Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

zlib: Expose zlibVersion to query runtime version of zlib #56515

Closed
Bluehorn mannequin opened this issue Jun 10, 2011 · 6 comments
Closed

zlib: Expose zlibVersion to query runtime version of zlib #56515

Bluehorn mannequin opened this issue Jun 10, 2011 · 6 comments
Labels
stdlib Python modules in the Lib dir type-feature A feature request or enhancement

Comments

@Bluehorn
Copy link
Mannequin

Bluehorn mannequin commented Jun 10, 2011

BPO 12306
Nosy @pitrou, @merwok, @Bluehorn
Files
  • zlibversion.diff: Patch for 2.7 branch
  • zlibversion_py3.diff: Patch for Python 3
  • zlib_runtime_version.diff: Updated patch
  • zlib_version_doc.diff: Documentation for ZLIB_VERSION
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = None
    closed_at = <Date 2011-09-11.22:13:10.028>
    created_at = <Date 2011-06-10.00:51:03.953>
    labels = ['type-feature', 'library']
    title = 'zlib: Expose zlibVersion to query runtime version of zlib'
    updated_at = <Date 2011-09-11.22:13:10.027>
    user = 'https://github.com/Bluehorn'

    bugs.python.org fields:

    activity = <Date 2011-09-11.22:13:10.027>
    actor = 'nadeem.vawda'
    assignee = 'nadeem.vawda'
    closed = True
    closed_date = <Date 2011-09-11.22:13:10.028>
    closer = 'nadeem.vawda'
    components = ['Library (Lib)']
    creation = <Date 2011-06-10.00:51:03.953>
    creator = 'torsten'
    dependencies = []
    files = ['22307', '22308', '22343', '22344']
    hgrepos = []
    issue_num = 12306
    keywords = ['patch']
    message_count = 6.0
    messages = ['138044', '138111', '138266', '138267', '143878', '143879']
    nosy_count = 5.0
    nosy_names = ['pitrou', 'nadeem.vawda', 'eric.araujo', 'torsten', 'python-dev']
    pr_nums = []
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'enhancement'
    url = 'https://bugs.python.org/issue12306'
    versions = ['Python 3.3']

    @Bluehorn
    Copy link
    Mannequin Author

    Bluehorn mannequin commented Jun 10, 2011

    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).

    @Bluehorn Bluehorn mannequin added stdlib Python modules in the Lib dir type-feature A feature request or enhancement labels Jun 10, 2011
    @pitrou
    Copy link
    Member

    pitrou commented Jun 10, 2011

    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 PEP-8-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.

    @Bluehorn
    Copy link
    Mannequin Author

    Bluehorn mannequin commented Jun 13, 2011

    Here is an updated patch:

    • Function zlibVersion() replaced by module-level constant ZLIB_RUNTIME_VERSION
    • Added documentation (with versionadded: 3.3)

    @Bluehorn
    Copy link
    Mannequin Author

    Bluehorn mannequin commented Jun 13, 2011

    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?

    @python-dev
    Copy link
    Mannequin

    python-dev mannequin commented Sep 11, 2011

    New changeset b21d1de6d78e by Nadeem Vawda in branch 'default':
    Issue bpo-12306: Add ZLIB_RUNTIME_VERSION to the zlib module.
    http://hg.python.org/cpython/rev/b21d1de6d78e

    @nadeemvawda
    Copy link
    Mannequin

    nadeemvawda mannequin commented Sep 11, 2011

    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!

    @nadeemvawda nadeemvawda mannequin closed this as completed Sep 11, 2011
    @nadeemvawda nadeemvawda mannequin self-assigned this Sep 11, 2011
    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    stdlib Python modules in the Lib dir type-feature A feature request or enhancement
    Projects
    None yet
    Development

    No branches or pull requests

    1 participant