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
78cf85c6
Kaydet (Commit)
78cf85c6
authored
Ock 04, 2014
tarafından
Larry Hastings
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Issue #19659: Added documentation for Argument Clinic.
üst
3cceb384
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
54 additions
and
10 deletions
+54
-10
clinic.rst
Doc/howto/clinic.rst
+0
-0
index.rst
Doc/howto/index.rst
+1
-0
NEWS
Misc/NEWS
+2
-0
zlibmodule.c
Modules/zlibmodule.c
+2
-5
clinic.py
Tools/clinic/clinic.py
+49
-5
No files found.
Doc/howto/clinic.rst
0 → 100644
Dosyayı görüntüle @
78cf85c6
This diff is collapsed.
Click to expand it.
Doc/howto/index.rst
Dosyayı görüntüle @
78cf85c6
...
@@ -28,4 +28,5 @@ Currently, the HOWTOs are:
...
@@ -28,4 +28,5 @@ Currently, the HOWTOs are:
webservers.rst
webservers.rst
argparse.rst
argparse.rst
ipaddress.rst
ipaddress.rst
clinic.rst
Misc/NEWS
Dosyayı görüntüle @
78cf85c6
...
@@ -345,6 +345,8 @@ Documentation
...
@@ -345,6 +345,8 @@ Documentation
Tools
/
Demos
Tools
/
Demos
-----------
-----------
-
Issue
#
19659
:
Added
documentation
for
Argument
Clinic
.
-
Issue
#
19976
:
Argument
Clinic
METH_NOARGS
functions
now
always
-
Issue
#
19976
:
Argument
Clinic
METH_NOARGS
functions
now
always
take
two
parameters
.
take
two
parameters
.
...
...
Modules/zlibmodule.c
Dosyayı görüntüle @
78cf85c6
...
@@ -312,9 +312,6 @@ class uint_converter(CConverter):
...
@@ -312,9 +312,6 @@ class uint_converter(CConverter):
type = 'unsigned int'
type = 'unsigned int'
converter = 'uint_converter'
converter = 'uint_converter'
class compobject_converter(self_converter):
type = "compobject *"
[python]*/
[python]*/
/*[python checksum: da39a3ee5e6b4b0d3255bfef95601890afd80709]*/
/*[python checksum: da39a3ee5e6b4b0d3255bfef95601890afd80709]*/
...
@@ -750,7 +747,7 @@ save_unconsumed_input(compobject *self, int err)
...
@@ -750,7 +747,7 @@ save_unconsumed_input(compobject *self, int err)
zlib.Decompress.decompress
zlib.Decompress.decompress
self:
compobject
self:
self(type="compobject *")
data: Py_buffer
data: Py_buffer
The binary data to decompress.
The binary data to decompress.
...
@@ -1032,7 +1029,7 @@ PyZlib_flush(compobject *self, PyObject *args)
...
@@ -1032,7 +1029,7 @@ PyZlib_flush(compobject *self, PyObject *args)
/*[clinic]
/*[clinic]
zlib.Compress.copy
zlib.Compress.copy
self:
compobject
self:
self(type="compobject *")
Return a copy of the compression object.
Return a copy of the compression object.
[clinic]*/
[clinic]*/
...
...
Tools/clinic/clinic.py
Dosyayı görüntüle @
78cf85c6
...
@@ -1296,11 +1296,13 @@ class CConverter(metaclass=CConverterAutoRegister):
...
@@ -1296,11 +1296,13 @@ class CConverter(metaclass=CConverterAutoRegister):
must be keyword-only.
must be keyword-only.
"""
"""
# The C type to use for this variable.
# 'type' should be a Python string specifying the type, e.g. "int".
# If this is a pointer type, the type string should end with ' *'.
type
=
None
type
=
None
format_unit
=
'O&'
# The Python default value for this parameter, as a Python value.
# The Python default value for this parameter, as a Python value.
# Or "unspecified" if there is no default.
# Or
the magic value
"unspecified" if there is no default.
default
=
unspecified
default
=
unspecified
# "default" as it should appear in the documentation, as a string.
# "default" as it should appear in the documentation, as a string.
...
@@ -1330,9 +1332,32 @@ class CConverter(metaclass=CConverterAutoRegister):
...
@@ -1330,9 +1332,32 @@ class CConverter(metaclass=CConverterAutoRegister):
# (If this is not None, format_unit must be 'O&'.)
# (If this is not None, format_unit must be 'O&'.)
converter
=
None
converter
=
None
encoding
=
None
# Should Argument Clinic add a '&' before the name of
# the variable when passing it into the _impl function?
impl_by_reference
=
False
impl_by_reference
=
False
# Should Argument Clinic add a '&' before the name of
# the variable when passing it into PyArg_ParseTuple (AndKeywords)?
parse_by_reference
=
True
parse_by_reference
=
True
#############################################################
#############################################################
## You shouldn't need to read anything below this point to ##
## write your own converter functions. ##
#############################################################
#############################################################
# The "format unit" to specify for this variable when
# parsing arguments using PyArg_ParseTuple (AndKeywords).
# Custom converters should always use the default value of 'O&'.
format_unit
=
'O&'
# What encoding do we want for this variable? Only used
# by format units starting with 'e'.
encoding
=
None
# Do we want an adjacent '_length' variable for this variable?
# Only used by format units ending with '#'.
length
=
False
length
=
False
def
__init__
(
self
,
name
,
function
,
default
=
unspecified
,
*
,
doc_default
=
None
,
required
=
False
,
annotation
=
unspecified
,
**
kwargs
):
def
__init__
(
self
,
name
,
function
,
default
=
unspecified
,
*
,
doc_default
=
None
,
required
=
False
,
annotation
=
unspecified
,
**
kwargs
):
...
@@ -1751,7 +1776,7 @@ class self_converter(CConverter):
...
@@ -1751,7 +1776,7 @@ class self_converter(CConverter):
this is the default converter used for "self".
this is the default converter used for "self".
"""
"""
type
=
"PyObject *"
type
=
"PyObject *"
def
converter_init
(
self
):
def
converter_init
(
self
,
*
,
type
=
None
):
f
=
self
.
function
f
=
self
.
function
if
f
.
kind
==
CALLABLE
:
if
f
.
kind
==
CALLABLE
:
if
f
.
cls
:
if
f
.
cls
:
...
@@ -1766,6 +1791,9 @@ class self_converter(CConverter):
...
@@ -1766,6 +1791,9 @@ class self_converter(CConverter):
self
.
name
=
"cls"
self
.
name
=
"cls"
self
.
type
=
"PyTypeObject *"
self
.
type
=
"PyTypeObject *"
if
type
:
self
.
type
=
type
def
render
(
self
,
parameter
,
data
):
def
render
(
self
,
parameter
,
data
):
fail
(
"render() should never be called on self_converter instances"
)
fail
(
"render() should never be called on self_converter instances"
)
...
@@ -1787,7 +1815,13 @@ class CReturnConverterAutoRegister(type):
...
@@ -1787,7 +1815,13 @@ class CReturnConverterAutoRegister(type):
class
CReturnConverter
(
metaclass
=
CReturnConverterAutoRegister
):
class
CReturnConverter
(
metaclass
=
CReturnConverterAutoRegister
):
# The C type to use for this variable.
# 'type' should be a Python string specifying the type, e.g. "int".
# If this is a pointer type, the type string should end with ' *'.
type
=
'PyObject *'
type
=
'PyObject *'
# The Python default value for this parameter, as a Python value.
# Or the magic value "unspecified" if there is no default.
default
=
None
default
=
None
def
__init__
(
self
,
*
,
doc_default
=
None
,
**
kwargs
):
def
__init__
(
self
,
*
,
doc_default
=
None
,
**
kwargs
):
...
@@ -1826,6 +1860,16 @@ class CReturnConverter(metaclass=CReturnConverterAutoRegister):
...
@@ -1826,6 +1860,16 @@ class CReturnConverter(metaclass=CReturnConverterAutoRegister):
add_c_return_converter
(
CReturnConverter
,
'object'
)
add_c_return_converter
(
CReturnConverter
,
'object'
)
class
NoneType_return_converter
(
CReturnConverter
):
def
render
(
self
,
function
,
data
):
self
.
declare
(
data
)
data
.
return_conversion
.
append
(
'''
if (_return_value != Py_None)
goto exit;
return_value = Py_None;
Py_INCREF(Py_None);
'''
.
strip
())
class
int_return_converter
(
CReturnConverter
):
class
int_return_converter
(
CReturnConverter
):
type
=
'int'
type
=
'int'
...
@@ -2680,7 +2724,7 @@ def main(argv):
...
@@ -2680,7 +2724,7 @@ def main(argv):
# print(" ", short_name + "".join(parameters))
# print(" ", short_name + "".join(parameters))
print
()
print
()
print
(
"All converters also accept (doc_default=None, required=False)."
)
print
(
"All converters also accept (doc_default=None, required=False
, annotation=None
)."
)
print
(
"All return converters also accept (doc_default=None)."
)
print
(
"All return converters also accept (doc_default=None)."
)
sys
.
exit
(
0
)
sys
.
exit
(
0
)
...
...
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