Skip to content

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

Merged
merged 6 commits into from
Jul 4, 2024
Merged

Conversation

max-muoto
Copy link
Contributor

@max-muoto max-muoto commented Jun 30, 2024

Add _interpqueues module for Python 3.13 Fixes #12241.

This comment has been minimized.

@max-muoto
Copy link
Contributor Author

@AlexWaygood Do you maybe want to review here?

This comment has been minimized.

Copy link
Collaborator

@srittau srittau left a 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): ...
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

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'
>>>

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: ...
Copy link
Collaborator

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.

Copy link
Contributor Author

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?

Copy link
Collaborator

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).

Copy link
Contributor Author

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.

Copy link
Contributor Author

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.

Copy link
Contributor Author

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.

Copy link
Contributor

github-actions bot commented Jul 4, 2024

According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉

@srittau srittau merged commit 582f08b into python:main Jul 4, 2024
63 checks passed
max-muoto added a commit to max-muoto/typeshed that referenced this pull request Sep 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add _interpqueues for Python 3.13
2 participants