diff options
author | Raymond Hettinger <python@rcn.com> | 2003-10-12 19:09:37 (GMT) |
---|---|---|
committer | Raymond Hettinger <python@rcn.com> | 2003-10-12 19:09:37 (GMT) |
commit | 8ae468965700fd9900efc28bff8fa2015dae2bef (patch) | |
tree | 1f3545b2d2a3ad8b7d5692a7f84daa88d850b29c /Modules/_sre.c | |
parent | cb2da43db8943e9e7b1d900bce1d6416339d6f64 (diff) | |
download | cpython-8ae468965700fd9900efc28bff8fa2015dae2bef.zip cpython-8ae468965700fd9900efc28bff8fa2015dae2bef.tar.gz cpython-8ae468965700fd9900efc28bff8fa2015dae2bef.tar.bz2 |
Simplify and speedup uses of Py_BuildValue():
* Py_BuildValue("(OOO)",a,b,c) --> PyTuple_Pack(3,a,b,c)
* Py_BuildValue("()",a) --> PyTuple_New(0)
* Py_BuildValue("O", a) --> Py_INCREF(a)
Diffstat (limited to 'Modules/_sre.c')
-rw-r--r-- | Modules/_sre.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/Modules/_sre.c b/Modules/_sre.c index a8a9774..5490bdc 100644 --- a/Modules/_sre.c +++ b/Modules/_sre.c @@ -1907,7 +1907,7 @@ deepcopy(PyObject** object, PyObject* memo) copy = call( "copy", "deepcopy", - Py_BuildValue("OO", *object, memo) + PyTuple_Pack(2, *object, memo) ); if (!copy) return 0; @@ -1968,7 +1968,7 @@ join_list(PyObject* list, PyObject* pattern) #else result = call( "string", "join", - Py_BuildValue("OO", list, joiner) + PyTuple_Pack(2, list, joiner) ); #endif Py_DECREF(joiner); @@ -2255,7 +2255,7 @@ pattern_subx(PatternObject* self, PyObject* template, PyObject* string, /* not a literal; hand it over to the template compiler */ filter = call( SRE_MODULE, "_subx", - Py_BuildValue("OO", self, template) + PyTuple_Pack(2, self, template) ); if (!filter) return NULL; @@ -2321,7 +2321,7 @@ pattern_subx(PatternObject* self, PyObject* template, PyObject* string, match = pattern_new_match(self, &state, 1); if (!match) goto error; - args = Py_BuildValue("(O)", match); + args = PyTuple_Pack(1, match); if (!args) { Py_DECREF(match); goto error; @@ -2610,7 +2610,7 @@ match_expand(MatchObject* self, PyObject* args) /* delegate to Python code */ return call( SRE_MODULE, "_expand", - Py_BuildValue("OOO", self->pattern, self, template) + PyTuple_Pack(3, self->pattern, self, template) ); } |