Skip to content

Commit 37c7636

Browse files
committed
The get_fields/flags/methods calls now only check the exact class.
This prevents them from following the MRO and getting fields/flags/methods from parent classes.
1 parent 982f80d commit 37c7636

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

src/ducktools/classbuilder/functions.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ def get_fields(cls, *, local=False):
4747
"""
4848
key = "local_fields" if local else "fields"
4949
try:
50-
return getattr(cls, INTERNALS_DICT)[key]
50+
return cls.__dict__[INTERNALS_DICT][key]
5151
except (AttributeError, KeyError):
5252
raise TypeError(f"{cls} is not a classbuilder generated class")
5353

@@ -61,7 +61,7 @@ def get_flags(cls):
6161
:return: dictionary of keys and flag values
6262
"""
6363
try:
64-
return getattr(cls, INTERNALS_DICT)["flags"]
64+
return cls.__dict__[INTERNALS_DICT]["flags"]
6565
except (AttributeError, KeyError):
6666
raise TypeError(f"{cls} is not a classbuilder generated class")
6767

@@ -75,7 +75,7 @@ def get_methods(cls):
7575
:return: dict of generated methods attached to the class by name
7676
"""
7777
try:
78-
return getattr(cls, INTERNALS_DICT)["methods"]
78+
return cls.__dict__[INTERNALS_DICT]["methods"]
7979
except (AttributeError, KeyError):
8080
raise TypeError(f"{cls} is not a classbuilder generated class")
8181

0 commit comments

Comments
 (0)