One function

MetaFlatten in berkerpeksag/astor

The author described this change as Fix TypeError when accessing TreeWalk().__dict__ (#137). It counts as a record because the check below fails on the code as it stood at 70b5924ea and passes on c5d5b3cde, with nothing else changed between the two runs.

Fix saved2019-05-12
Sharing licenceBSD-3-Clause · LICENSE
Change size+3 0

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

This metaclass is used to flatten classes to remove class hierarchy. This makes it easier to manipulate classes (find attributes in a single dict, etc.)

The change

1313 if base not in newbases:
1414 newdict.update(vars(base))
1515 newdict.update(clsdict)
16+ # These are class-bound, we should let Python recreate them.
17+ newdict.pop('__dict__', None)
18+ newdict.pop('__weakref__', None)
1619 # Delegate the real work to type
1720 return type.__new__(clstype, name, newbases, newdict)

The check that tells the two apart

failpass·tests/test_misc.py::TreeWalkTestCase::test_auto_generated_attributes

Check file tests/test_misc.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 it70b5924ea6dda8200c09fb9ba5959e14198bfd7d
Broken version dated2019-05-12
Moduleastor.tree_walk
Units changedMetaFlatten
Fingerprintce7fc3e00907bc8c
Checked2026-08-18 by goldset/0.1

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

Other bugs found in berkerpeksag/astor