Issue #16136: Remove VMS support and VMS-related code

This commit is contained in:
Christian Heimes 2013-12-21 16:19:10 +01:00
parent 5255b86fba
commit af01f66817
20 changed files with 27 additions and 325 deletions

View File

@ -977,6 +977,7 @@ Unsupported Operating Systems
* OS/2 * OS/2
* Windows 2000 * Windows 2000
* VMS
Deprecated Python modules, functions and methods Deprecated Python modules, functions and methods

View File

@ -199,9 +199,6 @@ PyAPI_DATA(PyObject *) PyExc_IOError;
#ifdef MS_WINDOWS #ifdef MS_WINDOWS
PyAPI_DATA(PyObject *) PyExc_WindowsError; PyAPI_DATA(PyObject *) PyExc_WindowsError;
#endif #endif
#ifdef __VMS
PyAPI_DATA(PyObject *) PyExc_VMSError;
#endif
PyAPI_DATA(PyObject *) PyExc_RecursionErrorInst; PyAPI_DATA(PyObject *) PyExc_RecursionErrorInst;

View File

@ -157,8 +157,6 @@ class AttributesTest(unittest.TestCase):
e.characters_written = 5 e.characters_written = 5
self.assertEqual(e.characters_written, 5) self.assertEqual(e.characters_written, 5)
# XXX VMSError not tested
class ExplicitSubclassingTest(unittest.TestCase): class ExplicitSubclassingTest(unittest.TestCase):

View File

@ -256,6 +256,8 @@ Tests
Build Build
----- -----
- Issue #16136: Remove VMS support
- Issue #18215: Add script Tools/ssl/test_multiple_versions.py to compile and - Issue #18215: Add script Tools/ssl/test_multiple_versions.py to compile and
run Python's unit tests with multiple versions of OpenSSL. run Python's unit tests with multiple versions of OpenSSL.

View File

