Inada Naoki <[email protected]> added the comment:
> I've tried writing some Python code to reproduce this bug, but I'm unable to
> -- I should be missing something. Is there a simple snippet showing the
> issue?
Note that this is a bug from long ago. Why this bug had lived long is it can
not happen in regular cases. So it is difficult to reproduce.
See PR 11112. _csv module is changed to use PyDict_GetItemWithError.
Let's try it on Python 3.7.
Python 3.7.6 (default, Dec 30 2019, 19:38:28)
[Clang 11.0.0 (clang-1100.0.33.16)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> class S(str):
... def __hash__(self):
... raise MemoryError
...
>>> import _csv
>>> _csv.Dialect(S("excel"))
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
_csv.Error: unknown dialect
You can see the MemoryError is suppressed. Let's try it on Python 3.8.
$ python3
Python 3.8.1 (default, Jan 6 2020, 16:02:33)
(snip)
>>> _csv.Dialect(S("excel"))
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "<stdin>", line 3, in __hash__
MemoryError
You can see the MemoryError is not suppressed.
----------
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue35459>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com