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.

classification
Title: enum.py : Enum.__new__(). __objclass__
Type: enhancement Stage: resolved
Components: Tests Versions: Python 3.4
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: ethan.furman Nosy List: CliffM, ethan.furman, python-dev
Priority: normal Keywords: patch

Created on 2013-10-14 22:47 by CliffM, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
enum.patch CliffM, 2013-10-14 22:47 review
Messages (4)
msg199964 - (view) Author: CliffM (CliffM) Date: 2013-10-14 22:47
Is the assignment __objclass__ = enum_class  in enum.py(149) needed ?

I cannot find any other reference to it (even Google) and it seems that __class__ is already set to enum_class :


enum_member.__objclass__ = enum_class     < not sure what this is doing >

I have attached a patch that forces the assignment, but would rather understand what is intended here -- and test for that.
msg199966 - (view) Author: Ethan Furman (ethan.furman) * (Python committer) Date: 2013-10-14 22:56
It was originally put in to help inspect.classify_class_attrs, but recent subsequent changes (not yet committed, issue19030), make it unnecessary.

Whether or not it stays depends on the changes to inspect being committed.
msg200844 - (view) Author: Ethan Furman (ethan.furman) * (Python committer) Date: 2013-10-21 20:48
Well, with all the changes to inspect to properly locate attributes in the class and metaclass mro, __objclass__ is necessary to get the home class correct (without it inspect thinks it lives in the EnumMeta metaclass).
msg200871 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2013-10-22 03:46
New changeset b9019b942435 by Ethan Furman in branch 'default':
Close #19263:  add tests to ensure __objclass__ correctly set.
http://hg.python.org/cpython/rev/b9019b942435
History
Date User Action Args
2022-04-11 14:57:52adminsetgithub: 63462
2013-10-22 03:46:03python-devsetstatus: open -> closed

nosy: + python-dev
messages: + msg200871

resolution: fixed
stage: resolved
2013-10-21 20:48:24ethan.furmansetmessages: + msg200844
2013-10-14 22:56:40ethan.furmansetassignee: ethan.furman
messages: + msg199966
2013-10-14 22:47:00CliffMcreate