Bug 1964955
Summary: | pyproj fails to build with Python 3.10: TypeError: invalid Flag 'GeodIntermediateFlag' -- missing values: 4, 8, 32, 64, 128, 512, 1024, 2048 | ||
---|---|---|---|
Product: | [Fedora] Fedora | Reporter: | Tomáš Hrnčiar <thrnciar> |
Component: | pyproj | Assignee: | Jos de Kloe <josdekloe> |
Status: | CLOSED RAWHIDE | QA Contact: | Fedora Extras Quality Assurance <extras-qa> |
Severity: | unspecified | Docs Contact: | |
Priority: | unspecified | ||
Version: | rawhide | CC: | e, josdekloe, mhroncok, thrnciar |
Target Milestone: | --- | ||
Target Release: | --- | ||
Hardware: | Unspecified | ||
OS: | Unspecified | ||
Whiteboard: | |||
Fixed In Version: | Doc Type: | If docs needed, set a value | |
Doc Text: | Story Points: | --- | |
Clone Of: | Environment: | ||
Last Closed: | 2021-05-26 19:53:15 UTC | Type: | Bug |
Regression: | --- | Mount Type: | --- |
Documentation: | --- | CRM: | |
Verified Versions: | Category: | --- | |
oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
Cloudforms Team: | --- | Target Upstream Version: | |
Embargoed: | |||
Bug Depends On: | |||
Bug Blocks: | 1890881 |
Description
Tomáš Hrnčiar
2021-05-26 12:24:24 UTC
Hi Tomáš, thanks a lot for reporting this issue. Using the COPR test possibility that you provided I could reproduce the problem on my local machine. I think this is caused by some undocumented behaviour in python 3.10.0b1 (or maybe I could just not find it in the documentation or maybe it is a bug in this python version?). Anyway, thanks to the COPR test possibility I could quickly zoom in to the problem. It seems that it is no longer allowed in this python version to define an enum.IntFlag subclass with a sequence of non consecutive bit values. And this is how IntFlag is used at the moment in the pyproj/enum.py module. If I add dummy flag constants to ensure the full range of bits between the minimum and maximum used value is defined then the code runs just fine again, also for python 3.10.0b1, in my local mock test. I will now kick off a koji build for regular rawhide to ensure I did not break anything there. This change seem to have introduced the behavior: https://github.com/python/cpython/commit/7aaeb2a3d682ecba125c33511e4b4796021d2f82 I've reported https://bugs.python.org/issue44242 The koji build in rawhide succeeded for python 3.9.5, so you can try to re-build pyproj now in COPR. Miro, thanks for reporting this to bugs.python.org. From your answer I get that this is actual new behavior for python3.10.0b1 and not a bug in itself, but more a lack in the documentation, so I will inform upstream about this. From the change in git it seems that another way to solve this would be to use something like: class GeodIntermediateFlag(IntFlag, boundary=enum.KEEP): in stead of: class GeodIntermediateFlag(IntFlag): But actually I am not sure if I like that. I find that a lot less obvious to understand when just reading the code. Also, boundary=enum.KEEP is not yet available in Python <= 3.9, so you would need to use something a bit far-fetched for compatibility, e.g.: try: from enum import IntFlag, KEEP INTFLAG_KWARGS = {'boundary': KEEP} except ImportError: INTFLAG_KWARGS = {} class GeodIntermediateFlag(IntFlag, **INTFLAG_KWARGS): ... I would not jump into conclusions whether or not this is a bug or just missing documentation. Backwards incompatible changes in Python have rules and boundary=enum.KEEP might just as well become the default. However, your solution with UNUSED enum values gets the job done, so I'll close this as fixed. Thanks! |