Kaydet (Commit) bbbd4fdb authored tarafından Guido van Rossum's avatar Guido van Rossum

Make test_new pass.

üst 1a1f61b4
......@@ -143,7 +143,7 @@ class NewTest(unittest.TestCase):
firstlineno, lnotab)
# new.code used to be a way to mutate a tuple...
class S(str):
class S(str8):
pass
t = (S("ab"),)
d = new.code(argcount, kwonlyargcount, nlocals, stacksize,
......
......@@ -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");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment