Skip to content

[3.9] bpo-44630: Fix assertion errors in csv module (GH-27127)#27130

Merged
miss-islington merged 1 commit intopython:3.9from
miss-islington:backport-0093876-3.9
Jul 13, 2021
Merged

[3.9] bpo-44630: Fix assertion errors in csv module (GH-27127)#27130
miss-islington merged 1 commit intopython:3.9from
miss-islington:backport-0093876-3.9

Conversation

@miss-islington
Copy link
Copy Markdown
Contributor

@miss-islington miss-islington commented Jul 13, 2021

Fix incorrect handling of exceptions when interpreting dialect objects in
the csv module. Not clearing exceptions between calls to
PyObject_GetAttrString() causes assertion failures in pydebug mode (or with
assertions enabled).

Add a minimal test that would've caught this (passing None as dialect, or
any object that isn't a csv.Dialect subclass, which the csv module allows
and caters to, even though it is not documented.) In pydebug mode, the test
triggers the assertion failure in the old code.

Contributed-By: T. Wouters [Google]
(cherry picked from commit 0093876)

Co-authored-by: T. Wouters [email protected]

https://bugs.python.org/issue44630

Automerge-Triggered-By: GH:gpshead

Fix incorrect handling of exceptions when interpreting dialect objects in
the csv module. Not clearing exceptions between calls to
PyObject_GetAttrString() causes assertion failures in pydebug mode (or with
assertions enabled).

Add a minimal test that would've caught this (passing None as dialect, or
any object that isn't a csv.Dialect subclass, which the csv module allows
and caters to, even though it is not documented.) In pydebug mode, the test
triggers the assertion failure in the old code.

Contributed-By: T. Wouters [Google]
(cherry picked from commit 0093876)

Co-authored-by: T. Wouters <[email protected]>
@miss-islington
Copy link
Copy Markdown
Contributor Author

@Yhg1s and @gpshead: Status check is done, and it's a success ✅ .

@miss-islington miss-islington merged commit fe73509 into python:3.9 Jul 13, 2021
@miss-islington miss-islington deleted the backport-0093876-3.9 branch July 13, 2021 23:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

skip news type-bug An unexpected behavior, bug, or error

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants