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.
Created on 2013年06月13日 21:02 by vstinner, last changed 2022年04月11日 14:57 by admin. This issue is now closed.
| Files | ||||
|---|---|---|---|---|
| File name | Uploaded | Description | Edit | |
| readline_gil.patch | vstinner, 2013年06月13日 21:13 | review | ||
| Messages (3) | |||
|---|---|---|---|
| msg191089 - (view) | Author: STINNER Victor (vstinner) * (Python committer) | Date: 2013年06月13日 21:02 | |
The callback PyOS_ReadlineFunctionPointer (used to read a line from the standard input) must return a buffer allocated by PyMem_Malloc(), but PyOS_Readline() releases the GIL before calling PyOS_ReadlineFunctionPointer. Simplified extract of PyOS_Readline(): Py_BEGIN_ALLOW_THREADS if (!isatty (fileno (sys_stdin)) || !isatty (fileno (sys_stdout))) rv = PyOS_StdioReadline (sys_stdin, sys_stdout, prompt); else rv = (*PyOS_ReadlineFunctionPointer)(sys_stdin, sys_stdout, prompt); Py_END_ALLOW_THREADS tok_nextc() calls PyOS_Readline() and calls PyMem_FREE() to release its result. PyOS_ReadlineFunctionPointer should allocate memory using malloc(), not using PyMem_Malloc(). But PyOS_Readline() should copy the line into a buffer allocated by PyMem_Malloc() to keep backward compatibility. See also issue #18203 and #3329. |
|||
| msg191090 - (view) | Author: STINNER Victor (vstinner) * (Python committer) | Date: 2013年06月13日 21:13 | |
Here is a patch for Python 3.4. |
|||
| msg191091 - (view) | Author: STINNER Victor (vstinner) * (Python committer) | Date: 2013年06月13日 21:20 | |
Oh, this is a duplicate of #16742, read also the thread on python-dev: http://mail.python.org/pipermail/python-dev/2012-December/123225.html |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022年04月11日 14:57:46 | admin | set | github: 62405 |
| 2013年06月13日 22:07:58 | vstinner | set | superseder: PyOS_Readline drops GIL and calls PyOS_StdioReadline, which isn't thread safe |
| 2013年06月13日 21:20:09 | vstinner | set | status: open -> closed resolution: duplicate messages: + msg191091 |
| 2013年06月13日 21:13:55 | vstinner | set | files:
+ readline_gil.patch keywords: + patch messages: + msg191090 |
| 2013年06月13日 21:02:17 | vstinner | create | |