Closed
Description
In the following stubs, each use of Self
in a return type is incorrect:
Lines 1947 to 1959 in c626137
This is because .derive()
must be manually overridden to return custom subtypes, in which case the child class should also manually update the type annotations on .subgroup()
and .split()
1. For example:
class MyGroup(ExceptionGroup):
pass
excs = [Exception("oops")]
mg = MyGroup("msg", excs)
assert type(mg.derive(excs)) == ExceptionGroup # *not* the Self type!
Discovered via agronholm/exceptiongroup#40 (comment); if accepted here we should make sure to fix the backport too.
Footnotes
-
since I don't know of a way to express "that other method's return-type" in an annotation ↩
Metadata
Metadata
Assignees
Labels
No labels