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 @@ class Dialect:
try: try:
_Dialect(self) _Dialect(self)
except TypeError as e: except TypeError as e:
# We do this for compatibility with py2.3 # Re-raise to get a traceback showing more user code.
raise Error(str(e)) raise Error(str(e)) from None
class excel(Dialect): class excel(Dialect):
"""Describe the usual properties of Excel-generated CSV files.""" """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.