Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 0b25053

Browse files
committed
Make this script handle PyVarObject* functions as well as PyObject*
functions.
1 parent df13b9f commit 0b25053

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

Doc/tools/anno-api.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
import refcounts
1111

1212

13-
PREFIX = r"\begin{cfuncdesc}{PyObject*}{"
13+
PREFIX = r"\begin{cfuncdesc}{Py(Var|)Object*}{"
1414

1515

1616
def main():
@@ -48,14 +48,15 @@ def main():
4848
except KeyError:
4949
sys.stderr.write("No refcount data for %s\n" % s)
5050
else:
51-
if info.result_type == "PyObject*":
51+
if info.result_type in ("PyObject*", "PyVarObject*"):
5252
if info.result_refs is None:
5353
rc = "Always \NULL{}"
5454
else:
5555
rc = info.result_refs and "New" or "Borrowed"
5656
rc = rc + " reference"
57-
line = r"\begin{cfuncdesc}[%s]{PyObject*}{" % rc \
58-
+ line[prefix_len:]
57+
line = (r"\begin{cfuncdesc}[%s]{%s}{"
58+
% (rc, info.result_type)) \
59+
+ line[prefix_len:]
5960
output.write(line)
6061
if infile != "-":
6162
input.close()

0 commit comments

Comments
 (0)