[Python-3000-checkins] r55272 - python/branches/py3k-struni/Objects/object.c

walter.doerwald python-3000-checkins at python.org
Fri May 11 19:25:56 CEST 2007


Author: walter.doerwald
Date: Fri May 11 19:25:52 2007
New Revision: 55272

Modified:
   python/branches/py3k-struni/Objects/object.c
Log:
Simplify PyObject_Unicode(NULL) by using
PyUnicode_FromString().


Modified: python/branches/py3k-struni/Objects/object.c
==============================================================================
--- python/branches/py3k-struni/Objects/object.c	(original)
+++ python/branches/py3k-struni/Objects/object.c	Fri May 11 19:25:52 2007
@@ -435,14 +435,9 @@
 	PyObject *str;
 	static PyObject *unicodestr;
 
-	if (v == NULL) {
-		res = PyString_FromString("<NULL>");
-		if (res == NULL)
-			return NULL;
-		str = PyUnicode_FromEncodedObject(res, NULL, "strict");
-		Py_DECREF(res);
-		return str;
-	} else if (PyUnicode_CheckExact(v)) {
+	if (v == NULL)
+		return PyUnicode_FromString("<NULL>");
+	else if (PyUnicode_CheckExact(v)) {
 		Py_INCREF(v);
 		return v;
 	}


More information about the Python-3000-checkins mailing list