Update of /cvsroot/python/python/dist/src/Parser In directory usw-pr-cvs1:/tmp/cvs-serv26440/Parser Modified Files: myreadline.c tokenizer.c Log Message: Patch #512981: Update readline input stream on sys.stdin/out change. Index: myreadline.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Parser/myreadline.c,v retrieving revision 2.27 retrieving revision 2.28 diff -C2 -d -r2.27 -r2.28 *** myreadline.c 14 Jul 2002 23:12:29 -0000 2.27 --- myreadline.c 26 Oct 2002 14:39:09 -0000 2.28 *************** *** 88,92 **** char * ! PyOS_StdioReadline(char *prompt) { size_t n; --- 88,92 ---- char * ! PyOS_StdioReadline(FILE *sys_stdin, FILE *sys_stdout, char *prompt) { size_t n; *************** *** 95,99 **** if ((p = PyMem_MALLOC(n)) == NULL) return NULL; ! fflush(stdout); #ifndef RISCOS if (prompt) --- 95,99 ---- if ((p = PyMem_MALLOC(n)) == NULL) return NULL; ! fflush(sys_stdout); #ifndef RISCOS if (prompt) *************** *** 108,112 **** #endif fflush(stderr); ! switch (my_fgets(p, (int)n, stdin)) { case 0: /* Normal case */ break; --- 108,112 ---- #endif fflush(stderr); ! switch (my_fgets(p, (int)n, sys_stdin)) { case 0: /* Normal case */ break; *************** *** 136,140 **** PyErr_SetString(PyExc_OverflowError, "input line too long"); } ! if (my_fgets(p+n, (int)incr, stdin) != 0) break; n += strlen(p+n); --- 136,140 ---- PyErr_SetString(PyExc_OverflowError, "input line too long"); } ! if (my_fgets(p+n, (int)incr, sys_stdin) != 0) break; n += strlen(p+n); *************** *** 149,153 **** Note: Python expects in return a buffer allocated with PyMem_Malloc. */ ! char *(*PyOS_ReadlineFunctionPointer)(char *); --- 149,153 ---- Note: Python expects in return a buffer allocated with PyMem_Malloc. */ ! char *(*PyOS_ReadlineFunctionPointer)(FILE *, FILE *, char *); *************** *** 155,166 **** char * ! PyOS_Readline(char *prompt) { char *rv; if (PyOS_ReadlineFunctionPointer == NULL) { ! PyOS_ReadlineFunctionPointer = PyOS_StdioReadline; } Py_BEGIN_ALLOW_THREADS ! rv = (*PyOS_ReadlineFunctionPointer)(prompt); Py_END_ALLOW_THREADS return rv; --- 155,178 ---- char * ! PyOS_Readline(FILE *sys_stdin, FILE *sys_stdout, char *prompt) { char *rv; + if (PyOS_ReadlineFunctionPointer == NULL) { ! PyOS_ReadlineFunctionPointer = PyOS_StdioReadline; } + Py_BEGIN_ALLOW_THREADS ! ! /* 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 return rv; Index: tokenizer.c =================================================================== RCS file: /cvsroot/python/python/dist/src/Parser/tokenizer.c,v retrieving revision 2.67 retrieving revision 2.68 diff -C2 -d -r2.67 -r2.68 *** tokenizer.c 3 Sep 2002 15:39:58 -0000 2.67 --- tokenizer.c 26 Oct 2002 14:39:09 -0000 2.68 *************** *** 19,23 **** #endif /* PGEN */ ! extern char *PyOS_Readline(char *); /* Return malloc'ed string including trailing \n; empty malloc'ed string for EOF; --- 19,23 ---- #endif /* PGEN */ ! extern char *PyOS_Readline(FILE *, FILE *, char *); /* Return malloc'ed string including trailing \n; empty malloc'ed string for EOF; *************** *** 672,676 **** } if (tok->prompt != NULL) { ! char *new = PyOS_Readline(tok->prompt); if (tok->nextprompt != NULL) tok->prompt = tok->nextprompt; --- 672,676 ---- } if (tok->prompt != NULL) { ! char *new = PyOS_Readline(stdin, stdout, tok->prompt); if (tok->nextprompt != NULL) tok->prompt = tok->nextprompt;
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4