From 90cba22c26d2b83df6c5d85f9b1e4b8985b62f9a Mon Sep 17 00:00:00 2001 From: Avasam Date: Fri, 9 May 2025 12:10:33 -0400 Subject: [PATCH] Fix new 3.14 C API deprecation for `_Py_HashPointer` --- win32/src/PyHANDLE.cpp | 4 ++++ win32/src/PyOVERLAPPED.cpp | 8 ++++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/win32/src/PyHANDLE.cpp b/win32/src/PyHANDLE.cpp index c1baf754f6..3576681ddf 100644 --- a/win32/src/PyHANDLE.cpp +++ b/win32/src/PyHANDLE.cpp @@ -288,7 +288,11 @@ Py_hash_t PyHANDLE::hashFunc(PyObject *ob) { return ((PyHANDLE *)ob)->hash(); } Py_hash_t PyHANDLE::hash(void) { // Just use the address. +#if PY_VERSION_HEX >= 0x03130000 + return Py_HashPointer(this); +#else return _Py_HashPointer(this); +#endif } int PyHANDLE::print(FILE *fp, int flags) diff --git a/win32/src/PyOVERLAPPED.cpp b/win32/src/PyOVERLAPPED.cpp index 5a5af5a8db..2fab5eaa0d 100644 --- a/win32/src/PyOVERLAPPED.cpp +++ b/win32/src/PyOVERLAPPED.cpp @@ -110,7 +110,7 @@ PYWINTYPES_EXPORT PyTypeObject PyOVERLAPPEDType = { {"Offset", T_ULONG, OFF(m_overlapped.Offset)}, // @prop integer|Offset|Specifies a file position at which to start the transfer. The // file position is a byte offset from the start of the file. The calling process sets - // this member before calling the ReadFile or WriteFile function. This member is + // this member before calling the ReadFile or WriteFile function. This member is // ignored when reading from or writing to named pipes and communications devices. {"OffsetHigh", T_ULONG, OFF(m_overlapped.OffsetHigh)}, // @prop integer|OffsetHigh|Specifies the high word of the // byte offset at which to start the transfer. @@ -123,7 +123,7 @@ PYWINTYPES_EXPORT PyTypeObject PyOVERLAPPEDType = { {"hEvent", T_OBJECT, OFF(obDummy)}, // @prop |hEvent|Identifies an event set to the signaled state when // the transfer has been completed. The calling process sets this member before // calling the , , , or  function. + // win32pipe.ConnectNamedPipe>, or function. {"Internal", T_OBJECT, OFF(obDummy)}, // @prop integer|Internal|Reserved for operating system use. (pointer-sized value) {"InternalHigh", T_OBJECT, @@ -251,7 +251,11 @@ int PyOVERLAPPED::setattro(PyObject *self, PyObject *obname, PyObject *v) /*static*/ Py_hash_t PyOVERLAPPED::hashFunc(PyObject *ob) { // Just use the address. +#if PY_VERSION_HEX >= 0x03130000 + return Py_HashPointer(ob); +#else return _Py_HashPointer(ob); +#endif } /*static*/ void PyOVERLAPPED::deallocFunc(PyObject *ob) { delete (PyOVERLAPPED *)ob; }