changeset 311:e6818f1ef1f3 default tip

fix compat with old python lib
author Alain Mazy <am@orthanc.team>
date Tue, 16 Dec 2025 19:14:22 +0100
parents f96ce88ff764
children
files Sources/StorageArea3.cpp
diffstat 1 files changed, 2 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/Sources/StorageArea3.cpp	Tue Dec 16 15:00:35 2025 +0100
+++ b/Sources/StorageArea3.cpp	Tue Dec 16 19:14:22 2025 +0100
@@ -123,7 +123,7 @@
         ORTHANC_PLUGINS_LOG_ERROR("The Python StorageCreate2 callback has not returned an int as the first element of the return tuple");
         return OrthancPluginErrorCode_Plugin;
       }
-      else if (!PyBytes_Check(pyTargetBuffer) && !Py_IsNone(pyTargetBuffer))
+      else if (!PyBytes_Check(pyTargetBuffer) && pyTargetBuffer != Py_None)
       {
         ORTHANC_PLUGINS_LOG_ERROR("The Python StorageCreate2 callback has not returned a byte array as the second element of the return tuple");
         return OrthancPluginErrorCode_Plugin;
@@ -133,7 +133,7 @@
 
       if (returnCode == OrthancPluginErrorCode_Success)
       {
-        if (Py_IsNone(pyTargetBuffer)) // no custom-data, return directly
+        if (pyTargetBuffer == Py_None) // no custom-data, return directly
         {
           customData = NULL;
           return returnCode;