-
Notifications
You must be signed in to change notification settings - Fork 659
Open
Description
Hi all,
On this line:
openexr/src/wrappers/python/PyOpenEXR_old.cpp
Line 1574 in 37ccf5c
| OpenEXR_error = PyErr_NewException ((char*) "OpenEXR.error", NULL, NULL); |
We've found that OpenEXR_error returns nullptr and will crash when it is run in the next few lines in PyDict_SetItemString. I've made the following patch to bypass this:
--- a/src/wrappers/python/PyOpenEXR_old.cpp 2025-10-20 13:41:28.625622100 +1100
+++ b/src/wrappers/python/PyOpenEXR_old.cpp 2025-10-20 13:41:35.439505100 +1100
@@ -1572,8 +1572,11 @@
PyModule_AddObject (module, "OutputFile", (PyObject*) &OutputFile_Type);
OpenEXR_error = PyErr_NewException ((char*) "OpenEXR.error", NULL, NULL);
- PyDict_SetItemString (moduleDict, "error", OpenEXR_error);
- Py_DECREF (OpenEXR_error);
+ if (OpenEXR_error)
+ {
+ PyDict_SetItemString (moduleDict, "error", OpenEXR_error);
+ Py_DECREF (OpenEXR_error);
+ }
PyObject *item;
But I'm not entirely familiar with the codebase to know if this is a valid workaround or it is just bypassing something else. With this workaround I'm able to import the module successfully without a crash.
I built this with the following:
MSVC 14.43.x
Windows 10
Python 3.11.4
Pybind11 2.9.2
Kind regards
-Alex
Metadata
Metadata
Assignees
Labels
No labels