Whole file

yuan-xy/canoser-python

The author described this change as fix getattr for enum. It counts as a record because the check below fails on the code as it stood at a420d9c3b and passes on dfe4ecadd, with nothing else changed between the two runs.

Fix saved2020-02-06
Sharing licenceMIT · LICENSE
Change size+4 1

What the code was meant to do, written into the code itself as a save note

fix getattr for enum

The change

4242 self._init_with_index_value(index, value, datatype)
4343
4444 def __getattr__(self, name):
45- return self._index == self.__class__.get_index(name)
45+ try:
46+ return self._index == self.__class__.get_index(name)
47+ except TypeError:
48+ return super().__getattr__(self, name)
4649
4750 def __setattr__(self, name, value):
4851 if name == "value":

The check that tells the two apart

failpass·test/test_enum.py::test_enum

Check file test/test_enum.py, taken without changes from the fix and copied onto the older code, so the exact same check runs against both versions.

Origin and history

The code before ita420d9c3bf998a99d2cea9af4903e11d2c141879
Broken version dated2020-02-06
Modulecanoser.rust_enum
Units changedRustEnum
Fingerprint5d26c8eb9eca0225
Checked2026-08-18 by goldset/0.1

Every field above is generated by our program. None of it is written by hand.