@@ -56,13 +56,6 @@ class Signature(wiring.Signature):
5656 def __init__ (self , shape , access ):
5757 if not isinstance (shape , ShapeLike ):
5858 raise TypeError (f"Field shape must be a shape-like object, not { shape !r} " )
59- # TODO(py3.9): Remove this. Python 3.8 and below use cls.__name__ in the error message
60- # instead of cls.__qualname__.
61- # FieldPort.Access(access)
62- try :
63- FieldPort .Access (access )
64- except ValueError as e :
65- raise ValueError (f"{ access !r} is not a valid FieldPort.Access" ) from e
6659
6760 self ._shape = Shape .cast (shape )
6861 self ._access = FieldPort .Access (access )
@@ -461,13 +454,7 @@ class Register(wiring.Component):
461454
462455 def __init_subclass__ (cls , * , access = None , ** kwargs ):
463456 if access is not None :
464- # TODO(py3.9): Remove this. Python 3.8 and below use cls.__name__ in the error message
465- # instead of cls.__qualname__.
466- # cls._access = Element.Access(access)
467- try :
468- cls ._access = Element .Access (access )
469- except ValueError as e :
470- raise ValueError (f"{ access !r} is not a valid Element.Access" ) from e
457+ cls ._access = Element .Access (access )
471458 cls .__doc__ = cls ._doc_template .format (parameters = "" )
472459 super ().__init_subclass__ (** kwargs )
473460
@@ -493,11 +480,7 @@ def filter_fields(src):
493480 f"field annotations: { ', ' .join (annot_fields )} " )
494481
495482 if access is not None :
496- # TODO(py3.9): Remove this (see above).
497- try :
498- access = Element .Access (access )
499- except ValueError as e :
500- raise ValueError (f"{ access !r} is not a valid Element.Access" ) from e
483+ access = Element .Access (access )
501484 if hasattr (self , "_access" ) and access != self ._access :
502485 raise ValueError (f"Element access mode { access } conflicts with the value "
503486 f"provided during class creation: { self ._access } " )
0 commit comments