mirror of
https://github.com/python/cpython.git
synced 2025-09-26 18:29:57 +00:00
Cosmetic changes to Christian's patch r58903.
(Consider this code review feedback. :-)
This commit is contained in:
parent
7d3bc0ade6
commit
c1bdbc316d
1 changed files with 5 additions and 7 deletions
|
@ -2939,12 +2939,12 @@ NullImporter_init(NullImporter *self, PyObject *args, PyObject *kwds)
|
||||||
struct stat statbuf;
|
struct stat statbuf;
|
||||||
int rv;
|
int rv;
|
||||||
|
|
||||||
|
rv = stat(path, &statbuf);
|
||||||
#ifdef MS_WINDOWS
|
#ifdef MS_WINDOWS
|
||||||
/* MS Windows' stat chokes on paths like C:\\path\\. Try to
|
/* MS Windows stat() chokes on paths like C:\path\. Try to
|
||||||
* recover *one* time by stripping of a trailing slash or
|
* recover *one* time by stripping off a trailing slash or
|
||||||
* backslash. http://bugs.python.org/issue1293
|
* backslash. http://bugs.python.org/issue1293
|
||||||
*/
|
*/
|
||||||
rv = stat(path, &statbuf);
|
|
||||||
if (rv != 0 && pathlen <= MAXPATHLEN &&
|
if (rv != 0 && pathlen <= MAXPATHLEN &&
|
||||||
(path[pathlen-1] == '/' || path[pathlen-1] == '\\')) {
|
(path[pathlen-1] == '/' || path[pathlen-1] == '\\')) {
|
||||||
char mangled[MAXPATHLEN+1];
|
char mangled[MAXPATHLEN+1];
|
||||||
|
@ -2953,8 +2953,6 @@ NullImporter_init(NullImporter *self, PyObject *args, PyObject *kwds)
|
||||||
mangled[pathlen-1] = '\0';
|
mangled[pathlen-1] = '\0';
|
||||||
rv = stat(mangled, &statbuf);
|
rv = stat(mangled, &statbuf);
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
rv = stat(path, &statbuf);
|
|
||||||
#endif
|
#endif
|
||||||
if (rv == 0) {
|
if (rv == 0) {
|
||||||
/* it exists */
|
/* it exists */
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue