[issue18801] inspect.classify_class_attrs() misclassifies object.__new__()

2014-01-31 Thread Roundup Robot

Roundup Robot added the comment:

New changeset c38f99554be4 by Yury Selivanov in branch 'default':
inspect.classify_class_attrs: Classify object.__new__ and __init__ correctly 
#18801
http://hg.python.org/cpython/rev/c38f99554be4

--
nosy: +python-dev

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue18801
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue18801] inspect.classify_class_attrs() misclassifies object.__new__()

2014-01-31 Thread Yury Selivanov

Yury Selivanov added the comment:

Not sure if we need to backport this to older python versions

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue18801
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue18801] inspect.classify_class_attrs() misclassifies object.__new__()

2014-01-31 Thread Yury Selivanov

Changes by Yury Selivanov yselivanov...@gmail.com:


--
resolution:  - fixed
status: open - closed

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue18801
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue18801] inspect.classify_class_attrs() misclassifies object.__new__()

2014-01-31 Thread Roundup Robot

Roundup Robot added the comment:

New changeset d0f95094033d by Yury Selivanov in branch 'default':
NEWS: Add news item for #18801
http://hg.python.org/cpython/rev/d0f95094033d

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue18801
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue18801] inspect.classify_class_attrs() misclassifies object.__new__()

2014-01-29 Thread Yury Selivanov

Yury Selivanov added the comment:

Tim, Eric,
Please review the attached patch.

--
keywords: +patch
nosy: +tim.peters, yselivanov
Added file: http://bugs.python.org/file33809/inspect_classify_01.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue18801
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue18801] inspect.classify_class_attrs() misclassifies object.__new__()

2013-08-21 Thread Eric Snow

New submission from Eric Snow:

 pprint.pprint(inspect.classify_class_attrs(object))
[Attribute(name='__class__', kind='data', defining_class=class 'object', 
object=attribute '__class__' of 'object' objects),
...
 Attribute(name='__init__', kind='method', defining_class=class 'object', 
object=slot wrapper '__init__' of 'object' objects),
...
 Attribute(name='__new__', kind='data', defining_class=class 'object', 
object=built-in method __new__ of type object at 0x8aee20),
...
]

I haven't had a chance to look into why __new__() falls through the cracks but 
expect it's due to how __new__() is treated like a staticmethod without being 
one.  I suppose there could be other similar cases, but __new__() is probably 
the only oddball here.

An extra test using isbuiltin() fixes this.

 else:
 obj_via_getattr = getattr(cls, name)
 if (ismethod(obj_via_getattr) or
-ismethoddescriptor(obj_via_getattr)):
+ismethoddescriptor(obj_via_getattr) or
+isbuiltin(obj_via_getattr)):
 kind = method
 else:
 kind = data

--
components: Library (Lib)
messages: 195818
nosy: eric.snow
priority: normal
severity: normal
stage: test needed
status: open
title: inspect.classify_class_attrs() misclassifies object.__new__()
type: behavior
versions: Python 2.7, Python 3.3, Python 3.4

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue18801
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com