@@ -22,7 +22,6 @@ extern "C" {
2222
2323/////////////////////////////////////////
2424// Adapted from bltinmodule.c in Python 3.7.0
25- #if PY_MAJOR_VERSION >= 3 && PY_MINOR_VERSION >= 7
2625_Py_IDENTIFIER (__mro_entries__ );
2726static PyObject *
2827update_bases (PyObject * bases )
@@ -96,16 +95,8 @@ update_bases(PyObject *bases)
9695 Py_XDECREF (new_bases );
9796 return NULL ;
9897}
99- #else
100- static PyObject *
101- update_bases (PyObject * bases )
102- {
103- return bases ;
104- }
105- #endif
10698
10799// From Python 3.7's typeobject.c
108- #if PY_MAJOR_VERSION >= 3 && PY_MINOR_VERSION >= 6
109100_Py_IDENTIFIER (__init_subclass__ );
110101static int
111102init_subclass (PyTypeObject * type , PyObject * kwds )
@@ -134,14 +125,6 @@ init_subclass(PyTypeObject *type, PyObject *kwds)
134125 return 0 ;
135126}
136127
137- #else
138- static int
139- init_subclass (PyTypeObject * type , PyObject * kwds )
140- {
141- return 0 ;
142- }
143- #endif
144-
145128// Adapted from longobject.c in Python 3.7.0
146129
147130/* This function adapted from PyLong_AsLongLongAndOverflow, but with
@@ -306,7 +289,7 @@ list_count(PyListObject *self, PyObject *value)
306289 return CPyTagged_ShortFromSsize_t (count );
307290}
308291
309- #if PY_MAJOR_VERSION >= 3 && PY_MINOR_VERSION < 8
292+ #if PY_VERSION_HEX < 0x03080000
310293static PyObject *
311294_PyDict_GetItemStringWithError (PyObject * v , const char * key )
312295{
@@ -321,13 +304,7 @@ _PyDict_GetItemStringWithError(PyObject *v, const char *key)
321304}
322305#endif
323306
324- #if PY_MAJOR_VERSION >= 3 && PY_MINOR_VERSION < 6
325- /* _PyUnicode_EqualToASCIIString got added in 3.5.3 (argh!) so we can't actually know
326- * whether it will be present at runtime, so we just assume we don't have it in 3.5. */
327- #define CPyUnicode_EqualToASCIIString (x , y ) (PyUnicode_CompareWithASCIIString((x), (y)) == 0)
328- #elif PY_MAJOR_VERSION >= 3 && PY_MINOR_VERSION >= 6
329307#define CPyUnicode_EqualToASCIIString (x , y ) _PyUnicode_EqualToASCIIString(x, y)
330- #endif
331308
332309// Adapted from genobject.c in Python 3.7.2
333310// Copied because it wasn't in 3.5.2 and it is undocumented anyways.
@@ -390,7 +367,7 @@ _CPyDictView_New(PyObject *dict, PyTypeObject *type)
390367}
391368#endif
392369
393- #if PY_MAJOR_VERSION >= 3 && PY_MINOR_VERSION >= 10
370+ #if PY_VERSION_HEX >= 0x030A0000 // 3. 10
394371static int
395372_CPyObject_HasAttrId (PyObject * v , _Py_Identifier * name ) {
396373 PyObject * tmp = NULL ;
@@ -404,7 +381,7 @@ _CPyObject_HasAttrId(PyObject *v, _Py_Identifier *name) {
404381#define _CPyObject_HasAttrId _PyObject_HasAttrId
405382#endif
406383
407- #if PY_MAJOR_VERSION >= 3 && PY_MINOR_VERSION < 9
384+ #if PY_VERSION_HEX < 0x03090000
408385// OneArgs and NoArgs functions got added in 3.9
409386#define _PyObject_CallMethodIdNoArgs (self , name ) \
410387 _PyObject_CallMethodIdObjArgs((self), (name), NULL)
0 commit comments