Author vstinner
Recipients ned.deily, vstinner, yselivanov
Date 2018-06-08.00:06:50
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1528416412.66.0.592728768989.issue33803@psf.upfronthosting.co.za>
In-reply-to
Content
One solution to trigger so crash more frequently is to reduce the threshold of the generation 0 of the garbage collector.

Here is a patch to do that when using -X dev: change the default threshold from 700 to 5 for the generation 0.

With this patch, "PYTHONDEVMODE=1 python -m test test_context" does also crash as expected.

diff --git a/Python/pylifecycle.c b/Python/pylifecycle.c
index 958219b744..81218fb964 100644
--- a/Python/pylifecycle.c
+++ b/Python/pylifecycle.c
@@ -622,6 +622,10 @@ _Py_InitializeCore(const _PyCoreConfig *core_config)
         return _Py_INIT_ERR("runtime core already initialized");
     }
 
+    if (core_config->dev_mode) {
+        _PyRuntime.gc.generations[0].threshold = 5;
+    }
+
     /* Py_Finalize leaves _Py_Finalizing set in order to help daemon
      * threads behave a little more gracefully at interpreter shutdown.
      * We clobber it here so the new interpreter can start with a clean
History
Date User Action Args
2018-06-08 00:06:52vstinnersetrecipients: + vstinner, ned.deily, yselivanov
2018-06-08 00:06:52vstinnersetmessageid: <1528416412.66.0.592728768989.issue33803@psf.upfronthosting.co.za>
2018-06-08 00:06:52vstinnerlinkissue33803 messages
2018-06-08 00:06:50vstinnercreate