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
d919a59a
Kaydet (Commit)
d919a59a
authored
Eki 14, 2002
tarafından
Martin v. Löwis
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Allow Unicode strings in __slots__, converting them to byte strings.
üst
ff9284bc
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
39 additions
and
0 deletions
+39
-0
typeobject.c
Objects/typeobject.c
+39
-0
No files found.
Objects/typeobject.c
Dosyayı görüntüle @
d919a59a
...
@@ -1003,6 +1003,38 @@ valid_identifier(PyObject *s)
...
@@ -1003,6 +1003,38 @@ valid_identifier(PyObject *s)
return
1
;
return
1
;
}
}
#ifdef Py_USING_UNICODE
/* Replace Unicode objects in slots. */
static
PyObject
*
_unicode_to_string
(
PyObject
*
slots
,
int
nslots
)
{
PyObject
*
tmp
=
slots
;
PyObject
*
o
,
*
o1
;
int
i
;
intintargfunc
copy
=
slots
->
ob_type
->
tp_as_sequence
->
sq_slice
;
for
(
i
=
0
;
i
<
nslots
;
i
++
)
{
if
(
PyUnicode_Check
(
o
=
PyTuple_GET_ITEM
(
tmp
,
i
)))
{
if
(
tmp
==
slots
)
{
tmp
=
copy
(
slots
,
0
,
PyTuple_GET_SIZE
(
slots
));
if
(
tmp
==
NULL
)
return
NULL
;
}
o1
=
_PyUnicode_AsDefaultEncodedString
(
o
,
NULL
);
if
(
o1
==
NULL
)
{
Py_DECREF
(
tmp
);
return
0
;
}
Py_INCREF
(
o1
);
Py_DECREF
(
o
);
PyTuple_SET_ITEM
(
tmp
,
i
,
o1
);
}
}
return
tmp
;
}
#endif
static
PyObject
*
static
PyObject
*
type_new
(
PyTypeObject
*
metatype
,
PyObject
*
args
,
PyObject
*
kwds
)
type_new
(
PyTypeObject
*
metatype
,
PyObject
*
args
,
PyObject
*
kwds
)
{
{
...
@@ -1135,6 +1167,13 @@ type_new(PyTypeObject *metatype, PyObject *args, PyObject *kwds)
...
@@ -1135,6 +1167,13 @@ type_new(PyTypeObject *metatype, PyObject *args, PyObject *kwds)
return
NULL
;
return
NULL
;
}
}
#ifdef Py_USING_UNICODE
tmp
=
_unicode_to_string
(
slots
,
nslots
);
Py_DECREF
(
slots
);
slots
=
tmp
;
if
(
!
tmp
)
return
NULL
;
#endif
/* Check for valid slot names and two special cases */
/* Check for valid slot names and two special cases */
for
(
i
=
0
;
i
<
nslots
;
i
++
)
{
for
(
i
=
0
;
i
<
nslots
;
i
++
)
{
PyObject
*
tmp
=
PyTuple_GET_ITEM
(
slots
,
i
);
PyObject
*
tmp
=
PyTuple_GET_ITEM
(
slots
,
i
);
...
...
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