The Py_UNUSED() is not implemented for the Windows MSVC compiler.
Example with this function included by Python.h: see #107239 (comment)
static inline unsigned int PyUnicode_IS_READY(PyObject* Py_UNUSED(op)) { return 1; }
Without my change, building a C program with cl /W4 which just includes Python.h emits the warning:
Include\cpython/unicodeobject.h(199): warning C4100: '_unused_op': unreferenced formal parameter
With my change, no warnings are emitted!
pythongh-107249: Implement Py_UNUSED() for MSVC
gh-107249: Implement Py_UNUSED() for MSVC (#107250)
pythongh-107249: Implement Py_UNUSED() for MSVC (python#107250)
Suppress unreferenced '_unused_op' warning
pythongh-107249: Implement Py_UNUSED() for MSVC (pythonGH-107250)
[3.12] gh-107249: Implement Py_UNUSED() for MSVC (GH-107250) (#127907)
Activity
pythongh-107249: Implement Py_UNUSED() for MSVC
gh-107249: Implement Py_UNUSED() for MSVC (#107250)
pythongh-107249: Implement Py_UNUSED() for MSVC (python#107250)
Suppress unreferenced '_unused_op' warning
pythongh-107249: Implement Py_UNUSED() for MSVC (pythonGH-107250)
[3.12] gh-107249: Implement Py_UNUSED() for MSVC (GH-107250) (#127907)