Robert Gomułka added the comment:
It turns out that enum34 backports module was the culprit (it was first on
search path). When using enum native module, everything works as expected:
> c:\Python\Python36-32\python.exe -I
Python 3.6.2 (v3.6.2:5fd33b5, Jul 8 2017, 04:14:34) [MSC v.1900 32 bit
(Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import enum
>>> enum
<module 'enum' from 'c:\\Python\\Python36-32\\lib\\enum.py'>
>>> @enum.unique
... class A(enum.IntEnum):
... a = 1
... name = 2
... value = 3
...
>>> exit()
> c:\Python\Python36-32\python.exe
Python 3.6.2 (v3.6.2:5fd33b5, Jul 8 2017, 04:14:34) [MSC v.1900 32 bit
(Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import enum
>>> enum
<module 'enum' from 'C:\\Python27\\Lib\\site-packages\\enum\\__init__.py'>
>>> @enum.unique
... class A(enum.IntEnum):
... a = 1
... name = 2
... value = 3
...
Traceback (most recent call last):
File "<stdin>", line 2, in <module>
File "C:\Python27\Lib\site-packages\enum\__init__.py", line 835, in unique
(enumeration, duplicate_names)
ValueError: duplicate names found in <enum 'A'>: a -> A.name, name -> A.name,
value -> A.name
Sorry for the noise.
----------
resolution: -> third party
stage: -> resolved
status: open -> closed
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue31587>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com