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

test.test_zlib.CompressObjectTestCase.test_flushes fails to parse ZLIB_VERSION with zlib-ng #112769

Closed
hroncok opened this issue Dec 5, 2023 · 5 comments · Fixed by #112771
Closed
Labels
tests Tests in the Lib/test dir type-bug An unexpected behavior, bug, or error

Comments

@hroncok
Copy link
Contributor

hroncok commented Dec 5, 2023

Bug report

Bug description:

Hello. Fedora is switching from zlib to zlib-ng. https://fedoraproject.org/wiki/Changes/ZlibNGTransition

zlib-ng defines ZLIB_VERSION as "1.3.0.zlib-ng":

https://github.com/zlib-ng/zlib-ng/blob/f3211aba349a1d4781d0d41cb00d29fb8325af06/zlib.h.in#L61

And test.test_zlib.CompressObjectTestCase.test_flushes fails to parse it a sequence of dot-separated integers:

ver = tuple(int(v) for v in zlib.ZLIB_RUNTIME_VERSION.split('.'))

Traceback (most recent call last):
  File "/builddir/build/BUILD/Python-3.12.0/Lib/test/test_zlib.py", line 477, in test_flushes
    ver = tuple(int(v) for v in zlib.ZLIB_RUNTIME_VERSION.split('.'))
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/builddir/build/BUILD/Python-3.12.0/Lib/test/test_zlib.py", line 477, in <genexpr>
    ver = tuple(int(v) for v in zlib.ZLIB_RUNTIME_VERSION.split('.'))
                ^^^^^^
ValueError: invalid literal for int() with base 10: 'zlib-ng'

Another test in this file already handles this differently via 4c7108a:

v = zlib.ZLIB_RUNTIME_VERSION.split('-', 1)[0].split('.')
if len(v) < 4:
v.append('0')
elif not v[-1].isnumeric():
v[-1] = '0'
v = tuple(map(int, v))

This could be made a function, so both the tests that need to compare the version could re-use it.

CPython versions tested on:

3.12, 3.13, CPython main branch

Operating systems tested on:

Linux

Linked PRs

@hroncok hroncok added the type-bug An unexpected behavior, bug, or error label Dec 5, 2023
@Eclips4 Eclips4 added the tests Tests in the Lib/test dir label Dec 5, 2023
@hroncok
Copy link
Contributor Author

hroncok commented Dec 5, 2023

I'm working on a PR.

@hroncok
Copy link
Contributor Author

hroncok commented Dec 5, 2023

I'm working on a PR.

Here it is: #112771

serhiy-storchaka pushed a commit that referenced this issue Dec 5, 2023
…-int suffix (GH-112771)

zlib-ng defines the version as "1.3.0.zlib-ng".
miss-islington pushed a commit to miss-islington/cpython that referenced this issue Dec 5, 2023
…th non-int suffix (pythonGH-112771)

zlib-ng defines the version as "1.3.0.zlib-ng".
(cherry picked from commit d384813)

Co-authored-by: Miro Hrončok <miro@hroncok.cz>
miss-islington pushed a commit to miss-islington/cpython that referenced this issue Dec 5, 2023
…th non-int suffix (pythonGH-112771)

zlib-ng defines the version as "1.3.0.zlib-ng".
(cherry picked from commit d384813)

Co-authored-by: Miro Hrončok <miro@hroncok.cz>
@Eclips4
Copy link
Member

Eclips4 commented Dec 5, 2023

Thanks for the report and fix @hroncok!

serhiy-storchaka pushed a commit that referenced this issue Dec 5, 2023
…ith non-int suffix (GH-112771) (GH-112774)

zlib-ng defines the version as "1.3.0.zlib-ng".
(cherry picked from commit d384813)

Co-authored-by: Miro Hrončok <miro@hroncok.cz>
serhiy-storchaka pushed a commit that referenced this issue Dec 5, 2023
…ith non-int suffix (GH-112771) (GH-112773)

zlib-ng defines the version as "1.3.0.zlib-ng".
(cherry picked from commit d384813)

Co-authored-by: Miro Hrončok <miro@hroncok.cz>
befeleme pushed a commit to fedora-python/cpython that referenced this issue Jan 25, 2024
…SION with non-int suffix (pythonGH-112771) (pythonGH-112774)

