Author: guido.van.rossum
Date: Thu Aug 16 23:02:22 2007
New Revision: 57102

Modified:
   python/branches/py3k/Modules/datetimemodule.c
   python/branches/py3k/Objects/unicodeobject.c
Log:
Get rid of some dead code and unneeded XXX comments by Neal.


Modified: python/branches/py3k/Modules/datetimemodule.c
==============================================================================
--- python/branches/py3k/Modules/datetimemodule.c       (original)
+++ python/branches/py3k/Modules/datetimemodule.c       Thu Aug 16 23:02:22 2007
@@ -1159,17 +1159,12 @@
        if (Zreplacement == NULL)
                return NULL;
        if (PyUnicode_Check(Zreplacement)) {
-               /* XXX(nnorwitz): this is really convoluted, is it correct? */
                PyObject *Zreplacement2 =
                        _PyUnicode_AsDefaultEncodedString(Zreplacement, NULL);
                if (Zreplacement2 == NULL)
                        return NULL;
                Py_INCREF(Zreplacement2);
-               /* Zreplacement is owned, but Zreplacement2 is borrowed.
-                  If they are different, we have to release Zreplacement. */
-               if (Zreplacement != Zreplacement2) {
-                       Py_DECREF(Zreplacement);
-               }
+               Py_DECREF(Zreplacement);
                Zreplacement = Zreplacement2;
        }
        if (!PyString_Check(Zreplacement)) {

Modified: python/branches/py3k/Objects/unicodeobject.c
==============================================================================
--- python/branches/py3k/Objects/unicodeobject.c        (original)
+++ python/branches/py3k/Objects/unicodeobject.c        Thu Aug 16 23:02:22 2007
@@ -1189,17 +1189,9 @@
         return v;
     if (errors != NULL)
         Py_FatalError("non-NULL encoding in 
_PyUnicode_AsDefaultEncodedString");
-    /* XXX(nnorwitz): errors will always be NULL due to the check above.
-       Should this check and the else be removed since it's dead code?
-     */
-    if (errors == NULL) {
-        b = PyUnicode_EncodeUTF8(PyUnicode_AS_UNICODE(unicode),
-                                 PyUnicode_GET_SIZE(unicode),
-                                 NULL);
-    }
-    else {
-        b = PyUnicode_AsEncodedString(unicode, NULL, errors);
-    }
+    b = PyUnicode_EncodeUTF8(PyUnicode_AS_UNICODE(unicode),
+                             PyUnicode_GET_SIZE(unicode),
+                             NULL);
     if (!b)
         return NULL;
     v = PyString_FromStringAndSize(PyBytes_AsString(b),
_______________________________________________
Python-3000-checkins mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-3000-checkins

Reply via email to