Skip to content

Commit d518f95

Browse files
committed
patch 8.2.0070: crash when using Python 3 with "debug" encoding
Problem: Crash when using Python 3 with "debug" encoding. (Dominique Pelle) Solution: Use "euc-jp" whenever enc_dbcs is set.
1 parent 8739607 commit d518f95

3 files changed

Lines changed: 8 additions & 1 deletion

File tree

src/if_py_both.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@ static char_u e_py_systemexit[] = "E880: Can't handle SystemExit of %s exception
1919
typedef int Py_ssize_t; // Python 2.4 and earlier don't have this type.
2020
#endif
2121

22-
#define ENC_OPT (enc_utf8 ? "utf-8" : (char *)p_enc)
22+
// Use values that are known to work, others may make Vim crash.
23+
#define ENC_OPT (enc_utf8 ? "utf-8" : enc_dbcs ? "euc-jp" : (char *)p_enc)
2324
#define DOPY_FUNC "_vim_pydo"
2425

2526
static const char *vim_special_path = "_vim_path_";

src/testdir/test_python3.vim

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,5 +172,9 @@ func Test_unicode()
172172
" this crashed Vim once
173173
set encoding=utf32
174174
py3 print('hello')
175+
set encoding=debug
176+
py3 print('hello')
177+
set encoding=euc-tw
178+
py3 print('hello')
175179
set encoding=utf8
176180
endfunc

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -742,6 +742,8 @@ static char *(features[]) =
742742

743743
static int included_patches[] =
744744
{ /* Add new patch number below this line */
745+
/**/
746+
70,
745747
/**/
746748
69,
747749
/**/

0 commit comments

Comments
 (0)