[Python-Dev] Re: Behavior of `asyncio.gather` when one of submitted tasks raises a `KeyboardInterrupt`.

2022-06-14 Thread Yves Duprat
Sure, I will do. Work is in progress !!

Guido van Rossum wrote:
> I'm sorry, I don't know the answer. Maybe you can read some of the source
> code and report back here if you find any clues?
> On Thu, Jun 9, 2022 at 1:53 PM Yves Duprat ydup...@gmail.com wrote:
> > Sorry for my imprecision, can you read the changes about the results:
> > With one coroutine in `asyncio.gather([sub_task()])`, result is:
> > main_task(), be: CancelledError()
> > __main__ 
> > With two coroutines `asyncio.gather([sub_task(), asyncio.sleep(0)])` ,
> > result is:
> > main_task(), be: KeyboardInterrupt()
> > __main__ 
> > --
> > Yves Duprat wrote:
> > Thank you for the straightforward explanation. May I ask you another
> > question?
> > I don't understand the behavior of this waiting primitive. So here is
> > the case below:
> > import asyncio
> > e = KeyboardInterrupt  # or SystemExit
> > async def sub_task():
> > raise e
> > async def main_task():
> > try:
> > await asyncio.gather(
> > # -- aws --
> > sub_task(),
> > asyncio.sleep(0)
> > )
> > except Exception as e:
> > print('\tmain_task(), e:', repr(e))
> > raise
> > except BaseException as e:
> > print('\tmain_task(), be:', repr(e))
> > if __name__ == '__main__':
> > try:
> > asyncio.run(main_task())
> > except e:
> > print(f'__main__ {e}')
> > 
> > When one coroutine `[sub_task()]`, result is:
> > main_task(), be: CancelledError()
> > __main__ 
> > When two coroutines `[sub_task(), sleep(0)]` , result is:
> > main_task(), be: KeyboardInterrupt()
> > __main__ 
> > Why are results so different when `aws` contains single coroutine or two
> > coroutines ?
> > Thank for your time
> > Yves
> > Guido van Rossum wrote:
> > KeyboardInterrupt is generally not handled properly by asyncio, the
> > normal
> > behavior here is that the code just exits with a traceback.
> > On Tue, Jun 7, 2022 at 11:00 AM Yves Duprat ydup...@gmail.com wrote:
> > Hi,
> > regarding this [issue93122](
> > https://github.com/python/cpython/issues/93122),
> > I am wondering what is the normal behavior of `asyncio.gather` when
> > one of
> > the submitted tasks raises a `KeyboardInterrupt` exception ? --
> > regardless
> > of the value of the `return_exception` parameter.
> > It seems that this primitive does not behave the same way with
> > `KeyboardInterrupt` and `ZeroDivisionError` exceptions. But may be it
> > is
> > normal ?
> > I have searched in the documentation [here](
> > https://docs.python.org/3/library/asyncio-task.html#asyncio.gather)
> > but I
> > did not find anything.
> > Thanks for your help.
> > Yves
> > ___
> > Python-Dev mailing list -- python-dev@python.org
> > To unsubscribe send an email to python-dev-le...@python.org
> > https://mail.python.org/mailman3/lists/python-dev.python.org/
> > Message archived at
> > https://mail.python.org/archives/list/python-dev@python.org/message/5KVY7SSD.
> > ..
> > Code of Conduct: http://python.org/psf/codeofconduct/
> > --Guido van Rossum (python.org/~guido)
> > *Pronouns: he/him **(why is my pronoun here?)*
> > http://feministing.com/2015/02/03/how-using-they-as-a-singular-pronoun-can-c.
> > ..
> > 
> > Python-Dev mailing list -- python-dev@python.org
> > To unsubscribe send an email to python-dev-le...@python.org
> > https://mail.python.org/mailman3/lists/python-dev.python.org/
> > Message archived at
> > https://mail.python.org/archives/list/python-dev@python.org/message/CIDCWFDX...
> > Code of Conduct: http://python.org/psf/codeofconduct/
> > -- 
> --Guido van Rossum (python.org/~guido)
> *Pronouns: he/him **(why is my pronoun here?)*
> http://feministing.com/2015/02/03/how-using-they-as-a-singular-pronoun-can-change-the-world/
___
Python-Dev mailing list -- python-dev@python.org
To unsubscribe send an email to python-dev-le...@python.org
https://mail.python.org/mailman3/lists/python-dev.python.org/
Message archived at 
https://mail.python.org/archives/list/python-dev@python.org/message/2TGKUEW5ZBC5ECUHE3AKQ633O2FANGPQ/
Code of Conduct: http://python.org/psf/codeofconduct/


[Python-Dev] Re: Behavior of `asyncio.gather` when one of submitted tasks raises a `KeyboardInterrupt`.

2022-06-09 Thread Yves Duprat
Sorry for my imprecision, can you read the changes about the results:
--
With one coroutine in `asyncio.gather([sub_task()])`, result is:
main_task(), be: CancelledError()
__main__ 

With two coroutines `asyncio.gather([sub_task(), asyncio.sleep(0)])` , result 
is:
main_task(), be: KeyboardInterrupt()
__main__ 
--

Yves Duprat wrote:
> Thank you for the straightforward explanation. May I ask you another question?
> I don't understand the behavior of this waiting primitive. So here is the 
> case below:
> ```py
> import asyncio
> e = KeyboardInterrupt  # or SystemExit
> async def sub_task():
> raise e
> async def main_task():
> try:
> await asyncio.gather(
> # -- aws --
> sub_task(),
> asyncio.sleep(0)
> )
> except Exception as e:
> print('\tmain_task(), e:', repr(e))
> raise
> except BaseException as e:
> print('\tmain_task(), be:', repr(e))
> if __name__ == '__main__':
> try:
> asyncio.run(main_task())
> except e:
> print(f'__main__ {e}')
> ```
> When one coroutine `[sub_task()]`, result is:
> main_task(), be: CancelledError()
> __main__ 
> When two coroutines `[sub_task(), sleep(0)]` , result is:
> main_task(), be: KeyboardInterrupt()
> __main__ 
> Why are results so different when `aws` contains single coroutine or two 
> coroutines ?
> Thank for your time
> Yves
> Guido van Rossum wrote:
> > KeyboardInterrupt is generally not handled properly by asyncio, the normal
> > behavior here is that the code just exits with a traceback.
> > On Tue, Jun 7, 2022 at 11:00 AM Yves Duprat ydup...@gmail.com wrote:
> > Hi,
> > regarding this [issue93122](https://github.com/python/cpython/issues/93122),
> > I am wondering what is the normal behavior of `asyncio.gather` when one of
> > the submitted tasks raises a `KeyboardInterrupt` exception ? -- regardless
> > of the value of the `return_exception` parameter.
> > It seems that this primitive does not behave the same way with
> > `KeyboardInterrupt` and `ZeroDivisionError` exceptions. But may be it is
> > normal ?
> > I have searched in the documentation [here](
> > https://docs.python.org/3/library/asyncio-task.html#asyncio.gather) but I
> > did not find anything.
> > Thanks for your help.
> > Yves
> > ___
> > Python-Dev mailing list -- python-dev@python.org
> > To unsubscribe send an email to python-dev-le...@python.org
> > https://mail.python.org/mailman3/lists/python-dev.python.org/
> > Message archived at
> > https://mail.python.org/archives/list/python-dev@python.org/message/5KVY7SSD...
> > Code of Conduct: http://python.org/psf/codeofconduct/
> > --
> > --Guido van Rossum (python.org/~guido)
> > *Pronouns: he/him **(why is my pronoun here?)*
> > http://feministing.com/2015/02/03/how-using-they-as-a-singular-pronoun-can-c...
> >
___
Python-Dev mailing list -- python-dev@python.org
To unsubscribe send an email to python-dev-le...@python.org
https://mail.python.org/mailman3/lists/python-dev.python.org/
Message archived at 
https://mail.python.org/archives/list/python-dev@python.org/message/CIDCWFDXIQ53745MI3V6S425SRSM6MRY/
Code of Conduct: http://python.org/psf/codeofconduct/


[Python-Dev] Re: Behavior of `asyncio.gather` when one of submitted tasks raises a `KeyboardInterrupt`.

2022-06-09 Thread Yves Duprat
Thank you for the straightforward explanation. May I ask you another question?
I don't understand the behavior of this waiting primitive. So here is the case 
below:
```py
import asyncio

e = KeyboardInterrupt  # or SystemExit
async def sub_task():
raise e

async def main_task():
try:
await asyncio.gather(
# -- aws --
sub_task(),
asyncio.sleep(0)
)
except Exception as e:
print('\tmain_task(), e:', repr(e))
raise
except BaseException as e:
print('\tmain_task(), be:', repr(e))

if __name__ == '__main__':
try:
asyncio.run(main_task())
except e:
print(f'__main__ {e}')
```
When one coroutine `[sub_task()]`, result is:
main_task(), be: CancelledError()
__main__ 

When two coroutines `[sub_task(), sleep(0)]` , result is:
main_task(), be: KeyboardInterrupt()
__main__ 

Why are results so different when `aws` contains single coroutine or two 
coroutines ?
Thank for your time
Yves

Guido van Rossum wrote:
> KeyboardInterrupt is generally not handled properly by asyncio, the normal
> behavior here is that the code just exits with a traceback.
> On Tue, Jun 7, 2022 at 11:00 AM Yves Duprat ydup...@gmail.com wrote:
> > Hi,
> > regarding this [issue93122](https://github.com/python/cpython/issues/93122),
> > I am wondering what is the normal behavior of `asyncio.gather` when one of
> > the submitted tasks raises a `KeyboardInterrupt` exception ? -- regardless
> > of the value of the `return_exception` parameter.
> > It seems that this primitive does not behave the same way with
> > `KeyboardInterrupt` and `ZeroDivisionError` exceptions. But may be it is
> > normal ?
> > I have searched in the documentation [here](
> > https://docs.python.org/3/library/asyncio-task.html#asyncio.gather) but I
> > did not find anything.
> > Thanks for your help.
> > Yves
> > ___
> > Python-Dev mailing list -- python-dev@python.org
> > To unsubscribe send an email to python-dev-le...@python.org
> > https://mail.python.org/mailman3/lists/python-dev.python.org/
> > Message archived at
> > https://mail.python.org/archives/list/python-dev@python.org/message/5KVY7SSD...
> > Code of Conduct: http://python.org/psf/codeofconduct/
> > -- 
> --Guido van Rossum (python.org/~guido)
> *Pronouns: he/him **(why is my pronoun here?)*
> http://feministing.com/2015/02/03/how-using-they-as-a-singular-pronoun-can-change-the-world/
___
Python-Dev mailing list -- python-dev@python.org
To unsubscribe send an email to python-dev-le...@python.org
https://mail.python.org/mailman3/lists/python-dev.python.org/
Message archived at 
https://mail.python.org/archives/list/python-dev@python.org/message/5AHMYI246S6INVUNPJM3KTM2XCRHYNDD/
Code of Conduct: http://python.org/psf/codeofconduct/


[Python-Dev] Behavior of `asyncio.gather` when one of submitted tasks raises a `KeyboardInterrupt`.

2022-06-07 Thread Yves Duprat
Hi,

regarding this [issue93122](https://github.com/python/cpython/issues/93122), I 
am wondering what is the normal behavior of `asyncio.gather` when one of the 
submitted tasks raises a `KeyboardInterrupt` exception ? -- regardless of the 
value of the `return_exception` parameter.
It seems that this primitive does not behave the same way with 
`KeyboardInterrupt` and `ZeroDivisionError` exceptions. But may be it is normal 
?
I have searched in the documentation 
[here](https://docs.python.org/3/library/asyncio-task.html#asyncio.gather) but 
I did not find anything. 
Thanks for your help.

Yves
___
Python-Dev mailing list -- python-dev@python.org
To unsubscribe send an email to python-dev-le...@python.org
https://mail.python.org/mailman3/lists/python-dev.python.org/
Message archived at 
https://mail.python.org/archives/list/python-dev@python.org/message/5KVY7SSDTYWOAOCXVSXNBHCSDEJ5JPP7/
Code of Conduct: http://python.org/psf/codeofconduct/


[Python-Dev] Re: build cpython on M1 Pro mac

2022-03-04 Thread Yves Duprat
Guido van Rossum wrote:
> On Wed, Mar 2, 2022 at 8:34 AM Yves Duprat ydup...@gmail.com wrote:
> > How did you find that issue?
> > This message printed from VSCode when I ran my script in debug mode
> > Oh, I see, this is something that pydevd prints when it doesn't understand
> the .pyc file. We changed the bytecode significantly in 3.11 (more than we
> did in previous versions, though it tends to change in each version) --
> that message is at least a decade old.
> > the Pydev extension used by VS Code doesn't yet work well with
> > the changes in 3.11 internals.
> > Is there a simple sheet, white paper about these internal changes ?
> > No, you could follow the discussions on
> https://github.com/faster-cpython/ideas though and ask specific questions
> there if something's not clear.
Ok

> > You should probably inquire with either the
> > Pydev extension (https://github.com/fabioz/Pydev) or the VS Code team
> > about
> > what their plans are for fixing this
> > Thank for the solutions.
> > The specific component to  look for is pydevd --
> https://github.com/fabioz/PyDev.Debugger/. I recommend filing an issue
> there.
see: https://github.com/fabioz/PyDev.Debugger/issues/213
see: https://github.com/microsoft/debugpy/issues/861
Thank for your help
___
Python-Dev mailing list -- python-dev@python.org
To unsubscribe send an email to python-dev-le...@python.org
https://mail.python.org/mailman3/lists/python-dev.python.org/
Message archived at 
https://mail.python.org/archives/list/python-dev@python.org/message/GZDHVUUAIRB7SXQPCQYYXXQEIXBTE3SJ/
Code of Conduct: http://python.org/psf/codeofconduct/


[Python-Dev] Re: build cpython on M1 Pro mac

2022-03-02 Thread Yves Duprat
> How did you find that issue? 
This message printed from VSCode when I ran my script in debug mode

> the Pydev extension used by VS Code doesn't yet work well with
> the changes in 3.11 internals. 
Is there a simple sheet, white paper about these internal changes ?

>You should probably inquire with either the
> Pydev extension (https://github.com/fabioz/Pydev) or the VS Code team about
> what their plans are for fixing this 
Thank for the solutions.
___
Python-Dev mailing list -- python-dev@python.org
To unsubscribe send an email to python-dev-le...@python.org
https://mail.python.org/mailman3/lists/python-dev.python.org/
Message archived at 
https://mail.python.org/archives/list/python-dev@python.org/message/RXHYSDABKG6LWB62VK2CWMQOUF3QKHUF/
Code of Conduct: http://python.org/psf/codeofconduct/


[Python-Dev] build cpython on M1 Pro mac

2022-03-01 Thread Yves Duprat
Hi,

I built cpython on a mac OSX 12.01. Python runs well. 
When starts, Python shows that version info which looks good:
'Python 3.11.0a5+ (heads/fix-issue-43352:f899da7fe5, Feb 25 2022, 10:04:53) 
[Clang 13.0.0 (clang-1300.0.29.30)] on darwin'

But when I want to used it in VSCode to debug a script, I have the following 
message:
---
This version of python seems to be incorrectly compiled
(internal generated filenames are not absolute).
This may make the debugger miss breakpoints.
Related bug: http://bugs.python.org/issue1666807
---
What do I miss ? I looked for a specific option in ./configure but seen nothing 
 ? 
Can someone help me please ?
Thank

Yves
___
Python-Dev mailing list -- python-dev@python.org
To unsubscribe send an email to python-dev-le...@python.org
https://mail.python.org/mailman3/lists/python-dev.python.org/
Message archived at 
https://mail.python.org/archives/list/python-dev@python.org/message/DISAPV26T2U6CHHSGXTD5EWX54CPMB6Z/
Code of Conduct: http://python.org/psf/codeofconduct/