pyrofork: access class __annotations__ instead of instance

Python 3.14 removed implicit fallback to class-level __annotations__,
causing AttributeError when accessing self.__annotations__. Updated
matches() to use self.__class__.__annotations__ for compatibility
across Python 3.10+.

Signed-off-by: wulan17 <wulan17@komodos.id>
This commit is contained in:
wulan17 2025-12-08 03:05:00 +07:00
parent d35abe89c4
commit 66753e44f2
No known key found for this signature in database
GPG key ID: 737814D4B5FF0420

View file

@ -46,7 +46,7 @@ class Identifier:
# Compare each property of other with the corresponding property in self
# If the property in self is None, the property in other can be anything
# If the property in self is not None, the property in other must be the same
for field in self.__annotations__:
for field in self.__class__.__annotations__:
pattern_value = getattr(self, field)
update_value = getattr(update, field)
@ -67,7 +67,7 @@ class Identifier:
def count_populated(self):
non_null_count = 0
for attr in self.__annotations__:
for attr in self.__class__.__annotations__:
if getattr(self, attr) is not None:
non_null_count += 1