Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bpo-32492: Tweak _collections._tuplegetter. #11367

Merged
merged 8 commits into from
Dec 31, 2018

Conversation

serhiy-storchaka
Copy link
Member

@serhiy-storchaka serhiy-storchaka commented Dec 30, 2018

  • Remove the docstrings cache.
  • Improve tests.
  • Unify names of tp_descr_get and tp_descr_set functions.

https://bugs.python.org/issue32492

* Remove the docstrings cache.
* Improve tests.
* Unify names of tp_descr_get and tp_descr_set functions.
@rhettinger
Copy link
Contributor

Consider adding another test for inspect.isdatadescriptor(Point.x)

@rhettinger
Copy link
Contributor

If caching is taken out, then docstring interning should be added back.

Python 3.8.0a0 (heads/pr_11367:906c21fb8b, Dec 30 2018, 14:49:20)
[Clang 10.0.0 (clang-1000.11.45.5)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from collections import namedtuple
>>> P = namedtuple('P', ['m', 'n'])
>>> Q = namedtuple('Q', ['o', 'p'])
>>> P.m.__doc__ is Q.o.__doc__
False
>>> P.m.__doc__ == Q.o.__doc__
True

@rhettinger
Copy link
Contributor

Also, the test for the exact help() string seems fragile (it depends on the exact spacing and formatting of the help() output). Instead, just check for the presence of the docstring or check that it is data descriptor and leave it at that.

@serhiy-storchaka serhiy-storchaka merged commit 052b2df into python:master Dec 31, 2018
@serhiy-storchaka serhiy-storchaka deleted the tuplegetter2 branch December 31, 2018 12:15
csabella pushed a commit to csabella/cpython that referenced this pull request Dec 31, 2018
* Replace the docstrings cache with sys.intern().
* Improve tests.
* Unify names of tp_descr_get and tp_descr_set functions.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants