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

@LostBenjamin LostBenjamin commented Jun 15, 2022

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

@cpython-cla-bot cpython-cla-bot bot commented Jun 15, 2022

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

Click the button to sign:
CLA not signed

@bedevere-bot
Copy link

@bedevere-bot bedevere-bot commented Jun 15, 2022

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 awaiting review labels Jun 15, 2022
@serhiy-storchaka
Copy link
Member

@serhiy-storchaka serhiy-storchaka commented Jun 16, 2022

No, it is the correct order.

@LostBenjamin
Copy link
Author

@LostBenjamin LostBenjamin commented Jun 16, 2022

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

@serhiy-storchaka serhiy-storchaka commented Jun 16, 2022

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
Author

@LostBenjamin LostBenjamin commented Jun 16, 2022

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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants