Issue 28691: python3.6 -Werror -c '"\c"' fails with an assertion error (original) (raw)
The issue #28128 (changeset 259745f9a1e4) introduced a DeprecationWarning on invalid Unicode sequence like "\c". When Python is run with -Werror, Python crashs with an assertion error:
$ ./python -Werror -c '"\c"' python: Objects/abstract.c:2232: PyObject_Call: Assertion `!PyErr_Occurred()' failed. Aborted (core dumped)
Gdb traceback:
(gdb) where #0 0x00007ffff711f6f5 in __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:54 #1 0x00007ffff71212fa in __GI_abort () at abort.c:89 #2 0x00007ffff7117f97 in __assert_fail_base (fmt=, assertion=assertion@entry=0x69b577 "!PyErr_Occurred()", file=file@entry=0x69a922 "Objects/abstract.c", line=line@entry=2232, function=function@entry=0x69b9c8 <__PRETTY_FUNCTION__.11084> "PyObject_Call") at assert.c:92 #3 0x00007ffff7118042 in __GI___assert_fail (assertion=0x69b577 "!PyErr_Occurred()", file=0x69a922 "Objects/abstract.c", line=2232, function=0x69b9c8 <__PRETTY_FUNCTION__.11084> "PyObject_Call") at assert.c:101 #4 0x000000000045afe8 in PyObject_Call (func=<type at remote 0x938a80>, args=(2, 'No such file or directory', ''), kwargs=0x0) at Objects/abstract.c:2232 #5 0x00000000005e77de in PyErr_SetFromErrnoWithFilenameObjects (exc=<type at remote 0x938a80>, filenameObject='', filenameObject2=0x0) at Python/errors.c:559 #6 0x00000000005e7631 in PyErr_SetFromErrnoWithFilenameObject (exc=<type at remote 0x938a80>, filenameObject='') at Python/errors.c:471 #7 0x000000000043e839 in _Py_fopen_obj (path='', mode=0x6c86e7 "rb") at Python/fileutils.c:1138 #8 0x00000000005e8e54 in PyErr_ProgramTextObject (filename='', lineno=1) at Python/errors.c:1179 #9 0x0000000000598e90 in ast_error (c=0x7fffffffd8b0, n=0x7ffff02d31f0, errmsg=0x7ffff02c1a80 "invalid escape sequence \c") at Python/ast.c:673 #10 0x00000000005a3ae8 in warn_invalid_escape_sequence (c=0x7fffffffd8b0, n=0x7ffff02d31f0, first_invalid_escape_char=99 'c') at Python/ast.c:4134 #11 0x00000000005a4123 in decode_unicode_with_escapes (c=0x7fffffffd8b0, n=0x7ffff02d31f0, s=0x7ffff03157f0 "\c\313\313\313\313\313\313\313\313\313", <incomplete sequence \313>, len=2) at Python/ast.c:4202 #12 0x00000000005a63b8 in parsestr (c=0x7fffffffd8b0, n=0x7ffff02d31f0, bytesmode=0x7fffffffd29c, rawmode=0x7fffffffd298, result=0x7fffffffd290, fstr=0x7fffffffd288, fstrlen=0x7fffffffd280) at Python/ast.c:5114 #13 0x00000000005a64cb in parsestrplus (c=0x7fffffffd8b0, n=0x7ffff02d31a8) at Python/ast.c:5145 #14 0x000000000059d17b in ast_for_atom (c=0x7fffffffd8b0, n=0x7ffff02d31a8) at Python/ast.c:2112 #15 0x000000000059e4d9 in ast_for_atom_expr (c=0x7fffffffd8b0, n=0x7ffff02d3160) at Python/ast.c:2467 #16 0x000000000059e649 in ast_for_power (c=0x7fffffffd8b0, n=0x7ffff02d3118) at Python/ast.c:2504 #17 0x000000000059ef95 in ast_for_expr (c=0x7fffffffd8b0, n=0x7ffff02d3118) at Python/ast.c:2692 #18 0x000000000059f8d2 in ast_for_testlist (c=0x7fffffffd8b0, n=0x7ffff0351d30) at Python/ast.c:2883 #19 0x000000000059f992 in ast_for_expr_stmt (c=0x7fffffffd8b0, n=0x7ffff0351ce8) at Python/ast.c:2906 #20 0x00000000005a3475 in ast_for_stmt (c=0x7fffffffd8b0, n=0x7ffff0351ce8) at Python/ast.c:3983 #21 0x00000000005997e8 in PyAST_FromNodeObject (n=0x7ffff0351c10, flags=0x7fffffffdcf0, filename='', arena=0x7ffff02ec040) at Python/ast.c:839 #22 0x000000000042a146 in PyParser_ASTFromFileObject (fp=0x7ffff74a78c0 <_IO_2_1_stdin_>, filename='', enc=0x7ffff7e574f8 "UTF-8", start=256, ps1=0x7ffff02cdd18 ">>> ", ps2=0x7ffff02cdde8 "... ", flags=0x7fffffffdcf0, errcode=0x7fffffffda4c, arena=0x7ffff02ec040) at Python/pythonrun.c:1169 #23 0x0000000000426b00 in PyRun_InteractiveOneObject (fp=0x7ffff74a78c0 <_IO_2_1_stdin_>, filename='', flags=0x7fffffffdcf0) at Python/pythonrun.c:212 #24 0x0000000000426698 in PyRun_InteractiveLoopFlags (fp=0x7ffff74a78c0 <_IO_2_1_stdin_>, filename_str=0x697276 "", flags=0x7fffffffdcf0) at Python/pythonrun.c:112 #25 0x0000000000426491 in PyRun_AnyFileExFlags (fp=0x7ffff74a78c0 <_IO_2_1_stdin_>, filename=0x697276 "", closeit=0, flags=0x7fffffffdcf0) at Python/pythonrun.c:74 #26 0x00000000004421cd in run_file (fp=0x7ffff74a78c0 <_IO_2_1_stdin_>, filename=0x0, p_cf=0x7fffffffdcf0) at Modules/main.c:319 #27 0x0000000000443086 in Py_Main (argc=2, argv=0x9d2010) at Modules/main.c:779 #28 0x000000000041d2c9 in main (argc=2, argv=0x7fffffffdf28) at ./Programs/python.c:69