Skip to content

Commit 4af9fed

Browse files
wanda-phiwhitequark
authored andcommitted
lib.data: fix wrong class name on Struct and Union.
1 parent 0564dd5 commit 4af9fed

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

amaranth/lib/data.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -801,15 +801,15 @@ def __new__(metacls, name, bases, namespace):
801801
# be instantiated. It can also be subclassed, and used to share layout and behavior.
802802
layout = dict()
803803
default = dict()
804-
for name in {**namespace["__annotations__"]}:
804+
for field_name in {**namespace["__annotations__"]}:
805805
try:
806-
Shape.cast(namespace["__annotations__"][name])
806+
Shape.cast(namespace["__annotations__"][field_name])
807807
except TypeError:
808808
# Not a shape-castable annotation; leave as-is.
809809
continue
810-
layout[name] = namespace["__annotations__"].pop(name)
811-
if name in namespace:
812-
default[name] = namespace.pop(name)
810+
layout[field_name] = namespace["__annotations__"].pop(field_name)
811+
if field_name in namespace:
812+
default[field_name] = namespace.pop(field_name)
813813
cls = type.__new__(metacls, name, bases, namespace)
814814
if cls.__layout_cls is UnionLayout:
815815
if len(default) > 1:

0 commit comments

Comments
 (0)