summaryrefslogtreecommitdiffstats
path: root/Parser/myreadline.c
Commit message (Collapse)AuthorAgeFilesLines
* bpo-30555: Fix WindowsConsoleIO fails in the presence of fd redirection ↵Segev Finer2021-04-231-4/+2
| | | | | | | | (GH-1927) This works by not caching the handle and instead getting the handle from the file descriptor each time, so that if the actual handle changes by fd redirection closing/opening the console handle beneath our feet, we will keep working correctly.
* bpo-38156: Fix compiler warning in PyOS_StdioReadline() (GH-21721)Victor Stinner2020-08-041-1/+1
| | | incr cannot be larger than INT_MAX: downcast to int explicitly.
* closes bpo-38156: Always handle interrupts in PyOS_StdioReadline. (GH-21569)Benjamin Peterson2020-07-291-30/+14
| | | | | This consolidates the handling of my_fgets return values, so that interrupts are always handled, even if they come after EOF. I believe PyOS_StdioReadline is still buggy in that I/O errors will not result in a proper Python exception being set. However, that is a separate issue.
* bpo-40826: Add _PyOS_InterruptOccurred(tstate) function (GH-20599)Victor Stinner2020-06-031-4/+13
| | | | | | | | | | | | my_fgets() now calls _PyOS_InterruptOccurred(tstate) to check for pending signals, rather calling PyOS_InterruptOccurred(). my_fgets() is called with the GIL released, whereas PyOS_InterruptOccurred() must be called with the GIL held. test_repl: use text=True and avoid SuppressCrashReport in test_multiline_string_parsing(). Fix my_fgets() on Windows: fgets(fp) does crash if fileno(fp) is closed.
* bpo-40826: Fix GIL usage in PyOS_Readline() (GH-20579)Victor Stinner2020-06-011-29/+72
| | | | | | Fix GIL usage in PyOS_Readline(): lock the GIL to set an exception. Pass tstate to my_fgets() and _PyOS_WindowsConsoleReadline(). Cleanup these functions.
* bpo-40268: Remove explicit pythread.h includes (#19529)Victor Stinner2020-04-151-1/+0
| | | | Remove explicit pythread.h includes: it is always included by Python.h.
* bpo-40268: Remove a few pycore_pystate.h includes (GH-19510)Victor Stinner2020-04-141-3/+3
|
* bpo-35436: Add missing PyErr_NoMemory() calls and other minor bug fixes. ↵Zackery Spytz2018-12-071-6/+37
| | | | | | (GH-11015) Set MemoryError when appropriate, add missing failure checks, and fix some potential leaks.
* bpo-35081: Rename internal headers (GH-10275)Victor Stinner2018-11-121-1/+1
| | | | | | | | | | | | | | Rename Include/internal/ headers: * pycore_hash.h -> pycore_pyhash.h * pycore_lifecycle.h -> pycore_pylifecycle.h * pycore_mem.h -> pycore_pymem.h * pycore_state.h -> pycore_pystate.h Add missing headers to Makefile.pre.in and PCbuild: * pycore_condvar.h. * pycore_hamt.h * pycore_pyhash.h
* bpo-35081: Add _PyThreadState_GET() internal macro (GH-10266)Victor Stinner2018-11-011-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | If Py_BUILD_CORE is defined, the PyThreadState_GET() macro access _PyRuntime which comes from the internal pycore_state.h header. Public headers must not require internal headers. Move PyThreadState_GET() and _PyInterpreterState_GET_UNSAFE() from Include/pystate.h to Include/internal/pycore_state.h, and rename PyThreadState_GET() to _PyThreadState_GET() there. The PyThreadState_GET() macro of pystate.h is now redefined when pycore_state.h is included, to use the fast _PyThreadState_GET(). Changes: * Add _PyThreadState_GET() macro * Replace "PyThreadState_GET()->interp" with _PyInterpreterState_GET_UNSAFE() * Replace PyThreadState_GET() with _PyThreadState_GET() in internal C files (compiled with Py_BUILD_CORE defined), but keep PyThreadState_GET() in the public header files. * _testcapimodule.c: replace PyThreadState_GET() with PyThreadState_Get(); the module is not compiled with Py_BUILD_CORE defined. * pycore_state.h now requires Py_BUILD_CORE to be defined.
* bpo-35081: Add pycore_ prefix to internal header files (GH-10263)Victor Stinner2018-10-311-1/+1
| | | | | | | | | | | | | | | | | | | | * Rename Include/internal/ header files: * pyatomic.h -> pycore_atomic.h * ceval.h -> pycore_ceval.h * condvar.h -> pycore_condvar.h * context.h -> pycore_context.h * pygetopt.h -> pycore_getopt.h * gil.h -> pycore_gil.h * hamt.h -> pycore_hamt.h * hash.h -> pycore_hash.h * mem.h -> pycore_mem.h * pystate.h -> pycore_state.h * warnings.h -> pycore_warnings.h * PCbuild project, Makefile.pre.in, Modules/Setup: add the Include/internal/ directory to the search paths of header files. * Update includes. For example, replace #include "internal/mem.h" with #include "pycore_mem.h".
* bpo-30237: Output error when ReadConsole is canceled by CancelSynchronousIo. ↵ValeriyaSinevich2018-07-191-1/+4
| | | | (GH-7911)
* bpo-31546: Fix input hook integration (GH-7978)Thomas A Caswell2018-06-281-0/+3
|
* closes bpo-32460: ensure all non-static globals have initializers (#5061)Benjamin Peterson2017-12-311-2/+2
|
* bpo-30860: Consolidate stateful runtime globals. (#3397)Eric Snow2017-09-081-0/+1
| | | | | | | * group the (stateful) runtime globals into various topical structs * consolidate the topical structs under a single top-level _PyRuntimeState struct * add a check-c-globals.py script that helps identify runtime globals Other globals are excluded (see globals.txt and check-c-globals.py).
* bpo-31370: Remove support for threads-less builds (#3385)Antoine Pitrou2017-09-071-20/+0
| | | | | | * Remove Setup.config * Always define WITH_THREAD for compatibility.
* Issue #28333: Fixes off-by-one error that was adding an extra space.Steve Dower2016-10-251-1/+2
|
* Issue #28333: Remove unnecessary increment.Steve Dower2016-10-081-1/+1
|
* Issue #28333: Enables Unicode for ps1/ps2 and input() prompts. (Patch by ↵Steve Dower2016-10-081-4/+24
| | | | Eryk Sun)
* merge 3.5 (#28184)Benjamin Peterson2016-09-201-3/+3
|\
* | Issue #1602: Windows console doesn't input or print Unicode (PEP 528)Steve Dower2016-08-311-0/+113
| | | | | | | | Closes #17602: Adds a readline implementation for the Windows console
* | Issue #23524: Finish removing _PyVerify_fd from sourcesSteve Dower2016-09-081-4/+1
|/
* Issue #16136: Remove VMS support and VMS-related codeChristian Heimes2013-12-211-8/+0
|
* Issue #1772673: The type of `char*` arguments now changed to `const char*`.Serhiy Storchaka2013-10-191-3/+3
|
* Issue #16742: My fix on PyOS_StdioReadline() was incomplete, PyMem_FREE() wasVictor Stinner2013-10-191-3/+3
| | | | not patched
* Close #16742: Fix misuse of memory allocations in PyOS_Readline()Victor Stinner2013-10-101-6/+20
| | | | | | | | | | | | | | | | The GIL must be held to call PyMem_Malloc(), whereas PyOS_Readline() releases the GIL to read input. The result of the C callback PyOS_ReadlineFunctionPointer must now be a string allocated by PyMem_RawMalloc() or PyMem_RawRealloc() (or NULL if an error occurred), instead of a string allocated by PyMem_Malloc() or PyMem_Realloc(). Fixing this issue was required to setup a hook on PyMem_Malloc(), for example using the tracemalloc module. PyOS_Readline() copies the result of PyOS_ReadlineFunctionPointer() into a new buffer allocated by PyMem_Malloc(). So the public API of PyOS_Readline() does not change.
* Issue #18368: PyOS_StdioReadline() no longer leaks memory when realloc() fails.Christian Heimes2013-08-061-5/+17
|\
| * Issue #18368: PyOS_StdioReadline() no longer leaks memory when realloc() fails.Christian Heimes2013-08-061-5/+17
| |
* | Replace WaitForSingleObject with WaitForSingleObjectEx,Martin v. Löwis2013-01-251-1/+1
|/ | | | for better WinRT compatibility.
* Issue #1677: Handle better a race condition between the interactive ↵Tim Golden2012-06-291-23/+22
| | | | | | interpreter and the Ctrl-C signal handler on Windows
* Issue #14433: Prevent msvcrt crash in interactive prompt when stdin is closed.Martin v. Löwis2012-04-301-1/+4
|
* Issue #10350: Read and save errno before calling a function which might ↵Antoine Pitrou2011-12-161-1/+3
| | | | | | overwrite it. Original patch by Hallvard B Furuseth.
* Issue #12016: my_fgets() now always clears errors before calling fgets(). FixVictor Stinner2011-05-301-0/+1
| | | | | the following case: sys.stdin.read() stopped with CTRL+d (end of file), raw_input() interrupted by CTRL+c.
* Issue #1195: Fix input() if it is interrupted by CTRL+d and then CTRL+c, clearVictor Stinner2011-05-091-0/+1
|\ | | | | | | the end-of-file indicator after CTRL+d.
| * Issue #1195: Fix input() if it is interrupted by CTRL+d and then CTRL+c,Victor Stinner2011-05-091-0/+1
| | | | | | | | clear the end-of-file indicator after CTRL+d.
* | (Merge 3.1) Issue #11650: PyOS_StdioReadline() retries fgets() if it wasVictor Stinner2011-04-091-45/+49
|\ \ | |/ | | | | | | interrupted (EINTR), for example if the program is stopped with CTRL+z on Mac OS X. Patch written by Charles-Francois Natali.
| * Issue #11650: PyOS_StdioReadline() retries fgets() if it was interruptedVictor Stinner2011-04-091-4/+5
| | | | | | | | | | (EINTR), for example if the program is stopped with CTRL+z on Mac OS X. Patch written by Charles-Francois Natali.
| * Recorded merge of revisions 81032 via svnmerge fromAntoine Pitrou2010-05-091-120/+120
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | svn+ssh://pythondev@svn.python.org/python/branches/py3k ................ r81032 | antoine.pitrou | 2010-05-09 17:52:27 +0200 (dim., 09 mai 2010) | 9 lines Recorded merge of revisions 81029 via svnmerge from svn+ssh://pythondev@svn.python.org/python/trunk ........ r81029 | antoine.pitrou | 2010-05-09 16:46:46 +0200 (dim., 09 mai 2010) | 3 lines Untabify C files. Will watch buildbots. ........ ................
* | Recorded merge of revisions 81029 via svnmerge fromAntoine Pitrou2010-05-091-117/+117
| | | | | | | | | | | | | | | | | | | | svn+ssh://pythondev@svn.python.org/python/trunk ........ r81029 | antoine.pitrou | 2010-05-09 16:46:46 +0200 (dim., 09 mai 2010) | 3 lines Untabify C files. Will watch buildbots. ........
* | Merged revisions ↵Benjamin Peterson2010-03-211-48/+45
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 77952,78030,78102,78104,78107,78206,78216,78296-78297,78328,78331-78332,78336,78339,78343,78378-78379,78415,78559,78717,78791 via svnmerge from svn+ssh://pythondev@svn.python.org/python/trunk ........ r77952 | mark.dickinson | 2010-02-03 10:50:14 -0600 (Wed, 03 Feb 2010) | 1 line Fix test_inspect.py data to match recent change to inspect_fodder.py (r77942). ........ r78030 | benjamin.peterson | 2010-02-06 14:14:10 -0600 (Sat, 06 Feb 2010) | 1 line check type_getattro for correctness in a descriptor corner case ........ r78102 | andrew.kuchling | 2010-02-07 19:35:35 -0600 (Sun, 07 Feb 2010) | 1 line Move distutils into its own subsection; add various items ........ r78104 | andrew.kuchling | 2010-02-08 07:22:24 -0600 (Mon, 08 Feb 2010) | 1 line Add two items; move a subsection ........ r78107 | antoine.pitrou | 2010-02-08 14:25:47 -0600 (Mon, 08 Feb 2010) | 3 lines Clarify and correct description for ccbench and iobench. ........ r78206 | r.david.murray | 2010-02-16 11:55:26 -0600 (Tue, 16 Feb 2010) | 3 lines Make the references to Popen in the description of Call and check_call into links. ........ r78216 | andrew.kuchling | 2010-02-18 08:16:48 -0600 (Thu, 18 Feb 2010) | 1 line Add various items ........ r78296 | andrew.kuchling | 2010-02-21 20:08:45 -0600 (Sun, 21 Feb 2010) | 1 line Re-word ........ r78297 | andrew.kuchling | 2010-02-21 20:29:10 -0600 (Sun, 21 Feb 2010) | 1 line #7076: mention SystemRandom class near start of the module docs; reword change description for clarity. Noted by Shawn Ligocki. ........ r78328 | jack.diederich | 2010-02-22 12:17:16 -0600 (Mon, 22 Feb 2010) | 1 line fixes issue #7530, serve_forever() ........ r78331 | andrew.kuchling | 2010-02-22 12:38:23 -0600 (Mon, 22 Feb 2010) | 1 line Fix comment typo ........ r78332 | andrew.kuchling | 2010-02-22 12:42:07 -0600 (Mon, 22 Feb 2010) | 2 lines #7627: MH.remove() would fail if the MH mailbox was locked; it would call _unlock_file() and pass it a closed file object. Noted by Rob Austein. ........ r78336 | jack.diederich | 2010-02-22 13:55:22 -0600 (Mon, 22 Feb 2010) | 1 line fixes issue #1522237, bad init check in _threading_local ........ r78339 | jack.diederich | 2010-02-22 15:27:38 -0600 (Mon, 22 Feb 2010) | 1 line * fix issue#7476 ........ r78343 | andrew.kuchling | 2010-02-22 16:48:41 -0600 (Mon, 22 Feb 2010) | 10 lines #2560: remove an unnecessary 'for' loop from my_fgets() in Parser/myreadline.c. Noted by Joseph Armbruster; patch by Jessica McKellar. The original code was 'for (;;) {...}', where ... ended with a 'return -2' statement and did not contain a 'break' or 'continue' statement. Therefore, the body of the loop is always executed once. Once upon a time there was a 'continue' in the loop, but it was removed in rev36346, committed by mwh on Wed Jul 7 17:44:12 2004. ........ r78378 | jack.diederich | 2010-02-23 11:23:30 -0600 (Tue, 23 Feb 2010) | 1 line fixup markup error ........ r78379 | jack.diederich | 2010-02-23 13:34:06 -0600 (Tue, 23 Feb 2010) | 1 line issue#6442 use in operator instead of has_key ........ r78415 | dirkjan.ochtman | 2010-02-23 22:00:52 -0600 (Tue, 23 Feb 2010) | 1 line Issue #7733: add explicit reference in asyncore docs. ........ r78559 | andrew.kuchling | 2010-03-01 13:45:21 -0600 (Mon, 01 Mar 2010) | 1 line #7637: update discussion of minidom.unlink() and garbage collection ........ r78717 | benjamin.peterson | 2010-03-05 21:13:33 -0600 (Fri, 05 Mar 2010) | 1 line settscdump is definitely an implementation detail ........ r78791 | andrew.kuchling | 2010-03-08 06:00:39 -0600 (Mon, 08 Mar 2010) | 1 line Add various items ........
* Remove RISCOS supportSkip Montanaro2007-08-161-13/+0
|
* Merge p3yk branch with the trunk up to revision 45595. This breaks a fairThomas Wouters2006-04-211-3/+3
| | | | | | | | | | | | | | | | | | | | number of tests, all because of the codecs/_multibytecodecs issue described here (it's not a Py3K issue, just something Py3K discovers): http://mail.python.org/pipermail/python-dev/2006-April/064051.html Hye-Shik Chang promised to look for a fix, so no need to fix it here. The tests that are expected to break are: test_codecencodings_cn test_codecencodings_hk test_codecencodings_jp test_codecencodings_kr test_codecencodings_tw test_codecs test_multibytecodec This merge fixes an actual test failure (test_weakref) in this branch, though, so I believe merging is the right thing to do anyway.
* In a threads-disabled build, typing Ctrl-C into a raw_input() crashed,Michael W. Hudson2005-04-071-0/+4
| | | | | | | | | because (essentially) I didn't realise that PY_BEGIN/END_ALLOW_THREADS actually expanded to nothing under a no-threads build, so if you somehow NULLed out the threadstate (e.g. by calling PyThread_SaveThread) it would stay NULLed when you return to Python. Argh! Backport candidate.
* PyThreadState_Swap(NULL) didn't do what I thought it did. FixesMichael W. Hudson2004-07-081-1/+1
| | | | [ 987287 ] Python 2.4a1, interpreter hanging on Keyboard Interrupt
* "#if WITH_THREAD" is incorrect; must be #ifdef instead; WITH_THREADTim Peters2004-07-071-4/+4
| | | | isn't always set to an integer value when it's defined.
* This closes patch:Michael W. Hudson2004-07-071-3/+38
| | | | | | | | | | | | | | | | | [ 960406 ] unblock signals in threads although the changes do not correspond exactly to any patch attached to that report. Non-main threads no longer have all signals masked. A different interface to readline is used. The handling of signals inside calls to PyOS_Readline is now rather different. These changes are all a bit scary! Review and cross-platform testing much appreciated.
* Getting rid of support for the ancient Apple MPW compiler.Jack Jansen2003-11-191-7/+0
|
* Patch #708495: Port more stuff to OpenVMS.Martin v. Löwis2003-05-031-0/+8
|
* Patch #512981: Update readline input stream on sys.stdin/out change.Martin v. Löwis2002-10-261-8/+20
|
* Fix bug 439992 - [win32] KeyboardInterrupt Not Caught.Mark Hammond2002-07-141-0/+33
| | | | This gets us closer to consistent Ctrl+C behaviour on NT and Win9x. NT now reliably generates KeyboardInterrupt exceptions for NT when a file IO operation was aborted. Bugfix candidate