[issue31282] C APIs called without GIL in PyOS_Readline

2020-06-25 Thread STINNER Victor
STINNER Victor added the comment: I fixed this issue in bpo-40826, especially with this change: commit c353764fd564e401cf47a5d9efab18c72c60014e Author: Victor Stinner Date: Mon Jun 1 20:59:35 2020 +0200 bpo-40826: Fix GIL usage in PyOS_Readline() (GH-20579) Fix GIL usage in Py

[issue31282] C APIs called without GIL in PyOS_Readline

2017-08-28 Thread Xiang Zhang
Xiang Zhang added the comment: >>> I fixed Python 3, no? Yes. In Python3 they are replaced by PyMem_RawMalloc. But it's not only PyMem_Malloc, there are also PyErr_SetString, PyErr_NoMemory, even in Python3. BTW, even in Python3, when memory allocators are in debug mode, it finally calls bump

[issue31282] C APIs called without GIL in PyOS_Readline

2017-08-28 Thread STINNER Victor
STINNER Victor added the comment: You must hold the GIL to call PyMem_Malloc(). A debug assert should be raised if you don't hold the GIL since Python 3.6 with PYTHONMALLOC=debug. Call PyMem_RawMalloc(). I fixed Python 3, no? For Python 2, in practice you can call PyMem_Malloc() without holdin

[issue31282] C APIs called without GIL in PyOS_Readline

2017-08-27 Thread Xiang Zhang
Xiang Zhang added the comment: In pymem.h, it's stated that "The GIL must be held when using these APIs". I think the reason is when PYMALLOC_DEBUG is defined, they finally delegate to PyObject_Malloc. Victor must be familiar with them since once he proposed to remote the restriction: https:/

[issue31282] C APIs called without GIL in PyOS_Readline

2017-08-27 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: AFAIK PyMem_Malloc/MALLOC can be used with released GIL. -- ___ Python tracker ___ ___ Python-bugs

[issue31282] C APIs called without GIL in PyOS_Readline

2017-08-27 Thread Xiang Zhang
Changes by Xiang Zhang : -- stage: -> needs patch versions: +Python 3.6, Python 3.7 ___ Python tracker ___ ___ Python-bugs-list maili

[issue31282] C APIs called without GIL in PyOS_Readline

2017-08-25 Thread Serhiy Storchaka
Changes by Serhiy Storchaka : -- nosy: +haypo, serhiy.storchaka ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue31282] C APIs called without GIL in PyOS_Readline

2017-08-25 Thread Xiang Zhang
New submission from Xiang Zhang: When debugging our project I find something interesting. In PyOS_Readline it releases the GIL and delegate its job to PyOS_ReadlineFunctionPointer, which could be call_readline or PyOS_StdioReadline(I don't find where vms__StdioReadline is defined). But in the