[issue26407] csv.writer.writerows masks exceptions from __iter__

2021-01-01 Thread Serhiy Storchaka
Change by Serhiy Storchaka : -- resolution: -> fixed stage: commit review -> resolved status: open -> closed ___ Python tracker ___

[issue26407] csv.writer.writerows masks exceptions from __iter__

2021-01-01 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: New changeset 6dffa67b98f78ae41b596f84478f3379f55d4d03 by Serhiy Storchaka in branch '3.8': [3.8] bpo-26407: Do not mask errors in csv. (GH-20536) (GH-24021) https://github.com/python/cpython/commit/6dffa67b98f78ae41b596f84478f3379f55d4d03 --

[issue26407] csv.writer.writerows masks exceptions from __iter__

2020-12-31 Thread Terry J. Reedy
Change by Terry J. Reedy : -- stage: patch review -> commit review versions: -Python 3.6, Python 3.7 ___ Python tracker ___ ___

[issue26407] csv.writer.writerows masks exceptions from __iter__

2020-12-31 Thread Serhiy Storchaka
Change by Serhiy Storchaka : -- pull_requests: +22861 pull_request: https://github.com/python/cpython/pull/24021 ___ Python tracker ___

[issue26407] csv.writer.writerows masks exceptions from __iter__

2020-06-22 Thread miss-islington
miss-islington added the comment: New changeset 5606d555b6e797625be9b0368472a86d8ad5252e by Miss Islington (bot) in branch '3.9': bpo-26407: Do not mask errors in csv. (GH-20536) https://github.com/python/cpython/commit/5606d555b6e797625be9b0368472a86d8ad5252e --

[issue26407] csv.writer.writerows masks exceptions from __iter__

2020-06-22 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: New changeset c88239f864a27f673c0f0a9e62d2488563f9d081 by Serhiy Storchaka in branch 'master': bpo-26407: Do not mask errors in csv. (GH-20536) https://github.com/python/cpython/commit/c88239f864a27f673c0f0a9e62d2488563f9d081 --

[issue26407] csv.writer.writerows masks exceptions from __iter__

2020-06-22 Thread miss-islington
Change by miss-islington : -- nosy: +miss-islington nosy_count: 3.0 -> 4.0 pull_requests: +20218 pull_request: https://github.com/python/cpython/pull/21047 ___ Python tracker

[issue26407] csv.writer.writerows masks exceptions from __iter__

2020-05-30 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: This bug occurred not only in writerows(), but also in writerow() and csv.reader(). See also more general issue40824. -- ___ Python tracker

[issue26407] csv.writer.writerows masks exceptions from __iter__

2020-05-30 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: It is definitely a bug. It can mask exceptions out of the control of the programmer like MemoryError and KeyboardInterrupt. -- components: +Library (Lib) type: enhancement -> behavior versions: +Python 3.10, Python 3.7, Python 3.8, Python 3.9

[issue26407] csv.writer.writerows masks exceptions from __iter__

2020-05-30 Thread Serhiy Storchaka
Change by Serhiy Storchaka : -- keywords: +patch nosy: +serhiy.storchaka nosy_count: 2.0 -> 3.0 pull_requests: +19779 stage: test needed -> patch review pull_request: https://github.com/python/cpython/pull/20536 ___ Python tracker

[issue26407] csv.writer.writerows masks exceptions from __iter__

2016-02-29 Thread Ilja Everilä
Ilja Everilä added the comment: I'm starting to think my initial example code was too simplified and misled from the issue at hand. It very explicitly showed what happens when some class with __iter__ raises and is passed to csv_writerows. Even then: >>> from collections.abc import Iterable

[issue26407] csv.writer.writerows masks exceptions from __iter__

2016-02-29 Thread Ilja Everilä
Ilja Everilä added the comment: As a side note PyObject_GetIter actually raises a TypeError already for non-iterables (classes without __iter__ etc.), so csv_writerows duplicates the effort at the moment. -- ___ Python tracker

[issue26407] csv.writer.writerows masks exceptions from __iter__

2016-02-29 Thread Ilja Everilä
Ilja Everilä added the comment: I have 0 beef with it being the TypeError as long as the exception chain is kept intact, especially since PY3 makes it possible. With current behaviour heisenbugs would produce some serious hair pulling, until one figures out that it is actually the __iter__

[issue26407] csv.writer.writerows masks exceptions from __iter__

2016-02-27 Thread Terry J. Reedy
Terry J. Reedy added the comment: The TypeError is correct. You passed a non-iterable. I agree that adding information, *if possible*, when 'non-iterable' is determined by an exception being raised, would be nice. I don't know how easy this would be. -- nosy: +terry.reedy stage:

[issue26407] csv.writer.writerows masks exceptions from __iter__

2016-02-23 Thread Ilja Everilä
Ilja Everilä added the comment: After doing some reading on https://docs.python.org/dev/c-api/exceptions.html it seems that this is possibly "as designed" or such, since csv_writerows explicitly calls PyErr_SetString on receiving NULL from PyObject_GetIter. Still, it feels like this could

[issue26407] csv.writer.writerows masks exceptions from __iter__

2016-02-22 Thread Ilja Everilä
New submission from Ilja Everilä: When passing a class implementing the dunder __iter__ that raises to csv.writer.writerows it hides the original exception and raises a TypeError instead. In the raised TypeError the __context__ and __cause__ both are None. For example: >>> class X: ... def