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.
Projectberkerpeksag/astor
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
| 13 | 13 | if base not in newbases: | |
| 14 | 14 | newdict.update(vars(base)) | |
| 15 | 15 | newdict.update(clsdict) | |
| 16 | + | # These are class-bound, we should let Python recreate them. | |
| 17 | + | newdict.pop('__dict__', None) | |
| 18 | + | newdict.pop('__weakref__', None) | |
| 16 | 19 | # Delegate the real work to type | |
| 17 | 20 | return type.__new__(clstype, name, newbases, newdict) |
The check that tells the two apart
fail→pass·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
- 2026-02-17add_parens
- 2019-03-14Fix code generation with escaped braces in f-strings (#125)
- 2018-05-07Fix trailing newlines in f-strings (#103)