Allow `FrameType` to be instantiated
Dieses Issue hat noch niemand übernommen.
- Vorherrschende Sprache
- Python
- Sterne
- 77.2k
- Forks
- 35.9k
- PR-Merge-Kennzahlen
- PR-Kennzahlen ausstehend
Beschreibung
Feature or enhancement
Proposal:
For some reason, FrameType is not allowed to be instantiated. This creates problems when trying to (for example) control an exception traceback, which is common for debuggers, among other uses. This is also inconsistant with most other internal types that exposed to Python and in the types module.
The only reason I can think of is because PyFrame_New requires a PyThreadState object, which is not exposed to Python. However, there are several ways around this:
- Run
PyThreadState_GetUnchecked, raisingRuntimeError(or another error) ifNULLis returned - Expose frames'
PyThreadStateto the interpreter - Pass another frame as a parameter, and get its thread state
This should be relatively trivial to implement and I can't think of any downsides, backwards compatibility concerns, or maintenance overhead. I can probably write a PR if one of the solutions to the thread state parameter is decided.
Has this already been discussed elsewhere?
This is a minor feature, which does not need previous discussion elsewhere
Links to previous discussion of this feature:
No response
Beitragsleitfaden
Erste Schritte
- Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
- Forke das Repository und arbeite in einem Branch.
- Öffne einen Pull Request, der die Issue-Nummer nennt.
Rechercherichtung
Beginne mit der Überprüfung des Instanziierungspfads von FrameType und der im Issue genannten Einstiegspunkte PyFrame_New und PyThreadState_GetUnchecked. Entscheide, wie die Instanziierung einen Thread-Zustand erhalten oder validieren soll, und bestätige anschließend, dass FrameType aus Python erstellt werden kann, ohne die genannten Traceback- und Debugger-Anwendungsfälle zu beeinträchtigen.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- python
- Bereich
- backend-api-design
- Issue-Typ
- Feature
- Schwierigkeit
- 5/5
- Geschätzter Aufwand
- Über eine Woche
- Aktivitätsstatus
- Ruhig
- Klarheit
- Größtenteils klar
- Anfängerfreundlichkeit
- 45/100