[issue44630] Assertion failure in csv module

Thomas Wouters report at bugs.python.org
Tue Jul 13 17:49:13 EDT 2021


New submission from Thomas Wouters <thomas at python.org>:

The csv module has some incorrect exception handling when dealing with dialect objects that are not csv.Dialect subclasses (or that otherwise raise errors when accessing the dialect attributes):

>>> csv.reader([], dialect=None)
python: ../../cpython/Objects/typeobject.c:3820: _PyType_Lookup: Assertion `!PyErr_Occurred()' failed.
Aborted

The problem is Modules/_csv.c tries to cater to dialects that lack the attributes it wants to access, but does so by leaving exceptions set between calls to PyObject_SetAttrString(). Since 3.7, that causes assertion failures. (I have a PR with a fix.)

----------
assignee: twouters
components: Extension Modules
messages: 397446
nosy: gregory.p.smith, twouters
priority: normal
severity: normal
status: open
title: Assertion failure in csv module
type: crash
versions: Python 3.10, Python 3.11, Python 3.9

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue44630>
_______________________________________


More information about the Python-bugs-list mailing list