Skip to content

Commit b24bb27

Browse files
author
Hirokazu Yamamoto
committed
Issue #3527: Removed Py_WIN_WIDE_FILENAMES which is not used any more.
1 parent 0c3b4c6 commit b24bb27

File tree

6 files changed

+32
-52
lines changed

6 files changed

+32
-52
lines changed

Include/pyerrors.h

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ PyAPI_FUNC(void) PyErr_NormalizeException(PyObject**, PyObject**, PyObject**);
112112
? (PyObject*)((PyInstanceObject*)(x))->in_class \
113113
: (PyObject*)((x)->ob_type)))
114114

115-
115+
116116
/* Predefined exceptions */
117117

118118
PyAPI_DATA(PyObject *) PyExc_BaseException;
@@ -186,10 +186,10 @@ PyAPI_FUNC(PyObject *) PyErr_SetFromErrno(PyObject *);
186186
PyAPI_FUNC(PyObject *) PyErr_SetFromErrnoWithFilenameObject(
187187
PyObject *, PyObject *);
188188
PyAPI_FUNC(PyObject *) PyErr_SetFromErrnoWithFilename(PyObject *, char *);
189-
#ifdef Py_WIN_WIDE_FILENAMES
189+
#ifdef MS_WINDOWS
190190
PyAPI_FUNC(PyObject *) PyErr_SetFromErrnoWithUnicodeFilename(
191191
PyObject *, Py_UNICODE *);
192-
#endif /* Py_WIN_WIDE_FILENAMES */
192+
#endif /* MS_WINDOWS */
193193

194194
PyAPI_FUNC(PyObject *) PyErr_Format(PyObject *, const char *, ...)
195195
Py_GCC_ATTRIBUTE((format(printf, 2, 3)));
@@ -199,19 +199,15 @@ PyAPI_FUNC(PyObject *) PyErr_SetFromWindowsErrWithFilenameObject(
199199
int, const char *);
200200
PyAPI_FUNC(PyObject *) PyErr_SetFromWindowsErrWithFilename(
201201
int, const char *);
202-
#ifdef Py_WIN_WIDE_FILENAMES
203202
PyAPI_FUNC(PyObject *) PyErr_SetFromWindowsErrWithUnicodeFilename(
204203
int, const Py_UNICODE *);
205-
#endif /* Py_WIN_WIDE_FILENAMES */
206204
PyAPI_FUNC(PyObject *) PyErr_SetFromWindowsErr(int);
207205
PyAPI_FUNC(PyObject *) PyErr_SetExcFromWindowsErrWithFilenameObject(
208206
PyObject *,int, PyObject *);
209207
PyAPI_FUNC(PyObject *) PyErr_SetExcFromWindowsErrWithFilename(
210208
PyObject *,int, const char *);
211-
#ifdef Py_WIN_WIDE_FILENAMES
212209
PyAPI_FUNC(PyObject *) PyErr_SetExcFromWindowsErrWithUnicodeFilename(
213210
PyObject *,int, const Py_UNICODE *);
214-
#endif /* Py_WIN_WIDE_FILENAMES */
215211
PyAPI_FUNC(PyObject *) PyErr_SetExcFromWindowsErr(PyObject *, int);
216212
#endif /* MS_WINDOWS */
217213

Modules/_fileio.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ fileio_init(PyObject *oself, PyObject *args, PyObject *kwds)
178178
else {
179179
PyErr_Clear();
180180

181-
#ifdef Py_WIN_WIDE_FILENAMES
181+
#ifdef MS_WINDOWS
182182
if (GetVersion() < 0x80000000) {
183183
/* On NT, so wide API available */
184184
PyObject *po;

Modules/posixmodule.c

Lines changed: 25 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -523,13 +523,13 @@ posix_error_with_filename(char* name)
523523
return PyErr_SetFromErrnoWithFilename(PyExc_OSError, name);
524524
}
525525

526-
#ifdef Py_WIN_WIDE_FILENAMES
526+
#ifdef MS_WINDOWS
527527
static PyObject *
528528
posix_error_with_unicode_filename(Py_UNICODE* name)
529529
{
530530
return PyErr_SetFromErrnoWithUnicodeFilename(PyExc_OSError, name);
531531
}
532-
#endif /* Py_WIN_WIDE_FILENAMES */
532+
#endif /* MS_WINDOWS */
533533

534534

535535
static PyObject *
@@ -556,7 +556,6 @@ win32_error(char* function, char* filename)
556556
return PyErr_SetFromWindowsErr(errno);
557557
}
558558

559-
#ifdef Py_WIN_WIDE_FILENAMES
560559
static PyObject *
561560
win32_error_unicode(char* function, Py_UNICODE* filename)
562561
{
@@ -585,9 +584,7 @@ convert_to_unicode(PyObject **param)
585584
return (*param) != NULL;
586585
}
587586

