]> granicus.if.org Git - python/commitdiff
pattern_subx() now uses fast call
authorVictor Stinner <victor.stinner@gmail.com>
Fri, 19 Aug 2016 23:38:00 +0000 (01:38 +0200)
committerVictor Stinner <victor.stinner@gmail.com>
Fri, 19 Aug 2016 23:38:00 +0000 (01:38 +0200)
Issue #27128.

Modules/_sre.c

index 6f8ec0e538141fa30ca21b61a908afdffe71e898..3e8d7f8b48d76d34d9a2000f944bb926b7ebb78b 100644 (file)
@@ -1056,7 +1056,6 @@ pattern_subx(PatternObject* self, PyObject* ptemplate, PyObject* string,
     PyObject* joiner;
     PyObject* item;
     PyObject* filter;
-    PyObject* args;
     PyObject* match;
     void* ptr;
     Py_ssize_t status;
@@ -1158,13 +1157,7 @@ pattern_subx(PatternObject* self, PyObject* ptemplate, PyObject* string,
             match = pattern_new_match(self, &state, 1);
             if (!match)
                 goto error;
-            args = PyTuple_Pack(1, match);
-            if (!args) {
-                Py_DECREF(match);
-                goto error;
-            }
-            item = PyObject_CallObject(filter, args);
-            Py_DECREF(args);
+            item = _PyObject_FastCall(filter, &match, 1, NULL);
             Py_DECREF(match);
             if (!item)
                 goto error;