Skip to content

Commit c0747cf

Browse files
committed
Merged revisions 67028,67040,67044,67046,67052,67065,67070,67077,67082 via svnmerge from
svn+ssh://[email protected]/python/trunk ........ r67028 | benjamin.peterson | 2008-10-25 18:27:07 -0500 (Sat, 25 Oct 2008) | 1 line don't use a catch-all ........ r67040 | armin.rigo | 2008-10-28 12:01:21 -0500 (Tue, 28 Oct 2008) | 5 lines Fix one of the tests: it relied on being present in an "output test" in order to actually test what it was supposed to test, i.e. that the code in the __del__ method did not crash. Use instead the new helper test_support.captured_output(). ........ r67044 | amaury.forgeotdarc | 2008-10-29 18:15:57 -0500 (Wed, 29 Oct 2008) | 3 lines Correct error message in io.open(): closefd=True is the only accepted value with a file name. ........ r67046 | thomas.heller | 2008-10-30 15:18:13 -0500 (Thu, 30 Oct 2008) | 2 lines Fixed a modulefinder crash on certain relative imports. ........ r67052 | christian.heimes | 2008-10-30 16:26:15 -0500 (Thu, 30 Oct 2008) | 1 line Issue #4237: io.FileIO() was raising invalid warnings caused by insufficient initialization of PyFileIOObject struct members. ........ r67065 | benjamin.peterson | 2008-10-30 18:59:18 -0500 (Thu, 30 Oct 2008) | 1 line move unprefixed error into .c file ........ r67070 | benjamin.peterson | 2008-10-31 15:41:44 -0500 (Fri, 31 Oct 2008) | 1 line rephrase has_key doc ........ r67077 | benjamin.peterson | 2008-11-03 09:14:51 -0600 (Mon, 03 Nov 2008) | 1 line #4048 make the parser module accept relative imports as valid ........ r67082 | hirokazu.yamamoto | 2008-11-03 12:03:06 -0600 (Mon, 03 Nov 2008) | 2 lines Issue #3774: Fixed an error when create a Tkinter menu item without command and then remove it. Written by Guilherme Polo (gpolo). ........
1 parent 6285ffd commit c0747cf

12 files changed

Lines changed: 34 additions & 14 deletions

File tree

Doc/ACKS.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ [email protected]), and we'll be glad to correct the problem.
1616
* A. Amoroso
1717
* Pehr Anderson
1818
* Oliver Andrich
19+
* Heidi Annexstad
1920
* Jesús Cea Avión
2021
* Daniel Barclay
2122
* Chris Barker

Include/compile.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,6 @@ PyAPI_FUNC(PyCodeObject *) PyAST_Compile(struct _mod *, const char *,
3232
PyCompilerFlags *, PyArena *);
3333
PyAPI_FUNC(PyFutureFeatures *) PyFuture_FromAST(struct _mod *, const char *);
3434

35-
#define ERR_LATE_FUTURE \
36-
"from __future__ imports must occur at the beginning of the file"
3735

3836
#ifdef __cplusplus
3937
}

Lib/modulefinder.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -310,7 +310,10 @@ def load_module(self, fqname, fp, pathname, file_info):
310310
def _add_badmodule(self, name, caller):
311311
if name not in self.badmodules:
312312
self.badmodules[name] = {}
313-
self.badmodules[name][caller.__name__] = 1
313+
if caller:
314+
self.badmodules[name][caller.__name__] = 1
315+
else:
316+
self.badmodules[name]["-"] = 1
314317

315318
def _safe_import_hook(self, name, caller, fromlist, level=-1):
316319
# wrapper for self.import_hook() that won't raise ImportError

Lib/test/test_descr.py

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1020,14 +1020,10 @@ def __init__(self):
10201020
def __del__(self_):
10211021
self.assertEqual(self_.a, 1)
10221022
self.assertEqual(self_.b, 2)
1023-
1024-
save_stderr = sys.stderr
1025-
sys.stderr = sys.stdout
1026-
h = H()
1027-
try:
1023+
with test_support.captured_output('stderr') as s:
1024+
h = H()
10281025
del h
1029-
finally:
1030-
sys.stderr = save_stderr
1026+
self.assertEqual(s.getvalue(), '')
10311027

10321028
def test_slots_special(self):
10331029
# Testing __dict__ and __weakref__ in __slots__...

Lib/test/test_io.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1245,6 +1245,7 @@ def test_fileio_warnings(self):
12451245
self.assertRaises(ValueError, io.FileIO, "/some/invalid/name", "rt")
12461246
self.assertEqual(w.warnings, [])
12471247

1248+
12481249
def test_main():
12491250
support.run_unittest(IOTest, BytesIOTest, StringIOTest,
12501251
BufferedReaderTest, BufferedWriterTest,

Lib/test/test_modulefinder.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,19 @@
190190
a/b/c/f.py
191191
"""]
192192

193+
relative_import_test_3 = [
194+
"a.module",
195+
["a", "a.module"],
196+
["a.bar"],
197+
[],
198+
"""\
199+
a/__init__.py
200+
def foo(): pass
201+
a/module.py
202+
from . import foo
203+
from . import bar
204+
"""]
205+
193206
def open_file(path):
194207
##print "#", os.path.abspath(path)
195208
dirname = os.path.dirname(path)
@@ -256,6 +269,9 @@ def test_relative_imports(self):
256269
def test_relative_imports_2(self):
257270
self._do_test(relative_import_test_2)
258271

272+
def test_relative_imports_3(self):
273+
self._do_test(relative_import_test_3)
274+
259275
def test_main():
260276
distutils.log.set_threshold(distutils.log.WARN)
261277
support.run_unittest(ModuleFinderTest)

Lib/test/test_parser.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import parser
2+
import os
23
import unittest
34
import sys
45
from test import support
@@ -172,6 +173,7 @@ def test_import_from_statement(self):
172173
"from sys.path import (dirname, basename as my_basename)")
173174
self.check_suite(
174175
"from sys.path import (dirname, basename as my_basename,)")
176+
self.check_suite("from .bogus import x")
175177

176178
def test_basic_import_statement(self):
177179
self.check_suite("import sys")

Misc/ACKS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ Eric Beser
6161
Steven Bethard
6262
Stephen Bevan
6363
Ron Bickers
64+
David Binger
6465
Dominic Binks
6566
Philippe Biondi
6667
Stuart Bishop

Modules/_fileio.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,7 @@ fileio_init(PyObject *oself, PyObject *args, PyObject *kwds)
251251
self->closefd = 1;
252252
if (!closefd) {
253253
PyErr_SetString(PyExc_ValueError,
254-
"Cannot use closefd=True with file name");
254+
"Cannot use closefd=False with file name");
255255
goto error;
256256
}
257257

Modules/parsermodule.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1710,10 +1710,10 @@ static int
17101710
count_from_dots(node *tree)
17111711
{
17121712
int i;
1713-
for (i = 0; i < NCH(tree); i++)
1713+
for (i = 1; i < NCH(tree); i++)
17141714
if (TYPE(CHILD(tree, i)) != DOT)
17151715
break;
1716-
return i;
1716+
return i-1;
17171717
}
17181718

17191719
/* 'from' ('.'* dotted_name | '.') 'import' ('*' | '(' import_as_names ')' |

0 commit comments

Comments
 (0)