summaryrefslogtreecommitdiffstats
path: root/Modules/ossaudiodev.c
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>2003-06-02 14:11:45 (GMT)
committerGuido van Rossum <guido@python.org>2003-06-02 14:11:45 (GMT)
commitf39dafb10a9c8b5d53c79f60ccf1bec77cc376a3 (patch)
tree0481d3b23a2099d2182f91e4f0560a45caaf9021 /Modules/ossaudiodev.c
parent01e32731649738b560f38cc7a17f4a20e64ea0b0 (diff)
downloadcpython-f39dafb10a9c8b5d53c79f60ccf1bec77cc376a3.zip
cpython-f39dafb10a9c8b5d53c79f60ccf1bec77cc376a3.tar.gz
cpython-f39dafb10a9c8b5d53c79f60ccf1bec77cc376a3.tar.bz2
Fix a subtle decref bug that caused a GC assertion to fail in a debug
build (assert(gc->gc.gc_refs != 0) in visit_decref()). Because OSSAudioError is a global, we must compensate (twice!) for PyModule_AddObject()'s "helpful" decref of the object it adds.
Diffstat (limited to 'Modules/ossaudiodev.c')
-rw-r--r--Modules/ossaudiodev.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/Modules/ossaudiodev.c b/Modules/ossaudiodev.c
index 40c328c..c19f2e0 100644
--- a/Modules/ossaudiodev.c
+++ b/Modules/ossaudiodev.c
@@ -938,6 +938,9 @@ initossaudiodev(void)
OSSAudioError = PyErr_NewException("ossaudiodev.OSSAudioError", NULL, NULL);
if (OSSAudioError) {
+ /* Each call to PyModule_AddObject decrefs it; compensate: */
+ Py_INCREF(OSSAudioError);
+ Py_INCREF(OSSAudioError);
PyModule_AddObject(m, "error", OSSAudioError);
PyModule_AddObject(m, "OSSAudioError", OSSAudioError);
}