gh-127627: Add posix._emscripten_debugger function (#127628)

Add a posix._emscripten_debugger function to add an emscripten breakpoint.
This commit is contained in:
Hood Chatham 2024-12-06 03:47:51 +01:00 committed by GitHub
parent 8b3cccf3f9
commit 25eee578c8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 50 additions and 2 deletions

View file

@ -84,6 +84,9 @@
extern char * _getpty(int *, int, mode_t, int);
#endif
#ifdef __EMSCRIPTEN__
#include "emscripten.h" // emscripten_debugger()
#endif
/*
* A number of APIs are available on macOS from a certain macOS version.
@ -16845,8 +16848,24 @@ os__create_environ_impl(PyObject *module)
}
static PyMethodDef posix_methods[] = {
#ifdef __EMSCRIPTEN__
/*[clinic input]
os._emscripten_debugger
Create a breakpoint for the JavaScript debugger. Emscripten only.
[clinic start generated code]*/
static PyObject *
os__emscripten_debugger_impl(PyObject *module)
/*[clinic end generated code: output=ad47dc3bf0661343 input=d814b1877fb6083a]*/
{
emscripten_debugger();
Py_RETURN_NONE;
}
#endif /* __EMSCRIPTEN__ */
static PyMethodDef posix_methods[] = {
OS_STAT_METHODDEF
OS_ACCESS_METHODDEF
OS_TTYNAME_METHODDEF
@ -17060,6 +17079,7 @@ static PyMethodDef posix_methods[] = {
OS__INPUTHOOK_METHODDEF
OS__IS_INPUTHOOK_INSTALLED_METHODDEF
OS__CREATE_ENVIRON_METHODDEF
OS__EMSCRIPTEN_DEBUGGER_METHODDEF
{NULL, NULL} /* Sentinel */
};