You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Now we assume that any argument is a "Borrowed" reference so we increment it (we need a matching ``Py_DECREF`` before function exit, see below). The first pattern assumes a non-NULL argument.
71
+
Now we assume that any argument is a "Borrowed" reference so we increment it (we need a matching ``Py_DECREF`` before
72
+
function exit, see below). The first pattern assumes a non-NULL argument.
68
73
69
74
.. code-block:: c
70
75
@@ -79,9 +84,10 @@ If you are willing to accept NULL arguments then this pattern would be more suit
79
84
Py_INCREF(arg_1);
80
85
}
81
86
82
-
Of course the same test must be used when calling ``Py_DECREF``, or just use ``Py_XDECREF``.
87
+
Or just use ``Py_XINCREF``.
83
88
84
-
Now we create any local objects, if they are "Borrowed" references we need to incref them. With any abnormal behaviour we do a local jump straight to the cleanup code.
89
+
Now we create any local objects, if they are "Borrowed" references we need to incref them.
90
+
With any abnormal behaviour we do a local jump straight to the cleanup code.
85
91
86
92
.. code-block:: c
87
93
@@ -173,7 +179,8 @@ Here is the complete code with minimal comments:
0 commit comments