changeset: 99439:b63fd82a8528 branch: 3.4 parent: 99436:4f4e2cbd2138 user: R David Murray date: Fri Dec 04 22:54:38 2015 -0500 files: Lib/compileall.py Lib/test/test_compileall.py Misc/ACKS Misc/NEWS description: #24903: Remove misleading error message to fix regression. Before the argparse conversion, compileall would (sometimes) accept multiple paths when -d was specified. Afterward, it does not. The corresponding check in the original code claimed to prevent multiple *directories* from being specified...but it didn't really work even to do that. So this patch fixes the regression by invoking the consenting adults rule: if you specify a combination of arguments to compileall that produces files with inconsistent destdirs (which you could do before), it is on you. Patch by Jake Garver. diff -r 4f4e2cbd2138 -r b63fd82a8528 Lib/compileall.py --- a/Lib/compileall.py Mon Nov 30 02:21:41 2015 +0000 +++ b/Lib/compileall.py Fri Dec 04 22:54:38 2015 -0500 @@ -196,9 +196,6 @@ compile_dests = args.compile_dest - if (args.ddir and (len(compile_dests) != 1 - or not os.path.isdir(compile_dests[0]))): - parser.exit('-d destdir requires exactly one directory argument') if args.rx: import re args.rx = re.compile(args.rx) diff -r 4f4e2cbd2138 -r b63fd82a8528 Lib/test/test_compileall.py --- a/Lib/test/test_compileall.py Mon Nov 30 02:21:41 2015 +0000 +++ b/Lib/test/test_compileall.py Fri Dec 04 22:54:38 2015 -0500 @@ -323,14 +323,6 @@ self.assertCompiled(init2fn) self.assertCompiled(bar2fn) - def test_d_takes_exactly_one_dir(self): - rc, out, err = self.assertRunNotOK('-d', 'foo') - self.assertEqual(out, b'') - self.assertRegex(err, b'-d') - rc, out, err = self.assertRunNotOK('-d', 'foo', 'bar') - self.assertEqual(out, b'') - self.assertRegex(err, b'-d') - def test_d_compile_error(self): script_helper.make_script(self.pkgdir, 'crunchyfrog', 'bad(syntax') rc, out, err = self.assertRunNotOK('-q', '-d', 'dinsdale', self.pkgdir) diff -r 4f4e2cbd2138 -r b63fd82a8528 Misc/ACKS --- a/Misc/ACKS Mon Nov 30 02:21:41 2015 +0000 +++ b/Misc/ACKS Fri Dec 04 22:54:38 2015 -0500 @@ -470,6 +470,7 @@ Nitin Ganatra Fred Gansevles Lars Marius Garshol +Jake Garver Dan Gass Andrew Gaul Matthieu Gautier diff -r 4f4e2cbd2138 -r b63fd82a8528 Misc/NEWS --- a/Misc/NEWS Mon Nov 30 02:21:41 2015 +0000 +++ b/Misc/NEWS Fri Dec 04 22:54:38 2015 -0500 @@ -115,6 +115,10 @@ Library ------- +- Issue #24903: Fix regression in number of arguments compileall accepts when + '-d' is specified. The check on the number of arguments has been dropped + completely as it never worked correctly anyway. + - Issue #25764: In the subprocess module, preserve any exception caused by fork() failure when preexec_fn is used.