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
65ce60ae
Unverified
Kaydet (Commit)
65ce60ae
authored
Ara 25, 2018
tarafından
Serhiy Storchaka
Kaydeden (comit)
GitHub
Ara 25, 2018
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
bpo-20180: Simplify char_converter in Argument Clinic. (GH-9828)
Fix also handling non-ascii default values.
üst
837c7dc1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
32 deletions
+19
-32
clinic.test
Lib/test/clinic.test
+16
-14
clinic.py
Tools/clinic/clinic.py
+3
-18
No files found.
Lib/test/clinic.test
Dosyayı görüntüle @
65ce60ae
...
...
@@ -349,6 +349,7 @@ test_char_converter
k: char = b'?'
l: char = b'\\'
m: char = b'\000'
n: char = b'\377'
/
[clinic start generated code]*/
...
...
@@ -356,7 +357,7 @@ test_char_converter
PyDoc_STRVAR
(
test_char_converter__doc__
,
"test_char_converter(
$module
, a=b\'A\', b=b\'
\\
x07\', c=b\'
\\
x08\', d=b\'
\\
t\',
\n
"
" e=b\'
\\
n\', f=b\'
\\
x0b\', g=b\'
\\
x0c\', h=b\'
\\
r\', i=b\'
\"
\',
\n
"
" j=b
\"
\'
\"
, k=b\'?\', l=b\'
\\\\
\', m=b\'
\\
x00\', /)
\n
"
" j=b
\"
\'
\"
, k=b\'?\', l=b\'
\\\\
\', m=b\'
\\
x00\',
n=b\'
\\
xff\',
/)
\n
"
"--
\n
"
"
\n
"
);
...
...
@@ -366,31 +367,32 @@ PyDoc_STRVAR(test_char_converter__doc__,
static
PyObject
*
test_char_converter_impl
(
PyObject
*
module
,
char
a
,
char
b
,
char
c
,
char
d
,
char
e
,
char
f
,
char
g
,
char
h
,
char
i
,
char
j
,
char
k
,
char
l
,
char
m
);
char
k
,
char
l
,
char
m
,
char
n
);
static
PyObject
*
test_char_converter
(
PyObject
*
module
,
PyObject
*
const
*
args
,
Py_ssize_t
nargs
)
{
PyObject
*
return_value
=
NULL
;
char
a
=
'A'
;
char
b
=
'\
a
'
;
char
c
=
'\
b
'
;
char
b
=
'\
x07
'
;
char
c
=
'\
x08
'
;
char
d
=
'\t'
;
char
e
=
'\n'
;
char
f
=
'\
v
'
;
char
g
=
'\
f
'
;
char
f
=
'\
x0b
'
;
char
g
=
'\
x0c
'
;
char
h
=
'\r'
;
char
i
=
'
\
"'
;
char
i
=
'"'
;
char
j
=
'\''
;
char
k
=
'
\
?'
;
char
k
=
'?'
;
char
l
=
'\\'
;
char
m
=
'\0'
;
char
m
=
'\x00'
;
char
n
=
'\xff'
;
if
(
!
_PyArg_ParseStack
(
args
,
nargs
,
"|ccccccccccccc:test_char_converter"
,
&
a
,
&
b
,
&
c
,
&
d
,
&
e
,
&
f
,
&
g
,
&
h
,
&
i
,
&
j
,
&
k
,
&
l
,
&
m
))
{
if
(
!
_PyArg_ParseStack
(
args
,
nargs
,
"|ccccccccccccc
c
:test_char_converter"
,
&
a
,
&
b
,
&
c
,
&
d
,
&
e
,
&
f
,
&
g
,
&
h
,
&
i
,
&
j
,
&
k
,
&
l
,
&
m
,
&
n
))
{
goto
exit
;
}
return_value
=
test_char_converter_impl
(
module
,
a
,
b
,
c
,
d
,
e
,
f
,
g
,
h
,
i
,
j
,
k
,
l
,
m
);
return_value
=
test_char_converter_impl
(
module
,
a
,
b
,
c
,
d
,
e
,
f
,
g
,
h
,
i
,
j
,
k
,
l
,
m
,
n
);
exit
:
return
return_value
;
...
...
@@ -399,8 +401,8 @@ exit:
static
PyObject
*
test_char_converter_impl
(
PyObject
*
module
,
char
a
,
char
b
,
char
c
,
char
d
,
char
e
,
char
f
,
char
g
,
char
h
,
char
i
,
char
j
,
char
k
,
char
l
,
char
m
)
/*[clinic end generated code: output=
d9b268767e933c77 input=40431047c768ec24
]*/
char
k
,
char
l
,
char
m
,
char
n
)
/*[clinic end generated code: output=
14c61e8ee78f3d47 input=e42330417a44feac
]*/
/*[clinic input]
test_unsigned_char_converter
...
...
Tools/clinic/clinic.py
Dosyayı görüntüle @
65ce60ae
...
...
@@ -2562,29 +2562,14 @@ class char_converter(CConverter):
format_unit
=
'c'
c_ignored_default
=
"'
\0
'"
# characters which need to be escaped in C code
_escapes
=
{
x
:
r'\%d'
%
x
for
x
in
range
(
7
)}
_escapes
.
update
({
0x07
:
r'\a'
,
0x08
:
r'\b'
,
0x09
:
r'\t'
,
0x0A
:
r'\n'
,
0x0B
:
r'\v'
,
0x0C
:
r'\f'
,
0x0D
:
r'\r'
,
0x22
:
r'\"'
,
0x27
:
r'\''
,
0x3F
:
r'\?'
,
0x5C
:
r'\\'
,
})
def
converter_init
(
self
):
if
isinstance
(
self
.
default
,
self
.
default_type
):
if
len
(
self
.
default
)
!=
1
:
fail
(
"char_converter: illegal default value "
+
repr
(
self
.
default
))
c_ord
=
self
.
default
[
0
]
self
.
c_default
=
"'
%
s'"
%
self
.
_escapes
.
get
(
c_ord
,
chr
(
c_ord
))
self
.
c_default
=
repr
(
bytes
(
self
.
default
))[
1
:]
if
self
.
c_default
==
'"
\'
"'
:
self
.
c_default
=
r"'\''"
@add_legacy_c_converter
(
'B'
,
bitwise
=
True
)
...
...
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