Changeset 673d7e3


Ignore:
Timestamp:
Jun 29, 2019, 12:42:36 PM (3 months ago)
Author:
Paul Brossier <piem@piem.org>
Branches:
feature/autosink, feature/timestretch, master
Children:
843b22f
Parents:
841ceed
Message:

[py] fix reference counting of exception types (thanks @wackou)

Commit 8bfef30 exposed a reference counting error, causing the
interpreter to crash before exiting. The solution is to incref the
exception type before calling PyErr_Restore.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • python/ext/py-filter.c

    r841ceed r673d7e3  
    164164      PyObject *type, *value, *traceback;
    165165      PyErr_Fetch(&type, &value, &traceback);
    166       PyErr_Restore(PyExc_ValueError, value, traceback);
     166      Py_XDECREF(type);
     167      type = PyExc_ValueError;
     168      Py_XINCREF(type);
     169      PyErr_Restore(type, value, traceback);
    167170    }
    168171    return NULL;
     
    189192      PyObject *type, *value, *traceback;
    190193      PyErr_Fetch(&type, &value, &traceback);
    191       PyErr_Restore(PyExc_ValueError, value, traceback);
     194      Py_XDECREF(type);
     195      type = PyExc_ValueError;
     196      Py_XINCREF(type);
     197      PyErr_Restore(type, value, traceback);
    192198    }
    193199    return NULL;
     
    214220      PyObject *type, *value, *traceback;
    215221      PyErr_Fetch(&type, &value, &traceback);
    216       PyErr_Restore(PyExc_ValueError, value, traceback);
     222      Py_XDECREF(type);
     223      type = PyExc_ValueError;
     224      Py_XINCREF(type);
     225      PyErr_Restore(type, value, traceback);
    217226    }
    218227    return NULL;
Note: See TracChangeset for help on using the changeset viewer.