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
ebe95fda
Kaydet (Commit)
ebe95fda
authored
Haz 09, 2016
tarafından
Serhiy Storchaka
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Issue #26305: Argument Clinic now escapes braces. No need to double them.
üst
efe72560
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
20 deletions
+21
-20
cmathmodule.c
Modules/cmathmodule.c
+7
-7
clinic.py
Tools/clinic/clinic.py
+14
-13
No files found.
Modules/cmathmodule.c
Dosyayı görüntüle @
ebe95fda
...
@@ -27,20 +27,20 @@ class Py_complex_protected_return_converter(CReturnConverter):
...
@@ -27,20 +27,20 @@ class Py_complex_protected_return_converter(CReturnConverter):
self.declare(data)
self.declare(data)
data.return_conversion.append("""
data.return_conversion.append("""
PyFPE_END_PROTECT(_return_value);
PyFPE_END_PROTECT(_return_value);
if (errno == EDOM) {
{
if (errno == EDOM) {
PyErr_SetString(PyExc_ValueError, "math domain error");
PyErr_SetString(PyExc_ValueError, "math domain error");
goto exit;
goto exit;
}
}
}
else if (errno == ERANGE) {
{
else if (errno == ERANGE) {
PyErr_SetString(PyExc_OverflowError, "math range error");
PyErr_SetString(PyExc_OverflowError, "math range error");
goto exit;
goto exit;
}
}
}
else {
{
else {
return_value = PyComplex_FromCComplex(_return_value);
return_value = PyComplex_FromCComplex(_return_value);
}
}
}
""".strip())
""".strip())
[python start generated code]*/
[python start generated code]*/
/*[python end generated code: output=da39a3ee5e6b4b0d input=
231019039a6fbb9a
]*/
/*[python end generated code: output=da39a3ee5e6b4b0d input=
345daa075b1028e7
]*/
#if (FLT_RADIX != 2 && FLT_RADIX != 16)
#if (FLT_RADIX != 2 && FLT_RADIX != 16)
#error "Modules/cmathmodule.c expects FLT_RADIX to be 2 or 16"
#error "Modules/cmathmodule.c expects FLT_RADIX to be 2 or 16"
...
...
Tools/clinic/clinic.py
Dosyayı görüntüle @
ebe95fda
...
@@ -176,6 +176,13 @@ def rstrip_lines(s):
...
@@ -176,6 +176,13 @@ def rstrip_lines(s):
text
.
pop
()
text
.
pop
()
return
output
()
return
output
()
def
format_escape
(
s
):
# double up curly-braces, this string will be used
# as part of a format_map() template later
s
=
s
.
replace
(
'{'
,
'{{'
)
s
=
s
.
replace
(
'}'
,
'}}'
)
return
s
def
linear_format
(
s
,
**
kwargs
):
def
linear_format
(
s
,
**
kwargs
):
"""
"""
Perform str.format-like substitution, except:
Perform str.format-like substitution, except:
...
@@ -996,7 +1003,7 @@ class CLanguage(Language):
...
@@ -996,7 +1003,7 @@ class CLanguage(Language):
count_min
=
sys
.
maxsize
count_min
=
sys
.
maxsize
count_max
=
-
1
count_max
=
-
1
add
(
"switch (PyTuple_GET_SIZE(args)) {
{
\n
"
)
add
(
"switch (PyTuple_GET_SIZE(args)) {
\n
"
)
for
subset
in
permute_optional_groups
(
left
,
required
,
right
):
for
subset
in
permute_optional_groups
(
left
,
required
,
right
):
count
=
len
(
subset
)
count
=
len
(
subset
)
count_min
=
min
(
count_min
,
count
)
count_min
=
min
(
count_min
,
count
)
...
@@ -1012,7 +1019,6 @@ class CLanguage(Language):
...
@@ -1012,7 +1019,6 @@ class CLanguage(Language):
d
=
{}
d
=
{}
d
[
'count'
]
=
count
d
[
'count'
]
=
count
d
[
'name'
]
=
f
.
name
d
[
'name'
]
=
f
.
name
d
[
'groups'
]
=
sorted
(
group_ids
)
d
[
'format_units'
]
=
""
.
join
(
p
.
converter
.
format_unit
for
p
in
subset
)
d
[
'format_units'
]
=
""
.
join
(
p
.
converter
.
format_unit
for
p
in
subset
)
parse_arguments
=
[]
parse_arguments
=
[]
...
@@ -1039,8 +1045,8 @@ class CLanguage(Language):
...
@@ -1039,8 +1045,8 @@ class CLanguage(Language):
s
=
' PyErr_SetString(PyExc_TypeError, "{} requires {} to {} arguments");
\n
'
s
=
' PyErr_SetString(PyExc_TypeError, "{} requires {} to {} arguments");
\n
'
add
(
s
.
format
(
f
.
full_name
,
count_min
,
count_max
))
add
(
s
.
format
(
f
.
full_name
,
count_min
,
count_max
))
add
(
' goto exit;
\n
'
)
add
(
' goto exit;
\n
'
)
add
(
"}
}
"
)
add
(
"}"
)
template_dict
[
'option_group_parsing'
]
=
output
(
)
template_dict
[
'option_group_parsing'
]
=
format_escape
(
output
()
)
def
render_function
(
self
,
clinic
,
f
):
def
render_function
(
self
,
clinic
,
f
):
if
not
f
:
if
not
f
:
...
@@ -1135,7 +1141,7 @@ class CLanguage(Language):
...
@@ -1135,7 +1141,7 @@ class CLanguage(Language):
f
.
return_converter
.
render
(
f
,
data
)
f
.
return_converter
.
render
(
f
,
data
)
template_dict
[
'impl_return_type'
]
=
f
.
return_converter
.
type
template_dict
[
'impl_return_type'
]
=
f
.
return_converter
.
type
template_dict
[
'declarations'
]
=
"
\n
"
.
join
(
data
.
declarations
)
template_dict
[
'declarations'
]
=
format_escape
(
"
\n
"
.
join
(
data
.
declarations
)
)
template_dict
[
'initializers'
]
=
"
\n\n
"
.
join
(
data
.
initializers
)
template_dict
[
'initializers'
]
=
"
\n\n
"
.
join
(
data
.
initializers
)
template_dict
[
'modifications'
]
=
'
\n\n
'
.
join
(
data
.
modifications
)
template_dict
[
'modifications'
]
=
'
\n\n
'
.
join
(
data
.
modifications
)
template_dict
[
'keywords'
]
=
'"'
+
'", "'
.
join
(
data
.
keywords
)
+
'"'
template_dict
[
'keywords'
]
=
'"'
+
'", "'
.
join
(
data
.
keywords
)
+
'"'
...
@@ -1143,8 +1149,8 @@ class CLanguage(Language):
...
@@ -1143,8 +1149,8 @@ class CLanguage(Language):
template_dict
[
'parse_arguments'
]
=
', '
.
join
(
data
.
parse_arguments
)
template_dict
[
'parse_arguments'
]
=
', '
.
join
(
data
.
parse_arguments
)
template_dict
[
'impl_parameters'
]
=
", "
.
join
(
data
.
impl_parameters
)
template_dict
[
'impl_parameters'
]
=
", "
.
join
(
data
.
impl_parameters
)
template_dict
[
'impl_arguments'
]
=
", "
.
join
(
data
.
impl_arguments
)
template_dict
[
'impl_arguments'
]
=
", "
.
join
(
data
.
impl_arguments
)
template_dict
[
'return_conversion'
]
=
""
.
join
(
data
.
return_conversion
)
.
rstrip
(
)
template_dict
[
'return_conversion'
]
=
format_escape
(
""
.
join
(
data
.
return_conversion
)
.
rstrip
()
)
template_dict
[
'cleanup'
]
=
""
.
join
(
data
.
cleanup
)
template_dict
[
'cleanup'
]
=
format_escape
(
""
.
join
(
data
.
cleanup
)
)
template_dict
[
'return_value'
]
=
data
.
return_value
template_dict
[
'return_value'
]
=
data
.
return_value
# used by unpack tuple code generator
# used by unpack tuple code generator
...
@@ -2439,12 +2445,7 @@ class CConverter(metaclass=CConverterAutoRegister):
...
@@ -2439,12 +2445,7 @@ class CConverter(metaclass=CConverterAutoRegister):
declaration
.
append
(
'
\n
Py_ssize_clean_t '
)
declaration
.
append
(
'
\n
Py_ssize_clean_t '
)
declaration
.
append
(
self
.
length_name
())
declaration
.
append
(
self
.
length_name
())
declaration
.
append
(
';'
)
declaration
.
append
(
';'
)
s
=
""
.
join
(
declaration
)
return
""
.
join
(
declaration
)
# double up curly-braces, this string will be used
# as part of a format_map() template later
s
=
s
.
replace
(
"{"
,
"{{"
)
s
=
s
.
replace
(
"}"
,
"}}"
)
return
s
def
initialize
(
self
):
def
initialize
(
self
):
"""
"""
...
...
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