Skip to content

Commit 12b2538

Browse files
Reuse Py_STRINGIFY() macro in sre_lib.h and dynload_win.c.
1 parent e20310f commit 12b2538

2 files changed

Lines changed: 4 additions & 8 deletions

File tree

Modules/sre_lib.h

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -367,14 +367,12 @@ SRE(info)(SRE_STATE* state, SRE_CODE* pattern)
367367
#define RETURN_ON_FAILURE(i) \
368368
do { RETURN_ON_ERROR(i); if (i == 0) RETURN_FAILURE; } while (0)
369369

370-
#define SFY(x) #x
371-
372370
#define DATA_STACK_ALLOC(state, type, ptr) \
373371
do { \
374372
alloc_pos = state->data_stack_base; \
375373
TRACE(("allocating %s in %" PY_FORMAT_SIZE_T "d " \
376374
"(%" PY_FORMAT_SIZE_T "d)\n", \
377-
SFY(type), alloc_pos, sizeof(type))); \
375+
Py_STRINGIFY(type), alloc_pos, sizeof(type))); \
378376
if (sizeof(type) > state->data_stack_size - alloc_pos) { \
379377
int j = data_stack_grow(state, sizeof(type)); \
380378
if (j < 0) return j; \
@@ -387,7 +385,7 @@ do { \
387385

388386
#define DATA_STACK_LOOKUP_AT(state, type, ptr, pos) \
389387
do { \
390-
TRACE(("looking up %s at %" PY_FORMAT_SIZE_T "d\n", SFY(type), pos)); \
388+
TRACE(("looking up %s at %" PY_FORMAT_SIZE_T "d\n", Py_STRINGIFY(type), pos)); \
391389
ptr = (type*)(state->data_stack+pos); \
392390
} while (0)
393391

Python/dynload_win.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,10 @@ void _Py_DeactivateActCtx(ULONG_PTR cookie);
2424
#define PYD_DEBUG_SUFFIX ""
2525
#endif
2626

27-
#define STRINGIZE2(x) #x
28-
#define STRINGIZE(x) STRINGIZE2(x)
2927
#ifdef PYD_PLATFORM_TAG
30-
#define PYD_TAGGED_SUFFIX PYD_DEBUG_SUFFIX ".cp" STRINGIZE(PY_MAJOR_VERSION) STRINGIZE(PY_MINOR_VERSION) "-" PYD_PLATFORM_TAG ".pyd"
28+
#define PYD_TAGGED_SUFFIX PYD_DEBUG_SUFFIX ".cp" Py_STRINGIFY(PY_MAJOR_VERSION) Py_STRINGIFY(PY_MINOR_VERSION) "-" PYD_PLATFORM_TAG ".pyd"
3129
#else
32-
#define PYD_TAGGED_SUFFIX PYD_DEBUG_SUFFIX ".cp" STRINGIZE(PY_MAJOR_VERSION) STRINGIZE(PY_MINOR_VERSION) ".pyd"
30+
#define PYD_TAGGED_SUFFIX PYD_DEBUG_SUFFIX ".cp" Py_STRINGIFY(PY_MAJOR_VERSION) Py_STRINGIFY(PY_MINOR_VERSION) ".pyd"
3331
#endif
3432

3533
#define PYD_UNTAGGED_SUFFIX PYD_DEBUG_SUFFIX ".pyd"

0 commit comments

Comments
 (0)