| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
|
|
|
| |
(GH-19472)
|
| |
|
|
|
|
| |
functions (GH-19017)
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
| |
readline now calls PyErr_NoMemory() rather than Py_FatalError() on
memory allocation failure, when importing the module.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
|
| |
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().
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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);
^~~~~~~~~
|
|
|
|
|
|
| |
(GH-6915)
The editline emulation needs to be initialized *after* the name is
defined. This fixes the long open issue.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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().
|
|
|
|
|
|
| |
time.strftime() must use the current LC_CTYPE encoding, not UTF-8
if the UTF-8 mode is enabled.
Add _PyUnicode_DecodeCurrentLocale() function.
|
|
|
|
|
|
|
|
|
|
|
|
| |
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().
|
|
|
|
|
|
|
|
|
|
|
|
| |
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).
|
| |
|
|
|
|
|
|
| |
* Remove Setup.config
* Always define WITH_THREAD for compatibility.
|
|
|
|
|
|
|
|
|
|
| |
* Remove obsolete fallback code in readline module
* Add NEWS
* Remove obsolete include
* Fix macro on Windows
|
|
|
|
|
| |
* test_readline logs the versions of libreadline when run in verbose
mode
* Add also readline._READLINE_LIBRARY_VERSION
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|\ |
|
| | |
|
|\ \
| |/ |
|
| |
| |
| |
| |
| | |
Also adjust the test condition, because enable-meta-key was only added in
6.1, not 6.0.
|
|\ \
| |/ |
|
| |
| |
| |
| | |
Based on patch by Serhiy Storchaka.
|
|\ \
| |/ |
|
| | |
|
| | |
|
|\ \
| |/ |
|
|\ \
| |/ |
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
* Group functions into six new subsections
* Document the underlying Readline function or variable accessed
* get_history_length() returns the history file limit
* clear_history() is conditionally compiled in
* Clarify zero and one bases for history item indexes
* parse_and_bind() uses its argument directly as an init line
* Change "command line" to "line buffer" for consistency
* read_init_file() also executes the file
* read_history_file() replaces the previous history
* write_history_file() overwrites any existing file
* Differentiate history file lines from history list items, which could be
multi-line
* Add more information about completion, also addressing Issue #10796
* libedit (Editline) may be used on any platform; detection is OS X specific
|
|\ \
| |/ |
|
| | |
|
|\ \
| |/ |
|
| | |
|
|\ \
| |/ |
|
| | |
|
|\ \
| |/ |
|
| | |
|
| | |
|
|\ \
| |/ |
|
| |\ |
|
| | |
| | |
| | |
| | |
| | |
| | | |
This changes the main documentation, doc strings, source code comments, and a
couple error messages in the test suite. In some cases the word was removed
or edited some other way to fix the grammar.
|
|\ \ \
| |/ /
| | |
| | | |
module in inconsistent state.
|
| |\ \
| | |/
| | |
| | | |
module in inconsistent state.
|
| | |
| | |
| | |
| | | |
module in inconsistent state.
|
|/ /
| |
| |
| | |
It is very unlikely that they can occur in real code for now.
|
|\ \
| |/ |
|