[issue18929] inspect.classify_class_attrs ignores metaclass

2013-09-14 Thread Roundup Robot
Roundup Robot added the comment: New changeset b0517bb271ad by Ethan Furman in branch 'default': Close #18929: inspect.classify_class_attrs will now search the metaclasses (last) to find where an attr was defined. http://hg.python.org/cpython/rev/b0517bb271ad -- nosy: +python-dev

[issue18929] inspect.classify_class_attrs ignores metaclass

2013-09-09 Thread Antoine Pitrou
Antoine Pitrou added the comment: So, even though __members__ does show up in dir(Color), classify_class_attrs incorrectly assigns its class. [...] So if getmembers() correctly reports it because it shows up in dir(), then classify_class_attrs should correctly identify it as well. Ok,

[issue18929] inspect.classify_class_attrs ignores metaclass

2013-09-09 Thread Ethan Furman
Ethan Furman added the comment: Cool. Latest patch has a slight doc fix for getmembers. Will commit on Friday if no other pertinent feedback. -- assignee: - ethan.furman stage: - patch review Added file: http://bugs.python.org/file31706/issue18929.stoneleaf.04.patch

[issue18929] inspect.classify_class_attrs ignores metaclass

2013-09-08 Thread Ethan Furman
Ethan Furman added the comment: Okay, taking a step back. It seems that currently inspect is geared towards instances and classes, not metaclasses. Consequently, so is help. So, how do we enhance inspect so that help can be metaclass aware? classify_class_attrs seems like an obvious choice,

[issue18929] inspect.classify_class_attrs ignores metaclass

2013-09-08 Thread Antoine Pitrou
Antoine Pitrou added the comment: It seems that currently inspect is geared towards instances and classes, not metaclasses. Consequently, so is help. I'm afraid I don't really understand what you're talking about. A metaclass is just a slightly different kind of class :-) def

[issue18929] inspect.classify_class_attrs ignores metaclass

2013-09-08 Thread Ethan Furman
Ethan Furman added the comment: Antoine, to answer all your questions at once, and using an Enum as the example: -- dir(Color) ['__class__', '__doc__', '__members__', '__module__', 'blue', 'green', 'red'] -- Color.__members__ mappingproxy(OrderedDict([('red', Color.red: 1), ('green',

[issue18929] inspect.classify_class_attrs ignores metaclass

2013-09-08 Thread Ethan Furman
Ethan Furman added the comment: This is a more useful help() -- patch attached. == Help on class Color in module __main__: class Color(enum.Enum) | Method resolution order: | Color | enum.Enum |

[issue18929] inspect.classify_class_attrs ignores metaclass

2013-09-07 Thread Antoine Pitrou
Antoine Pitrou added the comment: Of course it is causing tests to fail. You are changing behaviour of an existing API. Please find another solution. -- nosy: +pitrou ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18929

[issue18929] inspect.classify_class_attrs ignores metaclass

2013-09-05 Thread Ethan Furman
Ethan Furman added the comment: Another option with the global fix is to only add the metaclass to the mro if the metaclass is not 'type'. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18929

[issue18929] inspect.classify_class_attrs ignores metaclass

2013-09-04 Thread Ethan Furman
New submission from Ethan Furman: Part of the solution for Issue18693 is to have `inspect.classify_class_attrs()` properly consider the metaclass (or type) of the class when searching for the origination point of class attributes. The fix is changing line 325: -for base in (cls,) +

[issue18929] inspect.classify_class_attrs ignores metaclass

2013-09-04 Thread Ethan Furman
Changes by Ethan Furman et...@stoneleaf.us: Added file: http://bugs.python.org/file31594/local_fix.stoneleaf.01 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18929 ___

[issue18929] inspect.classify_class_attrs ignores metaclass

2013-09-04 Thread Ethan Furman
Changes by Ethan Furman et...@stoneleaf.us: Added file: http://bugs.python.org/file31595/global_fix.stoneleaf.01 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18929 ___

[issue18929] inspect.classify_class_attrs ignores metaclass

2013-09-04 Thread Ethan Furman
Ethan Furman added the comment: The global fix causes these two tests to fail: == FAIL: test_newstyle_mro (test.test_inspect.TestClassesAndFunctions) --