STINNER Victor <vstin...@redhat.com> added the comment:

The bug can be reproduced on the master branch of Python. I tested with 
versions:

* lxml 4.3.4
* xmlsec 1.3.3  

The filename comes from a lxml.etree.XMLSyntaxError exception which inherits 
from SyntaxError. The bug can be reproduced without lxml nor xmlsec, just with 
attached excepthook_syntaxerror.py:

$ ./python excepthook_syntaxerror.py
Traceback (most recent call last):
  File "/home/vstinner/prog/python/master/excepthook_syntaxerror.py", line 3, 
in <module>
    raise SyntaxError("msg", (b"bytes_filename", 123, 0, "text"))
Objects/unicodeobject.c:492: _PyUnicode_CheckConsistency: Assertion 
"((((((PyObject*)(op))->ob_type))->tp_flags & ((1UL << 28))) != 0)" failed
Enable tracemalloc to get the memory block allocation traceback

object  : b'bytes_filename'
type    : bytes
refcount: 4
address : 0x7fe22fe7ce50
Fatal Python error: _PyObject_AssertFailed

Current thread 0x00007fe23cfbf740 (most recent call first):
  File "/home/vstinner/prog/python/master/excepthook_syntaxerror.py", line 5 in 
<module>
Aborted (core dumped)


excepthook_syntaxerror.py uses:

raise SyntaxError("msg", (b"bytes_filename", 123, 0, "text"))

----------
title: print_exception() crash when lxml 4.2.5 raises a parser error -> 
print_exception() crash when lxml/xmlsec raises a parser error
versions: +Python 3.8, Python 3.9
Added file: https://bugs.python.org/file48451/excepthook_syntaxerror.py

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

Reply via email to