Fix compilation warnings on Windows (GH-8627)
* Fix compilation warning in _ctypes module on Window
(cherry picked from commit 20f11fe43c47b68c8b9dd6539d2d40b66c9957f9)
* Fix compilation warnings on Windows 64-bit
(cherry picked from commit 725e4212229bf68f87d4f66c1815d444ddfc7aa5)
* Fix compiler warning in unicodeobject.c
Explicitly case to Py_UNICODE to fix the warning:
Objects\unicodeobject.c(4225): warning C4244: '=' :
conversion from 'long' to 'Py_UNICODE', possible loss of data
The downcast cannot overflow since we check that value <= 0x10ffff.
diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c
index 8bf04df..b76db61 100644
--- a/Objects/unicodeobject.c
+++ b/Objects/unicodeobject.c
@@ -4222,7 +4222,7 @@
p = PyUnicode_AS_UNICODE(v) + oldpos;
}
value -= 0x10000;
- *p++ = 0xD800 | (value >> 10);
+ *p++ = 0xD800 | (Py_UNICODE)(value >> 10);
*p++ = 0xDC00 | (value & 0x3FF);
extrachars -= 2;
}