PEP 554: Return a boolean from send_nowait() rather than raising an exception. (#987)

This commit is contained in:
Eric Snow 2019-04-10 16:56:41 -06:00 committed by GitHub
parent 7bd1bc2c9e
commit b7f089015a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 33 additions and 33 deletions

View File

@ -139,32 +139,33 @@ For sharing data between interpreters:
|
+------------------------------+-------------------------------------------------+
+------------------------------+--------------------------------------------------+
| signature | description |
+==============================+=================================================+
+==============================+==================================================+
| ``class SendChannel(id)`` | The sending end of a channel. |
+------------------------------+-------------------------------------------------+
+------------------------------+--------------------------------------------------+
| ``.id`` | The channel's unique ID. |
+------------------------------+-------------------------------------------------+
+------------------------------+--------------------------------------------------+
| ``.interpreters`` | The list of associated interpreters. |
+------------------------------+-------------------------------------------------+
+------------------------------+--------------------------------------------------+
| ``.send(obj)`` | | Send the object (i.e. its data) to the |
| | | receiving end of the channel and wait. |
| | | Associate the interpreter with the channel. |
+------------------------------+-------------------------------------------------+
| ``.send_nowait(obj)`` | | Like send(), but fail if not received. |
+------------------------------+-------------------------------------------------+
+------------------------------+--------------------------------------------------+
| ``.send_nowait(obj)`` | | Like send(), but return False if not received. |
+------------------------------+--------------------------------------------------+
| ``.send_buffer(obj)`` | | Send the object's (PEP 3118) buffer to the |
| | | receiving end of the channel and wait. |
| | | Associate the interpreter with the channel. |
+------------------------------+-------------------------------------------------+
| ``.send_buffer_nowait(obj)`` | | Like send_buffer(), but fail if not received. |
+------------------------------+-------------------------------------------------+
+------------------------------+--------------------------------------------------+
| ``.send_buffer_nowait(obj)`` | | Like send_buffer(), but return False |
| | | if not received. |
+------------------------------+--------------------------------------------------+
| ``.release()`` | | No longer associate the current interpreter |
| | | with the channel (on the sending end). |
+------------------------------+-------------------------------------------------+
+------------------------------+--------------------------------------------------+
| ``.close(force=False)`` | | Close the channel in all interpreters. |
+------------------------------+-------------------------------------------------+
+------------------------------+--------------------------------------------------+
|
@ -938,10 +939,10 @@ The module also provides the following channel-related classes::
send_nowait(obj):
Send the object to the "recv" end of the channel. If no
interpreter is currently receiving (waiting on the other
end) then raise NotReceivedError. Otherwise this is the
same as "send()".
Send the object to the "recv" end of the channel. This
behaves the same as "send()", except for the waiting part.
If no interpreter is currently receiving (waiting on the
other end) then return False. Otherwise return True.
send_buffer(obj):
@ -952,9 +953,8 @@ The module also provides the following channel-related classes::
send_buffer_nowait(obj):
Send a MemoryView of the object rather than the object.
If the other end is not currently receiving then raise
NotReceivedError. Otherwise this is the same as
"send_buffer()".
If the other end is not currently receiving then return
False. Otherwise return True.
release():