Patch 8.2.1806

7 views
Skip to first unread message

Bram Moolenaar

unread,
Oct 6, 2020, 1:59:45 PM10/6/20
to vim...@googlegroups.com

Patch 8.2.1806
Problem: MS-Windows with Python: Vim freezes after import command.
Solution: Use either "NUL" or "CONIN$" when reopening stdin. (Yasuhiro
Matsumoto, closes #7083)
Files: src/if_python3.c


*** ../vim-8.2.1805/src/if_python3.c 2020-10-03 13:57:09.289123803 +0200
--- src/if_python3.c 2020-10-06 19:55:48.827455818 +0200
***************
*** 917,922 ****
--- 917,923 ----
{
FILE *(*py__acrt_iob_func)(unsigned) = NULL;
FILE *(*pyfreopen)(const char *, const char *, FILE *) = NULL;
+ char *stdin_name = "NUL";
HINSTANCE hinst;

# ifdef DYNAMIC_PYTHON3
***************
*** 933,948 ****
if (py__acrt_iob_func)
{
HINSTANCE hpystdiodll = find_imported_module_by_funcname(hinst,
! "__acrt_iob_func");
if (hpystdiodll)
! pyfreopen = (void*)GetProcAddress(hpystdiodll, "freopen");
}

! // Reconnect stdin to NUL.
! if (pyfreopen)
! pyfreopen("NUL", "r", py__acrt_iob_func(0));
else
! freopen("NUL", "r", stdin);
}
#else
# define reset_stdin()
--- 934,951 ----
if (py__acrt_iob_func)
{
HINSTANCE hpystdiodll = find_imported_module_by_funcname(hinst,
! "__acrt_iob_func");
if (hpystdiodll)
! pyfreopen = (void *)GetProcAddress(hpystdiodll, "freopen");
}
+ if (isatty(fileno(stdin)))
+ stdin_name = "CONIN$";

! // Reconnect stdin to NUL or CONIN$.
! if (pyfreopen != NULL)
! pyfreopen(stdin_name, "r", py__acrt_iob_func(0));
else
! freopen(stdin_name, "r", stdin);
}
#else
# define reset_stdin()
*** ../vim-8.2.1805/src/version.c 2020-10-05 21:39:21.283424484 +0200
--- src/version.c 2020-10-06 19:58:53.486931919 +0200
***************
*** 752,753 ****
--- 752,755 ----
{ /* Add new patch number below this line */
+ /**/
+ 1806,
/**/

--
The 50-50-90 rule: Anytime you have a 50-50 chance of getting
something right, there's a 90% probability you'll get it wrong.

/// Bram Moolenaar -- Br...@Moolenaar.net -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ an exciting new programming language -- http://www.Zimbu.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
Reply all
Reply to author
Forward
0 new messages