OpenBluetoothToolbox / SimpleBLE

SimpleBLE - the all-in-one Bluetooth library for MacOS, iOS, Windows, Linux and Android.
https://www.simpleble.org
Other
619 stars 107 forks source link

Acquire the GIL before creating a py::bytes objects in callbacks #283

Open nomenquis opened 6 months ago

nomenquis commented 6 months ago

The constructor of the py::bytes objects runs before the GIL is automatically acquired by the wrapped callback. So we have to make sure to acquire the GIL ourselves before, otherwise we'd run into corruption since PyMem_Malloc and friends are not thread safe.

CLAassistant commented 2 weeks ago

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.