]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Issue #28526: Use PyUnicode_AsEncodedString() instead of
authorSerhiy Storchaka <storchaka@gmail.com>
Thu, 27 Oct 2016 16:31:49 +0000 (19:31 +0300)
committerSerhiy Storchaka <storchaka@gmail.com>
Thu, 27 Oct 2016 16:31:49 +0000 (19:31 +0300)
PyUnicode_AsEncodedObject() in _curese to ensure that the result
is a bytes object.

Modules/_cursesmodule.c

index 960752cce373d65673d8b7884b4d7dc455a7cb60..1c718a71f4ed9b8e81d59c710278d80f08ea7ca5 100644 (file)
@@ -230,7 +230,7 @@ PyCurses_ConvertToChtype(PyCursesWindowObject *win, PyObject *obj, chtype *ch)
                 encoding = win->encoding;
             else
                 encoding = screen_encoding;
-            bytes = PyUnicode_AsEncodedObject(obj, encoding, NULL);
+            bytes = PyUnicode_AsEncodedString(obj, encoding, NULL);
             if (bytes == NULL)
                 return 0;
             if (PyBytes_GET_SIZE(bytes) == 1)
@@ -352,7 +352,7 @@ PyCurses_ConvertToString(PyCursesWindowObject *win, PyObject *obj,
         return 2;
 #else
         assert (wstr == NULL);
-        *bytes = PyUnicode_AsEncodedObject(obj, win->encoding, NULL);
+        *bytes = PyUnicode_AsEncodedString(obj, win->encoding, NULL);
         if (*bytes == NULL)
             return 0;
         return 1;