File tree Expand file tree Collapse file tree 2 files changed +9
-3
lines changed
Expand file tree Collapse file tree 2 files changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -8,4 +8,9 @@ class CIRPrinter(CPrinter):
88 """
99
1010 def _print_ComponentAccess (self , expr ):
11- return f"{ self ._print (expr .base )} .<{ expr .sindex } ,{ expr .function .ncomp } >"
11+ try :
12+ ncomp = expr .function .ncomp
13+ except AttributeError :
14+ # E.g., the argument is a plain Symbol
15+ ncomp = 'N'
16+ return f"{ self ._print (expr .base )} .<{ expr .sindex } ,{ ncomp } >"
Original file line number Diff line number Diff line change @@ -588,8 +588,9 @@ class ComponentAccess(Expr, Pickable):
588588 __rkwargs__ = ('index' ,)
589589
590590 def __new__ (cls , arg , index = 0 , ** kwargs ):
591- if not arg .is_Indexed :
592- raise ValueError ("Expected Indexed, got `%s` instead" % type (arg ))
591+ if not (arg .is_Symbol or arg .is_Indexed ):
592+ raise ValueError (f"Expected Symbol or Indexed, got `{ type (arg )} ` "
593+ "instead" )
593594 if not is_integer (index ) or index > 3 :
594595 raise ValueError ("Expected 0 <= index < 4" )
595596
You can’t perform that action at this time.
0 commit comments