From cf0d164092bfa61c386fba9f439f3ad94fadd88a Mon Sep 17 00:00:00 2001 From: frmdstryr Date: Tue, 21 Jan 2025 15:01:45 -0500 Subject: [PATCH] Use PyMapping_HasKeyWithError on 3.13+ --- atom/src/catom.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/atom/src/catom.cpp b/atom/src/catom.cpp index 5b9f3053..ab494b15 100644 --- a/atom/src/catom.cpp +++ b/atom/src/catom.cpp @@ -451,7 +451,13 @@ CAtom_setstate( CAtom* self, PyObject* state ) return cppy::type_error("__setstate__ requires a mapping"); // If the -f key is present freeze the object - bool frozen = PyMapping_HasKey(state, atom_flags); +#if PY_VERSION_HEX >= 0x030D0000 + int frozen = PyMapping_HasKeyWithError( state, atom_flags ); + if ( frozen == -1 ) + return 0; +#else + int frozen = PyMapping_HasKey( state, atom_flags ); +#endif if ( frozen ) { if ( PyMapping_DelItem(state, atom_flags) == -1 )