Sha256: 6683553b923fcdc8e3a456f94a7da557ece2428b818a7a8f13ea23794f6f337f

Contents?: true

Size: 562 Bytes

Versions: 2

Compression:

Stored size: 562 Bytes

Contents

#include "rp_error.h"

VALUE ePythonError;

void rp_pythonerror()
{
	PyObject *pType,*pValue,*pTraceback;
	PyObject *pTypeName;
	PyErr_Fetch(&pType,&pValue,&pTraceback);
	pTypeName=PyObject_GetAttrString(pType,"__name__");
	Py_XDECREF(pType);
	rb_raise(ePythonError,"%s:(%s)\n",STR2CSTR(ptor_obj(pTypeName)),STR2CSTR(ptor_obj(pValue)));
	Py_XDECREF(pTraceback);
}

/*
Used to pass error information back into Ruby should an error occur in the embedded Python
interpreter.
*/
void Init_RubyPyError()
{
	ePythonError=rb_define_class("PythonError",rb_eException);
}

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rubypython-0.2.0 ext/rubypython_bridge/rp_error.c
rubypython-0.2.1 ext/rubypython_bridge/rp_error.c