[issue42085] Add dedicated slot for sending values

2021-08-26 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

Oh, my bad. I can't find the enum values of the return type, though 
(PySendResult).

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue42085] Add dedicated slot for sending values

2021-08-25 Thread Dennis Sweeney


Dennis Sweeney  added the comment:

It did get added to the correct docs:

https://docs.python.org/3.10/c-api/typeobj.html#c.PyAsyncMethods.am_send

(the 3.10 and 3.11 docs, not the 3.9 docs ;-)

But as I mentioned, I feel that there could be more details about the 
semantics/contract.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue42085] Add dedicated slot for sending values

2021-08-25 Thread Pablo Galindo Salgado


Pablo Galindo Salgado  added the comment:

I am reopening this issue since am_send never got documented here: 
https://docs.python.org/3/c-api/typeobj.html#async-structs

--
nosy: +pablogsal
resolution: fixed -> 
status: closed -> open

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue42085] Add dedicated slot for sending values

2021-08-21 Thread Dennis Sweeney


Dennis Sweeney  added the comment:

Is there documentation anywhere for the semantics of am_send? I only see the 
signature followed by "See PyIter_Send for details", but the doc for 
PyIter_Send doesn't mention am_send.

In particular, it would be nice to document the relationship between 
PyIter_Send, am_send, and tp_iternext.

--
nosy: +Dennis Sweeney

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue42085] Add dedicated slot for sending values

2021-07-20 Thread Petr Viktorin


Petr Viktorin  added the comment:

Py_TPFLAGS_HAVE_AM_SEND is unnecessary and I'd like to remove it.

It is not possible for type objects to have a different layout than the 
interpreter:
- extensions using the regular ABI must be recompiled for each feature version 
of Python
- extensions using the stable ABI can only create types dynamically

Or is there a different reason for Py_TPFLAGS_HAVE_AM_SEND? Checking it may be 
faster than ((Py_TYPE(x)->tp_as_async != NULL) && 
(Py_TYPE(x)->tp_as_async->am_send != NULL)), but I don't think the speedup is 
relevant.

See bpo-42747

--
nosy: +petr.viktorin

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue42085] Add dedicated slot for sending values

2021-05-29 Thread Irit Katriel


Irit Katriel  added the comment:


New changeset d338ce0796e5fe8e54dfe52f93ed9d5936ad3efe by Miss Islington (bot) 
in branch '3.10':
bpo-42085: [docs] Add versionadded for am_send in type object documentation 
(GH-25465) (GH-26453)
https://github.com/python/cpython/commit/d338ce0796e5fe8e54dfe52f93ed9d5936ad3efe


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue42085] Add dedicated slot for sending values

2021-05-29 Thread miss-islington


Change by miss-islington :


--
pull_requests: +25049
pull_request: https://github.com/python/cpython/pull/26453

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue42085] Add dedicated slot for sending values

2021-05-29 Thread Irit Katriel


Irit Katriel  added the comment:


New changeset 0b11c429c7f1721d9ffb9ae19e3e8e2e7bd6444d by Martmists in branch 
'main':
bpo-42085: [docs] Add versionadded for am_send in type object documentation 
(GH-25465)
https://github.com/python/cpython/commit/0b11c429c7f1721d9ffb9ae19e3e8e2e7bd6444d


--
nosy: +iritkatriel

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue42085] Add dedicated slot for sending values

2021-05-29 Thread Martmists


Change by Martmists :


--
nosy: +martmists
nosy_count: 4.0 -> 5.0
pull_requests: +25048
pull_request: https://github.com/python/cpython/pull/25465

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue42085] Add dedicated slot for sending values

2020-11-18 Thread Yury Selivanov


Change by Yury Selivanov :


--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue42085] Add dedicated slot for sending values

2020-11-18 Thread Yury Selivanov


Yury Selivanov  added the comment:

> Is anything left to do?

I think we can close this now.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue42085] Add dedicated slot for sending values

2020-11-18 Thread Andrew Svetlov


Andrew Svetlov  added the comment:

Is anything left to do?

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue42085] Add dedicated slot for sending values

2020-11-18 Thread STINNER Victor


Change by STINNER Victor :


--
nosy:  -vstinner

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue42085] Add dedicated slot for sending values

2020-11-18 Thread miss-islington


miss-islington  added the comment:


New changeset 7c9487ded487f304c2906698c52f0815b92cbeb6 by Vladimir Matveev in 
branch 'master':
bpo-42085: Add documentation for Py_TPFLAGS_HAVE_AM_SEND (GH-23374)
https://github.com/python/cpython/commit/7c9487ded487f304c2906698c52f0815b92cbeb6


--
nosy: +miss-islington

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue42085] Add dedicated slot for sending values

2020-11-18 Thread Vladimir Matveev


Change by Vladimir Matveev :


--
pull_requests: +22267
pull_request: https://github.com/python/cpython/pull/23374

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue42085] Add dedicated slot for sending values

2020-11-11 Thread Andrew Svetlov


Andrew Svetlov  added the comment:

