diff --git a/Python/bltinmodule.c b/Python/bltinmodule.c index fa6816279df..8f5a9325a53 100644 --- a/Python/bltinmodule.c +++ b/Python/bltinmodule.c @@ -592,7 +592,7 @@ builtin_execfile(PyObject *self, PyObject *args) exists = 0; /* Test for existence or directory. */ if (!stat(filename, &s)) { - if (S_ISDIR(s.st_mode)) + if ((s.st_mode & S_IFMT) == S_IFDIR) errno = EISDIR; else exists = 1;