Skip to content

Commit

Permalink
Merge branch 'main' into pythongh-73435-pathlib-match-recursive
Browse files Browse the repository at this point in the history
  • Loading branch information
barneygale authored May 29, 2023
2 parents fec7702 + d593074 commit 89bc380
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 3 deletions.
19 changes: 18 additions & 1 deletion Doc/library/traceback.rst
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ The module also defines the following classes:
:class:`TracebackException` objects are created from actual exceptions to
capture data for later printing in a lightweight fashion.

.. class:: TracebackException(exc_type, exc_value, exc_traceback, *, limit=None, lookup_lines=True, capture_locals=False, compact=False)
.. class:: TracebackException(exc_type, exc_value, exc_traceback, *, limit=None, lookup_lines=True, capture_locals=False, compact=False, max_group_width=15, max_group_depth=10)

Capture an exception for later rendering. *limit*, *lookup_lines* and
*capture_locals* are as for the :class:`StackSummary` class.
Expand All @@ -230,6 +230,12 @@ capture data for later printing in a lightweight fashion.

Note that when locals are captured, they are also shown in the traceback.

*max_group_width* and *max_group_depth* control the formatting of exception
groups (see :exc:`BaseExceptionGroup`). The depth refers to the nesting
level of the group, and the width refers to the size of a single exception
group's exceptions array. The formatted output is truncated when either
limit is exceeded.

.. attribute:: __cause__

A :class:`TracebackException` of the original ``__cause__``.
Expand All @@ -238,6 +244,14 @@ capture data for later printing in a lightweight fashion.

A :class:`TracebackException` of the original ``__context__``.

.. attribute:: exceptions

If ``self`` represents an :exc:`ExceptionGroup`, this field holds a list of
:class:`TracebackException` instances representing the nested exceptions.
Otherwise it is ``None``.

.. versionadded:: 3.11

.. attribute:: __suppress_context__

The ``__suppress_context__`` value from the original exception.
Expand Down Expand Up @@ -323,6 +337,9 @@ capture data for later printing in a lightweight fashion.
.. versionchanged:: 3.10
Added the *compact* parameter.

.. versionchanged:: 3.11
Added the *max_group_width* and *max_group_depth* parameters.


:class:`StackSummary` Objects
-----------------------------
Expand Down
6 changes: 5 additions & 1 deletion Lib/pathlib.py
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ def __repr__(self):
return "<{}.parents>".format(type(self._path).__name__)


class PurePath(os.PathLike):
class PurePath:
"""Base class for manipulating paths without I/O.
PurePath represents a filesystem path and offers operations which
Expand Down Expand Up @@ -760,6 +760,10 @@ def match(self, path_pattern, *, case_sensitive=None):
raise ValueError("empty pattern")


# Subclassing os.PathLike makes isinstance() checks slower,
# which in turn makes Path construction slower. Register instead!
os.PathLike.register(PurePath)


class PurePosixPath(PurePath):
"""PurePath subclass for non-Windows systems.
Expand Down
2 changes: 2 additions & 0 deletions Lib/traceback.py
Original file line number Diff line number Diff line change
Expand Up @@ -658,6 +658,8 @@ class TracebackException:
- :attr:`__cause__` A TracebackException of the original *__cause__*.
- :attr:`__context__` A TracebackException of the original *__context__*.
- :attr:`exceptions` For exception groups - a list of TracebackException
instances for the nested *exceptions*. ``None`` for other exceptions.
- :attr:`__suppress_context__` The *__suppress_context__* value from the
original exception.
- :attr:`stack` A `StackSummary` representing the traceback.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Add missing documentation for the ``max_group_depth`` and ``max_group_width``
parameters and the ``exceptions`` attribute of the
:class:`traceback.TracebackException` class.
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
When installed from the Microsoft Store, ``pip`` no longer defaults to
per-user installs. However, as the install directory is unwritable, it
should automatically decide to do a per-user install anyway. This should
resolve issues when ``pip`` is passed an option that conflicts with
``--user``.
1 change: 0 additions & 1 deletion PC/layout/support/options.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ def public(f):
"options": [
"stable",
"pip",
"pip-user",
"tcltk",
"idle",
"venv",
Expand Down

0 comments on commit 89bc380

Please sign in to comment.