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
ed27785b
Kaydet (Commit)
ed27785b
authored
Ock 31, 2012
tarafından
Victor Stinner
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Issue #13706: Add assertions to detect bugs earlier
üst
5ea5b67a
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
3 deletions
+12
-3
unicodeobject.h
Include/unicodeobject.h
+3
-0
formatter_unicode.c
Python/formatter_unicode.c
+9
-3
No files found.
Include/unicodeobject.h
Dosyayı görüntüle @
ed27785b
...
...
@@ -499,14 +499,17 @@ enum PyUnicode_Kind {
do { \
switch ((kind)) { \
case PyUnicode_1BYTE_KIND: { \
assert(value <= 0xff); \
((Py_UCS1 *)(data))[(index)] = (Py_UCS1)(value); \
break; \
} \
case PyUnicode_2BYTE_KIND: { \
assert(value <= 0xffff); \
((Py_UCS2 *)(data))[(index)] = (Py_UCS2)(value); \
break; \
} \
default: { \
assert(value <= 0x10ffff); \
assert((kind) == PyUnicode_4BYTE_KIND); \
((Py_UCS4 *)(data))[(index)] = (Py_UCS4)(value); \
} \
...
...
Python/formatter_unicode.c
Dosyayı görüntüle @
ed27785b
...
...
@@ -559,8 +559,9 @@ fill_number(PyObject *out, Py_ssize_t pos, const NumberFieldWidths *spec,
Py_ssize_t
t
;
for
(
t
=
0
;
t
<
spec
->
n_prefix
;
t
++
)
{
Py_UCS4
c
=
PyUnicode_READ
(
kind
,
data
,
pos
+
t
);
c
=
Py_TOUPPER
(
c
);
assert
(
c
<=
127
);
PyUnicode_WRITE
(
kind
,
data
,
pos
+
t
,
Py_TOUPPER
(
c
)
);
PyUnicode_WRITE
(
kind
,
data
,
pos
+
t
,
c
);
}
}
pos
+=
spec
->
n_prefix
;
...
...
@@ -603,11 +604,12 @@ fill_number(PyObject *out, Py_ssize_t pos, const NumberFieldWidths *spec,
Py_ssize_t
t
;
for
(
t
=
0
;
t
<
spec
->
n_grouped_digits
;
t
++
)
{
Py_UCS4
c
=
PyUnicode_READ
(
kind
,
data
,
pos
+
t
);
c
=
Py_TOUPPER
(
c
);
if
(
c
>
127
)
{
PyErr_SetString
(
PyExc_SystemError
,
"non-ascii grouped digit"
);
return
-
1
;
}
PyUnicode_WRITE
(
kind
,
data
,
pos
+
t
,
Py_TOUPPER
(
c
)
);
PyUnicode_WRITE
(
kind
,
data
,
pos
+
t
,
c
);
}
}
pos
+=
spec
->
n_grouped_digits
;
...
...
@@ -733,6 +735,7 @@ format_string_internal(PyObject *value, const InternalFormatSpec *format)
Py_CLEAR
(
result
);
done:
assert
(
!
result
||
_PyUnicode_CheckConsistency
(
result
,
1
));
return
result
;
}
...
...
@@ -759,7 +762,7 @@ format_int_or_long_internal(PyObject *value, const InternalFormatSpec *format,
produces non-digits */
Py_ssize_t
n_prefix
=
0
;
/* Count of prefix chars, (e.g., '0x') */
Py_ssize_t
n_total
;
Py_ssize_t
prefix
;
Py_ssize_t
prefix
=
0
;
NumberFieldWidths
spec
;
long
x
;
int
err
;
...
...
@@ -894,6 +897,7 @@ format_int_or_long_internal(PyObject *value, const InternalFormatSpec *format,
done:
Py_XDECREF
(
tmp
);
assert
(
!
result
||
_PyUnicode_CheckConsistency
(
result
,
1
));
return
result
;
}
...
...
@@ -1036,6 +1040,7 @@ format_float_internal(PyObject *value,
done:
PyMem_Free
(
buf
);
Py_DECREF
(
unicode_tmp
);
assert
(
!
result
||
_PyUnicode_CheckConsistency
(
result
,
1
));
return
result
;
}
...
...
@@ -1270,6 +1275,7 @@ done:
PyMem_Free
(
im_buf
);
Py_XDECREF
(
re_unicode_tmp
);
Py_XDECREF
(
im_unicode_tmp
);
assert
(
!
result
||
_PyUnicode_CheckConsistency
(
result
,
1
));
return
result
;
}
...
...
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