Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
3d00c7d7
Commit
3d00c7d7
authored
Oct 08, 2016
by
Steve Dower
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue #28333: Enables Unicode for ps1/ps2 and input() prompts. (Patch by Eryk Sun)
parent
64e0f462
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
4 deletions
+26
-4
Misc/NEWS
Misc/NEWS
+2
-0
Parser/myreadline.c
Parser/myreadline.c
+24
-4
No files found.
Misc/NEWS
View file @
3d00c7d7
...
...
@@ -213,6 +213,8 @@ Library
Windows
-------
-
Issue
#
28333
:
Enables
Unicode
for
ps1
/
ps2
and
input
()
prompts
-
Issue
#
28251
:
Improvements
to
help
manuals
on
Windows
.
-
Issue
#
28110
:
launcher
.
msi
has
different
product
codes
between
32
-
bit
and
...
...
Parser/myreadline.c
View file @
3d00c7d7
...
...
@@ -203,17 +203,37 @@ PyOS_StdioReadline(FILE *sys_stdin, FILE *sys_stdout, const char *prompt)
#ifdef MS_WINDOWS
if
(
!
Py_LegacyWindowsStdioFlag
&&
sys_stdin
==
stdin
)
{
HANDLE
hStdIn
;
HANDLE
hStdIn
,
hStdErr
;
_Py_BEGIN_SUPPRESS_IPH
hStdIn
=
(
HANDLE
)
_get_osfhandle
(
fileno
(
sys_stdin
));
hStdErr
=
(
HANDLE
)
_get_osfhandle
(
fileno
(
stderr
));
_Py_END_SUPPRESS_IPH
if
(
_get_console_type
(
hStdIn
)
==
'r'
)
{
fflush
(
sys_stdout
);
if
(
prompt
)
if
(
prompt
)
{
if
(
_get_console_type
(
hStdErr
)
==
'w'
)
{
wchar_t
*
wbuf
;
int
wlen
;
wlen
=
MultiByteToWideChar
(
CP_UTF8
,
0
,
prompt
,
-
1
,
NULL
,
0
);
if
(
wlen
++
&&
(
wbuf
=
PyMem_RawMalloc
(
wlen
*
sizeof
(
wchar_t
))))
{
wlen
=
MultiByteToWideChar
(
CP_UTF8
,
0
,
prompt
,
-
1
,
wbuf
,
wlen
);
if
(
wlen
)
{
DWORD
n
;
fflush
(
stderr
);
WriteConsoleW
(
hStdErr
,
wbuf
,
wlen
,
&
n
,
NULL
);
}
PyMem_RawFree
(
wbuf
);
}
}
else
{
fprintf
(
stderr
,
"%s"
,
prompt
);
fflush
(
stderr
);
}
}
clearerr
(
sys_stdin
);
return
_PyOS_WindowsConsoleReadline
(
hStdIn
);
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment