Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add PyFrame_SetLineNumber() for Cython #118720

Open
methane opened this issue May 7, 2024 · 1 comment
Open

Add PyFrame_SetLineNumber() for Cython #118720

methane opened this issue May 7, 2024 · 1 comment
Labels
topic-C-API type-feature A feature request or enhancement

Comments

@methane
Copy link
Member

methane commented May 7, 2024

Feature or enhancement

Proposal:

CPython hides PyFrameObject internals so Cython include pycore_frame.h to set f_lineno.
Let's provide PyFrame_SetLineNumber() for Cython.

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:

#117551 (comment)

@methane methane added type-feature A feature request or enhancement topic-C-API labels May 7, 2024
@Ben4C
Copy link

Ben4C commented Aug 14, 2024

Hello, I've been working on this for a little while, but I'm a bit lost on implementing the changes.

From what I understand think I'm supposed to create a public API to set the f_fileno variable so I used PyAPI_FUNC(int) PyFrame_SetLineNumber(PyFrameObject *f, int lineno) in Include/cpython/frameobject.h which uses frame_setlineno from frameobject.c to change the f_lineno. I've been trying to get a test to pass to verify that this works in
Lib/test/test_frame.py but I'm not sure if my approach or logic is correct.

This is what I have so far: Ben4C@1e82093

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic-C-API type-feature A feature request or enhancement
Projects
None yet
Development

No branches or pull requests

2 participants