588-
#endif /* Py_WIN_WIDE_FILENAMES */
589-
590-
#endif
587+
#endif /* MS_WINDOWS */
591588

592589
#if defined(PYOS_OS2)
593590
/**********************************************************************
@@ -686,7 +683,7 @@ posix_fildes(PyObject *fdobj, int (*func)(int))
686683
return Py_None;
687684
}
688685

689-
#ifdef Py_WIN_WIDE_FILENAMES
686+
#ifdef MS_WINDOWS
690687
static int
691688
unicode_file_names(void)
692689
{
@@ -741,7 +738,7 @@ posix_2str(PyObject *args,
741738
return Py_None;
742739
}
743740

744-
#ifdef Py_WIN_WIDE_FILENAMES
741+
#ifdef MS_WINDOWS
745742
static PyObject*
746743
win32_1str(PyObject* args, char* func,
747744
char* format, BOOL (__stdcall *funcA)(LPCSTR),
@@ -1497,7 +1494,6 @@ IsUNCRootA(char *path, int pathlen)
14971494
#undef ISSLASH
14981495
}
14991496

1500-
#ifdef Py_WIN_WIDE_FILENAMES
15011497
static BOOL
15021498
IsUNCRootW(Py_UNICODE *path, int pathlen)
15031499
{
@@ -1520,7 +1516,6 @@ IsUNCRootW(Py_UNICODE *path, int pathlen)
15201516

15211517
#undef ISSLASH
15221518
}
1523-
#endif /* Py_WIN_WIDE_FILENAMES */
15241519
#endif /* MS_WINDOWS */
15251520

