The bulk of the Python readline is located in the .c: get_line file object and
FILE_BEGIN_ALLOW_THREADS(f)
FLOCKFILE(fp);
while ((c = GETC(fp)) != EOF &&
(*buf++ = c) != '\n' &&
buf != end)
;
FUNLOCKFILE(fp);
FILE_END_ALLOW_THREADS(f)
Where
#ifdef HAVE_GETC_UNLOCKED
#define GETC(f) getc_unlocked(f)
#define FLOCKFILE(f) flockfile(f)
#define FUNLOCKFILE(f) funlockfile(f)
#else
#define GETC(f) getc(f)
#define FLOCKFILE(f)
#define FUNLOCKFILE(f)
#endif
Nothing special happens there. Are you sure that your observations are what you think?
source
share