Skip to content

Commit 25eee57

Browse files
authored
pythongh-127627: Add posix._emscripten_debugger function (python#127628)
Add a posix._emscripten_debugger function to add an emscripten breakpoint.
1 parent 8b3cccf commit 25eee57

File tree

3 files changed

+50
-2
lines changed

3 files changed

+50
-2
lines changed
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Added ``posix._emscripten_debugger()`` to help with debugging the test suite on
2+
the Emscripten target.

Modules/clinic/posixmodule.c.h

Lines changed: 27 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Modules/posixmodule.c

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,9 @@
8484
extern char * _getpty(int *, int, mode_t, int);
8585
#endif
8686

87+
#ifdef __EMSCRIPTEN__
88+
#include "emscripten.h" // emscripten_debugger()
89+
#endif
8790

8891
/*
8992
* A number of APIs are available on macOS from a certain macOS version.
@@ -16845,8 +16848,24 @@ os__create_environ_impl(PyObject *module)
1684516848
}
1684616849

1684716850

16848-
static PyMethodDef posix_methods[] = {
16851+
#ifdef __EMSCRIPTEN__
16852+
/*[clinic input]
16853+
os._emscripten_debugger
16854+
16855+
Create a breakpoint for the JavaScript debugger. Emscripten only.
16856+
[clinic start generated code]*/
16857+
16858+
static PyObject *
16859+
os__emscripten_debugger_impl(PyObject *module)
16860+
/*[clinic end generated code: output=ad47dc3bf0661343 input=d814b1877fb6083a]*/
16861+
{
16862+
emscripten_debugger();
16863+
Py_RETURN_NONE;
16864+
}
16865+
#endif /* __EMSCRIPTEN__ */
16866+
1684916867

16868+
static PyMethodDef posix_methods[] = {
1685016869
OS_STAT_METHODDEF
1685116870
OS_ACCESS_METHODDEF
1685216871
OS_TTYNAME_METHODDEF
@@ -17060,6 +17079,7 @@ static PyMethodDef posix_methods[] = {
1706017079
OS__INPUTHOOK_METHODDEF
1706117080
OS__IS_INPUTHOOK_INSTALLED_METHODDEF
1706217081
OS__CREATE_ENVIRON_METHODDEF
17082+
OS__EMSCRIPTEN_DEBUGGER_METHODDEF
1706317083
{NULL, NULL} /* Sentinel */
1706417084
};
1706517085

0 commit comments

Comments
 (0)