Merged revisions 67028,67040,67044,67046,67052,67065,67070,67077,67082 via svnmerge from
svn+ssh://pythondev@svn.python.org/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). ........
This commit is contained in:
parent
6285ffd9db
commit
c0747cf537
|
@ -16,6 +16,7 @@ docs@python.org), and we'll be glad to correct the problem.
|
||||||
* A. Amoroso
|
* A. Amoroso
|
||||||
* Pehr Anderson
|
* Pehr Anderson
|
||||||
* Oliver Andrich
|
* Oliver Andrich
|
||||||
|
* Heidi Annexstad
|
||||||
* Jesús Cea Avión
|
* Jesús Cea Avión
|
||||||
* Daniel Barclay
|
* Daniel Barclay
|
||||||
* Chris Barker
|
* Chris Barker
|
||||||
|
|
|
@ -32,8 +32,6 @@ PyAPI_FUNC(PyCodeObject *) PyAST_Compile(struct _mod *, const char *,
|
||||||
PyCompilerFlags *, PyArena *);
|
PyCompilerFlags *, PyArena *);
|
||||||
PyAPI_FUNC(PyFutureFeatures *) PyFuture_FromAST(struct _mod *, const char *);
|
PyAPI_FUNC(PyFutureFeatures *) PyFuture_FromAST(struct _mod *, const char *);
|
||||||
|
|
||||||
#define ERR_LATE_FUTURE \
|
|
||||||
"from __future__ imports must occur at the beginning of the file"
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
|
|
@ -310,7 +310,10 @@ class ModuleFinder:
|
||||||
def _add_badmodule(self, name, caller):
|
def _add_badmodule(self, name, caller):
|
||||||
if name not in self.badmodules:
|
if name not in self.badmodules:
|
||||||
self.badmodules[name] = {}
|
self.badmodules[name] = {}
|
||||||
self.badmodules[name][caller.__name__] = 1
|
if caller:
|
||||||
|
self.badmodules[name][caller.__name__] = 1
|
||||||
|
else:
|
||||||
|
self.badmodules[name]["-"] = 1
|
||||||
|
|
||||||
def _safe_import_hook(self, name, caller, fromlist, level=-1):
|
def _safe_import_hook(self, name, caller, fromlist, level=-1):
|
||||||
# wrapper for self.import_hook() that won't raise ImportError
|
# wrapper for self.import_hook() that won't raise ImportError
|
||||||
|
|
|
@ -1020,14 +1020,10 @@ order (MRO) for bases """
|
||||||
def __del__(self_):
|
def __del__(self_):
|
||||||
self.assertEqual(self_.a, 1)
|
self.assertEqual(self_.a, 1)
|
||||||
self.assertEqual(self_.b, 2)
|
self.assertEqual(self_.b, 2)
|
||||||
|
with test_support.captured_output('stderr') as s:
|
||||||
save_stderr = sys.stderr
|
h = H()
|
||||||
sys.stderr = sys.stdout
|
|
||||||
h = H()
|
|
||||||
try:
|
|
||||||
del h
|
del h
|
||||||
finally:
|
self.assertEqual(s.getvalue(), '')
|
||||||
sys.stderr = save_stderr
|
|
||||||
|
|
||||||
def test_slots_special(self):
|
def test_slots_special(self):
|
||||||
# Testing __dict__ and __weakref__ in __slots__...
|
# Testing __dict__ and __weakref__ in __slots__...
|
||||||
|
|
|
@ -1245,6 +1245,7 @@ class MiscIOTest(unittest.TestCase):
|
||||||
self.assertRaises(ValueError, io.FileIO, "/some/invalid/name", "rt")
|
self.assertRaises(ValueError, io.FileIO, "/some/invalid/name", "rt")
|
||||||
self.assertEqual(w.warnings, [])
|
self.assertEqual(w.warnings, [])
|
||||||
|
|
||||||
|
|
||||||
def test_main():
|
def test_main():
|
||||||
support.run_unittest(IOTest, BytesIOTest, StringIOTest,
|
support.run_unittest(IOTest, BytesIOTest, StringIOTest,
|
||||||
BufferedReaderTest, BufferedWriterTest,
|
BufferedReaderTest, BufferedWriterTest,
|
||||||
|
|
|
@ -190,6 +190,19 @@ a/b/c/e.py
|
||||||
a/b/c/f.py
|
a/b/c/f.py
|
||||||
"""]
|
"""]
|
||||||
|
|
||||||
|
relative_import_test_3 = [
|
||||||
|
"a.module",
|
||||||
|
["a", "a.module"],
|
||||||
|
["a.bar"],
|
||||||
|
[],
|
||||||
|
"""\
|
||||||
|
a/__init__.py
|
||||||
|
def foo(): pass
|
||||||
|
a/module.py
|
||||||
|
from . import foo
|
||||||
|
from . import bar
|
||||||
|
"""]
|
||||||
|
|
||||||
def open_file(path):
|
def open_file(path):
|
||||||
##print "#", os.path.abspath(path)
|
##print "#", os.path.abspath(path)
|
||||||
dirname = os.path.dirname(path)
|
dirname = os.path.dirname(path)
|
||||||
|
@ -256,6 +269,9 @@ class ModuleFinderTest(unittest.TestCase):
|
||||||
def test_relative_imports_2(self):
|
def test_relative_imports_2(self):
|
||||||
self._do_test(relative_import_test_2)
|
self._do_test(relative_import_test_2)
|
||||||
|
|
||||||
|
def test_relative_imports_3(self):
|
||||||
|
self._do_test(relative_import_test_3)
|
||||||
|
|
||||||
def test_main():
|
def test_main():
|
||||||
distutils.log.set_threshold(distutils.log.WARN)
|
distutils.log.set_threshold(distutils.log.WARN)
|
||||||
support.run_unittest(ModuleFinderTest)
|
support.run_unittest(ModuleFinderTest)
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
import parser
|
import parser
|
||||||
|
import os
|
||||||
import unittest
|
import unittest
|
||||||
import sys
|
import sys
|
||||||
from test import support
|
from test import support
|
||||||
|
@ -172,6 +173,7 @@ class RoundtripLegalSyntaxTestCase(unittest.TestCase):
|
||||||
"from sys.path import (dirname, basename as my_basename)")
|
"from sys.path import (dirname, basename as my_basename)")
|
||||||
self.check_suite(
|
self.check_suite(
|
||||||
"from sys.path import (dirname, basename as my_basename,)")
|
"from sys.path import (dirname, basename as my_basename,)")
|
||||||
|
self.check_suite("from .bogus import x")
|
||||||
|
|
||||||
def test_basic_import_statement(self):
|
def test_basic_import_statement(self):
|
||||||
self.check_suite("import sys")
|
self.check_suite("import sys")
|
||||||
|
|
|
@ -61,6 +61,7 @@ Eric Beser
|
||||||
Steven Bethard
|
Steven Bethard
|
||||||
Stephen Bevan
|
Stephen Bevan
|
||||||
Ron Bickers
|
Ron Bickers
|
||||||
|
David Binger
|
||||||
Dominic Binks
|
Dominic Binks
|
||||||
Philippe Biondi
|
Philippe Biondi
|
||||||
Stuart Bishop
|
Stuart Bishop
|
||||||
|
|
|
@ -251,7 +251,7 @@ fileio_init(PyObject *oself, PyObject *args, PyObject *kwds)
|
||||||
self->closefd = 1;
|
self->closefd = 1;
|
||||||
if (!closefd) {
|
if (!closefd) {
|
||||||
PyErr_SetString(PyExc_ValueError,
|
PyErr_SetString(PyExc_ValueError,
|
||||||
"Cannot use closefd=True with file name");
|
"Cannot use closefd=False with file name");
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1710,10 +1710,10 @@ static int
|
||||||
count_from_dots(node *tree)
|
count_from_dots(node *tree)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
for (i = 0; i < NCH(tree); i++)
|
for (i = 1; i < NCH(tree); i++)
|
||||||
if (TYPE(CHILD(tree, i)) != DOT)
|
if (TYPE(CHILD(tree, i)) != DOT)
|
||||||
break;
|
break;
|
||||||
return i;
|
return i-1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 'from' ('.'* dotted_name | '.') 'import' ('*' | '(' import_as_names ')' |
|
/* 'from' ('.'* dotted_name | '.') 'import' ('*' | '(' import_as_names ')' |
|
||||||
|
|
|
@ -8,6 +8,8 @@
|
||||||
#include "symtable.h"
|
#include "symtable.h"
|
||||||
|
|
||||||
#define UNDEFINED_FUTURE_FEATURE "future feature %.100s is not defined"
|
#define UNDEFINED_FUTURE_FEATURE "future feature %.100s is not defined"
|
||||||
|
#define ERR_LATE_FUTURE \
|
||||||
|
"from __future__ imports must occur at the beginning of the file"
|
||||||
|
|
||||||
static int
|
static int
|
||||||
future_check_features(PyFutureFeatures *ff, stmt_ty s, const char *filename)
|
future_check_features(PyFutureFeatures *ff, stmt_ty s, const char *filename)
|
||||||
|
|
|
@ -12,7 +12,7 @@ import sys, os, re, getopt
|
||||||
# our pysource module finds Python source files
|
# our pysource module finds Python source files
|
||||||
try:
|
try:
|
||||||
import pysource
|
import pysource
|
||||||
except:
|
except ImportError:
|
||||||
# emulate the module with a simple os.walk
|
# emulate the module with a simple os.walk
|
||||||
class pysource:
|
class pysource:
|
||||||
has_python_ext = looks_like_python = can_be_compiled = None
|
has_python_ext = looks_like_python = can_be_compiled = None
|
||||||
|
|
Loading…
Reference in New Issue