Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix shadow instance creation failure in Python 3 #137

Merged
merged 1 commit into from Feb 16, 2014

Commits on Feb 15, 2014

  1. Fix shadow instance creation failure in Python 3

    I managed to trace a very nasty Python interpreter segfault to an
    allocation failure here. Adding this after the tp_new call:
    if (PyErr_Occurred()) {
        PyErr_Print();
    }
    
    results in output of 'TypeError: object() takes no parameters', followed
    by a segfault that takes down the Python interpeter.
    
    The 'object' constructor doesn't seem to be suitable for instantiating
    SWIG shadow instances in this way, so simply use the constructor
    function in the PyTypeObject 'tp_new' slot of data->newargs.
    
    The 'if (inst)' check after this doesn't hurt in as much as it prevented
    a segfault immediately after this failed allocation, but it doesn't help
    much since the null pointer dereference will probably happen sooner or
    later anyway.
    hfalcic committed Feb 15, 2014
    Configuration menu
    Copy the full SHA
    c063bb8 View commit details
    Browse the repository at this point in the history