This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: zlib: Expose zlibVersion to query runtime version of zlib
Type: enhancement Stage: resolved
Components: Library (Lib) Versions: Python 3.3
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: nadeem.vawda Nosy List: eric.araujo, nadeem.vawda, pitrou, python-dev, torsten
Priority: normal Keywords: patch

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:18adminsetgithub: 56515
2011-09-11 22:13:10nadeem.vawdasetstatus: open -> closed
messages: + msg143879

assignee: nadeem.vawda
resolution: fixed
stage: patch review -> resolved
2011-09-11 22:07:14python-devsetnosy: + python-dev
messages: + msg143878
2011-06-13 18:51:51torstensetfiles: + zlib_version_doc.diff

messages: + msg138267
2011-06-13 18:31:04torstensetfiles: + zlib_runtime_version.diff

messages: + msg138266
2011-06-10 17:14:57eric.araujosetnosy: + eric.araujo
2011-06-10 16:57:33pitrousetversions: - Python 2.7, Python 3.2
nosy: + pitrou

messages: + msg138111

stage: patch review
2011-06-10 06:51:42nadeem.vawdasetnosy: + nadeem.vawda
2011-06-10 01:02:56torstensetfiles: + zlibversion_py3.diff
2011-06-10 00:51:04torstencreate