[issue24766] Subclass of property doesn't preserve instance __doc__ when using doc= argument

2021-10-21 Thread Irit Katriel


Irit Katriel  added the comment:

Reproduced on 3.11.

--
nosy: +iritkatriel
versions: +Python 3.11 -Python 3.5, Python 3.6

___
Python tracker 

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



[issue24766] Subclass of property doesn't preserve instance __doc__ when using doc= argument

2017-06-29 Thread Erik Bray

Changes by Erik Bray :


--
pull_requests: +2546

___
Python tracker 

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



[issue24766] Subclass of property doesn't preserve instance __doc__ when using doc= argument

2016-05-02 Thread Erik Bray

Erik Bray added the comment:

Thanks for the updated patch. LGTM.

--

___
Python tracker 

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



[issue24766] Subclass of property doesn't preserve instance __doc__ when using doc= argument

2016-05-02 Thread Berker Peksag

Berker Peksag added the comment:

test_property_decorator_doc_writable fix has already been committed in 
cc1aa0e88626.

Here's an updated patch:

* Synced with the default branch
* Adapted the test from duplicate issue 25757 (written by Torsten Landschoff)

--
nosy: +berker.peksag, torsten
stage: test needed -> patch review
Added file: http://bugs.python.org/file42683/issue24766.diff

___
Python tracker 

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



[issue24766] Subclass of property doesn't preserve instance __doc__ when using doc= argument

2015-09-18 Thread Erik Bray

Erik Bray added the comment:

Actually, of course that test would fail when run repeatedly--it sets the 
property docstring from 'Eggs' to 'Spam' on the first run, but then doesn't set 
it back to its original value.  Since the PropertyWritableDocs class used in 
that test is module-level it doesn't get reset.

I'd just update that test to return the docstring to its original value if you 
want it to pass under such a condition.

--

___
Python tracker 

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



[issue24766] Subclass of property doesn't preserve instance __doc__ when using doc= argument

2015-09-18 Thread Erik Bray

Erik Bray added the comment:

Attached an additional patch to test_property_decorator_doc_writable so that it 
can pass on repeated runs.

--
Added file: http://bugs.python.org/file40504/property-doc-test2.patch

___
Python tracker 

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



[issue24766] Subclass of property doesn't preserve instance __doc__ when using doc= argument

2015-09-18 Thread Ethan Furman

Ethan Furman added the comment:

Thanks for checking that out, Erik.  I was hoping it was a testing issue, but I 
ran out of time to verify.

--

___
Python tracker 

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



[issue24766] Subclass of property doesn't preserve instance __doc__ when using doc= argument

2015-09-17 Thread Ethan Furman

Changes by Ethan Furman :


--
nosy:  -larry

___
Python tracker 

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



[issue24766] Subclass of property doesn't preserve instance __doc__ when using doc= argument

2015-09-17 Thread Ethan Furman

Ethan Furman added the comment:

ethan@code:~/source/python/issue25147$ ./python -m test.regrtest -R3:3 
test_property
[1/1] test_property

Eggs  # from print() inside test

beginning 6 repetitions
123456

Spam  # the new value from the previous run seems stuck

test test_property failed -- Traceback (most recent call last):
  File "/home/ethan/source/python/issue25147/Lib/test/test_property.py", line 
175, in test_property_decorator_doc_writable
self.assertEqual(sub.__class__.spam.__doc__, 'Eggs')
AssertionError: 'Spam' != 'Eggs'
- Spam
+ Eggs


1 test failed:
test_property

--

___
Python tracker 

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



[issue24766] Subclass of property doesn't preserve instance __doc__ when using doc= argument

2015-08-14 Thread Erik Bray

Erik Bray added the comment:

Sorry for the hold up.  Attached is another diff providing a test.  I think 
this is all that's really needed (since this is just a special case of the 
issue already tested for in this particular test class.

--
Added file: http://bugs.python.org/file40181/property-doc-test.patch

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



[issue24766] Subclass of property doesn't preserve instance __doc__ when using doc= argument

2015-08-14 Thread Ethan Furman

Ethan Furman added the comment:

Larry, can we get this into 3.5?  I'll create a pull-request in a couple days.

--
nosy: +larry

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



[issue24766] Subclass of property doesn't preserve instance __doc__ when using doc= argument

2015-08-01 Thread Serhiy Storchaka

Changes by Serhiy Storchaka storch...@gmail.com:


--
nosy: +r.david.murray

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



[issue24766] Subclass of property doesn't preserve instance __doc__ when using doc= argument

2015-07-31 Thread Ethan Furman

Changes by Ethan Furman et...@stoneleaf.us:


--
nosy: +ethan.furman

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



[issue24766] Subclass of property doesn't preserve instance __doc__ when using doc= argument

2015-07-31 Thread Ethan Furman

Ethan Furman added the comment:

Looks good so far.  Let's get some tests in place.

--
stage:  - test needed
type:  - behavior
versions: +Python 3.5, Python 3.6

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



[issue24766] Subclass of property doesn't preserve instance __doc__ when using doc= argument

2015-07-31 Thread Erik Bray

New submission from Erik Bray:

This issue is directly related to http://bugs.python.org/issue5890, the 
solution to which I think was incomplete.

The examples below use a trivial subclass of property (but apply as well to a 
less trivial one):

 class myproperty(property): pass
...

When using myproperty with the decorator syntax, or simply without specifying a 
doc= argument, the docstring is properly inherited from the getter, as was 
fixed by issue5890:

 class A:
... @myproperty
... def foo(self):
... The foo.
... return 1
... 
 A.foo.__doc__
'The foo.'

However, when using the doc= argument, this behavior is broken:

 class B:
... def _get_foo(self): return 1
... foo = myproperty(_get_foo, doc=The foo.)
... 
 B.foo.__doc__
 B.foo.__doc__ is None
True


The attached patch resolves the issue by applying the special case for 
subclasses more generally.  If this looks good I'll add a test as well.

One thing I went back and forth on in the if (Py_TYPE(self) != 
PyProperty_Type) block was whether or not to then deref prop-prop_doc and 
set it to NULL, since I don't think it's needed anymore at this point.  But I 
decided it was ultimately harmless to leave it.

--
components: Interpreter Core
files: property-doc.patch
keywords: patch
messages: 247756
nosy: erik.bray
priority: normal
severity: normal
status: open
title: Subclass of property doesn't preserve instance __doc__ when using doc= 
argument
Added file: http://bugs.python.org/file40086/property-doc.patch

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