[Python-checkins] cpython: PyArg_Parse*("U"): ensure that the Unicode string is ready

victor.stinner python-checkins at python.org
Tue May 29 13:13:17 CEST 2012


http://hg.python.org/cpython/rev/1700fb28d2ab
changeset:   77222:1700fb28d2ab
user:        Victor Stinner <victor.stinner at gmail.com>
date:        Tue May 29 12:30:29 2012 +0200
summary:
  PyArg_Parse*("U"): ensure that the Unicode string is ready

files:
  Python/getargs.c |  5 ++++-
  1 files changed, 4 insertions(+), 1 deletions(-)


diff --git a/Python/getargs.c b/Python/getargs.c
--- a/Python/getargs.c
+++ b/Python/getargs.c
@@ -1167,8 +1167,11 @@
 
     case 'U': { /* PyUnicode object */
         PyObject **p = va_arg(*p_va, PyObject **);
-        if (PyUnicode_Check(arg))
+        if (PyUnicode_Check(arg)) {
+            if (PyUnicode_READY(arg) == -1)
+                RETURN_ERR_OCCURRED;
             *p = arg;
+        }
         else
             return converterr("str", arg, msgbuf, bufsize);
         break;

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


More information about the Python-checkins mailing list