Skip to content

Commit 6687799

Browse files
committed
Merge branch 'main' into pr/92078
2 parents 633ff23 + b1fc8b6 commit 6687799

27 files changed

+2543
-344
lines changed

Doc/library/gzip.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -258,6 +258,10 @@ Example of how to GZIP compress a binary string::
258258
The basic data compression module needed to support the :program:`gzip` file
259259
format.
260260

261+
In case gzip (de)compression is a bottleneck, the `python-isal`_
262+
package speeds up (de)compression with a mostly compatible API.
263+
264+
.. _python-isal: https://github.com/pycompression/python-isal
261265

262266
.. program:: gzip
263267

Doc/library/zlib.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -353,3 +353,8 @@ the following constants:
353353
http://www.zlib.net/manual.html
354354
The zlib manual explains the semantics and usage of the library's many
355355
functions.
356+
357+
In case gzip (de)compression is a bottleneck, the `python-isal`_
358+
package speeds up (de)compression with a mostly compatible API.
359+
360+
.. _python-isal: https://github.com/pycompression/python-isal

Doc/whatsnew/3.14.rst

Lines changed: 44 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,9 @@ PEP 768: Safe external debugger interface for CPython
9999

100100
:pep:`768` introduces a zero-overhead debugging interface that allows debuggers and profilers
101101
to safely attach to running Python processes. This is a significant enhancement to Python's
102-
debugging capabilities allowing debuggers to forego unsafe alternatives.
102+
debugging capabilities allowing debuggers to forego unsafe alternatives. See
103+
:ref:`below <whatsnew314-remote-pdb>` for how this feature is leveraged to
104+
implement the new :mod:`pdb` module's remote attaching capabilities.
103105

104106
The new interface provides safe execution points for attaching debugger code without modifying
105107
the interpreter's normal execution path or adding runtime overhead. This enables tools to
@@ -149,6 +151,32 @@ See :pep:`768` for more details.
149151

150152
(Contributed by Pablo Galindo Salgado, Matt Wozniski, and Ivona Stojanovic in :gh:`131591`.)
151153

154+
155+
.. _whatsnew314-remote-pdb:
156+
157+
Remote attaching to a running Python process with PDB
158+
-----------------------------------------------------
159+
160+
The :mod:`pdb` module now supports remote attaching to a running Python process
161+
using a new ``-p PID`` command-line option:
162+
163+
.. code-block:: sh
164+
165+
python -m pdb -p 1234
166+
167+
This will connect to the Python process with the given PID and allow you to
168+
debug it interactively. Notice that due to how the Python interpreter works
169+
attaching to a remote process that is blocked in a system call or waiting for
170+
I/O will only work once the next bytecode instruction is executed or when the
171+
process receives a signal.
172+
173+
This feature leverages :pep:`768` and the :func:`sys.remote_exec` function
174+
to attach to the remote process and send the PDB commands to it.
175+
176+
177+
(Contributed by Matt Wozniski and Pablo Galindo in :gh:`131591`.)
178+
179+
152180
.. _whatsnew314-pep758:
153181

154182
PEP 758 – Allow except and except* expressions without parentheses
@@ -320,6 +348,21 @@ Improved error messages
320348
^^^^^^^
321349
ValueError: too many values to unpack (expected 3, got 4)
322350
351+
* :keyword:`elif` statements that follow an :keyword:`else` block now have a specific error message.
352+
(Contributed by Steele Farnsworth in :gh:`129902`.)
353+
354+
.. code-block:: pycon
355+
356+
>>> if who == "me":
357+
... print("It's me!")
358+
... else:
359+
... print("It's not me!")
360+
... elif who is None:
361+
... print("Who is it?")
362+
File "<stdin>", line 5
363+
elif who is None:
364+
^^^^
365+
SyntaxError: 'elif' block follows an 'else' block
323366
324367
* If a statement (:keyword:`pass`, :keyword:`del`, :keyword:`return`,
325368
:keyword:`yield`, :keyword:`raise`, :keyword:`break`, :keyword:`continue`,

Grammar/python.gram

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1422,6 +1422,7 @@ invalid_elif_stmt:
14221422
invalid_else_stmt:
14231423
| a='else' ':' NEWLINE !INDENT {
14241424
RAISE_INDENTATION_ERROR("expected an indented block after 'else' statement on line %d", a->lineno) }
1425+
| 'else' ':' block 'elif' { RAISE_SYNTAX_ERROR("'elif' block follows an 'else' block")}
14251426
invalid_while_stmt:
14261427
| 'while' named_expression NEWLINE { RAISE_SYNTAX_ERROR("expected ':'") }
14271428
| a='while' named_expression ':' NEWLINE !INDENT {

Include/internal/pycore_interp_structs.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ extern "C" {
99

1010
#include "pycore_ast_state.h" // struct ast_state
1111
#include "pycore_llist.h" // struct llist_node
12+
#include "pycore_memoryobject.h" // struct _memoryobject_state
1213
#include "pycore_opcode_utils.h" // NUM_COMMON_CONSTANTS
1314
#include "pycore_pymath.h" // _PY_SHORT_FLOAT_REPR
1415
#include "pycore_structs.h" // PyHamtObject
@@ -912,9 +913,10 @@ struct _is {
912913
struct _dtoa_state dtoa;
913914
struct _py_func_state func_state;
914915
struct _py_code_state code_state;
915-
916916
struct _Py_dict_state dict_state;
917917
struct _Py_exc_state exc_state;
918+
struct _memoryobject_state memobj_state;
919+
918920
struct _Py_mem_interp_free_queue mem_free_queue;
919921

920922
struct ast_state ast;

Include/internal/pycore_memoryobject.h

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,17 @@ extern "C" {
88
# error "this header requires Py_BUILD_CORE define"
99
#endif
1010

11+
struct _memoryobject_state {
12+
PyTypeObject *XIBufferViewType;
13+
};
14+
15+
extern PyStatus _PyMemoryView_InitTypes(PyInterpreterState *);
16+
extern void _PyMemoryView_FiniTypes(PyInterpreterState *);
17+
18+
// exported for _interpreters module
19+
PyAPI_FUNC(PyTypeObject *) _PyMemoryView_GetXIBuffewViewType(void);
20+
21+
1122
extern PyTypeObject _PyManagedBuffer_Type;
1223

1324
PyObject *

0 commit comments

Comments
 (0)