From 377728166f47b0e85b04fdedde04b8f1eca4ae44 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dani=C3=ABl=20van=20Eeden?= Date: Tue, 8 Dec 2020 15:44:42 +0100 Subject: [PATCH] Fix compilation with Python 3.9 * https://bugs.mysql.com/bug.php?id=101910 --- mysqlshdk/scripting/python_array_wrapper.cc | 1 - mysqlshdk/scripting/python_context.cc | 2 ++ mysqlshdk/scripting/python_function_wrapper.cc | 3 +-- mysqlshdk/scripting/python_map_wrapper.cc | 6 ++---- mysqlshdk/scripting/python_object_wrapper.cc | 9 +++------ 5 files changed, 8 insertions(+), 13 deletions(-) diff --git a/mysqlshdk/scripting/python_array_wrapper.cc b/mysqlshdk/scripting/python_array_wrapper.cc index 5017ccedd..2cdaf9e35 100644 --- a/mysqlshdk/scripting/python_array_wrapper.cc +++ b/mysqlshdk/scripting/python_array_wrapper.cc @@ -362,7 +362,6 @@ static PyTypeObject PyShListObjectType = { #if PY_VERSION_HEX >= 0x03080000 , 0, // tp_vectorcall - 0 // tp_print #endif }; diff --git a/mysqlshdk/scripting/python_context.cc b/mysqlshdk/scripting/python_context.cc index 6ca8c5bde..3ac024056 100644 --- a/mysqlshdk/scripting/python_context.cc +++ b/mysqlshdk/scripting/python_context.cc @@ -429,7 +429,9 @@ Python_context::Python_context(bool redirect_stdio) : _types(this) { // Stores the main thread state _main_thread_state = PyThreadState_Get(); +#if PY_VERSION_HEX < 0x03090000 PyEval_InitThreads(); +#endif PyEval_SaveThread(); _types.init(); diff --git a/mysqlshdk/scripting/python_function_wrapper.cc b/mysqlshdk/scripting/python_function_wrapper.cc index 83e6d1a0d..4a472e959 100644 --- a/mysqlshdk/scripting/python_function_wrapper.cc +++ b/mysqlshdk/scripting/python_function_wrapper.cc @@ -177,8 +177,7 @@ static PyTypeObject PyShFuncObjectType = { #endif #if PY_VERSION_HEX >= 0x03080000 , - 0, // tp_vectorcall - 0 // tp_print + 0 // tp_vectorcall #endif }; diff --git a/mysqlshdk/scripting/python_map_wrapper.cc b/mysqlshdk/scripting/python_map_wrapper.cc index acdc19569..dd03cc760 100644 --- a/mysqlshdk/scripting/python_map_wrapper.cc +++ b/mysqlshdk/scripting/python_map_wrapper.cc @@ -423,8 +423,7 @@ static PyTypeObject Key_iterator_type = { #endif #if PY_VERSION_HEX >= 0x03080000 , - 0, // tp_vectorcall - 0 // tp_print + 0 // tp_vectorcall #endif }; @@ -548,8 +547,7 @@ static PyTypeObject PyShDictObjectType = { #endif #if PY_VERSION_HEX >= 0x03080000 , - 0, // tp_vectorcall - 0 // tp_print + 0 // tp_vectorcall #endif }; diff --git a/mysqlshdk/scripting/python_object_wrapper.cc b/mysqlshdk/scripting/python_object_wrapper.cc index 8383a689f..ddc8a6602 100644 --- a/mysqlshdk/scripting/python_object_wrapper.cc +++ b/mysqlshdk/scripting/python_object_wrapper.cc @@ -213,8 +213,7 @@ static PyTypeObject PyShMethodObjectType = { #endif #if PY_VERSION_HEX >= 0x03080000 , - 0, // tp_vectorcall - 0 // tp_print + 0 // tp_vectorcall #endif }; @@ -644,8 +643,7 @@ static PyTypeObject PyShObjObjectType = { #endif #if PY_VERSION_HEX >= 0x03080000 , - 0, // tp_vectorcall - 0 // tp_print + 0 // tp_vectorcall #endif }; @@ -736,8 +734,7 @@ static PyTypeObject PyShObjIndexedObjectType = { #endif #if PY_VERSION_HEX >= 0x03080000 , - 0, // tp_vectorcall - 0 // tp_print + 0 // tp_vectorcall #endif };