Kristján Valur Jónsson added the comment:

My quick and dirty fix is simple:

    _PyOS_ReadlineTState = PyThreadState_GET();
    /* CCP change, cannot release the GIL here because PyOS_StdioReadline uses
     * the regular MALLOC
     */
    /*
    Py_BEGIN_ALLOW_THREADS
    */
#ifdef WITH_THREAD
    PyThread_acquire_lock(_PyOS_ReadlineLock, 1);
#endif

    /* This is needed to handle the unlikely case that the
     * interpreter is in interactive mode *and* stdin/out are not
     * a tty.  This can happen, for example if python is run like
     * this: python -i < test1.py
     */
    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
    */

#ifdef WITH_THREAD
    PyThread_release_lock(_PyOS_ReadlineLock);
#endif

Basically, we just comment out the lock release since we don't need it.  The 
reason we found this was that we were using GIL a custom mallocator which 
should have been run with the GIL but wasn´t.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue16742>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to