-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Raise TypeError when calling __new__ unsafely #4455
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
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CI Failure came from successful test.
test_subclass (test.test_bool.BoolTest) ... unexpected success
Because you fixed the bug, you can remove @unittest.expectedFailure
decorator from the test.
Thank you!
vm/src/builtins/type.rs
Outdated
} | ||
} | ||
if let Some(ref basetype) = staticbase { | ||
if !PyType::subclasscheck(basetype.to_owned(), typ.to_owned()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PyType_IsSubtype
in CPython is same to fast_issubclass
in RustPython
Hey @garychia do you still have time/want to work on this? |
Hi, @DimitrisJim! I was struggling to solve the problem that happens when running the RustPython/Lib/test/test_ast.py Lines 521 to 528 in bbd8fb2
|
bca1776
to
311b7a6
Compare
311b7a6
to
36b6755
Compare
Related to #3692

This implementation is based on the following code from CPython.
https://github.com/python/cpython/blob/206f05a46b426eb374f724f8e7cd42f2f9643bb8/Objects/typeobject.c#L7685-L7700