Let me summarize the original issue with the following quote from the python-dev thead:
> doing some sys.modules acrobatics and re-importing suddenly
changes the internal state of a previously imported [_csv] module.
The issue is now solved; both reproducers from that thread pass.
If you're interested, please read PEP 630 for a general overview of where we're at w.r.t. C-API changes that started with PEP 3121.
For the API used to fix this issue, see PEP 573; for the specific fix in _csv, see GH-23224.
Thanks to everyone involved, and especially to Nick Coghlan for helping me start this journey way back in 2013 :) |