[issue45813] Importing asyncio after deleting a coroutine object and before cleaning it up leads to crashing on Python3.11

2021-12-08 Thread Andrew Svetlov


Change by Andrew Svetlov :


--
resolution:  -> fixed
status: open -> closed

___
Python tracker 

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



[issue45813] Importing asyncio after deleting a coroutine object and before cleaning it up leads to crashing on Python3.11

2021-12-08 Thread Mark Shannon


Mark Shannon  added the comment:


New changeset d4363d214097b3fca8b7910c2e0e91c8b0873fb2 by Andrew Svetlov in 
branch 'main':
bpo-45813: Drop redundant assertion from frame.clear() (GH-29990)
https://github.com/python/cpython/commit/d4363d214097b3fca8b7910c2e0e91c8b0873fb2


--

___
Python tracker 

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



[issue45813] Importing asyncio after deleting a coroutine object and before cleaning it up leads to crashing on Python3.11

2021-12-08 Thread Andrew Svetlov


Andrew Svetlov  added the comment:

Pablo, I think https://github.com/python/cpython/pull/29990 should be merged as 
well before the issue closing.

It covers another execution branch.

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



[issue45813] Importing asyncio after deleting a coroutine object and before cleaning it up leads to crashing on Python3.11

2021-12-08 Thread Andrew Svetlov


Change by Andrew Svetlov :


--
pull_requests: +28213
pull_request: https://github.com/python/cpython/pull/29990

___
Python tracker 

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



[issue45813] Importing asyncio after deleting a coroutine object and before cleaning it up leads to crashing on Python3.11

2021-12-07 Thread Pablo Galindo Salgado


Change by Pablo Galindo Salgado :


--
status: open -> closed

___
Python tracker 

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



[issue45813] Importing asyncio after deleting a coroutine object and before cleaning it up leads to crashing on Python3.11

2021-11-29 Thread Dennis Sweeney


Dennis Sweeney  added the comment:

I think the PR fixed one case, but the other case (when coro is kept around) 
still fails an assertion:

