[Python-3000-checkins] r55925 - python/branches/py3k-struni/Python/codecs.c python/branches/py3k-struni/Python/import.c

martin.v.loewis python-3000-checkins at python.org
Tue Jun 12 07:53:05 CEST 2007


Author: martin.v.loewis
Date: Tue Jun 12 07:53:00 2007
New Revision: 55925

Modified:
   python/branches/py3k-struni/Python/codecs.c
   python/branches/py3k-struni/Python/import.c
Log:
Revert 55876. Use PyUnicode_AsEncodedString instead.


Modified: python/branches/py3k-struni/Python/codecs.c
==============================================================================
--- python/branches/py3k-struni/Python/codecs.c	(original)
+++ python/branches/py3k-struni/Python/codecs.c	Tue Jun 12 07:53:00 2007
@@ -319,23 +319,6 @@
     PyObject *args = NULL, *result = NULL;
     PyObject *v;
 
-    /* XXX short-cut a few common file system 
-       encodings for now, as otherwise the import
-       code can't load the codec registry. */
-    if (strcmp(encoding, "utf-8") == 0 && PyUnicode_Check(object)) {
-	return PyUnicode_EncodeUTF8(PyUnicode_AS_UNICODE(object),
-				    PyUnicode_GET_SIZE(object),
-				    errors);
-    }
-#if defined(MS_WINDOWS) && defined(HAVE_USABLE_WCHAR_T)
-    if (strcmp(encoding, "mbcs") == 0 && PyUnicode_Check(object)) {
-	return PyUnicode_EncodeMBCS(PyUnicode_AS_UNICODE(object),
-				    PyUnicode_GET_SIZE(object),
-				    errors);
-    }
-#endif
-
-
     encoder = PyCodec_Encoder(encoding);
     if (encoder == NULL)
 	goto onError;

Modified: python/branches/py3k-struni/Python/import.c
==============================================================================
--- python/branches/py3k-struni/Python/import.c	(original)
+++ python/branches/py3k-struni/Python/import.c	Tue Jun 12 07:53:00 2007
@@ -2305,10 +2305,10 @@
 			if (!Py_FileSystemDefaultEncoding) {
 				item8 = PyUnicode_EncodeASCII(PyUnicode_AsUnicode(item),
 							      PyUnicode_GetSize(item),
-							      "strict");
+							      NULL);
 			} else {
-				item8 = PyUnicode_AsEncodedObject(item, 
-				Py_FileSystemDefaultEncoding, "strict");
+				item8 = PyUnicode_AsEncodedString(item, 
+				Py_FileSystemDefaultEncoding, NULL);
 			}
 			if (!item8) {
 				PyErr_SetString(PyExc_ValueError, "Cannot encode path item");


More information about the Python-3000-checkins mailing list