Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Python: Bugs

[issue5890] Subclassing property doesn't preserve the auto __doc__ behavior

 

 

Python bugs RSS feed   Index | Next | Previous | View Threaded


report at bugs

Nov 11, 2009, 9:09 AM

Post #1 of 7 (437 views)
Permalink
[issue5890] Subclassing property doesn't preserve the auto __doc__ behavior

Moriyoshi Koizumi <mozo+python [at] mozo> added the comment:

A subclass of property doesn't always have writable __doc__, especially
what is implemented in C. This actually causes a problem with
Boost.Python's StaticProperty.

References:
- http://mail.python.org/pipermail/cplusplus-sig/2009-August/014747.html
- http://lists.boost.org/Archives/boost/2009/10/157512.php
- https://bugs.launchpad.net/ubuntu/+source/boost1.38/+bug/457688

----------
nosy: +moriyoshi

_______________________________________
Python tracker <report [at] bugs>
<http://bugs.python.org/issue5890>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com


report at bugs

Nov 11, 2009, 6:18 PM

Post #2 of 7 (415 views)
Permalink
[issue5890] Subclassing property doesn't preserve the auto __doc__ behavior [In reply to]

Moriyoshi Koizumi <mozo+python [at] mozo> added the comment:

I created a patch against trunk and 2.6-maint that lets it simply ignore
the error that might happen during PyObject_SetAttrString();

----------
Added file: http://bugs.python.org/file15311/issue5890-refix-py2.6.patch

_______________________________________
Python tracker <report [at] bugs>
<http://bugs.python.org/issue5890>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com


report at bugs

Nov 11, 2009, 6:18 PM

Post #3 of 7 (408 views)
Permalink
[issue5890] Subclassing property doesn't preserve the auto __doc__ behavior [In reply to]

Moriyoshi Koizumi <mozo+python [at] mozo> added the comment:

and the other one

----------
Added file: http://bugs.python.org/file15312/issue5890-refix-trunk.patch

_______________________________________
Python tracker <report [at] bugs>
<http://bugs.python.org/issue5890>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com


report at bugs

Nov 15, 2009, 5:08 PM

Post #4 of 7 (387 views)
Permalink
[issue5890] Subclassing property doesn't preserve the auto __doc__ behavior [In reply to]

R. David Murray <rdmurray [at] bitdance> added the comment:

It seems to me that all that patch does is re-enable the bug (in the
extension class context) that the patch for this issue was a workaround
for. I think perhaps the correct fix is to look at how the __doc__
attribute is found in the general case and see if it can be fixed there,
allowing the removal of the workaround in property.

See for example this sub-thread on python-dev:

http://www.mail-archive.com/python-dev [at] python/msg42786.html

----------

_______________________________________
Python tracker <report [at] bugs>
<http://bugs.python.org/issue5890>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com


report at bugs

Nov 16, 2009, 5:28 AM

Post #5 of 7 (381 views)
Permalink
[issue5890] Subclassing property doesn't preserve the auto __doc__ behavior [In reply to]

Moriyoshi Koizumi <mozo+python [at] mozo> added the comment:

Sorry, I don't quite have an idea on the part "these patches reenable
the bug". The script of the first message yields exactly the same result
both with the original 2.6.4 and the patched. Assuming the weirdness
you referred to is different from 5890, I'd say the workaround
introduced by the original patch to property class didn't correctly
avoid the issue in the first place. I mean the fix should be fixed anyhow.

----------

_______________________________________
Python tracker <report [at] bugs>
<http://bugs.python.org/issue5890>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com


report at bugs

Nov 16, 2009, 5:51 AM

Post #6 of 7 (387 views)
Permalink
[issue5890] Subclassing property doesn't preserve the auto __doc__ behavior [In reply to]

R. David Murray <rdmurray [at] bitdance> added the comment:

Well, I haven't worked with boost or any other extension class that
defines a subclass of property. If MyProp is such a subclass, would
print Fro.baz.__doc__ print "Get a baz" in 2.6.2 but raise an error in
2.6.3/4, or would it print None?

Regardless of which one it does, I think there is a better fix than
patching the original patch in this issue, assuming I can code it and
get approval to apply it.

On the other hand, the suggested 'refix' may be appropriate for 2.6.5.

----------

_______________________________________
Python tracker <report [at] bugs>
<http://bugs.python.org/issue5890>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com


report at bugs

Nov 18, 2009, 9:28 PM

Post #7 of 7 (354 views)
Permalink
[issue5890] Subclassing property doesn't preserve the auto __doc__ behavior [In reply to]

Moriyoshi Koizumi <mozo+python [at] mozo> added the comment:

@r.david.murray

> If MyProp is such a subclass, would
> print Fro.baz.__doc__ print "Get a baz" in 2.6.2 but raise an error in
> 2.6.3/4, or would it print None?

Just let it return None as they were for now. I completely agree
there's a better fix like delegating the access to __doc__ to the base
class (property class in this specific case).

----------

_______________________________________
Python tracker <report [at] bugs>
<http://bugs.python.org/issue5890>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com

Python bugs RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.