[Patches] [ python-Patches-1434038 ] Make property use the getter's __doc__ if no doc argument
SourceForge.net
noreply at sourceforge.net
Wed Mar 8 19:10:03 CET 2006
Patches item #1434038, was opened at 2006-02-18 08:37
Message generated for change (Comment added) made by gbrandl
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1434038&group_id=5470
Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Core (C code)
Group: Python 2.5
>Status: Closed
>Resolution: Accepted
Priority: 5
Submitted By: Georg Brandl (birkenfeld)
>Assigned to: Georg Brandl (gbrandl)
Summary: Make property use the getter's __doc__ if no doc argument
Initial Comment:
As requested by Guido in
http://mail.python.org/pipermail/python-dev/2006-February/061320.html.
The patch adds a check that fget, fset and fdel are
callable, if present.
Please check for ref leaks et al.
----------------------------------------------------------------------
>Comment By: Georg Brandl (gbrandl)
Date: 2006-03-08 18:10
Message:
Logged In: YES
user_id=849994
Fine with me too.
Committed patch without callable checks as revision 42916.
----------------------------------------------------------------------
Comment By: Guido van Rossum (gvanrossum)
Date: 2006-03-08 17:47
Message:
Logged In: YES
user_id=6380
Sorry, I really don't like the callable checks. IMO they're
for wimps. You should be testing your code anyway, and then
bad property args will show up the first time they are called.
Without those, I'm fine with the changes. Discuss on
python-def if you disagree.
----------------------------------------------------------------------
Comment By: Georg Brandl (gbrandl)
Date: 2006-03-08 17:32
Message:
Logged In: YES
user_id=849994
Ping!
----------------------------------------------------------------------
Comment By: Guido van Rossum (gvanrossum)
Date: 2006-02-19 20:08
Message:
Logged In: YES
user_id=6380
I'll try to review this ASAP.
----------------------------------------------------------------------
Comment By: Georg Brandl (birkenfeld)
Date: 2006-02-18 18:51
Message:
Logged In: YES
user_id=1188172
Thanks for the review. Attaching new patches with your
corrections. I also added a DECREF which I think is necessary.
----------------------------------------------------------------------
Comment By: Alex Martelli (aleax)
Date: 2006-02-18 15:21
Message:
Logged In: YES
user_id=60314
in property-get-doc.diff:
if doc is None and fget.__doc__ is not None:
would raise a confusing TypeError when doc is fget is None -- check for that
case explicitly to raise a specific exception. Also, property(fset=foo) used to
work and thus must keep working. Similarly, the C code
if ((get_doc = PyObject_GetAttrString(get, "__doc__")))
must reset the errorstate if get_doc is NULL.
in property-get-doc-2.diff:
Add unittest to check that property(fset=somecallable) keeps working.
Alex
----------------------------------------------------------------------
Comment By: Georg Brandl (birkenfeld)
Date: 2006-02-18 09:51
Message:
Logged In: YES
user_id=1188172
Adding docs and test suite changes.
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1434038&group_id=5470
More information about the Patches
mailing list