[Python-checkins] cpython: Issue #16136: Remove VMS support and VMS-related code

christian.heimes python-checkins at python.org
Sat Dec 21 16:20:17 CET 2013


http://hg.python.org/cpython/rev/568391b3eda9
changeset:   88110:568391b3eda9
parent:      88108:239faf6b6e8d
user:        Christian Heimes <christian at cheimes.de>
date:        Sat Dec 21 16:19:10 2013 +0100
summary:
  Issue #16136: Remove VMS support and VMS-related code

files:
  Doc/whatsnew/3.4.rst     |    1 +
  Include/pyerrors.h       |    3 -
  Lib/test/test_pep3151.py |    2 -
  Misc/NEWS                |    2 +
  Modules/_cryptmodule.c   |    7 -
  Modules/fcntlmodule.c    |    4 -
  Modules/fpectlmodule.c   |   29 -------
  Modules/getpath.c        |    6 +-
  Modules/grpmodule.c      |    5 -
  Modules/main.c           |   29 -------
  Modules/mmapmodule.c     |    6 -
  Modules/posixmodule.c    |   23 -----
  Modules/pwdmodule.c      |    8 --
  Modules/selectmodule.c   |   25 ++---
  Modules/socketmodule.c   |  106 ++------------------------
  Objects/exceptions.c     |    6 -
  Parser/myreadline.c      |    8 --
  Python/dynload_shlib.c   |   26 ------
  Python/random.c          |   37 +--------
  Python/sysmodule.c       |   19 ----
  20 files changed, 27 insertions(+), 325 deletions(-)


diff --git a/Doc/whatsnew/3.4.rst b/Doc/whatsnew/3.4.rst
--- a/Doc/whatsnew/3.4.rst
+++ b/Doc/whatsnew/3.4.rst
@@ -977,6 +977,7 @@
 
 * OS/2
 * Windows 2000
+* VMS
 
 
 Deprecated Python modules, functions and methods
diff --git a/Include/pyerrors.h b/Include/pyerrors.h
--- a/Include/pyerrors.h
+++ b/Include/pyerrors.h
@@ -199,9 +199,6 @@
 #ifdef MS_WINDOWS
 PyAPI_DATA(PyObject *) PyExc_WindowsError;
 #endif
-#ifdef __VMS
-PyAPI_DATA(PyObject *) PyExc_VMSError;
-#endif
 
 PyAPI_DATA(PyObject *) PyExc_RecursionErrorInst;
 
diff --git a/Lib/test/test_pep3151.py b/Lib/test/test_pep3151.py
--- a/Lib/test/test_pep3151.py
+++ b/Lib/test/test_pep3151.py
@@ -157,8 +157,6 @@
         e.characters_written = 5
         self.assertEqual(e.characters_written, 5)
 
-    # XXX VMSError not tested
-
 
 class ExplicitSubclassingTest(unittest.TestCase):
 
diff --git a/Misc/NEWS b/Misc/NEWS
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -256,6 +256,8 @@
 Build
 -----
 
+- Issue #16136: Remove VMS support
+
 - Issue #18215: Add script Tools/ssl/test_multiple_versions.py to compile and
   run Python's unit tests with multiple versions of OpenSSL.
 
diff --git a/Modules/_cryptmodule.c b/Modules/_cryptmodule.c
--- a/Modules/_cryptmodule.c
+++ b/Modules/_cryptmodule.c
@@ -5,19 +5,12 @@
 
 #include <sys/types.h>
 
