Kaydet (Commit) 0b25053c authored tarafından Fred Drake's avatar Fred Drake

Make this script handle PyVarObject* functions as well as PyObject*

functions.
üst df13b9ff
...@@ -10,7 +10,7 @@ import sys ...@@ -10,7 +10,7 @@ import sys
import refcounts import refcounts
PREFIX = r"\begin{cfuncdesc}{PyObject*}{" PREFIX = r"\begin{cfuncdesc}{Py(Var|)Object*}{"
def main(): def main():
...@@ -48,14 +48,15 @@ def main(): ...@@ -48,14 +48,15 @@ def main():
except KeyError: except KeyError:
sys.stderr.write("No refcount data for %s\n" % s) sys.stderr.write("No refcount data for %s\n" % s)
else: else:
if info.result_type == "PyObject*": if info.result_type in ("PyObject*", "PyVarObject*"):
if info.result_refs is None: if info.result_refs is None:
rc = "Always \NULL{}" rc = "Always \NULL{}"
else: else:
rc = info.result_refs and "New" or "Borrowed" rc = info.result_refs and "New" or "Borrowed"
rc = rc + " reference" rc = rc + " reference"
line = r"\begin{cfuncdesc}[%s]{PyObject*}{" % rc \ line = (r"\begin{cfuncdesc}[%s]{%s}{"
+ line[prefix_len:] % (rc, info.result_type)) \
+ line[prefix_len:]
output.write(line) output.write(line)
if infile != "-": if infile != "-":
input.close() input.close()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment