diff options
author | Mark Shannon <mark@hotpy.org> | 2023-04-12 12:04:55 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-04-12 12:04:55 +0100 |
commit | 411b1692811b2ecac59cb0df0f920861c7cf179a (patch) | |
tree | 64f7234e9d35623565ff1bb7fbd2c4688e8d3774 /Python/sysmodule.c | |
parent | dce2d38cb04b541bad477ccc1040a68fa70a9a69 (diff) | |
download | cpython-411b1692811b2ecac59cb0df0f920861c7cf179a.tar.gz cpython-411b1692811b2ecac59cb0df0f920861c7cf179a.zip |
GH-103082: Implementation of PEP 669: Low Impact Monitoring for CPython (GH-103083)
* The majority of the monitoring code is in instrumentation.c
* The new instrumentation bytecodes are in bytecodes.c
* legacy_tracing.c adapts the new API to the old sys.setrace and sys.setprofile APIs
Diffstat (limited to 'Python/sysmodule.c')
-rw-r--r-- | Python/sysmodule.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/Python/sysmodule.c b/Python/sysmodule.c index f1a294de598..4d693a1be1f 100644 --- a/Python/sysmodule.c +++ b/Python/sysmodule.c @@ -3409,6 +3409,7 @@ error: return _PyStatus_ERR("can't set preliminary stderr"); } +PyObject *_Py_CreateMonitoringObject(void); /* Create sys module without all attributes. _PySys_UpdateConfig() should be called later to add remaining attributes. */ @@ -3458,6 +3459,16 @@ _PySys_Create(PyThreadState *tstate, PyObject **sysmod_p) goto error; } + PyObject *monitoring = _Py_CreateMonitoringObject(); + if (monitoring == NULL) { + goto error; + } + int err = PyDict_SetItemString(sysdict, "monitoring", monitoring); + Py_DECREF(monitoring); + if (err < 0) { + goto error; + } + assert(!_PyErr_Occurred(tstate)); *sysmod_p = sysmod; |