-#ifdef __VMS
-#include <openssl/des.h>
-#endif
-
 /* Module crypt */
 
 
 static PyObject *crypt_crypt(PyObject *self, PyObject *args)
 {
     char *word, *salt;
-#ifndef __VMS
-    extern char * crypt(const char *, const char *);
-#endif
 
     if (!PyArg_ParseTuple(args, "ss:crypt", &word, &salt)) {
         return NULL;
diff --git a/Modules/fcntlmodule.c b/Modules/fcntlmodule.c
--- a/Modules/fcntlmodule.c
+++ b/Modules/fcntlmodule.c
@@ -208,11 +208,7 @@
       return NULL;
     }
     Py_BEGIN_ALLOW_THREADS
-#ifdef __VMS
-    ret = ioctl(fd, code, (void *)arg);
-#else
     ret = ioctl(fd, code, arg);
-#endif
     Py_END_ALLOW_THREADS
     if (ret < 0) {
         PyErr_SetFromErrno(PyExc_IOError);
diff --git a/Modules/fpectlmodule.c b/Modules/fpectlmodule.c
--- a/Modules/fpectlmodule.c
+++ b/Modules/fpectlmodule.c
@@ -70,10 +70,6 @@
 
 #if defined(__FreeBSD__)
 #  include <ieeefp.h>
-#elif defined(__VMS)
-#define __NEW_STARLET
-#include <starlet.h>
-#include <ieeedef.h>
 #endif
 
 #ifndef WANT_SIGFPE_HANDLER
@@ -182,23 +178,6 @@
     ieee_set_fp_control(fp_control);
     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 ----------------------------------------------------------*/
 #elif defined(cray)
     /* UNICOS delivers SIGFPE by default, but no matherr */
@@ -251,14 +230,6 @@
 #ifdef __FreeBSD__
     fpresetsticky(fpgetsticky());
     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
     fputs("Operation not implemented\n", stderr);
 #endif
diff --git a/Modules/getpath.c b/Modules/getpath.c
--- a/Modules/getpath.c
+++ b/Modules/getpath.c
@@ -110,11 +110,7 @@
 #endif
 
 #ifndef PREFIX
-#  ifdef __VMS
-#    define PREFIX ""
-#  else
-#    define PREFIX "/usr/local"
-#  endif
+#  define PREFIX "/usr/local"
 #endif
 
 #ifndef EXEC_PREFIX
diff --git a/Modules/grpmodule.c b/Modules/grpmodule.c
--- a/Modules/grpmodule.c
+++ b/Modules/grpmodule.c
@@ -58,17 +58,12 @@
 
 #define SET(i,val) PyStructSequence_SET_ITEM(v, i, val)
     SET(setIndex++, PyUnicode_DecodeFSDefault(p->gr_name));
-#ifdef __VMS
-    SET(setIndex++, Py_None);
-    Py_INCREF(Py_None);
-#else
     if (p->gr_passwd)
             SET(setIndex++, PyUnicode_DecodeFSDefault(p->gr_passwd));
     else {
             SET(setIndex++, Py_None);
             Py_INCREF(Py_None);
     }
-#endif
     SET(setIndex++, _PyLong_FromGid(p->gr_gid));
     SET(setIndex++, w);
 #undef SET
diff --git a/Modules/main.c b/Modules/main.c
--- a/Modules/main.c
+++ b/Modules/main.c
@@ -5,11 +5,6 @@
 
 #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__)
 #include <windows.h>
 #ifdef HAVE_FCNTL_H
@@ -124,19 +119,7 @@
         fprintf(f, usage_5, DELIM, PYTHONHOMEHELP);
         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;
-#endif
-    /*NOTREACHED*/
 }
 
 static void RunStartupFile(PyCompilerFlags *cf)
@@ -580,14 +563,7 @@
     if (command == NULL && module == NULL && _PyOS_optind < argc &&
         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];
-
-#else
         filename = argv[_PyOS_optind];
-#endif
     }
 
     stdin_is_interactive = Py_FdIsInteractive(stdin, (char *)0);
@@ -623,11 +599,6 @@
 #endif /* !MS_WINDOWS */
         /* Leave stderr alone - it should be unbuffered anyway. */
     }
-#ifdef __VMS
-    else {
-        setvbuf (stdout, (char *)NULL, _IOLBF, BUFSIZ);
-    }
-#endif /* __VMS */
 
 #ifdef __APPLE__
     /* On MacOS X, when the Python interpreter is embedded in an
diff --git a/Modules/mmapmodule.c b/Modules/mmapmodule.c
--- a/Modules/mmapmodule.c
+++ b/Modules/mmapmodule.c
@@ -1158,12 +1158,6 @@
         (void)fcntl(fd, F_FULLFSYNC);
 #endif
 #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 (map_size == 0) {
             if (st.st_size == 0) {
diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c
--- a/Modules/posixmodule.c
+++ b/Modules/posixmodule.c
@@ -29,11 +29,6 @@
 #include "posixmodule.h"
 #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
 extern "C" {
 #endif
@@ -164,9 +159,6 @@
 #define HAVE_FSYNC      1
 #define fsync _commit
 #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 */
 #define HAVE_EXECV      1
 #define HAVE_FORK       1
