Author pitrou
Recipients belopolsky, cben, eric.araujo, lesmana, loewis, ned.deily, pitrou, r.david.murray, ronaldoussoren
Date 2011-08-18.18:37:53
SpamBayes Score 9.71807e-07
Marked as misclassified No
Message-id <1313692674.05.0.0224326448436.issue5845@psf.upfronthosting.co.za>
In-reply-to
Content
Interestingly, there's already the following code in Modules/main.c:

    if ((Py_InspectFlag || (command == NULL && filename == NULL && module == NULL)) &&
        isatty(fileno(stdin))) {
        PyObject *v;
        v = PyImport_ImportModule("readline");
        if (v == NULL)
            PyErr_Clear();
        else
            Py_DECREF(v);
    }


...meaning readline already gets imported automatically when desired. And indeed:

$ ./python -S
Python 3.3.0a0 (default:50f1922bc1d5, Aug 18 2011, 00:09:47) 
[GCC 4.5.2] on linux2
>>> import sys
>>> sys.modules['readline']
<module 'readline' from '/home/antoine/cpython/default/build/lib.linux-x86_64-3.3-pydebug/readline.cpython-33dm.so'>


So perhaps we could simply change this code to import another, private module (e.g. "_setupinteractive.py") which would setup readline and rlcompleter?
History
Date User Action Args
2011-08-18 18:37:54pitrousetrecipients: + pitrou, loewis, ronaldoussoren, cben, belopolsky, ned.deily, eric.araujo, r.david.murray, lesmana
2011-08-18 18:37:54pitrousetmessageid: <1313692674.05.0.0224326448436.issue5845@psf.upfronthosting.co.za>
2011-08-18 18:37:53pitroulinkissue5845 messages
2011-08-18 18:37:53pitroucreate