Prior to this change, attempting to subclass the C implementation of
zoneinfo.ZoneInfo gave the following error:
TypeError: unbound method ZoneInfo.__init_subclass__() needs an argument
https://bugs.python.org/issue41025
pass
-class ZoneInfoTestSubclass(ZoneInfoTest):
+class ZoneInfoSubclassTest(ZoneInfoTest):
@classmethod
def setUpClass(cls):
super().setUpClass()
self.assertIsInstance(sub_obj, self.klass)
-class CZoneInfoTestSubclass(ZoneInfoTest):
+class CZoneInfoSubclassTest(ZoneInfoSubclassTest):
module = c_zoneinfo
--- /dev/null
+Fixed an issue preventing the C implementation of :class:`zoneinfo.ZoneInfo`
+from being subclassed.
{"_unpickle", (PyCFunction)zoneinfo__unpickle, METH_VARARGS | METH_CLASS,
PyDoc_STR("Private method used in unpickling.")},
{"__init_subclass__", (PyCFunction)(void (*)(void))zoneinfo_init_subclass,
- METH_VARARGS | METH_KEYWORDS,
+ METH_VARARGS | METH_KEYWORDS | METH_CLASS,
PyDoc_STR("Function to initialize subclasses.")},
{NULL} /* Sentinel */
};