[New-bugs-announce] [issue31282] C APIs called without GIL in PyOS_Readline

Xiang Zhang report at bugs.python.org
Sat Aug 26 00:51:13 EDT 2017

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 two functions, they use some C APIs like PyMem_Malloc/MALLOC, PyErr_SetString which need guarded by GIL. I don't understand why not doing find-grained lock control in call_readline or PyOS_StdioReadline since the code is ancient. :-(

I find this because our project makes test_cmd_line fail with `echo "Timer\n" | python -i -m timeit -n 1`.

components: Interpreter Core
messages: 300862
nosy: xiang.zhang
priority: normal
severity: normal
status: open
title: C APIs called without GIL in PyOS_Readline
type: behavior
versions: Python 2.7

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list