One function
Abstract in reinhrst/abstractcp
The author described this change as “Fix __abstractmethods__ attribute error in subclasses of ABC and Abstract derived class. Update tests.”. It counts as a record because the checks below fail on the code as it stood at abfd4cc7d and pass on 130f6d565, with nothing else changed between the two runs.
Projectreinhrst/abstractcp
Fix saved2021-03-03
Sharing licenceMIT · LICENSE
Change size+4 −0
What the code was meant to do, written into the code itself as a docstring
Only direct inheritance from this class makes subclasses abstract. Use: class A(acp.Abstract): x: int = acp.abstract_class_property(int) y: str = acp.abstract_class_property(str) class B(A): x: t.Literal[1] = 1 y: t.Literal["spam"] = "spam"
The change
| 32 | 32 | # assumed to be non-abstract, and therefore should have all | |
| 33 | 33 | # properties defined | |
| 34 | 34 | for name in dir(cls): | |
| 35 | + | if name.startswith("__") and name.endswith("__"): | |
| 36 | + | # internal names are ignored since they may have magic attached | |
| 37 | + | # when accessing | |
| 38 | + | continue | |
| 35 | 39 | if isinstance(getattr(cls, name), _AbstractClassProperty): | |
| 36 | 40 | raise TypeError( | |
| 37 | 41 | f"Class {cls.__name__} must define abstract class " |
The check that tells the two apart
fail→pass·tests/test_define.py::test_combine_with_abc_ABC_first
fail→pass·tests/test_define.py::test_combine_with_abc_ABC_second
Check file tests/test_define.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 itabfd4cc7d2fb71317a6f2aa35249ef602a4f58c8
Broken version dated2021-03-02
Moduleabstractcp.__init__
Units changedAbstract
Fingerprint460649a22a9cc889
Checked2026-08-18 by goldset/0.1
Every field above is generated by our program. None of it is written by hand.