Skip to content

Commit 14c81ab

Browse files
committed
#16135: Removal of OS/2 support (Modules/*)
1 parent ab70e2a commit 14c81ab

11 files changed

Lines changed: 4 additions & 157 deletions

Modules/_dbmmodule.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,7 @@
1414
*/
1515
#if defined(HAVE_NDBM_H)
1616
#include <ndbm.h>
17-
#if defined(PYOS_OS2) && !defined(PYCC_GCC)
18-
static char *which_dbm = "ndbm";
19-
#else
2017
static char *which_dbm = "GNU gdbm"; /* EMX port of GDBM */
21-
#endif
2218
#elif defined(HAVE_GDBM_NDBM_H)
2319
#include <gdbm/ndbm.h>
2420
static char *which_dbm = "GNU gdbm";

Modules/_lsprof.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,8 @@ hpTimerUnit(void)
3636
#error "This module requires gettimeofday() on non-Windows platforms!"
3737
#endif
3838

39-
#if (defined(PYOS_OS2) && defined(PYCC_GCC))
40-
#include <sys/time.h>
41-
#else
4239
#include <sys/resource.h>
4340
#include <sys/times.h>
44-
#endif
4541

4642
static PY_LONG_LONG
4743
hpTimer(void)

Modules/faulthandler.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,9 +79,6 @@ typedef struct {
7979
static user_signal_t *user_signals;
8080

8181
/* the following macros come from Python: Modules/signalmodule.c */
82-
#if defined(PYOS_OS2) && !defined(PYCC_GCC)
83-
#define NSIG 12
84-
#endif
8582
#ifndef NSIG
8683
# if defined(_NSIG)
8784
# define NSIG _NSIG /* For BSD/SysV */

Modules/fcntlmodule.c

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -325,11 +325,6 @@ fcntl_lockf(PyObject *self, PyObject *args)
325325
&lenobj, &startobj, &whence))
326326
return NULL;
327327

328-
#if defined(PYOS_OS2) && defined(PYCC_GCC)
329-
PyErr_SetString(PyExc_NotImplementedError,
330-
"lockf not supported on OS/2 (EMX)");
331-
return NULL;
332-
#else
333328
#ifndef LOCK_SH
334329
#define LOCK_SH 1 /* shared lock */
335330
#define LOCK_EX 2 /* exclusive lock */
@@ -383,7 +378,6 @@ fcntl_lockf(PyObject *self, PyObject *args)
383378
}
384379
Py_INCREF(Py_None);
385380
return Py_None;
386-
#endif /* defined(PYOS_OS2) && defined(PYCC_GCC) */
387381
}
388382

