diff options
author | Guido van Rossum <guido@python.org> | 2003-06-02 14:11:45 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 2003-06-02 14:11:45 (GMT) |
commit | f39dafb10a9c8b5d53c79f60ccf1bec77cc376a3 (patch) | |
tree | 0481d3b23a2099d2182f91e4f0560a45caaf9021 | |
parent | 01e32731649738b560f38cc7a17f4a20e64ea0b0 (diff) | |
download | cpython-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.
-rw-r--r-- | Modules/ossaudiodev.c | 3 |
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); } |