Skip to content

Commit 3be4667

Browse files
emcdclaude
andcommitted
Fix PyPy compatibility with super() calls in slotted dataclasses.
Apply closure cell repair mechanism to PyPy in addition to CPython. The existing repair logic works correctly on PyPy since it uses standard Python introspection APIs (__code__, __closure__, cell_contents). Fixes TypeError: super(type, obj): obj must be an instance or subtype of type when calling super() in methods of classes created with slots=True dataclass transformations. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
1 parent c38426a commit 3be4667

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

sources/classcore/utilities.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ def qualify_class_name( cls: type ) -> str:
114114
def repair_class_reproduction( original: type, reproduction: type ) -> None:
115115
''' Repairs a class reproduction, if necessary. '''
116116
match __.platform.python_implementation( ):
117-
case 'CPython': # pragma: no branch
117+
case 'CPython' | 'PyPy': # pragma: no branch
118118
_repair_cpython_class_closures( original, reproduction )
119119
case _: pass # pragma: no cover
120120

0 commit comments

Comments
 (0)