Closed steve-s closed 1 year ago
This has a merge conflict. Is it ready for review?
I've rebased the PR and it's ready for a review now.
@antocuni would you have some spare cycles for a review :-)?
This has conflicts.
Proactively rebased on top of https://github.com/hpyproject/hpy/pull/402 to streamline merging of both PRs
Could you describe under what cases the checks might fail? What is the scenario that would cause someone to get the wrong context?
Could you describe under what cases the checks might fail? What is the scenario that would cause someone to get the wrong context?
What this aims to prevent is a situation when someone misunderstands the contract of HPy and stashes context into some global variable to read it later in a context of another new Python->HPy call. For example, in the test:
on this line it uses global variable keep
as HPyContext
, but it should use the ctx
argument.
Thanks @steve-s
Based on WIP in https://github.com/hpyproject/hpy/pull/350 done with @NiRit100 at the HPy sprint
is_valid
and all the context functions check this flag as the first thing.is_valid
flagdebug_ctx_CallRealFunctionFromTrampoline
) takes next context from the buffer, setsis_valid=false
for the previous context andis_valid=true
for the context to be used (after the call the flags are reverted back)