Setting frame evaluation function (i.e.:PyInterpreterState.frame_eval)
Hi All, I'm trying to upgrade the pydevd debugger to the latest version of CPython (3.8), however I'm having some issues being able to access `PyInterpreterState.eval_frame` when compiling, so, I'd like to ask if someone can point me in the right direction. What I'm trying to do is compile something like: #include "pystate.h" ... PyThreadState *ts = PyThreadState_Get(); PyInterpreterState *interp = ts->interp; interp->eval_frame = my_frame_eval_func; and the error I'm having is: _pydevd_frame_eval/pydevd_frame_evaluator.c(7534): error C2037: left of 'eval_frame' specifies undefined struct/union '_is' So, it seems that now "pystate.h" only has a forward reference to "_is" and a typedef from " PyInterpreterState" to "_is" and "_is" is defined in "include/internal/pycore_pystate.h", which doesn't seem like I should be including (in fact, if I try to include it I get an error saying that I would need to define Py_BUILD_CORE)... so, can someone point me to the proper way to set the frame evaluation function on CPython 3.8? Thanks, Fabio
Hi Fabio,
Right, the PyInterpreterState structure is now opaque. You need to
include pycore_pystate.h which requires to define the
Py_BUILD_CORE_MODULE macro. That's the internal C API which "should
not be used", but it's ok to use it for very specific use cases, like
debuggers.
Maybe we should provide an interpreter method to set
interp->eval_frame, to avoid to pull the annoying internal C API.
Victor
Le mer. 16 oct. 2019 à 15:47, Fabio Zadrozny
Hi All,
I'm trying to upgrade the pydevd debugger to the latest version of CPython (3.8), however I'm having some issues being able to access `PyInterpreterState.eval_frame` when compiling, so, I'd like to ask if someone can point me in the right direction.
What I'm trying to do is compile something like:
#include "pystate.h" ... PyThreadState *ts = PyThreadState_Get(); PyInterpreterState *interp = ts->interp; interp->eval_frame = my_frame_eval_func;
and the error I'm having is:
_pydevd_frame_eval/pydevd_frame_evaluator.c(7534): error C2037: left of 'eval_frame' specifies undefined struct/union '_is'
So, it seems that now "pystate.h" only has a forward reference to "_is" and a typedef from " PyInterpreterState" to "_is" and "_is" is defined in "include/internal/pycore_pystate.h", which doesn't seem like I should be including (in fact, if I try to include it I get an error saying that I would need to define Py_BUILD_CORE)... so, can someone point me to the proper way to set the frame evaluation function on CPython 3.8?
Thanks,
Fabio _______________________________________________ Python-Dev mailing list -- python-dev@python.org To unsubscribe send an email to python-dev-leave@python.org https://mail.python.org/mailman3/lists/python-dev.python.org/ Message archived at https://mail.python.org/archives/list/python-dev@python.org/message/BJAO35DB... Code of Conduct: http://python.org/psf/codeofconduct/
-- Night gathers, and now my watch begins. It shall not end until my death.
On Wed, Oct 16, 2019 at 11:14 AM Victor Stinner
Hi Fabio,
Right, the PyInterpreterState structure is now opaque. You need to include pycore_pystate.h which requires to define the Py_BUILD_CORE_MODULE macro. That's the internal C API which "should not be used", but it's ok to use it for very specific use cases, like debuggers.
Maybe we should provide an interpreter method to set interp->eval_frame, to avoid to pull the annoying internal C API.
Hi Victor,
Thank you very much, that did the trick!
I agree it'd be nicer to have some method to set up the frame evaluation
function instead of pulling up the internal C API, but it's also *very*
specialized, so, I'm not sure how much it's worth it (I'm happy with just
being able to do it, even if it's not very straightforward).
Best Regards,
Fabio
Le mer. 16 oct. 2019 à 15:47, Fabio Zadrozny
Hi All,
I'm trying to upgrade the pydevd debugger to the latest version of
CPython (3.8), however I'm having some issues being able to access `PyInterpreterState.eval_frame` when compiling, so, I'd like to ask if someone can point me in the right direction.
What I'm trying to do is compile something like:
#include "pystate.h" ... PyThreadState *ts = PyThreadState_Get(); PyInterpreterState *interp = ts->interp; interp->eval_frame = my_frame_eval_func;
and the error I'm having is:
_pydevd_frame_eval/pydevd_frame_evaluator.c(7534): error C2037: left of
'eval_frame' specifies undefined struct/union '_is'
So, it seems that now "pystate.h" only has a forward reference to "_is"
and a typedef from " PyInterpreterState" to "_is" and "_is" is defined in "include/internal/pycore_pystate.h", which doesn't seem like I should be including (in fact, if I try to include it I get an error saying that I would need to define Py_BUILD_CORE)... so, can someone point me to the proper way to set the frame evaluation function on CPython 3.8?
Thanks,
Fabio _______________________________________________ Python-Dev mailing list -- python-dev@python.org To unsubscribe send an email to python-dev-leave@python.org https://mail.python.org/mailman3/lists/python-dev.python.org/ Message archived at
https://mail.python.org/archives/list/python-dev@python.org/message/BJAO35DB...
Code of Conduct: http://python.org/psf/codeofconduct/
-- Night gathers, and now my watch begins. It shall not end until my death.
Would you mind to open an issue at bugs.python.org? You can put me
("vstinner") in the nosy list.
Victor
Le mer. 16 oct. 2019 à 17:07, Fabio Zadrozny
On Wed, Oct 16, 2019 at 11:14 AM Victor Stinner
wrote: Hi Fabio,
Right, the PyInterpreterState structure is now opaque. You need to include pycore_pystate.h which requires to define the Py_BUILD_CORE_MODULE macro. That's the internal C API which "should not be used", but it's ok to use it for very specific use cases, like debuggers.
Maybe we should provide an interpreter method to set interp->eval_frame, to avoid to pull the annoying internal C API.
Hi Victor,
Thank you very much, that did the trick!
I agree it'd be nicer to have some method to set up the frame evaluation function instead of pulling up the internal C API, but it's also *very* specialized, so, I'm not sure how much it's worth it (I'm happy with just being able to do it, even if it's not very straightforward).
Best Regards,
Fabio
Le mer. 16 oct. 2019 à 15:47, Fabio Zadrozny
a écrit : Hi All,
I'm trying to upgrade the pydevd debugger to the latest version of CPython (3.8), however I'm having some issues being able to access `PyInterpreterState.eval_frame` when compiling, so, I'd like to ask if someone can point me in the right direction.
What I'm trying to do is compile something like:
#include "pystate.h" ... PyThreadState *ts = PyThreadState_Get(); PyInterpreterState *interp = ts->interp; interp->eval_frame = my_frame_eval_func;
and the error I'm having is:
_pydevd_frame_eval/pydevd_frame_evaluator.c(7534): error C2037: left of 'eval_frame' specifies undefined struct/union '_is'
So, it seems that now "pystate.h" only has a forward reference to "_is" and a typedef from " PyInterpreterState" to "_is" and "_is" is defined in "include/internal/pycore_pystate.h", which doesn't seem like I should be including (in fact, if I try to include it I get an error saying that I would need to define Py_BUILD_CORE)... so, can someone point me to the proper way to set the frame evaluation function on CPython 3.8?
Thanks,
Fabio _______________________________________________ Python-Dev mailing list -- python-dev@python.org To unsubscribe send an email to python-dev-leave@python.org https://mail.python.org/mailman3/lists/python-dev.python.org/ Message archived at https://mail.python.org/archives/list/python-dev@python.org/message/BJAO35DB... Code of Conduct: http://python.org/psf/codeofconduct/
-- Night gathers, and now my watch begins. It shall not end until my death.
-- Night gathers, and now my watch begins. It shall not end until my death.
On Wed, Oct 16, 2019 at 1:05 PM Victor Stinner
Would you mind to open an issue at bugs.python.org? You can put me ("vstinner") in the nosy list.
Done: https://bugs.python.org/issue38500
Victor
Le mer. 16 oct. 2019 à 17:07, Fabio Zadrozny
a écrit : On Wed, Oct 16, 2019 at 11:14 AM Victor Stinner
Hi Fabio,
Right, the PyInterpreterState structure is now opaque. You need to include pycore_pystate.h which requires to define the Py_BUILD_CORE_MODULE macro. That's the internal C API which "should not be used", but it's ok to use it for very specific use cases, like debuggers.
Maybe we should provide an interpreter method to set interp->eval_frame, to avoid to pull the annoying internal C API.
Hi Victor,
Thank you very much, that did the trick!
I agree it'd be nicer to have some method to set up the frame evaluation function instead of pulling up the internal C API, but it's also *very* specialized, so, I'm not sure how much it's worth it (I'm happy with just being able to do it, even if it's not very straightforward).
Best Regards,
Fabio
Le mer. 16 oct. 2019 à 15:47, Fabio Zadrozny
a écrit : Hi All,
I'm trying to upgrade the pydevd debugger to the latest version of
CPython (3.8), however I'm having some issues being able to access `PyInterpreterState.eval_frame` when compiling, so, I'd like to ask if someone can point me in the right direction.
What I'm trying to do is compile something like:
#include "pystate.h" ... PyThreadState *ts = PyThreadState_Get(); PyInterpreterState *interp = ts->interp; interp->eval_frame = my_frame_eval_func;
and the error I'm having is:
_pydevd_frame_eval/pydevd_frame_evaluator.c(7534): error C2037: left
of 'eval_frame' specifies undefined struct/union '_is'
So, it seems that now "pystate.h" only has a forward reference to
"_is" and a typedef from " PyInterpreterState" to "_is" and "_is" is defined in "include/internal/pycore_pystate.h", which doesn't seem like I should be including (in fact, if I try to include it I get an error saying
wrote: that I would need to define Py_BUILD_CORE)... so, can someone point me to the proper way to set the frame evaluation function on CPython 3.8?
Thanks,
Fabio _______________________________________________ Python-Dev mailing list -- python-dev@python.org To unsubscribe send an email to python-dev-leave@python.org https://mail.python.org/mailman3/lists/python-dev.python.org/ Message archived at
https://mail.python.org/archives/list/python-dev@python.org/message/BJAO35DB...
Code of Conduct: http://python.org/psf/codeofconduct/
-- Night gathers, and now my watch begins. It shall not end until my death.
-- Night gathers, and now my watch begins. It shall not end until my death.
participants (2)
-
Fabio Zadrozny
-
Victor Stinner