Skip to content

GH-137630: Convert _interpqueues to use Argument Clinic #137685

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

Open
wants to merge 16 commits into
base: main
Choose a base branch
from

Conversation

AA-Turner
Copy link
Member

@AA-Turner AA-Turner commented Aug 12, 2025

Note, we use a custom converter qidarg_converter here. I have changed the qidarg_converter() function to simplify the return -- we only ever use qidarg.id.

pydoc diff:

--- pydoc-interpqueues-HEAD.txt	2025-08-12 19:29:03.554066000 +0100
+++ pydoc-interpqueues-AC.txt	2025-08-12 19:26:19.952112000 +0100
@@ -130,70 +130,52 @@
      |  args
 
 FUNCTIONS
-    bind(...)
-        bind(qid)
-
+    bind(qid)
         Take a reference to the identified queue.
-        The queue is not destroyed until there are no references left.
 
-    create(...)
-        create(maxsize, unboundop, fallback) -> qid
+        The queue is not destroyed until there are no references left.
 
+    create(maxsize, unboundop=-1, fallback=-1)
         Create a new cross-interpreter queue and return its unique generated ID.
-        It is a new reference as though bind() had been called on the queue.
 
+        It is a new reference as though bind() had been called on the queue.
         The caller is responsible for calling destroy() for the new queue
         before the runtime is finalized.
 
-    destroy(...)
-        destroy(qid)
+    destroy(qid)
+        Clear and destroy the queue.
 
-        Clear and destroy the queue.  Afterward attempts to use the queue
-        will behave as though it never existed.
-
-    get(...)
-        get(qid) -> (obj, unboundop)
+        Afterward attempts to use the queue will behave as though it never existed.
 
+    get(qid)
         Return a new object from the data at the front of the queue.
-        The unbound op is also returned.
 
+        The unbound op is also returned.
         If there is nothing to receive then raise QueueEmpty.
 
-    get_count(...)
-        get_count(qid)
-
+    get_count(qid)
         Return the number of items in the queue.
 
-    get_maxsize(...)
-        get_maxsize(qid)
-
+    get_maxsize(qid)
         Return the maximum number of items in the queue.
 
-    get_queue_defaults(...)
-        get_queue_defaults(qid)
-
+    get_queue_defaults(qid)
         Return the queue's default values, set when it was created.
 
-    is_full(...)
-        is_full(qid)
-
+    is_full(qid)
         Return true if the queue has a maxsize and has reached it.
 
     list_all()
-        list_all() -> [(qid, unboundop, fallback)]
-
         Return the list of IDs for all queues.
-        Each corresponding default unbound op and fallback is also included.
 
-    put(...)
-        put(qid, obj)
+        Each corresponding default unbound op and fallback is also included.
 
+    put(qid, obj, unboundop=-1, fallback=-1)
         Add the object's data to the queue.
 
-    release(...)
-        release(qid)
-
+    release(qid)
         Release a reference to the queue.
+
         The queue is destroyed once there are no references left.
 
 FILE

A

Copy link
Member

@serhiy-storchaka serhiy-storchaka left a comment

Choose a reason for hiding this comment

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

There is a bug in the current code which should be fixed in 3.14 too. The rest LGTM. But I would like to get @ericsnowcurrently's approve.

@@ -0,0 +1,2 @@
The :mod:`!_interpqueues` module now uses Argument Clinic to parse arguments.
Copy link
Member

Choose a reason for hiding this comment

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

We usually do not add NEWS files for conversions to Argument Clinic. Argument Clinic is an implementation detail.

@serhiy-storchaka
Copy link
Member

I also add that after removing the return pseudo-annotation, some docstrings look more self-contadicting.

something(qid)
    Return bla-bla X.

    Ah, forget it, also return Y and Z.

It was in the old docstrings, but with -> (X, Y, Z) you at least could suspect that "return X" was not the whole truth.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants