Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions Doc/library/cmdline.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,17 @@ The following modules have a command-line interface.
* :ref:`dis <dis-cli>`
* :ref:`doctest <doctest-cli>`
* :mod:`!encodings.rot_13`
* :mod:`ensurepip`
* :ref:`ensurepip <ensurepip-cli>`
* :mod:`filecmp`
* :mod:`fileinput`
* :mod:`ftplib`
* :ref:`gzip <gzip-cli>`
* :ref:`http.server <http-server-cli>`
* :mod:`!idlelib`
* :ref:`idlelib <idlelib-cli>`
* :ref:`inspect <inspect-module-cli>`
* :ref:`json <json-commandline>`
* :ref:`mimetypes <mimetypes-cli>`
* :mod:`pdb`
* :ref:`pdb <pdb-cli>`
* :ref:`pickle <pickle-cli>`
* :ref:`pickletools <pickletools-cli>`
* :ref:`platform <platform-cli>`
Expand All @@ -52,8 +52,8 @@ The following modules have a command-line interface.
* :mod:`turtledemo`
* :ref:`unittest <unittest-command-line-interface>`
* :ref:`uuid <uuid-cli>`
* :mod:`venv`
* :mod:`webbrowser`
* :ref:`venv <venv-cli>`
* :ref:`webbrowser <webbrowser-cli>`
* :ref:`zipapp <zipapp-command-line-interface>`
* :ref:`zipfile <zipfile-commandline>`

Expand Down
4 changes: 3 additions & 1 deletion Doc/library/ensurepip.rst
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,9 @@ when creating a virtual environment) or after explicitly uninstalling

.. include:: ../includes/wasm-mobile-notavail.rst

Command line interface
.. _ensurepip-cli:

Command-line interface
----------------------

.. program:: ensurepip
Expand Down
4 changes: 2 additions & 2 deletions Doc/library/gzip.rst
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ Example of how to GZIP compress a binary string::

.. _gzip-cli:

Command Line Interface
Command-line interface
----------------------

The :mod:`gzip` module provides a simple command line interface to compress or
Expand All @@ -296,7 +296,7 @@ Once executed the :mod:`gzip` module keeps the input file(s).
Add a new command line interface with a usage.
By default, when you will execute the CLI, the default compression level is 6.

Command line options
Command-line options
^^^^^^^^^^^^^^^^^^^^

.. option:: file
Expand Down
4 changes: 3 additions & 1 deletion Doc/library/idle.rst
Original file line number Diff line number Diff line change
Expand Up @@ -661,7 +661,9 @@ looked for in the user's home directory. Statements in this file will be
executed in the Tk namespace, so this file is not useful for importing
functions to be used from IDLE's Python shell.

Command line usage
.. _idlelib-cli:

Command-line usage
^^^^^^^^^^^^^^^^^^

.. program:: idle
Expand Down
2 changes: 1 addition & 1 deletion Doc/library/inspect.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1788,7 +1788,7 @@ Buffer flags

.. _inspect-module-cli:

Command Line Interface
Command-line interface
----------------------

The :mod:`inspect` module also provides a basic introspection capability
Expand Down
6 changes: 5 additions & 1 deletion Doc/library/pdb.rst
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,10 @@ The debugger's prompt is ``(Pdb)``, which is the indicator that you are in debug


.. _pdb-cli:

Command-line interface
----------------------

.. program:: pdb

You can also invoke :mod:`pdb` from the command line to debug other scripts. For
Expand Down Expand Up @@ -334,7 +338,7 @@ access further features, you have to do this yourself:

.. _debugger-commands:

Debugger Commands
Debugger commands
-----------------

The commands recognized by the debugger are listed below. Most commands can be
Expand Down
12 changes: 11 additions & 1 deletion Doc/library/profile.rst
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,14 @@ Profile with real-time sampling statistics::

Sample all threads in the process instead of just the main thread

.. option:: --native

Include artificial ``<native>`` frames to denote calls to non-Python code.

.. option:: --no-gc

Don't include artificial ``<GC>`` frames to denote active garbage collection.

.. option:: --realtime-stats

