Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 3d17a5c

Browse files
committed
Merged revisions 64214 via svnmerge from
svn+ssh://[email protected]/python/trunk ........ r64214 | amaury.forgeotdarc | 2008-06-13 02:42:22 +0200 (ven., 13 juin 2008) | 6 lines Restore support for Microsoft VC6 compiler. Some functions in the msvcrt module are skipped, and socket.ioctl is enabled only when using a more recent Platform SDK. (and yes, there are still companies that use a 10-years old compiler) ........
1 parent e68df0f commit 3d17a5c

9 files changed

Lines changed: 35 additions & 53 deletions

File tree

Include/pythonrun.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ PyAPI_DATA(PyThreadState*) _PyOS_ReadlineTState;
154154
to a 8k margin. */
155155
#define PYOS_STACK_MARGIN 2048
156156

157-
#if defined(WIN32) && !defined(MS_WIN64) && defined(_MSC_VER)
157+
#if defined(WIN32) && !defined(MS_WIN64) && defined(_MSC_VER) && _MSC_VER >= 1300
158158
/* Enable stack checking under Microsoft C */
159159
#define USE_STACKCHECK
160160
#endif

Modules/errnomodule.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
/* Windows socket errors (WSA*) */
77
#ifdef MS_WINDOWS
88
#define WIN32_LEAN_AND_MEAN
9-
#include <winsock.h>
9+
#include <windows.h>
1010
#endif
1111

1212
/*

Modules/socketmodule.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2628,7 +2628,7 @@ PyDoc_STRVAR(shutdown_doc,
26282628
Shut down the reading side of the socket (flag == SHUT_RD), the writing side\n\
26292629
of the socket (flag == SHUT_WR), or both ends (flag == SHUT_RDWR).");
26302630

2631-
#ifdef MS_WINDOWS
2631+
#if defined(MS_WINDOWS) && defined(SIO_RCVALL)
26322632
static PyObject*
26332633
sock_ioctl(PySocketSockObject *s, PyObject *arg)
26342634
{
@@ -2677,7 +2677,7 @@ static PyMethodDef sock_methods[] = {
26772677
METH_NOARGS, getsockname_doc},
26782678
{"getsockopt", (PyCFunction)sock_getsockopt, METH_VARARGS,
26792679
getsockopt_doc},
2680-
#ifdef MS_WINDOWS
2680+
#if defined(MS_WINDOWS) && defined(SIO_RCVALL)
26812681
{"ioctl", (PyCFunction)sock_ioctl, METH_VARARGS,
26822682
sock_ioctl_doc},
26832683
#endif

Modules/socketmodule.h

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -13,20 +13,23 @@
1313
# endif
1414

1515
#else /* MS_WINDOWS */
16-
#if _MSC_VER >= 1300
1716
# include <winsock2.h>
1817
# include <ws2tcpip.h>
19-
# include <MSTcpIP.h> /* for SIO_RCVALL */
20-
# define HAVE_ADDRINFO
21-
# define HAVE_SOCKADDR_STORAGE
22-
# define HAVE_GETADDRINFO
23-
# define HAVE_GETNAMEINFO
24-
# define ENABLE_IPV6
25-
#else
26-
# define WIN32_LEAN_AND_MEAN
27-
# include <winsock.h>
28-
#endif
29-
#endif
18+
/* VC6 is shipped with old platform headers, and does not have MSTcpIP.h
19+
* Separate SDKs have all the functions we want, but older ones don't have
20+
* any version information. I use IPPROTO_IPV6 to detect a decent SDK.
21+
*/
22+
# ifdef IPPROTO_IPV6
23+
# include <MSTcpIP.h> /* for SIO_RCVALL */
24+
# define HAVE_ADDRINFO
25+
# define HAVE_SOCKADDR_STORAGE
26+
# define HAVE_GETADDRINFO
27+
# define HAVE_GETNAMEINFO
28+
# define ENABLE_IPV6
29+
# else
30+
typedef int socklen_t;
31+
# endif /* IPPROTO_IPV6 */
32+
#endif /* MS_WINDOWS */
3033

3134
#ifdef HAVE_SYS_UN_H
3235
# include <sys/un.h>

PC/VC6/_socket.dsp

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

PC/VC6/pythoncore.dsp

Lines changed: 8 additions & 20 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

PC/getpathp.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,8 +117,7 @@ reduce(wchar_t *dir)
117117
static int
118118
exists(wchar_t *filename)
119119
{
120-
struct _stat64 buf;
121-
return _wstat64(filename, &buf) == 0;
120+
return GetFileAttributesW(filename) != 0xFFFFFFFF;
122121
}
123122

124123
/* Assumes 'filename' MAXPATHLEN+1 bytes long -

PC/msvcrtmodule.c

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ msvcrt_getch(PyObject *self, PyObject *args)
145145
return PyBytes_FromStringAndSize(s, 1);
146146
}
147147

148-
#if _MSC_VER >= 1300
148+
#ifdef _WCONIO_DEFINED
149149
static PyObject *
150150
msvcrt_getwch(PyObject *self, PyObject *args)
151151
{
@@ -179,7 +179,7 @@ msvcrt_getche(PyObject *self, PyObject *args)
179179
return PyBytes_FromStringAndSize(s, 1);
180180
}
181181

182-
#if _MSC_VER >= 1300
182+
#ifdef _WCONIO_DEFINED
183183
static PyObject *
184184
msvcrt_getwche(PyObject *self, PyObject *args)
185185
{
@@ -210,8 +210,7 @@ msvcrt_putch(PyObject *self, PyObject *args)
210210
return Py_None;
211211
}
212212

213-
214-
#if _MSC_VER >= 1300
213+
#ifdef _WCONIO_DEFINED
215214
static PyObject *
216215
msvcrt_putwch(PyObject *self, PyObject *args)
217216
{
@@ -246,7 +245,7 @@ msvcrt_ungetch(PyObject *self, PyObject *args)
246245
return Py_None;
247246
}
248247

249-
#if _MSC_VER >= 1300
248+
#ifdef _WCONIO_DEFINED
250249
static PyObject *
251250
msvcrt_ungetwch(PyObject *self, PyObject *args)
252251
{
@@ -349,7 +348,7 @@ static struct PyMethodDef msvcrt_functions[] = {
349348
{"CrtSetReportMode", msvcrt_setreportmode, METH_VARARGS},
350349
{"set_error_mode", msvcrt_seterrormode, METH_VARARGS},
351350
#endif
352-
#if _MSC_VER >= 1300
351+
#ifdef _WCONIO_DEFINED
353352
{"getwch", msvcrt_getwch, METH_VARARGS},
354353
{"getwche", msvcrt_getwche, METH_VARARGS},
355354
{"putwch", msvcrt_putwch, METH_VARARGS},

PC/pyconfig.h

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -463,13 +463,6 @@ Py_NO_ENABLE_SHARED to find out. Also support MS_NO_COREDLL for b/w compat */
463463
/* Define to `unsigned' if <sys/types.h> doesn't define. */
464464
/* #undef size_t */
465465

466-
/* Define to `int' if <sys/types.h> doesn't define. */
467-
#if _MSC_VER + 0 >= 1300
468-
/* VC.NET typedefs socklen_t in ws2tcpip.h. */
469-
#else
470-
#define socklen_t int
471-
#endif
472-
473466
/* Define if you have the ANSI C header files. */
474467
#define STDC_HEADERS 1
475468

0 commit comments

Comments
 (0)