diff Python/modsupport.c @ 9720:24ca64134594 legacy-trunk

Add 'N' format character to Py_BuildValue -- like 'O' but doesn't INCREF. Patch and suggestion by Greg Couch.
author Guido van Rossum <guido@python.org>
date Wed, 23 Dec 1998 05:01:38 +0000
parents d437b6683e24
children 3955f787e9a1
line wrap: on
line diff
--- a/Python/modsupport.c	Wed Dec 23 04:45:04 1998 +0000
+++ b/Python/modsupport.c	Wed Dec 23 05:01:38 1998 +0000
@@ -332,6 +332,7 @@
 			return v;
 		}
 
+		case 'N':
 		case 'S':
 		case 'O':
 		if (**p_format == '&') {
@@ -345,7 +346,8 @@
 			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