summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNed Batchelder <ned@nedbatchelder.com>2016-12-29 06:58:09 -0500
committerNed Batchelder <ned@nedbatchelder.com>2016-12-29 06:58:09 -0500
commitc1fb25db7855b9269fb907651f6f4efb60364438 (patch)
treee083693669b3bcf3c7e011345eab8794e06514a8
parentff7b338c99361b461281e70fa76d7d4f3736fc91 (diff)
downloadpython-coveragepy-c1fb25db7855b9269fb907651f6f4efb60364438.tar.gz
Prevent a hard crash when starting coverage thousands of times
-rw-r--r--CHANGES.rst4
-rw-r--r--CONTRIBUTORS.txt1
-rw-r--r--coverage/ctracer/tracer.c1
3 files changed, 5 insertions, 1 deletions
diff --git a/CHANGES.rst b/CHANGES.rst
index d63388d..d502612 100644
--- a/CHANGES.rst
+++ b/CHANGES.rst
@@ -9,7 +9,9 @@ Change history for Coverage.py
Unreleased
----------
-Nothing yet.
+- If you started and stopped coverage measurement thousands of times in your
+ process, you could crash Python with a "Fatal Python error: deallocating
+ None" error. This is now fixed. Thanks to Alex Groce for the bug report.
Version 4.3.1 --- 2016-12-28
diff --git a/CONTRIBUTORS.txt b/CONTRIBUTORS.txt
index fbbef00..e293db7 100644
--- a/CONTRIBUTORS.txt
+++ b/CONTRIBUTORS.txt
@@ -6,6 +6,7 @@ useful bug reports, have been made by:
Adi Roiban
Alex Gaynor
+Alex Groce
Alexander Todorov
Andrew Hoos
Anthony Sottile
diff --git a/coverage/ctracer/tracer.c b/coverage/ctracer/tracer.c
index 8abb60a..a517327 100644
--- a/coverage/ctracer/tracer.c
+++ b/coverage/ctracer/tracer.c
@@ -74,6 +74,7 @@ CTracer_init(CTracer *self, PyObject *args_unused, PyObject *kwds_unused)
self->cur_entry.last_line = -1;
self->context = Py_None;
+ Py_INCREF(self->context);
ret = RET_OK;
goto ok;