mirror of
https://github.com/python/cpython
synced 2024-09-05 16:38:56 +00:00
gh-114628: Display csv.Error without context (#115005)
When cvs.Error is raised when TypeError is caught, the TypeError display and 'During handling' note is just noise with duplicate information. Suppress with 'from None'.
This commit is contained in:
parent
391659b3da
commit
e207cc181f
|
@ -113,8 +113,8 @@ def _validate(self):
|
|||
try:
|
||||
_Dialect(self)
|
||||
except TypeError as e:
|
||||
# We do this for compatibility with py2.3
|
||||
raise Error(str(e))
|
||||
# Re-raise to get a traceback showing more user code.
|
||||
raise Error(str(e)) from None
|
||||
|
||||
class excel(Dialect):
|
||||
"""Describe the usual properties of Excel-generated CSV files."""
|
||||
|
|
|
@ -0,0 +1,2 @@
|
|||
When csv.Error is raised when handling TypeError, do not print the TypeError
|
||||
traceback.
|
Loading…
Reference in a new issue