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:
Terry Jan Reedy 2024-02-04 20:57:54 -05:00 committed by GitHub
parent 391659b3da
commit e207cc181f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 4 additions and 2 deletions

View file

@ -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."""

View file

@ -0,0 +1,2 @@
When csv.Error is raised when handling TypeError, do not print the TypeError
traceback.