Skip to content

Commit 04f66ad

Browse files
committed
Make PyAnyDict_Check() public
1 parent 07b3510 commit 04f66ad

File tree

15 files changed

+64
-64
lines changed

15 files changed

+64
-64
lines changed

Include/cpython/dictobject.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,9 @@ PyAPI_DATA(PyTypeObject) PyFrozenDict_Type;
3737
#define PyFrozenDict_Check(op) PyObject_TypeCheck((op), &PyFrozenDict_Type)
3838
#define PyFrozenDict_CheckExact(op) Py_IS_TYPE((op), &PyFrozenDict_Type)
3939

40-
#define _PyAnyDict_CheckExact(ob) \
40+
#define PyAnyDict_CheckExact(ob) \
4141
(PyDict_CheckExact(ob) || PyFrozenDict_CheckExact(ob))
42-
#define _PyAnyDict_Check(ob) \
42+
#define PyAnyDict_Check(ob) \
4343
(PyDict_Check(ob) || PyFrozenDict_Check(ob))
4444

4545
PyAPI_FUNC(PyObject *) _PyDict_GetItem_KnownHash(PyObject *mp, PyObject *key,
@@ -62,7 +62,7 @@ PyAPI_FUNC(int) PyDict_SetDefaultRef(PyObject *mp, PyObject *key, PyObject *defa
6262
/* Get the number of items of a dictionary. */
6363
static inline Py_ssize_t PyDict_GET_SIZE(PyObject *op) {
6464
PyDictObject *mp;
65-
assert(_PyAnyDict_Check(op));
65+
assert(PyAnyDict_Check(op));
6666
mp = _Py_CAST(PyDictObject*, op);
6767
#ifdef Py_GIL_DISABLED
6868
return _Py_atomic_load_ssize_relaxed(&mp->ma_used);

Modules/_collectionsmodule.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2403,7 +2403,7 @@ defdict_or(PyObject* left, PyObject* right)
24032403
self = right;
24042404
other = left;
24052405
}
2406-
if (!_PyAnyDict_Check(other)) {
2406+
if (!PyAnyDict_Check(other)) {
24072407
Py_RETURN_NOTIMPLEMENTED;
24082408
}
24092409
// Like copy(), this calls the object's class.

Modules/_pickle.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -325,7 +325,7 @@ _Pickle_InitState(PickleState *st)
325325
PyObject_GetAttrString(compat_pickle, "NAME_MAPPING");
326326
if (!st->name_mapping_2to3)
327327
goto error;
328-
if (!_PyAnyDict_CheckExact(st->name_mapping_2to3)) {
328+
if (!PyAnyDict_CheckExact(st->name_mapping_2to3)) {
329329
PyErr_Format(PyExc_RuntimeError,
330330
"_compat_pickle.NAME_MAPPING should be a dict, not %.200s",
331331
Py_TYPE(st->name_mapping_2to3)->tp_name);
@@ -335,7 +335,7 @@ _Pickle_InitState(PickleState *st)
335335
PyObject_GetAttrString(compat_pickle, "IMPORT_MAPPING");
336336
if (!st->import_mapping_2to3)
337337
goto error;
338-
if (!_PyAnyDict_CheckExact(st->import_mapping_2to3)) {
338+
if (!PyAnyDict_CheckExact(st->import_mapping_2to3)) {
339339
PyErr_Format(PyExc_RuntimeError,
340340
"_compat_pickle.IMPORT_MAPPING should be a dict, "
341341
"not %.200s", Py_TYPE(st->import_mapping_2to3)->tp_name);

Objects/abstract.c

Lines changed: 5 additions & 5 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 (_PyAnyDict_CheckExact(obj)) {
211+
if (PyAnyDict_CheckExact(obj)) {
212212
return PyDict_GetItemRef(obj, key, result);
213213
}
214214

@@ -1672,7 +1672,7 @@ PyNumber_ToBase(PyObject *n, int base)
16721672
int
16731673
PySequence_Check(PyObject *s)
16741674
{
1675-
if (_PyAnyDict_Check(s))
1675+
if (PyAnyDict_Check(s))
16761676
return 0;
16771677
return Py_TYPE(s)->tp_as_sequence &&
16781678
Py_TYPE(s)->tp_as_sequence->sq_item != NULL;
@@ -2454,7 +2454,7 @@ PyMapping_Keys(PyObject *o)
24542454
if (o == NULL) {
24552455
return null_error();
24562456
}
2457-
if (_PyAnyDict_CheckExact(o)) {
2457+
if (PyAnyDict_CheckExact(o)) {
24582458
return PyDict_Keys(o);
24592459
}
24602460
return method_output_as_list(o, &_Py_ID(keys));
@@ -2466,7 +2466,7 @@ PyMapping_Items(PyObject *o)
24662466
if (o == NULL) {
24672467
return null_error();
24682468
}
2469-
if (_PyAnyDict_CheckExact(o)) {
2469+
if (PyAnyDict_CheckExact(o)) {
24702470
return PyDict_Items(o);
24712471
}
24722472
return method_output_as_list(o, &_Py_ID(items));
@@ -2478,7 +2478,7 @@ PyMapping_Values(PyObject *o)
24782478
if (o == NULL) {
24792479
return null_error();
24802480
}
2481-
if (_PyAnyDict_CheckExact(o)) {
2481+
if (PyAnyDict_CheckExact(o)) {
24822482
return PyDict_Values(o);
24832483
}
24842484
return method_output_as_list(o, &_Py_ID(values));

Objects/descrobject.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1089,7 +1089,7 @@ static int
10891089
mappingproxy_contains(PyObject *self, PyObject *key)
10901090
{
10911091
mappingproxyobject *pp = (mappingproxyobject *)self;
1092-
if (_PyAnyDict_CheckExact(pp->mapping))
1092+
if (PyAnyDict_CheckExact(pp->mapping))
10931093
return PyDict_Contains(pp->mapping, key);
10941094
else
10951095
return PySequence_Contains(pp->mapping, key);

0 commit comments

Comments
 (0)