mirror of
https://github.com/python/cpython.git
synced 2024-11-24 17:47:13 +01:00
1cc02ca063
Move the following files from Modules/_testcapi/ to Modules/_testlimitedcapi/: * bytearray.c * bytes.c * pyos.c * sys.c Changes: * Replace PyBytes_AS_STRING() with PyBytes_AsString(). * Replace PyBytes_GET_SIZE() with PyBytes_Size(). * Update related test_capi tests. * Copy Modules/_testcapi/util.h to Modules/_testlimitedcapi/util.h.
34 lines
1.3 KiB
C
34 lines
1.3 KiB
C
#define NULLABLE(x) do { \
|
|
if (x == Py_None) { \
|
|
x = NULL; \
|
|
} \
|
|
} while (0);
|
|
|
|
#define RETURN_INT(value) do { \
|
|
int _ret = (value); \
|
|
if (_ret == -1) { \
|
|
assert(PyErr_Occurred()); \
|
|
return NULL; \
|
|
} \
|
|
assert(!PyErr_Occurred()); \
|
|
return PyLong_FromLong(_ret); \
|
|
} while (0)
|
|
|
|
#define RETURN_SIZE(value) do { \
|
|
Py_ssize_t _ret = (value); \
|
|
if (_ret == -1) { \
|
|
assert(PyErr_Occurred()); \
|
|
return NULL; \
|
|
} \
|
|
assert(!PyErr_Occurred()); \
|
|
return PyLong_FromSsize_t(_ret); \
|
|
} while (0)
|
|
|
|
/* Marker to check that pointer value was set. */
|
|
static const char uninitialized[] = "uninitialized";
|
|
#define UNINITIALIZED_PTR ((void *)uninitialized)
|
|
/* Marker to check that Py_ssize_t value was set. */
|
|
#define UNINITIALIZED_SIZE ((Py_ssize_t)236892191)
|
|
/* Marker to check that integer value was set. */
|
|
#define UNINITIALIZED_INT (63256717)
|