◐ Shell
reader mode source ↗
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
File filter
Conversations
Jump to
Diff view
Apply and reload
Show whitespace
Diff view
Apply and reload
57 changes: 54 additions & 3 deletions Doc/c-api/dict.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

.. _dictobjects:

Dictionary Objects
------------------

.. index:: pair: object; dictionary
Expand Up @@ -444,7 +444,7 @@ Dictionary Objects
.. versionadded:: 3.12


Dictionary View Objects
^^^^^^^^^^^^^^^^^^^^^^^

.. c:function:: int PyDictViewSet_Check(PyObject *op)
Expand Down Expand Up @@ -490,7 +490,58 @@ Dictionary View Objects
always succeeds.


Ordered Dictionaries
^^^^^^^^^^^^^^^^^^^^

Python's C API provides interface for :class:`collections.OrderedDict` from C.
Expand Down
27 changes: 27 additions & 0 deletions Doc/whatsnew/3.15.rst
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@ Summary -- Release highlights

* :pep:`810`: :ref:`Explicit lazy imports for faster startup times
<whatsnew315-pep810>`
* :pep:`799`: :ref:`A dedicated profiling package for organizing Python
profiling tools <whatsnew315-profiling-package>`
* :pep:`799`: :ref:`Tachyon: High frequency statistical sampling profiler
Expand Down Expand Up @@ -180,6 +182,21 @@ raise :exc:`SyntaxError`).

(Contributed by Pablo Galindo Salgado and Dino Viehland in :gh:`142349`.)

.. _whatsnew315-profiling-package:

:pep:`799`: A dedicated profiling package
Expand Down Expand Up @@ -1512,6 +1529,16 @@ C API changes
New features
------------

* Add :c:func:`PySys_GetAttr`, :c:func:`PySys_GetAttrString`,
:c:func:`PySys_GetOptionalAttr`, and :c:func:`PySys_GetOptionalAttrString`
functions as replacements for :c:func:`PySys_GetObject`.
Expand Down
15 changes: 14 additions & 1 deletion Include/cpython/dictobject.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,16 @@ typedef struct {
PyDictValues *ma_values;
} PyDictObject;

PyAPI_FUNC(PyObject *) _PyDict_GetItem_KnownHash(PyObject *mp, PyObject *key,
Py_hash_t hash);
// PyDict_GetItemStringRef() can be used instead
Expand All @@ -42,7 +52,7 @@ PyAPI_FUNC(PyObject *) PyDict_SetDefault(
/* Get the number of items of a dictionary. */
static inline Py_ssize_t PyDict_GET_SIZE(PyObject *op) {
PyDictObject *mp;
assert(PyDict_Check(op));
mp = _Py_CAST(PyDictObject*, op);
#ifdef Py_GIL_DISABLED
return _Py_atomic_load_ssize_relaxed(&mp->ma_used);
Expand Down Expand Up @@ -93,3 +103,6 @@ PyAPI_FUNC(int) PyDict_ClearWatcher(int watcher_id);
// Mark given dictionary as "watched" (callback will be called if it is modified)
PyAPI_FUNC(int) PyDict_Watch(int watcher_id, PyObject* dict);
PyAPI_FUNC(int) PyDict_Unwatch(int watcher_id, PyObject* dict);
1 change: 1 addition & 0 deletions Include/internal/pycore_typeobject.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ extern "C" {
#define _Py_TYPE_VERSION_BYTEARRAY 9
#define _Py_TYPE_VERSION_BYTES 10
#define _Py_TYPE_VERSION_COMPLEX 11

#define _Py_TYPE_VERSION_NEXT 16

1 change: 1 addition & 0 deletions Lib/_collections_abc.py
Original file line number Diff line number Diff line change
Expand Up @@ -823,6 +823,7 @@ def __eq__(self, other):

__reversed__ = None

Mapping.register(mappingproxy)
Mapping.register(framelocalsproxy)

Expand Down
Loading
Loading
Toggle all file notes Toggle all file annotations