Skip to content

Commit 4c59e51

Browse files
committed
Merge branch 'main' into modulelocals
* main: (39 commits) pythongh-102542 Remove unused bytes object and bytes slicing (python#106433) Clarify state of CancelledError in doc (python#106453) pythongh-64595: Fix regression in file write logic in Argument Clinic (python#106449) pythongh-104683: Rename Lib/test/clinic.test as Lib/test/clinic.test.c (python#106443) tp_flags docs: fix indentation (python#106420) pythongh-104050: Partially annotate Argument Clinic CLanguage class (python#106437) pythongh-106368: Add tests for formatting helpers in Argument Clinic (python#106415) pythongh-104050: Annotate Argument Clinic parameter permutation helpers (python#106431) pythongh-104050: Annotate toplevel functions in clinic.py (python#106435) pythongh-106320: Fix specialize.c compilation by including pycore_pylifecycle.h (python#106434) Add some codeowners for `Tools/clinic/` (python#106430) pythongh-106217: Truncate the issue body size of `new-bugs-announce-notifier` (python#106423) pythongh-61215: Rename `wait_until_any_call` to `wait_until_any_call_with` (python#106414) pythongh-106162: array: suppress warning in test_array (python#106404) pythongh-106320: Remove _PyInterpreterState_HasFeature() (python#106425) pythonGH-106360: Support very basic superblock introspection (python#106422) pythongh-106406: Fix _Py_IsInterpreterFinalizing() in _winapi.c (python#106408) pythongh-106396: Special-case empty format spec to gen empty JoinedStr node (python#106401) pythongh-106368: Add tests for permutation helpers in Argument Clinic (python#106407) pythonGH-106008: Fix refleak when peepholing `None` comparisons (python#106367) ...
2 parents 7c33113 + 70e2a42 commit 4c59e51

File tree

81 files changed

+2352
-1536
lines changed

Some content is hidden

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

81 files changed

+2352
-1536
lines changed

.github/CODEOWNERS

+4
Original file line numberDiff line numberDiff line change
@@ -173,3 +173,7 @@ Doc/c-api/stable.rst @encukou
173173

174174
# zipfile.Path
175175
**/*zipfile/*_path.py @jaraco
176+
177+
# Argument Clinic
178+
/Tools/clinic/** @erlend-aasland @AlexWaygood
179+
/Lib/test/test_clinic.py @erlend-aasland @AlexWaygood

.github/workflows/new-bugs-announce-notifier.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ jobs:
4444
// We need to truncate the body size, because the max size for
4545
// the whole payload is 16kb. We want to be safe and assume that
4646
// body can take up to ~8kb of space.
47-
body : issue.data.body.substring(8000)
47+
body : issue.data.body.substring(0, 8000)
4848
};
4949
5050
const data = {

Doc/c-api/typeobj.rst

+9-9
Original file line numberDiff line numberDiff line change
@@ -1143,27 +1143,27 @@ and :c:type:`PyType_Type` effectively act as defaults.)
11431143
:const:`Py_TPFLAGS_IMMUTABLETYPE` flag set. For extension types, it is
11441144
inherited whenever :c:member:`~PyTypeObject.tp_descr_get` is inherited.
11451145

1146-
.. data:: Py_TPFLAGS_MANAGED_DICT
1146+
.. data:: Py_TPFLAGS_MANAGED_DICT
11471147

1148-
This bit indicates that instances of the class have a ``__dict__``
1149-
attribute, and that the space for the dictionary is managed by the VM.
1148+
This bit indicates that instances of the class have a ``__dict__``
1149+
attribute, and that the space for the dictionary is managed by the VM.
11501150

1151-
If this flag is set, :const:`Py_TPFLAGS_HAVE_GC` should also be set.
1151+
If this flag is set, :const:`Py_TPFLAGS_HAVE_GC` should also be set.
11521152

1153-
.. versionadded:: 3.12
1153+
.. versionadded:: 3.12
11541154

11551155
**Inheritance:**
11561156

11571157
This flag is inherited unless the
11581158
:c:member:`~PyTypeObject.tp_dictoffset` field is set in a superclass.
11591159

11601160

1161-
.. data:: Py_TPFLAGS_MANAGED_WEAKREF
1161+
.. data:: Py_TPFLAGS_MANAGED_WEAKREF
11621162

1163-
This bit indicates that instances of the class should be weakly
1164-
referenceable.
1163+
This bit indicates that instances of the class should be weakly
1164+
referenceable.
11651165

1166-
.. versionadded:: 3.12
1166+
.. versionadded:: 3.12
11671167

11681168
**Inheritance:**
11691169

Doc/library/asyncio-exceptions.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ Exceptions
3131

3232
.. versionchanged:: 3.8
3333

34-
:exc:`CancelledError` is now a subclass of :class:`BaseException`.
34+
:exc:`CancelledError` is now a subclass of :class:`BaseException` rather than :class:`Exception`.
3535

3636

3737
.. exception:: InvalidStateError

Doc/library/itertools.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -1085,8 +1085,8 @@ The following recipes have a more mathematical flavor:
10851085
kernel = tuple(kernel)[::-1]
10861086
n = len(kernel)
10871087
padded_signal = chain(repeat(0, n-1), signal, repeat(0, n-1))
1088-
for window in sliding_window(padded_signal, n):
1089-
yield math.sumprod(kernel, window)
1088+
windowed_signal = sliding_window(padded_signal, n)
1089+
return map(math.sumprod, repeat(kernel), windowed_signal)
10901090

10911091
def polynomial_from_roots(roots):
10921092
"""Compute a polynomial's coefficients from its roots.

Doc/library/unittest.mock.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -1126,7 +1126,7 @@ object::
11261126
>>> mock.wait_until_called(timeout=1)
11271127
>>> thread.join()
11281128

1129-
.. method:: wait_until_any_call(*args, **kwargs)
1129+
.. method:: wait_until_any_call_with(*args, **kwargs)
11301130

11311131
Waits until the the mock is called with the specified arguments.
11321132

@@ -1136,7 +1136,7 @@ object::
11361136
>>> mock = ThreadingMock()
11371137
>>> thread = threading.Thread(target=mock, args=("arg1", "arg2",), kwargs={"arg": "thing"})
11381138
>>> thread.start()
1139-
>>> mock.wait_until_any_call("arg1", "arg2", arg="thing")
1139+
>>> mock.wait_until_any_call_with("arg1", "arg2", arg="thing")
11401140
>>> thread.join()
11411141

11421142
.. attribute:: DEFAULT_TIMEOUT

Include/cpython/bytesobject.h

-80
Original file line numberDiff line numberDiff line change
@@ -47,83 +47,3 @@ static inline Py_ssize_t PyBytes_GET_SIZE(PyObject *op) {
4747
/* _PyBytes_Join(sep, x) is like sep.join(x). sep must be PyBytesObject*,
4848
x must be an iterable object. */
4949
PyAPI_FUNC(PyObject *) _PyBytes_Join(PyObject *sep, PyObject *x);
50-
51-
52-
/* The _PyBytesWriter structure is big: it contains an embedded "stack buffer".
53-
A _PyBytesWriter variable must be declared at the end of variables in a
54-
function to optimize the memory allocation on the stack. */
55-
typedef struct {
56-
/* bytes, bytearray or NULL (when the small buffer is used) */
57-
PyObject *buffer;
58-
59-
/* Number of allocated size. */
60-
Py_ssize_t allocated;
61-
62-
/* Minimum number of allocated bytes,
63-
incremented by _PyBytesWriter_Prepare() */
64-
Py_ssize_t min_size;
65-
66-
/* If non-zero, use a bytearray instead of a bytes object for buffer. */
67-
int use_bytearray;
68-
69-
/* If non-zero, overallocate the buffer (default: 0).
70-
This flag must be zero if use_bytearray is non-zero. */
71-
int overallocate;
72-
73-
/* Stack buffer */
74-
int use_small_buffer;
75-
char small_buffer[512];
76-
} _PyBytesWriter;
77-
78-
/* Initialize a bytes writer
79-
80-
By default, the overallocation is disabled. Set the overallocate attribute
81-
to control the allocation of the buffer. */
82-
PyAPI_FUNC(void) _PyBytesWriter_Init(_PyBytesWriter *writer);
83-
84-
/* Get the buffer content and reset the writer.
85-
Return a bytes object, or a bytearray object if use_bytearray is non-zero.
86-
Raise an exception and return NULL on error. */
87-
PyAPI_FUNC(PyObject *) _PyBytesWriter_Finish(_PyBytesWriter *writer,
88-
void *str);
89-
90-
/* Deallocate memory of a writer (clear its internal buffer). */
91-
PyAPI_FUNC(void) _PyBytesWriter_Dealloc(_PyBytesWriter *writer);
92-
93-
/* Allocate the buffer to write size bytes.
94-
Return the pointer to the beginning of buffer data.
95-
Raise an exception and return NULL on error. */
96-
PyAPI_FUNC(void*) _PyBytesWriter_Alloc(_PyBytesWriter *writer,
97-
Py_ssize_t size);
98-
99-
/* Ensure that the buffer is large enough to write *size* bytes.
100-
Add size to the writer minimum size (min_size attribute).
101-
102-
str is the current pointer inside the buffer.
103-
Return the updated current pointer inside the buffer.
104-
Raise an exception and return NULL on error. */
105-
PyAPI_FUNC(void*) _PyBytesWriter_Prepare(_PyBytesWriter *writer,
106-
void *str,
107-
Py_ssize_t size);
108-
109-
/* Resize the buffer to make it larger.
110-
The new buffer may be larger than size bytes because of overallocation.
111-
Return the updated current pointer inside the buffer.
112-
Raise an exception and return NULL on error.
113-
114-
Note: size must be greater than the number of allocated bytes in the writer.
115-
116-
This function doesn't use the writer minimum size (min_size attribute).
117-
118-
See also _PyBytesWriter_Prepare().
119-
*/
120-
PyAPI_FUNC(void*) _PyBytesWriter_Resize(_PyBytesWriter *writer,
121-
void *str,
122-
Py_ssize_t size);
123-
124-
/* Write bytes.
125-
Raise an exception and return NULL on error. */
126-
PyAPI_FUNC(void*) _PyBytesWriter_WriteBytes(_PyBytesWriter *writer,
127-
void *str,
128-
const void *bytes,
129-
Py_ssize_t size);

Include/cpython/import.h

-20
Original file line numberDiff line numberDiff line change
@@ -4,23 +4,6 @@
44

55
PyMODINIT_FUNC PyInit__imp(void);
66

7-
PyAPI_FUNC(int) _PyImport_IsInitialized(PyInterpreterState *);
8-
9-
PyAPI_FUNC(PyObject *) _PyImport_GetModuleId(_Py_Identifier *name);
10-
PyAPI_FUNC(int) _PyImport_SetModule(PyObject *name, PyObject *module);
11-
PyAPI_FUNC(int) _PyImport_SetModuleString(const char *name, PyObject* module);
12-
13-
PyAPI_FUNC(void) _PyImport_AcquireLock(PyInterpreterState *interp);
14-
PyAPI_FUNC(int) _PyImport_ReleaseLock(PyInterpreterState *interp);
15-
16-
PyAPI_FUNC(int) _PyImport_FixupBuiltin(
17-
PyObject *mod,
18-
const char *name, /* UTF-8 encoded string */
19-
PyObject *modules
20-
);
21-
PyAPI_FUNC(int) _PyImport_FixupExtensionObject(PyObject*, PyObject *,
22-
PyObject *, PyObject *);
23-
247
struct _inittab {
258
const char *name; /* ASCII encoded string */
269
PyObject* (*initfunc)(void);
@@ -41,6 +24,3 @@ struct _frozen {
4124
collection of frozen modules: */
4225

4326
PyAPI_DATA(const struct _frozen *) PyImport_FrozenModules;
44-
45-
PyAPI_DATA(PyObject *) _PyImport_GetModuleAttr(PyObject *, PyObject *);
46-
PyAPI_DATA(PyObject *) _PyImport_GetModuleAttrString(const char *, const char *);

Include/cpython/optimizer.h

+2
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ PyAPI_FUNC(void) PyUnstable_SetOptimizer(_PyOptimizerObject* optimizer);
3838

3939
PyAPI_FUNC(_PyOptimizerObject *) PyUnstable_GetOptimizer(void);
4040

41+
PyAPI_FUNC(_PyExecutorObject *)PyUnstable_GetExecutor(PyCodeObject *code, int offset);
42+
4143
struct _PyInterpreterFrame *
4244
_PyOptimizer_BackEdge(struct _PyInterpreterFrame *frame, _Py_CODEUNIT *src, _Py_CODEUNIT *dest, PyObject **stack_pointer);
4345

Include/cpython/pylifecycle.h

+2-25
Original file line numberDiff line numberDiff line change
@@ -19,45 +19,22 @@ PyAPI_FUNC(PyStatus) Py_PreInitializeFromArgs(
1919
Py_ssize_t argc,
2020
wchar_t **argv);
2121

22-
PyAPI_FUNC(int) _Py_IsCoreInitialized(void);
23-
2422

2523
/* Initialization and finalization */
2624

2725
PyAPI_FUNC(PyStatus) Py_InitializeFromConfig(
2826
const PyConfig *config);
27+
28+
// Python 3.8 provisional API (PEP 587)
2929
PyAPI_FUNC(PyStatus) _Py_InitializeMain(void);
3030

3131
PyAPI_FUNC(int) Py_RunMain(void);
3232

3333

3434
PyAPI_FUNC(void) _Py_NO_RETURN Py_ExitStatusException(PyStatus err);
3535

36-
/* Restore signals that the interpreter has called SIG_IGN on to SIG_DFL. */
37-
PyAPI_FUNC(void) _Py_RestoreSignals(void);
38-
3936
PyAPI_FUNC(int) Py_FdIsInteractive(FILE *, const char *);
40-
PyAPI_FUNC(int) _Py_FdIsInteractive(FILE *fp, PyObject *filename);
41-
42-
PyAPI_FUNC(const char *) _Py_gitidentifier(void);
43-
PyAPI_FUNC(const char *) _Py_gitversion(void);
44-
45-
PyAPI_FUNC(int) _Py_IsFinalizing(void);
46-
PyAPI_FUNC(int) _Py_IsInterpreterFinalizing(PyInterpreterState *interp);
47-
48-
/* Random */
49-
PyAPI_FUNC(int) _PyOS_URandom(void *buffer, Py_ssize_t size);
50-
PyAPI_FUNC(int) _PyOS_URandomNonblock(void *buffer, Py_ssize_t size);
51-
52-
/* Legacy locale support */
53-
PyAPI_FUNC(int) _Py_CoerceLegacyLocale(int warn);
54-
PyAPI_FUNC(int) _Py_LegacyLocaleDetected(int warn);
55-
PyAPI_FUNC(char *) _Py_SetLocaleFromEnv(int category);
5637

5738
PyAPI_FUNC(PyStatus) Py_NewInterpreterFromConfig(
5839
PyThreadState **tstate_p,
5940
const PyInterpreterConfig *config);
60-
61-
typedef void (*atexit_datacallbackfunc)(void *);
62-
PyAPI_FUNC(int) _Py_AtExit(
63-
PyInterpreterState *, atexit_datacallbackfunc, void *);

Include/cpython/pystate.h

-32
Original file line numberDiff line numberDiff line change
@@ -3,38 +3,6 @@
33
#endif
44

55

6-
/*
7-
Runtime Feature Flags
8-
9-
Each flag indicate whether or not a specific runtime feature
10-
is available in a given context. For example, forking the process
11-
might not be allowed in the current interpreter (i.e. os.fork() would fail).
12-
*/
13-
14-
/* Set if the interpreter share obmalloc runtime state
15-
with the main interpreter. */
16-
#define Py_RTFLAGS_USE_MAIN_OBMALLOC (1UL << 5)
17-
18-
/* Set if import should check a module for subinterpreter support. */
19-
#define Py_RTFLAGS_MULTI_INTERP_EXTENSIONS (1UL << 8)
20-
21-
/* Set if threads are allowed. */
22-
#define Py_RTFLAGS_THREADS (1UL << 10)
23-
24-
/* Set if daemon threads are allowed. */
25-
#define Py_RTFLAGS_DAEMON_THREADS (1UL << 11)
26-
27-
/* Set if os.fork() is allowed. */
28-
#define Py_RTFLAGS_FORK (1UL << 15)
29-
30-
/* Set if os.exec*() is allowed. */
31-
#define Py_RTFLAGS_EXEC (1UL << 16)
32-
33-
34-
PyAPI_FUNC(int) _PyInterpreterState_HasFeature(PyInterpreterState *interp,
35-
unsigned long feature);
36-
37-
386
/* private interpreter helpers */
397

408
PyAPI_FUNC(int) _PyInterpreterState_RequiresIDRef(PyInterpreterState *);

0 commit comments

Comments
 (0)