@@ -184,7 +176,6 @@
 #define HAVE_SYSTEM     1
 #define HAVE_WAIT       1
 #define HAVE_TTYNAME    1
-#endif  /* __VMS */
 #endif  /* _MSC_VER */
 #endif  /* __BORLANDC__ */
 #endif  /* ! __WATCOMC__ || __QNX__ */
@@ -2765,17 +2756,7 @@
 {
     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);
-#endif
     if (ret == NULL)
         posix_error();
     return ret;
@@ -8340,10 +8321,6 @@
     int res;
     if (!PyArg_ParseTuple(args, "i:fstat", &fd))
         return NULL;
-#ifdef __VMS
-    /* on OpenVMS we must ensure that all bytes are written to the file */
-    fsync(fd);
-#endif
     Py_BEGIN_ALLOW_THREADS
     res = FSTAT(fd, &st);
     Py_END_ALLOW_THREADS
diff --git a/Modules/pwdmodule.c b/Modules/pwdmodule.c
--- a/Modules/pwdmodule.c
+++ b/Modules/pwdmodule.c
@@ -69,18 +69,10 @@
 #define SETS(i,val) sets(v, i, val)
 
     SETS(setIndex++, p->pw_name);
-#ifdef __VMS
-    SETS(setIndex++, "");
-#else
     SETS(setIndex++, p->pw_passwd);
-#endif
     PyStructSequence_SET_ITEM(v, setIndex++, _PyLong_FromUid(p->pw_uid));
     PyStructSequence_SET_ITEM(v, setIndex++, _PyLong_FromGid(p->pw_gid));
-#ifdef __VMS
-    SETS(setIndex++, "");
-#else
     SETS(setIndex++, p->pw_gecos);
-#endif
     SETS(setIndex++, p->pw_dir);
     SETS(setIndex++, p->pw_shell);
 
diff --git a/Modules/selectmodule.c b/Modules/selectmodule.c
--- a/Modules/selectmodule.c
+++ b/Modules/selectmodule.c
@@ -52,9 +52,6 @@
 #  include <winsock.h>
 #else
 #  define SOCKET int
-#  if defined(__VMS)
-#    include <socket.h>
-#  endif
 #endif
 
 /* list of Python objects and their file descriptor */
@@ -1708,17 +1705,17 @@
  * kevent is not standard and its members vary across BSDs.
  */
 #if !defined(__OpenBSD__)
-#   define IDENT_TYPE	T_UINTPTRT
-#   define IDENT_CAST	Py_intptr_t
-#   define DATA_TYPE	T_INTPTRT
+#   define IDENT_TYPE  T_UINTPTRT
+#   define IDENT_CAST  Py_intptr_t
+#   define DATA_TYPE   T_INTPTRT
 #   define DATA_FMT_UNIT INTPTRT_FMT_UNIT
-#   define IDENT_AsType	PyLong_AsUintptr_t
+#   define IDENT_AsType PyLong_AsUintptr_t
 #else
-#   define IDENT_TYPE	T_UINT
-#   define IDENT_CAST	int
-#   define DATA_TYPE	T_INT
+#   define IDENT_TYPE  T_UINT
+#   define IDENT_CAST  int
+#   define DATA_TYPE   T_INT
 #   define DATA_FMT_UNIT "i"
-#   define IDENT_AsType	PyLong_AsUnsignedLong
+#   define IDENT_AsType PyLong_AsUnsignedLong
 #endif
 
 /* Unfortunately, we can't store python objects in udata, because
@@ -1770,7 +1767,7 @@
 
     if (PyLong_Check(pfd)
 #if IDENT_TYPE == T_UINT
-	&& PyLong_AsUnsignedLong(pfd) <= UINT_MAX
+        && PyLong_AsUnsignedLong(pfd) <= UINT_MAX
 #endif
     ) {
         self->e.ident = IDENT_AsType(pfd);
@@ -2253,7 +2250,7 @@
 that are ready.\n\
 \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.");
 
 static PyMethodDef select_methods[] = {
@@ -2271,7 +2268,7 @@
 "This module supports asynchronous I/O on multiple file descriptors.\n\
 \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 = {
diff --git a/Modules/socketmodule.c b/Modules/socketmodule.c
--- a/Modules/socketmodule.c
+++ b/Modules/socketmodule.c
@@ -188,7 +188,7 @@
 #if defined(WITH_THREAD) && (defined(__APPLE__) || \
     (defined(__FreeBSD__) && __FreeBSD_version+0 < 503000) || \
     defined(__OpenBSD__) || defined(__NetBSD__) || \
-    defined(__VMS) || !defined(HAVE_GETADDRINFO))
+    !defined(HAVE_GETADDRINFO))
 #define USE_GETADDRINFO_LOCK
 #endif
 
@@ -212,10 +212,6 @@
 # include <ctype.h>
 #endif
 
-#if defined(__VMS)
-#  include <ioctl.h>
-#endif
-
 #ifdef __APPLE__
 # include <sys/ioctl.h>
 #endif
@@ -403,11 +399,6 @@
 #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 *". */
 #define SAS2SA(x)       (&((x)->sa))
 