zlib-ng defines the version as "1.3.0.zlib-ng".
(cherry picked from commit d384813)
befeleme pushed a commit to fedora-python/cpython that referenced this issue Jan 25, 2024
…SION with non-int suffix (pythonGH-112771) (pythonGH-112774)

zlib-ng defines the version as "1.3.0.zlib-ng".
(cherry picked from commit d384813)

Co-authored-by: Miro Hrončok <miro@hroncok.cz>
befeleme pushed a commit to fedora-python/cpython that referenced this issue Jan 25, 2024
…SION with non-int suffix (pythonGH-112771) (pythonGH-112774)

zlib-ng defines the version as "1.3.0.zlib-ng".
(cherry picked from commit d384813)
befeleme pushed a commit to fedora-python/cpython that referenced this issue Jan 25, 2024
…SION with non-int suffix (pythonGH-112771) (pythonGH-112774)

zlib-ng defines the version as "1.3.0.zlib-ng".
(cherry picked from commit d384813)
befeleme pushed a commit to fedora-python/cpython that referenced this issue Jan 25, 2024
…SION with non-int suffix (pythonGH-112771) (pythonGH-112774)

zlib-ng defines the version as "1.3.0.zlib-ng".
(cherry picked from commit d384813)
aisk pushed a commit to aisk/cpython that referenced this issue Feb 11, 2024
…th non-int suffix (pythonGH-112771)

zlib-ng defines the version as "1.3.0.zlib-ng".
stratakis pushed a commit to stratakis/cpython that referenced this issue Feb 27, 2024
…SION with non-int suffix (pythonGH-112771) (pythonGH-112774)

zlib-ng defines the version as "1.3.0.zlib-ng".
(cherry picked from commit d384813)
hroncok added a commit to fedora-python/cpython that referenced this issue Mar 7, 2024
…SION with non-int suffix (pythonGH-112771) (pythonGH-112774)

zlib-ng defines the version as "1.3.0.zlib-ng".
(cherry picked from commit d384813)
stratakis pushed a commit to stratakis/cpython that referenced this issue Mar 11, 2024
…SION with non-int suffix (pythonGH-112771) (pythonGH-112774)

zlib-ng defines the version as "1.3.0.zlib-ng".
(cherry picked from commit d384813)
stratakis pushed a commit to stratakis/cpython that referenced this issue Mar 11, 2024
…SION with non-int suffix (pythonGH-112771) (pythonGH-112774)

zlib-ng defines the version as "1.3.0.zlib-ng".
(cherry picked from commit d384813)
stratakis pushed a commit to stratakis/cpython that referenced this issue Mar 20, 2024
…SION with non-int suffix (pythonGH-112771) (pythonGH-112774)

zlib-ng defines the version as "1.3.0.zlib-ng".
(cherry picked from commit d384813)
hrnciar pushed a commit to fedora-python/cpython that referenced this issue Mar 20, 2024
…SION with non-int suffix (pythonGH-112771) (pythonGH-112774)

zlib-ng defines the version as "1.3.0.zlib-ng".
(cherry picked from commit d384813)
hrnciar pushed a commit to fedora-python/cpython that referenced this issue Mar 20, 2024
…SION with non-int suffix (pythonGH-112771) (pythonGH-112774)

zlib-ng defines the version as "1.3.0.zlib-ng".
(cherry picked from commit d384813)
hrnciar pushed a commit to fedora-python/cpython that referenced this issue Mar 20, 2024
…SION with non-int suffix (pythonGH-112771) (pythonGH-112774)

zlib-ng defines the version as "1.3.0.zlib-ng".
(cherry picked from commit d384813)
stratakis pushed a commit to stratakis/cpython that referenced this issue Mar 20, 2024
…SION with non-int suffix (pythonGH-112771) (pythonGH-112774)

zlib-ng defines the version as "1.3.0.zlib-ng".
(cherry picked from commit d384813)
stratakis pushed a commit to stratakis/cpython that referenced this issue Mar 20, 2024
…SION with non-int suffix (pythonGH-112771) (pythonGH-112774)

