New submission from Serhiy Storchaka: Example:
>>> import socket >>> x = socket.AddressFamily.from_bytes(b'\1', 'big') >>> type(x) <enum 'AddressFamily'> >>> int(x) 1 >>> str(x) Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/home/serhiy/py/cpython/Lib/enum.py", line 464, in __str__ return "%s.%s" % (self.__class__.__name__, self._name_) AttributeError: 'AddressFamily' object has no attribute '_name_' >>> repr(x) Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/home/serhiy/py/cpython/Lib/enum.py", line 461, in __repr__ self.__class__.__name__, self._name_, self._value_) AttributeError: 'AddressFamily' object has no attribute '_name_' ---------- components: Library (Lib) messages: 237864 nosy: barry, eli.bendersky, ethan.furman, serhiy.storchaka priority: normal severity: normal status: open title: Enum.from_bytes() is broken type: behavior versions: Python 3.4, Python 3.5 _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue23640> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com