[issue25757] Subclasses of property lose docstring

Torsten Landschoff report at bugs.python.org
Sat Nov 28 04:42:34 EST 2015


Torsten Landschoff added the comment:

Prompted by Emanuel's comment I ran the test with repetitions. This does not actually test his assertion that I missed a decref since he referred to the error case when setting the __doc__ key of the instance dict fails. But I was curious none the less.

I was shocked that this failed with

```
torsten at defiant:~/mirror/cpython$ make test TESTOPTS="-R 3:2 test_property"
...
test test_property failed -- Traceback (most recent call last):
  File "/home/torsten/mirror/cpython/Lib/test/test_property.py", line 172, in test_property_decorator_doc_writable
    self.assertEqual(sub.__class__.spam.__doc__, 'Eggs')
AssertionError: 'Spam' != 'Eggs'
```

But this was not introduced by my changes, rather it is an existing bug in the tests: test_property_decorator_doc_writable modifies a class created on module level so the second repetition sees the already updated class.

fix_repetitions.diff contains a fix for this problem (by defining the class locally in the test method).

While at it I introduced a refleak on purpose and this is correctly reported by the tests. Good to know how to test for this :-)

----------
Added file: http://bugs.python.org/file41183/fix_repetitions.diff

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue25757>
_______________________________________


More information about the Python-bugs-list mailing list