Skip to content

Commit cf0d164

Browse files
committed
Use PyMapping_HasKeyWithError on 3.13+
1 parent ab87b90 commit cf0d164

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

atom/src/catom.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -451,7 +451,13 @@ CAtom_setstate( CAtom* self, PyObject* state )
451451
return cppy::type_error("__setstate__ requires a mapping");
452452

453453
// If the -f key is present freeze the object
454-
bool frozen = PyMapping_HasKey(state, atom_flags);
454+
#if PY_VERSION_HEX >= 0x030D0000
455+
int frozen = PyMapping_HasKeyWithError( state, atom_flags );
456+
if ( frozen == -1 )
457+
return 0;
458+
#else
459+
int frozen = PyMapping_HasKey( state, atom_flags );
460+
#endif
455461
if ( frozen )
456462
{
457463
if ( PyMapping_DelItem(state, atom_flags) == -1 )

0 commit comments

Comments
 (0)