From d341500d8f61633aefe90f3c8d4cc154360812ae Mon Sep 17 00:00:00 2001 From: Guido van Rossum Date: Wed, 23 Dec 1998 05:01:38 +0000 Subject: Add 'N' format character to Py_BuildValue -- like 'O' but doesn't INCREF. Patch and suggestion by Greg Couch. --- Python/modsupport.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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 -- cgit v0.12