Thank you Victor for the report!

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue42085] Add dedicated slot for sending values

2020-11-11 Thread STINNER Victor


STINNER Victor  added the comment:

commit cda99b4022daa08ac74b0420e9903cce883d91c6 (HEAD -> master, 
upstream/master)
Author: Andrew Svetlov 
Date:   Wed Nov 11 17:48:53 2020 +0200

Fix memory leak introduced by GH-22780 (GH-23237)

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue42085] Add dedicated slot for sending values

2020-11-11 Thread STINNER Victor


STINNER Victor  added the comment:

Thanks! The change fixed the leak:

$ ./python -m test -j0 -R 3:3 test_asyncgen test_coroutines test_unittest # 
test_asyncio 
(...)
Tests result: SUCCESS

I didn't run test_asyncio because the test is too slow.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue42085] Add dedicated slot for sending values

2020-11-11 Thread Andrew Svetlov


Andrew Svetlov  added the comment:

PR for the fix is created: https://github.com/python/cpython/pull/23237

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue42085] Add dedicated slot for sending values

2020-11-11 Thread Andrew Svetlov


Change by Andrew Svetlov :


--
pull_requests: +22135
pull_request: https://github.com/python/cpython/pull/23237

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue42085] Add dedicated slot for sending values

2020-11-11 Thread Andrew Svetlov


Andrew Svetlov  added the comment:

Investigating. The test leaks a future instance.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue42085] Add dedicated slot for sending values

2020-11-11 Thread STINNER Victor


STINNER Victor  added the comment:

> New changeset 1e996c3a3b51e9c6f1f4cea8a6dbcf3bcb865060 by Vladimir Matveev in 
> branch 'master':

This change introduced big reference leaks:

4 tests failed:
test_asyncgen test_asyncio test_coroutines test_unittest

Example:

$ ./python -m test test_asyncgen -R 3:3 -m 
test.test_asyncgen.AsyncGenAsyncioTest.test_async_gen_asyncio_03
(...)
test_asyncgen leaked [63, 63, 63] references, sum=189
(...)

Please fix the leak, or revert if nobody is avaible to fix it:
https://pythondev.readthedocs.io/ci.html#revert-on-fail

--
nosy: +vstinner

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue42085] Add dedicated slot for sending values

2020-11-10 Thread Yury Selivanov


Yury Selivanov  added the comment:


New changeset 1e996c3a3b51e9c6f1f4cea8a6dbcf3bcb865060 by Vladimir Matveev in 
branch 'master':
bpo-42085: Introduce dedicated entry in PyAsyncMethods for sending values 
(#22780)
https://github.com/python/cpython/commit/1e996c3a3b51e9c6f1f4cea8a6dbcf3bcb865060


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue42085] Add dedicated slot for sending values

2020-11-10 Thread Yury Selivanov


Yury Selivanov  added the comment:

Vladimir, please do a follow up PR documenting Py_TPFLAGS_HAVE_AM_SEND.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue42085] Add dedicated slot for sending values

2020-10-20 Thread Terry J. Reedy


Change by Terry J. Reedy :


--
nosy: +asvetlov, yselivanov

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue42085] Add dedicated slot for sending values

2020-10-20 Thread Vladimir Matveev


Change by Vladimir Matveev :


--
type:  -> performance

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue42085] Add dedicated slot for sending values

2020-10-19 Thread Vladimir Matveev


Change by Vladimir Matveev :


--
keywords: +patch
pull_requests: +21739
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/22780

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue42085] Add dedicated slot for sending values

2020-10-19 Thread Vladimir Matveev


New submission from Vladimir Matveev :

https://bugs.python.org/issue41756 has introduced PyIter_Send as a common 
entrypoint for sending values however currently fast path that does not use 
StopIteration exception is only available for generators/coroutines. It would 
be quite nice if this machinery was extensible and other types (both internal 
and 3rd party) could opt-in into using exception-free way of returning values 
without needing to update the implementation of PyIter_Send. One way of solving 
this is adding a new slot with a signature that matches PyIter_Send. With it:
- it should be possible to implement this slot for coroutines/generators and 
remove  special casing for them  in PyIter_Send
- provide implementation for this slot for internal types (i.e. FutureIter in 
_asynciomodule.c) - results of this experiment can be found below
- enable external native extensions to provide efficient implementation of 
coroutines (i.e.  Cython could benefit from it)

Microbenchmark to demonstrate the difference of accessing the value of fulfiled 
Future without and with dedicated slot:
```
import asyncio
import time

N = 1

async def run():
fut = asyncio.Future()
fut.set_result(42)

t0 = time.time()
for _ in range(N):
await fut
t1 = time.time()
print(f"Time: {t1 - t0} s")

asyncio.run(run())
```
Time: 8.365560054779053 s - without the slot
Time: 5.799655914306641 s - with the  slot

--
components: Interpreter Core
messages: 378999
nosy: v2m
priority: normal
severity: normal
status: open
title: Add dedicated slot for sending values
versions: Python 3.10

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com