Skip to content

Commit 161ed33

Browse files
authored
Update mapping methods in abstract.c to accept frozendict as well as dict
Specifically `PyMapping_GetOptionalItem`, `PyMapping_Keys`, `PyMapping_Values` and `PyMapping_Items`.
1 parent f4bda4d commit 161ed33

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

Objects/abstract.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ PyObject_GetItem(PyObject *o, PyObject *key)
208208
int
209209
PyMapping_GetOptionalItem(PyObject *obj, PyObject *key, PyObject **result)
210210
{
211-
if (PyDict_CheckExact(obj)) {
211+
if (PyAnyDict_CheckExact(obj)) {
212212
return PyDict_GetItemRef(obj, key, result);
213213
}
214214

@@ -2462,7 +2462,7 @@ PyMapping_Keys(PyObject *o)
24622462
if (o == NULL) {
24632463
return null_error();
24642464
}
2465-
if (PyDict_CheckExact(o)) {
2465+
if (PyAnyDict_CheckExact(o)) {
24662466
return PyDict_Keys(o);
24672467
}
24682468
return method_output_as_list(o, &_Py_ID(keys));
@@ -2474,7 +2474,7 @@ PyMapping_Items(PyObject *o)
24742474
if (o == NULL) {
24752475
return null_error();
24762476
}
2477-
if (PyDict_CheckExact(o)) {
2477+
if (PyAnyDict_CheckExact(o)) {
24782478
return PyDict_Items(o);
24792479
}
24802480
return method_output_as_list(o, &_Py_ID(items));
@@ -2486,7 +2486,7 @@ PyMapping_Values(PyObject *o)
24862486
if (o == NULL) {
24872487
return null_error();
24882488
}
2489-
if (PyDict_CheckExact(o)) {
2489+
if (PyAnyDict_CheckExact(o)) {
24902490
return PyDict_Values(o);
24912491
}
24922492
return method_output_as_list(o, &_Py_ID(values));

0 commit comments

Comments
 (0)