mirror of
https://github.com/python/cpython.git
synced 2025-07-24 11:44:31 +00:00
Add 'N' format character to Py_BuildValue -- like 'O' but doesn't INCREF.
Patch and suggestion by Greg Couch.
This commit is contained in:
parent
11847896ed
commit
d341500d8f
1 changed files with 3 additions and 1 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue