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

Skip to content

Commit c36625b

Browse files
committed
Some VS 6.0 compatibility fixes from Hirokazu Yamamoto which are also useful for later versions of MSVC. VS6 claims that fortran is a reserved word
1 parent 8fd7b0c commit c36625b

6 files changed

Lines changed: 19 additions & 6 deletions

File tree

Include/abstract.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -570,11 +570,11 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/
570570
error (i.e. the object does not have a buffer interface or
571571
it is not working).
572572
573-
If fortran is 'F', then if the object is multi-dimensional,
573+
If fort is 'F', then if the object is multi-dimensional,
574574
then the data will be copied into the array in
575575
Fortran-style (first dimension varies the fastest). If
576-
fortran is 'C', then the data will be copied into the array
577-
in C-style (last dimension varies the fastest). If fortran
576+
fort is 'C', then the data will be copied into the array
577+
in C-style (last dimension varies the fastest). If fort
578578
is 'A', then it does not matter and the copy will be made
579579
in whatever way is more efficient.
580580
@@ -585,7 +585,7 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/
585585
/* Copy the data from the src buffer to the buffer of destination
586586
*/
587587

588-
PyAPI_FUNC(int) PyBuffer_IsContiguous(Py_buffer *view, char fortran);
588+
PyAPI_FUNC(int) PyBuffer_IsContiguous(Py_buffer *view, char fort);
589589

590590

591591
PyAPI_FUNC(void) PyBuffer_FillContiguousStrides(int ndims,
@@ -595,7 +595,7 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/
595595
char fort);
596596

597597
/* Fill the strides array with byte-strides of a contiguous
598-
(Fortran-style if fortran is 'F' or C-style otherwise)
598+
(Fortran-style if fort is 'F' or C-style otherwise)
599599
array of the given shape with the given number of bytes
600600
per element.
601601
*/

Modules/errnomodule.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
/* Windows socket errors (WSA*) */
77
#ifdef MS_WINDOWS
8+
#define WIN32_LEAN_AND_MEAN
89
#include <winsock.h>
910
#endif
1011

Modules/selectmodule.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ extern void bzero(void *, int);
4444
#endif
4545

4646
#ifdef MS_WINDOWS
47+
# define WIN32_LEAN_AND_MEAN
4748
# include <winsock.h>
4849
#else
4950
# define SOCKET int

Modules/socketmodule.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
# define HAVE_GETNAMEINFO
2323
# define ENABLE_IPV6
2424
#else
25+
# define WIN32_LEAN_AND_MEAN
2526
# include <winsock.h>
2627
#endif
2728
#endif

Objects/longobject.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3530,7 +3530,7 @@ long_getnewargs(PyLongObject *v)
35303530

35313531
static PyObject *
35323532
long_getN(PyLongObject *v, void *context) {
3533-
return PyLong_FromLong((intptr_t)context);
3533+
return PyLong_FromLong((Py_intptr_t)context);
35343534
}
35353535

35363536
static PyObject *

PC/msvcrtmodule.c

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

148+
#if _MSC_VER >= 1300
148149
static PyObject *
149150
msvcrt_getwch(PyObject *self, PyObject *args)
150151
{
@@ -160,6 +161,7 @@ msvcrt_getwch(PyObject *self, PyObject *args)
160161
u[0] = ch;
161162
return PyUnicode_FromUnicode(u, 1);
162163
}
164+
#endif
163165

164166
static PyObject *
165167
msvcrt_getche(PyObject *self, PyObject *args)
@@ -177,6 +179,7 @@ msvcrt_getche(PyObject *self, PyObject *args)
177179
return PyString_FromStringAndSize(s, 1);
178180
}
179181

182+
#if _MSC_VER >= 1300
180183
static PyObject *
181184
msvcrt_getwche(PyObject *self, PyObject *args)
182185
{
@@ -192,6 +195,7 @@ msvcrt_getwche(PyObject *self, PyObject *args)
192195
s[0] = ch;
193196
return PyUnicode_FromUnicode(s, 1);
194197
}
198+
#endif
195199

196200
static PyObject *
197201
msvcrt_putch(PyObject *self, PyObject *args)
@@ -207,6 +211,7 @@ msvcrt_putch(PyObject *self, PyObject *args)
207211
}
208212

209213

214+
#if _MSC_VER >= 1300
210215
static PyObject *
211216
msvcrt_putwch(PyObject *self, PyObject *args)
212217
{
@@ -225,6 +230,7 @@ msvcrt_putwch(PyObject *self, PyObject *args)
225230
Py_RETURN_NONE;
226231

227232
}
233+
#endif
228234

229235
static PyObject *
230236
msvcrt_ungetch(PyObject *self, PyObject *args)
@@ -240,6 +246,7 @@ msvcrt_ungetch(PyObject *self, PyObject *args)
240246
return Py_None;
241247
}
242248

249+
#if _MSC_VER >= 1300
243250
static PyObject *
244251
msvcrt_ungetwch(PyObject *self, PyObject *args)
245252
{
@@ -253,6 +260,7 @@ msvcrt_ungetwch(PyObject *self, PyObject *args)
253260
Py_INCREF(Py_None);
254261
return Py_None;
255262
}
263+
#endif
256264

257265
static void
258266
insertint(PyObject *d, char *name, int value)
@@ -341,10 +349,12 @@ static struct PyMethodDef msvcrt_functions[] = {
341349
{"CrtSetReportMode", msvcrt_setreportmode, METH_VARARGS},
342350
{"set_error_mode", msvcrt_seterrormode, METH_VARARGS},
343351
#endif
352+
#if _MSC_VER >= 1300
344353
{"getwch", msvcrt_getwch, METH_VARARGS},
345354
{"getwche", msvcrt_getwche, METH_VARARGS},
346355
{"putwch", msvcrt_putwch, METH_VARARGS},
347356
{"ungetwch", msvcrt_ungetwch, METH_VARARGS},
357+
#endif
348358
{NULL, NULL}
349359
};
350360

0 commit comments

Comments
 (0)