summaryrefslogtreecommitdiff
path: root/Lib/python
diff options
context:
space:
mode:
authorWilliam S Fulton <wsf@fultondesigns.co.uk>2022-05-07 06:22:25 +0100
committerWilliam S Fulton <wsf@fultondesigns.co.uk>2022-05-07 06:22:25 +0100
commit72bb68d556e306b2faa54db7769f518e039f34f4 (patch)
tree65cf6598f4a1b48b7dbb4496ea99979d5eee5f46 /Lib/python
parent07a9eece101c395a451abf86475ba37e132efa3b (diff)
downloadswig-72bb68d556e306b2faa54db7769f518e039f34f4.tar.gz
Visual C++ warning fix in Python < 3.2 builtin wrappers
Fixes: warning C4311: 'type cast': pointer truncation from 'void *' to 'long' warning C4302: 'type cast': truncation from 'void *' to 'long'
Diffstat (limited to 'Lib/python')
-rw-r--r--Lib/python/builtin.swg4
1 files changed, 4 insertions, 0 deletions
diff --git a/Lib/python/builtin.swg b/Lib/python/builtin.swg
index 9dccd7e20..f31fccf1e 100644
--- a/Lib/python/builtin.swg
+++ b/Lib/python/builtin.swg
@@ -6,7 +6,11 @@ SWIGINTERN Py_hash_t
SwigPyObject_hash(PyObject *obj) {
SwigPyObject *sobj = (SwigPyObject *)obj;
void *ptr = sobj->ptr;
+#if PY_VERSION_HEX < 0x03020000
+ return (Py_hash_t)(Py_ssize_t)ptr;
+#else
return (Py_hash_t)ptr;
+#endif
}
SWIGINTERN Py_hash_t