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
f8bb7d02
Kaydet (Commit)
f8bb7d02
authored
Eyl 29, 2011
tarafından
Victor Stinner
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
array module stores the typecode in a char, instead of Py_UNICODE
üst
c806fdcd
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
19 deletions
+16
-19
arraymodule.c
Modules/arraymodule.c
+16
-19
No files found.
Modules/arraymodule.c
Dosyayı görüntüle @
f8bb7d02
...
...
@@ -22,7 +22,7 @@ struct arrayobject; /* Forward */
* functions aren't visible yet.
*/
struct
arraydescr
{
Py_UNICODE
typecode
;
char
typecode
;
int
itemsize
;
PyObject
*
(
*
getitem
)(
struct
arrayobject
*
,
Py_ssize_t
);
int
(
*
setitem
)(
struct
arrayobject
*
,
Py_ssize_t
,
PyObject
*
);
...
...
@@ -1510,7 +1510,7 @@ array_fromunicode(arrayobject *self, PyObject *args)
{
Py_UNICODE
*
ustr
;
Py_ssize_t
n
;
Py_UNICODE
typecode
;
char
typecode
;
if
(
!
PyArg_ParseTuple
(
args
,
"u#:fromunicode"
,
&
ustr
,
&
n
))
return
NULL
;
...
...
@@ -1545,7 +1545,7 @@ append Unicode data to an array of some other type.");
static
PyObject
*
array_tounicode
(
arrayobject
*
self
,
PyObject
*
unused
)
{
Py_UNICODE
typecode
;
char
typecode
;
typecode
=
self
->
ob_descr
->
typecode
;
if
((
typecode
!=
'u'
))
{
PyErr_SetString
(
PyExc_ValueError
,
...
...
@@ -1642,7 +1642,7 @@ static const struct mformatdescr {
* be found.
*/
static
enum
machine_format_code
typecode_to_mformat_code
(
int
typecode
)
typecode_to_mformat_code
(
char
typecode
)
{
#ifdef WORDS_BIGENDIAN
const
int
is_big_endian
=
1
;
...
...
@@ -1721,7 +1721,7 @@ typecode_to_mformat_code(int typecode)
intsize
=
sizeof
(
PY_LONG_LONG
);
is_signed
=
0
;
break
;
#endif
#endif
default:
return
UNKNOWN_FORMAT
;
}
...
...
@@ -1752,7 +1752,7 @@ static PyObject *array_new(PyTypeObject *type, PyObject *args, PyObject *kwds);
* NULL is returned to indicate a failure.
*/
static
PyObject
*
make_array
(
PyTypeObject
*
arraytype
,
Py_UNICODE
typecode
,
PyObject
*
items
)
make_array
(
PyTypeObject
*
arraytype
,
char
typecode
,
PyObject
*
items
)
{
PyObject
*
new_args
;
PyObject
*
array_obj
;
...
...
@@ -1761,7 +1761,7 @@ make_array(PyTypeObject *arraytype, Py_UNICODE typecode, PyObject *items)
assert
(
arraytype
!=
NULL
);
assert
(
items
!=
NULL
);
typecode_obj
=
PyUnicode_From
Unicode
(
&
typecode
,
1
);
typecode_obj
=
PyUnicode_From
Ordinal
(
typecode
);
if
(
typecode_obj
==
NULL
)
return
NULL
;
...
...
@@ -1791,17 +1791,14 @@ array_reconstructor(PyObject *self, PyObject *args)
PyObject
*
items
;
PyObject
*
converted_items
;
PyObject
*
result
;
int
typecode_int
;
Py_UNICODE
typecode
;
int
typecode
;
enum
machine_format_code
mformat_code
;
struct
arraydescr
*
descr
;
if
(
!
PyArg_ParseTuple
(
args
,
"OCiO:array._array_reconstructor"
,
&
arraytype
,
&
typecode
_int
,
&
mformat_code
,
&
items
))
&
arraytype
,
&
typecode
,
&
mformat_code
,
&
items
))
return
NULL
;
typecode
=
(
Py_UNICODE
)
typecode_int
;
if
(
!
PyType_Check
(
arraytype
))
{
PyErr_Format
(
PyExc_TypeError
,
"first argument must a type object, not %.200s"
,
...
...
@@ -1815,7 +1812,7 @@ array_reconstructor(PyObject *self, PyObject *args)
return
NULL
;
}
for
(
descr
=
descriptors
;
descr
->
typecode
!=
'\0'
;
descr
++
)
{
if
(
descr
->
typecode
==
typecode
)
if
(
(
int
)
descr
->
typecode
==
typecode
)
break
;
}
if
(
descr
->
typecode
==
'\0'
)
{
...
...
@@ -1837,9 +1834,9 @@ array_reconstructor(PyObject *self, PyObject *args)
}
/* Fast path: No decoding has to be done. */
if
(
mformat_code
==
typecode_to_mformat_code
(
typecode
)
||
if
(
mformat_code
==
typecode_to_mformat_code
(
(
char
)
typecode
)
||
mformat_code
==
UNKNOWN_FORMAT
)
{
return
make_array
(
arraytype
,
typecode
,
items
);
return
make_array
(
arraytype
,
(
char
)
typecode
,
items
);
}
/* Slow path: Decode the byte string according to the given machine
...
...
@@ -1985,7 +1982,7 @@ array_reconstructor(PyObject *self, PyObject *args)
return
NULL
;
}
result
=
make_array
(
arraytype
,
typecode
,
converted_items
);
result
=
make_array
(
arraytype
,
(
char
)
typecode
,
converted_items
);
Py_DECREF
(
converted_items
);
return
result
;
}
...
...
@@ -2074,8 +2071,8 @@ PyDoc_STRVAR(reduce_doc, "Return state information for pickling.");
static
PyObject
*
array_get_typecode
(
arrayobject
*
a
,
void
*
closure
)
{
Py_UNICODE
tc
=
a
->
ob_descr
->
typecode
;
return
PyUnicode_From
Unicode
(
&
tc
,
1
);
char
typecode
=
a
->
ob_descr
->
typecode
;
return
PyUnicode_From
Ordinal
(
typecode
);
}
static
PyObject
*
...
...
@@ -2147,7 +2144,7 @@ static PyMethodDef array_methods[] = {
static
PyObject
*
array_repr
(
arrayobject
*
a
)
{
Py_UNICODE
typecode
;
char
typecode
;
PyObject
*
s
,
*
v
=
NULL
;
Py_ssize_t
len
;
...
...
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