mirror of
https://foundry.openuru.org/gitblit/r/CWE-ou-minkata.git
synced 2025-07-20 12:19:10 +00:00
Update Python 2.3 for MSVC10
Rename WRITE_RESTRICTED due to a collision with windows headers. Remove PY_UNICODE_TYPE from config header. unicodeobject.h should define this correctly. Add special signal handling for MSVC8 and up.
This commit is contained in:
@ -153,13 +153,13 @@ PyFunction_SetClosure(PyObject *op, PyObject *closure)
|
|||||||
static PyMemberDef func_memberlist[] = {
|
static PyMemberDef func_memberlist[] = {
|
||||||
{"func_closure", T_OBJECT, OFF(func_closure),
|
{"func_closure", T_OBJECT, OFF(func_closure),
|
||||||
RESTRICTED|READONLY},
|
RESTRICTED|READONLY},
|
||||||
{"func_doc", T_OBJECT, OFF(func_doc), WRITE_RESTRICTED},
|
{"func_doc", T_OBJECT, OFF(func_doc), PY_WRITE_RESTRICTED},
|
||||||
{"__doc__", T_OBJECT, OFF(func_doc), WRITE_RESTRICTED},
|
{"__doc__", T_OBJECT, OFF(func_doc), PY_WRITE_RESTRICTED},
|
||||||
{"func_globals", T_OBJECT, OFF(func_globals),
|
{"func_globals", T_OBJECT, OFF(func_globals),
|
||||||
RESTRICTED|READONLY},
|
RESTRICTED|READONLY},
|
||||||
{"func_name", T_OBJECT, OFF(func_name), READONLY},
|
{"func_name", T_OBJECT, OFF(func_name), READONLY},
|
||||||
{"__name__", T_OBJECT, OFF(func_name), READONLY},
|
{"__name__", T_OBJECT, OFF(func_name), READONLY},
|
||||||
{"__module__", T_OBJECT, OFF(func_module), WRITE_RESTRICTED},
|
{"__module__", T_OBJECT, OFF(func_module), PY_WRITE_RESTRICTED},
|
||||||
{NULL} /* Sentinel */
|
{NULL} /* Sentinel */
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -189,7 +189,7 @@ static PyGetSetDef meth_getsets [] = {
|
|||||||
#define OFF(x) offsetof(PyCFunctionObject, x)
|
#define OFF(x) offsetof(PyCFunctionObject, x)
|
||||||
|
|
||||||
static PyMemberDef meth_members[] = {
|
static PyMemberDef meth_members[] = {
|
||||||
{"__module__", T_OBJECT, OFF(m_module), WRITE_RESTRICTED},
|
{"__module__", T_OBJECT, OFF(m_module), PY_WRITE_RESTRICTED},
|
||||||
{NULL}
|
{NULL}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1693,6 +1693,23 @@ PyOS_getsig(int sig)
|
|||||||
return context.sa_handler;
|
return context.sa_handler;
|
||||||
#else
|
#else
|
||||||
PyOS_sighandler_t handler;
|
PyOS_sighandler_t handler;
|
||||||
|
/* Special signal handling for the secure CRT in Visual Studio 2005 */
|
||||||
|
#if defined(_MSC_VER) && _MSC_VER >= 1400
|
||||||
|
switch (sig) {
|
||||||
|
/* Only these signals are valid */
|
||||||
|
case SIGINT:
|
||||||
|
case SIGILL:
|
||||||
|
case SIGFPE:
|
||||||
|
case SIGSEGV:
|
||||||
|
case SIGTERM:
|
||||||
|
case SIGBREAK:
|
||||||
|
case SIGABRT:
|
||||||
|
break;
|
||||||
|
/* Don't call signal() with other values or it will assert */
|
||||||
|
default:
|
||||||
|
return SIG_ERR;
|
||||||
|
}
|
||||||
|
#endif /* _MSC_VER && _MSC_VER >= 1400 */
|
||||||
handler = signal(sig, SIG_IGN);
|
handler = signal(sig, SIG_IGN);
|
||||||
signal(sig, handler);
|
signal(sig, handler);
|
||||||
return handler;
|
return handler;
|
||||||
|
@ -177,7 +177,7 @@ PyMember_SetOne(char *addr, PyMemberDef *l, PyObject *v)
|
|||||||
PyErr_SetString(PyExc_TypeError, "readonly attribute");
|
PyErr_SetString(PyExc_TypeError, "readonly attribute");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if ((l->flags & WRITE_RESTRICTED) && PyEval_GetRestricted()) {
|
if ((l->flags & PY_WRITE_RESTRICTED) && PyEval_GetRestricted()) {
|
||||||
PyErr_SetString(PyExc_RuntimeError, "restricted attribute");
|
PyErr_SetString(PyExc_RuntimeError, "restricted attribute");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
@ -76,8 +76,8 @@ typedef struct PyMemberDef {
|
|||||||
#define READONLY 1
|
#define READONLY 1
|
||||||
#define RO READONLY /* Shorthand */
|
#define RO READONLY /* Shorthand */
|
||||||
#define READ_RESTRICTED 2
|
#define READ_RESTRICTED 2
|
||||||
#define WRITE_RESTRICTED 4
|
#define PY_WRITE_RESTRICTED 4
|
||||||
#define RESTRICTED (READ_RESTRICTED | WRITE_RESTRICTED)
|
#define RESTRICTED (READ_RESTRICTED | PY_WRITE_RESTRICTED)
|
||||||
|
|
||||||
|
|
||||||
/* Obsolete API, for binary backwards compatibility */
|
/* Obsolete API, for binary backwards compatibility */
|
||||||
|
@ -414,9 +414,6 @@ Py_NO_ENABLE_SHARED to find out. Also support MS_NO_COREDLL for b/w compat */
|
|||||||
/* Define if you want to have a Unicode type. */
|
/* Define if you want to have a Unicode type. */
|
||||||
#define Py_USING_UNICODE
|
#define Py_USING_UNICODE
|
||||||
|
|
||||||
/* Define as the integral type used for Unicode representation. */
|
|
||||||
#define PY_UNICODE_TYPE unsigned short
|
|
||||||
|
|
||||||
/* Define as the size of the unicode type. */
|
/* Define as the size of the unicode type. */
|
||||||
#define Py_UNICODE_SIZE SIZEOF_SHORT
|
#define Py_UNICODE_SIZE SIZEOF_SHORT
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user