[Python-checkins] cpython: stdprinter_write(): mention the encoding

victor.stinner python-checkins at python.org
Tue Mar 24 14:07:22 CET 2015


https://hg.python.org/cpython/rev/67e47b898428
changeset: 95159:67e47b898428
user: Victor Stinner <victor.stinner at gmail.com>
date: Tue Mar 24 13:40:29 2015 +0100
summary:
 stdprinter_write(): mention the encoding
files:
 Objects/fileobject.c | 7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/Objects/fileobject.c b/Objects/fileobject.c
--- a/Objects/fileobject.c
+++ b/Objects/fileobject.c
@@ -372,7 +372,7 @@
 static PyObject *
 stdprinter_write(PyStdPrinter_Object *self, PyObject *args)
 {
- char *c;
+ char *str;
 Py_ssize_t n;
 
 if (self->fd < 0) {
@@ -383,10 +383,11 @@
 Py_RETURN_NONE;
 }
 
- if (!PyArg_ParseTuple(args, "s", &c))
+ /* encode Unicode to UTF-8 */
+ if (!PyArg_ParseTuple(args, "s", &str))
 return NULL;
 
- n = _Py_write(self->fd, c, strlen(c));
+ n = _Py_write(self->fd, str, strlen(str));
 if (n == -1) {
 if (errno == EAGAIN) {
 PyErr_Clear();
-- 
Repository URL: https://hg.python.org/cpython


More information about the Python-checkins mailing list

AltStyle によって変換されたページ (->オリジナル) /