-
Notifications
You must be signed in to change notification settings - Fork 763
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
Add types for None
, Ellipsis
, and NotImplemented
#3408
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.
Thank you! Looks like a merge conflict and also needs a newsfragment 3408.added.md
please
ecadc62
to
afbf980
Compare
The singletons don't expose their type objects in the C API. Is it necessary for these types to implement |
Ah yes, looks like they are not part of the stable API and will even be removed in Python 3.13 python/cpython#107030 So the way to implement for |
188067a
to
4d4769b
Compare
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.
Thanks, this implementation looks correct to me. Would you be willing to add some tests please?
I think it should be sufficient to check that some arbitrary value like empty dict doesn't downcast to these types (e.g. PyDict::new(py).downcast::<PyEllipsis>().is_err()
) and also that downcasting the singletons succeeds (e.g. py.Ellipsis().as_ref(py).downcast().unwrap().is(&py.Ellipsis())
).
d9411f6
to
24c6db3
Compare
Should we deprecate/remove |
That's a good question; I'd prefer to leave the So for now, this PR looks good to me, thanks @rytheo! |
Ah that's unfortunate, it looks like PyPy doesn't expose |
4314f4b
to
565ba62
Compare
@davidhewitt the |
Looks like a possible bug in |
Please rebase and CI should be working again. |
565ba62
to
b3cf61c
Compare
Head branch was pushed to by a user without write access
b3cf61c
to
a13e24b
Compare
Fixes #3162