#define TOP_HISTORY_PY "--- top of history ---"
#define BEGIN_HISTORY_PY "--- begin of history ---"
-#if PY_VERSION_HEX < 0x03050000
-static wchar_t*
-Py_DecodeLocale(const char *arg, size_t *size)
-{
- wchar_t *res;
- unsigned char *in;
- wchar_t *out;
- size_t argsize = strlen(arg) + 1;
-
- if (argsize > PY_SSIZE_T_MAX/sizeof(wchar_t))
- return NULL;
- res = (wchar_t*) PyMem_RawMalloc(argsize*sizeof(wchar_t));
- if (!res)
- return NULL;
-
- in = (unsigned char*)arg;
- out = res;
- while(*in)
- if(*in < 128)
- *out++ = *in++;
- else
- *out++ = 0xdc00 + *in++;
- *out = 0;
- if (size != NULL)
- *size = out - res;
- return res;
-}
-#endif
-
/*
The following functions are used to hook the Python
interpreter output.
PyStdOut_write(PyStdOut *self, PyObject *args)
{
char *c;
- int l;
- if (!PyArg_ParseTuple(args, "t#:write",&c, &l))
+ if (!PyArg_ParseTuple(args, "s",&c))
return NULL;
if(self->_cb==NULL) {
if ( self->_iscerr )
0, /*tp_new*/
0, /*tp_free*/
0, /*tp_is_gc*/
+ 0, /*tp_bases*/
+ 0, /*tp_mro*/
+ 0, /*tp_cache*/
+ 0, /*tp_subclasses*/
+ 0, /*tp_weaklist*/
+ 0, /*tp_del*/
+ 0, /*tp_version_tag*/
+ 0 /*tp_finalize*/
};
#define PyStdOut_Check(v) ((v)->ob_type == &PyStdOut_Type)
PySys_SetArgv(_argc, changed_argv);
PyEval_InitThreads(); // Create (and acquire) the Python global interpreter lock (GIL)
- PyEval_ReleaseLock();
+ PyEval_SaveThread(); // release safely GIL
}
}