diff options
author | Guido van Rossum <guido@python.org> | 1998-12-23 05:01:38 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 1998-12-23 05:01:38 (GMT) |
commit | d341500d8f61633aefe90f3c8d4cc154360812ae (patch) | |
tree | c28677c77d736760b1fdd29106267182e7804d2d | |
parent | 11847896edf710ef49f4fa1ccb744a7f46e9512c (diff) | |
download | cpython-d341500d8f61633aefe90f3c8d4cc154360812ae.zip cpython-d341500d8f61633aefe90f3c8d4cc154360812ae.tar.gz cpython-d341500d8f61633aefe90f3c8d4cc154360812ae.tar.bz2 |
Add 'N' format character to Py_BuildValue -- like 'O' but doesn't INCREF.
Patch and suggestion by Greg Couch.
-rw-r--r-- | Python/modsupport.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/Python/modsupport.c b/Python/modsupport.c index 6066aa8..56bde9e 100644 --- a/Python/modsupport.c +++ b/Python/modsupport.c @@ -332,6 +332,7 @@ do_mkvalue(p_format, p_va) return v; } + case 'N': case 'S': case 'O': if (**p_format == '&') { @@ -345,7 +346,8 @@ do_mkvalue(p_format, p_va) PyObject *v; v = va_arg(*p_va, PyObject *); if (v != NULL) - Py_INCREF(v); + if (*(*p_format - 1) != 'N') + Py_INCREF(v); else if (!PyErr_Occurred()) /* If a NULL was passed * because a call that should |