[New-bugs-announce] [issue39946] Is it time to remove _PyThreadState_GetFrame() hook?

STINNER Victor report at bugs.python.org
Thu Mar 12 13:40:48 EDT 2020


New submission from STINNER Victor <vstinner at python.org>:

Python has an internal function to get the frame of the PyThreadState:

/* hook for PyEval_GetFrame(), requested for Psyco */
#define _PyThreadState_GetFrame _PyRuntime.gilstate.getframe

It is used by the public function PyEval_GetFrame() for example.


The indirection was added in 2002 by:

commit 019a78e76d3542d4d56a08015e6980f8c8aeaba1
Author: Michael W. Hudson <mwh at python.net>
Date:   Fri Nov 8 12:53:11 2002 +0000

    Assorted patches from Armin Rigo:
    
    [ 617309 ] getframe hook (Psyco #1)
    [ 617311 ] Tiny profiling info (Psyco #2)
    [ 617312 ] debugger-controlled jumps (Psyco #3)
    
    These are forward ports from 2.2.2.


... but psyco is outdated for a very long time (superseded by PyPy which is no longer based on CPython). Is it time to drop _PyThreadState_GetFrame() (which became _PyRuntime.gilstate.getframe in the meanwhile)?

Or if we keep it, we should use it rather accessing directly PyThreadState.frame (read or write).

See also PEP 523 "Adding a frame evaluation API to CPython" and a recent discussion on this PEP: bpo-38500.

----------
components: Interpreter Core
messages: 364031
nosy: vstinner
priority: normal
severity: normal
status: open
title: Is it time to remove _PyThreadState_GetFrame() hook?
versions: Python 3.9

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue39946>
_______________________________________


More information about the New-bugs-announce mailing list