diff options
author | Victor Stinner <victor.stinner@gmail.com> | 2014-05-14 15:24:35 (GMT) |
---|---|---|
committer | Victor Stinner <victor.stinner@gmail.com> | 2014-05-14 15:24:35 (GMT) |
commit | 45e8e2f2185fc593ae84a628922c5cbb1799b6ea (patch) | |
tree | 5a6706f3fd37947b574fe44c45f6c4cb6f6f7c53 /Modules | |
parent | 79b49ab553f74560d71dd027db252f4f0ddd0304 (diff) | |
download | cpython-45e8e2f2185fc593ae84a628922c5cbb1799b6ea.zip cpython-45e8e2f2185fc593ae84a628922c5cbb1799b6ea.tar.gz cpython-45e8e2f2185fc593ae84a628922c5cbb1799b6ea.tar.bz2 |
Issue #21490: Add new C macros: Py_ABS() and Py_STRINGIFY()
Keep _Py_STRINGIZE() in PC/pyconfig.h to not introduce a dependency between
pyconfig.h and pymacros.h.
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/_ssl.c | 4 | ||||
-rw-r--r-- | Modules/_struct.c | 9 | ||||
-rw-r--r-- | Modules/_tracemalloc.c | 3 |
3 files changed, 5 insertions, 11 deletions
diff --git a/Modules/_ssl.c b/Modules/_ssl.c index 5031476..3b7226d 100644 --- a/Modules/_ssl.c +++ b/Modules/_ssl.c @@ -249,10 +249,8 @@ typedef enum { } timeout_state; /* Wrap error strings with filename and line # */ -#define STRINGIFY1(x) #x -#define STRINGIFY2(x) STRINGIFY1(x) #define ERRSTR1(x,y,z) (x ":" y ": " z) -#define ERRSTR(x) ERRSTR1("_ssl.c", STRINGIFY2(__LINE__), x) +#define ERRSTR(x) ERRSTR1("_ssl.c", Py_STRINGIFY(__LINE__), x) /* diff --git a/Modules/_struct.c b/Modules/_struct.c index 1de94e4..4941fc8 100644 --- a/Modules/_struct.c +++ b/Modules/_struct.c @@ -85,8 +85,6 @@ typedef struct { char c; _Bool x; } s_bool; #define BOOL_ALIGN 0 #endif -#define STRINGIFY(x) #x - #ifdef __powerc #pragma options align=reset #endif @@ -546,8 +544,8 @@ np_short(char *p, PyObject *v, const formatdef *f) return -1; if (x < SHRT_MIN || x > SHRT_MAX){ PyErr_SetString(StructError, - "short format requires " STRINGIFY(SHRT_MIN) - " <= number <= " STRINGIFY(SHRT_MAX)); + "short format requires " Py_STRINGIFY(SHRT_MIN) + " <= number <= " Py_STRINGIFY(SHRT_MAX)); return -1; } y = (short)x; @@ -564,7 +562,8 @@ np_ushort(char *p, PyObject *v, const formatdef *f) return -1; if (x < 0 || x > USHRT_MAX){ PyErr_SetString(StructError, - "ushort format requires 0 <= number <= " STRINGIFY(USHRT_MAX)); + "ushort format requires 0 <= number <= " + Py_STRINGIFY(USHRT_MAX)); return -1; } y = (unsigned short)x; diff --git a/Modules/_tracemalloc.c b/Modules/_tracemalloc.c index e254a90..429b209 100644 --- a/Modules/_tracemalloc.c +++ b/Modules/_tracemalloc.c @@ -16,9 +16,6 @@ static void raw_free(void *ptr); # define TRACE_DEBUG #endif -#define _STR(VAL) #VAL -#define STR(VAL) _STR(VAL) - /* Protected by the GIL */ static struct { PyMemAllocator mem; |