Skip to content

PEP 249 refers to StandardError (gone in Python 3) #2776

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

Closed
pchemguy opened this issue Aug 28, 2022 · 4 comments · Fixed by #2781
Closed

PEP 249 refers to StandardError (gone in Python 3) #2776

pchemguy opened this issue Aug 28, 2022 · 4 comments · Fixed by #2781
Assignees
Labels

Comments

@pchemguy
Copy link

PEP 249 / DB API 2.0 refers to the StandardError Python exception as the starting point for its exception hierarchy, but this exception is gone in Python 3.

@Rosuav
Copy link
Contributor

Rosuav commented Aug 28, 2022

Should the document say "must be a subclass of Exception" or just drop that requirement altogether?

@CAM-Gerlach
Copy link
Member

Normally, PEPs are considered historical documents, but in this special case it describes an ongoing specification, and I'm not sure there is another place this is documented (though perhaps ideally there should be). Pinging @malemburg as the PEP author and @erlend-aasland as a core dev whom I know is active with DB-API stuff to take a look at this.

@malemburg
Copy link
Member

malemburg commented Aug 29, 2022 via email

@Rosuav
Copy link
Contributor

Rosuav commented Aug 29, 2022

The justification for removing StandardError was basically "it ain't needed no more". From my reading of things, it looks like the removal of string exceptions also removed the need for extra types of hierarchy in class exceptions.

I think the entire sentence can be dropped, actually - if it weren't there, anyone creating a database module would still use Exception as a base class, as subclassing BaseException directly is rare and not what you'd want here.

@malemburg malemburg self-assigned this Aug 29, 2022
@malemburg malemburg added the bug label Aug 29, 2022
malemburg added a commit to malemburg/peps that referenced this issue Sep 2, 2022
the DB-API 2.0 in the context of Python 3.

Add a note about a future upgrade to the Warning base class.

Fixes python#2776.
malemburg added a commit that referenced this issue Sep 6, 2022
* Replace StandardError with Exception to avoid confusion when using
the DB-API 2.0 in the context of Python 3.

Add a note about a future upgrade to the Warning base class.

Fixes #2776.

* Fix typo and add year for more context.

* Remove mention of the exceptions module

This was removed in Python 3 as well.  Python 2.7 doesn't need it either,
since all standard exceptions are builtin objects.

* Remove mention of exception objects being builtins.

They were already for a very long time, so this is pointless.
I only had this sentence to explain why I had removed the
"import exceptions" line from the Python 2 days.

* Grammar fix

* Fix exception hierarchy formatting
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants