summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNeal Norwitz <nnorwitz@gmail.com>2006-03-14 06:47:07 (GMT)
committerNeal Norwitz <nnorwitz@gmail.com>2006-03-14 06:47:07 (GMT)
commit8a2bffc2351fb867dacbe1646a219a8151166642 (patch)
tree3a78bce7d9ac93787d427ab2a1ca381cee044ca2
parent9165680203a10341e7e76c92d12c76f5ddd1f6e1 (diff)
downloadcpython-8a2bffc2351fb867dacbe1646a219a8151166642.zip
cpython-8a2bffc2351fb867dacbe1646a219a8151166642.tar.gz
cpython-8a2bffc2351fb867dacbe1646a219a8151166642.tar.bz2
Backport 42932:
Try to be a bit more consistent on all platforms: python . python < . both print a message, return non-zero and do not core dump. This hopefully fixes the failure on Solaris.
-rw-r--r--Lib/test/test_cmd_line.py10
-rw-r--r--Modules/main.c3
2 files changed, 4 insertions, 9 deletions
diff --git a/Lib/test/test_cmd_line.py b/Lib/test/test_cmd_line.py
index 20e4afa..a4a656d 100644
--- a/Lib/test/test_cmd_line.py
+++ b/Lib/test/test_cmd_line.py
@@ -16,14 +16,8 @@ class CmdLineTest(unittest.TestCase):
return subprocess.call([sys.executable, cmd_line], stderr=subprocess.PIPE)
def test_directories(self):
- if sys.platform == 'win32':
- # Exit code for "python .", Error 13: permission denied = 2
- expected_exit_code = 2
- else:
- # Linux has no problem with "python .", Exit code = 0
- expected_exit_code = 0
- self.assertEqual(self.exit_code('.'), expected_exit_code)
- self.assertTrue(self.exit_code('< .') != 0)
+ self.assertNotEqual(self.exit_code('.'), 0)
+ self.assertNotEqual(self.exit_code('< .'), 0)
def verify_valid_flag(self, cmd_line):
data = self.start_python(cmd_line)
diff --git a/Modules/main.c b/Modules/main.c
index d511e59..f4f0bf6 100644
--- a/Modules/main.c
+++ b/Modules/main.c
@@ -364,7 +364,8 @@ Py_Main(int argc, char **argv)
struct stat sb;
if (fstat(fileno(fp), &sb) == 0 &&
S_ISDIR(sb.st_mode)) {
- fprintf(stderr, "%s: warning '%s' is a directory\n", argv[0], filename);
+ fprintf(stderr, "%s: '%s' is a directory, cannot continue\n", argv[0], filename);
+ return 1;
}
}
}