Skip to content

Commit 67b7340

Browse files
authored
Merge branch 'main' into issue-99631-2
2 parents 3cbabe9 + 85f727c commit 67b7340

39 files changed

+1037
-367
lines changed

Doc/library/pprint.rst

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,8 @@ such as files, sockets or classes are included, as well as many other
1919
objects which are not representable as Python literals.
2020

2121
The formatted representation keeps objects on a single line if it can, and
22-
breaks them onto multiple lines if they don't fit within the allowed width.
23-
Construct :class:`PrettyPrinter` objects explicitly if you need to adjust the
24-
width constraint.
22+
breaks them onto multiple lines if they don't fit within the allowed width,
23+
adjustable by the *width* parameter defaulting to 80 characters.
2524

2625
Dictionaries are sorted by key before the display is computed.
2726

Doc/library/shutil.rst

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -421,7 +421,8 @@ Directory and files operations
421421

422422
.. availability:: Unix, Windows.
423423

424-
.. function:: chown(path, user=None, group=None)
424+
.. function:: chown(path, user=None, group=None, *, dir_fd=None, \
425+
follow_symlinks=True)
425426

426427
Change owner *user* and/or *group* of the given *path*.
427428

@@ -436,6 +437,9 @@ Directory and files operations
436437

437438
.. versionadded:: 3.3
438439

440+
.. versionchanged:: 3.13
441+
Added *dir_fd* and *follow_symlinks* parameters.
442+
439443

440444
.. function:: which(cmd, mode=os.F_OK | os.X_OK, path=None)
441445

Doc/library/typing.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1972,7 +1972,7 @@ without the dedicated syntax, as documented below.
19721972
* :ref:`annotating-callables`
19731973

19741974
.. data:: ParamSpecArgs
1975-
.. data:: ParamSpecKwargs
1975+
ParamSpecKwargs
19761976

19771977
Arguments and keyword arguments attributes of a :class:`ParamSpec`. The
19781978
``P.args`` attribute of a ``ParamSpec`` is an instance of ``ParamSpecArgs``,

Doc/whatsnew/3.13.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,9 @@ Other Language Changes
241241
ones if configured to do so.
242242
(Contributed by Pedro Sousa Lacerda in :gh:`66449`.)
243243

244+
* :ref:`annotation scope <annotation-scopes>` within class scopes can now
245+
contain lambdas. (Contributed by Jelle Zijlstra in :gh:`109118`.)
246+
244247

245248
New Modules
246249
===========
@@ -594,6 +597,10 @@ os.path
594597
exactly one (back)slash to be absolute.
595598
(Contributed by Barney Gale and Jon Foster in :gh:`44626`.)
596599

600+
* Add support of *dir_fd* and *follow_symlinks* keyword arguments in
601+
:func:`shutil.chown`.
602+
(Contributed by Berker Peksag and Tahia K in :gh:`62308`)
603+
597604
pathlib
598605
-------
599606

