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
f866f97c
Kaydet (Commit)
f866f97c
authored
Eki 29, 2013
tarafından
Victor Stinner
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Issue #19433: test_capi: check signness of some C types
üst
01076554
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
34 additions
and
10 deletions
+34
-10
_testcapimodule.c
Modules/_testcapimodule.c
+34
-10
No files found.
Modules/_testcapimodule.c
Dosyayı görüntüle @
f866f97c
...
...
@@ -67,38 +67,62 @@ test_config(PyObject *self)
static
PyObject
*
test_sizeof_c_types
(
PyObject
*
self
)
{
#define CHECK_SIZEOF(
EXPECTED, TYPE
) \
#define CHECK_SIZEOF(
TYPE, EXPECTED
) \
if (EXPECTED != sizeof(TYPE)) { \
PyErr_Format(TestError, \
"sizeof(%s) = %u instead of %u", \
#TYPE, sizeof(TYPE), EXPECTED); \
return (PyObject*)NULL; \
}
#define IS_SIGNED(TYPE) (((TYPE)-1) < (TYPE)0)
#define CHECK_SIGNNESS(TYPE, SIGNED) \
if (IS_SIGNED(TYPE) != SIGNED) { \
PyErr_Format(TestError, \
"%s signness is, instead of %i", \
#TYPE, IS_SIGNED(TYPE), SIGNED); \
return (PyObject*)NULL; \
}
/* integer types */
CHECK_SIZEOF
(
1
,
Py_UCS1
);
CHECK_SIZEOF
(
2
,
Py_UCS2
);
CHECK_SIZEOF
(
4
,
Py_UCS4
);
CHECK_SIZEOF
(
Py_UCS1
,
1
);
CHECK_SIZEOF
(
Py_UCS2
,
2
);
CHECK_SIZEOF
(
Py_UCS4
,
4
);
CHECK_SIGNNESS
(
Py_UCS1
,
0
);
CHECK_SIGNNESS
(
Py_UCS2
,
0
);
CHECK_SIGNNESS
(
Py_UCS4
,
0
);
#ifdef HAVE_INT32_T
CHECK_SIZEOF
(
4
,
PY_INT32_T
);
CHECK_SIZEOF
(
PY_INT32_T
,
4
);
CHECK_SIGNNESS
(
PY_INT32_T
,
1
);
#endif
#ifdef HAVE_UINT32_T
CHECK_SIZEOF
(
4
,
PY_UINT32_T
);
CHECK_SIZEOF
(
PY_UINT32_T
,
4
);
CHECK_SIGNNESS
(
PY_UINT32_T
,
0
);
#endif
#ifdef HAVE_INT64_T
CHECK_SIZEOF
(
8
,
PY_INT64_T
);
CHECK_SIZEOF
(
PY_INT64_T
,
8
);
CHECK_SIGNNESS
(
PY_INT64_T
,
1
);
#endif
#ifdef HAVE_UINT64_T
CHECK_SIZEOF
(
8
,
PY_UINT64_T
);
CHECK_SIZEOF
(
PY_UINT64_T
,
8
);
CHECK_SIGNNESS
(
PY_UINT64_T
,
0
);
#endif
/* pointer/size types */
CHECK_SIZEOF
(
sizeof
(
void
*
),
size_t
);
CHECK_SIZEOF
(
sizeof
(
void
*
),
Py_ssize_t
);
CHECK_SIZEOF
(
size_t
,
sizeof
(
void
*
));
CHECK_SIGNNESS
(
size_t
,
0
);
CHECK_SIZEOF
(
Py_ssize_t
,
sizeof
(
void
*
));
CHECK_SIGNNESS
(
Py_ssize_t
,
1
);
CHECK_SIZEOF
(
Py_uintptr_t
,
sizeof
(
void
*
));
CHECK_SIGNNESS
(
Py_uintptr_t
,
0
);
CHECK_SIZEOF
(
Py_intptr_t
,
sizeof
(
void
*
));
CHECK_SIGNNESS
(
Py_intptr_t
,
1
);
Py_INCREF
(
Py_None
);
return
Py_None
;
#undef IS_SIGNED
#undef CHECK_SIGNESS
#undef CHECK_SIZEOF
}
...
...
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