15261521
static PyObject *
@@ -1540,7 +1535,7 @@ posix_do_stat(PyObject *self, PyObject *args,
15401535
int res;
15411536
PyObject *result;
15421537

1543-
#ifdef Py_WIN_WIDE_FILENAMES
1538+
#ifdef MS_WINDOWS
15441539
/* If on wide-character-capable OS see if argument
15451540
is Unicode and if so use wide API. */
15461541
if (unicode_file_names()) {
@@ -1603,7 +1598,7 @@ posix_access(PyObject *self, PyObject *args)
16031598
char *path;
16041599
int mode;
16051600

1606-
#ifdef Py_WIN_WIDE_FILENAMES
1601+
#ifdef MS_WINDOWS
16071602
DWORD attr;
16081603
if (unicode_file_names()) {
16091604
PyUnicodeObject *po;
@@ -1636,7 +1631,7 @@ posix_access(PyObject *self, PyObject *args)
16361631
return PyBool_FromLong(!(mode & 2)
16371632
|| !(attr & FILE_ATTRIBUTE_READONLY)
16381633
|| (attr & FILE_ATTRIBUTE_DIRECTORY));
1639-
#else
1634+
#else /* MS_WINDOWS */
16401635
int res;
16411636
if (!PyArg_ParseTuple(args, "eti:access",
16421637
Py_FileSystemDefaultEncoding, &path, &mode))
@@ -1646,7 +1641,7 @@ posix_access(PyObject *self, PyObject *args)
16461641
Py_END_ALLOW_THREADS
16471642
PyMem_Free(path);
16481643
return PyBool_FromLong(res == 0);
1649-
#endif
1644+
#endif /* MS_WINDOWS */
16501645
}
16511646

16521647
#ifndef F_OK
@@ -1757,7 +1752,7 @@ posix_chmod(PyObject *self, PyObject *args)
17571752
char *path = NULL;
17581753
int i;
17591754
int res;
1760-
#ifdef Py_WIN_WIDE_FILENAMES
1755+
#ifdef MS_WINDOWS
17611756
DWORD attr;
17621757
if (unicode_file_names()) {
17631758
PyUnicodeObject *po;
@@ -1807,7 +1802,7 @@ posix_chmod(PyObject *self, PyObject *args)
18071802
PyMem_Free(path);
18081803
Py_INCREF(Py_None);
18091804
return Py_None;
1810-
#else /* Py_WIN_WIDE_FILENAMES */
1805+
#else /* MS_WINDOWS */
18111806
if (!PyArg_ParseTuple(args, "eti:chmod", Py_FileSystemDefaultEncoding,
18121807
&path, &i))
18131808
return NULL;
@@ -2092,7 +2087,7 @@ posix_getcwdu(PyObject *self, PyObject *noargs)
20922087
char buf[1026];
20932088
char *res;
20942089

2095-
#ifdef Py_WIN_WIDE_FILENAMES
2090+
#ifdef MS_WINDOWS
20962091
DWORD len;
20972092
if (unicode_file_names()) {
20982093
wchar_t wbuf[1026];
@@ -2121,7 +2116,7 @@ posix_getcwdu(PyObject *self, PyObject *noargs)
21212116
if (wbuf2 != wbuf) free(wbuf2);
21222117
return resobj;
21232118
}
2124-
#endif
2119+
#endif /* MS_WINDOWS */
21252120

21262121
Py_BEGIN_ALLOW_THREADS
21272122
#if defined(PYOS_OS2) && defined(PYCC_GCC)
@@ -2134,8 +2129,8 @@ posix_getcwdu(PyObject *self, PyObject *noargs)
21342129
return posix_error();
21352130
return PyUnicode_Decode(buf, strlen(buf), Py_FileSystemDefaultEncoding,"strict");
21362131
}
2137-
#endif
2138-
#endif
2132+
#endif /* Py_USING_UNICODE */
2133+
#endif /* HAVE_GETCWD */
21392134

21402135

21412136
#ifdef HAVE_LINK
@@ -2175,7 +2170,6 @@ posix_listdir(PyObject *self, PyObject *args)
21752170
char *bufptr = namebuf;
21762171
Py_ssize_t len = sizeof(namebuf)-5; /* only claim to have space for MAX_PATH */
21772172

2178-
#ifdef Py_WIN_WIDE_FILENAMES
21792173
/* If on wide-character-capable OS see if argument
21802174
is Unicode and if so use wide API. */
21812175
if (unicode_file_names()) {
@@ -2258,7 +2252,6 @@ posix_listdir(PyObject *self, PyObject *args)
22582252
are also valid. */
22592253
PyErr_Clear();
22602254
}
2261-
#endif
22622255

22632256
if (!PyArg_ParseTuple(args, "et#:listdir",
22642257
Py_FileSystemDefaultEncoding, &bufptr, &len))
@@ -2482,7 +2475,7 @@ posix__getfullpathname(PyObject *self, PyObject *args)
24822475
Py_ssize_t insize = sizeof(inbuf);
24832476
char outbuf[MAX_PATH*2];
24842477
char *temp;
2485-
#ifdef Py_WIN_WIDE_FILENAMES
2478+
24862479
if (unicode_file_names()) {
24872480
PyUnicodeObject *po;
24882481
if (PyArg_ParseTuple(args, "U|:_getfullpathname", &po)) {
@@ -2512,7 +2505,7 @@ posix__getfullpathname(PyObject *self, PyObject *args)
25122505
are also valid. */
25132506
PyErr_Clear();
25142507
}
2515-
#endif
2508+
25162509
if (!PyArg_ParseTuple (args, "et#:_getfullpathname",
25172510
Py_FileSystemDefaultEncoding, &inbufp,
25182511
&insize))
@@ -2539,7 +2532,7 @@ posix_mkdir(PyObject *self, PyObject *args)
25392532
char *path = NULL;
25402533
int mode = 0777;
25412534

2542-
#ifdef Py_WIN_WIDE_FILENAMES
2535+
#ifdef MS_WINDOWS
25432536
if (unicode_file_names()) {
25442537
PyUnicodeObject *po;
25452538
if (PyArg_ParseTuple(args, "U|i:mkdir", &po, &mode)) {
@@ -2573,7 +2566,7 @@ posix_mkdir(PyObject *self, PyObject *args)
25732566
PyMem_Free(path);
25742567
Py_INCREF(Py_None);
25752568
return Py_None;
2576-
#else
2569+
#else /* MS_WINDOWS */
25772570

25782571
if (!PyArg_ParseTuple(args, "et|i:mkdir",
25792572
Py_FileSystemDefaultEncoding, &path, &mode))
@@ -2590,7 +2583,7 @@ posix_mkdir(PyObject *self, PyObject *args)
25902583
PyMem_Free(path);
25912584
Py_INCREF(Py_None);
25922585
return Py_None;
2593-
#endif
2586+
#endif /* MS_WINDOWS */
25942587
}
25952588

25962589

@@ -2833,7 +2826,7 @@ second form is used, set the access and modified times to the current time.");
28332826
static PyObject *
28342827
posix_utime(PyObject *self, PyObject *args)
28352828
{
2836-
#ifdef Py_WIN_WIDE_FILENAMES
2829+
#ifdef MS_WINDOWS
28372830
PyObject *arg;
28382831
PyUnicodeObject *obwpath;
28392832
wchar_t *wpath = NULL;
@@ -2911,7 +2904,7 @@ posix_utime(PyObject *self, PyObject *args)
29112904
done:
29122905
CloseHandle(hFile);
29132906
return result;
2914-
#else /* Py_WIN_WIDE_FILENAMES */
2907+
#else /* MS_WINDOWS */
29152908

29162909
char *path = NULL;
29172910
long atime, mtime, ausec, musec;
@@ -2985,7 +2978,7 @@ posix_utime(PyObject *self, PyObject *args)
29852978
#undef UTIME_ARG
29862979
#undef ATIME
29872980
#undef MTIME
2988-
#endif /* Py_WIN_WIDE_FILENAMES */
2981+
#endif /* MS_WINDOWS */
29892982
}
29902983

29912984

@@ -8273,7 +8266,7 @@ win32_startfile(PyObject *self, PyObject *args)
82738266
char *filepath;
82748267
char *operation = NULL;
82758268
HINSTANCE rc;
8276-
#ifdef Py_WIN_WIDE_FILENAMES
8269+
82778270
if (unicode_file_names()) {
82788271
PyObject *unipath, *woperation = NULL;
82798272
if (!PyArg_ParseTuple(args, "U|s:startfile",
@@ -8308,7 +8301,6 @@ win32_startfile(PyObject *self, PyObject *args)
83088301
Py_INCREF(Py_None);
83098302
return Py_None;
83108303
}
8311-
#endif
83128304

83138305
normal:
83148306
if (!PyArg_ParseTuple(args, "et|s:startfile",
@@ -8328,7 +8320,7 @@ win32_startfile(PyObject *self, PyObject *args)
83288320
Py_INCREF(Py_None);
83298321
return Py_None;
83308322
}
8331-
#endif
8323+
#endif /* MS_WINDOWS */
83328324

83338325
#ifdef HAVE_GETLOADAVG
83348326
PyDoc_STRVAR(posix_getloadavg__doc__,

Objects/fileobject.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2254,7 +2254,7 @@ file_init(PyObject *self, PyObject *args, PyObject *kwds)
22542254
Py_DECREF(closeresult);
22552255
}
22562256

2257-
#ifdef Py_WIN_WIDE_FILENAMES
2257+
#ifdef MS_WINDOWS
22582258
if (GetVersion() < 0x80000000) { /* On NT, so wide API available */
22592259
PyObject *po;
22602260
if (PyArg_ParseTupleAndKeywords(args, kwds, "U|si:file",

PC/pyconfig.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -565,10 +565,6 @@ Py_NO_ENABLE_SHARED to find out. Also support MS_NO_COREDLL for b/w compat */
565565
/* This is enough for unicodeobject.h to do the "right thing" on Windows. */
566566
#define Py_UNICODE_SIZE 2
567567

568-
/* Define to indicate that the Python Unicode representation can be passed
569-
as-is to Win32 Wide API. */
570-
#define Py_WIN_WIDE_FILENAMES
571-
572568
/* Use Python's own small-block memory-allocator. */
573569
#define WITH_PYMALLOC 1
574570

Python/errors.c

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -379,7 +379,7 @@ PyErr_SetFromErrnoWithFilename(PyObject *exc, char *filename)
379379
return result;
380380
}
381381

382-
#ifdef Py_WIN_WIDE_FILENAMES
382+
#ifdef MS_WINDOWS
383383
PyObject *
384384
PyErr_SetFromErrnoWithUnicodeFilename(PyObject *exc, Py_UNICODE *filename)
385385
{
@@ -390,7 +390,7 @@ PyErr_SetFromErrnoWithUnicodeFilename(PyObject *exc, Py_UNICODE *filename)
390390
Py_XDECREF(name);
391391
return result;
392392
}
393-
#endif /* Py_WIN_WIDE_FILENAMES */
393+
#endif /* MS_WINDOWS */
394394

395395
PyObject *
396396
PyErr_SetFromErrno(PyObject *exc)
@@ -460,7 +460,6 @@ PyObject *PyErr_SetExcFromWindowsErrWithFilename(
460460
return ret;
461461
}
462462

463-
#ifdef Py_WIN_WIDE_FILENAMES
464463
PyObject *PyErr_SetExcFromWindowsErrWithUnicodeFilename(
465464
PyObject *exc,
466465
int ierr,
@@ -475,7 +474,6 @@ PyObject *PyErr_SetExcFromWindowsErrWithUnicodeFilename(
475474
Py_XDECREF(name);
476475
return ret;
477476
}
478-
#endif /* Py_WIN_WIDE_FILENAMES */
479477

480478
PyObject *PyErr_SetExcFromWindowsErr(PyObject *exc, int ierr)
481479
{
@@ -499,7 +497,6 @@ PyObject *PyErr_SetFromWindowsErrWithFilename(
499497
return result;
500498
}
501499

502-
#ifdef Py_WIN_WIDE_FILENAMES
503500
PyObject *PyErr_SetFromWindowsErrWithUnicodeFilename(
504501
int ierr,
505502
const Py_UNICODE *filename)
@@ -513,7 +510,6 @@ PyObject *PyErr_SetFromWindowsErrWithUnicodeFilename(
513510
Py_XDECREF(name);
514511
return result;
515512
}
516-
#endif /* Py_WIN_WIDE_FILENAMES */
517513
#endif /* MS_WINDOWS */
518514

519515
void

0 commit comments

Comments
 (0)