@@ -556,37 +547,13 @@
     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
    internally. block = (1 | 0). */
 static int
 internal_setblocking(PySocketSockObject *s, int block)
 {
 #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;
 #endif
 #ifdef SOCK_NONBLOCK
@@ -598,7 +565,7 @@
 
     Py_BEGIN_ALLOW_THREADS
 #ifndef MS_WINDOWS
-#if (defined(HAVE_SYS_IOCTL_H) && defined(FIONBIO)) || defined(__VMS)
+#if (defined(HAVE_SYS_IOCTL_H) && defined(FIONBIO))
     block = !block;
     ioctl(s->sock_fd, FIONBIO, (unsigned int *)&block);
 #else
@@ -2227,13 +2194,7 @@
             return s->errorhandler();
         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) {
-#endif
         PyErr_SetString(PyExc_OSError,
                         "getsockopt buflen out of range");
         return NULL;
@@ -2603,10 +2564,6 @@
 {
     Py_ssize_t outlen = -1;
     int timeout;
-#ifdef __VMS
-    int remaining;
-    char *read_buf;
-#endif
 
     if (!IS_SELECTABLE(s)) {
         select_error();
@@ -2617,7 +2574,6 @@
         return 0;
     }
 
-#ifndef __VMS
     BEGIN_SELECT_LOOP(s)
     Py_BEGIN_ALLOW_THREADS
     timeout = internal_select_ex(s, 0, interval);
@@ -2643,48 +2599,6 @@
         s->errorhandler();
         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;
 }
 
@@ -3318,9 +3232,7 @@
     Py_BEGIN_ALLOW_THREADS
     timeout = internal_select_ex(s, 1, interval);
     if (!timeout) {
-#ifdef __VMS
-        n = sendsegmented(s->sock_fd, buf, len, flags);
-#elif defined(MS_WINDOWS)
+#ifdef MS_WINDOWS
         if (len > INT_MAX)
             len = INT_MAX;
         n = send(s->sock_fd, buf, (int)len, flags);
@@ -3375,9 +3287,7 @@
         timeout = internal_select(s, 1);
         n = -1;
         if (!timeout) {
-#ifdef __VMS
-            n = sendsegmented(s->sock_fd, buf, len, flags);
-#elif defined(MS_WINDOWS)
+#ifdef MS_WINDOWS
             if (len > INT_MAX)
                 len = INT_MAX;
             n = send(s->sock_fd, buf, (int)len, flags);
@@ -5310,9 +5220,9 @@
 #if defined(__APPLE__) && defined(AI_NUMERICSERV)
     if ((flags & AI_NUMERICSERV) && (pptr == NULL || (pptr[0] == '0' && pptr[1] == 0))) {
         /* On OSX upto at least OSX 10.8 getaddrinfo crashes
-	 * if AI_NUMERICSERV is set and the servname is NULL or "0".
-	 * This workaround avoids a segfault in libsystem.
-	 */
+         * if AI_NUMERICSERV is set and the servname is NULL or "0".
+         * This workaround avoids a segfault in libsystem.
+         */
         pptr = "00";
     }
 #endif
diff --git a/Objects/exceptions.c b/Objects/exceptions.c
--- a/Objects/exceptions.c
+++ b/Objects/exceptions.c
@@ -16,9 +16,6 @@
 #ifdef MS_WINDOWS
 PyObject *PyExc_WindowsError = NULL;
 #endif
-#ifdef __VMS
-PyObject *PyExc_VMSError = NULL;
-#endif
 
 /* The dict map from errno codes to OSError subclasses */
 static PyObject *errnomap = NULL;
@@ -2473,9 +2470,6 @@
 #ifdef MS_WINDOWS
     INIT_ALIAS(WindowsError, OSError)
 #endif
-#ifdef __VMS
-    INIT_ALIAS(VMSError, OSError)
-#endif
     POST_INIT(EOFError)
     POST_INIT(RuntimeError)
     POST_INIT(NotImplementedError)
diff --git a/Parser/myreadline.c b/Parser/myreadline.c
--- a/Parser/myreadline.c
+++ b/Parser/myreadline.c
@@ -15,10 +15,6 @@
 #include "windows.h"
 #endif /* MS_WINDOWS */
 
-#ifdef __VMS
-extern char* vms__StdioReadline(FILE *sys_stdin, FILE *sys_stdout, char *prompt);
-#endif
-
 
 PyThreadState* _PyOS_ReadlineTState;
 
@@ -189,11 +185,7 @@
 
 
     if (PyOS_ReadlineFunctionPointer == NULL) {
-#ifdef __VMS
-        PyOS_ReadlineFunctionPointer = vms__StdioReadline;
-#else
         PyOS_ReadlineFunctionPointer = PyOS_StdioReadline;
-#endif
     }
 
 #ifdef WITH_THREAD
diff --git a/Python/dynload_shlib.c b/Python/dynload_shlib.c
--- a/Python/dynload_shlib.c
+++ b/Python/dynload_shlib.c
@@ -36,25 +36,16 @@
 #ifdef __CYGWIN__
     ".dll",
 #else  /* !__CYGWIN__ */
-#ifdef __VMS
-    ".exe",
-    ".EXE",
-#else  /* !__VMS */
     "." SOABI ".so",
     ".abi" PYTHON_ABI_STRING ".so",
     ".so",
-#endif  /* __VMS */
 #endif  /* __CYGWIN__ */
     NULL,
 };
 
 static struct {
     dev_t dev;
-#ifdef __VMS
-    ino_t ino[3];
-#else
     ino_t ino;
-#endif
     void *handle;
 } handles[128];
 static int nhandles = 0;
@@ -95,29 +86,12 @@
         }
         if (nhandles < 128) {
             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;
-#endif
         }
     }
 
     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);
 
     if (handle == NULL) {
diff --git a/Python/random.c b/Python/random.c
--- a/Python/random.c
+++ b/Python/random.c
@@ -68,28 +68,7 @@
 #endif /* MS_WINDOWS */
 
 
-#ifdef __VMS
-/* 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)
+#ifndef MS_WINDOWS
 static int urandom_fd = -1;
 
 /* Read size bytes from /dev/urandom into buffer.
@@ -195,7 +174,7 @@
     }
 }
 
-#endif /* !defined(MS_WINDOWS) && !defined(__VMS) */
+#endif /* MS_WINDOWS */
 
 /* Fill buffer with pseudo-random bytes generated by a linear congruent
    generator (LCG):
@@ -237,11 +216,7 @@
 #ifdef MS_WINDOWS
     return win32_urandom((unsigned char *)buffer, size, 1);
 #else
-# ifdef __VMS
-    return vms_urandom((unsigned char *)buffer, size, 1);
-# else
     return dev_urandom_python((char*)buffer, size);
-# endif
 #endif
 }
 
@@ -285,12 +260,8 @@
     else {
 #ifdef MS_WINDOWS
         (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);
-# endif
 #endif
     }
 }
@@ -298,7 +269,7 @@
 void
 _PyRandom_Fini(void)
 {
-#if !defined(MS_WINDOWS) && !defined(__VMS)
+#ifndef MS_WINDOWS
     dev_urandom_close();
 #endif
 }
diff --git a/Python/sysmodule.c b/Python/sysmodule.c
--- a/Python/sysmodule.c
+++ b/Python/sysmodule.c
@@ -32,10 +32,6 @@
 extern const char *PyWin_DLLVersionString;
 #endif
 
-#ifdef __VMS
-#include <unixlib.h>
-#endif
-
 #ifdef HAVE_LANGINFO_H
 #include <locale.h>
 #include <langinfo.h>
@@ -1867,22 +1863,7 @@
     if (av != NULL) {
         int 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);
-#endif
             if (v == NULL) {
                 Py_DECREF(av);
                 av = NULL;

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list