Skip to content

Commit 00c8965

Browse files
committed
Merge branch 'main' into iOS-configure-reorg
2 parents d714196 + d4d5bae commit 00c8965

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+689
-138
lines changed

Doc/c-api/code.rst

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,13 @@ bound into a function.
2222
.. c:var:: PyTypeObject PyCode_Type
2323
2424
This is an instance of :c:type:`PyTypeObject` representing the Python
25-
:class:`code` type.
25+
:ref:`code object <code-objects>`.
2626

2727

2828
.. c:function:: int PyCode_Check(PyObject *co)
2929
30-
Return true if *co* is a :class:`code` object. This function always succeeds.
30+
Return true if *co* is a :ref:`code object <code-objects>`.
31+
This function always succeeds.
3132
3233
.. c:function:: int PyCode_GetNumFree(PyCodeObject *co)
3334

Doc/library/enum.rst

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -286,6 +286,19 @@ Data Types
286286
appropriate value will be chosen for you. See :class:`auto` for the
287287
details.
288288

289+
.. attribute:: Enum._name_
290+
291+
Name of the member.
292+
293+
.. attribute:: Enum._value_
294+
295+
Value of the member, can be set in :meth:`~object.__new__`.
296+
297+
.. attribute:: Enum._order_
298+
299+
No longer used, kept for backward compatibility.
300+
(class attribute, removed during class creation).
301+
289302
.. attribute:: Enum._ignore_
290303

291304
``_ignore_`` is only used during creation and is removed from the
@@ -823,8 +836,8 @@ Supported ``_sunder_`` names
823836
- :attr:`~Enum._ignore_` -- a list of names, either as a :class:`list` or a
824837
:class:`str`, that will not be transformed into members, and will be removed
825838
from the final class
826-
- :attr:`~Enum._order_` -- used in Python 2/3 code to ensure member order is
827-
consistent (class attribute, removed during class creation)
839+
- :attr:`~Enum._order_` -- no longer used, kept for backward
840+
compatibility (class attribute, removed during class creation)
828841
- :meth:`~Enum._generate_next_value_` -- used to get an appropriate value for
829842
an enum member; may be overridden
830843

Doc/tools/.nitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ Doc/library/email.compat32-message.rst
3131
Doc/library/email.errors.rst
3232
Doc/library/email.parser.rst
3333
Doc/library/email.policy.rst
34-
Doc/library/enum.rst
3534
Doc/library/exceptions.rst
3635
Doc/library/faulthandler.rst
3736
Doc/library/fcntl.rst

Doc/whatsnew/3.13.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1339,6 +1339,12 @@ Build Changes
13391339
:ref:`limited C API <limited-c-api>`.
13401340
(Contributed by Victor Stinner in :gh:`85283`.)
13411341

1342+
* ``wasm32-wasi`` is now a tier 2 platform.
1343+
(Contributed by Brett Cannon in :gh:`115192`.)
1344+
1345+
* ``wasm32-emscripten`` is no longer a supported platform.
1346+
(Contributed by Brett Cannon in :gh:`115192`.)
1347+
13421348

13431349
C API Changes
13441350
=============

Include/internal/pycore_brc.h

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
#ifndef Py_INTERNAL_BRC_H
2+
#define Py_INTERNAL_BRC_H
3+
4+
#include <stdint.h>
5+
#include "pycore_llist.h" // struct llist_node
6+
#include "pycore_lock.h" // PyMutex
7+
#include "pycore_object_stack.h" // _PyObjectStack
8+
9+
#ifdef __cplusplus
10+
extern "C" {
11+
#endif
12+
13+
#ifndef Py_BUILD_CORE
14+
# error "this header requires Py_BUILD_CORE define"
15+
#endif
16+
17+
#ifdef Py_GIL_DISABLED
18+
19+
// Prime number to avoid correlations with memory addresses.
20+
#define _Py_BRC_NUM_BUCKETS 257
21+
22+
// Hash table bucket
23+
struct _brc_bucket {
24+
// Mutex protects both the bucket and thread state queues in this bucket.
25+
PyMutex mutex;
26+
27+
// Linked list of _PyThreadStateImpl objects hashed to this bucket.
28+
struct llist_node root;
29+
};
30+
31+
// Per-interpreter biased reference counting state
32+
struct _brc_state {
33+
// Hash table of thread states by thread-id. Thread states within a bucket
34+
// are chained using a doubly-linked list.
35+
struct _brc_bucket table[_Py_BRC_NUM_BUCKETS];
36+
};
37+
38+
// Per-thread biased reference counting state
39+
struct _brc_thread_state {
40+
// Linked-list of thread states per hash bucket
41+
struct llist_node bucket_node;
42+
43+
// Thread-id as determined by _PyThread_Id()
44+
uintptr_t tid;
45+
46+
// Objects with refcounts to be merged (protected by bucket mutex)
47+
_PyObjectStack objects_to_merge;
48+
49+
// Local stack of objects to be merged (not accessed by other threads)
50+
_PyObjectStack local_objects_to_merge;
51+
};
52+
53+
// Initialize/finalize the per-thread biased reference counting state
54+
void _Py_brc_init_thread(PyThreadState *tstate);
55+
void _Py_brc_remove_thread(PyThreadState *tstate);
56+
57+
// Initialize per-interpreter state
58+
void _Py_brc_init_state(PyInterpreterState *interp);
59+
60+
void _Py_brc_after_fork(PyInterpreterState *interp);
61+
62+
// Enqueues an object to be merged by it's owning thread (tid). This
63+
// steals a reference to the object.
64+
void _Py_brc_queue_object(PyObject *ob);
65+
66+
// Merge the refcounts of queued objects for the current thread.
67+
void _Py_brc_merge_refcounts(PyThreadState *tstate);
68+
69+
#endif /* Py_GIL_DISABLED */
70+
71+
#ifdef __cplusplus
72+
}
73+
#endif
74+
#endif /* !Py_INTERNAL_BRC_H */

