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 1515from typing import TYPE_CHECKING , Any , TypeVar
1616
1717from astroid import bases , decorators , nodes , util
18+ from astroid .builder import extract_node
1819from astroid .const import Context
1920from astroid .context import InferenceContext , copy_context
2021from astroid .exceptions import (
@@ -535,15 +536,13 @@ def _generate_assigned():
535536 yield assigned
536537
537538 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+ ''' )))
547546 assigned = objects .ExceptionInstance (eg )
548547 assigned .instance_attrs ["exceptions" ] = [
549548 nodes .List .from_elements (_generate_assigned ())
You can’t perform that action at this time.
0 commit comments