summaryrefslogtreecommitdiffstats
path: root/Modules/sre_lib.h
diff options
context:
space:
mode:
authorAmmar Askar <ammar@ammaraskar.com>2020-06-01 17:21:43 (GMT)
committerGitHub <noreply@github.com>2020-06-01 17:21:43 (GMT)
commit06e3a27a3c863495390a07c695171a8e62a6e0d2 (patch)
tree9d2d738971d6a057717c5f233d40a53a94121064 /Modules/sre_lib.h
parenta97011b9b8c8111f42e1e7594081956136d848da (diff)
downloadcpython-06e3a27a3c863495390a07c695171a8e62a6e0d2.zip
cpython-06e3a27a3c863495390a07c695171a8e62a6e0d2.tar.gz
cpython-06e3a27a3c863495390a07c695171a8e62a6e0d2.tar.bz2
bpo-39943: Fix MSVC warnings in sre extension (GH-20508)
Diffstat (limited to 'Modules/sre_lib.h')
-rw-r--r--Modules/sre_lib.h5
1 files changed, 4 insertions, 1 deletions
diff --git a/Modules/sre_lib.h b/Modules/sre_lib.h
index 9cc7863..2657d8d 100644
--- a/Modules/sre_lib.h
+++ b/Modules/sre_lib.h
@@ -448,12 +448,15 @@ do { \
state->data_stack_base += size; \
} while (0)
+/* We add an explicit cast to memcpy here because MSVC has a bug when
+ compiling C code where it believes that `const void**` cannot be
+ safely casted to `void*`, see bpo-39943 for details. */
#define DATA_STACK_POP(state, data, size, discard) \
do { \
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); \
+ memcpy((void*) data, state->data_stack+state->data_stack_base-size, size); \
if (discard) \
state->data_stack_base -= size; \
} while (0)