]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
bpo-40421: Cleanup PyFrame C API (GH-32417)
authorVictor Stinner <vstinner@python.org>
Tue, 19 Apr 2022 07:53:10 +0000 (09:53 +0200)
committerGitHub <noreply@github.com>
Tue, 19 Apr 2022 07:53:10 +0000 (09:53 +0200)
Doc/c-api/frame.rst
Misc/NEWS.d/next/C API/2022-04-08-11-29-36.bpo-40421.H0ORmT.rst
Objects/frameobject.c

index 68e5dc6daeaec7ee966af6d3a2afed3e65671ca6..46ce700abf14748533bbb7b2ac6764f2f9cba4e8 100644 (file)
@@ -27,8 +27,6 @@ See also :ref:`Reflection <reflection>`.
    Return a :term:`strong reference`, or ``NULL`` if *frame* has no outer
    frame.
 
-   *frame* must not be ``NULL``.
-
    .. versionadded:: 3.9
 
 
@@ -38,8 +36,6 @@ See also :ref:`Reflection <reflection>`.
 
    Return a :term:`strong reference`. The result cannot be ``NULL``.
 
-   *frame* must not be ``NULL``.
-
    .. versionadded:: 3.11
 
 
@@ -49,7 +45,7 @@ See also :ref:`Reflection <reflection>`.
 
    Return a :term:`strong reference`.
 
-   *frame* must not be ``NULL``. The result (frame code) cannot be ``NULL``.
+   The result (frame code) cannot be ``NULL``.
 
    .. versionadded:: 3.9
 
@@ -62,8 +58,6 @@ See also :ref:`Reflection <reflection>`.
 
    Return a :term:`strong reference`, or ``NULL``.
 
-   *frame* must not be ``NULL``.
-
    .. versionadded:: 3.11
 
 
@@ -73,19 +67,15 @@ See also :ref:`Reflection <reflection>`.
 
    Return a :term:`strong reference`. The result cannot be ``NULL``.
 
-   *frame* must not be ``NULL``.
-
    .. versionadded:: 3.11
 
 
 .. c:function:: int PyFrame_GetLasti(PyFrameObject *frame)
 
-   Get the *frame*'s ``f_lasti`` attribute (:class:`dict`).
+   Get the *frame*'s ``f_lasti`` attribute.
 
    Returns -1 if ``frame.f_lasti`` is ``None``.
 
-   *frame* must not be ``NULL``.
-
    .. versionadded:: 3.11
 
 
@@ -95,13 +85,9 @@ See also :ref:`Reflection <reflection>`.
 
    Return a :term:`strong reference`.
 
-   *frame* must not be ``NULL``.
-
    .. versionadded:: 3.11
 
 
 .. c:function:: int PyFrame_GetLineNumber(PyFrameObject *frame)
 
    Return the line number that *frame* is currently executing.
-
-   *frame* must not be ``NULL``.
index 2e10c2394c933172264af64430733aed4cad0a77..d4a1dbecf28673ed0c6a38203defdca02c1faf1b 100644 (file)
@@ -1,2 +1,2 @@
-Add ``PyFrame_GetLasti`` C-API function to access frame object's ``lasti``
+Add ``PyFrame_GetLasti`` C-API function to access frame object's ``f_lasti``
 attribute safely from C code.
index dc4ef8bcda541f64393234024534d2e34ce171f4..e65395ee5f20e53beebf4f790c9b9a18d6ecf5c7 100644 (file)
@@ -1160,7 +1160,7 @@ PyFrame_GetLasti(PyFrameObject *frame)
     if (lasti < 0) {
         return -1;
     }
-    return lasti*2;
+    return lasti * sizeof(_Py_CODEUNIT);
 }
 
 PyObject *