Python 3.11.0a2+ (heads/main:734ed35383, Nov 29 2021, 19:29:25) [MSC v.1929 64 
bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> async def f(): pass
...
>>> coro = f()
>>> frame = coro.cr_frame
>>> frame.clear()
:1: RuntimeWarning: coroutine 'f' was never awaited
RuntimeWarning: Enable tracemalloc to get the object allocation traceback
Assertion failed: f->f_frame->generator == NULL, file 
C:\Users\sween\Source\Repos\cpython2\multiply\Objects\frameobject.c, line 689

Perhaps there should be some sort of backport as well?

--
status: closed -> open

___
Python tracker 

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



[issue45813] Importing asyncio after deleting a coroutine object and before cleaning it up leads to crashing on Python3.11

2021-11-29 Thread Andrew Svetlov


Change by Andrew Svetlov :


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



[issue45813] Importing asyncio after deleting a coroutine object and before cleaning it up leads to crashing on Python3.11

2021-11-22 Thread Mark Shannon


Mark Shannon  added the comment:


New changeset 7fd92a8b7ee5bed28c2681fa38e0a1e76200dd8e by Mark Shannon in 
branch 'main':
bpo-45813: Make sure that frame->generator is NULLed when generator is 
deallocated. (GH-29700)
https://github.com/python/cpython/commit/7fd92a8b7ee5bed28c2681fa38e0a1e76200dd8e


--

___
Python tracker 

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



[issue45813] Importing asyncio after deleting a coroutine object and before cleaning it up leads to crashing on Python3.11

2021-11-22 Thread Mark Shannon


Change by Mark Shannon :


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

___
Python tracker 

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



[issue45813] Importing asyncio after deleting a coroutine object and before cleaning it up leads to crashing on Python3.11

2021-11-22 Thread Mark Shannon


Change by Mark Shannon :


--
assignee:  -> Mark.Shannon
keywords: +3.11regression
priority: normal -> release blocker

___
Python tracker 

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



[issue45813] Importing asyncio after deleting a coroutine object and before cleaning it up leads to crashing on Python3.11

2021-11-22 Thread Mark Shannon


Mark Shannon  added the comment:

I'm seeing a similar failure on a debug build of 3.10 as well.

./python 
Python 3.10.0+ (heads/3.10:9e7a2e4920, Nov 22 2021, 10:51:32) [GCC 9.3.0] on 
linux
Type "help", "copyright", "credits" or "license" for more information.
>>> async def f():
... pass
... 
>>> coro = f()
>>> frame = coro.cr_frame
>>> frame.clear()
:1: RuntimeWarning: coroutine 'f' was never awaited
RuntimeWarning: Enable tracemalloc to get the object allocation traceback
python: Objects/frameobject.c:695: frame_clear: Assertion `f->f_gen == NULL' 
failed.
Aborted (core dumped)


I don't know why that assertion is there, it doesn't seem to be valid.

--

___
Python tracker 

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



[issue45813] Importing asyncio after deleting a coroutine object and before cleaning it up leads to crashing on Python3.11

2021-11-21 Thread Dennis Sweeney


Dennis Sweeney  added the comment:

Even without garbage-collecting the coroutine, we get a failed assertion in 
debug mode (but no crash with the assertion removed):

Python 3.11.0a2+ (heads/main:c8c21bdd19, Nov 21 2021, 13:58:01) [MSC v.1929 64 
bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> async def f():
... pass
...
>>> coro = f()
>>> frame = coro.cr_frame
>>> frame.clear()
:1: RuntimeWarning: coroutine 'f' was never awaited
RuntimeWarning: Enable tracemalloc to get the object allocation traceback
Assertion failed: f->f_frame->generator == NULL, file 
C:\Users\sween\Source\Repos\cpython2\cpython\Objects\frameobject.c, line 705

--

___
Python tracker 

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



[issue45813] Importing asyncio after deleting a coroutine object and before cleaning it up leads to crashing on Python3.11

2021-11-21 Thread Dennis Sweeney


Dennis Sweeney  added the comment:

I think the import is irrelevant (luckily). This still crashes:

async def f():
pass
frame = f().cr_frame
frame.clear()

--

___
Python tracker 

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



[issue45813] Importing asyncio after deleting a coroutine object and before cleaning it up leads to crashing on Python3.11

2021-11-21 Thread Dennis Sweeney


Dennis Sweeney  added the comment:

I got a crash on Windows in Objects/genobject.c:

void
_PyGen_Finalize(PyObject *self)
{
PyGenObject *gen = (PyGenObject *)self;
PyObject *res = NULL;
PyObject *error_type, *error_value, *error_traceback;

if (gen->gi_xframe == NULL ||  _PyFrameHasCompleted(gen->gi_xframe)) { 
<--- Crash is here
/* Generator isn't paused, so no need to close */
return;
}
...


It looks like gen->gi_xframe is a junk-but-not-NULL pointer that is getting 
dereferenced by _PyFrameHasCompleted.

Maybe related to bpo-44590.

--
nosy: +Dennis Sweeney, Mark.Shannon

___
Python tracker 

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



[issue45813] Importing asyncio after deleting a coroutine object and before cleaning it up leads to crashing on Python3.11

2021-11-20 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

The crash in IDLE could be in tcl or any of the extra modules imported by IDLE, 
such as tkinter and socket.  It should be retested on Windows once this appears 
fixed otherwise.

--

___
Python tracker 

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



[issue45813] Importing asyncio after deleting a coroutine object and before cleaning it up leads to crashing on Python3.11

2021-11-20 Thread Xinmeng Xia


Xinmeng Xia  added the comment:

Thanks for testing it. Maybe it only crashes on Unix-like operating systems. I 
also try it on MacOS 11.6.1. with -i to ensure that python survives running the 
test code. On MacOS, it reports the following crashing information: 

--- 
xxm$ Python-3.11.0a2/python.exe -i test.py 
test.py:5: RuntimeWarning: coroutine 'f' was never awaited
  del f
RuntimeWarning: Enable tracemalloc to get the object allocation traceback
Segmentation fault: 11


--

___
Python tracker 

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



[issue45813] Importing asyncio after deleting a coroutine object and before cleaning it up leads to crashing on Python3.11

2021-11-19 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

On 3.11, both of the last two lines are required for the crash and restart.

--

___
Python tracker 

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



[issue45813] Importing asyncio after deleting a coroutine object and before cleaning it up leads to crashing on Python3.11

2021-11-19 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

No crash on Windows running in CommandPrompt (using -i to ensure that python 
survives running the test code):

C:\Users\Terry>py -3.10 -i f:/dev/tem/tem.py
f:\dev\tem\tem.py:5: RuntimeWarning: coroutine 'f' was never awaited
  del f
RuntimeWarning: Enable tracemalloc to get the object allocation traceback
>>> quit()

C:\Users\Terry>py -3.11 -i f:/dev/tem/tem.py
f:\dev\tem\tem.py:5: RuntimeWarning: coroutine 'f' was never awaited
  del f
RuntimeWarning: Enable tracemalloc to get the object allocation traceback
>>> quit()

Running in IDLE, I only see the first warning.  (IDLE bug?  python behavior 
difference?  Don't know yet.)  On 3.11, the remote process crashes and IDLE's 
Shell does an unrequested restart.

--
nosy: +terry.reedy

___
Python tracker 

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



[issue45813] Importing asyncio after deleting a coroutine object and before cleaning it up leads to crashing on Python3.11

2021-11-16 Thread Xinmeng Xia


New submission from Xinmeng Xia :

The following crashing can only reproduce on Python3.11.  In this case, we 
import "asyncio" after deleting a coroutine object and before cleaning it up, 
leading to crashing. 


test.py
===
async def f():
pass
f = f()
frame = f.cr_frame
del f

import asyncio

frame.clear()
==

>>>Python3.11 -Werror test.py
Exception ignored in: 
Traceback (most recent call last):
  File "python311/Lib/warnings.py", line 506, in _warn_unawaited_coroutine
warn(msg, category=RuntimeWarning, stacklevel=2, source=coro)
^
RuntimeWarning: coroutine 'f' was never awaited
Segmentation fault (core dumped)



Version: Python 3.11.0a2+ on Ubuntu 16.04

--
components: asyncio
messages: 406388
nosy: asvetlov, xxm, yselivanov
priority: normal
severity: normal
status: open
title: Importing asyncio after deleting a coroutine object and before cleaning 
it up leads to crashing on Python3.11
type: crash
versions: Python 3.11

___
Python tracker 

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