Source

pypy / pypy / module / cpyext / src / pythonrun.c

Full commit

#include "Python.h"

#ifdef MS_WINDOWS
#include "malloc.h" /* for alloca */
#include "windows.h"
#endif

void
Py_FatalError(const char *msg)
{
	fprintf(stderr, "Fatal Python error: %s\n", msg);
	fflush(stderr); /* it helps in Windows debug build */

#ifdef MS_WINDOWS
	{
		size_t len = strlen(msg);
		WCHAR* buffer;
		size_t i;

		/* Convert the message to wchar_t. This uses a simple one-to-one
		conversion, assuming that the this error message actually uses ASCII
		only. If this ceases to be true, we will have to convert. */
		buffer = alloca( (len+1) * (sizeof *buffer));
		for( i=0; i<=len; ++i)
			buffer[i] = msg[i];
		OutputDebugStringW(L"Fatal Python error: ");
		OutputDebugStringW(buffer);
		OutputDebugStringW(L"\n");
	}
#ifdef _DEBUG
	DebugBreak();
#endif
#endif /* MS_WINDOWS */
	abort();
}

void Py_Initialize(void) {

    char *errmsg = RPython_StartupCode();
    if (errmsg) {
        fprintf(stderr, "unable to initialize PyPy: %s\n", errmsg);
        abort();
        return;
    }

    PyPy_Initialize();

}