Print real-time sampling statistics during profiling
Expand Down Expand Up @@ -349,7 +357,7 @@ This section documents the programmatic interface for the :mod:`!profiling.sampl
For command-line usage, see :ref:`sampling-profiler-cli`. For conceptual information
about statistical profiling, see :ref:`statistical-profiling`

.. function:: sample(pid, *, sort=2, sample_interval_usec=100, duration_sec=10, filename=None, all_threads=False, limit=None, show_summary=True, output_format="pstats", realtime_stats=False)
.. function:: sample(pid, *, sort=2, sample_interval_usec=100, duration_sec=10, filename=None, all_threads=False, limit=None, show_summary=True, output_format="pstats", realtime_stats=False, native=False, gc=True)

Sample a Python process and generate profiling data.

Expand All @@ -367,6 +375,8 @@ about statistical profiling, see :ref:`statistical-profiling`
:param bool show_summary: Whether to show summary statistics (default: True)
:param str output_format: Output format - 'pstats' or 'collapsed' (default: 'pstats')
:param bool realtime_stats: Whether to display real-time statistics (default: False)
:param bool native: Whether to include ``<native>`` frames (default: False)
:param bool gc: Whether to include ``<GC>`` frames (default: True)

:raises ValueError: If output_format is not 'pstats' or 'collapsed'

Expand Down
2 changes: 1 addition & 1 deletion Doc/library/site.rst
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ Module contents

.. _site-commandline:

Command Line Interface
Command-line interface
----------------------

.. program:: site
Expand Down
2 changes: 1 addition & 1 deletion Doc/library/socketserver.rst
Original file line number Diff line number Diff line change
Expand Up @@ -546,7 +546,7 @@ The difference is that the ``readline()`` call in the second handler will call
first handler had to use a ``recv()`` loop to accumulate data until a
newline itself. If it had just used a single ``recv()`` without the loop it
would just have returned what has been received so far from the client.
TCP is stream based: data arrives in the order it was sent, but there no
TCP is stream based: data arrives in the order it was sent, but there is no
correlation between client ``send()`` or ``sendall()`` calls and the number
of ``recv()`` calls on the server required to receive it.

Expand Down
4 changes: 2 additions & 2 deletions Doc/library/unittest.mock-examples.rst
Original file line number Diff line number Diff line change
Expand Up @@ -863,9 +863,9 @@ Here's one solution that uses the :attr:`~Mock.side_effect`
functionality. If you provide a ``side_effect`` function for a mock then
``side_effect`` will be called with the same args as the mock. This gives us an
opportunity to copy the arguments and store them for later assertions. In this
example I'm using *another* mock to store the arguments so that I can use the
example we're using *another* mock to store the arguments so that we can use the
mock methods for doing the assertion. Again a helper function sets this up for
me. ::
us. ::

>>> from copy import deepcopy
>>> from unittest.mock import Mock, patch, DEFAULT
Expand Down
7 changes: 6 additions & 1 deletion Doc/library/webbrowser.rst
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,11 @@ a new tab, with the browser being brought to the foreground. The use of the
:mod:`webbrowser` module on iOS requires the :mod:`ctypes` module. If
:mod:`ctypes` isn't available, calls to :func:`.open` will fail.

.. _webbrowser-cli:

Command-line interface
----------------------

.. program:: webbrowser

The script :program:`webbrowser` can be used as a command-line interface for the
Expand Down Expand Up @@ -232,7 +237,7 @@ Here are some simple examples::

.. _browser-controllers:

Browser Controller Objects
Browser controller objects
--------------------------

Browser controllers provide the :attr:`~controller.name` attribute,
Expand Down
2 changes: 1 addition & 1 deletion Doc/library/xml.sax.utils.rst
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ or as base classes.

You can unescape other strings of data by passing a dictionary as the optional
*entities* parameter. The keys and values must all be strings; each key will be
replaced with its corresponding value. ``'&amp'``, ``'&lt;'``, and ``'&gt;'``
replaced with its corresponding value. ``'&amp;'``, ``'&lt;'``, and ``'&gt;'``
are always unescaped, even if *entities* is provided.


Expand Down
13 changes: 13 additions & 0 deletions Doc/whatsnew/3.15.rst
Original file line number Diff line number Diff line change
Expand Up @@ -734,6 +734,19 @@ timeit
:ref:`environment variables <using-on-controlling-color>`.
(Contributed by Yi Hong in :gh:`139374`.)

tkinter
-------

* The :meth:`!tkinter.Text.search` method now supports two additional
arguments: *nolinestop* which allows the search to
continue across line boundaries;
and *strictlimits* which restricts the search to within the specified range.
(Contributed by Rihaan Meher in :gh:`130848`)

* A new method :meth:`!tkinter.Text.search_all` has been introduced.
This method allows for searching for all matches of a pattern
using Tcl's ``-all`` and ``-overlap`` options.
(Contributed by Rihaan Meher in :gh:`130848`)

types
------
Expand Down
16 changes: 8 additions & 8 deletions Include/cpython/pyatomic_std.h
Original file line number Diff line number Diff line change
Expand Up @@ -948,14 +948,6 @@ _Py_atomic_store_ushort_relaxed(unsigned short *obj, unsigned short value)
memory_order_relaxed);
}

static inline void
_Py_atomic_store_uint_release(unsigned int *obj, unsigned int value)
{
_Py_USING_STD;
atomic_store_explicit((_Atomic(unsigned int)*)obj, value,
memory_order_relaxed);
}

static inline void
_Py_atomic_store_long_relaxed(long *obj, long value)
{
Expand Down Expand Up @@ -1031,6 +1023,14 @@ _Py_atomic_store_int_release(int *obj, int value)
memory_order_release);
}

static inline void
_Py_atomic_store_uint_release(unsigned int *obj, unsigned int value)
{
_Py_USING_STD;
atomic_store_explicit((_Atomic(unsigned int)*)obj, value,
memory_order_release);
}

static inline void
_Py_atomic_store_ssize_release(Py_ssize_t *obj, Py_ssize_t value)
{
Expand Down
3 changes: 3 additions & 0 deletions Include/cpython/pystate.h
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,9 @@ struct _ts {
/* Currently holds the GIL. Must be its own field to avoid data races */
int holds_gil;

/* Currently requesting the GIL */
int gil_requested;

int _whence;

/* Thread state (_Py_THREAD_ATTACHED, _Py_THREAD_DETACHED, _Py_THREAD_SUSPENDED).
Expand Down
8 changes: 8 additions & 0 deletions Include/internal/pycore_ceval.h
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,11 @@ extern void _PyEval_DeactivateOpCache(void);
static inline int _Py_MakeRecCheck(PyThreadState *tstate) {
uintptr_t here_addr = _Py_get_machine_stack_pointer();
_PyThreadStateImpl *_tstate = (_PyThreadStateImpl *)tstate;
#if _Py_STACK_GROWS_DOWN
return here_addr < _tstate->c_stack_soft_limit;
#else
return here_addr > _tstate->c_stack_soft_limit;
#endif
}

// Export for '_json' shared extension, used via _Py_EnterRecursiveCall()
Expand Down Expand Up @@ -249,7 +253,11 @@ static inline int _Py_ReachedRecursionLimit(PyThreadState *tstate) {
uintptr_t here_addr = _Py_get_machine_stack_pointer();
_PyThreadStateImpl *_tstate = (_PyThreadStateImpl *)tstate;
assert(_tstate->c_stack_hard_limit != 0);
#if _Py_STACK_GROWS_DOWN
return here_addr <= _tstate->c_stack_soft_limit;
#else
return here_addr >= _tstate->c_stack_soft_limit;
#endif
}

static inline void _Py_LeaveRecursiveCall(void) {
Expand Down
6 changes: 6 additions & 0 deletions Include/internal/pycore_debug_offsets.h
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,8 @@ typedef struct _Py_DebugOffsets {
uint64_t native_thread_id;
uint64_t datastack_chunk;
uint64_t status;
uint64_t holds_gil;
uint64_t gil_requested;
} thread_state;

// InterpreterFrame offset;
Expand Down Expand Up @@ -210,6 +212,7 @@ typedef struct _Py_DebugOffsets {
struct _gc {
uint64_t size;
uint64_t collecting;
uint64_t frame;
} gc;

// Generator object offset;
Expand Down Expand Up @@ -273,6 +276,8 @@ typedef struct _Py_DebugOffsets {
.native_thread_id = offsetof(PyThreadState, native_thread_id), \
.datastack_chunk = offsetof(PyThreadState, datastack_chunk), \
.status = offsetof(PyThreadState, _status), \
.holds_gil = offsetof(PyThreadState, holds_gil), \
.gil_requested = offsetof(PyThreadState, gil_requested), \
}, \
.interpreter_frame = { \
.size = sizeof(_PyInterpreterFrame), \
Expand Down Expand Up @@ -351,6 +356,7 @@ typedef struct _Py_DebugOffsets {
.gc = { \
.size = sizeof(struct _gc_runtime_state), \
.collecting = offsetof(struct _gc_runtime_state, collecting), \
.frame = offsetof(struct _gc_runtime_state, frame), \
}, \
.gen_object = { \
.size = sizeof(PyGenObject), \
Expand Down
4 changes: 4 additions & 0 deletions Include/internal/pycore_global_objects_fini_generated.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions Include/internal/pycore_global_strings.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,12 @@ struct _Py_global_strings {
STRUCT_FOR_STR(dot_locals, ".<locals>")
STRUCT_FOR_STR(empty, "")
STRUCT_FOR_STR(format, ".format")
STRUCT_FOR_STR(gc, "<GC>")
STRUCT_FOR_STR(generic_base, ".generic_base")
STRUCT_FOR_STR(json_decoder, "json.decoder")
STRUCT_FOR_STR(kwdefaults, ".kwdefaults")
STRUCT_FOR_STR(list_err, "list index out of range")
STRUCT_FOR_STR(native, "<native>")
STRUCT_FOR_STR(str_replace_inf, "1e309")
STRUCT_FOR_STR(type_params, ".type_params")
STRUCT_FOR_STR(utf_8, "utf-8")
Expand Down Expand Up @@ -486,6 +488,7 @@ struct _Py_global_strings {
STRUCT_FOR_ID(fullerror)
STRUCT_FOR_ID(func)
STRUCT_FOR_ID(future)
STRUCT_FOR_ID(gc)
STRUCT_FOR_ID(generation)
STRUCT_FOR_ID(get)
STRUCT_FOR_ID(get_debug)
Expand Down Expand Up @@ -629,6 +632,7 @@ struct _Py_global_strings {
STRUCT_FOR_ID(name_from)
STRUCT_FOR_ID(namespace_separator)
STRUCT_FOR_ID(namespaces)
STRUCT_FOR_ID(native)
STRUCT_FOR_ID(ndigits)
STRUCT_FOR_ID(nested)
STRUCT_FOR_ID(new_file_name)
Expand Down
3 changes: 3 additions & 0 deletions Include/internal/pycore_interp_structs.h
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,9 @@ struct _gc_runtime_state {
struct gc_generation_stats generation_stats[NUM_GENERATIONS];
/* true if we are currently running the collector */
int collecting;
// The frame that started the current collection. It might be NULL even when
// collecting (if no Python frame is running):
_PyInterpreterFrame *frame;
/* list of uncollectable objects */
PyObject *garbage;
/* a list of callbacks to be invoked when collection is performed */
Expand Down
1 change: 0 additions & 1 deletion Include/internal/pycore_interpframe_structs.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ enum _frameowner {
FRAME_OWNED_BY_GENERATOR = 1,
FRAME_OWNED_BY_FRAME_OBJECT = 2,
FRAME_OWNED_BY_INTERPRETER = 3,
FRAME_OWNED_BY_CSTACK = 4,
};

struct _PyInterpreterFrame {
Expand Down
4 changes: 4 additions & 0 deletions Include/internal/pycore_pystate.h
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,11 @@ _Py_RecursionLimit_GetMargin(PyThreadState *tstate)
_PyThreadStateImpl *_tstate = (_PyThreadStateImpl *)tstate;
assert(_tstate->c_stack_hard_limit != 0);
intptr_t here_addr = _Py_get_machine_stack_pointer();
#if _Py_STACK_GROWS_DOWN
return Py_ARITHMETIC_RIGHT_SHIFT(intptr_t, here_addr - (intptr_t)_tstate->c_stack_soft_limit, _PyOS_STACK_MARGIN_SHIFT);
#else
return Py_ARITHMETIC_RIGHT_SHIFT(intptr_t, (intptr_t)_tstate->c_stack_soft_limit - here_addr, _PyOS_STACK_MARGIN_SHIFT);
#endif
}

#ifdef __cplusplus
Expand Down
Loading
Loading