1
0
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:
Skoader
2012-04-22 15:54:23 +10:00
parent 82857fb0bb
commit 0e154ffb4b
6 changed files with 24 additions and 10 deletions

View File

@ -153,13 +153,13 @@ PyFunction_SetClosure(PyObject *op, PyObject *closure)
static PyMemberDef func_memberlist[] = {
{"func_closure", T_OBJECT, OFF(func_closure),
RESTRICTED|READONLY},
{"func_doc", T_OBJECT, OFF(func_doc), WRITE_RESTRICTED},
{"__doc__", T_OBJECT, OFF(func_doc), WRITE_RESTRICTED},
{"func_doc", T_OBJECT, OFF(func_doc), PY_WRITE_RESTRICTED},
{"__doc__", T_OBJECT, OFF(func_doc), PY_WRITE_RESTRICTED},
{"func_globals", T_OBJECT, OFF(func_globals),
RESTRICTED|READONLY},
{"func_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 */
};

View File

@ -189,7 +189,7 @@ static PyGetSetDef meth_getsets [] = {
#define OFF(x) offsetof(PyCFunctionObject, x)
static PyMemberDef meth_members[] = {
{"__module__", T_OBJECT, OFF(m_module), WRITE_RESTRICTED},
{"__module__", T_OBJECT, OFF(m_module), PY_WRITE_RESTRICTED},
{NULL}
};

View File

@ -1693,6 +1693,23 @@ PyOS_getsig(int sig)
return context.sa_handler;
#else
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);
signal(sig, handler);
return handler;

View File

@ -177,7 +177,7 @@ PyMember_SetOne(char *addr, PyMemberDef *l, PyObject *v)
PyErr_SetString(PyExc_TypeError, "readonly attribute");
return -1;
}
if ((l->flags & WRITE_RESTRICTED) && PyEval_GetRestricted()) {
if ((l->flags & PY_WRITE_RESTRICTED) && PyEval_GetRestricted()) {
PyErr_SetString(PyExc_RuntimeError, "restricted attribute");
return -1;
}

View File

@ -76,8 +76,8 @@ typedef struct PyMemberDef {
#define READONLY 1
#define RO READONLY /* Shorthand */
#define READ_RESTRICTED 2
#define WRITE_RESTRICTED 4
#define RESTRICTED (READ_RESTRICTED | WRITE_RESTRICTED)
#define PY_WRITE_RESTRICTED 4
#define RESTRICTED (READ_RESTRICTED | PY_WRITE_RESTRICTED)
/* Obsolete API, for binary backwards compatibility */

View File

@ -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 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 Py_UNICODE_SIZE SIZEOF_SHORT