Skip to content

Conversation

vstinner
Copy link
Member

@vstinner vstinner commented Feb 4, 2020

Restore PyObject_IsInstance() comment explaining why only tuples of
types are accepted, but not general sequence. Comment written by
Guido van Rossum in commit 03290ec
which implements isinstance(x, (A, B, ...)). The comment was lost in
a PyObject_IsInstance() optimization:
commit ec569b7.

Cleanup also the code. recursive_isinstance() is no longer recursive,
so rename it to object_isinstance(), whereas object_isinstance() is
recursive and so rename it to object_recursive_isinstance().

https://bugs.python.org/issue2534

Restore PyObject_IsInstance() comment explaining why only tuples of
types are accepted, but not general sequence. Comment written by
Guido van Rossum in commit 03290ec
which implements isinstance(x, (A, B, ...)). The comment was lost in
a PyObject_IsInstance() optimization:
commit ec569b7.

Cleanup also the code. recursive_isinstance() is no longer recursive,
so rename it to object_isinstance(), whereas object_isinstance() is
recursive and so rename it to object_recursive_isinstance().
@vstinner vstinner changed the title Restore PyObject_IsInstance() comment bpo-2534: Restore PyObject_IsInstance() comment Feb 4, 2020
@codecov
Copy link

codecov bot commented Feb 4, 2020

Codecov Report

Merging #18345 into master will decrease coverage by 0.00%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master   #18345      +/-   ##
==========================================
- Coverage   82.11%   82.11%   -0.01%     
==========================================
  Files        1954     1954              
  Lines      583267   583267              
  Branches    44406    44406              
==========================================
- Hits       478962   478954       -8     
- Misses      94664    94672       +8     
  Partials     9641     9641              
Impacted Files Coverage Δ
Objects/listobject.c 90.49% <0.00%> (-0.70%) ⬇️
Lib/test/test_random.py 96.47% <0.00%> (-0.31%) ⬇️
Modules/_io/bufferedio.c 90.78% <0.00%> (+0.29%) ⬆️
Lib/_weakrefset.py 59.86% <0.00%> (+0.68%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update b6999e5...9e56c5f. Read the comment docs.

@vstinner vstinner merged commit 850a4bd into python:master Feb 4, 2020
@vstinner vstinner deleted the object_isinstance branch February 4, 2020 12:42
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.

3 participants