-
-
Notifications
You must be signed in to change notification settings - Fork 34.4k
TypeError on use of super() in ctypes.c_uint64 subclass #147987
Copy link
Copy link
Closed as duplicate of#73456
Labels
type-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
Description
Bug report
Bug description:
When subclassing ctypes.c_uint64, if you use super() in any method definitions you get a TypeError upon defining the class similar to the following:
import ctypes
class MyClass(ctypes.c_uint64):
def f(self):
super()TypeError: __class__ set to <class '__main__.MyClass'> defining 'MyClass' as <class '__main__.MyClass'>
This does not raise an error if subclassing other ctypes (e.g. c_uint8):
import ctypes
class MyClass(ctypes.c_uint8): # ok
def f(self):
super()It's also ok to subclass c_uint64 if you don't use super:
import ctypes
class MyClass(ctypes.c_uint64): # ok
def f(self):
passCPython versions tested on:
3.13
Operating systems tested on:
macOS
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
type-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error