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.

Author hroncok
Recipients John Belmonte, Manjusaka, ethan.furman, hauntsaninja, hroncok, jbelmonte, veky
Date 2021-05-26.19:31:42
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1622057503.27.0.852704547544.issue44242@roundup.psfhosted.org>
In-reply-to
Content
With the change introduced in https://bugs.python.org/issue38250 https://github.com/python/cpython/commit/7aaeb2a3d682ecba125c33511e4b4796021d2f82 I observe a regression in behavior of enum.IntFlag with missing values.

Consider this code (from pyproj):

    from enum import IntFlag

    class GeodIntermediateFlag(IntFlag):
        DEFAULT = 0x0

        NPTS_MASK = 0xF
        NPTS_ROUND = 0x0
        NPTS_CEIL = 0x1
        NPTS_TRUNC = 0x2
         
        DEL_S_MASK = 0xF0
        DEL_S_RECALC = 0x00
        DEL_S_NO_RECALC = 0x10
      
        AZIS_MASK = 0xF00
        AZIS_DISCARD = 0x000
        AZIS_KEEP = 0x100

This is a valid code in Python 3.9, however produces a TypeError in Python 3.10.0b1:

    Traceback (most recent call last):
      File "intflag.py", line 3, in <module>
        class GeodIntermediateFlag(IntFlag):
      File "/usr/lib64/python3.10/enum.py", line 544, in __new__
        raise TypeError(
    TypeError: invalid Flag 'GeodIntermediateFlag' -- missing values: 4, 8, 32, 64, 128, 512, 1024, 2048


Since I don't see this behavior mentioned in https://docs.python.org/3.10/library/enum.html or https://docs.python.org/3.10/whatsnew/3.10.html or https://docs.python.org/3.10/whatsnew/changelog.html I believe this is a regression.
History
Date User Action Args
2021-05-26 19:31:43hroncoksetrecipients: + hroncok, jbelmonte, ethan.furman, veky, Manjusaka, John Belmonte, hauntsaninja
2021-05-26 19:31:43hroncoksetmessageid: <1622057503.27.0.852704547544.issue44242@roundup.psfhosted.org>
2021-05-26 19:31:43hroncoklinkissue44242 messages
2021-05-26 19:31:42hroncokcreate