mirror of
https://github.com/python/cpython.git
synced 2025-08-03 16:39:00 +00:00
Three patches from issue #1047, by Amaury Forgeot d'Arc:
1/ getargs.diff adds the 'Z' and 'Z#' format specifiers for PyArg_ParseTuple. They mimic z and z# for unicode strings, by accepting a Unicode or None (in which case the Py_UNICODE* pointer is set to NULL). With doc and tests. 2/ subprocess.diff converts file PC/_subprocess.c to unicode. We use the Unicode version of the win32 api (and Z conversion from previous patch) 3/ stdout.diff: sys.stdout must not convert the line endings, Windows already does it. Without this patch, when redirecting the output of python, the file contains \r\r\n for each line. (test_subprocess did catch this) However, I (GvR) removed the change to _fileio.c (included in the patches) that prevents closing file descripors < 3 from being closed; I think that needs to be solved in a different way.
This commit is contained in:
parent
e86254e256
commit
fb67be2f6b
5 changed files with 118 additions and 32 deletions
|
@ -484,6 +484,13 @@ variable(s) whose address should be passed.
|
|||
by interpreting their read-buffer pointer as pointer to a :ctype:`Py_UNICODE`
|
||||
array.
|
||||
|
||||
``Z`` (Unicode or ``None``) [Py_UNICODE \*]
|
||||
Like ``s``, but the Python object may also be ``None``, in which case the C
|
||||
pointer is set to *NULL*.
|
||||
|
||||
``Z#`` (Unicode or ``None``) [Py_UNICODE \*, int]
|
||||
This is to ``u#`` as ``Z`` is to ``u``.
|
||||
|
||||
``es`` (string, Unicode object or character buffer compatible object) [const char \*encoding, char \*\*buffer]
|
||||
This variant on ``s`` is used for encoding Unicode and objects convertible to
|
||||
Unicode into a character buffer. It only works for encoded data without embedded
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue