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

Remove old-style classes from test_cmath #98727

Closed
sobolevn opened this issue Oct 26, 2022 · 1 comment
Closed

Remove old-style classes from test_cmath #98727

sobolevn opened this issue Oct 26, 2022 · 1 comment
Assignees
Labels
stdlib Python modules in the Lib dir tests Tests in the Lib/test dir type-bug An unexpected behavior, bug, or error

Comments

@sobolevn
Copy link
Member

sobolevn commented Oct 26, 2022

Right now old-style classes are long gone. But, test_cmath still tests for them and has an outdated comment about them being not fully supported:

# TypeError should be raised for classes not providing
# either __complex__ or __float__, even if they provide
# __int__ or __index__. An old-style class
# currently raises AttributeError instead of a TypeError;
# this could be considered a bug.
self.assertRaises(TypeError, f, NeitherComplexNorFloat())
self.assertRaises(TypeError, f, MyInt())
self.assertRaises(Exception, f, NeitherComplexNorFloatOS())

I will send a PR with removal of old style classes, correct exception handling, and comment rewording.

@sobolevn sobolevn added type-bug An unexpected behavior, bug, or error tests Tests in the Lib/test dir stdlib Python modules in the Lib dir labels Oct 26, 2022
@sobolevn sobolevn self-assigned this Oct 26, 2022
sobolevn added a commit to sobolevn/cpython that referenced this issue Oct 26, 2022
@mdickinson
Copy link
Member

mdickinson commented Oct 26, 2022

Closed in #98728. Thank you for the fix!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stdlib Python modules in the Lib dir tests Tests in the Lib/test dir type-bug An unexpected behavior, bug, or error
Projects
None yet
Development

No branches or pull requests

2 participants