]> granicus.if.org Git - python/commitdiff
Inline raise_translate_exception(): it is only used once
authorVictor Stinner <victor.stinner@gmail.com>
Tue, 23 Oct 2012 00:51:50 +0000 (02:51 +0200)
committerVictor Stinner <victor.stinner@gmail.com>
Tue, 23 Oct 2012 00:51:50 +0000 (02:51 +0200)
Objects/unicodeobject.c

index f569a83d157c061e520fe13a482325ef45c1d1f4..362f2cffcf12c6d71d7c34bda82e11982c52e639 100644 (file)
@@ -8064,19 +8064,6 @@ make_translate_exception(PyObject **exceptionObject,
     }
 }
 
-/* raises a UnicodeTranslateError */
-static void
-raise_translate_exception(PyObject **exceptionObject,
-                          PyObject *unicode,
-                          Py_ssize_t startpos, Py_ssize_t endpos,
-                          const char *reason)
-{
-    make_translate_exception(exceptionObject,
-                             unicode, startpos, endpos, reason);
-    if (*exceptionObject != NULL)
-        PyCodec_StrictErrors(*exceptionObject);
-}
-
 /* error handling callback helper:
    build arguments, call the callback and check the arguments,
    put the result into newpos and return the replacement string, which
@@ -8352,8 +8339,10 @@ _PyUnicode_TranslateCharmap(PyObject *input,
             }
             switch (known_errorHandler) {
             case 1: /* strict */
-                raise_translate_exception(&exc, input, collstart,
-                                          collend, reason);
+                make_translate_exception(&exc,
+                                         input, collstart, collend, reason);
+                if (exc != NULL)
+                    PyCodec_StrictErrors(exc);
                 goto onError;
             case 2: /* replace */
                 /* No need to check for space, this is a 1:1 replacement */