diff --git a/Modules/getpath.c b/Modules/getpath.c --- a/Modules/getpath.c +++ b/Modules/getpath.c @@ -1,5 +1,13 @@ /* Return the initial module search path. */ +#ifdef __hpux +/* Workaround for HP/UX compiler bug */ +#define HPUX_STRING_PASTE_KLUDGE_INNER(x) L ## x +#define CONV_WCHAR_T_STRING(y) HPUX_STRING_PASTE_KLUDGE_INNER(y) +#else +#define CONV_WCHAR_T_STRING(y) y +#endif + #include "Python.h" #include "osdefs.h" @@ -100,7 +108,6 @@ extern "C" { #endif - #ifndef VERSION #define VERSION "2.1" #endif @@ -135,7 +142,7 @@ static wchar_t exec_prefix[MAXPATHLEN+1] static wchar_t progpath[MAXPATHLEN+1]; static wchar_t *module_search_path = NULL; static int module_search_path_malloced = 0; -static wchar_t *lib_python = L"lib/python" VERSION; +static wchar_t *lib_python = L"lib/python" CONV_WCHAR_T_STRING(VERSION); static void reduce(wchar_t *dir) @@ -641,7 +648,7 @@ calculate_path(void) /* We can't exit, so print a warning and limp along */ fprintf(stderr, "Not enough memory for dynamic PYTHONPATH.\n"); fprintf(stderr, "Using default static PYTHONPATH.\n"); - module_search_path = L"" PYTHONPATH; + module_search_path = _Py_char2wchar(PYTHONPATH, NULL); } else { /* Run-time value of $PYTHONPATH goes first */ diff --git a/Modules/termios.c b/Modules/termios.c --- a/Modules/termios.c +++ b/Modules/termios.c @@ -1,5 +1,11 @@ /* termiosmodule.c -- POSIX terminal I/O module implementation. */ +#ifdef __hpux +/* Workaround HP/UX namespace kludges */ +#define _POSIX_SOURCE +#include +#endif + #include "Python.h" /* Apparently, on SGI, termios.h won't define CTRL if _XOPEN_SOURCE diff --git a/Objects/typeobject.c b/Objects/typeobject.c --- a/Objects/typeobject.c +++ b/Objects/typeobject.c @@ -5715,7 +5715,7 @@ update_one_slot(PyTypeObject *type, slot descr = _PyType_Lookup(type, p->name_strobj); if (descr == NULL) { if (ptr == (void**)&type->tp_iternext) { - specific = _PyObject_NextNotImplemented; + specific = (void *)_PyObject_NextNotImplemented; } continue; } @@ -5761,7 +5761,7 @@ update_one_slot(PyTypeObject *type, slot /* We specifically allow __hash__ to be set to None to prevent inheritance of the default implementation from object.__hash__ */ - specific = PyObject_HashNotImplemented; + specific = (void *)PyObject_HashNotImplemented; } else { use_generic = 1; @@ -5976,7 +5976,7 @@ add_operators(PyTypeObject *type) continue; if (PyDict_GetItem(dict, p->name_strobj)) continue; - if (*ptr == PyObject_HashNotImplemented) { + if (*ptr == (void *)PyObject_HashNotImplemented) { /* Classes may prevent the inheritance of the tp_hash slot by storing PyObject_HashNotImplemented in it. Make it visible as a None value for the __hash__ attribute. */ diff --git a/Python/Python-ast.c b/Python/Python-ast.c --- a/Python/Python-ast.c +++ b/Python/Python-ast.c @@ -2136,7 +2136,7 @@ alias(identifier name, identifier asname } -PyObject* +static PyObject* ast2obj_mod(void* _o) { mod_ty o = (mod_ty)_o; @@ -2191,7 +2191,7 @@ failed: return NULL; } -PyObject* +static PyObject* ast2obj_stmt(void* _o) { stmt_ty o = (stmt_ty)_o; @@ -2554,7 +2554,7 @@ failed: return NULL; } -PyObject* +static PyObject* ast2obj_expr(void* _o) { expr_ty o = (expr_ty)_o; @@ -2939,7 +2939,7 @@ failed: return NULL; } -PyObject* ast2obj_expr_context(expr_context_ty o) +static PyObject* ast2obj_expr_context(expr_context_ty o) { switch(o) { case Load: @@ -2966,7 +2966,7 @@ PyObject* ast2obj_expr_context(expr_cont return NULL; } } -PyObject* +static PyObject* ast2obj_slice(void* _o) { slice_ty o = (slice_ty)_o; @@ -3022,7 +3022,7 @@ failed: return NULL; } -PyObject* ast2obj_boolop(boolop_ty o) +static PyObject* ast2obj_boolop(boolop_ty o) { switch(o) { case And: @@ -3037,7 +3037,7 @@ PyObject* ast2obj_boolop(boolop_ty o) return NULL; } } -PyObject* ast2obj_operator(operator_ty o) +static PyObject* ast2obj_operator(operator_ty o) { switch(o) { case Add: @@ -3082,7 +3082,7 @@ PyObject* ast2obj_operator(operator_ty o return NULL; } } -PyObject* ast2obj_unaryop(unaryop_ty o) +static PyObject* ast2obj_unaryop(unaryop_ty o) { switch(o) { case Invert: @@ -3103,7 +3103,7 @@ PyObject* ast2obj_unaryop(unaryop_ty o) return NULL; } } -PyObject* ast2obj_cmpop(cmpop_ty o) +static PyObject* ast2obj_cmpop(cmpop_ty o) { switch(o) { case Eq: @@ -3142,7 +3142,7 @@ PyObject* ast2obj_cmpop(cmpop_ty o) return NULL; } } -PyObject* +static PyObject* ast2obj_comprehension(void* _o) { comprehension_ty o = (comprehension_ty)_o; @@ -3176,7 +3176,7 @@ failed: return NULL; } -PyObject* +static PyObject* ast2obj_excepthandler(void* _o) { excepthandler_ty o = (excepthandler_ty)_o; @@ -3224,7 +3224,7 @@ failed: return NULL; } -PyObject* +static PyObject* ast2obj_arguments(void* _o) { arguments_ty o = (arguments_ty)_o; @@ -3283,7 +3283,7 @@ failed: return NULL; } -PyObject* +static PyObject* ast2obj_arg(void* _o) { arg_ty o = (arg_ty)_o; @@ -3312,7 +3312,7 @@ failed: return NULL; } -PyObject* +static PyObject* ast2obj_keyword(void* _o) { keyword_ty o = (keyword_ty)_o; @@ -3341,7 +3341,7 @@ failed: return NULL; } -PyObject* +static PyObject* ast2obj_alias(void* _o) { alias_ty o = (alias_ty)_o; @@ -3371,7 +3371,7 @@ failed: } -int +static int obj2ast_mod(PyObject* obj, mod_ty* out, PyArena* arena) { int isinstance; @@ -3520,7 +3520,7 @@ obj2ast_mod(PyObject* obj, mod_ty* out, return 1; } -int +static int obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena) { int isinstance; @@ -4716,7 +4716,7 @@ obj2ast_stmt(PyObject* obj, stmt_ty* out return 1; } -int +static int obj2ast_expr(PyObject* obj, expr_ty* out, PyArena* arena) { int isinstance; @@ -5832,7 +5832,7 @@ obj2ast_expr(PyObject* obj, expr_ty* out return 1; } -int +static int obj2ast_expr_context(PyObject* obj, expr_context_ty* out, PyArena* arena) { int isinstance; @@ -5890,7 +5890,7 @@ obj2ast_expr_context(PyObject* obj, expr return 1; } -int +static int obj2ast_slice(PyObject* obj, slice_ty* out, PyArena* arena) { int isinstance; @@ -6013,7 +6013,7 @@ obj2ast_slice(PyObject* obj, slice_ty* o return 1; } -int +static int obj2ast_boolop(PyObject* obj, boolop_ty* out, PyArena* arena) { int isinstance; @@ -6039,7 +6039,7 @@ obj2ast_boolop(PyObject* obj, boolop_ty* return 1; } -int +static int obj2ast_operator(PyObject* obj, operator_ty* out, PyArena* arena) { int isinstance; @@ -6145,7 +6145,7 @@ obj2ast_operator(PyObject* obj, operator return 1; } -int +static int obj2ast_unaryop(PyObject* obj, unaryop_ty* out, PyArena* arena) { int isinstance; @@ -6187,7 +6187,7 @@ obj2ast_unaryop(PyObject* obj, unaryop_t return 1; } -int +static int obj2ast_cmpop(PyObject* obj, cmpop_ty* out, PyArena* arena) { int isinstance; @@ -6277,7 +6277,7 @@ obj2ast_cmpop(PyObject* obj, cmpop_ty* o return 1; } -int +static int obj2ast_comprehension(PyObject* obj, comprehension_ty* out, PyArena* arena) { PyObject* tmp = NULL; @@ -6341,7 +6341,7 @@ failed: return 1; } -int +static int obj2ast_excepthandler(PyObject* obj, excepthandler_ty* out, PyArena* arena) { int isinstance; @@ -6446,7 +6446,7 @@ obj2ast_excepthandler(PyObject* obj, exc return 1; } -int +static int obj2ast_arguments(PyObject* obj, arguments_ty* out, PyArena* arena) { PyObject* tmp = NULL; @@ -6611,7 +6611,7 @@ failed: return 1; } -int +static int obj2ast_arg(PyObject* obj, arg_ty* out, PyArena* arena) { PyObject* tmp = NULL; @@ -6648,7 +6648,7 @@ failed: return 1; } -int +static int obj2ast_keyword(PyObject* obj, keyword_ty* out, PyArena* arena) { PyObject* tmp = NULL; @@ -6686,7 +6686,7 @@ failed: return 1; } -int +static int obj2ast_alias(PyObject* obj, alias_ty* out, PyArena* arena) { PyObject* tmp = NULL; diff --git a/Python/fileutils.c b/Python/fileutils.c --- a/Python/fileutils.c +++ b/Python/fileutils.c @@ -1,3 +1,13 @@ +#ifdef __hpux +/* HP/UX namespace kludge workaround */ +#if defined(__STDC_VERSION__) && (__STDC_VERSION__-1+1) < 199901L +#undef __STDC_VERSION__ +#endif +#ifndef __STDC_VERSION__ +#define __STDC_VERSION__ 199901L +#endif +#endif + #include "Python.h" #ifdef MS_WINDOWS # include