This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author vstinner
Recipients serhiy.storchaka, vstinner
Date 2020-03-20.17:21:43
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1584724903.74.0.798653589392.issue39998@roundup.psfhosted.org>
In-reply-to
Content
Hum, I found multiple projects using PyEval_AcquireLock() and PyEval_ReleaseLock(). Many of them look abandonned. But a few were modified earlier than 1 year old.

--

ntripcaster2: Latest commit on Jun 2019 

https://github.com/rinex20/ntripcaster2/blob/ef45763c4c0b063e46ef3bbfc9d63bafcd76e421/src/interpreter.c

Example:

  PyEval_AcquireLock ();

  maininterpreterstate = mainthreadstate->interp;
  newthreadstate = PyThreadState_New (maininterpreterstate);

  PyEval_ReleaseLock ();

--

I found usage of PyEval_AcquireLock() in an old version of pygame (1.9.1, latest is 1.9.6):

    PyEval_AcquireLock ();
    oldstate = PyThreadState_Swap (helper->thread);
    ...
    result = PyObject_CallFunction (helper->tell, NULL);
    ...
    PyThreadState_Swap (oldstate);
    PyEval_ReleaseLock ();

https://github.com/z-pan/pygame_tankScout/blob/7977cc6756e948c37cb4aa56fb1009a74288b65c/pygame-1.9.1release/src/rwobject.c

pygame changed to "PyGILState_Ensure() ... PyGILState_Release()" instead.

--

giljoy (Latest commit in 2013): it seems to override symloads using LD_PRELOAD to measure time when the GIL is acquired and released.

https://github.com/itamarst/giljoy/blob/master/giljoy.c

--

xmlbus: Latest commit in 2014.

https://github.com/olger/xmlbus/blob/148692997a481d10827a1aa86dc0ed3d70d84209/server/xmlbusd/pyrunner/pyrunner.c

Example:

	PyEval_AcquireLock();
	mainInterpreterState = mainThreadState->interp;
	PyThreadState_Swap(mainThreadState);

	myThreadState = PyThreadState_New(mainInterpreterState);
	PyEval_ReleaseLock();
History
Date User Action Args
2020-03-20 17:21:43vstinnersetrecipients: + vstinner, serhiy.storchaka
2020-03-20 17:21:43vstinnersetmessageid: <1584724903.74.0.798653589392.issue39998@roundup.psfhosted.org>
2020-03-20 17:21:43vstinnerlinkissue39998 messages
2020-03-20 17:21:43vstinnercreate
Morty Proxy This is a proxified and sanitized view of the page, visit original site.