AcademySoftwareFoundation / AcademySoftwareFoundation/OpenColorIO

python tests fail because failed GIL interaction

Offen
#1,939 9 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
Python
Vorherrschende Sprache
C++
Sterne
2.1k
Forks
503
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

Tested with 2.3.0 and 2.3.1 on gentoo using python-3.11 and python-3.12.

Running `ctest -R test_python` fails with:

```
test_apply (CPUProcessorTest.CPUProcessorTest.test_apply) ... pybind11::handle::inc_ref() is being called while the GIL is either not held or invalid. Please see https://pybind11.readthedocs.io/en/stable/advanced/misc.html#common-sources-of-global-interpreter-lock-errors for debugging advice.
If you are convinced there is no bug in your code, you can #define PYBIND11_NO_ASSERT_GIL_HELD_INCREF_DECREFto disable this check. In that case you have to ensure this #define is consistently used for all translation units linked into a given pybind11 extension, otherwise there will be ODR violations.The failing pybind11::handle::inc_ref() call was triggered on a numpy.ndarray object.
ERROR
test_apply_src_dst (CPUProcessorTest.CPUProcessorTest.test_apply_src_dst) ... pybind11::handle::inc_ref() is being called while the GIL is either not held or invalid. Please see https://pybind11.readthedocs.io/en/stable/advanced/misc.html#common-sources-of-global-interpreter-lock-errors for debugging advice.
If you are convinced there is no bug in your code, you can #define PYBIND11_NO_ASSERT_GIL_HELD_INCREF_DECREFto disable this check. In that case you have to ensure this #define is consistently used for all translation units linked into a given pybind11 extension, otherwise there will be ODR violations.The failing pybind11::handle::inc_ref() call was triggered on a numpy.ndarray object.
ERROR
```

```
======================================================================
ERROR: test_apply (CPUProcessorTest.CPUProcessorTest.test_apply)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/var/tmp/paludis/media-libs-opencolorio-2.3.1/work/OpenColorIO-2.3.1/tests/python/CPUProcessorTest.py", line 302, in test_apply
image = OCIO.PackedImageDesc(arr, 7, 3, 3)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
RuntimeError: pybind11::handle::inc_ref() PyGILState_Check() failure.

======================================================================
ERROR: test_apply_src_dst (CPUProcessorTest.CPUProcessorTest.test_apply_src_dst)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/var/tmp/paludis/media-libs-opencolorio-2.3.1/work/OpenColorIO-2.3.1/tests/python/CPUProcessorTest.py", line 331, in test_apply_src_dst
src_image = OCIO.PackedImageDesc(src_arr, 7, 3, 3)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
RuntimeError: pybind11::handle::inc_ref() PyGILState_Check() failure.

----------------------------------------------------------------------
```

Beitragsleitfaden

Beitragsleitfaden öffnen

Rechercherichtung

Führen Sie `ctest -R test_python` mit Python 3.11 oder 3.12 aus und untersuchen Sie die Fehlschläge in `tests/python/CPUProcessorTest.py`, insbesondere `test_apply` und `test_apply_src_dst`. Verfolgen Sie die Aufrufe von `PackedImageDesc` und den gemeldeten pybind11-GIL-Fehler; die Aufgabe ist abgeschlossen, wenn die betroffenen Tests ohne den Fehler `PyGILState_Check()` bestehen.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
cpp, python
Bereich
testing
Issue-Typ
Bug
Schwierigkeit
4/5
Geschätzter Aufwand
3-5 Tage
Aktivitätsstatus
Veraltet
Klarheit
Muss geklärt werden
Anfängerfreundlichkeit
35/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.