X Tutup
The Wayback Machine - https://web.archive.org/web/20240714205642/https://github.com/python/cpython/pull/93869
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

Fix a bug about wrong order of function arguments #93869

Closed
wants to merge 1 commit into from

Conversation

LostBenjamin
Copy link
Contributor

Hi,

This pull request is a fix to a potential bug about wrong order of function arguments at Lib/test/test_descr.py. Please check the changes.

Best,
Jingxuan

@cpython-cla-bot
Copy link

The following commit authors need to sign the Contributor License Agreement:

Click the button to sign:
CLA not signed

@bedevere-bot
Copy link

Most changes to Python require a NEWS entry.

Please add it using the blurb_it web app or the blurb command-line tool.

@bedevere-bot bedevere-bot added tests Tests in the Lib/test dir awaiting review labels Jun 15, 2022
@serhiy-storchaka
Copy link
Member

No, it is the correct order.

@LostBenjamin
Copy link
Contributor Author

Why?

The documentation says that the first argument of isinstance is the object and the second argument is the class.

@serhiy-storchaka
Copy link
Member

The first argument is the object (its value does not matter, it is ignored in this test in any case). The second argument can be not only a class, but also a tuple or an arbitrary object with the __instancecheck__() method. The test checks that isinstance(x, y) calls y.__instancecheck__().

@LostBenjamin
Copy link
Contributor Author

Thank you for the explanation!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting review tests Tests in the Lib/test dir
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants
X Tutup