aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorOleg Iarygin <oleg@arhadthedev.net>2022-08-01 19:30:15 +0300
committerGitHub <noreply@github.com>2022-08-01 17:30:15 +0100
commit858c9a58bf56cefc792bf0eb1ba22984b7b2d150 (patch)
tree3a9e0c166045d8bc48c8b7ac48dfc813931f6dfa
parentc0cd79021951b3ab10804d42b3963b9fb1a66be7 (diff)
downloadcpython-858c9a58bf56cefc792bf0eb1ba22984b7b2d150.tar.gz
cpython-858c9a58bf56cefc792bf0eb1ba22984b7b2d150.zip
gh-95417: Quick fix for "ULONG_PTR differs in levels of indirection from void *" (GH-95538)
-rw-r--r--Modules/clinic/overlapped.c.h6
-rw-r--r--Modules/overlapped.c10
2 files changed, 12 insertions, 4 deletions
diff --git a/Modules/clinic/overlapped.c.h b/Modules/clinic/overlapped.c.h
index 721b38c75ce..1c216633eb9 100644
--- a/Modules/clinic/overlapped.c.h
+++ b/Modules/clinic/overlapped.c.h
@@ -37,7 +37,7 @@ _overlapped_CreateIoCompletionPort(PyObject *module, PyObject *const *args, Py_s
if (!ExistingCompletionPort && PyErr_Occurred()) {
goto exit;
}
- CompletionKey = PyLong_AsVoidPtr(args[2]);
+ CompletionKey = (uintptr_t)PyLong_AsVoidPtr(args[2]);
if (!CompletionKey && PyErr_Occurred()) {
goto exit;
}
@@ -124,7 +124,7 @@ _overlapped_PostQueuedCompletionStatus(PyObject *module, PyObject *const *args,
if (!_PyLong_UnsignedLong_Converter(args[1], &NumberOfBytes)) {
goto exit;
}
- CompletionKey = PyLong_AsVoidPtr(args[2]);
+ CompletionKey = (uintptr_t)PyLong_AsVoidPtr(args[2]);
if (!CompletionKey && PyErr_Occurred()) {
goto exit;
}
@@ -1225,4 +1225,4 @@ exit:
return return_value;
}
-/*[clinic end generated code: output=d90cda84e49a7c23 input=a9049054013a1b77]*/
+/*[clinic end generated code: output=edd05b7a6c9c3aac input=a9049054013a1b77]*/
diff --git a/Modules/overlapped.c b/Modules/overlapped.c
index 0cec9eedc87..369b1beae84 100644
--- a/Modules/overlapped.c
+++ b/Modules/overlapped.c
@@ -52,13 +52,21 @@ class HANDLE_converter(pointer_converter):
class ULONG_PTR_converter(pointer_converter):
type = 'ULONG_PTR'
+ def parse_arg(self, argname, displayname):
+ return """
+ {paramname} = (uintptr_t)PyLong_AsVoidPtr({argname});
+ if (!{paramname} && PyErr_Occurred()) {{{{
+ goto exit;
+ }}}}
+ """.format(argname=argname, paramname=self.parser_name)
+
class DWORD_converter(unsigned_long_converter):
type = 'DWORD'
class BOOL_converter(int_converter):
type = 'BOOL'
[python start generated code]*/
-/*[python end generated code: output=da39a3ee5e6b4b0d input=a19133a9e14fae9c]*/
+/*[python end generated code: output=da39a3ee5e6b4b0d input=8a07ea3018f4cec8]*/
/*[clinic input]
module _overlapped