[Python-checkins] cpython (merge 3.6 -> default): Issue #28526: Use PyUnicode_AsEncodedString() instead of

serhiy.storchaka python-checkins at python.org
Thu Oct 27 12:33:48 EDT 2016


https://hg.python.org/cpython/rev/a6548e230ed6
changeset:   104745:a6548e230ed6
parent:      104742:deb3e5857d8c
parent:      104744:fe9f361f3751
user:        Serhiy Storchaka <storchaka at gmail.com>
date:        Thu Oct 27 19:33:22 2016 +0300
summary:
  Issue #28526: Use PyUnicode_AsEncodedString() instead of
PyUnicode_AsEncodedObject() in _curese to ensure that the result
is a bytes object.

files:
  Modules/_cursesmodule.c |  4 ++--
  1 files changed, 2 insertions(+), 2 deletions(-)


diff --git a/Modules/_cursesmodule.c b/Modules/_cursesmodule.c
--- a/Modules/_cursesmodule.c
+++ b/Modules/_cursesmodule.c
@@ -230,7 +230,7 @@
                 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 @@
         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;

-- 
Repository URL: https://hg.python.org/cpython


More information about the Python-checkins mailing list