From d3a83d5eb345ef1de87419d145a83c156ebf26f8 Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Sat, 1 Oct 2011 03:09:33 +0200 Subject: [PATCH] PyUnicode_FromObject() ensures that its output is a ready string --- Objects/unicodeobject.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c index a26fd2f68b64..fed2cc9fb4f0 100644 --- a/Objects/unicodeobject.c +++ b/Objects/unicodeobject.c @@ -2068,6 +2068,8 @@ PyUnicode_FromObject(register PyObject *obj) /* XXX Perhaps we should make this API an alias of PyObject_Str() instead ?! */ if (PyUnicode_CheckExact(obj)) { + if (PyUnicode_READY(obj)) + return NULL; Py_INCREF(obj); return obj; }