summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2013-09-05 15:01:15 (GMT)
committerSerhiy Storchaka <storchaka@gmail.com>2013-09-05 15:01:15 (GMT)
commit134f0de66d9ff0478d9ace24d7671308082d1d5b (patch)
tree648007a24ed373f2bfae1b6d6c3bc1e065a55e8f /Modules
parentef31a00e996ca62080451ad6f3d96256103859ae (diff)
downloadcpython-134f0de66d9ff0478d9ace24d7671308082d1d5b.zip
cpython-134f0de66d9ff0478d9ace24d7671308082d1d5b.tar.gz
cpython-134f0de66d9ff0478d9ace24d7671308082d1d5b.tar.bz2
Issue #18672: Fixed format specifiers for Py_ssize_t in debugging output in
the _sre moduel.
Diffstat (limited to 'Modules')
-rw-r--r--Modules/_sre.c37
1 files changed, 23 insertions, 14 deletions
diff --git a/Modules/_sre.c b/Modules/_sre.c
index 2ecbcc0..5bcc387 100644
--- a/Modules/_sre.c
+++ b/Modules/_sre.c
@@ -242,7 +242,7 @@ data_stack_grow(SRE_STATE* state, Py_ssize_t size)
if (cursize < minsize) {
void* stack;
cursize = minsize+minsize/4+1024;
- TRACE(("allocate/grow stack %d\n", cursize));
+ TRACE(("allocate/grow stack %" PY_FORMAT_SIZE_T "d\n", cursize));
stack = PyMem_REALLOC(state->data_stack, cursize);
if (!stack) {
data_stack_dealloc(state);
@@ -561,12 +561,13 @@ SRE_COUNT(SRE_STATE* state, SRE_CODE* pattern, Py_ssize_t maxcount)
if (!i)
break;
}
- TRACE(("|%p|%p|COUNT %d\n", pattern, ptr,
+ TRACE(("|%p|%p|COUNT %" PY_FORMAT_SIZE_T "d\n", pattern, ptr,
((char*)state->ptr - ptr)/state->charsize));
return ((char*)state->ptr - ptr)/state->charsize;
}
- TRACE(("|%p|%p|COUNT %d\n", pattern, ptr, (ptr - (char*) state->ptr)/state->charsize));
+ TRACE(("|%p|%p|COUNT %" PY_FORMAT_SIZE_T "d\n", pattern, ptr,
+ (ptr - (char*) state->ptr)/state->charsize));
return (ptr - (char*) state->ptr)/state->charsize;
}
@@ -653,7 +654,8 @@ SRE_INFO(SRE_STATE* state, SRE_CODE* pattern)
#define DATA_STACK_ALLOC(state, type, ptr) \
do { \
alloc_pos = state->data_stack_base; \
- TRACE(("allocating %s in %d (%d)\n", \
+ TRACE(("allocating %s in %" PY_FORMAT_SIZE_T "d " \
+ "(%" PY_FORMAT_SIZE_T "d)\n", \
SFY(type), alloc_pos, sizeof(type))); \
if (sizeof(type) > state->data_stack_size - alloc_pos) { \
int j = data_stack_grow(state, sizeof(type)); \
@@ -667,13 +669,14 @@ do { \
#define DATA_STACK_LOOKUP_AT(state, type, ptr, pos) \
do { \
- TRACE(("looking up %s at %d\n", SFY(type), pos)); \
+ TRACE(("looking up %s at %" PY_FORMAT_SIZE_T "d\n", SFY(type), pos)); \
ptr = (type*)(state->data_stack+pos); \
} while (0)
#define DATA_STACK_PUSH(state, data, size) \
do { \
- TRACE(("copy data in %p to %d (%d)\n", \
+ TRACE(("copy data in %p to %" PY_FORMAT_SIZE_T "d " \
+ "(%" PY_FORMAT_SIZE_T "d)\n", \
data, state->data_stack_base, size)); \
if (size > state->data_stack_size - state->data_stack_base) { \
int j = data_stack_grow(state, size); \
@@ -687,7 +690,8 @@ do { \
#define DATA_STACK_POP(state, data, size, discard) \
do { \
- TRACE(("copy data to %p from %d (%d)\n", \
+ TRACE(("copy data to %p from %" PY_FORMAT_SIZE_T "d " \
+ "(%" PY_FORMAT_SIZE_T "d)\n", \
data, state->data_stack_base-size, size)); \
memcpy(data, state->data_stack+state->data_stack_base-size, size); \
if (discard) \
@@ -696,7 +700,8 @@ do { \
#define DATA_STACK_POP_DISCARD(state, size) \
do { \
- TRACE(("discard data from %d (%d)\n", \
+ TRACE(("discard data from %" PY_FORMAT_SIZE_T "d " \
+ "(%" PY_FORMAT_SIZE_T "d)\n", \
state->data_stack_base-size, size)); \
state->data_stack_base -= size; \
} while(0)
@@ -800,8 +805,10 @@ entrance:
/* optimization info block */
/* <INFO> <1=skip> <2=flags> <3=min> ... */
if (ctx->pattern[3] && (end - ctx->ptr)/state->charsize < ctx->pattern[3]) {
- TRACE(("reject (got %d chars, need %d)\n",
- (end - ctx->ptr)/state->charsize, ctx->pattern[3]));
+ TRACE(("reject (got %" PY_FORMAT_SIZE_T "d chars, "
+ "need %" PY_FORMAT_SIZE_T "d)\n",
+ (end - ctx->ptr)/state->charsize,
+ (Py_ssize_t) ctx->pattern[3]));
RETURN_FAILURE;
}
ctx->pattern += ctx->pattern[1] + 1;
@@ -1177,7 +1184,7 @@ entrance:
ctx->count = ctx->u.rep->count+1;
- TRACE(("|%p|%p|MAX_UNTIL %d\n", ctx->pattern,
+ TRACE(("|%p|%p|MAX_UNTIL %" PY_FORMAT_SIZE_T "d\n", ctx->pattern,
ctx->ptr, ctx->count));
if (ctx->count < (Py_ssize_t) ctx->u.rep->pattern[1]) {
@@ -1240,7 +1247,7 @@ entrance:
ctx->count = ctx->u.rep->count+1;
- TRACE(("|%p|%p|MIN_UNTIL %d %p\n", ctx->pattern,
+ TRACE(("|%p|%p|MIN_UNTIL %" PY_FORMAT_SIZE_T "d %p\n", ctx->pattern,
ctx->ptr, ctx->count, ctx->u.rep->pattern));
if (ctx->count < (Py_ssize_t) ctx->u.rep->pattern[1]) {
@@ -1457,7 +1464,8 @@ exit:
TRACE(("|%p|%p|JUMP_ASSERT_NOT\n", ctx->pattern, ctx->ptr));
goto jump_assert_not;
case JUMP_NONE:
- TRACE(("|%p|%p|RETURN %d\n", ctx->pattern, ctx->ptr, ret));
+ TRACE(("|%p|%p|RETURN %" PY_FORMAT_SIZE_T "d\n", ctx->pattern,
+ ctx->ptr, ret));
break;
}
@@ -1506,7 +1514,8 @@ SRE_SEARCH(SRE_STATE* state, SRE_CODE* pattern)
pattern += 1 + pattern[1];
}
- TRACE(("prefix = %p %d %d\n", prefix, prefix_len, prefix_skip));
+ TRACE(("prefix = %p %" PY_FORMAT_SIZE_T "d %" PY_FORMAT_SIZE_T "d\n",
+ prefix, prefix_len, prefix_skip));
TRACE(("charset = %p\n", charset));
#if defined(USE_FAST_SEARCH)