File tree Expand file tree Collapse file tree 1 file changed +8
-9
lines changed Expand file tree Collapse file tree 1 file changed +8
-9
lines changed Original file line number Diff line number Diff line change 15
15
from typing import TYPE_CHECKING , Any , TypeVar
16
16
17
17
from astroid import bases , decorators , nodes , util
18
+ from astroid .builder import extract_node
18
19
from astroid .const import Context
19
20
from astroid .context import InferenceContext , copy_context
20
21
from astroid .exceptions import (
@@ -535,15 +536,13 @@ def _generate_assigned():
535
536
yield assigned
536
537
537
538
if isinstance (self .parent , node_classes .TryStar ):
538
- # except * handler has assigned ExceptionGroup
539
- eg = nodes .ClassDef (
540
- "ExceptionGroup" ,
541
- self .lineno ,
542
- self .col_offset ,
543
- self ,
544
- end_lineno = self .end_lineno ,
545
- end_col_offset = self .end_col_offset ,
546
- )
539
+ # except * handler has assigned ExceptionGroup with caught
540
+ # exceptions under exceptions attribute
541
+ eg = next (node_classes .unpack_infer (
542
+ extract_node ('''
543
+ from builtins import ExceptionGroup
544
+ ExceptionGroup
545
+ ''' )))
547
546
assigned = objects .ExceptionInstance (eg )
548
547
assigned .instance_attrs ["exceptions" ] = [
549
548
nodes .List .from_elements (_generate_assigned ())
You can’t perform that action at this time.
0 commit comments