Skip to content

Commit 09e2148

Browse files
authored
Merge branch 'main' into fix/dict_borrow_ref
2 parents aa58de4 + 35c6779 commit 09e2148

35 files changed

Lines changed: 1550 additions & 1472 deletions

.github/workflows/reusable-docs.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,17 @@ name: Reusable Docs
33
on:
44
workflow_call:
55
workflow_dispatch:
6+
# Pushes to CPython branches seed the pip caches under the exact keys every
7+
# docs PR restores from. Without a branch-scoped copy, each PR saves a
8+
# duplicate into its own refs/pull/N/merge scope that nothing else can read.
9+
push:
10+
branches:
11+
- main
12+
- '3.*'
13+
paths:
14+
- 'Doc/pylock.toml'
15+
- 'Doc/requirements.txt'
16+
- '.github/workflows/reusable-docs.yml'
617

718
permissions:
819
contents: read

Doc/library/email.utils.rst

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ of the new API.
7070
Add *strict* optional parameter and reject malformed inputs by default.
7171

7272

73-
.. function:: formataddr(pair, charset='utf-8')
73+
.. function:: formataddr(pair, charset='utf-8', *, strict=True)
7474

7575
The inverse of :meth:`parseaddr`, this takes a 2-tuple of the form ``(realname,
7676
email_address)`` and returns the string value suitable for a :mailheader:`To` or
@@ -82,9 +82,16 @@ of the new API.
8282
characters. Can be an instance of :class:`str` or a
8383
:class:`~email.charset.Charset`. Defaults to ``utf-8``.
8484

85+
If *strict* is true (the default), raise :exc:`ValueError` for inputs that
86+
contain CR or LF, which are not allowed in an email address. Set *strict*
87+
to ``False`` to allow non-strict inputs.
88+
8589
.. versionchanged:: 3.3
8690
Added the *charset* option.
8791

92+
.. versionchanged:: next
93+
Added the *strict* parameter.
94+
8895

8996
.. function:: getaddresses(fieldvalues, *, strict=True)
9097

Doc/library/os.rst

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3037,10 +3037,16 @@ features:
30373037

30383038
.. attribute:: path
30393039

3040-
The entry's full path name: equivalent to ``os.path.join(scandir_path,
3041-
entry.name)`` where *scandir_path* is the :func:`scandir` *path*
3042-
argument. The path is only absolute if the :func:`scandir` *path*
3043-
argument was absolute. If the :func:`scandir` *path*
3040+
The entry's path name: equivalent to ``os.path.join(scandir_path,
3041+
entry.name)`` where *scandir_path* is the original :func:`scandir`
3042+
*path* argument. Apart from the filename, the path preserves the
3043+
original :func:`scandir` argument. If the :func:`scandir` *path*
3044+
argument was relative, the :attr:`path` attribute is also relative.
3045+
Changing the current working directory after creating the
3046+
:func:`scandir` iterator may cause later uses of :attr:`path` to resolve
3047+
differently. On some platforms, the constructed path may not be valid
3048+
if the original :func:`scandir` argument was usable for enumeration but
3049+
not for joining with the entry name. If the :func:`scandir` *path*
30443050
argument was a :ref:`file descriptor <path_fd>`, the :attr:`path`
30453051
attribute is the same as the :attr:`name` attribute.
30463052

Include/internal/pycore_dict.h

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ typedef struct {
9090
} PyDictUnicodeEntry;
9191

9292
extern PyDictKeysObject *_PyDict_NewKeysForClass(PyHeapTypeObject *);
93+
extern void _PyDict_RemoveKeysForClass(PyHeapTypeObject *);
9394
extern PyObject *_PyDict_FromKeys(PyObject *, PyObject *, PyObject *);
9495

9596
/* Implementations of the `|` and `|=` operators for dict, used by the
@@ -239,6 +240,17 @@ struct _dictkeysobject {
239240
see the DK_ENTRIES() / DK_UNICODE_ENTRIES() functions below */
240241
};
241242

243+
struct _instancekeysobject {
244+
PyTypeObject* dsk_owning_type;
245+
struct _dictkeysobject dsk_keys;
246+
};
247+
248+
static inline struct _instancekeysobject *_PyDictKeys_AsSharedKeys(struct _dictkeysobject *keys)
249+
{
250+
assert(keys->dk_kind == DICT_KEYS_SPLIT);
251+
return _Py_CONTAINER_OF(keys, struct _instancekeysobject, dsk_keys);
252+
}
253+
242254
/* This must be no more than 250, for the prefix size to fit in one byte. */
243255
#define SHARED_KEYS_MAX_SIZE 30
244256
#define NEXT_LOG2_SHARED_KEYS_MAX_SIZE 6

Include/internal/pycore_opcode_metadata.h

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Include/internal/pycore_typeobject.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,9 @@ extern int _PyType_AddMethod(PyTypeObject *, PyMethodDef *);
148148
extern void _PyType_SetFlagsRecursive(PyTypeObject *self, unsigned long mask,
149149
unsigned long flags);
150150

151+
// Raise PyType_Modified with the type lock already held.
152+
extern void _PyType_Modified_Unlocked(PyTypeObject *type);
153+
151154
PyAPI_FUNC(void) _PyType_SetVersion(PyTypeObject *tp, unsigned int version);
152155
PyTypeObject *_PyType_LookupByVersion(unsigned int version);
153156

0 commit comments

Comments
 (0)