comparison configmix/_speedups.c @ 618:8dc514bd3d5e

Use py_object_is when comparing to MISSING
author Franz Glasner <f.glasner@feldmann-mg.com>
date Wed, 12 Jan 2022 13:44:12 +0100
parents 7e480a32d9d5
children 8d2d5d54ff3c
comparison
equal deleted inserted replaced
617:98c3669d4df1 618:8dc514bd3d5e
757 return Py_NewRef(s); 757 return Py_NewRef(s);
758 } 758 }
759 759
760 res = PyDict_GetItem(cache, s); /* borrowed */ 760 res = PyDict_GetItem(cache, s); /* borrowed */
761 if (res != NULL) { 761 if (res != NULL) {
762 if (res == sstate->MISSING) { 762 if (py_object_is(res, sstate->MISSING)) {
763 return PyErr_Format( 763 return PyErr_Format(
764 PyExc_KeyError, 764 PyExc_KeyError,
765 "Cannot interpolate variables in string %R (cached)", 765 "Cannot interpolate variables in string %R (cached)",
766 s); 766 s);
767 } 767 }
1000 } 1000 }
1001 1001
1002 if (cache != NULL) { 1002 if (cache != NULL) {
1003 result = PyDict_GetItem(cache, s); /* borrowed */ 1003 result = PyDict_GetItem(cache, s); /* borrowed */
1004 if (result != NULL) { 1004 if (result != NULL) {
1005 if (result == sstate->MISSING) { 1005 if (py_object_is(result, sstate->MISSING)) {
1006 return PyErr_Format( 1006 return PyErr_Format(
1007 PyExc_KeyError, 1007 PyExc_KeyError,
1008 "Cannot interpolate variables in string %R (cached)", 1008 "Cannot interpolate variables in string %R (cached)",
1009 s); 1009 s);
1010 } 1010 }