You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
PEP 249 refers to StandardError (gone in Python 3) #2776
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.
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.
On 28.08.2022 18:52, C.A.M. Gerlach wrote:
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 <https://github.com/malemburg> as the PEP author
and @erlend-aasland <https://github.com/erlend-aasland> as a core dev
whom I know is active with DB-API stuff to take a look at this.
PEP 249 is an informational PEP and the documentation of a living
standard in Python. The DB-SIG still makes changes to the PEP every now
and then.
It is interesting that this difference between Python 2 and 3 wasn't
raised earlier. I could also not find any documentation on why
StandardError was removed in Python 3. There's no PEP or other
documentation explaining the reasoning. The only document mentioning the
removal is the "What's New in Python 3.0"
(https://docs.python.org/3.7/whatsnew/3.0.html).
In any case, the correct replacement in Python 3 is "Exception" and I'll
add a note to the PEP.
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.
Activity
Rosuav commentedon Aug 28, 2022
Should the document say "must be a subclass of
Exception" or just drop that requirement altogether?CAM-Gerlach commentedon Aug 28, 2022
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 commentedon Aug 29, 2022
Rosuav commentedon 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.
Replace StandardError with Exception to avoid confusion when using
PEP 249: Replace StandardError with Exception (#2781)