Closed mattip closed 1 year ago
@fangerer
I am confused why I needed to add the mappings to hpy/tools/autogen/conf.py
. I thought as long as the function name is H
+ <cpython name>
, then the ctx_<name>
functions would be generated automatically. What did I miss?
I am confused why I needed to add the mappings to
hpy/tools/autogen/conf.py
. I thought as long as the function name isH
+<cpython name>
, then thectx_<name>
functions would be generated automatically. What did I miss?
What I've overlooked (Monday morning is no good time for reviewing 😄 ): You should not specify
'HPyContextVar_New': None,
'HPyContextVar_Set': None
Just remove those lines since we want to have the auto-generated trampolines for them.
Only cppcheck is failing. Here is the rendered doc page (without formatting), does that read OK?
TBD
Add the function to hpy/tools/autogen/public_api.h
. If the CPython
equivalent function name is not the same (after removing the leading H
,
add an appropriate CPython function mapping in hpy/tools/autogen/conf.py
.
If the signature is complicated or there is no clear equivalent function,
the mapping should be None
, and follow the directions in the next step.
Otherwise all the needed functions will be autogenerated.
If the function cannot be autogenerated (i.e. the mapping does not exist),
you must write the wrapper by hand. Add the function to NO_WRAPPER
in
hpy/tools/autogen/debug.py
, and add a ctx_fname
function to
hyp/devel/src/runtime/*.c
(possibly adding the new file to setup.py
),
add a debug wrapper to hpy/debug/src/debug_ctx.c
, add a implementation
that uses the ctx variant to hpy/devel/include/hpy/cpython/misc.h
and
add the declaration to hpy/devel/include/hpy/runtime/ctx_funcs.h
.
Run make autogen
which will turn the mapping into autogenerated functions
Add a test for the functionality
Build with python setup.py build_ext
. After that works, build with
python -m pip install -e .
, then run the test with python -m pytest ...
.
After the last commit to #407, there were some test failures.
When I rerun
make autogen
, it removes the implementation ofctx_ContextVar_New
andctx_ContextVar_Set
, which then breaks the build. If I restore the mappings inhpy/tools/autogen/conf.py
, then the build succeeds.Also there was a problem with doc building.