Include/cpython/object.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -493,6 +493,7 @@ do { \
493493
PyAPI_FUNC(void *) PyObject_GetItemData(PyObject *obj);
494494

495495
PyAPI_FUNC(int) PyObject_VisitManagedDict(PyObject *obj, visitproc visit, void *arg);
496+
PyAPI_FUNC(void) _PyObject_SetManagedDict(PyObject *obj, PyObject *new_dict);
496497
PyAPI_FUNC(void) PyObject_ClearManagedDict(PyObject *obj);
497498

498499
#define TYPE_MAX_WATCHERS 8

Include/incl.tar

1.78 MB
Binary file not shown.

Include/internal/pycore_code.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -288,11 +288,6 @@ extern void _Py_Specialize_Send(PyObject *receiver, _Py_CODEUNIT *instr);
288288
extern void _Py_Specialize_ToBool(PyObject *value, _Py_CODEUNIT *instr);
289289
extern void _Py_Specialize_ContainsOp(PyObject *value, _Py_CODEUNIT *instr);
290290

291-
/* Finalizer function for static codeobjects used in deepfreeze.py */
292-
extern void _PyStaticCode_Fini(PyCodeObject *co);
293-
/* Function to intern strings of codeobjects and quicken the bytecode */
294-
extern int _PyStaticCode_Init(PyCodeObject *co);
295-
296291
#ifdef Py_STATS
297292

298293
#include "pycore_bitutils.h" // _Py_bit_length

Include/internal/pycore_dict.h

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
#ifndef Py_INTERNAL_DICT_H
32
#define Py_INTERNAL_DICT_H
43
#ifdef __cplusplus
@@ -9,9 +8,10 @@ extern "C" {
98
# error "this header requires Py_BUILD_CORE define"
109
#endif
1110

12-
#include "pycore_freelist.h" // _PyFreeListState
13-
#include "pycore_identifier.h" // _Py_Identifier
14-
#include "pycore_object.h" // PyManagedDictPointer
11+
#include "pycore_freelist.h" // _PyFreeListState
12+
#include "pycore_identifier.h" // _Py_Identifier
13+
#include "pycore_object.h" // PyManagedDictPointer
14+
#include "pycore_pyatomic_ft_wrappers.h" // FT_ATOMIC_LOAD_SSIZE_ACQUIRE
1515

1616
// Unsafe flavor of PyDict_GetItemWithError(): no error checking
1717
extern PyObject* _PyDict_GetItemWithError(PyObject *dp, PyObject *key);
@@ -249,7 +249,7 @@ _PyDict_NotifyEvent(PyInterpreterState *interp,
249249
return DICT_NEXT_VERSION(interp) | (mp->ma_version_tag & DICT_WATCHER_AND_MODIFICATION_MASK);
250250
}
251251

252-
extern PyDictObject *_PyObject_MakeDictFromInstanceAttributes(PyObject *obj);
252+
extern PyDictObject *_PyObject_MaterializeManagedDict(PyObject *obj);
253253

254254
PyAPI_FUNC(PyObject *)_PyDict_FromItems(
255255
PyObject *const *keys, Py_ssize_t keys_offset,
@@ -277,19 +277,16 @@ _PyDictValues_AddToInsertionOrder(PyDictValues *values, Py_ssize_t ix)
277277
static inline size_t
278278
shared_keys_usable_size(PyDictKeysObject *keys)
279279
{
280-
#ifdef Py_GIL_DISABLED
281280
// dk_usable will decrease for each instance that is created and each
282281
// value that is added. dk_nentries will increase for each value that
283282
// is added. We want to always return the right value or larger.
284283
// We therefore increase dk_nentries first and we decrease dk_usable
285284
// second, and conversely here we read dk_usable first and dk_entries
286285
// second (to avoid the case where we read entries before the increment
287286
// and read usable after the decrement)
288-
return (size_t)(_Py_atomic_load_ssize_acquire(&keys->dk_usable) +
289-
_Py_atomic_load_ssize_acquire(&keys->dk_nentries));
290-
#else
291-
return (size_t)keys->dk_nentries + (size_t)keys->dk_usable;
292-
#endif
287+
Py_ssize_t dk_usable = FT_ATOMIC_LOAD_SSIZE_ACQUIRE(keys->dk_usable);
288+
Py_ssize_t dk_nentries = FT_ATOMIC_LOAD_SSIZE_ACQUIRE(keys->dk_nentries);
289+
return dk_nentries + dk_usable;
293290
}
294291

295292
static inline size_t

Include/internal/pycore_object.h

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ extern "C" {
1212
#include "pycore_gc.h" // _PyObject_GC_IS_TRACKED()
1313
#include "pycore_emscripten_trampoline.h" // _PyCFunction_TrampolineCall()
1414
#include "pycore_interp.h" // PyInterpreterState.gc
15+
#include "pycore_pyatomic_ft_wrappers.h" // FT_ATOMIC_STORE_PTR_RELAXED
1516
#include "pycore_pystate.h" // _PyInterpreterState_GET()
1617

1718
/* Check if an object is consistent. For example, ensure that the reference
@@ -659,10 +660,10 @@ extern PyObject* _PyType_GetDocFromInternalDoc(const char *, const char *);
659660
extern PyObject* _PyType_GetTextSignatureFromInternalDoc(const char *, const char *, int);
660661

661662
void _PyObject_InitInlineValues(PyObject *obj, PyTypeObject *tp);
662-
extern int _PyObject_StoreInstanceAttribute(PyObject *obj, PyDictValues *values,
663-
PyObject *name, PyObject *value);
664-
PyObject * _PyObject_GetInstanceAttribute(PyObject *obj, PyDictValues *values,
665-
PyObject *name);
663+
extern int _PyObject_StoreInstanceAttribute(PyObject *obj,
664+
PyObject *name, PyObject *value);
665+
extern bool _PyObject_TryGetInstanceAttribute(PyObject *obj, PyObject *name,
666+
PyObject **attr);
666667

667668
#ifdef Py_GIL_DISABLED
668669
# define MANAGED_DICT_OFFSET (((Py_ssize_t)sizeof(PyObject *))*-1)
@@ -683,6 +684,13 @@ _PyObject_ManagedDictPointer(PyObject *obj)
683684
return (PyManagedDictPointer *)((char *)obj + MANAGED_DICT_OFFSET);
684685
}
685686

687+
static inline PyDictObject *
688+
_PyObject_GetManagedDict(PyObject *obj)
689+
{
690+
PyManagedDictPointer *dorv = _PyObject_ManagedDictPointer(obj);
691+
return (PyDictObject *)FT_ATOMIC_LOAD_PTR_RELAXED(dorv->dict);
692+
}
693+
686694
static inline PyDictValues *
687695
_PyObject_InlineValues(PyObject *obj)
688696
{

Include/internal/pycore_optimizer.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ extern bool _Py_uop_sym_set_type(_Py_UopsSymbol *sym, PyTypeObject *typ);
9898
extern bool _Py_uop_sym_set_const(_Py_UopsSymbol *sym, PyObject *const_val);
9999
extern bool _Py_uop_sym_is_bottom(_Py_UopsSymbol *sym);
100100
extern int _Py_uop_sym_truthiness(_Py_UopsSymbol *sym);
101+
extern PyTypeObject *_Py_uop_sym_get_type(_Py_UopsSymbol *sym);
101102

102103

103104
extern int _Py_uop_abstractcontext_init(_Py_UOpsContext *ctx);

0 commit comments

Comments
 (0)