Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
cpython
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
cpython
Commits
dee86c64
Kaydet (Commit)
dee86c64
authored
Mar 15, 2000
tarafından
Fred Drake
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Script to annotate api.tex with reference count information.
üst
def77e53
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
63 additions
and
0 deletions
+63
-0
anno-api.py
Doc/tools/anno-api.py
+63
-0
No files found.
Doc/tools/anno-api.py
0 → 100755
Dosyayı görüntüle @
dee86c64
#! /usr/bin/env python
"""Add reference count annotations to the Python/C API Reference."""
__version__
=
'$Revision$'
import
getopt
import
os
import
string
import
sys
import
refcounts
PREFIX
=
r"\begin{cfuncdesc}{PyObject*}{"
def
main
():
rcfile
=
os
.
path
.
join
(
os
.
path
.
dirname
(
refcounts
.
__file__
),
os
.
pardir
,
"api"
,
"refcounts.dat"
)
outfile
=
"-"
opts
,
args
=
getopt
.
getopt
(
sys
.
argv
[
1
:],
"o:r:"
,
[
"output="
,
"refcounts="
])
for
opt
,
arg
in
opts
:
if
opt
in
(
"-o"
,
"--output"
):
outfile
=
arg
elif
opt
in
(
"-r"
,
"--refcounts"
):
rcfile
=
arg
rcdict
=
refcounts
.
load
(
rcfile
)
if
outfile
==
"-"
:
output
=
sys
.
stdout
else
:
output
=
open
(
outfile
,
"w"
)
if
not
args
:
args
=
[
"-"
]
prefix
=
PREFIX
prefix_len
=
len
(
prefix
)
for
infile
in
args
:
if
infile
==
"-"
:
input
=
sys
.
stdin
else
:
input
=
open
(
infile
)
while
1
:
line
=
input
.
readline
()
if
not
line
:
break
if
line
[:
prefix_len
]
==
prefix
:
s
=
string
.
split
(
line
[
prefix_len
:],
'}'
,
1
)[
0
]
try
:
info
=
rcdict
[
s
]
except
KeyError
:
sys
.
stderr
.
write
(
"No refcount data for
%
s
\n
"
%
s
)
else
:
if
info
.
result_type
==
"PyObject*"
:
rc
=
info
.
result_refs
and
"New"
or
"Borrowed"
line
=
r"\begin{cfuncdesc}[
%
s]{PyObject*}{"
%
rc
\
+
line
[
prefix_len
:]
output
.
write
(
line
)
if
infile
!=
"-"
:
input
.
close
()
if
outfile
!=
"-"
:
output
.
close
()
if
__name__
==
"__main__"
:
main
()
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment