Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions .github/actionlint.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
self-hosted-runner:
# Pending https://github.com/rhysd/actionlint/pull/615
labels: ["windows-2025-vs2026"]

config-variables: null

paths:
Expand Down
2 changes: 1 addition & 1 deletion .github/zizmor.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Configuration for the zizmor static analysis tool, run via prek in CI
# https://woodruffw.github.io/zizmor/configuration/
# https://docs.zizmor.sh/configuration/
rules:
dangerous-triggers:
ignore:
Expand Down
18 changes: 9 additions & 9 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
repos:
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.15.0
rev: a27a2e47c7751b639d2b5badf0ef6ff11fee893f # frozen: v0.15.4
hooks:
- id: ruff-check
name: Run Ruff (lint) on Apple/
Expand Down Expand Up @@ -60,20 +60,20 @@ repos:
files: ^Tools/wasm/

- repo: https://github.com/psf/black-pre-commit-mirror
rev: 26.1.0
rev: ea488cebbfd88a5f50b8bd95d5c829d0bb76feb8 # frozen: 26.1.0
hooks:
- id: black
name: Run Black on Tools/jit/
files: ^Tools/jit/

- repo: https://github.com/Lucas-C/pre-commit-hooks
rev: v1.5.6
rev: ad1b27d73581aa16cca06fc4a0761fc563ffe8e8 # frozen: v1.5.6
hooks:
- id: remove-tabs
types: [python]

- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v6.0.0
rev: 3e8a8703264a2f4a69428a0aa4dcb512790b2c8c # frozen: v6.0.0
hooks:
- id: check-case-conflict
- id: check-merge-conflict
Expand All @@ -91,24 +91,24 @@ repos:
files: '^\.github/CODEOWNERS|\.(gram)$'

- repo: https://github.com/python-jsonschema/check-jsonschema
rev: 0.36.1
rev: 9f48a48aa91a6040d749ad68ec70907d907a5a7f # frozen: 0.37.0
hooks:
- id: check-dependabot
- id: check-github-workflows
- id: check-readthedocs

- repo: https://github.com/rhysd/actionlint
rev: v1.7.10
rev: 393031adb9afb225ee52ae2ccd7a5af5525e03e8 # frozen: v1.7.11
hooks:
- id: actionlint

- repo: https://github.com/woodruffw/zizmor-pre-commit
rev: v1.22.0
- repo: https://github.com/zizmorcore/zizmor-pre-commit
rev: b546b77c44c466a54a42af5499dcc0dcc1a3193f # frozen: v1.22.0
hooks:
- id: zizmor

- repo: https://github.com/sphinx-contrib/sphinx-lint
rev: v1.0.2
rev: c883505f64b59c3c5c9375191e4ad9f98e727ccd # frozen: v1.0.2
hooks:
- id: sphinx-lint
args: [--enable=default-role]
Expand Down
4 changes: 0 additions & 4 deletions Doc/c-api/dict.rst
Original file line number Diff line number Diff line change
Expand Up @@ -82,10 +82,6 @@ Dictionary objects

Return a new dictionary that contains the same key-value pairs as *p*.

.. versionchanged:: next
If *p* is a subclass of :class:`frozendict`, the result will be a
:class:`frozendict` instance instead of a :class:`dict` instance.

.. c:function:: int PyDict_SetItem(PyObject *p, PyObject *key, PyObject *val)

Insert *val* into the dictionary *p* with a key of *key*. *key* must be
Expand Down
3 changes: 3 additions & 0 deletions Doc/deprecations/pending-removal-in-3.18.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
Pending removal in Python 3.18
------------------------------

* No longer accept a boolean value when a file descriptor is expected.
(Contributed by Serhiy Storchaka in :gh:`82626`.)

* :mod:`decimal`:

* The non-standard and undocumented :class:`~decimal.Decimal` format
Expand Down
14 changes: 13 additions & 1 deletion Doc/library/functions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -594,7 +594,7 @@ are always available. They are listed here in alphabetical order.

:param globals:
The global namespace (default: ``None``).
:type globals: :class:`dict` | ``None``
:type globals: :class:`dict` | :class:`frozendict` | ``None``