zlib-ng defines the version as "1.3.0.zlib-ng".
(cherry picked from commit d384813)
stratakis pushed a commit to stratakis/cpython that referenced this issue Mar 20, 2024
…SION with non-int suffix (pythonGH-112771) (pythonGH-112774)

zlib-ng defines the version as "1.3.0.zlib-ng".
(cherry picked from commit d384813)
stratakis pushed a commit to stratakis/cpython that referenced this issue Mar 25, 2024
…SION with non-int suffix (pythonGH-112771) (pythonGH-112774)

zlib-ng defines the version as "1.3.0.zlib-ng".
(cherry picked from commit d384813)
hroncok added a commit to fedora-python/cpython that referenced this issue Mar 26, 2024
…SION with non-int suffix (pythonGH-112771) (pythonGH-112774)

zlib-ng defines the version as "1.3.0.zlib-ng".
(cherry picked from commit d384813)
mcepl pushed a commit to openSUSE-Python/cpython that referenced this issue Apr 2, 2024
…SION with non-int suffix (pythonGH-112771) (pythonGH-112774)

zlib-ng defines the version as "1.3.0.zlib-ng".
(cherry picked from commit d384813)
jessecomeau87 pushed a commit to jessecomeau87/Python that referenced this issue May 20, 2024
…-int suffix

zlib-ng defines the version as "1.3.0.zlib-ng".

https://github.com/zlib-ng/zlib-ng/blob/f3211aba349a1d4781d0d41cb00d29fb8325af06/zlib.h.in#L61

test.test_zlib.CompressObjectTestCase.test_flushes blew up with:

    Traceback (most recent call last):
      File "/builddir/build/BUILD/Python-3.12.0/Lib/test/test_zlib.py", line 477, in test_flushes
        ver = tuple(int(v) for v in zlib.ZLIB_RUNTIME_VERSION.split('.'))
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/builddir/build/BUILD/Python-3.12.0/Lib/test/test_zlib.py", line 477, in <genexpr>
        ver = tuple(int(v) for v in zlib.ZLIB_RUNTIME_VERSION.split('.'))
                    ^^^^^^
    ValueError: invalid literal for int() with base 10: 'zlib-ng'

This reuses logic from another test.

Fixes python/cpython#112769
@ned-deily
Copy link
Member

This issue is now affecting some older buildbots. Created backport PRs for 3.10, 3.9, and 3.8 security branches.

pablogsal pushed a commit that referenced this issue May 28, 2024
…E_VERSION with non-int suffix (GH-112771) (#119565)

[3.10] gh-112769: test_zlib: test_zlib: Fix comparison of ZLIB_RUNTIME_VERSION with non-int suffix

zlib-ng defines the version as "1.3.0.zlib-ng".
(cherry picked from commit d384813)

Co-authored-by: Miro Hrončok miro@hroncok.cz
ambv pushed a commit that referenced this issue May 30, 2024
…_VERSION with non-int suffix (GH-112771) (GH-119566)

zlib-ng defines the version as "1.3.0.zlib-ng".

(cherry picked from commit d384813)

Co-authored-by: Miro Hrončok miro@hroncok.cz
ambv pushed a commit that referenced this issue May 30, 2024
…_VERSION with non-int suffix (GH-112771) (GH-119567)

zlib-ng defines the version as "1.3.0.zlib-ng".

(cherry picked from commit d384813)

Co-authored-by: Miro Hrončok miro@hroncok.cz
@vstinner
Copy link
Member

vstinner commented Sep 2, 2024

I closed issue gh-98567 as a duplicate of this issue.

Glyphack pushed a commit to Glyphack/cpython that referenced this issue Sep 2, 2024
…th non-int suffix (pythonGH-112771)

zlib-ng defines the version as "1.3.0.zlib-ng".
hrnciar pushed a commit to fedora-python/cpython that referenced this issue Sep 9, 2024
…SION with non-int suffix (pythonGH-112771) (pythonGH-112774)

zlib-ng defines the version as "1.3.0.zlib-ng".
(cherry picked from commit d384813)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
tests Tests in the Lib/test dir type-bug An unexpected behavior, bug, or error
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants