From bbbd4fdba2c9589588410a4d1727c031234fc2a6 Mon Sep 17 00:00:00 2001 From: Guido van Rossum Date: Thu, 17 May 2007 21:15:39 +0000 Subject: Make test_new pass. --- Objects/funcobject.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'Objects/funcobject.c') diff --git a/Objects/funcobject.c b/Objects/funcobject.c index adbb6d51ab..0069fc1bbc 100644 --- a/Objects/funcobject.c +++ b/Objects/funcobject.c @@ -482,6 +482,11 @@ func_new(PyTypeObject* type, PyObject* args, PyObject* kw) &PyDict_Type, &globals, &name, &defaults, &closure)) return NULL; + if (PyUnicode_Check(name)) { + name = _PyUnicode_AsDefaultEncodedString(name, NULL); + if (name == NULL) + return NULL; + } if (name != Py_None && !PyString_Check(name)) { PyErr_SetString(PyExc_TypeError, "arg 3 (name) must be None or string"); -- cgit v1.2.1