-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Add _interpqueues
for 3.13
#12240
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 _interpqueues
for 3.13
#12240
Conversation
This comment has been minimized.
This comment has been minimized.
@AlexWaygood Do you maybe want to review here? |
This comment has been minimized.
This comment has been minimized.
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, a few (unsure) notes below.
from typing import SupportsIndex | ||
|
||
class QueueError(RuntimeError): ... | ||
class QueueNotFoundError(QueueError): ... |
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.
There also QueueEmpty
and QueueFull
:
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.
I'm not seeing these actually get exported, might be because of:
// QueueEmpty and QueueFull are set by set_external_exc_types().
state->QueueEmpty = NULL;
state->QueueFull = NUL
3.13.0b2
>>> import _interpqueues as iq
>>> iq.QueueEmpty
Traceback (most recent call last):
File "<python-input-5>", line 1, in <module>
iq.QueueEmpty
AttributeError: module '_interpqueues' has no attribute 'QueueEmpty'
>>> iq.QueueFull
Traceback (most recent call last):
File "<python-input-6>", line 1, in <module>
iq.QueueFull
AttributeError: module '_interpqueues' has no attribute 'QueueFull'
>>>
stdlib/_interpqueues.pyi
Outdated
def get_queue_defaults(qid: SupportsIndex) -> tuple[int]: ... | ||
def is_full(qid: SupportsIndex) -> bool: ... | ||
def list_all() -> list[tuple[int, int]]: ... | ||
def put(qid: SupportsIndex, obj: object, fmt: SupportsIndex) -> None: ... |
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.
If I understand this correctly (which I might not), the allowed values for obj
depend on fmt
. This would mean either using overloads or – easiest for now – Any
for obj
.
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.
Does using Any
versus object
really serve much of an advantage for param like this?
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.
This is mainly a documentation thing: "We can't accurately type this argument" instead of "this argument accepts all possible values" (like for example str()
does).
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.
Ah I see, makes sense.
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.
Let's keep things simple for now that in this case, and we can see about adding the overloads in a follow-up.
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.
This comment has been minimized.
This comment has been minimized.
According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉 |
Add
_interpqueues
module for Python 3.13 Fixes #12241.