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 -- [email protected] -- 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    ///

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/202010061759.096HxYLA2735474%40masaka.moolenaar.net.

Raspunde prin e-mail lui