[issue28691] python3.6 -Werror -c '"\c"' fails with an assertion error

2016-11-15 Thread STINNER Victor

STINNER Victor added the comment:

Thanks Serhiy for your unit tests! I pushed with patch with your tests.

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



[issue28691] python3.6 -Werror -c '"\c"' fails with an assertion error

2016-11-15 Thread Roundup Robot

Roundup Robot added the comment:

New changeset aa52ea2a7731 by Victor Stinner in branch '3.6':
Fix warn_invalid_escape_sequence()
https://hg.python.org/cpython/rev/aa52ea2a7731

--
nosy: +python-dev

___
Python tracker 

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



[issue28691] python3.6 -Werror -c '"\c"' fails with an assertion error

2016-11-14 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

This is my fault. Proposed patch adds tests for the "error" action.

--
components: +Interpreter Core
nosy: +serhiy.storchaka
stage:  -> patch review
type:  -> crash
Added file: 
http://bugs.python.org/file45484/test_eval_str_invalid_escape_error.patch

___
Python tracker 

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



[issue28691] python3.6 -Werror -c '"\c"' fails with an assertion error

2016-11-14 Thread STINNER Victor

STINNER Victor added the comment:

> By the way, an unit test is missing since the bug was not catched by the test 
> suite!

Lib/test/test_string_literals.py contains an unit test but it changes the 
warnings filter, so -Werror option is ignored.

--

___
Python tracker 

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



[issue28691] python3.6 -Werror -c '"\c"' fails with an assertion error

2016-11-14 Thread STINNER Victor

STINNER Victor added the comment:

Attached ast.patch fixes the issue: replace the DeprecationWarning with a 
SyntaxError.

Is it the expected behaviour? Is it worth it to chain the two exceptions?

--
keywords: +patch
Added file: http://bugs.python.org/file45483/ast.patch

___
Python tracker 

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



[issue28691] python3.6 -Werror -c '"\c"' fails with an assertion error

2016-11-14 Thread STINNER Victor

STINNER Victor added the comment:

By the way, an unit test is missing since the bug was not catched by the test 
suite!

--

___
Python tracker 

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



[issue28691] python3.6 -Werror -c '"\c"' fails with an assertion error

2016-11-14 Thread STINNER Victor

New submission from STINNER Victor:

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  0x7711f6f5 in __GI_raise (sig=sig@entry=6) at 
../sysdeps/unix/sysv/linux/raise.c:54
#1  0x771212fa in __GI_abort () at abort.c:89
#2  0x77117f97 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  0x77118042 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  0x0045afe8 in PyObject_Call (func=, 
args=(2, 'No such file or directory', ''), kwargs=0x0) at 
Objects/abstract.c:2232
#5  0x005e77de in PyErr_SetFromErrnoWithFilenameObjects (exc=, filenameObject='', filenameObject2=0x0) at 
Python/errors.c:559
#6  0x005e7631 in PyErr_SetFromErrnoWithFilenameObject (exc=, filenameObject='') at Python/errors.c:471
#7  0x0043e839 in _Py_fopen_obj (path='', mode=0x6c86e7 "rb") at 
Python/fileutils.c:1138
#8  0x005e8e54 in PyErr_ProgramTextObject (filename='', 
lineno=1) at Python/errors.c:1179
#9  0x00598e90 in ast_error (c=0x7fffd8b0, n=0x702d31f0, 
errmsg=0x702c1a80 "invalid escape sequence \\c") at Python/ast.c:673
#10 0x005a3ae8 in warn_invalid_escape_sequence (c=0x7fffd8b0, 
n=0x702d31f0, first_invalid_escape_char=99 'c') at Python/ast.c:4134
#11 0x005a4123 in decode_unicode_with_escapes (c=0x7fffd8b0, 
n=0x702d31f0, s=0x703157f0 "\\c\313\313\313\313\313\313\313\313\313", 
, len=2)
at Python/ast.c:4202
#12 0x005a63b8 in parsestr (c=0x7fffd8b0, n=0x702d31f0, 
bytesmode=0x7fffd29c, rawmode=0x7fffd298, result=0x7fffd290, 
fstr=0x7fffd288, fstrlen=0x7fffd280)
at Python/ast.c:5114
#13 0x005a64cb in parsestrplus (c=0x7fffd8b0, n=0x702d31a8) at 
Python/ast.c:5145
#14 0x0059d17b in ast_for_atom (c=0x7fffd8b0, n=0x702d31a8) at 
Python/ast.c:2112
#15 0x0059e4d9 in ast_for_atom_expr (c=0x7fffd8b0, 
n=0x702d3160) at Python/ast.c:2467
#16 0x0059e649 in ast_for_power (c=0x7fffd8b0, n=0x702d3118) at 
Python/ast.c:2504
#17 0x0059ef95 in ast_for_expr (c=0x7fffd8b0, n=0x702d3118) at 
Python/ast.c:2692
#18 0x0059f8d2 in ast_for_testlist (c=0x7fffd8b0, n=0x70351d30) 
at Python/ast.c:2883
#19 0x0059f992 in ast_for_expr_stmt (c=0x7fffd8b0, 
n=0x70351ce8) at Python/ast.c:2906
#20 0x005a3475 in ast_for_stmt (c=0x7fffd8b0, n=0x70351ce8) at 
Python/ast.c:3983
#21 0x005997e8 in PyAST_FromNodeObject (n=0x70351c10, 
flags=0x7fffdcf0, filename='', arena=0x702ec040) at 
Python/ast.c:839
#22 0x0042a146 in PyParser_ASTFromFileObject (fp=0x774a78c0 
<_IO_2_1_stdin_>, filename='', enc=0x77e574f8 "UTF-8", start=256, 
ps1=0x702cdd18 ">>> ", 
ps2=0x702cdde8 "... ", flags=0x7fffdcf0, errcode=0x7fffda4c, 
arena=0x702ec040) at Python/pythonrun.c:1169
#23 0x00426b00 in PyRun_InteractiveOneObject (fp=0x774a78c0 
<_IO_2_1_stdin_>, filename='', flags=0x7fffdcf0) at 
Python/pythonrun.c:212
#24 0x00426698 in PyRun_InteractiveLoopFlags (fp=0x774a78c0 
<_IO_2_1_stdin_>, filename_str=0x697276 "", flags=0x7fffdcf0) at 
Python/pythonrun.c:112
#25 0x00426491 in PyRun_AnyFileExFlags (fp=0x774a78c0 
<_IO_2_1_stdin_>, filename=0x697276 "", closeit=0, flags=0x7fffdcf0) 
at Python/pythonrun.c:74
#26 0x004421cd in run_file (fp=0x774a78c0 <_IO_2_1_stdin_>, 
filename=0x0, p_cf=0x7fffdcf0) at Modules/main.c:319
#27 0x00443086 in Py_Main (argc=2, argv=0x9d2010) at Modules/main.c:779
#28 0x0041d2c9 in main (argc=2, argv=0x7fffdf28) at 
./Programs/python.c:69

--
messages: 280793
nosy: ebarry, eric.smith, haypo, ned.deily
priority: release blocker
severity: normal
status: open
title: python3.6 -Werror -c '"\c"' fails with an assertion error
versions: Python 3.6, Python 3.7

___
Python tracker 

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