summaryrefslogtreecommitdiffstats
path: root/Modules/readline.c
Commit message (Collapse)AuthorAgeFilesLines
* gh-116322: Rename PyModule_ExperimentalSetGIL to PyUnstable_Module_SetGIL ↵Petr Viktorin2024-05-061-1/+1
| | | | (GH-118645)
* gh-116322: Add Py_mod_gil module slot (#116882)Brett Simmers2024-05-031-0/+3
| | | | | | | | | | | | | | This PR adds the ability to enable the GIL if it was disabled at interpreter startup, and modifies the multi-phase module initialization path to enable the GIL when loading a module, unless that module's spec includes a slot indicating it can run safely without the GIL. PEP 703 called the constant for the slot `Py_mod_gil_not_used`; I went with `Py_MOD_GIL_NOT_USED` for consistency with gh-104148. A warning will be issued up to once per interpreter for the first GIL-using module that is loaded. If `-v` is given, a shorter message will be printed to stderr every time a GIL-using module is loaded (including the first one that issues a warning).
* gh-117845: Detect libedit hook function signature in configure (#117870)Joshua Root2024-04-171-2/+2
| | | | | | Older libedit versions (like Apple's) use a different type signature for rl_startup_hook and rl_pre_input_hook. Add a configure check to determine which signature is accepted by introducing the Py_RL_STARTUP_HOOK_TAKES_ARGS macro in pyconfig.h.
* gh-105323: Remove `WITH_APPLE_EDITLINE` to use the same declaration for all ↵Tian Gao2023-12-051-6/+2
| | | | editline (gh-112513)
* gh-112510: Add `readline.backend` for the backend readline uses (GH-112511)Tian Gao2023-12-011-1/+8
| | | | Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com> Co-authored-by: Donghee Na <donghee.na92@gmail.com>
* gh-112105: Make completer delims work on libedit (gh-112106)Tian Gao2023-11-281-0/+16
|
* gh-112292 : Catch import error conditions with readline hooks (gh-112313)Anthony Shaw2023-11-281-22/+69
| | | | | Prevents a segmentation fault in registered hooks for the readline library, but only when the readline module is loaded inside an isolated sub interpreter. The module is single-phase init so loading it fails, but not until the module init function has already run, where the readline hooks get registered. The readlinestate_global macro was error-prone to PyImport_FindModule returning NULL and crashing in about 18 places. I could reproduce 1 easily, but this PR replaces the macro with a function and adds error conditions to the other functions.
* gh-109191: Fix build with newer editline (gh-110239)Bo Anderson2023-10-091-1/+1
|
* gh-105323: Update readline module to detect apple editline variant (gh-108665)Donghee Na2023-09-291-0/+4
|
* gh-108765: Python.h no longer includes <sys/time.h> (#108775)Victor Stinner2023-09-021-8/+8
| | | | | | | | | Python.h no longer includes <time.h>, <sys/select.h> and <sys/time.h> standard header files. * Add <time.h> include to xxsubtype.c. * Add <sys/time.h> include to posixmodule.c and semaphore.c. * readline.c includes <sys/select.h> instead of <sys/time.h>. * resource.c no longer includes <time.h> and <sys/time.h>.
* gh-108444: Replace _PyLong_AsInt() with PyLong_AsInt() (#108459)Victor Stinner2023-08-241-1/+1
| | | | | | Change generated by the command: sed -i -e 's!_PyLong_AsInt!PyLong_AsInt!g' \ $(find -name "*.c" -o -name "*.h")
* gh-106320: Remove _PyOS_ReadlineTState API (#107034)Victor Stinner2023-07-221-0/+3
| | | | Remove _PyOS_ReadlineTState variable from the public C API. The symbol is still exported for the readline shared extension.
* gh-106320: Remove private pylifecycle.h functions (#106400)Victor Stinner2023-07-041-0/+5
| | | | | | | Remove private pylifecycle.h functions: move them to the internal C API ( pycore_atexit.h, pycore_pylifecycle.h and pycore_signal.h). No longer export most of these functions. Move _testcapi.test_atexit() to _testinternalcapi.
* gh-105240: add missing function prototypes (#105241)Irit Katriel2023-06-021-2/+2
|
* gh-89886: Rely on HAVE_SYS_TIME_H (#105058)Erlend E. Aasland2023-06-011-0/+3
| | | | | | | Quoting autoconf (v2.71): All current systems provide time.h; it need not be checked for. Not all systems provide sys/time.h, but those that do, all allow you to include it and time.h simultaneously.
* gh-99300: Use Py_NewRef() in Modules/ directory (#99469)Victor Stinner2022-11-141-8/+4
| | | | Replace Py_INCREF() and Py_XINCREF() with Py_NewRef() and Py_XNewRef() in test C files of the Modules/ directory.
* Fix readline.c compiler warning. (GH-98738)Benjamin Peterson2022-10-261-1/+1
| | | | | | | ``` Modules/readline.c:1260:37: warning: assigning to 'char *' from 'const char *' discards qualifiers [-Wincompatible-pointer-types-discards-qualifiers] completer_word_break_characters = ^ ```
* bpo-45434: pyport.h no longer includes <stdlib.h> (GH-28914)Victor Stinner2021-10-131-2/+4
| | | | | Include <stdlib.h> explicitly in C files. Python.h includes <wchar.h>.
* bpo-42819, readline: Disable bracketed paste (GH-24108)Dustin Rodrigues2021-02-151-0/+23
|
* bpo-43172: readline now passes its tests when built against libedit (GH-24499)Gregory P. Smith2021-02-121-8/+30
| | | | | | | bpo-43172: readline now passes its tests when built against libedit. Existing irreconcilable API differences remain in readline.get_begidx and readline.get_endidx behavior based on libreadline vs libedit use. A note about that has been documented.
* bpo-13501: allow choosing between readline and libedit (GH-24189)Roland Hieber2021-02-091-3/+7
| | | | | | | | | | | | | | | | | | | | | | | In contrast to macOS, libedit is available as its own include file and library on Linux systems to prevent file name clashes. So if both libraries are available on the system, readline is currently chosen by default; and if only libedit is available, it is not found at all. This patch adds a way to link against libedit by adding the following arguments to configure: --with-readline link against libreadline (the default) --with-readline=editline link against libeditline --with-readline=no disable building the readline module --without-readline (same) The runtime detection of libedit vs. readline was already done in commit 7105319ada2e66365902 (2019-12-04, serge-sans-paille: "bpo-38634: Allow non-apple build to cope with libedit (GH-16986)"). Fixes: GH-12076 ("bpo-13501 Build or disable readline with Editline") Fixes: bpo-13501 ("Make libedit support more generic; port readline / libedit to FreeBSD") Co-authored-by: Enji Cooper (ngie-eign) Co-authored-by: Martin Panter (vadmium) Co-authored-by: Robert Marshall (kellinm)
* Fix minor typo in comments in readline.c (GH-23911)Jero Bado2020-12-291-1/+1
|
* bpo-20181: Convert the readline module to the Argument Clinic (#14326)Zackery Spytz2020-07-121-247/+336
|
* bpo-39943: Add the const qualifier to pointers on non-mutable PyBytes data. ↵Serhiy Storchaka2020-04-121-2/+2
| | | | (GH-19472)
* bpo-39968: Fix a typo error in get_readline_state() (GH-19028)Hai Shi2020-03-161-1/+1
|
* bpo-39968: Convert extension modules' macros of get_module_state() to inline ↵Hai Shi2020-03-161-4/+9
| | | | functions (GH-19017)
* bpo-38634: Allow non-apple build to cope with libedit (GH-16986)serge-sans-paille2019-12-041-19/+4
| | | | | | | | | | | The readline module now detects if Python is linked to libedit at runtime on all platforms. Previously, the check was only done on macOS. If Python is used as a library by a binary linking to libedit, the linker resolves the rl_initialize symbol required by the readline module against libedit instead of libreadline, which leads to a segfault. Take advantage of the existing supporting code to have readline module being compatible with both situations.
* bpo-38631: Avoid Py_FatalError() in readline (GH-16998)Victor Stinner2019-10-301-6/+11
| | | | readline now calls PyErr_NoMemory() rather than Py_FatalError() on memory allocation failure, when importing the module.
* bpo-37194: Add a new public PyObject_CallNoArgs() function (GH-13890)Victor Stinner2019-06-171-1/+1
| | | | | | | | | | | | | | | Add a new public PyObject_CallNoArgs() function to the C API: call a callable Python object without any arguments. It is the most efficient way to call a callback without any argument. On x86-64, for example, PyObject_CallFunctionObjArgs(func, NULL) allocates 960 bytes on the stack per call, whereas PyObject_CallNoArgs(func) only allocates 624 bytes per call. It is excluded from stable ABI 3.8. Replace private _PyObject_CallNoArg() with public PyObject_CallNoArgs() in C extensions: _asyncio, _datetime, _elementtree, _pickle, _tkinter and readline.
* bpo-35441: Remove dead and buggy code related to PyList_SetItem(). (GH-11033)Zackery Spytz2018-12-081-2/+1
| | | | | | | | | | In _localemodule.c and selectmodule.c, remove dead code that would cause double decrefs if run. In addition, replace PyList_SetItem() with PyList_SET_ITEM() in cases where a new list is populated and there is no possibility of an error. In addition, check if the list changed size in the loop in array_array_fromlist().
* Fix compiler warning in call_readline() (GH-10820)Victor Stinner2018-11-301-3/+3
| | | | | | | | | | | | | | Replace strncpy() with memcpy() in call_readline() to fix the following warning, the NUL byte is written manually just after: Modules/readline.c: In function ‘call_readline’: Modules/readline.c:1303:9: warning: ‘strncpy’ output truncated before terminating nul copying as many bytes from a string as its length [-Wstringop-truncation] strncpy(p, q, n); ^~~~~~~~~~~~~~~~ Modules/readline.c:1279:9: note: length computed here n = strlen(p); ^~~~~~~~~
* bpo-13631: Fix the order of initialization for readline libedit on macOS. ↵Zvezdan Petkovic2018-05-171-1/+3
| | | | | | (GH-6915) The editline emulation needs to be initialized *after* the name is defined. This fixes the long open issue.
* bpo-29240: Fix locale encodings in UTF-8 Mode (#5170)Victor Stinner2018-01-151-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | Modify locale.localeconv(), time.tzname, os.strerror() and other functions to ignore the UTF-8 Mode: always use the current locale encoding. Changes: * Add _Py_DecodeLocaleEx() and _Py_EncodeLocaleEx(). On decoding or encoding error, they return the position of the error and an error message which are used to raise Unicode errors in PyUnicode_DecodeLocale() and PyUnicode_EncodeLocale(). * Replace _Py_DecodeCurrentLocale() with _Py_DecodeLocaleEx(). * PyUnicode_DecodeLocale() now uses _Py_DecodeLocaleEx() for all cases, especially for the strict error handler. * Add _Py_DecodeUTF8Ex(): return more information on decoding error and supports the strict error handler. * Rename _Py_EncodeUTF8_surrogateescape() to _Py_EncodeUTF8Ex(). * Replace _Py_EncodeCurrentLocale() with _Py_EncodeLocaleEx(). * Ignore the UTF-8 mode to encode/decode localeconv(), strerror() and time zone name. * Remove PyUnicode_DecodeLocale(), PyUnicode_DecodeLocaleAndSize() and PyUnicode_EncodeLocale() now ignore the UTF-8 mode: always use the "current" locale. * Remove _PyUnicode_DecodeCurrentLocale(), _PyUnicode_DecodeCurrentLocaleAndSize() and _PyUnicode_EncodeCurrentLocale().
* bpo-29240: Ignore UTF-8 Mode in time module (#5148)Victor Stinner2018-01-111-2/+1
| | | | | | time.strftime() must use the current LC_CTYPE encoding, not UTF-8 if the UTF-8 mode is enabled. Add _PyUnicode_DecodeCurrentLocale() function.
* bpo-29240: readline now ignores the UTF-8 Mode (#5145)Victor Stinner2018-01-101-2/+3
| | | | | | | | | | | | Add new fuctions ignoring the UTF-8 mode: * _Py_DecodeCurrentLocale() * _Py_EncodeCurrentLocale() * _PyUnicode_DecodeCurrentLocaleAndSize() * _PyUnicode_EncodeCurrentLocale() Modify the readline module to use these functions. Re-enable test_readline.test_nonascii().
* Fix CID-1414686: PyInit_readline() handles errors (#4647)Victor Stinner2017-11-301-4/+18
| | | | | | | | | | | | Handle PyModule_AddIntConstant() and PyModule_AddStringConstant() failures. Add also constants before calling setup_readline(), since setup_readline() registers callbacks which uses a reference to the module, whereas the module is destroyed if adding constants fails. Fix Coverity warning: CID 1414686: Unchecked return value (CHECKED_RETURN) 2. check_return: Calling PyModule_AddStringConstant without checking return value (as is done elsewhere 45 out of 55 times).
* bpo-28180: Fix the implementation of PEP 538 on Android (GH-4334)xdegaye2017-11-121-1/+1
|
* bpo-31370: Remove support for threads-less builds (#3385)Antoine Pitrou2017-09-071-24/+0
| | | | | | * Remove Setup.config * Always define WITH_THREAD for compatibility.
* bpo-30946: Remove obsolete fallback code in readline module (#2738)Antoine Pitrou2017-07-181-46/+1
| | | | | | | | | | * Remove obsolete fallback code in readline module * Add NEWS * Remove obsolete include * Fix macro on Windows
* bpo-29854: test_readline logs versions (#2619)Victor Stinner2017-07-071-0/+1
| | | | | * test_readline logs the versions of libreadline when run in verbose mode * Add also readline._READLINE_LIBRARY_VERSION
* bpo-29854: Fix segfault in call_readline() (GH-728)Nir Soffer2017-07-071-4/+6
| | | | | | | | | | | | | If history-length is set in .inputrc, and the history file is double the history size (or more), history_get(N) returns NULL, and python segfaults. Fix that by checking for NULL return value. It seems that the root cause is incorrect handling of bigger history in readline, but Python should not segfault even if readline returns unexpected value. This issue affects only GNU readline. When using libedit emulation system history size option does not work.
* bpo-30022: Get rid of using EnvironmentError and IOError (except test… (#1051)Serhiy Storchaka2017-04-161-4/+4
|
* Replace PyObject_CallFunction() with fastcallVictor Stinner2016-12-011-1/+1
| | | | | | | | | | | | | | | | | Replace PyObject_CallFunction(func, "O", arg) and PyObject_CallFunction(func, "O", arg, NULL) with _PyObject_CallArg1(func, arg) Replace PyObject_CallFunction(func, NULL) with _PyObject_CallNoArg(func) _PyObject_CallNoArg() and _PyObject_CallArg1() are simpler and don't allocate memory on the C stack.
* merge 3.5Benjamin Peterson2016-09-061-1/+1
|\
| * explicitly cast away constness to silence compiler warningBenjamin Peterson2016-09-061-1/+1
| |
* | Issue #19884: Merge Readline updates from 3.5Martin Panter2016-08-271-12/+15
|\ \ | |/
| * Issue #19884: Avoid spurious output on OS X with Gnu ReadlineMartin Panter2016-08-271-12/+15
| | | | | | | | | | Also adjust the test condition, because enable-meta-key was only added in 6.1, not 6.0.
* | Issue #16182: Merge readline locale fix from 3.5Martin Panter2016-06-141-38/+94
|\ \ | |/
| * Issue #16182: Fix readline begidx, endidx, and use locale encodingMartin Panter2016-06-141-38/+94
| | | | | | | | Based on patch by Serhiy Storchaka.
* | Issue #27171: Merge typo fixes from 3.5Martin Panter2016-06-021-1/+1
|\ \ | |/