Include/internal/pycore_ceval.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,7 @@ void _PyEval_FrameClearAndPop(PyThreadState *tstate, _PyInterpreterFrame *frame)
206206
#define _PY_ASYNC_EXCEPTION_BIT 3
207207
#define _PY_GC_SCHEDULED_BIT 4
208208
#define _PY_EVAL_PLEASE_STOP_BIT 5
209+
#define _PY_EVAL_EXPLICIT_MERGE_BIT 6
209210

210211
/* Reserve a few bits for future use */
211212
#define _PY_EVAL_EVENTS_BITS 8

Include/internal/pycore_context.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ extern PyTypeObject _PyContextTokenMissing_Type;
1414
/* runtime lifecycle */
1515

1616
PyStatus _PyContext_Init(PyInterpreterState *);
17-
void _PyContext_Fini(_PyFreeListState *);
1817

1918

2019
/* other API */

Include/internal/pycore_floatobject.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ extern "C" {
1515

1616
extern void _PyFloat_InitState(PyInterpreterState *);
1717
extern PyStatus _PyFloat_InitTypes(PyInterpreterState *);
18-
extern void _PyFloat_Fini(_PyFreeListState *);
1918
extern void _PyFloat_FiniType(PyInterpreterState *);
2019

2120

Include/internal/pycore_freelist.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,16 @@ typedef struct _Py_freelist_state {
125125
struct _Py_object_stack_state object_stacks;
126126
} _PyFreeListState;
127127

128+
extern void _PyObject_ClearFreeLists(_PyFreeListState *state, int is_finalization);
129+
extern void _PyTuple_ClearFreeList(_PyFreeListState *state, int is_finalization);
130+
extern void _PyFloat_ClearFreeList(_PyFreeListState *state, int is_finalization);
131+
extern void _PyList_ClearFreeList(_PyFreeListState *state, int is_finalization);
132+
extern void _PySlice_ClearFreeList(_PyFreeListState *state, int is_finalization);
133+
extern void _PyDict_ClearFreeList(_PyFreeListState *state, int is_finalization);
134+
extern void _PyAsyncGen_ClearFreeLists(_PyFreeListState *state, int is_finalization);
135+
extern void _PyContext_ClearFreeList(_PyFreeListState *state, int is_finalization);
136+
extern void _PyObjectStackChunk_ClearFreeList(_PyFreeListState *state, int is_finalization);
137+
128138
#ifdef __cplusplus
129139
}
130140
#endif

Include/internal/pycore_gc.h

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -279,14 +279,6 @@ extern PyObject *_PyGC_GetReferrers(PyInterpreterState *interp, PyObject *objs);
279279

280280
// Functions to clear types free lists
281281
extern void _PyGC_ClearAllFreeLists(PyInterpreterState *interp);
282-
extern void _Py_ClearFreeLists(_PyFreeListState *state, int is_finalization);
283-
extern void _PyTuple_ClearFreeList(_PyFreeListState *state, int is_finalization);
284-
extern void _PyFloat_ClearFreeList(_PyFreeListState *state, int is_finalization);
285-
extern void _PyList_ClearFreeList(_PyFreeListState *state, int is_finalization);
286-
extern void _PySlice_ClearCache(_PyFreeListState *state);
287-
extern void _PyDict_ClearFreeList(_PyFreeListState *state, int is_finalization);
288-
extern void _PyAsyncGen_ClearFreeLists(_PyFreeListState *state, int is_finalization);
289-
extern void _PyContext_ClearFreeList(_PyFreeListState *state, int is_finalization);
290282
extern void _Py_ScheduleGC(PyInterpreterState *interp);
291283
extern void _Py_RunGC(PyThreadState *tstate);
292284

0 commit comments

Comments
 (0)