389383
PyDoc_STRVAR(lockf_doc,

Modules/pwdmodule.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -160,12 +160,8 @@ pwd_getpwall(PyObject *self)
160160
struct passwd *p;
161161
if ((d = PyList_New(0)) == NULL)
162162
return NULL;
163-
#if defined(PYOS_OS2) && defined(PYCC_GCC)
164-
if ((p = getpwuid(0)) != NULL) {
165-
#else
166163
setpwent();
167164
while ((p = getpwent()) != NULL) {
168-
#endif
169165
PyObject *v = mkpwent(p);
170166
if (v == NULL || PyList_Append(d, v) != 0) {
171167
Py_XDECREF(v);

Modules/readline.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -901,10 +901,6 @@ setup_readline(void)
901901
using_history();
902902

903903
rl_readline_name = "python";
904-
#if defined(PYOS_OS2) && defined(PYCC_GCC)
905-
/* Allow $if term= in .inputrc to work */
906-
rl_terminal_name = getenv("TERM");
907-
#endif
908904
/* Force rebind of TAB to insert-tab */
909905
rl_bind_key('\t', rl_insert);
910906
/* Bind both ESC-TAB and ESC-ESC to the completion function */

Modules/selectmodule.c

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,11 +47,6 @@ extern void bzero(void *, int);
4747
#include <sys/types.h>
4848
#endif
4949

50-
#if defined(PYOS_OS2) && !defined(PYCC_GCC)
51-
#include <sys/time.h>
52-
#include <utils.h>
53-
#endif
54-
5550
#ifdef MS_WINDOWS
5651
# define WIN32_LEAN_AND_MEAN
5752
# include <winsock.h>

Modules/signalmodule.c

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,6 @@
3434
#define SIG_ERR ((PyOS_sighandler_t)(-1))
3535
#endif
3636

37-
#if defined(PYOS_OS2) && !defined(PYCC_GCC)
38-
#define NSIG 12
39-
#include <process.h>
40-
#endif
41-
4237
#ifndef NSIG
4338
# if defined(_NSIG)
4439
# define NSIG _NSIG /* For BSD/SysV */

Modules/socketmodule.c

Lines changed: 3 additions & 94 deletions
Original file line numberDiff line numberDiff line change
@@ -223,13 +223,6 @@ if_indextoname(index) -- return the corresponding interface name\n\
223223
#endif
224224

225225

226-
#if defined(PYOS_OS2)
227-
# define INCL_DOS
228-
# define INCL_DOSERRORS
229-
# define INCL_NOPMAPI
230-
# include <os2.h>
231-
#endif
232-
233226
#if defined(__sgi) && _COMPILER_VERSION>700 && !_SGIAPI
234227
/* make sure that the reentrant (gethostbyaddr_r etc)
235228
functions are declared correctly if compiling with
@@ -286,12 +279,7 @@ if_indextoname(index) -- return the corresponding interface name\n\
286279
# include <unistd.h>
287280

288281
/* Headers needed for inet_ntoa() and inet_addr() */
289-
# if defined(PYOS_OS2) && defined(PYCC_VACPP)
290-
# include <netdb.h>
291-
typedef size_t socklen_t;
292-
# else
293282
# include <arpa/inet.h>
294-
# endif
295283

296284
# include <fcntl.h>
297285

@@ -395,11 +383,6 @@ dup_socket(SOCKET handle)
395383
#define snprintf _snprintf
396384
#endif
397385

398-
#if defined(PYOS_OS2) && !defined(PYCC_GCC)
399-
#define SOCKETCLOSE soclose
400-
#define NO_DUP /* Sockets are Not Actual File Handles under OS/2 */
401-
#endif
402-
403386
#ifndef SOCKETCLOSE
404387
#define SOCKETCLOSE close
405388
#endif
@@ -534,42 +517,6 @@ set_error(void)
534517
return PyErr_SetExcFromWindowsErr(PyExc_OSError, err_no);
535518
#endif
536519

537-
#if defined(PYOS_OS2) && !defined(PYCC_GCC)
538-
if (sock_errno() != NO_ERROR) {
539-
APIRET rc;
540-
ULONG msglen;
541-
char outbuf[100];
542-
int myerrorcode = sock_errno();
543-
544-
/* Retrieve socket-related error message from MPTN.MSG file */
545-
rc = DosGetMessage(NULL, 0, outbuf, sizeof(outbuf),
546-
myerrorcode - SOCBASEERR + 26,
547-
"mptn.msg",
548-
&msglen);
549-
if (rc == NO_ERROR) {
550-
PyObject *v;
551-
552-
/* OS/2 doesn't guarantee a terminator */
553-
outbuf[msglen] = '\0';
554-
if (strlen(outbuf) > 0) {
555-
/* If non-empty msg, trim CRLF */
556-
char *lastc = &outbuf[ strlen(outbuf)-1 ];
557-
while (lastc > outbuf &&
558-
isspace(Py_CHARMASK(*lastc))) {
559-
/* Trim trailing whitespace (CRLF) */
560-
*lastc-- = '\0';
561-
}
562-
}
563-
v = Py_BuildValue("(is)", myerrorcode, outbuf);
564-
if (v != NULL) {
565-
PyErr_SetObject(PyExc_OSError, v);
566-
Py_DECREF(v);
567-
}
568-
return NULL;
569-
}
570-
}
571-
#endif
572-
573520
return PyErr_SetFromErrno(PyExc_OSError);
574521
}
575522

@@ -658,20 +605,17 @@ internal_setblocking(PySocketSockObject *s, int block)
658605

659606
Py_BEGIN_ALLOW_THREADS
660607
#ifndef MS_WINDOWS
661-
#if defined(PYOS_OS2) && !defined(PYCC_GCC)
662-
block = !block;
663-
ioctl(s->sock_fd, FIONBIO, (caddr_t)&block, sizeof(block));
664-
#elif defined(__VMS)
608+
#if defined(__VMS)
665609
block = !block;
666610
ioctl(s->sock_fd, FIONBIO, (unsigned int *)&block);
667-
#else /* !PYOS_OS2 && !__VMS */
611+
#else /* !__VMS */
668612
delay_flag = fcntl(s->sock_fd, F_GETFL, 0);
669613
if (block)
670614
delay_flag &= (~O_NONBLOCK);
671615
else
672616
delay_flag |= O_NONBLOCK;
673617
fcntl(s->sock_fd, F_SETFL, delay_flag);
674-
#endif /* !PYOS_OS2 */
618+
#endif /* !__VMS */
675619
#else /* MS_WINDOWS */
676620
block = !block;
677621
ioctlsocket(s->sock_fd, FIONBIO, (u_long*)&block);
@@ -1329,11 +1273,7 @@ getsockaddrarg(PySocketSockObject *s, PyObject *args,
13291273
}
13301274
addr->sun_family = s->sock_family;
13311275
memcpy(addr->sun_path, path, len);
1332-
#if defined(PYOS_OS2)
1333-
*len_ret = sizeof(*addr);
1334-
#else
13351276
*len_ret = len + offsetof(struct sockaddr_un, sun_path);
1336-
#endif
13371277
retval = 1;
13381278
unix_out:
13391279
Py_DECREF(args);
@@ -2820,13 +2760,8 @@ sock_recvfrom_guts(PySocketSockObject *s, char* cbuf, Py_ssize_t len, int flags,
28202760
timeout = internal_select_ex(s, 0, interval);
28212761
if (!timeout) {
28222762
#ifndef MS_WINDOWS
2823-
#if defined(PYOS_OS2) && !defined(PYCC_GCC)
2824-
n = recvfrom(s->sock_fd, cbuf, len, flags,
2825-
SAS2SA(&addrbuf), &addrlen);
2826-
#else
28272763
n = recvfrom(s->sock_fd, cbuf, len, flags,
28282764
(void *) &addrbuf, &addrlen);
2829-
#endif
28302765
#else
28312766
n = recvfrom(s->sock_fd, cbuf, len, flags,
28322767
SAS2SA(&addrbuf), &addrlen);
@@ -5509,32 +5444,6 @@ os_init(void)
55095444
#endif /* MS_WINDOWS */
55105445

55115446

5512-
#ifdef PYOS_OS2
5513-
#define OS_INIT_DEFINED
5514-
5515-
/* Additional initialization for OS/2 */
5516-
5517-
static int
5518-
os_init(void)
5519-
{
5520-
#ifndef PYCC_GCC
5521-
int rc = sock_init();
5522-
5523-
if (rc == 0) {
5524-
return 1; /* Success */
5525-
}
5526-
5527-
PyErr_Format(PyExc_ImportError, "OS/2 TCP/IP Error# %d", sock_errno());
5528-
5529-
return 0; /* Failure */
5530-
#else
5531-
/* No need to initialize sockets with GCC/EMX */
5532-
return 1; /* Success */
5533-
#endif
5534-
}
5535-
5536-
#endif /* PYOS_OS2 */
5537-
55385447

55395448
#ifndef OS_INIT_DEFINED
55405449
static int

Modules/socketmodule.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
# include <sys/socket.h>
99
# endif
1010
# include <netinet/in.h>
11-
# if !(defined(__CYGWIN__) || (defined(PYOS_OS2) && defined(PYCC_VACPP)))
11+
# if !defined(__CYGWIN__)
1212
# include <netinet/tcp.h>
1313
# endif
1414

0 commit comments

Comments
 (0)