Issue 19263: enum.py : Enum.new(). objclass (original) (raw)

Issue19263

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, ), 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:52 admin set github: 63462
2013-10-22 03:46:03 python-dev set status: open -> closednosy: + python-devmessages: + resolution: fixedstage: resolved
2013-10-21 20:48:24 ethan.furman set messages: +
2013-10-14 22:56:40 ethan.furman set assignee: ethan.furmanmessages: +
2013-10-14 22:47:00 CliffM create