:param locals:
The local namespace (default: ``None``).
Expand Down Expand Up @@ -660,6 +660,10 @@ are always available. They are listed here in alphabetical order.
The semantics of the default *locals* namespace have been adjusted as
described for the :func:`locals` builtin.

.. versionchanged:: next

*globals* can now be a :class:`frozendict`.

.. index:: pair: built-in function; exec

.. function:: exec(source, /, globals=None, locals=None, *, closure=None)
Expand Down Expand Up @@ -737,6 +741,10 @@ are always available. They are listed here in alphabetical order.
The semantics of the default *locals* namespace have been adjusted as
described for the :func:`locals` builtin.

.. versionchanged:: next

*globals* can now be a :class:`frozendict`.


.. function:: filter(function, iterable, /)

Expand Down Expand Up @@ -2091,6 +2099,10 @@ are always available. They are listed here in alphabetical order.
Subclasses of :class:`!type` which don't override ``type.__new__`` may no
longer use the one-argument form to get the type of an object.

.. versionchanged:: next

*dict* can now be a :class:`frozendict`.

.. function:: vars()
vars(object, /)

Expand Down
4 changes: 4 additions & 0 deletions Doc/library/stdtypes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2385,6 +2385,10 @@ expression support in the :mod:`re` module).
the same position in *to*. If there is a third argument, it must be a string,
whose characters will be mapped to ``None`` in the result.

.. versionchanged:: next

*dict* can now be a :class:`frozendict`.


.. method:: str.partition(sep, /)

Expand Down
6 changes: 6 additions & 0 deletions Doc/library/xml.etree.elementtree.rst
Original file line number Diff line number Diff line change
Expand Up @@ -702,6 +702,9 @@ Functions
attributes. *extra* contains additional attributes, given as keyword
arguments. Returns an element instance.

.. versionchanged:: next
*attrib* can now be a :class:`frozendict`.


.. function:: tostring(element, encoding="us-ascii", method="xml", *, \
xml_declaration=None, default_namespace=None, \
Expand Down Expand Up @@ -887,6 +890,9 @@ Element Objects
an optional dictionary, containing element attributes. *extra* contains
additional attributes, given as keyword arguments.

.. versionchanged:: next
*attrib* can now be a :class:`frozendict`.


.. attribute:: tag

Expand Down
7 changes: 7 additions & 0 deletions Doc/whatsnew/3.15.rst
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,13 @@ For example::
>>> a == b
True

The following standard library modules have been updated to accept
:class:`!frozendict`: :mod:`copy`, :mod:`decimal`, :mod:`json`, :mod:`marshal`,
:mod:`pickle`, :mod:`pprint` and :mod:`xml.etree.ElementTree`.

:func:`eval` and :func:`exec` accept :class:`!frozendict` for *globals*, and
:func:`type` and :meth:`str.maketrans` accept :class:`!frozendict` for *dict*.

.. seealso:: :pep:`814` for the full specification and rationale.

(Contributed by Victor Stinner and Donghee Na in :gh:`141510`.)
Expand Down
7 changes: 4 additions & 3 deletions Include/internal/pycore_dict.h
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,8 @@ extern void _PyDict_Clear_LockHeld(PyObject *op);
PyAPI_FUNC(void) _PyDict_EnsureSharedOnRead(PyDictObject *mp);
#endif

extern PyObject* _PyDict_CopyAsDict(PyObject *op);
// Export for '_elementtree' shared extension
PyAPI_FUNC(PyObject*) _PyDict_CopyAsDict(PyObject *op);

#define DKIX_EMPTY (-1)
#define DKIX_DUMMY (-2) /* Used internally */
Expand Down Expand Up @@ -372,15 +373,15 @@ _PyDict_UniqueId(PyDictObject *mp)
static inline void
_Py_INCREF_DICT(PyObject *op)
{
assert(PyDict_Check(op));
assert(PyAnyDict_Check(op));
Py_ssize_t id = _PyDict_UniqueId((PyDictObject *)op);
_Py_THREAD_INCREF_OBJECT(op, id);
}

static inline void
_Py_DECREF_DICT(PyObject *op)
{
assert(PyDict_Check(op));
assert(PyAnyDict_Check(op));
Py_ssize_t id = _PyDict_UniqueId((PyDictObject *)op);
_Py_THREAD_DECREF_OBJECT(op, id);
}
Expand Down
Loading
Loading