Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
14 commits
Select commit Hold shift + click to select a range
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: 2 additions & 2 deletions Doc/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,9 @@ htmlhelp: build
"build/htmlhelp/pydoc.hhp project file."

.PHONY: latex
latex: _ensure-sphinxcontrib-svg2pdfconverter
latex: BUILDER = latex
latex: build
latex: _ensure-sphinxcontrib-svg2pdfconverter
$(MAKE) build BUILDER=$(BUILDER)
@echo "Build finished; the LaTeX files are in build/latex."
@echo "Run \`make all-pdf' or \`make all-ps' in that directory to" \
"run these through (pdf)latex."
Expand Down
23 changes: 18 additions & 5 deletions Doc/library/dataclasses.rst
Original file line number Diff line number Diff line change
Expand Up @@ -100,12 +100,25 @@ Module contents
ignored.

- *eq*: If true (the default), an :meth:`~object.__eq__` method will be
generated. This method compares the class as if it were a tuple
of its fields, in order. Both instances in the comparison must
be of the identical type.
generated.

If the class already defines :meth:`!__eq__`, this parameter is
ignored.
This method compares the class by comparing each field in order. Both
instances in the comparison must be of the identical type.

If the class already defines :meth:`!__eq__`, this parameter is ignored.

.. versionchanged:: 3.13
The generated ``__eq__`` method now compares each field individually
(for example, ``self.a == other.a and self.b == other.b``), rather than
comparing tuples of fields as in previous versions.

This change makes the comparison faster but it may alter results in cases
where attributes compare equal by identity but not by value (such as
``float('nan')``).

In Python 3.12 and earlier, the comparison was performed by creating
tuples of the fields and comparing them (for example,
``(self.a, self.b) == (other.a, other.b)``).

- *order*: If true (the default is ``False``), :meth:`~object.__lt__`,
:meth:`~object.__le__`, :meth:`~object.__gt__`, and :meth:`~object.__ge__` methods will be
Expand Down
2 changes: 1 addition & 1 deletion Doc/library/unittest.mock.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2223,7 +2223,7 @@ return something else::
>>> mock == 3
True

The return value of :meth:`MagicMock.__iter__` can be any iterable object and isn't
The return value of :meth:`!__iter__` can be any iterable object and isn't
required to be an iterator:

>>> mock = MagicMock()
Expand Down
1 change: 0 additions & 1 deletion Doc/tools/.nitignore
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ Doc/library/test.rst
Doc/library/tkinter.rst
Doc/library/tkinter.scrolledtext.rst
Doc/library/tkinter.ttk.rst
Doc/library/unittest.mock.rst
Doc/library/urllib.parse.rst
Doc/library/urllib.request.rst
Doc/library/wsgiref.rst
Expand Down
13 changes: 13 additions & 0 deletions Include/internal/pycore_dict.h
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,8 @@ typedef struct {
} PyDictUnicodeEntry;

extern PyDictKeysObject *_PyDict_NewKeysForClass(PyHeapTypeObject *);
extern void _PyDict_RemoveKeysForClass(PyHeapTypeObject *);
extern void _PyDict_SplitKeysInvalidated(PyDictKeysObject* keys);
extern PyObject *_PyDict_FromKeys(PyObject *, PyObject *, PyObject *);

/* Implementations of the `|` and `|=` operators for dict, used by the
Expand Down Expand Up @@ -239,6 +241,17 @@ struct _dictkeysobject {
see the DK_ENTRIES() / DK_UNICODE_ENTRIES() functions below */
};

struct _instancekeysobject {
PyTypeObject* dsk_owning_type;
struct _dictkeysobject dsk_keys;
};

static inline struct _instancekeysobject *_PyDictKeys_AsSharedKeys(struct _dictkeysobject *keys)
{
assert(keys->dk_kind == DICT_KEYS_SPLIT);
return _Py_CONTAINER_OF(keys, struct _instancekeysobject, dsk_keys);
}

/* This must be no more than 250, for the prefix size to fit in one byte. */
#define SHARED_KEYS_MAX_SIZE 30
#define NEXT_LOG2_SHARED_KEYS_MAX_SIZE 6
Expand Down
4 changes: 2 additions & 2 deletions Include/internal/pycore_opcode_metadata.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading