-
-
Notifications
You must be signed in to change notification settings - Fork 31.8k
Display cvs.Error without TypeError context #114628
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I guess backward compatibility is a contagious thing. The comment might be out of date, but this is effectively the behavior from the ancient time until now. Changing that will not only break backward compatibility for Python 2.4, but also all the versions till 3.12. |
Right. I believe that comment can be read to say "Since this behavior goes back to at least Python 2.3, it can't be changed with a deprecation cycle". Maybe the comment should be changed to say that. |
csv.Error is a subclass of Exception. It is documented as being raised in 6 different methods. (Have not check if all true.) Many modules define their own exception or exceptions to raise in module methods. So csv is not exceptional in this, though it is inconsistent that ValueError is raised in a couple of places. The comment is obsolete and should be deleted. The other place Error is raised in based on 'if' instead of 'for' so the message is constructed directly instead of via an stdlib exception. CSVError might have been a better name, and could even be added as an alias. But I would push for that here. |
I agree we should just delete the comment.
Do you mean "would not"? Otherwise I don't understand the "But" part of that sentence. I'd be against an alias, although I agree CSVError would have been better. |
One other thing occurred to me. I'll accept that raising |
would not |
Skip, in current Python, an exception raised within
If one raises the inner exception I will make a PR revising the comment and adding 'from None'. The only other occurrence of |
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'.
csv.py
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'.
While @smontanaro You are listed as inactive csv expert. You seem to be active again. Change back to active (delete |
I'm really not interested in being "the CSV guy" (never really was, was just the last person involved). I retired several years ago and now mostly just noodle around with Python. I was more-or-less house-bound the past week or so, and stumbled on #101100, so spent some time there. I'll probably herd the few open tickets along, then get back to the other things I generally do with my time. As for the CSV module, I could solve several of the items on that list by simply deleting the |
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'.
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'.
Bug report
Bug description:
Working my way through some documentation nits for the
csv
module, I noticed this method definition:Why should we still try and maintain compatibility with Python 2.3 at this late date? Shouldn't we just let
TypeError
bubble up to the user?CPython versions tested on:
3.13
Operating systems tested on:
macOS
Linked PRs
The text was updated successfully, but these errors were encountered: