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

PyCode_Addr2Location bogus assert(?) or invalid branch? #95060

Closed
Fidget-Spinner opened this issue Jul 20, 2022 · 3 comments
Closed

PyCode_Addr2Location bogus assert(?) or invalid branch? #95060

Fidget-Spinner opened this issue Jul 20, 2022 · 3 comments
Assignees
Labels
3.11 only security fixes 3.12 bugs and security fixes type-bug An unexpected behavior, bug, or error

Comments

@Fidget-Spinner
Copy link
Member

In https://github.com/python/cpython/blob/main/Objects/codeobject.c#L971-L975, addrq < 0 is a condition but the assert following the branch fails when addrq < 0. This causes mypyc to segfault on 3.11 debug.

@Fidget-Spinner Fidget-Spinner added the type-bug An unexpected behavior, bug, or error label Jul 20, 2022
@Fidget-Spinner Fidget-Spinner added 3.11 only security fixes 3.12 bugs and security fixes labels Jul 20, 2022
@Fidget-Spinner
Copy link
Member Author

I think the branch is supposed to return 0 or 1. (Not sure which).

@markshannon
Copy link
Member

There are no tests for PyCode_Addr2Location and it is undocumented. 🤷

Returning 0 with an exception if addrq < 0 seems the better API, but at this stage in 3.11, returning 1 for success seems safer.

@markshannon
Copy link
Member

Returning 1 seems consistent with the original implementation for #88116, so let's go with that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3.11 only security fixes 3.12 bugs and security fixes type-bug An unexpected behavior, bug, or error
Projects
None yet
Development

No branches or pull requests

2 participants