@ -5,19 +5,12 @@
#include <sys/types.h> #include <sys/types.h>
#ifdef __VMS
#include <openssl/des.h>
#endif
/* Module crypt */ /* Module crypt */
static PyObject *crypt_crypt(PyObject *self, PyObject *args) static PyObject *crypt_crypt(PyObject *self, PyObject *args)
{ {
char *word, *salt; char *word, *salt;
#ifndef __VMS
extern char * crypt(const char *, const char *);
#endif
if (!PyArg_ParseTuple(args, "ss:crypt", &word, &salt)) { if (!PyArg_ParseTuple(args, "ss:crypt", &word, &salt)) {
return NULL; return NULL;

View File

@ -208,11 +208,7 @@ fcntl_ioctl(PyObject *self, PyObject *args)
return NULL; return NULL;
} }
Py_BEGIN_ALLOW_THREADS Py_BEGIN_ALLOW_THREADS
#ifdef __VMS
ret = ioctl(fd, code, (void *)arg);
#else
ret = ioctl(fd, code, arg); ret = ioctl(fd, code, arg);
#endif
Py_END_ALLOW_THREADS Py_END_ALLOW_THREADS
if (ret < 0) { if (ret < 0) {
PyErr_SetFromErrno(PyExc_IOError); PyErr_SetFromErrno(PyExc_IOError);

View File

@ -70,10 +70,6 @@ extern "C" {
#if defined(__FreeBSD__) #if defined(__FreeBSD__)
# include <ieeefp.h> # include <ieeefp.h>
#elif defined(__VMS)
#define __NEW_STARLET
#include <starlet.h>
#include <ieeedef.h>
#endif #endif
#ifndef WANT_SIGFPE_HANDLER #ifndef WANT_SIGFPE_HANDLER
@ -182,23 +178,6 @@ static void fpe_reset(Sigfunc *handler)
ieee_set_fp_control(fp_control); ieee_set_fp_control(fp_control);
PyOS_setsig(SIGFPE, handler); PyOS_setsig(SIGFPE, handler);
/*-- DEC ALPHA VMS --------------------------------------------------------*/
#elif defined(__ALPHA) && defined(__VMS)
IEEE clrmsk;
IEEE setmsk;
clrmsk.ieee$q_flags =
IEEE$M_TRAP_ENABLE_UNF | IEEE$M_TRAP_ENABLE_INE |
IEEE$M_MAP_UMZ;
setmsk.ieee$q_flags =
IEEE$M_TRAP_ENABLE_INV | IEEE$M_TRAP_ENABLE_DZE |
IEEE$M_TRAP_ENABLE_OVF;
sys$ieee_set_fp_control(&clrmsk, &setmsk, 0);
PyOS_setsig(SIGFPE, handler);
/*-- HP IA64 VMS --------------------------------------------------------*/
#elif defined(__ia64) && defined(__VMS)
PyOS_setsig(SIGFPE, handler);
/*-- Cray Unicos ----------------------------------------------------------*/ /*-- Cray Unicos ----------------------------------------------------------*/
#elif defined(cray) #elif defined(cray)
/* UNICOS delivers SIGFPE by default, but no matherr */ /* UNICOS delivers SIGFPE by default, but no matherr */
@ -251,14 +230,6 @@ static PyObject *turnoff_sigfpe(PyObject *self,PyObject *args)
#ifdef __FreeBSD__ #ifdef __FreeBSD__
fpresetsticky(fpgetsticky()); fpresetsticky(fpgetsticky());
fpsetmask(0); fpsetmask(0);
#elif defined(__VMS)
IEEE clrmsk;
clrmsk.ieee$q_flags =
IEEE$M_TRAP_ENABLE_UNF | IEEE$M_TRAP_ENABLE_INE |
IEEE$M_MAP_UMZ | IEEE$M_TRAP_ENABLE_INV |
IEEE$M_TRAP_ENABLE_DZE | IEEE$M_TRAP_ENABLE_OVF |
IEEE$M_INHERIT;
sys$ieee_set_fp_control(&clrmsk, 0, 0);
#else #else
fputs("Operation not implemented\n", stderr); fputs("Operation not implemented\n", stderr);
#endif #endif

View File

@ -110,12 +110,8 @@
#endif #endif
#ifndef PREFIX #ifndef PREFIX
# ifdef __VMS
# define PREFIX ""
# else
# define PREFIX "/usr/local" # define PREFIX "/usr/local"
#endif #endif
#endif
#ifndef EXEC_PREFIX #ifndef EXEC_PREFIX
#define EXEC_PREFIX PREFIX #define EXEC_PREFIX PREFIX

View File

@ -58,17 +58,12 @@ mkgrent(struct group *p)
#define SET(i,val) PyStructSequence_SET_ITEM(v, i, val) #define SET(i,val) PyStructSequence_SET_ITEM(v, i, val)
SET(setIndex++, PyUnicode_DecodeFSDefault(p->gr_name)); SET(setIndex++, PyUnicode_DecodeFSDefault(p->gr_name));
#ifdef __VMS
SET(setIndex++, Py_None);
Py_INCREF(Py_None);
#else
if (p->gr_passwd) if (p->gr_passwd)
SET(setIndex++, PyUnicode_DecodeFSDefault(p->gr_passwd)); SET(setIndex++, PyUnicode_DecodeFSDefault(p->gr_passwd));
else { else {
SET(setIndex++, Py_None); SET(setIndex++, Py_None);
Py_INCREF(Py_None); Py_INCREF(Py_None);
} }
#endif
SET(setIndex++, _PyLong_FromGid(p->gr_gid)); SET(setIndex++, _PyLong_FromGid(p->gr_gid));
SET(setIndex++, w); SET(setIndex++, w);
#undef SET #undef SET

View File

@ -5,11 +5,6 @@
#include <locale.h> #include <locale.h>
#ifdef __VMS
#error "PEP 11: VMS is now unsupported, code will be removed in Python 3.4"
#include <unixlib.h>
#endif
#if defined(MS_WINDOWS) || defined(__CYGWIN__) #if defined(MS_WINDOWS) || defined(__CYGWIN__)
#include <windows.h> #include <windows.h>
#ifdef HAVE_FCNTL_H #ifdef HAVE_FCNTL_H
@ -124,19 +119,7 @@ usage(int exitcode, wchar_t* program)
fprintf(f, usage_5, DELIM, PYTHONHOMEHELP); fprintf(f, usage_5, DELIM, PYTHONHOMEHELP);
fputs(usage_6, f); fputs(usage_6, f);
} }
#if defined(__VMS)
if (exitcode == 0) {
/* suppress 'error' message */
return 1;
}
else {
/* STS$M_INHIB_MSG + SS$_ABORT */
return 0x1000002c;
}
#else
return exitcode; return exitcode;
#endif
/*NOTREACHED*/
} }
static void RunStartupFile(PyCompilerFlags *cf) static void RunStartupFile(PyCompilerFlags *cf)
@ -580,14 +563,7 @@ Py_Main(int argc, wchar_t **argv)
if (command == NULL && module == NULL && _PyOS_optind < argc && if (command == NULL && module == NULL && _PyOS_optind < argc &&
wcscmp(argv[_PyOS_optind], L"-") != 0) wcscmp(argv[_PyOS_optind], L"-") != 0)
{ {
#ifdef __VMS
filename = decc$translate_vms(argv[_PyOS_optind]);
if (filename == (char *)0 || filename == (char *)-1)
filename = argv[_PyOS_optind]; filename = argv[_PyOS_optind];
#else
filename = argv[_PyOS_optind];
#endif
} }
stdin_is_interactive = Py_FdIsInteractive(stdin, (char *)0); stdin_is_interactive = Py_FdIsInteractive(stdin, (char *)0);
@ -623,11 +599,6 @@ Py_Main(int argc, wchar_t **argv)
#endif /* !MS_WINDOWS */ #endif /* !MS_WINDOWS */
/* Leave stderr alone - it should be unbuffered anyway. */ /* Leave stderr alone - it should be unbuffered anyway. */
} }
#ifdef __VMS
else {
setvbuf (stdout, (char *)NULL, _IOLBF, BUFSIZ);
}
#endif /* __VMS */
#ifdef __APPLE__ #ifdef __APPLE__
/* On MacOS X, when the Python interpreter is embedded in an /* On MacOS X, when the Python interpreter is embedded in an

View File

@ -1158,12 +1158,6 @@ new_mmap_object(PyTypeObject *type, PyObject *args, PyObject *kwdict)
(void)fcntl(fd, F_FULLFSYNC); (void)fcntl(fd, F_FULLFSYNC);
#endif #endif
#ifdef HAVE_FSTAT #ifdef HAVE_FSTAT
# ifdef __VMS
/* on OpenVMS we must ensure that all bytes are written to the file */
if (fd != -1) {
fsync(fd);
}
# endif
if (fd != -1 && fstat(fd, &st) == 0 && S_ISREG(st.st_mode)) { if (fd != -1 && fstat(fd, &st) == 0 && S_ISREG(st.st_mode)) {
if (map_size == 0) { if (map_size == 0) {
if (st.st_size == 0) { if (st.st_size == 0) {

View File

@ -29,11 +29,6 @@
#include "posixmodule.h" #include "posixmodule.h"
#endif #endif
#if defined(__VMS)
# error "PEP 11: VMS is now unsupported, code will be removed in Python 3.4"
# include <unixio.h>
#endif /* defined(__VMS) */
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
@ -164,9 +159,6 @@ corresponding Unix manual entries for more information on calls.");
#define HAVE_FSYNC 1 #define HAVE_FSYNC 1
#define fsync _commit #define fsync _commit
#else #else
#if defined(__VMS)
/* Everything needed is defined in vms/pyconfig.h */
#else /* all other compilers */
/* Unix functions that the configure script doesn't check for */ /* Unix functions that the configure script doesn't check for */
#define HAVE_EXECV 1 #define HAVE_EXECV 1
#define HAVE_FORK 1 #define HAVE_FORK 1
@ -184,7 +176,6 @@ corresponding Unix manual entries for more information on calls.");
#define HAVE_SYSTEM 1 #define HAVE_SYSTEM 1
#define HAVE_WAIT 1 #define HAVE_WAIT 1
#define HAVE_TTYNAME 1 #define HAVE_TTYNAME 1
#endif /* __VMS */
#endif /* _MSC_VER */ #endif /* _MSC_VER */
#endif /* __BORLANDC__ */ #endif /* __BORLANDC__ */
#endif /* ! __WATCOMC__ || __QNX__ */ #endif /* ! __WATCOMC__ || __QNX__ */
@ -2765,17 +2756,7 @@ os_ttyname_impl(PyModuleDef *module, int fd)
{ {
char *ret; char *ret;
#if defined(__VMS)
/* file descriptor 0 only, the default input device (stdin) */
if (fd == 0) {
ret = ttyname();
}
else {
ret = NULL;
}
#else
ret = ttyname(fd); ret = ttyname(fd);
#endif
if (ret == NULL) if (ret == NULL)
posix_error(); posix_error();
return ret; return ret;
@ -8340,10 +8321,6 @@ posix_fstat(PyObject *self, PyObject *args)
int res; int res;
if (!PyArg_ParseTuple(args, "i:fstat", &fd)) if (!PyArg_ParseTuple(args, "i:fstat", &fd))
return NULL; return NULL;
#ifdef __VMS
/* on OpenVMS we must ensure that all bytes are written to the file */
fsync(fd);
#endif
Py_BEGIN_ALLOW_THREADS Py_BEGIN_ALLOW_THREADS
res = FSTAT(fd, &st); res = FSTAT(fd, &st);
Py_END_ALLOW_THREADS Py_END_ALLOW_THREADS

View File

@ -69,18 +69,10 @@ mkpwent(struct passwd *p)
#define SETS(i,val) sets(v, i, val) #define SETS(i,val) sets(v, i, val)
SETS(setIndex++, p->pw_name); SETS(setIndex++, p->pw_name);
#ifdef __VMS
SETS(setIndex++, "");
#else
SETS(setIndex++, p->pw_passwd); SETS(setIndex++, p->pw_passwd);
#endif
PyStructSequence_SET_ITEM(v, setIndex++, _PyLong_FromUid(p->pw_uid)); PyStructSequence_SET_ITEM(v, setIndex++, _PyLong_FromUid(p->pw_uid));
PyStructSequence_SET_ITEM(v, setIndex++, _PyLong_FromGid(p->pw_gid)); PyStructSequence_SET_ITEM(v, setIndex++, _PyLong_FromGid(p->pw_gid));
#ifdef __VMS
SETS(setIndex++, "");
#else
SETS(setIndex++, p->pw_gecos); SETS(setIndex++, p->pw_gecos);
#endif
SETS(setIndex++, p->pw_dir); SETS(setIndex++, p->pw_dir);
SETS(setIndex++, p->pw_shell); SETS(setIndex++, p->pw_shell);

View File

@ -52,9 +52,6 @@ extern void bzero(void *, int);
# include <winsock.h> # include <winsock.h>
#else #else
# define SOCKET int # define SOCKET int
# if defined(__VMS)
# include <socket.h>
# endif
#endif #endif
/* list of Python objects and their file descriptor */ /* list of Python objects and their file descriptor */
@ -2253,7 +2250,7 @@ arguments; each contains the subset of the corresponding file descriptors\n\
that are ready.\n\ that are ready.\n\
\n\ \n\
*** IMPORTANT NOTICE ***\n\ *** IMPORTANT NOTICE ***\n\
On Windows and OpenVMS, only sockets are supported; on Unix, all file\n\ On Windows only sockets are supported; on Unix, all file\n\
descriptors can be used."); descriptors can be used.");
static PyMethodDef select_methods[] = { static PyMethodDef select_methods[] = {
@ -2271,7 +2268,7 @@ PyDoc_STRVAR(module_doc,
"This module supports asynchronous I/O on multiple file descriptors.\n\ "This module supports asynchronous I/O on multiple file descriptors.\n\
\n\ \n\
*** IMPORTANT NOTICE ***\n\ *** IMPORTANT NOTICE ***\n\
On Windows and OpenVMS, only sockets are supported; on Unix, all file descriptors."); On Windows only sockets are supported; on Unix, all file descriptors.");
static struct PyModuleDef selectmodule = { static struct PyModuleDef selectmodule = {

View File

@ -188,7 +188,7 @@ if_indextoname(index) -- return the corresponding interface name\n\
#if defined(WITH_THREAD) && (defined(__APPLE__) || \ #if defined(WITH_THREAD) && (defined(__APPLE__) || \
(defined(__FreeBSD__) && __FreeBSD_version+0 < 503000) || \ (defined(__FreeBSD__) && __FreeBSD_version+0 < 503000) || \
defined(__OpenBSD__) || defined(__NetBSD__) || \ defined(__OpenBSD__) || defined(__NetBSD__) || \
defined(__VMS) || !defined(HAVE_GETADDRINFO)) !defined(HAVE_GETADDRINFO))
#define USE_GETADDRINFO_LOCK #define USE_GETADDRINFO_LOCK
#endif #endif
@ -212,10 +212,6 @@ if_indextoname(index) -- return the corresponding interface name\n\
# include <ctype.h> # include <ctype.h>
#endif #endif
#if defined(__VMS)
# include <ioctl.h>
#endif
#ifdef __APPLE__ #ifdef __APPLE__
# include <sys/ioctl.h> # include <sys/ioctl.h>
#endif #endif
@ -403,11 +399,6 @@ const char *inet_ntop(int af, const void *src, char *dst, socklen_t size);
#endif #endif
#endif #endif
#ifdef __VMS
/* TCP/IP Services for VMS uses a maximum send/recv buffer length */
#define SEGMENT_SIZE (32 * 1024 -1)
#endif
/* Convert "sock_addr_t *" to "struct sockaddr *". */ /* Convert "sock_addr_t *" to "struct sockaddr *". */
#define SAS2SA(x) (&((x)->sa)) #define SAS2SA(x) (&((x)->sa))
@ -556,37 +547,13 @@ set_gaierror(int error)
return NULL; return NULL;
} }
#ifdef __VMS
/* Function to send in segments */
static int
sendsegmented(int sock_fd, char *buf, int len, int flags)
{
int n = 0;
int remaining = len;
while (remaining > 0) {
unsigned int segment;
segment = (remaining >= SEGMENT_SIZE ? SEGMENT_SIZE : remaining);
n = send(sock_fd, buf, segment, flags);
if (n < 0) {
return n;
}
remaining -= segment;
buf += segment;
} /* end while */
return len;
}
#endif
/* Function to perform the setting of socket blocking mode /* Function to perform the setting of socket blocking mode
internally. block = (1 | 0). */ internally. block = (1 | 0). */
static int static int
internal_setblocking(PySocketSockObject *s, int block) internal_setblocking(PySocketSockObject *s, int block)
{ {
#if !defined(MS_WINDOWS) \ #if !defined(MS_WINDOWS) \
&& !((defined(HAVE_SYS_IOCTL_H) && defined(FIONBIO)) || defined(__VMS)) && !((defined(HAVE_SYS_IOCTL_H) && defined(FIONBIO)))
int delay_flag, new_delay_flag; int delay_flag, new_delay_flag;
#endif #endif
#ifdef SOCK_NONBLOCK #ifdef SOCK_NONBLOCK
@ -598,7 +565,7 @@ internal_setblocking(PySocketSockObject *s, int block)
Py_BEGIN_ALLOW_THREADS Py_BEGIN_ALLOW_THREADS
#ifndef MS_WINDOWS #ifndef MS_WINDOWS
#if (defined(HAVE_SYS_IOCTL_H) && defined(FIONBIO)) || defined(__VMS) #if (defined(HAVE_SYS_IOCTL_H) && defined(FIONBIO))
block = !block; block = !block;
ioctl(s->sock_fd, FIONBIO, (unsigned int *)&block); ioctl(s->sock_fd, FIONBIO, (unsigned int *)&block);
#else #else
@ -2227,13 +2194,7 @@ sock_getsockopt(PySocketSockObject *s, PyObject *args)
return s->errorhandler(); return s->errorhandler();
return PyLong_FromLong(flag); return PyLong_FromLong(flag);
} }
#ifdef __VMS
/* socklen_t is unsigned so no negative test is needed,
test buflen == 0 is previously done */
if (buflen > 1024) {
#else
if (buflen <= 0 || buflen > 1024) { if (buflen <= 0 || buflen > 1024) {
#endif
PyErr_SetString(PyExc_OSError, PyErr_SetString(PyExc_OSError,
"getsockopt buflen out of range"); "getsockopt buflen out of range");
return NULL; return NULL;
@ -2603,10 +2564,6 @@ sock_recv_guts(PySocketSockObject *s, char* cbuf, Py_ssize_t len, int flags)
{ {
Py_ssize_t outlen = -1; Py_ssize_t outlen = -1;
int timeout; int timeout;
#ifdef __VMS
int remaining;
char *read_buf;
#endif
if (!IS_SELECTABLE(s)) { if (!IS_SELECTABLE(s)) {
select_error(); select_error();
@ -2617,7 +2574,6 @@ sock_recv_guts(PySocketSockObject *s, char* cbuf, Py_ssize_t len, int flags)
return 0; return 0;
} }
#ifndef __VMS
BEGIN_SELECT_LOOP(s) BEGIN_SELECT_LOOP(s)
Py_BEGIN_ALLOW_THREADS Py_BEGIN_ALLOW_THREADS
timeout = internal_select_ex(s, 0, interval); timeout = internal_select_ex(s, 0, interval);
@ -2643,48 +2599,6 @@ sock_recv_guts(PySocketSockObject *s, char* cbuf, Py_ssize_t len, int flags)
s->errorhandler(); s->errorhandler();
return -1; return -1;
} }
#else
read_buf = cbuf;
remaining = len;
while (remaining != 0) {
unsigned int segment;
int nread = -1;
segment = remaining /SEGMENT_SIZE;
if (segment != 0) {
segment = SEGMENT_SIZE;
}
else {
segment = remaining;
}
BEGIN_SELECT_LOOP(s)
Py_BEGIN_ALLOW_THREADS
timeout = internal_select_ex(s, 0, interval);
if (!timeout)
nread = recv(s->sock_fd, read_buf, segment, flags);
Py_END_ALLOW_THREADS
if (timeout == 1) {
PyErr_SetString(socket_timeout, "timed out");
return -1;
}
END_SELECT_LOOP(s)
if (nread < 0) {
s->errorhandler();
return -1;
}
if (nread != remaining) {
read_buf += nread;
break;
}
remaining -= segment;
read_buf += segment;
}
outlen = read_buf - cbuf;
#endif /* !__VMS */
return outlen; return outlen;
} }
@ -3318,9 +3232,7 @@ sock_send(PySocketSockObject *s, PyObject *args)
Py_BEGIN_ALLOW_THREADS Py_BEGIN_ALLOW_THREADS
timeout = internal_select_ex(s, 1, interval); timeout = internal_select_ex(s, 1, interval);
if (!timeout) { if (!timeout) {
#ifdef __VMS #ifdef MS_WINDOWS
n = sendsegmented(s->sock_fd, buf, len, flags);
#elif defined(MS_WINDOWS)
if (len > INT_MAX) if (len > INT_MAX)
len = INT_MAX; len = INT_MAX;
n = send(s->sock_fd, buf, (int)len, flags); n = send(s->sock_fd, buf, (int)len, flags);
@ -3375,9 +3287,7 @@ sock_sendall(PySocketSockObject *s, PyObject *args)
timeout = internal_select(s, 1); timeout = internal_select(s, 1);
n = -1; n = -1;
if (!timeout) { if (!timeout) {
#ifdef __VMS #ifdef MS_WINDOWS
n = sendsegmented(s->sock_fd, buf, len, flags);
#elif defined(MS_WINDOWS)
if (len > INT_MAX) if (len > INT_MAX)
len = INT_MAX; len = INT_MAX;
n = send(s->sock_fd, buf, (int)len, flags); n = send(s->sock_fd, buf, (int)len, flags);

View File

@ -16,9 +16,6 @@ PyObject *PyExc_IOError = NULL;
#ifdef MS_WINDOWS #ifdef MS_WINDOWS
PyObject *PyExc_WindowsError = NULL; PyObject *PyExc_WindowsError = NULL;
#endif #endif
#ifdef __VMS
PyObject *PyExc_VMSError = NULL;
#endif
/* The dict map from errno codes to OSError subclasses */ /* The dict map from errno codes to OSError subclasses */
static PyObject *errnomap = NULL; static PyObject *errnomap = NULL;
@ -2472,9 +2469,6 @@ _PyExc_Init(PyObject *bltinmod)
INIT_ALIAS(IOError, OSError) INIT_ALIAS(IOError, OSError)
#ifdef MS_WINDOWS #ifdef MS_WINDOWS
INIT_ALIAS(WindowsError, OSError) INIT_ALIAS(WindowsError, OSError)
#endif
#ifdef __VMS
INIT_ALIAS(VMSError, OSError)
#endif #endif
POST_INIT(EOFError) POST_INIT(EOFError)
POST_INIT(RuntimeError) POST_INIT(RuntimeError)

View File

@ -15,10 +15,6 @@
#include "windows.h" #include "windows.h"
#endif /* MS_WINDOWS */ #endif /* MS_WINDOWS */
#ifdef __VMS
extern char* vms__StdioReadline(FILE *sys_stdin, FILE *sys_stdout, char *prompt);
#endif
PyThreadState* _PyOS_ReadlineTState; PyThreadState* _PyOS_ReadlineTState;
@ -189,11 +185,7 @@ PyOS_Readline(FILE *sys_stdin, FILE *sys_stdout, const char *prompt)
if (PyOS_ReadlineFunctionPointer == NULL) { if (PyOS_ReadlineFunctionPointer == NULL) {
#ifdef __VMS
PyOS_ReadlineFunctionPointer = vms__StdioReadline;
#else
PyOS_ReadlineFunctionPointer = PyOS_StdioReadline; PyOS_ReadlineFunctionPointer = PyOS_StdioReadline;
#endif
} }
#ifdef WITH_THREAD #ifdef WITH_THREAD

View File

@ -36,25 +36,16 @@ const char *_PyImport_DynLoadFiletab[] = {
#ifdef __CYGWIN__ #ifdef __CYGWIN__
".dll", ".dll",
#else /* !__CYGWIN__ */ #else /* !__CYGWIN__ */
#ifdef __VMS
".exe",
".EXE",
#else /* !__VMS */
"." SOABI ".so", "." SOABI ".so",
".abi" PYTHON_ABI_STRING ".so", ".abi" PYTHON_ABI_STRING ".so",
".so", ".so",
#endif /* __VMS */
#endif /* __CYGWIN__ */ #endif /* __CYGWIN__ */
NULL, NULL,
}; };
static struct { static struct {
dev_t dev; dev_t dev;
#ifdef __VMS
ino_t ino[3];
#else
ino_t ino; ino_t ino;
#endif
void *handle; void *handle;
} handles[128]; } handles[128];
static int nhandles = 0; static int nhandles = 0;
@ -95,29 +86,12 @@ dl_funcptr _PyImport_GetDynLoadFunc(const char *shortname,
} }
if (nhandles < 128) { if (nhandles < 128) {
handles[nhandles].dev = statb.st_dev; handles[nhandles].dev = statb.st_dev;
#ifdef __VMS
handles[nhandles].ino[0] = statb.st_ino[0];
handles[nhandles].ino[1] = statb.st_ino[1];
handles[nhandles].ino[2] = statb.st_ino[2];
#else
handles[nhandles].ino = statb.st_ino; handles[nhandles].ino = statb.st_ino;
#endif
} }
} }
dlopenflags = PyThreadState_GET()->interp->dlopenflags; dlopenflags = PyThreadState_GET()->interp->dlopenflags;
#ifdef __VMS
/* VMS currently don't allow a pathname, use a logical name instead */
/* Concatenate 'python_module_' and shortname */
/* so "import vms.bar" will use the logical python_module_bar */
/* As C module use only one name space this is probably not a */
/* important limitation */
PyOS_snprintf(pathbuf, sizeof(pathbuf), "python_module_%-.200s",
shortname);
pathname = pathbuf;
#endif
handle = dlopen(pathname, dlopenflags); handle = dlopen(pathname, dlopenflags);
if (handle == NULL) { if (handle == NULL) {

View File

@ -68,28 +68,7 @@ win32_urandom(unsigned char *buffer, Py_ssize_t size, int raise)
#endif /* MS_WINDOWS */ #endif /* MS_WINDOWS */
#ifdef __VMS #ifndef MS_WINDOWS
/* Use openssl random routine */
#include <openssl/rand.h>
static int
vms_urandom(unsigned char *buffer, Py_ssize_t size, int raise)
{
if (RAND_pseudo_bytes(buffer, size) < 0) {
if (raise) {
PyErr_Format(PyExc_ValueError,
"RAND_pseudo_bytes");
} else {
Py_FatalError("Failed to initialize the randomized hash "
"secret using RAND_pseudo_bytes");
}
return -1;
}
return 0;
}
#endif /* __VMS */
#if !defined(MS_WINDOWS) && !defined(__VMS)
static int urandom_fd = -1; static int urandom_fd = -1;
/* Read size bytes from /dev/urandom into buffer. /* Read size bytes from /dev/urandom into buffer.
@ -195,7 +174,7 @@ dev_urandom_close(void)
} }
} }
#endif /* !defined(MS_WINDOWS) && !defined(__VMS) */ #endif /* MS_WINDOWS */
/* Fill buffer with pseudo-random bytes generated by a linear congruent /* Fill buffer with pseudo-random bytes generated by a linear congruent
generator (LCG): generator (LCG):
@ -236,13 +215,9 @@ _PyOS_URandom(void *buffer, Py_ssize_t size)
#ifdef MS_WINDOWS #ifdef MS_WINDOWS
return win32_urandom((unsigned char *)buffer, size, 1); return win32_urandom((unsigned char *)buffer, size, 1);
#else
# ifdef __VMS
return vms_urandom((unsigned char *)buffer, size, 1);
#else #else
return dev_urandom_python((char*)buffer, size); return dev_urandom_python((char*)buffer, size);
#endif #endif
#endif
} }
void void
@ -285,12 +260,8 @@ _PyRandom_Init(void)
else { else {
#ifdef MS_WINDOWS #ifdef MS_WINDOWS
(void)win32_urandom(secret, secret_size, 0); (void)win32_urandom(secret, secret_size, 0);
#else /* #ifdef MS_WINDOWS */
# ifdef __VMS
vms_urandom(secret, secret_size, 0);
#else #else
dev_urandom_noraise(secret, secret_size); dev_urandom_noraise(secret, secret_size);
# endif
#endif #endif
} }
} }
@ -298,7 +269,7 @@ _PyRandom_Init(void)
void void
_PyRandom_Fini(void) _PyRandom_Fini(void)
{ {
#if !defined(MS_WINDOWS) && !defined(__VMS) #ifndef MS_WINDOWS
dev_urandom_close(); dev_urandom_close();
#endif #endif
} }

View File

@ -32,10 +32,6 @@ extern void *PyWin_DLLhModule;
extern const char *PyWin_DLLVersionString; extern const char *PyWin_DLLVersionString;
#endif #endif
#ifdef __VMS
#include <unixlib.h>
#endif
#ifdef HAVE_LANGINFO_H #ifdef HAVE_LANGINFO_H
#include <locale.h> #include <locale.h>
#include <langinfo.h> #include <langinfo.h>
@ -1867,22 +1863,7 @@ makeargvobject(int argc, wchar_t **argv)
if (av != NULL) { if (av != NULL) {
int i; int i;
for (i = 0; i < argc; i++) { for (i = 0; i < argc; i++) {
#ifdef __VMS
PyObject *v;
/* argv[0] is the script pathname if known */
if (i == 0) {
char* fn = decc$translate_vms(argv[0]);
if ((fn == (char *)0) || fn == (char *)-1)
v = PyUnicode_FromString(argv[0]);
else
v = PyUnicode_FromString(
decc$translate_vms(argv[0]));
} else
v = PyUnicode_FromString(argv[i]);
#else
PyObject *v = PyUnicode_FromWideChar(argv[i], -1); PyObject *v = PyUnicode_FromWideChar(argv[i], -1);
#endif
if (v == NULL) { if (v == NULL) {
Py_DECREF(av); Py_DECREF(av);
av = NULL; av = NULL;