Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add cast on Python 3.5
  • Loading branch information
vstinner committed Nov 14, 2023
commit 87cf8e623a33db7c9813bf80a724135c8c071060
5 changes: 4 additions & 1 deletion pythoncapi_compat.h
Original file line number Diff line number Diff line change
Expand Up @@ -1043,10 +1043,13 @@ PyDict_Pop(PyObject *dict, PyObject *key, PyObject **result)
return -1;
}

// bpo-16991 added _PyDict_Pop() to Python 3.5.0b2
#if defined(PYPY_VERSION) || PY_VERSION_HEX < 0x030500b2
value = PyObject_CallMethod(dict, "pop", "O", key);
// Python 3.6.0b3 changed _PyDict_Pop() first argument type to PyObject*
#elif PY_VERSION_HEX < 0x030600b3
value = _PyDict_Pop(_Py_CAST(PyDictObject*, dict), key, NULL);
#else
// bpo-16991 added _PyDict_Pop() to Python 3.5.0b2
value = _PyDict_Pop(dict, key, NULL);
#endif
if (value == NULL) {
Expand Down