Skip to content

[C API] Add PyObject_GetDict() function #139852

@vstinner

Description

@vstinner

Feature or enhancement

Feature or enhancement

There is a private _PyObject_GetDictPtr() function which is used by 30 projects of the PyPI top 15,000 projects:

  • accesscontrol (7.2)
  • acquisition (6.1)
  • backports_datetime_fromisoformat (2.0.3)
  • casadi (3.7.2)
  • catboost (1.2.8)
  • cvxpy (1.7.2)
  • cvxpy_base (1.7.2)
  • cython (3.1.4)
  • extensionclass (6.0)
  • frozendict (2.4.6)
  • gamsapi (51.1.0)
  • gdal (3.11.4)
  • gevent (25.9.1)
  • guppy3 (3.1.5)
  • htseq (2.0.9)
  • hunter (3.9.0)
  • ihm (2.7)
  • jpype1 (1.6.0)
  • m2crypto (0.45.1)
  • mecab-ko (1.0.1)
  • mecab_python3 (1.0.10)
  • mupdf (1.21.1.20230112.1504)
  • passagemath_standard_no_symbolics (10.6.26)
  • persistence (5.1)
  • persistent (6.1.1)
  • pybind11 (3.0.1)
  • pygdal (3.6.4.11)
  • pygraphviz (1.14)
  • python_crfsuite (0.9.11)
  • sentencepiece (0.2.1)

I propose to make the function public with a different API to no longer ignore errors silently.

UPDATE: I now propose adding PyObject_GetDict() (PyObject **dict parameter), instead of PyObject_GetDictPtr() (PyObject ***dict_ptr parameter).

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions