Skip to content

Commit 1438c2a

Browse files
authored
bpo-41845: Move PyObject_GenericGetDict() back into the limited API (GH22646)
It was moved out of the limited API in 7d95e40. This change re-enables it from 3.10, to avoid generating invalid extension modules for earlier versions.
1 parent f85658a commit 1438c2a

File tree

4 files changed

+6
-1
lines changed

4 files changed

+6
-1
lines changed

Include/cpython/dictobject.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ PyAPI_FUNC(int) _PyDict_DelItem_KnownHash(PyObject *mp, PyObject *key,
4141
PyAPI_FUNC(int) _PyDict_DelItemIf(PyObject *mp, PyObject *key,
4242
int (*predicate)(PyObject *value));
4343
PyDictKeysObject *_PyDict_NewKeysForClass(void);
44-
PyAPI_FUNC(PyObject *) PyObject_GenericGetDict(PyObject *, void *);
4544
PyAPI_FUNC(int) _PyDict_Next(
4645
PyObject *mp, Py_ssize_t *pos, PyObject **key, PyObject **value, Py_hash_t *hash);
4746

Include/dictobject.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,9 @@ PyAPI_FUNC(int) PyDict_MergeFromSeq2(PyObject *d,
5757
PyAPI_FUNC(PyObject *) PyDict_GetItemString(PyObject *dp, const char *key);
5858
PyAPI_FUNC(int) PyDict_SetItemString(PyObject *dp, const char *key, PyObject *item);
5959
PyAPI_FUNC(int) PyDict_DelItemString(PyObject *dp, const char *key);
60+
#if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x030A0000
61+
PyAPI_FUNC(PyObject *) PyObject_GenericGetDict(PyObject *, void *);
62+
#endif
6063

6164
/* Dictionary (keys, values, items) views */
6265

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
:c:func:`PyObject_GenericGetDict` is available again in the limited API
2+
when targeting 3.10 or later.

PC/python3dll.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -414,6 +414,7 @@ EXPORT_FUNC(PyObject_GC_Track)
414414
EXPORT_FUNC(PyObject_GC_UnTrack)
415415
EXPORT_FUNC(PyObject_GenericGetAttr)
416416
EXPORT_FUNC(PyObject_GenericSetAttr)
417+
EXPORT_FUNC(PyObject_GenericGetDict)
417418
EXPORT_FUNC(PyObject_GenericSetDict)
418419
EXPORT_FUNC(PyObject_GetAttr)
419420
EXPORT_FUNC(PyObject_GetAttrString)

0 commit comments

Comments
 (0)