Xavier de Gaye <xdeg...@gmail.com> added the comment:

The infinite loop may occur if one of the functions called by 
PyRun_InteractiveOneObject() returns persistently -1. This may be the case when 
there is no more memory and is handled by issue 30696.

It is not possible anymore to reproduce the infinite loop reported in the 
initial post. See how the 'enc' parameter of PyParser_ASTFromFileObject() is 
NULL in the following gdb session:

$ gdb -q python -q
Reading symbols from python...done.
(gdb) run
Starting program: /path_to/src/python/master/python
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/usr/lib/libthread_db.so.1".
Python 3.7.0a2+ (heads/master:bdf4298ae2, Oct 29 2017, 09:44:50) 
[GCC 7.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> 
Program received signal SIGINT, Interrupt.
0x00007ffff719daa7 in select () from /usr/lib/libc.so.6
(gdb) break PyParser_ASTFromFileObject
Breakpoint 1 at 0x5555555b38d1: file Python/pythonrun.c, line 1181.
(gdb) continue
Continuing.
sys.stdin = None

Breakpoint 1, PyParser_ASTFromFileObject (fp=fp@entry=0x7ffff7461860 
<_IO_2_1_stdin_>, 
    filename=filename@entry='<stdin>', enc=enc@entry=0x0, 
start=start@entry=256, 
    ps1=ps1@entry=0x7ffff6e7b220 ">>> ", ps2=ps2@entry=0x7ffff6e7beb8 "... ", 
    flags=0x7fffffffe338, errcode=0x7fffffffe244, arena=0x7ffff6eb2160) at 
Python/pythonrun.c:1181
1181    {
(gdb) continue
Continuing.
>>> print(chr(0xe9))
é

Breakpoint 1, PyParser_ASTFromFileObject (fp=fp@entry=0x7ffff7461860 
<_IO_2_1_stdin_>, 
    filename=filename@entry='<stdin>', enc=enc@entry=0x0, 
start=start@entry=256, 
    ps1=ps1@entry=0x7ffff6e7b220 ">>> ", ps2=ps2@entry=0x7ffff6e7beb8 "... ", 
    flags=0x7fffffffe338, errcode=0x7fffffffe244, arena=0x7ffff6eb2160) at 
Python/pythonrun.c:1181
1181    {
(gdb) continue
Continuing.
>>> 


Closing as out of date.

----------
nosy: +xdegaye
resolution:  -> out of date
stage:  -> resolved
status: open -> closed

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue8070>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to