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;
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;
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);
goto fail;
}
#endif
+ // Python 3.13 introduced a really useful feature: colorized exceptions.
+ // This is great if you're reading them from the terminal, but useless
+ // and broken everywhere else (such as in log files, or text editors).
+ // Opt out, forcefully.
+ vim_setenv((char_u*)"PYTHON_COLORS", (char_u*)"0");
init_structs();
v = create_list()
base_ref_count = sys.getrefcount(v)
for el in v:
- vim.vars['list_iter_ref_count_increase'] = sys.getrefcount(v) - base_ref_count
+ vim.vars['list_iter_ref_count_increase'] = sys.getrefcount(v) - base_ref_count
create_dict = vim.Function('Create_vim_dict')
v = create_dict()
base_ref_count = sys.getrefcount(v)
for el in v:
- vim.vars['dict_iter_ref_count_increase'] = sys.getrefcount(v) - base_ref_count
+ vim.vars['dict_iter_ref_count_increase'] = sys.getrefcount(v) - base_ref_count
v = vim.buffers
base_ref_count = sys.getrefcount(v)
for el in v:
- vim.vars['bufmap_iter_ref_count_increase'] = sys.getrefcount(v) - base_ref_count
+ vim.vars['bufmap_iter_ref_count_increase'] = sys.getrefcount(v) - base_ref_count
v = vim.options
base_ref_count = sys.getrefcount(v)
for el in v:
- vim.vars['options_iter_ref_count_increase'] = sys.getrefcount(v) - base_ref_count
+ vim.vars['options_iter_ref_count_increase'] = sys.getrefcount(v) - base_ref_count
test_python3_iter_ref()
EOF
call assert_equal(1, g:list_iter_ref_count_increase)
call assert_equal(1, g:dict_iter_ref_count_increase)
- call assert_equal(1, g:bufmap_iter_ref_count_increase)
+ if py3eval('sys.version_info[:2] < (3, 13)')
+ call assert_equal(1, g:bufmap_iter_ref_count_increase)
+ else
+ call assert_equal(0, g:bufmap_iter_ref_count_increase)
+ endif
call assert_equal(1, g:options_iter_ref_count_increase)
endfunc
static int included_patches[] =
{ /* Add new patch number below this line */
+/**/
+ 784,
/**/
783,
/**/