[Python-checkins] CVS: python/dist/src/Objects object.c,2.79,2.80
Fredrik Lundh
python-dev@python.org
Sat, 1 Jul 2000 07:31:12 -0700
Update of /cvsroot/python/python/dist/src/Objects
In directory slayer.i.sourceforge.net:/tmp/cvs-serv30087/Objects
Modified Files:
object.c
Log Message:
changed repr and str to always convert unicode strings
to 8-bit strings, using the default encoding.
Index: object.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Objects/object.c,v
retrieving revision 2.79
retrieving revision 2.80
diff -C2 -r2.79 -r2.80
*** object.c 2000/07/01 01:00:38 2.79
--- object.c 2000/07/01 14:31:09 2.80
***************
*** 266,269 ****
--- 266,277 ----
if (res == NULL)
return NULL;
+ if (PyUnicode_Check(res)) {
+ PyObject* str;
+ str = PyUnicode_AsEncodedString(res, NULL, NULL);
+ if (str) {
+ Py_DECREF(res);
+ res = str;
+ }
+ }
if (!PyString_Check(res)) {
PyErr_Format(PyExc_TypeError,
***************
*** 303,306 ****
--- 311,322 ----
if (res == NULL)
return NULL;
+ if (PyUnicode_Check(res)) {
+ PyObject* str;
+ str = PyUnicode_AsEncodedString(res, NULL, NULL);
+ if (str) {
+ Py_DECREF(res);
+ res = str;
+ }
+ }
if (!PyString_Check(res)) {
PyErr_Format(PyExc_TypeError,