Issue 12306: zlib: Expose zlibVersion to query runtime version of zlib (original) (raw)

Created on 2011-06-10 00:51 by torsten, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
zlibversion.diff torsten,2011-06-10 00:51 Patch for 2.7 branch review
zlibversion_py3.diff torsten,2011-06-10 01:02 Patch for Python 3 review
zlib_runtime_version.diff torsten,2011-06-13 18:31 Updated patch review
zlib_version_doc.diff torsten,2011-06-13 18:51 Documentation for ZLIB_VERSION
Messages (6)
msg138044 - (view) Author: Torsten Landschoff (torsten) * Date: 2011-06-10 00:51
I am currently fighting a curious problem in using zlib from Python: Decompression completes but sometimes the resulting output does not match a sha224 hash of the expected output. I deployed a zlib 1.2.5 with our PyInstaller output but the problem persists. I would like to check that the program is actually using the right zlib version. zlib provides the function zlibVersion to access the actual run time version. The attached patch exposes this function from the zlib module. I also added a unit test to check that the function is there and the output matches ZLIB_VERSION (which should match on the build machine).
msg138111 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2011-06-10 16:57
Good idea, and thanks for posting a patch! This is a new feature, so 3.3-only. Also, you'll need to update the docs (Doc/library/zlib.rst, presumably) to add the new module method/attribute (with a suitable "versionadded" tag). Nitpicking: - "zlibVersion" isn't PEP8-compliant - semantically it should probably be a module-level attribute, rather than a method; after all it's kind of a constant; perhaps ZLIB_RUNTIME_VERSION? Also, I see that ZLIB_VERSION itself isn't documented, it would be nice to have a separate patch to fix that.
msg138266 - (view) Author: Torsten Landschoff (torsten) * Date: 2011-06-13 18:31
Here is an updated patch: * Function zlibVersion() replaced by module-level constant ZLIB_RUNTIME_VERSION * Added documentation (with versionadded: 3.3)
msg138267 - (view) Author: Torsten Landschoff (torsten) * Date: 2011-06-13 18:51
Documentation for ZLIB_VERSION. I just notice that it makes no sense to add the version info to that section. Feel free to move the two snippets. I added a versionadded tag here as well (ZLIB_VERSION was already in Python 1.5). Is there any old release for that versionadded tags should be removed?
msg143878 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2011-09-11 22:07
New changeset b21d1de6d78e by Nadeem Vawda in branch 'default': Issue #12306: Add ZLIB_RUNTIME_VERSION to the zlib module. http://hg.python.org/cpython/rev/b21d1de6d78e
msg143879 - (view) Author: Nadeem Vawda (nadeem.vawda) * (Python committer) Date: 2011-09-11 22:13
I've committed your patches. I took the liberty of removing the "versionadded" tag for ZLIB_VERSION; I don't think many people will need to worry about compatibility with Python 1.5 ;-) Once again, thanks for the patches!
History
Date User Action Args
2022-04-11 14:57:18 admin set github: 56515
2011-09-11 22:13:10 nadeem.vawda set status: open -> closedmessages: + assignee: nadeem.vawdaresolution: fixedstage: patch review -> resolved
2011-09-11 22:07:14 python-dev set nosy: + python-devmessages: +
2011-06-13 18:51:51 torsten set files: + zlib_version_doc.diffmessages: +
2011-06-13 18:31:04 torsten set files: + zlib_runtime_version.diffmessages: +
2011-06-10 17:14:57 eric.araujo set nosy: + eric.araujo
2011-06-10 16:57:33 pitrou set versions: - Python 2.7, Python 3.2nosy: + pitroumessages: + stage: patch review
2011-06-10 06:51:42 nadeem.vawda set nosy: + nadeem.vawda
2011-06-10 01:02:56 torsten set files: + zlibversion_py3.diff
2011-06-10 00:51:04 torsten create