From 390bd32242bb560753b15036cd0b419a52b0cb8e Mon Sep 17 00:00:00 2001 From: "C.A.M. Gerlach" Date: Sat, 15 Oct 2022 16:16:59 -0500 Subject: [PATCH 1/5] Break fn list in inspect into bullets and tweak syntax/formatting --- Doc/whatsnew/3.11.rst | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/Doc/whatsnew/3.11.rst b/Doc/whatsnew/3.11.rst index 56a35f4e4802ba..87f170c78ae67e 100644 --- a/Doc/whatsnew/3.11.rst +++ b/Doc/whatsnew/3.11.rst @@ -729,22 +729,32 @@ IDLE and idlelib * Include prompts when saving Shell with inputs and outputs. (Contributed by Terry Jan Reedy in :gh:`95191`.) + +.. _whatsnew311-inspect: + inspect ------- -* Add :func:`inspect.getmembers_static`: return all members without + +* Add :func:`~inspect.getmembers_static` to return all members without triggering dynamic lookup via the descriptor protocol. (Contributed by Weipeng Hong in :issue:`30533`.) -* Add :func:`inspect.ismethodwrapper` for checking if the type of an object is a - :class:`~types.MethodWrapperType`. (Contributed by Hakan Çelik in :issue:`29418`.) +* Add :func:`~inspect.ismethodwrapper` + for checking if the type of an object is a :class:`~types.MethodWrapperType`. + (Contributed by Hakan Çelik in :issue:`29418`.) * Change the frame-related functions in the :mod:`inspect` module to return a regular object (that is backwards compatible with the old tuple-like interface) that include the extended :pep:`657` position information (end line number, column and end column). The affected functions are: - :func:`inspect.getframeinfo`, :func:`inspect.getouterframes`, :func:`inspect.getinnerframes`, - :func:`inspect.stack` and :func:`inspect.trace`. (Contributed by Pablo Galindo in - :gh:`88116`.) + + * :func:`inspect.getframeinfo` + * :func:`inspect.getouterframes` + * :func:`inspect.getinnerframes`, + * :func:`inspect.stack` + * :func:`inspect.trace` + + (Contributed by Pablo Galindo in :gh:`88116`.) locale ------ From 61b9ce50c1284224821eb4c33b2d934e8e886a81 Mon Sep 17 00:00:00 2001 From: "C.A.M. Gerlach" Date: Sat, 15 Oct 2022 16:17:26 -0500 Subject: [PATCH 2/5] Explictly name and reference the new inspect.FrameInfo objects --- Doc/whatsnew/3.11.rst | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Doc/whatsnew/3.11.rst b/Doc/whatsnew/3.11.rst index 87f170c78ae67e..097fbdd5f18e03 100644 --- a/Doc/whatsnew/3.11.rst +++ b/Doc/whatsnew/3.11.rst @@ -744,8 +744,9 @@ inspect (Contributed by Hakan Çelik in :issue:`29418`.) * Change the frame-related functions in the :mod:`inspect` module to return a - regular object (that is backwards compatible with the old tuple-like - interface) that include the extended :pep:`657` position information (end + :class:`~inspect.FrameInfo` instance + (backwards compatible with the old :func:`~collections.namedtuple`-like + interface) that includes the extended :pep:`657` position information (end line number, column and end column). The affected functions are: * :func:`inspect.getframeinfo` From 940e5b8227156d0335e4d6985f8267a23e19b0f2 Mon Sep 17 00:00:00 2001 From: "C.A.M. Gerlach" Date: Sat, 15 Oct 2022 21:47:01 -0500 Subject: [PATCH 3/5] Add mention of inspect.Traceback to entry & further clarify --- Doc/whatsnew/3.11.rst | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Doc/whatsnew/3.11.rst b/Doc/whatsnew/3.11.rst index 097fbdd5f18e03..f2e612f90ae8bb 100644 --- a/Doc/whatsnew/3.11.rst +++ b/Doc/whatsnew/3.11.rst @@ -743,10 +743,10 @@ inspect for checking if the type of an object is a :class:`~types.MethodWrapperType`. (Contributed by Hakan Çelik in :issue:`29418`.) -* Change the frame-related functions in the :mod:`inspect` module to return a - :class:`~inspect.FrameInfo` instance - (backwards compatible with the old :func:`~collections.namedtuple`-like - interface) that includes the extended :pep:`657` position information (end +* Change the frame-related functions in the :mod:`inspect` module to return new + :class:`~inspect.FrameInfo` and :class:`~inspect.Traceback` class instances + (backwards compatible with the previous :term:`named tuple`-like interfaces) + that includes the extended :pep:`657` position information (end line number, column and end column). The affected functions are: * :func:`inspect.getframeinfo` From 2aa2ed9a4129a794cf870e2295d3f0302eaae6f8 Mon Sep 17 00:00:00 2001 From: "C.A.M. Gerlach" Date: Sat, 15 Oct 2022 21:48:20 -0500 Subject: [PATCH 4/5] Add vchanged in inspect for Traceback & edit/indent properly --- Doc/library/inspect.rst | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/Doc/library/inspect.rst b/Doc/library/inspect.rst index 700cd9122cd34c..4dda4f28d5d96d 100644 --- a/Doc/library/inspect.rst +++ b/Doc/library/inspect.rst @@ -1206,12 +1206,13 @@ is considered deprecated and may be removed in the future. number, start column offset, and end column offset associated with the instruction being executed by the frame this record corresponds to. -.. versionchanged:: 3.5 - Return a named tuple instead of a tuple. + .. versionchanged:: 3.5 + Return a :term:`named tuple` instead of a :class:`tuple`. + + .. versionchanged:: 3.11 + :class:`!FrameInfo` is now a class instance + (that is backwards compatible with the previous :term:`named tuple`). -.. versionchanged:: 3.11 - Changed the return object from a named tuple to a regular object (that is - backwards compatible with the previous named tuple). .. class:: Traceback @@ -1245,6 +1246,11 @@ is considered deprecated and may be removed in the future. the instruction being executed by the frame this traceback corresponds to. + .. versionchanged:: 3.11 + :class:`!Traceback` is now a class instance + (that is backwards compatible with the previous :term:`named tuple`). + + .. note:: Keeping references to frame objects, as found in the first element of the frame From 4b7ac248bc768e552f492f333530634989022f5e Mon Sep 17 00:00:00 2001 From: "C.A.M. Gerlach" Date: Sat, 15 Oct 2022 21:54:10 -0500 Subject: [PATCH 5/5] Add missing versionadded to inspect.ismethodwrapper & fix Sphinx syntax --- Doc/library/inspect.rst | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Doc/library/inspect.rst b/Doc/library/inspect.rst index 4dda4f28d5d96d..44f1ae04c9e39e 100644 --- a/Doc/library/inspect.rst +++ b/Doc/library/inspect.rst @@ -434,8 +434,10 @@ attributes: Return ``True`` if the type of object is a :class:`~types.MethodWrapperType`. - These are instances of :class:`~types.MethodWrapperType`, such as :meth:`~object().__str__`, - :meth:`~object().__eq__` and :meth:`~object().__repr__` + These are instances of :class:`~types.MethodWrapperType`, such as :meth:`~object.__str__`, + :meth:`~object.__eq__` and :meth:`~object.__repr__`. + + .. versionadded:: 3.11 .. function:: isroutine(object) pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy