mirror of
https://github.com/vim/vim.git
synced 2025-09-25 03:54:15 -04:00
patch 9.1.0784: there are several problems with python 3.13
Problem: there are several problems with python 3.13 Solution: fix the problems in the python3 interface (Boris Staletic) This commit does the following things: 1) Since python 3.13.0b1, all statically defined objects are "immortal". Besides never getting garbage collected, this also affects reference counting: - Immportal objects have a reference count of 2^32-1. - Reference counting is a no-op. All this is considered implementation details by cpython, so documentation is next to non-existent. Relevant CPython source code: https://github.com/python/cpython/blob/v3.13.0/Include/object.h#L62-L107 https://github.com/python/cpython/blob/v3.13.0/Include/object.h#L389-L391 2) Opt-out of ANSI-painted python stack traces 3) Make python error message severity more consistent fixes: #15838 closes: #15842 Signed-off-by: Boris Staletic <boris.staletic@protonmail.com> Signed-off-by: puremourning <puremourning@users.noreply.github.com> Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
committed by
Christian Brabandt
parent
322ad0c953
commit
83a06705dc
@@ -635,13 +635,14 @@ PythonIO_Flush(void)
|
||||
if (old_fn != NULL && io_ga.ga_len > 0)
|
||||
{
|
||||
((char *)io_ga.ga_data)[io_ga.ga_len] = NUL;
|
||||
// We don't know what emsg_severe should be here, so ... hope?
|
||||
old_fn((char *)io_ga.ga_data);
|
||||
}
|
||||
io_ga.ga_len = 0;
|
||||
}
|
||||
|
||||
static void
|
||||
writer(writefn fn, char_u *str, PyInt n)
|
||||
writer(writefn fn, char_u *str, PyInt n, int severe)
|
||||
{
|
||||
char_u *ptr;
|
||||
|
||||
@@ -665,6 +666,7 @@ writer(writefn fn, char_u *str, PyInt n)
|
||||
|
||||
mch_memmove(((char *)io_ga.ga_data) + io_ga.ga_len, str, (size_t)len);
|
||||
((char *)io_ga.ga_data)[io_ga.ga_len + len] = NUL;
|
||||
emsg_severe = severe;
|
||||
fn((char *)io_ga.ga_data);
|
||||
str = ptr + 1;
|
||||
n -= len + 1;
|
||||
@@ -692,9 +694,7 @@ write_output(OutputObject *self, PyObject *string)
|
||||
|
||||
Py_BEGIN_ALLOW_THREADS
|
||||
Python_Lock_Vim();
|
||||
if (error)
|
||||
emsg_severe = TRUE;
|
||||
writer((writefn)(error ? emsg : msg), (char_u *)str, len);
|
||||
writer((writefn)(error ? emsg : msg), (char_u *)str, len, error);
|
||||
Python_Release_Vim();
|
||||
Py_END_ALLOW_THREADS
|
||||
PyMem_Free(str);
|
||||
|
Reference in New Issue
Block a user