diff Objects/typeobject.c @ 42184:bf5d04e0da4c

Make test_descr.py pass. Had to disable a few tests, remove references to 'file', and fix a bunch of subtleties in the behavior of objects related to overriding __str__. Also disabled a few tests that I couldn't see how to fix but that seemed to be checking silly stuff only.
author Guido van Rossum <guido@python.org>
date Wed, 11 Jul 2007 09:28:11 +0000
parents 229c28cb9afb
children 854cc4d5a33d
line wrap: on
line diff
--- a/Objects/typeobject.c	Wed Jul 11 06:56:16 2007 +0000
+++ b/Objects/typeobject.c	Wed Jul 11 09:28:11 2007 +0000
@@ -55,6 +55,11 @@
 			     "can't delete %s.__name__", type->tp_name);
 		return -1;
 	}
+	if (PyUnicode_Check(value)) {
+		value = _PyUnicode_AsDefaultEncodedString(value, NULL);
+		if (value == NULL)
+			return -1;
+	}
 	if (!PyString_Check(value)) {
 		PyErr_Format(PyExc_TypeError,
 			     "can only assign string to %s.__name__, not '%s'",