From 8fe91520846bbafbe0add670d48c286f56543bfc Mon Sep 17 00:00:00 2001 From: Adam Rankin Date: Tue, 7 Nov 2023 12:17:21 -0500 Subject: [PATCH 1/2] BUG: Removing duplicate error and constant entry for NDI_OKAY --- ndicapimodule.cxx | 1 - 1 file changed, 1 deletion(-) diff --git a/ndicapimodule.cxx b/ndicapimodule.cxx index b09b4c1..c08ea8c 100644 --- a/ndicapimodule.cxx +++ b/ndicapimodule.cxx @@ -1764,7 +1764,6 @@ ndicapiExport MOD_INIT(ndicapy) Py_NDIConstantMacro(NDI_OKAY); - Py_NDIErrcodeMacro(NDI_OKAY); Py_NDIErrcodeMacro(NDI_INVALID); Py_NDIErrcodeMacro(NDI_TOO_LONG); Py_NDIErrcodeMacro(NDI_TOO_SHORT); From 92444d6afef0df10c21cb4ac2e83d4ff46c54e12 Mon Sep 17 00:00:00 2001 From: Adam Rankin Date: Thu, 18 Jan 2024 20:21:03 -0500 Subject: [PATCH 2/2] Fixes #42 Enabling build for Python 3.11+ by using new PY_SET_TYPE macro --- ndicapimodule.cxx | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/ndicapimodule.cxx b/ndicapimodule.cxx index c08ea8c..ecabbd6 100644 --- a/ndicapimodule.cxx +++ b/ndicapimodule.cxx @@ -1748,8 +1748,13 @@ ndicapiExport MOD_INIT(ndicapy) PyNdicapiType.ob_type = &PyType_Type; PyNDIBitfield_Type.ob_type = &PyType_Type; #else - Py_TYPE(&PyNdicapiType) = &PyType_Type; - Py_TYPE(&PyNDIBitfield_Type) = &PyType_Type; + #if PY_MINOR_VERSION < 11 + Py_TYPE(&PyNdicapiType) = &PyType_Type; + Py_TYPE(&PyNDIBitfield_Type) = &PyType_Type; + #else + Py_SET_TYPE(&PyNdicapiType, &PyType_Type); + Py_SET_TYPE(&PyNDIBitfield_Type, &PyType_Type); + #endif #endif MOD_DEF(module, "ndicapy", NULL, NdicapiMethods);