Add types for None, Ellipsis, and NotImplemented#3408
Conversation
davidhewitt
left a comment
There was a problem hiding this comment.
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
davidhewitt
left a comment
There was a problem hiding this comment.
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