From buildbot at python.org Mon Jun 1 00:46:44 2009 From: buildbot at python.org (buildbot at python.org) Date: Sun, 31 May 2009 22:46:44 +0000 Subject: [Python-checkins] buildbot failure in sparc solaris10 gcc 3.0 Message-ID: <20090531224644.7C368DAA4@mail.python.org> The Buildbot has detected a new failure of sparc solaris10 gcc 3.0. Full details are available at: http://www.python.org/dev/buildbot/all/sparc%20solaris10%20gcc%203.0/builds/399 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: loewis-sun Build Reason: Build Source Stamp: [branch branches/release30-maint] HEAD Blamelist: r.david.murray BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_posix ====================================================================== ERROR: test_getcwd_long_pathnames (test.test_posix.PosixTester) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home2/buildbot/slave/3.0.loewis-sun/build/Lib/test/test_posix.py", line 252, in test_getcwd_long_pathnames support.rmtree(base_path) File "/home2/buildbot/slave/3.0.loewis-sun/build/Lib/test/support.py", line 98, in rmtree shutil.rmtree(path) File "/home2/buildbot/slave/3.0.loewis-sun/build/Lib/shutil.py", line 225, in rmtree onerror(os.rmdir, path, sys.exc_info()) File "/home2/buildbot/slave/3.0.loewis-sun/build/Lib/shutil.py", line 223, in rmtree os.rmdir(path) OSError: [Errno 22] Invalid argument: '/home2/buildbot/slave/3.0.loewis-sun/build/@test.getcwd/@test.getcwd' sincerely, -The Buildbot From python-checkins at python.org Mon Jun 1 01:21:13 2009 From: python-checkins at python.org (guilherme.polo) Date: Mon, 1 Jun 2009 01:21:13 +0200 (CEST) Subject: [Python-checkins] r73087 - python/branches/tk_and_idle_maintenance/Lib/lib-tk/test/test_tkinter/test_panedwindow.py Message-ID: <20090531232113.1A0B5DA3F@mail.python.org> Author: guilherme.polo Date: Mon Jun 1 01:21:12 2009 New Revision: 73087 Log: Some tests for the PanedWindow. Added: python/branches/tk_and_idle_maintenance/Lib/lib-tk/test/test_tkinter/test_panedwindow.py (contents, props changed) Added: python/branches/tk_and_idle_maintenance/Lib/lib-tk/test/test_tkinter/test_panedwindow.py ============================================================================== --- (empty file) +++ python/branches/tk_and_idle_maintenance/Lib/lib-tk/test/test_tkinter/test_panedwindow.py Mon Jun 1 01:21:12 2009 @@ -0,0 +1,109 @@ +import unittest +import Tkinter +from test.test_support import requires, run_unittest +from ttk import setup_master + +requires('gui') + +class PanedWindowTest(unittest.TestCase): + + def setUp(self): + self.root = setup_master() + self.pwin = Tkinter.PanedWindow(self.root) + + def tearDown(self): + self.pwin.destroy() + + + def test_add(self): + lbl = Tkinter.Label() + self.pwin.add(lbl) + self.assertIn(str(lbl), self.pwin.panes()) + + def test_remove(self): + self.test_add() + self.pwin.remove(self.pwin.panes()[0]) + self.assertFalse(self.pwin.panes()) + self.test_add() + self.pwin.forget(self.pwin.panes()[0]) + self.assertFalse(self.pwin.panes()) + + def test_identify(self): + lbl = Tkinter.Label(text='a') + lbl2 = Tkinter.Label(text='b') + self.pwin['orient'] = 'horizontal' + self.pwin['showhandle'] = True + self.pwin.add(lbl) + self.pwin.add(lbl2) + self.pwin.pack() + self.pwin.update_idletasks() + + to_find = ['sash', 'handle'] + for i in xrange(self.pwin.winfo_width()): + for j in xrange(self.pwin.winfo_height()): + res = self.pwin.identify(i, j) + if res: + self.assertTrue(isinstance(res, tuple)) + self.assertTrue(isinstance(res[0], int)) + self.assertTrue(isinstance(res[1], str)) + if res[1] in to_find: + to_find.remove(res[1]) + if not to_find: + return + + def test_proxy(self): + self.pwin.add(Tkinter.Label(text='hi')) + self.pwin.add(Tkinter.Label(text='hi')) + + self.pwin.proxy_place(10, 10) + res = self.pwin.proxy_coord() + self.assertTrue(isinstance(res, tuple)) + self.assertEqual(res[0], 10) + self.pwin.proxy_forget() + + def test_sash(self): pass + + def test_panecget(self): + lbl = Tkinter.Label() + self.pwin.add(lbl, padx=6, pady=3) + self.assertEqual(self.pwin.panecget(lbl, 'padx'), 6) + self.assertEqual(self.pwin.panecget(lbl, 'pady'), 3) + self.assertRaises(Tkinter.TclError, self.pwin.panecget, lbl, 'padz') + + def test_paneconfigure(self): + lbl = Tkinter.Label() + self.pwin.add(lbl, padx=6, pady=3) + cfg = self.pwin.paneconfigure(lbl) + self.assertEqual(cfg['padx'][-1], 6) + self.assertEqual(cfg['pady'][-1], 3) + self.assertTrue(isinstance(cfg, dict)) + + self.pwin.paneconfigure(lbl, padx=3) + self.assertEqual(self.pwin.paneconfigure(lbl)['padx'][-1], + self.pwin.paneconfigure(lbl)['pady'][-1]) + self.assertRaises(Tkinter.TclError, + self.pwin.paneconfigure, lbl, padz=3) + + r = self.pwin.paneconfigure(lbl, 'padx') + self.assertTrue(isinstance(r, tuple)) + self.assertEqual(r[-1], 3) + self.assertRaises(Tkinter.TclError, + self.pwin.paneconfigure, lbl, 'padz') + + self.assertEqual(r, self.pwin.paneconfigure(lbl)['padx']) + + def test_panes(self): + lbl1 = Tkinter.Label() + lbl2 = Tkinter.Label() + self.pwin.add(lbl1) + self.pwin.add(lbl2) + panes = self.pwin.panes() + self.assertEqual(panes[0], str(lbl1)) + self.assertEqual(panes[1], str(lbl2)) + self.assertTrue(isinstance(panes, tuple)) + + +tests_gui = (PanedWindowTest, ) + +if __name__ == "__main__": + run_unittest(*tests_gui) From python-checkins at python.org Mon Jun 1 02:11:36 2009 From: python-checkins at python.org (andrew.kuchling) Date: Mon, 1 Jun 2009 02:11:36 +0200 (CEST) Subject: [Python-checkins] r73088 - python/branches/py3k/Doc/library/re.rst Message-ID: <20090601001136.4186ADAC1@mail.python.org> Author: andrew.kuchling Date: Mon Jun 1 02:11:36 2009 New Revision: 73088 Log: Typo fix; constant name is uppercase Modified: python/branches/py3k/Doc/library/re.rst Modified: python/branches/py3k/Doc/library/re.rst ============================================================================== --- python/branches/py3k/Doc/library/re.rst (original) +++ python/branches/py3k/Doc/library/re.rst Mon Jun 1 02:11:36 2009 @@ -215,7 +215,7 @@ ``(?aiLmsux)`` (One or more letters from the set ``'a'``, ``'i'``, ``'L'``, ``'m'``, ``'s'``, ``'u'``, ``'x'``.) The group matches the empty string; the - letters set the corresponding flags: :const:`re.a` (ASCII-only matching), + letters set the corresponding flags: :const:`re.A` (ASCII-only matching), :const:`re.I` (ignore case), :const:`re.L` (locale dependent), :const:`re.M` (multi-line), :const:`re.S` (dot matches all), and :const:`re.X` (verbose), for the entire regular expression. (The From python-checkins at python.org Mon Jun 1 02:14:20 2009 From: python-checkins at python.org (andrew.kuchling) Date: Mon, 1 Jun 2009 02:14:20 +0200 (CEST) Subject: [Python-checkins] r73089 - python/trunk/Doc/howto/regex.rst Message-ID: <20090601001420.11CCEDAC2@mail.python.org> Author: andrew.kuchling Date: Mon Jun 1 02:14:19 2009 New Revision: 73089 Log: The class for regexes isn't called RegexObject any more; correct the text Modified: python/trunk/Doc/howto/regex.rst Modified: python/trunk/Doc/howto/regex.rst ============================================================================== --- python/trunk/Doc/howto/regex.rst (original) +++ python/trunk/Doc/howto/regex.rst Mon Jun 1 02:14:19 2009 @@ -257,7 +257,7 @@ Compiling Regular Expressions ----------------------------- -Regular expressions are compiled into :class:`RegexObject` instances, which have +Regular expressions are compiled into pattern objects, which have methods for various operations such as searching for pattern matches or performing string substitutions. :: @@ -336,7 +336,7 @@ ------------------ Once you have an object representing a compiled regular expression, what do you -do with it? :class:`RegexObject` instances have several methods and attributes. +do with it? Pattern objects have several methods and attributes. Only the most significant ones will be covered here; consult the :mod:`re` docs for a complete listing. @@ -427,8 +427,8 @@ and :meth:`end` return the starting and ending index of the match. :meth:`span` returns both start and end indexes in a single tuple. Since the :meth:`match` method only checks if the RE matches at the start of a string, :meth:`start` -will always be zero. However, the :meth:`search` method of :class:`RegexObject` -instances scans through the string, so the match may not start at zero in that +will always be zero. However, the :meth:`search` method of patterns +scans through the string, so the match may not start at zero in that case. :: >>> print p.match('::: message') @@ -450,7 +450,7 @@ else: print 'No match' -Two :class:`RegexObject` methods return all of the matches for a pattern. +Two pattern methods return all of the matches for a pattern. :meth:`findall` returns a list of matching strings:: >>> p = re.compile('\d+') @@ -475,10 +475,10 @@ Module-Level Functions ---------------------- -You don't have to create a :class:`RegexObject` and call its methods; the +You don't have to create a pattern object and call its methods; the :mod:`re` module also provides top-level functions called :func:`match`, :func:`search`, :func:`findall`, :func:`sub`, and so forth. These functions -take the same arguments as the corresponding :class:`RegexObject` method, with +take the same arguments as the corresponding pattern method, with the RE string added as the first argument, and still return either ``None`` or a :class:`MatchObject` instance. :: @@ -487,12 +487,12 @@ >>> re.match(r'From\s+', 'From amk Thu May 14 19:12:10 1998') -Under the hood, these functions simply produce a :class:`RegexObject` for you +Under the hood, these functions simply create a pattern object for you and call the appropriate method on it. They also store the compiled object in a cache, so future calls using the same RE are faster. Should you use these module-level functions, or should you get the -:class:`RegexObject` and call its methods yourself? That choice depends on how +pattern and call its methods yourself? That choice depends on how frequently the RE will be used, and on your personal coding style. If the RE is being used at only one point in the code, then the module functions are probably more convenient. If a program contains a lot of regular expressions, or re-uses @@ -1030,7 +1030,7 @@ Up to this point, we've simply performed searches against a static string. Regular expressions are also commonly used to modify strings in various ways, -using the following :class:`RegexObject` methods: +using the following pattern methods: +------------------+-----------------------------------------------+ | Method/Attribute | Purpose | @@ -1050,7 +1050,7 @@ Splitting Strings ----------------- -The :meth:`split` method of a :class:`RegexObject` splits a string apart +The :meth:`split` method of a pattern splits a string apart wherever the RE matches, returning a list of the pieces. It's similar to the :meth:`split` method of strings but provides much more generality in the delimiters that you can split by; :meth:`split` only supports splitting by @@ -1195,10 +1195,10 @@ 'Call 0xffd2 for printing, 0xc000 for user code.' When using the module-level :func:`re.sub` function, the pattern is passed as -the first argument. The pattern may be a string or a :class:`RegexObject`; if +the first argument. The pattern may be provided as an object or as a string; if you need to specify regular expression flags, you must either use a -:class:`RegexObject` as the first parameter, or use embedded modifiers in the -pattern, e.g. ``sub("(?i)b+", "x", "bbbb BBBB")`` returns ``'x x'``. +pattern object as the first parameter, or use embedded modifiers in the +pattern string, e.g. ``sub("(?i)b+", "x", "bbbb BBBB")`` returns ``'x x'``. Common Problems From python-checkins at python.org Mon Jun 1 03:45:08 2009 From: python-checkins at python.org (guilherme.polo) Date: Mon, 1 Jun 2009 03:45:08 +0200 (CEST) Subject: [Python-checkins] r73090 - python/branches/tk_and_idle_maintenance/Lib/lib-tk/ttk.py Message-ID: <20090601014508.ADE36C49B@mail.python.org> Author: guilherme.polo Date: Mon Jun 1 03:45:08 2009 New Revision: 73090 Log: Added support for passing keyword arguments in setup_master. Modified: python/branches/tk_and_idle_maintenance/Lib/lib-tk/ttk.py Modified: python/branches/tk_and_idle_maintenance/Lib/lib-tk/ttk.py ============================================================================== --- python/branches/tk_and_idle_maintenance/Lib/lib-tk/ttk.py (original) +++ python/branches/tk_and_idle_maintenance/Lib/lib-tk/ttk.py Mon Jun 1 03:45:08 2009 @@ -349,16 +349,18 @@ return adict -def setup_master(master=None): +def setup_master(master=None, **kw): """If master is not None, itself is returned. If master is None, the default master is returned if there is one, otherwise a new - master is created and returned. + master is created, defined as default and then returned. Any + other passed options will be repassed to the Tkinter.Tk class. If it is not allowed to use the default root and master is None, RuntimeError is raised.""" if master is None: if Tkinter._support_default_root: - master = Tkinter._default_root or Tkinter.Tk() + master = Tkinter._default_root or Tkinter.Tk(**kw) + Tkinter._default_root = master else: raise RuntimeError( "No master specified and Tkinter is " From python-checkins at python.org Mon Jun 1 03:55:26 2009 From: python-checkins at python.org (benjamin.peterson) Date: Mon, 1 Jun 2009 03:55:26 +0200 (CEST) Subject: [Python-checkins] r73091 - in sandbox/trunk/2to3/lib2to3: fixer_base.py fixer_util.py fixes/fix_apply.py fixes/fix_basestring.py fixes/fix_buffer.py fixes/fix_callable.py fixes/fix_dict.py fixes/fix_except.py fixes/fix_exec.py fixes/fix_execfile.py fixes/fix_filter.py fixes/fix_funcattrs.py fixes/fix_future.py fixes/fix_getcwdu.py fixes/fix_has_key.py fixes/fix_idioms.py fixes/fix_import.py fixes/fix_imports.py fixes/fix_input.py fixes/fix_intern.py fixes/fix_isinstance.py fixes/fix_itertools.py fixes/fix_itertools_imports.py fixes/fix_long.py fixes/fix_map.py fixes/fix_metaclass.py fixes/fix_methodattrs.py fixes/fix_ne.py fixes/fix_next.py fixes/fix_nonzero.py fixes/fix_numliterals.py fixes/fix_paren.py fixes/fix_print.py fixes/fix_raise.py fixes/fix_raw_input.py fixes/fix_renames.py fixes/fix_repr.py fixes/fix_set_literal.py fixes/fix_standarderror.py fixes/fix_sys_exc.py fixes/fix_throw.py fixes/fix_tuple_params.py fixes/fix_types.py fixes/fix_urllib.py fixes/fix_ws_comma.py fixes/fix_xrange.py fixes/fix_xreadlines.py fixes/fix_zip.py pytree.py tests/data/fixers/myfixes/fix_parrot.py tests/test_pytree.py Message-ID: <20090601015526.73C8CDABD@mail.python.org> Author: benjamin.peterson Date: Mon Jun 1 03:55:25 2009 New Revision: 73091 Log: deprecate set_prefix() and get_prefix() in favor of a prefix property Modified: sandbox/trunk/2to3/lib2to3/fixer_base.py sandbox/trunk/2to3/lib2to3/fixer_util.py sandbox/trunk/2to3/lib2to3/fixes/fix_apply.py sandbox/trunk/2to3/lib2to3/fixes/fix_basestring.py sandbox/trunk/2to3/lib2to3/fixes/fix_buffer.py sandbox/trunk/2to3/lib2to3/fixes/fix_callable.py sandbox/trunk/2to3/lib2to3/fixes/fix_dict.py sandbox/trunk/2to3/lib2to3/fixes/fix_except.py sandbox/trunk/2to3/lib2to3/fixes/fix_exec.py sandbox/trunk/2to3/lib2to3/fixes/fix_execfile.py sandbox/trunk/2to3/lib2to3/fixes/fix_filter.py sandbox/trunk/2to3/lib2to3/fixes/fix_funcattrs.py sandbox/trunk/2to3/lib2to3/fixes/fix_future.py sandbox/trunk/2to3/lib2to3/fixes/fix_getcwdu.py sandbox/trunk/2to3/lib2to3/fixes/fix_has_key.py sandbox/trunk/2to3/lib2to3/fixes/fix_idioms.py sandbox/trunk/2to3/lib2to3/fixes/fix_import.py sandbox/trunk/2to3/lib2to3/fixes/fix_imports.py sandbox/trunk/2to3/lib2to3/fixes/fix_input.py sandbox/trunk/2to3/lib2to3/fixes/fix_intern.py sandbox/trunk/2to3/lib2to3/fixes/fix_isinstance.py sandbox/trunk/2to3/lib2to3/fixes/fix_itertools.py sandbox/trunk/2to3/lib2to3/fixes/fix_itertools_imports.py sandbox/trunk/2to3/lib2to3/fixes/fix_long.py sandbox/trunk/2to3/lib2to3/fixes/fix_map.py sandbox/trunk/2to3/lib2to3/fixes/fix_metaclass.py sandbox/trunk/2to3/lib2to3/fixes/fix_methodattrs.py sandbox/trunk/2to3/lib2to3/fixes/fix_ne.py sandbox/trunk/2to3/lib2to3/fixes/fix_next.py sandbox/trunk/2to3/lib2to3/fixes/fix_nonzero.py sandbox/trunk/2to3/lib2to3/fixes/fix_numliterals.py sandbox/trunk/2to3/lib2to3/fixes/fix_paren.py sandbox/trunk/2to3/lib2to3/fixes/fix_print.py sandbox/trunk/2to3/lib2to3/fixes/fix_raise.py sandbox/trunk/2to3/lib2to3/fixes/fix_raw_input.py sandbox/trunk/2to3/lib2to3/fixes/fix_renames.py sandbox/trunk/2to3/lib2to3/fixes/fix_repr.py sandbox/trunk/2to3/lib2to3/fixes/fix_set_literal.py sandbox/trunk/2to3/lib2to3/fixes/fix_standarderror.py sandbox/trunk/2to3/lib2to3/fixes/fix_sys_exc.py sandbox/trunk/2to3/lib2to3/fixes/fix_throw.py sandbox/trunk/2to3/lib2to3/fixes/fix_tuple_params.py sandbox/trunk/2to3/lib2to3/fixes/fix_types.py sandbox/trunk/2to3/lib2to3/fixes/fix_urllib.py sandbox/trunk/2to3/lib2to3/fixes/fix_ws_comma.py sandbox/trunk/2to3/lib2to3/fixes/fix_xrange.py sandbox/trunk/2to3/lib2to3/fixes/fix_xreadlines.py sandbox/trunk/2to3/lib2to3/fixes/fix_zip.py sandbox/trunk/2to3/lib2to3/pytree.py sandbox/trunk/2to3/lib2to3/tests/data/fixers/myfixes/fix_parrot.py sandbox/trunk/2to3/lib2to3/tests/test_pytree.py Modified: sandbox/trunk/2to3/lib2to3/fixer_base.py ============================================================================== --- sandbox/trunk/2to3/lib2to3/fixer_base.py (original) +++ sandbox/trunk/2to3/lib2to3/fixer_base.py Mon Jun 1 03:55:25 2009 @@ -120,7 +120,7 @@ """ lineno = node.get_lineno() for_output = node.clone() - for_output.set_prefix(u"") + for_output.prefix = u"" msg = "Line %d: could not convert: %s" self.log_message(msg % (lineno, for_output)) if reason: Modified: sandbox/trunk/2to3/lib2to3/fixer_util.py ============================================================================== --- sandbox/trunk/2to3/lib2to3/fixer_util.py (original) +++ sandbox/trunk/2to3/lib2to3/fixer_util.py Mon Jun 1 03:55:25 2009 @@ -27,11 +27,11 @@ if not isinstance(target, list): target = [target] if not isinstance(source, list): - source.set_prefix(" ") + source.prefix = u" " source = [source] return Node(syms.atom, - target + [Leaf(token.EQUAL, "=", prefix=" ")] + source) + target + [Leaf(token.EQUAL, u"=", prefix=u" ")] + source) def Name(name, prefix=None): """Return a NAME leaf""" @@ -60,7 +60,7 @@ """A function call""" node = Node(syms.power, [func_name, ArgList(args)]) if prefix is not None: - node.set_prefix(prefix) + node.prefix = prefix return node def Newline(): @@ -89,18 +89,18 @@ If test is None, the "if test" part is omitted. """ - xp.set_prefix(u"") - fp.set_prefix(u" ") - it.set_prefix(u" ") + xp.prefix = u"" + fp.prefix = u" " + it.prefix = u" " for_leaf = Leaf(token.NAME, u"for") - for_leaf.set_prefix(u" ") + for_leaf.prefix = u" " in_leaf = Leaf(token.NAME, u"in") - in_leaf.set_prefix(u" ") + in_leaf.prefix = u" " inner_args = [for_leaf, fp, in_leaf, it] if test: - test.set_prefix(u" ") + test.prefix = u" " if_leaf = Leaf(token.NAME, u"if") - if_leaf.set_prefix(u" ") + if_leaf.prefix = u" " inner_args.append(Node(syms.comp_if, [if_leaf, test])) inner = Node(syms.listmaker, [xp, Node(syms.comp_for, inner_args)]) return Node(syms.atom, Modified: sandbox/trunk/2to3/lib2to3/fixes/fix_apply.py ============================================================================== --- sandbox/trunk/2to3/lib2to3/fixes/fix_apply.py (original) +++ sandbox/trunk/2to3/lib2to3/fixes/fix_apply.py Mon Jun 1 03:55:25 2009 @@ -33,25 +33,25 @@ func = results["func"] args = results["args"] kwds = results.get("kwds") - prefix = node.get_prefix() + prefix = node.prefix func = func.clone() if (func.type not in (token.NAME, syms.atom) and (func.type != syms.power or func.children[-2].type == token.DOUBLESTAR)): # Need to parenthesize func = parenthesize(func) - func.set_prefix("") + func.prefix = "" args = args.clone() - args.set_prefix("") + args.prefix = "" if kwds is not None: kwds = kwds.clone() - kwds.set_prefix("") + kwds.prefix = "" l_newargs = [pytree.Leaf(token.STAR, u"*"), args] if kwds is not None: l_newargs.extend([Comma(), pytree.Leaf(token.DOUBLESTAR, u"**"), kwds]) - l_newargs[-2].set_prefix(u" ") # that's the ** token + l_newargs[-2].prefix = u" " # that's the ** token # XXX Sometimes we could be cleverer, e.g. apply(f, (x, y) + t) # can be translated into f(x, y, *t) instead of f(*(x, y) + t) #new = pytree.Node(syms.power, (func, ArgList(l_newargs))) Modified: sandbox/trunk/2to3/lib2to3/fixes/fix_basestring.py ============================================================================== --- sandbox/trunk/2to3/lib2to3/fixes/fix_basestring.py (original) +++ sandbox/trunk/2to3/lib2to3/fixes/fix_basestring.py Mon Jun 1 03:55:25 2009 @@ -10,4 +10,4 @@ PATTERN = "'basestring'" def transform(self, node, results): - return Name(u"str", prefix=node.get_prefix()) + return Name(u"str", prefix=node.prefix) Modified: sandbox/trunk/2to3/lib2to3/fixes/fix_buffer.py ============================================================================== --- sandbox/trunk/2to3/lib2to3/fixes/fix_buffer.py (original) +++ sandbox/trunk/2to3/lib2to3/fixes/fix_buffer.py Mon Jun 1 03:55:25 2009 @@ -18,4 +18,4 @@ def transform(self, node, results): name = results["name"] - name.replace(Name(u"memoryview", prefix=name.get_prefix())) + name.replace(Name(u"memoryview", prefix=name.prefix)) Modified: sandbox/trunk/2to3/lib2to3/fixes/fix_callable.py ============================================================================== --- sandbox/trunk/2to3/lib2to3/fixes/fix_callable.py (original) +++ sandbox/trunk/2to3/lib2to3/fixes/fix_callable.py Mon Jun 1 03:55:25 2009 @@ -28,4 +28,4 @@ func = results["func"] args = [func.clone(), String(u', '), String(u"'__call__'")] - return Call(Name(u"hasattr"), args, prefix=node.get_prefix()) + return Call(Name(u"hasattr"), args, prefix=node.prefix) Modified: sandbox/trunk/2to3/lib2to3/fixes/fix_dict.py ============================================================================== --- sandbox/trunk/2to3/lib2to3/fixes/fix_dict.py (original) +++ sandbox/trunk/2to3/lib2to3/fixes/fix_dict.py Mon Jun 1 03:55:25 2009 @@ -61,15 +61,15 @@ args = head + [pytree.Node(syms.trailer, [Dot(), Name(method_name, - prefix=method.get_prefix())]), + prefix=method.prefix)]), results["parens"].clone()] new = pytree.Node(syms.power, args) if not special: - new.set_prefix(u"") + new.prefix = u"" new = Call(Name(isiter and u"iter" or u"list"), [new]) if tail: new = pytree.Node(syms.power, [new] + tail) - new.set_prefix(node.get_prefix()) + new.prefix = node.prefix return new P1 = "power< func=NAME trailer< '(' node=any ')' > any* >" Modified: sandbox/trunk/2to3/lib2to3/fixes/fix_except.py ============================================================================== --- sandbox/trunk/2to3/lib2to3/fixes/fix_except.py (original) +++ sandbox/trunk/2to3/lib2to3/fixes/fix_except.py Mon Jun 1 03:55:25 2009 @@ -58,7 +58,7 @@ # Generate a new N for the except clause new_N = Name(self.new_name(), prefix=u" ") target = N.clone() - target.set_prefix(u"") + target.prefix = u"" N.replace(new_N) new_N = new_N.clone() @@ -82,10 +82,10 @@ for child in reversed(suite_stmts[:i]): e_suite.insert_child(0, child) e_suite.insert_child(i, assign) - elif N.get_prefix() == u"": + elif N.prefix == u"": # No space after a comma is legal; no space after "as", # not so much. - N.set_prefix(u" ") + N.prefix = u" " #TODO(cwinter) fix this when children becomes a smart list children = [c.clone() for c in node.children[:3]] + try_cleanup + tail Modified: sandbox/trunk/2to3/lib2to3/fixes/fix_exec.py ============================================================================== --- sandbox/trunk/2to3/lib2to3/fixes/fix_exec.py (original) +++ sandbox/trunk/2to3/lib2to3/fixes/fix_exec.py Mon Jun 1 03:55:25 2009 @@ -30,10 +30,10 @@ b = results.get("b") c = results.get("c") args = [a.clone()] - args[0].set_prefix("") + args[0].prefix = "" if b is not None: args.extend([Comma(), b.clone()]) if c is not None: args.extend([Comma(), c.clone()]) - return Call(Name(u"exec"), args, prefix=node.get_prefix()) + return Call(Name(u"exec"), args, prefix=node.prefix) Modified: sandbox/trunk/2to3/lib2to3/fixes/fix_execfile.py ============================================================================== --- sandbox/trunk/2to3/lib2to3/fixes/fix_execfile.py (original) +++ sandbox/trunk/2to3/lib2to3/fixes/fix_execfile.py Mon Jun 1 03:55:25 2009 @@ -38,7 +38,7 @@ # Wrap the open call in a compile call. This is so the filename will be # preserved in the execed code. filename_arg = filename.clone() - filename_arg.set_prefix(u" ") + filename_arg.prefix = u" " exec_str = String(u"'exec'", u" ") compile_args = open_expr + [Comma(), filename_arg, Comma(), exec_str] compile_call = Call(Name(u"compile"), compile_args, u"") @@ -48,4 +48,4 @@ args.extend([Comma(), globals.clone()]) if locals is not None: args.extend([Comma(), locals.clone()]) - return Call(Name(u"exec"), args, prefix=node.get_prefix()) + return Call(Name(u"exec"), args, prefix=node.prefix) Modified: sandbox/trunk/2to3/lib2to3/fixes/fix_filter.py ============================================================================== --- sandbox/trunk/2to3/lib2to3/fixes/fix_filter.py (original) +++ sandbox/trunk/2to3/lib2to3/fixes/fix_filter.py Mon Jun 1 03:55:25 2009 @@ -69,7 +69,7 @@ if in_special_context(node): return None new = node.clone() - new.set_prefix(u"") + new.prefix = u"" new = Call(Name(u"list"), [new]) - new.set_prefix(node.get_prefix()) + new.prefix = node.prefix return new Modified: sandbox/trunk/2to3/lib2to3/fixes/fix_funcattrs.py ============================================================================== --- sandbox/trunk/2to3/lib2to3/fixes/fix_funcattrs.py (original) +++ sandbox/trunk/2to3/lib2to3/fixes/fix_funcattrs.py Mon Jun 1 03:55:25 2009 @@ -16,4 +16,4 @@ def transform(self, node, results): attr = results["attr"][0] attr.replace(Name((u"__%s__" % attr.value[5:]), - prefix=attr.get_prefix())) + prefix=attr.prefix)) Modified: sandbox/trunk/2to3/lib2to3/fixes/fix_future.py ============================================================================== --- sandbox/trunk/2to3/lib2to3/fixes/fix_future.py (original) +++ sandbox/trunk/2to3/lib2to3/fixes/fix_future.py Mon Jun 1 03:55:25 2009 @@ -16,5 +16,5 @@ def transform(self, node, results): new = BlankLine() - new.prefix = node.get_prefix() + new.prefix = node.prefix return new Modified: sandbox/trunk/2to3/lib2to3/fixes/fix_getcwdu.py ============================================================================== --- sandbox/trunk/2to3/lib2to3/fixes/fix_getcwdu.py (original) +++ sandbox/trunk/2to3/lib2to3/fixes/fix_getcwdu.py Mon Jun 1 03:55:25 2009 @@ -15,4 +15,4 @@ def transform(self, node, results): name = results["name"] - name.replace(Name(u"getcwd", prefix=name.get_prefix())) + name.replace(Name(u"getcwd", prefix=name.prefix)) Modified: sandbox/trunk/2to3/lib2to3/fixes/fix_has_key.py ============================================================================== --- sandbox/trunk/2to3/lib2to3/fixes/fix_has_key.py (original) +++ sandbox/trunk/2to3/lib2to3/fixes/fix_has_key.py Mon Jun 1 03:55:25 2009 @@ -78,7 +78,7 @@ return None negation = results.get("negation") anchor = results["anchor"] - prefix = node.get_prefix() + prefix = node.prefix before = [n.clone() for n in results["before"]] arg = results["arg"].clone() after = results.get("after") @@ -91,7 +91,7 @@ before = before[0] else: before = pytree.Node(syms.power, before) - before.set_prefix(u" ") + before.prefix = u" " n_op = Name(u"in", prefix=u" ") if negation: n_not = Name(u"not", prefix=u" ") @@ -105,5 +105,5 @@ syms.arith_expr, syms.term, syms.factor, syms.power): new = parenthesize(new) - new.set_prefix(prefix) + new.prefix = prefix return new Modified: sandbox/trunk/2to3/lib2to3/fixes/fix_idioms.py ============================================================================== --- sandbox/trunk/2to3/lib2to3/fixes/fix_idioms.py (original) +++ sandbox/trunk/2to3/lib2to3/fixes/fix_idioms.py Mon Jun 1 03:55:25 2009 @@ -101,18 +101,18 @@ def transform_isinstance(self, node, results): x = results["x"].clone() # The thing inside of type() T = results["T"].clone() # The type being compared against - x.set_prefix("") - T.set_prefix(" ") - test = Call(Name("isinstance"), [x, Comma(), T]) + x.prefix = u"" + T.prefix = u" " + test = Call(Name(u"isinstance"), [x, Comma(), T]) if "n" in results: - test.set_prefix(u" ") + test.prefix = u" " test = Node(syms.not_test, [Name(u"not"), test]) - test.set_prefix(node.get_prefix()) + test.prefix = node.prefix return test def transform_while(self, node, results): one = results["while"] - one.replace(Name(u"True", prefix=one.get_prefix())) + one.replace(Name(u"True", prefix=one.prefix)) def transform_sort(self, node, results): sort_stmt = results["sort"] @@ -121,14 +121,14 @@ simple_expr = results.get("expr") if list_call: - list_call.replace(Name(u"sorted", prefix=list_call.get_prefix())) + list_call.replace(Name(u"sorted", prefix=list_call.prefix)) elif simple_expr: new = simple_expr.clone() - new.set_prefix(u"") + new.prefix = u"" simple_expr.replace(Call(Name(u"sorted"), [new], - prefix=simple_expr.get_prefix())) + prefix=simple_expr.prefix)) else: raise RuntimeError("should not have reached here") sort_stmt.remove() if next_stmt: - next_stmt[0].set_prefix(sort_stmt.get_prefix()) + next_stmt[0].prefix = sort_stmt.prefix Modified: sandbox/trunk/2to3/lib2to3/fixes/fix_import.py ============================================================================== --- sandbox/trunk/2to3/lib2to3/fixes/fix_import.py (original) +++ sandbox/trunk/2to3/lib2to3/fixes/fix_import.py Mon Jun 1 03:55:25 2009 @@ -73,7 +73,7 @@ return new = FromImport('.', [imp]) - new.set_prefix(node.get_prefix()) + new.prefix = node.prefix return new def probably_a_local_import(self, imp_name): Modified: sandbox/trunk/2to3/lib2to3/fixes/fix_imports.py ============================================================================== --- sandbox/trunk/2to3/lib2to3/fixes/fix_imports.py (original) +++ sandbox/trunk/2to3/lib2to3/fixes/fix_imports.py Mon Jun 1 03:55:25 2009 @@ -124,7 +124,7 @@ if import_mod: mod_name = import_mod.value new_name = unicode(self.mapping[mod_name]) - import_mod.replace(Name(new_name, prefix=import_mod.get_prefix())) + import_mod.replace(Name(new_name, prefix=import_mod.prefix)) if "name_import" in results: # If it's not a "from x import x, y" or "import x as y" import, # marked its usage to be replaced. @@ -142,4 +142,4 @@ bare_name = results["bare_with_attr"][0] new_name = self.replace.get(bare_name.value) if new_name: - bare_name.replace(Name(new_name, prefix=bare_name.get_prefix())) + bare_name.replace(Name(new_name, prefix=bare_name.prefix)) Modified: sandbox/trunk/2to3/lib2to3/fixes/fix_input.py ============================================================================== --- sandbox/trunk/2to3/lib2to3/fixes/fix_input.py (original) +++ sandbox/trunk/2to3/lib2to3/fixes/fix_input.py Mon Jun 1 03:55:25 2009 @@ -22,5 +22,5 @@ return new = node.clone() - new.set_prefix(u"") - return Call(Name(u"eval"), [new], prefix=node.get_prefix()) + new.prefix = u"" + return Call(Name(u"eval"), [new], prefix=node.prefix) Modified: sandbox/trunk/2to3/lib2to3/fixes/fix_intern.py ============================================================================== --- sandbox/trunk/2to3/lib2to3/fixes/fix_intern.py (original) +++ sandbox/trunk/2to3/lib2to3/fixes/fix_intern.py Mon Jun 1 03:55:25 2009 @@ -39,6 +39,6 @@ [results["lpar"].clone(), newarglist, results["rpar"].clone()])] + after) - new.set_prefix(node.get_prefix()) + new.prefix = node.prefix touch_import(None, u'sys', node) return new Modified: sandbox/trunk/2to3/lib2to3/fixes/fix_isinstance.py ============================================================================== --- sandbox/trunk/2to3/lib2to3/fixes/fix_isinstance.py (original) +++ sandbox/trunk/2to3/lib2to3/fixes/fix_isinstance.py Mon Jun 1 03:55:25 2009 @@ -45,7 +45,7 @@ del new_args[-1] if len(new_args) == 1: atom = testlist.parent - new_args[0].set_prefix(atom.get_prefix()) + new_args[0].prefix = atom.prefix atom.replace(new_args[0]) else: args[:] = new_args Modified: sandbox/trunk/2to3/lib2to3/fixes/fix_itertools.py ============================================================================== --- sandbox/trunk/2to3/lib2to3/fixes/fix_itertools.py (original) +++ sandbox/trunk/2to3/lib2to3/fixes/fix_itertools.py Mon Jun 1 03:55:25 2009 @@ -30,12 +30,12 @@ if 'it' in results and func.value != u'ifilterfalse': dot, it = (results['dot'], results['it']) # Remove the 'itertools' - prefix = it.get_prefix() + prefix = it.prefix it.remove() # Replace the node wich contains ('.', 'function') with the # function (to be consistant with the second part of the pattern) dot.remove() func.parent.replace(func) - prefix = prefix or func.get_prefix() + prefix = prefix or func.prefix func.replace(Name(func.value[1:], prefix=prefix)) Modified: sandbox/trunk/2to3/lib2to3/fixes/fix_itertools_imports.py ============================================================================== --- sandbox/trunk/2to3/lib2to3/fixes/fix_itertools_imports.py (original) +++ sandbox/trunk/2to3/lib2to3/fixes/fix_itertools_imports.py Mon Jun 1 03:55:25 2009 @@ -46,7 +46,7 @@ # If there are no imports left, just get rid of the entire statement if not (imports.children or getattr(imports, 'value', None)) or \ imports.parent is None: - p = node.get_prefix() + p = node.prefix node = BlankLine() node.prefix = p return node Modified: sandbox/trunk/2to3/lib2to3/fixes/fix_long.py ============================================================================== --- sandbox/trunk/2to3/lib2to3/fixes/fix_long.py (original) +++ sandbox/trunk/2to3/lib2to3/fixes/fix_long.py Mon Jun 1 03:55:25 2009 @@ -18,5 +18,5 @@ def transform(self, node, results): if is_probably_builtin(node): new = self.static_int.clone() - new.set_prefix(node.get_prefix()) + new.prefix = node.prefix return new Modified: sandbox/trunk/2to3/lib2to3/fixes/fix_map.py ============================================================================== --- sandbox/trunk/2to3/lib2to3/fixes/fix_map.py (original) +++ sandbox/trunk/2to3/lib2to3/fixes/fix_map.py Mon Jun 1 03:55:25 2009 @@ -63,7 +63,7 @@ if node.parent.type == syms.simple_stmt: self.warning(node, "You should use a for loop here") new = node.clone() - new.set_prefix(u"") + new.prefix = u"" new = Call(Name(u"list"), [new]) elif "map_lambda" in results: new = ListComp(results.get("xp").clone(), @@ -76,7 +76,7 @@ if in_special_context(node): return None new = node.clone() - new.set_prefix(u"") + new.prefix = u"" new = Call(Name(u"list"), [new]) - new.set_prefix(node.get_prefix()) + new.prefix = node.prefix return new Modified: sandbox/trunk/2to3/lib2to3/fixes/fix_metaclass.py ============================================================================== --- sandbox/trunk/2to3/lib2to3/fixes/fix_metaclass.py (original) +++ sandbox/trunk/2to3/lib2to3/fixes/fix_metaclass.py Mon Jun 1 03:55:25 2009 @@ -89,7 +89,7 @@ parent.insert_child(i, new_stmt) new_leaf1 = new_stmt.children[0].children[0] old_leaf1 = stmt_node.children[0].children[0] - new_leaf1.set_prefix(old_leaf1.get_prefix()) + new_leaf1.prefix = old_leaf1.prefix def remove_trailing_newline(node): @@ -136,7 +136,7 @@ node = kids.pop() if isinstance(node, Leaf) and node.type != token.DEDENT: if node.prefix: - node.set_prefix('') + node.prefix = u'' return else: kids.extend(node.children[::-1]) @@ -191,19 +191,19 @@ # now stick the metaclass in the arglist meta_txt = last_metaclass.children[0].children[0] meta_txt.value = 'metaclass' - orig_meta_prefix = meta_txt.get_prefix() + orig_meta_prefix = meta_txt.prefix if arglist.children: arglist.append_child(Leaf(token.COMMA, u',')) - meta_txt.set_prefix(u' ') + meta_txt.prefix = u' ' else: - meta_txt.set_prefix(u'') + meta_txt.prefix = u'' # compact the expression "metaclass = Meta" -> "metaclass=Meta" expr_stmt = last_metaclass.children[0] assert expr_stmt.type == syms.expr_stmt - expr_stmt.children[1].set_prefix(u'') - expr_stmt.children[2].set_prefix(u'') + expr_stmt.children[1].prefix = u'' + expr_stmt.children[2].prefix = u'' arglist.append_child(last_metaclass) @@ -214,7 +214,7 @@ # one-liner that was just __metaclass_ suite.remove() pass_leaf = Leaf(text_type, u'pass') - pass_leaf.set_prefix(orig_meta_prefix) + pass_leaf.prefix = orig_meta_prefix node.append_child(pass_leaf) node.append_child(Leaf(token.NEWLINE, u'\n')) Modified: sandbox/trunk/2to3/lib2to3/fixes/fix_methodattrs.py ============================================================================== --- sandbox/trunk/2to3/lib2to3/fixes/fix_methodattrs.py (original) +++ sandbox/trunk/2to3/lib2to3/fixes/fix_methodattrs.py Mon Jun 1 03:55:25 2009 @@ -20,4 +20,4 @@ def transform(self, node, results): attr = results["attr"][0] new = unicode(MAP[attr.value]) - attr.replace(Name(new, prefix=attr.get_prefix())) + attr.replace(Name(new, prefix=attr.prefix)) Modified: sandbox/trunk/2to3/lib2to3/fixes/fix_ne.py ============================================================================== --- sandbox/trunk/2to3/lib2to3/fixes/fix_ne.py (original) +++ sandbox/trunk/2to3/lib2to3/fixes/fix_ne.py Mon Jun 1 03:55:25 2009 @@ -17,6 +17,5 @@ return node.type == token.NOTEQUAL and node.value == u"<>" def transform(self, node, results): - new = pytree.Leaf(token.NOTEQUAL, u"!=") - new.set_prefix(node.get_prefix()) + new = pytree.Leaf(token.NOTEQUAL, u"!=", prefix=node.prefix) return new Modified: sandbox/trunk/2to3/lib2to3/fixes/fix_next.py ============================================================================== --- sandbox/trunk/2to3/lib2to3/fixes/fix_next.py (original) +++ sandbox/trunk/2to3/lib2to3/fixes/fix_next.py Mon Jun 1 03:55:25 2009 @@ -52,13 +52,13 @@ if base: if self.shadowed_next: - attr.replace(Name(u"__next__", prefix=attr.get_prefix())) + attr.replace(Name(u"__next__", prefix=attr.prefix)) else: base = [n.clone() for n in base] - base[0].set_prefix(u"") - node.replace(Call(Name(u"next", prefix=node.get_prefix()), base)) + base[0].prefix = u"" + node.replace(Call(Name(u"next", prefix=node.prefix), base)) elif name: - n = Name(u"__next__", prefix=name.get_prefix()) + n = Name(u"__next__", prefix=name.prefix) name.replace(n) elif attr: # We don't do this transformation if we're assigning to "x.next". Modified: sandbox/trunk/2to3/lib2to3/fixes/fix_nonzero.py ============================================================================== --- sandbox/trunk/2to3/lib2to3/fixes/fix_nonzero.py (original) +++ sandbox/trunk/2to3/lib2to3/fixes/fix_nonzero.py Mon Jun 1 03:55:25 2009 @@ -16,5 +16,5 @@ def transform(self, node, results): name = results["name"] - new = Name(u"__bool__", prefix=name.get_prefix()) + new = Name(u"__bool__", prefix=name.prefix) name.replace(new) Modified: sandbox/trunk/2to3/lib2to3/fixes/fix_numliterals.py ============================================================================== --- sandbox/trunk/2to3/lib2to3/fixes/fix_numliterals.py (original) +++ sandbox/trunk/2to3/lib2to3/fixes/fix_numliterals.py Mon Jun 1 03:55:25 2009 @@ -24,4 +24,4 @@ elif val.startswith(u'0') and val.isdigit() and len(set(val)) > 1: val = u"0o" + val[1:] - return Number(val, prefix=node.get_prefix()) + return Number(val, prefix=node.prefix) Modified: sandbox/trunk/2to3/lib2to3/fixes/fix_paren.py ============================================================================== --- sandbox/trunk/2to3/lib2to3/fixes/fix_paren.py (original) +++ sandbox/trunk/2to3/lib2to3/fixes/fix_paren.py Mon Jun 1 03:55:25 2009 @@ -36,7 +36,7 @@ target = results["target"] lparen = LParen() - lparen.set_prefix(target.get_prefix()) - target.set_prefix(u"") # Make it hug the parentheses + lparen.prefix = target.prefix + target.prefix = u"" # Make it hug the parentheses target.insert_child(0, lparen) target.append_child(RParen()) Modified: sandbox/trunk/2to3/lib2to3/fixes/fix_print.py ============================================================================== --- sandbox/trunk/2to3/lib2to3/fixes/fix_print.py (original) +++ sandbox/trunk/2to3/lib2to3/fixes/fix_print.py Mon Jun 1 03:55:25 2009 @@ -45,7 +45,7 @@ if bare_print: # Special-case print all by itself bare_print.replace(Call(Name(u"print"), [], - prefix=bare_print.get_prefix())) + prefix=bare_print.prefix)) return assert node.children[0] == Name(u"print") args = node.children[1:] @@ -65,7 +65,7 @@ # Now synthesize a print(args, sep=..., end=..., file=...) node. l_args = [arg.clone() for arg in args] if l_args: - l_args[0].set_prefix(u"") + l_args[0].prefix = u"" if sep is not None or end is not None or file is not None: if sep is not None: self.add_kwarg(l_args, u"sep", String(repr(sep))) @@ -74,17 +74,17 @@ if file is not None: self.add_kwarg(l_args, u"file", file) n_stmt = Call(Name(u"print"), l_args) - n_stmt.set_prefix(node.get_prefix()) + n_stmt.prefix = node.prefix return n_stmt def add_kwarg(self, l_nodes, s_kwd, n_expr): # XXX All this prefix-setting may lose comments (though rarely) - n_expr.set_prefix(u"") + n_expr.prefix = u"" n_argument = pytree.Node(self.syms.argument, (Name(s_kwd), pytree.Leaf(token.EQUAL, u"="), n_expr)) if l_nodes: l_nodes.append(Comma()) - n_argument.set_prefix(u" ") + n_argument.prefix = u" " l_nodes.append(n_argument) Modified: sandbox/trunk/2to3/lib2to3/fixes/fix_raise.py ============================================================================== --- sandbox/trunk/2to3/lib2to3/fixes/fix_raise.py (original) +++ sandbox/trunk/2to3/lib2to3/fixes/fix_raise.py Mon Jun 1 03:55:25 2009 @@ -52,31 +52,31 @@ # exc.children[1:-1] is the unparenthesized tuple # exc.children[1].children[0] is the first element of the tuple exc = exc.children[1].children[0].clone() - exc.set_prefix(" ") + exc.prefix = " " if "val" not in results: # One-argument raise new = pytree.Node(syms.raise_stmt, [Name(u"raise"), exc]) - new.set_prefix(node.get_prefix()) + new.prefix = node.prefix return new val = results["val"].clone() if is_tuple(val): args = [c.clone() for c in val.children[1:-1]] else: - val.set_prefix(u"") + val.prefix = u"" args = [val] if "tb" in results: tb = results["tb"].clone() - tb.set_prefix(u"") + tb.prefix = u"" e = Call(exc, args) with_tb = Attr(e, Name(u'with_traceback')) + [ArgList([tb])] new = pytree.Node(syms.simple_stmt, [Name(u"raise")] + with_tb) - new.set_prefix(node.get_prefix()) + new.prefix = node.prefix return new else: return pytree.Node(syms.raise_stmt, [Name(u"raise"), Call(exc, args)], - prefix=node.get_prefix()) + prefix=node.prefix) Modified: sandbox/trunk/2to3/lib2to3/fixes/fix_raw_input.py ============================================================================== --- sandbox/trunk/2to3/lib2to3/fixes/fix_raw_input.py (original) +++ sandbox/trunk/2to3/lib2to3/fixes/fix_raw_input.py Mon Jun 1 03:55:25 2009 @@ -13,4 +13,4 @@ def transform(self, node, results): name = results["name"] - name.replace(Name(u"input", prefix=name.get_prefix())) + name.replace(Name(u"input", prefix=name.prefix)) Modified: sandbox/trunk/2to3/lib2to3/fixes/fix_renames.py ============================================================================== --- sandbox/trunk/2to3/lib2to3/fixes/fix_renames.py (original) +++ sandbox/trunk/2to3/lib2to3/fixes/fix_renames.py Mon Jun 1 03:55:25 2009 @@ -66,4 +66,4 @@ if mod_name and attr_name: new_attr = unicode(LOOKUP[(mod_name.value, attr_name.value)]) - attr_name.replace(Name(new_attr, prefix=attr_name.get_prefix())) + attr_name.replace(Name(new_attr, prefix=attr_name.prefix)) Modified: sandbox/trunk/2to3/lib2to3/fixes/fix_repr.py ============================================================================== --- sandbox/trunk/2to3/lib2to3/fixes/fix_repr.py (original) +++ sandbox/trunk/2to3/lib2to3/fixes/fix_repr.py Mon Jun 1 03:55:25 2009 @@ -19,4 +19,4 @@ if expr.type == self.syms.testlist1: expr = parenthesize(expr) - return Call(Name(u"repr"), [expr], prefix=node.get_prefix()) + return Call(Name(u"repr"), [expr], prefix=node.prefix) Modified: sandbox/trunk/2to3/lib2to3/fixes/fix_set_literal.py ============================================================================== --- sandbox/trunk/2to3/lib2to3/fixes/fix_set_literal.py (original) +++ sandbox/trunk/2to3/lib2to3/fixes/fix_set_literal.py Mon Jun 1 03:55:25 2009 @@ -38,15 +38,15 @@ literal.extend(n.clone() for n in items.children) literal.append(pytree.Leaf(token.RBRACE, u"}")) # Set the prefix of the right brace to that of the ')' or ']' - literal[-1].set_prefix(items.next_sibling.get_prefix()) + literal[-1].prefix = items.next_sibling.prefix maker = pytree.Node(syms.dictsetmaker, literal) - maker.set_prefix(node.get_prefix()) + maker.prefix = node.prefix # If the original was a one tuple, we need to remove the extra comma. if len(maker.children) == 4: n = maker.children[2] n.remove() - maker.children[-1].set_prefix(n.get_prefix()) + maker.children[-1].prefix = n.prefix # Finally, replace the set call with our shiny new literal. return maker Modified: sandbox/trunk/2to3/lib2to3/fixes/fix_standarderror.py ============================================================================== --- sandbox/trunk/2to3/lib2to3/fixes/fix_standarderror.py (original) +++ sandbox/trunk/2to3/lib2to3/fixes/fix_standarderror.py Mon Jun 1 03:55:25 2009 @@ -15,4 +15,4 @@ """ def transform(self, node, results): - return Name(u"Exception", prefix=node.get_prefix()) + return Name(u"Exception", prefix=node.prefix) Modified: sandbox/trunk/2to3/lib2to3/fixes/fix_sys_exc.py ============================================================================== --- sandbox/trunk/2to3/lib2to3/fixes/fix_sys_exc.py (original) +++ sandbox/trunk/2to3/lib2to3/fixes/fix_sys_exc.py Mon Jun 1 03:55:25 2009 @@ -22,8 +22,8 @@ sys_attr = results["attribute"][0] index = Number(self.exc_info.index(sys_attr.value)) - call = Call(Name(u"exc_info"), prefix=sys_attr.get_prefix()) + call = Call(Name(u"exc_info"), prefix=sys_attr.prefix) attr = Attr(Name(u"sys"), call) - attr[1].children[0].set_prefix(results["dot"].get_prefix()) + attr[1].children[0].prefix = results["dot"].prefix attr.append(Subscript(index)) - return Node(syms.power, attr, prefix=node.get_prefix()) + return Node(syms.power, attr, prefix=node.prefix) Modified: sandbox/trunk/2to3/lib2to3/fixes/fix_throw.py ============================================================================== --- sandbox/trunk/2to3/lib2to3/fixes/fix_throw.py (original) +++ sandbox/trunk/2to3/lib2to3/fixes/fix_throw.py Mon Jun 1 03:55:25 2009 @@ -40,14 +40,14 @@ if is_tuple(val): args = [c.clone() for c in val.children[1:-1]] else: - val.set_prefix(u"") + val.prefix = u"" args = [val] throw_args = results["args"] if "tb" in results: tb = results["tb"].clone() - tb.set_prefix(u"") + tb.prefix = u"" e = Call(exc, args) with_tb = Attr(e, Name(u'with_traceback')) + [ArgList([tb])] Modified: sandbox/trunk/2to3/lib2to3/fixes/fix_tuple_params.py ============================================================================== --- sandbox/trunk/2to3/lib2to3/fixes/fix_tuple_params.py (original) +++ sandbox/trunk/2to3/lib2to3/fixes/fix_tuple_params.py Mon Jun 1 03:55:25 2009 @@ -63,10 +63,10 @@ def handle_tuple(tuple_arg, add_prefix=False): n = Name(self.new_name()) arg = tuple_arg.clone() - arg.set_prefix(u"") + arg.prefix = u"" stmt = Assign(arg, n.clone()) if add_prefix: - n.set_prefix(u" ") + n.prefix = u" " tuple_arg.replace(n) new_lines.append(pytree.Node(syms.simple_stmt, [stmt, end.clone()])) @@ -91,14 +91,14 @@ # TODO(cwinter) suite-cleanup after = start if start == 0: - new_lines[0].set_prefix(u" ") + new_lines[0].prefix = u" " elif is_docstring(suite[0].children[start]): - new_lines[0].set_prefix(indent) + new_lines[0].prefix = indent after = start + 1 suite[0].children[after:after] = new_lines for i in range(after+1, after+len(new_lines)+1): - suite[0].children[i].set_prefix(indent) + suite[0].children[i].prefix = indent suite[0].changed() def transform_lambda(self, node, results): @@ -109,7 +109,7 @@ # Replace lambda ((((x)))): x with lambda x: x if inner.type == token.NAME: inner = inner.clone() - inner.set_prefix(u" ") + inner.prefix = u" " args.replace(inner) return @@ -124,7 +124,7 @@ subscripts = [c.clone() for c in to_index[n.value]] new = pytree.Node(syms.power, [new_param.clone()] + subscripts) - new.set_prefix(n.get_prefix()) + new.prefix = n.prefix n.replace(new) Modified: sandbox/trunk/2to3/lib2to3/fixes/fix_types.py ============================================================================== --- sandbox/trunk/2to3/lib2to3/fixes/fix_types.py (original) +++ sandbox/trunk/2to3/lib2to3/fixes/fix_types.py Mon Jun 1 03:55:25 2009 @@ -58,5 +58,5 @@ def transform(self, node, results): new_value = unicode(_TYPE_MAPPING.get(results["name"].value)) if new_value: - return Name(new_value, prefix=node.get_prefix()) + return Name(new_value, prefix=node.prefix) return None Modified: sandbox/trunk/2to3/lib2to3/fixes/fix_urllib.py ============================================================================== --- sandbox/trunk/2to3/lib2to3/fixes/fix_urllib.py (original) +++ sandbox/trunk/2to3/lib2to3/fixes/fix_urllib.py Mon Jun 1 03:55:25 2009 @@ -78,7 +78,7 @@ replacements. """ import_mod = results.get('module') - pref = import_mod.get_prefix() + pref = import_mod.prefix names = [] @@ -94,7 +94,7 @@ module. """ mod_member = results.get('mod_member') - pref = mod_member.get_prefix() + pref = mod_member.prefix member = results.get('member') # Simple case with only a single member being imported @@ -162,7 +162,7 @@ break if new_name: module_dot.replace(Name(new_name, - prefix=module_dot.get_prefix())) + prefix=module_dot.prefix)) else: self.cannot_convert(node, 'This is an invalid module element') Modified: sandbox/trunk/2to3/lib2to3/fixes/fix_ws_comma.py ============================================================================== --- sandbox/trunk/2to3/lib2to3/fixes/fix_ws_comma.py (original) +++ sandbox/trunk/2to3/lib2to3/fixes/fix_ws_comma.py Mon Jun 1 03:55:25 2009 @@ -26,14 +26,14 @@ comma = False for child in new.children: if child in self.SEPS: - prefix = child.get_prefix() + prefix = child.prefix if prefix.isspace() and u"\n" not in prefix: - child.set_prefix(u"") + child.prefix = u"" comma = True else: if comma: - prefix = child.get_prefix() + prefix = child.prefix if not prefix: - child.set_prefix(u" ") + child.prefix = u" " comma = False return new Modified: sandbox/trunk/2to3/lib2to3/fixes/fix_xrange.py ============================================================================== --- sandbox/trunk/2to3/lib2to3/fixes/fix_xrange.py (original) +++ sandbox/trunk/2to3/lib2to3/fixes/fix_xrange.py Mon Jun 1 03:55:25 2009 @@ -28,14 +28,14 @@ def transform_xrange(self, node, results): name = results["name"] - name.replace(Name(u"range", prefix=name.get_prefix())) + name.replace(Name(u"range", prefix=name.prefix)) def transform_range(self, node, results): if not self.in_special_context(node): range_call = Call(Name(u"range"), [results["args"].clone()]) # Encase the range call in list(). list_call = Call(Name(u"list"), [range_call], - prefix=node.get_prefix()) + prefix=node.prefix) # Put things that were after the range() call after the list call. for n in results["rest"]: list_call.append_child(n) Modified: sandbox/trunk/2to3/lib2to3/fixes/fix_xreadlines.py ============================================================================== --- sandbox/trunk/2to3/lib2to3/fixes/fix_xreadlines.py (original) +++ sandbox/trunk/2to3/lib2to3/fixes/fix_xreadlines.py Mon Jun 1 03:55:25 2009 @@ -19,6 +19,6 @@ no_call = results.get("no_call") if no_call: - no_call.replace(Name(u"__iter__", prefix=no_call.get_prefix())) + no_call.replace(Name(u"__iter__", prefix=no_call.prefix)) else: node.replace([x.clone() for x in results["call"]]) Modified: sandbox/trunk/2to3/lib2to3/fixes/fix_zip.py ============================================================================== --- sandbox/trunk/2to3/lib2to3/fixes/fix_zip.py (original) +++ sandbox/trunk/2to3/lib2to3/fixes/fix_zip.py Mon Jun 1 03:55:25 2009 @@ -28,7 +28,7 @@ return None new = node.clone() - new.set_prefix(u"") + new.prefix = u"" new = Call(Name(u"list"), [new]) - new.set_prefix(node.get_prefix()) + new.prefix = node.prefix return new Modified: sandbox/trunk/2to3/lib2to3/pytree.py ============================================================================== --- sandbox/trunk/2to3/lib2to3/pytree.py (original) +++ sandbox/trunk/2to3/lib2to3/pytree.py Mon Jun 1 03:55:25 2009 @@ -13,6 +13,7 @@ __author__ = "Guido van Rossum " import sys +import warnings from StringIO import StringIO @@ -111,17 +112,21 @@ """ Set the prefix for the node (see Leaf class). - This must be implemented by the concrete subclass. + DEPRECATED; use the prefix property directly. """ - raise NotImplementedError + warnings.warn("set_prefix() is deprecated; use the prefix property", + DeprecationWarning, stacklevel=2) + self.prefix = prefix def get_prefix(self): """ Return the prefix for the node (see Leaf class). - This must be implemented by the concrete subclass. + DEPRECATED; use the prefix property directly. """ - raise NotImplementedError + warnings.warn("get_prefix() is deprecated; use the prefix property", + DeprecationWarning, stacklevel=2) + return self.prefix def replace(self, new): """Replace this node with a new one in the parent.""" @@ -209,12 +214,12 @@ def get_suffix(self): """ Return the string immediately following the invocant node. This is - effectively equivalent to node.next_sibling.get_prefix() + effectively equivalent to node.next_sibling.prefix """ next_sib = self.next_sibling if next_sib is None: return u"" - return next_sib.get_prefix() + return next_sib.prefix if sys.version_info < (3, 0): def __str__(self): @@ -241,7 +246,7 @@ assert ch.parent is None, repr(ch) ch.parent = self if prefix is not None: - self.set_prefix(prefix) + self.prefix = prefix def __repr__(self): """Return a canonical string representation.""" @@ -282,24 +287,19 @@ for node in child.post_order(): yield node - def set_prefix(self, prefix): - """ - Set the prefix for the node. - - This passes the responsibility on to the first child. - """ - if self.children: - self.children[0].set_prefix(prefix) - - def get_prefix(self): + @property + def prefix(self): """ - Return the prefix for the node. - - This passes the call on to the first child. + The whitespace and comments preceding this node in the input. """ if not self.children: return "" - return self.children[0].get_prefix() + return self.children[0].prefix + + @prefix.setter + def prefix(self, prefix): + if self.children: + self.children[0].prefix = prefix def set_child(self, i, child): """ @@ -335,9 +335,9 @@ """Concrete implementation for leaf nodes.""" # Default values for instance variables - prefix = "" # Whitespace and comments preceding this token in the input - lineno = 0 # Line where this token starts in the input - column = 0 # Column where this token tarts in the input + _prefix = "" # Whitespace and comments preceding this token in the input + lineno = 0 # Line where this token starts in the input + column = 0 # Column where this token tarts in the input def __init__(self, type, value, context=None, prefix=None): """ @@ -348,11 +348,11 @@ """ assert 0 <= type < 256, type if context is not None: - self.prefix, (self.lineno, self.column) = context + self._prefix, (self.lineno, self.column) = context self.type = type self.value = value if prefix is not None: - self.prefix = prefix + self._prefix = prefix def __repr__(self): """Return a canonical string representation.""" @@ -388,14 +388,17 @@ """Return a pre-order iterator for the tree.""" yield self - def set_prefix(self, prefix): - """Set the prefix for the node.""" - self.changed() - self.prefix = prefix + @property + def prefix(self): + """ + The whitespace and comments preceding this token in the input. + """ + return self._prefix - def get_prefix(self): - """Return the prefix for the node.""" - return self.prefix + @prefix.setter + def prefix(self, prefix): + self.changed() + self._prefix = prefix def convert(gr, raw_node): Modified: sandbox/trunk/2to3/lib2to3/tests/data/fixers/myfixes/fix_parrot.py ============================================================================== --- sandbox/trunk/2to3/lib2to3/tests/data/fixers/myfixes/fix_parrot.py (original) +++ sandbox/trunk/2to3/lib2to3/tests/data/fixers/myfixes/fix_parrot.py Mon Jun 1 03:55:25 2009 @@ -10,4 +10,4 @@ def transform(self, node, results): name = results["name"] - name.replace(Name("cheese", name.get_prefix())) + name.replace(Name("cheese", name.prefix)) Modified: sandbox/trunk/2to3/lib2to3/tests/test_pytree.py ============================================================================== --- sandbox/trunk/2to3/lib2to3/tests/test_pytree.py (original) +++ sandbox/trunk/2to3/lib2to3/tests/test_pytree.py Mon Jun 1 03:55:25 2009 @@ -10,6 +10,8 @@ especially when debugging a test. """ +import warnings + # Testing imports from . import support @@ -28,6 +30,20 @@ """Unit tests for nodes (Base, Leaf, Node).""" + def test_deprecated_prefix_methods(self): + l = pytree.Leaf(100, "foo") + with warnings.catch_warnings(record=True) as w: + self.assertEqual(l.get_prefix(), "") + l.set_prefix("hi") + self.assertEqual(l.prefix, "hi") + self.assertEqual(len(w), 2) + for warning in w: + self.assertTrue(warning.category is DeprecationWarning) + self.assertEqual(str(w[0].message), "get_prefix() is deprecated; " \ + "use the prefix property") + self.assertEqual(str(w[1].message), "set_prefix() is deprecated; " \ + "use the prefix property") + def testBaseCantConstruct(self): if __debug__: # Test that instantiating Base() raises an AssertionError @@ -52,7 +68,7 @@ # Make sure that the Leaf's value is stringified. Failing to # do this can cause a TypeError in certain situations. l1 = pytree.Leaf(2, 5) - l1.set_prefix("foo_") + l1.prefix = "foo_" self.assertEqual(str(l1), "foo_5") def testLeafEq(self): @@ -66,10 +82,10 @@ def testLeafPrefix(self): l1 = pytree.Leaf(100, "foo") - self.assertEqual(l1.get_prefix(), "") + self.assertEqual(l1.prefix, "") self.failIf(l1.was_changed) - l1.set_prefix(" ##\n\n") - self.assertEqual(l1.get_prefix(), " ##\n\n") + l1.prefix = " ##\n\n" + self.assertEqual(l1.prefix, " ##\n\n") self.failUnless(l1.was_changed) def testNode(self): @@ -94,26 +110,26 @@ def testNodePrefix(self): l1 = pytree.Leaf(100, "foo") - self.assertEqual(l1.get_prefix(), "") + self.assertEqual(l1.prefix, "") n1 = pytree.Node(1000, [l1]) - self.assertEqual(n1.get_prefix(), "") - n1.set_prefix(" ") - self.assertEqual(n1.get_prefix(), " ") - self.assertEqual(l1.get_prefix(), " ") + self.assertEqual(n1.prefix, "") + n1.prefix = " " + self.assertEqual(n1.prefix, " ") + self.assertEqual(l1.prefix, " ") def testGetSuffix(self): l1 = pytree.Leaf(100, "foo", prefix="a") l2 = pytree.Leaf(100, "bar", prefix="b") n1 = pytree.Node(1000, [l1, l2]) - self.assertEqual(l1.get_suffix(), l2.get_prefix()) + self.assertEqual(l1.get_suffix(), l2.prefix) self.assertEqual(l2.get_suffix(), "") self.assertEqual(n1.get_suffix(), "") l3 = pytree.Leaf(100, "bar", prefix="c") n2 = pytree.Node(1000, [n1, l3]) - self.assertEqual(n1.get_suffix(), l3.get_prefix()) + self.assertEqual(n1.get_suffix(), l3.prefix) self.assertEqual(l3.get_suffix(), "") self.assertEqual(n2.get_suffix(), "") @@ -204,7 +220,7 @@ for prefix in ("xyz_", ""): l1 = pytree.Leaf(100, "self", prefix=prefix) self.failUnless(str(l1), prefix + "self") - self.assertEqual(l1.get_prefix(), prefix) + self.assertEqual(l1.prefix, prefix) def testNodeConstructorPrefix(self): for prefix in ("xyz_", ""): @@ -212,9 +228,9 @@ l2 = pytree.Leaf(100, "foo", prefix="_") n1 = pytree.Node(1000, [l1, l2], prefix=prefix) self.failUnless(str(n1), prefix + "self_foo") - self.assertEqual(n1.get_prefix(), prefix) - self.assertEqual(l1.get_prefix(), prefix) - self.assertEqual(l2.get_prefix(), "_") + self.assertEqual(n1.prefix, prefix) + self.assertEqual(l1.prefix, prefix) + self.assertEqual(l2.prefix, "_") def testRemove(self): l1 = pytree.Leaf(100, "foo") From python-checkins at python.org Mon Jun 1 04:00:51 2009 From: python-checkins at python.org (benjamin.peterson) Date: Mon, 1 Jun 2009 04:00:51 +0200 (CEST) Subject: [Python-checkins] r73092 - sandbox/trunk/2to3/lib2to3/tests/test_pytree.py Message-ID: <20090601020051.DA005DA62@mail.python.org> Author: benjamin.peterson Date: Mon Jun 1 04:00:51 2009 New Revision: 73092 Log: change hideous java naming scheme Modified: sandbox/trunk/2to3/lib2to3/tests/test_pytree.py Modified: sandbox/trunk/2to3/lib2to3/tests/test_pytree.py ============================================================================== --- sandbox/trunk/2to3/lib2to3/tests/test_pytree.py (original) +++ sandbox/trunk/2to3/lib2to3/tests/test_pytree.py Mon Jun 1 04:00:51 2009 @@ -44,34 +44,34 @@ self.assertEqual(str(w[1].message), "set_prefix() is deprecated; " \ "use the prefix property") - def testBaseCantConstruct(self): + def test_instantiate_base(self): if __debug__: # Test that instantiating Base() raises an AssertionError self.assertRaises(AssertionError, pytree.Base) - def testLeaf(self): + def test_leaf(self): l1 = pytree.Leaf(100, "foo") self.assertEqual(l1.type, 100) self.assertEqual(l1.value, "foo") - def testLeafRepr(self): + def test_leaf_repr(self): l1 = pytree.Leaf(100, "foo") self.assertEqual(repr(l1), "Leaf(100, 'foo')") - def testLeafStr(self): + def test_leaf_str(self): l1 = pytree.Leaf(100, "foo") self.assertEqual(str(l1), "foo") l2 = pytree.Leaf(100, "foo", context=(" ", (10, 1))) self.assertEqual(str(l2), " foo") - def testLeafStrNumericValue(self): + def test_leaf_str_numeric_value(self): # Make sure that the Leaf's value is stringified. Failing to # do this can cause a TypeError in certain situations. l1 = pytree.Leaf(2, 5) l1.prefix = "foo_" self.assertEqual(str(l1), "foo_5") - def testLeafEq(self): + def test_leaf_equality(self): l1 = pytree.Leaf(100, "foo") l2 = pytree.Leaf(100, "foo", context=(" ", (1, 0))) self.assertEqual(l1, l2) @@ -80,7 +80,7 @@ self.assertNotEqual(l1, l3) self.assertNotEqual(l1, l4) - def testLeafPrefix(self): + def test_leaf_prefix(self): l1 = pytree.Leaf(100, "foo") self.assertEqual(l1.prefix, "") self.failIf(l1.was_changed) @@ -88,27 +88,27 @@ self.assertEqual(l1.prefix, " ##\n\n") self.failUnless(l1.was_changed) - def testNode(self): + def test_node(self): l1 = pytree.Leaf(100, "foo") l2 = pytree.Leaf(200, "bar") n1 = pytree.Node(1000, [l1, l2]) self.assertEqual(n1.type, 1000) self.assertEqual(n1.children, [l1, l2]) - def testNodeRepr(self): + def test_node_repr(self): l1 = pytree.Leaf(100, "foo") l2 = pytree.Leaf(100, "bar", context=(" ", (1, 0))) n1 = pytree.Node(1000, [l1, l2]) self.assertEqual(repr(n1), "Node(1000, [%s, %s])" % (repr(l1), repr(l2))) - def testNodeStr(self): + def test_node_str(self): l1 = pytree.Leaf(100, "foo") l2 = pytree.Leaf(100, "bar", context=(" ", (1, 0))) n1 = pytree.Node(1000, [l1, l2]) self.assertEqual(str(n1), "foo bar") - def testNodePrefix(self): + def test_node_prefix(self): l1 = pytree.Leaf(100, "foo") self.assertEqual(l1.prefix, "") n1 = pytree.Node(1000, [l1]) @@ -117,7 +117,7 @@ self.assertEqual(n1.prefix, " ") self.assertEqual(l1.prefix, " ") - def testGetSuffix(self): + def test_get_suffix(self): l1 = pytree.Leaf(100, "foo", prefix="a") l2 = pytree.Leaf(100, "bar", prefix="b") n1 = pytree.Node(1000, [l1, l2]) @@ -133,14 +133,14 @@ self.assertEqual(l3.get_suffix(), "") self.assertEqual(n2.get_suffix(), "") - def testNodeEq(self): + def test_node_equality(self): n1 = pytree.Node(1000, ()) n2 = pytree.Node(1000, [], context=(" ", (1, 0))) self.assertEqual(n1, n2) n3 = pytree.Node(1001, ()) self.assertNotEqual(n1, n3) - def testNodeEqRecursive(self): + def test_node_recursive_equality(self): l1 = pytree.Leaf(100, "foo") l2 = pytree.Leaf(100, "foo") n1 = pytree.Node(1000, [l1]) @@ -150,7 +150,7 @@ n3 = pytree.Node(1000, [l3]) self.assertNotEqual(n1, n3) - def testReplace(self): + def test_replace(self): l1 = pytree.Leaf(100, "foo") l2 = pytree.Leaf(100, "+") l3 = pytree.Leaf(100, "bar") @@ -164,7 +164,7 @@ self.failUnless(isinstance(n1.children, list)) self.failUnless(n1.was_changed) - def testReplaceWithList(self): + def test_replace_with_list(self): l1 = pytree.Leaf(100, "foo") l2 = pytree.Leaf(100, "+") l3 = pytree.Leaf(100, "bar") @@ -174,26 +174,26 @@ self.assertEqual(str(n1), "foo**bar") self.failUnless(isinstance(n1.children, list)) - def testPostOrder(self): + def test_post_order(self): l1 = pytree.Leaf(100, "foo") l2 = pytree.Leaf(100, "bar") n1 = pytree.Node(1000, [l1, l2]) self.assertEqual(list(n1.post_order()), [l1, l2, n1]) - def testPreOrder(self): + def test_pre_order(self): l1 = pytree.Leaf(100, "foo") l2 = pytree.Leaf(100, "bar") n1 = pytree.Node(1000, [l1, l2]) self.assertEqual(list(n1.pre_order()), [n1, l1, l2]) - def testChangedLeaf(self): + def test_changed_leaf(self): l1 = pytree.Leaf(100, "f") self.failIf(l1.was_changed) l1.changed() self.failUnless(l1.was_changed) - def testChangedNode(self): + def test_changed_node(self): l1 = pytree.Leaf(100, "f") n1 = pytree.Node(1000, [l1]) self.failIf(n1.was_changed) @@ -201,7 +201,7 @@ n1.changed() self.failUnless(n1.was_changed) - def testChangedRecursive(self): + def test_changed_recursive(self): l1 = pytree.Leaf(100, "foo") l2 = pytree.Leaf(100, "+") l3 = pytree.Leaf(100, "bar") @@ -216,13 +216,13 @@ self.failUnless(n2.was_changed) self.failIf(l1.was_changed) - def testLeafConstructorPrefix(self): + def test_leaf_constructor_prefix(self): for prefix in ("xyz_", ""): l1 = pytree.Leaf(100, "self", prefix=prefix) self.failUnless(str(l1), prefix + "self") self.assertEqual(l1.prefix, prefix) - def testNodeConstructorPrefix(self): + def test_node_constructor_prefix(self): for prefix in ("xyz_", ""): l1 = pytree.Leaf(100, "self") l2 = pytree.Leaf(100, "foo", prefix="_") @@ -232,7 +232,7 @@ self.assertEqual(l1.prefix, prefix) self.assertEqual(l2.prefix, "_") - def testRemove(self): + def test_remove(self): l1 = pytree.Leaf(100, "foo") l2 = pytree.Leaf(100, "foo") n1 = pytree.Node(1000, [l1, l2]) @@ -255,7 +255,7 @@ self.failUnless(n1.was_changed) self.failUnless(n2.was_changed) - def testRemoveParentless(self): + def test_remove_parentless(self): n1 = pytree.Node(1000, []) n1.remove() self.assertEqual(n1.parent, None) @@ -264,7 +264,7 @@ l1.remove() self.assertEqual(l1.parent, None) - def testNodeSetChild(self): + def test_node_set_child(self): l1 = pytree.Leaf(100, "foo") n1 = pytree.Node(1000, [l1]) @@ -285,7 +285,7 @@ # I don't care what it raises, so long as it's an exception self.assertRaises(Exception, n1.set_child, 0, list) - def testNodeInsertChild(self): + def test_node_insert_child(self): l1 = pytree.Leaf(100, "foo") n1 = pytree.Node(1000, [l1]) @@ -301,7 +301,7 @@ # I don't care what it raises, so long as it's an exception self.assertRaises(Exception, n1.insert_child, 0, list) - def testNodeAppendChild(self): + def test_node_append_child(self): n1 = pytree.Node(1000, []) l1 = pytree.Leaf(100, "foo") @@ -317,7 +317,7 @@ # I don't care what it raises, so long as it's an exception self.assertRaises(Exception, n1.append_child, list) - def testNodeNextSibling(self): + def test_node_next_sibling(self): n1 = pytree.Node(1000, []) n2 = pytree.Node(1000, []) p1 = pytree.Node(1000, [n1, n2]) @@ -326,7 +326,7 @@ self.assertEqual(n2.next_sibling, None) self.assertEqual(p1.next_sibling, None) - def testLeafNextSibling(self): + def test_leaf_next_sibling(self): l1 = pytree.Leaf(100, "a") l2 = pytree.Leaf(100, "b") p1 = pytree.Node(1000, [l1, l2]) @@ -335,7 +335,7 @@ self.assertEqual(l2.next_sibling, None) self.assertEqual(p1.next_sibling, None) - def testNodePrevSibling(self): + def test_node_prev_sibling(self): n1 = pytree.Node(1000, []) n2 = pytree.Node(1000, []) p1 = pytree.Node(1000, [n1, n2]) @@ -344,7 +344,7 @@ self.assertEqual(n1.prev_sibling, None) self.assertEqual(p1.prev_sibling, None) - def testLeafPrevSibling(self): + def test_leaf_prev_sibling(self): l1 = pytree.Leaf(100, "a") l2 = pytree.Leaf(100, "b") p1 = pytree.Node(1000, [l1, l2]) @@ -358,7 +358,7 @@ """Unit tests for tree matching patterns.""" - def testBasicPatterns(self): + def test_basic_patterns(self): # Build a tree l1 = pytree.Leaf(100, "foo") l2 = pytree.Leaf(100, "bar") @@ -394,7 +394,7 @@ self.assertFalse(pn.match(l2, results=r)) self.assertEqual(r, {}) - def testWildcardPatterns(self): + def test_wildcard(self): # Build a tree for testing l1 = pytree.Leaf(100, "foo") l2 = pytree.Leaf(100, "bar") @@ -425,7 +425,7 @@ self.assert_(r["pl"] is l3) r = {} - def testGenerateMatches(self): + def test_generate_matches(self): la = pytree.Leaf(1, "a") lb = pytree.Leaf(1, "b") lc = pytree.Leaf(1, "c") @@ -455,7 +455,7 @@ for c in "abcdef": self.assertEqual(r["p" + c], pytree.Leaf(1, c)) - def testHasKeyExample(self): + def test_has_key_example(self): pattern = pytree.NodePattern(331, (pytree.LeafPattern(7), pytree.WildcardPattern(name="args"), From python-checkins at python.org Mon Jun 1 04:01:39 2009 From: python-checkins at python.org (benjamin.peterson) Date: Mon, 1 Jun 2009 04:01:39 +0200 (CEST) Subject: [Python-checkins] r73093 - sandbox/trunk/2to3/lib2to3/tests/test_pytree.py Message-ID: <20090601020139.9C005C2B2@mail.python.org> Author: benjamin.peterson Date: Mon Jun 1 04:01:39 2009 New Revision: 73093 Log: remove dated comment Modified: sandbox/trunk/2to3/lib2to3/tests/test_pytree.py Modified: sandbox/trunk/2to3/lib2to3/tests/test_pytree.py ============================================================================== --- sandbox/trunk/2to3/lib2to3/tests/test_pytree.py (original) +++ sandbox/trunk/2to3/lib2to3/tests/test_pytree.py Mon Jun 1 04:01:39 2009 @@ -15,8 +15,7 @@ # Testing imports from . import support -# Local imports (XXX should become a package) -from .. import pytree +from lib2to3 import pytree try: sorted From python-checkins at python.org Mon Jun 1 04:32:34 2009 From: python-checkins at python.org (guilherme.polo) Date: Mon, 1 Jun 2009 04:32:34 +0200 (CEST) Subject: [Python-checkins] r73094 - python/branches/tk_and_idle_maintenance/Lib/lib-tk/test/test_tkinter/test_tclvariables.py Message-ID: <20090601023234.6B305D52A@mail.python.org> Author: guilherme.polo Date: Mon Jun 1 04:32:34 2009 New Revision: 73094 Log: Initial tests for classes that manipulate tcl variables. Added: python/branches/tk_and_idle_maintenance/Lib/lib-tk/test/test_tkinter/test_tclvariables.py (contents, props changed) Added: python/branches/tk_and_idle_maintenance/Lib/lib-tk/test/test_tkinter/test_tclvariables.py ============================================================================== --- (empty file) +++ python/branches/tk_and_idle_maintenance/Lib/lib-tk/test/test_tkinter/test_tclvariables.py Mon Jun 1 04:32:34 2009 @@ -0,0 +1,122 @@ +import unittest +import Tkinter +from test.test_support import run_unittest +from ttk import setup_master + +class VariableTest(unittest.TestCase): + + var_class = Tkinter.Variable + + def setUp(self): + self.root = setup_master(useTk=False) + self.var = self.var_class(self.root) + + def tearDown(self): + del self.var + + + def test__str__(self): + name = 'test123' + myvar = Tkinter.Variable(self.root, name=name) + self.assertEqual(str(myvar), name) + del myvar + self.assertRaises(Tkinter.TclError, + self.root.tk.globalgetvar, name) + + def test_get_set(self): + self.assertEqual(self.var.get(), self.var_class._default) + self.var.set(1) + self.assertEqual(self.var.get(), 1) + self.var.set('1') + self.assertEqual(self.var.get(), '1') + + def test_trace(self): + self.assertFalse(self.var.trace_vinfo()) + + read = [False] + def test_read(name1, name2, op): + self.assertEqual(op, 'r') + read.pop() + cb1 = self.var.trace_variable('r', test_read) + self.var.get() + self.assertFalse(read) + + read_vinfo = self.var.trace_vinfo() + + self.assertEqual(len(read_vinfo), 1) + cb2 = self.var.trace_variable('w', test_read) + self.assertEqual(len(self.var.trace_vinfo()), 2) + + self.var.trace_vdelete('w', cb2) + self.assertEqual(self.var.trace_vinfo(), read_vinfo) + self.assertNotIn(cb2, self.var._master._tclCommands) + self.var.trace_vdelete('r', cb1) + self.assertNotIn(cb1, self.var._master._tclCommands) + + +class StringVarTest(VariableTest): + + var_class = Tkinter.StringVar + + def test_get_set(self): + self.assertEqual(self.var.get(), self.var_class._default) + self.var.set(1) + self.assertEqual(self.var.get(), '1') + self.var.set('1') + self.assertEqual(self.var.get(), '1') + + +class IntVarTest(VariableTest): + + var_class = Tkinter.IntVar + + def test_get_set(self): + self.assertEqual(self.var.get(), self.var_class._default) + self.var.set(1) + self.assertEqual(self.var.get(), 1) + self.var.set('1') + self.assertEqual(self.var.get(), 1) + self.var.set(True) + self.assertEqual(self.var.get(), int(True)) + + self.var.set([1, 2, 3]) + self.assertRaises(ValueError, self.var.get) + + +class DoubleVarTest(VariableTest): + + var_class = Tkinter.DoubleVar + + def test_get_set(self): + self.assertEqual(self.var.get(), self.var_class._default) + self.var.set(1.1) + self.assertEqual(self.var.get(), 1.1) + self.var.set('1.32') + self.assertEqual(self.var.get(), 1.32) + + self.var.set({}) + self.assertRaises(ValueError, self.var.get) + + +class BooleanVarTest(VariableTest): + + var_class = Tkinter.BooleanVar + + def test_get_set(self): + self.assertEqual(self.var.get(), self.var_class._default) + for val in ['on', 1, True, '1', 'true']: + self.var.set(val) + self.assertEqual(self.var.get(), True) + for val in ['off', 0, False, '0', 'false']: + self.var.set(val) + self.assertEqual(self.var.get(), False) + + self.var.set({}) + self.assertRaises(Tkinter.TclError, self.var.get) + + +tests_gui = (VariableTest, StringVarTest, IntVarTest, + DoubleVarTest, BooleanVarTest) + +if __name__ == "__main__": + run_unittest(*tests_gui) From python-checkins at python.org Mon Jun 1 04:37:55 2009 From: python-checkins at python.org (guilherme.polo) Date: Mon, 1 Jun 2009 04:37:55 +0200 (CEST) Subject: [Python-checkins] r73095 - python/branches/tk_and_idle_maintenance/Lib/lib-tk/test/test_tkinter/test_tclvariables.py Message-ID: <20090601023755.953B9D628@mail.python.org> Author: guilherme.polo Date: Mon Jun 1 04:37:55 2009 New Revision: 73095 Log: These tests do not require a gui. Modified: python/branches/tk_and_idle_maintenance/Lib/lib-tk/test/test_tkinter/test_tclvariables.py Modified: python/branches/tk_and_idle_maintenance/Lib/lib-tk/test/test_tkinter/test_tclvariables.py ============================================================================== --- python/branches/tk_and_idle_maintenance/Lib/lib-tk/test/test_tkinter/test_tclvariables.py (original) +++ python/branches/tk_and_idle_maintenance/Lib/lib-tk/test/test_tkinter/test_tclvariables.py Mon Jun 1 04:37:55 2009 @@ -115,8 +115,8 @@ self.assertRaises(Tkinter.TclError, self.var.get) -tests_gui = (VariableTest, StringVarTest, IntVarTest, +tests_nogui = (VariableTest, StringVarTest, IntVarTest, DoubleVarTest, BooleanVarTest) if __name__ == "__main__": - run_unittest(*tests_gui) + run_unittest(*tests_nogui) From python-checkins at python.org Mon Jun 1 04:40:54 2009 From: python-checkins at python.org (benjamin.peterson) Date: Mon, 1 Jun 2009 04:40:54 +0200 (CEST) Subject: [Python-checkins] r73096 - sandbox/trunk/2to3/lib2to3/tests/test_pytree.py Message-ID: <20090601024054.0241AD62E@mail.python.org> Author: benjamin.peterson Date: Mon Jun 1 04:40:53 2009 New Revision: 73096 Log: group tests Modified: sandbox/trunk/2to3/lib2to3/tests/test_pytree.py Modified: sandbox/trunk/2to3/lib2to3/tests/test_pytree.py ============================================================================== --- sandbox/trunk/2to3/lib2to3/tests/test_pytree.py (original) +++ sandbox/trunk/2to3/lib2to3/tests/test_pytree.py Mon Jun 1 04:40:53 2009 @@ -185,22 +185,18 @@ n1 = pytree.Node(1000, [l1, l2]) self.assertEqual(list(n1.pre_order()), [n1, l1, l2]) - def test_changed_leaf(self): + def test_changed(self): l1 = pytree.Leaf(100, "f") self.failIf(l1.was_changed) - l1.changed() self.failUnless(l1.was_changed) - def test_changed_node(self): l1 = pytree.Leaf(100, "f") n1 = pytree.Node(1000, [l1]) self.failIf(n1.was_changed) - n1.changed() self.failUnless(n1.was_changed) - def test_changed_recursive(self): l1 = pytree.Leaf(100, "foo") l2 = pytree.Leaf(100, "+") l3 = pytree.Leaf(100, "bar") From python-checkins at python.org Mon Jun 1 04:59:40 2009 From: python-checkins at python.org (guilherme.polo) Date: Mon, 1 Jun 2009 04:59:40 +0200 (CEST) Subject: [Python-checkins] r73097 - python/branches/tk_and_idle_maintenance/Lib/lib-tk/test/test_tkinter/test_text.py Message-ID: <20090601025940.031B9D70B@mail.python.org> Author: guilherme.polo Date: Mon Jun 1 04:59:39 2009 New Revision: 73097 Log: Checking for invalid index. Modified: python/branches/tk_and_idle_maintenance/Lib/lib-tk/test/test_tkinter/test_text.py Modified: python/branches/tk_and_idle_maintenance/Lib/lib-tk/test/test_tkinter/test_text.py ============================================================================== --- python/branches/tk_and_idle_maintenance/Lib/lib-tk/test/test_tkinter/test_text.py (original) +++ python/branches/tk_and_idle_maintenance/Lib/lib-tk/test/test_tkinter/test_text.py Mon Jun 1 04:59:39 2009 @@ -28,6 +28,9 @@ self.assertEqual(len(bbox), 4) self.assertEqual(bbox, self.text.bbox('1.0 -1c +1c')) + # Invalid index. + self.assertRaises(Tkinter.TclError, self.text.bbox, '1,0') + # The following used to raise Tkinter.TclError since text.bbox allowed # passing multiple args. self.assertRaises(TypeError, self.text.bbox, '1.0', '-1c') From python-checkins at python.org Mon Jun 1 05:18:43 2009 From: python-checkins at python.org (guilherme.polo) Date: Mon, 1 Jun 2009 05:18:43 +0200 (CEST) Subject: [Python-checkins] r73098 - python/branches/tk_and_idle_maintenance/Lib/lib-tk/test/test_tkinter/test_spinbox.py Message-ID: <20090601031843.9E6E3E267@mail.python.org> Author: guilherme.polo Date: Mon Jun 1 05:18:43 2009 New Revision: 73098 Log: Some tests for Tkinter.Spinbox Added: python/branches/tk_and_idle_maintenance/Lib/lib-tk/test/test_tkinter/test_spinbox.py (contents, props changed) Added: python/branches/tk_and_idle_maintenance/Lib/lib-tk/test/test_tkinter/test_spinbox.py ============================================================================== --- (empty file) +++ python/branches/tk_and_idle_maintenance/Lib/lib-tk/test/test_tkinter/test_spinbox.py Mon Jun 1 05:18:43 2009 @@ -0,0 +1,87 @@ +import unittest +import Tkinter +from test.test_support import requires, run_unittest +from ttk import setup_master + +requires('gui') + +class SpinboxTest(unittest.TestCase): + + def setUp(self): + self.root = setup_master() + self.sb = Tkinter.Spinbox(self.root) + + def tearDown(self): + self.sb.destroy() + + + def test_bbox(self): + res = self.sb.bbox('end') + self.assertTrue(isinstance(res, tuple)) + self.assertEqual(len(res), 4) + + self.assertRaises(Tkinter.TclError, self.sb.bbox, '2.0') + + def test_get_delete(self): + self.sb.insert('0', 'hi there') + self.sb.delete('0') + self.assertEqual(self.sb.get(), 'i there') + self.sb.delete(0, 1) + self.assertEqual(self.sb.get(), ' there') + self.sb.delete(0, 'end') + self.assertEqual(self.sb.get(), '') + + def test_icursor(self): + self.sb.insert(0, 'avocado') + self.sb.icursor(3) + self.sb.delete('insert', 'end') + self.assertEqual(self.sb.get(), 'avo') + + def test_identify(self): + self.sb.pack() + self.sb.update_idletasks() + + # XXX Based on Tk's code it doesn't seem like the identify command + # in Tcl can return the string 'none'. I also can't make it return + # this value, so it's more like a documentation bug in tk or even a + # tk bug that should be tested on tk side. + self.assertEqual(self.sb.identify(0, 0), 'entry') + + buttons = ['buttonup', 'buttondown'] + for i in xrange(self.sb.winfo_width(), 0, -1): + name = self.sb.identify(i, 1) + if name in buttons: + buttons.remove(name) + break + for j in xrange(self.sb.winfo_height(), 0, -1): + name = self.sb.identify(i, j) + if name in buttons: + buttons.remove(name) + break + self.assertFalse(buttons) + + def test_index(self): + self.assertEqual(self.sb.index('end'), 0) + self.sb.insert(0, 'airplane') + self.assertEqual(self.sb.index('end'), 8) + + def test_invoke(self): + self.sb.configure(from_=1.0, to=10.0, increment=0.5) + + val = self.sb.get() + self.sb.invoke('buttondown') + self.assertEqual(self.sb.get(), val) + self.sb.invoke('buttonup') + self.assertEqual(self.sb.get(), str(float(val) + 0.5)) + + def test_scan(self): pass + def test_selection(self): pass + + # XXX Tkinter.Spinbox is missing set, validate, xview and some + # selection methods. + + +tests_gui = (SpinboxTest, ) + +if __name__ == "__main__": + run_unittest(*tests_gui) From python-checkins at python.org Mon Jun 1 06:06:10 2009 From: python-checkins at python.org (brett.cannon) Date: Mon, 1 Jun 2009 06:06:10 +0200 (CEST) Subject: [Python-checkins] r73099 - peps/trunk/pep-0374.txt Message-ID: <20090601040610.736EAEF60@mail.python.org> Author: brett.cannon Date: Mon Jun 1 06:06:10 2009 New Revision: 73099 Log: Fill in explanation of why hg was chosen. Modified: peps/trunk/pep-0374.txt Modified: peps/trunk/pep-0374.txt ============================================================================== --- peps/trunk/pep-0374.txt (original) +++ peps/trunk/pep-0374.txt Mon Jun 1 06:06:10 2009 @@ -1473,5 +1473,82 @@ color-codes the information. -XXX ... usage on top of svn, filling in `Coordinated Development of a -New Feature`_ scenario +Decision +========= + +At PyCon 2009 the decision was made to go with Mercurial. + + +Why Mercurial over Subversion +----------------------------- + +While svn has served the development team well, it needs to be +admitted that svn does not serve the needs of non-committers as well +as a DVCS does. Because svn only provides its features such as version +control, branching, etc. to people with commit privileges on the +repository it can be a hinderance for people who lack commit +privileges. But DVCSs have no such limitiation as anyone can create a +local branch of Python and perform their own local commits without the +burden that comes with cloning the entire svn repository. Allowing +anyone to have the same workflow as the core developers was the key +reason to switch from svn to hg. + +Orthogonal to the benefits of allowing anyone to easily commit locally +to their own branches is offline, fast operations. Because hg stores +all data locally there is no need to send requests to a server +remotely and instead work off of the local disk. This improves +response times tremendously. It also allows for offline usage for when +one lacks an Internet connection. But this benefit is minor and +considered simply a side-effect benefit instead of a driving factor +for switching off of Subversion. + + +Why Mercurial over other DVCSs +------------------------------ + +Git was not chosen for three key reasons (see the `PyCon 2009 +lightning talk `_ where Brett +Cannon lists these exact reasons; talk started at 3:45). First, git's +Windows support is the weakest out of the three DVCSs being considered +which unacceptable as Python needs to support development on any +platform it runs on. Since Python runs on Windows and some people do +develop on the platform it needs solid support. And while git's +support is improving, as of this moment it is the weakest by a large +enough margin to warrant it a problem. + +Two, and just as important as the first issue, is that the Python +core developers liked git the least out of the three DVCS options by a +wide margin. If you look at the following table you will see the +results of a survey taken of the core developers and how by a large +margin git is the least favorite version control system. + +==== == ===== == ========== +DVCS ++ equal -- Uninformed +---- -- ----- -- ---------- +git 5 1 8 13 +bzr 10 3 2 12 +hg 15 1 1 10 +==== == ===== == ========== + +Lastly, all things being equal (which they are not +as shown by the previous two issues), it is preferable to +use and support a tool written in Python and not one written in C and +shell. We are pragmatic enough to not choose a tool simply because it +is written in Python, but we do see the usefulness in promoting tools +that do use it when it is reasonable to do so as it is in this case. + +As for why Mercurial was chosen over Bazaar, it came down to +popularity. As the core developer survey shows, hg was preferred over +bzr. But the community also appears to prefer hg as was shown at PyCon +after git's removal from consideration was announced. Many people came +up to Brett and said in various ways that they wanted hg to be chosen. +While no one said they did not want bzr chosen, no one said they did +either. + +Based on all of this information, Guido and Brett decided Mercurial +was to be the next version control system for Python. + + +Transition Plan +=============== +PEP 385 outlines the transition from svn to hg. From python-checkins at python.org Mon Jun 1 06:08:22 2009 From: python-checkins at python.org (brett.cannon) Date: Mon, 1 Jun 2009 06:08:22 +0200 (CEST) Subject: [Python-checkins] r73100 - peps/trunk/pep-0374.txt Message-ID: <20090601040822.BD6EDEFCC@mail.python.org> Author: brett.cannon Date: Mon Jun 1 06:08:22 2009 New Revision: 73100 Log: Remove the unfinished scenario. Modified: peps/trunk/pep-0374.txt Modified: peps/trunk/pep-0374.txt ============================================================================== --- peps/trunk/pep-0374.txt (original) +++ peps/trunk/pep-0374.txt Mon Jun 1 06:08:22 2009 @@ -935,25 +935,8 @@ svn commit -F svnmerge-commit-message.txt -bzr -''' -:: - - XXX To be done by Brett as a test of knowledge and online documentation/community. - - -hg -'' -:: - - XXX To be done by Brett as a test of knowledge and online documentation/community. - - -git -''' -:: - - XXX To be done by Brett as a test of knowledge and online documentation/community. +This scenario is incomplete as the decision for what DVCS to go with +was made before the work was complete. Separation of Issue Dependencies From python-checkins at python.org Mon Jun 1 06:10:03 2009 From: python-checkins at python.org (martin.v.loewis) Date: Mon, 1 Jun 2009 06:10:03 +0200 (CEST) Subject: [Python-checkins] r73101 - python/trunk/Tools/msi/msi.py Message-ID: <20090601041003.29EB3EFDA@mail.python.org> Author: martin.v.loewis Date: Mon Jun 1 06:10:03 2009 New Revision: 73101 Log: Issue #6158: package Sine-1000Hz-300ms.aif. Modified: python/trunk/Tools/msi/msi.py Modified: python/trunk/Tools/msi/msi.py ============================================================================== --- python/trunk/Tools/msi/msi.py (original) +++ python/trunk/Tools/msi/msi.py Mon Jun 1 06:10:03 2009 @@ -1008,6 +1008,7 @@ lib.add_file("test_difflib_expect.html") lib.add_file("check_soundcard.vbs") lib.add_file("empty.vbs") + lib.add_file("Sine-1000Hz-300ms.aif") lib.glob("*.uue") lib.glob("*.pem") lib.glob("*.pck") From python-checkins at python.org Mon Jun 1 06:12:01 2009 From: python-checkins at python.org (martin.v.loewis) Date: Mon, 1 Jun 2009 06:12:01 +0200 (CEST) Subject: [Python-checkins] r73102 - in python/branches/py3k: Tools/msi/msi.py Message-ID: <20090601041201.60EDEF018@mail.python.org> Author: martin.v.loewis Date: Mon Jun 1 06:12:01 2009 New Revision: 73102 Log: Merged revisions 73101 via svnmerge from svn+ssh://pythondev at svn.python.org/python/trunk ........ r73101 | martin.v.loewis | 2009-06-01 06:10:03 +0200 (Mo, 01 Jun 2009) | 2 lines Issue #6158: package Sine-1000Hz-300ms.aif. ........ Modified: python/branches/py3k/ (props changed) python/branches/py3k/Tools/msi/msi.py Modified: python/branches/py3k/Tools/msi/msi.py ============================================================================== --- python/branches/py3k/Tools/msi/msi.py (original) +++ python/branches/py3k/Tools/msi/msi.py Mon Jun 1 06:12:01 2009 @@ -1009,6 +1009,7 @@ lib.add_file("test_difflib_expect.html") lib.add_file("check_soundcard.vbs") lib.add_file("empty.vbs") + lib.add_file("Sine-1000Hz-300ms.aif") lib.glob("*.uue") lib.glob("*.pem") lib.glob("*.pck") From python-checkins at python.org Mon Jun 1 06:13:14 2009 From: python-checkins at python.org (martin.v.loewis) Date: Mon, 1 Jun 2009 06:13:14 +0200 (CEST) Subject: [Python-checkins] r73103 - python/branches/py3k/Misc/NEWS Message-ID: <20090601041314.49094F023@mail.python.org> Author: martin.v.loewis Date: Mon Jun 1 06:13:14 2009 New Revision: 73103 Log: NEWS entry for 73102. Modified: python/branches/py3k/Misc/NEWS Modified: python/branches/py3k/Misc/NEWS ============================================================================== --- python/branches/py3k/Misc/NEWS (original) +++ python/branches/py3k/Misc/NEWS Mon Jun 1 06:13:14 2009 @@ -21,6 +21,11 @@ - Issue #6149: Fix initialization of WeakValueDictionary objects from non-empty parameters. +Windows +------- + +- Issue #6158: Package Sine-1000Hz-300ms.aif in MSI file. + What's New in Python 3.1 release candidate 1? ============================================= From python-checkins at python.org Mon Jun 1 06:17:21 2009 From: python-checkins at python.org (martin.v.loewis) Date: Mon, 1 Jun 2009 06:17:21 +0200 (CEST) Subject: [Python-checkins] r73104 - in python/branches/release26-maint: Tools/msi/msi.py Message-ID: <20090601041721.DB566EFD5@mail.python.org> Author: martin.v.loewis Date: Mon Jun 1 06:17:21 2009 New Revision: 73104 Log: Merged revisions 73101 via svnmerge from svn+ssh://pythondev at svn.python.org/python/trunk ........ r73101 | martin.v.loewis | 2009-06-01 06:10:03 +0200 (Mo, 01 Jun 2009) | 2 lines Issue #6158: package Sine-1000Hz-300ms.aif. ........ Modified: python/branches/release26-maint/ (props changed) python/branches/release26-maint/Tools/msi/msi.py Modified: python/branches/release26-maint/Tools/msi/msi.py ============================================================================== --- python/branches/release26-maint/Tools/msi/msi.py (original) +++ python/branches/release26-maint/Tools/msi/msi.py Mon Jun 1 06:17:21 2009 @@ -1007,6 +1007,7 @@ lib.add_file("test_difflib_expect.html") lib.add_file("check_soundcard.vbs") lib.add_file("empty.vbs") + lib.add_file("Sine-1000Hz-300ms.aif") lib.glob("*.uue") lib.glob("*.pem") lib.glob("*.pck") From python-checkins at python.org Mon Jun 1 06:19:54 2009 From: python-checkins at python.org (martin.v.loewis) Date: Mon, 1 Jun 2009 06:19:54 +0200 (CEST) Subject: [Python-checkins] r73105 - in python/branches/release30-maint: Tools/msi/msi.py Message-ID: <20090601041954.EC557F04B@mail.python.org> Author: martin.v.loewis Date: Mon Jun 1 06:19:54 2009 New Revision: 73105 Log: Merged revisions 73102 via svnmerge from svn+ssh://pythondev at svn.python.org/python/branches/py3k ................ r73102 | martin.v.loewis | 2009-06-01 06:12:01 +0200 (Mo, 01 Jun 2009) | 9 lines Merged revisions 73101 via svnmerge from svn+ssh://pythondev at svn.python.org/python/trunk ........ r73101 | martin.v.loewis | 2009-06-01 06:10:03 +0200 (Mo, 01 Jun 2009) | 2 lines Issue #6158: package Sine-1000Hz-300ms.aif. ........ ................ Modified: python/branches/release30-maint/ (props changed) python/branches/release30-maint/Tools/msi/msi.py Modified: python/branches/release30-maint/Tools/msi/msi.py ============================================================================== --- python/branches/release30-maint/Tools/msi/msi.py (original) +++ python/branches/release30-maint/Tools/msi/msi.py Mon Jun 1 06:19:54 2009 @@ -1009,6 +1009,7 @@ lib.add_file("test_difflib_expect.html") lib.add_file("check_soundcard.vbs") lib.add_file("empty.vbs") + lib.add_file("Sine-1000Hz-300ms.aif") lib.glob("*.uue") lib.glob("*.pem") lib.glob("*.pck") From python-checkins at python.org Mon Jun 1 06:23:08 2009 From: python-checkins at python.org (martin.v.loewis) Date: Mon, 1 Jun 2009 06:23:08 +0200 (CEST) Subject: [Python-checkins] r73106 - in python/branches/py3k: Lib/test/test_unicode.py Misc/NEWS Message-ID: <20090601042308.216E1EA88@mail.python.org> Author: martin.v.loewis Date: Mon Jun 1 06:23:07 2009 New Revision: 73106 Log: Issue #6150: Fix test_unicode on wide-unicode builds. Modified: python/branches/py3k/Lib/test/test_unicode.py python/branches/py3k/Misc/NEWS Modified: python/branches/py3k/Lib/test/test_unicode.py ============================================================================== --- python/branches/py3k/Lib/test/test_unicode.py (original) +++ python/branches/py3k/Lib/test/test_unicode.py Mon Jun 1 06:23:07 2009 @@ -908,14 +908,15 @@ def test_codecs_utf8(self): self.assertEqual(''.encode('utf-8'), b'') self.assertEqual('\u20ac'.encode('utf-8'), b'\xe2\x82\xac') - self.assertEqual('\ud800\udc02'.encode('utf-8'), b'\xf0\x90\x80\x82') - self.assertEqual('\ud84d\udc56'.encode('utf-8'), b'\xf0\xa3\x91\x96') + if sys.maxunicode == 65535: + self.assertEqual('\ud800\udc02'.encode('utf-8'), b'\xf0\x90\x80\x82') + self.assertEqual('\ud84d\udc56'.encode('utf-8'), b'\xf0\xa3\x91\x96') self.assertEqual('\ud800'.encode('utf-8', 'surrogatepass'), b'\xed\xa0\x80') self.assertEqual('\udc00'.encode('utf-8', 'surrogatepass'), b'\xed\xb0\x80') - self.assertEqual( - ('\ud800\udc02'*1000).encode('utf-8', 'surrogatepass'), - b'\xf0\x90\x80\x82'*1000 - ) + if sys.maxunicode == 65535: + self.assertEqual( + ('\ud800\udc02'*1000).encode('utf-8'), + b'\xf0\x90\x80\x82'*1000) self.assertEqual( '\u6b63\u78ba\u306b\u8a00\u3046\u3068\u7ffb\u8a33\u306f' '\u3055\u308c\u3066\u3044\u307e\u305b\u3093\u3002\u4e00' Modified: python/branches/py3k/Misc/NEWS ============================================================================== --- python/branches/py3k/Misc/NEWS (original) +++ python/branches/py3k/Misc/NEWS Mon Jun 1 06:23:07 2009 @@ -18,6 +18,8 @@ Library ------- +- Issue #6150: Fix test_unicode on wide-unicode builds. + - Issue #6149: Fix initialization of WeakValueDictionary objects from non-empty parameters. From buildbot at python.org Mon Jun 1 07:55:20 2009 From: buildbot at python.org (buildbot at python.org) Date: Mon, 01 Jun 2009 05:55:20 +0000 Subject: [Python-checkins] buildbot failure in sparc solaris10 gcc 3.x Message-ID: <20090601055520.76D33EADE@mail.python.org> The Buildbot has detected a new failure of sparc solaris10 gcc 3.x. Full details are available at: http://www.python.org/dev/buildbot/all/sparc%20solaris10%20gcc%203.x/builds/790 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: loewis-sun Build Reason: Build Source Stamp: [branch branches/py3k] HEAD Blamelist: andrew.kuchling,martin.v.loewis BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_posix ====================================================================== ERROR: test_getcwd_long_pathnames (test.test_posix.PosixTester) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home2/buildbot/slave/3.x.loewis-sun/build/Lib/test/test_posix.py", line 251, in test_getcwd_long_pathnames support.rmtree(base_path) File "/home2/buildbot/slave/3.x.loewis-sun/build/Lib/test/support.py", line 178, in rmtree shutil.rmtree(path) File "/home2/buildbot/slave/3.x.loewis-sun/build/Lib/shutil.py", line 238, in rmtree onerror(os.rmdir, path, sys.exc_info()) File "/home2/buildbot/slave/3.x.loewis-sun/build/Lib/shutil.py", line 236, in rmtree os.rmdir(path) OSError: [Errno 22] Invalid argument: '/home2/buildbot/slave/3.x.loewis-sun/build/@test.getcwd/@test.getcwd' sincerely, -The Buildbot From buildbot at python.org Mon Jun 1 09:52:13 2009 From: buildbot at python.org (buildbot at python.org) Date: Mon, 01 Jun 2009 07:52:13 +0000 Subject: [Python-checkins] buildbot failure in ia64 Ubuntu 3.x Message-ID: <20090601075213.1E38EE93D@mail.python.org> The Buildbot has detected a new failure of ia64 Ubuntu 3.x. Full details are available at: http://www.python.org/dev/buildbot/all/ia64%20Ubuntu%203.x/builds/849 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: klose-debian-ia64 Build Reason: Build Source Stamp: [branch branches/py3k] HEAD Blamelist: martin.v.loewis BUILD FAILED: failed test Excerpt from the test logfile: Traceback (most recent call last): File "/home/pybot/buildarea/3.x.klose-debian-ia64/build/Lib/multiprocessing/process.py", line 232, in _bootstrap self.run() File "/home/pybot/buildarea/3.x.klose-debian-ia64/build/Lib/multiprocessing/process.py", line 88, in run self._target(*self._args, **self._kwargs) File "/home/pybot/buildarea/3.x.klose-debian-ia64/build/Lib/test/test_multiprocessing.py", line 1203, in _putter manager.connect() File "/home/pybot/buildarea/3.x.klose-debian-ia64/build/Lib/multiprocessing/managers.py", line 477, in connect conn = Client(self._address, authkey=self._authkey) File "/home/pybot/buildarea/3.x.klose-debian-ia64/build/Lib/multiprocessing/connection.py", line 416, in XmlClient import xmlrpc.client as xmlrpclib File "/home/pybot/buildarea/3.x.klose-debian-ia64/build/Lib/importlib/_bootstrap.py", line 151, in decorated return fxn(self, module) File "/home/pybot/buildarea/3.x.klose-debian-ia64/build/Lib/importlib/_bootstrap.py", line 399, in load_module return self._load_module(module) File "/home/pybot/buildarea/3.x.klose-debian-ia64/build/Lib/importlib/_bootstrap.py", line 324, in _load_module code_object = self.get_code(module.__name__) File "/home/pybot/buildarea/3.x.klose-debian-ia64/build/Lib/importlib/_bootstrap.py", line 411, in get_code pyc_timestamp = marshal._r_long(data[4:8]) File "/home/pybot/buildarea/3.x.klose-debian-ia64/build/Lib/importlib/__init__.py", line 65, in _r_long x = int_bytes[0] IndexError: index out of range 1 test failed: test_multiprocessing make: *** [buildbottest] Error 1 sincerely, -The Buildbot From rdmurray at bitdance.com Mon Jun 1 11:52:39 2009 From: rdmurray at bitdance.com (R. David Murray) Date: Mon, 1 Jun 2009 05:52:39 -0400 (EDT) Subject: [Python-checkins] r73099 - peps/trunk/pep-0374.txt In-Reply-To: <20090601040610.736EAEF60@mail.python.org> References: <20090601040610.736EAEF60@mail.python.org> Message-ID: Proofreading nits: On Mon, 1 Jun 2009 at 06:06, brett.cannon wrote: > +Why Mercurial over other DVCSs > +------------------------------ > + > +Git was not chosen for three key reasons (see the `PyCon 2009 > +lightning talk `_ where Brett > +Cannon lists these exact reasons; talk started at 3:45). First, git's > +Windows support is the weakest out of the three DVCSs being considered > +which unacceptable as Python needs to support development on any missing 'is' > +platform it runs on. Since Python runs on Windows and some people do > +develop on the platform it needs solid support. And while git's > +support is improving, as of this moment it is the weakest by a large > +enough margin to warrant it a problem. While what you wrote is probably technically correct, it would fall better on my American English ear if 'warrant' was followed by 'considering'. > +Two, and just as important as the first issue, is that the Python IMO it would read better if 'Two' was 'Second', since you start with 'First' and end with 'Lastly'. > +core developers liked git the least out of the three DVCS options by a > +wide margin. If you look at the following table you will see the > +results of a survey taken of the core developers and how by a large > +margin git is the least favorite version control system. --David From python-checkins at python.org Mon Jun 1 19:23:51 2009 From: python-checkins at python.org (georg.brandl) Date: Mon, 1 Jun 2009 19:23:51 +0200 (CEST) Subject: [Python-checkins] r73107 - python/branches/py3k/Lib/inspect.py Message-ID: <20090601172351.968BDC515@mail.python.org> Author: georg.brandl Date: Mon Jun 1 19:23:51 2009 New Revision: 73107 Log: Use true boolean for flag argument. Modified: python/branches/py3k/Lib/inspect.py Modified: python/branches/py3k/Lib/inspect.py ============================================================================== --- python/branches/py3k/Lib/inspect.py (original) +++ python/branches/py3k/Lib/inspect.py Mon Jun 1 19:23:51 2009 @@ -704,7 +704,7 @@ results.append(walktree(children[c], children, c)) return results -def getclasstree(classes, unique=0): +def getclasstree(classes, unique=False): """Arrange the given list of classes into a hierarchy of nested lists. Where a nested list appears, it contains classes derived from the class From python-checkins at python.org Mon Jun 1 19:35:27 2009 From: python-checkins at python.org (georg.brandl) Date: Mon, 1 Jun 2009 19:35:27 +0200 (CEST) Subject: [Python-checkins] r73108 - in python/branches/py3k/Doc/library: imaplib.rst imghdr.rst imp.rst inspect.rst internet.rst intro.rst io.rst ipc.rst itertools.rst Message-ID: <20090601173527.E97B1DB0E@mail.python.org> Author: georg.brandl Date: Mon Jun 1 19:35:27 2009 New Revision: 73108 Log: Convert all "i" docs to new style optional args. Modified: python/branches/py3k/Doc/library/imaplib.rst python/branches/py3k/Doc/library/imghdr.rst python/branches/py3k/Doc/library/imp.rst python/branches/py3k/Doc/library/inspect.rst python/branches/py3k/Doc/library/internet.rst python/branches/py3k/Doc/library/intro.rst python/branches/py3k/Doc/library/io.rst python/branches/py3k/Doc/library/ipc.rst python/branches/py3k/Doc/library/itertools.rst Modified: python/branches/py3k/Doc/library/imaplib.rst ============================================================================== --- python/branches/py3k/Doc/library/imaplib.rst (original) +++ python/branches/py3k/Doc/library/imaplib.rst Mon Jun 1 19:35:27 2009 @@ -26,7 +26,7 @@ base class: -.. class:: IMAP4([host[, port]]) +.. class:: IMAP4(host='', port=IMAP4_PORT) This class implements the actual IMAP4 protocol. The connection is created and protocol version (IMAP4 or IMAP4rev1) is determined when the instance is @@ -59,7 +59,7 @@ There's also a subclass for secure connections: -.. class:: IMAP4_SSL([host[, port[, keyfile[, certfile]]]]) +.. class:: IMAP4_SSL(host='', port=IMAP4_SSL_PORT, keyfile=None, certfile=None) This is a subclass derived from :class:`IMAP4` that connects over an SSL encrypted socket (to use this class you need a socket module that was compiled @@ -264,7 +264,7 @@ Shutdown connection to server. Returns server ``BYE`` response. -.. method:: IMAP4.lsub([directory[, pattern]]) +.. method:: IMAP4.lsub(directory='""', pattern='*') List subscribed mailbox names in directory matching pattern. *directory* defaults to the top level directory and *pattern* defaults to match any mailbox. @@ -348,7 +348,7 @@ typ, msgnums = M.search(None, '(FROM "LDJ")') -.. method:: IMAP4.select([mailbox[, readonly]]) +.. method:: IMAP4.select(mailbox='INBOX', readonly=False) Select a mailbox. Returned data is the count of messages in *mailbox* (``EXISTS`` response). The default *mailbox* is ``'INBOX'``. If the *readonly* @@ -464,12 +464,12 @@ Unsubscribe from old mailbox. -.. method:: IMAP4.xatom(name[, arg[, ...]]) +.. method:: IMAP4.xatom(name[, ...]) Allow simple extension commands notified by server in ``CAPABILITY`` response. -The following attributes are defined on instances of :class:`IMAP4`: +The following attributes are defined on instances of :class:`IMAP4`: .. attribute:: IMAP4.PROTOCOL_VERSION Modified: python/branches/py3k/Doc/library/imghdr.rst ============================================================================== --- python/branches/py3k/Doc/library/imghdr.rst (original) +++ python/branches/py3k/Doc/library/imghdr.rst Mon Jun 1 19:35:27 2009 @@ -1,4 +1,3 @@ - :mod:`imghdr` --- Determine the type of an image ================================================ @@ -12,7 +11,7 @@ The :mod:`imghdr` module defines the following function: -.. function:: what(filename[, h]) +.. function:: what(filename, h=None) Tests the image data contained in the file named by *filename*, and returns a string describing the image type. If optional *h* is provided, the *filename* Modified: python/branches/py3k/Doc/library/imp.rst ============================================================================== --- python/branches/py3k/Doc/library/imp.rst (original) +++ python/branches/py3k/Doc/library/imp.rst Mon Jun 1 19:35:27 2009 @@ -1,4 +1,3 @@ - :mod:`imp` --- Access the :keyword:`import` internals ===================================================== Modified: python/branches/py3k/Doc/library/inspect.rst ============================================================================== --- python/branches/py3k/Doc/library/inspect.rst (original) +++ python/branches/py3k/Doc/library/inspect.rst Mon Jun 1 19:35:27 2009 @@ -1,4 +1,3 @@ - :mod:`inspect` --- Inspect live objects ======================================= @@ -215,7 +214,8 @@ .. function:: isfunction(object) - Return true if the object is a Python function or unnamed (:term:`lambda`) function. + Return true if the object is a Python function or unnamed (:term:`lambda`) + function. .. function:: isgeneratorfunction(object) @@ -370,8 +370,7 @@ Classes and functions --------------------- - -.. function:: getclasstree(classes[, unique]) +.. function:: getclasstree(classes, unique=False) Arrange the given list of classes into a hierarchy of nested lists. Where a nested list appears, it contains classes derived from the class whose entry @@ -399,10 +398,11 @@ .. function:: getfullargspec(func) - Get the names and default values of a function's arguments. A :term:`named tuple` - is returned: + Get the names and default values of a function's arguments. A :term:`named + tuple` is returned: - ``FullArgSpec(args, varargs, varkw, defaults, kwonlyargs, kwonlydefaults, annotations)`` + ``FullArgSpec(args, varargs, varkw, defaults, kwonlyargs, kwonlydefaults, + annotations)`` *args* is a list of the argument names. *varargs* and *varkw* are the names of the ``*`` and ``**`` arguments or ``None``. *defaults* is an n-tuple of @@ -416,11 +416,11 @@ .. function:: getargvalues(frame) - Get information about arguments passed into a particular frame. A :term:`named tuple` - ``ArgInfo(args, varargs, keywords, locals)`` is returned. *args* is a list of the - argument names (it may contain nested lists). *varargs* and *varkw* are the - names of the ``*`` and ``**`` arguments or ``None``. *locals* is the locals - dictionary of the given frame. + Get information about arguments passed into a particular frame. A + :term:`named tuple` ``ArgInfo(args, varargs, keywords, locals)`` is + returned. *args* is a list of the argument names (it may contain nested + lists). *varargs* and *varkw* are the names of the ``*`` and ``**`` arguments + or ``None``. *locals* is the locals dictionary of the given frame. .. function:: formatargspec(args[, varargs, varkw, defaults, formatarg, formatvarargs, formatvarkw, formatvalue, join]) @@ -482,13 +482,13 @@ line. -.. function:: getframeinfo(frame[, context]) +.. function:: getframeinfo(frame, context=1) Get information about a frame or traceback object. A :term:`named tuple` ``Traceback(filename, lineno, function, code_context, index)`` is returned. -.. function:: getouterframes(frame[, context]) +.. function:: getouterframes(frame, context=1) Get a list of frame records for a frame and all outer frames. These frames represent the calls that lead to the creation of *frame*. The first entry in the @@ -496,7 +496,7 @@ on *frame*'s stack. -.. function:: getinnerframes(traceback[, context]) +.. function:: getinnerframes(traceback, context=1) Get a list of frame records for a traceback's frame and all inner frames. These frames represent calls made as a consequence of *frame*. The first entry in the @@ -509,14 +509,14 @@ Return the frame object for the caller's stack frame. -.. function:: stack([context]) +.. function:: stack(context=1) Return a list of frame records for the caller's stack. The first entry in the returned list represents the caller; the last entry represents the outermost call on the stack. -.. function:: trace([context]) +.. function:: trace(context=1) Return a list of frame records for the stack between the current frame and the frame in which an exception currently being handled was raised in. The first Modified: python/branches/py3k/Doc/library/internet.rst ============================================================================== --- python/branches/py3k/Doc/library/internet.rst (original) +++ python/branches/py3k/Doc/library/internet.rst Mon Jun 1 19:35:27 2009 @@ -1,4 +1,3 @@ - .. _internet: ****************************** Modified: python/branches/py3k/Doc/library/intro.rst ============================================================================== --- python/branches/py3k/Doc/library/intro.rst (original) +++ python/branches/py3k/Doc/library/intro.rst Mon Jun 1 19:35:27 2009 @@ -1,4 +1,3 @@ - .. _library-intro: ************ Modified: python/branches/py3k/Doc/library/io.rst ============================================================================== --- python/branches/py3k/Doc/library/io.rst (original) +++ python/branches/py3k/Doc/library/io.rst Mon Jun 1 19:35:27 2009 @@ -51,7 +51,7 @@ classes. :func:`open` uses the file's blksize (as obtained by :func:`os.stat`) if possible. -.. function:: open(file[, mode[, buffering[, encoding[, errors[, newline[, closefd=True]]]]]]) +.. function:: open(file, mode='r', buffering=None, encoding=None, errors=None, newline=None, closefd=True) Open *file* and return a corresponding stream. If the file cannot be opened, an :exc:`IOError` is raised. @@ -250,7 +250,7 @@ Return ``True`` if the stream can be read from. If False, :meth:`read` will raise :exc:`IOError`. - .. method:: readline([limit]) + .. method:: readline(limit=-1) Read and return one line from the stream. If *limit* is specified, at most *limit* bytes will be read. @@ -259,13 +259,13 @@ the *newlines* argument to :func:`open` can be used to select the line terminator(s) recognized. - .. method:: readlines([hint]) + .. method:: readlines(hint=-1) Read and return a list of lines from the stream. *hint* can be specified to control the number of lines read: no more lines will be read if the total size (in bytes/characters) of all lines so far exceeds *hint*. - .. method:: seek(offset[, whence]) + .. method:: seek(offset, whence=SEEK_SET) Change the stream position to the given byte *offset*. *offset* is interpreted relative to the position indicated by *whence*. Values for @@ -292,7 +292,7 @@ Return the current stream position. - .. method:: truncate([size]) + .. method:: truncate(size=None) Truncate the file to at most *size* bytes. *size* defaults to the current file position, as returned by :meth:`tell`. @@ -317,7 +317,7 @@ In addition to the attributes and methods from :class:`IOBase`, RawIOBase provides the following methods: - .. method:: read([n]) + .. method:: read(n=-1) Read and return all the bytes from the stream until EOF, or if *n* is specified, up to *n* bytes. Only one system call is ever made. An empty @@ -375,7 +375,7 @@ .. versionadded:: 3.1 - .. method:: read([n]) + .. method:: read(n=-1) Read and return up to *n* bytes. If the argument is omitted, ``None``, or negative, data is read and returned until EOF is reached. An empty bytes @@ -390,7 +390,7 @@ A :exc:`BlockingIOError` is raised if the underlying raw stream has no data at the moment. - .. method:: read1([n]) + .. method:: read1(n=-1) Read and return up to *n* bytes, with at most one call to the underlying raw stream's :meth:`~RawIOBase.read` method. @@ -419,7 +419,7 @@ Raw File I/O ------------ -.. class:: FileIO(name[, mode]) +.. class:: FileIO(name, mode='r', closefd=True) :class:`FileIO` represents a file containing bytes data. It implements the :class:`RawIOBase` interface (and therefore the :class:`IOBase` @@ -443,7 +443,7 @@ The file name. This is the file descriptor of the file when no name is given in the constructor. - .. method:: read([n]) + .. method:: read(n=-1) Read and return at most *n* bytes. Only one system call is made, so it is possible that less data than was requested is returned. Use :func:`len` @@ -490,7 +490,7 @@ current stream position, as returned by :meth:`tell`. -.. class:: BufferedReader(raw[, buffer_size]) +.. class:: BufferedReader(raw, buffer_size=DEFAULT_BUFFER_SIZE) A buffer for a readable, sequential :class:`RawIOBase` object. It inherits :class:`BufferedIOBase`. @@ -522,7 +522,7 @@ Otherwise, one raw stream read call is made. -.. class:: BufferedWriter(raw[, buffer_size[, max_buffer_size]]) +.. class:: BufferedWriter(raw, buffer_size=DEFAULT_BUFFER_SIZE) A buffer for a writeable sequential RawIO object. It inherits :class:`BufferedIOBase`. @@ -531,7 +531,7 @@ *raw* stream. If the *buffer_size* is not given, it defaults to :data:`DEFAULT_BUFFER_SIZE`. - *max_buffer_size* is unused and deprecated. + A third argument, *max_buffer_size*, is supported, but unused and deprecated. :class:`BufferedWriter` provides or overrides these methods in addition to those from :class:`BufferedIOBase` and :class:`IOBase`: @@ -548,7 +548,7 @@ raw stream blocks. -.. class:: BufferedRWPair(reader, writer[, buffer_size[, max_buffer_size]]) +.. class:: BufferedRWPair(reader, writer, buffer_size, max_buffer_size=DEFAULT_BUFFER_SIZE) A combined buffered writer and reader object for a raw stream that can be written to and read from. It has and supports both :meth:`read`, :meth:`write`, @@ -559,14 +559,15 @@ writeable respectively. If the *buffer_size* is omitted it defaults to :data:`DEFAULT_BUFFER_SIZE`. - *max_buffer_size* is unused and deprecated. + A fourth argument, *max_buffer_size*, is supported, but unused and + deprecated. :class:`BufferedRWPair` implements all of :class:`BufferedIOBase`\'s methods except for :meth:`~BufferedIOBase.detach`, which raises :exc:`UnsupportedOperation`. -.. class:: BufferedRandom(raw[, buffer_size[, max_buffer_size]]) +.. class:: BufferedRandom(raw, buffer_size=DEFAULT_BUFFER_SIZE) A buffered interface to random access streams. It inherits :class:`BufferedReader` and :class:`BufferedWriter`. @@ -575,7 +576,7 @@ in the first argument. If the *buffer_size* is omitted it defaults to :data:`DEFAULT_BUFFER_SIZE`. - *max_buffer_size* is unused and deprecated. + A third argument, *max_buffer_size*, is supported, but unused and deprecated. :class:`BufferedRandom` is capable of anything :class:`BufferedReader` or :class:`BufferedWriter` can do. @@ -633,7 +634,7 @@ written. -.. class:: TextIOWrapper(buffer[, encoding[, errors[, newline[, line_buffering]]]]) +.. class:: TextIOWrapper(buffer, encoding=None, errors=None, newline=None, line_buffering=False) A buffered text stream over a :class:`BufferedIOBase` raw stream, *buffer*. It inherits :class:`TextIOBase`. @@ -676,7 +677,7 @@ Whether line buffering is enabled. -.. class:: StringIO([initial_value[, newline]]) +.. class:: StringIO(initial_value='', newline=None) An in-memory stream for text. It inherits :class:`TextIOWrapper`. Modified: python/branches/py3k/Doc/library/ipc.rst ============================================================================== --- python/branches/py3k/Doc/library/ipc.rst (original) +++ python/branches/py3k/Doc/library/ipc.rst Mon Jun 1 19:35:27 2009 @@ -1,4 +1,3 @@ - .. _ipc: ***************************************** Modified: python/branches/py3k/Doc/library/itertools.rst ============================================================================== --- python/branches/py3k/Doc/library/itertools.rst (original) +++ python/branches/py3k/Doc/library/itertools.rst Mon Jun 1 19:35:27 2009 @@ -1,4 +1,3 @@ - :mod:`itertools` --- Functions creating iterators for efficient looping ======================================================================= @@ -291,7 +290,7 @@ yield x -.. function:: groupby(iterable[, key]) +.. function:: groupby(iterable, key=None) Make an iterator that returns consecutive keys and groups from the *iterable*. The *key* is a function computing a key value for each element. If not @@ -372,7 +371,7 @@ then the step defaults to one. -.. function:: permutations(iterable[, r]) +.. function:: permutations(iterable, r=None) Return successive *r* length permutations of elements in the *iterable*. @@ -430,7 +429,7 @@ The number of items returned is ``n! / (n-r)!`` when ``0 <= r <= n`` or zero when ``r > n``. -.. function:: product(*iterables[, repeat]) +.. function:: product(*iterables, repeat=1) Cartesian product of input iterables. @@ -460,7 +459,7 @@ yield tuple(prod) -.. function:: repeat(object[, times]) +.. function:: repeat(object, times=-1) Make an iterator that returns *object* over and over again. Runs indefinitely unless the *times* argument is specified. Used as argument to :func:`map` for @@ -505,7 +504,7 @@ break -.. function:: tee(iterable[, n=2]) +.. function:: tee(iterable, n=2) Return *n* independent iterators from a single iterable. Equivalent to:: @@ -531,7 +530,7 @@ :func:`list` instead of :func:`tee`. -.. function:: zip_longest(*iterables[, fillvalue]) +.. function:: zip_longest(*iterables, fillvalue=None) Make an iterator that aggregates elements from each of the iterables. If the iterables are of uneven length, missing values are filled-in with *fillvalue*. From python-checkins at python.org Mon Jun 1 19:40:41 2009 From: python-checkins at python.org (gregory.p.smith) Date: Mon, 1 Jun 2009 19:40:41 +0200 (CEST) Subject: [Python-checkins] r73109 - python/trunk/Lib/ipaddr.py Message-ID: <20090601174041.471FDDB34@mail.python.org> Author: gregory.p.smith Date: Mon Jun 1 19:40:41 2009 New Revision: 73109 Log: Sync up __version__ number with the version of the ipaddr-py project this library came from that it matches. Remove the former apache license text now that its been contributed to PSF to avoid confusion. Modified: python/trunk/Lib/ipaddr.py Modified: python/trunk/Lib/ipaddr.py ============================================================================== --- python/trunk/Lib/ipaddr.py (original) +++ python/trunk/Lib/ipaddr.py Mon Jun 1 19:40:41 2009 @@ -1,18 +1,6 @@ # Copyright 2007 Google Inc. # Licensed to PSF under a Contributor Agreement. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or -# implied. See the License for the specific language governing -# permissions and limitations under the License. -# # See also: http://code.google.com/p/ipaddr-py/ """An IPv4/IPv6 manipulation library in Python. @@ -22,7 +10,7 @@ """ -__version__ = '1.0.2' +__version__ = '1.1.0' import struct From python-checkins at python.org Mon Jun 1 19:43:35 2009 From: python-checkins at python.org (gregory.p.smith) Date: Mon, 1 Jun 2009 19:43:35 +0200 (CEST) Subject: [Python-checkins] r73110 - in python/branches/py3k: Lib/ipaddr.py Message-ID: <20090601174335.A58A4DB5F@mail.python.org> Author: gregory.p.smith Date: Mon Jun 1 19:43:35 2009 New Revision: 73110 Log: Merged revisions 73109 via svnmerge from svn+ssh://pythondev at svn.python.org/python/trunk ........ r73109 | gregory.p.smith | 2009-06-01 10:40:41 -0700 (Mon, 01 Jun 2009) | 6 lines Sync up __version__ number with the version of the ipaddr-py project this library came from that it matches. ........ Modified: python/branches/py3k/ (props changed) python/branches/py3k/Lib/ipaddr.py Modified: python/branches/py3k/Lib/ipaddr.py ============================================================================== --- python/branches/py3k/Lib/ipaddr.py (original) +++ python/branches/py3k/Lib/ipaddr.py Mon Jun 1 19:43:35 2009 @@ -1,5 +1,6 @@ # Copyright 2007 Google Inc. # Licensed to PSF under a Contributor Agreement. +# # See also: http://code.google.com/p/ipaddr-py/ """An IPv4/IPv6 manipulation library in Python. @@ -9,7 +10,7 @@ """ -__version__ = '1.0.2' +__version__ = '1.1.0' import struct From python-checkins at python.org Mon Jun 1 21:16:52 2009 From: python-checkins at python.org (raymond.hettinger) Date: Mon, 1 Jun 2009 21:16:52 +0200 (CEST) Subject: [Python-checkins] r73111 - python/branches/py3k/Doc/library/itertools.rst Message-ID: <20090601191652.32D32DCC7@mail.python.org> Author: raymond.hettinger Date: Mon Jun 1 21:16:52 2009 New Revision: 73111 Log: Fix-up doc for itertools.repeat(). A -1 translates to zero repetitions, not infinite repetitions. This matches the behavior of ['x']*n. Modified: python/branches/py3k/Doc/library/itertools.rst Modified: python/branches/py3k/Doc/library/itertools.rst ============================================================================== --- python/branches/py3k/Doc/library/itertools.rst (original) +++ python/branches/py3k/Doc/library/itertools.rst Mon Jun 1 21:16:52 2009 @@ -459,7 +459,7 @@ yield tuple(prod) -.. function:: repeat(object, times=-1) +.. function:: repeat(object[, times]) Make an iterator that returns *object* over and over again. Runs indefinitely unless the *times* argument is specified. Used as argument to :func:`map` for From brett at python.org Mon Jun 1 22:00:01 2009 From: brett at python.org (Brett Cannon) Date: Mon, 1 Jun 2009 13:00:01 -0700 Subject: [Python-checkins] r73099 - peps/trunk/pep-0374.txt In-Reply-To: References: <20090601040610.736EAEF60@mail.python.org> Message-ID: Thanks, all fixed! On Mon, Jun 1, 2009 at 02:52, R. David Murray wrote: > Proofreading nits: > > On Mon, 1 Jun 2009 at 06:06, brett.cannon wrote: > >> +Why Mercurial over other DVCSs >> +------------------------------ >> + >> +Git was not chosen for three key reasons (see the `PyCon 2009 >> +lightning talk `_ where Brett >> +Cannon lists these exact reasons; talk started at 3:45). First, git's >> +Windows support is the weakest out of the three DVCSs being considered >> +which unacceptable as Python needs to support development on any >> > > missing 'is' > > +platform it runs on. Since Python runs on Windows and some people do >> +develop on the platform it needs solid support. And while git's >> +support is improving, as of this moment it is the weakest by a large >> +enough margin to warrant it a problem. >> > > While what you wrote is probably technically correct, it would fall better > on my American English ear if 'warrant' was followed by 'considering'. > > +Two, and just as important as the first issue, is that the Python >> > > IMO it would read better if 'Two' was 'Second', since you start with > 'First' and end with 'Lastly'. > > +core developers liked git the least out of the three DVCS options by a >> +wide margin. If you look at the following table you will see the >> +results of a survey taken of the core developers and how by a large >> +margin git is the least favorite version control system. >> > > --David > -------------- next part -------------- An HTML attachment was scrubbed... URL: From python-checkins at python.org Mon Jun 1 22:01:24 2009 From: python-checkins at python.org (guilherme.polo) Date: Mon, 1 Jun 2009 22:01:24 +0200 (CEST) Subject: [Python-checkins] r73112 - python/branches/tk_and_idle_maintenance/Lib/lib-tk/test/test_tkinter/test_scrollbar.py Message-ID: <20090601200124.74C72D4BB@mail.python.org> Author: guilherme.polo Date: Mon Jun 1 22:01:24 2009 New Revision: 73112 Log: Some tests for Tkinter.Scrollbar. Added: python/branches/tk_and_idle_maintenance/Lib/lib-tk/test/test_tkinter/test_scrollbar.py (contents, props changed) Added: python/branches/tk_and_idle_maintenance/Lib/lib-tk/test/test_tkinter/test_scrollbar.py ============================================================================== --- (empty file) +++ python/branches/tk_and_idle_maintenance/Lib/lib-tk/test/test_tkinter/test_scrollbar.py Mon Jun 1 22:01:24 2009 @@ -0,0 +1,84 @@ +import unittest +import Tkinter +from test.test_support import requires, run_unittest +from ttk import setup_master + +requires('gui') + +class ScrollbarTest(unittest.TestCase): + + def setUp(self): + self.root = setup_master() + self.text = Tkinter.Text(self.root, width=50, height=10) + self.sb = Tkinter.Scrollbar(self.root) + self.text.pack(side='left', fill='both', expand=True) + self.sb.pack(side='right', fill='y') + self.text['yscrollcommand'] = self.sb.set + self.sb['command'] = self.text.yview + + def tearDown(self): + self.sb.destroy() + self.text.destroy() + + + def test_activate(self): + self.assertIs(self.sb.activate(), None) + self.sb.activate('arrow2') + self.assertEqual(self.sb.activate(), 'arrow2') + self.sb.activate('something invalid') + self.assertIs(self.sb.activate(), None) + + def test_delta(self): + self.sb.update_idletasks() + self.assertTrue(isinstance(self.sb.delta(5, 5), float)) + self.assertTrue(isinstance(self.sb.delta('1', '2'), float)) + self.assertRaises(Tkinter.TclError, self.sb.delta, 1, {}) + + def test_fraction(self): + self.sb.update_idletasks() + self.assertTrue(isinstance(self.sb.fraction(5, 5), float)) + self.assertTrue(isinstance(self.sb.fraction('1', '2'), float)) + self.assertRaises(Tkinter.TclError, self.sb.fraction, 1, {}) + + def test_identify(self): + self.sb.update_idletasks() + x_mid = self.sb.winfo_width() / 2 + y_max = self.sb.winfo_height() + + values = ['', 'arrow1', 'arrow2', 'slider'] + empty = self.sb.identify(0, 0) + self.assertIn(empty, values) + values.remove(empty) + self.assertEqual(values, ['arrow1', 'arrow2', 'slider']) + arrow1 = self.sb.identify(x_mid, 5) + self.assertIn(arrow1, values) + values.remove(arrow1) + self.assertEqual(values, ['arrow2', 'slider']) + arrow2 = self.sb.identify(x_mid, y_max - 5) + self.assertIn(arrow2, values) + values.remove(arrow2) + self.assertEqual(values, ['slider']) + + for i in range(5, y_max): + if self.sb.identify(x_mid, i) in values: + values.remove('slider') + self.assertFalse(values) + + def test_get_set(self): + self.sb.update_idletasks() + curr = self.sb.get() + self.assertTrue(isinstance(curr, tuple)) + self.assertEqual(len(curr), 2) + for item in curr: + self.assertTrue(isinstance(item, float)) + + self.sb.set(2, 2) + self.assertEqual(self.sb.get(), (1.0, 1.0)) + self.sb.set(-1, 2) + self.assertEqual(self.sb.get(), (0, 1)) + + +tests_gui = (ScrollbarTest, ) + +if __name__ == "__main__": + run_unittest(*tests_gui) From python-checkins at python.org Mon Jun 1 22:36:32 2009 From: python-checkins at python.org (guilherme.polo) Date: Mon, 1 Jun 2009 22:36:32 +0200 (CEST) Subject: [Python-checkins] r73113 - python/branches/tk_and_idle_maintenance/Lib/lib-tk/test/test_tkinter/test_toplevel.py Message-ID: <20090601203632.B9E20D5D9@mail.python.org> Author: guilherme.polo Date: Mon Jun 1 22:36:32 2009 New Revision: 73113 Log: A very small set of tests for Tkinter.Toplevel (there isn't much to test here actually). Added: python/branches/tk_and_idle_maintenance/Lib/lib-tk/test/test_tkinter/test_toplevel.py (contents, props changed) Added: python/branches/tk_and_idle_maintenance/Lib/lib-tk/test/test_tkinter/test_toplevel.py ============================================================================== --- (empty file) +++ python/branches/tk_and_idle_maintenance/Lib/lib-tk/test/test_tkinter/test_toplevel.py Mon Jun 1 22:36:32 2009 @@ -0,0 +1,27 @@ +import unittest +import Tkinter +from test.test_support import requires, run_unittest +from ttk import setup_master + +requires('gui') + +class ToplevelTest(unittest.TestCase): + + def setUp(self): + self.root = setup_master() + + + def test_initialization(self): + self.root.title('hi') + tl = Tkinter.Toplevel(self.root, **{'class_': 'test'}) + self.assertEqual(tl['class'], 'test') + self.assertEqual(tl.title(), 'hi') + tl.destroy() + + self.assertRaises(Tkinter.TclError, Tkinter.Toplevel, self.root, a='b') + + +tests_gui = (ToplevelTest, ) + +if __name__ == "__main__": + run_unittest(*tests_gui) From python-checkins at python.org Mon Jun 1 22:53:18 2009 From: python-checkins at python.org (amaury.forgeotdarc) Date: Mon, 1 Jun 2009 22:53:18 +0200 (CEST) Subject: [Python-checkins] r73114 - in python/trunk: Lib/test/test_trace.py Misc/NEWS Objects/frameobject.c Message-ID: <20090601205318.B672BD8F6@mail.python.org> Author: amaury.forgeotdarc Date: Mon Jun 1 22:53:18 2009 New Revision: 73114 Log: #4547: When debugging a very large function, it was not always possible to update the lineno attribute of the current frame. Modified: python/trunk/Lib/test/test_trace.py python/trunk/Misc/NEWS python/trunk/Objects/frameobject.c Modified: python/trunk/Lib/test/test_trace.py ============================================================================== --- python/trunk/Lib/test/test_trace.py (original) +++ python/trunk/Lib/test/test_trace.py Mon Jun 1 22:53:18 2009 @@ -740,6 +740,23 @@ def test_19_no_jump_without_trace_function(self): no_jump_without_trace_function() + def test_20_large_function(self): + d = {} + exec("""def f(output): # line 0 + x = 0 # line 1 + y = 1 # line 2 + ''' # line 3 + %s # lines 4-1004 + ''' # line 1005 + x += 1 # line 1006 + output.append(x) # line 1007 + return""" % ('\n' * 1000,), d) + f = d['f'] + + f.jump = (2, 1007) + f.output = [0] + self.run_test(f) + def test_jump_to_firstlineno(self): # This tests that PDB can jump back to the first line in a # file. See issue #1689458. It can only be triggered in a Modified: python/trunk/Misc/NEWS ============================================================================== --- python/trunk/Misc/NEWS (original) +++ python/trunk/Misc/NEWS Mon Jun 1 22:53:18 2009 @@ -12,6 +12,9 @@ Core and Builtins ----------------- +- Issue #4547: When debugging a very large function, it was not always + possible to update the lineno attribute of the current frame. + - Issue #5330: C functions called with keyword arguments were not reported by the various profiling modules (profile, cProfile). Patch by Hagen F?rstenau. Modified: python/trunk/Objects/frameobject.c ============================================================================== --- python/trunk/Objects/frameobject.c (original) +++ python/trunk/Objects/frameobject.c Mon Jun 1 22:53:18 2009 @@ -98,7 +98,7 @@ int new_iblock = 0; /* The new value of f_iblock */ unsigned char *code = NULL; /* The bytecode for the frame... */ Py_ssize_t code_len = 0; /* ...and its length */ - char *lnotab = NULL; /* Iterating over co_lnotab */ + unsigned char *lnotab = NULL; /* Iterating over co_lnotab */ Py_ssize_t lnotab_len = 0; /* (ditto) */ int offset = 0; /* (ditto) */ int line = 0; /* (ditto) */ @@ -148,7 +148,7 @@ /* Find the bytecode offset for the start of the given * line, or the first code-owning line after it. */ PyString_AsStringAndSize(f->f_code->co_lnotab, - &lnotab, &lnotab_len); + &(char*)lnotab, &lnotab_len); addr = 0; line = f->f_code->co_firstlineno; new_lasti = -1; From buildbot at python.org Mon Jun 1 22:59:41 2009 From: buildbot at python.org (buildbot at python.org) Date: Mon, 01 Jun 2009 20:59:41 +0000 Subject: [Python-checkins] buildbot failure in amd64 gentoo trunk Message-ID: <20090601205941.23D2BD3E4@mail.python.org> The Buildbot has detected a new failure of amd64 gentoo trunk. Full details are available at: http://www.python.org/dev/buildbot/all/amd64%20gentoo%20trunk/builds/103 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: norwitz-amd64 Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: amaury.forgeotdarc BUILD FAILED: failed compile sincerely, -The Buildbot From python-checkins at python.org Mon Jun 1 23:00:57 2009 From: python-checkins at python.org (benjamin.peterson) Date: Mon, 1 Jun 2009 23:00:57 +0200 (CEST) Subject: [Python-checkins] r73115 - python/branches/py3k Message-ID: <20090601210057.3578AC50E@mail.python.org> Author: benjamin.peterson Date: Mon Jun 1 23:00:57 2009 New Revision: 73115 Log: Blocked revisions 72571,72774,72791,72956,72992,73001-73002,73006,73029,73046,73048 via svnmerge ........ r72571 | michael.foord | 2009-05-11 13:01:45 -0500 (Mon, 11 May 2009) | 1 line Add missing # to NEWS ........ r72774 | raymond.hettinger | 2009-05-18 10:51:59 -0500 (Mon, 18 May 2009) | 1 line Issue 6037: MutableSequence.__iadd__ should return self. ........ r72791 | ronald.oussoren | 2009-05-19 15:12:17 -0500 (Tue, 19 May 2009) | 2 lines Remove some old MacPython files that are no longer relevant. ........ r72956 | raymond.hettinger | 2009-05-26 21:24:45 -0500 (Tue, 26 May 2009) | 3 lines Fix field name conflicts for named tuples. ........ r72992 | r.david.murray | 2009-05-28 13:49:23 -0500 (Thu, 28 May 2009) | 2 lines Backport smtplib auth tests from r72990. ........ r73001 | raymond.hettinger | 2009-05-28 20:36:26 -0500 (Thu, 28 May 2009) | 1 line Issue 5150: Add rstrip() option to IDLE's format menu. ........ r73002 | raymond.hettinger | 2009-05-28 20:46:48 -0500 (Thu, 28 May 2009) | 3 lines Deprecate contextlib.nested(). The with-statement now provides this functionality directly. ........ r73006 | raymond.hettinger | 2009-05-28 23:58:52 -0500 (Thu, 28 May 2009) | 1 line Issue 5982: Classmethod and staticmethod expose wrapped function with __func__. ........ r73029 | raymond.hettinger | 2009-05-29 16:20:41 -0500 (Fri, 29 May 2009) | 1 line Move the basic examples section back to the beginning. ........ r73046 | georg.brandl | 2009-05-30 02:31:25 -0500 (Sat, 30 May 2009) | 1 line Use preferred form of raising exceptions. ........ r73048 | georg.brandl | 2009-05-30 05:34:25 -0500 (Sat, 30 May 2009) | 1 line Fix markup problem. ........ Modified: python/branches/py3k/ (props changed) From python-checkins at python.org Mon Jun 1 23:16:17 2009 From: python-checkins at python.org (amaury.forgeotdarc) Date: Mon, 1 Jun 2009 23:16:17 +0200 (CEST) Subject: [Python-checkins] r73116 - in python/branches/py3k: Include/modsupport.h Misc/NEWS Message-ID: <20090601211617.65352D3D2@mail.python.org> Author: amaury.forgeotdarc Date: Mon Jun 1 23:16:17 2009 New Revision: 73116 Log: #5735: Modules compiled with incompatible settings (--with-pydebug when python is not) should generate a link-time error. I won't backport to 3.0, because it breaks binary compatibility Modified: python/branches/py3k/Include/modsupport.h python/branches/py3k/Misc/NEWS Modified: python/branches/py3k/Include/modsupport.h ============================================================================== --- python/branches/py3k/Include/modsupport.h (original) +++ python/branches/py3k/Include/modsupport.h Mon Jun 1 23:16:17 2009 @@ -92,10 +92,10 @@ */ #ifdef Py_TRACE_REFS - /* When we are tracing reference counts, rename PyModule_New2 so + /* When we are tracing reference counts, rename PyModule_Create2 so modules compiled with incompatible settings will generate a link-time error. */ - #define PyModule_New2 PyModule_Create2TraceRefs + #define PyModule_Create2 PyModule_Create2TraceRefs #endif PyAPI_FUNC(PyObject *) PyModule_Create2(struct PyModuleDef*, Modified: python/branches/py3k/Misc/NEWS ============================================================================== --- python/branches/py3k/Misc/NEWS (original) +++ python/branches/py3k/Misc/NEWS Mon Jun 1 23:16:17 2009 @@ -28,6 +28,13 @@ - Issue #6158: Package Sine-1000Hz-300ms.aif in MSI file. +C-API +----- + +- Issue #5735: Python compiled with --with-pydebug should throw an + ImportError when trying to import modules compiled without + --with-pydebug, and vice-versa. + What's New in Python 3.1 release candidate 1? ============================================= From python-checkins at python.org Mon Jun 1 23:28:37 2009 From: python-checkins at python.org (amaury.forgeotdarc) Date: Mon, 1 Jun 2009 23:28:37 +0200 (CEST) Subject: [Python-checkins] r73117 - in python/branches/py3k: Lib/test/test_trace.py Misc/NEWS Objects/frameobject.c Message-ID: <20090601212837.4BA00D68F@mail.python.org> Author: amaury.forgeotdarc Date: Mon Jun 1 23:28:37 2009 New Revision: 73117 Log: Merged revisions 73114 via svnmerge from svn+ssh://pythondev at svn.python.org/python/trunk ........ r73114 | amaury.forgeotdarc | 2009-06-01 22:53:18 +0200 (lun., 01 juin 2009) | 3 lines #4547: When debugging a very large function, it was not always possible to update the lineno attribute of the current frame. ........ Modified: python/branches/py3k/ (props changed) python/branches/py3k/Lib/test/test_trace.py python/branches/py3k/Misc/NEWS python/branches/py3k/Objects/frameobject.c Modified: python/branches/py3k/Lib/test/test_trace.py ============================================================================== --- python/branches/py3k/Lib/test/test_trace.py (original) +++ python/branches/py3k/Lib/test/test_trace.py Mon Jun 1 23:28:37 2009 @@ -741,6 +741,23 @@ def test_19_no_jump_without_trace_function(self): no_jump_without_trace_function() + def test_20_large_function(self): + d = {} + exec("""def f(output): # line 0 + x = 0 # line 1 + y = 1 # line 2 + ''' # line 3 + %s # lines 4-1004 + ''' # line 1005 + x += 1 # line 1006 + output.append(x) # line 1007 + return""" % ('\n' * 1000,), d) + f = d['f'] + + f.jump = (2, 1007) + f.output = [0] + self.run_test(f) + def test_jump_to_firstlineno(self): # This tests that PDB can jump back to the first line in a # file. See issue #1689458. It can only be triggered in a Modified: python/branches/py3k/Misc/NEWS ============================================================================== --- python/branches/py3k/Misc/NEWS (original) +++ python/branches/py3k/Misc/NEWS Mon Jun 1 23:28:37 2009 @@ -12,6 +12,9 @@ Core and Builtins ----------------- +- Issue #4547: When debugging a very large function, it was not always + possible to update the lineno attribute of the current frame. + - Issue #5330: C functions called with keyword arguments were not reported by the various profiling modules (profile, cProfile). Patch by Hagen F?rstenau. Modified: python/branches/py3k/Objects/frameobject.c ============================================================================== --- python/branches/py3k/Objects/frameobject.c (original) +++ python/branches/py3k/Objects/frameobject.c Mon Jun 1 23:28:37 2009 @@ -69,7 +69,7 @@ int new_iblock = 0; /* The new value of f_iblock */ unsigned char *code = NULL; /* The bytecode for the frame... */ Py_ssize_t code_len = 0; /* ...and its length */ - char *lnotab = NULL; /* Iterating over co_lnotab */ + unsigned char *lnotab = NULL; /* Iterating over co_lnotab */ Py_ssize_t lnotab_len = 0; /* (ditto) */ int offset = 0; /* (ditto) */ int line = 0; /* (ditto) */ @@ -131,7 +131,7 @@ /* Find the bytecode offset for the start of the given * line, or the first code-owning line after it. */ PyBytes_AsStringAndSize(f->f_code->co_lnotab, - &lnotab, &lnotab_len); + &(char*)lnotab, &lnotab_len); addr = 0; line = f->f_code->co_firstlineno; new_lasti = -1; From buildbot at python.org Mon Jun 1 23:47:37 2009 From: buildbot at python.org (buildbot at python.org) Date: Mon, 01 Jun 2009 21:47:37 +0000 Subject: [Python-checkins] buildbot failure in amd64 gentoo 3.x Message-ID: <20090601214737.8649FD4D2@mail.python.org> The Buildbot has detected a new failure of amd64 gentoo 3.x. Full details are available at: http://www.python.org/dev/buildbot/all/amd64%20gentoo%203.x/builds/739 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: norwitz-amd64 Build Reason: Build Source Stamp: [branch branches/py3k] HEAD Blamelist: amaury.forgeotdarc BUILD FAILED: failed compile sincerely, -The Buildbot From python-checkins at python.org Tue Jun 2 00:04:41 2009 From: python-checkins at python.org (amaury.forgeotdarc) Date: Tue, 2 Jun 2009 00:04:41 +0200 (CEST) Subject: [Python-checkins] r73118 - in python/branches/release26-maint: Lib/test/test_trace.py Misc/NEWS Objects/frameobject.c Message-ID: <20090601220441.DB4A1D9A1@mail.python.org> Author: amaury.forgeotdarc Date: Tue Jun 2 00:04:41 2009 New Revision: 73118 Log: Merged revisions 73114 via svnmerge from svn+ssh://pythondev at svn.python.org/python/trunk ........ r73114 | amaury.forgeotdarc | 2009-06-01 22:53:18 +0200 (lun., 01 juin 2009) | 3 lines #4547: When debugging a very large function, it was not always possible to update the lineno attribute of the current frame. ........ Modified: python/branches/release26-maint/ (props changed) python/branches/release26-maint/Lib/test/test_trace.py python/branches/release26-maint/Misc/NEWS python/branches/release26-maint/Objects/frameobject.c Modified: python/branches/release26-maint/Lib/test/test_trace.py ============================================================================== --- python/branches/release26-maint/Lib/test/test_trace.py (original) +++ python/branches/release26-maint/Lib/test/test_trace.py Tue Jun 2 00:04:41 2009 @@ -740,6 +740,23 @@ def test_19_no_jump_without_trace_function(self): no_jump_without_trace_function() + def test_20_large_function(self): + d = {} + exec("""def f(output): # line 0 + x = 0 # line 1 + y = 1 # line 2 + ''' # line 3 + %s # lines 4-1004 + ''' # line 1005 + x += 1 # line 1006 + output.append(x) # line 1007 + return""" % ('\n' * 1000,), d) + f = d['f'] + + f.jump = (2, 1007) + f.output = [0] + self.run_test(f) + def test_main(): test_support.run_unittest( TraceTestCase, Modified: python/branches/release26-maint/Misc/NEWS ============================================================================== --- python/branches/release26-maint/Misc/NEWS (original) +++ python/branches/release26-maint/Misc/NEWS Tue Jun 2 00:04:41 2009 @@ -12,6 +12,9 @@ Core and Builtins ----------------- +- Issue #4547: When debugging a very large function, it was not always + possible to update the lineno attribute of the current frame. + - Issue #5330: C functions called with keyword arguments were not reported by the various profiling modules (profile, cProfile). Patch by Hagen F?rstenau. Modified: python/branches/release26-maint/Objects/frameobject.c ============================================================================== --- python/branches/release26-maint/Objects/frameobject.c (original) +++ python/branches/release26-maint/Objects/frameobject.c Tue Jun 2 00:04:41 2009 @@ -70,7 +70,7 @@ int new_iblock = 0; /* The new value of f_iblock */ unsigned char *code = NULL; /* The bytecode for the frame... */ Py_ssize_t code_len = 0; /* ...and its length */ - char *lnotab = NULL; /* Iterating over co_lnotab */ + unsigned char *lnotab = NULL; /* Iterating over co_lnotab */ Py_ssize_t lnotab_len = 0; /* (ditto) */ int offset = 0; /* (ditto) */ int line = 0; /* (ditto) */ @@ -114,7 +114,8 @@ /* Find the bytecode offset for the start of the given line, or the * first code-owning line after it. */ - PyString_AsStringAndSize(f->f_code->co_lnotab, &lnotab, &lnotab_len); + PyString_AsStringAndSize((char*)f->f_code->co_lnotab, + &lnotab, &lnotab_len); addr = 0; line = f->f_code->co_firstlineno; new_lasti = -1; From python-checkins at python.org Tue Jun 2 00:17:39 2009 From: python-checkins at python.org (amaury.forgeotdarc) Date: Tue, 2 Jun 2009 00:17:39 +0200 (CEST) Subject: [Python-checkins] r73119 - python/branches/release26-maint/Objects/frameobject.c Message-ID: <20090601221739.F186AD358@mail.python.org> Author: amaury.forgeotdarc Date: Tue Jun 2 00:17:39 2009 New Revision: 73119 Log: #4547 again: fix a typo that causes compilation warnings Modified: python/branches/release26-maint/Objects/frameobject.c Modified: python/branches/release26-maint/Objects/frameobject.c ============================================================================== --- python/branches/release26-maint/Objects/frameobject.c (original) +++ python/branches/release26-maint/Objects/frameobject.c Tue Jun 2 00:17:39 2009 @@ -114,8 +114,8 @@ /* Find the bytecode offset for the start of the given line, or the * first code-owning line after it. */ - PyString_AsStringAndSize((char*)f->f_code->co_lnotab, - &lnotab, &lnotab_len); + PyString_AsStringAndSize(f->f_code->co_lnotab, + &(char*)lnotab, &lnotab_len); addr = 0; line = f->f_code->co_firstlineno; new_lasti = -1; From python-checkins at python.org Tue Jun 2 00:19:47 2009 From: python-checkins at python.org (amaury.forgeotdarc) Date: Tue, 2 Jun 2009 00:19:47 +0200 (CEST) Subject: [Python-checkins] r73120 - in python/branches/release30-maint: Lib/test/test_trace.py Misc/NEWS Objects/frameobject.c Message-ID: <20090601221947.ED2A7D415@mail.python.org> Author: amaury.forgeotdarc Date: Tue Jun 2 00:19:47 2009 New Revision: 73120 Log: Merged revisions 73117 via svnmerge from svn+ssh://pythondev at svn.python.org/python/branches/py3k ................ r73117 | amaury.forgeotdarc | 2009-06-01 23:28:37 +0200 (lun., 01 juin 2009) | 10 lines Merged revisions 73114 via svnmerge from svn+ssh://pythondev at svn.python.org/python/trunk ........ r73114 | amaury.forgeotdarc | 2009-06-01 22:53:18 +0200 (lun., 01 juin 2009) | 3 lines #4547: When debugging a very large function, it was not always possible to update the lineno attribute of the current frame. ........ ................ Modified: python/branches/release30-maint/ (props changed) python/branches/release30-maint/Lib/test/test_trace.py python/branches/release30-maint/Misc/NEWS python/branches/release30-maint/Objects/frameobject.c Modified: python/branches/release30-maint/Lib/test/test_trace.py ============================================================================== --- python/branches/release30-maint/Lib/test/test_trace.py (original) +++ python/branches/release30-maint/Lib/test/test_trace.py Tue Jun 2 00:19:47 2009 @@ -741,6 +741,23 @@ def test_19_no_jump_without_trace_function(self): no_jump_without_trace_function() + def test_20_large_function(self): + d = {} + exec("""def f(output): # line 0 + x = 0 # line 1 + y = 1 # line 2 + ''' # line 3 + %s # lines 4-1004 + ''' # line 1005 + x += 1 # line 1006 + output.append(x) # line 1007 + return""" % ('\n' * 1000,), d) + f = d['f'] + + f.jump = (2, 1007) + f.output = [0] + self.run_test(f) + def test_main(): support.run_unittest( TraceTestCase, Modified: python/branches/release30-maint/Misc/NEWS ============================================================================== --- python/branches/release30-maint/Misc/NEWS (original) +++ python/branches/release30-maint/Misc/NEWS Tue Jun 2 00:19:47 2009 @@ -12,6 +12,9 @@ Core and Builtins ----------------- +- Issue #4547: When debugging a very large function, it was not always + possible to update the lineno attribute of the current frame. + - Issue #6089: Fixed str.format with certain invalid field specifiers that would raise SystemError. Modified: python/branches/release30-maint/Objects/frameobject.c ============================================================================== --- python/branches/release30-maint/Objects/frameobject.c (original) +++ python/branches/release30-maint/Objects/frameobject.c Tue Jun 2 00:19:47 2009 @@ -69,7 +69,7 @@ int new_iblock = 0; /* The new value of f_iblock */ unsigned char *code = NULL; /* The bytecode for the frame... */ Py_ssize_t code_len = 0; /* ...and its length */ - char *lnotab = NULL; /* Iterating over co_lnotab */ + unsigned char *lnotab = NULL; /* Iterating over co_lnotab */ Py_ssize_t lnotab_len = 0; /* (ditto) */ int offset = 0; /* (ditto) */ int line = 0; /* (ditto) */ @@ -125,7 +125,8 @@ /* Find the bytecode offset for the start of the given line, or the * first code-owning line after it. */ - PyBytes_AsStringAndSize(f->f_code->co_lnotab, &lnotab, &lnotab_len); + PyBytes_AsStringAndSize(f->f_code->co_lnotab, + &(char*)lnotab, &lnotab_len); addr = 0; line = f->f_code->co_firstlineno; new_lasti = -1; From python-checkins at python.org Tue Jun 2 00:22:13 2009 From: python-checkins at python.org (tarek.ziade) Date: Tue, 2 Jun 2009 00:22:13 +0200 (CEST) Subject: [Python-checkins] r73121 - in python/trunk/Lib/distutils: dist.py tests/test_dist.py Message-ID: <20090601222213.6F304D492@mail.python.org> Author: tarek.ziade Date: Tue Jun 2 00:22:13 2009 New Revision: 73121 Log: improved distutils.dist test coverage, pep-8 compliancy Modified: python/trunk/Lib/distutils/dist.py python/trunk/Lib/distutils/tests/test_dist.py Modified: python/trunk/Lib/distutils/dist.py ============================================================================== --- python/trunk/Lib/distutils/dist.py (original) +++ python/trunk/Lib/distutils/dist.py Tue Jun 2 00:22:13 2009 @@ -6,8 +6,7 @@ __revision__ = "$Id$" -import sys, os, string, re -from types import * +import sys, os, re try: import warnings @@ -251,7 +250,7 @@ # Now work on the rest of the attributes. Any attribute that's # not already defined is invalid! - for (key,val) in attrs.items(): + for (key, val) in attrs.items(): if hasattr(self.metadata, "set_" + key): getattr(self.metadata, "set_" + key)(val) elif hasattr(self.metadata, key): @@ -286,22 +285,24 @@ commands.sort() if header is not None: - print indent + header + self.announce(indent + header) indent = indent + " " if not commands: - print indent + "no commands known yet" + self.announce(indent + "no commands known yet") return for cmd_name in commands: opt_dict = self.command_options.get(cmd_name) if opt_dict is None: - print indent + "no option dict for '%s' command" % cmd_name + self.announce(indent + + "no option dict for '%s' command" % cmd_name) else: - print indent + "option dict for '%s' command:" % cmd_name + self.announce(indent + + "option dict for '%s' command:" % cmd_name) out = pformat(opt_dict) - for line in string.split(out, "\n"): - print indent + " " + line + for line in out.split('\n'): + self.announce(indent + " " + line) # -- Config file finding/parsing methods --------------------------- @@ -352,11 +353,13 @@ if filenames is None: filenames = self.find_config_files() - if DEBUG: print "Distribution.parse_config_files():" + if DEBUG: + self.announce("Distribution.parse_config_files():") parser = ConfigParser() for filename in filenames: - if DEBUG: print " reading", filename + if DEBUG: + self.announce(" reading", filename) parser.read(filename) for section in parser.sections(): options = parser.options(section) @@ -365,7 +368,7 @@ for opt in options: if opt != '__name__': val = parser.get(section,opt) - opt = string.replace(opt, '-', '_') + opt = opt.replace('-', '_') opt_dict[opt] = (filename, val) # Make the ConfigParser forget everything (so we retain @@ -503,7 +506,7 @@ # Also make sure that the command object provides a list of its # known options. if not (hasattr(cmd_class, 'user_options') and - type(cmd_class.user_options) is ListType): + isinstance(cmd_class.user_options, list)): raise DistutilsClassError, \ ("command class %s must provide " + "'user_options' attribute (a list of tuples)") % \ @@ -519,7 +522,7 @@ # Check for help_options in command class. They have a different # format (tuple of four) so we need to preprocess them here. if (hasattr(cmd_class, 'help_options') and - type(cmd_class.help_options) is ListType): + isinstance(cmd_class.help_options, list)): help_options = fix_help_options(cmd_class.help_options) else: help_options = [] @@ -537,14 +540,11 @@ return if (hasattr(cmd_class, 'help_options') and - type(cmd_class.help_options) is ListType): + isinstance(cmd_class.help_options, list)): help_option_found=0 for (help_option, short, desc, func) in cmd_class.help_options: if hasattr(opts, parser.get_attr_name(help_option)): help_option_found=1 - #print "showing help for option %s of command %s" % \ - # (help_option[0],cmd_class) - if callable(func): func() else: @@ -569,17 +569,13 @@ instance, analogous to the .finalize_options() method of Command objects. """ - keywords = self.metadata.keywords - if keywords is not None: - if type(keywords) is StringType: - keywordlist = string.split(keywords, ',') - self.metadata.keywords = map(string.strip, keywordlist) - - platforms = self.metadata.platforms - if platforms is not None: - if type(platforms) is StringType: - platformlist = string.split(platforms, ',') - self.metadata.platforms = map(string.strip, platformlist) + for attr in ('keywords', 'platforms'): + value = getattr(self.metadata, attr) + if value is None: + continue + if isinstance(value, str): + value = [elm.strip() for elm in value.split(',')] + setattr(self.metadata, attr, value) def _show_help(self, parser, global_options=1, display_options=1, commands=[]): @@ -606,31 +602,30 @@ options = self.global_options parser.set_option_table(options) parser.print_help(self.common_usage + "\nGlobal options:") - print + self.announce('') if display_options: parser.set_option_table(self.display_options) parser.print_help( "Information display options (just display " + "information, ignore any commands)") - print + self.announce('') for command in self.commands: - if type(command) is ClassType and issubclass(command, Command): + if isinstance(command, type) and issubclass(command, Command): klass = command else: klass = self.get_command_class(command) if (hasattr(klass, 'help_options') and - type(klass.help_options) is ListType): + isinstance(klass.help_options, list)): parser.set_option_table(klass.user_options + fix_help_options(klass.help_options)) else: parser.set_option_table(klass.user_options) parser.print_help("Options for '%s' command:" % klass.__name__) - print + self.announce('') - print gen_usage(self.script_name) - return + self.announce(gen_usage(self.script_name)) def handle_display_options(self, option_order): """If there were any non-global "display-only" options @@ -645,8 +640,8 @@ # we ignore "foo bar"). if self.help_commands: self.print_commands() - print - print gen_usage(self.script_name) + self.announce('') + self.announce(gen_usage(self.script_name)) return 1 # If user supplied any of the "display metadata" options, then @@ -662,12 +657,12 @@ opt = translate_longopt(opt) value = getattr(self.metadata, "get_"+opt)() if opt in ['keywords', 'platforms']: - print string.join(value, ',') + self.announce(','.join(value)) elif opt in ('classifiers', 'provides', 'requires', 'obsoletes'): - print string.join(value, '\n') + self.announce('\n'.join(value)) else: - print value + self.announce(value) any_display_options = 1 return any_display_options @@ -676,7 +671,7 @@ """Print a subset of the list of all commands -- used by 'print_commands()'. """ - print header + ":" + self.announce(header + ":") for cmd in commands: klass = self.cmdclass.get(cmd) @@ -687,7 +682,7 @@ except AttributeError: description = "(no description available)" - print " %-*s %s" % (max_length, cmd, description) + self.announce(" %-*s %s" % (max_length, cmd, description)) def print_commands(self): """Print out a help message listing all available commands with a @@ -760,11 +755,10 @@ def get_command_packages(self): """Return a list of packages from which commands are loaded.""" pkgs = self.command_packages - if not isinstance(pkgs, type([])): - pkgs = string.split(pkgs or "", ",") - for i in range(len(pkgs)): - pkgs[i] = string.strip(pkgs[i]) - pkgs = filter(None, pkgs) + if not isinstance(pkgs, list): + if pkgs is None: + pkgs = '' + pkgs = [pkg.strip() for pkg in pkgs.split(',') if pkg != ''] if "distutils.command" not in pkgs: pkgs.insert(0, "distutils.command") self.command_packages = pkgs @@ -818,8 +812,8 @@ cmd_obj = self.command_obj.get(command) if not cmd_obj and create: if DEBUG: - print "Distribution.get_command_obj(): " \ - "creating '%s' command object" % command + self.announce("Distribution.get_command_obj(): " \ + "creating '%s' command object" % command) klass = self.get_command_class(command) cmd_obj = self.command_obj[command] = klass(self) @@ -849,9 +843,12 @@ if option_dict is None: option_dict = self.get_option_dict(command_name) - if DEBUG: print " setting options for '%s' command:" % command_name + if DEBUG: + self.announce(" setting options for '%s' command:" % command_name) for (option, (source, value)) in option_dict.items(): - if DEBUG: print " %s = %s (from %s)" % (option, value, source) + if DEBUG: + self.announce(" %s = %s (from %s)" % (option, value, + source)) try: bool_opts = map(translate_longopt, command_obj.boolean_options) except AttributeError: @@ -862,7 +859,7 @@ neg_opt = {} try: - is_string = type(value) is StringType + is_string = isinstance(value, str) if option in neg_opt and is_string: setattr(command_obj, neg_opt[option], not strtobool(value)) elif option in bool_opts and is_string: @@ -1044,10 +1041,10 @@ if self.download_url: self._write_field(file, 'Download-URL', self.download_url) - long_desc = rfc822_escape( self.get_long_description()) + long_desc = rfc822_escape(self.get_long_description()) self._write_field(file, 'Description', long_desc) - keywords = string.join( self.get_keywords(), ',') + keywords = ','.join(self.get_keywords()) if keywords: self._write_field(file, 'Keywords', keywords) Modified: python/trunk/Lib/distutils/tests/test_dist.py ============================================================================== --- python/trunk/Lib/distutils/tests/test_dist.py (original) +++ python/trunk/Lib/distutils/tests/test_dist.py Tue Jun 2 00:22:13 2009 @@ -1,4 +1,4 @@ -# -*- coding: latin-1 -*- +# -*- coding: utf8 -*- """Tests for distutils.dist.""" import os @@ -36,7 +36,9 @@ return self._config_files -class DistributionTestCase(support.TempdirManager, unittest.TestCase): +class DistributionTestCase(support.TempdirManager, + support.LoggingSilencer, + unittest.TestCase): def setUp(self): super(DistributionTestCase, self).setUp() @@ -106,11 +108,11 @@ my_file = os.path.join(tmp_dir, 'f') klass = Distribution - dist = klass(attrs={'author': u'Mister Caf?', + dist = klass(attrs={'author': u'Mister Caf??', 'name': 'my.package', - 'maintainer': u'Caf? Junior', - 'description': u'Caf? torr?fi?', - 'long_description': u'H?h?h?'}) + 'maintainer': u'Caf?? Junior', + 'description': u'Caf?? torr??fi??', + 'long_description': u'H??h??h??'}) # let's make sure the file can be written @@ -151,6 +153,49 @@ self.assertEquals(len(warns), 0) + def test_finalize_options(self): + + attrs = {'keywords': 'one,two', + 'platforms': 'one,two'} + + dist = Distribution(attrs=attrs) + dist.finalize_options() + + # finalize_option splits platforms and keywords + self.assertEquals(dist.metadata.platforms, ['one', 'two']) + self.assertEquals(dist.metadata.keywords, ['one', 'two']) + + def test_show_help(self): + class FancyGetopt(object): + def __init__(self): + self.count = 0 + + def set_option_table(self, *args): + pass + + def print_help(self, *args): + self.count += 1 + + parser = FancyGetopt() + dist = Distribution() + dist.commands = ['sdist'] + dist.script_name = 'setup.py' + dist._show_help(parser) + self.assertEquals(parser.count, 3) + + def test_get_command_packages(self): + dist = Distribution() + self.assertEquals(dist.command_packages, None) + cmds = dist.get_command_packages() + self.assertEquals(cmds, ['distutils.command']) + self.assertEquals(dist.command_packages, + ['distutils.command']) + + dist.command_packages = 'one,two' + cmds = dist.get_command_packages() + self.assertEquals(cmds, ['distutils.command', 'one', 'two']) + + class MetadataTestCase(support.TempdirManager, support.EnvironGuard, unittest.TestCase): From python-checkins at python.org Tue Jun 2 00:23:22 2009 From: python-checkins at python.org (tarek.ziade) Date: Tue, 2 Jun 2009 00:23:22 +0200 (CEST) Subject: [Python-checkins] r73122 - python/branches/release26-maint Message-ID: <20090601222322.8A522D4A6@mail.python.org> Author: tarek.ziade Date: Tue Jun 2 00:23:22 2009 New Revision: 73122 Log: Blocked revisions 73121 via svnmerge ........ r73121 | tarek.ziade | 2009-06-02 00:22:13 +0200 (Tue, 02 Jun 2009) | 1 line improved distutils.dist test coverage, pep-8 compliancy ........ Modified: python/branches/release26-maint/ (props changed) From buildbot at python.org Tue Jun 2 00:35:36 2009 From: buildbot at python.org (buildbot at python.org) Date: Mon, 01 Jun 2009 22:35:36 +0000 Subject: [Python-checkins] buildbot failure in amd64 gentoo 3.0 Message-ID: <20090601223536.6EBBAD6D8@mail.python.org> The Buildbot has detected a new failure of amd64 gentoo 3.0. Full details are available at: http://www.python.org/dev/buildbot/all/amd64%20gentoo%203.0/builds/47 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: norwitz-amd64 Build Reason: Build Source Stamp: [branch branches/release30-maint] HEAD Blamelist: amaury.forgeotdarc BUILD FAILED: failed compile sincerely, -The Buildbot From python-checkins at python.org Tue Jun 2 00:36:29 2009 From: python-checkins at python.org (tarek.ziade) Date: Tue, 2 Jun 2009 00:36:29 +0200 (CEST) Subject: [Python-checkins] r73123 - in python/branches/py3k: Lib/distutils/dist.py Lib/distutils/tests/test_dist.py Message-ID: <20090601223629.1293BD733@mail.python.org> Author: tarek.ziade Date: Tue Jun 2 00:36:26 2009 New Revision: 73123 Log: Merged revisions 73121 via svnmerge from svn+ssh://pythondev at svn.python.org/python/trunk ........ r73121 | tarek.ziade | 2009-06-02 00:22:13 +0200 (Tue, 02 Jun 2009) | 1 line improved distutils.dist test coverage, pep-8 compliancy ........ Modified: python/branches/py3k/ (props changed) python/branches/py3k/Lib/distutils/dist.py python/branches/py3k/Lib/distutils/tests/test_dist.py Modified: python/branches/py3k/Lib/distutils/dist.py ============================================================================== --- python/branches/py3k/Lib/distutils/dist.py (original) +++ python/branches/py3k/Lib/distutils/dist.py Tue Jun 2 00:36:26 2009 @@ -246,7 +246,7 @@ # Now work on the rest of the attributes. Any attribute that's # not already defined is invalid! - for (key,val) in attrs.items(): + for (key, val) in attrs.items(): if hasattr(self.metadata, "set_" + key): getattr(self.metadata, "set_" + key)(val) elif hasattr(self.metadata, key): @@ -280,22 +280,24 @@ commands = sorted(self.command_options.keys()) if header is not None: - print(indent + header) + self.announce(indent + header) indent = indent + " " if not commands: - print(indent + "no commands known yet") + self.announce(indent + "no commands known yet") return for cmd_name in commands: opt_dict = self.command_options.get(cmd_name) if opt_dict is None: - print(indent + "no option dict for '%s' command" % cmd_name) + self.announce(indent + + "no option dict for '%s' command" % cmd_name) else: - print(indent + "option dict for '%s' command:" % cmd_name) + self.announce(indent + + "option dict for '%s' command:" % cmd_name) out = pformat(opt_dict) - for line in out.split("\n"): - print(indent + " " + line) + for line in out.split('\n'): + self.announce(indent + " " + line) # -- Config file finding/parsing methods --------------------------- @@ -346,11 +348,13 @@ if filenames is None: filenames = self.find_config_files() - if DEBUG: print("Distribution.parse_config_files():") + if DEBUG: + self.announce("Distribution.parse_config_files():") parser = ConfigParser() for filename in filenames: - if DEBUG: print(" reading", filename) + if DEBUG: + self.announce(" reading", filename) parser.read(filename) for section in parser.sections(): options = parser.options(section) @@ -535,9 +539,6 @@ for (help_option, short, desc, func) in cmd_class.help_options: if hasattr(opts, parser.get_attr_name(help_option)): help_option_found=1 - #print "showing help for option %s of command %s" % \ - # (help_option[0],cmd_class) - if hasattr(func, '__call__'): func() else: @@ -562,17 +563,13 @@ instance, analogous to the .finalize_options() method of Command objects. """ - keywords = self.metadata.keywords - if keywords is not None: - if isinstance(keywords, str): - keywordlist = keywords.split(',') - self.metadata.keywords = [x.strip() for x in keywordlist] - - platforms = self.metadata.platforms - if platforms is not None: - if isinstance(platforms, str): - platformlist = platforms.split(',') - self.metadata.platforms = [x.strip() for x in platformlist] + for attr in ('keywords', 'platforms'): + value = getattr(self.metadata, attr) + if value is None: + continue + if isinstance(value, str): + value = [elm.strip() for elm in value.split(',')] + setattr(self.metadata, attr, value) def _show_help(self, parser, global_options=1, display_options=1, commands=[]): @@ -599,14 +596,14 @@ options = self.global_options parser.set_option_table(options) parser.print_help(self.common_usage + "\nGlobal options:") - print() + self.announce('') if display_options: parser.set_option_table(self.display_options) parser.print_help( "Information display options (just display " + "information, ignore any commands)") - print() + self.announce('') for command in self.commands: if isinstance(command, type) and issubclass(command, Command): @@ -620,10 +617,9 @@ else: parser.set_option_table(klass.user_options) parser.print_help("Options for '%s' command:" % klass.__name__) - print() + self.announce('') - print(gen_usage(self.script_name)) - return + self.announce(gen_usage(self.script_name)) def handle_display_options(self, option_order): """If there were any non-global "display-only" options @@ -638,8 +634,8 @@ # we ignore "foo bar"). if self.help_commands: self.print_commands() - print() - print(gen_usage(self.script_name)) + self.announce('') + self.announce(gen_usage(self.script_name)) return 1 # If user supplied any of the "display metadata" options, then @@ -655,12 +651,12 @@ opt = translate_longopt(opt) value = getattr(self.metadata, "get_"+opt)() if opt in ['keywords', 'platforms']: - print(','.join(value)) + self.announce(','.join(value)) elif opt in ('classifiers', 'provides', 'requires', 'obsoletes'): - print('\n'.join(value)) + self.announce('\n'.join(value)) else: - print(value) + self.announce(value) any_display_options = 1 return any_display_options @@ -669,7 +665,7 @@ """Print a subset of the list of all commands -- used by 'print_commands()'. """ - print(header + ":") + self.announce(header + ":") for cmd in commands: klass = self.cmdclass.get(cmd) @@ -680,7 +676,7 @@ except AttributeError: description = "(no description available)" - print(" %-*s %s" % (max_length, cmd, description)) + self.announce(" %-*s %s" % (max_length, cmd, description)) def print_commands(self): """Print out a help message listing all available commands with a @@ -752,11 +748,10 @@ def get_command_packages(self): """Return a list of packages from which commands are loaded.""" pkgs = self.command_packages - if not isinstance(pkgs, type([])): - pkgs = (pkgs or "").split(",") - for i in range(len(pkgs)): - pkgs[i] = pkgs[i].strip() - pkgs = [p for p in pkgs if p] + if not isinstance(pkgs, list): + if pkgs is None: + pkgs = '' + pkgs = [pkg.strip() for pkg in pkgs.split(',') if pkg != ''] if "distutils.command" not in pkgs: pkgs.insert(0, "distutils.command") self.command_packages = pkgs @@ -809,8 +804,8 @@ cmd_obj = self.command_obj.get(command) if not cmd_obj and create: if DEBUG: - print("Distribution.get_command_obj(): " \ - "creating '%s' command object" % command) + self.announce("Distribution.get_command_obj(): " \ + "creating '%s' command object" % command) klass = self.get_command_class(command) cmd_obj = self.command_obj[command] = klass(self) @@ -840,9 +835,12 @@ if option_dict is None: option_dict = self.get_option_dict(command_name) - if DEBUG: print(" setting options for '%s' command:" % command_name) + if DEBUG: + self.announce(" setting options for '%s' command:" % command_name) for (option, (source, value)) in option_dict.items(): - if DEBUG: print(" %s = %s (from %s)" % (option, value, source)) + if DEBUG: + self.announce(" %s = %s (from %s)" % (option, value, + source)) try: bool_opts = [translate_longopt(o) for o in command_obj.boolean_options] @@ -1036,7 +1034,7 @@ if self.download_url: file.write('Download-URL: %s\n' % self.download_url) - long_desc = rfc822_escape( self.get_long_description() ) + long_desc = rfc822_escape(self.get_long_description()) file.write('Description: %s\n' % long_desc) keywords = ','.join(self.get_keywords()) Modified: python/branches/py3k/Lib/distutils/tests/test_dist.py ============================================================================== --- python/branches/py3k/Lib/distutils/tests/test_dist.py (original) +++ python/branches/py3k/Lib/distutils/tests/test_dist.py Tue Jun 2 00:36:26 2009 @@ -1,3 +1,4 @@ +# -*- coding: utf8 -*- """Tests for distutils.dist.""" import os import io @@ -35,7 +36,8 @@ return self._config_files -class DistributionTestCase(unittest.TestCase): +class DistributionTestCase(support.LoggingSilencer, + unittest.TestCase): def setUp(self): super(DistributionTestCase, self).setUp() @@ -122,6 +124,49 @@ self.assertEquals(len(warns), 0) + def test_finalize_options(self): + + attrs = {'keywords': 'one,two', + 'platforms': 'one,two'} + + dist = Distribution(attrs=attrs) + dist.finalize_options() + + # finalize_option splits platforms and keywords + self.assertEquals(dist.metadata.platforms, ['one', 'two']) + self.assertEquals(dist.metadata.keywords, ['one', 'two']) + + def test_show_help(self): + class FancyGetopt(object): + def __init__(self): + self.count = 0 + + def set_option_table(self, *args): + pass + + def print_help(self, *args): + self.count += 1 + + parser = FancyGetopt() + dist = Distribution() + dist.commands = ['sdist'] + dist.script_name = 'setup.py' + dist._show_help(parser) + self.assertEquals(parser.count, 3) + + def test_get_command_packages(self): + dist = Distribution() + self.assertEquals(dist.command_packages, None) + cmds = dist.get_command_packages() + self.assertEquals(cmds, ['distutils.command']) + self.assertEquals(dist.command_packages, + ['distutils.command']) + + dist.command_packages = 'one,two' + cmds = dist.get_command_packages() + self.assertEquals(cmds, ['distutils.command', 'one', 'two']) + + class MetadataTestCase(support.TempdirManager, support.EnvironGuard, unittest.TestCase): From buildbot at python.org Tue Jun 2 00:38:06 2009 From: buildbot at python.org (buildbot at python.org) Date: Mon, 01 Jun 2009 22:38:06 +0000 Subject: [Python-checkins] buildbot failure in amd64 gentoo 2.6 Message-ID: <20090601223806.26A9FD9D6@mail.python.org> The Buildbot has detected a new failure of amd64 gentoo 2.6. Full details are available at: http://www.python.org/dev/buildbot/all/amd64%20gentoo%202.6/builds/64 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: norwitz-amd64 Build Reason: Build Source Stamp: [branch branches/release26-maint] HEAD Blamelist: amaury.forgeotdarc,tarek.ziade BUILD FAILED: failed compile sincerely, -The Buildbot From python-checkins at python.org Tue Jun 2 00:38:26 2009 From: python-checkins at python.org (tarek.ziade) Date: Tue, 2 Jun 2009 00:38:26 +0200 (CEST) Subject: [Python-checkins] r73124 - python/branches/release30-maint Message-ID: <20090601223826.596F1D94A@mail.python.org> Author: tarek.ziade Date: Tue Jun 2 00:38:26 2009 New Revision: 73124 Log: Blocked revisions 73123 via svnmerge ................ r73123 | tarek.ziade | 2009-06-02 00:36:26 +0200 (Tue, 02 Jun 2009) | 9 lines Merged revisions 73121 via svnmerge from svn+ssh://pythondev at svn.python.org/python/trunk ........ r73121 | tarek.ziade | 2009-06-02 00:22:13 +0200 (Tue, 02 Jun 2009) | 1 line improved distutils.dist test coverage, pep-8 compliancy ........ ................ Modified: python/branches/release30-maint/ (props changed) From python-checkins at python.org Tue Jun 2 00:42:34 2009 From: python-checkins at python.org (benjamin.peterson) Date: Tue, 2 Jun 2009 00:42:34 +0200 (CEST) Subject: [Python-checkins] r73125 - in python/branches/py3k: Doc/c-api/buffer.rst Doc/c-api/sequence.rst Doc/conf.py Doc/library/ctypes.rst Doc/library/email-examples.rst Doc/library/exceptions.rst Doc/library/functions.rst Doc/library/http.client.rst Doc/library/os.rst Doc/library/rlcompleter.rst Doc/library/smtplib.rst Doc/library/subprocess.rst Doc/reference/simple_stmts.rst Lib/gettext.py Lib/idlelib/macosxSupport.py Lib/logging/__init__.py Lib/test/support.py Lib/test/test_hashlib.py Lib/test/test_os.py Lib/test/test_unittest.py Lib/unittest.py Lib/zipfile.py Tools/freeze/makeconfig.py Message-ID: <20090601224234.5E2E2D787@mail.python.org> Author: benjamin.peterson Date: Tue Jun 2 00:42:33 2009 New Revision: 73125 Log: Merged revisions 72506,72525-72526,72551,72558,72616,72654-72655,72689,72745,72750,72802,72812,72822,72824,72826-72827,72833,72876,72890,72923,72946,73026,73042,73045,73047,73065,73068-73069 via svnmerge from svn+ssh://pythondev at svn.python.org/python/trunk ........ r72506 | vinay.sajip | 2009-05-09 07:07:17 -0500 (Sat, 09 May 2009) | 1 line Issue #5971: StreamHandler.handleError now swallows IOErrors which occur when trying to print a traceback. ........ r72525 | benjamin.peterson | 2009-05-09 20:38:02 -0500 (Sat, 09 May 2009) | 1 line close file explicitly ........ r72526 | benjamin.peterson | 2009-05-09 21:29:00 -0500 (Sat, 09 May 2009) | 1 line make sure files are closed using the with statement ........ r72551 | benjamin.peterson | 2009-05-10 09:16:47 -0500 (Sun, 10 May 2009) | 1 line use isinstance ........ r72558 | benjamin.peterson | 2009-05-10 18:52:09 -0500 (Sun, 10 May 2009) | 1 line sys.setdefaultencoding() strikes me as a bad example ........ r72616 | benjamin.peterson | 2009-05-13 19:33:10 -0500 (Wed, 13 May 2009) | 1 line importlib.import_module is better these days ........ r72654 | benjamin.peterson | 2009-05-14 17:37:49 -0500 (Thu, 14 May 2009) | 1 line prevent refleaks from threads ........ r72655 | benjamin.peterson | 2009-05-14 17:40:34 -0500 (Thu, 14 May 2009) | 1 line a useful decorator for cleaning up threads ........ r72689 | benjamin.peterson | 2009-05-16 13:44:34 -0500 (Sat, 16 May 2009) | 1 line use skipTest() ........ r72745 | benjamin.peterson | 2009-05-17 09:16:29 -0500 (Sun, 17 May 2009) | 1 line ignore .rst files in sphinx its self ........ r72750 | benjamin.peterson | 2009-05-17 11:59:27 -0500 (Sun, 17 May 2009) | 1 line chop off slash ........ r72802 | georg.brandl | 2009-05-20 13:35:27 -0500 (Wed, 20 May 2009) | 1 line #6051: refer to email examples for better way to construct email messages. ........ r72812 | michael.foord | 2009-05-21 17:57:02 -0500 (Thu, 21 May 2009) | 1 line Rename TestCase._result to _resultForDoCleanups to avoid potential clashes in TestCase subclasses. Issue 6072. ........ r72822 | georg.brandl | 2009-05-22 04:33:25 -0500 (Fri, 22 May 2009) | 1 line #6084: fix example. ........ r72824 | georg.brandl | 2009-05-22 04:43:17 -0500 (Fri, 22 May 2009) | 1 line Fix references to file-related functions and methods (os.* vs file.*). ........ r72826 | georg.brandl | 2009-05-22 04:49:42 -0500 (Fri, 22 May 2009) | 1 line Fix confusing wording. ........ r72827 | georg.brandl | 2009-05-22 04:50:30 -0500 (Fri, 22 May 2009) | 1 line s/use/call/ ........ r72833 | georg.brandl | 2009-05-22 12:00:17 -0500 (Fri, 22 May 2009) | 1 line #6078: _warnings is a builtin module and has no standard init_warnings function. ........ r72876 | benjamin.peterson | 2009-05-23 15:59:09 -0500 (Sat, 23 May 2009) | 1 line remove mention of old ctypes version ........ r72890 | gregory.p.smith | 2009-05-24 13:00:13 -0500 (Sun, 24 May 2009) | 2 lines add a versionadded tag for set_tunnel ........ r72923 | michael.foord | 2009-05-25 15:36:56 -0500 (Mon, 25 May 2009) | 1 line Make assertSequenceEqual error messages less cryptic, particularly for nested sequences. ........ r72946 | ronald.oussoren | 2009-05-26 13:44:48 -0500 (Tue, 26 May 2009) | 2 lines Fixes issue 6110 ........ r73026 | r.david.murray | 2009-05-29 14:30:27 -0500 (Fri, 29 May 2009) | 3 lines Issue 6141: document that the first item of args is still the command name even when executable is specified. ........ r73042 | benjamin.peterson | 2009-05-29 22:10:52 -0500 (Fri, 29 May 2009) | 1 line no fdatasync on macos ........ r73045 | georg.brandl | 2009-05-30 02:26:04 -0500 (Sat, 30 May 2009) | 1 line #6146: fix markup bug. ........ r73047 | georg.brandl | 2009-05-30 05:33:23 -0500 (Sat, 30 May 2009) | 1 line Fix some more small markup problems. ........ r73065 | antoine.pitrou | 2009-05-30 16:39:25 -0500 (Sat, 30 May 2009) | 3 lines The test for #5330 wasn't correct. ........ r73068 | antoine.pitrou | 2009-05-30 16:45:40 -0500 (Sat, 30 May 2009) | 3 lines Update ACKS ........ r73069 | benjamin.peterson | 2009-05-30 19:42:42 -0500 (Sat, 30 May 2009) | 1 line fix signature ........ Modified: python/branches/py3k/ (props changed) python/branches/py3k/Doc/c-api/buffer.rst python/branches/py3k/Doc/c-api/sequence.rst python/branches/py3k/Doc/conf.py python/branches/py3k/Doc/library/ctypes.rst python/branches/py3k/Doc/library/email-examples.rst python/branches/py3k/Doc/library/exceptions.rst python/branches/py3k/Doc/library/functions.rst python/branches/py3k/Doc/library/http.client.rst python/branches/py3k/Doc/library/os.rst python/branches/py3k/Doc/library/rlcompleter.rst python/branches/py3k/Doc/library/smtplib.rst python/branches/py3k/Doc/library/subprocess.rst python/branches/py3k/Doc/reference/simple_stmts.rst python/branches/py3k/Lib/gettext.py python/branches/py3k/Lib/idlelib/macosxSupport.py python/branches/py3k/Lib/logging/__init__.py python/branches/py3k/Lib/test/support.py python/branches/py3k/Lib/test/test_hashlib.py python/branches/py3k/Lib/test/test_os.py python/branches/py3k/Lib/test/test_unittest.py python/branches/py3k/Lib/unittest.py python/branches/py3k/Lib/zipfile.py python/branches/py3k/Tools/freeze/makeconfig.py Modified: python/branches/py3k/Doc/c-api/buffer.rst ============================================================================== --- python/branches/py3k/Doc/c-api/buffer.rst (original) +++ python/branches/py3k/Doc/c-api/buffer.rst Tue Jun 2 00:42:33 2009 @@ -137,7 +137,7 @@ Return 1 if *obj* supports the buffer interface otherwise 0. -.. cfunction:: int PyObject_GetBuffer(PyObject *obj, PyObject *view, int flags) +.. cfunction:: int PyObject_GetBuffer(PyObject *obj, Py_buffer *view, int flags) Export *obj* into a :ctype:`Py_buffer`, *view*. These arguments must never be *NULL*. The *flags* argument is a bit field indicating what Modified: python/branches/py3k/Doc/c-api/sequence.rst ============================================================================== --- python/branches/py3k/Doc/c-api/sequence.rst (original) +++ python/branches/py3k/Doc/c-api/sequence.rst Tue Jun 2 00:42:33 2009 @@ -50,7 +50,7 @@ .. cfunction:: PyObject* PySequence_GetItem(PyObject *o, Py_ssize_t i) - Return the *i*th element of *o*, or *NULL* on failure. This is the equivalent of + Return the *i*\ th element of *o*, or *NULL* on failure. This is the equivalent of the Python expression ``o[i]``. @@ -62,14 +62,14 @@ .. cfunction:: int PySequence_SetItem(PyObject *o, Py_ssize_t i, PyObject *v) - Assign object *v* to the *i*th element of *o*. Returns ``-1`` on failure. This + Assign object *v* to the *i*\ th element of *o*. Returns ``-1`` on failure. This is the equivalent of the Python statement ``o[i] = v``. This function *does not* steal a reference to *v*. .. cfunction:: int PySequence_DelItem(PyObject *o, Py_ssize_t i) - Delete the *i*th element of object *o*. Returns ``-1`` on failure. This is the + Delete the *i*\ th element of object *o*. Returns ``-1`` on failure. This is the equivalent of the Python statement ``del o[i]``. @@ -131,7 +131,7 @@ .. cfunction:: PyObject* PySequence_Fast_GET_ITEM(PyObject *o, Py_ssize_t i) - Return the *i*th element of *o*, assuming that *o* was returned by + Return the *i*\ th element of *o*, assuming that *o* was returned by :cfunc:`PySequence_Fast`, *o* is not *NULL*, and that *i* is within bounds. @@ -147,7 +147,7 @@ .. cfunction:: PyObject* PySequence_ITEM(PyObject *o, Py_ssize_t i) - Return the *i*th element of *o* or *NULL* on failure. Macro form of + Return the *i*\ th element of *o* or *NULL* on failure. Macro form of :cfunc:`PySequence_GetItem` but without checking that :cfunc:`PySequence_Check(o)` is true and without adjustment for negative indices. Modified: python/branches/py3k/Doc/conf.py ============================================================================== --- python/branches/py3k/Doc/conf.py (original) +++ python/branches/py3k/Doc/conf.py Tue Jun 2 00:42:33 2009 @@ -46,6 +46,9 @@ 'library/xml.etree', ] +# Ignore .rst in Sphinx its self. +exclude_trees = ['tools/sphinx'] + # Relative filename of the reference count data file. refcount_file = 'data/refcounts.dat' Modified: python/branches/py3k/Doc/library/ctypes.rst ============================================================================== --- python/branches/py3k/Doc/library/ctypes.rst (original) +++ python/branches/py3k/Doc/library/ctypes.rst Tue Jun 2 00:42:33 2009 @@ -1207,8 +1207,7 @@ Variable-sized data types ^^^^^^^^^^^^^^^^^^^^^^^^^ -``ctypes`` provides some support for variable-sized arrays and structures (this -was added in version 0.9.9.7). +``ctypes`` provides some support for variable-sized arrays and structures. The ``resize`` function can be used to resize the memory buffer of an existing ctypes object. The function takes the object as first argument, and the Modified: python/branches/py3k/Doc/library/email-examples.rst ============================================================================== --- python/branches/py3k/Doc/library/email-examples.rst (original) +++ python/branches/py3k/Doc/library/email-examples.rst Tue Jun 2 00:42:33 2009 @@ -1,3 +1,5 @@ +.. _email-examples: + :mod:`email`: Examples ---------------------- Modified: python/branches/py3k/Doc/library/exceptions.rst ============================================================================== --- python/branches/py3k/Doc/library/exceptions.rst (original) +++ python/branches/py3k/Doc/library/exceptions.rst Tue Jun 2 00:42:33 2009 @@ -73,9 +73,9 @@ .. exception:: LookupError - The base class for the exceptions that are raised when a key or index used on a - mapping or sequence is invalid: :exc:`IndexError`, :exc:`KeyError`. This can be - raised directly by :func:`sys.setdefaultencoding`. + The base class for the exceptions that are raised when a key or index used on + a mapping or sequence is invalid: :exc:`IndexError`, :exc:`KeyError`. This + can be raised directly by :func:`codecs.lookup`. .. exception:: EnvironmentError Modified: python/branches/py3k/Doc/library/functions.rst ============================================================================== --- python/branches/py3k/Doc/library/functions.rst (original) +++ python/branches/py3k/Doc/library/functions.rst Tue Jun 2 00:42:33 2009 @@ -1209,7 +1209,7 @@ >>> list(zipped) [(1, 4), (2, 5), (3, 6)] >>> x2, y2 = zip(*zip(x, y)) - >>> x == x2, y == y2 + >>> x == list(x2) and y == list(y2) True @@ -1272,7 +1272,7 @@ names. If you simply want to import a module (potentially within a package) by name, - you can get it from :data:`sys.modules`:: + you can call :func:`__import__` and then look it up in :data:`sys.modules`:: >>> import sys >>> name = 'foo.bar.baz' Modified: python/branches/py3k/Doc/library/http.client.rst ============================================================================== --- python/branches/py3k/Doc/library/http.client.rst (original) +++ python/branches/py3k/Doc/library/http.client.rst Tue Jun 2 00:42:33 2009 @@ -384,6 +384,8 @@ Set the debugging level (the amount of debugging output printed). The default debug level is ``0``, meaning no debugging output is printed. + .. versionadded:: 2.7 + .. method:: HTTPConnection.connect() Modified: python/branches/py3k/Doc/library/os.rst ============================================================================== --- python/branches/py3k/Doc/library/os.rst (original) +++ python/branches/py3k/Doc/library/os.rst Tue Jun 2 00:42:33 2009 @@ -386,9 +386,9 @@ .. note:: This function is intended for low-level I/O and must be applied to a file - descriptor as returned by :func:`open` or :func:`pipe`. To close a "file + descriptor as returned by :func:`os.open` or :func:`pipe`. To close a "file object" returned by the built-in function :func:`open` or by :func:`popen` or - :func:`fdopen`, use its :meth:`close` method. + :func:`fdopen`, use its :meth:`~file.close` method. .. function:: closerange(fd_low, fd_high) @@ -439,6 +439,9 @@ Force write of file with filedescriptor *fd* to disk. Does not force update of metadata. Availability: Unix. + .. note:: + This function is not available on MacOS. + .. function:: fpathconf(fd, name) @@ -514,8 +517,8 @@ .. note:: This function is intended for low-level I/O. For normal usage, use the built-in - function :func:`open`, which returns a "file object" with :meth:`read` and - :meth:`write` methods (and many more). To wrap a file descriptor in a "file + function :func:`open`, which returns a "file object" with :meth:`~file.read` and + :meth:`~file.write` methods (and many more). To wrap a file descriptor in a "file object", use :func:`fdopen`. @@ -544,22 +547,22 @@ .. note:: This function is intended for low-level I/O and must be applied to a file - descriptor as returned by :func:`open` or :func:`pipe`. To read a "file object" + descriptor as returned by :func:`os.open` or :func:`pipe`. To read a "file object" returned by the built-in function :func:`open` or by :func:`popen` or - :func:`fdopen`, or :data:`sys.stdin`, use its :meth:`read` or :meth:`readline` - methods. + :func:`fdopen`, or :data:`sys.stdin`, use its :meth:`~file.read` or + :meth:`~file.readline` methods. .. function:: tcgetpgrp(fd) Return the process group associated with the terminal given by *fd* (an open - file descriptor as returned by :func:`open`). Availability: Unix. + file descriptor as returned by :func:`os.open`). Availability: Unix. .. function:: tcsetpgrp(fd, pg) Set the process group associated with the terminal given by *fd* (an open file - descriptor as returned by :func:`open`) to *pg*. Availability: Unix. + descriptor as returned by :func:`os.open`) to *pg*. Availability: Unix. .. function:: ttyname(fd) @@ -577,13 +580,13 @@ .. note:: This function is intended for low-level I/O and must be applied to a file - descriptor as returned by :func:`open` or :func:`pipe`. To write a "file + descriptor as returned by :func:`os.open` or :func:`pipe`. To write a "file object" returned by the built-in function :func:`open` or by :func:`popen` or - :func:`fdopen`, or :data:`sys.stdout` or :data:`sys.stderr`, use its :meth:`write` - method. + :func:`fdopen`, or :data:`sys.stdout` or :data:`sys.stderr`, use its + :meth:`~file.write` method. The following constants are options for the *flags* parameter to the -:func:`open` function. They can be combined using the bitwise OR operator +:func:`~os.open` function. They can be combined using the bitwise OR operator ``|``. Some of them are not available on all platforms. For descriptions of their availability and use, consult the :manpage:`open(2)` manual page on Unix or `the MSDN ` on Windows. @@ -660,7 +663,7 @@ .. note:: Using :func:`access` to check if a user is authorized to e.g. open a file before - actually doing so using :func:`open` creates a security hole, because the user + actually doing so using :func:`open` creates a security hole, because the user might exploit the short time interval between checking and opening the file to manipulate it. Modified: python/branches/py3k/Doc/library/rlcompleter.rst ============================================================================== --- python/branches/py3k/Doc/library/rlcompleter.rst (original) +++ python/branches/py3k/Doc/library/rlcompleter.rst Tue Jun 2 00:42:33 2009 @@ -52,7 +52,7 @@ .. method:: Completer.complete(text, state) - Return the *state*th completion for *text*. + Return the *state*\ th completion for *text*. If called for *text* that doesn't include a period character (``'.'``), it will complete from names currently defined in :mod:`__main__`, :mod:`builtins` and Modified: python/branches/py3k/Doc/library/smtplib.rst ============================================================================== --- python/branches/py3k/Doc/library/smtplib.rst (original) +++ python/branches/py3k/Doc/library/smtplib.rst Tue Jun 2 00:42:33 2009 @@ -364,3 +364,8 @@ server.sendmail(fromaddr, toaddrs, msg) server.quit() +.. note:: + + In general, you will want to use the :mod:`email` package's features to + construct an email message, which you can then convert to a string and send + via :meth:`sendmail`; see :ref:`email-examples`. Modified: python/branches/py3k/Doc/library/subprocess.rst ============================================================================== --- python/branches/py3k/Doc/library/subprocess.rst (original) +++ python/branches/py3k/Doc/library/subprocess.rst Tue Jun 2 00:42:33 2009 @@ -34,9 +34,12 @@ Arguments are: *args* should be a string, or a sequence of program arguments. The program - to execute is normally the first item in the args sequence or the string if a - string is given, but can be explicitly set by using the *executable* - argument. + to execute is normally the first item in the args sequence or the string if + a string is given, but can be explicitly set by using the *executable* + argument. When *executable* is given, the first item in the args sequence + is still treated by most programs as the command name, which can then be + different from the actual executable name. On Unix, it becomes the display + name for the executing program in utilities such as :program:`ps`. On Unix, with *shell=False* (default): In this case, the Popen class uses :meth:`os.execvp` to execute the child program. *args* should normally be a Modified: python/branches/py3k/Doc/reference/simple_stmts.rst ============================================================================== --- python/branches/py3k/Doc/reference/simple_stmts.rst (original) +++ python/branches/py3k/Doc/reference/simple_stmts.rst Tue Jun 2 00:42:33 2009 @@ -815,12 +815,8 @@ imprt mod`` from within ``pkg.subpkg1`` you will import ``pkg.subpkg2.mod``. The specification for relative imports is contained within :pep:`328`. - -.. index:: builtin: __import__ - -The built-in function :func:`__import__` is provided to support applications -that determine which modules need to be loaded dynamically; refer to -:ref:`built-in-funcs` for additional information. +:func:`importlib.import_module` is provided to support applications that +determine which modules need to be loaded dynamically. .. _future: Modified: python/branches/py3k/Lib/gettext.py ============================================================================== --- python/branches/py3k/Lib/gettext.py (original) +++ python/branches/py3k/Lib/gettext.py Tue Jun 2 00:42:33 2009 @@ -415,7 +415,6 @@ if fallback: return NullTranslations() raise IOError(ENOENT, 'No translation file found for domain', domain) - # TBD: do we need to worry about the file pointer getting collected? # Avoid opening, reading, and parsing the .mo file after it's been done # once. result = None @@ -423,7 +422,8 @@ key = os.path.abspath(mofile) t = _translations.get(key) if t is None: - t = _translations.setdefault(key, class_(open(mofile, 'rb'))) + with open(mofile, 'rb') as fp: + t = _translations.setdefault(key, class_(fp)) # Copy the translation object to allow setting fallbacks and # output charset. All other instance data is shared with the # cached object. Modified: python/branches/py3k/Lib/idlelib/macosxSupport.py ============================================================================== --- python/branches/py3k/Lib/idlelib/macosxSupport.py (original) +++ python/branches/py3k/Lib/idlelib/macosxSupport.py Tue Jun 2 00:42:33 2009 @@ -88,6 +88,7 @@ # on an EditorWindow instance that is then passed as the first # argument to ConfigDialog) root.instance_dict = flist.inversedict + root.instance_dict = flist.inversedict configDialog.ConfigDialog(root, 'Settings') Modified: python/branches/py3k/Lib/logging/__init__.py ============================================================================== --- python/branches/py3k/Lib/logging/__init__.py (original) +++ python/branches/py3k/Lib/logging/__init__.py Tue Jun 2 00:42:33 2009 @@ -720,8 +720,12 @@ """ if raiseExceptions: ei = sys.exc_info() - traceback.print_exception(ei[0], ei[1], ei[2], None, sys.stderr) - del ei + try: + traceback.print_exception(ei[0], ei[1], ei[2], None, sys.stderr) + except IOError: + pass # see issue 5971 + finally: + del ei class StreamHandler(Handler): """ Modified: python/branches/py3k/Lib/test/support.py ============================================================================== --- python/branches/py3k/Lib/test/support.py (original) +++ python/branches/py3k/Lib/test/support.py Tue Jun 2 00:42:33 2009 @@ -5,6 +5,7 @@ import contextlib import errno +import functools import socket import sys import os @@ -933,6 +934,16 @@ count += 1 time.sleep(0.1) +def reap_threads(func): + @functools.wraps(func) + def decorator(*args): + key = threading_setup() + try: + return func(*args) + finally: + threading_cleanup(*key) + return decorator + def reap_children(): """Use this function at the end of test_main() whenever sub-processes are started. This will help ensure that no extra children (zombies) Modified: python/branches/py3k/Lib/test/test_hashlib.py ============================================================================== --- python/branches/py3k/Lib/test/test_hashlib.py (original) +++ python/branches/py3k/Lib/test/test_hashlib.py Tue Jun 2 00:42:33 2009 @@ -267,10 +267,9 @@ self.assertEqual(expected_hash, hasher.hexdigest()) - + at support.reap_threads def test_main(): support.run_unittest(HashLibTestCase) - if __name__ == "__main__": test_main() Modified: python/branches/py3k/Lib/test/test_os.py ============================================================================== --- python/branches/py3k/Lib/test/test_os.py (original) +++ python/branches/py3k/Lib/test/test_os.py Tue Jun 2 00:42:33 2009 @@ -35,9 +35,7 @@ retries += 1 if retries > 10: # XXX test skipped - print("couldn't allocate two consecutive fds, " - "skipping test_closerange", file=sys.stderr) - return + self.skipTest("couldn't allocate two consecutive fds") first, second = second, os.dup(second) finally: os.close(second) Modified: python/branches/py3k/Lib/test/test_unittest.py ============================================================================== --- python/branches/py3k/Lib/test/test_unittest.py (original) +++ python/branches/py3k/Lib/test/test_unittest.py Tue Jun 2 00:42:33 2009 @@ -3175,7 +3175,7 @@ result = MockResult() test = TestableTest('testNothing') - test._result = result + test._resultForDoCleanups = result exc1 = Exception('foo') exc2 = Exception('bar') Modified: python/branches/py3k/Lib/unittest.py ============================================================================== --- python/branches/py3k/Lib/unittest.py (original) +++ python/branches/py3k/Lib/unittest.py Tue Jun 2 00:42:33 2009 @@ -353,7 +353,7 @@ not have a method with the specified name. """ self._testMethodName = methodName - self._result = None + self._resultForDoCleanups = None try: testMethod = getattr(self, methodName) except AttributeError: @@ -457,7 +457,7 @@ if startTestRun is not None: startTestRun() - self._result = result + self._resultForDoCleanups = result result.startTest(self) if getattr(self.__class__, "__unittest_skip__", False): # If the whole class was skipped. @@ -511,7 +511,7 @@ def doCleanups(self): """Execute all cleanup functions. Normally called for you after tearDown.""" - result = self._result + result = self._resultForDoCleanups ok = True while self._cleanups: function, args, kwargs = self._cleanups.pop(-1) @@ -732,23 +732,32 @@ if seq1 == seq2: return + seq1_repr = repr(seq1) + seq2_repr = repr(seq2) + if len(seq1_repr) > 30: + seq1_repr = seq1_repr[:30] + '...' + if len(seq2_repr) > 30: + seq2_repr = seq2_repr[:30] + '...' + elements = (seq_type_name.capitalize(), seq1_repr, seq2_repr) + differing = '%ss differ: %s != %s\n' % elements + for i in range(min(len1, len2)): try: item1 = seq1[i] except (TypeError, IndexError, NotImplementedError): - differing = ('Unable to index element %d of first %s\n' % + differing += ('\nUnable to index element %d of first %s\n' % (i, seq_type_name)) break try: item2 = seq2[i] except (TypeError, IndexError, NotImplementedError): - differing = ('Unable to index element %d of second %s\n' % + differing += ('\nUnable to index element %d of second %s\n' % (i, seq_type_name)) break if item1 != item2: - differing = ('First differing element %d:\n%s\n%s\n' % + differing += ('\nFirst differing element %d:\n%s\n%s\n' % (i, item1, item2)) break else: @@ -756,28 +765,26 @@ type(seq1) != type(seq2)): # The sequences are the same, but have differing types. return - # A catch-all message for handling arbitrary user-defined - # sequences. - differing = '%ss differ:\n' % seq_type_name.capitalize() - if len1 > len2: - differing = ('First %s contains %d additional ' - 'elements.\n' % (seq_type_name, len1 - len2)) - try: - differing += ('First extra element %d:\n%s\n' % - (len2, seq1[len2])) - except (TypeError, IndexError, NotImplementedError): - differing += ('Unable to index element %d ' - 'of first %s\n' % (len2, seq_type_name)) - elif len1 < len2: - differing = ('Second %s contains %d additional ' - 'elements.\n' % (seq_type_name, len2 - len1)) - try: - differing += ('First extra element %d:\n%s\n' % - (len1, seq2[len1])) - except (TypeError, IndexError, NotImplementedError): - differing += ('Unable to index element %d ' - 'of second %s\n' % (len1, seq_type_name)) - standardMsg = differing + '\n'.join(difflib.ndiff(pprint.pformat(seq1).splitlines(), + + if len1 > len2: + differing += ('\nFirst %s contains %d additional ' + 'elements.\n' % (seq_type_name, len1 - len2)) + try: + differing += ('First extra element %d:\n%s\n' % + (len2, seq1[len2])) + except (TypeError, IndexError, NotImplementedError): + differing += ('Unable to index element %d ' + 'of first %s\n' % (len2, seq_type_name)) + elif len1 < len2: + differing += ('\nSecond %s contains %d additional ' + 'elements.\n' % (seq_type_name, len2 - len1)) + try: + differing += ('First extra element %d:\n%s\n' % + (len1, seq2[len1])) + except (TypeError, IndexError, NotImplementedError): + differing += ('Unable to index element %d ' + 'of second %s\n' % (len1, seq_type_name)) + standardMsg = differing + '\n' + '\n'.join(difflib.ndiff(pprint.pformat(seq1).splitlines(), pprint.pformat(seq2).splitlines())) msg = self._formatMessage(msg, standardMsg) self.fail(msg) Modified: python/branches/py3k/Lib/zipfile.py ============================================================================== --- python/branches/py3k/Lib/zipfile.py (original) +++ python/branches/py3k/Lib/zipfile.py Tue Jun 2 00:42:33 2009 @@ -1055,28 +1055,27 @@ self.fp.write(zinfo.FileHeader()) return - fp = io.open(filename, "rb") - # Must overwrite CRC and sizes with correct data later - zinfo.CRC = CRC = 0 - zinfo.compress_size = compress_size = 0 - zinfo.file_size = file_size = 0 - self.fp.write(zinfo.FileHeader()) - if zinfo.compress_type == ZIP_DEFLATED: - cmpr = zlib.compressobj(zlib.Z_DEFAULT_COMPRESSION, - zlib.DEFLATED, -15) - else: - cmpr = None - while 1: - buf = fp.read(1024 * 8) - if not buf: - break - file_size = file_size + len(buf) - CRC = crc32(buf, CRC) & 0xffffffff - if cmpr: - buf = cmpr.compress(buf) - compress_size = compress_size + len(buf) - self.fp.write(buf) - fp.close() + with open(filename, "rb") as fp: + # Must overwrite CRC and sizes with correct data later + zinfo.CRC = CRC = 0 + zinfo.compress_size = compress_size = 0 + zinfo.file_size = file_size = 0 + self.fp.write(zinfo.FileHeader()) + if zinfo.compress_type == ZIP_DEFLATED: + cmpr = zlib.compressobj(zlib.Z_DEFAULT_COMPRESSION, + zlib.DEFLATED, -15) + else: + cmpr = None + while 1: + buf = fp.read(1024 * 8) + if not buf: + break + file_size = file_size + len(buf) + CRC = crc32(buf, CRC) & 0xffffffff + if cmpr: + buf = cmpr.compress(buf) + compress_size = compress_size + len(buf) + self.fp.write(buf) if cmpr: buf = cmpr.flush() compress_size = compress_size + len(buf) @@ -1400,9 +1399,8 @@ tgtdir = os.path.dirname(tgt) if not os.path.exists(tgtdir): os.makedirs(tgtdir) - fp = io.open(tgt, 'wb') - fp.write(zf.read(path)) - fp.close() + with open(tgt, 'wb') as fp: + fp.write(zf.read(path)) zf.close() elif args[0] == '-c': Modified: python/branches/py3k/Tools/freeze/makeconfig.py ============================================================================== --- python/branches/py3k/Tools/freeze/makeconfig.py (original) +++ python/branches/py3k/Tools/freeze/makeconfig.py Tue Jun 2 00:42:33 2009 @@ -3,7 +3,7 @@ # Write the config.c file -never = ['marshal', '__main__', 'builtins', 'sys', 'exceptions'] +never = ['marshal', '__main__', 'builtins', 'sys', 'exceptions', '_warnings'] def makeconfig(infp, outfp, modules, with_ifdef=0): m1 = re.compile('-- ADDMODULE MARKER 1 --') From ziade.tarek at gmail.com Tue Jun 2 00:50:58 2009 From: ziade.tarek at gmail.com (=?ISO-8859-1?Q?Tarek_Ziad=E9?=) Date: Tue, 2 Jun 2009 00:50:58 +0200 Subject: [Python-checkins] r73119 - python/branches/release26-maint/Objects/frameobject.c In-Reply-To: <20090601221739.F186AD358@mail.python.org> References: <20090601221739.F186AD358@mail.python.org> Message-ID: <94bdd2610906011550q62988afs11d71ad9b1f52775@mail.gmail.com> Looks like Python cannot compile anymore under debian with the changes on frameobject.c : ... gcc -pthread -c -fno-strict-aliasing -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I. -IInclude -I./Include -DPy_BUILD_CORE -o Objects/frameobject.o Objects/frameobject.c Objects/frameobject.c: In function ?frame_setlineno?: Objects/frameobject.c:151: error: invalid lvalue in unary ?&? make: *** [Objects/frameobject.o] Erreur 1 On Tue, Jun 2, 2009 at 12:17 AM, amaury.forgeotdarc wrote: > Author: amaury.forgeotdarc > Date: Tue Jun ?2 00:17:39 2009 > New Revision: 73119 > > Log: > #4547 again: fix a typo that causes compilation warnings > > > Modified: > ? python/branches/release26-maint/Objects/frameobject.c > > Modified: python/branches/release26-maint/Objects/frameobject.c > ============================================================================== > --- python/branches/release26-maint/Objects/frameobject.c ? ? ? (original) > +++ python/branches/release26-maint/Objects/frameobject.c ? ? ? Tue Jun ?2 00:17:39 2009 > @@ -114,8 +114,8 @@ > > ? ? ? ?/* Find the bytecode offset for the start of the given line, or the > ? ? ? ? * first code-owning line after it. */ > - ? ? ? PyString_AsStringAndSize((char*)f->f_code->co_lnotab, > - ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?&lnotab, &lnotab_len); > + ? ? ? PyString_AsStringAndSize(f->f_code->co_lnotab, > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?&(char*)lnotab, &lnotab_len); > ? ? ? ?addr = 0; > ? ? ? ?line = f->f_code->co_firstlineno; > ? ? ? ?new_lasti = -1; > _______________________________________________ > Python-checkins mailing list > Python-checkins at python.org > http://mail.python.org/mailman/listinfo/python-checkins > -- Tarek Ziad? | http://ziade.org From python-checkins at python.org Tue Jun 2 00:59:00 2009 From: python-checkins at python.org (benjamin.peterson) Date: Tue, 2 Jun 2009 00:59:00 +0200 (CEST) Subject: [Python-checkins] r73126 - python/branches/py3k Message-ID: <20090601225900.BDDD7D35A@mail.python.org> Author: benjamin.peterson Date: Tue Jun 2 00:59:00 2009 New Revision: 73126 Log: Blocked revisions 72786 via svnmerge ........ r72786 | raymond.hettinger | 2009-05-19 12:43:59 -0500 (Tue, 19 May 2009) | 1 line Note that ordered dictionaries work with reversed(). ........ Modified: python/branches/py3k/ (props changed) From python-checkins at python.org Tue Jun 2 01:09:51 2009 From: python-checkins at python.org (benjamin.peterson) Date: Tue, 2 Jun 2009 01:09:51 +0200 (CEST) Subject: [Python-checkins] r73127 - python/branches/py3k Message-ID: <20090601230951.58B27D8A9@mail.python.org> Author: benjamin.peterson Date: Tue Jun 2 01:09:51 2009 New Revision: 73127 Log: Blocked revisions 73076 via svnmerge ........ r73076 | antoine.pitrou | 2009-05-31 13:05:51 -0500 (Sun, 31 May 2009) | 4 lines Uninitialized file type would lead to __exit__ lookup failure when site.py tries to read *.pth files on interpreter startup. ........ Modified: python/branches/py3k/ (props changed) From python-checkins at python.org Tue Jun 2 01:14:51 2009 From: python-checkins at python.org (benjamin.peterson) Date: Tue, 2 Jun 2009 01:14:51 +0200 (CEST) Subject: [Python-checkins] r73128 - in python/branches/py3k: Doc/howto/regex.rst Lib/multiprocessing/synchronize.py Lib/test/support.py Message-ID: <20090601231451.BC360C419@mail.python.org> Author: benjamin.peterson Date: Tue Jun 2 01:14:51 2009 New Revision: 73128 Log: Merged revisions 73073-73074,73089 via svnmerge from svn+ssh://pythondev at svn.python.org/python/trunk ........ r73073 | benjamin.peterson | 2009-05-31 09:43:00 -0500 (Sun, 31 May 2009) | 1 line remove function import ........ r73074 | benjamin.peterson | 2009-05-31 10:00:27 -0500 (Sun, 31 May 2009) | 1 line __enter__ and __exit__ must be on the class ........ r73089 | andrew.kuchling | 2009-05-31 19:14:19 -0500 (Sun, 31 May 2009) | 1 line The class for regexes isn't called RegexObject any more; correct the text ........ Modified: python/branches/py3k/ (props changed) python/branches/py3k/Doc/howto/regex.rst python/branches/py3k/Lib/multiprocessing/synchronize.py python/branches/py3k/Lib/test/support.py Modified: python/branches/py3k/Doc/howto/regex.rst ============================================================================== --- python/branches/py3k/Doc/howto/regex.rst (original) +++ python/branches/py3k/Doc/howto/regex.rst Tue Jun 2 01:14:51 2009 @@ -257,7 +257,7 @@ Compiling Regular Expressions ----------------------------- -Regular expressions are compiled into :class:`RegexObject` instances, which have +Regular expressions are compiled into pattern objects, which have methods for various operations such as searching for pattern matches or performing string substitutions. :: @@ -336,7 +336,7 @@ ------------------ Once you have an object representing a compiled regular expression, what do you -do with it? :class:`RegexObject` instances have several methods and attributes. +do with it? Pattern objects have several methods and attributes. Only the most significant ones will be covered here; consult the :mod:`re` docs for a complete listing. @@ -427,8 +427,8 @@ and :meth:`end` return the starting and ending index of the match. :meth:`span` returns both start and end indexes in a single tuple. Since the :meth:`match` method only checks if the RE matches at the start of a string, :meth:`start` -will always be zero. However, the :meth:`search` method of :class:`RegexObject` -instances scans through the string, so the match may not start at zero in that +will always be zero. However, the :meth:`search` method of patterns +scans through the string, so the match may not start at zero in that case. :: >>> print(p.match('::: message')) @@ -450,7 +450,7 @@ else: print('No match') -Two :class:`RegexObject` methods return all of the matches for a pattern. +Two pattern methods return all of the matches for a pattern. :meth:`findall` returns a list of matching strings:: >>> p = re.compile('\d+') @@ -475,10 +475,10 @@ Module-Level Functions ---------------------- -You don't have to create a :class:`RegexObject` and call its methods; the +You don't have to create a pattern object and call its methods; the :mod:`re` module also provides top-level functions called :func:`match`, :func:`search`, :func:`findall`, :func:`sub`, and so forth. These functions -take the same arguments as the corresponding :class:`RegexObject` method, with +take the same arguments as the corresponding pattern method, with the RE string added as the first argument, and still return either ``None`` or a :class:`MatchObject` instance. :: @@ -487,12 +487,12 @@ >>> re.match(r'From\s+', 'From amk Thu May 14 19:12:10 1998') -Under the hood, these functions simply produce a :class:`RegexObject` for you +Under the hood, these functions simply create a pattern object for you and call the appropriate method on it. They also store the compiled object in a cache, so future calls using the same RE are faster. Should you use these module-level functions, or should you get the -:class:`RegexObject` and call its methods yourself? That choice depends on how +pattern and call its methods yourself? That choice depends on how frequently the RE will be used, and on your personal coding style. If the RE is being used at only one point in the code, then the module functions are probably more convenient. If a program contains a lot of regular expressions, or re-uses @@ -1031,7 +1031,7 @@ Up to this point, we've simply performed searches against a static string. Regular expressions are also commonly used to modify strings in various ways, -using the following :class:`RegexObject` methods: +using the following pattern methods: +------------------+-----------------------------------------------+ | Method/Attribute | Purpose | @@ -1051,7 +1051,7 @@ Splitting Strings ----------------- -The :meth:`split` method of a :class:`RegexObject` splits a string apart +The :meth:`split` method of a pattern splits a string apart wherever the RE matches, returning a list of the pieces. It's similar to the :meth:`split` method of strings but provides much more generality in the delimiters that you can split by; :meth:`split` only supports splitting by @@ -1196,10 +1196,10 @@ 'Call 0xffd2 for printing, 0xc000 for user code.' When using the module-level :func:`re.sub` function, the pattern is passed as -the first argument. The pattern may be a string or a :class:`RegexObject`; if +the first argument. The pattern may be provided as an object or as a string; if you need to specify regular expression flags, you must either use a -:class:`RegexObject` as the first parameter, or use embedded modifiers in the -pattern, e.g. ``sub("(?i)b+", "x", "bbbb BBBB")`` returns ``'x x'``. +pattern object as the first parameter, or use embedded modifiers in the +pattern string, e.g. ``sub("(?i)b+", "x", "bbbb BBBB")`` returns ``'x x'``. Common Problems Modified: python/branches/py3k/Lib/multiprocessing/synchronize.py ============================================================================== --- python/branches/py3k/Lib/multiprocessing/synchronize.py (original) +++ python/branches/py3k/Lib/multiprocessing/synchronize.py Tue Jun 2 01:14:51 2009 @@ -58,8 +58,12 @@ def _make_methods(self): self.acquire = self._semlock.acquire self.release = self._semlock.release - self.__enter__ = self._semlock.__enter__ - self.__exit__ = self._semlock.__exit__ + + def __enter__(self): + return self._semlock.__enter__() + + def __exit__(self, *args): + return self._semlock.__exit__(*args) def __getstate__(self): assert_spawning(self) @@ -181,11 +185,15 @@ self._woken_count, self._wait_semaphore) = state self._make_methods() + def __enter__(self): + return self._lock.__enter__() + + def __exit__(self, *args): + return self._lock.__exit__(*args) + def _make_methods(self): self.acquire = self._lock.acquire self.release = self._lock.release - self.__enter__ = self._lock.__enter__ - self.__exit__ = self._lock.__exit__ def __repr__(self): try: Modified: python/branches/py3k/Lib/test/support.py ============================================================================== --- python/branches/py3k/Lib/test/support.py (original) +++ python/branches/py3k/Lib/test/support.py Tue Jun 2 01:14:51 2009 @@ -6,6 +6,7 @@ import contextlib import errno import functools +import gc import socket import sys import os @@ -630,7 +631,6 @@ longer than expected. This function tries its best to force all garbage objects to disappear. """ - import gc gc.collect() gc.collect() gc.collect() From python-checkins at python.org Tue Jun 2 01:23:16 2009 From: python-checkins at python.org (antoine.pitrou) Date: Tue, 2 Jun 2009 01:23:16 +0200 (CEST) Subject: [Python-checkins] r73129 - python/trunk/Objects/frameobject.c Message-ID: <20090601232316.7DECAD30D@mail.python.org> Author: antoine.pitrou Date: Tue Jun 2 01:23:16 2009 New Revision: 73129 Log: Fix compilation error with gcc 4.3.2 Modified: python/trunk/Objects/frameobject.c Modified: python/trunk/Objects/frameobject.c ============================================================================== --- python/trunk/Objects/frameobject.c (original) +++ python/trunk/Objects/frameobject.c Tue Jun 2 01:23:16 2009 @@ -147,8 +147,10 @@ else { /* Find the bytecode offset for the start of the given * line, or the first code-owning line after it. */ + char *tmp; PyString_AsStringAndSize(f->f_code->co_lnotab, - &(char*)lnotab, &lnotab_len); + &tmp, &lnotab_len); + lnotab = (unsigned char *) tmp; addr = 0; line = f->f_code->co_firstlineno; new_lasti = -1; From python-checkins at python.org Tue Jun 2 01:27:15 2009 From: python-checkins at python.org (antoine.pitrou) Date: Tue, 2 Jun 2009 01:27:15 +0200 (CEST) Subject: [Python-checkins] r73130 - in python/branches/release26-maint: Objects/frameobject.c Message-ID: <20090601232715.8C56DD3E0@mail.python.org> Author: antoine.pitrou Date: Tue Jun 2 01:27:15 2009 New Revision: 73130 Log: Merged revisions 73129 via svnmerge from svn+ssh://pythondev at svn.python.org/python/trunk ........ r73129 | antoine.pitrou | 2009-06-02 01:23:16 +0200 (mar., 02 juin 2009) | 3 lines Fix compilation error with gcc 4.3.2 ........ Modified: python/branches/release26-maint/ (props changed) python/branches/release26-maint/Objects/frameobject.c Modified: python/branches/release26-maint/Objects/frameobject.c ============================================================================== --- python/branches/release26-maint/Objects/frameobject.c (original) +++ python/branches/release26-maint/Objects/frameobject.c Tue Jun 2 01:27:15 2009 @@ -86,6 +86,7 @@ int in_finally[CO_MAXBLOCKS]; /* (ditto) */ int blockstack_top = 0; /* (ditto) */ unsigned char setup_op = 0; /* (ditto) */ + char *tmp; /* f_lineno must be an integer. */ if (!PyInt_Check(p_new_lineno)) { @@ -115,7 +116,8 @@ /* Find the bytecode offset for the start of the given line, or the * first code-owning line after it. */ PyString_AsStringAndSize(f->f_code->co_lnotab, - &(char*)lnotab, &lnotab_len); + &tmp, &lnotab_len); + lnotab = (unsigned char *) tmp; addr = 0; line = f->f_code->co_firstlineno; new_lasti = -1; From python-checkins at python.org Tue Jun 2 01:29:07 2009 From: python-checkins at python.org (antoine.pitrou) Date: Tue, 2 Jun 2009 01:29:07 +0200 (CEST) Subject: [Python-checkins] r73131 - in python/branches/py3k: Objects/frameobject.c Message-ID: <20090601232907.4F64FD3E0@mail.python.org> Author: antoine.pitrou Date: Tue Jun 2 01:29:07 2009 New Revision: 73131 Log: Merged revisions 73129 via svnmerge from svn+ssh://pythondev at svn.python.org/python/trunk ........ r73129 | antoine.pitrou | 2009-06-02 01:23:16 +0200 (mar., 02 juin 2009) | 3 lines Fix compilation error with gcc 4.3.2 ........ Modified: python/branches/py3k/ (props changed) python/branches/py3k/Objects/frameobject.c Modified: python/branches/py3k/Objects/frameobject.c ============================================================================== --- python/branches/py3k/Objects/frameobject.c (original) +++ python/branches/py3k/Objects/frameobject.c Tue Jun 2 01:29:07 2009 @@ -130,8 +130,10 @@ else { /* Find the bytecode offset for the start of the given * line, or the first code-owning line after it. */ + char *tmp; PyBytes_AsStringAndSize(f->f_code->co_lnotab, - &(char*)lnotab, &lnotab_len); + &tmp, &lnotab_len); + lnotab = (unsigned char *) tmp; addr = 0; line = f->f_code->co_firstlineno; new_lasti = -1; From python-checkins at python.org Tue Jun 2 01:35:11 2009 From: python-checkins at python.org (antoine.pitrou) Date: Tue, 2 Jun 2009 01:35:11 +0200 (CEST) Subject: [Python-checkins] r73132 - in python/branches/release30-maint: Objects/frameobject.c Message-ID: <20090601233511.F3C10D3E2@mail.python.org> Author: antoine.pitrou Date: Tue Jun 2 01:35:11 2009 New Revision: 73132 Log: Merged revisions 73131 via svnmerge from svn+ssh://pythondev at svn.python.org/python/branches/py3k ................ r73131 | antoine.pitrou | 2009-06-02 01:29:07 +0200 (mar., 02 juin 2009) | 9 lines Merged revisions 73129 via svnmerge from svn+ssh://pythondev at svn.python.org/python/trunk ........ r73129 | antoine.pitrou | 2009-06-02 01:23:16 +0200 (mar., 02 juin 2009) | 3 lines Fix compilation error with gcc 4.3.2 ........ ................ Modified: python/branches/release30-maint/ (props changed) python/branches/release30-maint/Objects/frameobject.c Modified: python/branches/release30-maint/Objects/frameobject.c ============================================================================== --- python/branches/release30-maint/Objects/frameobject.c (original) +++ python/branches/release30-maint/Objects/frameobject.c Tue Jun 2 01:35:11 2009 @@ -85,6 +85,7 @@ int in_finally[CO_MAXBLOCKS]; /* (ditto) */ int blockstack_top = 0; /* (ditto) */ unsigned char setup_op = 0; /* (ditto) */ + char *tmp; /* f_lineno must be an integer. */ if (!PyLong_CheckExact(p_new_lineno)) { @@ -126,7 +127,8 @@ /* Find the bytecode offset for the start of the given line, or the * first code-owning line after it. */ PyBytes_AsStringAndSize(f->f_code->co_lnotab, - &(char*)lnotab, &lnotab_len); + &tmp, &lnotab_len); + lnotab = (unsigned char *) tmp; addr = 0; line = f->f_code->co_firstlineno; new_lasti = -1; From python-checkins at python.org Tue Jun 2 02:58:55 2009 From: python-checkins at python.org (guilherme.polo) Date: Tue, 2 Jun 2009 02:58:55 +0200 (CEST) Subject: [Python-checkins] r73133 - python/branches/tk_and_idle_maintenance/Lib/lib-tk/test/test_tkinter/test_menu.py Message-ID: <20090602005855.D4124D416@mail.python.org> Author: guilherme.polo Date: Tue Jun 2 02:58:55 2009 New Revision: 73133 Log: Some tests for Tkinter.Menu. Added: python/branches/tk_and_idle_maintenance/Lib/lib-tk/test/test_tkinter/test_menu.py (contents, props changed) Added: python/branches/tk_and_idle_maintenance/Lib/lib-tk/test/test_tkinter/test_menu.py ============================================================================== --- (empty file) +++ python/branches/tk_and_idle_maintenance/Lib/lib-tk/test/test_tkinter/test_menu.py Tue Jun 2 02:58:55 2009 @@ -0,0 +1,137 @@ +import unittest +import Tkinter +from test.test_support import requires, run_unittest +from ttk import setup_master + +requires('gui') + +class MenuTest(unittest.TestCase): + + def setUp(self): + self.root = setup_master() + self.menu = Tkinter.Menu(self.root, tearoff=False) + + def tearDown(self): + self.menu.destroy() + + + def test_menu_creation(self): + test1 = Tkinter.Menu(self.root, tearoff=False) + test1.add_checkbutton(label='Check', indicatoron=True) + test1.add_radiobutton(label='Radio', indicatoron=True) + test1.add_separator() + test1.add_command(label='Cmd', accelerator='C', underline=0) + self.assertRaises(Tkinter.TclError, test1.add_separator, label='sep') + self.assertRaises(Tkinter.TclError, test1.add_separator, + accelerator='X') + + test2 = Tkinter.Menu(self.root, tearoff=True) + test2.insert_checkbutton(1, label='Check') + test2.insert_separator(2) + test2.insert_radiobutton(1, label='Radio') + test2.insert_command(4, label='Cmd') + + self.menu.add_cascade(label='Test1', menu=test1) + self.assertRaises(Tkinter.TclError, self.menu.insert_cascade, -1) + self.menu.insert_cascade(1, label='Test2', menu=test2) + + self.assertEqual(self.menu.type(0), 'cascade') + m1 = self.menu.nametowidget(self.menu.entrycget(0, 'menu')) + self.assertEqual(m1, test1) + self.assertEqual(m1.type(0), 'checkbutton') + self.assertEqual(m1.type(1), 'radiobutton') + self.assertEqual(m1.type(2), 'separator') + self.assertEqual(m1.type(3), 'command') + m2 = self.menu.nametowidget(self.menu.entrycget(1, 'menu')) + self.assertEqual(m2, test2) + self.assertEqual(m2.type(0), 'tearoff') + + self.assertEqual(m1.entrycget(3, 'accelerator'), 'C') + self.assertEqual(m1.entrycget(3, 'underline'), 0) + + def test_delete(self): + self.menu['tearoff'] = True + self.assertRaises(Tkinter.TclError, self.menu.delete, -1) + + self.menu.add_command(label='C1', command=lambda: None) + self.menu.add_command(label='C2', command=lambda: None) + + self.assertIs(self.menu.index('active'), None) + cfg1 = self.menu.entryconfigure(1) + cfg2 = self.menu.entryconfigure(2) + cmds = self.menu._tclCommands[:] + self.menu.delete('active', 'end') + self.assertEqual(self.menu.entryconfigure(1), cfg1) + self.assertEqual(self.menu.entryconfigure(2), cfg2) + self.assertEqual(self.menu._tclCommands, cmds) + + self.menu.activate(1) + self.menu.delete('active') + self.assertIs(self.menu.index('active'), None) + self.assertEqual(len(self.menu._tclCommands), 1) + + self.menu.delete(0, 'last') + self.assertFalse(self.menu._tclCommands) + + def test_entrycget(self): + self.assertRaises(Tkinter.TclError, self.menu.entrycget, -1, 'hi') + self.menu.add_checkbutton(label='Test') + self.menu.add_separator() + self.assertTrue(isinstance(self.menu.entrycget(0, 'state'), str)) + self.assertEqual(self.menu.entrycget(0, 'underline'), -1) + self.assertRaises(Tkinter.TclError, self.menu.entrycget, 1, 'state') + + def test_entryconfigure(self): + self.assertEqual(self.menu.entryconfigure(0), {}) + self.menu.add_separator() + cfg = self.menu.entryconfigure(0) + self.assertTrue(isinstance(cfg, dict)) + key_test = cfg.keys()[0] + self.assertEqual(self.menu.entryconfigure(0, key_test), cfg[key_test]) + + self.assertRaises(Tkinter.TclError, + self.menu.entryconfigure, 0, label='hi') + + def test_index(self): + self.assertIs(self.menu.index(0), None) + self.menu.add_command(label='test') + self.assertEqual(self.menu.index(0), self.menu.index(1)) + self.assertEqual(self.menu.index(0), self.menu.index('last')) + self.assertIs(self.menu.index('active'), None) + self.assertIs(self.menu.index('none'), None) + self.assertRaises(Tkinter.TclError, self.menu.index, -1) + + def test_invoke(self): + self.assertIs(self.menu.invoke(0), '') + + def test(): + return (1, 2, 3) + self.menu.add_command(command=test) + self.assertEqual(self.menu.invoke(0), (1, 2, 3)) + + self.assertRaises(Tkinter.TclError, self.menu.invoke, -1) + + def test_post_unpost(self): + self.menu.add_radiobutton(label='R') + self.menu.add_checkbutton(label='C') + + ypos = self.menu.yposition('last') + self.assertTrue(isinstance(ypos, int)) + self.menu.post(10, 10) + x, y = self.menu.winfo_rootx(), self.menu.winfo_rooty() + self.assertIs(self.menu.index('active'), None) + self.menu.event_generate('', x=0, y=0) + self.menu.event_generate('', x=x, y=y) + # If there is an active item, then we can assume that the menu was + # posted and we moved the mouse over it correctly. + self.assertIsNot(self.menu.index('active'), None) + self.menu.activate(2) + self.menu.unpost() + + # XXX Tkinter.Menu is missing xposition, postcascade and clone methods. + + +tests_gui = (MenuTest, ) + +if __name__ == "__main__": + run_unittest(*tests_gui) From python-checkins at python.org Tue Jun 2 03:25:38 2009 From: python-checkins at python.org (guilherme.polo) Date: Tue, 2 Jun 2009 03:25:38 +0200 (CEST) Subject: [Python-checkins] r73134 - in python/branches/tk_and_idle_maintenance: Doc/howto/regex.rst Lib/distutils/dist.py Lib/distutils/tests/test_dist.py Lib/ipaddr.py Lib/test/test_trace.py Misc/NEWS Objects/frameobject.c Tools/msi/msi.py Message-ID: <20090602012538.B9971D81F@mail.python.org> Author: guilherme.polo Date: Tue Jun 2 03:25:38 2009 New Revision: 73134 Log: Merged revisions 73089,73101,73109,73114,73121,73129 via svnmerge from svn+ssh://pythondev/python/trunk ........ r73089 | andrew.kuchling | 2009-05-31 21:14:19 -0300 (Sun, 31 May 2009) | 1 line The class for regexes isn't called RegexObject any more; correct the text ........ r73101 | martin.v.loewis | 2009-06-01 01:10:03 -0300 (Mon, 01 Jun 2009) | 2 lines Issue #6158: package Sine-1000Hz-300ms.aif. ........ r73109 | gregory.p.smith | 2009-06-01 14:40:41 -0300 (Mon, 01 Jun 2009) | 6 lines Sync up __version__ number with the version of the ipaddr-py project this library came from that it matches. Remove the former apache license text now that its been contributed to PSF to avoid confusion. ........ r73114 | amaury.forgeotdarc | 2009-06-01 17:53:18 -0300 (Mon, 01 Jun 2009) | 3 lines #4547: When debugging a very large function, it was not always possible to update the lineno attribute of the current frame. ........ r73121 | tarek.ziade | 2009-06-01 19:22:13 -0300 (Mon, 01 Jun 2009) | 1 line improved distutils.dist test coverage, pep-8 compliancy ........ r73129 | antoine.pitrou | 2009-06-01 20:23:16 -0300 (Mon, 01 Jun 2009) | 3 lines Fix compilation error with gcc 4.3.2 ........ Modified: python/branches/tk_and_idle_maintenance/ (props changed) python/branches/tk_and_idle_maintenance/Doc/howto/regex.rst python/branches/tk_and_idle_maintenance/Lib/distutils/dist.py python/branches/tk_and_idle_maintenance/Lib/distutils/tests/test_dist.py python/branches/tk_and_idle_maintenance/Lib/ipaddr.py python/branches/tk_and_idle_maintenance/Lib/test/test_trace.py python/branches/tk_and_idle_maintenance/Misc/NEWS python/branches/tk_and_idle_maintenance/Objects/frameobject.c python/branches/tk_and_idle_maintenance/Tools/msi/msi.py Modified: python/branches/tk_and_idle_maintenance/Doc/howto/regex.rst ============================================================================== --- python/branches/tk_and_idle_maintenance/Doc/howto/regex.rst (original) +++ python/branches/tk_and_idle_maintenance/Doc/howto/regex.rst Tue Jun 2 03:25:38 2009 @@ -257,7 +257,7 @@ Compiling Regular Expressions ----------------------------- -Regular expressions are compiled into :class:`RegexObject` instances, which have +Regular expressions are compiled into pattern objects, which have methods for various operations such as searching for pattern matches or performing string substitutions. :: @@ -336,7 +336,7 @@ ------------------ Once you have an object representing a compiled regular expression, what do you -do with it? :class:`RegexObject` instances have several methods and attributes. +do with it? Pattern objects have several methods and attributes. Only the most significant ones will be covered here; consult the :mod:`re` docs for a complete listing. @@ -427,8 +427,8 @@ and :meth:`end` return the starting and ending index of the match. :meth:`span` returns both start and end indexes in a single tuple. Since the :meth:`match` method only checks if the RE matches at the start of a string, :meth:`start` -will always be zero. However, the :meth:`search` method of :class:`RegexObject` -instances scans through the string, so the match may not start at zero in that +will always be zero. However, the :meth:`search` method of patterns +scans through the string, so the match may not start at zero in that case. :: >>> print p.match('::: message') @@ -450,7 +450,7 @@ else: print 'No match' -Two :class:`RegexObject` methods return all of the matches for a pattern. +Two pattern methods return all of the matches for a pattern. :meth:`findall` returns a list of matching strings:: >>> p = re.compile('\d+') @@ -475,10 +475,10 @@ Module-Level Functions ---------------------- -You don't have to create a :class:`RegexObject` and call its methods; the +You don't have to create a pattern object and call its methods; the :mod:`re` module also provides top-level functions called :func:`match`, :func:`search`, :func:`findall`, :func:`sub`, and so forth. These functions -take the same arguments as the corresponding :class:`RegexObject` method, with +take the same arguments as the corresponding pattern method, with the RE string added as the first argument, and still return either ``None`` or a :class:`MatchObject` instance. :: @@ -487,12 +487,12 @@ >>> re.match(r'From\s+', 'From amk Thu May 14 19:12:10 1998') -Under the hood, these functions simply produce a :class:`RegexObject` for you +Under the hood, these functions simply create a pattern object for you and call the appropriate method on it. They also store the compiled object in a cache, so future calls using the same RE are faster. Should you use these module-level functions, or should you get the -:class:`RegexObject` and call its methods yourself? That choice depends on how +pattern and call its methods yourself? That choice depends on how frequently the RE will be used, and on your personal coding style. If the RE is being used at only one point in the code, then the module functions are probably more convenient. If a program contains a lot of regular expressions, or re-uses @@ -1030,7 +1030,7 @@ Up to this point, we've simply performed searches against a static string. Regular expressions are also commonly used to modify strings in various ways, -using the following :class:`RegexObject` methods: +using the following pattern methods: +------------------+-----------------------------------------------+ | Method/Attribute | Purpose | @@ -1050,7 +1050,7 @@ Splitting Strings ----------------- -The :meth:`split` method of a :class:`RegexObject` splits a string apart +The :meth:`split` method of a pattern splits a string apart wherever the RE matches, returning a list of the pieces. It's similar to the :meth:`split` method of strings but provides much more generality in the delimiters that you can split by; :meth:`split` only supports splitting by @@ -1195,10 +1195,10 @@ 'Call 0xffd2 for printing, 0xc000 for user code.' When using the module-level :func:`re.sub` function, the pattern is passed as -the first argument. The pattern may be a string or a :class:`RegexObject`; if +the first argument. The pattern may be provided as an object or as a string; if you need to specify regular expression flags, you must either use a -:class:`RegexObject` as the first parameter, or use embedded modifiers in the -pattern, e.g. ``sub("(?i)b+", "x", "bbbb BBBB")`` returns ``'x x'``. +pattern object as the first parameter, or use embedded modifiers in the +pattern string, e.g. ``sub("(?i)b+", "x", "bbbb BBBB")`` returns ``'x x'``. Common Problems Modified: python/branches/tk_and_idle_maintenance/Lib/distutils/dist.py ============================================================================== --- python/branches/tk_and_idle_maintenance/Lib/distutils/dist.py (original) +++ python/branches/tk_and_idle_maintenance/Lib/distutils/dist.py Tue Jun 2 03:25:38 2009 @@ -6,8 +6,7 @@ __revision__ = "$Id$" -import sys, os, string, re -from types import * +import sys, os, re try: import warnings @@ -251,7 +250,7 @@ # Now work on the rest of the attributes. Any attribute that's # not already defined is invalid! - for (key,val) in attrs.items(): + for (key, val) in attrs.items(): if hasattr(self.metadata, "set_" + key): getattr(self.metadata, "set_" + key)(val) elif hasattr(self.metadata, key): @@ -286,22 +285,24 @@ commands.sort() if header is not None: - print indent + header + self.announce(indent + header) indent = indent + " " if not commands: - print indent + "no commands known yet" + self.announce(indent + "no commands known yet") return for cmd_name in commands: opt_dict = self.command_options.get(cmd_name) if opt_dict is None: - print indent + "no option dict for '%s' command" % cmd_name + self.announce(indent + + "no option dict for '%s' command" % cmd_name) else: - print indent + "option dict for '%s' command:" % cmd_name + self.announce(indent + + "option dict for '%s' command:" % cmd_name) out = pformat(opt_dict) - for line in string.split(out, "\n"): - print indent + " " + line + for line in out.split('\n'): + self.announce(indent + " " + line) # -- Config file finding/parsing methods --------------------------- @@ -352,11 +353,13 @@ if filenames is None: filenames = self.find_config_files() - if DEBUG: print "Distribution.parse_config_files():" + if DEBUG: + self.announce("Distribution.parse_config_files():") parser = ConfigParser() for filename in filenames: - if DEBUG: print " reading", filename + if DEBUG: + self.announce(" reading", filename) parser.read(filename) for section in parser.sections(): options = parser.options(section) @@ -365,7 +368,7 @@ for opt in options: if opt != '__name__': val = parser.get(section,opt) - opt = string.replace(opt, '-', '_') + opt = opt.replace('-', '_') opt_dict[opt] = (filename, val) # Make the ConfigParser forget everything (so we retain @@ -503,7 +506,7 @@ # Also make sure that the command object provides a list of its # known options. if not (hasattr(cmd_class, 'user_options') and - type(cmd_class.user_options) is ListType): + isinstance(cmd_class.user_options, list)): raise DistutilsClassError, \ ("command class %s must provide " + "'user_options' attribute (a list of tuples)") % \ @@ -519,7 +522,7 @@ # Check for help_options in command class. They have a different # format (tuple of four) so we need to preprocess them here. if (hasattr(cmd_class, 'help_options') and - type(cmd_class.help_options) is ListType): + isinstance(cmd_class.help_options, list)): help_options = fix_help_options(cmd_class.help_options) else: help_options = [] @@ -537,14 +540,11 @@ return if (hasattr(cmd_class, 'help_options') and - type(cmd_class.help_options) is ListType): + isinstance(cmd_class.help_options, list)): help_option_found=0 for (help_option, short, desc, func) in cmd_class.help_options: if hasattr(opts, parser.get_attr_name(help_option)): help_option_found=1 - #print "showing help for option %s of command %s" % \ - # (help_option[0],cmd_class) - if callable(func): func() else: @@ -569,17 +569,13 @@ instance, analogous to the .finalize_options() method of Command objects. """ - keywords = self.metadata.keywords - if keywords is not None: - if type(keywords) is StringType: - keywordlist = string.split(keywords, ',') - self.metadata.keywords = map(string.strip, keywordlist) - - platforms = self.metadata.platforms - if platforms is not None: - if type(platforms) is StringType: - platformlist = string.split(platforms, ',') - self.metadata.platforms = map(string.strip, platformlist) + for attr in ('keywords', 'platforms'): + value = getattr(self.metadata, attr) + if value is None: + continue + if isinstance(value, str): + value = [elm.strip() for elm in value.split(',')] + setattr(self.metadata, attr, value) def _show_help(self, parser, global_options=1, display_options=1, commands=[]): @@ -606,31 +602,30 @@ options = self.global_options parser.set_option_table(options) parser.print_help(self.common_usage + "\nGlobal options:") - print + self.announce('') if display_options: parser.set_option_table(self.display_options) parser.print_help( "Information display options (just display " + "information, ignore any commands)") - print + self.announce('') for command in self.commands: - if type(command) is ClassType and issubclass(command, Command): + if isinstance(command, type) and issubclass(command, Command): klass = command else: klass = self.get_command_class(command) if (hasattr(klass, 'help_options') and - type(klass.help_options) is ListType): + isinstance(klass.help_options, list)): parser.set_option_table(klass.user_options + fix_help_options(klass.help_options)) else: parser.set_option_table(klass.user_options) parser.print_help("Options for '%s' command:" % klass.__name__) - print + self.announce('') - print gen_usage(self.script_name) - return + self.announce(gen_usage(self.script_name)) def handle_display_options(self, option_order): """If there were any non-global "display-only" options @@ -645,8 +640,8 @@ # we ignore "foo bar"). if self.help_commands: self.print_commands() - print - print gen_usage(self.script_name) + self.announce('') + self.announce(gen_usage(self.script_name)) return 1 # If user supplied any of the "display metadata" options, then @@ -662,12 +657,12 @@ opt = translate_longopt(opt) value = getattr(self.metadata, "get_"+opt)() if opt in ['keywords', 'platforms']: - print string.join(value, ',') + self.announce(','.join(value)) elif opt in ('classifiers', 'provides', 'requires', 'obsoletes'): - print string.join(value, '\n') + self.announce('\n'.join(value)) else: - print value + self.announce(value) any_display_options = 1 return any_display_options @@ -676,7 +671,7 @@ """Print a subset of the list of all commands -- used by 'print_commands()'. """ - print header + ":" + self.announce(header + ":") for cmd in commands: klass = self.cmdclass.get(cmd) @@ -687,7 +682,7 @@ except AttributeError: description = "(no description available)" - print " %-*s %s" % (max_length, cmd, description) + self.announce(" %-*s %s" % (max_length, cmd, description)) def print_commands(self): """Print out a help message listing all available commands with a @@ -760,11 +755,10 @@ def get_command_packages(self): """Return a list of packages from which commands are loaded.""" pkgs = self.command_packages - if not isinstance(pkgs, type([])): - pkgs = string.split(pkgs or "", ",") - for i in range(len(pkgs)): - pkgs[i] = string.strip(pkgs[i]) - pkgs = filter(None, pkgs) + if not isinstance(pkgs, list): + if pkgs is None: + pkgs = '' + pkgs = [pkg.strip() for pkg in pkgs.split(',') if pkg != ''] if "distutils.command" not in pkgs: pkgs.insert(0, "distutils.command") self.command_packages = pkgs @@ -818,8 +812,8 @@ cmd_obj = self.command_obj.get(command) if not cmd_obj and create: if DEBUG: - print "Distribution.get_command_obj(): " \ - "creating '%s' command object" % command + self.announce("Distribution.get_command_obj(): " \ + "creating '%s' command object" % command) klass = self.get_command_class(command) cmd_obj = self.command_obj[command] = klass(self) @@ -849,9 +843,12 @@ if option_dict is None: option_dict = self.get_option_dict(command_name) - if DEBUG: print " setting options for '%s' command:" % command_name + if DEBUG: + self.announce(" setting options for '%s' command:" % command_name) for (option, (source, value)) in option_dict.items(): - if DEBUG: print " %s = %s (from %s)" % (option, value, source) + if DEBUG: + self.announce(" %s = %s (from %s)" % (option, value, + source)) try: bool_opts = map(translate_longopt, command_obj.boolean_options) except AttributeError: @@ -862,7 +859,7 @@ neg_opt = {} try: - is_string = type(value) is StringType + is_string = isinstance(value, str) if option in neg_opt and is_string: setattr(command_obj, neg_opt[option], not strtobool(value)) elif option in bool_opts and is_string: @@ -1044,10 +1041,10 @@ if self.download_url: self._write_field(file, 'Download-URL', self.download_url) - long_desc = rfc822_escape( self.get_long_description()) + long_desc = rfc822_escape(self.get_long_description()) self._write_field(file, 'Description', long_desc) - keywords = string.join( self.get_keywords(), ',') + keywords = ','.join(self.get_keywords()) if keywords: self._write_field(file, 'Keywords', keywords) Modified: python/branches/tk_and_idle_maintenance/Lib/distutils/tests/test_dist.py ============================================================================== --- python/branches/tk_and_idle_maintenance/Lib/distutils/tests/test_dist.py (original) +++ python/branches/tk_and_idle_maintenance/Lib/distutils/tests/test_dist.py Tue Jun 2 03:25:38 2009 @@ -1,4 +1,4 @@ -# -*- coding: latin-1 -*- +# -*- coding: utf8 -*- """Tests for distutils.dist.""" import os @@ -36,7 +36,9 @@ return self._config_files -class DistributionTestCase(support.TempdirManager, unittest.TestCase): +class DistributionTestCase(support.TempdirManager, + support.LoggingSilencer, + unittest.TestCase): def setUp(self): super(DistributionTestCase, self).setUp() @@ -106,11 +108,11 @@ my_file = os.path.join(tmp_dir, 'f') klass = Distribution - dist = klass(attrs={'author': u'Mister Caf?', + dist = klass(attrs={'author': u'Mister Caf??', 'name': 'my.package', - 'maintainer': u'Caf? Junior', - 'description': u'Caf? torr?fi?', - 'long_description': u'H?h?h?'}) + 'maintainer': u'Caf?? Junior', + 'description': u'Caf?? torr??fi??', + 'long_description': u'H??h??h??'}) # let's make sure the file can be written @@ -151,6 +153,49 @@ self.assertEquals(len(warns), 0) + def test_finalize_options(self): + + attrs = {'keywords': 'one,two', + 'platforms': 'one,two'} + + dist = Distribution(attrs=attrs) + dist.finalize_options() + + # finalize_option splits platforms and keywords + self.assertEquals(dist.metadata.platforms, ['one', 'two']) + self.assertEquals(dist.metadata.keywords, ['one', 'two']) + + def test_show_help(self): + class FancyGetopt(object): + def __init__(self): + self.count = 0 + + def set_option_table(self, *args): + pass + + def print_help(self, *args): + self.count += 1 + + parser = FancyGetopt() + dist = Distribution() + dist.commands = ['sdist'] + dist.script_name = 'setup.py' + dist._show_help(parser) + self.assertEquals(parser.count, 3) + + def test_get_command_packages(self): + dist = Distribution() + self.assertEquals(dist.command_packages, None) + cmds = dist.get_command_packages() + self.assertEquals(cmds, ['distutils.command']) + self.assertEquals(dist.command_packages, + ['distutils.command']) + + dist.command_packages = 'one,two' + cmds = dist.get_command_packages() + self.assertEquals(cmds, ['distutils.command', 'one', 'two']) + + class MetadataTestCase(support.TempdirManager, support.EnvironGuard, unittest.TestCase): Modified: python/branches/tk_and_idle_maintenance/Lib/ipaddr.py ============================================================================== --- python/branches/tk_and_idle_maintenance/Lib/ipaddr.py (original) +++ python/branches/tk_and_idle_maintenance/Lib/ipaddr.py Tue Jun 2 03:25:38 2009 @@ -1,18 +1,6 @@ # Copyright 2007 Google Inc. # Licensed to PSF under a Contributor Agreement. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or -# implied. See the License for the specific language governing -# permissions and limitations under the License. -# # See also: http://code.google.com/p/ipaddr-py/ """An IPv4/IPv6 manipulation library in Python. @@ -22,7 +10,7 @@ """ -__version__ = '1.0.2' +__version__ = '1.1.0' import struct Modified: python/branches/tk_and_idle_maintenance/Lib/test/test_trace.py ============================================================================== --- python/branches/tk_and_idle_maintenance/Lib/test/test_trace.py (original) +++ python/branches/tk_and_idle_maintenance/Lib/test/test_trace.py Tue Jun 2 03:25:38 2009 @@ -740,6 +740,23 @@ def test_19_no_jump_without_trace_function(self): no_jump_without_trace_function() + def test_20_large_function(self): + d = {} + exec("""def f(output): # line 0 + x = 0 # line 1 + y = 1 # line 2 + ''' # line 3 + %s # lines 4-1004 + ''' # line 1005 + x += 1 # line 1006 + output.append(x) # line 1007 + return""" % ('\n' * 1000,), d) + f = d['f'] + + f.jump = (2, 1007) + f.output = [0] + self.run_test(f) + def test_jump_to_firstlineno(self): # This tests that PDB can jump back to the first line in a # file. See issue #1689458. It can only be triggered in a Modified: python/branches/tk_and_idle_maintenance/Misc/NEWS ============================================================================== --- python/branches/tk_and_idle_maintenance/Misc/NEWS (original) +++ python/branches/tk_and_idle_maintenance/Misc/NEWS Tue Jun 2 03:25:38 2009 @@ -12,6 +12,9 @@ Core and Builtins ----------------- +- Issue #4547: When debugging a very large function, it was not always + possible to update the lineno attribute of the current frame. + - Issue #5330: C functions called with keyword arguments were not reported by the various profiling modules (profile, cProfile). Patch by Hagen F?rstenau. Modified: python/branches/tk_and_idle_maintenance/Objects/frameobject.c ============================================================================== --- python/branches/tk_and_idle_maintenance/Objects/frameobject.c (original) +++ python/branches/tk_and_idle_maintenance/Objects/frameobject.c Tue Jun 2 03:25:38 2009 @@ -98,7 +98,7 @@ int new_iblock = 0; /* The new value of f_iblock */ unsigned char *code = NULL; /* The bytecode for the frame... */ Py_ssize_t code_len = 0; /* ...and its length */ - char *lnotab = NULL; /* Iterating over co_lnotab */ + unsigned char *lnotab = NULL; /* Iterating over co_lnotab */ Py_ssize_t lnotab_len = 0; /* (ditto) */ int offset = 0; /* (ditto) */ int line = 0; /* (ditto) */ @@ -147,8 +147,10 @@ else { /* Find the bytecode offset for the start of the given * line, or the first code-owning line after it. */ + char *tmp; PyString_AsStringAndSize(f->f_code->co_lnotab, - &lnotab, &lnotab_len); + &tmp, &lnotab_len); + lnotab = (unsigned char *) tmp; addr = 0; line = f->f_code->co_firstlineno; new_lasti = -1; Modified: python/branches/tk_and_idle_maintenance/Tools/msi/msi.py ============================================================================== --- python/branches/tk_and_idle_maintenance/Tools/msi/msi.py (original) +++ python/branches/tk_and_idle_maintenance/Tools/msi/msi.py Tue Jun 2 03:25:38 2009 @@ -1008,6 +1008,7 @@ lib.add_file("test_difflib_expect.html") lib.add_file("check_soundcard.vbs") lib.add_file("empty.vbs") + lib.add_file("Sine-1000Hz-300ms.aif") lib.glob("*.uue") lib.glob("*.pem") lib.glob("*.pck") From python-checkins at python.org Tue Jun 2 07:25:34 2009 From: python-checkins at python.org (gregory.p.smith) Date: Tue, 2 Jun 2009 07:25:34 +0200 (CEST) Subject: [Python-checkins] r73135 - in python/trunk/Lib: ipaddr.py test/test_ipaddr.py Message-ID: <20090602052534.892FDDB62@mail.python.org> Author: gregory.p.smith Date: Tue Jun 2 07:25:34 2009 New Revision: 73135 Log: Fixes issue6169: it was possible for two ipaddr network addresses to compare as both < and > than eachother. Modified: python/trunk/Lib/ipaddr.py python/trunk/Lib/test/test_ipaddr.py Modified: python/trunk/Lib/ipaddr.py ============================================================================== --- python/trunk/Lib/ipaddr.py (original) +++ python/trunk/Lib/ipaddr.py Tue Jun 2 07:25:34 2009 @@ -10,7 +10,7 @@ """ -__version__ = '1.1.0' +__version__ = '1.1.1' import struct @@ -204,17 +204,25 @@ def __lt__(self, other): try: - return (self.version < other.version - or self.ip < other.ip - or self.netmask < other.netmask) + if self.version != other.version: + return self.version < other.version + if self.ip != other.ip: + return self.ip < other.ip + if self.netmask != other.netmask: + return self.netmask < other.netmask + return False except AttributeError: return NotImplemented def __gt__(self, other): try: - return (self.version > other.version - or self.ip > other.ip - or self.netmask > other.netmask) + if self.version != other.version: + return self.version > other.version + if self.ip != other.ip: + return self.ip > other.ip + if self.netmask != other.netmask: + return self.netmask > other.netmask + return False except AttributeError: return NotImplemented Modified: python/trunk/Lib/test/test_ipaddr.py ============================================================================== --- python/trunk/Lib/test/test_ipaddr.py (original) +++ python/trunk/Lib/test/test_ipaddr.py Tue Jun 2 07:25:34 2009 @@ -1,18 +1,6 @@ # Copyright 2007 Google Inc. # Licensed to PSF under a Contributor Agreement. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# # See also: http://code.google.com/p/ipaddr-py/ """Unittest for ipaddr module.""" @@ -373,6 +361,21 @@ self.assertTrue(ipv6 > ipv4) self.assertTrue(ipv4 < ipv6) + # Regression test for issue6169 (ipaddr-py issue 19) + ip1 = ipaddr.IP('10.1.2.128/25') + self.assertFalse(ip1 < ip1) + self.assertFalse(ip1 > ip1) + ip2 = ipaddr.IP('10.1.3.0/24') + self.assertTrue(ip1 < ip2) + self.assertFalse(ip2 < ip1) + self.assertFalse(ip1 > ip2) + self.assertTrue(ip2 > ip1) + ip3 = ipaddr.IP('10.1.3.0/25') + self.assertTrue(ip2 < ip3) + self.assertFalse(ip3 < ip2) + self.assertFalse(ip2 > ip3) + self.assertTrue(ip3 > ip2) + def test_embedded_ipv4(self): ipv4_string = '192.168.0.1' ipv4 = ipaddr.IPv4(ipv4_string) From python-checkins at python.org Tue Jun 2 07:29:38 2009 From: python-checkins at python.org (gregory.p.smith) Date: Tue, 2 Jun 2009 07:29:38 +0200 (CEST) Subject: [Python-checkins] r73136 - in python/branches/py3k: Lib/ipaddr.py Lib/test/test_ipaddr.py Message-ID: <20090602052938.16CA1D26D@mail.python.org> Author: gregory.p.smith Date: Tue Jun 2 07:29:37 2009 New Revision: 73136 Log: Merged revisions 73135 via svnmerge from svn+ssh://pythondev at svn.python.org/python/trunk ........ r73135 | gregory.p.smith | 2009-06-01 22:25:34 -0700 (Mon, 01 Jun 2009) | 3 lines Fixes issue6169: it was possible for two ipaddr network addresses to compare as both < and > than eachother. ........ Modified: python/branches/py3k/ (props changed) python/branches/py3k/Lib/ipaddr.py python/branches/py3k/Lib/test/test_ipaddr.py Modified: python/branches/py3k/Lib/ipaddr.py ============================================================================== --- python/branches/py3k/Lib/ipaddr.py (original) +++ python/branches/py3k/Lib/ipaddr.py Tue Jun 2 07:29:37 2009 @@ -10,7 +10,7 @@ """ -__version__ = '1.1.0' +__version__ = '1.1.1' import struct @@ -206,17 +206,25 @@ def __lt__(self, other): try: - return (self.version < other.version - or self.ip < other.ip - or self.netmask < other.netmask) + if self.version != other.version: + return self.version < other.version + if self.ip != other.ip: + return self.ip < other.ip + if self.netmask != other.netmask: + return self.netmask < other.netmask + return False except AttributeError: return NotImplemented def __gt__(self, other): try: - return (self.version > other.version - or self.ip > other.ip - or self.netmask > other.netmask) + if self.version != other.version: + return self.version > other.version + if self.ip != other.ip: + return self.ip > other.ip + if self.netmask != other.netmask: + return self.netmask > other.netmask + return False except AttributeError: return NotImplemented Modified: python/branches/py3k/Lib/test/test_ipaddr.py ============================================================================== --- python/branches/py3k/Lib/test/test_ipaddr.py (original) +++ python/branches/py3k/Lib/test/test_ipaddr.py Tue Jun 2 07:29:37 2009 @@ -1,18 +1,6 @@ # Copyright 2007 Google Inc. # Licensed to PSF under a Contributor Agreement. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# # See also: http://code.google.com/p/ipaddr-py/ """Unittest for ipaddr module.""" @@ -393,6 +381,21 @@ self.assertTrue(ipv6 > ipv4) self.assertTrue(ipv4 < ipv6) + # Regression test for issue6169 (ipaddr-py issue 19) + ip1 = ipaddr.IP('10.1.2.128/25') + self.assertFalse(ip1 < ip1) + self.assertFalse(ip1 > ip1) + ip2 = ipaddr.IP('10.1.3.0/24') + self.assertTrue(ip1 < ip2) + self.assertFalse(ip2 < ip1) + self.assertFalse(ip1 > ip2) + self.assertTrue(ip2 > ip1) + ip3 = ipaddr.IP('10.1.3.0/25') + self.assertTrue(ip2 < ip3) + self.assertFalse(ip3 < ip2) + self.assertFalse(ip2 > ip3) + self.assertTrue(ip3 > ip2) + def test_embedded_ipv4(self): ipv4_string = '192.168.0.1' ipv4 = ipaddr.IPv4(ipv4_string) From python-checkins at python.org Tue Jun 2 07:46:02 2009 From: python-checkins at python.org (gregory.p.smith) Date: Tue, 2 Jun 2009 07:46:02 +0200 (CEST) Subject: [Python-checkins] r73137 - python/branches/py3k/Lib/test/test_ipaddr.py Message-ID: <20090602054602.03057D32C@mail.python.org> Author: gregory.p.smith Date: Tue Jun 2 07:46:01 2009 New Revision: 73137 Log: Add test code to verify that relative comparison operators with an object of the wrong type fail properly (TypeError is raised). Modified: python/branches/py3k/Lib/test/test_ipaddr.py Modified: python/branches/py3k/Lib/test/test_ipaddr.py ============================================================================== --- python/branches/py3k/Lib/test/test_ipaddr.py (original) +++ python/branches/py3k/Lib/test/test_ipaddr.py Tue Jun 2 07:46:01 2009 @@ -396,6 +396,16 @@ self.assertFalse(ip2 > ip3) self.assertTrue(ip3 > ip2) + # Confirm that relative comparisons to the wrong type fail properly. + self.assertRaises(TypeError, lambda: ipv4 < '') + self.assertRaises(TypeError, lambda: ipv4 > '') + self.assertRaises(TypeError, lambda: ipv4 >= '') + self.assertRaises(TypeError, lambda: ipv4 <= '') + self.assertRaises(TypeError, lambda: ipv6 < '') + self.assertRaises(TypeError, lambda: ipv6 > '') + self.assertRaises(TypeError, lambda: ipv6 >= '') + self.assertRaises(TypeError, lambda: ipv6 <= '') + def test_embedded_ipv4(self): ipv4_string = '192.168.0.1' ipv4 = ipaddr.IPv4(ipv4_string) From python-checkins at python.org Tue Jun 2 09:39:26 2009 From: python-checkins at python.org (mark.dickinson) Date: Tue, 2 Jun 2009 09:39:26 +0200 (CEST) Subject: [Python-checkins] r73138 - python/trunk/Lib/socket.py Message-ID: <20090602073926.D62F9D814@mail.python.org> Author: mark.dickinson Date: Tue Jun 2 09:39:26 2009 New Revision: 73138 Log: Typo in socket.py. Thanks Pablo Torres Navarrete. Modified: python/trunk/Lib/socket.py Modified: python/trunk/Lib/socket.py ============================================================================== --- python/trunk/Lib/socket.py (original) +++ python/trunk/Lib/socket.py Tue Jun 2 09:39:26 2009 @@ -16,7 +16,7 @@ gethostbyname() -- map a hostname to its IP number gethostbyaddr() -- map an IP number or hostname to DNS info getservbyname() -- map a service name and a protocol name to a port number -getprotobyname() -- mape a protocol name (e.g. 'tcp') to a number +getprotobyname() -- map a protocol name (e.g. 'tcp') to a number ntohs(), ntohl() -- convert 16, 32 bit int from network to host byte order htons(), htonl() -- convert 16, 32 bit int from host to network byte order inet_aton() -- convert IP addr string (123.45.67.89) to 32-bit packed format From python-checkins at python.org Tue Jun 2 09:40:15 2009 From: python-checkins at python.org (mark.dickinson) Date: Tue, 2 Jun 2009 09:40:15 +0200 (CEST) Subject: [Python-checkins] r73139 - in python/branches/release26-maint: Lib/socket.py Message-ID: <20090602074015.44155D81F@mail.python.org> Author: mark.dickinson Date: Tue Jun 2 09:40:15 2009 New Revision: 73139 Log: Merged revisions 73138 via svnmerge from svn+ssh://pythondev at svn.python.org/python/trunk ........ r73138 | mark.dickinson | 2009-06-02 08:39:26 +0100 (Tue, 02 Jun 2009) | 1 line Typo in socket.py. Thanks Pablo Torres Navarrete. ........ Modified: python/branches/release26-maint/ (props changed) python/branches/release26-maint/Lib/socket.py Modified: python/branches/release26-maint/Lib/socket.py ============================================================================== --- python/branches/release26-maint/Lib/socket.py (original) +++ python/branches/release26-maint/Lib/socket.py Tue Jun 2 09:40:15 2009 @@ -16,7 +16,7 @@ gethostbyname() -- map a hostname to its IP number gethostbyaddr() -- map an IP number or hostname to DNS info getservbyname() -- map a service name and a protocol name to a port number -getprotobyname() -- mape a protocol name (e.g. 'tcp') to a number +getprotobyname() -- map a protocol name (e.g. 'tcp') to a number ntohs(), ntohl() -- convert 16, 32 bit int from network to host byte order htons(), htonl() -- convert 16, 32 bit int from host to network byte order inet_aton() -- convert IP addr string (123.45.67.89) to 32-bit packed format From python-checkins at python.org Tue Jun 2 09:41:26 2009 From: python-checkins at python.org (mark.dickinson) Date: Tue, 2 Jun 2009 09:41:26 +0200 (CEST) Subject: [Python-checkins] r73140 - in python/branches/py3k: Lib/socket.py Message-ID: <20090602074126.D511ED83C@mail.python.org> Author: mark.dickinson Date: Tue Jun 2 09:41:26 2009 New Revision: 73140 Log: Merged revisions 73138 via svnmerge from svn+ssh://pythondev at svn.python.org/python/trunk ........ r73138 | mark.dickinson | 2009-06-02 08:39:26 +0100 (Tue, 02 Jun 2009) | 1 line Typo in socket.py. Thanks Pablo Torres Navarrete. ........ Modified: python/branches/py3k/ (props changed) python/branches/py3k/Lib/socket.py Modified: python/branches/py3k/Lib/socket.py ============================================================================== --- python/branches/py3k/Lib/socket.py (original) +++ python/branches/py3k/Lib/socket.py Tue Jun 2 09:41:26 2009 @@ -16,7 +16,7 @@ gethostbyname() -- map a hostname to its IP number gethostbyaddr() -- map an IP number or hostname to DNS info getservbyname() -- map a service name and a protocol name to a port number -getprotobyname() -- mape a protocol name (e.g. 'tcp') to a number +getprotobyname() -- map a protocol name (e.g. 'tcp') to a number ntohs(), ntohl() -- convert 16, 32 bit int from network to host byte order htons(), htonl() -- convert 16, 32 bit int from host to network byte order inet_aton() -- convert IP addr string (123.45.67.89) to 32-bit packed format From python-checkins at python.org Tue Jun 2 09:42:11 2009 From: python-checkins at python.org (mark.dickinson) Date: Tue, 2 Jun 2009 09:42:11 +0200 (CEST) Subject: [Python-checkins] r73141 - in python/branches/release30-maint: Lib/socket.py Message-ID: <20090602074211.C49E1D83C@mail.python.org> Author: mark.dickinson Date: Tue Jun 2 09:42:11 2009 New Revision: 73141 Log: Merged revisions 73140 via svnmerge from svn+ssh://pythondev at svn.python.org/python/branches/py3k ................ r73140 | mark.dickinson | 2009-06-02 08:41:26 +0100 (Tue, 02 Jun 2009) | 9 lines Merged revisions 73138 via svnmerge from svn+ssh://pythondev at svn.python.org/python/trunk ........ r73138 | mark.dickinson | 2009-06-02 08:39:26 +0100 (Tue, 02 Jun 2009) | 1 line Typo in socket.py. Thanks Pablo Torres Navarrete. ........ ................ Modified: python/branches/release30-maint/ (props changed) python/branches/release30-maint/Lib/socket.py Modified: python/branches/release30-maint/Lib/socket.py ============================================================================== --- python/branches/release30-maint/Lib/socket.py (original) +++ python/branches/release30-maint/Lib/socket.py Tue Jun 2 09:42:11 2009 @@ -16,7 +16,7 @@ gethostbyname() -- map a hostname to its IP number gethostbyaddr() -- map an IP number or hostname to DNS info getservbyname() -- map a service name and a protocol name to a port number -getprotobyname() -- mape a protocol name (e.g. 'tcp') to a number +getprotobyname() -- map a protocol name (e.g. 'tcp') to a number ntohs(), ntohl() -- convert 16, 32 bit int from network to host byte order htons(), htonl() -- convert 16, 32 bit int from host to network byte order inet_aton() -- convert IP addr string (123.45.67.89) to 32-bit packed format From buildbot at python.org Tue Jun 2 10:56:29 2009 From: buildbot at python.org (buildbot at python.org) Date: Tue, 02 Jun 2009 08:56:29 +0000 Subject: [Python-checkins] buildbot failure in amd64 gentoo 3.x Message-ID: <20090602085629.621B9DB8E@mail.python.org> The Buildbot has detected a new failure of amd64 gentoo 3.x. Full details are available at: http://www.python.org/dev/buildbot/all/amd64%20gentoo%203.x/builds/748 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: norwitz-amd64 Build Reason: Build Source Stamp: [branch branches/py3k] HEAD Blamelist: mark.dickinson BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_threading_local make: *** [buildbottest] Error 1 sincerely, -The Buildbot From nnorwitz at gmail.com Tue Jun 2 11:28:35 2009 From: nnorwitz at gmail.com (Neal Norwitz) Date: Tue, 2 Jun 2009 05:28:35 -0400 Subject: [Python-checkins] Python Regression Test Failures refleak (1) Message-ID: <20090602092835.GA24416@python.psfb.org> More important issues: ---------------------- test_ssl leaked [322, 0, 0] references, sum=322 Less important issues: ---------------------- test_asynchat leaked [-117, 126, 6] references, sum=15 test_file leaked [0, 0, 82] references, sum=82 test_smtplib leaked [88, 0, 187] references, sum=275 test_socketserver leaked [-78, 0, 0] references, sum=-78 test_sys leaked [0, 42, -21] references, sum=21 test_threading leaked [48, 48, 48] references, sum=144 From python-checkins at python.org Tue Jun 2 12:55:57 2009 From: python-checkins at python.org (ronald.oussoren) Date: Tue, 2 Jun 2009 12:55:57 +0200 (CEST) Subject: [Python-checkins] r73142 - in python/branches/py3k: configure configure.in Message-ID: <20090602105557.143CFD5EF@mail.python.org> Author: ronald.oussoren Date: Tue Jun 2 12:55:56 2009 New Revision: 73142 Log: Fix for Issue6170: 'make frameworkinstall' failure with python 3.1rc1. Modified: python/branches/py3k/configure python/branches/py3k/configure.in Modified: python/branches/py3k/configure ============================================================================== --- python/branches/py3k/configure (original) +++ python/branches/py3k/configure Tue Jun 2 12:55:56 2009 @@ -1,5 +1,5 @@ #! /bin/sh -# From configure.in Revision: 72899 . +# From configure.in Revision: 73021 . # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.61 for python 3.1. # @@ -1976,7 +1976,7 @@ PYTHONFRAMEWORKPREFIX=$enableval PYTHONFRAMEWORKINSTALLDIR=$PYTHONFRAMEWORKPREFIX/$PYTHONFRAMEWORKDIR FRAMEWORKINSTALLFIRST="frameworkinstallstructure" - FRAMEWORKALTINSTALLFIRST="frameworkinstallstructure bininstall maninstall" + FRAMEWORKALTINSTALLFIRST="frameworkinstallstructure " if test "$UNIVERSAL_ARCHS" = "all" then FRAMEWORKINSTALLLAST="frameworkinstallmaclib frameworkinstallapps4way frameworkinstallunixtools4way" Modified: python/branches/py3k/configure.in ============================================================================== --- python/branches/py3k/configure.in (original) +++ python/branches/py3k/configure.in Tue Jun 2 12:55:56 2009 @@ -159,7 +159,7 @@ PYTHONFRAMEWORKPREFIX=$enableval PYTHONFRAMEWORKINSTALLDIR=$PYTHONFRAMEWORKPREFIX/$PYTHONFRAMEWORKDIR FRAMEWORKINSTALLFIRST="frameworkinstallstructure" - FRAMEWORKALTINSTALLFIRST="frameworkinstallstructure bininstall maninstall" + FRAMEWORKALTINSTALLFIRST="frameworkinstallstructure " if test "$UNIVERSAL_ARCHS" = "all" then FRAMEWORKINSTALLLAST="frameworkinstallmaclib frameworkinstallapps4way frameworkinstallunixtools4way" From python-checkins at python.org Tue Jun 2 14:53:15 2009 From: python-checkins at python.org (mark.dickinson) Date: Tue, 2 Jun 2009 14:53:15 +0200 (CEST) Subject: [Python-checkins] r73143 - python/branches/py3k/Doc/library/math.rst Message-ID: <20090602125315.5696FD2A0@mail.python.org> Author: mark.dickinson Date: Tue Jun 2 14:53:15 2009 New Revision: 73143 Log: Fix header level for 'Constants' section of math.rst Modified: python/branches/py3k/Doc/library/math.rst Modified: python/branches/py3k/Doc/library/math.rst ============================================================================== --- python/branches/py3k/Doc/library/math.rst (original) +++ python/branches/py3k/Doc/library/math.rst Tue Jun 2 14:53:15 2009 @@ -277,7 +277,7 @@ Constants -========= +--------- .. data:: pi From python-checkins at python.org Tue Jun 2 14:54:05 2009 From: python-checkins at python.org (mark.dickinson) Date: Tue, 2 Jun 2009 14:54:05 +0200 (CEST) Subject: [Python-checkins] r73144 - in python/branches/release30-maint: Doc/library/math.rst Message-ID: <20090602125405.E510AD2A0@mail.python.org> Author: mark.dickinson Date: Tue Jun 2 14:54:05 2009 New Revision: 73144 Log: Merged revisions 73143 via svnmerge from svn+ssh://pythondev at svn.python.org/python/branches/py3k ........ r73143 | mark.dickinson | 2009-06-02 13:53:15 +0100 (Tue, 02 Jun 2009) | 1 line Fix header level for 'Constants' section of math.rst ........ Modified: python/branches/release30-maint/ (props changed) python/branches/release30-maint/Doc/library/math.rst Modified: python/branches/release30-maint/Doc/library/math.rst ============================================================================== --- python/branches/release30-maint/Doc/library/math.rst (original) +++ python/branches/release30-maint/Doc/library/math.rst Tue Jun 2 14:54:05 2009 @@ -277,7 +277,7 @@ Constants -========= +--------- .. data:: pi From python-checkins at python.org Tue Jun 2 15:14:08 2009 From: python-checkins at python.org (kristjan.jonsson) Date: Tue, 2 Jun 2009 15:14:08 +0200 (CEST) Subject: [Python-checkins] r73145 - python/trunk/Lib/socket.py Message-ID: <20090602131408.96F2FDA33@mail.python.org> Author: kristjan.jonsson Date: Tue Jun 2 15:14:08 2009 New Revision: 73145 Log: http://bugs.python.org/issue6117 Fix O(n**2) performance problem in socket._fileobject Modified: python/trunk/Lib/socket.py Modified: python/trunk/Lib/socket.py ============================================================================== --- python/trunk/Lib/socket.py (original) +++ python/trunk/Lib/socket.py Tue Jun 2 15:14:08 2009 @@ -235,7 +235,7 @@ __slots__ = ["mode", "bufsize", "softspace", # "closed" is a property, see below - "_sock", "_rbufsize", "_wbufsize", "_rbuf", "_wbuf", + "_sock", "_rbufsize", "_wbufsize", "_rbuf", "_wbuf", "_wbuf_len", "_close"] def __init__(self, sock, mode='rb', bufsize=-1, close=False): @@ -261,6 +261,7 @@ # realloc()ed down much smaller than their original allocation. self._rbuf = StringIO() self._wbuf = [] # A list of strings + self._wbuf_len = 0 self._close = close def _getclosed(self): @@ -287,6 +288,7 @@ if self._wbuf: buffer = "".join(self._wbuf) self._wbuf = [] + self._wbuf_len = 0 self._sock.sendall(buffer) def fileno(self): @@ -297,25 +299,22 @@ if not data: return self._wbuf.append(data) + self._wbuf_len += len(data) if (self._wbufsize == 0 or self._wbufsize == 1 and '\n' in data or - self._get_wbuf_len() >= self._wbufsize): + self._wbuf_len >= self._wbufsize): self.flush() def writelines(self, list): # XXX We could do better here for very long lists # XXX Should really reject non-string non-buffers - self._wbuf.extend(filter(None, map(str, list))) + lines = filter(None, map(str, list)) + self._wbuf_len += sum(map(len, lines)) + self._wbuf.extend(lines) if (self._wbufsize <= 1 or - self._get_wbuf_len() >= self._wbufsize): + self._wbuf_len >= self._wbufsize): self.flush() - def _get_wbuf_len(self): - buf_len = 0 - for x in self._wbuf: - buf_len += len(x) - return buf_len - def read(self, size=-1): # Use max, disallow tiny reads in a loop as they are very inefficient. # We never leave read() with any leftover data from a new recv() call From python-checkins at python.org Tue Jun 2 17:53:29 2009 From: python-checkins at python.org (guilherme.polo) Date: Tue, 2 Jun 2009 17:53:29 +0200 (CEST) Subject: [Python-checkins] r73146 - python/branches/tk_and_idle_maintenance/Lib/lib-tk/test/test_tkinter/test_listbox.py Message-ID: <20090602155329.10CB4DB69@mail.python.org> Author: guilherme.polo Date: Tue Jun 2 17:53:28 2009 New Revision: 73146 Log: Initial tests for Tkinter.Listbox. Added: python/branches/tk_and_idle_maintenance/Lib/lib-tk/test/test_tkinter/test_listbox.py (contents, props changed) Added: python/branches/tk_and_idle_maintenance/Lib/lib-tk/test/test_tkinter/test_listbox.py ============================================================================== --- (empty file) +++ python/branches/tk_and_idle_maintenance/Lib/lib-tk/test/test_tkinter/test_listbox.py Tue Jun 2 17:53:28 2009 @@ -0,0 +1,148 @@ +import unittest +import Tkinter +from test.test_support import requires, run_unittest +from ttk import setup_master + +requires('gui') + +class ListboxTest(unittest.TestCase): + + def setUp(self): + self.root = setup_master() + self.lb = Tkinter.Listbox(self.root) + + def tearDown(self): + self.lb.destroy() + + def test_activate(self): pass + + def test_bbox(self): + self.assertRaises(Tkinter.TclError, self.lb.bbox, '@1.2') + self.assertIs(self.lb.bbox(0), None) + + self.lb.insert(0, 'hi') + bbox = self.lb.bbox(0) + self.assertTrue(isinstance(bbox, tuple)) + self.assertEqual(len(bbox), 4) + for item in bbox: + self.assertTrue(isinstance(item, int)) + + self.assertEqual(self.lb.bbox(('0',)), self.lb.bbox(0)) + self.assertEqual(self.lb.bbox(0), self.lb.bbox('0')) + + def test_curselection(self): + self.assertEqual(self.lb.curselection(), ()) + self.lb.insert(0, *[i for i in range(15)]) + self.lb.selection_set(0, 9) + indices = self.lb.curselection() + self.assertTrue(isinstance(indices, tuple)) + for item in indices: + self.assertTrue(isinstance(item, int)) + + def test_delete(self): + self.assertRaises(Tkinter.TclError, self.lb.delete, '@1.2') + + self.lb.insert(0, 1, '2', 3) + self.lb.delete(0) + self.assertEqual(self.lb.get(0, 'end'), ('2', 3)) + self.lb.delete(0, 'end') + self.assertEqual(self.lb.get(0, 'end'), ()) + + def test_get(self): + self.assertFalse(self.lb.get(0)) + self.lb.insert(0, 'a', 'b', 'c d e') + self.assertEqual(self.lb.get(2), 'c d e') + self.assertEqual(self.lb.get(1, 'end'), ('b', 'c d e')) + self.assertEqual(self.lb.get(3, 2), ()) + self.assertEqual(self.lb.get(2, 0), ()) + # 'last' is not a valid index in listbox + self.assertRaises(Tkinter.TclError, self.lb.get, 'last') + + def test_index(self): + self.assertEqual(self.lb.index('end'), 0) + self.lb.insert(0, *range(5)) + self.assertEqual(self.lb.index('end'), 5) + self.assertEqual(self.lb.index('2'), 2) + # XXX how can I get a None using the index method ? + + def test_nearest(self): pass + def test_scan(self): pass + + def test_see(self): + self.lb['height'] = 5 + self.lb.insert(0, *range(7)) + self.lb.pack() + self.lb.update_idletasks() + + self.assertEqual(self.lb.index('@5,%d' % (self.lb.winfo_height() - 5)), + 4) + self.lb.see('end') + self.assertEqual(self.lb.index('@5,%d' % (self.lb.winfo_height() - 5)), + 6) + + def test_selection(self): + self.lb.insert(0, *range(20)) + + # Verifying that selection_set includes the end point. + self.assertFalse(self.lb.select_includes(0)) + self.assertFalse(self.lb.select_includes(5)) + self.lb.selection_set(0, 5) + self.assertTrue(self.lb.select_includes(0)) + self.assertTrue(self.lb.select_includes(5)) + self.assertEqual(self.lb.curselection(), tuple(range(6))) + + # Verifying that setting a new selection doesn't remove the old + # selection. + self.lb.selection_set(7, 9) + self.assertEqual(self.lb.curselection(), (0, 1, 2, 3, 4, 5, 7, 8, 9)) + self.lb.selection_set(6) + self.assertEqual(self.lb.curselection(), (0, 1, 2, 3, 4, 5, 6, 7, 8, 9)) + self.lb.selection_set(3, 6) + self.assertEqual(self.lb.curselection(), (0, 1, 2, 3, 4, 5, 6, 7, 8, 9)) + + # Verifying that selection_clear includes the end point. + self.assertTrue(self.lb.selection_includes(0)) + self.assertTrue(self.lb.selection_includes(5)) + self.lb.selection_clear(0, 5) + self.assertFalse(self.lb.selection_includes(0)) + self.assertFalse(self.lb.selection_includes(5)) + self.assertEqual(self.lb.curselection(), (6, 7, 8, 9)) + self.lb.selection_clear(7) + self.assertEqual(self.lb.curselection(), (6, 8, 9)) + self.lb.selection_clear(0, 'end') + self.assertEqual(self.lb.curselection(), ()) + + def test_xview(self, method='xview'): + view = getattr(self.lb, method)() + self.assertTrue(isinstance(view, tuple)) + self.assertEqual(len(view), 2) + for item in view: + self.assertTrue(isinstance(item, float)) + + def test_yview(self): + self.test_xview('yview') + + def test_itemcget(self): + self.lb.insert(0, 0) + self.lb.itemconfigure(0, bg='blue') + self.assertEqual(self.lb.itemcget(0, 'bg'), 'blue') + # invalid index: + self.assertRaises(Tkinter.TclError, self.lb.itemcget, 2, 'bg') + # invalid option: + self.assertRaises(Tkinter.TclError, self.lb.itemcget, 0, 'hi') + + def test_itemconfigure(self): + self.lb.insert(0, 0) + self.lb.itemconfigure(0, background='blue') + self.assertTrue(isinstance(self.lb.itemconfigure(0), dict)) + self.assertEqual(self.lb.itemconfigure(0, 'background'), + self.lb.itemconfigure(0)['background']) + + self.assertRaises(Tkinter.TclError, self.lb.itemconfigure, 0, 'hi') + self.assertRaises(Tkinter.TclError, self.lb.itemconfigure, 2) + + +tests_gui = (ListboxTest, ) + +if __name__ == "__main__": + run_unittest(*tests_gui) From python-checkins at python.org Tue Jun 2 17:58:44 2009 From: python-checkins at python.org (tarek.ziade) Date: Tue, 2 Jun 2009 17:58:44 +0200 (CEST) Subject: [Python-checkins] r73147 - in python/trunk/Lib/distutils: spawn.py tests/test_spawn.py Message-ID: <20090602155844.20047DBEB@mail.python.org> Author: tarek.ziade Date: Tue Jun 2 17:58:43 2009 New Revision: 73147 Log: improved distutils.spawn test coverage + cleaned it up Modified: python/trunk/Lib/distutils/spawn.py python/trunk/Lib/distutils/tests/test_spawn.py Modified: python/trunk/Lib/distutils/spawn.py ============================================================================== --- python/trunk/Lib/distutils/spawn.py (original) +++ python/trunk/Lib/distutils/spawn.py Tue Jun 2 17:58:43 2009 @@ -8,17 +8,16 @@ __revision__ = "$Id$" -import sys, os, string -from distutils.errors import * +import sys +import os + +from distutils.errors import DistutilsPlatformError, DistutilsExecError from distutils import log -def spawn (cmd, - search_path=1, - verbose=0, - dry_run=0): +def spawn(cmd, search_path=1, verbose=0, dry_run=0): + """Run another program, specified as a command list 'cmd', in a new process. - """Run another program, specified as a command list 'cmd', in a new - process. 'cmd' is just the argument list for the new process, ie. + 'cmd' is just the argument list for the new process, ie. cmd[0] is the program to run and cmd[1:] are the rest of its arguments. There is no way to run a program with a name different from that of its executable. @@ -41,37 +40,29 @@ raise DistutilsPlatformError, \ "don't know how to spawn programs on platform '%s'" % os.name -# spawn () - +def _nt_quote_args(args): + """Quote command-line arguments for DOS/Windows conventions. -def _nt_quote_args (args): - """Quote command-line arguments for DOS/Windows conventions: just - wraps every argument which contains blanks in double quotes, and + Just wraps every argument which contains blanks in double quotes, and returns a new argument list. """ - # XXX this doesn't seem very robust to me -- but if the Windows guys # say it'll work, I guess I'll have to accept it. (What if an arg # contains quotes? What other magic characters, other than spaces, # have to be escaped? Is there an escaping mechanism other than # quoting?) - - for i in range(len(args)): - if string.find(args[i], ' ') != -1: - args[i] = '"%s"' % args[i] + for i, arg in enumerate(args): + if ' ' in arg: + args[i] = '"%s"' % arg return args -def _spawn_nt (cmd, - search_path=1, - verbose=0, - dry_run=0): - +def _spawn_nt(cmd, search_path=1, verbose=0, dry_run=0): executable = cmd[0] cmd = _nt_quote_args(cmd) if search_path: # either we find one or it stays the same executable = find_executable(executable) or executable - log.info(string.join([executable] + cmd[1:], ' ')) + log.info(' '.join([executable] + cmd[1:])) if not dry_run: # spawn for NT requires a full path to the .exe try: @@ -85,18 +76,12 @@ raise DistutilsExecError, \ "command '%s' failed with exit status %d" % (cmd[0], rc) - -def _spawn_os2 (cmd, - search_path=1, - verbose=0, - dry_run=0): - +def _spawn_os2(cmd, search_path=1, verbose=0, dry_run=0): executable = cmd[0] - #cmd = _nt_quote_args(cmd) if search_path: # either we find one or it stays the same executable = find_executable(executable) or executable - log.info(string.join([executable] + cmd[1:], ' ')) + log.info(' '.join([executable] + cmd[1:])) if not dry_run: # spawnv for OS/2 EMX requires a full path to the .exe try: @@ -107,27 +92,20 @@ "command '%s' failed: %s" % (cmd[0], exc[-1]) if rc != 0: # and this reflects the command running but failing - print "command '%s' failed with exit status %d" % (cmd[0], rc) + log.debug("command '%s' failed with exit status %d" % (cmd[0], rc)) raise DistutilsExecError, \ "command '%s' failed with exit status %d" % (cmd[0], rc) -def _spawn_posix (cmd, - search_path=1, - verbose=0, - dry_run=0): - - log.info(string.join(cmd, ' ')) +def _spawn_posix(cmd, search_path=1, verbose=0, dry_run=0): + log.info(' '.join(cmd)) if dry_run: return exec_fn = search_path and os.execvp or os.execv - pid = os.fork() - if pid == 0: # in the child + if pid == 0: # in the child try: - #print "cmd[0] =", cmd[0] - #print "cmd =", cmd exec_fn(cmd[0], cmd) except OSError, e: sys.stderr.write("unable to execute %s: %s\n" % @@ -136,14 +114,12 @@ sys.stderr.write("unable to execute %s for unknown reasons" % cmd[0]) os._exit(1) - - - else: # in the parent + else: # in the parent # Loop until the child either exits or is terminated by a signal # (ie. keep waiting if it's merely stopped) while 1: try: - (pid, status) = os.waitpid(pid, 0) + pid, status = os.waitpid(pid, 0) except OSError, exc: import errno if exc.errno == errno.EINTR: @@ -158,7 +134,7 @@ elif os.WIFEXITED(status): exit_status = os.WEXITSTATUS(status) if exit_status == 0: - return # hey, it succeeded! + return # hey, it succeeded! else: raise DistutilsExecError, \ "command '%s' failed with exit status %d" % \ @@ -171,21 +147,21 @@ raise DistutilsExecError, \ "unknown error executing '%s': termination status %d" % \ (cmd[0], status) -# _spawn_posix () - def find_executable(executable, path=None): - """Try to find 'executable' in the directories listed in 'path' (a - string listing directories separated by 'os.pathsep'; defaults to - os.environ['PATH']). Returns the complete filename or None if not - found. + """Tries to find 'executable' in the directories listed in 'path'. + + A string listing directories separated by 'os.pathsep'; defaults to + os.environ['PATH']. Returns the complete filename or None if not found. """ if path is None: path = os.environ['PATH'] - paths = string.split(path, os.pathsep) - (base, ext) = os.path.splitext(executable) + paths = path.split(os.pathsep) + base, ext = os.path.splitext(executable) + if (sys.platform == 'win32' or os.name == 'os2') and (ext != '.exe'): executable = executable + '.exe' + if not os.path.isfile(executable): for p in paths: f = os.path.join(p, executable) @@ -195,5 +171,3 @@ return None else: return executable - -# find_executable() Modified: python/trunk/Lib/distutils/tests/test_spawn.py ============================================================================== --- python/trunk/Lib/distutils/tests/test_spawn.py (original) +++ python/trunk/Lib/distutils/tests/test_spawn.py Tue Jun 2 17:58:43 2009 @@ -1,8 +1,17 @@ """Tests for distutils.spawn.""" import unittest +import os +import time +from test.test_support import captured_stdout + from distutils.spawn import _nt_quote_args +from distutils.spawn import spawn, find_executable +from distutils.errors import DistutilsExecError +from distutils.tests import support -class SpawnTestCase(unittest.TestCase): +class SpawnTestCase(support.TempdirManager, + support.LoggingSilencer, + unittest.TestCase): def test_nt_quote_args(self): @@ -13,6 +22,37 @@ res = _nt_quote_args(args) self.assertEquals(res, wanted) + + @unittest.skipUnless(os.name in ('nt', 'posix'), + 'Runs only under posix or nt') + def test_spawn(self): + tmpdir = self.mkdtemp() + + # creating something executable + # through the shell that returns 1 + if os.name == 'posix': + exe = os.path.join(tmpdir, 'foo.sh') + self.write_file(exe, '#!/bin/sh\nexit 1') + os.chmod(exe, 0777) + else: + exe = os.path.join(tmpdir, 'foo.bat') + self.write_file(exe, 'exit 1') + + os.chmod(exe, 0777) + self.assertRaises(DistutilsExecError, spawn, [exe]) + + # now something that works + if os.name == 'posix': + exe = os.path.join(tmpdir, 'foo.sh') + self.write_file(exe, '#!/bin/sh\nexit 0') + os.chmod(exe, 0777) + else: + exe = os.path.join(tmpdir, 'foo.bat') + self.write_file(exe, 'exit 0') + + os.chmod(exe, 0777) + spawn([exe]) # should work without any error + def test_suite(): return unittest.makeSuite(SpawnTestCase) From python-checkins at python.org Tue Jun 2 17:59:38 2009 From: python-checkins at python.org (tarek.ziade) Date: Tue, 2 Jun 2009 17:59:38 +0200 (CEST) Subject: [Python-checkins] r73148 - python/branches/release26-maint Message-ID: <20090602155938.C1661DC16@mail.python.org> Author: tarek.ziade Date: Tue Jun 2 17:59:38 2009 New Revision: 73148 Log: Blocked revisions 73147 via svnmerge ........ r73147 | tarek.ziade | 2009-06-02 17:58:43 +0200 (Tue, 02 Jun 2009) | 1 line improved distutils.spawn test coverage + cleaned it up ........ Modified: python/branches/release26-maint/ (props changed) From python-checkins at python.org Tue Jun 2 18:18:55 2009 From: python-checkins at python.org (tarek.ziade) Date: Tue, 2 Jun 2009 18:18:55 +0200 (CEST) Subject: [Python-checkins] r73149 - in python/branches/py3k: Lib/distutils/spawn.py Lib/distutils/tests/test_spawn.py Message-ID: <20090602161855.D898CDC57@mail.python.org> Author: tarek.ziade Date: Tue Jun 2 18:18:55 2009 New Revision: 73149 Log: Merged revisions 73147 via svnmerge from svn+ssh://pythondev at svn.python.org/python/trunk ........ r73147 | tarek.ziade | 2009-06-02 17:58:43 +0200 (Tue, 02 Jun 2009) | 1 line improved distutils.spawn test coverage + cleaned it up ........ Modified: python/branches/py3k/ (props changed) python/branches/py3k/Lib/distutils/spawn.py python/branches/py3k/Lib/distutils/tests/test_spawn.py Modified: python/branches/py3k/Lib/distutils/spawn.py ============================================================================== --- python/branches/py3k/Lib/distutils/spawn.py (original) +++ python/branches/py3k/Lib/distutils/spawn.py Tue Jun 2 18:18:55 2009 @@ -8,13 +8,16 @@ __revision__ = "$Id$" -import sys, os -from distutils.errors import * +import sys +import os + +from distutils.errors import DistutilsPlatformError, DistutilsExecError from distutils import log def spawn(cmd, search_path=1, verbose=0, dry_run=0): - """Run another program, specified as a command list 'cmd', in a new - process. 'cmd' is just the argument list for the new process, ie. + """Run another program, specified as a command list 'cmd', in a new process. + + 'cmd' is just the argument list for the new process, ie. cmd[0] is the program to run and cmd[1:] are the rest of its arguments. There is no way to run a program with a name different from that of its executable. @@ -37,10 +40,10 @@ raise DistutilsPlatformError( "don't know how to spawn programs on platform '%s'" % os.name) - def _nt_quote_args(args): - """Quote command-line arguments for DOS/Windows conventions: just - wraps every argument which contains blanks in double quotes, and + """Quote command-line arguments for DOS/Windows conventions. + + Just wraps every argument which contains blanks in double quotes, and returns a new argument list. """ # XXX this doesn't seem very robust to me -- but if the Windows guys @@ -48,9 +51,9 @@ # contains quotes? What other magic characters, other than spaces, # have to be escaped? Is there an escaping mechanism other than # quoting?) - for i in range(len(args)): - if args[i].find(' ') != -1: - args[i] = '"%s"' % args[i] + for i, arg in enumerate(args): + if ' ' in arg: + args[i] = '"%s"' % arg return args def _spawn_nt(cmd, search_path=1, verbose=0, dry_run=0): @@ -73,10 +76,8 @@ raise DistutilsExecError( "command '%s' failed with exit status %d" % (cmd[0], rc)) - def _spawn_os2(cmd, search_path=1, verbose=0, dry_run=0): executable = cmd[0] - #cmd = _nt_quote_args(cmd) if search_path: # either we find one or it stays the same executable = find_executable(executable) or executable @@ -91,17 +92,15 @@ "command '%s' failed: %s" % (cmd[0], exc.args[-1])) if rc != 0: # and this reflects the command running but failing - print("command '%s' failed with exit status %d" % (cmd[0], rc)) + log.debug("command '%s' failed with exit status %d" % (cmd[0], rc)) raise DistutilsExecError( "command '%s' failed with exit status %d" % (cmd[0], rc)) - def _spawn_posix(cmd, search_path=1, verbose=0, dry_run=0): log.info(' '.join(cmd)) if dry_run: return exec_fn = search_path and os.execvp or os.execv - pid = os.fork() if pid == 0: # in the child try: @@ -118,7 +117,7 @@ # (ie. keep waiting if it's merely stopped) while True: try: - (pid, status) = os.waitpid(pid, 0) + pid, status = os.waitpid(pid, 0) except OSError as exc: import errno if exc.errno == errno.EINTR: @@ -132,7 +131,7 @@ elif os.WIFEXITED(status): exit_status = os.WEXITSTATUS(status) if exit_status == 0: - return # hey, it succeeded! + return # hey, it succeeded! else: raise DistutilsExecError( "command '%s' failed with exit status %d" @@ -144,19 +143,21 @@ "unknown error executing '%s': termination status %d" % (cmd[0], status)) - def find_executable(executable, path=None): - """Try to find 'executable' in the directories listed in 'path' (a - string listing directories separated by 'os.pathsep'; defaults to - os.environ['PATH']). Returns the complete filename or None if not - found. + """Tries to find 'executable' in the directories listed in 'path'. + + A string listing directories separated by 'os.pathsep'; defaults to + os.environ['PATH']. Returns the complete filename or None if not found. """ if path is None: path = os.environ['PATH'] + paths = path.split(os.pathsep) - (base, ext) = os.path.splitext(executable) + base, ext = os.path.splitext(executable) + if (sys.platform == 'win32' or os.name == 'os2') and (ext != '.exe'): executable = executable + '.exe' + if not os.path.isfile(executable): for p in paths: f = os.path.join(p, executable) Modified: python/branches/py3k/Lib/distutils/tests/test_spawn.py ============================================================================== --- python/branches/py3k/Lib/distutils/tests/test_spawn.py (original) +++ python/branches/py3k/Lib/distutils/tests/test_spawn.py Tue Jun 2 18:18:55 2009 @@ -1,8 +1,17 @@ """Tests for distutils.spawn.""" import unittest +import os +import time +from test.support import captured_stdout + from distutils.spawn import _nt_quote_args +from distutils.spawn import spawn, find_executable +from distutils.errors import DistutilsExecError +from distutils.tests import support -class SpawnTestCase(unittest.TestCase): +class SpawnTestCase(support.TempdirManager, + support.LoggingSilencer, + unittest.TestCase): def test_nt_quote_args(self): @@ -13,6 +22,35 @@ res = _nt_quote_args(args) self.assertEquals(res, wanted) + + @unittest.skipUnless(os.name in ('nt', 'posix'), + 'Runs only under posix or nt') + def test_spawn(self): + tmpdir = self.mkdtemp() + + # creating something executable + # through the shell that returns 1 + if os.name == 'posix': + exe = os.path.join(tmpdir, 'foo.sh') + self.write_file(exe, '#!/bin/sh\nexit 1') + else: + exe = os.path.join(tmpdir, 'foo.bat') + self.write_file(exe, 'exit 1') + + os.chmod(exe, 0o777) + self.assertRaises(DistutilsExecError, spawn, [exe]) + + # now something that works + if os.name == 'posix': + exe = os.path.join(tmpdir, 'foo.sh') + self.write_file(exe, '#!/bin/sh\nexit 0') + else: + exe = os.path.join(tmpdir, 'foo.bat') + self.write_file(exe, 'exit 0') + + os.chmod(exe, 0o777) + spawn([exe]) # should work without any error + def test_suite(): return unittest.makeSuite(SpawnTestCase) From python-checkins at python.org Tue Jun 2 18:20:05 2009 From: python-checkins at python.org (tarek.ziade) Date: Tue, 2 Jun 2009 18:20:05 +0200 (CEST) Subject: [Python-checkins] r73150 - python/branches/release30-maint Message-ID: <20090602162005.3A545DCA4@mail.python.org> Author: tarek.ziade Date: Tue Jun 2 18:20:05 2009 New Revision: 73150 Log: Blocked revisions 73149 via svnmerge ................ r73149 | tarek.ziade | 2009-06-02 18:18:55 +0200 (Tue, 02 Jun 2009) | 9 lines Merged revisions 73147 via svnmerge from svn+ssh://pythondev at svn.python.org/python/trunk ........ r73147 | tarek.ziade | 2009-06-02 17:58:43 +0200 (Tue, 02 Jun 2009) | 1 line improved distutils.spawn test coverage + cleaned it up ........ ................ Modified: python/branches/release30-maint/ (props changed) From python-checkins at python.org Tue Jun 2 20:08:27 2009 From: python-checkins at python.org (michael.foord) Date: Tue, 2 Jun 2009 20:08:27 +0200 (CEST) Subject: [Python-checkins] r73151 - in python/trunk/Lib: test/test_unittest.py unittest.py Message-ID: <20090602180827.344AFDA51@mail.python.org> Author: michael.foord Date: Tue Jun 2 20:08:27 2009 New Revision: 73151 Log: Restore default testRunner argument in unittest.main to None. Issue 6177 Modified: python/trunk/Lib/test/test_unittest.py python/trunk/Lib/unittest.py Modified: python/trunk/Lib/test/test_unittest.py ============================================================================== --- python/trunk/Lib/test/test_unittest.py (original) +++ python/trunk/Lib/test/test_unittest.py Tue Jun 2 20:08:27 2009 @@ -3325,6 +3325,14 @@ self.assertEqual(program.verbosity, 2) + def testTestProgram_testRunnerArgument(self): + program = object.__new__(TestProgram) + program.parseArgs = lambda _: None + program.runTests = lambda: None + program.__init__(testRunner=None) + self.assertEqual(program.testRunner, unittest.TextTestRunner) + + class FooBar(unittest.TestCase): def testPass(self): assert True Modified: python/trunk/Lib/unittest.py ============================================================================== --- python/trunk/Lib/unittest.py (original) +++ python/trunk/Lib/unittest.py Tue Jun 2 20:08:27 2009 @@ -1640,9 +1640,11 @@ """ USAGE = USAGE def __init__(self, module='__main__', defaultTest=None, - argv=None, testRunner=TextTestRunner, + argv=None, testRunner=None, testLoader=defaultTestLoader, exit=True, verbosity=1): + if testRunner is None: + testRunner = TextTestRunner if isinstance(module, basestring): self.module = __import__(module) for part in module.split('.')[1:]: From python-checkins at python.org Tue Jun 2 20:22:38 2009 From: python-checkins at python.org (michael.foord) Date: Tue, 2 Jun 2009 20:22:38 +0200 (CEST) Subject: [Python-checkins] r73152 - in python/branches/release26-maint/Lib: test/test_unittest.py unittest.py Message-ID: <20090602182238.9089DDAB2@mail.python.org> Author: michael.foord Date: Tue Jun 2 20:22:38 2009 New Revision: 73152 Log: Restore default testRunner argument in unittest.main to None. Issue 6177. Modified: python/branches/release26-maint/Lib/test/test_unittest.py python/branches/release26-maint/Lib/unittest.py Modified: python/branches/release26-maint/Lib/test/test_unittest.py ============================================================================== --- python/branches/release26-maint/Lib/test/test_unittest.py (original) +++ python/branches/release26-maint/Lib/test/test_unittest.py Tue Jun 2 20:22:38 2009 @@ -2284,6 +2284,17 @@ self.assertRaises(AssertionError, self.failIfAlmostEqual, 0, .1+.1j, places=0) + +class Test_TestProgram(TestCase): + + def testTestProgram_testRunnerArgument(self): + program = object.__new__(unittest.TestProgram) + program.parseArgs = lambda _: None + program.runTests = lambda: None + program.__init__(testRunner=None) + self.assertEqual(program.testRunner, unittest.TextTestRunner) + + ###################################################################### ## Main ###################################################################### @@ -2291,7 +2302,7 @@ def test_main(): test_support.run_unittest(Test_TestCase, Test_TestLoader, Test_TestSuite, Test_TestResult, Test_FunctionTestCase, - Test_Assertions) + Test_Assertions, Test_TestProgram) if __name__ == "__main__": test_main() Modified: python/branches/release26-maint/Lib/unittest.py ============================================================================== --- python/branches/release26-maint/Lib/unittest.py (original) +++ python/branches/release26-maint/Lib/unittest.py Tue Jun 2 20:22:38 2009 @@ -798,8 +798,10 @@ in MyTestCase """ def __init__(self, module='__main__', defaultTest=None, - argv=None, testRunner=TextTestRunner, + argv=None, testRunner=None, testLoader=defaultTestLoader): + if testRunner is None: + testRunner = TextTestRunner if type(module) == type(''): self.module = __import__(module) for part in module.split('.')[1:]: From python-checkins at python.org Tue Jun 2 21:01:57 2009 From: python-checkins at python.org (david.goodger) Date: Tue, 2 Jun 2009 21:01:57 +0200 (CEST) Subject: [Python-checkins] r73153 - peps/trunk/pep-0374.txt Message-ID: <20090602190157.57AF3DA3A@mail.python.org> Author: david.goodger Date: Tue Jun 2 21:01:57 2009 New Revision: 73153 Log: markup fixes: table title rows, PEP references are automatically detected Modified: peps/trunk/pep-0374.txt Modified: peps/trunk/pep-0374.txt ============================================================================== --- peps/trunk/pep-0374.txt (original) +++ peps/trunk/pep-0374.txt Tue Jun 2 21:01:57 2009 @@ -119,9 +119,7 @@ Although all of these points can be debated, in the end a pronouncement from the BDFL was made to go with hg as the chosen DVCS for the Python project. A -detailed plan for the migration strategy has been deferred to `PEP 385`_. - -.. _PEP 385: http://www.python.org/dev/peps/pep-0385/ +detailed plan for the migration strategy has been deferred to PEP 385. Terminology @@ -226,7 +224,7 @@ ========== ========== ======= =================================== ========================================== Name Short Name Version 2.x Trunk Mirror 3.x Trunk Mirror ----------- ---------- ------- ----------------------------------- ------------------------------------------ +========== ========== ======= =================================== ========================================== Bazaar_ bzr 1.12 http://code.python.org/python/trunk http://code.python.org/python/3.0 Mercurial_ hg 1.2.0 http://code.python.org/hg/trunk/ http://code.python.org/hg/branches/py3k/ git_ N/A 1.6.1 git://code.python.org/python/trunk git://code.python.org/python/branches/py3k @@ -278,7 +276,7 @@ ========= === Name VCS ---------- --- +========= === Brett svn Barry bzr Alexandre hg @@ -1186,7 +1184,7 @@ ----------------- ==== ======================================= ============================================= ============================= DVCS Windows OS X UNIX ----- --------------------------------------- --------------------------------------------- ----------------------------- +==== ======================================= ============================================= ============================= bzr yes (installer) w/ tortoise yes (installer, fink or MacPorts) yes (various package formats) hg yes (third-party installer) w/ tortoise yes (third-party installer, fink or MacPorts) yes (various package formats) git yes (third-party installer) yes (third-party installer, fink or MacPorts) yes (.deb or .rpm) @@ -1273,7 +1271,7 @@ ==== ============ DVCS svn support ----- ------------ +==== ============ bzr bzr-svn_ (third-party) hg `multiple third-parties `__ git git-svn_ @@ -1291,7 +1289,7 @@ ==== ================== DVCS Web page interface ----- ------------------ +==== ================== bzr loggerhead_ hg hgweb_ git gitweb_ @@ -1369,7 +1367,7 @@ ======= ================ ========= ===== DVCS San Francisco Vancouver Space -------- ---------------- --------- ----- +======= ================ ========= ===== svn 1:04 2:59 139 M bzr 10:45 16:04 276 M hg 2:30 5:24 171 M @@ -1391,7 +1389,7 @@ ==== ===== DVCS Time ----- ----- +==== ===== bzr 4.5 s hg 1.1 s git 1.5 s @@ -1440,7 +1438,7 @@ ==== =========== ========== DVCS 700 commits 50 commits ----- ----------- ---------- +==== =========== ========== bzr 39 s 7 s hg 17 s 3 s git N/A 4 s @@ -1507,7 +1505,7 @@ ==== == ===== == ========== DVCS ++ equal -- Uninformed ----- -- ----- -- ---------- +==== == ===== == ========== git 5 1 8 13 bzr 10 3 2 12 hg 15 1 1 10 @@ -1534,4 +1532,5 @@ Transition Plan =============== + PEP 385 outlines the transition from svn to hg. From python-checkins at python.org Tue Jun 2 21:13:33 2009 From: python-checkins at python.org (brett.cannon) Date: Tue, 2 Jun 2009 21:13:33 +0200 (CEST) Subject: [Python-checkins] r73154 - peps/trunk/pep-0374.txt Message-ID: <20090602191333.07A57DA46@mail.python.org> Author: brett.cannon Date: Tue Jun 2 21:13:32 2009 New Revision: 73154 Log: Minor grammatical typos found by Eric Smith and R. David Murray. Modified: peps/trunk/pep-0374.txt Modified: peps/trunk/pep-0374.txt ============================================================================== --- peps/trunk/pep-0374.txt (original) +++ peps/trunk/pep-0374.txt Tue Jun 2 21:13:32 2009 @@ -1491,13 +1491,13 @@ lightning talk `_ where Brett Cannon lists these exact reasons; talk started at 3:45). First, git's Windows support is the weakest out of the three DVCSs being considered -which unacceptable as Python needs to support development on any +which is unacceptable as Python needs to support development on any platform it runs on. Since Python runs on Windows and some people do develop on the platform it needs solid support. And while git's support is improving, as of this moment it is the weakest by a large -enough margin to warrant it a problem. +enough margin to warrant considering it a problem. -Two, and just as important as the first issue, is that the Python +Second, and just as important as the first issue, is that the Python core developers liked git the least out of the three DVCS options by a wide margin. If you look at the following table you will see the results of a survey taken of the core developers and how by a large From python-checkins at python.org Tue Jun 2 22:00:47 2009 From: python-checkins at python.org (brett.cannon) Date: Tue, 2 Jun 2009 22:00:47 +0200 (CEST) Subject: [Python-checkins] r73155 - peps/trunk/pep-0374.txt Message-ID: <20090602200047.A4E9DD3E0@mail.python.org> Author: brett.cannon Date: Tue Jun 2 22:00:47 2009 New Revision: 73155 Log: Add a copyright notice. Modified: peps/trunk/pep-0374.txt Modified: peps/trunk/pep-0374.txt ============================================================================== --- peps/trunk/pep-0374.txt (original) +++ peps/trunk/pep-0374.txt Tue Jun 2 22:00:47 2009 @@ -1534,3 +1534,10 @@ =============== PEP 385 outlines the transition from svn to hg. + + +Copyright +========= + +This document has been placed in the public domain. + From python-checkins at python.org Tue Jun 2 23:00:50 2009 From: python-checkins at python.org (martin.v.loewis) Date: Tue, 2 Jun 2009 23:00:50 +0200 (CEST) Subject: [Python-checkins] r73156 - peps/trunk/pep-0383.txt Message-ID: <20090602210050.69D69DBEB@mail.python.org> Author: martin.v.loewis Date: Tue Jun 2 23:00:50 2009 New Revision: 73156 Log: Add discussion of security issues. Modified: peps/trunk/pep-0383.txt Modified: peps/trunk/pep-0383.txt ============================================================================== --- peps/trunk/pep-0383.txt (original) +++ peps/trunk/pep-0383.txt Tue Jun 2 23:00:50 2009 @@ -104,6 +104,17 @@ Data obtained from other sources may conflict with data produced by this PEP. Dealing with such conflicts is out of scope of the PEP. +This PEP allows to "smuggle" bytes in character strings. This would +be a security risk if the bytes are security-critical when interpreted +as characters on a target system, such as path name separators. For +this reason, the PEP rejects smuggling bytes below 128. If the target +system uses EBCDIC, such smuggled bytes may still a security risk, +allowing to smuggle, e.g. square brackets or the backslash. Python +currently does not support EBCDIC, so this should not be a problem in +practice. Anybody porting Python to an EBCDIC system might want to +adjust the error handlers, or come up with other approaches to address +the security risks. + Encodings that are not compatible with ASCII are not supported by this specification; bytes in the ASCII range that fail to decode will cause an exception. It is widely agreed that such encodings From python-checkins at python.org Tue Jun 2 23:11:08 2009 From: python-checkins at python.org (guilherme.polo) Date: Tue, 2 Jun 2009 23:11:08 +0200 (CEST) Subject: [Python-checkins] r73157 - python/branches/tk_and_idle_maintenance/Lib/lib-tk/test/test_tkinter/test_entry.py Message-ID: <20090602211108.C39F5C49E@mail.python.org> Author: guilherme.polo Date: Tue Jun 2 23:11:08 2009 New Revision: 73157 Log: Initial tests for Tkinter.Entry. Added: python/branches/tk_and_idle_maintenance/Lib/lib-tk/test/test_tkinter/test_entry.py (contents, props changed) Added: python/branches/tk_and_idle_maintenance/Lib/lib-tk/test/test_tkinter/test_entry.py ============================================================================== --- (empty file) +++ python/branches/tk_and_idle_maintenance/Lib/lib-tk/test/test_tkinter/test_entry.py Tue Jun 2 23:11:08 2009 @@ -0,0 +1,85 @@ +import unittest +import Tkinter +from test.test_support import requires, run_unittest +from ttk import setup_master + +requires('gui') + +class EntryTest(unittest.TestCase): + + def setUp(self): + self.root = setup_master() + self.entry = Tkinter.Entry(self.root) + + def tearDown(self): + self.entry.destroy() + + + def test_delete(self): + self.entry.insert('end', 'avocado') + self.entry.delete(0) + self.assertEqual(self.entry.get(), 'vocado') + + # verify that the last index isn't removed by delete. + self.entry.delete(0, 1) + self.assertEqual(self.entry.get(), 'ocado') + + self.entry.delete(2, 0) + self.assertEqual(self.entry.get(), 'ocado') + self.assertRaises(Tkinter.TclError, self.entry.delete, 'last') + + def test_get_insert(self): + self.assertEqual(self.entry.get(), '') + self.assertIs(self.entry.insert('end', 'hi'), None) + self.assertEqual(self.entry.get(), 'hi') + self.entry.insert(1, 'ea') + self.assertEqual(self.entry.get(), 'heai') + + self.entry.delete(0, 'end') + self.entry.insert(0, u'\u1234') + x = self.entry.get() + self.assertEqual(x, u'\u1234') + self.assertEqual(len(x), 1) + + def test_icursor(self): + self.assertEqual(self.entry.index('insert'), 0) + self.assertIs(self.entry.icursor(2), None) + self.assertEqual(self.entry.index('insert'), 0) + + self.entry.insert(0, 'testing') + self.entry.icursor(2) + self.assertEqual(self.entry.index('insert'), 2) + + def test_index(self): + i = self.entry.index(0) + self.assertEqual(i, 0) + i = self.entry.index('0') + self.assertEqual(i, 0) + self.entry.insert('end', '.. abc ..') + self.assertTrue(isinstance(self.entry.index('end'), int)) + + def test_scan(self): pass + + def test_selection(self): + self.entry.insert(0, 'airplane') + self.assertFalse(self.entry.selection_present()) + self.entry.selection_range(0, 1) + self.assertTrue(self.entry.selection_present()) + self.assertEqual(self.entry.index('sel.first'), 0) + self.assertEqual(self.entry.index('sel.last'), 1) + self.assertIs(self.entry.selection_clear(), None) + # sel.last doesn't exist now. + self.assertRaises(Tkinter.TclError, self.entry.index, 'sel.last') + + def test_xview(self): + view = self.entry.xview() + self.assertTrue(isinstance(view, tuple)) + self.assertEqual(len(view), 2) + for item in view: + self.assertTrue(isinstance(item, float)) + + +tests_gui = (EntryTest, ) + +if __name__ == "__main__": + run_unittest(*tests_gui) From rdmurray at bitdance.com Tue Jun 2 23:35:37 2009 From: rdmurray at bitdance.com (R. David Murray) Date: Tue, 2 Jun 2009 17:35:37 -0400 (EDT) Subject: [Python-checkins] r73156 - peps/trunk/pep-0383.txt In-Reply-To: <20090602210050.69D69DBEB@mail.python.org> References: <20090602210050.69D69DBEB@mail.python.org> Message-ID: On Tue, 2 Jun 2009 at 23:00, martin.v.loewis wrote: > Author: martin.v.loewis > Date: Tue Jun 2 23:00:50 2009 > New Revision: 73156 > > Log: > Add discussion of security issues. > > > Modified: > peps/trunk/pep-0383.txt > > Modified: peps/trunk/pep-0383.txt > ============================================================================== > --- peps/trunk/pep-0383.txt (original) > +++ peps/trunk/pep-0383.txt Tue Jun 2 23:00:50 2009 > @@ -104,6 +104,17 @@ > Data obtained from other sources may conflict with data produced > by this PEP. Dealing with such conflicts is out of scope of the PEP. > > +This PEP allows to "smuggle" bytes in character strings. This would allows the possibility of "smuggling" > +be a security risk if the bytes are security-critical when interpreted > +as characters on a target system, such as path name separators. For > +this reason, the PEP rejects smuggling bytes below 128. If the target > +system uses EBCDIC, such smuggled bytes may still a security risk, may still be a > +allowing to smuggle, e.g. square brackets or the backslash. Python allowing smuggling of > +currently does not support EBCDIC, so this should not be a problem in > +practice. Anybody porting Python to an EBCDIC system might want to > +adjust the error handlers, or come up with other approaches to address > +the security risks. > + > Encodings that are not compatible with ASCII are not supported by > this specification; bytes in the ASCII range that fail to decode > will cause an exception. It is widely agreed that such encodings > _______________________________________________ > Python-checkins mailing list > Python-checkins at python.org > http://mail.python.org/mailman/listinfo/python-checkins > From python-checkins at python.org Tue Jun 2 23:43:06 2009 From: python-checkins at python.org (martin.v.loewis) Date: Tue, 2 Jun 2009 23:43:06 +0200 (CEST) Subject: [Python-checkins] r73158 - peps/trunk/pep-0383.txt Message-ID: <20090602214306.5F4A4D9FB@mail.python.org> Author: martin.v.loewis Date: Tue Jun 2 23:43:06 2009 New Revision: 73158 Log: Fix grammar. Reported by R. David Murray. Modified: peps/trunk/pep-0383.txt Modified: peps/trunk/pep-0383.txt ============================================================================== --- peps/trunk/pep-0383.txt (original) +++ peps/trunk/pep-0383.txt Tue Jun 2 23:43:06 2009 @@ -104,16 +104,17 @@ Data obtained from other sources may conflict with data produced by this PEP. Dealing with such conflicts is out of scope of the PEP. -This PEP allows to "smuggle" bytes in character strings. This would -be a security risk if the bytes are security-critical when interpreted -as characters on a target system, such as path name separators. For -this reason, the PEP rejects smuggling bytes below 128. If the target -system uses EBCDIC, such smuggled bytes may still a security risk, -allowing to smuggle, e.g. square brackets or the backslash. Python -currently does not support EBCDIC, so this should not be a problem in -practice. Anybody porting Python to an EBCDIC system might want to -adjust the error handlers, or come up with other approaches to address -the security risks. +This PEP allows the possibility of "smuggling" bytes in character +strings. This would be a security risk if the bytes are +security-critical when interpreted as characters on a target system, +such as path name separators. For this reason, the PEP rejects +smuggling bytes below 128. If the target system uses EBCDIC, such +smuggled bytes may still be a security risk, allowing smuggling of +e.g. square brackets or the backslash. Python currently does not +support EBCDIC, so this should not be a problem in practice. Anybody +porting Python to an EBCDIC system might want to adjust the error +handlers, or come up with other approaches to address the security +risks. Encodings that are not compatible with ASCII are not supported by this specification; bytes in the ASCII range that fail to decode From python-checkins at python.org Wed Jun 3 00:23:02 2009 From: python-checkins at python.org (guilherme.polo) Date: Wed, 3 Jun 2009 00:23:02 +0200 (CEST) Subject: [Python-checkins] r73159 - in python/branches/tk_and_idle_maintenance: Lib/distutils/spawn.py Lib/distutils/tests/test_spawn.py Lib/ipaddr.py Lib/socket.py Lib/test/test_ipaddr.py Lib/test/test_unittest.py Lib/unittest.py Message-ID: <20090602222302.D3B58DA65@mail.python.org> Author: guilherme.polo Date: Wed Jun 3 00:22:54 2009 New Revision: 73159 Log: Merged revisions 73135,73138,73145,73147,73151 via svnmerge from svn+ssh://pythondev/python/trunk ........ r73135 | gregory.p.smith | 2009-06-02 02:25:34 -0300 (Tue, 02 Jun 2009) | 3 lines Fixes issue6169: it was possible for two ipaddr network addresses to compare as both < and > than eachother. ........ r73138 | mark.dickinson | 2009-06-02 04:39:26 -0300 (Tue, 02 Jun 2009) | 1 line Typo in socket.py. Thanks Pablo Torres Navarrete. ........ r73145 | kristjan.jonsson | 2009-06-02 10:14:08 -0300 (Tue, 02 Jun 2009) | 2 lines http://bugs.python.org/issue6117 Fix O(n**2) performance problem in socket._fileobject ........ r73147 | tarek.ziade | 2009-06-02 12:58:43 -0300 (Tue, 02 Jun 2009) | 1 line improved distutils.spawn test coverage + cleaned it up ........ r73151 | michael.foord | 2009-06-02 15:08:27 -0300 (Tue, 02 Jun 2009) | 1 line Restore default testRunner argument in unittest.main to None. Issue 6177 ........ Modified: python/branches/tk_and_idle_maintenance/ (props changed) python/branches/tk_and_idle_maintenance/Lib/distutils/spawn.py python/branches/tk_and_idle_maintenance/Lib/distutils/tests/test_spawn.py python/branches/tk_and_idle_maintenance/Lib/ipaddr.py python/branches/tk_and_idle_maintenance/Lib/socket.py python/branches/tk_and_idle_maintenance/Lib/test/test_ipaddr.py python/branches/tk_and_idle_maintenance/Lib/test/test_unittest.py python/branches/tk_and_idle_maintenance/Lib/unittest.py Modified: python/branches/tk_and_idle_maintenance/Lib/distutils/spawn.py ============================================================================== --- python/branches/tk_and_idle_maintenance/Lib/distutils/spawn.py (original) +++ python/branches/tk_and_idle_maintenance/Lib/distutils/spawn.py Wed Jun 3 00:22:54 2009 @@ -8,17 +8,16 @@ __revision__ = "$Id$" -import sys, os, string -from distutils.errors import * +import sys +import os + +from distutils.errors import DistutilsPlatformError, DistutilsExecError from distutils import log -def spawn (cmd, - search_path=1, - verbose=0, - dry_run=0): +def spawn(cmd, search_path=1, verbose=0, dry_run=0): + """Run another program, specified as a command list 'cmd', in a new process. - """Run another program, specified as a command list 'cmd', in a new - process. 'cmd' is just the argument list for the new process, ie. + 'cmd' is just the argument list for the new process, ie. cmd[0] is the program to run and cmd[1:] are the rest of its arguments. There is no way to run a program with a name different from that of its executable. @@ -41,37 +40,29 @@ raise DistutilsPlatformError, \ "don't know how to spawn programs on platform '%s'" % os.name -# spawn () - +def _nt_quote_args(args): + """Quote command-line arguments for DOS/Windows conventions. -def _nt_quote_args (args): - """Quote command-line arguments for DOS/Windows conventions: just - wraps every argument which contains blanks in double quotes, and + Just wraps every argument which contains blanks in double quotes, and returns a new argument list. """ - # XXX this doesn't seem very robust to me -- but if the Windows guys # say it'll work, I guess I'll have to accept it. (What if an arg # contains quotes? What other magic characters, other than spaces, # have to be escaped? Is there an escaping mechanism other than # quoting?) - - for i in range(len(args)): - if string.find(args[i], ' ') != -1: - args[i] = '"%s"' % args[i] + for i, arg in enumerate(args): + if ' ' in arg: + args[i] = '"%s"' % arg return args -def _spawn_nt (cmd, - search_path=1, - verbose=0, - dry_run=0): - +def _spawn_nt(cmd, search_path=1, verbose=0, dry_run=0): executable = cmd[0] cmd = _nt_quote_args(cmd) if search_path: # either we find one or it stays the same executable = find_executable(executable) or executable - log.info(string.join([executable] + cmd[1:], ' ')) + log.info(' '.join([executable] + cmd[1:])) if not dry_run: # spawn for NT requires a full path to the .exe try: @@ -85,18 +76,12 @@ raise DistutilsExecError, \ "command '%s' failed with exit status %d" % (cmd[0], rc) - -def _spawn_os2 (cmd, - search_path=1, - verbose=0, - dry_run=0): - +def _spawn_os2(cmd, search_path=1, verbose=0, dry_run=0): executable = cmd[0] - #cmd = _nt_quote_args(cmd) if search_path: # either we find one or it stays the same executable = find_executable(executable) or executable - log.info(string.join([executable] + cmd[1:], ' ')) + log.info(' '.join([executable] + cmd[1:])) if not dry_run: # spawnv for OS/2 EMX requires a full path to the .exe try: @@ -107,27 +92,20 @@ "command '%s' failed: %s" % (cmd[0], exc[-1]) if rc != 0: # and this reflects the command running but failing - print "command '%s' failed with exit status %d" % (cmd[0], rc) + log.debug("command '%s' failed with exit status %d" % (cmd[0], rc)) raise DistutilsExecError, \ "command '%s' failed with exit status %d" % (cmd[0], rc) -def _spawn_posix (cmd, - search_path=1, - verbose=0, - dry_run=0): - - log.info(string.join(cmd, ' ')) +def _spawn_posix(cmd, search_path=1, verbose=0, dry_run=0): + log.info(' '.join(cmd)) if dry_run: return exec_fn = search_path and os.execvp or os.execv - pid = os.fork() - if pid == 0: # in the child + if pid == 0: # in the child try: - #print "cmd[0] =", cmd[0] - #print "cmd =", cmd exec_fn(cmd[0], cmd) except OSError, e: sys.stderr.write("unable to execute %s: %s\n" % @@ -136,14 +114,12 @@ sys.stderr.write("unable to execute %s for unknown reasons" % cmd[0]) os._exit(1) - - - else: # in the parent + else: # in the parent # Loop until the child either exits or is terminated by a signal # (ie. keep waiting if it's merely stopped) while 1: try: - (pid, status) = os.waitpid(pid, 0) + pid, status = os.waitpid(pid, 0) except OSError, exc: import errno if exc.errno == errno.EINTR: @@ -158,7 +134,7 @@ elif os.WIFEXITED(status): exit_status = os.WEXITSTATUS(status) if exit_status == 0: - return # hey, it succeeded! + return # hey, it succeeded! else: raise DistutilsExecError, \ "command '%s' failed with exit status %d" % \ @@ -171,21 +147,21 @@ raise DistutilsExecError, \ "unknown error executing '%s': termination status %d" % \ (cmd[0], status) -# _spawn_posix () - def find_executable(executable, path=None): - """Try to find 'executable' in the directories listed in 'path' (a - string listing directories separated by 'os.pathsep'; defaults to - os.environ['PATH']). Returns the complete filename or None if not - found. + """Tries to find 'executable' in the directories listed in 'path'. + + A string listing directories separated by 'os.pathsep'; defaults to + os.environ['PATH']. Returns the complete filename or None if not found. """ if path is None: path = os.environ['PATH'] - paths = string.split(path, os.pathsep) - (base, ext) = os.path.splitext(executable) + paths = path.split(os.pathsep) + base, ext = os.path.splitext(executable) + if (sys.platform == 'win32' or os.name == 'os2') and (ext != '.exe'): executable = executable + '.exe' + if not os.path.isfile(executable): for p in paths: f = os.path.join(p, executable) @@ -195,5 +171,3 @@ return None else: return executable - -# find_executable() Modified: python/branches/tk_and_idle_maintenance/Lib/distutils/tests/test_spawn.py ============================================================================== --- python/branches/tk_and_idle_maintenance/Lib/distutils/tests/test_spawn.py (original) +++ python/branches/tk_and_idle_maintenance/Lib/distutils/tests/test_spawn.py Wed Jun 3 00:22:54 2009 @@ -1,8 +1,17 @@ """Tests for distutils.spawn.""" import unittest +import os +import time +from test.test_support import captured_stdout + from distutils.spawn import _nt_quote_args +from distutils.spawn import spawn, find_executable +from distutils.errors import DistutilsExecError +from distutils.tests import support -class SpawnTestCase(unittest.TestCase): +class SpawnTestCase(support.TempdirManager, + support.LoggingSilencer, + unittest.TestCase): def test_nt_quote_args(self): @@ -13,6 +22,37 @@ res = _nt_quote_args(args) self.assertEquals(res, wanted) + + @unittest.skipUnless(os.name in ('nt', 'posix'), + 'Runs only under posix or nt') + def test_spawn(self): + tmpdir = self.mkdtemp() + + # creating something executable + # through the shell that returns 1 + if os.name == 'posix': + exe = os.path.join(tmpdir, 'foo.sh') + self.write_file(exe, '#!/bin/sh\nexit 1') + os.chmod(exe, 0777) + else: + exe = os.path.join(tmpdir, 'foo.bat') + self.write_file(exe, 'exit 1') + + os.chmod(exe, 0777) + self.assertRaises(DistutilsExecError, spawn, [exe]) + + # now something that works + if os.name == 'posix': + exe = os.path.join(tmpdir, 'foo.sh') + self.write_file(exe, '#!/bin/sh\nexit 0') + os.chmod(exe, 0777) + else: + exe = os.path.join(tmpdir, 'foo.bat') + self.write_file(exe, 'exit 0') + + os.chmod(exe, 0777) + spawn([exe]) # should work without any error + def test_suite(): return unittest.makeSuite(SpawnTestCase) Modified: python/branches/tk_and_idle_maintenance/Lib/ipaddr.py ============================================================================== --- python/branches/tk_and_idle_maintenance/Lib/ipaddr.py (original) +++ python/branches/tk_and_idle_maintenance/Lib/ipaddr.py Wed Jun 3 00:22:54 2009 @@ -10,7 +10,7 @@ """ -__version__ = '1.1.0' +__version__ = '1.1.1' import struct @@ -204,17 +204,25 @@ def __lt__(self, other): try: - return (self.version < other.version - or self.ip < other.ip - or self.netmask < other.netmask) + if self.version != other.version: + return self.version < other.version + if self.ip != other.ip: + return self.ip < other.ip + if self.netmask != other.netmask: + return self.netmask < other.netmask + return False except AttributeError: return NotImplemented def __gt__(self, other): try: - return (self.version > other.version - or self.ip > other.ip - or self.netmask > other.netmask) + if self.version != other.version: + return self.version > other.version + if self.ip != other.ip: + return self.ip > other.ip + if self.netmask != other.netmask: + return self.netmask > other.netmask + return False except AttributeError: return NotImplemented Modified: python/branches/tk_and_idle_maintenance/Lib/socket.py ============================================================================== --- python/branches/tk_and_idle_maintenance/Lib/socket.py (original) +++ python/branches/tk_and_idle_maintenance/Lib/socket.py Wed Jun 3 00:22:54 2009 @@ -16,7 +16,7 @@ gethostbyname() -- map a hostname to its IP number gethostbyaddr() -- map an IP number or hostname to DNS info getservbyname() -- map a service name and a protocol name to a port number -getprotobyname() -- mape a protocol name (e.g. 'tcp') to a number +getprotobyname() -- map a protocol name (e.g. 'tcp') to a number ntohs(), ntohl() -- convert 16, 32 bit int from network to host byte order htons(), htonl() -- convert 16, 32 bit int from host to network byte order inet_aton() -- convert IP addr string (123.45.67.89) to 32-bit packed format @@ -235,7 +235,7 @@ __slots__ = ["mode", "bufsize", "softspace", # "closed" is a property, see below - "_sock", "_rbufsize", "_wbufsize", "_rbuf", "_wbuf", + "_sock", "_rbufsize", "_wbufsize", "_rbuf", "_wbuf", "_wbuf_len", "_close"] def __init__(self, sock, mode='rb', bufsize=-1, close=False): @@ -261,6 +261,7 @@ # realloc()ed down much smaller than their original allocation. self._rbuf = StringIO() self._wbuf = [] # A list of strings + self._wbuf_len = 0 self._close = close def _getclosed(self): @@ -287,6 +288,7 @@ if self._wbuf: buffer = "".join(self._wbuf) self._wbuf = [] + self._wbuf_len = 0 self._sock.sendall(buffer) def fileno(self): @@ -297,25 +299,22 @@ if not data: return self._wbuf.append(data) + self._wbuf_len += len(data) if (self._wbufsize == 0 or self._wbufsize == 1 and '\n' in data or - self._get_wbuf_len() >= self._wbufsize): + self._wbuf_len >= self._wbufsize): self.flush() def writelines(self, list): # XXX We could do better here for very long lists # XXX Should really reject non-string non-buffers - self._wbuf.extend(filter(None, map(str, list))) + lines = filter(None, map(str, list)) + self._wbuf_len += sum(map(len, lines)) + self._wbuf.extend(lines) if (self._wbufsize <= 1 or - self._get_wbuf_len() >= self._wbufsize): + self._wbuf_len >= self._wbufsize): self.flush() - def _get_wbuf_len(self): - buf_len = 0 - for x in self._wbuf: - buf_len += len(x) - return buf_len - def read(self, size=-1): # Use max, disallow tiny reads in a loop as they are very inefficient. # We never leave read() with any leftover data from a new recv() call Modified: python/branches/tk_and_idle_maintenance/Lib/test/test_ipaddr.py ============================================================================== --- python/branches/tk_and_idle_maintenance/Lib/test/test_ipaddr.py (original) +++ python/branches/tk_and_idle_maintenance/Lib/test/test_ipaddr.py Wed Jun 3 00:22:54 2009 @@ -1,18 +1,6 @@ # Copyright 2007 Google Inc. # Licensed to PSF under a Contributor Agreement. # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# # See also: http://code.google.com/p/ipaddr-py/ """Unittest for ipaddr module.""" @@ -373,6 +361,21 @@ self.assertTrue(ipv6 > ipv4) self.assertTrue(ipv4 < ipv6) + # Regression test for issue6169 (ipaddr-py issue 19) + ip1 = ipaddr.IP('10.1.2.128/25') + self.assertFalse(ip1 < ip1) + self.assertFalse(ip1 > ip1) + ip2 = ipaddr.IP('10.1.3.0/24') + self.assertTrue(ip1 < ip2) + self.assertFalse(ip2 < ip1) + self.assertFalse(ip1 > ip2) + self.assertTrue(ip2 > ip1) + ip3 = ipaddr.IP('10.1.3.0/25') + self.assertTrue(ip2 < ip3) + self.assertFalse(ip3 < ip2) + self.assertFalse(ip2 > ip3) + self.assertTrue(ip3 > ip2) + def test_embedded_ipv4(self): ipv4_string = '192.168.0.1' ipv4 = ipaddr.IPv4(ipv4_string) Modified: python/branches/tk_and_idle_maintenance/Lib/test/test_unittest.py ============================================================================== --- python/branches/tk_and_idle_maintenance/Lib/test/test_unittest.py (original) +++ python/branches/tk_and_idle_maintenance/Lib/test/test_unittest.py Wed Jun 3 00:22:54 2009 @@ -3325,6 +3325,14 @@ self.assertEqual(program.verbosity, 2) + def testTestProgram_testRunnerArgument(self): + program = object.__new__(TestProgram) + program.parseArgs = lambda _: None + program.runTests = lambda: None + program.__init__(testRunner=None) + self.assertEqual(program.testRunner, unittest.TextTestRunner) + + class FooBar(unittest.TestCase): def testPass(self): assert True Modified: python/branches/tk_and_idle_maintenance/Lib/unittest.py ============================================================================== --- python/branches/tk_and_idle_maintenance/Lib/unittest.py (original) +++ python/branches/tk_and_idle_maintenance/Lib/unittest.py Wed Jun 3 00:22:54 2009 @@ -1640,9 +1640,11 @@ """ USAGE = USAGE def __init__(self, module='__main__', defaultTest=None, - argv=None, testRunner=TextTestRunner, + argv=None, testRunner=None, testLoader=defaultTestLoader, exit=True, verbosity=1): + if testRunner is None: + testRunner = TextTestRunner if isinstance(module, basestring): self.module = __import__(module) for part in module.split('.')[1:]: From python-checkins at python.org Wed Jun 3 05:08:41 2009 From: python-checkins at python.org (benjamin.peterson) Date: Wed, 3 Jun 2009 05:08:41 +0200 (CEST) Subject: [Python-checkins] r73160 - python/branches/py3k/Makefile.pre.in Message-ID: <20090603030841.B8AB9D991@mail.python.org> Author: benjamin.peterson Date: Wed Jun 3 05:08:41 2009 New Revision: 73160 Log: ignore some 2to3 test files with 2.x syntax #6184 Modified: python/branches/py3k/Makefile.pre.in Modified: python/branches/py3k/Makefile.pre.in ============================================================================== --- python/branches/py3k/Makefile.pre.in (original) +++ python/branches/py3k/Makefile.pre.in Wed Jun 3 05:08:41 2009 @@ -910,12 +910,12 @@ -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \ ./$(BUILDPYTHON) -Wi $(DESTDIR)$(LIBDEST)/compileall.py \ -d $(LIBDEST) -f \ - -x 'bad_coding|badsyntax|site-packages|py2_test_grammar' \ + -x 'bad_coding|badsyntax|site-packages|py2_test_grammar|crlf|different_encoding|' \ $(DESTDIR)$(LIBDEST) -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \ ./$(BUILDPYTHON) -Wi -O $(DESTDIR)$(LIBDEST)/compileall.py \ -d $(LIBDEST) -f \ - -x 'bad_coding|badsyntax|site-packages|py2_test_grammar' \ + -x 'bad_coding|badsyntax|site-packages|py2_test_grammar|crlf|different_encoding|' \ $(DESTDIR)$(LIBDEST) -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \ ./$(BUILDPYTHON) -Wi $(DESTDIR)$(LIBDEST)/compileall.py \ From python-checkins at python.org Wed Jun 3 05:13:30 2009 From: python-checkins at python.org (benjamin.peterson) Date: Wed, 3 Jun 2009 05:13:30 +0200 (CEST) Subject: [Python-checkins] r73161 - python/branches/py3k/Doc/reference/compound_stmts.rst Message-ID: <20090603031330.EC669D99B@mail.python.org> Author: benjamin.peterson Date: Wed Jun 3 05:13:30 2009 New Revision: 73161 Log: range() doesn't return a list Modified: python/branches/py3k/Doc/reference/compound_stmts.rst Modified: python/branches/py3k/Doc/reference/compound_stmts.rst ============================================================================== --- python/branches/py3k/Doc/reference/compound_stmts.rst (original) +++ python/branches/py3k/Doc/reference/compound_stmts.rst Wed Jun 3 05:13:30 2009 @@ -182,7 +182,7 @@ Names in the target list are not deleted when the loop is finished, but if the sequence is empty, it will not have been assigned to at all by the loop. Hint: the built-in function :func:`range` returns an iterator of integers suitable to -emulate the effect of Pascal's ``for i := a to b do``; e.g., ``range(3)`` +emulate the effect of Pascal's ``for i := a to b do``; e.g., ``list(range(3))`` returns the list ``[0, 1, 2]``. .. note:: From python-checkins at python.org Wed Jun 3 07:19:19 2009 From: python-checkins at python.org (hirokazu.yamamoto) Date: Wed, 3 Jun 2009 07:19:19 +0200 (CEST) Subject: [Python-checkins] r73162 - in python/branches/py3k: Modules/timemodule.c PC/pyconfig.h Message-ID: <20090603051919.09115D918@mail.python.org> Author: hirokazu.yamamoto Date: Wed Jun 3 07:19:18 2009 New Revision: 73162 Log: Issue #6183: Disables wcsftime on VC6. Modified: python/branches/py3k/Modules/timemodule.c python/branches/py3k/PC/pyconfig.h Modified: python/branches/py3k/Modules/timemodule.c ============================================================================== --- python/branches/py3k/Modules/timemodule.c (original) +++ python/branches/py3k/Modules/timemodule.c Wed Jun 3 07:19:18 2009 @@ -540,7 +540,7 @@ fmt = PyBytes_AS_STRING(format); #endif -#ifdef MS_WINDOWS +#if defined(MS_WINDOWS) && defined(HAVE_WCSFTIME) /* check that the format string contains only valid directives */ for(outbuf = wcschr(fmt, L'%'); outbuf != NULL; Modified: python/branches/py3k/PC/pyconfig.h ============================================================================== --- python/branches/py3k/PC/pyconfig.h (original) +++ python/branches/py3k/PC/pyconfig.h Wed Jun 3 07:19:18 2009 @@ -638,7 +638,9 @@ /* #undef HAVE_WAITPID */ /* Define to 1 if you have the `wcsftime' function. */ +#if defined(_MSC_VER) && _MSC_VER >= 1310 #define HAVE_WCSFTIME 1 +#endif /* Define to 1 if you have the `wcscoll' function. */ #ifndef MS_WINCE From python-checkins at python.org Wed Jun 3 09:25:35 2009 From: python-checkins at python.org (georg.brandl) Date: Wed, 3 Jun 2009 09:25:35 +0200 (CEST) Subject: [Python-checkins] r73163 - in python/trunk/Doc: howto/sockets.rst includes/email-unpack.py includes/mp_pool.py includes/mp_synchronize.py library/crypt.rst library/imputil.rst library/rexec.rst library/shutil.rst library/signal.rst reference/simple_stmts.rst tools/roman.py tools/sphinxext/suspicious.py Message-ID: <20090603072535.DB8ACD9A3@mail.python.org> Author: georg.brandl Date: Wed Jun 3 09:25:35 2009 New Revision: 73163 Log: Use the preferred form of raise statements in the docs. Modified: python/trunk/Doc/howto/sockets.rst python/trunk/Doc/includes/email-unpack.py python/trunk/Doc/includes/mp_pool.py python/trunk/Doc/includes/mp_synchronize.py python/trunk/Doc/library/crypt.rst python/trunk/Doc/library/imputil.rst python/trunk/Doc/library/rexec.rst python/trunk/Doc/library/shutil.rst python/trunk/Doc/library/signal.rst python/trunk/Doc/reference/simple_stmts.rst python/trunk/Doc/tools/roman.py python/trunk/Doc/tools/sphinxext/suspicious.py Modified: python/trunk/Doc/howto/sockets.rst ============================================================================== --- python/trunk/Doc/howto/sockets.rst (original) +++ python/trunk/Doc/howto/sockets.rst Wed Jun 3 09:25:35 2009 @@ -204,8 +204,7 @@ while totalsent < MSGLEN: sent = self.sock.send(msg[totalsent:]) if sent == 0: - raise RuntimeError, \ - "socket connection broken" + raise RuntimeError("socket connection broken") totalsent = totalsent + sent def myreceive(self): @@ -213,8 +212,7 @@ while len(msg) < MSGLEN: chunk = self.sock.recv(MSGLEN-len(msg)) if chunk == '': - raise RuntimeError, \ - "socket connection broken" + raise RuntimeError("socket connection broken") msg = msg + chunk return msg Modified: python/trunk/Doc/includes/email-unpack.py ============================================================================== --- python/trunk/Doc/includes/email-unpack.py (original) +++ python/trunk/Doc/includes/email-unpack.py Wed Jun 3 09:25:35 2009 @@ -37,7 +37,7 @@ os.mkdir(opts.directory) except OSError, e: # Ignore directory exists error - if e.errno <> errno.EEXIST: + if e.errno != errno.EEXIST: raise fp = open(msgfile) Modified: python/trunk/Doc/includes/mp_pool.py ============================================================================== --- python/trunk/Doc/includes/mp_pool.py (original) +++ python/trunk/Doc/includes/mp_pool.py Wed Jun 3 09:25:35 2009 @@ -149,21 +149,21 @@ except ZeroDivisionError: print '\tGot ZeroDivisionError as expected from pool.apply()' else: - raise AssertionError, 'expected ZeroDivisionError' + raise AssertionError('expected ZeroDivisionError') try: print pool.map(f, range(10)) except ZeroDivisionError: print '\tGot ZeroDivisionError as expected from pool.map()' else: - raise AssertionError, 'expected ZeroDivisionError' + raise AssertionError('expected ZeroDivisionError') try: print list(pool.imap(f, range(10))) except ZeroDivisionError: print '\tGot ZeroDivisionError as expected from list(pool.imap())' else: - raise AssertionError, 'expected ZeroDivisionError' + raise AssertionError('expected ZeroDivisionError') it = pool.imap(f, range(10)) for i in range(10): @@ -176,7 +176,7 @@ break else: if i == 5: - raise AssertionError, 'expected ZeroDivisionError' + raise AssertionError('expected ZeroDivisionError') assert i == 9 print '\tGot ZeroDivisionError as expected from IMapIterator.next()' Modified: python/trunk/Doc/includes/mp_synchronize.py ============================================================================== --- python/trunk/Doc/includes/mp_synchronize.py (original) +++ python/trunk/Doc/includes/mp_synchronize.py Wed Jun 3 09:25:35 2009 @@ -249,7 +249,7 @@ info = multiprocessing._debug_info() if info: print info - raise ValueError, 'there should be no positive refcounts left' + raise ValueError('there should be no positive refcounts left') if __name__ == '__main__': @@ -271,6 +271,6 @@ import multiprocessing.dummy as namespace else: print 'Usage:\n\t%s [processes | manager | threads]' % sys.argv[0] - raise SystemExit, 2 + raise SystemExit(2) test(namespace) Modified: python/trunk/Doc/library/crypt.rst ============================================================================== --- python/trunk/Doc/library/crypt.rst (original) +++ python/trunk/Doc/library/crypt.rst Wed Jun 3 09:25:35 2009 @@ -52,7 +52,8 @@ cryptedpasswd = pwd.getpwnam(username)[1] if cryptedpasswd: if cryptedpasswd == 'x' or cryptedpasswd == '*': - raise "Sorry, currently no support for shadow passwords" + raise NotImplementedError( + "Sorry, currently no support for shadow passwords") cleartext = getpass.getpass() return crypt.crypt(cleartext, cryptedpasswd) == cryptedpasswd else: Modified: python/trunk/Doc/library/imputil.rst ============================================================================== --- python/trunk/Doc/library/imputil.rst (original) +++ python/trunk/Doc/library/imputil.rst Wed Jun 3 09:25:35 2009 @@ -160,7 +160,7 @@ parent = None q = import_module(head, qname, parent) if q: return q, tail - raise ImportError, "No module named " + qname + raise ImportError("No module named " + qname) def load_tail(q, tail): m = q @@ -171,7 +171,7 @@ mname = "%s.%s" % (m.__name__, head) m = import_module(head, mname, m) if not m: - raise ImportError, "No module named " + mname + raise ImportError("No module named " + mname) return m def ensure_fromlist(m, fromlist, recursive=0): @@ -189,7 +189,7 @@ subname = "%s.%s" % (m.__name__, sub) submod = import_module(sub, subname, m) if not submod: - raise ImportError, "No module named " + subname + raise ImportError("No module named " + subname) def import_module(partname, fqname, parent): try: Modified: python/trunk/Doc/library/rexec.rst ============================================================================== --- python/trunk/Doc/library/rexec.rst (original) +++ python/trunk/Doc/library/rexec.rst Wed Jun 3 09:25:35 2009 @@ -272,11 +272,11 @@ elif mode in ('w', 'wb', 'a', 'ab'): # check filename : must begin with /tmp/ if file[:5]!='/tmp/': - raise IOError, "can't write outside /tmp" + raise IOError("can't write outside /tmp") elif (string.find(file, '/../') >= 0 or file[:3] == '../' or file[-3:] == '/..'): - raise IOError, "'..' in filename forbidden" - else: raise IOError, "Illegal open() mode" + raise IOError("'..' in filename forbidden") + else: raise IOError("Illegal open() mode") return open(file, mode, buf) Notice that the above code will occasionally forbid a perfectly valid filename; Modified: python/trunk/Doc/library/shutil.rst ============================================================================== --- python/trunk/Doc/library/shutil.rst (original) +++ python/trunk/Doc/library/shutil.rst Wed Jun 3 09:25:35 2009 @@ -216,7 +216,7 @@ except OSError, why: errors.extend((src, dst, str(why))) if errors: - raise Error, errors + raise Error(errors) Another example that uses the :func:`ignore_patterns` helper:: Modified: python/trunk/Doc/library/signal.rst ============================================================================== --- python/trunk/Doc/library/signal.rst (original) +++ python/trunk/Doc/library/signal.rst Wed Jun 3 09:25:35 2009 @@ -232,7 +232,7 @@ def handler(signum, frame): print 'Signal handler called with signal', signum - raise IOError, "Couldn't open device!" + raise IOError("Couldn't open device!") # Set the signal handler and a 5-second alarm signal.signal(signal.SIGALRM, handler) Modified: python/trunk/Doc/reference/simple_stmts.rst ============================================================================== --- python/trunk/Doc/reference/simple_stmts.rst (original) +++ python/trunk/Doc/reference/simple_stmts.rst Wed Jun 3 09:25:35 2009 @@ -288,7 +288,7 @@ The extended form, ``assert expression1, expression2``, is equivalent to :: if __debug__: - if not expression1: raise AssertionError, expression2 + if not expression1: raise AssertionError(expression2) .. index:: single: __debug__ Modified: python/trunk/Doc/tools/roman.py ============================================================================== --- python/trunk/Doc/tools/roman.py (original) +++ python/trunk/Doc/tools/roman.py Wed Jun 3 09:25:35 2009 @@ -40,9 +40,9 @@ def toRoman(n): """convert integer to Roman numeral""" if not (0 < n < 5000): - raise OutOfRangeError, "number out of range (must be 1..4999)" - if int(n) <> n: - raise NotIntegerError, "decimals can not be converted" + raise OutOfRangeError("number out of range (must be 1..4999)") + if int(n) != n: + raise NotIntegerError("decimals can not be converted") result = "" for numeral, integer in romanNumeralMap: @@ -67,9 +67,9 @@ def fromRoman(s): """convert Roman numeral to integer""" if not s: - raise InvalidRomanNumeralError, 'Input can not be blank' + raise InvalidRomanNumeralError('Input can not be blank') if not romanNumeralPattern.search(s): - raise InvalidRomanNumeralError, 'Invalid Roman numeral: %s' % s + raise InvalidRomanNumeralError('Invalid Roman numeral: %s' % s) result = 0 index = 0 Modified: python/trunk/Doc/tools/sphinxext/suspicious.py ============================================================================== --- python/trunk/Doc/tools/sphinxext/suspicious.py (original) +++ python/trunk/Doc/tools/sphinxext/suspicious.py Wed Jun 3 09:25:35 2009 @@ -159,7 +159,7 @@ except IOError: return for i, row in enumerate(csv.reader(f)): if len(row) != 4: - raise ValueError, "wrong format in %s, line %d: %s" % (filename, i+1, row) + raise ValueError("wrong format in %s, line %d: %s" % (filename, i+1, row)) docname, lineno, issue, text = row docname = docname.decode('utf-8') if lineno: lineno = int(lineno) From python-checkins at python.org Wed Jun 3 09:26:22 2009 From: python-checkins at python.org (georg.brandl) Date: Wed, 3 Jun 2009 09:26:22 +0200 (CEST) Subject: [Python-checkins] r73164 - python/branches/py3k/Doc/reference/expressions.rst Message-ID: <20090603072622.467D6D82C@mail.python.org> Author: georg.brandl Date: Wed Jun 3 09:26:22 2009 New Revision: 73164 Log: <> is gone (almost). Modified: python/branches/py3k/Doc/reference/expressions.rst Modified: python/branches/py3k/Doc/reference/expressions.rst ============================================================================== --- python/branches/py3k/Doc/reference/expressions.rst (original) +++ python/branches/py3k/Doc/reference/expressions.rst Wed Jun 3 09:26:22 2009 @@ -1253,7 +1253,7 @@ +-----------------------------------------------+-------------------------------------+ | :keyword:`in`, :keyword:`not` :keyword:`in`, | Comparisons, including membership | | :keyword:`is`, :keyword:`is not`, ``<``, | tests and identity tests, | -| ``<=``, ``>``, ``>=``, ``<>``, ``!=``, ``==`` | | +| ``<=``, ``>``, ``>=``, ``!=``, ``==`` | | +-----------------------------------------------+-------------------------------------+ | ``|`` | Bitwise OR | +-----------------------------------------------+-------------------------------------+ From python-checkins at python.org Wed Jun 3 09:26:53 2009 From: python-checkins at python.org (georg.brandl) Date: Wed, 3 Jun 2009 09:26:53 +0200 (CEST) Subject: [Python-checkins] r73165 - python/branches/py3k Message-ID: <20090603072653.71247DA2B@mail.python.org> Author: georg.brandl Date: Wed Jun 3 09:26:53 2009 New Revision: 73165 Log: Blocked revisions 73163 via svnmerge ........ r73163 | georg.brandl | 2009-06-03 09:25:35 +0200 (Mi, 03 Jun 2009) | 1 line Use the preferred form of raise statements in the docs. ........ Modified: python/branches/py3k/ (props changed) From python-checkins at python.org Wed Jun 3 12:26:26 2009 From: python-checkins at python.org (tarek.ziade) Date: Wed, 3 Jun 2009 12:26:26 +0200 (CEST) Subject: [Python-checkins] r73166 - in python/trunk/Lib/distutils: extension.py tests/Setup.sample tests/test_extension.py Message-ID: <20090603102626.A9BBDD958@mail.python.org> Author: tarek.ziade Date: Wed Jun 3 12:26:26 2009 New Revision: 73166 Log: added some tests for distutils.extension + code cleanup Added: python/trunk/Lib/distutils/tests/Setup.sample (contents, props changed) python/trunk/Lib/distutils/tests/test_extension.py (contents, props changed) Modified: python/trunk/Lib/distutils/extension.py Modified: python/trunk/Lib/distutils/extension.py ============================================================================== --- python/trunk/Lib/distutils/extension.py (original) +++ python/trunk/Lib/distutils/extension.py Wed Jun 3 12:26:26 2009 @@ -141,9 +141,11 @@ # class Extension -def read_setup_file (filename): - from distutils.sysconfig import \ - parse_makefile, expand_makefile_vars, _variable_rx +def read_setup_file(filename): + """Reads a Setup file and returns Extension instances.""" + from distutils.sysconfig import (parse_makefile, expand_makefile_vars, + _variable_rx) + from distutils.text_file import TextFile from distutils.util import split_quoted @@ -168,10 +170,8 @@ file.warn("'%s' lines not handled yet" % line) continue - #print "original line: " + line line = expand_makefile_vars(line, vars) words = split_quoted(line) - #print "expanded line: " + line # NB. this parses a slightly different syntax than the old # makesetup script: here, there must be exactly one extension per @@ -237,15 +237,4 @@ extensions.append(ext) - #print "module:", module - #print "source files:", source_files - #print "cpp args:", cpp_args - #print "lib args:", library_args - - #extensions[module] = { 'sources': source_files, - # 'cpp_args': cpp_args, - # 'lib_args': library_args } - return extensions - -# read_setup_file () Added: python/trunk/Lib/distutils/tests/Setup.sample ============================================================================== --- (empty file) +++ python/trunk/Lib/distutils/tests/Setup.sample Wed Jun 3 12:26:26 2009 @@ -0,0 +1,67 @@ +# Setup file from the pygame project + +#--StartConfig +SDL = -I/usr/include/SDL -D_REENTRANT -lSDL +FONT = -lSDL_ttf +IMAGE = -lSDL_image +MIXER = -lSDL_mixer +SMPEG = -lsmpeg +PNG = -lpng +JPEG = -ljpeg +SCRAP = -lX11 +PORTMIDI = -lportmidi +PORTTIME = -lporttime +#--EndConfig + +#DEBUG = -C-W -C-Wall +DEBUG = + +#the following modules are optional. you will want to compile +#everything you can, but you can ignore ones you don't have +#dependencies for, just comment them out + +imageext src/imageext.c $(SDL) $(IMAGE) $(PNG) $(JPEG) $(DEBUG) +font src/font.c $(SDL) $(FONT) $(DEBUG) +mixer src/mixer.c $(SDL) $(MIXER) $(DEBUG) +mixer_music src/music.c $(SDL) $(MIXER) $(DEBUG) +_numericsurfarray src/_numericsurfarray.c $(SDL) $(DEBUG) +_numericsndarray src/_numericsndarray.c $(SDL) $(MIXER) $(DEBUG) +movie src/movie.c $(SDL) $(SMPEG) $(DEBUG) +scrap src/scrap.c $(SDL) $(SCRAP) $(DEBUG) +_camera src/_camera.c src/camera_v4l2.c src/camera_v4l.c $(SDL) $(DEBUG) +pypm src/pypm.c $(SDL) $(PORTMIDI) $(PORTTIME) $(DEBUG) + +GFX = src/SDL_gfx/SDL_gfxPrimitives.c +#GFX = src/SDL_gfx/SDL_gfxBlitFunc.c src/SDL_gfx/SDL_gfxPrimitives.c +gfxdraw src/gfxdraw.c $(SDL) $(GFX) $(DEBUG) + + + +#these modules are required for pygame to run. they only require +#SDL as a dependency. these should not be altered + +base src/base.c $(SDL) $(DEBUG) +cdrom src/cdrom.c $(SDL) $(DEBUG) +color src/color.c $(SDL) $(DEBUG) +constants src/constants.c $(SDL) $(DEBUG) +display src/display.c $(SDL) $(DEBUG) +event src/event.c $(SDL) $(DEBUG) +fastevent src/fastevent.c src/fastevents.c $(SDL) $(DEBUG) +key src/key.c $(SDL) $(DEBUG) +mouse src/mouse.c $(SDL) $(DEBUG) +rect src/rect.c $(SDL) $(DEBUG) +rwobject src/rwobject.c $(SDL) $(DEBUG) +surface src/surface.c src/alphablit.c src/surface_fill.c $(SDL) $(DEBUG) +surflock src/surflock.c $(SDL) $(DEBUG) +time src/time.c $(SDL) $(DEBUG) +joystick src/joystick.c $(SDL) $(DEBUG) +draw src/draw.c $(SDL) $(DEBUG) +image src/image.c $(SDL) $(DEBUG) +overlay src/overlay.c $(SDL) $(DEBUG) +transform src/transform.c src/rotozoom.c src/scale2x.c src/scale_mmx.c $(SDL) $(DEBUG) +mask src/mask.c src/bitmask.c $(SDL) $(DEBUG) +bufferproxy src/bufferproxy.c $(SDL) $(DEBUG) +pixelarray src/pixelarray.c $(SDL) $(DEBUG) +_arraysurfarray src/_arraysurfarray.c $(SDL) $(DEBUG) + + Added: python/trunk/Lib/distutils/tests/test_extension.py ============================================================================== --- (empty file) +++ python/trunk/Lib/distutils/tests/test_extension.py Wed Jun 3 12:26:26 2009 @@ -0,0 +1,36 @@ +"""Tests for distutils.extension.""" +import unittest +import os + +from distutils.extension import read_setup_file + +class ExtensionTestCase(unittest.TestCase): + + def test_read_setup_file(self): + # trying to read a Setup file + # (sample extracted from the PyGame project) + setup = os.path.join(os.path.dirname(__file__), 'Setup.sample') + + exts = read_setup_file(setup) + names = [ext.name for ext in exts] + names.sort() + + # here are the extensions read_setup_file should have created + # out of the file + wanted = ['_arraysurfarray', '_camera', '_numericsndarray', + '_numericsurfarray', 'base', 'bufferproxy', 'cdrom', + 'color', 'constants', 'display', 'draw', 'event', + 'fastevent', 'font', 'gfxdraw', 'image', 'imageext', + 'joystick', 'key', 'mask', 'mixer', 'mixer_music', + 'mouse', 'movie', 'overlay', 'pixelarray', 'pypm', + 'rect', 'rwobject', 'scrap', 'surface', 'surflock', + 'time', 'transform'] + + self.assertEquals(names, wanted) + + +def test_suite(): + return unittest.makeSuite(ExtensionTestCase) + +if __name__ == "__main__": + unittest.main(defaultTest="test_suite") From python-checkins at python.org Wed Jun 3 12:28:11 2009 From: python-checkins at python.org (tarek.ziade) Date: Wed, 3 Jun 2009 12:28:11 +0200 (CEST) Subject: [Python-checkins] r73167 - python/branches/release26-maint Message-ID: <20090603102811.C6E14D9FB@mail.python.org> Author: tarek.ziade Date: Wed Jun 3 12:28:11 2009 New Revision: 73167 Log: Blocked revisions 73166 via svnmerge ........ r73166 | tarek.ziade | 2009-06-03 12:26:26 +0200 (Wed, 03 Jun 2009) | 1 line added some tests for distutils.extension + code cleanup ........ Modified: python/branches/release26-maint/ (props changed) From python-checkins at python.org Wed Jun 3 12:31:15 2009 From: python-checkins at python.org (tarek.ziade) Date: Wed, 3 Jun 2009 12:31:15 +0200 (CEST) Subject: [Python-checkins] r73168 - in python/branches/py3k: Lib/distutils/extension.py Lib/distutils/tests/Setup.sample Lib/distutils/tests/test_extension.py Message-ID: <20090603103115.EE5E7DBAD@mail.python.org> Author: tarek.ziade Date: Wed Jun 3 12:31:15 2009 New Revision: 73168 Log: Merged revisions 73166 via svnmerge from svn+ssh://pythondev at svn.python.org/python/trunk ........ r73166 | tarek.ziade | 2009-06-03 12:26:26 +0200 (Wed, 03 Jun 2009) | 1 line added some tests for distutils.extension + code cleanup ........ Added: python/branches/py3k/Lib/distutils/tests/Setup.sample - copied unchanged from r73166, /python/trunk/Lib/distutils/tests/Setup.sample python/branches/py3k/Lib/distutils/tests/test_extension.py - copied unchanged from r73166, /python/trunk/Lib/distutils/tests/test_extension.py Modified: python/branches/py3k/ (props changed) python/branches/py3k/Lib/distutils/extension.py Modified: python/branches/py3k/Lib/distutils/extension.py ============================================================================== --- python/branches/py3k/Lib/distutils/extension.py (original) +++ python/branches/py3k/Lib/distutils/extension.py Wed Jun 3 12:31:15 2009 @@ -139,8 +139,10 @@ def read_setup_file(filename): - from distutils.sysconfig import \ - parse_makefile, expand_makefile_vars, _variable_rx + """Reads a Setup file and returns Extension instances.""" + from distutils.sysconfig import (parse_makefile, expand_makefile_vars, + _variable_rx) + from distutils.text_file import TextFile from distutils.util import split_quoted @@ -165,10 +167,8 @@ file.warn("'%s' lines not handled yet" % line) continue - #print "original line: " + line line = expand_makefile_vars(line, vars) words = split_quoted(line) - #print "expanded line: " + line # NB. this parses a slightly different syntax than the old # makesetup script: here, there must be exactly one extension per @@ -234,13 +234,4 @@ extensions.append(ext) - #print "module:", module - #print "source files:", source_files - #print "cpp args:", cpp_args - #print "lib args:", library_args - - #extensions[module] = { 'sources': source_files, - # 'cpp_args': cpp_args, - # 'lib_args': library_args } - return extensions From python-checkins at python.org Wed Jun 3 12:31:55 2009 From: python-checkins at python.org (tarek.ziade) Date: Wed, 3 Jun 2009 12:31:55 +0200 (CEST) Subject: [Python-checkins] r73169 - python/branches/release30-maint Message-ID: <20090603103155.1A1C2DBA8@mail.python.org> Author: tarek.ziade Date: Wed Jun 3 12:31:54 2009 New Revision: 73169 Log: Blocked revisions 73168 via svnmerge ................ r73168 | tarek.ziade | 2009-06-03 12:31:15 +0200 (Wed, 03 Jun 2009) | 9 lines Merged revisions 73166 via svnmerge from svn+ssh://pythondev at svn.python.org/python/trunk ........ r73166 | tarek.ziade | 2009-06-03 12:26:26 +0200 (Wed, 03 Jun 2009) | 1 line added some tests for distutils.extension + code cleanup ........ ................ Modified: python/branches/release30-maint/ (props changed) From python-checkins at python.org Wed Jun 3 13:12:08 2009 From: python-checkins at python.org (tarek.ziade) Date: Wed, 3 Jun 2009 13:12:08 +0200 (CEST) Subject: [Python-checkins] r73170 - in python/trunk/Lib/distutils: extension.py tests/test_extension.py Message-ID: <20090603111208.353F7DB44@mail.python.org> Author: tarek.ziade Date: Wed Jun 3 13:12:08 2009 New Revision: 73170 Log: more cleanup and test coverage for distutils.extension Modified: python/trunk/Lib/distutils/extension.py python/trunk/Lib/distutils/tests/test_extension.py Modified: python/trunk/Lib/distutils/extension.py ============================================================================== --- python/trunk/Lib/distutils/extension.py (original) +++ python/trunk/Lib/distutils/extension.py Wed Jun 3 13:12:08 2009 @@ -5,13 +5,9 @@ __revision__ = "$Id$" -import os, string, sys -from types import * - -try: - import warnings -except ImportError: - warnings = None +import os +import sys +import warnings # This class is really only used by the "build_ext" command, so it might # make sense to put it in distutils.command.build_ext. However, that @@ -107,9 +103,9 @@ optional=None, **kw # To catch unknown keywords ): - assert type(name) is StringType, "'name' must be a string" - assert (type(sources) is ListType and - map(type, sources) == [StringType]*len(sources)), \ + assert isinstance(name, str) + assert (isinstance(sources, list) and + all(isinstance(v, str) for v in sources)), \ "'sources' must be a list of strings" self.name = name @@ -130,16 +126,11 @@ self.optional = optional # If there are unknown keyword options, warn about them - if len(kw): - L = kw.keys() ; L.sort() - L = map(repr, L) - msg = "Unknown Extension options: " + string.join(L, ', ') - if warnings is not None: - warnings.warn(msg) - else: - sys.stderr.write(msg + '\n') -# class Extension - + if len(kw) > 0: + options = [repr(option) for option in kw] + options = ', '.join(sorted(options)) + msg = "Unknown Extension options: %s" % options + warnings.warn(msg) def read_setup_file(filename): """Reads a Setup file and returns Extension instances.""" @@ -200,7 +191,7 @@ elif switch == "-I": ext.include_dirs.append(value) elif switch == "-D": - equals = string.find(value, "=") + equals = value.find("=") if equals == -1: # bare "-DFOO" -- no value ext.define_macros.append((value, None)) else: # "-DFOO=blah" Modified: python/trunk/Lib/distutils/tests/test_extension.py ============================================================================== --- python/trunk/Lib/distutils/tests/test_extension.py (original) +++ python/trunk/Lib/distutils/tests/test_extension.py Wed Jun 3 13:12:08 2009 @@ -1,8 +1,10 @@ """Tests for distutils.extension.""" import unittest import os +import warnings -from distutils.extension import read_setup_file +from test.test_support import check_warnings +from distutils.extension import read_setup_file, Extension class ExtensionTestCase(unittest.TestCase): @@ -28,6 +30,37 @@ self.assertEquals(names, wanted) + def test_extension_init(self): + # the first argument, which is the name, must be a string + self.assertRaises(AssertionError, Extension, 1, []) + ext = Extension('name', []) + self.assertEquals(ext.name, 'name') + + # the second argument, which is the list of files, must + # be a list of strings + self.assertRaises(AssertionError, Extension, 'name', 'file') + self.assertRaises(AssertionError, Extension, 'name', ['file', 1]) + ext = Extension('name', ['file1', 'file2']) + self.assertEquals(ext.sources, ['file1', 'file2']) + + # others arguments have defaults + for attr in ('include_dirs', 'define_macros', 'undef_macros', + 'library_dirs', 'libraries', 'runtime_library_dirs', + 'extra_objects', 'extra_compile_args', 'extra_link_args', + 'export_symbols', 'swig_opts', 'depends'): + self.assertEquals(getattr(ext, attr), []) + + self.assertEquals(ext.language, None) + self.assertEquals(ext.optional, None) + + # if there are unknown keyword options, warn about them + with check_warnings() as w: + warnings.simplefilter('always') + ext = Extension('name', ['file1', 'file2'], chic=True) + + self.assertEquals(len(w.warnings), 1) + self.assertEquals(str(w.warnings[0].message), + "Unknown Extension options: 'chic'") def test_suite(): return unittest.makeSuite(ExtensionTestCase) From python-checkins at python.org Wed Jun 3 13:13:24 2009 From: python-checkins at python.org (tarek.ziade) Date: Wed, 3 Jun 2009 13:13:24 +0200 (CEST) Subject: [Python-checkins] r73171 - python/branches/release26-maint Message-ID: <20090603111324.A7083DB90@mail.python.org> Author: tarek.ziade Date: Wed Jun 3 13:13:24 2009 New Revision: 73171 Log: Blocked revisions 73170 via svnmerge ........ r73170 | tarek.ziade | 2009-06-03 13:12:08 +0200 (Wed, 03 Jun 2009) | 1 line more cleanup and test coverage for distutils.extension ........ Modified: python/branches/release26-maint/ (props changed) From python-checkins at python.org Wed Jun 3 13:17:15 2009 From: python-checkins at python.org (tarek.ziade) Date: Wed, 3 Jun 2009 13:17:15 +0200 (CEST) Subject: [Python-checkins] r73172 - in python/branches/py3k: Lib/distutils/extension.py Lib/distutils/tests/test_extension.py Message-ID: <20090603111715.3DA3FDA61@mail.python.org> Author: tarek.ziade Date: Wed Jun 3 13:17:15 2009 New Revision: 73172 Log: Merged revisions 73170 via svnmerge from svn+ssh://pythondev at svn.python.org/python/trunk ........ r73170 | tarek.ziade | 2009-06-03 13:12:08 +0200 (Wed, 03 Jun 2009) | 1 line more cleanup and test coverage for distutils.extension ........ Modified: python/branches/py3k/ (props changed) python/branches/py3k/Lib/distutils/extension.py python/branches/py3k/Lib/distutils/tests/test_extension.py Modified: python/branches/py3k/Lib/distutils/extension.py ============================================================================== --- python/branches/py3k/Lib/distutils/extension.py (original) +++ python/branches/py3k/Lib/distutils/extension.py Wed Jun 3 13:17:15 2009 @@ -5,12 +5,9 @@ __revision__ = "$Id$" -import os, sys - -try: - import warnings -except ImportError: - warnings = None +import os +import sys +import warnings # This class is really only used by the "build_ext" command, so it might # make sense to put it in distutils.command.build_ext. However, that @@ -129,14 +126,11 @@ self.optional = optional # If there are unknown keyword options, warn about them - if len(kw): - L = map(repr, sorted(kw)) - msg = "Unknown Extension options: " + ', '.join(L) - if warnings is not None: - warnings.warn(msg) - else: - sys.stderr.write(msg + '\n') - + if len(kw) > 0: + options = [repr(option) for option in kw] + options = ', '.join(sorted(options)) + msg = "Unknown Extension options: %s" % options + warnings.warn(msg) def read_setup_file(filename): """Reads a Setup file and returns Extension instances.""" Modified: python/branches/py3k/Lib/distutils/tests/test_extension.py ============================================================================== --- python/branches/py3k/Lib/distutils/tests/test_extension.py (original) +++ python/branches/py3k/Lib/distutils/tests/test_extension.py Wed Jun 3 13:17:15 2009 @@ -1,8 +1,10 @@ """Tests for distutils.extension.""" import unittest import os +import warnings -from distutils.extension import read_setup_file +from test.support import check_warnings +from distutils.extension import read_setup_file, Extension class ExtensionTestCase(unittest.TestCase): @@ -28,6 +30,37 @@ self.assertEquals(names, wanted) + def test_extension_init(self): + # the first argument, which is the name, must be a string + self.assertRaises(AssertionError, Extension, 1, []) + ext = Extension('name', []) + self.assertEquals(ext.name, 'name') + + # the second argument, which is the list of files, must + # be a list of strings + self.assertRaises(AssertionError, Extension, 'name', 'file') + self.assertRaises(AssertionError, Extension, 'name', ['file', 1]) + ext = Extension('name', ['file1', 'file2']) + self.assertEquals(ext.sources, ['file1', 'file2']) + + # others arguments have defaults + for attr in ('include_dirs', 'define_macros', 'undef_macros', + 'library_dirs', 'libraries', 'runtime_library_dirs', + 'extra_objects', 'extra_compile_args', 'extra_link_args', + 'export_symbols', 'swig_opts', 'depends'): + self.assertEquals(getattr(ext, attr), []) + + self.assertEquals(ext.language, None) + self.assertEquals(ext.optional, None) + + # if there are unknown keyword options, warn about them + with check_warnings() as w: + warnings.simplefilter('always') + ext = Extension('name', ['file1', 'file2'], chic=True) + + self.assertEquals(len(w.warnings), 1) + self.assertEquals(str(w.warnings[0].message), + "Unknown Extension options: 'chic'") def test_suite(): return unittest.makeSuite(ExtensionTestCase) From python-checkins at python.org Wed Jun 3 13:18:27 2009 From: python-checkins at python.org (tarek.ziade) Date: Wed, 3 Jun 2009 13:18:27 +0200 (CEST) Subject: [Python-checkins] r73173 - python/branches/release30-maint Message-ID: <20090603111827.5B71DDB61@mail.python.org> Author: tarek.ziade Date: Wed Jun 3 13:18:27 2009 New Revision: 73173 Log: Blocked revisions 73172 via svnmerge ................ r73172 | tarek.ziade | 2009-06-03 13:17:15 +0200 (Wed, 03 Jun 2009) | 9 lines Merged revisions 73170 via svnmerge from svn+ssh://pythondev at svn.python.org/python/trunk ........ r73170 | tarek.ziade | 2009-06-03 13:12:08 +0200 (Wed, 03 Jun 2009) | 1 line more cleanup and test coverage for distutils.extension ........ ................ Modified: python/branches/release30-maint/ (props changed) From python-checkins at python.org Wed Jun 3 13:20:44 2009 From: python-checkins at python.org (tarek.ziade) Date: Wed, 3 Jun 2009 13:20:44 +0200 (CEST) Subject: [Python-checkins] r73174 - python/trunk/Lib/distutils/extension.py Message-ID: <20090603112044.8B0D4DB94@mail.python.org> Author: tarek.ziade Date: Wed Jun 3 13:20:44 2009 New Revision: 73174 Log: assertion message was dropped Modified: python/trunk/Lib/distutils/extension.py Modified: python/trunk/Lib/distutils/extension.py ============================================================================== --- python/trunk/Lib/distutils/extension.py (original) +++ python/trunk/Lib/distutils/extension.py Wed Jun 3 13:20:44 2009 @@ -103,7 +103,7 @@ optional=None, **kw # To catch unknown keywords ): - assert isinstance(name, str) + assert isinstance(name, str), "'name' must be a string" assert (isinstance(sources, list) and all(isinstance(v, str) for v in sources)), \ "'sources' must be a list of strings" From python-checkins at python.org Wed Jun 3 13:21:17 2009 From: python-checkins at python.org (tarek.ziade) Date: Wed, 3 Jun 2009 13:21:17 +0200 (CEST) Subject: [Python-checkins] r73175 - python/branches/release26-maint Message-ID: <20090603112117.750FFDB69@mail.python.org> Author: tarek.ziade Date: Wed Jun 3 13:21:17 2009 New Revision: 73175 Log: Blocked revisions 73174 via svnmerge ........ r73174 | tarek.ziade | 2009-06-03 13:20:44 +0200 (Wed, 03 Jun 2009) | 1 line assertion message was dropped ........ Modified: python/branches/release26-maint/ (props changed) From python-checkins at python.org Wed Jun 3 13:22:48 2009 From: python-checkins at python.org (tarek.ziade) Date: Wed, 3 Jun 2009 13:22:48 +0200 (CEST) Subject: [Python-checkins] r73176 - python/branches/py3k Message-ID: <20090603112248.53A07DBB1@mail.python.org> Author: tarek.ziade Date: Wed Jun 3 13:22:48 2009 New Revision: 73176 Log: Blocked revisions 73174 via svnmerge ........ r73174 | tarek.ziade | 2009-06-03 13:20:44 +0200 (Wed, 03 Jun 2009) | 1 line assertion message was dropped ........ Modified: python/branches/py3k/ (props changed) From python-checkins at python.org Wed Jun 3 13:41:45 2009 From: python-checkins at python.org (benjamin.peterson) Date: Wed, 3 Jun 2009 13:41:45 +0200 (CEST) Subject: [Python-checkins] r73177 - python/branches/py3k/Makefile.pre.in Message-ID: <20090603114145.80D7ADBDC@mail.python.org> Author: benjamin.peterson Date: Wed Jun 3 13:41:45 2009 New Revision: 73177 Log: remove extra "|"s Modified: python/branches/py3k/Makefile.pre.in Modified: python/branches/py3k/Makefile.pre.in ============================================================================== --- python/branches/py3k/Makefile.pre.in (original) +++ python/branches/py3k/Makefile.pre.in Wed Jun 3 13:41:45 2009 @@ -910,12 +910,12 @@ -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \ ./$(BUILDPYTHON) -Wi $(DESTDIR)$(LIBDEST)/compileall.py \ -d $(LIBDEST) -f \ - -x 'bad_coding|badsyntax|site-packages|py2_test_grammar|crlf|different_encoding|' \ + -x 'bad_coding|badsyntax|site-packages|py2_test_grammar|crlf|different_encoding' \ $(DESTDIR)$(LIBDEST) -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \ ./$(BUILDPYTHON) -Wi -O $(DESTDIR)$(LIBDEST)/compileall.py \ -d $(LIBDEST) -f \ - -x 'bad_coding|badsyntax|site-packages|py2_test_grammar|crlf|different_encoding|' \ + -x 'bad_coding|badsyntax|site-packages|py2_test_grammar|crlf|different_encoding' \ $(DESTDIR)$(LIBDEST) -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \ ./$(BUILDPYTHON) -Wi $(DESTDIR)$(LIBDEST)/compileall.py \ From buildbot at python.org Wed Jun 3 13:42:35 2009 From: buildbot at python.org (buildbot at python.org) Date: Wed, 03 Jun 2009 11:42:35 +0000 Subject: [Python-checkins] buildbot failure in amd64 gentoo 3.x Message-ID: <20090603114235.EADC0C524@mail.python.org> The Buildbot has detected a new failure of amd64 gentoo 3.x. Full details are available at: http://www.python.org/dev/buildbot/all/amd64%20gentoo%203.x/builds/754 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: norwitz-amd64 Build Reason: Build Source Stamp: [branch branches/py3k] HEAD Blamelist: tarek.ziade BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_smtplib make: *** [buildbottest] Error 1 sincerely, -The Buildbot From python-checkins at python.org Wed Jun 3 19:21:17 2009 From: python-checkins at python.org (raymond.hettinger) Date: Wed, 3 Jun 2009 19:21:17 +0200 (CEST) Subject: [Python-checkins] r73178 - python/branches/py3k/Lib/antigravity.py Message-ID: <20090603172117.D82F8D76C@mail.python.org> Author: raymond.hettinger Date: Wed Jun 3 19:21:17 2009 New Revision: 73178 Log: Another hidden treasure. Modified: python/branches/py3k/Lib/antigravity.py Modified: python/branches/py3k/Lib/antigravity.py ============================================================================== --- python/branches/py3k/Lib/antigravity.py (original) +++ python/branches/py3k/Lib/antigravity.py Wed Jun 3 19:21:17 2009 @@ -1,4 +1,17 @@ import webbrowser +import hashlib webbrowser.open("http://xkcd.com/353/") + +def geohash(latitude, longitude, datedow): + '''Compute geohash() using the Munroe algorithm. + + >>> geohash(37.421542, -122.085589, b'2005-05-26-10458.68') + 37.857713 -122.544543 + + ''' + # http://xkcd.com/426/ + h = hashlib.md5(datedow).hexdigest() + p, q = [('%f' % float.fromhex('0.' + x)) for x in (h[:16], h[16:32])] + print('%d%s %d%s' % (latitude, p[1:], longitude, q[1:])) From python-checkins at python.org Wed Jun 3 20:09:53 2009 From: python-checkins at python.org (benjamin.peterson) Date: Wed, 3 Jun 2009 20:09:53 +0200 (CEST) Subject: [Python-checkins] r73179 - in sandbox/trunk/2to3/lib2to3: fixes/fix_buffer.py tests/test_fixers.py Message-ID: <20090603180953.CEA43DCED@mail.python.org> Author: benjamin.peterson Date: Wed Jun 3 20:09:53 2009 New Revision: 73179 Log: handle the case where there's multiple trailers #6185 Modified: sandbox/trunk/2to3/lib2to3/fixes/fix_buffer.py sandbox/trunk/2to3/lib2to3/tests/test_fixers.py Modified: sandbox/trunk/2to3/lib2to3/fixes/fix_buffer.py ============================================================================== --- sandbox/trunk/2to3/lib2to3/fixes/fix_buffer.py (original) +++ sandbox/trunk/2to3/lib2to3/fixes/fix_buffer.py Wed Jun 3 20:09:53 2009 @@ -13,7 +13,7 @@ explicit = True # The user must ask for this fixer PATTERN = """ - power< name='buffer' trailer< '(' [any] ')' > > + power< name='buffer' trailer< '(' [any] ')' > any* > """ def transform(self, node, results): Modified: sandbox/trunk/2to3/lib2to3/tests/test_fixers.py ============================================================================== --- sandbox/trunk/2to3/lib2to3/tests/test_fixers.py (original) +++ sandbox/trunk/2to3/lib2to3/tests/test_fixers.py Wed Jun 3 20:09:53 2009 @@ -3325,6 +3325,11 @@ a = """x = memoryview(y)""" self.check(b, a) + def test_slicing(self): + b = """buffer(y)[4:5]""" + a = """memoryview(y)[4:5]""" + self.check(b, a) + class Test_future(FixerTestCase): fixer = "future" From python-checkins at python.org Wed Jun 3 20:18:05 2009 From: python-checkins at python.org (benjamin.peterson) Date: Wed, 3 Jun 2009 20:18:05 +0200 (CEST) Subject: [Python-checkins] r73180 - sandbox/trunk/2to3/lib2to3/tests/test_fixers.py Message-ID: <20090603181805.4E32DD908@mail.python.org> Author: benjamin.peterson Date: Wed Jun 3 20:18:05 2009 New Revision: 73180 Log: scrap __main__ section Modified: sandbox/trunk/2to3/lib2to3/tests/test_fixers.py Modified: sandbox/trunk/2to3/lib2to3/tests/test_fixers.py ============================================================================== --- sandbox/trunk/2to3/lib2to3/tests/test_fixers.py (original) +++ sandbox/trunk/2to3/lib2to3/tests/test_fixers.py Wed Jun 3 20:18:05 2009 @@ -4052,8 +4052,3 @@ b = """os.getcwdu ( )""" a = """os.getcwd ( )""" self.check(b, a) - - -if __name__ == "__main__": - import __main__ - support.run_all_tests(__main__) From python-checkins at python.org Wed Jun 3 20:24:48 2009 From: python-checkins at python.org (benjamin.peterson) Date: Wed, 3 Jun 2009 20:24:48 +0200 (CEST) Subject: [Python-checkins] r73181 - in sandbox/trunk/2to3/lib2to3/tests: pytree_idempotency.py test_all_fixers.py test_fixers.py test_parser.py test_pytree.py test_util.py Message-ID: <20090603182448.543D3DA1E@mail.python.org> Author: benjamin.peterson Date: Wed Jun 3 20:24:48 2009 New Revision: 73181 Log: remove shebang lines and __main__ sections Modified: sandbox/trunk/2to3/lib2to3/tests/pytree_idempotency.py sandbox/trunk/2to3/lib2to3/tests/test_all_fixers.py sandbox/trunk/2to3/lib2to3/tests/test_fixers.py sandbox/trunk/2to3/lib2to3/tests/test_parser.py sandbox/trunk/2to3/lib2to3/tests/test_pytree.py sandbox/trunk/2to3/lib2to3/tests/test_util.py Modified: sandbox/trunk/2to3/lib2to3/tests/pytree_idempotency.py ============================================================================== --- sandbox/trunk/2to3/lib2to3/tests/pytree_idempotency.py (original) +++ sandbox/trunk/2to3/lib2to3/tests/pytree_idempotency.py Wed Jun 3 20:24:48 2009 @@ -1,4 +1,4 @@ -#!/usr/bin/env python2.5 +#!/usr/bin/env python # Copyright 2006 Google, Inc. All Rights Reserved. # Licensed to PSF under a Contributor Agreement. Modified: sandbox/trunk/2to3/lib2to3/tests/test_all_fixers.py ============================================================================== --- sandbox/trunk/2to3/lib2to3/tests/test_all_fixers.py (original) +++ sandbox/trunk/2to3/lib2to3/tests/test_all_fixers.py Wed Jun 3 20:24:48 2009 @@ -1,4 +1,3 @@ -#!/usr/bin/env python2.5 """Tests that run all fixer modules over an input stream. This has been broken out into its own test module because of its @@ -6,18 +5,13 @@ """ # Author: Collin Winter -# Testing imports -try: - from . import support -except ImportError: - import support - # Python imports import unittest # Local imports from .. import pytree from .. import refactor +from . import support class Test_all(support.TestCase): def setUp(self): @@ -28,8 +22,3 @@ for filepath in support.all_project_files(): print "Fixing %s..." % filepath self.refactor.refactor_file(filepath) - - -if __name__ == "__main__": - import __main__ - support.run_all_tests(__main__) Modified: sandbox/trunk/2to3/lib2to3/tests/test_fixers.py ============================================================================== --- sandbox/trunk/2to3/lib2to3/tests/test_fixers.py (original) +++ sandbox/trunk/2to3/lib2to3/tests/test_fixers.py Wed Jun 3 20:24:48 2009 @@ -1,12 +1,4 @@ -#!/usr/bin/env python2.5 """ Test suite for the fixer modules """ -# Author: Collin Winter - -# Testing imports -try: - from tests import support -except ImportError: - import support # Python imports import os @@ -16,6 +8,7 @@ # Local imports from lib2to3 import pygram, pytree, refactor, fixer_util +from lib2to3.tests import support class FixerTestCase(support.TestCase): Modified: sandbox/trunk/2to3/lib2to3/tests/test_parser.py ============================================================================== --- sandbox/trunk/2to3/lib2to3/tests/test_parser.py (original) +++ sandbox/trunk/2to3/lib2to3/tests/test_parser.py Wed Jun 3 20:24:48 2009 @@ -1,4 +1,3 @@ -#!/usr/bin/env python2.5 """Test suite for 2to3's parser and grammar files. This is the place to add tests for changes to 2to3's grammar, such as those @@ -6,7 +5,6 @@ parts of the grammar we've changed, we also make sure we can parse the test_grammar.py files from both Python 2 and Python 3. """ -# Author: Collin Winter # Testing imports from . import support @@ -207,8 +205,3 @@ return os.system("diff -u %s @" % fn) finally: os.remove("@") - - -if __name__ == "__main__": - import __main__ - support.run_all_tests(__main__) Modified: sandbox/trunk/2to3/lib2to3/tests/test_pytree.py ============================================================================== --- sandbox/trunk/2to3/lib2to3/tests/test_pytree.py (original) +++ sandbox/trunk/2to3/lib2to3/tests/test_pytree.py Wed Jun 3 20:24:48 2009 @@ -1,4 +1,3 @@ -#!/usr/bin/env python2.5 # Copyright 2006 Google, Inc. All Rights Reserved. # Licensed to PSF under a Contributor Agreement. @@ -462,8 +461,3 @@ r = {} self.assert_(pattern.match(node, r)) self.assertEqual(r["args"], [l2]) - - -if __name__ == "__main__": - import __main__ - support.run_all_tests(__main__) Modified: sandbox/trunk/2to3/lib2to3/tests/test_util.py ============================================================================== --- sandbox/trunk/2to3/lib2to3/tests/test_util.py (original) +++ sandbox/trunk/2to3/lib2to3/tests/test_util.py Wed Jun 3 20:24:48 2009 @@ -1,6 +1,4 @@ -#!/usr/bin/env python2.5 """ Test suite for the code in fixes.util """ -# Author: Collin Winter # Testing imports from . import support @@ -552,8 +550,3 @@ node = parse('bar()') fixer_util.touch_import(None, "cgi", node) self.assertEqual(str(node), 'import cgi\nbar()\n\n') - - -if __name__ == "__main__": - import __main__ - support.run_all_tests(__main__) From python-checkins at python.org Wed Jun 3 21:46:21 2009 From: python-checkins at python.org (josiah.carlson) Date: Wed, 3 Jun 2009 21:46:21 +0200 (CEST) Subject: [Python-checkins] r73182 - python/trunk/Lib/asyncore.py Message-ID: <20090603194621.E5CD6DADC@mail.python.org> Author: josiah.carlson Date: Wed Jun 3 21:46:21 2009 New Revision: 73182 Log: This fixes bug 5798 on OS X. This should also fix disconnect behavior cross-platform. Modified: python/trunk/Lib/asyncore.py Modified: python/trunk/Lib/asyncore.py ============================================================================== --- python/trunk/Lib/asyncore.py (original) +++ python/trunk/Lib/asyncore.py Wed Jun 3 21:46:21 2009 @@ -101,10 +101,16 @@ obj.handle_read_event() if flags & select.POLLOUT: obj.handle_write_event() - if flags & (select.POLLHUP | select.POLLERR | select.POLLNVAL): - obj.handle_close() if flags & select.POLLPRI: obj.handle_expt_event() + if flags & (select.POLLHUP | select.POLLERR | select.POLLNVAL): + obj.handle_close() + except socket.error, e: + if e.args[0] not in (EBADF, ECONNRESET, ENOTCONN, ESHUTDOWN, +ECONNABORTED): + obj.handle_error() + else: + obj.handle_close() except _reraised_exceptions: raise except: From python-checkins at python.org Wed Jun 3 21:48:02 2009 From: python-checkins at python.org (josiah.carlson) Date: Wed, 3 Jun 2009 21:48:02 +0200 (CEST) Subject: [Python-checkins] r73183 - python/branches/py3k/Lib/asyncore.py Message-ID: <20090603194802.258F6D9D0@mail.python.org> Author: josiah.carlson Date: Wed Jun 3 21:48:02 2009 New Revision: 73183 Log: This fixes bug 5798 on OS X. This should also fix disconnect behavior cross-platform. Modified: python/branches/py3k/Lib/asyncore.py Modified: python/branches/py3k/Lib/asyncore.py ============================================================================== --- python/branches/py3k/Lib/asyncore.py (original) +++ python/branches/py3k/Lib/asyncore.py Wed Jun 3 21:48:02 2009 @@ -100,10 +100,15 @@ obj.handle_read_event() if flags & select.POLLOUT: obj.handle_write_event() - if flags & (select.POLLHUP | select.POLLERR | select.POLLNVAL): - obj.handle_close() if flags & select.POLLPRI: obj.handle_expt_event() + if flags & (select.POLLHUP | select.POLLERR | select.POLLNVAL): + obj.handle_close() + except socket.error as e: + if e.args[0] not in (EBADF, ECONNRESET, ENOTCONN, ESHUTDOWN, ECONNABORTED): + obj.handle_error() + else: + obj.handle_close() except _reraised_exceptions: raise except: From python-checkins at python.org Wed Jun 3 21:51:53 2009 From: python-checkins at python.org (josiah.carlson) Date: Wed, 3 Jun 2009 21:51:53 +0200 (CEST) Subject: [Python-checkins] r73184 - python/trunk/Lib/asyncore.py Message-ID: <20090603195153.25B6DDA9E@mail.python.org> Author: josiah.carlson Date: Wed Jun 3 21:51:52 2009 New Revision: 73184 Log: Fix for line wrap ugly. Modified: python/trunk/Lib/asyncore.py Modified: python/trunk/Lib/asyncore.py ============================================================================== --- python/trunk/Lib/asyncore.py (original) +++ python/trunk/Lib/asyncore.py Wed Jun 3 21:51:52 2009 @@ -106,8 +106,7 @@ if flags & (select.POLLHUP | select.POLLERR | select.POLLNVAL): obj.handle_close() except socket.error, e: - if e.args[0] not in (EBADF, ECONNRESET, ENOTCONN, ESHUTDOWN, -ECONNABORTED): + if e.args[0] not in (EBADF, ECONNRESET, ENOTCONN, ESHUTDOWN, ECONNABORTED): obj.handle_error() else: obj.handle_close() From python-checkins at python.org Wed Jun 3 23:00:59 2009 From: python-checkins at python.org (georg.brandl) Date: Wed, 3 Jun 2009 23:00:59 +0200 (CEST) Subject: [Python-checkins] r73185 - python/branches/py3k/Doc/tutorial/introduction.rst Message-ID: <20090603210059.189F4D93D@mail.python.org> Author: georg.brandl Date: Wed Jun 3 23:00:58 2009 New Revision: 73185 Log: #6190: Remove duplicate paragraph. Modified: python/branches/py3k/Doc/tutorial/introduction.rst Modified: python/branches/py3k/Doc/tutorial/introduction.rst ============================================================================== --- python/branches/py3k/Doc/tutorial/introduction.rst (original) +++ python/branches/py3k/Doc/tutorial/introduction.rst Wed Jun 3 23:00:58 2009 @@ -239,13 +239,6 @@ This is a rather long string containing\n\ several lines of text much as you would do in C. -The interpreter prints the result of string operations in the same way as they -are typed for input: inside quotes, and with quotes and other funny characters -escaped by backslashes, to show the precise value. The string is enclosed in -double quotes if the string contains a single quote and no double quotes, else -it's enclosed in single quotes. (The :func:`print` function, described later, -can be used to write strings without quotes or escapes.) - Strings can be concatenated (glued together) with the ``+`` operator, and repeated with ``*``:: From python-checkins at python.org Wed Jun 3 23:21:09 2009 From: python-checkins at python.org (georg.brandl) Date: Wed, 3 Jun 2009 23:21:09 +0200 (CEST) Subject: [Python-checkins] r73186 - python/trunk/Doc/whatsnew/2.6.rst Message-ID: <20090603212109.5503FD992@mail.python.org> Author: georg.brandl Date: Wed Jun 3 23:21:09 2009 New Revision: 73186 Log: #6174: fix indentation in code example. Modified: python/trunk/Doc/whatsnew/2.6.rst Modified: python/trunk/Doc/whatsnew/2.6.rst ============================================================================== --- python/trunk/Doc/whatsnew/2.6.rst (original) +++ python/trunk/Doc/whatsnew/2.6.rst Wed Jun 3 23:21:09 2009 @@ -678,15 +678,15 @@ for N in range(1, 1000, 10): p.apply_async(factorial, (N, d)) - # Mark pool as closed -- no more tasks can be added. - p.close() + # Mark pool as closed -- no more tasks can be added. + p.close() - # Wait for tasks to exit - p.join() + # Wait for tasks to exit + p.join() - # Output results - for k, v in sorted(d.items()): - print k, v + # Output results + for k, v in sorted(d.items()): + print k, v This will produce the output:: From python-checkins at python.org Thu Jun 4 00:18:05 2009 From: python-checkins at python.org (ronald.oussoren) Date: Thu, 4 Jun 2009 00:18:05 +0200 (CEST) Subject: [Python-checkins] r73187 - python/branches/py3k/Mac/PythonLauncher/Python Launcher.app Message-ID: <20090603221805.EF84CC2B2@mail.python.org> Author: ronald.oussoren Date: Thu Jun 4 00:18:05 2009 New Revision: 73187 Log: Remove the application stub for Python Launcher. This directory structure isn't used during the build and causes problems when you do build without a separate build directory. Fixes issue 5267 Removed: python/branches/py3k/Mac/PythonLauncher/Python Launcher.app/ From python-checkins at python.org Thu Jun 4 00:19:45 2009 From: python-checkins at python.org (ronald.oussoren) Date: Thu, 4 Jun 2009 00:19:45 +0200 (CEST) Subject: [Python-checkins] r73188 - in python/branches/release30-maint: Mac/PythonLauncher/Python Launcher.app Message-ID: <20090603221945.6784FC2B2@mail.python.org> Author: ronald.oussoren Date: Thu Jun 4 00:19:45 2009 New Revision: 73188 Log: Merged revisions 73187 via svnmerge from svn+ssh://pythondev at svn.python.org/python/branches/py3k ........ r73187 | ronald.oussoren | 2009-06-04 00:18:05 +0200 (Thu, 04 Jun 2009) | 7 lines Remove the application stub for Python Launcher. This directory structure isn't used during the build and causes problems when you do build without a separate build directory. Fixes issue 5267 ........ Removed: python/branches/release30-maint/Mac/PythonLauncher/Python Launcher.app/ Modified: python/branches/release30-maint/ (props changed) From python-checkins at python.org Thu Jun 4 00:49:42 2009 From: python-checkins at python.org (benjamin.peterson) Date: Thu, 4 Jun 2009 00:49:42 +0200 (CEST) Subject: [Python-checkins] r73189 - sandbox/trunk/2to3/setup.py Message-ID: <20090603224942.DA7CFD87D@mail.python.org> Author: benjamin.peterson Date: Thu Jun 4 00:49:42 2009 New Revision: 73189 Log: remove setup.py; 2to3 is not distributed separately Removed: sandbox/trunk/2to3/setup.py Deleted: sandbox/trunk/2to3/setup.py ============================================================================== --- sandbox/trunk/2to3/setup.py Thu Jun 4 00:49:42 2009 +++ (empty file) @@ -1,8 +0,0 @@ -from distutils.core import setup - -setup( - name="2to3", - packages=['lib2to3','lib2to3.fixes','lib2to3.pgen2'], - package_data={'lib2to3':['Grammar.txt','PatternGrammar.txt']}, - scripts=["2to3"] -) From python-checkins at python.org Thu Jun 4 01:23:45 2009 From: python-checkins at python.org (georg.brandl) Date: Thu, 4 Jun 2009 01:23:45 +0200 (CEST) Subject: [Python-checkins] r73190 - python/trunk/Lib/test/test_pep352.py Message-ID: <20090603232345.4F08AD91E@mail.python.org> Author: georg.brandl Date: Thu Jun 4 01:23:45 2009 New Revision: 73190 Log: Avoid PendingDeprecationWarnings by using deprecated unittest methods. Modified: python/trunk/Lib/test/test_pep352.py Modified: python/trunk/Lib/test/test_pep352.py ============================================================================== --- python/trunk/Lib/test/test_pep352.py (original) +++ python/trunk/Lib/test/test_pep352.py Thu Jun 4 01:23:45 2009 @@ -26,7 +26,7 @@ ignore_message_warning() for attr in ("args", "message", "__str__", "__repr__", "__getitem__"): - self.failUnless(hasattr(ins, attr), + self.assertTrue(hasattr(ins, attr), "%s missing %s attribute" % (ins.__class__.__name__, attr)) @@ -88,7 +88,7 @@ def interface_test_driver(self, results): for test_name, (given, expected) in zip(self.interface_tests, results): - self.failUnlessEqual(given, expected, "%s: %s != %s" % (test_name, + self.assertEqual(given, expected, "%s: %s != %s" % (test_name, given, expected)) def test_interface_single_arg(self): From python-checkins at python.org Thu Jun 4 01:29:16 2009 From: python-checkins at python.org (georg.brandl) Date: Thu, 4 Jun 2009 01:29:16 +0200 (CEST) Subject: [Python-checkins] r73190 - svn:log Message-ID: <20090603232916.6B973C345@mail.python.org> Author: georg.brandl Revision: 73190 Property Name: svn:log Action: modified Property diff: --- old property value +++ new property value @@ -1 +1 @@ -Avoid PendingDeprecationWarnings by using deprecated unittest methods. \ No newline at end of file +Avoid PendingDeprecationWarnings emitted by deprecated unittest methods. From python-checkins at python.org Thu Jun 4 02:11:54 2009 From: python-checkins at python.org (raymond.hettinger) Date: Thu, 4 Jun 2009 02:11:54 +0200 (CEST) Subject: [Python-checkins] r73191 - in python/branches/py3k/Lib: filecmp.py test/support.py test/test_signal.py test/test_urllib2net.py Message-ID: <20090604001154.E1682D32B@mail.python.org> Author: raymond.hettinger Date: Thu Jun 4 02:11:54 2009 New Revision: 73191 Log: Use new form of with-statement instead of contextlib.nested(). Modified: python/branches/py3k/Lib/filecmp.py python/branches/py3k/Lib/test/support.py python/branches/py3k/Lib/test/test_signal.py python/branches/py3k/Lib/test/test_urllib2net.py Modified: python/branches/py3k/Lib/filecmp.py ============================================================================== --- python/branches/py3k/Lib/filecmp.py (original) +++ python/branches/py3k/Lib/filecmp.py Thu Jun 4 02:11:54 2009 @@ -11,7 +11,6 @@ import os import stat -import contextlib from itertools import filterfalse __all__ = ["cmp", "dircmp", "cmpfiles"] @@ -63,7 +62,7 @@ def _do_cmp(f1, f2): bufsize = BUFSIZE - with contextlib.nested(open(f1, 'rb'), open(f2, 'rb')) as (fp1, fp2): + with open(f1, 'rb') as fp1, open(f2, 'rb') as fp2: while True: b1 = fp1.read(bufsize) b2 = fp2.read(bufsize) Modified: python/branches/py3k/Lib/test/support.py ============================================================================== --- python/branches/py3k/Lib/test/support.py (original) +++ python/branches/py3k/Lib/test/support.py Thu Jun 4 02:11:54 2009 @@ -591,13 +591,11 @@ raise ResourceDenied("an optional resource is not available") -def transient_internet(): - """Return a context manager that raises ResourceDenied when various issues - with the Internet connection manifest themselves as exceptions.""" - time_out = TransientResource(IOError, errno=errno.ETIMEDOUT) - socket_peer_reset = TransientResource(socket.error, errno=errno.ECONNRESET) - ioerror_peer_reset = TransientResource(IOError, errno=errno.ECONNRESET) - return contextlib.nested(time_out, socket_peer_reset, ioerror_peer_reset) +# Context managers that raise ResourceDenied when various issues +# with the Internet connection manifest themselves as exceptions. +time_out = TransientResource(IOError, errno=errno.ETIMEDOUT) +socket_peer_reset = TransientResource(socket.error, errno=errno.ECONNRESET) +ioerror_peer_reset = TransientResource(IOError, errno=errno.ECONNRESET) @contextlib.contextmanager Modified: python/branches/py3k/Lib/test/test_signal.py ============================================================================== --- python/branches/py3k/Lib/test/test_signal.py (original) +++ python/branches/py3k/Lib/test/test_signal.py Thu Jun 4 02:11:54 2009 @@ -146,8 +146,8 @@ # re-raises information about any exceptions the child # throws. The real work happens in self.run_test(). os_done_r, os_done_w = os.pipe() - with nested(closing(os.fdopen(os_done_r, 'rb')), - closing(os.fdopen(os_done_w, 'wb'))) as (done_r, done_w): + with closing(os.fdopen(os_done_r, 'rb')) as done_r, \ + closing(os.fdopen(os_done_w, 'wb')) as done_w: child = os.fork() if child == 0: # In the child process; run the test and report results Modified: python/branches/py3k/Lib/test/test_urllib2net.py ============================================================================== --- python/branches/py3k/Lib/test/test_urllib2net.py (original) +++ python/branches/py3k/Lib/test/test_urllib2net.py Thu Jun 4 02:11:54 2009 @@ -174,7 +174,9 @@ (expected_err, url, req, type(err), err)) self.assert_(isinstance(err, expected_err), msg) else: - with support.transient_internet(): + with support.time_out, \ + support.socket_peer_reset, \ + support.ioerror_peer_reset: buf = f.read() f.close() debug("read %d bytes" % len(buf)) From python-checkins at python.org Thu Jun 4 02:16:31 2009 From: python-checkins at python.org (benjamin.peterson) Date: Thu, 4 Jun 2009 02:16:31 +0200 (CEST) Subject: [Python-checkins] r73192 - sandbox/trunk/2to3/lib2to3/tests/test_fixers.py Message-ID: <20090604001631.0E60CD5EF@mail.python.org> Author: benjamin.peterson Date: Thu Jun 4 02:16:30 2009 New Revision: 73192 Log: actually test something here Thanks to Joe Amenta for noticing.y Modified: sandbox/trunk/2to3/lib2to3/tests/test_fixers.py Modified: sandbox/trunk/2to3/lib2to3/tests/test_fixers.py ============================================================================== --- sandbox/trunk/2to3/lib2to3/tests/test_fixers.py (original) +++ sandbox/trunk/2to3/lib2to3/tests/test_fixers.py Thu Jun 4 02:16:30 2009 @@ -415,6 +415,7 @@ def test_5(self): b = """print; print whatever;""" a = """print(); print(whatever);""" + self.check(b, a) def test_tuple(self): b = """print (a, b, c)""" From python-checkins at python.org Thu Jun 4 02:28:39 2009 From: python-checkins at python.org (amaury.forgeotdarc) Date: Thu, 4 Jun 2009 02:28:39 +0200 (CEST) Subject: [Python-checkins] r73193 - sandbox/trunk/io-c Message-ID: <20090604002839.35430D644@mail.python.org> Author: amaury.forgeotdarc Date: Thu Jun 4 02:28:39 2009 New Revision: 73193 Log: kill old io-c project, already merged in py3k Removed: sandbox/trunk/io-c/ From python-checkins at python.org Thu Jun 4 02:35:30 2009 From: python-checkins at python.org (raymond.hettinger) Date: Thu, 4 Jun 2009 02:35:30 +0200 (CEST) Subject: [Python-checkins] r73194 - python/branches/py3k/Lib/test/support.py Message-ID: <20090604003530.C4085D87D@mail.python.org> Author: raymond.hettinger Date: Thu Jun 4 02:35:30 2009 New Revision: 73194 Log: Fix __all__. Modified: python/branches/py3k/Lib/test/support.py Modified: python/branches/py3k/Lib/test/support.py ============================================================================== --- python/branches/py3k/Lib/test/support.py (original) +++ python/branches/py3k/Lib/test/support.py Thu Jun 4 02:35:30 2009 @@ -25,7 +25,8 @@ "vereq", "sortdict", "check_syntax_error", "open_urlresource", "check_warnings", "CleanImport", "EnvironmentVarGuard", "TransientResource", "captured_output", "captured_stdout", - "TransientResource", "transient_internet", "run_with_locale", + "time_out", "socket_peer_reset", "ioerror_peer_reset", + "run_with_locale", "set_memlimit", "bigmemtest", "bigaddrspacetest", "BasicTestRunner", "run_unittest", "run_doctest", "threading_setup", "threading_cleanup", "reap_children", "cpython_only", "check_impl_detail", "get_attribute"] From buildbot at python.org Thu Jun 4 02:36:56 2009 From: buildbot at python.org (buildbot at python.org) Date: Thu, 04 Jun 2009 00:36:56 +0000 Subject: [Python-checkins] buildbot failure in amd64 gentoo 3.x Message-ID: <20090604003656.C6F4AD8A9@mail.python.org> The Buildbot has detected a new failure of amd64 gentoo 3.x. Full details are available at: http://www.python.org/dev/buildbot/all/amd64%20gentoo%203.x/builds/760 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: norwitz-amd64 Build Reason: Build Source Stamp: [branch branches/py3k] HEAD Blamelist: raymond.hettinger BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test___all__ ====================================================================== ERROR: test_all (test.test___all__.AllTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/buildbot/slave/py-build/3.x.norwitz-amd64/build/Lib/test/test___all__.py", line 131, in test_all self.check_all("test.support") File "/home/buildbot/slave/py-build/3.x.norwitz-amd64/build/Lib/test/test___all__.py", line 23, in check_all exec("from %s import *" % modname, names) File "", line 1, in AttributeError: 'module' object has no attribute 'transient_internet' make: *** [buildbottest] Error 1 sincerely, -The Buildbot From python-checkins at python.org Thu Jun 4 02:43:04 2009 From: python-checkins at python.org (alexandre.vassalotti) Date: Thu, 4 Jun 2009 02:43:04 +0200 (CEST) Subject: [Python-checkins] r73195 - python/branches/py3k/Objects/typeobject.c Message-ID: <20090604004304.7FE53D78F@mail.python.org> Author: alexandre.vassalotti Date: Thu Jun 4 02:43:04 2009 New Revision: 73195 Log: Issue #5373: Remove restriction on null bytes in docstrings of classes. Modified: python/branches/py3k/Objects/typeobject.c Modified: python/branches/py3k/Objects/typeobject.c ============================================================================== --- python/branches/py3k/Objects/typeobject.c (original) +++ python/branches/py3k/Objects/typeobject.c Thu Jun 4 02:43:04 2009 @@ -2178,17 +2178,13 @@ char *doc_str; char *tp_doc; - doc_str = _PyUnicode_AsStringAndSize(doc, &len); + doc_str = _PyUnicode_AsString(doc); if (doc_str == NULL) { Py_DECREF(type); return NULL; } - if ((Py_ssize_t)strlen(doc_str) != len) { - PyErr_SetString(PyExc_TypeError, - "__doc__ contains null-bytes"); - Py_DECREF(type); - return NULL; - } + /* Silently truncate the docstring if it contains null bytes. */ + len = strlen(doc_str); tp_doc = (char *)PyObject_MALLOC(len + 1); if (tp_doc == NULL) { Py_DECREF(type); From python-checkins at python.org Thu Jun 4 03:40:29 2009 From: python-checkins at python.org (benjamin.peterson) Date: Thu, 4 Jun 2009 03:40:29 +0200 (CEST) Subject: [Python-checkins] r73196 - python/trunk/Objects/dictobject.c Message-ID: <20090604014029.D01FDD8FA@mail.python.org> Author: benjamin.peterson Date: Thu Jun 4 03:40:29 2009 New Revision: 73196 Log: use the offical api Modified: python/trunk/Objects/dictobject.c Modified: python/trunk/Objects/dictobject.c ============================================================================== --- python/trunk/Objects/dictobject.c (original) +++ python/trunk/Objects/dictobject.c Thu Jun 4 03:40:29 2009 @@ -715,7 +715,7 @@ /* We can arrive here with a NULL tstate during initialization: try running "python -Wi" for an example related to string interning. Let's just hope that no exception occurs then... */ - tstate = _PyThreadState_Current; + tstate = PyThreadState_GET(); if (tstate != NULL && tstate->curexc_type != NULL) { /* preserve the existing exception */ PyObject *err_type, *err_value, *err_tb; From python-checkins at python.org Thu Jun 4 09:31:53 2009 From: python-checkins at python.org (tarek.ziade) Date: Thu, 4 Jun 2009 09:31:53 +0200 (CEST) Subject: [Python-checkins] r73197 - in python/trunk/Lib/distutils: command/install.py tests/test_install.py Message-ID: <20090604073153.40BA3C526@mail.python.org> Author: tarek.ziade Date: Thu Jun 4 09:31:52 2009 New Revision: 73197 Log: improved test coverage for distutils.command.install and cleaned it up Modified: python/trunk/Lib/distutils/command/install.py python/trunk/Lib/distutils/tests/test_install.py Modified: python/trunk/Lib/distutils/command/install.py ============================================================================== --- python/trunk/Lib/distutils/command/install.py (original) +++ python/trunk/Lib/distutils/command/install.py Thu Jun 4 09:31:52 2009 @@ -2,12 +2,12 @@ Implements the Distutils 'install' command.""" -from distutils import log - __revision__ = "$Id$" -import sys, os, string -from types import * +import sys +import os + +from distutils import log from distutils.core import Command from distutils.debug import DEBUG from distutils.sysconfig import get_config_vars @@ -117,7 +117,7 @@ SCHEME_KEYS = ('purelib', 'platlib', 'headers', 'scripts', 'data') -class install (Command): +class install(Command): description = "install everything from build directory" @@ -190,8 +190,8 @@ negative_opt = {'no-compile' : 'compile'} - def initialize_options (self): - + def initialize_options(self): + """Initializes options.""" # High-level options: these select both an installation base # and scheme. self.prefix = None @@ -267,8 +267,8 @@ # party Python modules on various platforms given a wide # array of user input is decided. Yes, it's quite complex!) - def finalize_options (self): - + def finalize_options(self): + """Finalizes options.""" # This method (and its pliant slaves, like 'finalize_unix()', # 'finalize_other()', and 'select_scheme()') is where the default # installation directories for modules, extension modules, and @@ -326,7 +326,7 @@ # $platbase in the other installation directories and not worry # about needing recursive variable expansion (shudder). - py_version = (string.split(sys.version))[0] + py_version = sys.version.split()[0] (prefix, exec_prefix) = get_config_vars('prefix', 'exec_prefix') self.config_vars = {'dist_name': self.distribution.get_name(), 'dist_version': self.distribution.get_version(), @@ -409,29 +409,27 @@ # Punt on doc directories for now -- after all, we're punting on # documentation completely! - # finalize_options () - - - def dump_dirs (self, msg): - if DEBUG: - from distutils.fancy_getopt import longopt_xlate - print msg + ":" - for opt in self.user_options: - opt_name = opt[0] - if opt_name[-1] == "=": - opt_name = opt_name[0:-1] - if opt_name in self.negative_opt: - opt_name = string.translate(self.negative_opt[opt_name], - longopt_xlate) - val = not getattr(self, opt_name) - else: - opt_name = string.translate(opt_name, longopt_xlate) - val = getattr(self, opt_name) - print " %s: %s" % (opt_name, val) - - - def finalize_unix (self): + def dump_dirs(self, msg): + """Dumps the list of user options.""" + if not DEBUG: + return + from distutils.fancy_getopt import longopt_xlate + log.debug(msg + ":") + for opt in self.user_options: + opt_name = opt[0] + if opt_name[-1] == "=": + opt_name = opt_name[0:-1] + if opt_name in self.negative_opt: + opt_name = self.negative_opt[opt_name] + opt_name = opt_name.translate(longopt_xlate) + val = not getattr(self, opt_name) + else: + opt_name = opt_name.translate(longopt_xlate) + val = getattr(self, opt_name) + log.debug(" %s: %s" % (opt_name, val)) + def finalize_unix(self): + """Finalizes options for posix platforms.""" if self.install_base is not None or self.install_platbase is not None: if ((self.install_lib is None and self.install_purelib is None and @@ -470,11 +468,8 @@ self.install_platbase = self.exec_prefix self.select_scheme("unix_prefix") - # finalize_unix () - - - def finalize_other (self): # Windows and Mac OS for now - + def finalize_other(self): + """Finalizes options for non-posix platforms""" if self.user: if self.install_userbase is None: raise DistutilsPlatformError( @@ -495,10 +490,8 @@ raise DistutilsPlatformError, \ "I don't know how to install stuff on '%s'" % os.name - # finalize_other () - - - def select_scheme (self, name): + def select_scheme(self, name): + """Sets the install directories by applying the install schemes.""" # it's the caller's problem if they supply a bad name! scheme = INSTALL_SCHEMES[name] for key in SCHEME_KEYS: @@ -506,8 +499,7 @@ if getattr(self, attrname) is None: setattr(self, attrname, scheme[key]) - - def _expand_attrs (self, attrs): + def _expand_attrs(self, attrs): for attr in attrs: val = getattr(self, attr) if val is not None: @@ -516,40 +508,36 @@ val = subst_vars(val, self.config_vars) setattr(self, attr, val) + def expand_basedirs(self): + """Calls `os.path.expanduser` on install_base, install_platbase and + root.""" + self._expand_attrs(['install_base', 'install_platbase', 'root']) + + def expand_dirs(self): + """Calls `os.path.expanduser` on install dirs.""" + self._expand_attrs(['install_purelib', 'install_platlib', + 'install_lib', 'install_headers', + 'install_scripts', 'install_data',]) - def expand_basedirs (self): - self._expand_attrs(['install_base', - 'install_platbase', - 'root']) - - def expand_dirs (self): - self._expand_attrs(['install_purelib', - 'install_platlib', - 'install_lib', - 'install_headers', - 'install_scripts', - 'install_data',]) - - - def convert_paths (self, *names): + def convert_paths(self, *names): + """Call `convert_path` over `names`.""" for name in names: attr = "install_" + name setattr(self, attr, convert_path(getattr(self, attr))) - - def handle_extra_path (self): - + def handle_extra_path(self): + """Set `path_file` and `extra_dirs` using `extra_path`.""" if self.extra_path is None: self.extra_path = self.distribution.extra_path if self.extra_path is not None: - if type(self.extra_path) is StringType: - self.extra_path = string.split(self.extra_path, ',') + if isinstance(self.extra_path, str): + self.extra_path = self.extra_path.split(',') if len(self.extra_path) == 1: path_file = extra_dirs = self.extra_path[0] elif len(self.extra_path) == 2: - (path_file, extra_dirs) = self.extra_path + path_file, extra_dirs = self.extra_path else: raise DistutilsOptionError, \ ("'extra_path' option must be a list, tuple, or " @@ -558,7 +546,6 @@ # convert to local form in case Unix notation used (as it # should be in setup scripts) extra_dirs = convert_path(extra_dirs) - else: path_file = None extra_dirs = '' @@ -568,17 +555,14 @@ self.path_file = path_file self.extra_dirs = extra_dirs - # handle_extra_path () - - - def change_roots (self, *names): + def change_roots(self, *names): + """Change the install direcories pointed by name using root.""" for name in names: attr = "install_" + name setattr(self, attr, change_root(self.root, getattr(self, attr))) def create_home_path(self): - """Create directories under ~ - """ + """Create directories under ~.""" if not self.user: return home = convert_path(os.path.expanduser("~")) @@ -589,8 +573,8 @@ # -- Command execution methods ------------------------------------- - def run (self): - + def run(self): + """Runs the command.""" # Obviously have to build before we can install if not self.skip_build: self.run_command('build') @@ -633,9 +617,8 @@ "you'll have to change the search path yourself"), self.install_lib) - # run () - - def create_path_file (self): + def create_path_file(self): + """Creates the .pth file""" filename = os.path.join(self.install_libbase, self.path_file + ".pth") if self.install_path_file: @@ -648,8 +631,8 @@ # -- Reporting methods --------------------------------------------- - def get_outputs (self): - # Assemble the outputs of all the sub-commands. + def get_outputs(self): + """Assembles the outputs of all the sub-commands.""" outputs = [] for cmd_name in self.get_sub_commands(): cmd = self.get_finalized_command(cmd_name) @@ -665,7 +648,8 @@ return outputs - def get_inputs (self): + def get_inputs(self): + """Returns the inputs of all the sub-commands""" # XXX gee, this looks familiar ;-( inputs = [] for cmd_name in self.get_sub_commands(): @@ -674,25 +658,29 @@ return inputs - # -- Predicates for sub-command list ------------------------------- - def has_lib (self): - """Return true if the current distribution has any Python + def has_lib(self): + """Returns true if the current distribution has any Python modules to install.""" return (self.distribution.has_pure_modules() or self.distribution.has_ext_modules()) - def has_headers (self): + def has_headers(self): + """Returns true if the current distribution has any headers to + install.""" return self.distribution.has_headers() - def has_scripts (self): + def has_scripts(self): + """Returns true if the current distribution has any scripts to. + install.""" return self.distribution.has_scripts() - def has_data (self): + def has_data(self): + """Returns true if the current distribution has any data to. + install.""" return self.distribution.has_data_files() - # 'sub_commands': a list of commands this command might have to run to # get its work done. See cmd.py for more info. sub_commands = [('install_lib', has_lib), @@ -701,5 +689,3 @@ ('install_data', has_data), ('install_egg_info', lambda self:True), ] - -# class install Modified: python/trunk/Lib/distutils/tests/test_install.py ============================================================================== --- python/trunk/Lib/distutils/tests/test_install.py (original) +++ python/trunk/Lib/distutils/tests/test_install.py Thu Jun 4 09:31:52 2009 @@ -10,11 +10,14 @@ from distutils.command import install as install_module from distutils.command.install import INSTALL_SCHEMES from distutils.core import Distribution +from distutils.errors import DistutilsOptionError from distutils.tests import support -class InstallTestCase(support.TempdirManager, unittest.TestCase): +class InstallTestCase(support.TempdirManager, + support.LoggingSilencer, + unittest.TestCase): def test_home_installation_scheme(self): # This ensure two things: @@ -112,6 +115,74 @@ self.assert_('userbase' in cmd.config_vars) self.assert_('usersite' in cmd.config_vars) + def test_handle_extra_path(self): + dist = Distribution({'name': 'xx', 'extra_path': 'path,dirs'}) + cmd = install(dist) + + # two elements + cmd.handle_extra_path() + self.assertEquals(cmd.extra_path, ['path', 'dirs']) + self.assertEquals(cmd.extra_dirs, 'dirs') + self.assertEquals(cmd.path_file, 'path') + + # one element + cmd.extra_path = ['path'] + cmd.handle_extra_path() + self.assertEquals(cmd.extra_path, ['path']) + self.assertEquals(cmd.extra_dirs, 'path') + self.assertEquals(cmd.path_file, 'path') + + # none + dist.extra_path = cmd.extra_path = None + cmd.handle_extra_path() + self.assertEquals(cmd.extra_path, None) + self.assertEquals(cmd.extra_dirs, '') + self.assertEquals(cmd.path_file, None) + + # three elements (no way !) + cmd.extra_path = 'path,dirs,again' + self.assertRaises(DistutilsOptionError, cmd.handle_extra_path) + + def test_finalize_options(self): + dist = Distribution({'name': 'xx'}) + cmd = install(dist) + + # must supply either prefix/exec-prefix/home or + # install-base/install-platbase -- not both + cmd.prefix = 'prefix' + cmd.install_base = 'base' + self.assertRaises(DistutilsOptionError, cmd.finalize_options) + + # must supply either home or prefix/exec-prefix -- not both + cmd.install_base = None + cmd.home = 'home' + self.assertRaises(DistutilsOptionError, cmd.finalize_options) + + # can't combine user with with prefix/exec_prefix/home or + # install_(plat)base + cmd.prefix = None + cmd.user = 'user' + self.assertRaises(DistutilsOptionError, cmd.finalize_options) + + def test_record(self): + + install_dir = self.mkdtemp() + pkgdir, dist = self.create_dist() + + dist = Distribution() + cmd = install(dist) + dist.command_obj['install'] = cmd + cmd.root = install_dir + cmd.record = os.path.join(pkgdir, 'RECORD') + cmd.ensure_finalized() + + cmd.run() + + # let's check the RECORD file was created with one + # line (the egg info file) + with open(cmd.record) as f: + self.assertEquals(len(f.readlines()), 1) + def test_suite(): return unittest.makeSuite(InstallTestCase) From python-checkins at python.org Thu Jun 4 09:33:30 2009 From: python-checkins at python.org (tarek.ziade) Date: Thu, 4 Jun 2009 09:33:30 +0200 (CEST) Subject: [Python-checkins] r73198 - python/branches/release26-maint Message-ID: <20090604073330.1AE32D275@mail.python.org> Author: tarek.ziade Date: Thu Jun 4 09:33:29 2009 New Revision: 73198 Log: Blocked revisions 73197 via svnmerge ........ r73197 | tarek.ziade | 2009-06-04 09:31:52 +0200 (Thu, 04 Jun 2009) | 1 line improved test coverage for distutils.command.install and cleaned it up ........ Modified: python/branches/release26-maint/ (props changed) From python-checkins at python.org Thu Jun 4 09:39:50 2009 From: python-checkins at python.org (tarek.ziade) Date: Thu, 4 Jun 2009 09:39:50 +0200 (CEST) Subject: [Python-checkins] r73199 - in python/branches/py3k: Lib/distutils/command/install.py Lib/distutils/tests/test_install.py Message-ID: <20090604073950.9D130D420@mail.python.org> Author: tarek.ziade Date: Thu Jun 4 09:39:50 2009 New Revision: 73199 Log: Merged revisions 73197 via svnmerge from svn+ssh://pythondev at svn.python.org/python/trunk ........ r73197 | tarek.ziade | 2009-06-04 09:31:52 +0200 (Thu, 04 Jun 2009) | 1 line improved test coverage for distutils.command.install and cleaned it up ........ Modified: python/branches/py3k/ (props changed) python/branches/py3k/Lib/distutils/command/install.py python/branches/py3k/Lib/distutils/tests/test_install.py Modified: python/branches/py3k/Lib/distutils/command/install.py ============================================================================== --- python/branches/py3k/Lib/distutils/command/install.py (original) +++ python/branches/py3k/Lib/distutils/command/install.py Thu Jun 4 09:39:50 2009 @@ -2,11 +2,12 @@ Implements the Distutils 'install' command.""" -from distutils import log - __revision__ = "$Id$" -import sys, os +import sys +import os + +from distutils import log from distutils.core import Command from distutils.debug import DEBUG from distutils.sysconfig import get_config_vars @@ -116,7 +117,7 @@ SCHEME_KEYS = ('purelib', 'platlib', 'headers', 'scripts', 'data') -class install (Command): +class install(Command): description = "install everything from build directory" @@ -190,7 +191,7 @@ def initialize_options(self): - + """Initializes options.""" # High-level options: these select both an installation base # and scheme. self.prefix = None @@ -267,7 +268,7 @@ # array of user input is decided. Yes, it's quite complex!) def finalize_options(self): - + """Finalizes options.""" # This method (and its pliant slaves, like 'finalize_unix()', # 'finalize_other()', and 'select_scheme()') is where the default # installation directories for modules, extension modules, and @@ -408,25 +409,27 @@ # Punt on doc directories for now -- after all, we're punting on # documentation completely! - def dump_dirs(self, msg): - if DEBUG: - from distutils.fancy_getopt import longopt_xlate - print(msg + ":") - for opt in self.user_options: - opt_name = opt[0] - if opt_name[-1] == "=": - opt_name = opt_name[0:-1] - if opt_name in self.negative_opt: - opt_name = longopt_xlate(self.negative_opt[opt_name]) - val = not getattr(self, opt_name) - else: - opt_name = longopt_xlate(opt_name) - val = getattr(self, opt_name) - print(" %s: %s" % (opt_name, val)) - + """Dumps the list of user options.""" + if not DEBUG: + return + from distutils.fancy_getopt import longopt_xlate + log.debug(msg + ":") + for opt in self.user_options: + opt_name = opt[0] + if opt_name[-1] == "=": + opt_name = opt_name[0:-1] + if opt_name in self.negative_opt: + opt_name = self.negative_opt[opt_name] + opt_name = opt_name.translate(longopt_xlate) + val = not getattr(self, opt_name) + else: + opt_name = opt_name.translate(longopt_xlate) + val = getattr(self, opt_name) + log.debug(" %s: %s" % (opt_name, val)) def finalize_unix(self): + """Finalizes options for posix platforms.""" if self.install_base is not None or self.install_platbase is not None: if ((self.install_lib is None and self.install_purelib is None and @@ -465,8 +468,8 @@ self.install_platbase = self.exec_prefix self.select_scheme("unix_prefix") - - def finalize_other(self): # Windows and Mac OS for now + def finalize_other(self): + """Finalizes options for non-posix platforms""" if self.user: if self.install_userbase is None: raise DistutilsPlatformError( @@ -487,8 +490,8 @@ raise DistutilsPlatformError( "I don't know how to install stuff on '%s'" % os.name) - def select_scheme(self, name): + """Sets the install directories by applying the install schemes.""" # it's the caller's problem if they supply a bad name! scheme = INSTALL_SCHEMES[name] for key in SCHEME_KEYS: @@ -496,7 +499,6 @@ if getattr(self, attrname) is None: setattr(self, attrname, scheme[key]) - def _expand_attrs(self, attrs): for attr in attrs: val = getattr(self, attr) @@ -506,27 +508,25 @@ val = subst_vars(val, self.config_vars) setattr(self, attr, val) - def expand_basedirs(self): - self._expand_attrs(['install_base', - 'install_platbase', - 'root']) + """Calls `os.path.expanduser` on install_base, install_platbase and + root.""" + self._expand_attrs(['install_base', 'install_platbase', 'root']) def expand_dirs(self): - self._expand_attrs(['install_purelib', - 'install_platlib', - 'install_lib', - 'install_headers', - 'install_scripts', - 'install_data',]) - + """Calls `os.path.expanduser` on install dirs.""" + self._expand_attrs(['install_purelib', 'install_platlib', + 'install_lib', 'install_headers', + 'install_scripts', 'install_data',]) def convert_paths(self, *names): + """Call `convert_path` over `names`.""" for name in names: attr = "install_" + name setattr(self, attr, convert_path(getattr(self, attr))) def handle_extra_path(self): + """Set `path_file` and `extra_dirs` using `extra_path`.""" if self.extra_path is None: self.extra_path = self.distribution.extra_path @@ -537,7 +537,7 @@ if len(self.extra_path) == 1: path_file = extra_dirs = self.extra_path[0] elif len(self.extra_path) == 2: - (path_file, extra_dirs) = self.extra_path + path_file, extra_dirs = self.extra_path else: raise DistutilsOptionError( "'extra_path' option must be a list, tuple, or " @@ -546,7 +546,6 @@ # convert to local form in case Unix notation used (as it # should be in setup scripts) extra_dirs = convert_path(extra_dirs) - else: path_file = None extra_dirs = '' @@ -557,13 +556,13 @@ self.extra_dirs = extra_dirs def change_roots(self, *names): + """Change the install direcories pointed by name using root.""" for name in names: attr = "install_" + name setattr(self, attr, change_root(self.root, getattr(self, attr))) def create_home_path(self): - """Create directories under ~ - """ + """Create directories under ~.""" if not self.user: return home = convert_path(os.path.expanduser("~")) @@ -575,6 +574,7 @@ # -- Command execution methods ------------------------------------- def run(self): + """Runs the command.""" # Obviously have to build before we can install if not self.skip_build: self.run_command('build') @@ -618,6 +618,7 @@ self.install_lib) def create_path_file(self): + """Creates the .pth file""" filename = os.path.join(self.install_libbase, self.path_file + ".pth") if self.install_path_file: @@ -631,7 +632,7 @@ # -- Reporting methods --------------------------------------------- def get_outputs(self): - # Assemble the outputs of all the sub-commands. + """Assembles the outputs of all the sub-commands.""" outputs = [] for cmd_name in self.get_sub_commands(): cmd = self.get_finalized_command(cmd_name) @@ -648,6 +649,7 @@ return outputs def get_inputs(self): + """Returns the inputs of all the sub-commands""" # XXX gee, this looks familiar ;-( inputs = [] for cmd_name in self.get_sub_commands(): @@ -656,25 +658,29 @@ return inputs - # -- Predicates for sub-command list ------------------------------- def has_lib(self): - """Return true if the current distribution has any Python + """Returns true if the current distribution has any Python modules to install.""" return (self.distribution.has_pure_modules() or self.distribution.has_ext_modules()) def has_headers(self): + """Returns true if the current distribution has any headers to + install.""" return self.distribution.has_headers() def has_scripts(self): + """Returns true if the current distribution has any scripts to. + install.""" return self.distribution.has_scripts() def has_data(self): + """Returns true if the current distribution has any data to. + install.""" return self.distribution.has_data_files() - # 'sub_commands': a list of commands this command might have to run to # get its work done. See cmd.py for more info. sub_commands = [('install_lib', has_lib), Modified: python/branches/py3k/Lib/distutils/tests/test_install.py ============================================================================== --- python/branches/py3k/Lib/distutils/tests/test_install.py (original) +++ python/branches/py3k/Lib/distutils/tests/test_install.py Thu Jun 4 09:39:50 2009 @@ -10,11 +10,14 @@ from distutils.command import install as install_module from distutils.command.install import INSTALL_SCHEMES from distutils.core import Distribution +from distutils.errors import DistutilsOptionError from distutils.tests import support -class InstallTestCase(support.TempdirManager, unittest.TestCase): +class InstallTestCase(support.TempdirManager, + support.LoggingSilencer, + unittest.TestCase): def test_home_installation_scheme(self): # This ensure two things: @@ -112,6 +115,74 @@ self.assert_('userbase' in cmd.config_vars) self.assert_('usersite' in cmd.config_vars) + def test_handle_extra_path(self): + dist = Distribution({'name': 'xx', 'extra_path': 'path,dirs'}) + cmd = install(dist) + + # two elements + cmd.handle_extra_path() + self.assertEquals(cmd.extra_path, ['path', 'dirs']) + self.assertEquals(cmd.extra_dirs, 'dirs') + self.assertEquals(cmd.path_file, 'path') + + # one element + cmd.extra_path = ['path'] + cmd.handle_extra_path() + self.assertEquals(cmd.extra_path, ['path']) + self.assertEquals(cmd.extra_dirs, 'path') + self.assertEquals(cmd.path_file, 'path') + + # none + dist.extra_path = cmd.extra_path = None + cmd.handle_extra_path() + self.assertEquals(cmd.extra_path, None) + self.assertEquals(cmd.extra_dirs, '') + self.assertEquals(cmd.path_file, None) + + # three elements (no way !) + cmd.extra_path = 'path,dirs,again' + self.assertRaises(DistutilsOptionError, cmd.handle_extra_path) + + def test_finalize_options(self): + dist = Distribution({'name': 'xx'}) + cmd = install(dist) + + # must supply either prefix/exec-prefix/home or + # install-base/install-platbase -- not both + cmd.prefix = 'prefix' + cmd.install_base = 'base' + self.assertRaises(DistutilsOptionError, cmd.finalize_options) + + # must supply either home or prefix/exec-prefix -- not both + cmd.install_base = None + cmd.home = 'home' + self.assertRaises(DistutilsOptionError, cmd.finalize_options) + + # can't combine user with with prefix/exec_prefix/home or + # install_(plat)base + cmd.prefix = None + cmd.user = 'user' + self.assertRaises(DistutilsOptionError, cmd.finalize_options) + + def test_record(self): + + install_dir = self.mkdtemp() + pkgdir, dist = self.create_dist() + + dist = Distribution() + cmd = install(dist) + dist.command_obj['install'] = cmd + cmd.root = install_dir + cmd.record = os.path.join(pkgdir, 'RECORD') + cmd.ensure_finalized() + + cmd.run() + + # let's check the RECORD file was created with one + # line (the egg info file) + with open(cmd.record) as f: + self.assertEquals(len(f.readlines()), 1) + def test_suite(): return unittest.makeSuite(InstallTestCase) From python-checkins at python.org Thu Jun 4 09:40:36 2009 From: python-checkins at python.org (tarek.ziade) Date: Thu, 4 Jun 2009 09:40:36 +0200 (CEST) Subject: [Python-checkins] r73200 - python/branches/release30-maint Message-ID: <20090604074036.07997D4E3@mail.python.org> Author: tarek.ziade Date: Thu Jun 4 09:40:35 2009 New Revision: 73200 Log: Blocked revisions 73199 via svnmerge ................ r73199 | tarek.ziade | 2009-06-04 09:39:50 +0200 (Thu, 04 Jun 2009) | 9 lines Merged revisions 73197 via svnmerge from svn+ssh://pythondev at svn.python.org/python/trunk ........ r73197 | tarek.ziade | 2009-06-04 09:31:52 +0200 (Thu, 04 Jun 2009) | 1 line improved test coverage for distutils.command.install and cleaned it up ........ ................ Modified: python/branches/release30-maint/ (props changed) From python-checkins at python.org Thu Jun 4 10:58:32 2009 From: python-checkins at python.org (georg.brandl) Date: Thu, 4 Jun 2009 10:58:32 +0200 (CEST) Subject: [Python-checkins] r73201 - in python/trunk: Lib/xmlrpclib.py Misc/NEWS Message-ID: <20090604085832.78AEFD275@mail.python.org> Author: georg.brandl Date: Thu Jun 4 10:58:32 2009 New Revision: 73201 Log: #5767: remove sgmlop support from xmlrpclib; the sgmlop parser does not do much validation and is no longer much faster than e.g. the cElementTree XMLParser. Modified: python/trunk/Lib/xmlrpclib.py python/trunk/Misc/NEWS Modified: python/trunk/Lib/xmlrpclib.py ============================================================================== --- python/trunk/Lib/xmlrpclib.py (original) +++ python/trunk/Lib/xmlrpclib.py Thu Jun 4 10:58:32 2009 @@ -526,56 +526,6 @@ except (AttributeError, ImportError): FastMarshaller = None -# -# the SGMLOP parser is about 15x faster than Python's builtin -# XML parser. SGMLOP sources can be downloaded from: -# -# http://www.pythonware.com/products/xml/sgmlop.htm -# - -try: - import sgmlop - if not hasattr(sgmlop, "XMLParser"): - raise ImportError -except ImportError: - SgmlopParser = None # sgmlop accelerator not available -else: - class SgmlopParser: - def __init__(self, target): - - # setup callbacks - self.finish_starttag = target.start - self.finish_endtag = target.end - self.handle_data = target.data - self.handle_xml = target.xml - - # activate parser - self.parser = sgmlop.XMLParser() - self.parser.register(self) - self.feed = self.parser.feed - self.entity = { - "amp": "&", "gt": ">", "lt": "<", - "apos": "'", "quot": '"' - } - - def close(self): - try: - self.parser.close() - finally: - self.parser = self.feed = None # nuke circular reference - - def handle_proc(self, tag, attr): - m = re.search("encoding\s*=\s*['\"]([^\"']+)[\"']", attr) - if m: - self.handle_xml(m.group(1), 1) - - def handle_entityref(self, entity): - # entity - try: - self.handle_data(self.entity[entity]) - except KeyError: - self.handle_data("&%s;" % entity) - try: from xml.parsers import expat if not hasattr(expat, "ParserCreate"): @@ -584,8 +534,7 @@ ExpatParser = None # expat not available else: class ExpatParser: - # fast expat parser for Python 2.0 and later. this is about - # 50% slower than sgmlop, on roundtrip testing + # fast expat parser for Python 2.0 and later. def __init__(self, target): self._parser = parser = expat.ParserCreate(None, None) self._target = target @@ -606,8 +555,7 @@ class SlowParser: """Default XML parser (based on xmllib.XMLParser).""" - # this is about 10 times slower than sgmlop, on roundtrip - # testing. + # this is the slowest parser. def __init__(self, target): import xmllib # lazy subclassing (!) if xmllib.XMLParser not in SlowParser.__bases__: @@ -1069,8 +1017,6 @@ target = Unmarshaller(use_datetime=use_datetime) if FastParser: parser = FastParser(target) - elif SgmlopParser: - parser = SgmlopParser(target) elif ExpatParser: parser = ExpatParser(target) else: Modified: python/trunk/Misc/NEWS ============================================================================== --- python/trunk/Misc/NEWS (original) +++ python/trunk/Misc/NEWS Thu Jun 4 10:58:32 2009 @@ -317,6 +317,8 @@ Library ------- +- Issue #5767: Removed sgmlop support from xmlrpclib. + - Issue #6131: test_modulefinder leaked when run after test_distutils. Patch by Hirokazu Yamamoto. From python-checkins at python.org Thu Jun 4 11:00:57 2009 From: python-checkins at python.org (georg.brandl) Date: Thu, 4 Jun 2009 11:00:57 +0200 (CEST) Subject: [Python-checkins] r73202 - in python/branches/py3k: Lib/xmlrpc/client.py Misc/NEWS Message-ID: <20090604090057.22740D4E3@mail.python.org> Author: georg.brandl Date: Thu Jun 4 11:00:56 2009 New Revision: 73202 Log: Recorded merge of revisions 73201 via svnmerge from svn+ssh://pythondev at svn.python.org/python/trunk ........ r73201 | georg.brandl | 2009-06-04 10:58:32 +0200 (Do, 04 Jun 2009) | 1 line #5767: remove sgmlop support from xmlrpclib; the sgmlop parser does not do much validation and is no longer much faster than e.g. the cElementTree XMLParser. ........ Modified: python/branches/py3k/ (props changed) python/branches/py3k/Lib/xmlrpc/client.py python/branches/py3k/Misc/NEWS Modified: python/branches/py3k/Lib/xmlrpc/client.py ============================================================================== --- python/branches/py3k/Lib/xmlrpc/client.py (original) +++ python/branches/py3k/Lib/xmlrpc/client.py Thu Jun 4 11:00:56 2009 @@ -439,56 +439,6 @@ # -------------------------------------------------------------------- # XML parsers -# -# the SGMLOP parser is about 15x faster than Python's builtin -# XML parser. SGMLOP sources can be downloaded from: -# -# http://www.pythonware.com/products/xml/sgmlop.htm -# - -try: - import sgmlop - if not hasattr(sgmlop, "XMLParser"): - raise ImportError -except ImportError: - SgmlopParser = None # sgmlop accelerator not available -else: - class SgmlopParser: - def __init__(self, target): - - # setup callbacks - self.finish_starttag = target.start - self.finish_endtag = target.end - self.handle_data = target.data - self.handle_xml = target.xml - - # activate parser - self.parser = sgmlop.XMLParser() - self.parser.register(self) - self.feed = self.parser.feed - self.entity = { - "amp": "&", "gt": ">", "lt": "<", - "apos": "'", "quot": '"' - } - - def close(self): - try: - self.parser.close() - finally: - self.parser = self.feed = None # nuke circular reference - - def handle_proc(self, tag, attr): - m = re.search("encoding\s*=\s*['\"]([^\"']+)[\"']", attr) - if m: - self.handle_xml(m.group(1), 1) - - def handle_entityref(self, entity): - # entity - try: - self.handle_data(self.entity[entity]) - except KeyError: - self.handle_data("&%s;" % entity) - try: from xml.parsers import expat if not hasattr(expat, "ParserCreate"): @@ -497,8 +447,7 @@ ExpatParser = None # expat not available else: class ExpatParser: - # fast expat parser for Python 2.0 and later. this is about - # 50% slower than sgmlop, on roundtrip testing + # fast expat parser for Python 2.0 and later. def __init__(self, target): self._parser = parser = expat.ParserCreate(None, None) self._target = target @@ -963,8 +912,6 @@ target = Unmarshaller(use_datetime=use_datetime) if FastParser: parser = FastParser(target) - elif SgmlopParser: - parser = SgmlopParser(target) elif ExpatParser: parser = ExpatParser(target) else: Modified: python/branches/py3k/Misc/NEWS ============================================================================== --- python/branches/py3k/Misc/NEWS (original) +++ python/branches/py3k/Misc/NEWS Thu Jun 4 11:00:56 2009 @@ -21,6 +21,8 @@ Library ------- +- Issue #5767: Remove sgmlop support from xmlrpc.client. + - Issue #6150: Fix test_unicode on wide-unicode builds. - Issue #6149: Fix initialization of WeakValueDictionary objects from non-empty From python-checkins at python.org Thu Jun 4 11:04:53 2009 From: python-checkins at python.org (georg.brandl) Date: Thu, 4 Jun 2009 11:04:53 +0200 (CEST) Subject: [Python-checkins] r73203 - python/branches/py3k/Lib/xmlrpc/client.py Message-ID: <20090604090453.6296FD538@mail.python.org> Author: georg.brandl Date: Thu Jun 4 11:04:53 2009 New Revision: 73203 Log: Remove mentions of the nonexisting SlowParser in xmlrpc.client. Modified: python/branches/py3k/Lib/xmlrpc/client.py Modified: python/branches/py3k/Lib/xmlrpc/client.py ============================================================================== --- python/branches/py3k/Lib/xmlrpc/client.py (original) +++ python/branches/py3k/Lib/xmlrpc/client.py Thu Jun 4 11:04:53 2009 @@ -113,7 +113,6 @@ XML-RPC value Binary binary data wrapper - SlowParser Slow but safe standard parser (based on xmllib) Marshaller Generate an XML-RPC params chunk from a Python data structure Unmarshaller Unmarshal an XML-RPC response from incoming XML event message Transport Handles an HTTP transaction to an XML-RPC server @@ -136,6 +135,7 @@ import re, time, operator import http.client +from xml.parsers import expat # -------------------------------------------------------------------- # Internal stuff @@ -439,30 +439,23 @@ # -------------------------------------------------------------------- # XML parsers -try: - from xml.parsers import expat - if not hasattr(expat, "ParserCreate"): - raise ImportError -except ImportError: - ExpatParser = None # expat not available -else: - class ExpatParser: - # fast expat parser for Python 2.0 and later. - def __init__(self, target): - self._parser = parser = expat.ParserCreate(None, None) - self._target = target - parser.StartElementHandler = target.start - parser.EndElementHandler = target.end - parser.CharacterDataHandler = target.data - encoding = None - target.xml(encoding, None) - - def feed(self, data): - self._parser.Parse(data, 0) - - def close(self): - self._parser.Parse("", 1) # end of data - del self._target, self._parser # get rid of circular references +class ExpatParser: + # fast expat parser for Python 2.0 and later. + def __init__(self, target): + self._parser = parser = expat.ParserCreate(None, None) + self._target = target + parser.StartElementHandler = target.start + parser.EndElementHandler = target.end + parser.CharacterDataHandler = target.data + encoding = None + target.xml(encoding, None) + + def feed(self, data): + self._parser.Parse(data, 0) + + def close(self): + self._parser.Parse("", 1) # end of data + del self._target, self._parser # get rid of circular references # -------------------------------------------------------------------- # XML-RPC marshalling and unmarshalling code @@ -912,10 +905,8 @@ target = Unmarshaller(use_datetime=use_datetime) if FastParser: parser = FastParser(target) - elif ExpatParser: - parser = ExpatParser(target) else: - parser = SlowParser(target) + parser = ExpatParser(target) return parser, target ## From python-checkins at python.org Thu Jun 4 11:11:51 2009 From: python-checkins at python.org (georg.brandl) Date: Thu, 4 Jun 2009 11:11:51 +0200 (CEST) Subject: [Python-checkins] r73204 - in python/branches/py3k: Doc/library/base64.rst Lib/base64.py Lib/test/test_base64.py Lib/test/test_xmlrpc.py Lib/xmlrpc/client.py Misc/NEWS Message-ID: <20090604091151.AD9B9D4F9@mail.python.org> Author: georg.brandl Date: Thu Jun 4 11:11:51 2009 New Revision: 73204 Log: #3613: add base64.encodebytes and decodebytes as the new spelling of encodestring and decodestring; deprecate the latter. Modified: python/branches/py3k/Doc/library/base64.rst python/branches/py3k/Lib/base64.py python/branches/py3k/Lib/test/test_base64.py python/branches/py3k/Lib/test/test_xmlrpc.py python/branches/py3k/Lib/xmlrpc/client.py python/branches/py3k/Misc/NEWS Modified: python/branches/py3k/Doc/library/base64.rst ============================================================================== --- python/branches/py3k/Doc/library/base64.rst (original) +++ python/branches/py3k/Doc/library/base64.rst Thu Jun 4 11:11:51 2009 @@ -116,38 +116,44 @@ incorrectly padded or if there are non-alphabet characters present in the string. -The legacy interface: +The legacy interface: .. function:: decode(input, output) - Decode the contents of the *input* file and write the resulting binary data to - the *output* file. *input* and *output* must either be file objects or objects - that mimic the file object interface. *input* will be read until - ``input.read()`` returns an empty string. + Decode the contents of the binary *input* file and write the resulting binary + data to the *output* file. *input* and *output* must either be file objects + or objects that mimic the file object interface working with bytes + objects. *input* will be read until ``input.read()`` returns an empty string. -.. function:: decodestring(s) - - Decode the string *s*, which must contain one or more lines of base64 encoded - data, and return a string containing the resulting binary data. +.. function:: decodebytes(s) + decodestring(s) + + Decode the bytestring *s*, which must contain one or more lines of base64 + encoded data, and return a bytestring containing the resulting binary data. + ``decodestring`` is a deprecated alias. .. function:: encode(input, output) - Encode the contents of the *input* file and write the resulting base64 encoded - data to the *output* file. *input* and *output* must either be file objects or - objects that mimic the file object interface. *input* will be read until - ``input.read()`` returns an empty string. :func:`encode` returns the encoded - data plus a trailing newline character (``'\n'``). - + Encode the contents of the binary *input* file and write the resulting base64 + encoded data to the *output* file. *input* and *output* must either be file + objects or objects that mimic the file object interface working with bytes + objects. *input* will be read until ``input.read()`` returns an empty string. + :func:`encode` returns the encoded data plus a trailing newline character + (``b'\n'``). + + +.. function:: encodebytes(s) + encodestring(s) + + Encode the bytestring *s*, which can contain arbitrary binary data, and + return a bytestring containing one or more lines of base64-encoded data. + :func:`encodebytes` returns a string containing one or more lines of + base64-encoded data always including an extra trailing newline (``b'\n'``). + ``encodestring`` is a deprecated alias. -.. function:: encodestring(s) - - Encode the string *s*, which can contain arbitrary binary data, and return a - string containing one or more lines of base64-encoded data. - :func:`encodestring` returns a string containing one or more lines of - base64-encoded data always including an extra trailing newline (``'\n'``). An example usage of the module: Modified: python/branches/py3k/Lib/base64.py ============================================================================== --- python/branches/py3k/Lib/base64.py (original) +++ python/branches/py3k/Lib/base64.py Thu Jun 4 11:11:51 2009 @@ -13,7 +13,7 @@ __all__ = [ # Legacy interface exports traditional RFC 1521 Base64 encodings - 'encode', 'decode', 'encodestring', 'decodestring', + 'encode', 'decode', 'encodebytes', 'decodebytes', # Generalized interface for other encodings 'b64encode', 'b64decode', 'b32encode', 'b32decode', 'b16encode', 'b16decode', @@ -329,11 +329,9 @@ output.write(s) -def encodestring(s): - """Encode a string into multiple lines of base-64 data. - - Argument and return value are bytes. - """ +def encodebytes(s): + """Encode a bytestring into a bytestring containing multiple lines + of base-64 data.""" if not isinstance(s, bytes_types): raise TypeError("expected bytes, not %s" % s.__class__.__name__) pieces = [] @@ -342,16 +340,26 @@ pieces.append(binascii.b2a_base64(chunk)) return b"".join(pieces) +def encodestring(s): + """Legacy alias of encodebytes().""" + import warnings + warnings.warn("encodestring() is a deprecated alias, use encodebytes()", + DeprecationWarning, 2) + return encodebytes(s) -def decodestring(s): - """Decode a string. - Argument and return value are bytes. - """ +def decodebytes(s): + """Decode a bytestring of base-64 data into a bytestring.""" if not isinstance(s, bytes_types): raise TypeError("expected bytes, not %s" % s.__class__.__name__) return binascii.a2b_base64(s) +def decodestring(s): + """Legacy alias of decodebytes().""" + import warnings + warnings.warn("decodestring() is a deprecated alias, use decodebytes()", + DeprecationWarning, 2) + return decodebytes(s) # Usable as a script... Modified: python/branches/py3k/Lib/test/test_base64.py ============================================================================== --- python/branches/py3k/Lib/test/test_base64.py (original) +++ python/branches/py3k/Lib/test/test_base64.py Thu Jun 4 11:11:51 2009 @@ -6,35 +6,35 @@ class LegacyBase64TestCase(unittest.TestCase): - def test_encodestring(self): + def test_encodebytes(self): eq = self.assertEqual - eq(base64.encodestring(b"www.python.org"), b"d3d3LnB5dGhvbi5vcmc=\n") - eq(base64.encodestring(b"a"), b"YQ==\n") - eq(base64.encodestring(b"ab"), b"YWI=\n") - eq(base64.encodestring(b"abc"), b"YWJj\n") - eq(base64.encodestring(b""), b"") - eq(base64.encodestring(b"abcdefghijklmnopqrstuvwxyz" + eq(base64.encodebytes(b"www.python.org"), b"d3d3LnB5dGhvbi5vcmc=\n") + eq(base64.encodebytes(b"a"), b"YQ==\n") + eq(base64.encodebytes(b"ab"), b"YWI=\n") + eq(base64.encodebytes(b"abc"), b"YWJj\n") + eq(base64.encodebytes(b""), b"") + eq(base64.encodebytes(b"abcdefghijklmnopqrstuvwxyz" b"ABCDEFGHIJKLMNOPQRSTUVWXYZ" b"0123456789!@#0^&*();:<>,. []{}"), b"YWJjZGVmZ2hpamtsbW5vcHFyc3R1dnd4eXpBQkNE" b"RUZHSElKS0xNTk9QUVJTVFVWV1hZWjAxMjM0\nNT" b"Y3ODkhQCMwXiYqKCk7Ojw+LC4gW117fQ==\n") - self.assertRaises(TypeError, base64.encodestring, "") + self.assertRaises(TypeError, base64.encodebytes, "") - def test_decodestring(self): + def test_decodebytes(self): eq = self.assertEqual - eq(base64.decodestring(b"d3d3LnB5dGhvbi5vcmc=\n"), b"www.python.org") - eq(base64.decodestring(b"YQ==\n"), b"a") - eq(base64.decodestring(b"YWI=\n"), b"ab") - eq(base64.decodestring(b"YWJj\n"), b"abc") - eq(base64.decodestring(b"YWJjZGVmZ2hpamtsbW5vcHFyc3R1dnd4eXpBQkNE" + eq(base64.decodebytes(b"d3d3LnB5dGhvbi5vcmc=\n"), b"www.python.org") + eq(base64.decodebytes(b"YQ==\n"), b"a") + eq(base64.decodebytes(b"YWI=\n"), b"ab") + eq(base64.decodebytes(b"YWJj\n"), b"abc") + eq(base64.decodebytes(b"YWJjZGVmZ2hpamtsbW5vcHFyc3R1dnd4eXpBQkNE" b"RUZHSElKS0xNTk9QUVJTVFVWV1hZWjAxMjM0\nNT" b"Y3ODkhQCMwXiYqKCk7Ojw+LC4gW117fQ==\n"), b"abcdefghijklmnopqrstuvwxyz" b"ABCDEFGHIJKLMNOPQRSTUVWXYZ" b"0123456789!@#0^&*();:<>,. []{}") - eq(base64.decodestring(b''), b'') - self.assertRaises(TypeError, base64.decodestring, "") + eq(base64.decodebytes(b''), b'') + self.assertRaises(TypeError, base64.decodebytes, "") def test_encode(self): eq = self.assertEqual Modified: python/branches/py3k/Lib/test/test_xmlrpc.py ============================================================================== --- python/branches/py3k/Lib/test/test_xmlrpc.py (original) +++ python/branches/py3k/Lib/test/test_xmlrpc.py Thu Jun 4 11:11:51 2009 @@ -232,7 +232,7 @@ def test_decode(self): d = b'\x01\x02\x03abc123\xff\xfe' - de = base64.encodestring(d) + de = base64.encodebytes(d) t1 = xmlrpclib.Binary() t1.decode(de) self.assertEqual(str(t1), str(d, "latin-1")) Modified: python/branches/py3k/Lib/xmlrpc/client.py ============================================================================== --- python/branches/py3k/Lib/xmlrpc/client.py (original) +++ python/branches/py3k/Lib/xmlrpc/client.py Thu Jun 4 11:11:51 2009 @@ -419,11 +419,11 @@ return self.data != other def decode(self, data): - self.data = base64.decodestring(data) + self.data = base64.decodebytes(data) def encode(self, out): out.write("\n") - encoded = base64.encodestring(self.data) + encoded = base64.encodebytes(self.data) out.write(encoded.decode('ascii')) out.write('\n') out.write("\n") @@ -1100,7 +1100,7 @@ if auth: import base64 auth = urllib.parse.unquote_to_bytes(auth) - auth = base64.encodestring(auth).decode("utf-8") + auth = base64.encodebytes(auth).decode("utf-8") auth = "".join(auth.split()) # get rid of whitespace extra_headers = [ ("Authorization", "Basic " + auth) Modified: python/branches/py3k/Misc/NEWS ============================================================================== --- python/branches/py3k/Misc/NEWS (original) +++ python/branches/py3k/Misc/NEWS Thu Jun 4 11:11:51 2009 @@ -21,6 +21,10 @@ Library ------- +- Issue #3613: base64.{encode,decode}string are now called + base64.{encode,decode}bytes which reflects what type they accept and return. + The old names are still there as deprecated aliases. + - Issue #5767: Remove sgmlop support from xmlrpc.client. - Issue #6150: Fix test_unicode on wide-unicode builds. From python-checkins at python.org Thu Jun 4 11:13:09 2009 From: python-checkins at python.org (tarek.ziade) Date: Thu, 4 Jun 2009 11:13:09 +0200 (CEST) Subject: [Python-checkins] r73205 - peps/trunk/pep-0386.txt Message-ID: <20090604091309.1269AD525@mail.python.org> Author: tarek.ziade Date: Thu Jun 4 11:13:08 2009 New Revision: 73205 Log: added PEP 386 (version comparison in Distutils) Added: peps/trunk/pep-0386.txt (contents, props changed) Added: peps/trunk/pep-0386.txt ============================================================================== --- (empty file) +++ peps/trunk/pep-0386.txt Thu Jun 4 11:13:08 2009 @@ -0,0 +1,391 @@ +PEP: 386 +Title: Changing the version comparison module in Distutils +Version: $Revision$ +Last-Modified: $Date$ +Author: Tarek Ziad? +Status: Draft +Type: Standards Track +Content-Type: text/x-rst +Created: 4-June-2009 + + +Abstract +======== + +This PEP proposes the inclusion of a new version comparison system in +Distutils. + + +Motivation +========== + +Distutils will soon extend the metadata standard, by including the +`install_requires` field from Setuptools [#requires]_ among other changes. + +These changes are a work in progress in PEP 345 [#pep345]_, but validating +the current PEP is mandatory to continue the work. + +The `install_requires` field will allow a package to define a dependency on +another package and optionally restrict this dependency to a set of +compatible versions. + +That's why Distutils needs to provide a robust standard and reference +implementation to compare versions numbers. + + +Proposal +======== + +In Python there are no real restriction yet on how a project should manage +its versions, and how they should be incremented. They are no standard +either, even if they are a few conventions widely used, like having a major +and a minor revision (1.1, 1.2, etc.). + +Developers are free to put in the `version` meta-data of their package any +string they want, and push a new release at PyPI. This version will appear +as the `latest` for end users. + +Some project are also using dates as their major version numbers, or a custom +versioning standard that is sometimes quite exotic. + +The problem with this freedom is that the package will be harder to re-package +for OS packagers, that need to have stricter conventions. The worst case is +when a packager is unable to easily compare the versions he needs to package. + +This PEP proposes to change the `version` module in Distutils with a new one +that complies with the needs. + + +Existing version systems +======================== + +There are two main systems in Python: + +- The current Distutils system [#distutils]_ +- Setuptools [#setuptools]_ + +Distutils +--------- + +Distutils currently provides a `StrictVersion` and a `LooseVersion` class +that can be used to manage versions. + +The `LooseVersion` class is quite laxest. From Distutils doc:: + + Version numbering for anarchists and software realists. + Implements the standard interface for version number classes as + described above. A version number consists of a series of numbers, + separated by either periods or strings of letters. When comparing + version numbers, the numeric components will be compared + numerically, and the alphabetic components lexically. The following + are all valid version numbers, in no particular order: + + 1.5.1 + 1.5.2b2 + 161 + 3.10a + 8.02 + 3.4j + 1996.07.12 + 3.2.pl0 + 3.1.1.6 + 2g6 + 11g + 0.960923 + 2.2beta29 + 1.13++ + 5.5.kw + 2.0b1pl0 + + In fact, there is no such thing as an invalid version number under + this scheme; the rules for comparison are simple and predictable, + but may not always give the results you want (for some definition + of "want"). + +This class makes any version string valid, and provides an algorithm to sort +them numerically then lexically. It means that anything can be used to version +your project:: + + >>> from distutils.version import LooseVersion as V + >>> v1 = V('FunkyVersion') + >>> v2 = V('GroovieVersion') + >>> v1 > v2 + False + +The `StrictVersion` class is more strict. From the doc:: + + Version numbering for anal retentive and software idealists. + Implements the standard interface for version number classes as + described above. A version number consists of two or three + dot-separated numeric components, with an optional "pre-release" tag + on the end. The pre-release tag consists of the letter 'a' or 'b' + followed by a number. If the numeric components of two version + numbers are equal, then one with a pre-release tag will always + be deemed earlier (lesser) than one without. + + The following are valid version numbers (shown in the order that + would be obtained by sorting according to the supplied cmp function): + + 0.4 0.4.0 (these two are equivalent) + 0.4.1 + 0.5a1 + 0.5b3 + 0.5 + 0.9.6 + 1.0 + 1.0.4a3 + 1.0.4b1 + 1.0.4 + + The following are examples of invalid version numbers: + + 1 + 2.7.2.2 + 1.3.a4 + 1.3pl1 + 1.3c4 + +This class enforces a few rules, and makes a decent tool to work with version +numbers:: + + >>> from distutils.version import StrictVersion as V + >>> v2 = V('GroovieVersion') + Traceback (most recent call last): + ... + ValueError: invalid version number 'GroovieVersion' + >>> v2 = V('1.1') + >>> v3 = V('1.3') + >>> v2 < v3 + True + +Although, it lacks a few elements to make it usable: + +- development releases +- post-release tags +- development releases of post-release tags. + +Notice that Distutils version classes are not really used in the community. + +Setuptools +---------- + +Setuptools provides another version comparison tool [#setuptools-version]_ +which does not enforce any rule for the version, but try to provide a better +algorithm to convert the strings to sortable keys, with a ``parse_version`` +function. + +From the doc:: + + Convert a version string to a chronologically-sortable key + + This is a rough cross between Distutils' StrictVersion and LooseVersion; + if you give it versions that would work with StrictVersion, then it behaves + the same; otherwise it acts like a slightly-smarter LooseVersion. It is + *possible* to create pathological version coding schemes that will fool + this parser, but they should be very rare in practice. + + The returned value will be a tuple of strings. Numeric portions of the + version are padded to 8 digits so they will compare numerically, but + without relying on how numbers compare relative to strings. Dots are + dropped, but dashes are retained. Trailing zeros between alpha segments + or dashes are suppressed, so that e.g. "2.4.0" is considered the same as + "2.4". Alphanumeric parts are lower-cased. + + The algorithm assumes that strings like "-" and any alpha string that + alphabetically follows "final" represents a "patch level". So, "2.4-1" + is assumed to be a branch or patch of "2.4", and therefore "2.4.1" is + considered newer than "2.4-1", which in turn is newer than "2.4". + + Strings like "a", "b", "c", "alpha", "beta", "candidate" and so on (that + come before "final" alphabetically) are assumed to be pre-release versions, + so that the version "2.4" is considered newer than "2.4a1". + + Finally, to handle miscellaneous cases, the strings "pre", "preview", and + "rc" are treated as if they were "c", i.e. as though they were release + candidates, and therefore are not as new as a version string that does not + contain them, and "dev" is replaced with an '@' so that it sorts lower than + than any other pre-release tag. + +In other words, ``parse_version`` will return a tuple for each version string, +that is compatible with ``StrictVersion`` but also accept arbitrary version and +deal with them so they can be compared:: + + >>> from pkg_resources import parse_version as V + >>> V('1.2') + ('00000001', '00000002', '*final') + >>> V('1.2b2') + ('00000001', '00000002', '*b', '00000002', '*final') + >>> V('FunkyVersion') + ('*funkyversion', '*final') + +Caveats of existing systems +--------------------------- + +The major problem with the described version comparison tools is that they are +too permissive. Many of the versions on PyPI [#pypi]_ are obviously not useful +versions, which makes it difficult for users to grok the versioning that a +particular package was using and to provide tools on top of PyPI. + +Distutils classes are not really used in Python projects, but the +Setuptools function is quite spread because it's used by tools like +`easy_install` [#ezinstall]_, `pip` [#pip]_ or `zc.buildout` [#zc.buildout]_ +to install dependencies of a given project. + +While Setuptools *does* provide a mechanism for comparing/sorting versions, +it is much preferable if the versioning spec is such that a human can make a +reasonable attempt at that sorting without having to run it against some code. + +Also there's a problem with the use of dates at the "major" version number +(e.g. a version string "20090421") with RPMs: it means that any attempt to +switch to a more typical "major.minor..." version scheme is problematic because +it will always sort less than "20090421". + +Last, the meaning of `-` is specific to Setuptools, while it is avoided in +some packaging systems like the one used by Debian or Ubuntu. + +The new versioning algorithm +============================ + +During Pycon, members of the Python, Ubuntu and Fedora community worked on +a version standard that would be acceptable for everyone. + +It's currently called `verlib` and a prototype lives here : +http://bitbucket.org/tarek/distutilsversion/src/ + +The pseudo-format supported is:: + + N.N[.N]+[abc]N[.N]+[.(dev|post)N+|(devNpostN)] + +Some examples probably make it clearer:: + + >>> from verlib import RationalVersion as V + >>> (V('1.0a1') + ... < V('1.0a2.dev456') + ... < V('1.0a2') + ... < V('1.0a2.1.dev456') + ... < V('1.0a2.1') + ... < V('1.0b1.dev456') + ... < V('1.0b2') + ... < V('1.0c1.dev456') + ... < V('1.0c1') + ... < V('1.0.dev456') + ... < V('1.0') + ... < V('1.0.dev456post623') + ... < V('1.0.post456')) + True + +The trailing ".dev123" is for pre-releases. The ".post123" is for +post-releases -- which apparently is used by a number of projects out there +(e.g. Twisted [#twisted]_). For example *after* a "1.2.0" release there might +be a "1.2.0-r678" release. We used "post" instead of "r" because the "r" is +ambiguous as to whether it indicates a pre- or post-release. +Last ".dev456post623" is a development version of a post-release. + +``verlib`` provides a ``RationalVersion`` class and a +``suggest_rational_version`` function. + +RationalVersion +--------------- + +The `RationalVersion` class is used to hold a version and to compare it with +others. It takes a string as an argument, that contains the representation of +the version:: + + >>> from verlib import RationalVersion + >>> version = RationalVersion('1.0') + +The version can be represented as a string:: + + >>> str(version) + '1.0' + +Or compared with others:: + + >>> RationalVersion('1.0') > RationalVersion('0.9') + True + >>> RationalVersion('1.0') < RationalVersion('1.1') + True + +A class method called ``from_parts`` is available if you want to create an +instance by providing the parts that composes the version. + +Each part is a tuple and there are three parts: + +- the main version part +- the pre-release part +- the `devpost` marker part + +Examples :: + + >>> version = RationalVersion.from_parts((1, 0)) + >>> str(version) + '1.0' + + >>> version = RationalVersion.from_parts((1, 0), ('c', 4)) + >>> str(version) + '1.0c4' + + >>> version = RationalVersion.from_parts((1, 0), ('c', 4), ('dev', 34)) + >>> str(version) + '1.0c4.dev34' + +suggest_rational_version +------------------------ + +XXX explain here suggest_rational_version + + +References +========== + +.. [#distutils] + http://docs.python.org/distutils + +.. [#setuptools] + http://peak.telecommunity.com/DevCenter/setuptools + +.. [#setuptools-version] + http://peak.telecommunity.com/DevCenter/setuptools#specifying-your-project-s-version + +.. [#pypi] + http://pypi.python.org/pypi + +.. [#pip] + http://pypi.python.org/pypi/pip + +.. [#ezinstall] + http://peak.telecommunity.com/DevCenter/EasyInstall + +.. [#zc.buildout] + http://pypi.python.org/pypi/zc.buildout + +.. [#twisted] + http://twistedmatrix.com/trac/ + +.. [#requires] + http://peak.telecommunity.com/DevCenter/setuptools + +.. [#pep345] + http://svn.python.org/projects/peps/branches/jim-update-345/pep-0345.txt + +Aknowledgments +============== + +Trent Mick, Matthias Klose, Phillip Eby, and many people at Pycon and +Distutils-SIG. + +Copyright +========= + +This document has been placed in the public domain. + + + +.. + Local Variables: + mode: indented-text + indent-tabs-mode: nil + sentence-end-double-space: t + fill-column: 70 + coding: utf-8 + End: From python-checkins at python.org Thu Jun 4 11:15:12 2009 From: python-checkins at python.org (georg.brandl) Date: Thu, 4 Jun 2009 11:15:12 +0200 (CEST) Subject: [Python-checkins] r73206 - python/trunk/Lib/traceback.py Message-ID: <20090604091512.AB128D525@mail.python.org> Author: georg.brandl Date: Thu Jun 4 11:15:12 2009 New Revision: 73206 Log: #3584: ignore trailing newlines when placing the caret for a SyntaxError location. Modified: python/trunk/Lib/traceback.py Modified: python/trunk/Lib/traceback.py ============================================================================== --- python/trunk/Lib/traceback.py (original) +++ python/trunk/Lib/traceback.py Thu Jun 4 11:15:12 2009 @@ -189,7 +189,7 @@ if badline is not None: lines.append(' %s\n' % badline.strip()) if offset is not None: - caretspace = badline[:offset].lstrip() + caretspace = badline.rstrip('\n')[:offset].lstrip() # non-space whitespace (likes tabs) must be kept for alignment caretspace = ((c.isspace() and c or ' ') for c in caretspace) # only three spaces to account for offset1 == pos 0 From python-checkins at python.org Thu Jun 4 11:29:12 2009 From: python-checkins at python.org (tarek.ziade) Date: Thu, 4 Jun 2009 11:29:12 +0200 (CEST) Subject: [Python-checkins] r73207 - peps/trunk/pep-0386.txt Message-ID: <20090604092912.7A81AD900@mail.python.org> Author: tarek.ziade Date: Thu Jun 4 11:29:12 2009 New Revision: 73207 Log: rephrased introduction Modified: peps/trunk/pep-0386.txt Modified: peps/trunk/pep-0386.txt ============================================================================== --- peps/trunk/pep-0386.txt (original) +++ peps/trunk/pep-0386.txt Thu Jun 4 11:29:12 2009 @@ -32,9 +32,12 @@ That's why Distutils needs to provide a robust standard and reference implementation to compare versions numbers. +This will also provide to the community a convention for their package +versioning needs. -Proposal -======== + +Current status +============== In Python there are no real restriction yet on how a project should manage its versions, and how they should be incremented. They are no standard @@ -52,14 +55,8 @@ for OS packagers, that need to have stricter conventions. The worst case is when a packager is unable to easily compare the versions he needs to package. -This PEP proposes to change the `version` module in Distutils with a new one -that complies with the needs. - - -Existing version systems -======================== - -There are two main systems in Python: +For people that want to go further and use a tool to manage their version +numbers, the two major ones are: - The current Distutils system [#distutils]_ - Setuptools [#setuptools]_ From python-checkins at python.org Thu Jun 4 11:30:31 2009 From: python-checkins at python.org (georg.brandl) Date: Thu, 4 Jun 2009 11:30:31 +0200 (CEST) Subject: [Python-checkins] r73208 - in python/branches/py3k: Doc/library/shelve.rst Doc/library/weakref.rst Lib/test/regrtest.py Makefile.pre.in Misc/RPM/python-3.1.spec Misc/valgrind-python.supp Modules/Setup.dist PC/VS7.1/python.build PC/VS7.1/python.iss PC/VS7.1/python20.wse PC/VS7.1/readme.txt PC/VS8.0/pyproject.vsprops PC/os2emx/README.os2emx PC/os2vacpp/makefile PC/os2vacpp/makefile.omk PCbuild/pyproject.vsprops PCbuild/readme.txt PCbuild/vs9to8.py Message-ID: <20090604093031.12B25DA02@mail.python.org> Author: georg.brandl Date: Thu Jun 4 11:30:30 2009 New Revision: 73208 Log: #3791: remove last traces of bsddb. Modified: python/branches/py3k/Doc/library/shelve.rst python/branches/py3k/Doc/library/weakref.rst python/branches/py3k/Lib/test/regrtest.py python/branches/py3k/Makefile.pre.in python/branches/py3k/Misc/RPM/python-3.1.spec python/branches/py3k/Misc/valgrind-python.supp python/branches/py3k/Modules/Setup.dist python/branches/py3k/PC/VS7.1/python.build python/branches/py3k/PC/VS7.1/python.iss python/branches/py3k/PC/VS7.1/python20.wse python/branches/py3k/PC/VS7.1/readme.txt python/branches/py3k/PC/VS8.0/pyproject.vsprops python/branches/py3k/PC/os2emx/README.os2emx python/branches/py3k/PC/os2vacpp/makefile python/branches/py3k/PC/os2vacpp/makefile.omk python/branches/py3k/PCbuild/pyproject.vsprops python/branches/py3k/PCbuild/readme.txt python/branches/py3k/PCbuild/vs9to8.py Modified: python/branches/py3k/Doc/library/shelve.rst ============================================================================== --- python/branches/py3k/Doc/library/shelve.rst (original) +++ python/branches/py3k/Doc/library/shelve.rst Thu Jun 4 11:30:30 2009 @@ -102,12 +102,14 @@ .. class:: BsdDbShelf(dict[, protocol=None[, writeback=False]]) A subclass of :class:`Shelf` which exposes :meth:`first`, :meth:`next`, - :meth:`previous`, :meth:`last` and :meth:`set_location` which are available in - the :mod:`bsddb` module but not in other database modules. The *dict* object - passed to the constructor must support those methods. This is generally - accomplished by calling one of :func:`bsddb.hashopen`, :func:`bsddb.btopen` or - :func:`bsddb.rnopen`. The optional *protocol* and *writeback* parameters have - the same interpretation as for the :class:`Shelf` class. + :meth:`previous`, :meth:`last` and :meth:`set_location` which are available + in the third-party :mod:`bsddb` module from `pybsddb + `_ but not in other database + modules. The *dict* object passed to the constructor must support those + methods. This is generally accomplished by calling one of + :func:`bsddb.hashopen`, :func:`bsddb.btopen` or :func:`bsddb.rnopen`. The + optional *protocol* and *writeback* parameters have the same interpretation + as for the :class:`Shelf` class. .. class:: DbfilenameShelf(filename[, flag='c'[, protocol=None[, writeback=False]]]) Modified: python/branches/py3k/Doc/library/weakref.rst ============================================================================== --- python/branches/py3k/Doc/library/weakref.rst (original) +++ python/branches/py3k/Doc/library/weakref.rst Thu Jun 4 11:30:30 2009 @@ -59,9 +59,8 @@ Not all objects can be weakly referenced; those objects which can include class instances, functions written in Python (but not in C), instance methods, sets, -frozensets, file objects, :term:`generator`\s, type objects, :class:`DBcursor` -objects from the :mod:`bsddb` module, sockets, arrays, deques, and regular -expression pattern objects. +frozensets, file objects, :term:`generator`\s, type objects, sockets, arrays, +deques, and regular expression pattern objects. Several builtin types such as :class:`list` and :class:`dict` do not directly support weak references but can add support through subclassing:: Modified: python/branches/py3k/Lib/test/regrtest.py ============================================================================== --- python/branches/py3k/Lib/test/regrtest.py (original) +++ python/branches/py3k/Lib/test/regrtest.py Thu Jun 4 11:30:30 2009 @@ -114,9 +114,6 @@ network - It is okay to run tests that use external network resource, e.g. testing SSL support for sockets. - bsddb - It is okay to run the bsddb testsuite, which takes - a long time to complete. - decimal - Test the decimal module against a large suite that verifies compliance with standards. @@ -130,8 +127,8 @@ gui - Run tests that require a running GUI. To enable all resources except one, use '-uall,-'. For -example, to run all the tests except for the bsddb tests, give the -option '-uall,-bsddb'. +example, to run all the tests except for the gui tests, give the +option '-uall,-gui'. """ import getopt @@ -182,7 +179,7 @@ from test import support -RESOURCE_NAMES = ('audio', 'curses', 'largefile', 'network', 'bsddb', +RESOURCE_NAMES = ('audio', 'curses', 'largefile', 'network', 'decimal', 'compiler', 'subprocess', 'urlfetch', 'gui') @@ -900,7 +897,6 @@ 'win32': """ test__locale - test_bsddb3 test_crypt test_curses test_dbm @@ -937,8 +933,6 @@ 'mac': """ test_atexit - test_bsddb - test_bsddb3 test_bz2 test_crypt test_curses @@ -966,7 +960,6 @@ """, 'unixware7': """ - test_bsddb test_epoll test_largefile test_kqueue @@ -978,7 +971,6 @@ """, 'openunix8': """ - test_bsddb test_epoll test_largefile test_kqueue @@ -991,7 +983,6 @@ 'sco_sv3': """ test_asynchat - test_bsddb test_fork1 test_epoll test_gettext @@ -1012,8 +1003,6 @@ 'darwin': """ test__locale - test_bsddb - test_bsddb3 test_curses test_epoll test_dbm_gnu @@ -1025,7 +1014,6 @@ """, 'sunos5': """ - test_bsddb test_curses test_dbm test_epoll @@ -1038,7 +1026,6 @@ """, 'hp-ux11': """ - test_bsddb test_curses test_epoll test_dbm_gnu @@ -1068,7 +1055,6 @@ """, 'cygwin': """ - test_bsddb3 test_curses test_dbm test_epoll @@ -1082,7 +1068,6 @@ 'os2emx': """ test_audioop - test_bsddb3 test_curses test_epoll test_kqueue @@ -1096,8 +1081,6 @@ """, 'freebsd4': """ - test_bsddb - test_bsddb3 test_epoll test_dbm_gnu test_locale @@ -1115,8 +1098,6 @@ """, 'aix5': """ - test_bsddb - test_bsddb3 test_bz2 test_epoll test_dbm_gnu @@ -1132,8 +1113,6 @@ """, 'openbsd3': """ - test_bsddb - test_bsddb3 test_ctypes test_epoll test_dbm_gnu @@ -1149,8 +1128,6 @@ """, 'netbsd3': """ - test_bsddb - test_bsddb3 test_ctypes test_curses test_epoll Modified: python/branches/py3k/Makefile.pre.in ============================================================================== --- python/branches/py3k/Makefile.pre.in (original) +++ python/branches/py3k/Makefile.pre.in Thu Jun 4 11:30:30 2009 @@ -840,7 +840,7 @@ email email/mime email/test email/test/data \ html json json/tests http dbm xmlrpc \ sqlite3 sqlite3/test \ - logging bsddb bsddb/test csv wsgiref urllib \ + logging csv wsgiref urllib \ lib2to3 lib2to3/fixes lib2to3/pgen2 lib2to3/tests \ lib2to3/tests/data lib2to3/tests/data/fixers lib2to3/tests/data/fixers/myfixes \ ctypes ctypes/test ctypes/macholib idlelib idlelib/Icons \ Modified: python/branches/py3k/Misc/RPM/python-3.1.spec ============================================================================== --- python/branches/py3k/Misc/RPM/python-3.1.spec (original) +++ python/branches/py3k/Misc/RPM/python-3.1.spec Thu Jun 4 11:30:30 2009 @@ -360,7 +360,6 @@ %{__prefix}/%{libdirname}/python%{libvers}/email/mime %{__prefix}/%{libdirname}/python%{libvers}/sqlite3 %{__prefix}/%{libdirname}/python%{libvers}/compiler -%{__prefix}/%{libdirname}/python%{libvers}/bsddb %{__prefix}/%{libdirname}/python%{libvers}/hotshot %{__prefix}/%{libdirname}/python%{libvers}/logging %{__prefix}/%{libdirname}/python%{libvers}/lib-old Modified: python/branches/py3k/Misc/valgrind-python.supp ============================================================================== --- python/branches/py3k/Misc/valgrind-python.supp (original) +++ python/branches/py3k/Misc/valgrind-python.supp Thu Jun 4 11:30:30 2009 @@ -5,7 +5,7 @@ # # cd python/dist/src # valgrind --tool=memcheck --suppressions=Misc/valgrind-python.supp \ -# ./python -E ./Lib/test/regrtest.py -u bsddb,network +# ./python -E ./Lib/test/regrtest.py -u gui,network # # You must edit Objects/obmalloc.c and uncomment Py_USING_MEMORY_DEBUGGER # to use the preferred suppressions with Py_ADDRESS_IN_RANGE. Modified: python/branches/py3k/Modules/Setup.dist ============================================================================== --- python/branches/py3k/Modules/Setup.dist (original) +++ python/branches/py3k/Modules/Setup.dist Thu Jun 4 11:30:30 2009 @@ -324,25 +324,6 @@ #_gdbm _gdbmmodule.c -I/usr/local/include -L/usr/local/lib -lgdbm -# Sleepycat Berkeley DB interface. -# -# This requires the Sleepycat DB code, see http://www.sleepycat.com/ -# The earliest supported version of that library is 3.0, the latest -# supported version is 4.0 (4.1 is specifically not supported, as that -# changes the semantics of transactional databases). A list of available -# releases can be found at -# -# http://www.sleepycat.com/update/index.html -# -# Edit the variables DB and DBLIBVERto point to the db top directory -# and the subdirectory of PORT where you built it. -#DB=/usr/local/BerkeleyDB.4.0 -#DBLIBVER=4.0 -#DBINC=$(DB)/include -#DBLIB=$(DB)/lib -#_bsddb _bsddb.c -I$(DBINC) -L$(DBLIB) -ldb-$(DBLIBVER) - - # Helper module for various ascii-encoders #binascii binascii.c Modified: python/branches/py3k/PC/VS7.1/python.build ============================================================================== --- python/branches/py3k/PC/VS7.1/python.build (original) +++ python/branches/py3k/PC/VS7.1/python.build Thu Jun 4 11:30:30 2009 @@ -12,7 +12,6 @@ - Modified: python/branches/py3k/PC/VS7.1/python.iss ============================================================================== --- python/branches/py3k/PC/VS7.1/python.iss (original) +++ python/branches/py3k/PC/VS7.1/python.iss Thu Jun 4 11:30:30 2009 @@ -137,9 +137,6 @@ Source: DLLs\_tkinter.pyd; DestDir: {app}\DLLs; CopyMode: alwaysoverwrite; Components: tk Source: libs\_tkinter.lib; DestDir: {app}\libs; CopyMode: alwaysoverwrite; Components: tk -Source: DLLs\bsddb.pyd; DestDir: {app}\DLLs; CopyMode: alwaysoverwrite; Components: main -Source: libs\bsddb.lib; DestDir: {app}\libs; CopyMode: alwaysoverwrite; Components: main - Source: DLLs\mmap.pyd; DestDir: {app}\DLLs; CopyMode: alwaysoverwrite; Components: main Source: libs\mmap.lib; DestDir: {app}\libs; CopyMode: alwaysoverwrite; Components: main Modified: python/branches/py3k/PC/VS7.1/python20.wse ============================================================================== --- python/branches/py3k/PC/VS7.1/python20.wse (original) +++ python/branches/py3k/PC/VS7.1/python20.wse Thu Jun 4 11:30:30 2009 @@ -1754,11 +1754,6 @@ Flags=0000000000000010 end item: Install File - Source=.\_bsddb.pyd - Destination=%MAINDIR%\DLLs\_bsddb.pyd - Flags=0000000000000010 -end -item: Install File Source=.\bz2.pyd Destination=%MAINDIR%\DLLs\bz2.pyd Flags=0000000000000010 @@ -1851,11 +1846,6 @@ Flags=0000000000000010 end item: Install File - Source=.\_bsddb.lib - Destination=%MAINDIR%\libs\_bsddb.lib - Flags=0000000000000010 -end -item: Install File Source=.\bz2.lib Destination=%MAINDIR%\libs\bz2.lib Flags=0000000000000010 @@ -1940,14 +1930,6 @@ item: Remark end item: Install File - Source=..\lib\bsddb\*.py - Destination=%MAINDIR%\Lib\bsddb - Description=Berkeley database package - Flags=0000000100000010 -end -item: Remark -end -item: Install File Source=..\lib\compiler\*.py Destination=%MAINDIR%\Lib\compiler Description=Python compiler written in Python Modified: python/branches/py3k/PC/VS7.1/readme.txt ============================================================================== --- python/branches/py3k/PC/VS7.1/readme.txt (original) +++ python/branches/py3k/PC/VS7.1/readme.txt Thu Jun 4 11:30:30 2009 @@ -138,82 +138,6 @@ All of this managed to build bzip2-1.0.3\libbz2.lib, which the Python project links in. - -_bsddb - To use the version of bsddb that Python is built with by default, invoke - (in the dist directory) - - svn export http://svn.python.org/projects/external/db-4.4.20 - - - Then open a VS.NET 2003 shell, and invoke: - - devenv db-4.4.20\build_win32\Berkeley_DB.sln /build Release /project db_static - - and do that a second time for a Debug build too: - - devenv db-4.4.20\build_win32\Berkeley_DB.sln /build Debug /project db_static - - Alternatively, if you want to start with the original sources, - go to Sleepycat's download page: - http://www.sleepycat.com/downloads/releasehistorybdb.html - - and download version 4.4.20. - - With or without strong cryptography? You can choose either with or - without strong cryptography, as per the instructions below. By - default, Python is built and distributed WITHOUT strong crypto. - - Unpack the sources; if you downloaded the non-crypto version, rename - the directory from db-4.4.20.NC to db-4.4.20. - - Now apply any patches that apply to your version. - - Open - dist\db-4.4.20\docs\index.html - - and follow the "Windows->Building Berkeley DB with Visual C++ .NET" - instructions for building the Sleepycat - software. Note that Berkeley_DB.dsw is in the build_win32 subdirectory. - Build the "db_static" project, for "Release" mode. - - To run extensive tests, pass "-u bsddb" to regrtest.py. test_bsddb3.py - is then enabled. Running in verbose mode may be helpful. - - XXX The test_bsddb3 tests don't always pass, on Windows (according to - XXX me) or on Linux (according to Barry). (I had much better luck - XXX on Win2K than on Win98SE.) The common failure mode across platforms - XXX is - XXX DBAgainError: (11, 'Resource temporarily unavailable -- unable - XXX to join the environment') - XXX - XXX and it appears timing-dependent. On Win2K I also saw this once: - XXX - XXX test02_SimpleLocks (bsddb.test.test_thread.HashSimpleThreaded) ... - XXX Exception in thread reader 1: - XXX Traceback (most recent call last): - XXX File "C:\Code\python\lib\threading.py", line 411, in __bootstrap - XXX self.run() - XXX File "C:\Code\python\lib\threading.py", line 399, in run - XXX apply(self.__target, self.__args, self.__kwargs) - XXX File "C:\Code\python\lib\bsddb\test\test_thread.py", line 268, in - XXX readerThread - XXX rec = c.next() - XXX DBLockDeadlockError: (-30996, 'DB_LOCK_DEADLOCK: Locker killed - XXX to resolve a deadlock') - XXX - XXX I'm told that DBLockDeadlockError is expected at times. It - XXX doesn't cause a test to fail when it happens (exceptions in - XXX threads are invisible to unittest). - - Building for Win64: - - open a VS.NET 2003 command prompt - - run the SDK setenv.cmd script, passing /RETAIL and the target - architecture (/SRV64 for Itanium, /X64 for AMD64) - - build BerkeleyDB with the solution configuration matching the - target ("Release IA64" for Itanium, "Release AMD64" for AMD64), e.g. - devenv db-4.4.20\build_win32\Berkeley_DB.sln /build "Release AMD64" /project db_static /useenv - _sqlite3 Python wrapper for SQLite library. @@ -363,7 +287,7 @@ Extension modules To build those extension modules which require external libraries - (_tkinter, bz2, _bsddb, _sqlite3, _ssl) you can follow the instructions + (_tkinter, bz2, _sqlite3, _ssl) you can follow the instructions for the Visual Studio build above, with a few minor modifications. These instructions have only been tested using the sources in the Python subversion repository - building from original sources should work, but @@ -386,19 +310,6 @@ bz2 No changes are needed - _bsddb - The file db.build should be copied from the Python PCBuild directory - to the directory db-4.4.20\build_win32. - - The file db_static.vcproj in db-4.4.20\build_win32 should be edited to - remove the string "$(SolutionDir)" - this occurs in 2 places, only - relevant for 64-bit builds. (The edit is required as otherwise, nant - wants to read the solution file, which is not in a suitable form). - - The bsddb library can then be build with the command - nant -buildfile:db.build all - run from the db-4.4.20\build_win32 directory. - _sqlite3 No changes are needed. However, in order for the tests to succeed, a copy of sqlite3.dll must be downloaded, and placed alongside Modified: python/branches/py3k/PC/VS8.0/pyproject.vsprops ============================================================================== --- python/branches/py3k/PC/VS8.0/pyproject.vsprops (original) +++ python/branches/py3k/PC/VS8.0/pyproject.vsprops Thu Jun 4 11:30:30 2009 @@ -49,30 +49,6 @@ Value="..\..\.." /> - - - - - - Modified: python/branches/py3k/PC/os2emx/README.os2emx ============================================================================== --- python/branches/py3k/PC/os2emx/README.os2emx (original) +++ python/branches/py3k/PC/os2emx/README.os2emx Thu Jun 4 11:30:30 2009 @@ -123,7 +123,7 @@ Where I've been able to locate the required 3rd party packages already ported to OS/2, I've built and included them. -These include ncurses (_curses, _curses_panel), BSD DB (bsddb185), +These include ncurses (_curses, _curses_panel), GNU GDBM (gdbm, dbm), zlib (zlib), GNU Readline (readline), and GNU UFC (crypt). @@ -150,10 +150,6 @@ No updates to the Python 2.6 release have become available. -Eberhard Mattes' EMXFIX04 update to his EMX 0.9d tools suite includes -bug fixes for the BSD DB library. The bsddb module included in this -port incorporates these fixes. - Library and other distributed Python code: The Python standard library lives in the Lib directory. All the standard @@ -326,7 +322,6 @@ GNU UltraFast Crypt HAVE_UFC Tcl/Tk HAVE_TCLTK (not known to work) GNU Readline HAVE_GREADLINE - BSD DB (v1.85) HAVE_BSDDB ncurses HAVE_NCURSES GNU gdbm HAVE_GDBM libbz2 HAVE_BZ2 @@ -388,52 +383,23 @@ Because of other side-effects I have modified the test_fcntl.py test script to deactivate the exercising of the missing functionality. -4. the PyBSDDB3 module has been imported into the Python standard -library, with the intent of superceding the BSDDB 1.85 module (bsddb). -As I don't yet have a satisfactory port of Sleepcat's more recent DB -library (3.3.x/4.0.x/4.1.x), I haven't included a binary of this -module. I have left the Python part of the PyBSDDB package in this -distribution for completeness. - -5. As a consequence of the PyBSDDB3 module being imported, the former -BSD DB (bsddb) module, linked against the DB v1.85 library from EMX, -has been renamed bsddb185. The bsddb185 module will not be built by -default on most platforms, but in the absence of a PyBSDDB3 module I -have retained it in the EMX port. - -Version 1.85 of the DB library is widely known to have bugs, although -some patches have become available (and are incorporated into the -included bsddb185 module). Unless you have problems with software -licenses which would rule out GDBM (and the dbm module because it is -linked against the GDBM library) or need it for file format compatibility, -you may be better off deleting it and relying on GDBM. - -Any code you have which uses the v1.85 bsddb module can be modified to -use the renamed module by changing - - import bsddb - -to - - import bsddb185 as bsddb - -6. The readline module has been linked against ncurses rather than the +4. The readline module has been linked against ncurses rather than the termcap library supplied with EMX. -7. I have configured this port to use "/" as the preferred path separator +5. I have configured this port to use "/" as the preferred path separator character, rather than "\" ('\\'), in line with the convention supported by EMX. Backslashes are still supported of course, and still appear in unexpected places due to outside sources that don't get normalised. -8. While the DistUtils components are now functional, other +6. While the DistUtils components are now functional, other packaging/binary handling tools and utilities such as those included in the Demo and Tools directories - freeze in particular - are unlikely to work. If you do get them going, I'd like to know about your success. -9. I haven't set out to support the [BEGIN|END]LIBPATH functionality +7. I haven't set out to support the [BEGIN|END]LIBPATH functionality supported by one of the earlier ports (Rush's??). If it works let me know. -10. As a result of the limitations imposed by EMX's library routines, the +8. As a result of the limitations imposed by EMX's library routines, the standard extension module pwd only synthesises a simple passwd database, and the grp module cannot be supported at all. @@ -511,11 +477,7 @@ ready yet. 16. I have successfully built this port with Andy Zabolotny's ports of -pgcc 2.95 and gcc 3.2.1, in addition to EM's gcc 2.8.1. To use the -bsddb185 module with the gcc 3.2.1 build, I had to recompile the DB library -with gcc 3.2.1 - I don't know why, but trying to import the module built -against a DB library compiled with gcc 2.8.1 would result in a SYS3175 -error. +pgcc 2.95 and gcc 3.2.1, in addition to EM's gcc 2.8.1. I have not attempted to compile Python with any version of gcc prior to v2.8.1. Modified: python/branches/py3k/PC/os2vacpp/makefile ============================================================================== --- python/branches/py3k/PC/os2vacpp/makefile (original) +++ python/branches/py3k/PC/os2vacpp/makefile Thu Jun 4 11:30:30 2009 @@ -408,20 +408,6 @@ $(PY_INCLUDE)\sliceobject.h $(PY_INCLUDE)\stringobject.h \ $(PY_INCLUDE)\sysmodule.h $(PY_INCLUDE)\traceback.h $(PY_INCLUDE)\tupleobject.h -bsddbmodule.obj: $(PY_INCLUDE)\abstract.h $(PY_INCLUDE)\ceval.h \ - $(PY_INCLUDE)\classobject.h $(PY_INCLUDE)\cobject.h $(PY_INCLUDE)\complexobject.h \ - pyconfig.h $(PY_INCLUDE)\dictobject.h $(PY_INCLUDE)\fileobject.h \ - $(PY_INCLUDE)\floatobject.h $(PY_INCLUDE)\funcobject.h $(PY_INCLUDE)\import.h \ - $(PY_INCLUDE)\intobject.h $(PY_INCLUDE)\intrcheck.h $(PY_INCLUDE)\listobject.h \ - $(PY_INCLUDE)\longobject.h $(PY_INCLUDE)\methodobject.h \ - $(PY_INCLUDE)\modsupport.h $(PY_INCLUDE)\moduleobject.h $(PY_INCLUDE)\mymalloc.h \ - $(PY_INCLUDE)\myproto.h $(PY_INCLUDE)\object.h $(PY_INCLUDE)\objimpl.h \ - $(PY_INCLUDE)\pydebug.h $(PY_INCLUDE)\pyerrors.h $(PY_INCLUDE)\pyfpe.h \ - $(PY_INCLUDE)\pystate.h $(PY_INCLUDE)\python.h $(PY_INCLUDE)\pythonrun.h \ - $(PY_INCLUDE)\rangeobject.h $(PY_INCLUDE)\sliceobject.h \ - $(PY_INCLUDE)\stringobject.h $(PY_INCLUDE)\sysmodule.h $(PY_INCLUDE)\traceback.h \ - $(PY_INCLUDE)\tupleobject.h - cmathmodule.obj: $(PY_INCLUDE)\abstract.h $(PY_INCLUDE)\ceval.h \ $(PY_INCLUDE)\classobject.h $(PY_INCLUDE)\cobject.h $(PY_INCLUDE)\complexobject.h \ pyconfig.h $(PY_INCLUDE)\dictobject.h $(PY_INCLUDE)\fileobject.h \ Modified: python/branches/py3k/PC/os2vacpp/makefile.omk ============================================================================== --- python/branches/py3k/PC/os2vacpp/makefile.omk (original) +++ python/branches/py3k/PC/os2vacpp/makefile.omk Thu Jun 4 11:30:30 2009 @@ -360,14 +360,6 @@ pythonrun.h rangeobject.h sliceobject.h stringobject.h sysmodule.h \ traceback.h tupleobject.h -bsddbmodule.obj: abstract.h ceval.h classobject.h cobject.h complexobject.h \ - pyconfig.h dictobject.h fileobject.h floatobject.h funcobject.h \ - import.h intobject.h intrcheck.h listobject.h longobject.h \ - methodobject.h modsupport.h moduleobject.h mymalloc.h myproto.h \ - object.h objimpl.h pydebug.h pyerrors.h pyfpe.h pystate.h python.h \ - pythonrun.h rangeobject.h sliceobject.h stringobject.h sysmodule.h \ - traceback.h tupleobject.h - cmathmodule.obj: abstract.h ceval.h classobject.h cobject.h complexobject.h \ pyconfig.h dictobject.h fileobject.h floatobject.h funcobject.h \ import.h intobject.h intrcheck.h listobject.h longobject.h \ Modified: python/branches/py3k/PCbuild/pyproject.vsprops ============================================================================== --- python/branches/py3k/PCbuild/pyproject.vsprops (original) +++ python/branches/py3k/PCbuild/pyproject.vsprops Thu Jun 4 11:30:30 2009 @@ -49,30 +49,6 @@ Value="..\.." /> - - - - - - Modified: python/branches/py3k/PCbuild/readme.txt ============================================================================== --- python/branches/py3k/PCbuild/readme.txt (original) +++ python/branches/py3k/PCbuild/readme.txt Thu Jun 4 11:30:30 2009 @@ -103,13 +103,10 @@ play sounds (typically .wav files) under Windows Python-controlled subprojects that wrap external projects: -_bsddb - Wraps Berkeley DB 4.7.25, which is currently built by _bsddb.vcproj. - project (see below). _sqlite3 Wraps SQLite 3.5.9, which is currently built by sqlite3.vcproj (see below). _tkinter - Wraps the Tk windowing system. Unlike _bsddb and _sqlite3, there's no + Wraps the Tk windowing system. Unlike _sqlite3, there's no corresponding tcltk.vcproj-type project that builds Tcl/Tk from vcproj's within our pcbuild.sln, which means this module expects to find a pre-built Tcl/Tk in either ..\..\tcltk for 32-bit or ..\..\tcltk64 for @@ -213,8 +210,8 @@ This will be cleaned up in the future; ideally Tcl/Tk will be brought into our pcbuild.sln as custom .vcproj files, just as we've recently done with the -_bsddb.vcproj and sqlite3.vcproj files, which will remove the need for -Tcl/Tk to be built separately via a batch file. +sqlite3.vcproj file, which will remove the need for Tcl/Tk to be built +separately via a batch file. XXX trent.nelson 02-Apr-08: Having the external subprojects in ..\.. relative to this directory is a Modified: python/branches/py3k/PCbuild/vs9to8.py ============================================================================== --- python/branches/py3k/PCbuild/vs9to8.py (original) +++ python/branches/py3k/PCbuild/vs9to8.py Thu Jun 4 11:30:30 2009 @@ -25,8 +25,6 @@ # Bah. VS8.0 does not expand macros in file names. # Replace them here. lines = lines.replace('$(sqlite3Dir)', '..\\..\\..\\sqlite-3.5.9') - lines = lines.replace('$(bsddbDir)\\..\\..', '..\\..\\..\\db-4.4.20\\build_win32\\..') - lines = lines.replace('$(bsddbDir)', '..\\..\\..\\db-4.4.20\\build_win32') with open(destname, 'wb') as fout: lines = lines.replace("\n", "\r\n").encode() From python-checkins at python.org Thu Jun 4 11:36:32 2009 From: python-checkins at python.org (tarek.ziade) Date: Thu, 4 Jun 2009 11:36:32 +0200 (CEST) Subject: [Python-checkins] r73209 - peps/trunk/pep-0376.txt Message-ID: <20090604093632.BFD87D8F4@mail.python.org> Author: tarek.ziade Date: Thu Jun 4 11:36:32 2009 New Revision: 73209 Log: reflecting the last API discussions in the SIG Modified: peps/trunk/pep-0376.txt Modified: peps/trunk/pep-0376.txt ============================================================================== --- peps/trunk/pep-0376.txt (original) +++ peps/trunk/pep-0376.txt Thu Jun 4 11:36:32 2009 @@ -115,7 +115,7 @@ - a new `.egg-info` structure using a directory, based on the `EggFormats` standard from `setuptools` [#eggformats]_. - new APIs in `pkgutil` to be able to query the information of installed - projects. + projects. - a de-facto replacement for PEP 262 - an uninstall function in Distutils. @@ -151,10 +151,10 @@ The egg-info directory name is created using a new function called ``egg_info_dirname(name, version)`` added to ``pkgutil``. ``name`` is converted to a standard distribution name any runs of non-alphanumeric -characters are replaced with a single '-'. ``version`` is converted -to a standard version string. Spaces become dots, and all other -non-alphanumeric characters become dashes, with runs of multiple dashes -condensed to a single dash. Both attributes are then converted into their +characters are replaced with a single '-'. ``version`` is converted +to a standard version string. Spaces become dots, and all other +non-alphanumeric characters become dashes, with runs of multiple dashes +condensed to a single dash. Both attributes are then converted into their filename-escaped form. Any '-' characters are currently replaced with '_'. Examples:: @@ -233,23 +233,33 @@ To use the `.egg-info` directory content, we need to add in the standard library a set of APIs. The best place to put these APIs seems to be `pkgutil`. +The API is organized in three classes: + +- ``EggInfo``: manages an `.egg-info` directory. +- ``EggInfoDirectory``: manages a directory that contains some `.egg-info` + directories. +- ``EggInfoDirectories``: manages ``EggInfoDirectory`` instances. + EggInfo class ------------- -A new class called ``EggInfo`` is created, which provides the following -attributes: +A new class called ``EggInfo`` is created with a the path of the `.egg-info` +directory provided to the contructor. It reads the metadata contained in +`PKG-INFO` when it is instanciated. + +``EggInfo`` provides the following attributes: - ``name``: The name of the project - ``metadata``: A ``DistributionMetadata`` instance loaded with the project's PKG-INFO file -The following methods are provided: +And following methods: - ``get_installed_files(local=False)`` -> iterator of (path, md5, size) - Iterates over the `RECORD` entries and return a tuple ``(path, md5, size)`` - for each line. If ``local`` is ``True``, the path is transformed into a + Iterates over the `RECORD` entries and return a tuple ``(path, md5, size)`` + for each line. If ``local`` is ``True``, the path is transformed into a local absolute path. Otherwise the raw value from `RECORD` is returned. - ``uses(path)`` -> Boolean @@ -257,30 +267,100 @@ Returns ``True`` if ``path`` is listed in `RECORD`. ``path`` can be a local absolute path or a relative '/'-separated path. -- ``owns(path)`` -> Boolean - - Returns ``True`` if ``path`` is owned by the project. - Owned means that the path is used only by this project and is not used - by any other project. ``path`` can be a local absolute path or a relative - '/'-separated path. - - ``get_file(path, binary=False)`` -> file object - Returns a ``file`` instance for the file pointed by ``path``. ``path`` can be - a local absolute path or a relative '/'-separated path. If ``binary`` is + Returns a ``file`` instance for the file pointed by ``path``. ``path`` can be + a local absolute path or a relative '/'-separated path. If ``binary`` is ``True``, opens the file in binary mode. +EggInfoDirectory class +---------------------- + +A new class called ``EggInfoDirectory`` is created with a path corresponding +to a directory. For each `.egg-info` directory founded in `path`, the class +creates a corresponding ``EggInfo``. + +The class is iterable, and returns every ``EggInfo`` instance created. + +It also provides two methods: + +- ``file_users(path)`` -> Iterator of ``EggInfo``. + + Returns all ``EggInfo`` which uses ``path``, by calling + ``EggInfo.uses(path)`` on all ``EggInfo`` instances. + +- ``owner(path)`` -> ``EggInfo`` instance or None + + If ``path`` is used by only one ``EggInfo`` instance, returns it. + Otherwise returns None. + +EggInfoDirectories class +------------------------- + +A new class called ``EggInfoDirectories`` is created. It's a collection of +``EggInfoDirectory`` instances. The constructor takes one optional +argument ``use_cache`` set to ``True`` by default. When ``True``, +``EggInfoDirectories`` will use a global cache to reduce the numbers of I/O +accesses and speed up the lookups. + +The cache is a global mapping containing ``EggInfoDirectory`` instances. +When an ``EggInfoDirectories`` object is created, it will use the cache to +add an entry for each path it visits, or reuse existing entries. The cache +usage can be disabled at any time with the `use_cache` attribute. + +The cache can also be emptied with the global ``purge_cache`` function. + +The class is iterable, and returns every ``EggInfo`` instance from every +``EggInfoDirectory`` instance it contains. + +``EggInfoDirectories`` also provides the following container and helper +methods: + +- ``append(path)`` + + Creates an ``EggInfoDirectory`` instance. for ``path`` appends it. + +- ``remove(egg_info_dir)`` + + Removes the ``EggInfoDirectory`` instance for the given ``path``. + +- ``clear()`` + + Removes all elements. + +- ``load(paths)`` + + Creates and adds ``EggInfoDirectory`` instances corresponding to ``paths``. + +- ``reload()`` + + Reloads existing entries. + +- ``get_egg_infos()`` -> Iterator of ``EggInfo`` instances. + + Iterates over all ``EggInfo`` contained in ``EggInfoDirectory`` instances. + +- ``get_egg_info(project_name)`` -> ``EggInfo`` or None. + + Returns an EggInfo instance for the given project name. + If not found, returns None. + +- ``get_file_users(path)`` -> Iterator of ``EggInfo`` instances. + + Iterates over all projects to find out which project uses the file. + Returns ``EggInfo`` instances. + .egg-info functions ------------------- The new functions added in the ``pkgutil`` are : -- ``get_egg_infos()`` -> iterator +- ``get_egg_infos(paths=sys.path)`` -> iterator Provides an iterator that looks for ``.egg-info`` directories in ``sys.path`` and returns ``EggInfo`` instances for each one of them. -- ``get_egg_info(project_name)`` -> path or None +- ``get_egg_info(project_name, paths=sys.path)`` -> path or None Scans all elements in ``sys.path`` and looks for all directories ending with ``.egg-info``. Returns an ``EggInfo`` corresponding to the ``.egg-info`` @@ -290,23 +370,14 @@ Notice that there should be at most one result. The first result founded will be returned. If the directory is not found, returns None. -- ``get_file_users(path)`` -> iterator of ``EggInfo`` instances. +- ``get_file_users(path, paths=sys.path)`` -> iterator of ``EggInfo`` instances. Iterates over all projects to find out which project uses ``path``. ``path`` can be a local absolute path or a relative '/'-separated path. -Cache functions ---------------- - -The functions from the previous section work with a global memory cache to -reduce the numbers of I/O accesses and speed up the lookups. - -The cache can be managed with these functions: - -- ``purge_cache``: removes all entries from cache. -- ``cache_enabled``: returns ``True`` if the cache is enabled. -- ``enable_cache``: enables the cache. -- ``disable_cache``: disables the cache. +All these functions use the same global instance of ``EggInfoDirectories`` to +use the cache. Notice that the cache is never emptied explicitely so it keeps +on growing everytime it is used with new paths. Example ------- @@ -337,8 +408,6 @@ >>> egg_info.uses('zlib/include/zlib.h') True - >>> egg_info.owns('zlib/include/zlib.h') - True >>> egg_info.get_file('zlib/include/zlib.h') From python-checkins at python.org Thu Jun 4 11:37:16 2009 From: python-checkins at python.org (georg.brandl) Date: Thu, 4 Jun 2009 11:37:16 +0200 (CEST) Subject: [Python-checkins] r73210 - in python/branches/py3k/Lib/email: base64mime.py quoprimime.py Message-ID: <20090604093716.58F90C2AC@mail.python.org> Author: georg.brandl Date: Thu Jun 4 11:37:16 2009 New Revision: 73210 Log: Remove nonexisting stuff from __all__. Modified: python/branches/py3k/Lib/email/base64mime.py python/branches/py3k/Lib/email/quoprimime.py Modified: python/branches/py3k/Lib/email/base64mime.py ============================================================================== --- python/branches/py3k/Lib/email/base64mime.py (original) +++ python/branches/py3k/Lib/email/base64mime.py Thu Jun 4 11:37:16 2009 @@ -29,8 +29,6 @@ 'body_encode', 'decode', 'decodestring', - 'encode', - 'encodestring', 'header_encode', 'header_length', ] Modified: python/branches/py3k/Lib/email/quoprimime.py ============================================================================== --- python/branches/py3k/Lib/email/quoprimime.py (original) +++ python/branches/py3k/Lib/email/quoprimime.py Thu Jun 4 11:37:16 2009 @@ -32,8 +32,6 @@ 'body_length', 'decode', 'decodestring', - 'encode', - 'encodestring', 'header_decode', 'header_encode', 'header_length', From buildbot at python.org Thu Jun 4 11:40:32 2009 From: buildbot at python.org (buildbot at python.org) Date: Thu, 04 Jun 2009 09:40:32 +0000 Subject: [Python-checkins] buildbot failure in amd64 gentoo trunk Message-ID: <20090604094032.31577DA35@mail.python.org> The Buildbot has detected a new failure of amd64 gentoo trunk. Full details are available at: http://www.python.org/dev/buildbot/all/amd64%20gentoo%20trunk/builds/119 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: norwitz-amd64 Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: georg.brandl BUILD FAILED: failed failed slave lost sincerely, -The Buildbot From python-checkins at python.org Thu Jun 4 11:42:55 2009 From: python-checkins at python.org (georg.brandl) Date: Thu, 4 Jun 2009 11:42:55 +0200 (CEST) Subject: [Python-checkins] r73211 - in python/branches/py3k/Lib: base64.py distutils/command/upload.py email/test/test_email.py http/server.py plistlib.py smtplib.py ssl.py test/test_gettext.py test/test_urllib2.py urllib/request.py Message-ID: <20090604094255.E383BD4F3@mail.python.org> Author: georg.brandl Date: Thu Jun 4 11:42:55 2009 New Revision: 73211 Log: More codestring -> codebytes. Modified: python/branches/py3k/Lib/base64.py python/branches/py3k/Lib/distutils/command/upload.py python/branches/py3k/Lib/email/test/test_email.py python/branches/py3k/Lib/http/server.py python/branches/py3k/Lib/plistlib.py python/branches/py3k/Lib/smtplib.py python/branches/py3k/Lib/ssl.py python/branches/py3k/Lib/test/test_gettext.py python/branches/py3k/Lib/test/test_urllib2.py python/branches/py3k/Lib/urllib/request.py Modified: python/branches/py3k/Lib/base64.py ============================================================================== --- python/branches/py3k/Lib/base64.py (original) +++ python/branches/py3k/Lib/base64.py Thu Jun 4 11:42:55 2009 @@ -391,9 +391,9 @@ def test(): s0 = b"Aladdin:open sesame" print(repr(s0)) - s1 = encodestring(s0) + s1 = encodebytes(s0) print(repr(s1)) - s2 = decodestring(s1) + s2 = decodebytes(s1) print(repr(s2)) assert s0 == s2 Modified: python/branches/py3k/Lib/distutils/command/upload.py ============================================================================== --- python/branches/py3k/Lib/distutils/command/upload.py (original) +++ python/branches/py3k/Lib/distutils/command/upload.py Thu Jun 4 11:42:55 2009 @@ -127,7 +127,7 @@ user_pass = (self.username + ":" + self.password).encode('ascii') # The exact encoding of the authentication string is debated. # Anyway PyPI only accepts ascii for both username or password. - auth = "Basic " + base64.encodestring(user_pass).strip().decode('ascii') + auth = "Basic " + base64.encodebytes(user_pass).strip().decode('ascii') # Build up the MIME payload for the POST data boundary = '--------------GHSKFJDLGDS7543FJKLFHRE75642756743254' Modified: python/branches/py3k/Lib/email/test/test_email.py ============================================================================== --- python/branches/py3k/Lib/email/test/test_email.py (original) +++ python/branches/py3k/Lib/email/test/test_email.py Thu Jun 4 11:42:55 2009 @@ -944,7 +944,7 @@ def test_encoding(self): payload = self._au.get_payload() - self.assertEqual(base64.decodestring(payload), self._audiodata) + self.assertEqual(base64.decodebytes(payload), self._audiodata) def test_checkSetMinor(self): au = MIMEAudio(self._audiodata, 'fish') @@ -984,7 +984,7 @@ def test_encoding(self): payload = self._im.get_payload() - self.assertEqual(base64.decodestring(payload), self._imgdata) + self.assertEqual(base64.decodebytes(payload), self._imgdata) def test_checkSetMinor(self): im = MIMEImage(self._imgdata, 'fish') Modified: python/branches/py3k/Lib/http/server.py ============================================================================== --- python/branches/py3k/Lib/http/server.py (original) +++ python/branches/py3k/Lib/http/server.py Thu Jun 4 11:42:55 2009 @@ -985,7 +985,7 @@ if authorization[0].lower() == "basic": try: authorization = authorization[1].encode('ascii') - authorization = base64.decodestring(authorization).\ + authorization = base64.decodebytes(authorization).\ decode('ascii') except (binascii.Error, UnicodeError): pass Modified: python/branches/py3k/Lib/plistlib.py ============================================================================== --- python/branches/py3k/Lib/plistlib.py (original) +++ python/branches/py3k/Lib/plistlib.py Thu Jun 4 11:42:55 2009 @@ -316,7 +316,7 @@ def _encodeBase64(s, maxlinelength=76): - # copied from base64.encodestring(), with added maxlinelength argument + # copied from base64.encodebytes(), with added maxlinelength argument maxbinsize = (maxlinelength//4)*3 pieces = [] for i in range(0, len(s), maxbinsize): @@ -335,7 +335,7 @@ @classmethod def fromBase64(cls, data): - # base64.decodestring just calls binascii.a2b_base64; + # base64.decodebytes just calls binascii.a2b_base64; # it seems overkill to use both base64 and binascii. return cls(binascii.a2b_base64(data)) Modified: python/branches/py3k/Lib/smtplib.py ============================================================================== --- python/branches/py3k/Lib/smtplib.py (original) +++ python/branches/py3k/Lib/smtplib.py Thu Jun 4 11:42:55 2009 @@ -540,7 +540,7 @@ """ def encode_cram_md5(challenge, user, password): - challenge = base64.decodestring(challenge) + challenge = base64.decodebytes(challenge) response = user + " " + hmac.HMAC(password.encode('ascii'), challenge).hexdigest() return encode_base64(response.encode('ascii'), eol='') Modified: python/branches/py3k/Lib/ssl.py ============================================================================== --- python/branches/py3k/Lib/ssl.py (original) +++ python/branches/py3k/Lib/ssl.py Thu Jun 4 11:42:55 2009 @@ -413,7 +413,7 @@ raise ValueError("Invalid PEM encoding; must end with %s" % PEM_FOOTER) d = pem_cert_string.strip()[len(PEM_HEADER):-len(PEM_FOOTER)] - return base64.decodestring(d.encode('ASCII', 'strict')) + return base64.decodebytes(d.encode('ASCII', 'strict')) def get_server_certificate(addr, ssl_version=PROTOCOL_SSLv3, ca_certs=None): """Retrieve the certificate from the server at the specified address, Modified: python/branches/py3k/Lib/test/test_gettext.py ============================================================================== --- python/branches/py3k/Lib/test/test_gettext.py (original) +++ python/branches/py3k/Lib/test/test_gettext.py Thu Jun 4 11:42:55 2009 @@ -65,13 +65,13 @@ if not os.path.isdir(LOCALEDIR): os.makedirs(LOCALEDIR) fp = open(MOFILE, 'wb') - fp.write(base64.decodestring(GNU_MO_DATA)) + fp.write(base64.decodebytes(GNU_MO_DATA)) fp.close() fp = open(UMOFILE, 'wb') - fp.write(base64.decodestring(UMO_DATA)) + fp.write(base64.decodebytes(UMO_DATA)) fp.close() fp = open(MMOFILE, 'wb') - fp.write(base64.decodestring(MMO_DATA)) + fp.write(base64.decodebytes(MMO_DATA)) fp.close() self.env = support.EnvironmentVarGuard() self.env['LANGUAGE'] = 'xx' Modified: python/branches/py3k/Lib/test/test_urllib2.py ============================================================================== --- python/branches/py3k/Lib/test/test_urllib2.py (original) +++ python/branches/py3k/Lib/test/test_urllib2.py Thu Jun 4 11:42:55 2009 @@ -1050,7 +1050,7 @@ self.assertFalse(http_handler.requests[0].has_header(auth_header)) userpass = bytes('%s:%s' % (user, password), "ascii") auth_hdr_value = ('Basic ' + - base64.encodestring(userpass).strip().decode()) + base64.encodebytes(userpass).strip().decode()) self.assertEqual(http_handler.requests[1].get_header(auth_header), auth_hdr_value) Modified: python/branches/py3k/Lib/urllib/request.py ============================================================================== --- python/branches/py3k/Lib/urllib/request.py (original) +++ python/branches/py3k/Lib/urllib/request.py Thu Jun 4 11:42:55 2009 @@ -1758,7 +1758,8 @@ msg.append('Content-type: %s' % type) if encoding == 'base64': import base64 - data = base64.decodestring(data) + # XXX is this encoding/decoding ok? + data = base64.decodebytes(data.encode('ascii')).decode('latin1') else: data = unquote(data) msg.append('Content-Length: %d' % len(data)) From python-checkins at python.org Thu Jun 4 12:10:41 2009 From: python-checkins at python.org (georg.brandl) Date: Thu, 4 Jun 2009 12:10:41 +0200 (CEST) Subject: [Python-checkins] r73212 - python/trunk/Lib/test/test_with.py Message-ID: <20090604101041.B0B9DDA06@mail.python.org> Author: georg.brandl Date: Thu Jun 4 12:10:41 2009 New Revision: 73212 Log: Better name for "Ctor". Modified: python/trunk/Lib/test/test_with.py Modified: python/trunk/Lib/test/test_with.py ============================================================================== --- python/trunk/Lib/test/test_with.py (original) +++ python/trunk/Lib/test/test_with.py Thu Jun 4 12:10:41 2009 @@ -675,7 +675,7 @@ if self.gobble: return True - class CtorRaises(object): + class InitRaises(object): def __init__(self): raise RuntimeError() class EnterRaises(object): @@ -695,7 +695,7 @@ def testExceptionInExprList(self): try: - with self.Dummy() as a, self.CtorRaises(): + with self.Dummy() as a, self.InitRaises(): pass except: pass From python-checkins at python.org Thu Jun 4 12:15:57 2009 From: python-checkins at python.org (georg.brandl) Date: Thu, 4 Jun 2009 12:15:57 +0200 (CEST) Subject: [Python-checkins] r73213 - python/trunk/Doc/c-api/list.rst Message-ID: <20090604101557.953A2C4DC@mail.python.org> Author: georg.brandl Date: Thu Jun 4 12:15:57 2009 New Revision: 73213 Log: #5967: note that the C slicing APIs do not support negative indices. Modified: python/trunk/Doc/c-api/list.rst Modified: python/trunk/Doc/c-api/list.rst ============================================================================== --- python/trunk/Doc/c-api/list.rst (original) +++ python/trunk/Doc/c-api/list.rst Thu Jun 4 12:15:57 2009 @@ -149,9 +149,10 @@ .. cfunction:: PyObject* PyList_GetSlice(PyObject *list, Py_ssize_t low, Py_ssize_t high) - Return a list of the objects in *list* containing the objects *between* - *low* and *high*. Return *NULL* and set an exception if unsuccessful. - Analogous to ``list[low:high]``. + Return a list of the objects in *list* containing the objects *between* *low* + and *high*. Return *NULL* and set an exception if unsuccessful. Analogous + to ``list[low:high]``. Negative indices, as when slicing from Python, are not + supported. .. versionchanged:: 2.5 This function used an :ctype:`int` for *low* and *high*. This might @@ -163,7 +164,8 @@ Set the slice of *list* between *low* and *high* to the contents of *itemlist*. Analogous to ``list[low:high] = itemlist``. The *itemlist* may be *NULL*, indicating the assignment of an empty list (slice deletion). - Return ``0`` on success, ``-1`` on failure. + Return ``0`` on success, ``-1`` on failure. Negative indices, as when + slicing from Python, are not supported. .. versionchanged:: 2.5 This function used an :ctype:`int` for *low* and *high*. This might From python-checkins at python.org Thu Jun 4 12:21:10 2009 From: python-checkins at python.org (georg.brandl) Date: Thu, 4 Jun 2009 12:21:10 +0200 (CEST) Subject: [Python-checkins] r73214 - in python/branches/py3k: Doc/whatsnew/2.6.rst Lib/test/test_with.py Lib/traceback.py Message-ID: <20090604102110.32D9BD79C@mail.python.org> Author: georg.brandl Date: Thu Jun 4 12:21:10 2009 New Revision: 73214 Log: Merged revisions 73186,73206,73212 via svnmerge from svn+ssh://pythondev at svn.python.org/python/trunk ........ r73186 | georg.brandl | 2009-06-03 23:21:09 +0200 (Mi, 03 Jun 2009) | 1 line #6174: fix indentation in code example. ........ r73206 | georg.brandl | 2009-06-04 11:15:12 +0200 (Do, 04 Jun 2009) | 1 line #3584: ignore trailing newlines when placing the caret for a SyntaxError location. ........ r73212 | georg.brandl | 2009-06-04 12:10:41 +0200 (Do, 04 Jun 2009) | 1 line Better name for "Ctor". ........ Modified: python/branches/py3k/ (props changed) python/branches/py3k/Doc/whatsnew/2.6.rst python/branches/py3k/Lib/test/test_with.py python/branches/py3k/Lib/traceback.py Modified: python/branches/py3k/Doc/whatsnew/2.6.rst ============================================================================== --- python/branches/py3k/Doc/whatsnew/2.6.rst (original) +++ python/branches/py3k/Doc/whatsnew/2.6.rst Thu Jun 4 12:21:10 2009 @@ -682,15 +682,15 @@ for N in range(1, 1000, 10): p.apply_async(factorial, (N, d)) - # Mark pool as closed -- no more tasks can be added. - p.close() + # Mark pool as closed -- no more tasks can be added. + p.close() - # Wait for tasks to exit - p.join() + # Wait for tasks to exit + p.join() - # Output results - for k, v in sorted(d.items()): - print k, v + # Output results + for k, v in sorted(d.items()): + print k, v This will produce the output:: Modified: python/branches/py3k/Lib/test/test_with.py ============================================================================== --- python/branches/py3k/Lib/test/test_with.py (original) +++ python/branches/py3k/Lib/test/test_with.py Thu Jun 4 12:21:10 2009 @@ -677,7 +677,7 @@ if self.gobble: return True - class CtorRaises(object): + class InitRaises(object): def __init__(self): raise RuntimeError() class EnterRaises(object): @@ -697,7 +697,7 @@ def testExceptionInExprList(self): try: - with self.Dummy() as a, self.CtorRaises(): + with self.Dummy() as a, self.InitRaises(): pass except: pass Modified: python/branches/py3k/Lib/traceback.py ============================================================================== --- python/branches/py3k/Lib/traceback.py (original) +++ python/branches/py3k/Lib/traceback.py Thu Jun 4 12:21:10 2009 @@ -225,7 +225,7 @@ if badline is not None: lines.append(' %s\n' % badline.strip()) if offset is not None: - caretspace = badline[:offset].lstrip() + caretspace = badline.rstrip('\n')[:offset].lstrip() # non-space whitespace (likes tabs) must be kept for alignment caretspace = ((c.isspace() and c or ' ') for c in caretspace) # only three spaces to account for offset1 == pos 0 From python-checkins at python.org Thu Jun 4 12:22:32 2009 From: python-checkins at python.org (georg.brandl) Date: Thu, 4 Jun 2009 12:22:32 +0200 (CEST) Subject: [Python-checkins] r73215 - python/trunk/Doc/library/fcntl.rst Message-ID: <20090604102232.01DF1D5FA@mail.python.org> Author: georg.brandl Date: Thu Jun 4 12:22:31 2009 New Revision: 73215 Log: #6176: fix man page section for flock(2). Modified: python/trunk/Doc/library/fcntl.rst Modified: python/trunk/Doc/library/fcntl.rst ============================================================================== --- python/trunk/Doc/library/fcntl.rst (original) +++ python/trunk/Doc/library/fcntl.rst Thu Jun 4 12:22:31 2009 @@ -96,7 +96,7 @@ Perform the lock operation *op* on file descriptor *fd* (file objects providing a :meth:`fileno` method are accepted as well). See the Unix manual - :manpage:`flock(3)` for details. (On some systems, this function is emulated + :manpage:`flock(2)` for details. (On some systems, this function is emulated using :cfunc:`fcntl`.) From python-checkins at python.org Thu Jun 4 12:23:20 2009 From: python-checkins at python.org (georg.brandl) Date: Thu, 4 Jun 2009 12:23:20 +0200 (CEST) Subject: [Python-checkins] r73216 - in python/branches/py3k: Doc/library/fcntl.rst Message-ID: <20090604102320.6F6C2D693@mail.python.org> Author: georg.brandl Date: Thu Jun 4 12:23:20 2009 New Revision: 73216 Log: Merged revisions 73215 via svnmerge from svn+ssh://pythondev at svn.python.org/python/trunk ........ r73215 | georg.brandl | 2009-06-04 12:22:31 +0200 (Do, 04 Jun 2009) | 1 line #6176: fix man page section for flock(2). ........ Modified: python/branches/py3k/ (props changed) python/branches/py3k/Doc/library/fcntl.rst Modified: python/branches/py3k/Doc/library/fcntl.rst ============================================================================== --- python/branches/py3k/Doc/library/fcntl.rst (original) +++ python/branches/py3k/Doc/library/fcntl.rst Thu Jun 4 12:23:20 2009 @@ -90,7 +90,7 @@ Perform the lock operation *op* on file descriptor *fd* (file objects providing a :meth:`fileno` method are accepted as well). See the Unix manual - :manpage:`flock(3)` for details. (On some systems, this function is emulated + :manpage:`flock(2)` for details. (On some systems, this function is emulated using :cfunc:`fcntl`.) From python-checkins at python.org Thu Jun 4 12:27:21 2009 From: python-checkins at python.org (georg.brandl) Date: Thu, 4 Jun 2009 12:27:21 +0200 (CEST) Subject: [Python-checkins] r73217 - python/trunk/Doc/library/socket.rst Message-ID: <20090604102721.455DED6C9@mail.python.org> Author: georg.brandl Date: Thu Jun 4 12:27:21 2009 New Revision: 73217 Log: #6175: document that inet_aton supports alternate input formats with less than three dots. Modified: python/trunk/Doc/library/socket.rst Modified: python/trunk/Doc/library/socket.rst ============================================================================== --- python/trunk/Doc/library/socket.rst (original) +++ python/trunk/Doc/library/socket.rst Thu Jun 4 12:27:21 2009 @@ -401,6 +401,9 @@ library and needs objects of type :ctype:`struct in_addr`, which is the C type for the 32-bit packed binary this function returns. + :func:`inet_aton` also accepts strings with less than three dots; see the + Unix manual page :manpage:`inet(3)` for details. + If the IPv4 address string passed to this function is invalid, :exc:`socket.error` will be raised. Note that exactly what is valid depends on the underlying C implementation of :cfunc:`inet_aton`. From python-checkins at python.org Thu Jun 4 12:28:36 2009 From: python-checkins at python.org (georg.brandl) Date: Thu, 4 Jun 2009 12:28:36 +0200 (CEST) Subject: [Python-checkins] r73218 - in python/branches/py3k: Doc/library/socket.rst Message-ID: <20090604102836.6E9B5D6C9@mail.python.org> Author: georg.brandl Date: Thu Jun 4 12:28:36 2009 New Revision: 73218 Log: Merged revisions 73217 via svnmerge from svn+ssh://pythondev at svn.python.org/python/trunk ........ r73217 | georg.brandl | 2009-06-04 12:27:21 +0200 (Do, 04 Jun 2009) | 1 line #6175: document that inet_aton supports alternate input formats with less than three dots. ........ Modified: python/branches/py3k/ (props changed) python/branches/py3k/Doc/library/socket.rst Modified: python/branches/py3k/Doc/library/socket.rst ============================================================================== --- python/branches/py3k/Doc/library/socket.rst (original) +++ python/branches/py3k/Doc/library/socket.rst Thu Jun 4 12:28:36 2009 @@ -381,6 +381,9 @@ library and needs objects of type :ctype:`struct in_addr`, which is the C type for the 32-bit packed binary this function returns. + :func:`inet_aton` also accepts strings with less than three dots; see the + Unix manual page :manpage:`inet(3)` for details. + If the IPv4 address string passed to this function is invalid, :exc:`socket.error` will be raised. Note that exactly what is valid depends on the underlying C implementation of :cfunc:`inet_aton`. From amauryfa at gmail.com Tue Jun 2 01:55:20 2009 From: amauryfa at gmail.com (Amaury Forgeot d'Arc) Date: Tue, 2 Jun 2009 01:55:20 +0200 Subject: [Python-checkins] r73119 - python/branches/release26-maint/Objects/frameobject.c In-Reply-To: <94bdd2610906011550q62988afs11d71ad9b1f52775@mail.gmail.com> References: <20090601221739.F186AD358@mail.python.org> <94bdd2610906011550q62988afs11d71ad9b1f52775@mail.gmail.com> Message-ID: 2009/6/2 Tarek Ziad? : > Looks like Python cannot compile anymore under debian with the changes > on frameobject.c : > > ... > gcc -pthread -c -fno-strict-aliasing -DNDEBUG -g -fwrapv -O3 -Wall > -Wstrict-prototypes ?-I. -IInclude -I./Include ? -DPy_BUILD_CORE -o > Objects/frameobject.o Objects/frameobject.c > Objects/frameobject.c: In function ?frame_setlineno?: > Objects/frameobject.c:151: error: invalid lvalue in unary ?&? > make: *** [Objects/frameobject.o] Erreur 1 Antoine already fixed it. Thanks! -- Amaury Forgeot d'Arc From eric at trueblade.com Tue Jun 2 23:03:55 2009 From: eric at trueblade.com (Eric Smith) Date: Tue, 02 Jun 2009 17:03:55 -0400 Subject: [Python-checkins] r73156 - peps/trunk/pep-0383.txt In-Reply-To: <20090602210050.69D69DBEB@mail.python.org> References: <20090602210050.69D69DBEB@mail.python.org> Message-ID: <4A2593BB.3080608@trueblade.com> > If the target > +system uses EBCDIC, such smuggled bytes may still a security risk, > +allowing to smuggle, e.g. square brackets or the backslash. This sentence should probably be "... may still present a security risk, ...". Eric. From buildbot at python.org Thu Jun 4 13:32:30 2009 From: buildbot at python.org (buildbot at python.org) Date: Thu, 04 Jun 2009 11:32:30 +0000 Subject: [Python-checkins] buildbot failure in amd64 gentoo 3.x Message-ID: <20090604113230.AE379D763@mail.python.org> The Buildbot has detected a new failure of amd64 gentoo 3.x. Full details are available at: http://www.python.org/dev/buildbot/all/amd64%20gentoo%203.x/builds/767 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: norwitz-amd64 Build Reason: Build Source Stamp: [branch branches/py3k] HEAD Blamelist: georg.brandl BUILD FAILED: failed test Excerpt from the test logfile: 2 tests failed: test_codecs test_io ====================================================================== ERROR: test_basics (test.test_codecs.BasicUnicodeTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/buildbot/slave/py-build/3.x.norwitz-amd64/build/Lib/test/test_codecs.py", line 1360, in test_basics encodedresult += encoder.encode(c) File "/home/buildbot/slave/py-build/3.x.norwitz-amd64/build/Lib/encodings/ascii.py", line 22, in encode return codecs.ascii_encode(input, self.errors)[0] AttributeError: 'NoneType' object has no attribute 'ascii_encode' ====================================================================== ERROR: test_decoder_state (test.test_codecs.BasicUnicodeTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/buildbot/slave/py-build/3.x.norwitz-amd64/build/Lib/test/test_codecs.py", line 1445, in test_decoder_state self.check_state_handling_decode(encoding, u, u.encode(encoding)) File "/home/buildbot/slave/py-build/3.x.norwitz-amd64/build/Lib/test/test_codecs.py", line 30, in check_state_handling_decode part1 = d.decode(s[:i]) File "/home/buildbot/slave/py-build/3.x.norwitz-amd64/build/Lib/encodings/ascii.py", line 26, in decode return codecs.ascii_decode(input, self.errors)[0] AttributeError: 'NoneType' object has no attribute 'ascii_decode' ====================================================================== ERROR: test_basic_io (test.test_io.CTextIOWrapperTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/buildbot/slave/py-build/3.x.norwitz-amd64/build/Lib/test/test_io.py", line 1753, in test_basic_io self.assertEquals(f.read(), "abc") File "/home/buildbot/slave/py-build/3.x.norwitz-amd64/build/Lib/encodings/ascii.py", line 26, in decode return codecs.ascii_decode(input, self.errors)[0] AttributeError: 'NoneType' object has no attribute 'ascii_decode' ====================================================================== ERROR: test_encoding_errors_reading (test.test_io.CTextIOWrapperTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/buildbot/slave/py-build/3.x.norwitz-amd64/build/Lib/test/test_io.py", line 1575, in test_encoding_errors_reading self.assertRaises(UnicodeError, t.read) File "/home/buildbot/slave/py-build/3.x.norwitz-amd64/build/Lib/unittest.py", line 589, in assertRaises callableObj(*args, **kwargs) File "/home/buildbot/slave/py-build/3.x.norwitz-amd64/build/Lib/encodings/ascii.py", line 26, in decode return codecs.ascii_decode(input, self.errors)[0] AttributeError: 'NoneType' object has no attribute 'ascii_decode' ====================================================================== ERROR: test_issue1395_1 (test.test_io.CTextIOWrapperTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/buildbot/slave/py-build/3.x.norwitz-amd64/build/Lib/test/test_io.py", line 1944, in test_issue1395_1 c = txt.read(1) File "/home/buildbot/slave/py-build/3.x.norwitz-amd64/build/Lib/encodings/ascii.py", line 26, in decode return codecs.ascii_decode(input, self.errors)[0] AttributeError: 'NoneType' object has no attribute 'ascii_decode' ====================================================================== ERROR: test_issue1395_2 (test.test_io.CTextIOWrapperTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/buildbot/slave/py-build/3.x.norwitz-amd64/build/Lib/test/test_io.py", line 1956, in test_issue1395_2 c = txt.read(4) File "/home/buildbot/slave/py-build/3.x.norwitz-amd64/build/Lib/encodings/ascii.py", line 26, in decode return codecs.ascii_decode(input, self.errors)[0] AttributeError: 'NoneType' object has no attribute 'ascii_decode' ====================================================================== ERROR: test_issue1395_3 (test.test_io.CTextIOWrapperTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/buildbot/slave/py-build/3.x.norwitz-amd64/build/Lib/test/test_io.py", line 1966, in test_issue1395_3 reads = txt.read(4) File "/home/buildbot/slave/py-build/3.x.norwitz-amd64/build/Lib/encodings/ascii.py", line 26, in decode return codecs.ascii_decode(input, self.errors)[0] AttributeError: 'NoneType' object has no attribute 'ascii_decode' ====================================================================== ERROR: test_issue1395_4 (test.test_io.CTextIOWrapperTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/buildbot/slave/py-build/3.x.norwitz-amd64/build/Lib/test/test_io.py", line 1977, in test_issue1395_4 reads = txt.read(4) File "/home/buildbot/slave/py-build/3.x.norwitz-amd64/build/Lib/encodings/ascii.py", line 26, in decode return codecs.ascii_decode(input, self.errors)[0] AttributeError: 'NoneType' object has no attribute 'ascii_decode' ====================================================================== ERROR: test_issue1395_5 (test.test_io.CTextIOWrapperTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/buildbot/slave/py-build/3.x.norwitz-amd64/build/Lib/test/test_io.py", line 1985, in test_issue1395_5 reads = txt.read(4) File "/home/buildbot/slave/py-build/3.x.norwitz-amd64/build/Lib/encodings/ascii.py", line 26, in decode return codecs.ascii_decode(input, self.errors)[0] AttributeError: 'NoneType' object has no attribute 'ascii_decode' ====================================================================== ERROR: test_newlines_input (test.test_io.CTextIOWrapperTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/buildbot/slave/py-build/3.x.norwitz-amd64/build/Lib/test/test_io.py", line 1667, in test_newlines_input self.assertEquals(txt.readlines(), expected) File "/home/buildbot/slave/py-build/3.x.norwitz-amd64/build/Lib/encodings/ascii.py", line 26, in decode return codecs.ascii_decode(input, self.errors)[0] AttributeError: 'NoneType' object has no attribute 'ascii_decode' ====================================================================== ERROR: test_basic_io (test.test_io.PyTextIOWrapperTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/buildbot/slave/py-build/3.x.norwitz-amd64/build/Lib/test/test_io.py", line 1748, in test_basic_io self.assertEquals(f.write("abc"), 3) File "/home/buildbot/slave/py-build/3.x.norwitz-amd64/build/Lib/_pyio.py", line 1534, in write b = encoder.encode(s) File "/home/buildbot/slave/py-build/3.x.norwitz-amd64/build/Lib/encodings/ascii.py", line 22, in encode return codecs.ascii_encode(input, self.errors)[0] AttributeError: 'NoneType' object has no attribute 'ascii_encode' ====================================================================== ERROR: test_destructor (test.test_io.PyTextIOWrapperTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/buildbot/slave/py-build/3.x.norwitz-amd64/build/Lib/test/test_io.py", line 1698, in test_destructor t.write("abc") File "/home/buildbot/slave/py-build/3.x.norwitz-amd64/build/Lib/_pyio.py", line 1534, in write b = encoder.encode(s) File "/home/buildbot/slave/py-build/3.x.norwitz-amd64/build/Lib/encodings/ascii.py", line 22, in encode return codecs.ascii_encode(input, self.errors)[0] AttributeError: 'NoneType' object has no attribute 'ascii_encode' ====================================================================== ERROR: test_detach (test.test_io.PyTextIOWrapperTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/buildbot/slave/py-build/3.x.norwitz-amd64/build/Lib/test/test_io.py", line 1531, in test_detach t.write("howdy") File "/home/buildbot/slave/py-build/3.x.norwitz-amd64/build/Lib/_pyio.py", line 1534, in write b = encoder.encode(s) File "/home/buildbot/slave/py-build/3.x.norwitz-amd64/build/Lib/encodings/ascii.py", line 22, in encode return codecs.ascii_encode(input, self.errors)[0] AttributeError: 'NoneType' object has no attribute 'ascii_encode' ====================================================================== ERROR: test_encoding_errors_reading (test.test_io.PyTextIOWrapperTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/buildbot/slave/py-build/3.x.norwitz-amd64/build/Lib/test/test_io.py", line 1575, in test_encoding_errors_reading self.assertRaises(UnicodeError, t.read) File "/home/buildbot/slave/py-build/3.x.norwitz-amd64/build/Lib/unittest.py", line 589, in assertRaises callableObj(*args, **kwargs) File "/home/buildbot/slave/py-build/3.x.norwitz-amd64/build/Lib/_pyio.py", line 1789, in read decoder.decode(self.buffer.read(), final=True)) File "/home/buildbot/slave/py-build/3.x.norwitz-amd64/build/Lib/_pyio.py", line 1311, in decode output = self.decoder.decode(input, final=final) File "/home/buildbot/slave/py-build/3.x.norwitz-amd64/build/Lib/encodings/ascii.py", line 26, in decode return codecs.ascii_decode(input, self.errors)[0] AttributeError: 'NoneType' object has no attribute 'ascii_decode' ====================================================================== ERROR: test_encoding_errors_writing (test.test_io.PyTextIOWrapperTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/buildbot/slave/py-build/3.x.norwitz-amd64/build/Lib/test/test_io.py", line 1593, in test_encoding_errors_writing self.assertRaises(UnicodeError, t.write, "\xff") File "/home/buildbot/slave/py-build/3.x.norwitz-amd64/build/Lib/unittest.py", line 589, in assertRaises callableObj(*args, **kwargs) File "/home/buildbot/slave/py-build/3.x.norwitz-amd64/build/Lib/_pyio.py", line 1534, in write b = encoder.encode(s) File "/home/buildbot/slave/py-build/3.x.norwitz-amd64/build/Lib/encodings/ascii.py", line 22, in encode return codecs.ascii_encode(input, self.errors)[0] AttributeError: 'NoneType' object has no attribute 'ascii_encode' ====================================================================== ERROR: test_issue1395_1 (test.test_io.PyTextIOWrapperTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/buildbot/slave/py-build/3.x.norwitz-amd64/build/Lib/test/test_io.py", line 1944, in test_issue1395_1 c = txt.read(1) File "/home/buildbot/slave/py-build/3.x.norwitz-amd64/build/Lib/_pyio.py", line 1798, in read eof = not self._read_chunk() File "/home/buildbot/slave/py-build/3.x.norwitz-amd64/build/Lib/_pyio.py", line 1605, in _read_chunk self._set_decoded_chars(self._decoder.decode(input_chunk, eof)) File "/home/buildbot/slave/py-build/3.x.norwitz-amd64/build/Lib/_pyio.py", line 1311, in decode output = self.decoder.decode(input, final=final) File "/home/buildbot/slave/py-build/3.x.norwitz-amd64/build/Lib/encodings/ascii.py", line 26, in decode return codecs.ascii_decode(input, self.errors)[0] AttributeError: 'NoneType' object has no attribute 'ascii_decode' ====================================================================== ERROR: test_issue1395_2 (test.test_io.PyTextIOWrapperTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/buildbot/slave/py-build/3.x.norwitz-amd64/build/Lib/test/test_io.py", line 1956, in test_issue1395_2 c = txt.read(4) File "/home/buildbot/slave/py-build/3.x.norwitz-amd64/build/Lib/_pyio.py", line 1798, in read eof = not self._read_chunk() File "/home/buildbot/slave/py-build/3.x.norwitz-amd64/build/Lib/_pyio.py", line 1605, in _read_chunk self._set_decoded_chars(self._decoder.decode(input_chunk, eof)) File "/home/buildbot/slave/py-build/3.x.norwitz-amd64/build/Lib/_pyio.py", line 1311, in decode output = self.decoder.decode(input, final=final) File "/home/buildbot/slave/py-build/3.x.norwitz-amd64/build/Lib/encodings/ascii.py", line 26, in decode return codecs.ascii_decode(input, self.errors)[0] AttributeError: 'NoneType' object has no attribute 'ascii_decode' ====================================================================== ERROR: test_issue1395_3 (test.test_io.PyTextIOWrapperTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/buildbot/slave/py-build/3.x.norwitz-amd64/build/Lib/test/test_io.py", line 1966, in test_issue1395_3 reads = txt.read(4) File "/home/buildbot/slave/py-build/3.x.norwitz-amd64/build/Lib/_pyio.py", line 1798, in read eof = not self._read_chunk() File "/home/buildbot/slave/py-build/3.x.norwitz-amd64/build/Lib/_pyio.py", line 1605, in _read_chunk self._set_decoded_chars(self._decoder.decode(input_chunk, eof)) File "/home/buildbot/slave/py-build/3.x.norwitz-amd64/build/Lib/_pyio.py", line 1311, in decode output = self.decoder.decode(input, final=final) File "/home/buildbot/slave/py-build/3.x.norwitz-amd64/build/Lib/encodings/ascii.py", line 26, in decode return codecs.ascii_decode(input, self.errors)[0] AttributeError: 'NoneType' object has no attribute 'ascii_decode' ====================================================================== ERROR: test_issue1395_4 (test.test_io.PyTextIOWrapperTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/buildbot/slave/py-build/3.x.norwitz-amd64/build/Lib/test/test_io.py", line 1977, in test_issue1395_4 reads = txt.read(4) File "/home/buildbot/slave/py-build/3.x.norwitz-amd64/build/Lib/_pyio.py", line 1798, in read eof = not self._read_chunk() File "/home/buildbot/slave/py-build/3.x.norwitz-amd64/build/Lib/_pyio.py", line 1605, in _read_chunk self._set_decoded_chars(self._decoder.decode(input_chunk, eof)) File "/home/buildbot/slave/py-build/3.x.norwitz-amd64/build/Lib/_pyio.py", line 1311, in decode output = self.decoder.decode(input, final=final) File "/home/buildbot/slave/py-build/3.x.norwitz-amd64/build/Lib/encodings/ascii.py", line 26, in decode return codecs.ascii_decode(input, self.errors)[0] AttributeError: 'NoneType' object has no attribute 'ascii_decode' ====================================================================== ERROR: test_issue1395_5 (test.test_io.PyTextIOWrapperTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/buildbot/slave/py-build/3.x.norwitz-amd64/build/Lib/test/test_io.py", line 1985, in test_issue1395_5 reads = txt.read(4) File "/home/buildbot/slave/py-build/3.x.norwitz-amd64/build/Lib/_pyio.py", line 1798, in read eof = not self._read_chunk() File "/home/buildbot/slave/py-build/3.x.norwitz-amd64/build/Lib/_pyio.py", line 1605, in _read_chunk self._set_decoded_chars(self._decoder.decode(input_chunk, eof)) File "/home/buildbot/slave/py-build/3.x.norwitz-amd64/build/Lib/_pyio.py", line 1311, in decode output = self.decoder.decode(input, final=final) File "/home/buildbot/slave/py-build/3.x.norwitz-amd64/build/Lib/encodings/ascii.py", line 26, in decode return codecs.ascii_decode(input, self.errors)[0] AttributeError: 'NoneType' object has no attribute 'ascii_decode' ====================================================================== ERROR: test_newlines_input (test.test_io.PyTextIOWrapperTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/buildbot/slave/py-build/3.x.norwitz-amd64/build/Lib/test/test_io.py", line 1667, in test_newlines_input self.assertEquals(txt.readlines(), expected) File "/home/buildbot/slave/py-build/3.x.norwitz-amd64/build/Lib/_pyio.py", line 493, in readlines return list(self) File "/home/buildbot/slave/py-build/3.x.norwitz-amd64/build/Lib/_pyio.py", line 1804, in __next__ line = self.readline() File "/home/buildbot/slave/py-build/3.x.norwitz-amd64/build/Lib/_pyio.py", line 1881, in readline while self._read_chunk(): File "/home/buildbot/slave/py-build/3.x.norwitz-amd64/build/Lib/_pyio.py", line 1605, in _read_chunk self._set_decoded_chars(self._decoder.decode(input_chunk, eof)) File "/home/buildbot/slave/py-build/3.x.norwitz-amd64/build/Lib/_pyio.py", line 1311, in decode output = self.decoder.decode(input, final=final) File "/home/buildbot/slave/py-build/3.x.norwitz-amd64/build/Lib/encodings/ascii.py", line 26, in decode return codecs.ascii_decode(input, self.errors)[0] AttributeError: 'NoneType' object has no attribute 'ascii_decode' ====================================================================== ERROR: test_newlines_output (test.test_io.PyTextIOWrapperTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/buildbot/slave/py-build/3.x.norwitz-amd64/build/Lib/test/test_io.py", line 1682, in test_newlines_output txt.write("AAA\nB") File "/home/buildbot/slave/py-build/3.x.norwitz-amd64/build/Lib/_pyio.py", line 1534, in write b = encoder.encode(s) File "/home/buildbot/slave/py-build/3.x.norwitz-amd64/build/Lib/encodings/ascii.py", line 22, in encode return codecs.ascii_encode(input, self.errors)[0] AttributeError: 'NoneType' object has no attribute 'ascii_encode' make: *** [buildbottest] Error 1 sincerely, -The Buildbot From python-checkins at python.org Thu Jun 4 14:42:19 2009 From: python-checkins at python.org (tarek.ziade) Date: Thu, 4 Jun 2009 14:42:19 +0200 (CEST) Subject: [Python-checkins] r73219 - peps/trunk/pep-0386.txt Message-ID: <20090604124219.E6347D8EA@mail.python.org> Author: tarek.ziade Date: Thu Jun 4 14:42:19 2009 New Revision: 73219 Log: fixed the format thanks to Doug Modified: peps/trunk/pep-0386.txt Modified: peps/trunk/pep-0386.txt ============================================================================== --- peps/trunk/pep-0386.txt (original) +++ peps/trunk/pep-0386.txt Thu Jun 4 14:42:19 2009 @@ -251,7 +251,7 @@ The pseudo-format supported is:: - N.N[.N]+[abc]N[.N]+[.(dev|post)N+|(devNpostN)] + N.N[.N]+[abc]N[.N]+[.(dev|post)N+|(devN+postN+)] Some examples probably make it clearer:: From postmaster at boxbe.com Thu Jun 4 15:36:12 2009 From: postmaster at boxbe.com (postmaster at boxbe.com) Date: Thu, 4 Jun 2009 06:36:12 -0700 (PDT) Subject: [Python-checkins] buildbot failure in amd64 gentoo trunk (Action Required) Message-ID: <363501105.36911.1244122572350.JavaMail.prod@app003.boxbe.com> Dear sender, This message serves as notification that you will not receive any more courtesy notices from our members for two days. Messages you have sent will remain in a lower priority queue for our member to review at their leisure. Future messages will be more likely to be viewed if you are on our member's priority Guest List. Thank you, ravindraee24 at gmail.com About Boxbe This courtesy notice is part of a free service to make email more reliable and useful. Boxbe (http://www.boxbe.com) uses your existing social network and that of your friends to keep your inbox clean and make sure you receive email from people who matter to you. Boxbe: Say Goodbye to Email Overload Visit http://www.boxbe.com/how-it-works?tc=124475936_1949439418 -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- An embedded message was scrubbed... From: buildbot at python.org Subject: [Python-checkins] buildbot failure in amd64 gentoo trunk Date: Thu, 04 Jun 2009 09:40:32 +0000 Size: 4279 URL: From python-checkins at python.org Thu Jun 4 17:12:14 2009 From: python-checkins at python.org (dirkjan.ochtman) Date: Thu, 4 Jun 2009 17:12:14 +0200 (CEST) Subject: [Python-checkins] r73220 - peps/trunk/pep-0385.txt Message-ID: <20090604151214.16D88C2C5@mail.python.org> Author: dirkjan.ochtman Date: Thu Jun 4 17:12:13 2009 New Revision: 73220 Log: Fix some wording, rewrite section on branching strategies. Modified: peps/trunk/pep-0385.txt Modified: peps/trunk/pep-0385.txt ============================================================================== --- peps/trunk/pep-0385.txt (original) +++ peps/trunk/pep-0385.txt Thu Jun 4 17:12:13 2009 @@ -20,7 +20,7 @@ infrastructure like the version control system for a large, distributed project like Python, this is a significant effort. This PEP is an attempt to describe the steps that must be taken for further discussion. It's -equivalent to `PEP 347`_, which discussed the migration to SVN. +somewhat similar to `PEP 347`_, which discussed the migration to SVN. To make the most of hg, I (Dirkjan) would like to make a high-fidelity conversion, such that (a) as much of the svn metadata as possible is @@ -53,13 +53,17 @@ often has somewhat unintuitive results for people (though this has been getting better in recent versions of Mercurial). -For Python, I think it would work well to have cloned branches and keep most -things separate. This is predicated on the assumption that most people work on -just one (or maybe two) branches at a time. Branches can be exposed separately, -though I would advocate merging old (and tagged!) branches into mainline so -that people can easily revert to older releases. At what age of a release this -should be done can be debated (a natural point might be when the branch gets -unsupported, e.g. 2.4 at the release of 2.6). +I'm still a bit on the fence about whether Python should adopt cloned +branches and named branches. Since it usually makes more sense to tag releases +on the maintenance branch, for example, mainline history would not contain +release tags if we used cloned branches. Also, Mercurial 1.2 and 1.3 have the +necessary tools to make named branches less painful (because they can be +properly closed and closed heads are no longer considered in relevant cases). + +A disadvantage might be that the used clones will be a good bit larger (since +they essentially contain all other branches as well). Perhaps it would be a +good idea to distinguish between feature branches (which would be done trough +a separate clone) and release branches (which would be named). Converting branches ------------------- @@ -133,7 +137,8 @@ Developers should access the repositories through ssh, similar to the current setup. Public keys can be used to grant people access to a shared hg@ account. A hgwebdir instance should also be set up for easy browsing and read-only -access. Some facility for sandboxes/incubator repositories could be discussed. +access. If we're using ssh, developers should trivially be able to start new +clones (for longer-term features that profit from a separate branch). Hooks ----- From python-checkins at python.org Thu Jun 4 17:33:30 2009 From: python-checkins at python.org (dirkjan.ochtman) Date: Thu, 4 Jun 2009 17:33:30 +0200 (CEST) Subject: [Python-checkins] r73221 - peps/trunk/pep-0385.txt Message-ID: <20090604153330.5EB3DC51E@mail.python.org> Author: dirkjan.ochtman Date: Thu Jun 4 17:33:30 2009 New Revision: 73221 Log: Clarify cloned branches description a bit. Modified: peps/trunk/pep-0385.txt Modified: peps/trunk/pep-0385.txt ============================================================================== --- peps/trunk/pep-0385.txt (original) +++ peps/trunk/pep-0385.txt Thu Jun 4 17:33:30 2009 @@ -46,7 +46,7 @@ --------------- Mercurial has two basic ways of using branches: cloned branches, where each -branch is kept in a separate directory, and named branches, where each revision +branch is kept in a separate repository, and named branches, where each revision keeps metadata to note on which branch it belongs. The former makes it easier to distinguish branches, at the expense of requiring more disk space on the client. The latter makes it a little easier to switch between branches, but From python-checkins at python.org Thu Jun 4 18:38:23 2009 From: python-checkins at python.org (dirkjan.ochtman) Date: Thu, 4 Jun 2009 18:38:23 +0200 (CEST) Subject: [Python-checkins] r73222 - peps/trunk/pep-0385.txt Message-ID: <20090604163823.96D15D536@mail.python.org> Author: dirkjan.ochtman Date: Thu Jun 4 18:38:23 2009 New Revision: 73222 Log: PEP 385: add a note about client-side whitespace hooks (thanks georg.brandl). Modified: peps/trunk/pep-0385.txt Modified: peps/trunk/pep-0385.txt ============================================================================== --- peps/trunk/pep-0385.txt (original) +++ peps/trunk/pep-0385.txt Thu Jun 4 18:38:23 2009 @@ -148,8 +148,11 @@ * check whitespace: a hook to reject commits in case the whitespace doesn't match the rules for the Python codebase. Should be straightforward to - re-implement from the current version. Open issue: do we check only the tip - after each push, or do we check every commit in a changegroup? + re-implement from the current version. We can also offer a whitespace hook + for use with client-side repositories that people can use; it could either + warn about whitespace issues and/or truncate trailing whitespace from changed + lines. Open issue: do we check only the tip after each push, or do we check + every commit in a changegroup? * commit mails: we can leverage the notify extension for this From python-checkins at python.org Thu Jun 4 19:39:41 2009 From: python-checkins at python.org (raymond.hettinger) Date: Thu, 4 Jun 2009 19:39:41 +0200 (CEST) Subject: [Python-checkins] r73223 - python/branches/py3k/Doc/whatsnew/3.1.rst Message-ID: <20090604173941.A1AF7D932@mail.python.org> Author: raymond.hettinger Date: Thu Jun 4 19:39:41 2009 New Revision: 73223 Log: Take ipaddr out of whatsnew. Modified: python/branches/py3k/Doc/whatsnew/3.1.rst Modified: python/branches/py3k/Doc/whatsnew/3.1.rst ============================================================================== --- python/branches/py3k/Doc/whatsnew/3.1.rst (original) +++ python/branches/py3k/Doc/whatsnew/3.1.rst Thu Jun 4 19:39:41 2009 @@ -372,43 +372,6 @@ (Contributed by Ross Light; :issue:`4285`.) -* A new module, :mod:`ipaddr` has been added to the standard library. - It provides classes to represent, verify and manipulate IPv4 and IPv6 - host and network addresses. - - The :func:`ipaddr.IP` factory function creates an address object from - a string or integer representing the IP or the IP and prefix/netmask. - The objects provide a number of attributes for direct access to - components of the full address:: - - >>> addr = IP('2001:658:22A:CAFE:200::1/64') - >>> for attr in ['ip', 'ip_ext', 'ip_ext_full', 'network', 'network_ext', - ... 'hostmask', 'hostmask_ext', 'broadcast', 'broadcast_ext', - ... 'netmask', 'netmask_ext', 'prefixlen']: - ... print(attr, '=', getattr(addr, attr)) - ... - ip = 42540616829182469433547762482097946625 - ip_ext = 2001:658:22a:cafe:200::1 - ip_ext_full = 2001:0658:022a:cafe:0200:0000:0000:0001 - network = 42540616829182469433403647294022090752 - network_ext = 2001:658:22a:cafe:: - hostmask = 18446744073709551615 - hostmask_ext = ::ffff:ffff:ffff:ffff - broadcast = 42540616829182469451850391367731642367 - broadcast_ext = 2001:658:22a:cafe:ffff:ffff:ffff:ffff - netmask = 340282366920938463444927863358058659840 - netmask_ext = 64 - prefixlen = 64 - - Each address object supports a number of simple properties including: - ``is_private``, ``is_multicast``, ``is_loopback``, and ``is_link_local``. - - Additionally, the address objects provide a sort order for IP addresses, - support for address ranges (stored as lists of addresses), and subnet - computations. - - (Contributed by Google, :issue:`3959`.) - * The :mod:`nntplib` and :mod:`imaplib` modules now support IPv6. (Contributed by Derek Morr; :issue:`1655` and :issue:`1664`.) From python-checkins at python.org Thu Jun 4 19:58:15 2009 From: python-checkins at python.org (eric.smith) Date: Thu, 4 Jun 2009 19:58:15 +0200 (CEST) Subject: [Python-checkins] r73224 - python/trunk/Doc/library/logging.rst Message-ID: <20090604175815.D8A76D9E7@mail.python.org> Author: eric.smith Date: Thu Jun 4 19:58:15 2009 New Revision: 73224 Log: Minor documentation fixes for logging. Modified: python/trunk/Doc/library/logging.rst Modified: python/trunk/Doc/library/logging.rst ============================================================================== --- python/trunk/Doc/library/logging.rst (original) +++ python/trunk/Doc/library/logging.rst Thu Jun 4 19:58:15 2009 @@ -69,7 +69,7 @@ DEBUG:root:This message should go to the log file If you run the script repeatedly, the additional log messages are appended to -the file. To create a new file each time, you can pass a filemode argument to +the file. To create a new file each time, you can pass a *filemode* argument to :func:`basicConfig` with a value of ``'w'``. Rather than managing the file size yourself, though, it is simpler to use a :class:`RotatingFileHandler`:: @@ -112,7 +112,7 @@ The most current file is always :file:`/tmp/logging_rotatingfile_example.out`, and each time it reaches the size limit it is renamed with the suffix ``.1``. Each of the existing backup files is renamed to increment the suffix -(``.1`` becomes ``.2``, etc.) and the ``.5`` file is erased. +(``.1`` becomes ``.2``, etc.) and the ``.6`` file is erased. Obviously this example sets the log length much much too small as an extreme example. You would want to set *maxBytes* to an appropriate value. From python-checkins at python.org Thu Jun 4 20:11:45 2009 From: python-checkins at python.org (brett.cannon) Date: Thu, 4 Jun 2009 20:11:45 +0200 (CEST) Subject: [Python-checkins] r73225 - peps/trunk/pep-0385.txt Message-ID: <20090604181145.EE29BD5B4@mail.python.org> Author: brett.cannon Date: Thu Jun 4 20:11:38 2009 New Revision: 73225 Log: Set svn property metadata. Modified: peps/trunk/pep-0385.txt (contents, props changed) Modified: peps/trunk/pep-0385.txt ============================================================================== --- peps/trunk/pep-0385.txt (original) +++ peps/trunk/pep-0385.txt Thu Jun 4 20:11:38 2009 @@ -1,7 +1,7 @@ PEP: 385 Title: Migrating from svn to Mercurial -Version: $Revision: 72563 $ -Last-Modified: $Date: 2009-05-11 14:50:03 +0200 (Mon, 11 May 2009) $ +Version: $Revision$ +Last-Modified: $Date$ Author: Dirkjan Ochtman Status: Active Type: Process From python-checkins at python.org Thu Jun 4 20:14:01 2009 From: python-checkins at python.org (benjamin.peterson) Date: Thu, 4 Jun 2009 20:14:01 +0200 (CEST) Subject: [Python-checkins] r73226 - peps/trunk/pep-0374.txt Message-ID: <20090604181401.CD9DDD5B4@mail.python.org> Author: benjamin.peterson Date: Thu Jun 4 20:14:01 2009 New Revision: 73226 Log: four apparently Modified: peps/trunk/pep-0374.txt Modified: peps/trunk/pep-0374.txt ============================================================================== --- peps/trunk/pep-0374.txt (original) +++ peps/trunk/pep-0374.txt Thu Jun 4 20:14:01 2009 @@ -104,7 +104,7 @@ `_ was made to go with Mercurial. -The choice to go with Mercurial was made for three important reasons: +The choice to go with Mercurial was made for four important reasons: * According to a small survey, Python developers are more interested in using Mercurial than in Bazaar or Git. From python-checkins at python.org Thu Jun 4 20:15:48 2009 From: python-checkins at python.org (eric.smith) Date: Thu, 4 Jun 2009 20:15:48 +0200 (CEST) Subject: [Python-checkins] r73227 - in python/branches/release26-maint: Doc/library/logging.rst Message-ID: <20090604181548.E413BD5BA@mail.python.org> Author: eric.smith Date: Thu Jun 4 20:15:48 2009 New Revision: 73227 Log: Merged revisions 73224 via svnmerge from svn+ssh://pythondev at svn.python.org/python/trunk ........ r73224 | eric.smith | 2009-06-04 13:58:15 -0400 (Thu, 04 Jun 2009) | 1 line Minor documentation fixes for logging. ........ Modified: python/branches/release26-maint/ (props changed) python/branches/release26-maint/Doc/library/logging.rst Modified: python/branches/release26-maint/Doc/library/logging.rst ============================================================================== --- python/branches/release26-maint/Doc/library/logging.rst (original) +++ python/branches/release26-maint/Doc/library/logging.rst Thu Jun 4 20:15:48 2009 @@ -69,7 +69,7 @@ DEBUG:root:This message should go to the log file If you run the script repeatedly, the additional log messages are appended to -the file. To create a new file each time, you can pass a filemode argument to +the file. To create a new file each time, you can pass a *filemode* argument to :func:`basicConfig` with a value of ``'w'``. Rather than managing the file size yourself, though, it is simpler to use a :class:`RotatingFileHandler`:: @@ -112,7 +112,7 @@ The most current file is always :file:`/tmp/logging_rotatingfile_example.out`, and each time it reaches the size limit it is renamed with the suffix ``.1``. Each of the existing backup files is renamed to increment the suffix -(``.1`` becomes ``.2``, etc.) and the ``.5`` file is erased. +(``.1`` becomes ``.2``, etc.) and the ``.6`` file is erased. Obviously this example sets the log length much much too small as an extreme example. You would want to set *maxBytes* to an appropriate value. From python-checkins at python.org Thu Jun 4 20:20:51 2009 From: python-checkins at python.org (eric.smith) Date: Thu, 4 Jun 2009 20:20:51 +0200 (CEST) Subject: [Python-checkins] r73228 - in python/branches/py3k: Doc/library/logging.rst Message-ID: <20090604182051.971C0D555@mail.python.org> Author: eric.smith Date: Thu Jun 4 20:20:51 2009 New Revision: 73228 Log: Merged revisions 73224 via svnmerge from svn+ssh://pythondev at svn.python.org/python/trunk ........ r73224 | eric.smith | 2009-06-04 13:58:15 -0400 (Thu, 04 Jun 2009) | 1 line Minor documentation fixes for logging. ........ Modified: python/branches/py3k/ (props changed) python/branches/py3k/Doc/library/logging.rst Modified: python/branches/py3k/Doc/library/logging.rst ============================================================================== --- python/branches/py3k/Doc/library/logging.rst (original) +++ python/branches/py3k/Doc/library/logging.rst Thu Jun 4 20:20:51 2009 @@ -67,7 +67,7 @@ DEBUG:root:This message should go to the log file If you run the script repeatedly, the additional log messages are appended to -the file. To create a new file each time, you can pass a filemode argument to +the file. To create a new file each time, you can pass a *filemode* argument to :func:`basicConfig` with a value of ``'w'``. Rather than managing the file size yourself, though, it is simpler to use a :class:`RotatingFileHandler`:: @@ -110,7 +110,7 @@ The most current file is always :file:`/tmp/logging_rotatingfile_example.out`, and each time it reaches the size limit it is renamed with the suffix ``.1``. Each of the existing backup files is renamed to increment the suffix -(``.1`` becomes ``.2``, etc.) and the ``.5`` file is erased. +(``.1`` becomes ``.2``, etc.) and the ``.6`` file is erased. Obviously this example sets the log length much much too small as an extreme example. You would want to set *maxBytes* to an appropriate value. From python-checkins at python.org Thu Jun 4 20:30:12 2009 From: python-checkins at python.org (eric.smith) Date: Thu, 4 Jun 2009 20:30:12 +0200 (CEST) Subject: [Python-checkins] r73229 - in python/branches/release30-maint: Doc/library/logging.rst Message-ID: <20090604183012.79CB9D4FC@mail.python.org> Author: eric.smith Date: Thu Jun 4 20:30:12 2009 New Revision: 73229 Log: Merged revisions 73228 via svnmerge from svn+ssh://pythondev at svn.python.org/python/branches/py3k ................ r73228 | eric.smith | 2009-06-04 14:20:51 -0400 (Thu, 04 Jun 2009) | 9 lines Merged revisions 73224 via svnmerge from svn+ssh://pythondev at svn.python.org/python/trunk ........ r73224 | eric.smith | 2009-06-04 13:58:15 -0400 (Thu, 04 Jun 2009) | 1 line Minor documentation fixes for logging. ........ ................ Modified: python/branches/release30-maint/ (props changed) python/branches/release30-maint/Doc/library/logging.rst Modified: python/branches/release30-maint/Doc/library/logging.rst ============================================================================== --- python/branches/release30-maint/Doc/library/logging.rst (original) +++ python/branches/release30-maint/Doc/library/logging.rst Thu Jun 4 20:30:12 2009 @@ -67,7 +67,7 @@ DEBUG:root:This message should go to the log file If you run the script repeatedly, the additional log messages are appended to -the file. To create a new file each time, you can pass a filemode argument to +the file. To create a new file each time, you can pass a *filemode* argument to :func:`basicConfig` with a value of ``'w'``. Rather than managing the file size yourself, though, it is simpler to use a :class:`RotatingFileHandler`:: @@ -110,7 +110,7 @@ The most current file is always :file:`/tmp/logging_rotatingfile_example.out`, and each time it reaches the size limit it is renamed with the suffix ``.1``. Each of the existing backup files is renamed to increment the suffix -(``.1`` becomes ``.2``, etc.) and the ``.5`` file is erased. +(``.1`` becomes ``.2``, etc.) and the ``.6`` file is erased. Obviously this example sets the log length much much too small as an extreme example. You would want to set *maxBytes* to an appropriate value. From python-checkins at python.org Thu Jun 4 20:32:39 2009 From: python-checkins at python.org (raymond.hettinger) Date: Thu, 4 Jun 2009 20:32:39 +0200 (CEST) Subject: [Python-checkins] r73230 - in python/branches/py3k: Doc/library/internet.rst Doc/library/ipaddr.rst Lib/ipaddr.py Lib/test/test_ipaddr.py Misc/NEWS Message-ID: <20090604183239.AEBCAC52C@mail.python.org> Author: raymond.hettinger Date: Thu Jun 4 20:32:39 2009 New Revision: 73230 Log: Remove the ipaddr module per discussion on python-dev. Removed: python/branches/py3k/Doc/library/ipaddr.rst python/branches/py3k/Lib/ipaddr.py python/branches/py3k/Lib/test/test_ipaddr.py Modified: python/branches/py3k/Doc/library/internet.rst python/branches/py3k/Misc/NEWS Modified: python/branches/py3k/Doc/library/internet.rst ============================================================================== --- python/branches/py3k/Doc/library/internet.rst (original) +++ python/branches/py3k/Doc/library/internet.rst Thu Jun 4 20:32:39 2009 @@ -36,7 +36,6 @@ smtpd.rst telnetlib.rst uuid.rst - ipaddr.rst socketserver.rst http.server.rst http.cookies.rst Deleted: python/branches/py3k/Doc/library/ipaddr.rst ============================================================================== --- python/branches/py3k/Doc/library/ipaddr.rst Thu Jun 4 20:32:39 2009 +++ (empty file) @@ -1,428 +0,0 @@ -:mod:`ipaddr` --- IP address manipulation library -================================================= - -.. module:: ipaddr - :synopsis: IPv4 and IPv6 network address manipulation classes. -.. moduleauthor:: Google, Inc. -.. sectionauthor:: Gregory P. Smith - - -.. versionadded:: 3.1 - -.. index:: - single: IP address, IPv4, IPv6, netmask - -This module implements classes for working with IP host and network addresses, -both IPv4 and IPv6. - - -.. _ipaddr_examples: - -Examples --------- - -Netmask. - - >>> ipaddr.IP('1.1.1.1/255.255.255.0') - IPv4('1.1.1.1/24') - >>> ipaddr.IP('1080::200C:417B/96') - IPv6('1080::200c:417b/96') - -Hostmask. - - >>> ipaddr.IPv4('1.1.1.1/0.0.0.255') - IPv4('1.1.1.1/24') - -Prefix length. - - >>> addr = ipaddr.IPv4('1.1.1.1/24') - >>> addr.prefixlen - 24 - -Individual addresses. - - >>> ipaddr.IP('1.1.1.1') - IPv4('1.1.1.1/32') - -Many standard Python operations are also supported. - -Comparison. - - >>> ipaddr.IPv4('1.1.1.1') == ipaddr.IPv4('1.1.1.2') - False - >>> ipaddr.IPv4('1.1.1.1') < ipaddr.IPv4('1.1.1.2') - True - -Inclusion. - - >>> ipaddr.IPv4('1.1.1.1') in ipaddr.IPv4("1.0.0.0/8") - True - -Sorting. - - >>> a = ipaddr.IPv4('1.1.1.10') - >>> b = ipaddr.IPv4('1.10.1.10') - >>> c = ipaddr.IPv4('1.1.10.10') - >>> d = ipaddr.IPv4('1.1.1.1') - >>> sorted([a, b, c, d]) - [IPv4('1.1.1.1/32'), IPv4('1.1.1.10/32'), IPv4('1.1.10.10/32'), IPv4('1.10.1.10/32')] - -Conversion to string and integer forms. - - >>> spam = ipaddr.IPv4('192.168.1.254')) - >>> str(spam) - '192.168.1.254/32' - >>> spam.ip_ext - '192.168.1.254' - >>> int(spam) - 3232236030 - >>> eggs = ipaddr.IPv6('ffff::1/120') - >>> int(eggs) - 340277174624079928635746076935438991361 - -Additionally, there are quite a few network-specific features available to -ipaddr. - - >>> ipaddr.IPv4('10.0.0.0/8').supernet() - IPv4('10.0.0.0/7') - >>> ipaddr.IPv4('10.0.0.0/8').subnet() - [IPv4('10.0.0.0/9'), IPv4('10.128.0.0/9')] - # This returns networks with a prefix length of /10 - >>> ipaddr.IPv4('10.0.0.0/8').subnet(prefixlen_diff=2) - [IPv4('10.0.0.0/10'), IPv4('10.64.0.0/10'), IPv4('10.128.0.0/10'), IPv4('10.192.0.0/10')] - # Remove an address from a superblock. - >>> ipaddr.IP('10.0.0.0/24').address_exclude(ipaddr.IP('10.0.0.0/28')) - [IPv4('10.0.0.16/28'), IPv4('10.0.0.32/27'), IPv4('10.0.0.64/26'), IPv4('10.0.0.128/25')] - - -.. _ipaddr_funcs_and_classes: - -Functions And Classes ---------------------- - -.. function:: IP(ipaddr) - - Take an IP string or int and return an object of the correct type. Returns - an :class:`IPv4` or :class:`IPv6` object. - - The *ipaddr* parameter must be a string, bytes or integer representing the - IP address in ascii, network byte order or as a number respectively. Either - IPv4 or IPv6 addresses may be supplied. Integers less than 2**32 will be - considered to be IPv4. - - Raises :exc:`ValueError` if the *ipaddr* passed is not either an IPv4 or an - IPv6 address. - - -.. function:: collapse_address_list(addresses) - - Collapse a sequence of :class:`IPv4` or :class:`IPv6` objects into the most - concise representation. Returns a list of :class:`IPv4` or :class:`IPv6` - objects. - - Example usage:: - - >>> collapse_address_list([IPv4('1.1.0.0/24'), IPv4('1.1.1.0/24')]) - [IPv4('1.1.0.0/23')] - - -.. class:: BaseIP() - - A generic IP address object. This base class defines the API and contains - common code. Most authors should either use the :func:`IP` function or - create :class:`IPv4` or :class:`IPv6` objects directly rather than using this - base class. - - IP address objects support the following python operators: - ``=``, ``!=``, ``<``, ``>``, ``<=``, ``>=``, and ``in``. - - An IP address object may be used as a sequence index or as a hash key and can - be converted back to an integer representation using :func:`int`. It may - also be used as a sequence that yields the string representation of every IP - address within the object's subnet. - - The following properties are available on all IP address objects: - - .. attribute:: broadcast - - Integer representation of the broadcast address. Read only. - - .. attribute:: broadcast_ext - - Dotted decimal or colon string version of the broadcast address. Read - only. - - .. attribute:: hostmask - - Integer representation of the hostmask. Read only. - - .. attribute:: hostmask_ext - - Dotted decimal or colon string version of the hostmask. Read only. - - .. attribute:: ip - - Integer representation of the IP address. Read only. - - .. attribute:: ip_ext - - Dotted decimal or colon string version of the IP address. Read only. - - .. attribute:: ip_ext_full - - Canonical string version of the IP address. Read only. - - .. attribute:: is_loopback - - True if the address is a loopback address as defined in IPv4 :rfc:`3330` - or IPv6 :rfc:`2373` section 2.5.3. - - .. attribute:: is_link_local - - True if the address is a link-local address as defined in IPv4 :rfc:`3927` - or IPv6 :rfc:`4291`. - - .. attribute:: is_multicast - - True if the address is reserved for multicast use. See IPv4 :rfc:`3171` - or IPv6 :rfc:`2373` section 2.7 for details. - - .. attribute:: is_private - - True if the address is reserved for private networks as defined in IPv4 - :rfc:`1918` or IPv6 :rfc:`4193`. - - .. attribute:: netmask - - Integer representation of the netmask. Read only. - - .. attribute:: netmask_ext - - Dotted decimal or colon string version of the netmask. Read only. - - .. attribute:: network - - Integer representation of the network. Read only. - - .. attribute:: network_ext - - Dotted decimal or colon string version of the network. Read only. - - .. attribute:: numhosts - - Number of hosts in the current subnet. Read only. - - .. attribute:: packed - - The packed network byte order representation of this network address. - Read only. - - .. attribute:: prefixlen - - A property to get and set the prefix length. Readable and writeable. - - .. attribute:: version - - Integer IP version number. Read only. - - - The following methods are available on all IP address objects: - - .. method:: address_exclude(other) - - Remove an address from within a larger block. Returns a sorted list of IP - address objects representing networks. - - Examples:: - - >>> addr1 = IP('10.1.1.0/24') - >>> addr2 = IP('10.1.1.0/26') - >>> addr1.address_exclude(addr2) - [IP('10.1.1.64/26'), IP('10.1.1.128/25')] - - >>> addr1 = IP('::1/32') - >>> addr2 = IP('::1/128') - >>> addr1.address_exclude(addr2) - [IP('::0/128'), IP('::2/127'), IP('::4/126'), IP('::8/125'), IP('0:0:8000::/33')] - - Raises :exc:`ValueError` if *other* is not completely contained by *self*. - - - .. method:: compare_networks(other) - - Compare this IP object's network to another IP network. - Returns -1, 0 or 1. - - This compares the integer representation of the network addresses. The - host bits are not considered by this method. If you want to compare host - bits, you can use ``host_a.ip < host_b.ip``. - - If the IP versions of self and other are the same, returns: - - -1 if self < other - eg: IPv4('1.1.1.0/24') < IPv4('1.1.2.0/24') - - IPv6('1080::200C:417A') < IPv6('1080::200B:417B') - - 0 if self == other - eg: IPv4('1.1.1.1/24') == IPv4('1.1.1.2/24') - - IPv6('1080::200C:417A/96') == IPv6('1080::200C:417B/96') - - 1 if self > other - eg: IPv4('1.1.1.0/24') > IPv4('1.1.0.0/24') - - IPv6('1080::1:200C:417A/112') > IPv6('1080::0:200C:417A/112') - - If the IP versions of self and other are different, returns: - - -1 if self.version < other.version - eg: IPv4('10.0.0.1/24') < IPv6('::1/128') - - 1 if self.version > other.version - eg: IPv6('::1/128') > IPv4('255.255.255.0/24') - - .. note:: - - To sort networks with :func:`sorted`, :func:`min`, :func:`max` and - other tools with a *key* argument, use the :func:`operator.attrgetter` - function to extract the relevant fields:: - - >>> from operator import attrgetter - >>> s = [IPv6('::1/128'), IPv4('255.255.255.0/24')] - >>> sorted(s, key=attrgetter('version', 'network', 'netmask')) - [IPv4('255.255.255.0/24'), IPv6('::1/128')] - - .. method:: subnet(prefixlen_diff=1) - - Returns a list of subnets which when joined make up the current subnet. - - The optional *prefixlen_diff* argument specifies how many bits the prefix - length should be increased by. Given a /24 network and - ``prefixlen_diff=3``, for example, 8 subnets of size /27 will be returned. - - If called on a host IP address rather than a network, a list containing - the host itself will be returned. - - Raises :exc:`PrefixlenDiffInvalidError` if the *prefixlen_diff* is out of - range. - - - .. method:: supernet(prefixlen_diff=1) - - Returns a single IP object representing the supernet containing the - current network. - - The optional *prefixlen_diff* argument specifies how many bits the prefix - length should be decreased by. Given a /24 network and - ``prefixlen_diff=3``, for example, a supernet with a 21 bit netmask is - returned. - - Raises :exc:`PrefixlenDiffInvalidError` if the prefixlen_diff is out of - range. - - -.. class:: IPv4() - - This class represents and manipulates 32-bit IPv4 addresses. - - Attributes:: - - # These examples for IPv4('1.2.3.4/27') - .ip: 16909060 - .ip_ext: '1.2.3.4' - .ip_ext_full: '1.2.3.4' - .network: 16909056 - .network_ext: '1.2.3.0' - .hostmask: 31 (0x1F) - .hostmask_ext: '0.0.0.31' - .broadcast: 16909087 (0x102031F) - .broadcast_ext: '1.2.3.31' - .netmask: 4294967040 (0xFFFFFFE0) - .netmask_ext: '255.255.255.224' - .prefixlen: 27 - - -.. class:: IPv6() - - This class respresents and manipulates 128-bit IPv6 addresses. - - Attributes:: - - # These examples are for IPv6('2001:658:22A:CAFE:200::1/64') - .ip: 42540616829182469433547762482097946625 - .ip_ext: '2001:658:22a:cafe:200::1' - .ip_ext_full: '2001:0658:022a:cafe:0200:0000:0000:0001' - .network: 42540616829182469433403647294022090752 - .network_ext: '2001:658:22a:cafe::' - .hostmask: 18446744073709551615 - .hostmask_ext: '::ffff:ffff:ffff:ffff' - .broadcast: 42540616829182469451850391367731642367 - .broadcast_ext: '2001:658:22a:cafe:ffff:ffff:ffff:ffff' - .netmask: 340282366920938463444927863358058659840 - .netmask_ext: 64 - .prefixlen: 64 - - .. attribute:: is_site_local - - True if the address was reserved as site-local in :rfc:`3513` section - 2.5.6. - - .. note:: - - The IPv6 site-local address space has been deprecated by :rfc:`3879`. - Use :data:`is_private` to test if this address is in the space of - unique local addresses as defined by :rfc:`4193`. - - .. attribute:: is_unspecified - - True if this is the unspecified address as defined in :rfc:`2373` section - 2.5.2. - - -.. _ipaddr_exceptions: - -Exceptions ----------- - -The following exceptions are defined by this module: - -.. exception:: Error - - Base class for all exceptions defined in this module. - -.. exception:: IPTypeError - - Tried to perform a v4 action on v6 object or vice versa. - -.. exception:: IPAddressExclusionError - - An Error we should never see occurred in address exclusion. - -.. exception:: IPv4IpValidationError - - Raised when an IPv4 address is invalid. - -.. exception:: IPv4NetmaskValidationError - - Raised when a netmask is invalid. - -.. exception:: IPv6IpValidationError - - Raised when an IPv6 address is invalid. - -.. exception:: IPv6NetmaskValidationError - - Raised when an IPv6 netmask is invalid. - -.. exception:: PrefixlenDiffInvalidError - - Raised when :meth:`BaseIP.subnet` or :meth:`BaseIP.supernet` is called with a - bad ``prefixlen_diff``. - - -.. seealso:: - - http://code.google.com/p/ipaddr-py/ - The original source of this module and a place to download it as a package - for use on earlier versions of Python. Deleted: python/branches/py3k/Lib/ipaddr.py ============================================================================== --- python/branches/py3k/Lib/ipaddr.py Thu Jun 4 20:32:39 2009 +++ (empty file) @@ -1,1388 +0,0 @@ -# Copyright 2007 Google Inc. -# Licensed to PSF under a Contributor Agreement. -# -# See also: http://code.google.com/p/ipaddr-py/ - -"""An IPv4/IPv6 manipulation library in Python. - -This library is used to create/poke/manipulate IPv4 and IPv6 addresses -and prefixes. - -""" - -__version__ = '1.1.1' - -import struct - - -class Error(Exception): - - """Base class for exceptions.""" - - -class IPTypeError(Error): - - """Tried to perform a v4 action on v6 object or vice versa.""" - - -class IPAddressExclusionError(Error): - - """An Error we should never see occurred in address exclusion.""" - - -class IPv4IpValidationError(Error): - - """Raised when an IPv4 address is invalid.""" - - def __init__(self, ip): - Error.__init__(self) - self.ip = ip - - def __str__(self): - return repr(self.ip) + ' is not a valid IPv4 address' - - -class IPv4NetmaskValidationError(Error): - - """Raised when a netmask is invalid.""" - - def __init__(self, netmask): - Error.__init__(self) - self.netmask = netmask - - def __str__(self): - return repr(self.netmask) + ' is not a valid IPv4 netmask' - - -class IPv6IpValidationError(Error): - - """Raised when an IPv6 address is invalid.""" - - def __init__(self, ip): - Error.__init__(self) - self.ip = ip - - def __str__(self): - return repr(self.ip) + ' is not a valid IPv6 address' - - -class IPv6NetmaskValidationError(Error): - - """Raised when an IPv6 netmask is invalid.""" - - def __init__(self, netmask): - Error.__init__(self) - self.netmask = netmask - - def __str__(self): - return repr(self.netmask) + ' is not a valid IPv6 netmask' - - -class PrefixlenDiffInvalidError(Error): - - """Raised when Sub/Supernets is called with a bad prefixlen_diff.""" - - def __init__(self, error_str): - Error.__init__(self) - self.error_str = error_str - - -def IP(ipaddr): - """Take an IP string/int and return an object of the correct type. - - Args: - ipaddr: A string or integer, the IP address. Either IPv4 or - IPv6 addresses may be supplied; integers less than 2**32 will - be considered to be IPv4. - - Returns: - An IPv4 or IPv6 object. - - Raises: - ValueError: if the string passed isn't either a v4 or a v6 - address. - - """ - - try: - return IPv4(ipaddr) - except (IPv4IpValidationError, IPv4NetmaskValidationError): - pass - - try: - return IPv6(ipaddr) - except (IPv6IpValidationError, IPv6NetmaskValidationError): - pass - - raise ValueError('%r does not appear to be an IPv4 or IPv6 address' % - ipaddr) - - -def _collapse_address_list_recursive(addresses): - """Loops through the addresses, collapsing concurrent netblocks. - - Example: - - >>> ip1 = IPv4('1.1.0.0/24') - >>> ip2 = IPv4('1.1.1.0/24') - >>> ip3 = IPv4('1.1.2.0/24') - >>> ip4 = IPv4('1.1.3.0/24') - >>> ip5 = IPv4('1.1.4.0/24') - >>> ip6 = IPv4('1.1.0.1/22') - - >>> _collapse_address_list_recursive([ip1, ip2, ip3, ip4, ip5, ip6]) - [IPv4('1.1.0.0/22'), IPv4('1.1.4.0/24'), IPv4('1.1.0.1/22')] - - Notes: - This shouldn't be called directly; it is called via - collapse_address_list([]). - - Args: - addresses: A list of IPv4 or IPv6 objects. - - Returns: - A list of IPv4 or IPv6 objects depending on what we were passed. - - """ - ret_array = [] - optimized = False - - for cur_addr in addresses: - if not ret_array: - ret_array.append(cur_addr) - continue - if cur_addr in ret_array[-1]: - optimized = True - elif cur_addr == ret_array[-1].supernet().subnet()[1]: - ret_array.append(ret_array.pop().supernet()) - optimized = True - else: - ret_array.append(cur_addr) - - if optimized: - return _collapse_address_list_recursive(ret_array) - - return ret_array - - -def collapse_address_list(addresses): - """Collapse a list of IP objects. - - Example: - - >>> collapse_address_list([IPv4('1.1.0.0/24'), IPv4('1.1.1.0/24')]) - [IPv4('1.1.0.0/23')] - - Args: - addresses: A list of IPv4 or IPv6 objects. - - Returns: - A list of IPv4 or IPv6 objects depending on what we were passed. - - """ - return _collapse_address_list_recursive( - sorted(addresses, key=BaseIP._get_networks_key)) - - -class BaseIP(object): - - """A generic IP object. - - This IP class contains most of the methods which are used by - the IPv4 and IPv6 classes. - - """ - - def __getitem__(self, n): - if n >= 0: - if self.network + n > self.broadcast: - raise IndexError - return self._string_from_ip_int(self.network + n) - else: - n += 1 - if self.broadcast + n < self.network: - raise IndexError - return self._string_from_ip_int(self.broadcast + n) - - def __lt__(self, other): - try: - if self.version != other.version: - return self.version < other.version - if self.ip != other.ip: - return self.ip < other.ip - if self.netmask != other.netmask: - return self.netmask < other.netmask - return False - except AttributeError: - return NotImplemented - - def __gt__(self, other): - try: - if self.version != other.version: - return self.version > other.version - if self.ip != other.ip: - return self.ip > other.ip - if self.netmask != other.netmask: - return self.netmask > other.netmask - return False - except AttributeError: - return NotImplemented - - def __eq__(self, other): - try: - return (self.version == other.version - and self.ip == other.ip - and self.netmask == other.netmask) - except AttributeError: - return NotImplemented - - def __ne__(self, other): - eq = self.__eq__(other) - if eq is NotImplemented: - return NotImplemented - return not eq - - def __le__(self, other): - gt = self.__gt__(other) - if gt is NotImplemented: - return NotImplemented - return not gt - - def __ge__(self, other): - lt = self.__lt__(other) - if lt is NotImplemented: - return NotImplemented - return not lt - - def __repr__(self): - return '%s(%r)' % (self.__class__.__name__, str(self)) - - def __index__(self): - return self.ip - - def __int__(self): - return self.ip - - def address_exclude(self, other): - """Remove an address from a larger block. - - For example: - - >>> addr1 = IP('10.1.1.0/24') - >>> addr2 = IP('10.1.1.0/26') - >>> addr1.address_exclude(addr2) - [IPv4('10.1.1.64/26'), IPv4('10.1.1.128/25')] - - or IPv6: - - >>> addr1 = IP('::1/32') - >>> addr2 = IP('::1/128') - >>> s = addr1.address_exclude(addr2) - >>> s[:4] - [IPv6('::/128'), IPv6('::2/127'), IPv6('::4/126'), IPv6('::8/125')] - >>> s[-1] - IPv6('0:0:8000::/33') - - Args: - other: An IP object of the same type. - - Returns: - A sorted list of IP objects addresses which is self minus - other. - - Raises: - IPTypeError: If self and other are of difffering address - versions. - IPAddressExclusionError: There was some unknown error in the - address exclusion process. This likely points to a bug - elsewhere in this code. - ValueError: If other is not completely contained by self. - - """ - if not self.version == other.version: - raise IPTypeError("%s and %s aren't of the same version" % ( - str(self), str(other))) - - if other not in self: - raise ValueError('%s not contained in %s' % (str(other), - str(self))) - - ret_addrs = [] - - # Make sure we're comparing the network of other. - other = IP(other.network_ext + '/' + str(other.prefixlen)) - - s1, s2 = self.subnet() - while s1 != other and s2 != other: - if other in s1: - ret_addrs.append(s2) - s1, s2 = s1.subnet() - elif other in s2: - ret_addrs.append(s1) - s1, s2 = s2.subnet() - else: - # If we got here, there's a bug somewhere. - raise IPAddressExclusionError('Error performing exclusion: ' - 's1: %s s2: %s other: %s' % - (str(s1), str(s2), str(other))) - if s1 == other: - ret_addrs.append(s2) - elif s2 == other: - ret_addrs.append(s1) - else: - # If we got here, there's a bug somewhere. - raise IPAddressExclusionError('Error performing exclusion: ' - 's1: %s s2: %s other: %s' % - (str(s1), str(s2), str(other))) - - return sorted(ret_addrs, key=BaseIP._get_networks_key) - - def compare_networks(self, other): - """Compare two IP objects. - - This is only concerned about the comparison of the integer - representation of the network addresses. This means that the - host bits aren't considered at all in this method. If you want - to compare host bits, you can easily enough do a - 'HostA.ip < HostB.ip' - - Args: - other: An IP object. - - Returns: - If the IP versions of self and other are the same, returns: - - -1 if self < other: - eg: IPv4('1.1.1.0/24') < IPv4('1.1.2.0/24') - IPv6('1080::200C:417A') < IPv6('1080::200B:417B') - 0 if self == other - eg: IPv4('1.1.1.1/24') == IPv4('1.1.1.2/24') - IPv6('1080::200C:417A/96') == IPv6('1080::200C:417B/96') - 1 if self > other - eg: IPv4('1.1.1.0/24') > IPv4('1.1.0.0/24') - IPv6('1080::1:200C:417A/112') > - IPv6('1080::0:200C:417A/112') - - If the IP versions of self and other are different, returns: - - -1 if self.version < other.version - eg: IPv4('10.0.0.1/24') < IPv6('::1/128') - 1 if self.version > other.version - eg: IPv6('::1/128') > IPv4('255.255.255.0/24') - - To sort networks with sorted(), min(), max() and other tools with a - *key* argument, use the operator.attrgetter() function to extract the - relevant fields: - - >>> from operator import attrgetter - >>> s = [IPv6('::1/128'), IPv4('255.255.255.0/24')] - >>> sorted(s, key=attrgetter('version', 'network', 'netmask')) - [IPv4('255.255.255.0/24'), IPv6('::1/128')] - - """ - if self.version < other.version: - return -1 - if self.version > other.version: - return 1 - # self.version == other.version below here: - if self.network < other.network: - return -1 - if self.network > other.network: - return 1 - # self.network == other.network below here: - if self.netmask < other.netmask: - return -1 - if self.netmask > other.netmask: - return 1 - # self.network == other.network and self.netmask == other.netmask - return 0 - - def _get_networks_key(self): - """Network-only key function. - - Returns an object that identifies this address' network and - netmask. This function is a suitable "key" argument for sorted() - and list.sort(). - - """ - return (self.version, self.network, self.netmask) - - prefixlen = property( - fget=lambda self: self._prefixlen, - fset=lambda self, prefixlen: self._set_prefix(prefixlen)) - - def __str__(self): - return '%s/%s' % (self._string_from_ip_int(self.ip), - str(self.prefixlen)) - - def __hash__(self): - return hash(self.ip ^ self.netmask) - - def __contains__(self, other): - return self.network <= other.ip and self.broadcast >= other.broadcast - - @property - def ip_ext(self): - """Dotted decimal or colon string version of the IP address.""" - return self._string_from_ip_int(self.ip) - - @property - def ip_ext_full(self): - """Canonical string version of the IP address.""" - return self.ip_ext - - @property - def broadcast(self): - """Integer representation of the broadcast address.""" - return self.ip | self.hostmask - - @property - def broadcast_ext(self): - """Dotted decimal or colon string version of the broadcast.""" - return self._string_from_ip_int(self.broadcast) - - @property - def hostmask(self): - """Integer representation of the hostmask.""" - return self.netmask ^ self._ALL_ONES - - @property - def hostmask_ext(self): - """Dotted decimal or colon string version of the hostmask.""" - return self._string_from_ip_int(self.hostmask) - - @property - def network(self): - """Integer representation of the network.""" - return self.ip & self.netmask - - @property - def network_ext(self): - """Dotted decimal or colon string version of the network.""" - return self._string_from_ip_int(self.network) - - @property - def netmask_ext(self): - """Dotted decimal or colon string version of the netmask.""" - return self._string_from_ip_int(self.netmask) - - @property - def numhosts(self): - """Number of hosts in the current subnet.""" - return self.broadcast - self.network + 1 - - @property - def version(self): - raise NotImplementedError('BaseIP has no version') - - def _ip_int_from_prefix(self, prefixlen=None): - """Turn the prefix length netmask into a int for comparison. - - Args: - prefixlen: An integer, the prefix length. - - Returns: - An integer. - - """ - if not prefixlen and prefixlen != 0: - prefixlen = self.prefixlen - return self._ALL_ONES ^ (self._ALL_ONES >> prefixlen) - - def _prefix_from_ip_int(self, ip_int, mask=32): - """Return prefix length from the decimal netmask. - - Args: - ip_int: An integer, the IP address. - mask: The netmask. Defaults to 32. - - Returns: - An integer, the prefix length. - - """ - while mask: - if ip_int & 1 == 1: - break - ip_int >>= 1 - mask -= 1 - - return mask - - def _ip_string_from_prefix(self, prefixlen=None): - """Turn a prefix length into a dotted decimal string. - - Args: - prefixlen: An integer, the netmask prefix length. - - Returns: - A string, the dotted decimal netmask string. - - """ - if not prefixlen: - prefixlen = self.prefixlen - return self._string_from_ip_int(self._ip_int_from_prefix(prefixlen)) - - -class IPv4(BaseIP): - - """This class represents and manipulates 32-bit IPv4 addresses. - - >>> addr = IPv4('1.2.3.4/27') - >>> for attr in ['ip', 'ip_ext', 'ip_ext_full', 'network', 'network_ext', - ... 'hostmask', 'hostmask_ext', 'broadcast', 'broadcast_ext', - ... 'netmask', 'netmask_ext', 'prefixlen']: - ... print(attr, '=', getattr(addr, attr)) - ip = 16909060 - ip_ext = 1.2.3.4 - ip_ext_full = 1.2.3.4 - network = 16909056 - network_ext = 1.2.3.0 - hostmask = 31 - hostmask_ext = 0.0.0.31 - broadcast = 16909087 - broadcast_ext = 1.2.3.31 - netmask = 4294967264 - netmask_ext = 255.255.255.224 - prefixlen = 27 - - """ - - # Equivalent to 255.255.255.255 or 32 bits of 1's. - _ALL_ONES = 0xffffffff - _version = 4 - - def __init__(self, ipaddr): - """Instantiate a new IPv4 object. - - Args: - ipaddr: A string or integer representing the IP [& network]. - '192.168.1.1/32' - '192.168.1.1/255.255.255.255' - '192.168.1.1/0.0.0.255' - '192.168.1.1' - are all functionally the same in IPv4. That is to say, - failing to provide a subnetmask will create an object with - a mask of /32. A netmask of '255.255.255.255' is assumed - to be /32 and '0.0.0.0' is assumed to be /0, even though - other netmasks can be expressed both as host- and - net-masks. (255.0.0.0 == 0.255.255.255) - - Additionally, an integer can be passed, so - IPv4('192.168.1.1') == IPv4(3232235777). - or, more generally - IPv4(IPv4('192.168.1.1').ip) == IPv4('192.168.1.1') - - Raises: - IPv4IpValidationError: If ipaddr isn't a valid IPv4 address. - IPv4NetmaskValidationError: If the netmask isn't valid for - an IPv4 address. - - """ - BaseIP.__init__(self) - - # Efficient constructor from integer. - if isinstance(ipaddr, int): - self.ip = ipaddr - self._prefixlen = 32 - self.netmask = self._ALL_ONES - if ipaddr < 0 or ipaddr > self._ALL_ONES: - raise IPv4IpValidationError(ipaddr) - return - - # Constructing from a packed address - if isinstance(ipaddr, (bytes, bytearray)) and len(ipaddr) == 4: - self.ip = struct.unpack('!I', ipaddr)[0] - self._prefixlen = 32 - self.netmask = self._ALL_ONES - return - - # Assume input argument to be string or any object representation - # which converts into a formatted IP prefix string. - addr = str(ipaddr).split('/') - - if len(addr) > 2: - raise IPv4IpValidationError(ipaddr) - - if not self._is_valid_ip(addr[0]): - raise IPv4IpValidationError(addr[0]) - - self.ip = self._ip_int_from_string(addr[0]) - - if len(addr) == 2: - mask = addr[1].split('.') - if len(mask) == 4: - # We have dotted decimal netmask. - if not self._is_valid_netmask(addr[1]): - raise IPv4NetmaskValidationError(addr[1]) - if self._is_hostmask(addr[1]): - self.netmask = ( - self._ip_int_from_string(addr[1]) ^ self._ALL_ONES) - else: - self.netmask = self._ip_int_from_string(addr[1]) - self._prefixlen = self._prefix_from_ip_int(self.netmask) - else: - # We have a netmask in prefix length form. - if not self._is_valid_netmask(addr[1]): - raise IPv4NetmaskValidationError(addr[1]) - self._prefixlen = int(addr[1]) - self.netmask = self._ip_int_from_prefix(self._prefixlen) - else: - self._prefixlen = 32 - self.netmask = self._ip_int_from_prefix(self._prefixlen) - - def _set_prefix(self, prefixlen): - """Change the prefix length. - - Args: - prefixlen: An integer, the new prefix length. - - Raises: - IPv4NetmaskValidationError: If prefixlen is out of bounds. - - """ - if not 0 <= prefixlen <= 32: - raise IPv4NetmaskValidationError(prefixlen) - self._prefixlen = prefixlen - self.netmask = self._ip_int_from_prefix(self._prefixlen) - - def subnet(self, prefixlen_diff=1): - """The subnets which join to make the current subnet. - - In the case that self contains only one IP - (self._prefixlen == 32), return a list with just ourself. - - Args: - prefixlen_diff: An integer, the amount the prefix length - should be increased by. Given a /24 network and a - prefixlen_diff of 3, for example, 8 subnets of size /27 - will be returned. The default value of 1 splits the - current network into two halves. - - Returns: - A list of IPv4 objects. - - Raises: - PrefixlenDiffInvalidError: The prefixlen_diff is too small - or too large. - - """ - if self._prefixlen == 32: - return [self] - - if prefixlen_diff < 0: - raise PrefixlenDiffInvalidError('prefix length diff must be > 0') - new_prefixlen = self.prefixlen + prefixlen_diff - - if not self._is_valid_netmask(str(new_prefixlen)): - raise PrefixlenDiffInvalidError( - 'prefix length diff %d is invalid for netblock %s' % ( - new_prefixlen, str(self))) - - first = IPv4( - self._string_from_ip_int(self.network) + '/' + - str(self._prefixlen + prefixlen_diff)) - subnets = [first] - current = first - while True: - broadcast = current.broadcast - if broadcast == self.broadcast: - break - current = IPv4(self._string_from_ip_int(broadcast + 1) + '/' + - str(new_prefixlen)) - subnets.append(current) - - return subnets - - def supernet(self, prefixlen_diff=1): - """The supernet containing the current network. - - Args: - prefixlen_diff: An integer, the amount the prefix length of - the network should be decreased by. For example, given a - /24 network and a prefixlen_diff of 3, a supernet with a - /21 netmask is returned. - - Returns: - An IPv4 object. - - Raises: - PrefixlenDiffInvalidError: If - self.prefixlen - prefixlen_diff < 0. I.e., you have a - negative prefix length. - - """ - if self.prefixlen == 0: - return self - if self.prefixlen - prefixlen_diff < 0: - raise PrefixlenDiffInvalidError( - 'current prefixlen is %d, cannot have a prefixlen_diff of %d' % - (self.prefixlen, prefixlen_diff)) - return IPv4(self.ip_ext + '/' + str(self.prefixlen - prefixlen_diff)) - - @property - def is_private(self): - """Test if this address is allocated for private networks. - - Returns: - A boolean, True if the address is reserved per RFC 1918. - - """ - for network in _IPV4_RFC1918_NETWORKS: - if self in network: - return True - return False - - @property - def is_multicast(self): - """Test if the address is reserved for multicast use. - - Returns: - A boolean, True if the address is multicast. - See RFC 3171 for details. - - """ - return self in _IPV4_RFC3171_MULTICAST - - @property - def is_loopback(self): - """Test if the address is a loopback adddress. - - Returns: - A boolean, True if the address is a loopback per RFC 3330. - - """ - return self in _IPV4_RFC3330_LOOPBACK - - @property - def is_link_local(self): - """Test if the address is reserved for link-local. - - Returns: - A boolean, True if the address is link-local per RFC 3927. - - """ - return self in _IPV4_RFC3927_LINK_LOCAL - - @property - def version(self): - return self._version - - @property - def packed(self): - """The binary representation of this address.""" - return struct.pack('!I', self.ip) - - def _is_hostmask(self, ip_str): - """Test if the IP string is a hostmask (rather than a netmask). - - Args: - ip_str: A string, the potential hostmask. - - Returns: - A boolean, True if the IP string is a hostmask. - - """ - parts = [int(x) for x in ip_str.split('.')] - if parts[0] < parts[-1]: - return True - return False - - def _ip_int_from_string(self, ip_str): - """Turn the given IP string into an integer for comparison. - - Args: - ip_str: A string, the IP address. - - Returns: - The IP address as an integer. - - """ - packed_ip = 0 - for oc in ip_str.split('.'): - packed_ip = (packed_ip << 8) | int(oc) - return packed_ip - - def _string_from_ip_int(self, ip_int): - """Turns a 32-bit integer into dotted decimal notation. - - Args: - ip_int: An integer, the IP address. - - Returns: - The IP address as a string in dotted decimal notation. - - """ - octets = [] - for _ in range(4): - octets.insert(0, str(ip_int & 0xFF)) - ip_int >>= 8 - return '.'.join(octets) - - def _is_valid_ip(self, ip_str): - """Validate the dotted decimal notation IP/netmask string. - - Args: - ip_str: A string, the IP address. - - Returns: - A boolean, True if the string is a valid dotted decimal IP - string. - - """ - octets = ip_str.split('.') - if len(octets) == 1: - # We have an integer rather than a dotted decimal IP. - try: - return int(ip_str) >= 0 and int(ip_str) <= self._ALL_ONES - except ValueError: - return False - - if len(octets) != 4: - return False - - for octet in octets: - try: - if not 0 <= int(octet) <= 255: - return False - except ValueError: - return False - return True - - def _is_valid_netmask(self, netmask): - """Verify that the netmask is valid. - - Args: - netmask: A string, either a prefix or dotted decimal - netmask. - - Returns: - A boolean, True if the prefix represents a valid IPv4 - netmask. - - """ - if len(netmask.split('.')) == 4: - return self._is_valid_ip(netmask) - try: - netmask = int(netmask) - except ValueError: - return False - return 0 <= netmask <= 32 - - -class IPv6(BaseIP): - - """This class respresents and manipulates 128-bit IPv6 addresses. - - >>> addr = IPv6('2001:658:22A:CAFE:200::1/64') - >>> for attr in ['ip', 'ip_ext', 'ip_ext_full', 'network', 'network_ext', - ... 'hostmask', 'hostmask_ext', 'broadcast', 'broadcast_ext', - ... 'netmask', 'netmask_ext', 'prefixlen']: - ... print(attr, '=', getattr(addr, attr)) - ip = 42540616829182469433547762482097946625 - ip_ext = 2001:658:22a:cafe:200::1 - ip_ext_full = 2001:0658:022a:cafe:0200:0000:0000:0001 - network = 42540616829182469433403647294022090752 - network_ext = 2001:658:22a:cafe:: - hostmask = 18446744073709551615 - hostmask_ext = ::ffff:ffff:ffff:ffff - broadcast = 42540616829182469451850391367731642367 - broadcast_ext = 2001:658:22a:cafe:ffff:ffff:ffff:ffff - netmask = 340282366920938463444927863358058659840 - netmask_ext = 64 - prefixlen = 64 - - """ - - _ALL_ONES = (2**128) - 1 - _version = 6 - - def __init__(self, ipaddr): - """Instantiate a new IPv6 object. - - Args: - ipaddr: A string or integer representing the IP or the IP - and prefix/netmask. - '2001:4860::/128' - '2001:4860:0000:0000:0000:0000:0000:0000/128' - '2001:4860::' - are all functionally the same in IPv6. That is to say, - failing to provide a subnetmask will create an object with - a mask of /128. - - Additionally, an integer can be passed, so - IPv6('2001:4860::') == - IPv6(42541956101370907050197289607612071936L). - or, more generally - IPv6(IPv6('2001:4860::').ip) == IPv6('2001:4860::') - - Raises: - IPv6IpValidationError: If ipaddr isn't a valid IPv6 address. - IPv6NetmaskValidationError: If the netmask isn't valid for - an IPv6 address. - - """ - BaseIP.__init__(self) - - # Efficient constructor from integer. - if isinstance(ipaddr, int): - self.ip = ipaddr - self._prefixlen = 128 - self.netmask = self._ALL_ONES - if ipaddr < 0 or ipaddr > self._ALL_ONES: - raise IPv6IpValidationError(ipaddr) - return - - # Constructing from a packed address - if isinstance(ipaddr, (bytes, bytearray)) and len(ipaddr) == 16: - tmp = struct.unpack('!QQ', ipaddr) - self.ip = (tmp[0] << 64) | tmp[1] - self._prefixlen = 128 - self.netmask = self._ALL_ONES - return - - # Assume input argument to be string or any object representation - # which converts into a formatted IP prefix string. - addr_str = str(ipaddr) - if not addr_str: - raise IPv6IpValidationError('') - addr = addr_str.split('/') - if len(addr) > 1: - if self._is_valid_netmask(addr[1]): - self._prefixlen = int(addr[1]) - else: - raise IPv6NetmaskValidationError(addr[1]) - else: - self._prefixlen = 128 - - self.netmask = self._ip_int_from_prefix(self._prefixlen) - - if not self._is_valid_ip(addr[0]): - raise IPv6IpValidationError(addr[0]) - - self.ip = self._ip_int_from_string(addr[0]) - - @property - def ip_ext_full(self): - """Returns the expanded version of the IPv6 string.""" - return self._explode_shorthand_ip_string(self.ip_ext) - - def _set_prefix(self, prefixlen): - """Change the prefix length. - - Args: - prefixlen: An integer, the new prefix length. - - Raises: - IPv6NetmaskValidationError: If prefixlen is out of bounds. - - """ - if not 0 <= prefixlen <= 128: - raise IPv6NetmaskValidationError(prefixlen) - self._prefixlen = prefixlen - self.netmask = self._ip_int_from_prefix(self.prefixlen) - - def subnet(self, prefixlen_diff=1): - """The subnets which join to make the current subnet. - - In the case that self contains only one IP - (self._prefixlen == 128), return a list with just ourself. - - Args: - prefixlen_diff: An integer, the amount the prefix length - should be increased by. - - Returns: - A list of IPv6 objects. - - Raises: - PrefixlenDiffInvalidError: The prefixlen_diff is too small - or too large. - - """ - # Preserve original functionality (return [self] if - # self.prefixlen == 128). - if self.prefixlen == 128: - return [self] - - if prefixlen_diff < 0: - raise PrefixlenDiffInvalidError('Prefix length diff must be > 0') - new_prefixlen = self.prefixlen + prefixlen_diff - if not self._is_valid_netmask(str(new_prefixlen)): - raise PrefixlenDiffInvalidError( - 'Prefix length diff %d is invalid for netblock %s' % ( - new_prefixlen, str(self))) - first = IPv6( - self._string_from_ip_int(self.network) + '/' + - str(self._prefixlen + prefixlen_diff)) - subnets = [first] - current = first - while True: - broadcast = current.broadcast - if current.broadcast == self.broadcast: - break - current = IPv6(self._string_from_ip_int(broadcast + 1) + '/' + - str(new_prefixlen)) - subnets.append(current) - - return subnets - - def supernet(self, prefixlen_diff=1): - """The supernet containing the current network. - - Args: - prefixlen_diff: An integer, the amount the prefix length of the - network should be decreased by. For example, given a /96 - network and a prefixlen_diff of 3, a supernet with a /93 - netmask is returned. - - Returns: - An IPv6 object. - - Raises: - PrefixlenDiffInvalidError: If - self._prefixlen - prefixlen_diff < 0. I.e., you have a - negative prefix length. - - """ - if self.prefixlen == 0: - return self - if self.prefixlen - prefixlen_diff < 0: - raise PrefixlenDiffInvalidError( - 'current prefixlen is %d, cannot have a prefixlen_diff of %d' % - (self.prefixlen, prefixlen_diff)) - return IPv6(self.ip_ext + '/' + str(self.prefixlen - prefixlen_diff)) - - @property - def is_multicast(self): - """Test if the address is reserved for multicast use. - - Returns: - A boolean, True if the address is a multicast address. - See RFC 2373 2.7 for details. - - """ - return self in _IPV6_RFC2373_MULTICAST - - @property - def is_unspecified(self): - """Test if the address is unspecified. - - Returns: - A boolean, True if this is the unspecified address as defined in - RFC 2373 2.5.2. - - """ - return self == _IPV6_RFC2373_UNSPECIFIED - - @property - def is_loopback(self): - """Test if the address is a loopback adddress. - - Returns: - A boolean, True if the address is a loopback address as defined in - RFC 2373 2.5.3. - - """ - return self == _IPV6_RFC2373_LOOPBACK - - @property - def is_link_local(self): - """Test if the address is reserved for link-local. - - Returns: - A boolean, True if the address is reserved per RFC 4291. - - """ - return self in _IPV6_RFC4291_LINK_LOCAL - - @property - def is_site_local(self): - """Test if the address is reserved for site-local. - - Note that the site-local address space has been deprecated by RFC 3879. - Use is_private to test if this address is in the space of unique local - addresses as defined by RFC 4193. - - Returns: - A boolean, True if the address is reserved per RFC 3513 2.5.6. - - """ - return self in _IPV6_RFC3513_SITE_LOCAL - - @property - def is_private(self): - """Test if this address is allocated for private networks. - - Returns: - A boolean, True if the address is reserved per RFC 4193. - - """ - return self in _IPV6_RFC4193_PRIVATE - - @property - def version(self): - return self._version - - @property - def packed(self): - """The binary representation of this address.""" - return struct.pack('!QQ', self.ip >> 64, self.ip & (2**64 - 1)) - - def _is_shorthand_ip(self, ip_str=None): - """Determine if the address is shortened. - - Args: - ip_str: A string, the IPv6 address. - - Returns: - A boolean, True if the address is shortened. - - """ - if ip_str.count('::') == 1: - return True - return False - - def _explode_shorthand_ip_string(self, ip_str): - """Expand a shortened IPv6 address. - - Args: - ip_str: A string, the IPv6 address. - - Returns: - A string, the expanded IPv6 address. - - """ - if self._is_shorthand_ip(ip_str): - new_ip = [] - hextet = ip_str.split('::') - sep = len(hextet[0].split(':')) + len(hextet[1].split(':')) - new_ip = hextet[0].split(':') - - for _ in range(8 - sep): - new_ip.append('0000') - new_ip += hextet[1].split(':') - - # Now need to make sure every hextet is 4 lower case characters. - # If a hextet is < 4 characters, we've got missing leading 0's. - ret_ip = [] - for hextet in new_ip: - ret_ip.append(('0' * (4 - len(hextet)) + hextet).lower()) - return ':'.join(ret_ip) - # We've already got a longhand ip_str. - return ip_str - - def _is_valid_ip(self, ip_str=None): - """Ensure we have a valid IPv6 address. - - Probably not as exhaustive as it should be. - - Args: - ip_str: A string, the IPv6 address. - - Returns: - A boolean, True if this is a valid IPv6 address. - - """ - if not ip_str: - ip_str = self.ip_ext - - # We need to have at least one ':'. - if ':' not in ip_str: - return False - - # We can only have one '::' shortener. - if ip_str.count('::') > 1: - return False - - # '::' should be encompassed by start, digits or end. - if ':::' in ip_str: - return False - - # A single colon can neither start nor end an address. - if ((ip_str.startswith(':') and not ip_str.startswith('::')) or - (ip_str.endswith(':') and not ip_str.endswith('::'))): - return False - - # If we have no concatenation, we need to have 8 fields with 7 ':'. - if '::' not in ip_str and ip_str.count(':') != 7: - # We might have an IPv4 mapped address. - if ip_str.count('.') != 3: - return False - - ip_str = self._explode_shorthand_ip_string(ip_str) - - # Now that we have that all squared away, let's check that each of the - # hextets are between 0x0 and 0xFFFF. - for hextet in ip_str.split(':'): - if hextet.count('.') == 3: - # If we have an IPv4 mapped address, the IPv4 portion has to be - # at the end of the IPv6 portion. - if not ip_str.split(':')[-1] == hextet: - return False - try: - IPv4(hextet) - except IPv4IpValidationError: - return False - elif int(hextet, 16) < 0x0 or int(hextet, 16) > 0xFFFF: - return False - return True - - def _is_valid_netmask(self, prefixlen): - """Verify that the netmask/prefixlen is valid. - - Args: - prefixlen: A string, the netmask in prefix length format. - - Returns: - A boolean, True if the prefix represents a valid IPv6 - netmask. - - """ - try: - prefixlen = int(prefixlen) - except ValueError: - return False - return 0 <= prefixlen <= 128 - - def _ip_int_from_string(self, ip_str=None): - """Turn an IPv6 address into an integer. - - Args: - ip_str: A string, the IPv6 address. - - Returns: - A long, the IPv6 address. - - """ - if not ip_str: - ip_str = self.ip_ext - - ip_int = 0 - - fields = self._explode_shorthand_ip_string(ip_str).split(':') - - # Do we have an IPv4 mapped (::ffff:a.b.c.d) or compact (::a.b.c.d) - # address? - if fields[-1].count('.') == 3: - ipv4_string = fields.pop() - ipv4_int = IPv4(ipv4_string).ip - octets = [] - for _ in range(2): - octets.append(hex(ipv4_int & 0xFFFF).lstrip('0x').rstrip('L')) - ipv4_int >>= 16 - fields.extend(reversed(octets)) - - for field in fields: - ip_int = (ip_int << 16) + int(field, 16) - - return ip_int - - def _compress_hextets(self, hextets): - """Compresses a list of hextets. - - Compresses a list of strings, replacing the longest continuous - sequence of "0" in the list with "" and adding empty strings at - the beginning or at the end of the string such that subsequently - calling ":".join(hextets) will produce the compressed version of - the IPv6 address. - - Args: - hextets: A list of strings, the hextets to compress. - - Returns: - A list of strings. - - """ - best_doublecolon_start = -1 - best_doublecolon_len = 0 - doublecolon_start = -1 - doublecolon_len = 0 - for index in range(len(hextets)): - if hextets[index] == '0': - doublecolon_len += 1 - if doublecolon_start == -1: - # Start of a sequence of zeros. - doublecolon_start = index - if doublecolon_len > best_doublecolon_len: - # This is the longest sequence of zeros so far. - best_doublecolon_len = doublecolon_len - best_doublecolon_start = doublecolon_start - else: - doublecolon_len = 0 - doublecolon_start = -1 - - if best_doublecolon_len > 1: - best_doublecolon_end = (best_doublecolon_start + - best_doublecolon_len) - # For zeros at the end of the address. - if best_doublecolon_end == len(hextets): - hextets += [''] - hextets[best_doublecolon_start:best_doublecolon_end] = [''] - # For zeros at the beginning of the address. - if best_doublecolon_start == 0: - hextets = [''] + hextets - - return hextets - - def _string_from_ip_int(self, ip_int=None): - """Turns a 128-bit integer into hexadecimal notation. - - Args: - ip_int: An integer, the IP address. - - Returns: - A string, the hexadecimal representation of the address. - - Raises: - ValueError: The address is bigger than 128 bits of all ones. - - """ - if not ip_int and ip_int != 0: - ip_int = self.ip - - if ip_int > self._ALL_ONES: - raise ValueError('IPv6 address is too large') - - hex_str = '%032x' % ip_int - hextets = [] - for x in range(0, 32, 4): - hextets.append('%x' % int(hex_str[x:x+4], 16)) - - hextets = self._compress_hextets(hextets) - return ':'.join(hextets) - - @property - def netmask_ext(self): - """IPv6 extended netmask. - - We don't deal with netmasks in IPv6 like we do in IPv4. This is - here strictly for IPv4 compatibility. We simply return the - prefix length. - - Returns: - An integer. - - """ - return self.prefixlen - - -# IPv4 constants. -_IPV4_RFC1918_NETWORKS = (IPv4('10.0.0.0/8'), - IPv4('172.16.0.0/12'), - IPv4('192.168.0.0/16')) -_IPV4_RFC3171_MULTICAST = IPv4('224.0.0.0/4') -_IPV4_RFC3330_LOOPBACK = IPv4('127.0.0.0/8') -_IPV4_RFC3927_LINK_LOCAL = IPv4('169.254.0.0/16') - -# IPv6 constants. -_IPV6_RFC2373_MULTICAST = IPv6('ff00::/8') -_IPV6_RFC2373_UNSPECIFIED = IPv6('::') -_IPV6_RFC2373_LOOPBACK = IPv6('::1') -_IPV6_RFC4291_LINK_LOCAL = IPv6('fe80::/10') -_IPV6_RFC3513_SITE_LOCAL = IPv6('fec0::/10') # Deprecated by RFC3879. -_IPV6_RFC4193_PRIVATE = IPv6('fc00::/7') - -if __name__ == '__main__': - - import doctest - print(doctest.testmod()) Deleted: python/branches/py3k/Lib/test/test_ipaddr.py ============================================================================== --- python/branches/py3k/Lib/test/test_ipaddr.py Thu Jun 4 20:32:39 2009 +++ (empty file) @@ -1,586 +0,0 @@ -# Copyright 2007 Google Inc. -# Licensed to PSF under a Contributor Agreement. -# -# See also: http://code.google.com/p/ipaddr-py/ - -"""Unittest for ipaddr module.""" - - -import unittest -from test import support -import ipaddr - - -class IpaddrUnitTest(unittest.TestCase): - - def setUp(self): - self.ipv4 = ipaddr.IPv4('1.2.3.4/24') - self.ipv4_hostmask = ipaddr.IPv4('10.0.0.1/0.255.255.255') - self.ipv6 = ipaddr.IPv6('2001:658:22a:cafe:200:0:0:1/64') - - def test_repr(self): - self.assertEqual("IPv4('1.2.3.4/32')", repr(ipaddr.IPv4('1.2.3.4'))) - self.assertEqual("IPv6('::1/128')", repr(ipaddr.IPv6('::1'))) - - def test_invalid_strings(self): - self.assertRaises(ValueError, ipaddr.IP, '') - self.assertRaises(ValueError, ipaddr.IP, 'www.google.com') - self.assertRaises(ValueError, ipaddr.IP, '1.2.3') - self.assertRaises(ValueError, ipaddr.IP, '1.2.3.4.5') - self.assertRaises(ValueError, ipaddr.IP, '301.2.2.2') - self.assertRaises(ValueError, ipaddr.IP, '1:2:3:4:5:6:7') - self.assertRaises(ValueError, ipaddr.IP, '1:2:3:4:5:6:7:') - self.assertRaises(ValueError, ipaddr.IP, ':2:3:4:5:6:7:8') - self.assertRaises(ValueError, ipaddr.IP, '1:2:3:4:5:6:7:8:9') - self.assertRaises(ValueError, ipaddr.IP, '1:2:3:4:5:6:7:8:') - self.assertRaises(ValueError, ipaddr.IP, '1::3:4:5:6::8') - self.assertRaises(ValueError, ipaddr.IP, 'a:') - self.assertRaises(ValueError, ipaddr.IP, ':') - self.assertRaises(ValueError, ipaddr.IP, ':::') - self.assertRaises(ValueError, ipaddr.IP, '::a:') - self.assertRaises(ValueError, ipaddr.IP, '1ffff::') - self.assertRaises(ValueError, ipaddr.IP, '0xa::') - self.assertRaises(ValueError, ipaddr.IP, '1:2:3:4:5:6:1a.2.3.4') - self.assertRaises(ValueError, ipaddr.IP, '1:2:3:4:5:1.2.3.4:8') - self.assertRaises(ipaddr.IPv4IpValidationError, ipaddr.IPv4, '') - self.assertRaises(ipaddr.IPv4IpValidationError, ipaddr.IPv4, - 'google.com') - self.assertRaises(ipaddr.IPv4IpValidationError, ipaddr.IPv4, - '::1.2.3.4') - self.assertRaises(ipaddr.IPv6IpValidationError, ipaddr.IPv6, '') - self.assertRaises(ipaddr.IPv6IpValidationError, ipaddr.IPv6, - 'google.com') - self.assertRaises(ipaddr.IPv6IpValidationError, ipaddr.IPv6, - '1.2.3.4') - - def test_get_network(self): - self.assertEqual(self.ipv4.network, 16909056) - self.assertEqual(self.ipv4.network_ext, '1.2.3.0') - self.assertEqual(self.ipv4_hostmask.network_ext, '10.0.0.0') - - self.assertEqual(self.ipv6.network, - 42540616829182469433403647294022090752) - self.assertEqual(self.ipv6.network_ext, - '2001:658:22a:cafe::') - self.assertEqual(self.ipv6.hostmask_ext, - '::ffff:ffff:ffff:ffff') - - def test_ip_from_int(self): - self.assertEqual(self.ipv4.ip, ipaddr.IPv4(16909060).ip) - self.assertRaises(ipaddr.IPv4IpValidationError, - ipaddr.IPv4, 2**32) - self.assertRaises(ipaddr.IPv4IpValidationError, - ipaddr.IPv4, -1) - - self.assertEqual(self.ipv6.ip, - ipaddr.IPv6(42540616829182469433547762482097946625).ip) - self.assertRaises(ipaddr.IPv6IpValidationError, - ipaddr.IPv6, 2**128) - self.assertRaises(ipaddr.IPv6IpValidationError, - ipaddr.IPv6, -1) - - self.assertEqual(ipaddr.IP(self.ipv4.ip).version, 4) - self.assertEqual(ipaddr.IP(self.ipv6.ip).version, 6) - - def test_ip_from_packed(self): - ip = ipaddr.IP - - self.assertEqual(self.ipv4.ip, - ip(b'\x01\x02\x03\x04').ip) - self.assertEqual(ip('255.254.253.252'), - ip(b'\xff\xfe\xfd\xfc')) - self.assertRaises(ValueError, ipaddr.IP, b'\x00' * 3) - self.assertRaises(ValueError, ipaddr.IP, b'\x00' * 5) - self.assertEqual(self.ipv6.ip, - ip(b'\x20\x01\x06\x58\x02\x2a\xca\xfe' - b'\x02\x00\x00\x00\x00\x00\x00\x01').ip) - self.assertEqual(ip('ffff:2:3:4:ffff::'), - ip(b'\xff\xff\x00\x02\x00\x03\x00\x04' + - b'\xff\xff' + b'\x00' * 6)) - self.assertEqual(ip('::'), - ip(b'\x00' * 16)) - self.assertRaises(ValueError, ip, b'\x00' * 15) - self.assertRaises(ValueError, ip, b'\x00' * 17) - - def test_get_ip(self): - self.assertEqual(self.ipv4.ip, 16909060) - self.assertEqual(self.ipv4.ip_ext, '1.2.3.4') - self.assertEqual(self.ipv4.ip_ext_full, '1.2.3.4') - self.assertEqual(self.ipv4_hostmask.ip_ext, '10.0.0.1') - - self.assertEqual(self.ipv6.ip, 42540616829182469433547762482097946625) - self.assertEqual(self.ipv6.ip_ext, - '2001:658:22a:cafe:200::1') - self.assertEqual(self.ipv6.ip_ext_full, - '2001:0658:022a:cafe:0200:0000:0000:0001') - - def test_get_netmask(self): - self.assertEqual(self.ipv4.netmask, 4294967040) - self.assertEqual(self.ipv4.netmask_ext, '255.255.255.0') - self.assertEqual(self.ipv4_hostmask.netmask_ext, '255.0.0.0') - self.assertEqual(self.ipv6.netmask, - 340282366920938463444927863358058659840) - self.assertEqual(self.ipv6.netmask_ext, 64) - - def test_zero_netmask(self): - ipv4_zero_netmask = ipaddr.IPv4('1.2.3.4/0') - self.assertEqual(ipv4_zero_netmask.netmask, 0) - self.assert_(ipv4_zero_netmask._is_valid_netmask(str(0))) - - ipv6_zero_netmask = ipaddr.IPv6('::1/0') - self.assertEqual(ipv6_zero_netmask.netmask, 0) - self.assert_(ipv6_zero_netmask._is_valid_netmask(str(0))) - - def test_get_broadcast(self): - self.assertEqual(self.ipv4.broadcast, 16909311) - self.assertEqual(self.ipv4.broadcast_ext, '1.2.3.255') - - self.assertEqual(self.ipv6.broadcast, - 42540616829182469451850391367731642367) - self.assertEqual(self.ipv6.broadcast_ext, - '2001:658:22a:cafe:ffff:ffff:ffff:ffff') - - def test_get_prefixlen(self): - self.assertEqual(self.ipv4.prefixlen, 24) - - self.assertEqual(self.ipv6.prefixlen, 64) - - def test_get_supernet(self): - self.assertEqual(self.ipv4.supernet().prefixlen, 23) - self.assertEqual(self.ipv4.supernet().network_ext, '1.2.2.0') - self.assertEqual(ipaddr.IPv4('0.0.0.0/0').supernet(), - ipaddr.IPv4('0.0.0.0/0')) - - self.assertEqual(self.ipv6.supernet().prefixlen, 63) - self.assertEqual(self.ipv6.supernet().network_ext, - '2001:658:22a:cafe::') - self.assertEqual(ipaddr.IPv6('::0/0').supernet(), ipaddr.IPv6('::0/0')) - - def test_get_supernet3(self): - self.assertEqual(self.ipv4.supernet(3).prefixlen, 21) - self.assertEqual(self.ipv4.supernet(3).network_ext, '1.2.0.0') - - self.assertEqual(self.ipv6.supernet(3).prefixlen, 61) - self.assertEqual(self.ipv6.supernet(3).network_ext, - '2001:658:22a:caf8::') - - def test_get_subnet(self): - self.assertEqual(self.ipv4.subnet()[0].prefixlen, 25) - self.assertEqual(self.ipv4.subnet()[0].network_ext, '1.2.3.0') - self.assertEqual(self.ipv4.subnet()[1].network_ext, '1.2.3.128') - - self.assertEqual(self.ipv6.subnet()[0].prefixlen, 65) - - def test_get_subnet_for_single32(self): - ip = ipaddr.IPv4('1.2.3.4/32') - subnets1 = [str(x) for x in ip.subnet()] - subnets2 = [str(x) for x in ip.subnet(2)] - self.assertEqual(subnets1, ['1.2.3.4/32']) - self.assertEqual(subnets1, subnets2) - - def test_get_subnet_for_single128(self): - ip = ipaddr.IPv6('::1/128') - subnets1 = [str(x) for x in ip.subnet()] - subnets2 = [str(x) for x in ip.subnet(2)] - self.assertEqual(subnets1, ['::1/128']) - self.assertEqual(subnets1, subnets2) - - def test_subnet2(self): - ips = [str(x) for x in self.ipv4.subnet(2)] - self.assertEqual( - ips, - ['1.2.3.0/26', '1.2.3.64/26', '1.2.3.128/26', '1.2.3.192/26']) - - ipsv6 = [str(x) for x in self.ipv6.subnet(2)] - self.assertEqual( - ipsv6, - ['2001:658:22a:cafe::/66', - '2001:658:22a:cafe:4000::/66', - '2001:658:22a:cafe:8000::/66', - '2001:658:22a:cafe:c000::/66']) - - def test_subnet_fails_for_large_cidr_diff(self): - self.assertRaises(ipaddr.PrefixlenDiffInvalidError, self.ipv4.subnet, 9) - self.assertRaises(ipaddr.PrefixlenDiffInvalidError, self.ipv6.subnet, - 65) - - def test_supernet_fails_for_large_cidr_diff(self): - self.assertRaises(ipaddr.PrefixlenDiffInvalidError, self.ipv4.supernet, - 25) - self.assertRaises(ipaddr.PrefixlenDiffInvalidError, self.ipv6.supernet, - 65) - - def test_subnet_fails_for_negative_cidr_diff(self): - self.assertRaises(ipaddr.PrefixlenDiffInvalidError, self.ipv4.subnet, - -1) - self.assertRaises(ipaddr.PrefixlenDiffInvalidError, self.ipv6.subnet, - -1) - - def test_get_num_hosts(self): - self.assertEqual(self.ipv4.numhosts, 256) - self.assertEqual(self.ipv4.subnet()[0].numhosts, 128) - self.assertEqual(self.ipv4.supernet().numhosts, 512) - - self.assertEqual(self.ipv6.numhosts, 18446744073709551616) - self.assertEqual(self.ipv6.subnet()[0].numhosts, 9223372036854775808) - self.assertEqual(self.ipv6.supernet().numhosts, 36893488147419103232) - - def test_contains(self): - self.assertTrue(ipaddr.IPv4('1.2.3.128/25') in self.ipv4) - self.assertFalse(ipaddr.IPv4('1.2.4.1/24') in self.ipv4) - self.assertFalse(self.ipv4 in self.ipv6) - self.assertFalse(self.ipv6 in self.ipv4) - self.assertTrue(self.ipv4 in self.ipv4) - self.assertTrue(self.ipv6 in self.ipv6) - - def test_bad_address(self): - self.assertRaises(ipaddr.IPv4IpValidationError, ipaddr.IPv4, 'poop') - self.assertRaises(ipaddr.IPv4IpValidationError, - ipaddr.IPv4, '1.2.3.256') - - self.assertRaises(ipaddr.IPv6IpValidationError, ipaddr.IPv6, 'poopv6') - self.assertRaises(ipaddr.IPv4IpValidationError, - ipaddr.IPv4, '1.2.3.4/32/24') - - def test_bad_net_mask(self): - self.assertRaises(ipaddr.IPv4NetmaskValidationError, - ipaddr.IPv4, '1.2.3.4/') - self.assertRaises(ipaddr.IPv4NetmaskValidationError, - ipaddr.IPv4, '1.2.3.4/33') - self.assertRaises(ipaddr.IPv4NetmaskValidationError, - ipaddr.IPv4, '1.2.3.4/254.254.255.256') - - self.assertRaises(ipaddr.IPv6NetmaskValidationError, - ipaddr.IPv6, '::1/') - self.assertRaises(ipaddr.IPv6NetmaskValidationError, - ipaddr.IPv6, '::1/129') - - def test_nth(self): - self.assertEqual(self.ipv4[5], '1.2.3.5') - self.assertRaises(IndexError, self.ipv4.__getitem__, 256) - - self.assertEqual(self.ipv6[5], - '2001:658:22a:cafe::5') - - def test_getitem(self): - # http://code.google.com/p/ipaddr-py/issues/detail?id=15 - addr = ipaddr.IPv4('172.31.255.128/255.255.255.240') - self.assertEqual(28, addr.prefixlen) - addr_list = list(addr) - self.assertEqual('172.31.255.128', addr_list[0]) - self.assertEqual('172.31.255.128', addr[0]) - self.assertEqual('172.31.255.143', addr_list[-1]) - self.assertEqual('172.31.255.143', addr[-1]) - self.assertEqual(addr_list[-1], addr[-1]) - - def test_equals(self): - self.assertTrue(self.ipv4 == ipaddr.IPv4('1.2.3.4/24')) - self.assertFalse(self.ipv4 == ipaddr.IPv4('1.2.3.4/23')) - self.assertFalse(self.ipv4 == ipaddr.IPv4('1.2.3.5/24')) - self.assertFalse(self.ipv4 == ipaddr.IPv6('::1.2.3.4/24')) - self.assertFalse(self.ipv4 == '') - self.assertFalse(self.ipv4 == []) - self.assertFalse(self.ipv4 == 2) - - self.assertTrue(self.ipv6 == - ipaddr.IPv6('2001:658:22a:cafe:200::1/64')) - self.assertFalse(self.ipv6 == - ipaddr.IPv6('2001:658:22a:cafe:200::1/63')) - self.assertFalse(self.ipv6 == - ipaddr.IPv6('2001:658:22a:cafe:200::2/64')) - self.assertFalse(self.ipv6 == ipaddr.IPv4('1.2.3.4/23')) - self.assertFalse(self.ipv6 == '') - self.assertFalse(self.ipv6 == []) - self.assertFalse(self.ipv6 == 2) - - def test_not_equals(self): - self.assertFalse(self.ipv4 != ipaddr.IPv4('1.2.3.4/24')) - self.assertTrue(self.ipv4 != ipaddr.IPv4('1.2.3.4/23')) - self.assertTrue(self.ipv4 != ipaddr.IPv4('1.2.3.5/24')) - self.assertTrue(self.ipv4 != ipaddr.IPv6('::1.2.3.4/24')) - self.assertTrue(self.ipv4 != '') - self.assertTrue(self.ipv4 != []) - self.assertTrue(self.ipv4 != 2) - - self.assertFalse(self.ipv6 != - ipaddr.IPv6('2001:658:22a:cafe:200::1/64')) - self.assertTrue(self.ipv6 != - ipaddr.IPv6('2001:658:22a:cafe:200::1/63')) - self.assertTrue(self.ipv6 != - ipaddr.IPv6('2001:658:22a:cafe:200::2/64')) - self.assertTrue(self.ipv6 != ipaddr.IPv4('1.2.3.4/23')) - self.assertTrue(self.ipv6 != '') - self.assertTrue(self.ipv6 != []) - self.assertTrue(self.ipv6 != 2) - - def test_slash32_constructor(self): - self.assertEquals(str(ipaddr.IPv4('1.2.3.4/255.255.255.255')), - '1.2.3.4/32') - - def test_slash128_constructor(self): - self.assertEquals(str(ipaddr.IPv6('::1/128')), - '::1/128') - - def test_slash0_constructor(self): - self.assertEquals(str(ipaddr.IPv4('1.2.3.4/0.0.0.0')), '1.2.3.4/0') - - def test_collapsing(self): - ip1 = ipaddr.IPv4('1.1.0.0/24') - ip2 = ipaddr.IPv4('1.1.1.0/24') - ip3 = ipaddr.IPv4('1.1.2.0/24') - ip4 = ipaddr.IPv4('1.1.3.0/24') - ip5 = ipaddr.IPv4('1.1.4.0/24') - # stored in no particular order b/c we want CollapseAddr to call [].sort - ip6 = ipaddr.IPv4('1.1.0.0/22') - # check that addreses are subsumed properlly. - collapsed = ipaddr.collapse_address_list([ip1, ip2, ip3, ip4, ip5, ip6]) - self.assertEqual(collapsed, [ipaddr.IPv4('1.1.0.0/22'), - ipaddr.IPv4('1.1.4.0/24')]) - # test that two addresses are supernet'ed properlly - collapsed = ipaddr.collapse_address_list([ip1, ip2]) - self.assertEqual(collapsed, [ipaddr.IPv4('1.1.0.0/23')]) - - ip_same1 = ip_same2 = ipaddr.IPv4('1.1.1.1/32') - self.assertEqual(ipaddr.collapse_address_list([ip_same1, ip_same2]), - [ip_same1]) - ip1 = ipaddr.IPv6('::2001:1/100') - ip2 = ipaddr.IPv6('::2002:1/120') - ip3 = ipaddr.IPv6('::2001:1/96') - # test that ipv6 addresses are subsumed properly. - collapsed = ipaddr.collapse_address_list([ip1, ip2, ip3]) - self.assertEqual(collapsed, [ip3]) - - def test_network_comparison(self): - # ip1 and ip2 have the same network address - ip1 = ipaddr.IPv4('1.1.1.0/24') - ip2 = ipaddr.IPv4('1.1.1.1/24') - ip3 = ipaddr.IPv4('1.1.2.0/24') - - self.assertTrue(ip1 < ip3) - self.assertTrue(ip3 > ip2) - - self.assertEquals(ip1.compare_networks(ip2), 0) - self.assertTrue(ip1._get_networks_key() == ip2._get_networks_key()) - self.assertEquals(ip1.compare_networks(ip3), -1) - self.assertTrue(ip1._get_networks_key() < ip3._get_networks_key()) - - ip1 = ipaddr.IPv6('2001::2000/96') - ip2 = ipaddr.IPv6('2001::2001/96') - ip3 = ipaddr.IPv6('2001:ffff::2000/96') - - self.assertTrue(ip1 < ip3) - self.assertTrue(ip3 > ip2) - self.assertEquals(ip1.compare_networks(ip2), 0) - self.assertTrue(ip1._get_networks_key() == ip2._get_networks_key()) - self.assertEquals(ip1.compare_networks(ip3), -1) - self.assertTrue(ip1._get_networks_key() < ip3._get_networks_key()) - - # Test comparing different protocols - ipv6 = ipaddr.IPv6('::/0') - ipv4 = ipaddr.IPv4('0.0.0.0/0') - self.assertTrue(ipv6 > ipv4) - self.assertTrue(ipv4 < ipv6) - - # Regression test for issue6169 (ipaddr-py issue 19) - ip1 = ipaddr.IP('10.1.2.128/25') - self.assertFalse(ip1 < ip1) - self.assertFalse(ip1 > ip1) - ip2 = ipaddr.IP('10.1.3.0/24') - self.assertTrue(ip1 < ip2) - self.assertFalse(ip2 < ip1) - self.assertFalse(ip1 > ip2) - self.assertTrue(ip2 > ip1) - ip3 = ipaddr.IP('10.1.3.0/25') - self.assertTrue(ip2 < ip3) - self.assertFalse(ip3 < ip2) - self.assertFalse(ip2 > ip3) - self.assertTrue(ip3 > ip2) - - # Confirm that relative comparisons to the wrong type fail properly. - self.assertRaises(TypeError, lambda: ipv4 < '') - self.assertRaises(TypeError, lambda: ipv4 > '') - self.assertRaises(TypeError, lambda: ipv4 >= '') - self.assertRaises(TypeError, lambda: ipv4 <= '') - self.assertRaises(TypeError, lambda: ipv6 < '') - self.assertRaises(TypeError, lambda: ipv6 > '') - self.assertRaises(TypeError, lambda: ipv6 >= '') - self.assertRaises(TypeError, lambda: ipv6 <= '') - - def test_embedded_ipv4(self): - ipv4_string = '192.168.0.1' - ipv4 = ipaddr.IPv4(ipv4_string) - v4compat_ipv6 = ipaddr.IPv6('::%s' % ipv4_string) - self.assertEquals(v4compat_ipv6.ip, ipv4.ip) - v4mapped_ipv6 = ipaddr.IPv6('::ffff:%s' % ipv4_string) - self.assertNotEquals(v4mapped_ipv6.ip, ipv4.ip) - self.assertRaises(ipaddr.IPv6IpValidationError, ipaddr.IPv6, - '2001:1.1.1.1:1.1.1.1') - - def test_ip_version(self): - self.assertEqual(self.ipv4.version, 4) - self.assertEqual(self.ipv6.version, 6) - - def test_packed(self): - self.assertEqual(self.ipv4.packed, - b'\x01\x02\x03\x04') - self.assertEqual(ipaddr.IPv4('255.254.253.252').packed, - b'\xff\xfe\xfd\xfc') - self.assertEqual(self.ipv6.packed, - b'\x20\x01\x06\x58\x02\x2a\xca\xfe' + - b'\x02\x00\x00\x00\x00\x00\x00\x01') - self.assertEqual(ipaddr.IPv6('ffff:2:3:4:ffff::').packed, - b'\xff\xff\x00\x02\x00\x03\x00\x04\xff\xff' - + b'\x00' * 6) - self.assertEqual(ipaddr.IPv6('::1:0:0:0:0').packed, - b'\x00' * 6 + b'\x00\x01' + b'\x00' * 8) - - def test_ip_str_from_prefixlen(self): - ipv4 = ipaddr.IPv4('1.2.3.4/24') - self.assertEquals(ipv4._ip_string_from_prefix(), '255.255.255.0') - self.assertEquals(ipv4._ip_string_from_prefix(28), '255.255.255.240') - - def test_ip_type(self): - ipv4 = ipaddr.IP('1.2.3.4') - ipv6 = ipaddr.IP('::1.2.3.4') - self.assertEquals(ipaddr.IPv4, type(ipv4)) - self.assertEquals(ipaddr.IPv6, type(ipv6)) - - def test_reserved_ipv4(self): - self.assertEquals(True, ipaddr.IP('224.1.1.1/31').is_multicast) - self.assertEquals(False, ipaddr.IP('240.0.0.0').is_multicast) - - self.assertEquals(True, ipaddr.IP('192.168.1.1/17').is_private) - self.assertEquals(False, ipaddr.IP('192.169.0.0').is_private) - self.assertEquals(True, ipaddr.IP('10.255.255.255').is_private) - self.assertEquals(False, ipaddr.IP('11.0.0.0').is_private) - self.assertEquals(True, ipaddr.IP('172.31.255.255').is_private) - self.assertEquals(False, ipaddr.IP('172.32.0.0').is_private) - - self.assertEquals(True, ipaddr.IP('169.254.100.200/24').is_link_local) - self.assertEquals(False, ipaddr.IP('169.255.100.200/24').is_link_local) - - self.assertEquals(True, ipaddr.IP('127.100.200.254/32').is_loopback) - self.assertEquals(True, ipaddr.IP('127.42.0.0/16').is_loopback) - self.assertEquals(False, ipaddr.IP('128.0.0.0').is_loopback) - - def test_reserved_ipv6(self): - ip = ipaddr.IP - - self.assertEquals(True, ip('ffff::').is_multicast) - self.assertEquals(True, ip(2**128-1).is_multicast) - self.assertEquals(True, ip('ff00::').is_multicast) - self.assertEquals(False, ip('fdff::').is_multicast) - - self.assertEquals(True, ip('fecf::').is_site_local) - self.assertEquals(True, ip('feff:ffff:ffff:ffff::').is_site_local) - self.assertEquals(False, ip('fbf:ffff::').is_site_local) - self.assertEquals(False, ip('ff00::').is_site_local) - - self.assertEquals(True, ip('fc00::').is_private) - self.assertEquals(True, ip('fc00:ffff:ffff:ffff::').is_private) - self.assertEquals(False, ip('fbff:ffff::').is_private) - self.assertEquals(False, ip('fe00::').is_private) - - self.assertEquals(True, ip('fea0::').is_link_local) - self.assertEquals(True, ip('febf:ffff::').is_link_local) - self.assertEquals(False, ip('fe7f:ffff::').is_link_local) - self.assertEquals(False, ip('fec0::').is_link_local) - - self.assertEquals(True, ip('0:0::0:01').is_loopback) - self.assertEquals(False, ip('::1/127').is_loopback) - self.assertEquals(False, ip('::').is_loopback) - self.assertEquals(False, ip('::2').is_loopback) - - self.assertEquals(True, ip('0::0').is_unspecified) - self.assertEquals(False, ip('::1').is_unspecified) - self.assertEquals(False, ip('::/127').is_unspecified) - - def test_addr_exclude(self): - addr1 = ipaddr.IP('10.1.1.0/24') - addr2 = ipaddr.IP('10.1.1.0/26') - addr3 = ipaddr.IP('10.2.1.0/24') - self.assertEqual(addr1.address_exclude(addr2), - [ipaddr.IP('10.1.1.64/26'), - ipaddr.IP('10.1.1.128/25')]) - self.assertRaises(ValueError, addr1.address_exclude, addr3) - - def test_hash(self): - self.assertEquals(hash(ipaddr.IP('10.1.1.0/24')), - hash(ipaddr.IP('10.1.1.0/24'))) - dummy = {} - dummy[self.ipv4] = None - dummy[self.ipv6] = None - self.assertTrue(self.ipv4 in dummy) - - def test_ipv4_prefix_from_int(self): - addr1 = ipaddr.IP('10.1.1.0/24') - addr2 = ipaddr.IPv4(addr1.ip) # clone prefix - addr2.prefixlen = addr1.prefixlen - addr3 = ipaddr.IP(123456) - - self.assertEqual(123456, addr3.ip) - self.assertRaises(ipaddr.IPv4NetmaskValidationError, - addr2._set_prefix, -1) - self.assertEqual(addr1, addr2) - self.assertEqual(str(addr1), str(addr2)) - - def test_ipv6_prefix_from_int(self): - addr1 = ipaddr.IP('2001:0658:022a:cafe:0200::1/64') - addr2 = ipaddr.IPv6(addr1.ip) # clone prefix - addr2.prefixlen = addr1.prefixlen - addr3 = ipaddr.IP(123456) - - self.assertEqual(123456, addr3.ip) - self.assertRaises(ipaddr.IPv6NetmaskValidationError, - addr2._set_prefix, -1) - self.assertEqual(addr1, addr2) - self.assertEqual(str(addr1), str(addr2)) - - def test_copy_constructor(self): - addr1 = ipaddr.IP('10.1.1.0/24') - addr2 = ipaddr.IP(addr1) - addr3 = ipaddr.IP('2001:658:22a:cafe:200::1/64') - addr4 = ipaddr.IP(addr3) - - self.assertEqual(addr1, addr2) - self.assertEqual(addr3, addr4) - - def test_compress_ipv6_address(self): - test_addresses = { - '1:2:3:4:5:6:7:8': '1:2:3:4:5:6:7:8/128', - '2001:0:0:4:0:0:0:8': '2001:0:0:4::8/128', - '2001:0:0:4:5:6:7:8': '2001::4:5:6:7:8/128', - '2001:0:3:4:5:6:7:8': '2001:0:3:4:5:6:7:8/128', - '2001:0::3:4:5:6:7:8': '2001:0:3:4:5:6:7:8/128', - '0:0:3:0:0:0:0:ffff': '0:0:3::ffff/128', - '0:0:0:4:0:0:0:ffff': '::4:0:0:0:ffff/128', - '0:0:0:0:5:0:0:ffff': '::5:0:0:ffff/128', - '1:0:0:4:0:0:7:8': '1::4:0:0:7:8/128', - '0:0:0:0:0:0:0:0': '::/128', - '0:0:0:0:0:0:0:0/0': '::/0', - '0:0:0:0:0:0:0:1': '::1/128', - '2001:0658:022a:cafe:0000:0000:0000:0000/66': - '2001:658:22a:cafe::/66', - } - for uncompressed, compressed in test_addresses.items(): - self.assertEquals(compressed, str(ipaddr.IPv6(uncompressed))) - - def test_explode_short_hand_ip_str(self): - addr1 = ipaddr.IPv6('2001::1') - self.assertEqual('2001:0000:0000:0000:0000:0000:0000:0001', - addr1._explode_shorthand_ip_string(addr1.ip_ext)) - - def test_int_representation(self): - self.assertEqual(16909060, int(self.ipv4)) - self.assertEqual(42540616829182469433547762482097946625, int(self.ipv6)) - - def test_hex_representation(self): - self.assertEqual(hex(0x1020304), hex(self.ipv4)) - - self.assertEqual(hex(0x20010658022ACAFE0200000000000001), - hex(self.ipv6)) - - -if __name__ == '__main__': - support.run_unittest(IpaddrUnitTest) - support.run_doctest(ipaddr, True) Modified: python/branches/py3k/Misc/NEWS ============================================================================== --- python/branches/py3k/Misc/NEWS (original) +++ python/branches/py3k/Misc/NEWS Thu Jun 4 20:32:39 2009 @@ -21,6 +21,8 @@ Library ------- +- Removed the ipaddr module. + - Issue #3613: base64.{encode,decode}string are now called base64.{encode,decode}bytes which reflects what type they accept and return. The old names are still there as deprecated aliases. From python-checkins at python.org Thu Jun 4 20:38:50 2009 From: python-checkins at python.org (benjamin.peterson) Date: Thu, 4 Jun 2009 20:38:50 +0200 (CEST) Subject: [Python-checkins] r73231 - sandbox/trunk/2to3/lib2to3/fixes/fix_next.py Message-ID: <20090604183850.A3BE2D428@mail.python.org> Author: benjamin.peterson Date: Thu Jun 4 20:38:50 2009 New Revision: 73231 Log: remove unused variable Modified: sandbox/trunk/2to3/lib2to3/fixes/fix_next.py Modified: sandbox/trunk/2to3/lib2to3/fixes/fix_next.py ============================================================================== --- sandbox/trunk/2to3/lib2to3/fixes/fix_next.py (original) +++ sandbox/trunk/2to3/lib2to3/fixes/fix_next.py Thu Jun 4 20:38:50 2009 @@ -48,7 +48,6 @@ base = results.get("base") attr = results.get("attr") name = results.get("name") - mod = results.get("mod") if base: if self.shadowed_next: From python-checkins at python.org Thu Jun 4 20:59:58 2009 From: python-checkins at python.org (georg.brandl) Date: Thu, 4 Jun 2009 20:59:58 +0200 (CEST) Subject: [Python-checkins] r73232 - python/trunk/Lib/test/test_traceback.py Message-ID: <20090604185958.C1813D555@mail.python.org> Author: georg.brandl Date: Thu Jun 4 20:59:58 2009 New Revision: 73232 Log: Add test for #3684. Modified: python/trunk/Lib/test/test_traceback.py Modified: python/trunk/Lib/test/test_traceback.py ============================================================================== --- python/trunk/Lib/test/test_traceback.py (original) +++ python/trunk/Lib/test/test_traceback.py Thu Jun 4 20:59:58 2009 @@ -24,6 +24,9 @@ def syntax_error_with_caret(self): compile("def fact(x):\n\treturn x!\n", "?", "exec") + def syntax_error_with_caret_2(self): + compile("1 +\n", "?", "exec") + def syntax_error_without_caret(self): # XXX why doesn't compile raise the same traceback? import test.badsyntax_nocaret @@ -39,6 +42,12 @@ self.assert_("^" in err[2]) # third line has caret self.assert_(err[1].find("!") == err[2].find("^")) # in the right place + err = self.get_exception_format(self.syntax_error_with_caret_2, + SyntaxError) + self.assert_("^" in err[2]) # third line has caret + self.assert_(err[2].count('\n') == 1) # and no additional newline + self.assert_(err[1].find("+") == err[2].find("^")) # in the right place + def test_nocaret(self): if is_jython: # jython adds a caret in this case (why shouldn't it?) From python-checkins at python.org Thu Jun 4 21:41:00 2009 From: python-checkins at python.org (georg.brandl) Date: Thu, 4 Jun 2009 21:41:00 +0200 (CEST) Subject: [Python-checkins] r73233 - in python/branches/py3k: Lib/test/test_traceback.py Message-ID: <20090604194100.9E3BDDA29@mail.python.org> Author: georg.brandl Date: Thu Jun 4 21:41:00 2009 New Revision: 73233 Log: Merged revisions 73232 via svnmerge from svn+ssh://pythondev at svn.python.org/python/trunk ........ r73232 | georg.brandl | 2009-06-04 20:59:58 +0200 (Do, 04 Jun 2009) | 1 line Add test for #3684. ........ Modified: python/branches/py3k/ (props changed) python/branches/py3k/Lib/test/test_traceback.py Modified: python/branches/py3k/Lib/test/test_traceback.py ============================================================================== --- python/branches/py3k/Lib/test/test_traceback.py (original) +++ python/branches/py3k/Lib/test/test_traceback.py Thu Jun 4 21:41:00 2009 @@ -26,6 +26,9 @@ def syntax_error_with_caret(self): compile("def fact(x):\n\treturn x!\n", "?", "exec") + def syntax_error_with_caret_2(self): + compile("1 +\n", "?", "exec") + def syntax_error_without_caret(self): # XXX why doesn't compile raise the same traceback? import test.badsyntax_nocaret @@ -41,6 +44,12 @@ self.assert_("^" in err[2]) # third line has caret self.assertEqual(err[1].find("!"), err[2].find("^")) # in the right place + err = self.get_exception_format(self.syntax_error_with_caret_2, + SyntaxError) + self.assert_("^" in err[2]) # third line has caret + self.assert_(err[2].count('\n') == 1) # and no additional newline + self.assert_(err[1].find("+") == err[2].find("^")) # in the right place + def test_nocaret(self): if is_jython: # jython adds a caret in this case (why shouldn't it?) From python-checkins at python.org Thu Jun 4 21:44:37 2009 From: python-checkins at python.org (brett.cannon) Date: Thu, 4 Jun 2009 21:44:37 +0200 (CEST) Subject: [Python-checkins] r73234 - peps/trunk/pep-0263.txt Message-ID: <20090604194437.78443C415@mail.python.org> Author: brett.cannon Date: Thu Jun 4 21:44:37 2009 New Revision: 73234 Log: Fix a minor typo. Modified: peps/trunk/pep-0263.txt Modified: peps/trunk/pep-0263.txt ============================================================================== --- peps/trunk/pep-0263.txt (original) +++ peps/trunk/pep-0263.txt Thu Jun 4 21:44:37 2009 @@ -218,7 +218,7 @@ implementing only phase 1 is available at [1]. Phases - Implemenation of steps 1 and 2 above were completed in 2.3, + Implementation of steps 1 and 2 above were completed in 2.3, except for changing the default encoding to "ascii". The default encoding was set to "ascii" in version 2.5. From python-checkins at python.org Thu Jun 4 22:00:27 2009 From: python-checkins at python.org (tarek.ziade) Date: Thu, 4 Jun 2009 22:00:27 +0200 (CEST) Subject: [Python-checkins] r73235 - peps/branches/jim-update-345/pep-0345.txt Message-ID: <20090604200027.CCA2AD5BA@mail.python.org> Author: tarek.ziade Date: Thu Jun 4 22:00:27 2009 New Revision: 73235 Log: applying Tres patch (PEP 386 references) Modified: peps/branches/jim-update-345/pep-0345.txt Modified: peps/branches/jim-update-345/pep-0345.txt ============================================================================== --- peps/branches/jim-update-345/pep-0345.txt (original) +++ peps/branches/jim-update-345/pep-0345.txt Thu Jun 4 22:00:27 2009 @@ -61,7 +61,7 @@ Version A string containing the package's version number. This - field must be in the format specified in `Version Specifiers`_. + field must be in the format specified in `PEP 386`_. Example:: @@ -294,7 +294,7 @@ A version declaration is a series of conditional operators and version numbers, separated by commas. Conditional operators must be one of "<", ">", "<=", ">=", "==", and "!=". Version - numbers must be in the format specified in `Version Specifiers`_. + numbers must be in the format specified in `PEP 386`_. Any number of conditional operators can be specified, e.g. the string ">1.0, !=1.3.4, <2.0" is a legal version declaration. @@ -328,7 +328,7 @@ A version declaration may be supplied (without a comparison operator); the distribution's version number will be implied if none is specified. Version numbers must be in the format specified in - `Version Specifiers`_. + `PEP 386`_. Examples:: @@ -342,7 +342,7 @@ should not be installed at the same time. Version declarations can be supplied. Version numbers must be in the - format specified in `Version Specifiers`_. + format specified in `PEP 386`_. The most common use of this field will be in case a project name changes, e.g. Gorgon 2.3 gets subsumed into Torqued Python 1.0. @@ -361,7 +361,7 @@ by commas. Conditional operators must be one of "<", ">", "<=", ">=", "==", and "!=". - Version numbers must be in the format specified in `Version Specifiers`_. + Version numbers must be in the format specified in `PEP 386`_. Any number of conditional operators can be specified, e.g. the string ">1.0, !=1.3.4, <2.0" is a legal version declaration. @@ -387,7 +387,7 @@ must be one of "<", ">", "<=", ">=", "==", and "!=". Because they refer to non-Python software releases, version numbers for this field are **not** required to conform to the format - specified in `Version Specifiers`_: they should correspond to the + specified in `PEP 386`_: they should correspond to the version scheme used by the external dependency. Any number of conditional operators can be specified, e.g. @@ -420,7 +420,9 @@ Version Specifiers ================== -(TODO: fill in the ``verlib.py`` specification here). +The specification for distribution version specifiers has been moved to +`PEP 386`_. + External References Registry ============================ @@ -476,6 +478,9 @@ .. _`Python Package Index`: http://pypi.python.org/pypi/ +.. _`PEP 386`: http://svn.python.org/projects/peps/trunk/pep-0386.txt + + Copyright ========= From buildbot at python.org Thu Jun 4 22:14:50 2009 From: buildbot at python.org (buildbot at python.org) Date: Thu, 04 Jun 2009 20:14:50 +0000 Subject: [Python-checkins] buildbot failure in amd64 gentoo 3.x Message-ID: <20090604201450.AE3E3C2C7@mail.python.org> The Buildbot has detected a new failure of amd64 gentoo 3.x. Full details are available at: http://www.python.org/dev/buildbot/all/amd64%20gentoo%203.x/builds/769 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: norwitz-amd64 Build Reason: Build Source Stamp: [branch branches/py3k] HEAD Blamelist: raymond.hettinger BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_mailbox make: *** [buildbottest] Error 1 sincerely, -The Buildbot From python-checkins at python.org Thu Jun 4 22:32:06 2009 From: python-checkins at python.org (antoine.pitrou) Date: Thu, 4 Jun 2009 22:32:06 +0200 (CEST) Subject: [Python-checkins] r73236 - in python/branches/py3k: Doc/library/pickle.rst Lib/_compat_pickle.py Lib/pickle.py Lib/pickletools.py Lib/test/pickletester.py Lib/test/test_pickletools.py Misc/NEWS Modules/_pickle.c Message-ID: <20090604203206.5ECEAC37D@mail.python.org> Author: antoine.pitrou Date: Thu Jun 4 22:32:06 2009 New Revision: 73236 Log: Issue #6137: The pickle module now translates module names when loading or dumping pickles with a 2.x-compatible protocol, in order to make data sharing and migration easier. This behaviour can be disabled using the new `fix_imports` optional argument. Added: python/branches/py3k/Lib/_compat_pickle.py (contents, props changed) Modified: python/branches/py3k/Doc/library/pickle.rst python/branches/py3k/Lib/pickle.py python/branches/py3k/Lib/pickletools.py python/branches/py3k/Lib/test/pickletester.py python/branches/py3k/Lib/test/test_pickletools.py python/branches/py3k/Misc/NEWS python/branches/py3k/Modules/_pickle.c Modified: python/branches/py3k/Doc/library/pickle.rst ============================================================================== --- python/branches/py3k/Doc/library/pickle.rst (original) +++ python/branches/py3k/Doc/library/pickle.rst Thu Jun 4 22:32:06 2009 @@ -141,7 +141,7 @@ The :mod:`pickle` module provides the following functions to make the pickling process more convenient: -.. function:: dump(obj, file[, protocol]) +.. function:: dump(obj, file[, protocol, \*, fix_imports=True]) Write a pickled representation of *obj* to the open file object *file*. This is equivalent to ``Pickler(file, protocol).dump(obj)``. @@ -158,7 +158,11 @@ argument. It can thus be a file object opened for binary writing, a io.BytesIO instance, or any other custom object that meets this interface. -.. function:: dumps(obj[, protocol]) + If *fix_imports* is True and *protocol* is less than 3, pickle will try to + map the new Python 3.x names to the old module names used in Python 2.x, + so that the pickle data stream is readable with Python 2.x. + +.. function:: dumps(obj[, protocol, \*, fix_imports=True]) Return the pickled representation of the object as a :class:`bytes` object, instead of writing it to a file. @@ -171,7 +175,11 @@ supported. The higher the protocol used, the more recent the version of Python needed to read the pickle produced. -.. function:: load(file, [\*, encoding="ASCII", errors="strict"]) + If *fix_imports* is True and *protocol* is less than 3, pickle will try to + map the new Python 3.x names to the old module names used in Python 2.x, + so that the pickle data stream is readable with Python 2.x. + +.. function:: load(file, [\*, fix_imports=True, encoding="ASCII", errors="strict"]) Read a pickled object representation from the open file object *file* and return the reconstituted object hierarchy specified therein. This is @@ -187,11 +195,14 @@ for reading, a BytesIO object, or any other custom object that meets this interface. - Optional keyword arguments are encoding and errors, which are used to decode - 8-bit string instances pickled by Python 2.x. These default to 'ASCII' and - 'strict', respectively. + Optional keyword arguments are *fix_imports*, *encoding* and *errors*, + which are used to control compatiblity support for pickle stream generated + by Python 2.x. If *fix_imports* is True, pickle will try to map the old + Python 2.x names to the new names used in Python 3.x. The *encoding* and + *errors* tell pickle how to decode 8-bit string instances pickled by Python + 2.x; these default to 'ASCII' and 'strict', respectively. -.. function:: loads(bytes_object, [\*, encoding="ASCII", errors="strict"]) +.. function:: loads(bytes_object, [\*, fix_imports=True, encoding="ASCII", errors="strict"]) Read a pickled object hierarchy from a :class:`bytes` object and return the reconstituted object hierarchy specified therein @@ -200,9 +211,12 @@ argument is needed. Bytes past the pickled object's representation are ignored. - Optional keyword arguments are encoding and errors, which are used to decode - 8-bit string instances pickled by Python 2.x. These default to 'ASCII' and - 'strict', respectively. + Optional keyword arguments are *fix_imports*, *encoding* and *errors*, + which are used to control compatiblity support for pickle stream generated + by Python 2.x. If *fix_imports* is True, pickle will try to map the old + Python 2.x names to the new names used in Python 3.x. The *encoding* and + *errors* tell pickle how to decode 8-bit string instances pickled by Python + 2.x; these default to 'ASCII' and 'strict', respectively. The :mod:`pickle` module defines three exceptions: @@ -233,7 +247,7 @@ The :mod:`pickle` module exports two classes, :class:`Pickler` and :class:`Unpickler`: -.. class:: Pickler(file[, protocol]) +.. class:: Pickler(file[, protocol, \*, fix_imports=True]) This takes a binary file for writing a pickle data stream. @@ -249,6 +263,10 @@ argument. It can thus be a file object opened for binary writing, a io.BytesIO instance, or any other custom object that meets this interface. + If *fix_imports* is True and *protocol* is less than 3, pickle will try to + map the new Python 3.x names to the old module names used in Python 2.x, + so that the pickle data stream is readable with Python 2.x. + .. method:: dump(obj) Write a pickled representation of *obj* to the open file object given in @@ -277,7 +295,7 @@ Use :func:`pickletools.optimize` if you need more compact pickles. -.. class:: Unpickler(file, [\*, encoding="ASCII", errors="strict"]) +.. class:: Unpickler(file, [\*, fix_imports=True, encoding="ASCII", errors="strict"]) This takes a binary file for reading a pickle data stream. @@ -290,9 +308,12 @@ for reading, a BytesIO object, or any other custom object that meets this interface. - Optional keyword arguments are encoding and errors, which are used to decode - 8-bit string instances pickled by Python 2.x. These default to 'ASCII' and - 'strict', respectively. + Optional keyword arguments are *fix_imports*, *encoding* and *errors*, + which are used to control compatiblity support for pickle stream generated + by Python 2.x. If *fix_imports* is True, pickle will try to map the old + Python 2.x names to the new names used in Python 3.x. The *encoding* and + *errors* tell pickle how to decode 8-bit string instances pickled by Python + 2.x; these default to 'ASCII' and 'strict', respectively. .. method:: load() Added: python/branches/py3k/Lib/_compat_pickle.py ============================================================================== --- (empty file) +++ python/branches/py3k/Lib/_compat_pickle.py Thu Jun 4 22:32:06 2009 @@ -0,0 +1,81 @@ +# This module is used to map the old Python 2 names to the new names used in +# Python 3 for the pickle module. This needed to make pickle streams +# generated with Python 2 loadable by Python 3. + +# This is a copy of lib2to3.fixes.fix_imports.MAPPING. We cannot import +# lib2to3 and use the mapping defined there, because lib2to3 uses pickle. +# Thus, this could cause the module to be imported recursively. +IMPORT_MAPPING = { + 'StringIO': 'io', + 'cStringIO': 'io', + 'cPickle': 'pickle', + '__builtin__' : 'builtins', + 'copy_reg': 'copyreg', + 'Queue': 'queue', + 'SocketServer': 'socketserver', + 'ConfigParser': 'configparser', + 'repr': 'reprlib', + 'FileDialog': 'tkinter.filedialog', + 'tkFileDialog': 'tkinter.filedialog', + 'SimpleDialog': 'tkinter.simpledialog', + 'tkSimpleDialog': 'tkinter.simpledialog', + 'tkColorChooser': 'tkinter.colorchooser', + 'tkCommonDialog': 'tkinter.commondialog', + 'Dialog': 'tkinter.dialog', + 'Tkdnd': 'tkinter.dnd', + 'tkFont': 'tkinter.font', + 'tkMessageBox': 'tkinter.messagebox', + 'ScrolledText': 'tkinter.scrolledtext', + 'Tkconstants': 'tkinter.constants', + 'Tix': 'tkinter.tix', + 'ttk': 'tkinter.ttk', + 'Tkinter': 'tkinter', + 'markupbase': '_markupbase', + '_winreg': 'winreg', + 'thread': '_thread', + 'dummy_thread': '_dummy_thread', + 'dbhash': 'dbm.bsd', + 'dumbdbm': 'dbm.dumb', + 'dbm': 'dbm.ndbm', + 'gdbm': 'dbm.gnu', + 'xmlrpclib': 'xmlrpc.client', + 'DocXMLRPCServer': 'xmlrpc.server', + 'SimpleXMLRPCServer': 'xmlrpc.server', + 'httplib': 'http.client', + 'htmlentitydefs' : 'html.entities', + 'HTMLParser' : 'html.parser', + 'Cookie': 'http.cookies', + 'cookielib': 'http.cookiejar', + 'BaseHTTPServer': 'http.server', + 'SimpleHTTPServer': 'http.server', + 'CGIHTTPServer': 'http.server', + 'test.test_support': 'test.support', + 'commands': 'subprocess', + 'UserString' : 'collections', + 'UserList' : 'collections', + 'urlparse' : 'urllib.parse', + 'robotparser' : 'urllib.robotparser', + 'whichdb': 'dbm', + 'anydbm': 'dbm' +} + + +# This contains rename rules that are easy to handle. We ignore the more +# complex stuff (e.g. mapping the names in the urllib and types modules). +# These rules should be run before import names are fixed. +NAME_MAPPING = { + ('__builtin__', 'xrange'): ('builtins', 'range'), + ('__builtin__', 'reduce'): ('functools', 'reduce'), + ('__builtin__', 'intern'): ('sys', 'intern'), + ('__builtin__', 'unichr'): ('builtins', 'chr'), + ('__builtin__', 'basestring'): ('builtins', 'str'), + ('__builtin__', 'long'): ('builtins', 'int'), + ('itertools', 'izip'): ('builtins', 'zip'), + ('itertools', 'imap'): ('builtins', 'map'), + ('itertools', 'ifilter'): ('builtins', 'filter'), + ('itertools', 'ifilterfalse'): ('itertools', 'filterfalse'), +} + +# Same, but for 3.x to 2.x +REVERSE_IMPORT_MAPPING = dict((v, k) for (k, v) in IMPORT_MAPPING.items()) +REVERSE_NAME_MAPPING = dict((v, k) for (k, v) in NAME_MAPPING.items()) Modified: python/branches/py3k/Lib/pickle.py ============================================================================== --- python/branches/py3k/Lib/pickle.py (original) +++ python/branches/py3k/Lib/pickle.py Thu Jun 4 22:32:06 2009 @@ -34,6 +34,7 @@ import re import io import codecs +import _compat_pickle __all__ = ["PickleError", "PicklingError", "UnpicklingError", "Pickler", "Unpickler", "dump", "dumps", "load", "loads"] @@ -171,12 +172,11 @@ __all__.extend([x for x in dir() if re.match("[A-Z][A-Z0-9_]+$",x)]) - # Pickling machinery class _Pickler: - def __init__(self, file, protocol=None): + def __init__(self, file, protocol=None, *, fix_imports=True): """This takes a binary file for writing a pickle data stream. The optional protocol argument tells the pickler to use the @@ -193,6 +193,10 @@ bytes argument. It can thus be a file object opened for binary writing, a io.BytesIO instance, or any other custom object that meets this interface. + + If fix_imports is True and protocol is less than 3, pickle will try to + map the new Python 3.x names to the old module names used in Python + 2.x, so that the pickle data stream is readable with Python 2.x. """ if protocol is None: protocol = DEFAULT_PROTOCOL @@ -208,6 +212,7 @@ self.proto = int(protocol) self.bin = protocol >= 1 self.fast = 0 + self.fix_imports = fix_imports and protocol < 3 def clear_memo(self): """Clears the pickler's "memo". @@ -698,6 +703,11 @@ write(GLOBAL + bytes(module, "utf-8") + b'\n' + bytes(name, "utf-8") + b'\n') else: + if self.fix_imports: + if (module, name) in _compat_pickle.REVERSE_NAME_MAPPING: + module, name = _compat_pickle.REVERSE_NAME_MAPPING[(module, name)] + if module in _compat_pickle.REVERSE_IMPORT_MAPPING: + module = _compat_pickle.REVERSE_IMPORT_MAPPING[module] try: write(GLOBAL + bytes(module, "ascii") + b'\n' + bytes(name, "ascii") + b'\n') @@ -766,7 +776,8 @@ class _Unpickler: - def __init__(self, file, *, encoding="ASCII", errors="strict"): + def __init__(self, file, *, fix_imports=True, + encoding="ASCII", errors="strict"): """This takes a binary file for reading a pickle data stream. The protocol version of the pickle is detected automatically, so no @@ -779,15 +790,21 @@ reading, a BytesIO object, or any other custom object that meets this interface. - Optional keyword arguments are encoding and errors, which are - used to decode 8-bit string instances pickled by Python 2.x. - These default to 'ASCII' and 'strict', respectively. + Optional keyword arguments are *fix_imports*, *encoding* and *errors*, + which are used to control compatiblity support for pickle stream + generated by Python 2.x. If *fix_imports* is True, pickle will try to + map the old Python 2.x names to the new names used in Python 3.x. The + *encoding* and *errors* tell pickle how to decode 8-bit string + instances pickled by Python 2.x; these default to 'ASCII' and + 'strict', respectively. """ self.readline = file.readline self.read = file.read self.memo = {} self.encoding = encoding self.errors = errors + self.proto = 0 + self.fix_imports = fix_imports def load(self): """Read a pickled object representation from the open file. @@ -838,6 +855,7 @@ proto = ord(self.read(1)) if not 0 <= proto <= HIGHEST_PROTOCOL: raise ValueError("unsupported pickle protocol: %d" % proto) + self.proto = proto dispatch[PROTO[0]] = load_proto def load_persid(self): @@ -1088,7 +1106,12 @@ self.append(obj) def find_class(self, module, name): - # Subclasses may override this + # Subclasses may override this. + if self.proto < 3 and self.fix_imports: + if (module, name) in _compat_pickle.NAME_MAPPING: + module, name = _compat_pickle.NAME_MAPPING[(module, name)] + if module in _compat_pickle.IMPORT_MAPPING: + module = _compat_pickle.IMPORT_MAPPING[module] __import__(module, level=0) mod = sys.modules[module] klass = getattr(mod, name) @@ -1327,27 +1350,28 @@ # Shorthands -def dump(obj, file, protocol=None): - Pickler(file, protocol).dump(obj) +def dump(obj, file, protocol=None, *, fix_imports=True): + Pickler(file, protocol, fix_imports=fix_imports).dump(obj) -def dumps(obj, protocol=None): +def dumps(obj, protocol=None, *, fix_imports=True): f = io.BytesIO() - Pickler(f, protocol).dump(obj) + Pickler(f, protocol, fix_imports=fix_imports).dump(obj) res = f.getvalue() assert isinstance(res, bytes_types) return res -def load(file, *, encoding="ASCII", errors="strict"): - return Unpickler(file, encoding=encoding, errors=errors).load() +def load(file, *, fix_imports=True, encoding="ASCII", errors="strict"): + return Unpickler(file, fix_imports=fix_imports, + encoding=encoding, errors=errors).load() -def loads(s, *, encoding="ASCII", errors="strict"): +def loads(s, *, fix_imports=True, encoding="ASCII", errors="strict"): if isinstance(s, str): raise TypeError("Can't load pickle from unicode string") file = io.BytesIO(s) - return Unpickler(file, encoding=encoding, errors=errors).load() + return Unpickler(file, fix_imports=fix_imports, + encoding=encoding, errors=errors).load() # Doctest - def _test(): import doctest return doctest.testmod() Modified: python/branches/py3k/Lib/pickletools.py ============================================================================== --- python/branches/py3k/Lib/pickletools.py (original) +++ python/branches/py3k/Lib/pickletools.py Thu Jun 4 22:32:06 2009 @@ -2066,27 +2066,27 @@ 29: ( MARK 30: d DICT (MARK at 29) 31: p PUT 2 - 34: c GLOBAL 'builtins bytes' - 50: p PUT 3 - 53: ( MARK - 54: ( MARK - 55: l LIST (MARK at 54) - 56: p PUT 4 - 59: L LONG 97 - 64: a APPEND - 65: L LONG 98 - 70: a APPEND - 71: L LONG 99 - 76: a APPEND - 77: t TUPLE (MARK at 53) - 78: p PUT 5 - 81: R REDUCE - 82: p PUT 6 - 85: V UNICODE 'def' - 90: p PUT 7 - 93: s SETITEM - 94: a APPEND - 95: . STOP + 34: c GLOBAL '__builtin__ bytes' + 53: p PUT 3 + 56: ( MARK + 57: ( MARK + 58: l LIST (MARK at 57) + 59: p PUT 4 + 62: L LONG 97 + 67: a APPEND + 68: L LONG 98 + 73: a APPEND + 74: L LONG 99 + 79: a APPEND + 80: t TUPLE (MARK at 56) + 81: p PUT 5 + 84: R REDUCE + 85: p PUT 6 + 88: V UNICODE 'def' + 93: p PUT 7 + 96: s SETITEM + 97: a APPEND + 98: . STOP highest protocol among opcodes = 0 Try again with a "binary" pickle. @@ -2105,25 +2105,25 @@ 14: q BINPUT 1 16: } EMPTY_DICT 17: q BINPUT 2 - 19: c GLOBAL 'builtins bytes' - 35: q BINPUT 3 - 37: ( MARK - 38: ] EMPTY_LIST - 39: q BINPUT 4 - 41: ( MARK - 42: K BININT1 97 - 44: K BININT1 98 - 46: K BININT1 99 - 48: e APPENDS (MARK at 41) - 49: t TUPLE (MARK at 37) - 50: q BINPUT 5 - 52: R REDUCE - 53: q BINPUT 6 - 55: X BINUNICODE 'def' - 63: q BINPUT 7 - 65: s SETITEM - 66: e APPENDS (MARK at 3) - 67: . STOP + 19: c GLOBAL '__builtin__ bytes' + 38: q BINPUT 3 + 40: ( MARK + 41: ] EMPTY_LIST + 42: q BINPUT 4 + 44: ( MARK + 45: K BININT1 97 + 47: K BININT1 98 + 49: K BININT1 99 + 51: e APPENDS (MARK at 44) + 52: t TUPLE (MARK at 40) + 53: q BINPUT 5 + 55: R REDUCE + 56: q BINPUT 6 + 58: X BINUNICODE 'def' + 66: q BINPUT 7 + 68: s SETITEM + 69: e APPENDS (MARK at 3) + 70: . STOP highest protocol among opcodes = 1 Exercise the INST/OBJ/BUILD family. @@ -2141,58 +2141,58 @@ 0: ( MARK 1: l LIST (MARK at 0) 2: p PUT 0 - 5: c GLOBAL 'copyreg _reconstructor' - 29: p PUT 1 - 32: ( MARK - 33: c GLOBAL 'pickletools _Example' - 55: p PUT 2 - 58: c GLOBAL 'builtins object' - 75: p PUT 3 - 78: N NONE - 79: t TUPLE (MARK at 32) - 80: p PUT 4 - 83: R REDUCE - 84: p PUT 5 - 87: ( MARK - 88: d DICT (MARK at 87) - 89: p PUT 6 - 92: V UNICODE 'value' - 99: p PUT 7 - 102: L LONG 42 - 107: s SETITEM - 108: b BUILD - 109: a APPEND - 110: g GET 5 + 5: c GLOBAL 'copy_reg _reconstructor' + 30: p PUT 1 + 33: ( MARK + 34: c GLOBAL 'pickletools _Example' + 56: p PUT 2 + 59: c GLOBAL '__builtin__ object' + 79: p PUT 3 + 82: N NONE + 83: t TUPLE (MARK at 33) + 84: p PUT 4 + 87: R REDUCE + 88: p PUT 5 + 91: ( MARK + 92: d DICT (MARK at 91) + 93: p PUT 6 + 96: V UNICODE 'value' + 103: p PUT 7 + 106: L LONG 42 + 111: s SETITEM + 112: b BUILD 113: a APPEND - 114: . STOP + 114: g GET 5 + 117: a APPEND + 118: . STOP highest protocol among opcodes = 0 >>> dis(pickle.dumps(x, 1)) 0: ] EMPTY_LIST 1: q BINPUT 0 3: ( MARK - 4: c GLOBAL 'copyreg _reconstructor' - 28: q BINPUT 1 - 30: ( MARK - 31: c GLOBAL 'pickletools _Example' - 53: q BINPUT 2 - 55: c GLOBAL 'builtins object' - 72: q BINPUT 3 - 74: N NONE - 75: t TUPLE (MARK at 30) - 76: q BINPUT 4 - 78: R REDUCE - 79: q BINPUT 5 - 81: } EMPTY_DICT - 82: q BINPUT 6 - 84: X BINUNICODE 'value' - 94: q BINPUT 7 - 96: K BININT1 42 - 98: s SETITEM - 99: b BUILD - 100: h BINGET 5 - 102: e APPENDS (MARK at 3) - 103: . STOP + 4: c GLOBAL 'copy_reg _reconstructor' + 29: q BINPUT 1 + 31: ( MARK + 32: c GLOBAL 'pickletools _Example' + 54: q BINPUT 2 + 56: c GLOBAL '__builtin__ object' + 76: q BINPUT 3 + 78: N NONE + 79: t TUPLE (MARK at 31) + 80: q BINPUT 4 + 82: R REDUCE + 83: q BINPUT 5 + 85: } EMPTY_DICT + 86: q BINPUT 6 + 88: X BINUNICODE 'value' + 98: q BINPUT 7 + 100: K BININT1 42 + 102: s SETITEM + 103: b BUILD + 104: h BINGET 5 + 106: e APPENDS (MARK at 3) + 107: . STOP highest protocol among opcodes = 1 Try "the canonical" recursive-object test. Modified: python/branches/py3k/Lib/test/pickletester.py ============================================================================== --- python/branches/py3k/Lib/test/pickletester.py (original) +++ python/branches/py3k/Lib/test/pickletester.py Thu Jun 4 22:32:06 2009 @@ -3,6 +3,7 @@ import pickle import pickletools import copyreg +from http.cookies import SimpleCookie from test.support import TestFailed, TESTFN, run_with_locale @@ -342,6 +343,24 @@ highest protocol among opcodes = 2 """ +# set([1,2]) pickled from 2.x with protocol 2 +DATA3 = b'\x80\x02c__builtin__\nset\nq\x00]q\x01(K\x01K\x02e\x85q\x02Rq\x03.' + +# xrange(5) pickled from 2.x with protocol 2 +DATA4 = b'\x80\x02c__builtin__\nxrange\nq\x00K\x00K\x05K\x01\x87q\x01Rq\x02.' + +# a SimpleCookie() object pickled from 2.x with protocol 2 +DATA5 = (b'\x80\x02cCookie\nSimpleCookie\nq\x00)\x81q\x01U\x03key' + b'q\x02cCookie\nMorsel\nq\x03)\x81q\x04(U\x07commentq\x05U' + b'\x00q\x06U\x06domainq\x07h\x06U\x06secureq\x08h\x06U\x07' + b'expiresq\th\x06U\x07max-ageq\nh\x06U\x07versionq\x0bh\x06U' + b'\x04pathq\x0ch\x06U\x08httponlyq\rh\x06u}q\x0e(U\x0b' + b'coded_valueq\x0fU\x05valueq\x10h\x10h\x10h\x02h\x02ubs}q\x11b.') + +# set([3]) pickled from 2.x with protocol 2 +DATA6 = b'\x80\x02c__builtin__\nset\nq\x00]q\x01K\x03a\x85q\x02Rq\x03.' + + def create_data(): c = C() c.foo = 1 @@ -956,6 +975,29 @@ for x_key, y_key in zip(x_keys, y_keys): self.assertIs(x_key, y_key) + def test_unpickle_from_2x(self): + # Unpickle non-trivial data from Python 2.x. + loaded = self.loads(DATA3) + self.assertEqual(loaded, set([1, 2])) + loaded = self.loads(DATA4) + self.assertEqual(type(loaded), type(range(0))) + self.assertEqual(list(loaded), list(range(5))) + loaded = self.loads(DATA5) + self.assertEqual(type(loaded), SimpleCookie) + self.assertEqual(list(loaded.keys()), ["key"]) + self.assertEqual(loaded["key"].value, "Set-Cookie: key=value") + + def test_pickle_to_2x(self): + # Pickle non-trivial data with protocol 2, expecting that it yields + # the same result as Python 2.x did. + # NOTE: this test is a bit too strong since we can produce different + # bytecode that 2.x will still understand. + dumped = self.dumps(range(5), 2) + self.assertEqual(dumped, DATA4) + dumped = self.dumps(set([3]), 2) + self.assertEqual(dumped, DATA6) + + # Test classes for reduce_ex class REX_one(object): Modified: python/branches/py3k/Lib/test/test_pickletools.py ============================================================================== --- python/branches/py3k/Lib/test/test_pickletools.py (original) +++ python/branches/py3k/Lib/test/test_pickletools.py Thu Jun 4 22:32:06 2009 @@ -12,6 +12,9 @@ def loads(self, buf): return pickle.loads(buf) + # Test relies on precise output of dumps() + test_pickle_to_2x = None + def test_main(): support.run_unittest(OptimizedPickleTests) Modified: python/branches/py3k/Misc/NEWS ============================================================================== --- python/branches/py3k/Misc/NEWS (original) +++ python/branches/py3k/Misc/NEWS Thu Jun 4 22:32:06 2009 @@ -21,6 +21,11 @@ Library ------- +- Issue #6137: The pickle module now translates module names when loading + or dumping pickles with a 2.x-compatible protocol, in order to make data + sharing and migration easier. This behaviour can be disabled using the + new `fix_imports` optional argument. + - Removed the ipaddr module. - Issue #3613: base64.{encode,decode}string are now called Modified: python/branches/py3k/Modules/_pickle.c ============================================================================== --- python/branches/py3k/Modules/_pickle.c (original) +++ python/branches/py3k/Modules/_pickle.c Thu Jun 4 22:32:06 2009 @@ -103,25 +103,33 @@ /* Exception classes for pickle. These should override the ones defined in pickle.py, when the C-optimized Pickler and Unpickler are used. */ -static PyObject *PickleError; -static PyObject *PicklingError; -static PyObject *UnpicklingError; +static PyObject *PickleError = NULL; +static PyObject *PicklingError = NULL; +static PyObject *UnpicklingError = NULL; /* copyreg.dispatch_table, {type_object: pickling_function} */ -static PyObject *dispatch_table; +static PyObject *dispatch_table = NULL; /* For EXT[124] opcodes. */ /* copyreg._extension_registry, {(module_name, function_name): code} */ -static PyObject *extension_registry; +static PyObject *extension_registry = NULL; /* copyreg._inverted_registry, {code: (module_name, function_name)} */ -static PyObject *inverted_registry; +static PyObject *inverted_registry = NULL; /* copyreg._extension_cache, {code: object} */ -static PyObject *extension_cache; +static PyObject *extension_cache = NULL; + +/* _compat_pickle.NAME_MAPPING, {(oldmodule, oldname): (newmodule, newname)} */ +static PyObject *name_mapping_2to3 = NULL; +/* _compat_pickle.IMPORT_MAPPING, {oldmodule: newmodule} */ +static PyObject *import_mapping_2to3 = NULL; +/* Same, but with REVERSE_NAME_MAPPING / REVERSE_IMPORT_MAPPING */ +static PyObject *name_mapping_3to2 = NULL; +static PyObject *import_mapping_3to2 = NULL; /* XXX: Are these really nescessary? */ /* As the name says, an empty tuple. */ -static PyObject *empty_tuple; +static PyObject *empty_tuple = NULL; /* For looking up name pairs in copyreg._extension_registry. */ -static PyObject *two_tuple; +static PyObject *two_tuple = NULL; static int stack_underflow(void) @@ -315,6 +323,8 @@ should not be used if with self-referential objects. */ int fast_nesting; + int fix_imports; /* Indicate whether Pickler should fix + the name of globals for Python 2.x. */ PyObject *fast_memo; } PicklerObject; @@ -340,6 +350,9 @@ objects. */ Py_ssize_t num_marks; /* Number of marks in the mark stack. */ Py_ssize_t marks_size; /* Current allocated size of the mark stack. */ + int proto; /* Protocol of the pickle loaded. */ + int fix_imports; /* Indicate whether Unpickler should fix + the name of globals pickled by Python 2.x. */ } UnpicklerObject; /* Forward declarations */ @@ -1972,6 +1985,63 @@ unicode_encoder = PyUnicode_AsASCIIString; } + /* For protocol < 3 and if the user didn't request against doing so, + we convert module names to the old 2.x module names. */ + if (self->fix_imports) { + PyObject *key; + PyObject *item; + + key = PyTuple_Pack(2, module_name, global_name); + if (key == NULL) + goto error; + item = PyDict_GetItemWithError(name_mapping_3to2, key); + Py_DECREF(key); + if (item) { + if (!PyTuple_Check(item) || PyTuple_GET_SIZE(item) != 2) { + PyErr_Format(PyExc_RuntimeError, + "_compat_pickle.REVERSE_NAME_MAPPING values " + "should be 2-tuples, not %.200s", + Py_TYPE(item)->tp_name); + goto error; + } + Py_CLEAR(module_name); + Py_CLEAR(global_name); + module_name = PyTuple_GET_ITEM(item, 0); + global_name = PyTuple_GET_ITEM(item, 1); + if (!PyUnicode_Check(module_name) || + !PyUnicode_Check(global_name)) { + PyErr_Format(PyExc_RuntimeError, + "_compat_pickle.REVERSE_NAME_MAPPING values " + "should be pairs of str, not (%.200s, %.200s)", + Py_TYPE(module_name)->tp_name, + Py_TYPE(global_name)->tp_name); + goto error; + } + Py_INCREF(module_name); + Py_INCREF(global_name); + } + else if (PyErr_Occurred()) { + goto error; + } + + item = PyDict_GetItemWithError(import_mapping_3to2, module_name); + if (item) { + if (!PyUnicode_Check(item)) { + PyErr_Format(PyExc_RuntimeError, + "_compat_pickle.REVERSE_IMPORT_MAPPING values " + "should be strings, not %.200s", + Py_TYPE(item)->tp_name); + goto error; + } + Py_CLEAR(module_name); + module_name = item; + Py_INCREF(module_name); + } + else if (PyErr_Occurred()) { + goto error; + } + } + /* Save the name of the module. */ encoded = unicode_encoder(module_name); if (encoded == NULL) { @@ -2608,18 +2678,23 @@ "The file argument must have a write() method that accepts a single\n" "bytes argument. It can thus be a file object opened for binary\n" "writing, a io.BytesIO instance, or any other custom object that\n" -"meets this interface.\n"); +"meets this interface.\n" +"\n" +"If fix_imports is True and protocol is less than 3, pickle will try to\n" +"map the new Python 3.x names to the old module names used in Python\n" +"2.x, so that the pickle data stream is readable with Python 2.x.\n"); static int Pickler_init(PicklerObject *self, PyObject *args, PyObject *kwds) { - static char *kwlist[] = {"file", "protocol", 0}; + static char *kwlist[] = {"file", "protocol", "fix_imports", 0}; PyObject *file; PyObject *proto_obj = NULL; long proto = 0; + int fix_imports = 1; - if (!PyArg_ParseTupleAndKeywords(args, kwds, "O|O:Pickler", - kwlist, &file, &proto_obj)) + if (!PyArg_ParseTupleAndKeywords(args, kwds, "O|Oi:Pickler", + kwlist, &file, &proto_obj, &fix_imports)) return -1; /* In case of multiple __init__() calls, clear previous content. */ @@ -2628,8 +2703,11 @@ if (proto_obj == NULL || proto_obj == Py_None) proto = DEFAULT_PROTOCOL; - else + else { proto = PyLong_AsLong(proto_obj); + if (proto == -1 && PyErr_Occurred()) + return -1; + } if (proto < 0) proto = HIGHEST_PROTOCOL; @@ -2639,12 +2717,13 @@ return -1; } - self->proto = proto; - self->bin = proto > 0; - self->arg = NULL; - self->fast = 0; - self->fast_nesting = 0; - self->fast_memo = NULL; + self->proto = proto; + self->bin = proto > 0; + self->arg = NULL; + self->fast = 0; + self->fast_nesting = 0; + self->fast_memo = NULL; + self->fix_imports = fix_imports && proto < 3; if (!PyObject_HasAttrString(file, "write")) { PyErr_SetString(PyExc_TypeError, @@ -4220,8 +4299,10 @@ return -1; i = (unsigned char)s[0]; - if (i <= HIGHEST_PROTOCOL) + if (i <= HIGHEST_PROTOCOL) { + self->proto = i; return 0; + } PyErr_Format(PyExc_ValueError, "unsupported pickle protocol: %d", i); return -1; @@ -4383,12 +4464,67 @@ &module_name, &global_name)) return NULL; + /* Try to map the old names used in Python 2.x to the new ones used in + Python 3.x. We do this only with old pickle protocols and when the + user has not disabled the feature. */ + if (self->proto < 3 && self->fix_imports) { + PyObject *key; + PyObject *item; + + /* Check if the global (i.e., a function or a class) was renamed + or moved to another module. */ + key = PyTuple_Pack(2, module_name, global_name); + if (key == NULL) + return NULL; + item = PyDict_GetItemWithError(name_mapping_2to3, key); + Py_DECREF(key); + if (item) { + if (!PyTuple_Check(item) || PyTuple_GET_SIZE(item) != 2) { + PyErr_Format(PyExc_RuntimeError, + "_compat_pickle.NAME_MAPPING values should be " + "2-tuples, not %.200s", Py_TYPE(item)->tp_name); + return NULL; + } + module_name = PyTuple_GET_ITEM(item, 0); + global_name = PyTuple_GET_ITEM(item, 1); + if (!PyUnicode_Check(module_name) || + !PyUnicode_Check(global_name)) { + PyErr_Format(PyExc_RuntimeError, + "_compat_pickle.NAME_MAPPING values should be " + "pairs of str, not (%.200s, %.200s)", + Py_TYPE(module_name)->tp_name, + Py_TYPE(global_name)->tp_name); + return NULL; + } + } + else if (PyErr_Occurred()) { + return NULL; + } + + /* Check if the module was renamed. */ + item = PyDict_GetItemWithError(import_mapping_2to3, module_name); + if (item) { + if (!PyUnicode_Check(item)) { + PyErr_Format(PyExc_RuntimeError, + "_compat_pickle.IMPORT_MAPPING values should be " + "strings, not %.200s", Py_TYPE(item)->tp_name); + return NULL; + } + module_name = item; + } + else if (PyErr_Occurred()) { + return NULL; + } + } + modules_dict = PySys_GetObject("modules"); if (modules_dict == NULL) return NULL; - module = PyDict_GetItem(modules_dict, module_name); + module = PyDict_GetItemWithError(modules_dict, module_name); if (module == NULL) { + if (PyErr_Occurred()) + return NULL; module = PyImport_Import(module_name); if (module == NULL) return NULL; @@ -4477,15 +4613,20 @@ "reading, a BytesIO object, or any other custom object that\n" "meets this interface.\n" "\n" -"Optional keyword arguments are encoding and errors, which are\n" -"used to decode 8-bit string instances pickled by Python 2.x.\n" -"These default to 'ASCII' and 'strict', respectively.\n"); +"Optional keyword arguments are *fix_imports*, *encoding* and *errors*,\n" +"which are used to control compatiblity support for pickle stream\n" +"generated by Python 2.x. If *fix_imports* is True, pickle will try to\n" +"map the old Python 2.x names to the new names used in Python 3.x. The\n" +"*encoding* and *errors* tell pickle how to decode 8-bit string\n" +"instances pickled by Python 2.x; these default to 'ASCII' and\n" +"'strict', respectively.\n"); static int Unpickler_init(UnpicklerObject *self, PyObject *args, PyObject *kwds) { - static char *kwlist[] = {"file", "encoding", "errors", 0}; + static char *kwlist[] = {"file", "fix_imports", "encoding", "errors", 0}; PyObject *file; + int fix_imports = 1; char *encoding = NULL; char *errors = NULL; @@ -4504,8 +4645,8 @@ extra careful in the other Unpickler methods, since a subclass could forget to call Unpickler.__init__() thus breaking our internal invariants. */ - if (!PyArg_ParseTupleAndKeywords(args, kwds, "O|ss:Unpickler", kwlist, - &file, &encoding, &errors)) + if (!PyArg_ParseTupleAndKeywords(args, kwds, "O|iss:Unpickler", kwlist, + &file, &fix_imports, &encoding, &errors)) return -1; /* In case of multiple __init__() calls, clear previous content. */ @@ -4549,6 +4690,8 @@ self->last_string = NULL; self->arg = NULL; + self->proto = 0; + self->fix_imports = fix_imports; return 0; } @@ -4672,40 +4815,85 @@ }; static int -init_stuff(void) +initmodule(void) { - PyObject *copyreg; + PyObject *copyreg = NULL; + PyObject *compat_pickle = NULL; + + /* XXX: We should ensure that the types of the dictionaries imported are + exactly PyDict objects. Otherwise, it is possible to crash the pickle + since we use the PyDict API directly to access these dictionaries. */ copyreg = PyImport_ImportModule("copyreg"); if (!copyreg) - return -1; - + goto error; dispatch_table = PyObject_GetAttrString(copyreg, "dispatch_table"); if (!dispatch_table) goto error; - extension_registry = \ PyObject_GetAttrString(copyreg, "_extension_registry"); if (!extension_registry) goto error; - inverted_registry = PyObject_GetAttrString(copyreg, "_inverted_registry"); if (!inverted_registry) goto error; - extension_cache = PyObject_GetAttrString(copyreg, "_extension_cache"); if (!extension_cache) goto error; + Py_CLEAR(copyreg); - Py_DECREF(copyreg); + /* Load the 2.x -> 3.x stdlib module mapping tables */ + compat_pickle = PyImport_ImportModule("_compat_pickle"); + if (!compat_pickle) + goto error; + name_mapping_2to3 = PyObject_GetAttrString(compat_pickle, "NAME_MAPPING"); + if (!name_mapping_2to3) + goto error; + if (!PyDict_CheckExact(name_mapping_2to3)) { + PyErr_Format(PyExc_RuntimeError, + "_compat_pickle.NAME_MAPPING should be a dict, not %.200s", + Py_TYPE(name_mapping_2to3)->tp_name); + goto error; + } + import_mapping_2to3 = PyObject_GetAttrString(compat_pickle, + "IMPORT_MAPPING"); + if (!import_mapping_2to3) + goto error; + if (!PyDict_CheckExact(import_mapping_2to3)) { + PyErr_Format(PyExc_RuntimeError, + "_compat_pickle.IMPORT_MAPPING should be a dict, " + "not %.200s", Py_TYPE(import_mapping_2to3)->tp_name); + goto error; + } + /* ... and the 3.x -> 2.x mapping tables */ + name_mapping_3to2 = PyObject_GetAttrString(compat_pickle, + "REVERSE_NAME_MAPPING"); + if (!name_mapping_3to2) + goto error; + if (!PyDict_CheckExact(name_mapping_3to2)) { + PyErr_Format(PyExc_RuntimeError, + "_compat_pickle.REVERSE_NAME_MAPPING shouldbe a dict, " + "not %.200s", Py_TYPE(name_mapping_3to2)->tp_name); + goto error; + } + import_mapping_3to2 = PyObject_GetAttrString(compat_pickle, + "REVERSE_IMPORT_MAPPING"); + if (!import_mapping_3to2) + goto error; + if (!PyDict_CheckExact(import_mapping_3to2)) { + PyErr_Format(PyExc_RuntimeError, + "_compat_pickle.REVERSE_IMPORT_MAPPING should be a dict, " + "not %.200s", Py_TYPE(import_mapping_3to2)->tp_name); + goto error; + } + Py_CLEAR(compat_pickle); empty_tuple = PyTuple_New(0); if (empty_tuple == NULL) - return -1; - + goto error; two_tuple = PyTuple_New(2); if (two_tuple == NULL) - return -1; + goto error; /* We use this temp container with no regard to refcounts, or to * keeping containees alive. Exempt from GC, because we don't * want anything looking at two_tuple() by magic. @@ -4715,7 +4903,18 @@ return 0; error: - Py_DECREF(copyreg); + Py_CLEAR(copyreg); + Py_CLEAR(dispatch_table); + Py_CLEAR(extension_registry); + Py_CLEAR(inverted_registry); + Py_CLEAR(extension_cache); + Py_CLEAR(compat_pickle); + Py_CLEAR(name_mapping_2to3); + Py_CLEAR(import_mapping_2to3); + Py_CLEAR(name_mapping_3to2); + Py_CLEAR(import_mapping_3to2); + Py_CLEAR(empty_tuple); + Py_CLEAR(two_tuple); return -1; } @@ -4773,7 +4972,7 @@ if (PyModule_AddObject(m, "UnpicklingError", UnpicklingError) < 0) return NULL; - if (init_stuff() < 0) + if (initmodule() < 0) return NULL; return m; From python-checkins at python.org Fri Jun 5 04:36:12 2009 From: python-checkins at python.org (guilherme.polo) Date: Fri, 5 Jun 2009 04:36:12 +0200 (CEST) Subject: [Python-checkins] r73237 - python/branches/tk_and_idle_maintenance/Lib/lib-tk/test/test_tkinter/test_canvas.py Message-ID: <20090605023612.82430D921@mail.python.org> Author: guilherme.polo Date: Fri Jun 5 04:36:12 2009 New Revision: 73237 Log: Started tests for Tkinter.Canvas. Added: python/branches/tk_and_idle_maintenance/Lib/lib-tk/test/test_tkinter/test_canvas.py (contents, props changed) Added: python/branches/tk_and_idle_maintenance/Lib/lib-tk/test/test_tkinter/test_canvas.py ============================================================================== --- (empty file) +++ python/branches/tk_and_idle_maintenance/Lib/lib-tk/test/test_tkinter/test_canvas.py Fri Jun 5 04:36:12 2009 @@ -0,0 +1,162 @@ +import unittest +import Tkinter +from test.test_support import requires, run_unittest +from ttk import setup_master + +requires('gui') + +class CanvasTest(unittest.TestCase): + + def setUp(self): + self.root = setup_master() + self.canvas = Tkinter.Canvas(self.root) + + def tearDown(self): + self.canvas.destroy() + + + def test_addtag(self): pass + + def test_bbox(self): + self.assertIs(self.canvas.bbox('a'), None) + self.assertRaises(Tkinter.TclError, self.canvas.bbox) + + self.canvas.create_line(1, 1, 10, 10, tags='a') + self.canvas.create_line(5, 5, 12, 12, tags='b') + res = self.canvas.bbox('a', 'b') + self.assertTrue(isinstance(res, tuple)) + self.assertEqual(len(res), 4) + for item in res: + self.assertTrue(isinstance(item, int)) + + ba = self.canvas.bbox('a') + bb = self.canvas.bbox('b') + for indx, item in enumerate(zip(ba[:2], bb[:2])): + self.assertEqual(min(item), res[indx]) + for indx, item in enumerate(zip(ba[2:], bb[2:])): + self.assertEqual(max(item), res[indx + 2]) + + def test_tag(self): pass + def test_canvasxy(self): pass + + def test_coords(self): + coords = self.canvas.coords('x') + self.assertFalse(coords) + self.assertEqual(coords, []) + + item_id = self.canvas.create_line(5, 5, 10, 10) + coords = self.canvas.coords(item_id) + self.assertTrue(isinstance(coords, list)) + self.assertEqual(len(coords), 4) + for item in coords: + self.assertTrue(isinstance(item, float)) + + t = (1, 2, 3, 4) + self.canvas.coords(item_id, 1, 2, 3, 4) + for item in zip(self.canvas.coords(item_id), t): + self.assertAlmostEqual(item[0], item[1]) + + self.canvas.coords(item_id, t) + for item in zip(self.canvas.coords(item_id), t): + self.assertAlmostEqual(item[0], item[1]) + + def test_create(self): + self.assertIs(self.canvas.type('x'), None) + self.assertRaises(Tkinter.TclError, self.canvas.create_arc) + self.assertRaises(Tkinter.TclError, self.canvas.create_arc, + 1, 2, 3, 4, badoption=2) + + arcid = self.canvas.create_arc(1, 2, 3, 4, tags=('a', 'b', 'c')) + self.assertEqual(self.canvas.type(arcid), 'arc') + self.assertEqual(self.canvas.gettags(arcid), ('a', 'b', 'c')) + + bmpid = self.canvas.create_bitmap(1, 2, state='hidden', anchor='n') + self.assertEqual(self.canvas.type(bmpid), 'bitmap') + self.assertEqual(self.canvas.itemcget(bmpid, 'state'), 'hidden') + self.assertEqual(self.canvas.itemcget(bmpid, 'anchor'), 'n') + + imgid = self.canvas.create_image(1, 2) + self.assertEqual(self.canvas.type(imgid), 'image') + # line needs at least 4 coordinates + self.assertRaises(Tkinter.TclError, self.canvas.create_line, 1, 10) + lineid = self.canvas.create_line(1, 10, 30, 10, 60, 30, + width=3, smooth=True) + self.assertEqual(self.canvas.type(lineid), 'line') + ovalid = self.canvas.create_oval(1, 2, 3, 4) + self.assertEqual(self.canvas.type(ovalid), 'oval') + rectid = self.canvas.create_rectangle(1, 2, 3, 4) + self.assertEqual(self.canvas.type(rectid), 'rectangle') + textid = self.canvas.create_text(1, 2) + self.assertEqual(self.canvas.type(textid), 'text') + winid = self.canvas.create_window(1, 2) + self.assertEqual(self.canvas.type(winid), 'window') + + for key, val in locals().iteritems(): + if key.endswith('id'): + self.assertTrue(isinstance(val, int)) + + def test_dchars(self): + tid = self.canvas.create_text(10, 10, text='testing', tags='t') + self.canvas.dchars('t', 4) + self.assertEqual(self.canvas.itemcget(tid, 'text'), 'testng') + self.assertRaises(Tkinter.TclError, self.canvas.dchars, 't', 'badindex') + self.canvas.dchars('t', 4, 'end') + self.assertEqual(self.canvas.itemcget(tid, 'text'), 'test') + + lid = self.canvas.create_line(10, 10, 20, 20, tags='t') + self.assertEqual(self.canvas.coords(lid), [10, 10, 20, 20]) + self.canvas.dchars('t', 2, 3) + self.assertEqual(self.canvas.coords(lid), [10, 10]) + self.assertEqual(self.canvas.itemcget(tid, 'text'), 'te') + + self.canvas.dchars('t', 0, 'end') + self.assertEqual(self.canvas.coords(lid), []) + self.assertEqual(self.canvas.itemcget(tid, 'text'), '') + + def test_delete(self): + t1 = self.canvas.create_text(5, 5, tags='a') + t2 = self.canvas.create_text(5, 5, tags='a') + t3 = self.canvas.create_text(20, 20, tags='a') + self.assertTrue(self.canvas.itemconfigure(t1), {}) + self.canvas.delete(t1) + self.assertEqual(self.canvas.itemconfigure(t1), {}) + + t4 = self.canvas.create_text(15, 15, tags='b') + self.assertTrue(self.canvas.itemconfigure(t2)) + self.canvas.delete('b', 'a', t3) + self.assertEqual(self.canvas.itemconfigure(t2), + self.canvas.itemconfigure(t3)) + self.assertEqual(self.canvas.itemconfigure(t3), + self.canvas.itemconfigure(t4)) + self.assertEqual(self.canvas.itemconfigure(t4), {}) + + def test_dtag(self): pass + def test_find(self): pass + def test_focus(self): pass + def test_gettags(self): pass + def test_icursor(self): pass + def test_index(self): pass + def test_insert(self): pass + def test_itemcget(self): pass + def test_itemconfigure(self): pass + def test_move(self): pass + def test_postscript(self): pass # XXX + def test_scale(self): pass + def test_scan(self): pass + def test_select(self): pass + + def test_xview(self, method='xview'): + view = getattr(self.canvas, method)() + self.assertTrue(isinstance(view, tuple)) + self.assertEqual(len(view), 2) + for item in view: + self.assertTrue(isinstance(item, float)) + + def test_yview(self): + self.test_xview('yview') + + +tests_gui = (CanvasTest, ) + +if __name__ == "__main__": + run_unittest(*tests_gui) From python-checkins at python.org Fri Jun 5 07:15:58 2009 From: python-checkins at python.org (hirokazu.yamamoto) Date: Fri, 5 Jun 2009 07:15:58 +0200 (CEST) Subject: [Python-checkins] r73238 - python/trunk/Lib/test/test__locale.py Message-ID: <20090605051558.7AC21D89D@mail.python.org> Author: hirokazu.yamamoto Date: Fri Jun 5 07:15:58 2009 New Revision: 73238 Log: Fix test__locale on windows (Backport of r72365) Modified: python/trunk/Lib/test/test__locale.py Modified: python/trunk/Lib/test/test__locale.py ============================================================================== --- python/trunk/Lib/test/test__locale.py (original) +++ python/trunk/Lib/test/test__locale.py Fri Jun 5 07:15:58 2009 @@ -1,7 +1,12 @@ from test.test_support import verbose, run_unittest -from _locale import (setlocale, LC_NUMERIC, RADIXCHAR, THOUSEP, nl_langinfo, - localeconv, Error) +from _locale import (setlocale, LC_NUMERIC, localeconv, Error) +try: + from _locale import (RADIXCHAR, THOUSEP, nl_langinfo) +except ImportError: + nl_langinfo = None + import unittest +import sys from platform import uname if uname()[0] == "Darwin": @@ -20,6 +25,13 @@ 'eu_ES', 'vi_VN', 'af_ZA', 'nb_NO', 'en_DK', 'tg_TJ', 'en_US', 'es_ES.ISO8859-1', 'fr_FR.ISO8859-15', 'ru_RU.KOI8-R', 'ko_KR.eucKR'] +# Workaround for MSVC6(debug) crash bug +if "MSC v.1200" in sys.version: + def accept(loc): + a = loc.split(".") + return not(len(a) == 2 and len(a[-1]) >= 9) + candidate_locales = [loc for loc in candidate_locales if accept(loc)] + # List known locale values to test against when available. # Dict formatted as `` : (, )``. If a # value is not known, use '' . @@ -53,6 +65,7 @@ calc_type, data_type, set_locale, used_locale)) + @unittest.skipUnless(nl_langinfo, "nl_langinfo is not available") def test_lc_numeric_nl_langinfo(self): # Test nl_langinfo against known values for loc in candidate_locales: @@ -71,10 +84,11 @@ setlocale(LC_NUMERIC, loc) except Error: continue - for li, lc in ((RADIXCHAR, "decimal_point"), - (THOUSEP, "thousands_sep")): + for li, lc in ("decimal_point", + "thousands_sep"): self.numeric_tester('localeconv', localeconv()[lc], lc, loc) + @unittest.skipUnless(nl_langinfo, "nl_langinfo is not available") def test_lc_numeric_basic(self): # Test nl_langinfo against localeconv for loc in candidate_locales: From python-checkins at python.org Fri Jun 5 10:35:30 2009 From: python-checkins at python.org (tarek.ziade) Date: Fri, 5 Jun 2009 10:35:30 +0200 (CEST) Subject: [Python-checkins] r73239 - peps/trunk/pep-0376.txt Message-ID: <20090605083530.DF35DDA6E@mail.python.org> Author: tarek.ziade Date: Fri Jun 5 10:35:30 2009 New Revision: 73239 Log: added the installer marker + more details from feedback Modified: peps/trunk/pep-0376.txt Modified: peps/trunk/pep-0376.txt ============================================================================== --- peps/trunk/pep-0376.txt (original) +++ peps/trunk/pep-0376.txt Fri Jun 5 10:35:30 2009 @@ -174,8 +174,15 @@ A `RECORD` file will be added inside the `.egg-info` directory at installation time. The `RECORD` file will hold the list of installed files. These correspond to the files listed by the `record` option of the `install` command, and will -always be generated. This will allow uninstallation, as explained later in this -PEP. This RECORD file is inspired from PEP 262 FILES [#pep262]_. +be generated by default. This will allow uninstallation, as explained later in this +PEP. The `install` command will also provide an option to prevent the `RECORD` +file from being written and this option should be used when creating system +packages. + +Third-party installation tools also should not overwrite or delete files +that are not in a RECORD file without prompting or warning. + +This RECORD file is inspired from PEP 262 FILES [#pep262]_. The RECORD format ----------------- @@ -227,6 +234,21 @@ - `zlib` and `zlib-2.5.2.egg-info` are located in `site-packages` so the file paths are relative to it. +Adding an INSTALLER file in the .egg-info directory +=================================================== + +The `install` command will have a new option called `installer`. This option +is the name of the tool used to invoke the installation. It's an normalized +lower-case string matching `[a-z0-9_\-\.]`. + + $ python setup.py install --installer=pkg-system + +It will default to `distutils` if not provided. + +When a project is installed, the INSTALLER file is generated in the +`.egg-info` directory with this value, to keep track of **who** installed the +project. The file is a single-line text file. + New APIs in pkgutil =================== @@ -453,6 +475,9 @@ If the project is not found, a ``DistutilsUninstallError`` will be raised. +Filtering +--------- + To make it a reference API for third-party projects that wish to control how `uninstall` works, a second callable argument can be used. It will be called for each file that is removed. If the callable returns `True`, the @@ -475,6 +500,32 @@ Of course, a third-party tool can use ``pkgutil`` APIs to implement its own uninstall feature. +Installer marker +---------------- + +As explained earlier in this PEP, the `install` command adds an `INSTALLER` +file in the `.egg-info` directory with the name of the installer. + +To avoid removing projects that where installed by another packaging system, +the ``uninstall`` function takes an extra argument ``installer`` which default +to ``distutils``. + +When called, ``uninstall`` will control that the ``INSTALLER`` file matches +this argument. If not, it will raise a ``DistutilsUninstallError``:: + + >>> uninstall('zlib') + Traceback (most recent call last): + ... + DistutilsUninstallError: zlib was installed by 'cool-pkg-manager' + + >>> uninstall('zlib', installer='cool-pkg-manager') + +This allows a third-party application to use the ``uninstall`` function +and make sure it's the only program that can remove a project it has +previously installed. This is useful when a third-party program that relies +on Distutils APIs does extra steps on the system at installation time, +it has to undo at uninstallation time. + Backward compatibility and roadmap ================================== From python-checkins at python.org Fri Jun 5 14:33:27 2009 From: python-checkins at python.org (eric.smith) Date: Fri, 5 Jun 2009 14:33:27 +0200 (CEST) Subject: [Python-checkins] r73240 - python/trunk/Lib/test/formatfloat_testcases.txt Message-ID: <20090605123327.28481D930@mail.python.org> Author: eric.smith Date: Fri Jun 5 14:33:26 2009 New Revision: 73240 Log: Removed tests so that test_float pass on Windows. See issue 6198. Modified: python/trunk/Lib/test/formatfloat_testcases.txt Modified: python/trunk/Lib/test/formatfloat_testcases.txt ============================================================================== --- python/trunk/Lib/test/formatfloat_testcases.txt (original) +++ python/trunk/Lib/test/formatfloat_testcases.txt Fri Jun 5 14:33:26 2009 @@ -11,7 +11,7 @@ -- precision 0; result should never include a . %.0f 1.5 -> 2 -%.0f 2.5 -> 2 +--%.0f 2.5 -> 2 fails on Windows in 2.7, works in 3.1+. See issue 6198. %.0f 3.5 -> 4 %.0f 0.0 -> 0 %.0f 0.1 -> 0 @@ -21,9 +21,9 @@ %.0f 10.01 -> 10 %.0f 123.456 -> 123 %.0f 1234.56 -> 1235 -%.0f 1e49 -> 9999999999999999464902769475481793196872414789632 +--%.0f 1e49 -> 9999999999999999464902769475481793196872414789632 See issue 6198. -- %.0f 1e50 -> 100000000000000007629769841091887003294964970946560 -%.0f 9.9999999999999987e+49 -> 99999999999999986860582406952576489172979654066176 +-- %.0f 9.9999999999999987e+49 -> 99999999999999986860582406952576489172979654066176 See issue 6198. -- precision 1 %.1f 0.0001 -> 0.0 @@ -31,7 +31,7 @@ %.1f 0.01 -> 0.0 %.1f 0.04 -> 0.0 %.1f 0.06 -> 0.1 -%.1f 0.25 -> 0.2 +-- %.1f 0.25 -> 0.2 See issue 6198. %.1f 0.75 -> 0.8 %.1f 1.4 -> 1.4 %.1f 1.5 -> 1.5 @@ -47,7 +47,7 @@ %.2f 0.004999 -> 0.00 %.2f 0.005001 -> 0.01 %.2f 0.01 -> 0.01 -%.2f 0.125 -> 0.12 +-- %.2f 0.125 -> 0.12 See issue 6198. %.2f 0.375 -> 0.38 %.2f 1234500 -> 1234500.00 %.2f 1234560 -> 1234560.00 @@ -61,8 +61,8 @@ -- makes a difference when the precision is 0. %#.0f 0 -> 0. %#.1f 0 -> 0.0 -%#.0f 1.5 -> 2. -%#.0f 2.5 -> 2. +--%#.0f 1.5 -> 2. See issue 6198. +-- %#.0f 2.5 -> 2. See issue 6198. %#.0f 10.1 -> 10. %#.0f 1234.56 -> 1235. %#.1f 1.4 -> 1.4 @@ -108,18 +108,18 @@ %.0e 123456000 -> 1e+08 %.0e 0.5 -> 5e-01 %.0e 1.4 -> 1e+00 -%.0e 1.5 -> 2e+00 +--%.0e 1.5 -> 2e+00 See issue 6198. %.0e 1.6 -> 2e+00 %.0e 2.4999999 -> 2e+00 -%.0e 2.5 -> 2e+00 +--%.0e 2.5 -> 2e+00 See issue 6198. %.0e 2.5000001 -> 3e+00 %.0e 3.499999999999 -> 3e+00 %.0e 3.5 -> 4e+00 -%.0e 4.5 -> 4e+00 +--%.0e 4.5 -> 4e+00 See issue 6198. %.0e 5.5 -> 6e+00 -%.0e 6.5 -> 6e+00 +--%.0e 6.5 -> 6e+00 See issue 6198. %.0e 7.5 -> 8e+00 -%.0e 8.5 -> 8e+00 +--%.0e 8.5 -> 8e+00 See issue 6198. %.0e 9.4999 -> 9e+00 %.0e 9.5 -> 1e+01 %.0e 10.5 -> 1e+01 @@ -185,15 +185,15 @@ %#.0e 1.5 -> 2.e+00 %#.0e 1.6 -> 2.e+00 %#.0e 2.4999999 -> 2.e+00 -%#.0e 2.5 -> 2.e+00 +--%#.0e 2.5 -> 2.e+00 See issue 6198. %#.0e 2.5000001 -> 3.e+00 %#.0e 3.499999999999 -> 3.e+00 %#.0e 3.5 -> 4.e+00 -%#.0e 4.5 -> 4.e+00 +--%#.0e 4.5 -> 4.e+00 See issue 6198. %#.0e 5.5 -> 6.e+00 -%#.0e 6.5 -> 6.e+00 +--%#.0e 6.5 -> 6.e+00 See issue 6198. %#.0e 7.5 -> 8.e+00 -%#.0e 8.5 -> 8.e+00 +--%#.0e 8.5 -> 8.e+00 See issue 6198. %#.0e 9.4999 -> 9.e+00 %#.0e 9.5 -> 1.e+01 %#.0e 10.5 -> 1.e+01 @@ -281,11 +281,11 @@ -- alternate g formatting: always include decimal point and -- exactly significant digits. -%#.0g 0 -> 0. -%#.1g 0 -> 0. -%#.2g 0 -> 0.0 -%#.3g 0 -> 0.00 -%#.4g 0 -> 0.000 +--%#.0g 0 -> 0. See issue 6198. +--%#.1g 0 -> 0. See issue 6198. +--%#.2g 0 -> 0.0 See issue 6198. +--%#.3g 0 -> 0.00 See issue 6198. +--%#.4g 0 -> 0.000 See issue 6198. %#.0g 0.2 -> 0.2 %#.1g 0.2 -> 0.2 From python-checkins at python.org Fri Jun 5 14:34:12 2009 From: python-checkins at python.org (eric.smith) Date: Fri, 5 Jun 2009 14:34:12 +0200 (CEST) Subject: [Python-checkins] r73241 - python/branches/py3k Message-ID: <20090605123412.B72ECD944@mail.python.org> Author: eric.smith Date: Fri Jun 5 14:34:12 2009 New Revision: 73241 Log: Blocked revisions 73240 via svnmerge ........ r73240 | eric.smith | 2009-06-05 08:33:26 -0400 (Fri, 05 Jun 2009) | 1 line Removed tests so that test_float pass on Windows. See issue 6198. ........ Modified: python/branches/py3k/ (props changed) From python-checkins at python.org Fri Jun 5 14:34:50 2009 From: python-checkins at python.org (eric.smith) Date: Fri, 5 Jun 2009 14:34:50 +0200 (CEST) Subject: [Python-checkins] r73242 - python/branches/release26-maint Message-ID: <20090605123450.D6852D944@mail.python.org> Author: eric.smith Date: Fri Jun 5 14:34:50 2009 New Revision: 73242 Log: Blocked revisions 73240 via svnmerge ........ r73240 | eric.smith | 2009-06-05 08:33:26 -0400 (Fri, 05 Jun 2009) | 1 line Removed tests so that test_float pass on Windows. See issue 6198. ........ Modified: python/branches/release26-maint/ (props changed) From python-checkins at python.org Fri Jun 5 15:37:29 2009 From: python-checkins at python.org (tarek.ziade) Date: Fri, 5 Jun 2009 15:37:29 +0200 (CEST) Subject: [Python-checkins] r73243 - python/trunk/Lib/distutils/command/bdist_msi.py Message-ID: <20090605133729.7450CD8E6@mail.python.org> Author: tarek.ziade Date: Fri Jun 5 15:37:29 2009 New Revision: 73243 Log: reverting r72823 : Python trunk has to use latin-1 encoding Modified: python/trunk/Lib/distutils/command/bdist_msi.py Modified: python/trunk/Lib/distutils/command/bdist_msi.py ============================================================================== --- python/trunk/Lib/distutils/command/bdist_msi.py (original) +++ python/trunk/Lib/distutils/command/bdist_msi.py Fri Jun 5 15:37:29 2009 @@ -1,5 +1,5 @@ -# -*- coding: utf-8 -*- -# Copyright (C) 2005, 2006 Martin von L??wis +# -*- coding: iso-8859-1 -*- +# Copyright (C) 2005, 2006 Martin von L?wis # Licensed to PSF under a Contributor Agreement. # The bdist_wininst command proper # based on bdist_wininst From ziade.tarek at gmail.com Fri Jun 5 15:33:04 2009 From: ziade.tarek at gmail.com (=?ISO-8859-1?Q?Tarek_Ziad=E9?=) Date: Fri, 5 Jun 2009 15:33:04 +0200 Subject: [Python-checkins] r72823 - python/trunk/Lib/distutils/command/bdist_msi.py In-Reply-To: <4A291C22.3070109@trueblade.com> References: <20090522094243.C41A3C2C6@mail.python.org> <4A170482.4090205@v.loewis.de> <4A291C22.3070109@trueblade.com> Message-ID: <94bdd2610906050633g4b38992dxe2c880d7ec011c73@mail.gmail.com> 2009/6/5 Eric Smith : > Martin v. L?wis wrote: >>> >>> fixed encoding >>> >>> Modified: >>> ? python/trunk/Lib/distutils/command/bdist_msi.py >>> >>> Modified: python/trunk/Lib/distutils/command/bdist_msi.py >>> >>> ============================================================================== >>> --- python/trunk/Lib/distutils/command/bdist_msi.py ? ? (original) >>> +++ python/trunk/Lib/distutils/command/bdist_msi.py ? ? Fri May 22 >>> 11:42:43 2009 >>> @@ -1,5 +1,5 @@ >>> -# -*- coding: iso-8859-1 -*- >>> +# -*- coding: utf-8 -*- >> >> Why is that a fix? It wasn't broken before (AFAICT), and it violates >> PEP 8 (Encodings) now. > > Did this ever get answered? It still says utf-8 in svn. > > (Trying to clean out my inbox of open items.) No I missed Martin mail in my flow of mails, sorry. I was unaware of the non-utf8 rule in trunk. I'll revert that change now. Tarek From python-checkins at python.org Fri Jun 5 15:39:25 2009 From: python-checkins at python.org (benjamin.peterson) Date: Fri, 5 Jun 2009 15:39:25 +0200 (CEST) Subject: [Python-checkins] r73244 - sandbox/trunk/2to3/lib2to3/tests/test_fixers.py Message-ID: <20090605133925.CF472DA32@mail.python.org> Author: benjamin.peterson Date: Fri Jun 5 15:39:25 2009 New Revision: 73244 Log: allow fixers to give different options in setUp Modified: sandbox/trunk/2to3/lib2to3/tests/test_fixers.py Modified: sandbox/trunk/2to3/lib2to3/tests/test_fixers.py ============================================================================== --- sandbox/trunk/2to3/lib2to3/tests/test_fixers.py (original) +++ sandbox/trunk/2to3/lib2to3/tests/test_fixers.py Fri Jun 5 15:39:25 2009 @@ -15,10 +15,11 @@ # Other test cases can subclass this class and replace "fixer_pkg" with # their own. - def setUp(self, fix_list=None, fixer_pkg="lib2to3"): + def setUp(self, fix_list=None, fixer_pkg="lib2to3", options=None): if fix_list is None: fix_list = [self.fixer] - options = {"print_function" : False} + if options is None: + options = {"print_function" : False} self.refactor = support.get_refactorer(fixer_pkg, fix_list, options) self.fixer_log = [] self.filename = u"" From python-checkins at python.org Fri Jun 5 15:43:08 2009 From: python-checkins at python.org (tarek.ziade) Date: Fri, 5 Jun 2009 15:43:08 +0200 (CEST) Subject: [Python-checkins] r73245 - python/branches/release26-maint Message-ID: <20090605134308.C5F79D8E6@mail.python.org> Author: tarek.ziade Date: Fri Jun 5 15:43:08 2009 New Revision: 73245 Log: Blocked revisions 73243 via svnmerge ........ r73243 | tarek.ziade | 2009-06-05 15:37:29 +0200 (Fri, 05 Jun 2009) | 1 line reverting r72823 : Python trunk has to use latin-1 encoding ........ Modified: python/branches/release26-maint/ (props changed) From python-checkins at python.org Fri Jun 5 15:51:52 2009 From: python-checkins at python.org (tarek.ziade) Date: Fri, 5 Jun 2009 15:51:52 +0200 (CEST) Subject: [Python-checkins] r73246 - python/branches/py3k Message-ID: <20090605135152.4D018D8EB@mail.python.org> Author: tarek.ziade Date: Fri Jun 5 15:51:52 2009 New Revision: 73246 Log: Blocked revisions 73243 via svnmerge ........ r73243 | tarek.ziade | 2009-06-05 15:37:29 +0200 (Fri, 05 Jun 2009) | 1 line reverting r72823 : Python trunk has to use latin-1 encoding ........ Modified: python/branches/py3k/ (props changed) From python-checkins at python.org Fri Jun 5 16:14:34 2009 From: python-checkins at python.org (michael.foord) Date: Fri, 5 Jun 2009 16:14:34 +0200 (CEST) Subject: [Python-checkins] r73247 - python/trunk/Lib/test/test_unittest.py Message-ID: <20090605141434.64339D9F9@mail.python.org> Author: michael.foord Date: Fri Jun 5 16:14:34 2009 New Revision: 73247 Log: Fix unittest discovery tests for Windows. Issue 6199 Modified: python/trunk/Lib/test/test_unittest.py Modified: python/trunk/Lib/test/test_unittest.py ============================================================================== --- python/trunk/Lib/test/test_unittest.py (original) +++ python/trunk/Lib/test/test_unittest.py Fri Jun 5 16:14:34 2009 @@ -3537,7 +3537,9 @@ # We should have loaded tests from the test_directory package by calling load_tests # and directly from the test_directory2 package - self.assertEqual(suite, ['load_tests', '/foo/test_directory2 module tests']) + self.assertEqual(suite, + ['load_tests', + os.path.join('/foo', 'test_directory2') + ' module tests']) self.assertEqual(Module.paths, [os.path.join('/foo', 'test_directory'), os.path.join('/foo', 'test_directory2')]) From buildbot at python.org Fri Jun 5 16:39:59 2009 From: buildbot at python.org (buildbot at python.org) Date: Fri, 05 Jun 2009 14:39:59 +0000 Subject: [Python-checkins] buildbot failure in amd64 gentoo 2.6 Message-ID: <20090605143959.2D775D2A0@mail.python.org> The Buildbot has detected a new failure of amd64 gentoo 2.6. Full details are available at: http://www.python.org/dev/buildbot/all/amd64%20gentoo%202.6/builds/75 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: norwitz-amd64 Build Reason: Build Source Stamp: [branch branches/release26-maint] HEAD Blamelist: tarek.ziade BUILD FAILED: failed test Excerpt from the test logfile: Traceback (most recent call last): File "/home/buildbot/slave/py-build/2.6.norwitz-amd64/build/Lib/test/test_signal.py", line 165, in test_main pickle.dump(None, done_w) File "/home/buildbot/slave/py-build/2.6.norwitz-amd64/build/Lib/contextlib.py", line 153, in __exit__ self.thing.close() IOError: [Errno 9] Bad file descriptor 1 test failed: test_signal make: *** [buildbottest] Error 1 sincerely, -The Buildbot From python-checkins at python.org Fri Jun 5 17:16:41 2009 From: python-checkins at python.org (guilherme.polo) Date: Fri, 5 Jun 2009 17:16:41 +0200 (CEST) Subject: [Python-checkins] r73248 - python/branches/tk_and_idle_maintenance/Lib/lib-tk/test/test_tkinter/test_text.py Message-ID: <20090605151641.8BC71D54F@mail.python.org> Author: guilherme.polo Date: Fri Jun 5 17:16:41 2009 New Revision: 73248 Log: Basic {x,y}view tests for Tkinter.Text Modified: python/branches/tk_and_idle_maintenance/Lib/lib-tk/test/test_tkinter/test_text.py Modified: python/branches/tk_and_idle_maintenance/Lib/lib-tk/test/test_tkinter/test_text.py ============================================================================== --- python/branches/tk_and_idle_maintenance/Lib/lib-tk/test/test_tkinter/test_text.py (original) +++ python/branches/tk_and_idle_maintenance/Lib/lib-tk/test/test_tkinter/test_text.py Fri Jun 5 17:16:41 2009 @@ -177,11 +177,15 @@ def test_window(self): pass - def test_xview(self): - pass + def test_xview(self, method='xview'): + view = getattr(self.text, method)() + self.assertTrue(isinstance(view, tuple)) + self.assertEqual(len(view), 2) + for item in view: + self.assertTrue(isinstance(item, float)) def test_yview(self): - pass + self.test_xview('yview') tests_gui = (TextTest, ) From python-checkins at python.org Fri Jun 5 18:49:40 2009 From: python-checkins at python.org (dirkjan.ochtman) Date: Fri, 5 Jun 2009 18:49:40 +0200 (CEST) Subject: [Python-checkins] r73249 - peps/trunk/pep-0385.txt Message-ID: <20090605164940.50855D9D8@mail.python.org> Author: dirkjan.ochtman Date: Fri Jun 5 18:49:40 2009 New Revision: 73249 Log: PEP 385: more clarifications, notes on use, branching strategies. Modified: peps/trunk/pep-0385.txt Modified: peps/trunk/pep-0385.txt ============================================================================== --- peps/trunk/pep-0385.txt (original) +++ peps/trunk/pep-0385.txt Fri Jun 5 18:49:40 2009 @@ -39,6 +39,12 @@ .. _hgsubversion: http://bitbucket.org/durin42/hgsubversion/ +Timeline +======== + +TBD; needs fully working hgsubversion and consensus on this document. + + Transition plan =============== @@ -61,9 +67,13 @@ properly closed and closed heads are no longer considered in relevant cases). A disadvantage might be that the used clones will be a good bit larger (since -they essentially contain all other branches as well). Perhaps it would be a -good idea to distinguish between feature branches (which would be done trough -a separate clone) and release branches (which would be named). +they essentially contain all other branches as well). This can me mitigated by +keeping non-release (feature) branches in separate clones. Also note that it's +still possible to clone a single named branch from a combined clone, by +specifying the branch as in hg clone http://hg.python.org/main/#2.6-maint. +Keeping the py3k history in a separate clone problably also makes sense. + +XXX To do: size comparison for selected separation scenarios. Converting branches ------------------- @@ -85,7 +95,8 @@ we should keep all release tags, and consider other tags for inclusion based on requests from the developer community. I'd like to consider unifying the release tag naming scheme to make some things more consistent, if people feel -that won't create too many problems. +that won't create too many problems. For example, Mercurial itself just uses +'1.2.1' as a tag, where CPython would currently use r121. Author map ---------- @@ -173,3 +184,116 @@ come up with a style to match the Python website. It may also be useful to build a quick extension to augment the URL rev parser so that it can also take r[0-9]+ args and come up with the matching hg revision. + + +After migration +=============== + +Where to get code +----------------- + +It needs to be decided where the hg repositories will live. I'd like to +propose to keep the hgwebdir instance at hg.python.org. This is an accepted +standard for many organizations, and an easy parallel to svn.python.org. +The 2.7 (trunk) repo might live at http://hg.python.org/main/, for example, +with py3k at http://hg.python.org/py3k/. For write access, developers will +have to use ssh, which could be ssh://hg at hg.python.org/main/. A demo +installation will be set up with a preliminary conversion so people can +experiment and review; it can live at http://hg.python.org/example/. + +code.python.org was also proposed as the hostname. Personally, I think that +using the VCS name in the hostname is good because it prevents confusion: it +should be clear that you can't use svn or bzr for hg.python.org. + +hgwebdir can already provide tarballs for every changeset. I think this +obviates the need for daily snapshots; we can just point users to tip.tar.gz +instead, meaning they will get the latest. If desired, we could even use +buildbot results to point to the last good changeset. + +Python-specific documentation +----------------------------- + +hg comes with good built-in documentation (available through hg help) and a +`wiki`_ that's full of useful information and recipes. In addition to that, +the `parts of the developer FAQ`_ concerning version control will gain a +section on using hg for Python development. Some of the text will be dependent +on the outcome of debate about this PEP (for example, the branching strategy). + + .. _wiki: http://www.selenic.com/mercurial/wiki/ + .. _parts of the developer FAQ: http://www.python.org/dev/faq/#version-control + +Think first, commit later? +-------------------------- + +In recent history, old versions of Python have been maintained by a select +group of people backporting patches from trunk to release branches. While +this may not scale so well as the development pace grows, it also runs into +some problems with the current crop of distributed versioning tools. These +tools (I believe similar problems would exist for either git, bzr, or hg, +though some may cope better than others) are based on the idea of a Directed +Acyclic Graph (or DAG), meaning they keep track of relations of changesets. + +Mercurial itself has a stable branch which is a ''strict'' subset of the +unstable branch. This means that generally all fixes for the stable branch +get committed against the tip of the stable branch, then they get merged into +the unstable branch (which already contains the parent of the new cset). This +provides a largely frictionless environment for moving changes from stable to +unstable branches. Mistakes, where a change that should go on stable goes on +unstable first, do happen, but they're usually easy to fix. That can be done by +copying the change over to the stable branch, then trivial-merging with +unstable -- meaning the merge in fact ignores the parent from the stable +branch). + +This strategy means a little more work for regular committers, because they +have to think about whether their change should go on stable or unstable; they +may even have to ask someone else (the RM) before committing. But it also +relieves a dedicated group of committers of regular backporting duty, in +addition to making it easier to work with the tool. + +Now would be a good time to consider changing strategies in this regard, +although it would be relatively easy to switch to such a model later on. + +The future of Subversion +------------------------ + +What happens to the Subversion repositories after the migration? Since the svn +server contains a bunch of repositories, not just the CPython one, it will +probably live on for a bit as not every project may want to migrate or it +takes longer for other projects to migrate. To prevent people from staying +behind, we may want to remove migrated projects from the repository. + +Build identification +-------------------- + +Python currently provides the sys.subversion tuple to allow Python code to +find out exactly what version of Python it's running against. The current +version looks something like this: + +* ('CPython', 'tags/r262', '71600') +* ('CPython', 'trunk', '73128M') + +Another value is returned from Py_GetBuildInfo() in the C API, and available +to Python code as part of sys.version: + +* 'r262:71600, Jun 2 2009, 09:58:33' +* 'trunk:73128M, Jun 2 2009, 01:24:14' + +I propose that the revision identifier will be the short version of hg's +revision hash, for example 'dd3ebf81af43', augmented with '+' (instead of 'M') +if the working directory from which it was built was modified. This mirrors +the output of the hg id command, which is intended for this kind of usage. + +For the tag/branch identifier, I propose that hg will check for tags on the +currently checked out revision, use the tag if there is one ('tip' doesn't +count), and uses the branch name otherwise. sys.subversion becomes + +* ('CPython', '2.6.2', 'dd3ebf81af43') +* ('CPython', 'default', 'af694c6a888c+') + +and the build info string becomes + +* '2.6.2:dd3ebf81af43, Jun 2 2009, 09:58:33' +* 'default:af694c6a888c+, Jun 2 2009, 01:24:14' + +This reflects that the default branch in hg is called 'default' instead of +Subversion's 'trunk', and reflects the proposed new tag format. From eric at trueblade.com Fri Jun 5 15:22:42 2009 From: eric at trueblade.com (Eric Smith) Date: Fri, 05 Jun 2009 09:22:42 -0400 Subject: [Python-checkins] r72823 - python/trunk/Lib/distutils/command/bdist_msi.py In-Reply-To: <4A170482.4090205@v.loewis.de> References: <20090522094243.C41A3C2C6@mail.python.org> <4A170482.4090205@v.loewis.de> Message-ID: <4A291C22.3070109@trueblade.com> Martin v. L?wis wrote: >> fixed encoding >> >> Modified: >> python/trunk/Lib/distutils/command/bdist_msi.py >> >> Modified: python/trunk/Lib/distutils/command/bdist_msi.py >> ============================================================================== >> --- python/trunk/Lib/distutils/command/bdist_msi.py (original) >> +++ python/trunk/Lib/distutils/command/bdist_msi.py Fri May 22 11:42:43 2009 >> @@ -1,5 +1,5 @@ >> -# -*- coding: iso-8859-1 -*- >> +# -*- coding: utf-8 -*- > > Why is that a fix? It wasn't broken before (AFAICT), and it violates > PEP 8 (Encodings) now. Did this ever get answered? It still says utf-8 in svn. (Trying to clean out my inbox of open items.) Eric. From python-checkins at python.org Fri Jun 5 21:09:28 2009 From: python-checkins at python.org (benjamin.peterson) Date: Fri, 5 Jun 2009 21:09:28 +0200 (CEST) Subject: [Python-checkins] r73250 - python/trunk/Lib/shutil.py Message-ID: <20090605190928.7201EDB8F@mail.python.org> Author: benjamin.peterson Date: Fri Jun 5 21:09:28 2009 New Revision: 73250 Log: only test for named pipe when os.stat doesn't raise #6209 Modified: python/trunk/Lib/shutil.py Modified: python/trunk/Lib/shutil.py ============================================================================== --- python/trunk/Lib/shutil.py (original) +++ python/trunk/Lib/shutil.py Fri Jun 5 21:09:28 2009 @@ -58,9 +58,10 @@ except OSError: # File most likely does not exist pass - # XXX What about other special files? (sockets, devices...) - if stat.S_ISFIFO(st.st_mode): - raise SpecialFileError("`%s` is a named pipe" % fn) + else: + # XXX What about other special files? (sockets, devices...) + if stat.S_ISFIFO(st.st_mode): + raise SpecialFileError("`%s` is a named pipe" % fn) try: fsrc = open(src, 'rb') fdst = open(dst, 'wb') From python-checkins at python.org Fri Jun 5 21:13:28 2009 From: python-checkins at python.org (benjamin.peterson) Date: Fri, 5 Jun 2009 21:13:28 +0200 (CEST) Subject: [Python-checkins] r73251 - in python/branches/py3k: Lib/shutil.py Message-ID: <20090605191328.01265DB94@mail.python.org> Author: benjamin.peterson Date: Fri Jun 5 21:13:27 2009 New Revision: 73251 Log: Merged revisions 73250 via svnmerge from svn+ssh://pythondev at svn.python.org/python/trunk ........ r73250 | benjamin.peterson | 2009-06-05 14:09:28 -0500 (Fri, 05 Jun 2009) | 1 line only test for named pipe when os.stat doesn't raise #6209 ........ Modified: python/branches/py3k/ (props changed) python/branches/py3k/Lib/shutil.py Modified: python/branches/py3k/Lib/shutil.py ============================================================================== --- python/branches/py3k/Lib/shutil.py (original) +++ python/branches/py3k/Lib/shutil.py Fri Jun 5 21:13:27 2009 @@ -58,9 +58,10 @@ except OSError: # File most likely does not exist pass - # XXX What about other special files? (sockets, devices...) - if stat.S_ISFIFO(st.st_mode): - raise SpecialFileError("`%s` is a named pipe" % fn) + else: + # XXX What about other special files? (sockets, devices...) + if stat.S_ISFIFO(st.st_mode): + raise SpecialFileError("`%s` is a named pipe" % fn) try: fsrc = open(src, 'rb') fdst = open(dst, 'wb') From python-checkins at python.org Sat Jun 6 07:54:34 2009 From: python-checkins at python.org (georg.brandl) Date: Sat, 6 Jun 2009 07:54:34 +0200 (CEST) Subject: [Python-checkins] r73252 - python/trunk/Lib/test/test__locale.py Message-ID: <20090606055434.A64CFDCEF@mail.python.org> Author: georg.brandl Date: Sat Jun 6 07:54:34 2009 New Revision: 73252 Log: #6206: fix test__locale. Modified: python/trunk/Lib/test/test__locale.py Modified: python/trunk/Lib/test/test__locale.py ============================================================================== --- python/trunk/Lib/test/test__locale.py (original) +++ python/trunk/Lib/test/test__locale.py Sat Jun 6 07:54:34 2009 @@ -84,8 +84,7 @@ setlocale(LC_NUMERIC, loc) except Error: continue - for li, lc in ("decimal_point", - "thousands_sep"): + for lc in ("decimal_point", "thousands_sep"): self.numeric_tester('localeconv', localeconv()[lc], lc, loc) @unittest.skipUnless(nl_langinfo, "nl_langinfo is not available") From python-checkins at python.org Sat Jun 6 15:57:13 2009 From: python-checkins at python.org (guilherme.polo) Date: Sat, 6 Jun 2009 15:57:13 +0200 (CEST) Subject: [Python-checkins] r73253 - python/branches/tk_and_idle_maintenance/Lib/lib-tk/test/test_tkinter/test_canvas.py Message-ID: <20090606135713.C64D2D72B@mail.python.org> Author: guilherme.polo Date: Sat Jun 6 15:57:13 2009 New Revision: 73253 Log: Some more tests for Tkinter.Canvas. Modified: python/branches/tk_and_idle_maintenance/Lib/lib-tk/test/test_tkinter/test_canvas.py Modified: python/branches/tk_and_idle_maintenance/Lib/lib-tk/test/test_tkinter/test_canvas.py ============================================================================== --- python/branches/tk_and_idle_maintenance/Lib/lib-tk/test/test_tkinter/test_canvas.py (original) +++ python/branches/tk_and_idle_maintenance/Lib/lib-tk/test/test_tkinter/test_canvas.py Sat Jun 6 15:57:13 2009 @@ -14,6 +14,12 @@ def tearDown(self): self.canvas.destroy() + def verify_tags(self, orig, new): + self.assertEqual(len(orig), len(new)) + for tag in new: + orig.remove(tag) + self.assertFalse(orig) + def test_addtag(self): pass @@ -130,12 +136,82 @@ self.canvas.itemconfigure(t4)) self.assertEqual(self.canvas.itemconfigure(t4), {}) - def test_dtag(self): pass + def test_dtag(self): + ttags = ['a', 'b', 'c'] + x = self.canvas.create_text(5, 5, tags=tuple(ttags)) + self.verify_tags(ttags, self.canvas.gettags(x)) + + self.canvas.dtag(x, 'a') + ttags = ['b', 'c'] + self.verify_tags(ttags[:], self.canvas.gettags(x)) + + self.canvas.dtag(x, 'd') + self.verify_tags(ttags, self.canvas.gettags(x)) + + self.canvas.dtag('b') + self.verify_tags(['c'], self.canvas.gettags(x)) + def test_find(self): pass - def test_focus(self): pass - def test_gettags(self): pass - def test_icursor(self): pass - def test_index(self): pass + + def test_focus(self): + # XXX This used to raise Tkinter.TclError since canvas.focus allowed + # any amount of arguments while the focus command in Tk expects at + # most one. + self.assertRaises(TypeError, self.canvas.focus, 'a', 'b') + + self.assertIs(self.canvas.focus(), None) + + tid = self.canvas.create_text(10, 10, tags='a') + self.canvas.focus('a') + self.assertEqual(self.canvas.focus(), tid) + self.canvas.focus(10) + self.assertEqual(self.canvas.focus(), tid) + self.canvas.focus('') + self.assertIs(self.canvas.focus(), None) + + def test_gettags(self): + # XXX The following used to raise Tkinter.TclError since gettags + # allowed multiple arguments while the gettags command in Tk + # accepts only one argument. + self.assertRaises(TypeError, self.canvas.gettags, 'a', 'b') + + self.assertEqual(self.canvas.gettags('x'), ()) + tid = self.canvas.create_text(10, 10, tags='a') + self.assertEqual(self.canvas.gettags(tid), ('a', )) + + tid2 = self.canvas.create_text(10, 10, tags=('a', 'b', 'c')) + self.verify_tags(['a'], self.canvas.gettags('a')) + # lower tid2 so it assumes the first position in the display list + # (the item at the end of display list is the one that is displayed, + # but gettags returns the tags of the first item in this display list) + self.canvas.tag_lower(tid2) + self.verify_tags(['a', 'b', 'c'], self.canvas.gettags('a')) + + def test_icursor(self): + # XXX This used to raise Tkinter.TclError since canvas.icursor allowed + # a single argument while it always requires two (not counting self). + self.assertRaises(TypeError, self.canvas.icursor, 1) + + tid = self.canvas.create_text(5, 5, text='test') + self.canvas.icursor(tid, 3) + self.assertEqual(self.canvas.index(tid, 'insert'), 3) + + def test_index(self): + # XXX This used to raise Tkinter.TclError since canvas.index allowed + # passing a single argument while it always requires two (not counting + # self). + self.assertRaises(TypeError, self.canvas.index, 0) + + # won't return index of an unexisting item + self.assertRaises(Tkinter.TclError, self.canvas.index, 1, 1) + + tid = self.canvas.create_text(5, 5, text='test') + self.assertEqual(self.canvas.index(tid, 'end'), 4) + self.assertEqual(self.canvas.index(tid, 'insert'), 0) + + # no selection set + self.assertRaises(Tkinter.TclError, self.canvas.index, tid, 'sel.first') + def test_insert(self): pass def test_itemcget(self): pass def test_itemconfigure(self): pass From python-checkins at python.org Sat Jun 6 16:21:44 2009 From: python-checkins at python.org (antoine.pitrou) Date: Sat, 6 Jun 2009 16:21:44 +0200 (CEST) Subject: [Python-checkins] r73254 - python/branches/py3k/Doc/whatsnew/3.1.rst Message-ID: <20090606142144.70A45D89B@mail.python.org> Author: antoine.pitrou Date: Sat Jun 6 16:21:44 2009 New Revision: 73254 Log: Add what's new entry for r73236. Modified: python/branches/py3k/Doc/whatsnew/3.1.rst Modified: python/branches/py3k/Doc/whatsnew/3.1.rst ============================================================================== --- python/branches/py3k/Doc/whatsnew/3.1.rst (original) +++ python/branches/py3k/Doc/whatsnew/3.1.rst Sat Jun 6 16:21:44 2009 @@ -384,6 +384,24 @@ (Contributed by Brett Cannon.) +* :mod:`pickle` is now more compatible with Python 2.x when using a + 2.x-compatible protocol (that is, protocol 2 or lower), through translation + of some standard library module names to or from their Python 2.x + equivalents. + + This means that more (protocol 2 or lower) pickles produced by Python 3.1 + will be reusable by Python 2.x, and vice-versa. Standard set objects are + an example of this improvement. + + This has the (unfortunate but unavoidable) side effect that some + protocol 2 pickles produced by Python 3.1 won't be readable with + Python 3.0. The latest pickle protocol, protocol 3, should be used when + migrating data between Python 3.x implementations, as it doesn't attempt + to remain compatible with Python 2.x. + + (Contributed by Alexandre Vassalotti and Antoine Pitrou, :issue:`6137`.) + + Optimizations ============= From python-checkins at python.org Sat Jun 6 18:23:46 2009 From: python-checkins at python.org (benjamin.peterson) Date: Sat, 6 Jun 2009 18:23:46 +0200 (CEST) Subject: [Python-checkins] r73255 - in sandbox/trunk/2to3/lib2to3: fixes/fix_except.py tests/test_fixers.py Message-ID: <20090606162346.C7AEBC408@mail.python.org> Author: benjamin.peterson Date: Sat Jun 6 18:23:46 2009 New Revision: 73255 Log: fix the except fixer on one line suites #6222 Modified: sandbox/trunk/2to3/lib2to3/fixes/fix_except.py sandbox/trunk/2to3/lib2to3/tests/test_fixers.py Modified: sandbox/trunk/2to3/lib2to3/fixes/fix_except.py ============================================================================== --- sandbox/trunk/2to3/lib2to3/fixes/fix_except.py (original) +++ sandbox/trunk/2to3/lib2to3/fixes/fix_except.py Sat Jun 6 18:23:46 2009 @@ -36,11 +36,11 @@ class FixExcept(fixer_base.BaseFix): PATTERN = """ - try_stmt< 'try' ':' suite - cleanup=(except_clause ':' suite)+ - tail=(['except' ':' suite] - ['else' ':' suite] - ['finally' ':' suite]) > + try_stmt< 'try' ':' (simple_stmt | suite) + cleanup=(except_clause ':' (simple_stmt | suite))+ + tail=(['except' ':' (simple_stmt | suite)] + ['else' ':' (simple_stmt | suite)] + ['finally' ':' (simple_stmt | suite)]) > """ def transform(self, node, results): Modified: sandbox/trunk/2to3/lib2to3/tests/test_fixers.py ============================================================================== --- sandbox/trunk/2to3/lib2to3/tests/test_fixers.py (original) +++ sandbox/trunk/2to3/lib2to3/tests/test_fixers.py Sat Jun 6 18:23:46 2009 @@ -778,6 +778,39 @@ pass""" self.check(b, a) + def test_one_line_suites(self): + b = """ + try: raise TypeError + except TypeError, e: + pass + """ + a = """ + try: raise TypeError + except TypeError as e: + pass + """ + self.check(b, a) + b = """ + try: + raise TypeError + except TypeError, e: pass + """ + a = """ + try: + raise TypeError + except TypeError as e: pass + """ + self.check(b, a) + b = """ + try: raise TypeError + except TypeError, e: pass + """ + a = """ + try: raise TypeError + except TypeError as e: pass + """ + self.check(b, a) + # These should not be touched: def test_unchanged_1(self): From python-checkins at python.org Sat Jun 6 18:27:40 2009 From: python-checkins at python.org (benjamin.peterson) Date: Sat, 6 Jun 2009 18:27:40 +0200 (CEST) Subject: [Python-checkins] r73256 - sandbox/trunk/2to3/lib2to3/tests/test_fixers.py Message-ID: <20090606162740.3019BDB3F@mail.python.org> Author: benjamin.peterson Date: Sat Jun 6 18:27:40 2009 New Revision: 73256 Log: test one-line else and finally clauses Modified: sandbox/trunk/2to3/lib2to3/tests/test_fixers.py Modified: sandbox/trunk/2to3/lib2to3/tests/test_fixers.py ============================================================================== --- sandbox/trunk/2to3/lib2to3/tests/test_fixers.py (original) +++ sandbox/trunk/2to3/lib2to3/tests/test_fixers.py Sat Jun 6 18:27:40 2009 @@ -810,6 +810,19 @@ except TypeError as e: pass """ self.check(b, a) + b = """ + try: raise TypeError + except TypeError, e: pass + else: function() + finally: done() + """ + a = """ + try: raise TypeError + except TypeError as e: pass + else: function() + finally: done() + """ + self.check(b, a) # These should not be touched: From python-checkins at python.org Sat Jun 6 19:50:05 2009 From: python-checkins at python.org (georg.brandl) Date: Sat, 6 Jun 2009 19:50:05 +0200 (CEST) Subject: [Python-checkins] r73257 - python/trunk/Doc/tutorial/controlflow.rst Message-ID: <20090606175005.ADE18DC13@mail.python.org> Author: georg.brandl Date: Sat Jun 6 19:50:05 2009 New Revision: 73257 Log: #6211: elaborate a bit on ways to call the function. Modified: python/trunk/Doc/tutorial/controlflow.rst Modified: python/trunk/Doc/tutorial/controlflow.rst ============================================================================== --- python/trunk/Doc/tutorial/controlflow.rst (original) +++ python/trunk/Doc/tutorial/controlflow.rst Sat Jun 6 19:50:05 2009 @@ -312,14 +312,23 @@ def ask_ok(prompt, retries=4, complaint='Yes or no, please!'): while True: ok = raw_input(prompt) - if ok in ('y', 'ye', 'yes'): return True - if ok in ('n', 'no', 'nop', 'nope'): return False + if ok in ('y', 'ye', 'yes'): + return True + if ok in ('n', 'no', 'nop', 'nope'): + return False retries = retries - 1 - if retries < 0: raise IOError('refusenik user') + if retries < 0: + raise IOError('refusenik user') print complaint -This function can be called either like this: ``ask_ok('Do you really want to -quit?')`` or like this: ``ask_ok('OK to overwrite the file?', 2)``. +This function can be called in several ways: + +* giving only the mandatory argument: + ``ask_ok('Do you really want to quit?')`` +* giving one of the optional arguments: + ``ask_ok('OK to overwrite the file?', 2)`` +* or even giving all arguments: + ``ask_ok('OK to overwrite the file?', 2, 'Come on, only yes or no!')`` This example also introduces the :keyword:`in` keyword. This tests whether or not a sequence contains a certain value. From python-checkins at python.org Sat Jun 6 19:51:31 2009 From: python-checkins at python.org (georg.brandl) Date: Sat, 6 Jun 2009 19:51:31 +0200 (CEST) Subject: [Python-checkins] r73258 - python/trunk/Doc/tutorial/controlflow.rst Message-ID: <20090606175131.676D9C47F@mail.python.org> Author: georg.brandl Date: Sat Jun 6 19:51:31 2009 New Revision: 73258 Log: #6204: use a real reference instead of "see later". Modified: python/trunk/Doc/tutorial/controlflow.rst Modified: python/trunk/Doc/tutorial/controlflow.rst ============================================================================== --- python/trunk/Doc/tutorial/controlflow.rst (original) +++ python/trunk/Doc/tutorial/controlflow.rst Sat Jun 6 19:51:31 2009 @@ -285,7 +285,7 @@ and ``methodname`` is the name of a method that is defined by the object's type. Different types define different methods. Methods of different types may have the same name without causing ambiguity. (It is possible to define your own - object types and methods, using *classes*, as discussed later in this tutorial.) + object types and methods, using *classes*, see :ref:`tut-classes`) The method :meth:`append` shown in the example is defined for list objects; it adds a new element at the end of the list. In this example it is equivalent to ``result = result + [b]``, but more efficient. From python-checkins at python.org Sat Jun 6 20:02:18 2009 From: python-checkins at python.org (benjamin.peterson) Date: Sat, 6 Jun 2009 20:02:18 +0200 (CEST) Subject: [Python-checkins] r73259 - in python/branches/py3k: Doc/library/io.rst Lib/_pyio.py Lib/test/test_io.py Lib/test/test_memoryio.py Misc/NEWS Modules/_io/stringio.c Modules/_io/textio.c Message-ID: <20090606180218.0CBB1D80D@mail.python.org> Author: benjamin.peterson Date: Sat Jun 6 20:02:12 2009 New Revision: 73259 Log: give the C implementation of TextIOWrapper the errors property #6217 Modified: python/branches/py3k/Doc/library/io.rst python/branches/py3k/Lib/_pyio.py python/branches/py3k/Lib/test/test_io.py python/branches/py3k/Lib/test/test_memoryio.py python/branches/py3k/Misc/NEWS python/branches/py3k/Modules/_io/stringio.c python/branches/py3k/Modules/_io/textio.c Modified: python/branches/py3k/Doc/library/io.rst ============================================================================== --- python/branches/py3k/Doc/library/io.rst (original) +++ python/branches/py3k/Doc/library/io.rst Sat Jun 6 20:02:12 2009 @@ -600,6 +600,10 @@ The name of the encoding used to decode the stream's bytes into strings, and to encode strings into bytes. + .. attribute:: errors + + The error setting of the decoder or encoder. + .. attribute:: newlines A string, a tuple of strings, or ``None``, indicating the newlines @@ -665,13 +669,9 @@ If *line_buffering* is ``True``, :meth:`flush` is implied when a call to write contains a newline character. - :class:`TextIOWrapper` provides these data attributes in addition to those of + :class:`TextIOWrapper` provides one attribute in addition to those of :class:`TextIOBase` and its parents: - .. attribute:: errors - - The encoding and decoding error setting. - .. attribute:: line_buffering Whether line buffering is enabled. Modified: python/branches/py3k/Lib/_pyio.py ============================================================================== --- python/branches/py3k/Lib/_pyio.py (original) +++ python/branches/py3k/Lib/_pyio.py Sat Jun 6 20:02:12 2009 @@ -1286,6 +1286,13 @@ """ return None + @property + def errors(self): + """Error setting of the decoder or encoder. + + Subclasses should override.""" + return None + io.TextIOBase.register(TextIOBase) @@ -1933,6 +1940,10 @@ return object.__repr__(self) @property + def errors(self): + return None + + @property def encoding(self): return None Modified: python/branches/py3k/Lib/test/test_io.py ============================================================================== --- python/branches/py3k/Lib/test/test_io.py (original) +++ python/branches/py3k/Lib/test/test_io.py Sat Jun 6 20:02:12 2009 @@ -2024,6 +2024,12 @@ with self.open(filename, 'rb') as f: self.assertEquals(f.read(), 'bbbzzz'.encode(charset)) + def test_errors_property(self): + with self.open(support.TESTFN, "w") as f: + self.assertEqual(f.errors, "strict") + with self.open(support.TESTFN, "w", errors="replace") as f: + self.assertEqual(f.errors, "replace") + class CTextIOWrapperTest(TextIOWrapperTest): Modified: python/branches/py3k/Lib/test/test_memoryio.py ============================================================================== --- python/branches/py3k/Lib/test/test_memoryio.py (original) +++ python/branches/py3k/Lib/test/test_memoryio.py Sat Jun 6 20:02:12 2009 @@ -459,9 +459,9 @@ # These are just dummy values but we nevertheless check them for fear # of unexpected breakage. - self.assertTrue(memio.encoding is None) - self.assertEqual(memio.errors, "strict") - self.assertEqual(memio.line_buffering, False) + self.assertIsNone(memio.encoding) + self.assertIsNone(memio.errors) + self.assertFalse(memio.line_buffering) def test_newline_none(self): # newline=None Modified: python/branches/py3k/Misc/NEWS ============================================================================== --- python/branches/py3k/Misc/NEWS (original) +++ python/branches/py3k/Misc/NEWS Sat Jun 6 20:02:12 2009 @@ -21,6 +21,10 @@ Library ------- +- Issue #6217: The C implementation of io.TextIOWrapper didn't include the + errors property. Additionally, the errors and encoding properties of StringIO + are always None now. + - Issue #6137: The pickle module now translates module names when loading or dumping pickles with a 2.x-compatible protocol, in order to make data sharing and migration easier. This behaviour can be disabled using the Modified: python/branches/py3k/Modules/_io/stringio.c ============================================================================== --- python/branches/py3k/Modules/_io/stringio.c (original) +++ python/branches/py3k/Modules/_io/stringio.c Sat Jun 6 20:02:12 2009 @@ -661,22 +661,6 @@ } static PyObject * -stringio_encoding(StringIOObject *self, void *context) -{ - CHECK_INITIALIZED(self); - CHECK_CLOSED(self); - Py_RETURN_NONE; -} - -static PyObject * -stringio_errors(StringIOObject *self, void *context) -{ - CHECK_INITIALIZED(self); - CHECK_CLOSED(self); - return PyUnicode_FromString("strict"); -} - -static PyObject * stringio_line_buffering(StringIOObject *self, void *context) { CHECK_INITIALIZED(self); @@ -720,8 +704,6 @@ will be found. */ {"buffer", (getter)stringio_buffer, NULL, NULL}, - {"encoding", (getter)stringio_encoding, NULL, NULL}, - {"errors", (getter)stringio_errors, NULL, NULL}, {"line_buffering", (getter)stringio_line_buffering, NULL, NULL}, {NULL} }; Modified: python/branches/py3k/Modules/_io/textio.c ============================================================================== --- python/branches/py3k/Modules/_io/textio.c (original) +++ python/branches/py3k/Modules/_io/textio.c Sat Jun 6 20:02:12 2009 @@ -104,6 +104,18 @@ Py_RETURN_NONE; } +PyDoc_STRVAR(TextIOBase_errors_doc, + "The error setting of the decoder or encoder.\n" + "\n" + "Subclasses should override.\n" + ); + +static PyObject * +TextIOBase_errors_get(PyObject *self, void *context) +{ + Py_RETURN_NONE; +} + static PyMethodDef TextIOBase_methods[] = { {"detach", (PyCFunction)TextIOBase_detach, METH_NOARGS, TextIOBase_detach_doc}, @@ -116,6 +128,7 @@ static PyGetSetDef TextIOBase_getset[] = { {"encoding", (getter)TextIOBase_encoding_get, NULL, TextIOBase_encoding_doc}, {"newlines", (getter)TextIOBase_newlines_get, NULL, TextIOBase_newlines_doc}, + {"errors", (getter)TextIOBase_errors_get, NULL, TextIOBase_errors_doc}, {NULL} }; @@ -2462,6 +2475,13 @@ } static PyObject * +TextIOWrapper_errors_get(PyTextIOWrapperObject *self, void *context) +{ + CHECK_INITIALIZED(self); + return PyUnicode_FromString(PyBytes_AS_STRING(self->errors)); +} + +static PyObject * TextIOWrapper_chunk_size_get(PyTextIOWrapperObject *self, void *context) { CHECK_INITIALIZED(self); @@ -2519,6 +2539,7 @@ /* {"mode", (getter)TextIOWrapper_mode_get, NULL, NULL}, */ {"newlines", (getter)TextIOWrapper_newlines_get, NULL, NULL}, + {"errors", (getter)TextIOWrapper_errors_get, NULL, NULL}, {"_CHUNK_SIZE", (getter)TextIOWrapper_chunk_size_get, (setter)TextIOWrapper_chunk_size_set, NULL}, {NULL} From python-checkins at python.org Sat Jun 6 20:21:58 2009 From: python-checkins at python.org (georg.brandl) Date: Sat, 6 Jun 2009 20:21:58 +0200 (CEST) Subject: [Python-checkins] r73260 - in python/trunk: Doc/library/platform.rst Doc/library/tkinter.rst Lib/imputil.py Objects/unicodeobject.c Message-ID: <20090606182158.8625ED803@mail.python.org> Author: georg.brandl Date: Sat Jun 6 20:21:58 2009 New Revision: 73260 Log: #6224: s/JPython/Jython/, and remove one link to a module nine years old. Modified: python/trunk/Doc/library/platform.rst python/trunk/Doc/library/tkinter.rst python/trunk/Lib/imputil.py python/trunk/Objects/unicodeobject.c Modified: python/trunk/Doc/library/platform.rst ============================================================================== --- python/trunk/Doc/library/platform.rst (original) +++ python/trunk/Doc/library/platform.rst Sat Jun 6 20:21:58 2009 @@ -169,7 +169,7 @@ .. function:: java_ver(release='', vendor='', vminfo=('','',''), osinfo=('','','')) - Version interface for JPython. + Version interface for Jython. Returns a tuple ``(release, vendor, vminfo, osinfo)`` with *vminfo* being a tuple ``(vm_name, vm_release, vm_vendor)`` and *osinfo* being a tuple Modified: python/trunk/Doc/library/tkinter.rst ============================================================================== --- python/trunk/Doc/library/tkinter.rst (original) +++ python/trunk/Doc/library/tkinter.rst Sat Jun 6 20:21:58 2009 @@ -29,9 +29,6 @@ `Tkinter reference: a GUI for Python `_ On-line reference material. - `Tkinter for JPython `_ - The Jython interface to Tkinter. - `Python and Tkinter Programming `_ The book by John Grayson (ISBN 1-884777-81-3). Modified: python/trunk/Lib/imputil.py ============================================================================== --- python/trunk/Lib/imputil.py (original) +++ python/trunk/Lib/imputil.py Sat Jun 6 20:21:58 2009 @@ -14,7 +14,7 @@ del warnpy3k # note: avoid importing non-builtin modules -import imp ### not available in JPython? +import imp ### not available in Jython? import sys import __builtin__ @@ -25,7 +25,7 @@ __all__ = ["ImportManager","Importer","BuiltinImporter"] _StringType = type('') -_ModuleType = type(sys) ### doesn't work in JPython... +_ModuleType = type(sys) ### doesn't work in Jython... class ImportManager: "Manage the import process." @@ -639,8 +639,8 @@ # TODO # # from Finn Bock: -# type(sys) is not a module in JPython. what to use instead? -# imp.C_EXTENSION is not in JPython. same for get_suffixes and new_module +# type(sys) is not a module in Jython. what to use instead? +# imp.C_EXTENSION is not in Jython. same for get_suffixes and new_module # # given foo.py of: # import sys Modified: python/trunk/Objects/unicodeobject.c ============================================================================== --- python/trunk/Objects/unicodeobject.c (original) +++ python/trunk/Objects/unicodeobject.c Sat Jun 6 20:21:58 2009 @@ -6308,7 +6308,7 @@ /* This code should go into some future Unicode collation support module. The basic comparison should compare ordinals on a naive - basis (this is what Java does and thus JPython too). */ + basis (this is what Java does and thus Jython too). */ /* speedy UTF-16 code point order comparison */ /* gleaned from: */ From python-checkins at python.org Sat Jun 6 20:27:26 2009 From: python-checkins at python.org (guilherme.polo) Date: Sat, 6 Jun 2009 20:27:26 +0200 (CEST) Subject: [Python-checkins] r73261 - python/branches/tk_and_idle_maintenance/Lib/lib-tk/test/test_tkinter/test_canvas.py Message-ID: <20090606182726.B847BC406@mail.python.org> Author: guilherme.polo Date: Sat Jun 6 20:27:26 2009 New Revision: 73261 Log: More tests for Tkinter.Canvas. Modified: python/branches/tk_and_idle_maintenance/Lib/lib-tk/test/test_tkinter/test_canvas.py Modified: python/branches/tk_and_idle_maintenance/Lib/lib-tk/test/test_tkinter/test_canvas.py ============================================================================== --- python/branches/tk_and_idle_maintenance/Lib/lib-tk/test/test_tkinter/test_canvas.py (original) +++ python/branches/tk_and_idle_maintenance/Lib/lib-tk/test/test_tkinter/test_canvas.py Sat Jun 6 20:27:26 2009 @@ -20,7 +20,6 @@ orig.remove(tag) self.assertFalse(orig) - def test_addtag(self): pass def test_bbox(self): @@ -42,8 +41,18 @@ for indx, item in enumerate(zip(ba[2:], bb[2:])): self.assertEqual(max(item), res[indx + 2]) - def test_tag(self): pass - def test_canvasxy(self): pass + def test_tagbind_unbind(self): + # XXX Very likely to contain a leak, will test soon. + pass + + def test_canvasx(self, meth='canvasx'): + x = getattr(self.canvas, meth)(832, 5) + self.assertTrue(isinstance(x, float)) + self.assertEqual(x, 830) + self.assertEqual(getattr(self.canvas, meth)(832), 832) + + def test_canvasy(self): + self.test_canvasx('canvasy') def test_coords(self): coords = self.canvas.coords('x') @@ -97,7 +106,7 @@ winid = self.canvas.create_window(1, 2) self.assertEqual(self.canvas.type(winid), 'window') - for key, val in locals().iteritems(): + for key, val in locals().items(): if key.endswith('id'): self.assertTrue(isinstance(val, int)) @@ -151,7 +160,43 @@ self.canvas.dtag('b') self.verify_tags(['c'], self.canvas.gettags(x)) - def test_find(self): pass + def test_find(self): + self.assertEqual(self.canvas.find_withtag(1), ()) + self.assertEqual(self.canvas.find_all(), ()) + + lid = self.canvas.create_line(10, 10, 20, 20, tags='a') + tid = self.canvas.create_text(30, 30, text='x', tags='a') + + self.assertEqual(self.canvas.find_all(), (lid, tid)) + + self.assertEqual(self.canvas.find_withtag(tid), (tid, )) + atags = self.canvas.find_withtag('a') + self.assertEqual(len(atags), 2) + self.assertIn(tid, atags) + self.assertIn(lid, atags) + self.assertEqual(self.canvas.find_withtag('x'), ()) + + self.assertEqual(self.canvas.find_overlapping(30, 30, 30, 30), (tid, )) + self.assertEqual(self.canvas.find_overlapping(15, 15, 30, 30), + (lid, tid)) + self.assertEqual(self.canvas.find_overlapping(5, 5, 8, 8), ()) + + self.assertEqual(self.canvas.find_enclosed(10, 10, 15, 15), ()) + self.assertEqual(self.canvas.find_enclosed(8, 8, 22, 22), (lid, )) + + self.assertEqual(self.canvas.find_above(lid), (tid, )) + self.canvas.tag_lower(tid) + self.assertEqual(self.canvas.find_above(lid), ()) + + self.assertEqual(self.canvas.find_below(lid), (tid, )) + self.canvas.tag_raise(tid) + self.assertEqual(self.canvas.find_below(lid), ()) + + self.assertEqual(self.canvas.find_closest(19, 19), (lid, )) + self.assertEqual(self.canvas.find_closest(19, 19, 10), (tid, )) + self.assertEqual(self.canvas.find_closest(19, 19, 10, tid), (lid, )) + self.canvas.tag_raise(lid) + self.assertEqual(self.canvas.find_closest(19, 19, 10), (lid, )) def test_focus(self): # XXX This used to raise Tkinter.TclError since canvas.focus allowed @@ -212,12 +257,88 @@ # no selection set self.assertRaises(Tkinter.TclError, self.canvas.index, tid, 'sel.first') - def test_insert(self): pass - def test_itemcget(self): pass - def test_itemconfigure(self): pass - def test_move(self): pass - def test_postscript(self): pass # XXX - def test_scale(self): pass + def test_insert(self): + # XXX The following used to be "supported" since canvas.insert allowed + # any amount of arguments, include invalid amounts. + self.assertRaises(TypeError, self.canvas.insert, 0) + + self.assertRaises(Tkinter.TclError, self.canvas.insert, 0, 0) + + tid = self.canvas.create_text(10, 10, text='hi') + l1 = self.canvas.create_line(5, 5, 20, 20, tags='a') + l2 = self.canvas.create_line(30, 30, 15, 15, tags='a') + + self.canvas.insert(tid, 'end', ' there') + self.assertEqual(self.canvas.itemcget(tid, 'text'), 'hi there') + + l1_coords = [5, 5, 20, 20] + l2_coords = [30, 30, 15, 15] + for indx, item in enumerate(self.canvas.coords(l1)): + self.assertAlmostEqual(item, l1_coords[indx]) + for indx, item in enumerate(self.canvas.coords(l2)): + self.assertAlmostEqual(item, l2_coords[indx]) + self.canvas.insert('a', '@20,20', (10, 10)) + l1_coords = l1_coords[:2] + [10, 10] + l1_coords[2:] + l2_coords = l2_coords[:2] + [10, 10] + l2_coords[2:] + for indx, item in enumerate(self.canvas.coords(l1)): + self.assertAlmostEqual(item, l1_coords[indx]) + for indx, item in enumerate(self.canvas.coords(l2)): + self.assertAlmostEqual(item, l2_coords[indx]) + + def test_itemcget(self): + x = self.canvas.create_line(1, 2, 3, 4, + fill='blue', activefill='yellow', state='normal') + self.assertEqual(self.canvas.itemcget(x, 'fill'), 'blue') + self.assertEqual(self.canvas.itemcget(x, 'activefill'), 'yellow') + self.assertEqual(self.canvas.itemcget(x, 'state'), 'normal') + + self.assertRaises(Tkinter.TclError, self.canvas.itemcget, x, 'image') + + def test_itemconfigure(self): + self.assertEqual(self.canvas.itemconfigure(0), {}) + + tid = self.canvas.create_text(10, 10) + self.assertRaises(Tkinter.TclError, self.canvas.itemconfigure, + tid, 'image') + + self.assertEqual(self.canvas.itemconfigure(tid, 'font'), + self.canvas.itemconfigure(tid)['font']) + + self.assertIs(self.canvas.itemconfigure(0, 'image'), None) + + def test_move(self): + # XXX These used to raise Tkinter.TclError + self.assertRaises(TypeError, self.canvas.move) + self.assertRaises(TypeError, self.canvas.move, 1) + self.assertRaises(TypeError, self.canvas.move, 1, 2) + + tid = self.canvas.create_text(10, 10, tags='a') + lid = self.canvas.create_line(50, 50, 70, 90, tags='a') + self.canvas.move('a', -5, 5) + self.assertEqual(self.canvas.coords(tid), [5, 15]) + self.assertEqual(self.canvas.coords(lid), [45, 55, 65, 95]) + + def test_postscript(self): + ps = self.canvas.postscript() + self.assertTrue(isinstance(ps, basestring)) + + self.assertRaises(Tkinter.TclError, self.canvas.postscript, + invalid='val') + self.assertTrue(isinstance(self.canvas.postscript(x=10, y=10), + basestring)) + + def test_scale(self): + # XXX All these used to raise Tkinter.TclError + self.assertRaises(TypeError, self.canvas.scale) + self.assertRaises(TypeError, self.canvas.scale, 0) + self.assertRaises(TypeError, self.canvas.scale, 0, 1) + self.assertRaises(TypeError, self.canvas.scale, 0, 1, 2) + self.assertRaises(TypeError, self.canvas.scale, 0, 1, 2, 3) + + # Supposing tagOrId is not None, can canvas.scale + # raise Tkinter.TclError ? + self.assertIs(self.canvas.scale(0, 1, 2, 3, 4), None) + def test_scan(self): pass def test_select(self): pass From buildbot at python.org Sat Jun 6 20:51:48 2009 From: buildbot at python.org (buildbot at python.org) Date: Sat, 06 Jun 2009 18:51:48 +0000 Subject: [Python-checkins] buildbot failure in sparc solaris10 gcc 3.x Message-ID: <20090606185148.55D1CD860@mail.python.org> The Buildbot has detected a new failure of sparc solaris10 gcc 3.x. Full details are available at: http://www.python.org/dev/buildbot/all/sparc%20solaris10%20gcc%203.x/builds/793 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: loewis-sun Build Reason: Build Source Stamp: [branch branches/py3k] HEAD Blamelist: antoine.pitrou,benjamin.peterson BUILD FAILED: failed test Excerpt from the test logfile: 2 tests failed: test_capi test_posix ====================================================================== ERROR: test_getcwd_long_pathnames (test.test_posix.PosixTester) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home2/buildbot/slave/3.x.loewis-sun/build/Lib/test/test_posix.py", line 251, in test_getcwd_long_pathnames support.rmtree(base_path) File "/home2/buildbot/slave/3.x.loewis-sun/build/Lib/test/support.py", line 181, in rmtree shutil.rmtree(path) File "/home2/buildbot/slave/3.x.loewis-sun/build/Lib/shutil.py", line 239, in rmtree onerror(os.rmdir, path, sys.exc_info()) File "/home2/buildbot/slave/3.x.loewis-sun/build/Lib/shutil.py", line 237, in rmtree os.rmdir(path) OSError: [Errno 22] Invalid argument: '/home2/buildbot/slave/3.x.loewis-sun/build/@test.getcwd/@test.getcwd' sincerely, -The Buildbot From python-checkins at python.org Sat Jun 6 22:46:48 2009 From: python-checkins at python.org (benjamin.peterson) Date: Sat, 6 Jun 2009 22:46:48 +0200 (CEST) Subject: [Python-checkins] r73262 - python/branches/py3k/Modules/_io/textio.c Message-ID: <20090606204648.5516CDC5D@mail.python.org> Author: benjamin.peterson Date: Sat Jun 6 22:46:48 2009 New Revision: 73262 Log: stop throwing out all errors when PyObject_GetAttr fails Modified: python/branches/py3k/Modules/_io/textio.c Modified: python/branches/py3k/Modules/_io/textio.c ============================================================================== --- python/branches/py3k/Modules/_io/textio.c (original) +++ python/branches/py3k/Modules/_io/textio.c Sat Jun 6 22:46:48 2009 @@ -988,8 +988,12 @@ goto error; res = PyObject_GetAttrString(ci, "name"); Py_DECREF(ci); - if (res == NULL) - PyErr_Clear(); + if (res == NULL) { + if (PyErr_ExceptionMatches(PyExc_AttributeError)) + PyErr_Clear(); + else + goto error; + } else if (PyUnicode_Check(res)) { encodefuncentry *e = encodefuncs; while (e->name != NULL) { @@ -1011,8 +1015,12 @@ Py_TYPE(buffer) == &PyBufferedRandom_Type) { raw = PyObject_GetAttrString(buffer, "raw"); /* Cache the raw FileIO object to speed up 'closed' checks */ - if (raw == NULL) - PyErr_Clear(); + if (raw == NULL) { + if (PyErr_ExceptionMatches(PyExc_AttributeError)) + PyErr_Clear(); + else + goto error; + } else if (Py_TYPE(raw) == &PyFileIO_Type) self->raw = raw; else @@ -2468,8 +2476,13 @@ Py_RETURN_NONE; res = PyObject_GetAttr(self->decoder, _PyIO_str_newlines); if (res == NULL) { - PyErr_Clear(); - Py_RETURN_NONE; + if (PyErr_ExceptionMatches(PyExc_AttributeError)) { + PyErr_Clear(); + Py_RETURN_NONE; + } + else { + return NULL; + } } return res; } From python-checkins at python.org Sat Jun 6 23:09:04 2009 From: python-checkins at python.org (guilherme.polo) Date: Sat, 6 Jun 2009 23:09:04 +0200 (CEST) Subject: [Python-checkins] r73263 - python/branches/tk_and_idle_maintenance/Lib/lib-tk/test/test_tkinter/test_listbox.py Message-ID: <20090606210904.15388D647@mail.python.org> Author: guilherme.polo Date: Sat Jun 6 23:09:03 2009 New Revision: 73263 Log: Some tests for nearest and activate. Modified: python/branches/tk_and_idle_maintenance/Lib/lib-tk/test/test_tkinter/test_listbox.py Modified: python/branches/tk_and_idle_maintenance/Lib/lib-tk/test/test_tkinter/test_listbox.py ============================================================================== --- python/branches/tk_and_idle_maintenance/Lib/lib-tk/test/test_tkinter/test_listbox.py (original) +++ python/branches/tk_and_idle_maintenance/Lib/lib-tk/test/test_tkinter/test_listbox.py Sat Jun 6 23:09:03 2009 @@ -14,7 +14,10 @@ def tearDown(self): self.lb.destroy() - def test_activate(self): pass + def test_activate(self): + self.lb.insert(0, 'a', 'b c') + self.lb.activate(1) + self.assertEqual(self.lb.index('active'), 1) def test_bbox(self): self.assertRaises(Tkinter.TclError, self.lb.bbox, '@1.2') @@ -65,7 +68,22 @@ self.assertEqual(self.lb.index('2'), 2) # XXX how can I get a None using the index method ? - def test_nearest(self): pass + def test_nearest(self): + self.assertEqual(self.lb.nearest(10), -1) + + items = [1, 2, 3] + self.lb.insert(0, *tuple(items)) + self.assertTrue(isinstance(self.lb.nearest(10), int)) + self.lb.pack() + self.lb.update_idletasks() + for i in range(0, self.lb.winfo_height(), 5): + item = self.lb.get(self.lb.nearest(i)) + if item in items: + items.remove(item) + if not items: + break + self.assertFalse(items) + def test_scan(self): pass def test_see(self): From python-checkins at python.org Sat Jun 6 23:28:44 2009 From: python-checkins at python.org (guilherme.polo) Date: Sat, 6 Jun 2009 23:28:44 +0200 (CEST) Subject: [Python-checkins] r73264 - python/branches/tk_and_idle_maintenance/Lib/lib-tk/test/test_tkinter/test_canvas.py Message-ID: <20090606212844.F28CCC2AF@mail.python.org> Author: guilherme.polo Date: Sat Jun 6 23:28:44 2009 New Revision: 73264 Log: Some tests for tag bind/unbind and addtag. Modified: python/branches/tk_and_idle_maintenance/Lib/lib-tk/test/test_tkinter/test_canvas.py Modified: python/branches/tk_and_idle_maintenance/Lib/lib-tk/test/test_tkinter/test_canvas.py ============================================================================== --- python/branches/tk_and_idle_maintenance/Lib/lib-tk/test/test_tkinter/test_canvas.py (original) +++ python/branches/tk_and_idle_maintenance/Lib/lib-tk/test/test_tkinter/test_canvas.py Sat Jun 6 23:28:44 2009 @@ -20,7 +20,34 @@ orig.remove(tag) self.assertFalse(orig) - def test_addtag(self): pass + def test_addtag(self): + def verify_tags(a, b, c): + self.assertEqual(self.canvas.gettags(l1), a) + self.assertEqual(self.canvas.gettags(l2), b) + self.assertEqual(self.canvas.gettags(l3), c) + + l1 = self.canvas.create_line(10, 10, 20, 20) + l2 = self.canvas.create_line(15, 15, 25, 25) + l3 = self.canvas.create_line(20, 20, 30, 30) + + self.canvas.addtag_all('line') + verify_tags(('line', ), ('line', ), ('line', )) + + self.canvas.addtag_above('l3', l2) + verify_tags(('line', ), ('line', ), ('line', 'l3')) + self.canvas.addtag_below('l1', l2) + verify_tags(('line', 'l1'), ('line', ), ('line', 'l3')) + self.canvas.addtag_closest('start', 5, 5) + verify_tags(('line', 'l1', 'start'), ('line', ), ('line', 'l3')) + self.canvas.addtag_withtag('x', 'line') + verify_tags(('line', 'l1', 'start', 'x'), ('line', 'x'), + ('line', 'l3', 'x')) + self.canvas.addtag_overlapping('a', 10, 10, 17, 17) + verify_tags(('line', 'l1', 'start', 'x', 'a'), ('line', 'x', 'a'), + ('line', 'l3', 'x')) + self.canvas.addtag_enclosed('e', 12, 12, 28, 28) + verify_tags(('line', 'l1', 'start', 'x', 'a'), ('line', 'x', 'a', 'e'), + ('line', 'l3', 'x')) def test_bbox(self): self.assertIs(self.canvas.bbox('a'), None) @@ -42,8 +69,14 @@ self.assertEqual(max(item), res[indx + 2]) def test_tagbind_unbind(self): - # XXX Very likely to contain a leak, will test soon. - pass + self.assertFalse(self.canvas._tclCommands) + a = self.canvas.tag_bind('x', '', lambda: None) + b = self.canvas.tag_bind('x', '', lambda: None) + self.assertEqual(self.canvas._tclCommands, [a, b]) + self.canvas.tag_unbind('x', '') + self.canvas.tag_unbind('x', '', b) + self.canvas.tag_unbind('x', '', a) + self.assertFalse(self.canvas._tclCommands) def test_canvasx(self, meth='canvasx'): x = getattr(self.canvas, meth)(832, 5) From python-checkins at python.org Sat Jun 6 23:43:45 2009 From: python-checkins at python.org (guilherme.polo) Date: Sat, 6 Jun 2009 23:43:45 +0200 (CEST) Subject: [Python-checkins] r73265 - python/branches/tk_and_idle_maintenance/Lib/lib-tk/test/test_tkinter/test_canvas.py Message-ID: <20090606214345.BDBB3D6FF@mail.python.org> Author: guilherme.polo Date: Sat Jun 6 23:43:45 2009 New Revision: 73265 Log: Some tests for tag_lower and tag_raise. Modified: python/branches/tk_and_idle_maintenance/Lib/lib-tk/test/test_tkinter/test_canvas.py Modified: python/branches/tk_and_idle_maintenance/Lib/lib-tk/test/test_tkinter/test_canvas.py ============================================================================== --- python/branches/tk_and_idle_maintenance/Lib/lib-tk/test/test_tkinter/test_canvas.py (original) +++ python/branches/tk_and_idle_maintenance/Lib/lib-tk/test/test_tkinter/test_canvas.py Sat Jun 6 23:43:45 2009 @@ -339,6 +339,35 @@ self.assertIs(self.canvas.itemconfigure(0, 'image'), None) + def test_lower_raise(self): + # XXX These used to raise Tkinter.TclError + self.assertRaises(TypeError, self.canvas.tag_lower) + self.assertRaises(TypeError, self.canvas.tag_raise) + + t1 = self.canvas.create_text(10, 10, tags='t') + t2 = self.canvas.create_text(10, 10, tags='t') + t3 = self.canvas.create_text(10, 10, tags='t') + + self.canvas.focus('t') + self.assertEqual(self.canvas.focus(), t1) + + self.canvas.tag_lower(t2) + self.canvas.focus('t') + self.assertEqual(self.canvas.focus(), t2) + self.canvas.tag_lower(t3, t1) + self.canvas.focus('t') + self.assertEqual(self.canvas.focus(), t2) + self.canvas.tag_lower(t3) + self.canvas.focus('t') + self.assertEqual(self.canvas.focus(), t3) + + self.canvas.tag_raise(t3, t1) + self.canvas.focus('t') + self.assertEqual(self.canvas.focus(), t2) + self.canvas.tag_raise(t2) + self.canvas.focus('t') + self.assertEqual(self.canvas.focus(), t1) + def test_move(self): # XXX These used to raise Tkinter.TclError self.assertRaises(TypeError, self.canvas.move) From python-checkins at python.org Sun Jun 7 00:03:16 2009 From: python-checkins at python.org (guilherme.polo) Date: Sun, 7 Jun 2009 00:03:16 +0200 (CEST) Subject: [Python-checkins] r73266 - in python/branches/tk_and_idle_maintenance: Doc/c-api/list.rst Doc/howto/sockets.rst Doc/includes/email-unpack.py Doc/includes/mp_pool.py Doc/includes/mp_synchronize.py Doc/library/crypt.rst Doc/library/fcntl.rst Doc/library/imputil.rst Doc/library/logging.rst Doc/library/platform.rst Doc/library/rexec.rst Doc/library/shutil.rst Doc/library/signal.rst Doc/library/socket.rst Doc/library/tkinter.rst Doc/reference/simple_stmts.rst Doc/tools/roman.py Doc/tools/sphinxext/suspicious.py Doc/tutorial/controlflow.rst Doc/whatsnew/2.6.rst Lib/asyncore.py Lib/distutils/command/bdist_msi.py Lib/distutils/command/install.py Lib/distutils/extension.py Lib/distutils/tests/Setup.sample Lib/distutils/tests/test_extension.py Lib/distutils/tests/test_install.py Lib/imputil.py Lib/shutil.py Lib/test/formatfloat_testcases.txt Lib/test/test__locale.py Lib/test/test_pep352.py Lib/test/test_traceback.py Lib/test/test_unittest.py Lib/test/test_with.py Lib/traceback.py Lib/xmlrpclib.py Misc/NEWS Objects/dictobject.c Objects/unicodeobject.c Message-ID: <20090606220316.0EF28C540@mail.python.org> Author: guilherme.polo Date: Sun Jun 7 00:03:15 2009 New Revision: 73266 Log: Merged revisions 73163,73166,73170,73174,73182,73184,73186,73190,73196-73197,73201,73206,73212-73213,73215,73217,73224,73232,73238,73240,73243,73247,73250,73252,73257-73258,73260 via svnmerge from svn+ssh://pythondev/python/trunk ........ r73163 | georg.brandl | 2009-06-03 04:25:35 -0300 (Wed, 03 Jun 2009) | 1 line Use the preferred form of raise statements in the docs. ........ r73166 | tarek.ziade | 2009-06-03 07:26:26 -0300 (Wed, 03 Jun 2009) | 1 line added some tests for distutils.extension + code cleanup ........ r73170 | tarek.ziade | 2009-06-03 08:12:08 -0300 (Wed, 03 Jun 2009) | 1 line more cleanup and test coverage for distutils.extension ........ r73174 | tarek.ziade | 2009-06-03 08:20:44 -0300 (Wed, 03 Jun 2009) | 1 line assertion message was dropped ........ r73182 | josiah.carlson | 2009-06-03 16:46:21 -0300 (Wed, 03 Jun 2009) | 4 lines This fixes bug 5798 on OS X. This should also fix disconnect behavior cross-platform. ........ r73184 | josiah.carlson | 2009-06-03 16:51:52 -0300 (Wed, 03 Jun 2009) | 2 lines Fix for line wrap ugly. ........ r73186 | georg.brandl | 2009-06-03 18:21:09 -0300 (Wed, 03 Jun 2009) | 1 line #6174: fix indentation in code example. ........ r73190 | georg.brandl | 2009-06-03 20:23:45 -0300 (Wed, 03 Jun 2009) | 2 lines Avoid PendingDeprecationWarnings emitted by deprecated unittest methods. ........ r73196 | benjamin.peterson | 2009-06-03 22:40:29 -0300 (Wed, 03 Jun 2009) | 1 line use the offical api ........ r73197 | tarek.ziade | 2009-06-04 04:31:52 -0300 (Thu, 04 Jun 2009) | 1 line improved test coverage for distutils.command.install and cleaned it up ........ r73201 | georg.brandl | 2009-06-04 05:58:32 -0300 (Thu, 04 Jun 2009) | 1 line #5767: remove sgmlop support from xmlrpclib; the sgmlop parser does not do much validation and is no longer much faster than e.g. the cElementTree XMLParser. ........ r73206 | georg.brandl | 2009-06-04 06:15:12 -0300 (Thu, 04 Jun 2009) | 1 line #3584: ignore trailing newlines when placing the caret for a SyntaxError location. ........ r73212 | georg.brandl | 2009-06-04 07:10:41 -0300 (Thu, 04 Jun 2009) | 1 line Better name for "Ctor". ........ r73213 | georg.brandl | 2009-06-04 07:15:57 -0300 (Thu, 04 Jun 2009) | 1 line #5967: note that the C slicing APIs do not support negative indices. ........ r73215 | georg.brandl | 2009-06-04 07:22:31 -0300 (Thu, 04 Jun 2009) | 1 line #6176: fix man page section for flock(2). ........ r73217 | georg.brandl | 2009-06-04 07:27:21 -0300 (Thu, 04 Jun 2009) | 1 line #6175: document that inet_aton supports alternate input formats with less than three dots. ........ r73224 | eric.smith | 2009-06-04 14:58:15 -0300 (Thu, 04 Jun 2009) | 1 line Minor documentation fixes for logging. ........ r73232 | georg.brandl | 2009-06-04 15:59:58 -0300 (Thu, 04 Jun 2009) | 1 line Add test for #3684. ........ r73238 | hirokazu.yamamoto | 2009-06-05 02:15:58 -0300 (Fri, 05 Jun 2009) | 1 line Fix test__locale on windows (Backport of r72365) ........ r73240 | eric.smith | 2009-06-05 09:33:26 -0300 (Fri, 05 Jun 2009) | 1 line Removed tests so that test_float pass on Windows. See issue 6198. ........ r73243 | tarek.ziade | 2009-06-05 10:37:29 -0300 (Fri, 05 Jun 2009) | 1 line reverting r72823 : Python trunk has to use latin-1 encoding ........ r73247 | michael.foord | 2009-06-05 11:14:34 -0300 (Fri, 05 Jun 2009) | 1 line Fix unittest discovery tests for Windows. Issue 6199 ........ r73250 | benjamin.peterson | 2009-06-05 16:09:28 -0300 (Fri, 05 Jun 2009) | 1 line only test for named pipe when os.stat doesn't raise #6209 ........ r73252 | georg.brandl | 2009-06-06 02:54:34 -0300 (Sat, 06 Jun 2009) | 1 line #6206: fix test__locale. ........ r73257 | georg.brandl | 2009-06-06 14:50:05 -0300 (Sat, 06 Jun 2009) | 1 line #6211: elaborate a bit on ways to call the function. ........ r73258 | georg.brandl | 2009-06-06 14:51:31 -0300 (Sat, 06 Jun 2009) | 1 line #6204: use a real reference instead of "see later". ........ r73260 | georg.brandl | 2009-06-06 15:21:58 -0300 (Sat, 06 Jun 2009) | 1 line #6224: s/JPython/Jython/, and remove one link to a module nine years old. ........ Added: python/branches/tk_and_idle_maintenance/Lib/distutils/tests/Setup.sample - copied unchanged from r73260, /python/trunk/Lib/distutils/tests/Setup.sample python/branches/tk_and_idle_maintenance/Lib/distutils/tests/test_extension.py - copied unchanged from r73260, /python/trunk/Lib/distutils/tests/test_extension.py Modified: python/branches/tk_and_idle_maintenance/ (props changed) python/branches/tk_and_idle_maintenance/Doc/c-api/list.rst python/branches/tk_and_idle_maintenance/Doc/howto/sockets.rst python/branches/tk_and_idle_maintenance/Doc/includes/email-unpack.py python/branches/tk_and_idle_maintenance/Doc/includes/mp_pool.py python/branches/tk_and_idle_maintenance/Doc/includes/mp_synchronize.py python/branches/tk_and_idle_maintenance/Doc/library/crypt.rst python/branches/tk_and_idle_maintenance/Doc/library/fcntl.rst python/branches/tk_and_idle_maintenance/Doc/library/imputil.rst python/branches/tk_and_idle_maintenance/Doc/library/logging.rst python/branches/tk_and_idle_maintenance/Doc/library/platform.rst python/branches/tk_and_idle_maintenance/Doc/library/rexec.rst python/branches/tk_and_idle_maintenance/Doc/library/shutil.rst python/branches/tk_and_idle_maintenance/Doc/library/signal.rst python/branches/tk_and_idle_maintenance/Doc/library/socket.rst python/branches/tk_and_idle_maintenance/Doc/library/tkinter.rst python/branches/tk_and_idle_maintenance/Doc/reference/simple_stmts.rst python/branches/tk_and_idle_maintenance/Doc/tools/roman.py python/branches/tk_and_idle_maintenance/Doc/tools/sphinxext/suspicious.py python/branches/tk_and_idle_maintenance/Doc/tutorial/controlflow.rst python/branches/tk_and_idle_maintenance/Doc/whatsnew/2.6.rst python/branches/tk_and_idle_maintenance/Lib/asyncore.py python/branches/tk_and_idle_maintenance/Lib/distutils/command/bdist_msi.py python/branches/tk_and_idle_maintenance/Lib/distutils/command/install.py python/branches/tk_and_idle_maintenance/Lib/distutils/extension.py python/branches/tk_and_idle_maintenance/Lib/distutils/tests/test_install.py python/branches/tk_and_idle_maintenance/Lib/imputil.py python/branches/tk_and_idle_maintenance/Lib/shutil.py python/branches/tk_and_idle_maintenance/Lib/test/formatfloat_testcases.txt python/branches/tk_and_idle_maintenance/Lib/test/test__locale.py python/branches/tk_and_idle_maintenance/Lib/test/test_pep352.py python/branches/tk_and_idle_maintenance/Lib/test/test_traceback.py python/branches/tk_and_idle_maintenance/Lib/test/test_unittest.py python/branches/tk_and_idle_maintenance/Lib/test/test_with.py python/branches/tk_and_idle_maintenance/Lib/traceback.py python/branches/tk_and_idle_maintenance/Lib/xmlrpclib.py python/branches/tk_and_idle_maintenance/Misc/NEWS python/branches/tk_and_idle_maintenance/Objects/dictobject.c python/branches/tk_and_idle_maintenance/Objects/unicodeobject.c Modified: python/branches/tk_and_idle_maintenance/Doc/c-api/list.rst ============================================================================== --- python/branches/tk_and_idle_maintenance/Doc/c-api/list.rst (original) +++ python/branches/tk_and_idle_maintenance/Doc/c-api/list.rst Sun Jun 7 00:03:15 2009 @@ -149,9 +149,10 @@ .. cfunction:: PyObject* PyList_GetSlice(PyObject *list, Py_ssize_t low, Py_ssize_t high) - Return a list of the objects in *list* containing the objects *between* - *low* and *high*. Return *NULL* and set an exception if unsuccessful. - Analogous to ``list[low:high]``. + Return a list of the objects in *list* containing the objects *between* *low* + and *high*. Return *NULL* and set an exception if unsuccessful. Analogous + to ``list[low:high]``. Negative indices, as when slicing from Python, are not + supported. .. versionchanged:: 2.5 This function used an :ctype:`int` for *low* and *high*. This might @@ -163,7 +164,8 @@ Set the slice of *list* between *low* and *high* to the contents of *itemlist*. Analogous to ``list[low:high] = itemlist``. The *itemlist* may be *NULL*, indicating the assignment of an empty list (slice deletion). - Return ``0`` on success, ``-1`` on failure. + Return ``0`` on success, ``-1`` on failure. Negative indices, as when + slicing from Python, are not supported. .. versionchanged:: 2.5 This function used an :ctype:`int` for *low* and *high*. This might Modified: python/branches/tk_and_idle_maintenance/Doc/howto/sockets.rst ============================================================================== --- python/branches/tk_and_idle_maintenance/Doc/howto/sockets.rst (original) +++ python/branches/tk_and_idle_maintenance/Doc/howto/sockets.rst Sun Jun 7 00:03:15 2009 @@ -204,8 +204,7 @@ while totalsent < MSGLEN: sent = self.sock.send(msg[totalsent:]) if sent == 0: - raise RuntimeError, \ - "socket connection broken" + raise RuntimeError("socket connection broken") totalsent = totalsent + sent def myreceive(self): @@ -213,8 +212,7 @@ while len(msg) < MSGLEN: chunk = self.sock.recv(MSGLEN-len(msg)) if chunk == '': - raise RuntimeError, \ - "socket connection broken" + raise RuntimeError("socket connection broken") msg = msg + chunk return msg Modified: python/branches/tk_and_idle_maintenance/Doc/includes/email-unpack.py ============================================================================== --- python/branches/tk_and_idle_maintenance/Doc/includes/email-unpack.py (original) +++ python/branches/tk_and_idle_maintenance/Doc/includes/email-unpack.py Sun Jun 7 00:03:15 2009 @@ -37,7 +37,7 @@ os.mkdir(opts.directory) except OSError, e: # Ignore directory exists error - if e.errno <> errno.EEXIST: + if e.errno != errno.EEXIST: raise fp = open(msgfile) Modified: python/branches/tk_and_idle_maintenance/Doc/includes/mp_pool.py ============================================================================== --- python/branches/tk_and_idle_maintenance/Doc/includes/mp_pool.py (original) +++ python/branches/tk_and_idle_maintenance/Doc/includes/mp_pool.py Sun Jun 7 00:03:15 2009 @@ -149,21 +149,21 @@ except ZeroDivisionError: print '\tGot ZeroDivisionError as expected from pool.apply()' else: - raise AssertionError, 'expected ZeroDivisionError' + raise AssertionError('expected ZeroDivisionError') try: print pool.map(f, range(10)) except ZeroDivisionError: print '\tGot ZeroDivisionError as expected from pool.map()' else: - raise AssertionError, 'expected ZeroDivisionError' + raise AssertionError('expected ZeroDivisionError') try: print list(pool.imap(f, range(10))) except ZeroDivisionError: print '\tGot ZeroDivisionError as expected from list(pool.imap())' else: - raise AssertionError, 'expected ZeroDivisionError' + raise AssertionError('expected ZeroDivisionError') it = pool.imap(f, range(10)) for i in range(10): @@ -176,7 +176,7 @@ break else: if i == 5: - raise AssertionError, 'expected ZeroDivisionError' + raise AssertionError('expected ZeroDivisionError') assert i == 9 print '\tGot ZeroDivisionError as expected from IMapIterator.next()' Modified: python/branches/tk_and_idle_maintenance/Doc/includes/mp_synchronize.py ============================================================================== --- python/branches/tk_and_idle_maintenance/Doc/includes/mp_synchronize.py (original) +++ python/branches/tk_and_idle_maintenance/Doc/includes/mp_synchronize.py Sun Jun 7 00:03:15 2009 @@ -249,7 +249,7 @@ info = multiprocessing._debug_info() if info: print info - raise ValueError, 'there should be no positive refcounts left' + raise ValueError('there should be no positive refcounts left') if __name__ == '__main__': @@ -271,6 +271,6 @@ import multiprocessing.dummy as namespace else: print 'Usage:\n\t%s [processes | manager | threads]' % sys.argv[0] - raise SystemExit, 2 + raise SystemExit(2) test(namespace) Modified: python/branches/tk_and_idle_maintenance/Doc/library/crypt.rst ============================================================================== --- python/branches/tk_and_idle_maintenance/Doc/library/crypt.rst (original) +++ python/branches/tk_and_idle_maintenance/Doc/library/crypt.rst Sun Jun 7 00:03:15 2009 @@ -52,7 +52,8 @@ cryptedpasswd = pwd.getpwnam(username)[1] if cryptedpasswd: if cryptedpasswd == 'x' or cryptedpasswd == '*': - raise "Sorry, currently no support for shadow passwords" + raise NotImplementedError( + "Sorry, currently no support for shadow passwords") cleartext = getpass.getpass() return crypt.crypt(cleartext, cryptedpasswd) == cryptedpasswd else: Modified: python/branches/tk_and_idle_maintenance/Doc/library/fcntl.rst ============================================================================== --- python/branches/tk_and_idle_maintenance/Doc/library/fcntl.rst (original) +++ python/branches/tk_and_idle_maintenance/Doc/library/fcntl.rst Sun Jun 7 00:03:15 2009 @@ -96,7 +96,7 @@ Perform the lock operation *op* on file descriptor *fd* (file objects providing a :meth:`fileno` method are accepted as well). See the Unix manual - :manpage:`flock(3)` for details. (On some systems, this function is emulated + :manpage:`flock(2)` for details. (On some systems, this function is emulated using :cfunc:`fcntl`.) Modified: python/branches/tk_and_idle_maintenance/Doc/library/imputil.rst ============================================================================== --- python/branches/tk_and_idle_maintenance/Doc/library/imputil.rst (original) +++ python/branches/tk_and_idle_maintenance/Doc/library/imputil.rst Sun Jun 7 00:03:15 2009 @@ -160,7 +160,7 @@ parent = None q = import_module(head, qname, parent) if q: return q, tail - raise ImportError, "No module named " + qname + raise ImportError("No module named " + qname) def load_tail(q, tail): m = q @@ -171,7 +171,7 @@ mname = "%s.%s" % (m.__name__, head) m = import_module(head, mname, m) if not m: - raise ImportError, "No module named " + mname + raise ImportError("No module named " + mname) return m def ensure_fromlist(m, fromlist, recursive=0): @@ -189,7 +189,7 @@ subname = "%s.%s" % (m.__name__, sub) submod = import_module(sub, subname, m) if not submod: - raise ImportError, "No module named " + subname + raise ImportError("No module named " + subname) def import_module(partname, fqname, parent): try: Modified: python/branches/tk_and_idle_maintenance/Doc/library/logging.rst ============================================================================== --- python/branches/tk_and_idle_maintenance/Doc/library/logging.rst (original) +++ python/branches/tk_and_idle_maintenance/Doc/library/logging.rst Sun Jun 7 00:03:15 2009 @@ -69,7 +69,7 @@ DEBUG:root:This message should go to the log file If you run the script repeatedly, the additional log messages are appended to -the file. To create a new file each time, you can pass a filemode argument to +the file. To create a new file each time, you can pass a *filemode* argument to :func:`basicConfig` with a value of ``'w'``. Rather than managing the file size yourself, though, it is simpler to use a :class:`RotatingFileHandler`:: @@ -112,7 +112,7 @@ The most current file is always :file:`/tmp/logging_rotatingfile_example.out`, and each time it reaches the size limit it is renamed with the suffix ``.1``. Each of the existing backup files is renamed to increment the suffix -(``.1`` becomes ``.2``, etc.) and the ``.5`` file is erased. +(``.1`` becomes ``.2``, etc.) and the ``.6`` file is erased. Obviously this example sets the log length much much too small as an extreme example. You would want to set *maxBytes* to an appropriate value. Modified: python/branches/tk_and_idle_maintenance/Doc/library/platform.rst ============================================================================== --- python/branches/tk_and_idle_maintenance/Doc/library/platform.rst (original) +++ python/branches/tk_and_idle_maintenance/Doc/library/platform.rst Sun Jun 7 00:03:15 2009 @@ -169,7 +169,7 @@ .. function:: java_ver(release='', vendor='', vminfo=('','',''), osinfo=('','','')) - Version interface for JPython. + Version interface for Jython. Returns a tuple ``(release, vendor, vminfo, osinfo)`` with *vminfo* being a tuple ``(vm_name, vm_release, vm_vendor)`` and *osinfo* being a tuple Modified: python/branches/tk_and_idle_maintenance/Doc/library/rexec.rst ============================================================================== --- python/branches/tk_and_idle_maintenance/Doc/library/rexec.rst (original) +++ python/branches/tk_and_idle_maintenance/Doc/library/rexec.rst Sun Jun 7 00:03:15 2009 @@ -272,11 +272,11 @@ elif mode in ('w', 'wb', 'a', 'ab'): # check filename : must begin with /tmp/ if file[:5]!='/tmp/': - raise IOError, "can't write outside /tmp" + raise IOError("can't write outside /tmp") elif (string.find(file, '/../') >= 0 or file[:3] == '../' or file[-3:] == '/..'): - raise IOError, "'..' in filename forbidden" - else: raise IOError, "Illegal open() mode" + raise IOError("'..' in filename forbidden") + else: raise IOError("Illegal open() mode") return open(file, mode, buf) Notice that the above code will occasionally forbid a perfectly valid filename; Modified: python/branches/tk_and_idle_maintenance/Doc/library/shutil.rst ============================================================================== --- python/branches/tk_and_idle_maintenance/Doc/library/shutil.rst (original) +++ python/branches/tk_and_idle_maintenance/Doc/library/shutil.rst Sun Jun 7 00:03:15 2009 @@ -216,7 +216,7 @@ except OSError, why: errors.extend((src, dst, str(why))) if errors: - raise Error, errors + raise Error(errors) Another example that uses the :func:`ignore_patterns` helper:: Modified: python/branches/tk_and_idle_maintenance/Doc/library/signal.rst ============================================================================== --- python/branches/tk_and_idle_maintenance/Doc/library/signal.rst (original) +++ python/branches/tk_and_idle_maintenance/Doc/library/signal.rst Sun Jun 7 00:03:15 2009 @@ -232,7 +232,7 @@ def handler(signum, frame): print 'Signal handler called with signal', signum - raise IOError, "Couldn't open device!" + raise IOError("Couldn't open device!") # Set the signal handler and a 5-second alarm signal.signal(signal.SIGALRM, handler) Modified: python/branches/tk_and_idle_maintenance/Doc/library/socket.rst ============================================================================== --- python/branches/tk_and_idle_maintenance/Doc/library/socket.rst (original) +++ python/branches/tk_and_idle_maintenance/Doc/library/socket.rst Sun Jun 7 00:03:15 2009 @@ -401,6 +401,9 @@ library and needs objects of type :ctype:`struct in_addr`, which is the C type for the 32-bit packed binary this function returns. + :func:`inet_aton` also accepts strings with less than three dots; see the + Unix manual page :manpage:`inet(3)` for details. + If the IPv4 address string passed to this function is invalid, :exc:`socket.error` will be raised. Note that exactly what is valid depends on the underlying C implementation of :cfunc:`inet_aton`. Modified: python/branches/tk_and_idle_maintenance/Doc/library/tkinter.rst ============================================================================== --- python/branches/tk_and_idle_maintenance/Doc/library/tkinter.rst (original) +++ python/branches/tk_and_idle_maintenance/Doc/library/tkinter.rst Sun Jun 7 00:03:15 2009 @@ -29,9 +29,6 @@ `Tkinter reference: a GUI for Python `_ On-line reference material. - `Tkinter for JPython `_ - The Jython interface to Tkinter. - `Python and Tkinter Programming `_ The book by John Grayson (ISBN 1-884777-81-3). Modified: python/branches/tk_and_idle_maintenance/Doc/reference/simple_stmts.rst ============================================================================== --- python/branches/tk_and_idle_maintenance/Doc/reference/simple_stmts.rst (original) +++ python/branches/tk_and_idle_maintenance/Doc/reference/simple_stmts.rst Sun Jun 7 00:03:15 2009 @@ -288,7 +288,7 @@ The extended form, ``assert expression1, expression2``, is equivalent to :: if __debug__: - if not expression1: raise AssertionError, expression2 + if not expression1: raise AssertionError(expression2) .. index:: single: __debug__ Modified: python/branches/tk_and_idle_maintenance/Doc/tools/roman.py ============================================================================== --- python/branches/tk_and_idle_maintenance/Doc/tools/roman.py (original) +++ python/branches/tk_and_idle_maintenance/Doc/tools/roman.py Sun Jun 7 00:03:15 2009 @@ -40,9 +40,9 @@ def toRoman(n): """convert integer to Roman numeral""" if not (0 < n < 5000): - raise OutOfRangeError, "number out of range (must be 1..4999)" - if int(n) <> n: - raise NotIntegerError, "decimals can not be converted" + raise OutOfRangeError("number out of range (must be 1..4999)") + if int(n) != n: + raise NotIntegerError("decimals can not be converted") result = "" for numeral, integer in romanNumeralMap: @@ -67,9 +67,9 @@ def fromRoman(s): """convert Roman numeral to integer""" if not s: - raise InvalidRomanNumeralError, 'Input can not be blank' + raise InvalidRomanNumeralError('Input can not be blank') if not romanNumeralPattern.search(s): - raise InvalidRomanNumeralError, 'Invalid Roman numeral: %s' % s + raise InvalidRomanNumeralError('Invalid Roman numeral: %s' % s) result = 0 index = 0 Modified: python/branches/tk_and_idle_maintenance/Doc/tools/sphinxext/suspicious.py ============================================================================== --- python/branches/tk_and_idle_maintenance/Doc/tools/sphinxext/suspicious.py (original) +++ python/branches/tk_and_idle_maintenance/Doc/tools/sphinxext/suspicious.py Sun Jun 7 00:03:15 2009 @@ -159,7 +159,7 @@ except IOError: return for i, row in enumerate(csv.reader(f)): if len(row) != 4: - raise ValueError, "wrong format in %s, line %d: %s" % (filename, i+1, row) + raise ValueError("wrong format in %s, line %d: %s" % (filename, i+1, row)) docname, lineno, issue, text = row docname = docname.decode('utf-8') if lineno: lineno = int(lineno) Modified: python/branches/tk_and_idle_maintenance/Doc/tutorial/controlflow.rst ============================================================================== --- python/branches/tk_and_idle_maintenance/Doc/tutorial/controlflow.rst (original) +++ python/branches/tk_and_idle_maintenance/Doc/tutorial/controlflow.rst Sun Jun 7 00:03:15 2009 @@ -285,7 +285,7 @@ and ``methodname`` is the name of a method that is defined by the object's type. Different types define different methods. Methods of different types may have the same name without causing ambiguity. (It is possible to define your own - object types and methods, using *classes*, as discussed later in this tutorial.) + object types and methods, using *classes*, see :ref:`tut-classes`) The method :meth:`append` shown in the example is defined for list objects; it adds a new element at the end of the list. In this example it is equivalent to ``result = result + [b]``, but more efficient. @@ -312,14 +312,23 @@ def ask_ok(prompt, retries=4, complaint='Yes or no, please!'): while True: ok = raw_input(prompt) - if ok in ('y', 'ye', 'yes'): return True - if ok in ('n', 'no', 'nop', 'nope'): return False + if ok in ('y', 'ye', 'yes'): + return True + if ok in ('n', 'no', 'nop', 'nope'): + return False retries = retries - 1 - if retries < 0: raise IOError('refusenik user') + if retries < 0: + raise IOError('refusenik user') print complaint -This function can be called either like this: ``ask_ok('Do you really want to -quit?')`` or like this: ``ask_ok('OK to overwrite the file?', 2)``. +This function can be called in several ways: + +* giving only the mandatory argument: + ``ask_ok('Do you really want to quit?')`` +* giving one of the optional arguments: + ``ask_ok('OK to overwrite the file?', 2)`` +* or even giving all arguments: + ``ask_ok('OK to overwrite the file?', 2, 'Come on, only yes or no!')`` This example also introduces the :keyword:`in` keyword. This tests whether or not a sequence contains a certain value. Modified: python/branches/tk_and_idle_maintenance/Doc/whatsnew/2.6.rst ============================================================================== --- python/branches/tk_and_idle_maintenance/Doc/whatsnew/2.6.rst (original) +++ python/branches/tk_and_idle_maintenance/Doc/whatsnew/2.6.rst Sun Jun 7 00:03:15 2009 @@ -678,15 +678,15 @@ for N in range(1, 1000, 10): p.apply_async(factorial, (N, d)) - # Mark pool as closed -- no more tasks can be added. - p.close() + # Mark pool as closed -- no more tasks can be added. + p.close() - # Wait for tasks to exit - p.join() + # Wait for tasks to exit + p.join() - # Output results - for k, v in sorted(d.items()): - print k, v + # Output results + for k, v in sorted(d.items()): + print k, v This will produce the output:: Modified: python/branches/tk_and_idle_maintenance/Lib/asyncore.py ============================================================================== --- python/branches/tk_and_idle_maintenance/Lib/asyncore.py (original) +++ python/branches/tk_and_idle_maintenance/Lib/asyncore.py Sun Jun 7 00:03:15 2009 @@ -101,10 +101,15 @@ obj.handle_read_event() if flags & select.POLLOUT: obj.handle_write_event() - if flags & (select.POLLHUP | select.POLLERR | select.POLLNVAL): - obj.handle_close() if flags & select.POLLPRI: obj.handle_expt_event() + if flags & (select.POLLHUP | select.POLLERR | select.POLLNVAL): + obj.handle_close() + except socket.error, e: + if e.args[0] not in (EBADF, ECONNRESET, ENOTCONN, ESHUTDOWN, ECONNABORTED): + obj.handle_error() + else: + obj.handle_close() except _reraised_exceptions: raise except: Modified: python/branches/tk_and_idle_maintenance/Lib/distutils/command/bdist_msi.py ============================================================================== --- python/branches/tk_and_idle_maintenance/Lib/distutils/command/bdist_msi.py (original) +++ python/branches/tk_and_idle_maintenance/Lib/distutils/command/bdist_msi.py Sun Jun 7 00:03:15 2009 @@ -1,5 +1,5 @@ -# -*- coding: utf-8 -*- -# Copyright (C) 2005, 2006 Martin von L??wis +# -*- coding: iso-8859-1 -*- +# Copyright (C) 2005, 2006 Martin von L?wis # Licensed to PSF under a Contributor Agreement. # The bdist_wininst command proper # based on bdist_wininst Modified: python/branches/tk_and_idle_maintenance/Lib/distutils/command/install.py ============================================================================== --- python/branches/tk_and_idle_maintenance/Lib/distutils/command/install.py (original) +++ python/branches/tk_and_idle_maintenance/Lib/distutils/command/install.py Sun Jun 7 00:03:15 2009 @@ -2,12 +2,12 @@ Implements the Distutils 'install' command.""" -from distutils import log - __revision__ = "$Id$" -import sys, os, string -from types import * +import sys +import os + +from distutils import log from distutils.core import Command from distutils.debug import DEBUG from distutils.sysconfig import get_config_vars @@ -117,7 +117,7 @@ SCHEME_KEYS = ('purelib', 'platlib', 'headers', 'scripts', 'data') -class install (Command): +class install(Command): description = "install everything from build directory" @@ -190,8 +190,8 @@ negative_opt = {'no-compile' : 'compile'} - def initialize_options (self): - + def initialize_options(self): + """Initializes options.""" # High-level options: these select both an installation base # and scheme. self.prefix = None @@ -267,8 +267,8 @@ # party Python modules on various platforms given a wide # array of user input is decided. Yes, it's quite complex!) - def finalize_options (self): - + def finalize_options(self): + """Finalizes options.""" # This method (and its pliant slaves, like 'finalize_unix()', # 'finalize_other()', and 'select_scheme()') is where the default # installation directories for modules, extension modules, and @@ -326,7 +326,7 @@ # $platbase in the other installation directories and not worry # about needing recursive variable expansion (shudder). - py_version = (string.split(sys.version))[0] + py_version = sys.version.split()[0] (prefix, exec_prefix) = get_config_vars('prefix', 'exec_prefix') self.config_vars = {'dist_name': self.distribution.get_name(), 'dist_version': self.distribution.get_version(), @@ -409,29 +409,27 @@ # Punt on doc directories for now -- after all, we're punting on # documentation completely! - # finalize_options () - - - def dump_dirs (self, msg): - if DEBUG: - from distutils.fancy_getopt import longopt_xlate - print msg + ":" - for opt in self.user_options: - opt_name = opt[0] - if opt_name[-1] == "=": - opt_name = opt_name[0:-1] - if opt_name in self.negative_opt: - opt_name = string.translate(self.negative_opt[opt_name], - longopt_xlate) - val = not getattr(self, opt_name) - else: - opt_name = string.translate(opt_name, longopt_xlate) - val = getattr(self, opt_name) - print " %s: %s" % (opt_name, val) - - - def finalize_unix (self): + def dump_dirs(self, msg): + """Dumps the list of user options.""" + if not DEBUG: + return + from distutils.fancy_getopt import longopt_xlate + log.debug(msg + ":") + for opt in self.user_options: + opt_name = opt[0] + if opt_name[-1] == "=": + opt_name = opt_name[0:-1] + if opt_name in self.negative_opt: + opt_name = self.negative_opt[opt_name] + opt_name = opt_name.translate(longopt_xlate) + val = not getattr(self, opt_name) + else: + opt_name = opt_name.translate(longopt_xlate) + val = getattr(self, opt_name) + log.debug(" %s: %s" % (opt_name, val)) + def finalize_unix(self): + """Finalizes options for posix platforms.""" if self.install_base is not None or self.install_platbase is not None: if ((self.install_lib is None and self.install_purelib is None and @@ -470,11 +468,8 @@ self.install_platbase = self.exec_prefix self.select_scheme("unix_prefix") - # finalize_unix () - - - def finalize_other (self): # Windows and Mac OS for now - + def finalize_other(self): + """Finalizes options for non-posix platforms""" if self.user: if self.install_userbase is None: raise DistutilsPlatformError( @@ -495,10 +490,8 @@ raise DistutilsPlatformError, \ "I don't know how to install stuff on '%s'" % os.name - # finalize_other () - - - def select_scheme (self, name): + def select_scheme(self, name): + """Sets the install directories by applying the install schemes.""" # it's the caller's problem if they supply a bad name! scheme = INSTALL_SCHEMES[name] for key in SCHEME_KEYS: @@ -506,8 +499,7 @@ if getattr(self, attrname) is None: setattr(self, attrname, scheme[key]) - - def _expand_attrs (self, attrs): + def _expand_attrs(self, attrs): for attr in attrs: val = getattr(self, attr) if val is not None: @@ -516,40 +508,36 @@ val = subst_vars(val, self.config_vars) setattr(self, attr, val) + def expand_basedirs(self): + """Calls `os.path.expanduser` on install_base, install_platbase and + root.""" + self._expand_attrs(['install_base', 'install_platbase', 'root']) + + def expand_dirs(self): + """Calls `os.path.expanduser` on install dirs.""" + self._expand_attrs(['install_purelib', 'install_platlib', + 'install_lib', 'install_headers', + 'install_scripts', 'install_data',]) - def expand_basedirs (self): - self._expand_attrs(['install_base', - 'install_platbase', - 'root']) - - def expand_dirs (self): - self._expand_attrs(['install_purelib', - 'install_platlib', - 'install_lib', - 'install_headers', - 'install_scripts', - 'install_data',]) - - - def convert_paths (self, *names): + def convert_paths(self, *names): + """Call `convert_path` over `names`.""" for name in names: attr = "install_" + name setattr(self, attr, convert_path(getattr(self, attr))) - - def handle_extra_path (self): - + def handle_extra_path(self): + """Set `path_file` and `extra_dirs` using `extra_path`.""" if self.extra_path is None: self.extra_path = self.distribution.extra_path if self.extra_path is not None: - if type(self.extra_path) is StringType: - self.extra_path = string.split(self.extra_path, ',') + if isinstance(self.extra_path, str): + self.extra_path = self.extra_path.split(',') if len(self.extra_path) == 1: path_file = extra_dirs = self.extra_path[0] elif len(self.extra_path) == 2: - (path_file, extra_dirs) = self.extra_path + path_file, extra_dirs = self.extra_path else: raise DistutilsOptionError, \ ("'extra_path' option must be a list, tuple, or " @@ -558,7 +546,6 @@ # convert to local form in case Unix notation used (as it # should be in setup scripts) extra_dirs = convert_path(extra_dirs) - else: path_file = None extra_dirs = '' @@ -568,17 +555,14 @@ self.path_file = path_file self.extra_dirs = extra_dirs - # handle_extra_path () - - - def change_roots (self, *names): + def change_roots(self, *names): + """Change the install direcories pointed by name using root.""" for name in names: attr = "install_" + name setattr(self, attr, change_root(self.root, getattr(self, attr))) def create_home_path(self): - """Create directories under ~ - """ + """Create directories under ~.""" if not self.user: return home = convert_path(os.path.expanduser("~")) @@ -589,8 +573,8 @@ # -- Command execution methods ------------------------------------- - def run (self): - + def run(self): + """Runs the command.""" # Obviously have to build before we can install if not self.skip_build: self.run_command('build') @@ -633,9 +617,8 @@ "you'll have to change the search path yourself"), self.install_lib) - # run () - - def create_path_file (self): + def create_path_file(self): + """Creates the .pth file""" filename = os.path.join(self.install_libbase, self.path_file + ".pth") if self.install_path_file: @@ -648,8 +631,8 @@ # -- Reporting methods --------------------------------------------- - def get_outputs (self): - # Assemble the outputs of all the sub-commands. + def get_outputs(self): + """Assembles the outputs of all the sub-commands.""" outputs = [] for cmd_name in self.get_sub_commands(): cmd = self.get_finalized_command(cmd_name) @@ -665,7 +648,8 @@ return outputs - def get_inputs (self): + def get_inputs(self): + """Returns the inputs of all the sub-commands""" # XXX gee, this looks familiar ;-( inputs = [] for cmd_name in self.get_sub_commands(): @@ -674,25 +658,29 @@ return inputs - # -- Predicates for sub-command list ------------------------------- - def has_lib (self): - """Return true if the current distribution has any Python + def has_lib(self): + """Returns true if the current distribution has any Python modules to install.""" return (self.distribution.has_pure_modules() or self.distribution.has_ext_modules()) - def has_headers (self): + def has_headers(self): + """Returns true if the current distribution has any headers to + install.""" return self.distribution.has_headers() - def has_scripts (self): + def has_scripts(self): + """Returns true if the current distribution has any scripts to. + install.""" return self.distribution.has_scripts() - def has_data (self): + def has_data(self): + """Returns true if the current distribution has any data to. + install.""" return self.distribution.has_data_files() - # 'sub_commands': a list of commands this command might have to run to # get its work done. See cmd.py for more info. sub_commands = [('install_lib', has_lib), @@ -701,5 +689,3 @@ ('install_data', has_data), ('install_egg_info', lambda self:True), ] - -# class install Modified: python/branches/tk_and_idle_maintenance/Lib/distutils/extension.py ============================================================================== --- python/branches/tk_and_idle_maintenance/Lib/distutils/extension.py (original) +++ python/branches/tk_and_idle_maintenance/Lib/distutils/extension.py Sun Jun 7 00:03:15 2009 @@ -5,13 +5,9 @@ __revision__ = "$Id$" -import os, string, sys -from types import * - -try: - import warnings -except ImportError: - warnings = None +import os +import sys +import warnings # This class is really only used by the "build_ext" command, so it might # make sense to put it in distutils.command.build_ext. However, that @@ -107,9 +103,9 @@ optional=None, **kw # To catch unknown keywords ): - assert type(name) is StringType, "'name' must be a string" - assert (type(sources) is ListType and - map(type, sources) == [StringType]*len(sources)), \ + assert isinstance(name, str), "'name' must be a string" + assert (isinstance(sources, list) and + all(isinstance(v, str) for v in sources)), \ "'sources' must be a list of strings" self.name = name @@ -130,20 +126,17 @@ self.optional = optional # If there are unknown keyword options, warn about them - if len(kw): - L = kw.keys() ; L.sort() - L = map(repr, L) - msg = "Unknown Extension options: " + string.join(L, ', ') - if warnings is not None: - warnings.warn(msg) - else: - sys.stderr.write(msg + '\n') -# class Extension - + if len(kw) > 0: + options = [repr(option) for option in kw] + options = ', '.join(sorted(options)) + msg = "Unknown Extension options: %s" % options + warnings.warn(msg) + +def read_setup_file(filename): + """Reads a Setup file and returns Extension instances.""" + from distutils.sysconfig import (parse_makefile, expand_makefile_vars, + _variable_rx) -def read_setup_file (filename): - from distutils.sysconfig import \ - parse_makefile, expand_makefile_vars, _variable_rx from distutils.text_file import TextFile from distutils.util import split_quoted @@ -168,10 +161,8 @@ file.warn("'%s' lines not handled yet" % line) continue - #print "original line: " + line line = expand_makefile_vars(line, vars) words = split_quoted(line) - #print "expanded line: " + line # NB. this parses a slightly different syntax than the old # makesetup script: here, there must be exactly one extension per @@ -200,7 +191,7 @@ elif switch == "-I": ext.include_dirs.append(value) elif switch == "-D": - equals = string.find(value, "=") + equals = value.find("=") if equals == -1: # bare "-DFOO" -- no value ext.define_macros.append((value, None)) else: # "-DFOO=blah" @@ -237,15 +228,4 @@ extensions.append(ext) - #print "module:", module - #print "source files:", source_files - #print "cpp args:", cpp_args - #print "lib args:", library_args - - #extensions[module] = { 'sources': source_files, - # 'cpp_args': cpp_args, - # 'lib_args': library_args } - return extensions - -# read_setup_file () Modified: python/branches/tk_and_idle_maintenance/Lib/distutils/tests/test_install.py ============================================================================== --- python/branches/tk_and_idle_maintenance/Lib/distutils/tests/test_install.py (original) +++ python/branches/tk_and_idle_maintenance/Lib/distutils/tests/test_install.py Sun Jun 7 00:03:15 2009 @@ -10,11 +10,14 @@ from distutils.command import install as install_module from distutils.command.install import INSTALL_SCHEMES from distutils.core import Distribution +from distutils.errors import DistutilsOptionError from distutils.tests import support -class InstallTestCase(support.TempdirManager, unittest.TestCase): +class InstallTestCase(support.TempdirManager, + support.LoggingSilencer, + unittest.TestCase): def test_home_installation_scheme(self): # This ensure two things: @@ -112,6 +115,74 @@ self.assert_('userbase' in cmd.config_vars) self.assert_('usersite' in cmd.config_vars) + def test_handle_extra_path(self): + dist = Distribution({'name': 'xx', 'extra_path': 'path,dirs'}) + cmd = install(dist) + + # two elements + cmd.handle_extra_path() + self.assertEquals(cmd.extra_path, ['path', 'dirs']) + self.assertEquals(cmd.extra_dirs, 'dirs') + self.assertEquals(cmd.path_file, 'path') + + # one element + cmd.extra_path = ['path'] + cmd.handle_extra_path() + self.assertEquals(cmd.extra_path, ['path']) + self.assertEquals(cmd.extra_dirs, 'path') + self.assertEquals(cmd.path_file, 'path') + + # none + dist.extra_path = cmd.extra_path = None + cmd.handle_extra_path() + self.assertEquals(cmd.extra_path, None) + self.assertEquals(cmd.extra_dirs, '') + self.assertEquals(cmd.path_file, None) + + # three elements (no way !) + cmd.extra_path = 'path,dirs,again' + self.assertRaises(DistutilsOptionError, cmd.handle_extra_path) + + def test_finalize_options(self): + dist = Distribution({'name': 'xx'}) + cmd = install(dist) + + # must supply either prefix/exec-prefix/home or + # install-base/install-platbase -- not both + cmd.prefix = 'prefix' + cmd.install_base = 'base' + self.assertRaises(DistutilsOptionError, cmd.finalize_options) + + # must supply either home or prefix/exec-prefix -- not both + cmd.install_base = None + cmd.home = 'home' + self.assertRaises(DistutilsOptionError, cmd.finalize_options) + + # can't combine user with with prefix/exec_prefix/home or + # install_(plat)base + cmd.prefix = None + cmd.user = 'user' + self.assertRaises(DistutilsOptionError, cmd.finalize_options) + + def test_record(self): + + install_dir = self.mkdtemp() + pkgdir, dist = self.create_dist() + + dist = Distribution() + cmd = install(dist) + dist.command_obj['install'] = cmd + cmd.root = install_dir + cmd.record = os.path.join(pkgdir, 'RECORD') + cmd.ensure_finalized() + + cmd.run() + + # let's check the RECORD file was created with one + # line (the egg info file) + with open(cmd.record) as f: + self.assertEquals(len(f.readlines()), 1) + def test_suite(): return unittest.makeSuite(InstallTestCase) Modified: python/branches/tk_and_idle_maintenance/Lib/imputil.py ============================================================================== --- python/branches/tk_and_idle_maintenance/Lib/imputil.py (original) +++ python/branches/tk_and_idle_maintenance/Lib/imputil.py Sun Jun 7 00:03:15 2009 @@ -14,7 +14,7 @@ del warnpy3k # note: avoid importing non-builtin modules -import imp ### not available in JPython? +import imp ### not available in Jython? import sys import __builtin__ @@ -25,7 +25,7 @@ __all__ = ["ImportManager","Importer","BuiltinImporter"] _StringType = type('') -_ModuleType = type(sys) ### doesn't work in JPython... +_ModuleType = type(sys) ### doesn't work in Jython... class ImportManager: "Manage the import process." @@ -639,8 +639,8 @@ # TODO # # from Finn Bock: -# type(sys) is not a module in JPython. what to use instead? -# imp.C_EXTENSION is not in JPython. same for get_suffixes and new_module +# type(sys) is not a module in Jython. what to use instead? +# imp.C_EXTENSION is not in Jython. same for get_suffixes and new_module # # given foo.py of: # import sys Modified: python/branches/tk_and_idle_maintenance/Lib/shutil.py ============================================================================== --- python/branches/tk_and_idle_maintenance/Lib/shutil.py (original) +++ python/branches/tk_and_idle_maintenance/Lib/shutil.py Sun Jun 7 00:03:15 2009 @@ -58,9 +58,10 @@ except OSError: # File most likely does not exist pass - # XXX What about other special files? (sockets, devices...) - if stat.S_ISFIFO(st.st_mode): - raise SpecialFileError("`%s` is a named pipe" % fn) + else: + # XXX What about other special files? (sockets, devices...) + if stat.S_ISFIFO(st.st_mode): + raise SpecialFileError("`%s` is a named pipe" % fn) try: fsrc = open(src, 'rb') fdst = open(dst, 'wb') Modified: python/branches/tk_and_idle_maintenance/Lib/test/formatfloat_testcases.txt ============================================================================== --- python/branches/tk_and_idle_maintenance/Lib/test/formatfloat_testcases.txt (original) +++ python/branches/tk_and_idle_maintenance/Lib/test/formatfloat_testcases.txt Sun Jun 7 00:03:15 2009 @@ -11,7 +11,7 @@ -- precision 0; result should never include a . %.0f 1.5 -> 2 -%.0f 2.5 -> 2 +--%.0f 2.5 -> 2 fails on Windows in 2.7, works in 3.1+. See issue 6198. %.0f 3.5 -> 4 %.0f 0.0 -> 0 %.0f 0.1 -> 0 @@ -21,9 +21,9 @@ %.0f 10.01 -> 10 %.0f 123.456 -> 123 %.0f 1234.56 -> 1235 -%.0f 1e49 -> 9999999999999999464902769475481793196872414789632 +--%.0f 1e49 -> 9999999999999999464902769475481793196872414789632 See issue 6198. -- %.0f 1e50 -> 100000000000000007629769841091887003294964970946560 -%.0f 9.9999999999999987e+49 -> 99999999999999986860582406952576489172979654066176 +-- %.0f 9.9999999999999987e+49 -> 99999999999999986860582406952576489172979654066176 See issue 6198. -- precision 1 %.1f 0.0001 -> 0.0 @@ -31,7 +31,7 @@ %.1f 0.01 -> 0.0 %.1f 0.04 -> 0.0 %.1f 0.06 -> 0.1 -%.1f 0.25 -> 0.2 +-- %.1f 0.25 -> 0.2 See issue 6198. %.1f 0.75 -> 0.8 %.1f 1.4 -> 1.4 %.1f 1.5 -> 1.5 @@ -47,7 +47,7 @@ %.2f 0.004999 -> 0.00 %.2f 0.005001 -> 0.01 %.2f 0.01 -> 0.01 -%.2f 0.125 -> 0.12 +-- %.2f 0.125 -> 0.12 See issue 6198. %.2f 0.375 -> 0.38 %.2f 1234500 -> 1234500.00 %.2f 1234560 -> 1234560.00 @@ -61,8 +61,8 @@ -- makes a difference when the precision is 0. %#.0f 0 -> 0. %#.1f 0 -> 0.0 -%#.0f 1.5 -> 2. -%#.0f 2.5 -> 2. +--%#.0f 1.5 -> 2. See issue 6198. +-- %#.0f 2.5 -> 2. See issue 6198. %#.0f 10.1 -> 10. %#.0f 1234.56 -> 1235. %#.1f 1.4 -> 1.4 @@ -108,18 +108,18 @@ %.0e 123456000 -> 1e+08 %.0e 0.5 -> 5e-01 %.0e 1.4 -> 1e+00 -%.0e 1.5 -> 2e+00 +--%.0e 1.5 -> 2e+00 See issue 6198. %.0e 1.6 -> 2e+00 %.0e 2.4999999 -> 2e+00 -%.0e 2.5 -> 2e+00 +--%.0e 2.5 -> 2e+00 See issue 6198. %.0e 2.5000001 -> 3e+00 %.0e 3.499999999999 -> 3e+00 %.0e 3.5 -> 4e+00 -%.0e 4.5 -> 4e+00 +--%.0e 4.5 -> 4e+00 See issue 6198. %.0e 5.5 -> 6e+00 -%.0e 6.5 -> 6e+00 +--%.0e 6.5 -> 6e+00 See issue 6198. %.0e 7.5 -> 8e+00 -%.0e 8.5 -> 8e+00 +--%.0e 8.5 -> 8e+00 See issue 6198. %.0e 9.4999 -> 9e+00 %.0e 9.5 -> 1e+01 %.0e 10.5 -> 1e+01 @@ -185,15 +185,15 @@ %#.0e 1.5 -> 2.e+00 %#.0e 1.6 -> 2.e+00 %#.0e 2.4999999 -> 2.e+00 -%#.0e 2.5 -> 2.e+00 +--%#.0e 2.5 -> 2.e+00 See issue 6198. %#.0e 2.5000001 -> 3.e+00 %#.0e 3.499999999999 -> 3.e+00 %#.0e 3.5 -> 4.e+00 -%#.0e 4.5 -> 4.e+00 +--%#.0e 4.5 -> 4.e+00 See issue 6198. %#.0e 5.5 -> 6.e+00 -%#.0e 6.5 -> 6.e+00 +--%#.0e 6.5 -> 6.e+00 See issue 6198. %#.0e 7.5 -> 8.e+00 -%#.0e 8.5 -> 8.e+00 +--%#.0e 8.5 -> 8.e+00 See issue 6198. %#.0e 9.4999 -> 9.e+00 %#.0e 9.5 -> 1.e+01 %#.0e 10.5 -> 1.e+01 @@ -281,11 +281,11 @@ -- alternate g formatting: always include decimal point and -- exactly significant digits. -%#.0g 0 -> 0. -%#.1g 0 -> 0. -%#.2g 0 -> 0.0 -%#.3g 0 -> 0.00 -%#.4g 0 -> 0.000 +--%#.0g 0 -> 0. See issue 6198. +--%#.1g 0 -> 0. See issue 6198. +--%#.2g 0 -> 0.0 See issue 6198. +--%#.3g 0 -> 0.00 See issue 6198. +--%#.4g 0 -> 0.000 See issue 6198. %#.0g 0.2 -> 0.2 %#.1g 0.2 -> 0.2 Modified: python/branches/tk_and_idle_maintenance/Lib/test/test__locale.py ============================================================================== --- python/branches/tk_and_idle_maintenance/Lib/test/test__locale.py (original) +++ python/branches/tk_and_idle_maintenance/Lib/test/test__locale.py Sun Jun 7 00:03:15 2009 @@ -1,7 +1,12 @@ from test.test_support import verbose, run_unittest -from _locale import (setlocale, LC_NUMERIC, RADIXCHAR, THOUSEP, nl_langinfo, - localeconv, Error) +from _locale import (setlocale, LC_NUMERIC, localeconv, Error) +try: + from _locale import (RADIXCHAR, THOUSEP, nl_langinfo) +except ImportError: + nl_langinfo = None + import unittest +import sys from platform import uname if uname()[0] == "Darwin": @@ -20,6 +25,13 @@ 'eu_ES', 'vi_VN', 'af_ZA', 'nb_NO', 'en_DK', 'tg_TJ', 'en_US', 'es_ES.ISO8859-1', 'fr_FR.ISO8859-15', 'ru_RU.KOI8-R', 'ko_KR.eucKR'] +# Workaround for MSVC6(debug) crash bug +if "MSC v.1200" in sys.version: + def accept(loc): + a = loc.split(".") + return not(len(a) == 2 and len(a[-1]) >= 9) + candidate_locales = [loc for loc in candidate_locales if accept(loc)] + # List known locale values to test against when available. # Dict formatted as `` : (, )``. If a # value is not known, use '' . @@ -53,6 +65,7 @@ calc_type, data_type, set_locale, used_locale)) + @unittest.skipUnless(nl_langinfo, "nl_langinfo is not available") def test_lc_numeric_nl_langinfo(self): # Test nl_langinfo against known values for loc in candidate_locales: @@ -71,10 +84,10 @@ setlocale(LC_NUMERIC, loc) except Error: continue - for li, lc in ((RADIXCHAR, "decimal_point"), - (THOUSEP, "thousands_sep")): + for lc in ("decimal_point", "thousands_sep"): self.numeric_tester('localeconv', localeconv()[lc], lc, loc) + @unittest.skipUnless(nl_langinfo, "nl_langinfo is not available") def test_lc_numeric_basic(self): # Test nl_langinfo against localeconv for loc in candidate_locales: Modified: python/branches/tk_and_idle_maintenance/Lib/test/test_pep352.py ============================================================================== --- python/branches/tk_and_idle_maintenance/Lib/test/test_pep352.py (original) +++ python/branches/tk_and_idle_maintenance/Lib/test/test_pep352.py Sun Jun 7 00:03:15 2009 @@ -26,7 +26,7 @@ ignore_message_warning() for attr in ("args", "message", "__str__", "__repr__", "__getitem__"): - self.failUnless(hasattr(ins, attr), + self.assertTrue(hasattr(ins, attr), "%s missing %s attribute" % (ins.__class__.__name__, attr)) @@ -88,7 +88,7 @@ def interface_test_driver(self, results): for test_name, (given, expected) in zip(self.interface_tests, results): - self.failUnlessEqual(given, expected, "%s: %s != %s" % (test_name, + self.assertEqual(given, expected, "%s: %s != %s" % (test_name, given, expected)) def test_interface_single_arg(self): Modified: python/branches/tk_and_idle_maintenance/Lib/test/test_traceback.py ============================================================================== --- python/branches/tk_and_idle_maintenance/Lib/test/test_traceback.py (original) +++ python/branches/tk_and_idle_maintenance/Lib/test/test_traceback.py Sun Jun 7 00:03:15 2009 @@ -24,6 +24,9 @@ def syntax_error_with_caret(self): compile("def fact(x):\n\treturn x!\n", "?", "exec") + def syntax_error_with_caret_2(self): + compile("1 +\n", "?", "exec") + def syntax_error_without_caret(self): # XXX why doesn't compile raise the same traceback? import test.badsyntax_nocaret @@ -39,6 +42,12 @@ self.assert_("^" in err[2]) # third line has caret self.assert_(err[1].find("!") == err[2].find("^")) # in the right place + err = self.get_exception_format(self.syntax_error_with_caret_2, + SyntaxError) + self.assert_("^" in err[2]) # third line has caret + self.assert_(err[2].count('\n') == 1) # and no additional newline + self.assert_(err[1].find("+") == err[2].find("^")) # in the right place + def test_nocaret(self): if is_jython: # jython adds a caret in this case (why shouldn't it?) Modified: python/branches/tk_and_idle_maintenance/Lib/test/test_unittest.py ============================================================================== --- python/branches/tk_and_idle_maintenance/Lib/test/test_unittest.py (original) +++ python/branches/tk_and_idle_maintenance/Lib/test/test_unittest.py Sun Jun 7 00:03:15 2009 @@ -3537,7 +3537,9 @@ # We should have loaded tests from the test_directory package by calling load_tests # and directly from the test_directory2 package - self.assertEqual(suite, ['load_tests', '/foo/test_directory2 module tests']) + self.assertEqual(suite, + ['load_tests', + os.path.join('/foo', 'test_directory2') + ' module tests']) self.assertEqual(Module.paths, [os.path.join('/foo', 'test_directory'), os.path.join('/foo', 'test_directory2')]) Modified: python/branches/tk_and_idle_maintenance/Lib/test/test_with.py ============================================================================== --- python/branches/tk_and_idle_maintenance/Lib/test/test_with.py (original) +++ python/branches/tk_and_idle_maintenance/Lib/test/test_with.py Sun Jun 7 00:03:15 2009 @@ -675,7 +675,7 @@ if self.gobble: return True - class CtorRaises(object): + class InitRaises(object): def __init__(self): raise RuntimeError() class EnterRaises(object): @@ -695,7 +695,7 @@ def testExceptionInExprList(self): try: - with self.Dummy() as a, self.CtorRaises(): + with self.Dummy() as a, self.InitRaises(): pass except: pass Modified: python/branches/tk_and_idle_maintenance/Lib/traceback.py ============================================================================== --- python/branches/tk_and_idle_maintenance/Lib/traceback.py (original) +++ python/branches/tk_and_idle_maintenance/Lib/traceback.py Sun Jun 7 00:03:15 2009 @@ -189,7 +189,7 @@ if badline is not None: lines.append(' %s\n' % badline.strip()) if offset is not None: - caretspace = badline[:offset].lstrip() + caretspace = badline.rstrip('\n')[:offset].lstrip() # non-space whitespace (likes tabs) must be kept for alignment caretspace = ((c.isspace() and c or ' ') for c in caretspace) # only three spaces to account for offset1 == pos 0 Modified: python/branches/tk_and_idle_maintenance/Lib/xmlrpclib.py ============================================================================== --- python/branches/tk_and_idle_maintenance/Lib/xmlrpclib.py (original) +++ python/branches/tk_and_idle_maintenance/Lib/xmlrpclib.py Sun Jun 7 00:03:15 2009 @@ -526,56 +526,6 @@ except (AttributeError, ImportError): FastMarshaller = None -# -# the SGMLOP parser is about 15x faster than Python's builtin -# XML parser. SGMLOP sources can be downloaded from: -# -# http://www.pythonware.com/products/xml/sgmlop.htm -# - -try: - import sgmlop - if not hasattr(sgmlop, "XMLParser"): - raise ImportError -except ImportError: - SgmlopParser = None # sgmlop accelerator not available -else: - class SgmlopParser: - def __init__(self, target): - - # setup callbacks - self.finish_starttag = target.start - self.finish_endtag = target.end - self.handle_data = target.data - self.handle_xml = target.xml - - # activate parser - self.parser = sgmlop.XMLParser() - self.parser.register(self) - self.feed = self.parser.feed - self.entity = { - "amp": "&", "gt": ">", "lt": "<", - "apos": "'", "quot": '"' - } - - def close(self): - try: - self.parser.close() - finally: - self.parser = self.feed = None # nuke circular reference - - def handle_proc(self, tag, attr): - m = re.search("encoding\s*=\s*['\"]([^\"']+)[\"']", attr) - if m: - self.handle_xml(m.group(1), 1) - - def handle_entityref(self, entity): - # entity - try: - self.handle_data(self.entity[entity]) - except KeyError: - self.handle_data("&%s;" % entity) - try: from xml.parsers import expat if not hasattr(expat, "ParserCreate"): @@ -584,8 +534,7 @@ ExpatParser = None # expat not available else: class ExpatParser: - # fast expat parser for Python 2.0 and later. this is about - # 50% slower than sgmlop, on roundtrip testing + # fast expat parser for Python 2.0 and later. def __init__(self, target): self._parser = parser = expat.ParserCreate(None, None) self._target = target @@ -606,8 +555,7 @@ class SlowParser: """Default XML parser (based on xmllib.XMLParser).""" - # this is about 10 times slower than sgmlop, on roundtrip - # testing. + # this is the slowest parser. def __init__(self, target): import xmllib # lazy subclassing (!) if xmllib.XMLParser not in SlowParser.__bases__: @@ -1069,8 +1017,6 @@ target = Unmarshaller(use_datetime=use_datetime) if FastParser: parser = FastParser(target) - elif SgmlopParser: - parser = SgmlopParser(target) elif ExpatParser: parser = ExpatParser(target) else: Modified: python/branches/tk_and_idle_maintenance/Misc/NEWS ============================================================================== --- python/branches/tk_and_idle_maintenance/Misc/NEWS (original) +++ python/branches/tk_and_idle_maintenance/Misc/NEWS Sun Jun 7 00:03:15 2009 @@ -317,6 +317,8 @@ Library ------- +- Issue #5767: Removed sgmlop support from xmlrpclib. + - Issue #6131: test_modulefinder leaked when run after test_distutils. Patch by Hirokazu Yamamoto. Modified: python/branches/tk_and_idle_maintenance/Objects/dictobject.c ============================================================================== --- python/branches/tk_and_idle_maintenance/Objects/dictobject.c (original) +++ python/branches/tk_and_idle_maintenance/Objects/dictobject.c Sun Jun 7 00:03:15 2009 @@ -715,7 +715,7 @@ /* We can arrive here with a NULL tstate during initialization: try running "python -Wi" for an example related to string interning. Let's just hope that no exception occurs then... */ - tstate = _PyThreadState_Current; + tstate = PyThreadState_GET(); if (tstate != NULL && tstate->curexc_type != NULL) { /* preserve the existing exception */ PyObject *err_type, *err_value, *err_tb; Modified: python/branches/tk_and_idle_maintenance/Objects/unicodeobject.c ============================================================================== --- python/branches/tk_and_idle_maintenance/Objects/unicodeobject.c (original) +++ python/branches/tk_and_idle_maintenance/Objects/unicodeobject.c Sun Jun 7 00:03:15 2009 @@ -6308,7 +6308,7 @@ /* This code should go into some future Unicode collation support module. The basic comparison should compare ordinals on a naive - basis (this is what Java does and thus JPython too). */ + basis (this is what Java does and thus Jython too). */ /* speedy UTF-16 code point order comparison */ /* gleaned from: */ From python-checkins at python.org Sun Jun 7 01:49:53 2009 From: python-checkins at python.org (guilherme.polo) Date: Sun, 7 Jun 2009 01:49:53 +0200 (CEST) Subject: [Python-checkins] r73267 - in python/branches/tk_and_idle_maintenance/Lib/lib-tk/test/test_tkinter: test_canvas.py test_listbox.py test_toplevel.py Message-ID: <20090606234953.D7402DCA0@mail.python.org> Author: guilherme.polo Date: Sun Jun 7 01:49:53 2009 New Revision: 73267 Log: Short tests for Listbox.size and Canvas.create_polygon. Testing a Toplevel wmkey that doesn't end in '_'. Modified: python/branches/tk_and_idle_maintenance/Lib/lib-tk/test/test_tkinter/test_canvas.py python/branches/tk_and_idle_maintenance/Lib/lib-tk/test/test_tkinter/test_listbox.py python/branches/tk_and_idle_maintenance/Lib/lib-tk/test/test_tkinter/test_toplevel.py Modified: python/branches/tk_and_idle_maintenance/Lib/lib-tk/test/test_tkinter/test_canvas.py ============================================================================== --- python/branches/tk_and_idle_maintenance/Lib/lib-tk/test/test_tkinter/test_canvas.py (original) +++ python/branches/tk_and_idle_maintenance/Lib/lib-tk/test/test_tkinter/test_canvas.py Sun Jun 7 01:49:53 2009 @@ -132,6 +132,8 @@ self.assertEqual(self.canvas.type(lineid), 'line') ovalid = self.canvas.create_oval(1, 2, 3, 4) self.assertEqual(self.canvas.type(ovalid), 'oval') + polyid = self.canvas.create_polygon(50, 50, 90, 50, 40, 40) + self.assertEqual(self.canvas.type(polyid), 'polygon') rectid = self.canvas.create_rectangle(1, 2, 3, 4) self.assertEqual(self.canvas.type(rectid), 'rectangle') textid = self.canvas.create_text(1, 2) Modified: python/branches/tk_and_idle_maintenance/Lib/lib-tk/test/test_tkinter/test_listbox.py ============================================================================== --- python/branches/tk_and_idle_maintenance/Lib/lib-tk/test/test_tkinter/test_listbox.py (original) +++ python/branches/tk_and_idle_maintenance/Lib/lib-tk/test/test_tkinter/test_listbox.py Sun Jun 7 01:49:53 2009 @@ -130,6 +130,13 @@ self.lb.selection_clear(0, 'end') self.assertEqual(self.lb.curselection(), ()) + def test_size(self): + self.assertEqual(self.lb.size(), 0) + self.lb.insert(0, 1, 2) + self.assertEqual(self.lb.size(), 2) + self.lb.insert(1, 1.5, 1.7) + self.assertEqual(self.lb.size(), 4) + def test_xview(self, method='xview'): view = getattr(self.lb, method)() self.assertTrue(isinstance(view, tuple)) Modified: python/branches/tk_and_idle_maintenance/Lib/lib-tk/test/test_tkinter/test_toplevel.py ============================================================================== --- python/branches/tk_and_idle_maintenance/Lib/lib-tk/test/test_tkinter/test_toplevel.py (original) +++ python/branches/tk_and_idle_maintenance/Lib/lib-tk/test/test_tkinter/test_toplevel.py Sun Jun 7 01:49:53 2009 @@ -13,7 +13,8 @@ def test_initialization(self): self.root.title('hi') - tl = Tkinter.Toplevel(self.root, **{'class_': 'test'}) + tl = Tkinter.Toplevel(self.root, + **{'class_': 'test', 'colormap': 'new'}) self.assertEqual(tl['class'], 'test') self.assertEqual(tl.title(), 'hi') tl.destroy() From python-checkins at python.org Sun Jun 7 17:29:47 2009 From: python-checkins at python.org (ronald.oussoren) Date: Sun, 7 Jun 2009 17:29:47 +0200 (CEST) Subject: [Python-checkins] r73268 - in python/branches/py3k: Lib/locale.py Modules/_localemodule.c Message-ID: <20090607152947.1999AC4B7@mail.python.org> Author: ronald.oussoren Date: Sun Jun 7 17:29:46 2009 New Revision: 73268 Log: Fix for issue 6202 Modified: python/branches/py3k/Lib/locale.py python/branches/py3k/Modules/_localemodule.c Modified: python/branches/py3k/Lib/locale.py ============================================================================== --- python/branches/py3k/Lib/locale.py (original) +++ python/branches/py3k/Lib/locale.py Sun Jun 7 17:29:46 2009 @@ -536,10 +536,8 @@ """ _setlocale(category, _build_localename(getdefaultlocale())) -if sys.platform in ('win32', 'darwin', 'mac'): +if sys.platform.startswith("win"): # On Win32, this will return the ANSI code page - # On the Mac, it should return the system encoding; - # it might return "ascii" instead def getpreferredencoding(do_setlocale = True): """Return the charset that the user is likely using.""" import _locale Modified: python/branches/py3k/Modules/_localemodule.c ============================================================================== --- python/branches/py3k/Modules/_localemodule.c (original) +++ python/branches/py3k/Modules/_localemodule.c Sun Jun 7 17:29:46 2009 @@ -363,38 +363,6 @@ } #endif -#if defined(__APPLE__) -/* -** Find out what the current script is. -** Donated by Fredrik Lundh. -*/ -static char *mac_getscript(void) -{ - CFStringEncoding enc = CFStringGetSystemEncoding(); - static CFStringRef name = NULL; - /* Return the code name for the encodings for which we have codecs. */ - switch(enc) { - case kCFStringEncodingMacRoman: return "mac-roman"; - case kCFStringEncodingMacGreek: return "mac-greek"; - case kCFStringEncodingMacCyrillic: return "mac-cyrillic"; - case kCFStringEncodingMacTurkish: return "mac-turkish"; - case kCFStringEncodingMacIcelandic: return "mac-icelandic"; - /* XXX which one is mac-latin2? */ - } - if (!name) { - /* This leaks an object. */ - name = CFStringConvertEncodingToIANACharSetName(enc); - } - return (char *)CFStringGetCStringPtr(name, 0); -} - -static PyObject* -PyLocale_getdefaultlocale(PyObject* self) -{ - return Py_BuildValue("Os", Py_None, mac_getscript()); -} -#endif - #ifdef HAVE_LANGINFO_H #define LANGINFO(X) {#X, X} static struct langinfo_constant{ @@ -645,7 +613,7 @@ {"strxfrm", (PyCFunction) PyLocale_strxfrm, METH_VARARGS, strxfrm__doc__}, #endif -#if defined(MS_WINDOWS) || defined(__APPLE__) +#if defined(MS_WINDOWS) {"_getdefaultlocale", (PyCFunction) PyLocale_getdefaultlocale, METH_NOARGS}, #endif #ifdef HAVE_LANGINFO_H From python-checkins at python.org Sun Jun 7 17:34:13 2009 From: python-checkins at python.org (ronald.oussoren) Date: Sun, 7 Jun 2009 17:34:13 +0200 (CEST) Subject: [Python-checkins] r73269 - python/branches/py3k/Mac/Makefile.in Message-ID: <20090607153413.F11DBC508@mail.python.org> Author: ronald.oussoren Date: Sun Jun 7 17:34:13 2009 New Revision: 73269 Log: Fix symlink for 2to3 in framework install. Without this patch an incorrect link is created when DESTDIR is set. Modified: python/branches/py3k/Mac/Makefile.in Modified: python/branches/py3k/Mac/Makefile.in ============================================================================== --- python/branches/py3k/Mac/Makefile.in (original) +++ python/branches/py3k/Mac/Makefile.in Sun Jun 7 17:34:13 2009 @@ -132,7 +132,7 @@ ln -sf "$${fn}$(VERSION)" "$(DESTDIR)$(prefix)/bin/$${fn}3" ;\ done mv "$(DESTDIR)$(prefix)/bin/2to3" "$(DESTDIR)$(prefix)/bin/2to3-$(VERSION)" - ln -sf "$(DESTDIR)$(prefix)/bin/2to3-$(VERSION)" "$(DESTDIR)$(prefix)/bin/2to3" + ln -sf "2to3-$(VERSION)" "$(DESTDIR)$(prefix)/bin/2to3" if [ ! -h "$(DESTDIR)$(prefix)/bin/python3-config" ]; then \ mv "$(DESTDIR)$(prefix)/bin/python3-config" "$(DESTDIR)$(prefix)/bin/python$(VERSION)-config" ;\ ln -sf "python$(VERSION)-config" "$(DESTDIR)$(prefix)/bin/python3-config" ; \ From buildbot at python.org Sun Jun 7 18:24:28 2009 From: buildbot at python.org (buildbot at python.org) Date: Sun, 07 Jun 2009 16:24:28 +0000 Subject: [Python-checkins] buildbot failure in sparc solaris10 gcc 3.x Message-ID: <20090607162428.4514ED28F@mail.python.org> The Buildbot has detected a new failure of sparc solaris10 gcc 3.x. Full details are available at: http://www.python.org/dev/buildbot/all/sparc%20solaris10%20gcc%203.x/builds/795 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: loewis-sun Build Reason: Build Source Stamp: [branch branches/py3k] HEAD Blamelist: ronald.oussoren BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_posix ====================================================================== ERROR: test_getcwd_long_pathnames (test.test_posix.PosixTester) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home2/buildbot/slave/3.x.loewis-sun/build/Lib/test/test_posix.py", line 251, in test_getcwd_long_pathnames support.rmtree(base_path) File "/home2/buildbot/slave/3.x.loewis-sun/build/Lib/test/support.py", line 181, in rmtree shutil.rmtree(path) File "/home2/buildbot/slave/3.x.loewis-sun/build/Lib/shutil.py", line 239, in rmtree onerror(os.rmdir, path, sys.exc_info()) File "/home2/buildbot/slave/3.x.loewis-sun/build/Lib/shutil.py", line 237, in rmtree os.rmdir(path) OSError: [Errno 22] Invalid argument: '/home2/buildbot/slave/3.x.loewis-sun/build/@test.getcwd/@test.getcwd' sincerely, -The Buildbot From python-checkins at python.org Sun Jun 7 18:24:49 2009 From: python-checkins at python.org (benjamin.peterson) Date: Sun, 7 Jun 2009 18:24:49 +0200 (CEST) Subject: [Python-checkins] r73270 - in python/trunk: Lib/locale.py Modules/_localemodule.c Message-ID: <20090607162449.1F4F5D28F@mail.python.org> Author: benjamin.peterson Date: Sun Jun 7 18:24:48 2009 New Revision: 73270 Log: backport r73268 Modified: python/trunk/Lib/locale.py python/trunk/Modules/_localemodule.c Modified: python/trunk/Lib/locale.py ============================================================================== --- python/trunk/Lib/locale.py (original) +++ python/trunk/Lib/locale.py Sun Jun 7 18:24:48 2009 @@ -529,10 +529,8 @@ """ _setlocale(category, _build_localename(getdefaultlocale())) -if sys.platform in ('win32', 'darwin', 'mac'): +if sys.platform.startswith("win"): # On Win32, this will return the ANSI code page - # On the Mac, it should return the system encoding; - # it might return "ascii" instead def getpreferredencoding(do_setlocale = True): """Return the charset that the user is likely using.""" import _locale Modified: python/trunk/Modules/_localemodule.c ============================================================================== --- python/trunk/Modules/_localemodule.c (original) +++ python/trunk/Modules/_localemodule.c Sun Jun 7 18:24:48 2009 @@ -412,38 +412,6 @@ } #endif -#if defined(__APPLE__) -/* -** Find out what the current script is. -** Donated by Fredrik Lundh. -*/ -static char *mac_getscript(void) -{ - CFStringEncoding enc = CFStringGetSystemEncoding(); - static CFStringRef name = NULL; - /* Return the code name for the encodings for which we have codecs. */ - switch(enc) { - case kCFStringEncodingMacRoman: return "mac-roman"; - case kCFStringEncodingMacGreek: return "mac-greek"; - case kCFStringEncodingMacCyrillic: return "mac-cyrillic"; - case kCFStringEncodingMacTurkish: return "mac-turkish"; - case kCFStringEncodingMacIcelandic: return "mac-icelandic"; - /* XXX which one is mac-latin2? */ - } - if (!name) { - /* This leaks an object. */ - name = CFStringConvertEncodingToIANACharSetName(enc); - } - return (char *)CFStringGetCStringPtr(name, 0); -} - -static PyObject* -PyLocale_getdefaultlocale(PyObject* self) -{ - return Py_BuildValue("Os", Py_None, mac_getscript()); -} -#endif - #ifdef HAVE_LANGINFO_H #define LANGINFO(X) {#X, X} static struct langinfo_constant{ @@ -689,7 +657,7 @@ METH_VARARGS, strcoll__doc__}, {"strxfrm", (PyCFunction) PyLocale_strxfrm, METH_VARARGS, strxfrm__doc__}, -#if defined(MS_WINDOWS) || defined(__APPLE__) +#if defined(MS_WINDOWS) {"_getdefaultlocale", (PyCFunction) PyLocale_getdefaultlocale, METH_NOARGS}, #endif #ifdef HAVE_LANGINFO_H From python-checkins at python.org Sun Jun 7 18:26:48 2009 From: python-checkins at python.org (benjamin.peterson) Date: Sun, 7 Jun 2009 18:26:48 +0200 (CEST) Subject: [Python-checkins] r73271 - python/branches/py3k Message-ID: <20090607162648.2A9F3C479@mail.python.org> Author: benjamin.peterson Date: Sun Jun 7 18:26:47 2009 New Revision: 73271 Log: Blocked revisions 73270 via svnmerge ........ r73270 | benjamin.peterson | 2009-06-07 11:24:48 -0500 (Sun, 07 Jun 2009) | 1 line backport r73268 ........ Modified: python/branches/py3k/ (props changed) From python-checkins at python.org Sun Jun 7 18:43:23 2009 From: python-checkins at python.org (kristjan.jonsson) Date: Sun, 7 Jun 2009 18:43:23 +0200 (CEST) Subject: [Python-checkins] r73272 - in python/trunk: Doc/library/socketserver.rst Lib/SocketServer.py Message-ID: <20090607164323.BDB41C4EE@mail.python.org> Author: kristjan.jonsson Date: Sun Jun 7 18:43:23 2009 New Revision: 73272 Log: http://bugs.python.org/issue6192 Add a feature to disable the Nagle algorithm on sockets in TCPServer Modified: python/trunk/Doc/library/socketserver.rst python/trunk/Lib/SocketServer.py Modified: python/trunk/Doc/library/socketserver.rst ============================================================================== --- python/trunk/Doc/library/socketserver.rst (original) +++ python/trunk/Doc/library/socketserver.rst Sun Jun 7 18:43:23 2009 @@ -223,6 +223,15 @@ desired. If :meth:`handle_request` receives no incoming requests within the timeout period, the :meth:`handle_timeout` method is called. +.. attribute:: TCPServer.disable_nagle_algorithm + + If set to True, it will set the TCP_NODELAY attribute of new requests + connections. This can help alleviate problems with latency in + request-response type applications. To avoid sending many small packets, + this option should be used only when bufferning output, such as when + setting :attr:`StreamRequestHandler.wbufsize` attribute to -1. + + .. versionadded:: 2.7 There are various server methods that can be overridden by subclasses of base server classes like :class:`TCPServer`; these methods aren't useful to external Modified: python/trunk/Lib/SocketServer.py ============================================================================== --- python/trunk/Lib/SocketServer.py (original) +++ python/trunk/Lib/SocketServer.py Sun Jun 7 18:43:23 2009 @@ -374,6 +374,7 @@ - socket_type - request_queue_size (only for stream sockets) - allow_reuse_address + - disable_nagle_algorithm Instance variables: @@ -391,6 +392,8 @@ allow_reuse_address = False + disable_nagle_algorithm = False + def __init__(self, server_address, RequestHandlerClass, bind_and_activate=True): """Constructor. May be extended, do not override.""" BaseServer.__init__(self, server_address, RequestHandlerClass) @@ -441,7 +444,10 @@ May be overridden. """ - return self.socket.accept() + request = self.socket.accept() + if self.disable_nagle_algorithm: + request[0].setsockopt(socket.IPPROTO_TCP, socket.TCP_NODELAY, True) + return request def close_request(self, request): """Called to clean up an individual request.""" From buildbot at python.org Sun Jun 7 19:44:15 2009 From: buildbot at python.org (buildbot at python.org) Date: Sun, 07 Jun 2009 17:44:15 +0000 Subject: [Python-checkins] buildbot failure in amd64 gentoo trunk Message-ID: <20090607174415.1AF4BD3E1@mail.python.org> The Buildbot has detected a new failure of amd64 gentoo trunk. Full details are available at: http://www.python.org/dev/buildbot/all/amd64%20gentoo%20trunk/builds/131 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: norwitz-amd64 Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: kristjan.jonsson BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_mailbox make: *** [buildbottest] Error 1 sincerely, -The Buildbot From buildbot at python.org Sun Jun 7 19:52:08 2009 From: buildbot at python.org (buildbot at python.org) Date: Sun, 07 Jun 2009 17:52:08 +0000 Subject: [Python-checkins] buildbot failure in x86 osx.5 trunk Message-ID: <20090607175208.32EAFD6E4@mail.python.org> The Buildbot has detected a new failure of x86 osx.5 trunk. Full details are available at: http://www.python.org/dev/buildbot/all/x86%20osx.5%20trunk/builds/1151 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: heller-x86-osx5 Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: kristjan.jonsson BUILD FAILED: failed test Excerpt from the test logfile: 2 tests failed: test_docxmlrpc test_htmllib make: *** [buildbottest] Error 1 sincerely, -The Buildbot From python-checkins at python.org Sun Jun 7 19:55:18 2009 From: python-checkins at python.org (martin.v.loewis) Date: Sun, 7 Jun 2009 19:55:18 +0200 (CEST) Subject: [Python-checkins] r73273 - in python/branches/py3k: Lib/test/test_winreg.py Misc/NEWS Message-ID: <20090607175518.1FA1FD3E4@mail.python.org> Author: martin.v.loewis Date: Sun Jun 7 19:55:17 2009 New Revision: 73273 Log: Issue #6221: Delete test registry key before running the test. Modified: python/branches/py3k/Lib/test/test_winreg.py python/branches/py3k/Misc/NEWS Modified: python/branches/py3k/Lib/test/test_winreg.py ============================================================================== --- python/branches/py3k/Lib/test/test_winreg.py (original) +++ python/branches/py3k/Lib/test/test_winreg.py Sun Jun 7 19:55:17 2009 @@ -28,6 +28,27 @@ class WinregTests(unittest.TestCase): remote_name = None + def setUp(self): + # Make sure that the test key is absent when the test + # starts. + self.delete_tree(HKEY_CURRENT_USER, test_key_name) + + def delete_tree(self, root, subkey): + try: + hkey = OpenKey(root, subkey, KEY_ALL_ACCESS) + except WindowsError: + # subkey does not exist + return + while True: + try: + subsubkey = EnumKey(hkey, 0) + except WindowsError: + # no more subkeys + break + self.delete_tree(hkey, subsubkey) + CloseKey(hkey) + DeleteKey(root, subkey) + def WriteTestData(self, root_key, subkeystr="sub_key"): # Set the default value for this key. SetValue(root_key, test_key_name, REG_SZ, "Default value") Modified: python/branches/py3k/Misc/NEWS ============================================================================== --- python/branches/py3k/Misc/NEWS (original) +++ python/branches/py3k/Misc/NEWS Sun Jun 7 19:55:17 2009 @@ -46,6 +46,8 @@ Windows ------- +- Issue #6221: Delete test registry key before running the test. + - Issue #6158: Package Sine-1000Hz-300ms.aif in MSI file. C-API From buildbot at python.org Sun Jun 7 20:41:43 2009 From: buildbot at python.org (buildbot at python.org) Date: Sun, 07 Jun 2009 18:41:43 +0000 Subject: [Python-checkins] buildbot failure in x86 osx.5 3.x Message-ID: <20090607184143.E7D5CEE987@mail.python.org> The Buildbot has detected a new failure of x86 osx.5 3.x. Full details are available at: http://www.python.org/dev/buildbot/all/x86%20osx.5%203.x/builds/1003 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: heller-x86-osx5 Build Reason: Build Source Stamp: [branch branches/py3k] HEAD Blamelist: martin.v.loewis BUILD FAILED: failed test Excerpt from the test logfile: sincerely, -The Buildbot From buildbot at python.org Sun Jun 7 22:00:14 2009 From: buildbot at python.org (buildbot at python.org) Date: Sun, 07 Jun 2009 20:00:14 +0000 Subject: [Python-checkins] buildbot failure in sparc solaris10 gcc 3.x Message-ID: <20090607200014.22568D31A@mail.python.org> The Buildbot has detected a new failure of sparc solaris10 gcc 3.x. Full details are available at: http://www.python.org/dev/buildbot/all/sparc%20solaris10%20gcc%203.x/builds/797 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: loewis-sun Build Reason: Build Source Stamp: [branch branches/py3k] HEAD Blamelist: martin.v.loewis BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_posix ====================================================================== ERROR: test_getcwd_long_pathnames (test.test_posix.PosixTester) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home2/buildbot/slave/3.x.loewis-sun/build/Lib/test/test_posix.py", line 251, in test_getcwd_long_pathnames support.rmtree(base_path) File "/home2/buildbot/slave/3.x.loewis-sun/build/Lib/test/support.py", line 181, in rmtree shutil.rmtree(path) File "/home2/buildbot/slave/3.x.loewis-sun/build/Lib/shutil.py", line 239, in rmtree onerror(os.rmdir, path, sys.exc_info()) File "/home2/buildbot/slave/3.x.loewis-sun/build/Lib/shutil.py", line 237, in rmtree os.rmdir(path) OSError: [Errno 22] Invalid argument: '/home2/buildbot/slave/3.x.loewis-sun/build/@test.getcwd/@test.getcwd' sincerely, -The Buildbot From python-checkins at python.org Sun Jun 7 22:09:54 2009 From: python-checkins at python.org (brett.cannon) Date: Sun, 7 Jun 2009 22:09:54 +0200 (CEST) Subject: [Python-checkins] r73274 - in python/branches/py3k: Makefile.pre.in Misc/NEWS configure configure.in Message-ID: <20090607200954.184E0D32B@mail.python.org> Author: brett.cannon Date: Sun Jun 7 22:09:53 2009 New Revision: 73274 Log: When _locale became a built-in module it was discovered that ``-lintl`` was not added as a build flag as needed. This then led to the discovery that OS X framework builds did not have the LIBS var to pick up this flag. Fixes issue #6154. Thanks to Benjamin Peterson, Roumen Petrov, Erick Tryzelaar, Mark Dickinson, Evan Behar, and Ronald Oussoren for helping. Modified: python/branches/py3k/Makefile.pre.in python/branches/py3k/Misc/NEWS python/branches/py3k/configure python/branches/py3k/configure.in Modified: python/branches/py3k/Makefile.pre.in ============================================================================== --- python/branches/py3k/Makefile.pre.in (original) +++ python/branches/py3k/Makefile.pre.in Sun Jun 7 22:09:53 2009 @@ -463,10 +463,10 @@ -install_name $(DESTDIR)$(PYTHONFRAMEWORKINSTALLDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK) \ -compatibility_version $(VERSION) \ -current_version $(VERSION) \ - -framework CoreFoundation; \ + -framework CoreFoundation $(LIBS); \ else \ /usr/bin/libtool -o $(LDLIBRARY) -dynamic $(OTHER_LIBTOOL_OPT) $(LIBRARY) \ - @LIBTOOL_CRUFT@ -framework CoreFoundation;\ + @LIBTOOL_CRUFT@ -framework CoreFoundation $(LIBS);\ fi $(INSTALL) -d -m $(DIRMODE) \ $(PYTHONFRAMEWORKDIR)/Versions/$(VERSION)/Resources/English.lproj Modified: python/branches/py3k/Misc/NEWS ============================================================================== --- python/branches/py3k/Misc/NEWS (original) +++ python/branches/py3k/Misc/NEWS Sun Jun 7 22:09:53 2009 @@ -58,6 +58,13 @@ --with-pydebug, and vice-versa. +Build +----- + +- Issue #6154: Make sure the intl library is added to LIBS if needed. Also + added LIBS to OS X framework builds. + + What's New in Python 3.1 release candidate 1? ============================================= Modified: python/branches/py3k/configure ============================================================================== --- python/branches/py3k/configure (original) +++ python/branches/py3k/configure Sun Jun 7 22:09:53 2009 @@ -1,5 +1,5 @@ #! /bin/sh -# From configure.in Revision: 73021 . +# From configure.in Revision: 73142 . # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.61 for python 3.1. # @@ -13892,6 +13892,7 @@ #define WITH_LIBINTL 1 _ACEOF + LIBS="-lintl $LIBS" fi Modified: python/branches/py3k/configure.in ============================================================================== --- python/branches/py3k/configure.in (original) +++ python/branches/py3k/configure.in Sun Jun 7 22:09:53 2009 @@ -1819,8 +1819,9 @@ # check if we need libintl for locale functions AC_CHECK_LIB(intl, textdomain, - AC_DEFINE(WITH_LIBINTL, 1, - [Define to 1 if libintl is needed for locale functions.])) + [AC_DEFINE(WITH_LIBINTL, 1, + [Define to 1 if libintl is needed for locale functions.]) + LIBS="-lintl $LIBS"]) # checks for system dependent C++ extensions support case "$ac_sys_system" in From python-checkins at python.org Sun Jun 7 22:37:52 2009 From: python-checkins at python.org (georg.brandl) Date: Sun, 7 Jun 2009 22:37:52 +0200 (CEST) Subject: [Python-checkins] r73275 - python/trunk/Misc/developers.txt Message-ID: <20090607203752.B675ED778@mail.python.org> Author: georg.brandl Date: Sun Jun 7 22:37:52 2009 New Revision: 73275 Log: Add Ezio. Modified: python/trunk/Misc/developers.txt Modified: python/trunk/Misc/developers.txt ============================================================================== --- python/trunk/Misc/developers.txt (original) +++ python/trunk/Misc/developers.txt Sun Jun 7 22:37:52 2009 @@ -17,6 +17,9 @@ Permissions History ------------------- +- Ezio Melotti was given SVN access on June 7 2009 by GFB, for work on and + fixes to the documentation. + - Paul Kippes was given commit privileges at PyCon 2009 by BAC to work on 3to2. - Ron DuPlain was given commit privileges at PyCon 2009 by BAC to work on 3to2. From python-checkins at python.org Sun Jun 7 23:07:55 2009 From: python-checkins at python.org (guilherme.polo) Date: Sun, 7 Jun 2009 23:07:55 +0200 (CEST) Subject: [Python-checkins] r73276 - in python/branches/tk_and_idle_maintenance/Lib/lib-tk/test/test_tkinter: test_listbox.py test_menu.py test_scrollbar.py Message-ID: <20090607210755.71D6DC512@mail.python.org> Author: guilherme.polo Date: Sun Jun 7 23:07:55 2009 New Revision: 73276 Log: Adjusts for running properly under Windows. Modified: python/branches/tk_and_idle_maintenance/Lib/lib-tk/test/test_tkinter/test_listbox.py python/branches/tk_and_idle_maintenance/Lib/lib-tk/test/test_tkinter/test_menu.py python/branches/tk_and_idle_maintenance/Lib/lib-tk/test/test_tkinter/test_scrollbar.py Modified: python/branches/tk_and_idle_maintenance/Lib/lib-tk/test/test_tkinter/test_listbox.py ============================================================================== --- python/branches/tk_and_idle_maintenance/Lib/lib-tk/test/test_tkinter/test_listbox.py (original) +++ python/branches/tk_and_idle_maintenance/Lib/lib-tk/test/test_tkinter/test_listbox.py Sun Jun 7 23:07:55 2009 @@ -75,7 +75,7 @@ self.lb.insert(0, *tuple(items)) self.assertTrue(isinstance(self.lb.nearest(10), int)) self.lb.pack() - self.lb.update_idletasks() + self.lb.wait_visibility() for i in range(0, self.lb.winfo_height(), 5): item = self.lb.get(self.lb.nearest(i)) if item in items: Modified: python/branches/tk_and_idle_maintenance/Lib/lib-tk/test/test_tkinter/test_menu.py ============================================================================== --- python/branches/tk_and_idle_maintenance/Lib/lib-tk/test/test_tkinter/test_menu.py (original) +++ python/branches/tk_and_idle_maintenance/Lib/lib-tk/test/test_tkinter/test_menu.py Sun Jun 7 23:07:55 2009 @@ -1,3 +1,4 @@ +import sys import unittest import Tkinter from test.test_support import requires, run_unittest @@ -112,6 +113,9 @@ self.assertRaises(Tkinter.TclError, self.menu.invoke, -1) def test_post_unpost(self): + if sys.platform == 'win32': + self.skipTest("Menu post blocks on Windows.") + self.menu.add_radiobutton(label='R') self.menu.add_checkbutton(label='C') Modified: python/branches/tk_and_idle_maintenance/Lib/lib-tk/test/test_tkinter/test_scrollbar.py ============================================================================== --- python/branches/tk_and_idle_maintenance/Lib/lib-tk/test/test_tkinter/test_scrollbar.py (original) +++ python/branches/tk_and_idle_maintenance/Lib/lib-tk/test/test_tkinter/test_scrollbar.py Sun Jun 7 23:07:55 2009 @@ -46,8 +46,8 @@ y_max = self.sb.winfo_height() values = ['', 'arrow1', 'arrow2', 'slider'] - empty = self.sb.identify(0, 0) - self.assertIn(empty, values) + empty = self.sb.identify(-1, -1) + self.assertEqual(empty, '') values.remove(empty) self.assertEqual(values, ['arrow1', 'arrow2', 'slider']) arrow1 = self.sb.identify(x_mid, 5) From python-checkins at python.org Sun Jun 7 23:22:26 2009 From: python-checkins at python.org (guilherme.polo) Date: Sun, 7 Jun 2009 23:22:26 +0200 (CEST) Subject: [Python-checkins] r73277 - in python/branches/tk_and_idle_maintenance: Doc/library/socketserver.rst Lib/SocketServer.py Lib/locale.py Misc/developers.txt Modules/_localemodule.c Message-ID: <20090607212226.20ED0C512@mail.python.org> Author: guilherme.polo Date: Sun Jun 7 23:22:25 2009 New Revision: 73277 Log: Merged revisions 73270,73272,73275 via svnmerge from svn+ssh://pythondev/python/trunk ........ r73270 | benjamin.peterson | 2009-06-07 13:24:48 -0300 (Sun, 07 Jun 2009) | 1 line backport r73268 ........ r73272 | kristjan.jonsson | 2009-06-07 13:43:23 -0300 (Sun, 07 Jun 2009) | 2 lines http://bugs.python.org/issue6192 Add a feature to disable the Nagle algorithm on sockets in TCPServer ........ r73275 | georg.brandl | 2009-06-07 17:37:52 -0300 (Sun, 07 Jun 2009) | 1 line Add Ezio. ........ Modified: python/branches/tk_and_idle_maintenance/ (props changed) python/branches/tk_and_idle_maintenance/Doc/library/socketserver.rst python/branches/tk_and_idle_maintenance/Lib/SocketServer.py python/branches/tk_and_idle_maintenance/Lib/locale.py python/branches/tk_and_idle_maintenance/Misc/developers.txt python/branches/tk_and_idle_maintenance/Modules/_localemodule.c Modified: python/branches/tk_and_idle_maintenance/Doc/library/socketserver.rst ============================================================================== --- python/branches/tk_and_idle_maintenance/Doc/library/socketserver.rst (original) +++ python/branches/tk_and_idle_maintenance/Doc/library/socketserver.rst Sun Jun 7 23:22:25 2009 @@ -223,6 +223,15 @@ desired. If :meth:`handle_request` receives no incoming requests within the timeout period, the :meth:`handle_timeout` method is called. +.. attribute:: TCPServer.disable_nagle_algorithm + + If set to True, it will set the TCP_NODELAY attribute of new requests + connections. This can help alleviate problems with latency in + request-response type applications. To avoid sending many small packets, + this option should be used only when bufferning output, such as when + setting :attr:`StreamRequestHandler.wbufsize` attribute to -1. + + .. versionadded:: 2.7 There are various server methods that can be overridden by subclasses of base server classes like :class:`TCPServer`; these methods aren't useful to external Modified: python/branches/tk_and_idle_maintenance/Lib/SocketServer.py ============================================================================== --- python/branches/tk_and_idle_maintenance/Lib/SocketServer.py (original) +++ python/branches/tk_and_idle_maintenance/Lib/SocketServer.py Sun Jun 7 23:22:25 2009 @@ -374,6 +374,7 @@ - socket_type - request_queue_size (only for stream sockets) - allow_reuse_address + - disable_nagle_algorithm Instance variables: @@ -391,6 +392,8 @@ allow_reuse_address = False + disable_nagle_algorithm = False + def __init__(self, server_address, RequestHandlerClass, bind_and_activate=True): """Constructor. May be extended, do not override.""" BaseServer.__init__(self, server_address, RequestHandlerClass) @@ -441,7 +444,10 @@ May be overridden. """ - return self.socket.accept() + request = self.socket.accept() + if self.disable_nagle_algorithm: + request[0].setsockopt(socket.IPPROTO_TCP, socket.TCP_NODELAY, True) + return request def close_request(self, request): """Called to clean up an individual request.""" Modified: python/branches/tk_and_idle_maintenance/Lib/locale.py ============================================================================== --- python/branches/tk_and_idle_maintenance/Lib/locale.py (original) +++ python/branches/tk_and_idle_maintenance/Lib/locale.py Sun Jun 7 23:22:25 2009 @@ -529,10 +529,8 @@ """ _setlocale(category, _build_localename(getdefaultlocale())) -if sys.platform in ('win32', 'darwin', 'mac'): +if sys.platform.startswith("win"): # On Win32, this will return the ANSI code page - # On the Mac, it should return the system encoding; - # it might return "ascii" instead def getpreferredencoding(do_setlocale = True): """Return the charset that the user is likely using.""" import _locale Modified: python/branches/tk_and_idle_maintenance/Misc/developers.txt ============================================================================== --- python/branches/tk_and_idle_maintenance/Misc/developers.txt (original) +++ python/branches/tk_and_idle_maintenance/Misc/developers.txt Sun Jun 7 23:22:25 2009 @@ -17,6 +17,9 @@ Permissions History ------------------- +- Ezio Melotti was given SVN access on June 7 2009 by GFB, for work on and + fixes to the documentation. + - Paul Kippes was given commit privileges at PyCon 2009 by BAC to work on 3to2. - Ron DuPlain was given commit privileges at PyCon 2009 by BAC to work on 3to2. Modified: python/branches/tk_and_idle_maintenance/Modules/_localemodule.c ============================================================================== --- python/branches/tk_and_idle_maintenance/Modules/_localemodule.c (original) +++ python/branches/tk_and_idle_maintenance/Modules/_localemodule.c Sun Jun 7 23:22:25 2009 @@ -412,38 +412,6 @@ } #endif -#if defined(__APPLE__) -/* -** Find out what the current script is. -** Donated by Fredrik Lundh. -*/ -static char *mac_getscript(void) -{ - CFStringEncoding enc = CFStringGetSystemEncoding(); - static CFStringRef name = NULL; - /* Return the code name for the encodings for which we have codecs. */ - switch(enc) { - case kCFStringEncodingMacRoman: return "mac-roman"; - case kCFStringEncodingMacGreek: return "mac-greek"; - case kCFStringEncodingMacCyrillic: return "mac-cyrillic"; - case kCFStringEncodingMacTurkish: return "mac-turkish"; - case kCFStringEncodingMacIcelandic: return "mac-icelandic"; - /* XXX which one is mac-latin2? */ - } - if (!name) { - /* This leaks an object. */ - name = CFStringConvertEncodingToIANACharSetName(enc); - } - return (char *)CFStringGetCStringPtr(name, 0); -} - -static PyObject* -PyLocale_getdefaultlocale(PyObject* self) -{ - return Py_BuildValue("Os", Py_None, mac_getscript()); -} -#endif - #ifdef HAVE_LANGINFO_H #define LANGINFO(X) {#X, X} static struct langinfo_constant{ @@ -689,7 +657,7 @@ METH_VARARGS, strcoll__doc__}, {"strxfrm", (PyCFunction) PyLocale_strxfrm, METH_VARARGS, strxfrm__doc__}, -#if defined(MS_WINDOWS) || defined(__APPLE__) +#if defined(MS_WINDOWS) {"_getdefaultlocale", (PyCFunction) PyLocale_getdefaultlocale, METH_NOARGS}, #endif #ifdef HAVE_LANGINFO_H From python-checkins at python.org Mon Jun 8 00:33:11 2009 From: python-checkins at python.org (benjamin.peterson) Date: Mon, 8 Jun 2009 00:33:11 +0200 (CEST) Subject: [Python-checkins] r73278 - python/trunk/Parser/asdl.py Message-ID: <20090607223311.EB285D416@mail.python.org> Author: benjamin.peterson Date: Mon Jun 8 00:33:11 2009 New Revision: 73278 Log: inherit from object Modified: python/trunk/Parser/asdl.py Modified: python/trunk/Parser/asdl.py ============================================================================== --- python/trunk/Parser/asdl.py (original) +++ python/trunk/Parser/asdl.py Mon Jun 8 00:33:11 2009 @@ -226,7 +226,7 @@ # not sure if any of the methods are useful yet, but I'm adding them # piecemeal as they seem helpful -class AST: +class AST(object): pass # a marker class class Module(AST): From python-checkins at python.org Mon Jun 8 00:35:01 2009 From: python-checkins at python.org (benjamin.peterson) Date: Mon, 8 Jun 2009 00:35:01 +0200 (CEST) Subject: [Python-checkins] r73279 - python/trunk/Parser/asdl.py Message-ID: <20090607223501.0F6C0C528@mail.python.org> Author: benjamin.peterson Date: Mon Jun 8 00:35:00 2009 New Revision: 73279 Log: always inherit from an appropiate base class Modified: python/trunk/Parser/asdl.py Modified: python/trunk/Parser/asdl.py ============================================================================== --- python/trunk/Parser/asdl.py (original) +++ python/trunk/Parser/asdl.py Mon Jun 8 00:35:00 2009 @@ -10,14 +10,12 @@ Changes for Python: Add support for module versions """ -#__metaclass__ = type - import os import traceback import spark -class Token: +class Token(object): # spark seems to dispatch in the parser based on a token's # type attribute def __init__(self, type, lineno): @@ -45,7 +43,7 @@ self.value = value self.lineno = lineno -class ASDLSyntaxError: +class ASDLSyntaxError(Exception): def __init__(self, lineno, token=None, msg=None): self.lineno = lineno From python-checkins at python.org Mon Jun 8 00:54:36 2009 From: python-checkins at python.org (benjamin.peterson) Date: Mon, 8 Jun 2009 00:54:36 +0200 (CEST) Subject: [Python-checkins] r73280 - in python/trunk/Parser: asdl.py asdl_c.py Message-ID: <20090607225436.12102D463@mail.python.org> Author: benjamin.peterson Date: Mon Jun 8 00:54:35 2009 New Revision: 73280 Log: use booleans for flags Modified: python/trunk/Parser/asdl.py python/trunk/Parser/asdl_c.py Modified: python/trunk/Parser/asdl.py ============================================================================== --- python/trunk/Parser/asdl.py (original) +++ python/trunk/Parser/asdl.py Mon Jun 8 00:54:35 2009 @@ -204,19 +204,19 @@ def p_field_2(self, (type, _, name)): " field ::= Id * Id " - return Field(type, name, seq=1) + return Field(type, name, seq=True) def p_field_3(self, (type, _, name)): " field ::= Id ? Id " - return Field(type, name, opt=1) + return Field(type, name, opt=True) def p_field_4(self, (type, _)): " field ::= Id * " - return Field(type, seq=1) + return Field(type, seq=True) def p_field_5(self, (type, _)): " field ::= Id ? " - return Field(type, opt=1) + return Field(type, opt=True) builtin_types = ("identifier", "string", "int", "bool", "object") @@ -256,7 +256,7 @@ return "Constructor(%s, %s)" % (self.name, self.fields) class Field(AST): - def __init__(self, type, name=None, seq=0, opt=0): + def __init__(self, type, name=None, seq=False, opt=False): self.type = type self.name = name self.seq = seq @@ -264,9 +264,9 @@ def __repr__(self): if self.seq: - extra = ", seq=1" + extra = ", seq=True" elif self.opt: - extra = ", opt=1" + extra = ", opt=True" else: extra = "" if self.name is None: @@ -294,7 +294,7 @@ class VisitorBase(object): - def __init__(self, skip=0): + def __init__(self, skip=False): self.cache = {} self.skip = skip @@ -329,7 +329,7 @@ class Check(VisitorBase): def __init__(self): - super(Check, self).__init__(skip=1) + super(Check, self).__init__(skip=True) self.cons = {} self.errors = 0 self.types = {} Modified: python/trunk/Parser/asdl_c.py ============================================================================== --- python/trunk/Parser/asdl_c.py (original) +++ python/trunk/Parser/asdl_c.py Mon Jun 8 00:54:35 2009 @@ -86,7 +86,7 @@ self.file = file super(EmitVisitor, self).__init__() - def emit(self, s, depth, reflow=1): + def emit(self, s, depth, reflow=True): # XXX reflow long lines? if reflow: lines = reflow_lines(s, depth) @@ -255,7 +255,7 @@ ctype = get_c_type(type) self.emit_function(cons.name, ctype, args, attrs) - def emit_function(self, name, ctype, args, attrs, union=1): + def emit_function(self, name, ctype, args, attrs, union=True): args = args + attrs if args: argstr = ", ".join(["%s %s" % (atype, aname) @@ -267,19 +267,19 @@ for i in range(1, len(args)+1): margs += ", a%d" % i self.emit("#define %s(%s) _Py_%s(%s)" % (name, margs, name, margs), 0, - reflow = 0) - self.emit("%s _Py_%s(%s);" % (ctype, name, argstr), 0) + reflow=False) + self.emit("%s _Py_%s(%s);" % (ctype, name, argstr), False) def visitProduct(self, prod, name): self.emit_function(name, get_c_type(name), - self.get_args(prod.fields), [], union=0) + self.get_args(prod.fields), [], union=False) class FunctionVisitor(PrototypeVisitor): """Visitor to generate constructor functions for AST.""" - def emit_function(self, name, ctype, args, attrs, union=1): - def emit(s, depth=0, reflow=1): + def emit_function(self, name, ctype, args, attrs, union=True): + def emit(s, depth=0, reflow=True): self.emit(s, depth, reflow) argstr = ", ".join(["%s %s" % (atype, aname) for atype, aname, opt in args + attrs]) @@ -298,7 +298,7 @@ emit("PyErr_SetString(PyExc_ValueError,", 2) msg = "field %s is required for %s" % (argname, name) emit(' "%s");' % msg, - 2, reflow=0) + 2, reflow=False) emit('return NULL;', 2) emit('}', 1) @@ -314,7 +314,7 @@ emit("") def emit_body_union(self, name, args, attrs): - def emit(s, depth=0, reflow=1): + def emit(s, depth=0, reflow=True): self.emit(s, depth, reflow) emit("p->kind = %s_kind;" % name, 1) for argtype, argname, opt in args: @@ -323,7 +323,7 @@ emit("p->%s = %s;" % (argname, argname), 1) def emit_body_struct(self, name, args, attrs): - def emit(s, depth=0, reflow=1): + def emit(s, depth=0, reflow=True): self.emit(s, depth, reflow) for argtype, argname, opt in args: emit("p->%s = %s;" % (argname, argname), 1) From python-checkins at python.org Mon Jun 8 00:55:36 2009 From: python-checkins at python.org (benjamin.peterson) Date: Mon, 8 Jun 2009 00:55:36 +0200 (CEST) Subject: [Python-checkins] r73281 - python/trunk/Parser/asdl.py Message-ID: <20090607225536.BE847C2AF@mail.python.org> Author: benjamin.peterson Date: Mon Jun 8 00:55:36 2009 New Revision: 73281 Log: remove has_key Modified: python/trunk/Parser/asdl.py Modified: python/trunk/Parser/asdl.py ============================================================================== --- python/trunk/Parser/asdl.py (original) +++ python/trunk/Parser/asdl.py Mon Jun 8 00:55:36 2009 @@ -371,7 +371,7 @@ v.visit(mod) for t in v.types: - if not mod.types.has_key(t) and not t in builtin_types: + if t not in mod.types and not t in builtin_types: v.errors += 1 uses = ", ".join(v.types[t]) print "Undefined type %s, used in %s" % (t, uses) From python-checkins at python.org Mon Jun 8 01:12:44 2009 From: python-checkins at python.org (benjamin.peterson) Date: Mon, 8 Jun 2009 01:12:44 +0200 (CEST) Subject: [Python-checkins] r73282 - python/trunk/Lib/test/test_winreg.py Message-ID: <20090607231244.63B3DD420@mail.python.org> Author: benjamin.peterson Date: Mon Jun 8 01:12:44 2009 New Revision: 73282 Log: backport r73273 Modified: python/trunk/Lib/test/test_winreg.py Modified: python/trunk/Lib/test/test_winreg.py ============================================================================== --- python/trunk/Lib/test/test_winreg.py (original) +++ python/trunk/Lib/test/test_winreg.py Mon Jun 8 01:12:44 2009 @@ -35,6 +35,27 @@ class WinregTests(unittest.TestCase): remote_name = None + def setUp(self): + # Make sure that the test key is absent when the test + # starts. + self.delete_tree(HKEY_CURRENT_USER, test_key_name) + + def delete_tree(self, root, subkey): + try: + hkey = OpenKey(root, subkey, KEY_ALL_ACCESS) + except WindowsError: + # subkey does not exist + return + while True: + try: + subsubkey = EnumKey(hkey, 0) + except WindowsError: + # no more subkeys + break + self.delete_tree(hkey, subsubkey) + CloseKey(hkey) + DeleteKey(root, subkey) + def WriteTestData(self, root_key): # Set the default value for this key. SetValue(root_key, test_key_name, REG_SZ, "Default value") From python-checkins at python.org Mon Jun 8 01:15:34 2009 From: python-checkins at python.org (benjamin.peterson) Date: Mon, 8 Jun 2009 01:15:34 +0200 (CEST) Subject: [Python-checkins] r73283 - python/branches/py3k Message-ID: <20090607231534.75F63D438@mail.python.org> Author: benjamin.peterson Date: Mon Jun 8 01:15:34 2009 New Revision: 73283 Log: Blocked revisions 73282 via svnmerge ........ r73282 | benjamin.peterson | 2009-06-07 18:12:44 -0500 (Sun, 07 Jun 2009) | 1 line backport r73273 ........ Modified: python/branches/py3k/ (props changed) From buildbot at python.org Mon Jun 8 02:24:18 2009 From: buildbot at python.org (buildbot at python.org) Date: Mon, 08 Jun 2009 00:24:18 +0000 Subject: [Python-checkins] buildbot failure in sparc solaris10 gcc 3.x Message-ID: <20090608002418.3FF73D9B1@mail.python.org> The Buildbot has detected a new failure of sparc solaris10 gcc 3.x. Full details are available at: http://www.python.org/dev/buildbot/all/sparc%20solaris10%20gcc%203.x/builds/799 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: loewis-sun Build Reason: Build Source Stamp: [branch branches/py3k] HEAD Blamelist: benjamin.peterson BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_posix ====================================================================== ERROR: test_getcwd_long_pathnames (test.test_posix.PosixTester) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home2/buildbot/slave/3.x.loewis-sun/build/Lib/test/test_posix.py", line 251, in test_getcwd_long_pathnames support.rmtree(base_path) File "/home2/buildbot/slave/3.x.loewis-sun/build/Lib/test/support.py", line 181, in rmtree shutil.rmtree(path) File "/home2/buildbot/slave/3.x.loewis-sun/build/Lib/shutil.py", line 239, in rmtree onerror(os.rmdir, path, sys.exc_info()) File "/home2/buildbot/slave/3.x.loewis-sun/build/Lib/shutil.py", line 237, in rmtree os.rmdir(path) OSError: [Errno 22] Invalid argument: '/home2/buildbot/slave/3.x.loewis-sun/build/@test.getcwd/@test.getcwd' sincerely, -The Buildbot From buildbot at python.org Mon Jun 8 06:02:51 2009 From: buildbot at python.org (buildbot at python.org) Date: Mon, 08 Jun 2009 04:02:51 +0000 Subject: [Python-checkins] buildbot failure in x86 XP-4 3.x Message-ID: <20090608040251.A1734DA83@mail.python.org> The Buildbot has detected a new failure of x86 XP-4 3.x. Full details are available at: http://www.python.org/dev/buildbot/all/x86%20XP-4%203.x/builds/668 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: bolen-windows Build Reason: Build Source Stamp: [branch branches/py3k] HEAD Blamelist: benjamin.peterson BUILD FAILED: failed test Excerpt from the test logfile: Traceback (most recent call last): File "E:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\test\test_import.py", line 63, in test_with_extension self.fail("import from %s failed: %s" % (ext, err)) File "E:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\unittest.py", line 540, in fail raise self.failureException(msg) AssertionError: import from .PY failed: No module named @test Traceback (most recent call last): File "E:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\test\test_import.py", line 80, in testImport test_with_extension(ext) File "E:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\test\test_import.py", line 73, in test_with_extension del sys.modules[TESTFN] KeyError: '@test' 1 test failed: test_import ====================================================================== ERROR: testImport (test.test_import.ImportTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "E:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\test\test_import.py", line 61, in test_with_extension mod = __import__(TESTFN) ImportError: No module named @test Traceback (most recent call last): File "E:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\test\test_import.py", line 63, in test_with_extension self.fail("import from %s failed: %s" % (ext, err)) File "E:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\unittest.py", line 540, in fail raise self.failureException(msg) AssertionError: import from .PY failed: No module named @test Traceback (most recent call last): File "E:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\test\test_import.py", line 80, in testImport test_with_extension(ext) File "E:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\test\test_import.py", line 73, in test_with_extension del sys.modules[TESTFN] KeyError: '@test' Traceback (most recent call last): File "E:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\test\test_import.py", line 63, in test_with_extension self.fail("import from %s failed: %s" % (ext, err)) File "E:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\unittest.py", line 540, in fail raise self.failureException(msg) AssertionError: import from .PY failed: No module named @test Traceback (most recent call last): File "E:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\test\test_import.py", line 80, in testImport test_with_extension(ext) File "E:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\test\test_import.py", line 73, in test_with_extension del sys.modules[TESTFN] KeyError: '@test' sincerely, -The Buildbot From python-checkins at python.org Mon Jun 8 09:48:27 2009 From: python-checkins at python.org (georg.brandl) Date: Mon, 8 Jun 2009 09:48:27 +0200 (CEST) Subject: [Python-checkins] r73284 - python/branches/py3k/Doc/library/re.rst Message-ID: <20090608074827.ACB5AD97B@mail.python.org> Author: georg.brandl Date: Mon Jun 8 09:48:27 2009 New Revision: 73284 Log: Remove duplicated sentence. Remove duplicated sentence. Modified: python/branches/py3k/Doc/library/re.rst Modified: python/branches/py3k/Doc/library/re.rst ============================================================================== --- python/branches/py3k/Doc/library/re.rst (original) +++ python/branches/py3k/Doc/library/re.rst Mon Jun 8 09:48:27 2009 @@ -9,8 +9,7 @@ This module provides regular expression matching operations similar to -those found in Perl. Both patterns and strings to be searched can be -Unicode strings as well as 8-bit strings. +those found in Perl. Both patterns and strings to be searched can be Unicode strings as well as 8-bit strings. However, Unicode strings and 8-bit strings cannot be mixed: From python-checkins at python.org Mon Jun 8 09:49:54 2009 From: python-checkins at python.org (georg.brandl) Date: Mon, 8 Jun 2009 09:49:54 +0200 (CEST) Subject: [Python-checkins] r73285 - python/branches/py3k/Doc/library/re.rst Message-ID: <20090608074954.DAE24D96F@mail.python.org> Author: georg.brandl Date: Mon Jun 8 09:49:54 2009 New Revision: 73285 Log: #6235: ASCII also affects \[dD] escapes. Modified: python/branches/py3k/Doc/library/re.rst Modified: python/branches/py3k/Doc/library/re.rst ============================================================================== --- python/branches/py3k/Doc/library/re.rst (original) +++ python/branches/py3k/Doc/library/re.rst Mon Jun 8 09:49:54 2009 @@ -479,9 +479,9 @@ .. data:: A ASCII - Make ``\w``, ``\W``, ``\b``, ``\B``, ``\s`` and ``\S`` perform ASCII-only - matching instead of full Unicode matching. This is only meaningful for - Unicode patterns, and is ignored for byte patterns. + Make ``\w``, ``\W``, ``\b``, ``\B``, ``\d``, ``\D``, ``\s`` and ``\S`` + perform ASCII-only matching instead of full Unicode matching. This is only + meaningful for Unicode patterns, and is ignored for byte patterns. Note that for backward compatibility, the :const:`re.U` flag still exists (as well as its synonym :const:`re.UNICODE` and its embedded From python-checkins at python.org Mon Jun 8 09:57:36 2009 From: python-checkins at python.org (georg.brandl) Date: Mon, 8 Jun 2009 09:57:36 +0200 (CEST) Subject: [Python-checkins] r73286 - in python/trunk/Doc/library: cgi.rst contextlib.rst ctypes.rst curses.panel.rst pickletools.rst platform.rst Message-ID: <20090608075736.2BB25DA65@mail.python.org> Author: georg.brandl Date: Mon Jun 8 09:57:35 2009 New Revision: 73286 Log: Remove period from end of headings. Modified: python/trunk/Doc/library/cgi.rst python/trunk/Doc/library/contextlib.rst python/trunk/Doc/library/ctypes.rst python/trunk/Doc/library/curses.panel.rst python/trunk/Doc/library/pickletools.rst python/trunk/Doc/library/platform.rst Modified: python/trunk/Doc/library/cgi.rst ============================================================================== --- python/trunk/Doc/library/cgi.rst (original) +++ python/trunk/Doc/library/cgi.rst Mon Jun 8 09:57:35 2009 @@ -1,6 +1,5 @@ - -:mod:`cgi` --- Common Gateway Interface support. -================================================ +:mod:`cgi` --- Common Gateway Interface support +=============================================== .. module:: cgi :synopsis: Helpers for running Python scripts via the Common Gateway Interface. Modified: python/trunk/Doc/library/contextlib.rst ============================================================================== --- python/trunk/Doc/library/contextlib.rst (original) +++ python/trunk/Doc/library/contextlib.rst Mon Jun 8 09:57:35 2009 @@ -1,6 +1,5 @@ - -:mod:`contextlib` --- Utilities for :keyword:`with`\ -statement contexts. -========================================================================= +:mod:`contextlib` --- Utilities for :keyword:`with`\ -statement contexts +======================================================================== .. module:: contextlib :synopsis: Utilities for with-statement contexts. Modified: python/trunk/Doc/library/ctypes.rst ============================================================================== --- python/trunk/Doc/library/ctypes.rst (original) +++ python/trunk/Doc/library/ctypes.rst Mon Jun 8 09:57:35 2009 @@ -1,6 +1,5 @@ - -:mod:`ctypes` --- A foreign function library for Python. -======================================================== +:mod:`ctypes` --- A foreign function library for Python +======================================================= .. module:: ctypes :synopsis: A foreign function library for Python. Modified: python/trunk/Doc/library/curses.panel.rst ============================================================================== --- python/trunk/Doc/library/curses.panel.rst (original) +++ python/trunk/Doc/library/curses.panel.rst Mon Jun 8 09:57:35 2009 @@ -1,6 +1,5 @@ - -:mod:`curses.panel` --- A panel stack extension for curses. -=========================================================== +:mod:`curses.panel` --- A panel stack extension for curses +========================================================== .. module:: curses.panel :synopsis: A panel stack extension that adds depth to curses windows. Modified: python/trunk/Doc/library/pickletools.rst ============================================================================== --- python/trunk/Doc/library/pickletools.rst (original) +++ python/trunk/Doc/library/pickletools.rst Mon Jun 8 09:57:35 2009 @@ -1,6 +1,5 @@ - -:mod:`pickletools` --- Tools for pickle developers. -=================================================== +:mod:`pickletools` --- Tools for pickle developers +================================================== .. module:: pickletools :synopsis: Contains extensive comments about the pickle protocols and pickle-machine Modified: python/trunk/Doc/library/platform.rst ============================================================================== --- python/trunk/Doc/library/platform.rst (original) +++ python/trunk/Doc/library/platform.rst Mon Jun 8 09:57:35 2009 @@ -1,6 +1,5 @@ - -:mod:`platform` --- Access to underlying platform's identifying data. -====================================================================== +:mod:`platform` --- Access to underlying platform's identifying data +===================================================================== .. module:: platform :synopsis: Retrieves as much platform identifying data as possible. From python-checkins at python.org Mon Jun 8 10:00:23 2009 From: python-checkins at python.org (georg.brandl) Date: Mon, 8 Jun 2009 10:00:23 +0200 (CEST) Subject: [Python-checkins] r73287 - in python/branches/py3k: Doc/library/contextlib.rst Doc/library/pickletools.rst Doc/library/platform.rst Message-ID: <20090608080023.22F00EE981@mail.python.org> Author: georg.brandl Date: Mon Jun 8 10:00:22 2009 New Revision: 73287 Log: Recorded merge of revisions 73286 via svnmerge from svn+ssh://pythondev at svn.python.org/python/trunk ........ r73286 | georg.brandl | 2009-06-08 09:57:35 +0200 (Mo, 08 Jun 2009) | 1 line Remove period from end of headings. ........ Modified: python/branches/py3k/ (props changed) python/branches/py3k/Doc/library/contextlib.rst python/branches/py3k/Doc/library/pickletools.rst python/branches/py3k/Doc/library/platform.rst Modified: python/branches/py3k/Doc/library/contextlib.rst ============================================================================== --- python/branches/py3k/Doc/library/contextlib.rst (original) +++ python/branches/py3k/Doc/library/contextlib.rst Mon Jun 8 10:00:22 2009 @@ -1,5 +1,5 @@ -:mod:`contextlib` --- Utilities for :keyword:`with`\ -statement contexts. -========================================================================= +:mod:`contextlib` --- Utilities for :keyword:`with`\ -statement contexts +======================================================================== .. module:: contextlib :synopsis: Utilities for with-statement contexts. Modified: python/branches/py3k/Doc/library/pickletools.rst ============================================================================== --- python/branches/py3k/Doc/library/pickletools.rst (original) +++ python/branches/py3k/Doc/library/pickletools.rst Mon Jun 8 10:00:22 2009 @@ -1,6 +1,5 @@ - -:mod:`pickletools` --- Tools for pickle developers. -=================================================== +:mod:`pickletools` --- Tools for pickle developers +================================================== .. module:: pickletools :synopsis: Contains extensive comments about the pickle protocols and pickle-machine opcodes, as well as some useful functions. Modified: python/branches/py3k/Doc/library/platform.rst ============================================================================== --- python/branches/py3k/Doc/library/platform.rst (original) +++ python/branches/py3k/Doc/library/platform.rst Mon Jun 8 10:00:22 2009 @@ -1,6 +1,5 @@ - -:mod:`platform` --- Access to underlying platform's identifying data. -====================================================================== +:mod:`platform` --- Access to underlying platform's identifying data +===================================================================== .. module:: platform :synopsis: Retrieves as much platform identifying data as possible. From buildbot at python.org Mon Jun 8 10:30:06 2009 From: buildbot at python.org (buildbot at python.org) Date: Mon, 08 Jun 2009 08:30:06 +0000 Subject: [Python-checkins] buildbot failure in x86 osx.5 3.x Message-ID: <20090608083006.57576DA63@mail.python.org> The Buildbot has detected a new failure of x86 osx.5 3.x. Full details are available at: http://www.python.org/dev/buildbot/all/x86%20osx.5%203.x/builds/1006 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: heller-x86-osx5 Build Reason: Build Source Stamp: [branch branches/py3k] HEAD Blamelist: georg.brandl BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_tarfile make: *** [buildbottest] Error 1 sincerely, -The Buildbot From python-checkins at python.org Mon Jun 8 10:53:40 2009 From: python-checkins at python.org (georg.brandl) Date: Mon, 8 Jun 2009 10:53:40 +0200 (CEST) Subject: [Python-checkins] r73288 - python/branches/py3k/Lib/logging/handlers.py Message-ID: <20090608085340.0BB6CD5FA@mail.python.org> Author: georg.brandl Date: Mon Jun 8 10:53:39 2009 New Revision: 73288 Log: Use a real bool for a flag option. Modified: python/branches/py3k/Lib/logging/handlers.py Modified: python/branches/py3k/Lib/logging/handlers.py ============================================================================== --- python/branches/py3k/Lib/logging/handlers.py (original) +++ python/branches/py3k/Lib/logging/handlers.py Mon Jun 8 10:53:39 2009 @@ -155,7 +155,7 @@ If backupCount is > 0, when rollover is done, no more than backupCount files are kept - the oldest ones are deleted. """ - def __init__(self, filename, when='h', interval=1, backupCount=0, encoding=None, delay=0, utc=0): + def __init__(self, filename, when='h', interval=1, backupCount=0, encoding=None, delay=0, utc=False): BaseRotatingHandler.__init__(self, filename, 'a', encoding, delay) self.when = when.upper() self.backupCount = backupCount From python-checkins at python.org Mon Jun 8 10:58:54 2009 From: python-checkins at python.org (georg.brandl) Date: Mon, 8 Jun 2009 10:58:54 +0200 (CEST) Subject: [Python-checkins] r73289 - python/branches/py3k/Lib/logging/config.py Message-ID: <20090608085854.5AB2FD628@mail.python.org> Author: georg.brandl Date: Mon Jun 8 10:58:54 2009 New Revision: 73289 Log: Use boolean for another flag option. Modified: python/branches/py3k/Lib/logging/config.py Modified: python/branches/py3k/Lib/logging/config.py ============================================================================== --- python/branches/py3k/Lib/logging/config.py (original) +++ python/branches/py3k/Lib/logging/config.py Mon Jun 8 10:58:54 2009 @@ -49,7 +49,7 @@ # _listener holds the server object doing the listening _listener = None -def fileConfig(fname, defaults=None, disable_existing_loggers=1): +def fileConfig(fname, defaults=None, disable_existing_loggers=True): """ Read the logging configuration from a ConfigParser-format file. From python-checkins at python.org Mon Jun 8 11:07:34 2009 From: python-checkins at python.org (georg.brandl) Date: Mon, 8 Jun 2009 11:07:34 +0200 (CEST) Subject: [Python-checkins] r73290 - python/branches/py3k/Lib/mimetypes.py Message-ID: <20090608090734.DEAEBD6E4@mail.python.org> Author: georg.brandl Date: Mon Jun 8 11:07:34 2009 New Revision: 73290 Log: Fix default value in docstring. Modified: python/branches/py3k/Lib/mimetypes.py Modified: python/branches/py3k/Lib/mimetypes.py ============================================================================== --- python/branches/py3k/Lib/mimetypes.py (original) +++ python/branches/py3k/Lib/mimetypes.py Mon Jun 8 11:07:34 2009 @@ -2,9 +2,9 @@ This module defines two useful functions: -guess_type(url, strict=1) -- guess the MIME type and encoding of a URL. +guess_type(url, strict=True) -- guess the MIME type and encoding of a URL. -guess_extension(type, strict=1) -- guess the extension for a given MIME type. +guess_extension(type, strict=True) -- guess the extension for a given MIME type. It also contains the following, for tuning the behavior: From python-checkins at python.org Mon Jun 8 11:13:45 2009 From: python-checkins at python.org (georg.brandl) Date: Mon, 8 Jun 2009 11:13:45 +0200 (CEST) Subject: [Python-checkins] r73291 - in python/branches/py3k/Doc/library: json.rst keyword.rst language.rst linecache.rst locale.rst logging.rst macpath.rst mailbox.rst mailcap.rst markup.rst marshal.rst math.rst mimetypes.rst misc.rst mm.rst mmap.rst modulefinder.rst modules.rst msilib.rst msvcrt.rst Message-ID: <20090608091345.EAF1DD777@mail.python.org> Author: georg.brandl Date: Mon Jun 8 11:13:45 2009 New Revision: 73291 Log: Signature documentation style update, modules J, K, L and M. Modified: python/branches/py3k/Doc/library/json.rst python/branches/py3k/Doc/library/keyword.rst python/branches/py3k/Doc/library/language.rst python/branches/py3k/Doc/library/linecache.rst python/branches/py3k/Doc/library/locale.rst python/branches/py3k/Doc/library/logging.rst python/branches/py3k/Doc/library/macpath.rst python/branches/py3k/Doc/library/mailbox.rst python/branches/py3k/Doc/library/mailcap.rst python/branches/py3k/Doc/library/markup.rst python/branches/py3k/Doc/library/marshal.rst python/branches/py3k/Doc/library/math.rst python/branches/py3k/Doc/library/mimetypes.rst python/branches/py3k/Doc/library/misc.rst python/branches/py3k/Doc/library/mm.rst python/branches/py3k/Doc/library/mmap.rst python/branches/py3k/Doc/library/modulefinder.rst python/branches/py3k/Doc/library/modules.rst python/branches/py3k/Doc/library/msilib.rst python/branches/py3k/Doc/library/msvcrt.rst Modified: python/branches/py3k/Doc/library/json.rst ============================================================================== --- python/branches/py3k/Doc/library/json.rst (original) +++ python/branches/py3k/Doc/library/json.rst Mon Jun 8 11:13:45 2009 @@ -112,7 +112,7 @@ Basic Usage ----------- -.. function:: dump(obj, fp[, skipkeys[, ensure_ascii[, check_circular[, allow_nan[, cls[, indent[, separators[, default[, **kw]]]]]]]]]]) +.. function:: dump(obj, fp, skipkeys=False, ensure_ascii=True, check_circular=True, allow_nan=True, cls=None, indent=None, separators=None, default=None, **kw) Serialize *obj* as a JSON formatted stream to *fp* (a ``.write()``-supporting file-like object). @@ -126,7 +126,6 @@ :class:`bytes` objects. Therefore, ``fp.write()`` must support :class:`str` input. - If *check_circular* is ``False`` (default: ``True``), then the circular reference check for container types will be skipped and a circular reference will result in an :exc:`OverflowError` (or worse). @@ -153,13 +152,13 @@ *cls* kwarg. -.. function:: dumps(obj[, skipkeys[, ensure_ascii[, check_circular[, allow_nan[, cls[, indent[, separators[, default[, **kw]]]]]]]]]]) +.. function:: dumps(obj, skipkeys=False, ensure_ascii=True, check_circular=True, allow_nan=True, cls=None, indent=None, separators=None, default=None, **kw) Serialize *obj* to a JSON formatted :class:`str`. The arguments have the same meaning as in :func:`dump`. -.. function:: load(fp[, cls[, object_hook[, parse_float[, parse_int[, parse_constant[, object_pairs_hook[, **kw]]]]]]]]) +.. function:: load(fp, cls=None, object_hook=None, parse_float=None, parse_int=None, parse_constant=None, object_pairs_hook=None, **kw) Deserialize *fp* (a ``.read()``-supporting file-like object containing a JSON document) to a Python object. @@ -200,7 +199,7 @@ class. -.. function:: loads(s[, encoding[, cls[, object_hook[, parse_float[, parse_int[, parse_constant[, object_pairs_hook[, **kw]]]]]]]]) +.. function:: loads(s, encoding=None, cls=None, object_hook=None, parse_float=None, parse_int=None, parse_constant=None, object_pairs_hook=None, **kw) Deserialize *s* (a :class:`str` or :class:`unicode` instance containing a JSON document) to a Python object. @@ -216,7 +215,7 @@ Encoders and decoders --------------------- -.. class:: JSONDecoder([encoding[, object_hook[, parse_float[, parse_int[, parse_constant[, strict[, object_pairs_hook]]]]]]]) +.. class:: JSONDecoder(object_hook=None, parse_float=None, parse_int=None, parse_constant=None, strict=True, object_pairs_hook=None) Simple JSON decoder. @@ -292,7 +291,7 @@ extraneous data at the end. -.. class:: JSONEncoder([skipkeys[, ensure_ascii[, check_circular[, allow_nan[, sort_keys[, indent[, separators[, default]]]]]]]]) +.. class:: JSONEncoder(skipkeys=False, ensure_ascii=True, check_circular=True, allow_nan=True, sort_keys=False, indent=None, separators=None, default=None) Extensible JSON encoder for Python data structures. Modified: python/branches/py3k/Doc/library/keyword.rst ============================================================================== --- python/branches/py3k/Doc/library/keyword.rst (original) +++ python/branches/py3k/Doc/library/keyword.rst Mon Jun 8 11:13:45 2009 @@ -1,4 +1,3 @@ - :mod:`keyword` --- Testing for Python keywords ============================================== Modified: python/branches/py3k/Doc/library/language.rst ============================================================================== --- python/branches/py3k/Doc/library/language.rst (original) +++ python/branches/py3k/Doc/library/language.rst Mon Jun 8 11:13:45 2009 @@ -1,4 +1,3 @@ - .. _language: ************************ Modified: python/branches/py3k/Doc/library/linecache.rst ============================================================================== --- python/branches/py3k/Doc/library/linecache.rst (original) +++ python/branches/py3k/Doc/library/linecache.rst Mon Jun 8 11:13:45 2009 @@ -1,4 +1,3 @@ - :mod:`linecache` --- Random access to text lines ================================================ @@ -15,7 +14,7 @@ The :mod:`linecache` module defines the following functions: -.. function:: getline(filename, lineno[, module_globals]) +.. function:: getline(filename, lineno, module_globals=None) Get line *lineno* from file named *filename*. This function will never throw an exception --- it will return ``''`` on errors (the terminating newline character @@ -35,12 +34,13 @@ previously read using :func:`getline`. -.. function:: checkcache([filename]) +.. function:: checkcache(filename=None) Check the cache for validity. Use this function if files in the cache may have changed on disk, and you require the updated version. If *filename* is omitted, it will check all the entries in the cache. + Example:: >>> import linecache Modified: python/branches/py3k/Doc/library/locale.rst ============================================================================== --- python/branches/py3k/Doc/library/locale.rst (original) +++ python/branches/py3k/Doc/library/locale.rst Mon Jun 8 11:13:45 2009 @@ -1,4 +1,3 @@ - :mod:`locale` --- Internationalization services =============================================== @@ -26,7 +25,7 @@ Exception raised when :func:`setlocale` fails. -.. function:: setlocale(category[, locale]) +.. function:: setlocale(category, locale=None) If *locale* is specified, it may be a string, a tuple of the form ``(language code, encoding)``, or ``None``. If it is a tuple, it is converted to a string @@ -151,7 +150,7 @@ constants are available in the locale module. -.. function:: getdefaultlocale([envvars]) +.. function:: getdefaultlocale(envvars=('LC_ALL', 'LC_CTYPE', 'LANG', 'LANGUAGE')) Tries to determine the default locale settings and returns them as a tuple of the form ``(language code, encoding)``. @@ -164,17 +163,17 @@ To maintain compatibility with other platforms, not only the :envvar:`LANG` variable is tested, but a list of variables given as envvars parameter. The - first found to be defined will be used. *envvars* defaults to the search path - used in GNU gettext; it must always contain the variable name ``LANG``. The GNU - gettext search path contains ``'LANGUAGE'``, ``'LC_ALL'``, ``'LC_CTYPE'``, and - ``'LANG'``, in that order. + first found to be defined will be used. *envvars* defaults to the search + path used in GNU gettext; it must always contain the variable name + ``'LANG'``. The GNU gettext search path contains ``'LC_ALL'``, + ``'LC_CTYPE'``, ``'LANG'`` and ``'LANGUAGE'``, in that order. Except for the code ``'C'``, the language code corresponds to :rfc:`1766`. *language code* and *encoding* may be ``None`` if their values cannot be determined. -.. function:: getlocale([category]) +.. function:: getlocale(category=LC_CTYPE) Returns the current setting for the given locale category as sequence containing *language code*, *encoding*. *category* may be one of the :const:`LC_\*` values @@ -185,7 +184,7 @@ determined. -.. function:: getpreferredencoding([do_setlocale]) +.. function:: getpreferredencoding(do_setlocale=True) Return the encoding used for text data, according to user preferences. User preferences are expressed differently on different systems, and might not be @@ -207,7 +206,7 @@ encoding for the locale code just like :func:`setlocale`. -.. function:: resetlocale([category]) +.. function:: resetlocale(category=LC_ALL) Sets the locale for *category* to the default setting. @@ -232,7 +231,7 @@ sequence of strings. -.. function:: format(format, val[, grouping[, monetary]]) +.. function:: format(format, val, grouping=False, monetary=False) Formats a number *val* according to the current :const:`LC_NUMERIC` setting. The format follows the conventions of the ``%`` operator. For floating point @@ -246,13 +245,13 @@ For whole format strings, use :func:`format_string`. -.. function:: format_string(format, val[, grouping]) +.. function:: format_string(format, val, grouping=False) Processes formatting specifiers as in ``format % val``, but takes the current locale settings into account. -.. function:: currency(val[, symbol[, grouping[, international]]]) +.. function:: currency(val, symbol=True, grouping=False, international=False) Formats a number *val* according to the current :const:`LC_MONETARY` settings. Modified: python/branches/py3k/Doc/library/logging.rst ============================================================================== --- python/branches/py3k/Doc/library/logging.rst (original) +++ python/branches/py3k/Doc/library/logging.rst Mon Jun 8 11:13:45 2009 @@ -616,9 +616,9 @@ functions. -.. function:: getLogger([name]) +.. function:: getLogger(name=None) - Return a logger with the specified name or, if no name is specified, return a + Return a logger with the specified name or, if name is ``None``, return a logger which is the root logger of the hierarchy. If specified, the name is typically a dot-separated hierarchical name like *"a"*, *"a.b"* or *"a.b.c.d"*. Choice of these names is entirely up to the developer who is using logging. @@ -639,7 +639,7 @@ # ... override behaviour here -.. function:: debug(msg[, *args[, **kwargs]]) +.. function:: debug(msg, *args, **kwargs) Logs a message with level :const:`DEBUG` on the root logger. The *msg* is the message format string, and the *args* are the arguments which are merged into @@ -663,7 +663,7 @@ d = {'clientip': '192.168.0.1', 'user': 'fbloggs'} logging.warning("Protocol problem: %s", "connection reset", extra=d) - would print something like :: + would print something like :: 2006-02-08 22:20:02,165 192.168.0.1 fbloggs Protocol problem: connection reset @@ -686,38 +686,38 @@ :class:`Formatter`\ s would be used with particular :class:`Handler`\ s. -.. function:: info(msg[, *args[, **kwargs]]) +.. function:: info(msg, *args, **kwargs) Logs a message with level :const:`INFO` on the root logger. The arguments are interpreted as for :func:`debug`. -.. function:: warning(msg[, *args[, **kwargs]]) +.. function:: warning(msg, *args, **kwargs) Logs a message with level :const:`WARNING` on the root logger. The arguments are interpreted as for :func:`debug`. -.. function:: error(msg[, *args[, **kwargs]]) +.. function:: error(msg, *args, **kwargs) Logs a message with level :const:`ERROR` on the root logger. The arguments are interpreted as for :func:`debug`. -.. function:: critical(msg[, *args[, **kwargs]]) +.. function:: critical(msg, *args, **kwargs) Logs a message with level :const:`CRITICAL` on the root logger. The arguments are interpreted as for :func:`debug`. -.. function:: exception(msg[, *args]) +.. function:: exception(msg, *args) Logs a message with level :const:`ERROR` on the root logger. The arguments are interpreted as for :func:`debug`. Exception info is added to the logging message. This function should only be called from an exception handler. -.. function:: log(level, msg[, *args[, **kwargs]]) +.. function:: log(level, msg, *args, **kwargs) Logs a message with level *level* on the root logger. The other arguments are interpreted as for :func:`debug`. @@ -759,7 +759,7 @@ it as a :class:`LogRecord` instance at the receiving end. -.. function:: basicConfig([**kwargs]) +.. function:: basicConfig(**kwargs) Does basic configuration for the logging system by creating a :class:`StreamHandler` with a default :class:`Formatter` and adding it to the @@ -876,7 +876,7 @@ :const:`NOTSET` is found, and that value is returned. -.. method:: Logger.debug(msg[, *args[, **kwargs]]) +.. method:: Logger.debug(msg, *args, **kwargs) Logs a message with level :const:`DEBUG` on this logger. The *msg* is the message format string, and the *args* are the arguments which are merged into @@ -924,37 +924,37 @@ :class:`Formatter`\ s would be used with particular :class:`Handler`\ s. -.. method:: Logger.info(msg[, *args[, **kwargs]]) +.. method:: Logger.info(msg, *args, **kwargs) Logs a message with level :const:`INFO` on this logger. The arguments are interpreted as for :meth:`debug`. -.. method:: Logger.warning(msg[, *args[, **kwargs]]) +.. method:: Logger.warning(msg, *args, **kwargs) Logs a message with level :const:`WARNING` on this logger. The arguments are interpreted as for :meth:`debug`. -.. method:: Logger.error(msg[, *args[, **kwargs]]) +.. method:: Logger.error(msg, *args, **kwargs) Logs a message with level :const:`ERROR` on this logger. The arguments are interpreted as for :meth:`debug`. -.. method:: Logger.critical(msg[, *args[, **kwargs]]) +.. method:: Logger.critical(msg, *args, **kwargs) Logs a message with level :const:`CRITICAL` on this logger. The arguments are interpreted as for :meth:`debug`. -.. method:: Logger.log(lvl, msg[, *args[, **kwargs]]) +.. method:: Logger.log(lvl, msg, *args, **kwargs) Logs a message with integer level *lvl* on this logger. The other arguments are interpreted as for :meth:`debug`. -.. method:: Logger.exception(msg[, *args]) +.. method:: Logger.exception(msg, *args) Logs a message with level :const:`ERROR` on this logger. The arguments are interpreted as for :meth:`debug`. Exception info is added to the logging @@ -1001,7 +1001,7 @@ Logger-level filtering is applied using :meth:`filter`. -.. method:: Logger.makeRecord(name, lvl, fn, lno, msg, args, exc_info [, func, extra]) +.. method:: Logger.makeRecord(name, lvl, fn, lno, msg, args, exc_info, func=None, extra=None) This is a factory method which can be overridden in subclasses to create specialized :class:`LogRecord` instances. @@ -1561,7 +1561,7 @@ and :meth:`flush` methods). -.. class:: StreamHandler([strm]) +.. class:: StreamHandler(strm=None) Returns a new instance of the :class:`StreamHandler` class. If *strm* is specified, the instance will use it for logging output; otherwise, *sys.stderr* @@ -1591,7 +1591,7 @@ :class:`StreamHandler`. -.. class:: FileHandler(filename[, mode[, encoding[, delay]]]) +.. class:: FileHandler(filename, mode='a', encoding=None, delay=0) Returns a new instance of the :class:`FileHandler` class. The specified file is opened and used as the stream for logging. If *mode* is not specified, @@ -1678,7 +1678,7 @@ module, supports rotation of disk log files. -.. class:: RotatingFileHandler(filename[, mode[, maxBytes[, backupCount[, encoding[, delay]]]]]) +.. class:: RotatingFileHandler(filename, mode='a', maxBytes=0, backupCount=0, encoding=None, delay=0) Returns a new instance of the :class:`RotatingFileHandler` class. The specified file is opened and used as the stream for logging. If *mode* is not specified, @@ -1719,7 +1719,7 @@ timed intervals. -.. class:: TimedRotatingFileHandler(filename [,when [,interval [,backupCount[, encoding[, delay[, utc]]]]]]) +.. class:: TimedRotatingFileHandler(filename, when='h', interval=1, backupCount=0, encoding=None, delay=0, utc=False) Returns a new instance of the :class:`TimedRotatingFileHandler` class. The specified file is opened and used as the stream for logging. On rotating it also @@ -1861,7 +1861,7 @@ supports sending logging messages to a remote or local Unix syslog. -.. class:: SysLogHandler([address[, facility]]) +.. class:: SysLogHandler(address=('localhost', SYSLOG_UDP_PORT), facility=LOG_USER) Returns a new instance of the :class:`SysLogHandler` class intended to communicate with a remote Unix machine whose address is given by *address* in @@ -1900,7 +1900,7 @@ extensions for Python installed. -.. class:: NTEventLogHandler(appname[, dllname[, logtype]]) +.. class:: NTEventLogHandler(appname, dllname=None, logtype='Application') Returns a new instance of the :class:`NTEventLogHandler` class. The *appname* is used to define the application name as it appears in the event log. An @@ -1964,7 +1964,7 @@ supports sending logging messages to an email address via SMTP. -.. class:: SMTPHandler(mailhost, fromaddr, toaddrs, subject[, credentials]) +.. class:: SMTPHandler(mailhost, fromaddr, toaddrs, subject, credentials=None) Returns a new instance of the :class:`SMTPHandler` class. The instance is initialized with the from and to addresses and subject line of the email. The @@ -2023,7 +2023,7 @@ overridden to implement custom flushing strategies. -.. class:: MemoryHandler(capacity[, flushLevel [, target]]) +.. class:: MemoryHandler(capacity, flushLevel=ERROR, target=None) Returns a new instance of the :class:`MemoryHandler` class. The instance is initialized with a buffer size of *capacity*. If *flushLevel* is not specified, @@ -2062,7 +2062,7 @@ ``POST`` semantics. -.. class:: HTTPHandler(host, url[, method]) +.. class:: HTTPHandler(host, url, method='GET') Returns a new instance of the :class:`HTTPHandler` class. The instance is initialized with a host address, url and HTTP method. The *host* can be of the @@ -2150,13 +2150,13 @@ +-------------------------+-----------------------------------------------+ -.. class:: Formatter([fmt[, datefmt]]) +.. class:: Formatter(fmt=None, datefmt=None) - Returns a new instance of the :class:`Formatter` class. The instance is - initialized with a format string for the message as a whole, as well as a format - string for the date/time portion of a message. If no *fmt* is specified, - ``'%(message)s'`` is used. If no *datefmt* is specified, the ISO8601 date format - is used. + Returns a new instance of the :class:`Formatter` class. The instance is + initialized with a format string for the message as a whole, as well as a + format string for the date/time portion of a message. If no *fmt* is + specified, ``'%(message)s'`` is used. If no *datefmt* is specified, the + ISO8601 date format is used. .. method:: format(record) @@ -2178,7 +2178,7 @@ recalculates it afresh. - .. method:: formatTime(record[, datefmt]) + .. method:: formatTime(record, datefmt=None) This method should be called from :meth:`format` by a formatter which wants to make use of a formatted time. This method can be overridden in @@ -2208,11 +2208,11 @@ initialized with the empty string, all events are passed. -.. class:: Filter([name]) +.. class:: Filter(name='') Returns an instance of the :class:`Filter` class. If *name* is specified, it names a logger which, together with its children, will have its events allowed - through the filter. If no name is specified, allows every event. + through the filter. If *name* is the empty string, allows every event. .. method:: filter(record) @@ -2233,7 +2233,7 @@ made, and any exception information to be logged. -.. class:: LogRecord(name, lvl, pathname, lineno, msg, args, exc_info [, func]) +.. class:: LogRecord(name, lvl, pathname, lineno, msg, args, exc_info, func=None) Returns an instance of :class:`LogRecord` initialized with interesting information. The *name* is the logger name; *lvl* is the numeric level; @@ -2311,7 +2311,7 @@ :mod:`logging` or :mod:`logging.handlers`. -.. function:: fileConfig(fname[, defaults]) +.. function:: fileConfig(fname, defaults=None, disable_existing_loggers=True) Reads the logging configuration from a :mod:`configparser`\-format file named *fname*. This function can be called several times from an application, @@ -2320,8 +2320,11 @@ and load the chosen configuration). Defaults to be passed to the ConfigParser can be specified in the *defaults* argument. + If *disable_existing_loggers* is true, any existing loggers that are not + children of named loggers will be disabled. + -.. function:: listen([port]) +.. function:: listen(port=DEFAULT_LOGGING_CONFIG_PORT) Starts up a socket server on the specified port, and listens for new configurations. If no port is specified, the module's default Modified: python/branches/py3k/Doc/library/macpath.rst ============================================================================== --- python/branches/py3k/Doc/library/macpath.rst (original) +++ python/branches/py3k/Doc/library/macpath.rst Mon Jun 8 11:13:45 2009 @@ -1,4 +1,3 @@ - :mod:`macpath` --- Mac OS 9 path manipulation functions ======================================================= Modified: python/branches/py3k/Doc/library/mailbox.rst ============================================================================== --- python/branches/py3k/Doc/library/mailbox.rst (original) +++ python/branches/py3k/Doc/library/mailbox.rst Mon Jun 8 11:13:45 2009 @@ -1,4 +1,3 @@ - :mod:`mailbox` --- Manipulate mailboxes in various formats ========================================================== @@ -27,7 +26,6 @@ :class:`Mailbox` objects ------------------------ - .. class:: Mailbox A mailbox, which may be inspected and modified. @@ -154,7 +152,7 @@ when the :class:`Mailbox` instance was initialized. - .. method:: get(key[, default=None]) + .. method:: get(key, default=None) __getitem__(key) Return a representation of the message corresponding to *key*. If no such @@ -209,11 +207,10 @@ Delete all messages from the mailbox. - .. method:: pop(key[, default]) + .. method:: pop(key, default=None) Return a representation of the message corresponding to *key* and delete - the message. If no such message exists, return *default* if it was - supplied or else raise a :exc:`KeyError` exception. The message is + the message. If no such message exists, return *default*. The message is represented as an instance of the appropriate format-specific :class:`Message` subclass unless a custom message factory was specified when the :class:`Mailbox` instance was initialized. @@ -277,7 +274,7 @@ ^^^^^^^^^^^^^^^^ -.. class:: Maildir(dirname[, factory=None[, create=True]]) +.. class:: Maildir(dirname, factory=None, create=True) A subclass of :class:`Mailbox` for mailboxes in Maildir format. Parameter *factory* is a callable object that accepts a file-like message representation @@ -419,7 +416,7 @@ ^^^^^^^^^^^^^ -.. class:: mbox(path[, factory=None[, create=True]]) +.. class:: mbox(path, factory=None, create=True) A subclass of :class:`Mailbox` for mailboxes in mbox format. Parameter *factory* is a callable object that accepts a file-like message representation (which @@ -479,7 +476,7 @@ ^^^^^^^^^^^ -.. class:: MH(path[, factory=None[, create=True]]) +.. class:: MH(path, factory=None, create=True) A subclass of :class:`Mailbox` for mailboxes in MH format. Parameter *factory* is a callable object that accepts a file-like message representation (which @@ -609,7 +606,7 @@ ^^^^^^^^^^^^^^ -.. class:: Babyl(path[, factory=None[, create=True]]) +.. class:: Babyl(path, factory=None, create=True) A subclass of :class:`Mailbox` for mailboxes in Babyl format. Parameter *factory* is a callable object that accepts a file-like message representation @@ -685,7 +682,7 @@ ^^^^^^^^^^^^^ -.. class:: MMDF(path[, factory=None[, create=True]]) +.. class:: MMDF(path, factory=None, create=True) A subclass of :class:`Mailbox` for mailboxes in MMDF format. Parameter *factory* is a callable object that accepts a file-like message representation (which @@ -737,7 +734,7 @@ ------------------------ -.. class:: Message([message]) +.. class:: Message(message=None) A subclass of the :mod:`email.Message` module's :class:`Message`. Subclasses of :class:`mailbox.Message` add mailbox-format-specific state and behavior. @@ -772,7 +769,7 @@ ^^^^^^^^^^^^^^^^^^^^^^^ -.. class:: MaildirMessage([message]) +.. class:: MaildirMessage(message=None) A message with Maildir-specific behaviors. Parameter *message* has the same meaning as with the :class:`Message` constructor. @@ -940,7 +937,7 @@ ^^^^^^^^^^^^^^^^^^^^ -.. class:: mboxMessage([message]) +.. class:: mboxMessage(message=None) A message with mbox-specific behaviors. Parameter *message* has the same meaning as with the :class:`Message` constructor. @@ -983,7 +980,7 @@ are excluded. - .. method:: set_from(from_[, time_=None]) + .. method:: set_from(from_, time_=None) Set the "From " line to *from_*, which should be specified without a leading "From " or trailing newline. For convenience, *time_* may be @@ -1094,7 +1091,7 @@ ^^^^^^^^^^^^^^^^^^ -.. class:: MHMessage([message]) +.. class:: MHMessage(message=None) A message with MH-specific behaviors. Parameter *message* has the same meaning as with the :class:`Message` constructor. @@ -1184,7 +1181,7 @@ ^^^^^^^^^^^^^^^^^^^^^ -.. class:: BabylMessage([message]) +.. class:: BabylMessage(message=None) A message with Babyl-specific behaviors. Parameter *message* has the same meaning as with the :class:`Message` constructor. @@ -1312,7 +1309,7 @@ ^^^^^^^^^^^^^^^^^^^^ -.. class:: MMDFMessage([message]) +.. class:: MMDFMessage(message=None) A message with MMDF-specific behaviors. Parameter *message* has the same meaning as with the :class:`Message` constructor. @@ -1354,7 +1351,7 @@ are excluded. - .. method:: set_from(from_[, time_=None]) + .. method:: set_from(from_, time_=None) Set the "From " line to *from_*, which should be specified without a leading "From " or trailing newline. For convenience, *time_* may be Modified: python/branches/py3k/Doc/library/mailcap.rst ============================================================================== --- python/branches/py3k/Doc/library/mailcap.rst (original) +++ python/branches/py3k/Doc/library/mailcap.rst Mon Jun 8 11:13:45 2009 @@ -5,7 +5,6 @@ :synopsis: Mailcap file handling. - Mailcap files are used to configure how MIME-aware applications such as mail readers and Web browsers react to files with different MIME types. (The name "mailcap" is derived from the phrase "mail capability".) For example, a mailcap @@ -20,7 +19,7 @@ standard. However, mailcap files are supported on most Unix systems. -.. function:: findmatch(caps, MIMEtype[, key[, filename[, plist]]]) +.. function:: findmatch(caps, MIMEtype, key='view', filename='/dev/null', plist=[]) Return a 2-tuple; the first element is a string containing the command line to be executed (which can be passed to :func:`os.system`), and the second element Modified: python/branches/py3k/Doc/library/markup.rst ============================================================================== --- python/branches/py3k/Doc/library/markup.rst (original) +++ python/branches/py3k/Doc/library/markup.rst Mon Jun 8 11:13:45 2009 @@ -1,4 +1,3 @@ - .. _markup: ********************************** Modified: python/branches/py3k/Doc/library/marshal.rst ============================================================================== --- python/branches/py3k/Doc/library/marshal.rst (original) +++ python/branches/py3k/Doc/library/marshal.rst Mon Jun 8 11:13:45 2009 @@ -1,4 +1,3 @@ - :mod:`marshal` --- Internal Python object serialization ======================================================= Modified: python/branches/py3k/Doc/library/math.rst ============================================================================== --- python/branches/py3k/Doc/library/math.rst (original) +++ python/branches/py3k/Doc/library/math.rst Mon Jun 8 11:13:45 2009 @@ -1,4 +1,3 @@ - :mod:`math` --- Mathematical functions ====================================== Modified: python/branches/py3k/Doc/library/mimetypes.rst ============================================================================== --- python/branches/py3k/Doc/library/mimetypes.rst (original) +++ python/branches/py3k/Doc/library/mimetypes.rst Mon Jun 8 11:13:45 2009 @@ -1,4 +1,3 @@ - :mod:`mimetypes` --- Map filenames to MIME types ================================================ @@ -23,7 +22,7 @@ the information :func:`init` sets up. -.. function:: guess_type(filename[, strict]) +.. function:: guess_type(url, strict=True) .. index:: pair: MIME; headers @@ -47,7 +46,7 @@ are also recognized. -.. function:: guess_all_extensions(type[, strict]) +.. function:: guess_all_extensions(type, strict=True) Guess the extensions for a file based on its MIME type, given by *type*. The return value is a list of strings giving all possible filename extensions, @@ -58,7 +57,7 @@ Optional *strict* has the same meaning as with the :func:`guess_type` function. -.. function:: guess_extension(type[, strict]) +.. function:: guess_extension(type, strict=True) Guess the extension for a file based on its MIME type, given by *type*. The return value is a string giving a filename extension, including the leading dot @@ -73,7 +72,7 @@ behavior of the module. -.. function:: init([files]) +.. function:: init(files=None) Initialize the internal data structures. If given, *files* must be a sequence of file names which should be used to augment the default type map. If omitted, @@ -90,7 +89,7 @@ does not exist or cannot be read, ``None`` is returned. -.. function:: add_type(type, ext[, strict]) +.. function:: add_type(type, ext, strict=True) Add a mapping from the mimetype *type* to the extension *ext*. When the extension is already known, the new type will replace the old one. When the type @@ -142,7 +141,7 @@ than one MIME-type database: -.. class:: MimeTypes([filenames]) +.. class:: MimeTypes(filenames=(), strict=True) This class represents a MIME-types database. By default, it provides access to the same database as the rest of this module. The initial database is a copy of @@ -206,13 +205,13 @@ module. -.. method:: MimeTypes.guess_extension(type[, strict]) +.. method:: MimeTypes.guess_extension(type, strict=True) Similar to the :func:`guess_extension` function, using the tables stored as part of the object. -.. method:: MimeTypes.guess_type(url[, strict]) +.. method:: MimeTypes.guess_type(url, strict=True) Similar to the :func:`guess_type` function, using the tables stored as part of the object. Modified: python/branches/py3k/Doc/library/misc.rst ============================================================================== --- python/branches/py3k/Doc/library/misc.rst (original) +++ python/branches/py3k/Doc/library/misc.rst Mon Jun 8 11:13:45 2009 @@ -1,4 +1,3 @@ - .. _misc: ********************** Modified: python/branches/py3k/Doc/library/mm.rst ============================================================================== --- python/branches/py3k/Doc/library/mm.rst (original) +++ python/branches/py3k/Doc/library/mm.rst Mon Jun 8 11:13:45 2009 @@ -1,4 +1,3 @@ - .. _mmedia: ******************* Modified: python/branches/py3k/Doc/library/mmap.rst ============================================================================== --- python/branches/py3k/Doc/library/mmap.rst (original) +++ python/branches/py3k/Doc/library/mmap.rst Mon Jun 8 11:13:45 2009 @@ -1,4 +1,3 @@ - :mod:`mmap` --- Memory-mapped file support ========================================== @@ -37,7 +36,7 @@ To map anonymous memory, -1 should be passed as the fileno along with the length. -.. class:: mmap(fileno, length[, tagname[, access[, offset]]]) +.. class:: mmap(fileno, length, tagname=None, access=ACCESS_DEFAULT[, offset]) **(Windows version)** Maps *length* bytes from the file specified by the file handle *fileno*, and creates a mmap object. If *length* is larger @@ -59,7 +58,7 @@ defaults to 0. *offset* must be a multiple of the ALLOCATIONGRANULARITY. -.. class:: mmap(fileno, length[, flags[, prot[, access[, offset]]]]) +.. class:: mmap(fileno, length, flags=MAP_SHARED, prot=PROT_WRITE|PROT_READ, access=ACCESS_DEFAULT[, offset]) :noindex: **(Unix version)** Maps *length* bytes from the file specified by the file @@ -148,7 +147,7 @@ Returns ``-1`` on failure. - .. method:: flush([offset, size]) + .. method:: flush([offset[, size]]) Flushes changes made to the in-memory copy of a file back to disk. Without use of this call there is no guarantee that changes are written back before Modified: python/branches/py3k/Doc/library/modulefinder.rst ============================================================================== --- python/branches/py3k/Doc/library/modulefinder.rst (original) +++ python/branches/py3k/Doc/library/modulefinder.rst Mon Jun 8 11:13:45 2009 @@ -1,4 +1,3 @@ - :mod:`modulefinder` --- Find modules used by a script ===================================================== @@ -27,7 +26,7 @@ package replaces the :mod:`xml` package. -.. class:: ModuleFinder([path=None, debug=0, excludes=[], replace_paths=[]]) +.. class:: ModuleFinder(path=None, debug=0, excludes=[], replace_paths=[]) This class provides :meth:`run_script` and :meth:`report` methods to determine the set of modules imported by a script. *path* can be a list of directories to Modified: python/branches/py3k/Doc/library/modules.rst ============================================================================== --- python/branches/py3k/Doc/library/modules.rst (original) +++ python/branches/py3k/Doc/library/modules.rst Mon Jun 8 11:13:45 2009 @@ -1,4 +1,3 @@ - .. _modules: ***************** Modified: python/branches/py3k/Doc/library/msilib.rst ============================================================================== --- python/branches/py3k/Doc/library/msilib.rst (original) +++ python/branches/py3k/Doc/library/msilib.rst Mon Jun 8 11:13:45 2009 @@ -363,7 +363,7 @@ the default flags that new components get. - .. method:: start_component([component[, feature[, flags[, keyfile[, uuid]]]]]) + .. method:: start_component(component=None, feature=None, flags=None, keyfile=None, uuid=None) Add an entry to the Component table, and make this component the current component for this directory. If no component name is given, the directory @@ -372,7 +372,7 @@ is given, the KeyPath is left null in the Component table. - .. method:: add_file(file[, src[, version[, language]]]) + .. method:: add_file(file, src=None, version=None, language=None) Add a file to the current component of the directory, starting a new one if there is no current component. By default, the file name in the source @@ -381,7 +381,7 @@ and a *language* can be specified for the entry in the File table. - .. method:: glob(pattern[, exclude]) + .. method:: glob(pattern, exclude=None) Add a list of files to the current component as specified in the glob pattern. Individual files can be excluded in the *exclude* list. @@ -405,7 +405,7 @@ -------- -.. class:: Feature(database, id, title, desc, display[, level=1[, parent[, directory[, attributes=0]]]]) +.. class:: Feature(db, id, title, desc, display, level=1, parent=None, directory=None, attributes=0) Add a new record to the ``Feature`` table, using the values *id*, *parent.id*, *title*, *desc*, *display*, *level*, *directory*, and *attributes*. The @@ -440,7 +440,7 @@ belongs to, and *name* is the control's name. - .. method:: event(event, argument[, condition=1[, ordering]]) + .. method:: event(event, argument, condition=1, ordering=None) Make an entry into the ``ControlEvent`` table for this control. @@ -461,10 +461,10 @@ that gets set when a radio button is selected. - .. method:: add(name, x, y, width, height, text [, value]) + .. method:: add(name, x, y, width, height, text, value=None) Add a radio button named *name* to the group, at the coordinates *x*, *y*, - *width*, *height*, and with the label *text*. If *value* is omitted, it + *width*, *height*, and with the label *text*. If *value* is ``None``, it defaults to *name*. Modified: python/branches/py3k/Doc/library/msvcrt.rst ============================================================================== --- python/branches/py3k/Doc/library/msvcrt.rst (original) +++ python/branches/py3k/Doc/library/msvcrt.rst Mon Jun 8 11:13:45 2009 @@ -1,4 +1,3 @@ - :mod:`msvcrt` -- Useful routines from the MS VC++ runtime ========================================================= From buildbot at python.org Mon Jun 8 11:50:50 2009 From: buildbot at python.org (buildbot at python.org) Date: Mon, 08 Jun 2009 09:50:50 +0000 Subject: [Python-checkins] buildbot failure in sparc solaris10 gcc 3.x Message-ID: <20090608095050.C809EDAE4@mail.python.org> The Buildbot has detected a new failure of sparc solaris10 gcc 3.x. Full details are available at: http://www.python.org/dev/buildbot/all/sparc%20solaris10%20gcc%203.x/builds/801 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: loewis-sun Build Reason: Build Source Stamp: [branch branches/py3k] HEAD Blamelist: georg.brandl BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_posix ====================================================================== ERROR: test_getcwd_long_pathnames (test.test_posix.PosixTester) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home2/buildbot/slave/3.x.loewis-sun/build/Lib/test/test_posix.py", line 251, in test_getcwd_long_pathnames support.rmtree(base_path) File "/home2/buildbot/slave/3.x.loewis-sun/build/Lib/test/support.py", line 181, in rmtree shutil.rmtree(path) File "/home2/buildbot/slave/3.x.loewis-sun/build/Lib/shutil.py", line 239, in rmtree onerror(os.rmdir, path, sys.exc_info()) File "/home2/buildbot/slave/3.x.loewis-sun/build/Lib/shutil.py", line 237, in rmtree os.rmdir(path) OSError: [Errno 22] Invalid argument: '/home2/buildbot/slave/3.x.loewis-sun/build/@test.getcwd/@test.getcwd' sincerely, -The Buildbot From python-checkins at python.org Mon Jun 8 11:54:02 2009 From: python-checkins at python.org (tarek.ziade) Date: Mon, 8 Jun 2009 11:54:02 +0200 (CEST) Subject: [Python-checkins] r73292 - peps/trunk/pep-0376.txt Message-ID: <20090608095402.D175DDAFC@mail.python.org> Author: tarek.ziade Date: Mon Jun 8 11:54:02 2009 New Revision: 73292 Log: fixes from Ronald feedbacks Modified: peps/trunk/pep-0376.txt Modified: peps/trunk/pep-0376.txt ============================================================================== --- peps/trunk/pep-0376.txt (original) +++ peps/trunk/pep-0376.txt Mon Jun 8 11:54:02 2009 @@ -24,8 +24,8 @@ Definitions =========== -A **project** is a Python application composed of one or several files, which can -be Python modules, extensions or data. It is distributed using a `setup.py` script +A **project** is a distribution of one or several files, which can be Python +modules, extensions or data. It is distributed using a `setup.py` script with Distutils and/or Setuptools. The `setup.py` script indicates where each elements should be installed. @@ -112,8 +112,8 @@ To address those issues, this PEP proposes a few changes: -- a new `.egg-info` structure using a directory, based on the `EggFormats` - standard from `setuptools` [#eggformats]_. +- a new `.egg-info` structure using a directory, based on one form of + the `EggFormats` standard from `setuptools` [#eggformats]_. - new APIs in `pkgutil` to be able to query the information of installed projects. - a de-facto replacement for PEP 262 @@ -128,7 +128,14 @@ the `Distribution` class in Distutils. Notice that this change is based on the standard proposed by `EggFormats`. -You may refer to its documentation for more information. +Although, this standard proposes two ways to install files : + +- a self-contained directory that can be zipped or left unzipped and that + contains the project files *and* the `.egg-info` directory. + +- a distinct `.egg-info` directory located in the site-packages directory. + +You may refer to the `EggFormats` documentation for more details. This change will not impact Python itself, because `egg-info` files are not used anywhere yet in the standard library besides Distutils. @@ -187,8 +194,15 @@ The RECORD format ----------------- -The `RECORD` file is a CSV-like file, composed of records, one line per -installed file. Each record is composed of three elements. +The `RECORD` file is a CSV file, composed of records, one line per +installed file. The ``csv`` module is used to read the file, with +the `excel` dialect, which uses these options to read the file: + +- field delimiter : `,` +- quoting char : `"`. +- line terminator : `\r\n` + +Each record is composed of three elements. - the file's full **path** @@ -289,11 +303,29 @@ Returns ``True`` if ``path`` is listed in `RECORD`. ``path`` can be a local absolute path or a relative '/'-separated path. -- ``get_file(path, binary=False)`` -> file object +- ``get_egg_info(path, binary=False)`` -> file object + + Returns a file located under the `.egg-info` directory. + + Returns a ``file`` instance for the file pointed by ``path``. + + ``path`` has to be a '/'-separated path relative to the `.egg-info` + directory or an absolute path. + + If ``path`` is an absolute path and doesn't start with the `.egg-info` + directory path, a ``DistutilsError`` is raised. + + If ``binary`` is ``True``, opens the file in binary mode. + +- ``get_egg_info_files(local=False)`` -> iterator of paths + + Iterates over the `RECORD` entries and return paths for each line if the path + is pointing a file located in the `.egg-info` directory or one of its + subdirectory. + + If ``local`` is ``True``, each path is transformed into a + local absolute path. Otherwise the raw value from `RECORD` is returned. - Returns a ``file`` instance for the file pointed by ``path``. ``path`` can be - a local absolute path or a relative '/'-separated path. If ``binary`` is - ``True``, opens the file in binary mode. EggInfoDirectory class ---------------------- From python-checkins at python.org Mon Jun 8 15:27:23 2009 From: python-checkins at python.org (georg.brandl) Date: Mon, 8 Jun 2009 15:27:23 +0200 (CEST) Subject: [Python-checkins] r73293 - python/branches/py3k/Doc/library/ctypes.rst Message-ID: <20090608132723.9FEE6D385@mail.python.org> Author: georg.brandl Date: Mon Jun 8 15:27:23 2009 New Revision: 73293 Log: Review ctypes docs w.r.t. bytes/unicode. Use bytes where appropriate as the type for C strings. Lots of small markup fixes. Also fixes #4309. Modified: python/branches/py3k/Doc/library/ctypes.rst Modified: python/branches/py3k/Doc/library/ctypes.rst ============================================================================== --- python/branches/py3k/Doc/library/ctypes.rst (original) +++ python/branches/py3k/Doc/library/ctypes.rst Mon Jun 8 15:27:23 2009 @@ -16,7 +16,7 @@ ctypes tutorial --------------- -Note: The code samples in this tutorial use ``doctest`` to make sure that they +Note: The code samples in this tutorial use :mod:`doctest` to make sure that they actually work. Since some code samples behave differently under Linux, Windows, or Mac OS X, they contain doctest directives in comments. @@ -31,7 +31,7 @@ Loading dynamic link libraries ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -``ctypes`` exports the *cdll*, and on Windows *windll* and *oledll* +:mod:`ctypes` exports the *cdll*, and on Windows *windll* and *oledll* objects, for loading dynamic link libraries. You load libraries by accessing them as attributes of these objects. *cdll* @@ -106,8 +106,7 @@ *windll* does not try to select one of them by magic, you must access the version you need by specifying ``GetModuleHandleA`` or ``GetModuleHandleW`` -explicitly, and then call it with strings or unicode strings -respectively. +explicitly, and then call it with bytes or string objects respectively. Sometimes, dlls export functions with names which aren't valid Python identifiers, like ``"??2 at YAPAXI@Z"``. In this case you have to use ``getattr`` @@ -150,7 +149,7 @@ 0x1d000000 >>> -``ctypes`` tries to protect you from calling functions with the wrong number of +:mod:`ctypes` tries to protect you from calling functions with the wrong number of arguments or the wrong calling convention. Unfortunately this only works on Windows. It does this by examining the stack after the function returns, so although an error is raised the function *has* been called:: @@ -174,7 +173,7 @@ ValueError: Procedure probably called with not enough arguments (4 bytes missing) >>> - >>> windll.msvcrt.printf("spam") # doctest: +WINDOWS + >>> windll.msvcrt.printf(b"spam") # doctest: +WINDOWS Traceback (most recent call last): File "", line 1, in ? ValueError: Procedure probably called with too many arguments (4 bytes in excess) @@ -183,7 +182,7 @@ To find out the correct calling convention you have to look into the C header file or the documentation for the function you want to call. -On Windows, ``ctypes`` uses win32 structured exception handling to prevent +On Windows, :mod:`ctypes` uses win32 structured exception handling to prevent crashes from general protection faults when functions are called with invalid argument values:: @@ -193,18 +192,18 @@ WindowsError: exception: access violation reading 0x00000020 >>> -There are, however, enough ways to crash Python with ``ctypes``, so you should +There are, however, enough ways to crash Python with :mod:`ctypes`, so you should be careful anyway. -``None``, integers, byte strings and unicode strings are the only native +``None``, integers, bytes objects and (unicode) strings are the only native Python objects that can directly be used as parameters in these function calls. -``None`` is passed as a C ``NULL`` pointer, byte strings and unicode strings are +``None`` is passed as a C ``NULL`` pointer, bytes objects and strings are passed as pointer to the memory block that contains their data (``char *`` or ``wchar_t *``). Python integers are passed as the platforms default C ``int`` type, their value is masked to fit into the C type. Before we move on calling functions with other parameter types, we have to learn -more about ``ctypes`` data types. +more about :mod:`ctypes` data types. .. _ctypes-fundamental-data-types: @@ -212,14 +211,14 @@ Fundamental data types ^^^^^^^^^^^^^^^^^^^^^^ -``ctypes`` defines a number of primitive C compatible data types : +:mod:`ctypes` defines a number of primitive C compatible data types : +----------------------+--------------------------------+----------------------------+ | ctypes type | C type | Python type | +======================+================================+============================+ - | :class:`c_char` | ``char`` | 1-character string | + | :class:`c_char` | ``char`` | 1-character bytes object | +----------------------+--------------------------------+----------------------------+ - | :class:`c_wchar` | ``wchar_t`` | 1-character unicode string | + | :class:`c_wchar` | ``wchar_t`` | 1-character string | +----------------------+--------------------------------+----------------------------+ | :class:`c_byte` | ``char`` | int | +----------------------+--------------------------------+----------------------------+ @@ -248,9 +247,9 @@ +----------------------+--------------------------------+----------------------------+ | :class:`c_longdouble`| ``long double`` | float | +----------------------+--------------------------------+----------------------------+ - | :class:`c_char_p` | ``char *`` (NUL terminated) | string or ``None`` | + | :class:`c_char_p` | ``char *`` (NUL terminated) | bytes objcet or ``None`` | +----------------------+--------------------------------+----------------------------+ - | :class:`c_wchar_p` | ``wchar_t *`` (NUL terminated) | unicode or ``None`` | + | :class:`c_wchar_p` | ``wchar_t *`` (NUL terminated) | string or ``None`` | +----------------------+--------------------------------+----------------------------+ | :class:`c_void_p` | ``void *`` | int or ``None`` | +----------------------+--------------------------------+----------------------------+ @@ -261,8 +260,8 @@ >>> c_int() c_long(0) - >>> c_char_p("Hello, World") - c_char_p('Hello, World') + >>> c_wchar_p("Hello, World") + c_wchar_p('Hello, World') >>> c_ushort(-3) c_ushort(65533) >>> @@ -282,47 +281,48 @@ Assigning a new value to instances of the pointer types :class:`c_char_p`, :class:`c_wchar_p`, and :class:`c_void_p` changes the *memory location* they point to, *not the contents* of the memory block (of course not, because Python -strings are immutable):: +bytes objects are immutable):: >>> s = "Hello, World" - >>> c_s = c_char_p(s) + >>> c_s = c_wchar_p(s) >>> print(c_s) - c_char_p('Hello, World') + c_wchar_p('Hello, World') >>> c_s.value = "Hi, there" >>> print(c_s) - c_char_p('Hi, there') - >>> print(s) # first string is unchanged + c_wchar_p('Hi, there') + >>> print(s) # first object is unchanged Hello, World >>> You should be careful, however, not to pass them to functions expecting pointers to mutable memory. If you need mutable memory blocks, ctypes has a -``create_string_buffer`` function which creates these in various ways. The +:func:`create_string_buffer` function which creates these in various ways. The current memory block contents can be accessed (or changed) with the ``raw`` property; if you want to access it as NUL terminated string, use the ``value`` property:: >>> from ctypes import * - >>> p = create_string_buffer(3) # create a 3 byte buffer, initialized to NUL bytes + >>> p = create_string_buffer(3) # create a 3 byte buffer, initialized to NUL bytes >>> print(sizeof(p), repr(p.raw)) - 3 '\x00\x00\x00' - >>> p = create_string_buffer("Hello") # create a buffer containing a NUL terminated string + 3 b'\x00\x00\x00' + >>> p = create_string_buffer(b"Hello") # create a buffer containing a NUL terminated string >>> print(sizeof(p), repr(p.raw)) - 6 'Hello\x00' + 6 b'Hello\x00' >>> print(repr(p.value)) - 'Hello' - >>> p = create_string_buffer("Hello", 10) # create a 10 byte buffer + b'Hello' + >>> p = create_string_buffer(b"Hello", 10) # create a 10 byte buffer >>> print(sizeof(p), repr(p.raw)) - 10 'Hello\x00\x00\x00\x00\x00' - >>> p.value = "Hi" + 10 b'Hello\x00\x00\x00\x00\x00' + >>> p.value = b"Hi" >>> print(sizeof(p), repr(p.raw)) - 10 'Hi\x00lo\x00\x00\x00\x00\x00' + 10 b'Hi\x00lo\x00\x00\x00\x00\x00' >>> -The ``create_string_buffer`` function replaces the ``c_buffer`` function (which -is still available as an alias), as well as the ``c_string`` function from -earlier ctypes releases. To create a mutable memory block containing unicode -characters of the C type ``wchar_t`` use the ``create_unicode_buffer`` function. +The :func:`create_string_buffer` function replaces the ``c_buffer`` function +(which is still available as an alias), as well as the ``c_string`` function +from earlier ctypes releases. To create a mutable memory block containing +unicode characters of the C type ``wchar_t`` use the +:func:`create_unicode_buffer` function. .. _ctypes-calling-functions-continued: @@ -331,30 +331,30 @@ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Note that printf prints to the real standard output channel, *not* to -``sys.stdout``, so these examples will only work at the console prompt, not from -within *IDLE* or *PythonWin*:: +:data:`sys.stdout`, so these examples will only work at the console prompt, not +from within *IDLE* or *PythonWin*:: >>> printf = libc.printf - >>> printf("Hello, %s\n", "World!") + >>> printf(b"Hello, %s\n", b"World!") Hello, World! 14 - >>> printf("Hello, %S\n", u"World!") + >>> printf(b"Hello, %S\n", "World!") Hello, World! 14 - >>> printf("%d bottles of beer\n", 42) + >>> printf(b"%d bottles of beer\n", 42) 42 bottles of beer 19 - >>> printf("%f bottles of beer\n", 42.5) + >>> printf(b"%f bottles of beer\n", 42.5) Traceback (most recent call last): File "", line 1, in ? ArgumentError: argument 2: exceptions.TypeError: Don't know how to convert parameter 2 >>> As has been mentioned before, all Python types except integers, strings, and -unicode strings have to be wrapped in their corresponding ``ctypes`` type, so +bytes objects have to be wrapped in their corresponding :mod:`ctypes` type, so that they can be converted to the required C data type:: - >>> printf("An int %d, a double %f\n", 1234, c_double(3.14)) + >>> printf(b"An int %d, a double %f\n", 1234, c_double(3.14)) An int 1234, a double 3.140000 31 >>> @@ -365,24 +365,24 @@ Calling functions with your own custom data types ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -You can also customize ``ctypes`` argument conversion to allow instances of your -own classes be used as function arguments. ``ctypes`` looks for an +You can also customize :mod:`ctypes` argument conversion to allow instances of your +own classes be used as function arguments. :mod:`ctypes` looks for an :attr:`_as_parameter_` attribute and uses this as the function argument. Of -course, it must be one of integer, string, or unicode:: +course, it must be one of integer, string, or bytes:: >>> class Bottles(object): ... def __init__(self, number): ... self._as_parameter_ = number ... >>> bottles = Bottles(42) - >>> printf("%d bottles of beer\n", bottles) + >>> printf(b"%d bottles of beer\n", bottles) 42 bottles of beer 19 >>> If you don't want to store the instance's data in the :attr:`_as_parameter_` -instance variable, you could define a ``property`` which makes the data -available. +instance variable, you could define a :class:`property` which makes the +attribute available on request. .. _ctypes-specifying-required-argument-types: @@ -399,7 +399,7 @@ this is quite handy to experiment with this feature):: >>> printf.argtypes = [c_char_p, c_char_p, c_int, c_double] - >>> printf("String '%s', Int %d, Double %f\n", "Hi", 10, 2.2) + >>> printf(b"String '%s', Int %d, Double %f\n", b"Hi", 10, 2.2) String 'Hi', Int 10, Double 2.200000 37 >>> @@ -407,11 +407,11 @@ Specifying a format protects against incompatible argument types (just as a prototype for a C function), and tries to convert the arguments to valid types:: - >>> printf("%d %d %d", 1, 2, 3) + >>> printf(b"%d %d %d", 1, 2, 3) Traceback (most recent call last): File "", line 1, in ? ArgumentError: argument 2: exceptions.TypeError: wrong type - >>> printf("%s %d %f\n", "X", 2, 3) + >>> printf(b"%s %d %f\n", b"X", 2, 3) X 2 3.000000 13 >>> @@ -423,7 +423,7 @@ whatever is needed to make sure this object is acceptable, and then return the object itself, its :attr:`_as_parameter_` attribute, or whatever you want to pass as the C function argument in this case. Again, the result should be an -integer, string, unicode, a ``ctypes`` instance, or an object with an +integer, string, bytes, a :mod:`ctypes` instance, or an object with an :attr:`_as_parameter_` attribute. @@ -440,30 +440,30 @@ a string pointer and a char, and returns a pointer to a string:: >>> strchr = libc.strchr - >>> strchr("abcdef", ord("d")) # doctest: +SKIP + >>> strchr(b"abcdef", ord("d")) # doctest: +SKIP 8059983 - >>> strchr.restype = c_char_p # c_char_p is a pointer to a string - >>> strchr("abcdef", ord("d")) - 'def' - >>> print(strchr("abcdef", ord("x"))) + >>> strchr.restype = c_char_p # c_char_p is a pointer to a string + >>> strchr(b"abcdef", ord("d")) + b'def' + >>> print(strchr(b"abcdef", ord("x"))) None >>> If you want to avoid the ``ord("x")`` calls above, you can set the :attr:`argtypes` attribute, and the second argument will be converted from a -single character Python string into a C char:: +single character Python bytes object into a C char:: >>> strchr.restype = c_char_p >>> strchr.argtypes = [c_char_p, c_char] - >>> strchr("abcdef", "d") + >>> strchr(b"abcdef", b"d") 'def' - >>> strchr("abcdef", "def") + >>> strchr(b"abcdef", b"def") Traceback (most recent call last): File "", line 1, in ? ArgumentError: argument 2: exceptions.TypeError: one character string expected - >>> print(strchr("abcdef", "x")) + >>> print(strchr(b"abcdef", b"x")) None - >>> strchr("abcdef", "d") + >>> strchr(b"abcdef", b"d") 'def' >>> @@ -508,22 +508,22 @@ probably to write into the corresponding location, or if the data is too large to be passed by value. This is also known as *passing parameters by reference*. -``ctypes`` exports the :func:`byref` function which is used to pass parameters -by reference. The same effect can be achieved with the ``pointer`` function, -although ``pointer`` does a lot more work since it constructs a real pointer +:mod:`ctypes` exports the :func:`byref` function which is used to pass parameters +by reference. The same effect can be achieved with the :func:`pointer` function, +although :func:`pointer` does a lot more work since it constructs a real pointer object, so it is faster to use :func:`byref` if you don't need the pointer object in Python itself:: >>> i = c_int() >>> f = c_float() - >>> s = create_string_buffer('\000' * 32) + >>> s = create_string_buffer(b'\000' * 32) >>> print(i.value, f.value, repr(s.value)) - 0 0.0 '' - >>> libc.sscanf("1 3.14 Hello", "%d %f %s", + 0 0.0 b'' + >>> libc.sscanf(b"1 3.14 Hello", b"%d %f %s", ... byref(i), byref(f), s) 3 >>> print(i.value, f.value, repr(s.value)) - 1 3.1400001049 'Hello' + 1 3.1400001049 b'Hello' >>> @@ -533,16 +533,15 @@ ^^^^^^^^^^^^^^^^^^^^^ Structures and unions must derive from the :class:`Structure` and :class:`Union` -base classes which are defined in the ``ctypes`` module. Each subclass must +base classes which are defined in the :mod:`ctypes` module. Each subclass must define a :attr:`_fields_` attribute. :attr:`_fields_` must be a list of *2-tuples*, containing a *field name* and a *field type*. -The field type must be a ``ctypes`` type like :class:`c_int`, or any other -derived ``ctypes`` type: structure, union, array, pointer. +The field type must be a :mod:`ctypes` type like :class:`c_int`, or any other +derived :mod:`ctypes` type: structure, union, array, pointer. Here is a simple example of a POINT structure, which contains two integers named -``x`` and ``y``, and also shows how to initialize a structure in the -constructor:: +*x* and *y*, and also shows how to initialize a structure in the constructor:: >>> from ctypes import * >>> class POINT(Structure): @@ -604,7 +603,7 @@ positive integer and specifies the maximum alignment for the fields. This is what ``#pragma pack(n)`` also does in MSVC. -``ctypes`` uses the native byte order for Structures and Unions. To build +:mod:`ctypes` uses the native byte order for Structures and Unions. To build structures with non-native byte order, you can use one of the BigEndianStructure, LittleEndianStructure, BigEndianUnion, and LittleEndianUnion base classes. These classes cannot contain pointer fields. @@ -685,8 +684,8 @@ Pointers ^^^^^^^^ -Pointer instances are created by calling the ``pointer`` function on a -``ctypes`` type:: +Pointer instances are created by calling the :func:`pointer` function on a +:mod:`ctypes` type:: >>> from ctypes import * >>> i = c_int(42) @@ -700,7 +699,7 @@ c_long(42) >>> -Note that ``ctypes`` does not have OOR (original object return), it constructs a +Note that :mod:`ctypes` does not have OOR (original object return), it constructs a new, equivalent object each time you retrieve an attribute:: >>> pi.contents is i @@ -741,10 +740,10 @@ and you *know* that the pointer actually points to an array instead of a single item. -Behind the scenes, the ``pointer`` function does more than simply create pointer -instances, it has to create pointer *types* first. This is done with the -``POINTER`` function, which accepts any ``ctypes`` type, and returns a new -type:: +Behind the scenes, the :func:`pointer` function does more than simply create +pointer instances, it has to create pointer *types* first. This is done with the +:func:`POINTER` function, which accepts any :mod:`ctypes` type, and returns a +new type:: >>> PI = POINTER(c_int) >>> PI @@ -765,7 +764,7 @@ False >>> -``ctypes`` checks for ``NULL`` when dereferencing pointers (but dereferencing +:mod:`ctypes` checks for ``NULL`` when dereferencing pointers (but dereferencing invalid non-\ ``NULL`` pointers would crash Python):: >>> null_ptr[0] @@ -814,8 +813,8 @@ .. XXX list other conversions... -Sometimes you have instances of incompatible types. In C, you can cast one -type into another type. ``ctypes`` provides a ``cast`` function which can be +Sometimes you have instances of incompatible types. In C, you can cast one type +into another type. :mod:`ctypes` provides a :func:`cast` function which can be used in the same way. The ``Bar`` structure defined above accepts ``POINTER(c_int)`` pointers or :class:`c_int` arrays for its ``values`` field, but not instances of other types:: @@ -826,20 +825,20 @@ TypeError: incompatible types, c_byte_Array_4 instance instead of LP_c_long instance >>> -For these cases, the ``cast`` function is handy. +For these cases, the :func:`cast` function is handy. -The ``cast`` function can be used to cast a ctypes instance into a pointer to a -different ctypes data type. ``cast`` takes two parameters, a ctypes object that -is or can be converted to a pointer of some kind, and a ctypes pointer type. It -returns an instance of the second argument, which references the same memory -block as the first argument:: +The :func:`cast` function can be used to cast a ctypes instance into a pointer +to a different ctypes data type. :func:`cast` takes two parameters, a ctypes +object that is or can be converted to a pointer of some kind, and a ctypes +pointer type. It returns an instance of the second argument, which references +the same memory block as the first argument:: >>> a = (c_byte * 4)() >>> cast(a, POINTER(c_int)) >>> -So, ``cast`` can be used to assign to the ``values`` field of ``Bar`` the +So, :func:`cast` can be used to assign to the ``values`` field of ``Bar`` the structure:: >>> bar = Bar() @@ -879,7 +878,7 @@ >>> because the new ``class cell`` is not available in the class statement itself. -In ``ctypes``, we can define the ``cell`` class and set the :attr:`_fields_` +In :mod:`ctypes`, we can define the ``cell`` class and set the :attr:`_fields_` attribute later, after the class statement:: >>> from ctypes import * @@ -913,7 +912,7 @@ Callback functions ^^^^^^^^^^^^^^^^^^ -``ctypes`` allows to create C callable function pointers from Python callables. +:mod:`ctypes` allows to create C callable function pointers from Python callables. These are sometimes called *callback functions*. First, you must create a class for the callback function, the class knows the @@ -929,9 +928,9 @@ argument, and the callback functions expected argument types as the remaining arguments. -I will present an example here which uses the standard C library's :func:`qsort` -function, this is used to sort items with the help of a callback function. -:func:`qsort` will be used to sort an array of integers:: +I will present an example here which uses the standard C library's +:cfunc:`qsort` function, this is used to sort items with the help of a callback +function. :cfunc:`qsort` will be used to sort an array of integers:: >>> IntArray5 = c_int * 5 >>> ia = IntArray5(5, 1, 7, 33, 99) @@ -1062,7 +1061,7 @@ **Important note for callback functions:** Make sure you keep references to CFUNCTYPE objects as long as they are used from -C code. ``ctypes`` doesn't, and if you don't, they may be garbage collected, +C code. :mod:`ctypes` doesn't, and if you don't, they may be garbage collected, crashing your program when a callback is made. @@ -1072,11 +1071,11 @@ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Some shared libraries not only export functions, they also export variables. An -example in the Python library itself is the ``Py_OptimizeFlag``, an integer set -to 0, 1, or 2, depending on the :option:`-O` or :option:`-OO` flag given on +example in the Python library itself is the :cdata:`Py_OptimizeFlag`, an integer +set to 0, 1, or 2, depending on the :option:`-O` or :option:`-OO` flag given on startup. -``ctypes`` can access values like this with the :meth:`in_dll` class methods of +:mod:`ctypes` can access values like this with the :meth:`in_dll` class methods of the type. *pythonapi* is a predefined symbol giving access to the Python C api:: @@ -1090,16 +1089,17 @@ specified. An extended example which also demonstrates the use of pointers accesses the -``PyImport_FrozenModules`` pointer exported by Python. +:cdata:`PyImport_FrozenModules` pointer exported by Python. + +Quoting the docs for that value: -Quoting the Python docs: *This pointer is initialized to point to an array of -"struct _frozen" records, terminated by one whose members are all NULL or zero. -When a frozen module is imported, it is searched in this table. Third-party code -could play tricks with this to provide a dynamically created collection of -frozen modules.* + This pointer is initialized to point to an array of :ctype:`struct _frozen` + records, terminated by one whose members are all *NULL* or zero. When a frozen + module is imported, it is searched in this table. Third-party code could play + tricks with this to provide a dynamically created collection of frozen modules. So manipulating this pointer could even prove useful. To restrict the example -size, we show only how this table can be read with ``ctypes``:: +size, we show only how this table can be read with :mod:`ctypes`:: >>> from ctypes import * >>> @@ -1110,8 +1110,8 @@ ... >>> -We have defined the ``struct _frozen`` data type, so we can get the pointer to -the table:: +We have defined the :ctype:`struct _frozen` data type, so we can get the pointer +to the table:: >>> FrozenTable = POINTER(struct_frozen) >>> table = FrozenTable.in_dll(pythonapi, "PyImport_FrozenModules") @@ -1144,7 +1144,7 @@ Surprises ^^^^^^^^^ -There are some edges in ``ctypes`` where you may be expect something else than +There are some edges in :mod:`ctypes` where you may be expect something else than what actually happens. Consider the following example:: @@ -1207,13 +1207,13 @@ Variable-sized data types ^^^^^^^^^^^^^^^^^^^^^^^^^ -``ctypes`` provides some support for variable-sized arrays and structures. +:mod:`ctypes` provides some support for variable-sized arrays and structures. -The ``resize`` function can be used to resize the memory buffer of an existing -ctypes object. The function takes the object as first argument, and the -requested size in bytes as the second argument. The memory block cannot be made -smaller than the natural memory block specified by the objects type, a -``ValueError`` is raised if this is tried:: +The :func:`resize` function can be used to resize the memory buffer of an +existing ctypes object. The function takes the object as first argument, and +the requested size in bytes as the second argument. The memory block cannot be +made smaller than the natural memory block specified by the objects type, a +:exc:`ValueError` is raised if this is tried:: >>> short_array = (c_short * 4)() >>> print(sizeof(short_array)) @@ -1241,7 +1241,7 @@ IndexError: invalid index >>> -Another way to use variable-sized data types with ``ctypes`` is to use the +Another way to use variable-sized data types with :mod:`ctypes` is to use the dynamic nature of Python, and (re-)define the data type after the required size is already known, on a case by case basis. @@ -1260,13 +1260,13 @@ When programming in a compiled language, shared libraries are accessed when compiling/linking a program, and when the program is run. -The purpose of the ``find_library`` function is to locate a library in a way +The purpose of the :func:`find_library` function is to locate a library in a way similar to what the compiler does (on platforms with several versions of a shared library the most recent should be loaded), while the ctypes library loaders act like when a program is run, and call the runtime loader directly. -The ``ctypes.util`` module provides a function which can help to determine the -library to load. +The :mod:`ctypes.util` module provides a function which can help to determine +the library to load. .. data:: find_library(name) @@ -1280,9 +1280,9 @@ The exact functionality is system dependent. -On Linux, ``find_library`` tries to run external programs (/sbin/ldconfig, gcc, -and objdump) to find the library file. It returns the filename of the library -file. Here are some examples:: +On Linux, :func:`find_library` tries to run external programs (/sbin/ldconfig, +gcc, and objdump) to find the library file. It returns the filename of the +library file. Here are some examples:: >>> from ctypes.util import find_library >>> find_library("m") @@ -1293,8 +1293,8 @@ 'libbz2.so.1.0' >>> -On OS X, ``find_library`` tries several predefined naming schemes and paths to -locate the library, and returns a full pathname if successful:: +On OS X, :func:`find_library` tries several predefined naming schemes and paths +to locate the library, and returns a full pathname if successful:: >>> from ctypes.util import find_library >>> find_library("c") @@ -1307,13 +1307,13 @@ '/System/Library/Frameworks/AGL.framework/AGL' >>> -On Windows, ``find_library`` searches along the system search path, and returns -the full pathname, but since there is no predefined naming scheme a call like -``find_library("c")`` will fail and return ``None``. +On Windows, :func:`find_library` searches along the system search path, and +returns the full pathname, but since there is no predefined naming scheme a call +like ``find_library("c")`` will fail and return ``None``. -If wrapping a shared library with ``ctypes``, it *may* be better to determine +If wrapping a shared library with :mod:`ctypes`, it *may* be better to determine the shared library name at development type, and hardcode that into the wrapper -module instead of using ``find_library`` to locate the library at runtime. +module instead of using :func:`find_library` to locate the library at runtime. .. _ctypes-loading-shared-libraries: @@ -1373,7 +1373,7 @@ it. The *mode* parameter can be used to specify how the library is loaded. For -details, consult the ``dlopen(3)`` manpage, on Windows, *mode* is ignored. +details, consult the :manpage:`dlopen(3)` manpage, on Windows, *mode* is ignored. The *use_errno* parameter, when set to True, enables a ctypes mechanism that allows to access the system :data:`errno` error number in a safe way. @@ -1446,14 +1446,13 @@ accessing it as attribute of a library loader instance. The result is cached, so repeated attribute accesses return the same library each time. - .. method:: LoadLibrary(name) Load a shared library into the process and return it. This method always returns a new instance of the library. -These prefabricated library loaders are available: +These prefabricated library loaders are available: .. data:: cdll :noindex: @@ -1478,10 +1477,10 @@ Creates :class:`PyDLL` instances. + For accessing the C Python api directly, a ready-to-use Python shared library object is available: - .. data:: pythonapi :noindex: @@ -1513,7 +1512,6 @@ This behavior can be customized by assigning to special attributes of the foreign function object. - .. attribute:: restype Assign a ctypes type to specify the result type of the foreign function. @@ -1526,7 +1524,6 @@ post processing or error checking use a ctypes data type as :attr:`restype` and assign a callable to the :attr:`errcheck` attribute. - .. attribute:: argtypes Assign a tuple of ctypes types to specify the argument types that the @@ -1539,15 +1536,14 @@ :meth:`from_param` class method of the items in the :attr:`argtypes` tuple, this method allows to adapt the actual argument to an object that the foreign function accepts. For example, a :class:`c_char_p` item in - the :attr:`argtypes` tuple will convert a unicode string passed as - argument into an byte string using ctypes conversion rules. + the :attr:`argtypes` tuple will convert a string passed as argument into + a bytes object using ctypes conversion rules. New: It is now possible to put items in argtypes which are not ctypes types, but each item must have a :meth:`from_param` method which returns a value usable as argument (integer, string, ctypes instance). This allows to define adapters that can adapt custom objects as function parameters. - .. attribute:: errcheck Assign a Python function or another callable to this attribute. The @@ -1555,15 +1551,16 @@ .. function:: callable(result, func, arguments) :noindex: + :module: - ``result`` is what the foreign function returns, as specified + *result* is what the foreign function returns, as specified by the :attr:`restype` attribute. - ``func`` is the foreign function object itself, this allows + *func* is the foreign function object itself, this allows to reuse the same callable object to check or post process the results of several functions. - ``arguments`` is a tuple containing the parameters originally + *arguments* is a tuple containing the parameters originally passed to the function call, this allows to specialize the behavior on the arguments used. @@ -1572,7 +1569,7 @@ and raise an exception if the foreign function call failed. -.. exception:: ArgumentError() +.. exception:: ArgumentError This exception is raised when a foreign function call cannot convert one of the passed arguments. @@ -1629,31 +1626,32 @@ :noindex: :module: - Create a C callable function (a callback function) from a Python ``callable``. + Create a C callable function (a callback function) from a Python *callable*. .. function:: prototype(func_spec[, paramflags]) :noindex: :module: - Returns a foreign function exported by a shared library. ``func_spec`` must be a - 2-tuple ``(name_or_ordinal, library)``. The first item is the name of the - exported function as string, or the ordinal of the exported function as small - integer. The second item is the shared library instance. + Returns a foreign function exported by a shared library. *func_spec* + must be a 2-tuple ``(name_or_ordinal, library)``. The first item is the + name of the exported function as string, or the ordinal of the exported + function as small integer. The second item is the shared library + instance. .. function:: prototype(vtbl_index, name[, paramflags[, iid]]) :noindex: :module: - Returns a foreign function that will call a COM method. ``vtbl_index`` is the - index into the virtual function table, a small non-negative integer. *name* is - name of the COM method. *iid* is an optional pointer to the interface identifier - which is used in extended error reporting. - - COM methods use a special calling convention: They require a pointer to the COM - interface as first argument, in addition to those parameters that are specified - in the :attr:`argtypes` tuple. + Returns a foreign function that will call a COM method. *vtbl_index* is + the index into the virtual function table, a small non-negative + integer. *name* is name of the COM method. *iid* is an optional pointer to + the interface identifier which is used in extended error reporting. + + COM methods use a special calling convention: They require a pointer to + the COM interface as first argument, in addition to those parameters that + are specified in the :attr:`argtypes` tuple. The optional *paramflags* parameter creates foreign function wrappers with much more functionality than the features described above. @@ -1691,7 +1689,7 @@ LPCSTR lpCaption, UINT uType); -Here is the wrapping with ``ctypes``:: +Here is the wrapping with :mod:`ctypes`:: >>> from ctypes import c_int, WINFUNCTYPE, windll >>> from ctypes.wintypes import HWND, LPCSTR, UINT @@ -1716,7 +1714,7 @@ HWND hWnd, LPRECT lpRect); -Here is the wrapping with ``ctypes``:: +Here is the wrapping with :mod:`ctypes`:: >>> from ctypes import POINTER, WINFUNCTYPE, windll, WinError >>> from ctypes.wintypes import BOOL, HWND, RECT @@ -1744,7 +1742,7 @@ >>> If the :attr:`errcheck` function returns the argument tuple it receives -unchanged, ``ctypes`` continues the normal processing it does on the output +unchanged, :mod:`ctypes` continues the normal processing it does on the output parameters. If you want to return a tuple of window coordinates instead of a ``RECT`` instance, you can retrieve the fields in the function and return them instead, the normal processing will no longer take place:: @@ -1764,23 +1762,22 @@ Utility functions ^^^^^^^^^^^^^^^^^ - .. function:: addressof(obj) - Returns the address of the memory buffer as integer. ``obj`` must be an + Returns the address of the memory buffer as integer. *obj* must be an instance of a ctypes type. .. function:: alignment(obj_or_type) - Returns the alignment requirements of a ctypes type. ``obj_or_type`` must be a + Returns the alignment requirements of a ctypes type. *obj_or_type* must be a ctypes type or instance. .. function:: byref(obj[, offset]) - Returns a light-weight pointer to ``obj``, which must be an - instance of a ctypes type. ``offset`` defaults to zero, and must be + Returns a light-weight pointer to *obj*, which must be an + instance of a ctypes type. *offset* defaults to zero, and must be an integer that will be added to the internal pointer value. ``byref(obj, offset)`` corresponds to this C code:: @@ -1794,44 +1791,44 @@ .. function:: cast(obj, type) - This function is similar to the cast operator in C. It returns a new instance of - ``type`` which points to the same memory block as ``obj``. ``type`` must be a - pointer type, and ``obj`` must be an object that can be interpreted as a + This function is similar to the cast operator in C. It returns a new instance + of *type* which points to the same memory block as *obj*. *type* must be a + pointer type, and *obj* must be an object that can be interpreted as a pointer. -.. function:: create_string_buffer(init_or_size[, size]) +.. function:: create_string_buffer(init_or_size, size=None) This function creates a mutable character buffer. The returned object is a ctypes array of :class:`c_char`. - ``init_or_size`` must be an integer which specifies the size of the array, or a - string which will be used to initialize the array items. + *init_or_size* must be an integer which specifies the size of the array, or a + bytes object which will be used to initialize the array items. - If a string is specified as first argument, the buffer is made one item larger - than the length of the string so that the last element in the array is a NUL + If a bytes object is specified as first argument, the buffer is made one item + larger than its length so that the last element in the array is a NUL termination character. An integer can be passed as second argument which allows - to specify the size of the array if the length of the string should not be used. + to specify the size of the array if the length of the bytes should not be used. - If the first parameter is a unicode string, it is converted into an 8-bit string + If the first parameter is a string, it is converted into a bytes object according to ctypes conversion rules. -.. function:: create_unicode_buffer(init_or_size[, size]) +.. function:: create_unicode_buffer(init_or_size, size=None) This function creates a mutable unicode character buffer. The returned object is a ctypes array of :class:`c_wchar`. - ``init_or_size`` must be an integer which specifies the size of the array, or a - unicode string which will be used to initialize the array items. + *init_or_size* must be an integer which specifies the size of the array, or a + string which will be used to initialize the array items. - If a unicode string is specified as first argument, the buffer is made one item + If a string is specified as first argument, the buffer is made one item larger than the length of the string so that the last element in the array is a NUL termination character. An integer can be passed as second argument which allows to specify the size of the array if the length of the string should not be used. - If the first parameter is a 8-bit string, it is converted into an unicode string + If the first parameter is a bytes object, it is converted into an unicode string according to ctypes conversion rules. @@ -1896,7 +1893,7 @@ .. function:: memmove(dst, src, count) Same as the standard C memmove library function: copies *count* bytes from - ``src`` to *dst*. *dst* and ``src`` must be integers or ctypes instances that + *src* to *dst*. *dst* and *src* must be integers or ctypes instances that can be converted to pointers. @@ -1916,7 +1913,7 @@ .. function:: pointer(obj) - This function creates a new pointer instance, pointing to ``obj``. The returned + This function creates a new pointer instance, pointing to *obj*. The returned object is of the type POINTER(type(obj)). Note: If you just want to pass a pointer to an object to a foreign function @@ -1927,60 +1924,65 @@ This function resizes the internal memory buffer of obj, which must be an instance of a ctypes type. It is not possible to make the buffer smaller than - the native size of the objects type, as given by sizeof(type(obj)), but it is - possible to enlarge the buffer. + the native size of the objects type, as given by ``sizeof(type(obj))``, but + it is possible to enlarge the buffer. .. function:: set_conversion_mode(encoding, errors) This function sets the rules that ctypes objects use when converting between - 8-bit strings and unicode strings. encoding must be a string specifying an - encoding, like ``'utf-8'`` or ``'mbcs'``, errors must be a string specifying the - error handling on encoding/decoding errors. Examples of possible values are - ``"strict"``, ``"replace"``, or ``"ignore"``. + bytes objects and (unicode) strings. *encoding* must be a string specifying an + encoding, like ``'utf-8'`` or ``'mbcs'``, *errors* must be a string specifying + the error handling on encoding/decoding errors. Examples of possible values are + ``'strict'``, ``'replace'``, or ``'ignore'``. - ``set_conversion_mode`` returns a 2-tuple containing the previous conversion + :func:`set_conversion_mode` returns a 2-tuple containing the previous conversion rules. On windows, the initial conversion rules are ``('mbcs', 'ignore')``, on other systems ``('ascii', 'strict')``. + You can set the *encoding* to ``'undefined'`` to completely disable automatic + conversions. + .. function:: set_errno(value) Set the current value of the ctypes-private copy of the system :data:`errno` variable in the calling thread to *value* and return the previous value. + .. function:: set_last_error(value) Windows only: set the current value of the ctypes-private copy of the system :data:`LastError` variable in the calling thread to *value* and return the previous value. + .. function:: sizeof(obj_or_type) Returns the size in bytes of a ctypes type or instance memory buffer. Does the same as the C ``sizeof()`` function. -.. function:: string_at(address[, size]) +.. function:: string_at(address, size=-1) - This function returns the string starting at memory address address. If size - is specified, it is used as size, otherwise the string is assumed to be - zero-terminated. + This function returns the C string starting at memory address address as a bytes + object. If size is specified, it is used as size, otherwise the string is assumed + to be zero-terminated. .. function:: WinError(code=None, descr=None) Windows only: this function is probably the worst-named thing in ctypes. It - creates an instance of WindowsError. If *code* is not specified, + creates an instance of WindowsError. If *code* is not specified, ``GetLastError`` is called to determine the error code. If ``descr`` is not specified, :func:`FormatError` is called to get a textual description of the error. -.. function:: wstring_at(address) +.. function:: wstring_at(address, size=-1) This function returns the wide character string starting at memory address - ``address`` as unicode string. If ``size`` is specified, it is used as the + *address* as a string. If ``size`` is specified, it is used as the number of characters of the string, otherwise the string is assumed to be zero-terminated. @@ -1996,14 +1998,13 @@ This non-public class is the common base class of all ctypes data types. Among other things, all ctypes type instances contain a memory block that hold C compatible data; the address of the memory block is returned by the - ``addressof()`` helper function. Another instance variable is exposed as + :func:`addressof` helper function. Another instance variable is exposed as :attr:`_objects`; this contains other Python objects that need to be kept alive in case the memory block contains pointers. Common methods of ctypes data types, these are all class methods (to be exact, they are methods of the :term:`metaclass`): - .. method:: _CData.from_buffer(source[, offset]) This method returns a ctypes instance that shares the buffer of @@ -2013,22 +2014,19 @@ is zero. If the source buffer is not large enough a ValueError is raised. - .. method:: _CData.from_buffer_copy(source[, offset]) This method creates a ctypes instance, copying the buffer from the source object buffer which must be readable. The optional - ``offset`` parameter specifies an offset into the source buffer + *offset* parameter specifies an offset into the source buffer in bytes; the default is zero. If the source buffer is not large enough a ValueError is raised. - .. method:: from_address(address) This method returns a ctypes type instance using the memory specified by address which must be an integer. - .. method:: from_param(obj) This method adapts *obj* to a ctypes type. It is called with the actual @@ -2037,20 +2035,17 @@ can be used as a function call parameter. All ctypes data types have a default implementation of this classmethod - that normally returns ``obj`` if that is an instance of the type. Some + that normally returns *obj* if that is an instance of the type. Some types accept other objects as well. - .. method:: in_dll(library, name) This method returns a ctypes type instance exported by a shared library. *name* is the name of the symbol that exports the data, *library* is the loaded shared library. - Common instance variables of ctypes data types: - .. attribute:: _b_base_ Sometimes ctypes data instances do not own the memory block they contain, @@ -2058,13 +2053,11 @@ :attr:`_b_base_` read-only member is the root ctypes object that owns the memory block. - .. attribute:: _b_needsfree_ This read-only variable is true when the ctypes data instance has allocated the memory block itself, false otherwise. - .. attribute:: _objects This member is either ``None`` or a dictionary containing Python objects @@ -2078,35 +2071,36 @@ Fundamental data types ^^^^^^^^^^^^^^^^^^^^^^ - .. class:: _SimpleCData This non-public class is the base class of all fundamental ctypes data types. It is mentioned here because it contains the common attributes of the - fundamental ctypes data types. ``_SimpleCData`` is a subclass of ``_CData``, - so it inherits their methods and attributes. ctypes data types that are not - and do not contain pointers can now be pickled. + fundamental ctypes data types. :class:`_SimpleCData` is a subclass of + :class:`_CData`, so it inherits their methods and attributes. ctypes data + types that are not and do not contain pointers can now be pickled. Instances have a single attribute: - .. attribute:: value This attribute contains the actual value of the instance. For integer and pointer types, it is an integer, for character types, it is a single - character string, for character pointer types it is a Python string or - unicode string. + character bytes object or string, for character pointer types it is a + Python bytes object or string. When the ``value`` attribute is retrieved from a ctypes instance, usually - a new object is returned each time. ``ctypes`` does *not* implement + a new object is returned each time. :mod:`ctypes` does *not* implement original object return, always a new object is constructed. The same is true for all other ctypes object instances. + Fundamental data types, when returned as foreign function call results, or, for example, by retrieving structure field members or array items, are transparently converted to native Python types. In other words, if a foreign function has a -:attr:`restype` of :class:`c_char_p`, you will always receive a Python string, -*not* a :class:`c_char_p` instance. +:attr:`restype` of :class:`c_char_p`, you will always receive a Python bytes +object, *not* a :class:`c_char_p` instance. + +.. XXX above is false, it actually returns a Unicode string Subclasses of fundamental data types do *not* inherit this behavior. So, if a foreign functions :attr:`restype` is a subclass of :class:`c_void_p`, you will @@ -2115,7 +2109,6 @@ These are the fundamental ctypes data types: - .. class:: c_byte Represents the C signed char datatype, and interprets the value as small @@ -2133,7 +2126,7 @@ .. class:: c_char_p Represents the C char \* datatype, which must be a pointer to a zero-terminated - string. The constructor accepts an integer address, or a string. + string. The constructor accepts an integer address, or a bytes object. .. class:: c_double @@ -2336,7 +2329,7 @@ Abstract base class for structures in *native* byte order. Concrete structure and union types must be created by subclassing one of these - types, and at least define a :attr:`_fields_` class variable. ``ctypes`` will + types, and at least define a :attr:`_fields_` class variable. :mod:`ctypes` will create :term:`descriptor`\s which allow reading and writing the fields by direct attribute accesses. These are the @@ -2365,7 +2358,7 @@ ] The :attr:`_fields_` class variable must, however, be defined before the - type is first used (an instance is created, ``sizeof()`` is called on it, + type is first used (an instance is created, :func:`sizeof` is called on it, and so on). Later assignments to the :attr:`_fields_` class variable will raise an AttributeError. @@ -2393,7 +2386,7 @@ otherwise it will have no effect. The fields listed in this variable must be structure or union type fields. - ``ctypes`` will create descriptors in the structure type that allows to + :mod:`ctypes` will create descriptors in the structure type that allows to access the nested fields directly, without the need to create the structure or union field. From python-checkins at python.org Mon Jun 8 15:34:53 2009 From: python-checkins at python.org (georg.brandl) Date: Mon, 8 Jun 2009 15:34:53 +0200 (CEST) Subject: [Python-checkins] r73294 - python/trunk/Doc/library/fcntl.rst Message-ID: <20090608133453.21159D77E@mail.python.org> Author: georg.brandl Date: Mon Jun 8 15:34:52 2009 New Revision: 73294 Log: #6194: O_SHLOCK/O_EXLOCK are not really more platform independent than lockf(). Modified: python/trunk/Doc/library/fcntl.rst Modified: python/trunk/Doc/library/fcntl.rst ============================================================================== --- python/trunk/Doc/library/fcntl.rst (original) +++ python/trunk/Doc/library/fcntl.rst Mon Jun 8 15:34:52 2009 @@ -151,7 +151,6 @@ Module :mod:`os` If the locking flags :const:`O_SHLOCK` and :const:`O_EXLOCK` are present - in the :mod:`os` module, the :func:`os.open` function provides a more - platform-independent alternative to the :func:`lockf` and :func:`flock` - functions. + in the :mod:`os` module (on BSD only), the :func:`os.open` function + provides an alternative to the :func:`lockf` and :func:`flock` functions. From python-checkins at python.org Mon Jun 8 15:41:29 2009 From: python-checkins at python.org (georg.brandl) Date: Mon, 8 Jun 2009 15:41:29 +0200 (CEST) Subject: [Python-checkins] r73295 - in python/branches/py3k: Doc/c-api/list.rst Doc/library/fcntl.rst Doc/library/platform.rst Doc/library/tkinter.rst Doc/tutorial/controlflow.rst Lib/test/test_pep352.py Misc/developers.txt Objects/unicodeobject.c Message-ID: <20090608134129.546D1DA88@mail.python.org> Author: georg.brandl Date: Mon Jun 8 15:41:29 2009 New Revision: 73295 Log: Merged revisions 73190,73213,73257-73258,73260,73275,73294 via svnmerge from svn+ssh://pythondev at svn.python.org/python/trunk ........ r73190 | georg.brandl | 2009-06-04 01:23:45 +0200 (Do, 04 Jun 2009) | 2 lines Avoid PendingDeprecationWarnings emitted by deprecated unittest methods. ........ r73213 | georg.brandl | 2009-06-04 12:15:57 +0200 (Do, 04 Jun 2009) | 1 line #5967: note that the C slicing APIs do not support negative indices. ........ r73257 | georg.brandl | 2009-06-06 19:50:05 +0200 (Sa, 06 Jun 2009) | 1 line #6211: elaborate a bit on ways to call the function. ........ r73258 | georg.brandl | 2009-06-06 19:51:31 +0200 (Sa, 06 Jun 2009) | 1 line #6204: use a real reference instead of "see later". ........ r73260 | georg.brandl | 2009-06-06 20:21:58 +0200 (Sa, 06 Jun 2009) | 1 line #6224: s/JPython/Jython/, and remove one link to a module nine years old. ........ r73275 | georg.brandl | 2009-06-07 22:37:52 +0200 (So, 07 Jun 2009) | 1 line Add Ezio. ........ r73294 | georg.brandl | 2009-06-08 15:34:52 +0200 (Mo, 08 Jun 2009) | 1 line #6194: O_SHLOCK/O_EXLOCK are not really more platform independent than lockf(). ........ Modified: python/branches/py3k/ (props changed) python/branches/py3k/Doc/c-api/list.rst python/branches/py3k/Doc/library/fcntl.rst python/branches/py3k/Doc/library/platform.rst python/branches/py3k/Doc/library/tkinter.rst python/branches/py3k/Doc/tutorial/controlflow.rst python/branches/py3k/Lib/test/test_pep352.py python/branches/py3k/Misc/developers.txt python/branches/py3k/Objects/unicodeobject.c Modified: python/branches/py3k/Doc/c-api/list.rst ============================================================================== --- python/branches/py3k/Doc/c-api/list.rst (original) +++ python/branches/py3k/Doc/c-api/list.rst Mon Jun 8 15:41:29 2009 @@ -112,9 +112,10 @@ .. cfunction:: PyObject* PyList_GetSlice(PyObject *list, Py_ssize_t low, Py_ssize_t high) - Return a list of the objects in *list* containing the objects *between* - *low* and *high*. Return *NULL* and set an exception if unsuccessful. - Analogous to ``list[low:high]``. + Return a list of the objects in *list* containing the objects *between* *low* + and *high*. Return *NULL* and set an exception if unsuccessful. Analogous + to ``list[low:high]``. Negative indices, as when slicing from Python, are not + supported. .. cfunction:: int PyList_SetSlice(PyObject *list, Py_ssize_t low, Py_ssize_t high, PyObject *itemlist) @@ -122,7 +123,8 @@ Set the slice of *list* between *low* and *high* to the contents of *itemlist*. Analogous to ``list[low:high] = itemlist``. The *itemlist* may be *NULL*, indicating the assignment of an empty list (slice deletion). - Return ``0`` on success, ``-1`` on failure. + Return ``0`` on success, ``-1`` on failure. Negative indices, as when + slicing from Python, are not supported. .. cfunction:: int PyList_Sort(PyObject *list) Modified: python/branches/py3k/Doc/library/fcntl.rst ============================================================================== --- python/branches/py3k/Doc/library/fcntl.rst (original) +++ python/branches/py3k/Doc/library/fcntl.rst Mon Jun 8 15:41:29 2009 @@ -145,7 +145,6 @@ Module :mod:`os` If the locking flags :const:`O_SHLOCK` and :const:`O_EXLOCK` are present - in the :mod:`os` module, the :func:`os.open` function provides a more - platform-independent alternative to the :func:`lockf` and :func:`flock` - functions. + in the :mod:`os` module (on BSD only), the :func:`os.open` function + provides an alternative to the :func:`lockf` and :func:`flock` functions. Modified: python/branches/py3k/Doc/library/platform.rst ============================================================================== --- python/branches/py3k/Doc/library/platform.rst (original) +++ python/branches/py3k/Doc/library/platform.rst Mon Jun 8 15:41:29 2009 @@ -160,7 +160,7 @@ .. function:: java_ver(release='', vendor='', vminfo=('','',''), osinfo=('','','')) - Version interface for JPython. + Version interface for Jython. Returns a tuple ``(release, vendor, vminfo, osinfo)`` with *vminfo* being a tuple ``(vm_name, vm_release, vm_vendor)`` and *osinfo* being a tuple Modified: python/branches/py3k/Doc/library/tkinter.rst ============================================================================== --- python/branches/py3k/Doc/library/tkinter.rst (original) +++ python/branches/py3k/Doc/library/tkinter.rst Mon Jun 8 15:41:29 2009 @@ -23,9 +23,6 @@ `Tkinter reference: a GUI for Python `_ On-line reference material. - `Tkinter for JPython `_ - The Jython interface to Tkinter. - `Python and Tkinter Programming `_ The book by John Grayson (ISBN 1-884777-81-3). Modified: python/branches/py3k/Doc/tutorial/controlflow.rst ============================================================================== --- python/branches/py3k/Doc/tutorial/controlflow.rst (original) +++ python/branches/py3k/Doc/tutorial/controlflow.rst Mon Jun 8 15:41:29 2009 @@ -317,7 +317,7 @@ and ``methodname`` is the name of a method that is defined by the object's type. Different types define different methods. Methods of different types may have the same name without causing ambiguity. (It is possible to define your own - object types and methods, using *classes*, as discussed later in this tutorial.) + object types and methods, using *classes*, see :ref:`tut-classes`) The method :meth:`append` shown in the example is defined for list objects; it adds a new element at the end of the list. In this example it is equivalent to ``result = result + [b]``, but more efficient. @@ -344,15 +344,23 @@ def ask_ok(prompt, retries=4, complaint='Yes or no, please!'): while True: ok = input(prompt) - if ok in ('y', 'ye', 'yes'): return True - if ok in ('n', 'no', 'nop', 'nope'): return False + if ok in ('y', 'ye', 'yes'): + return True + if ok in ('n', 'no', 'nop', 'nope'): + return False retries = retries - 1 if retries < 0: raise IOError('refusenik user') print(complaint) -This function can be called either like this: ``ask_ok('Do you really want to -quit?')`` or like this: ``ask_ok('OK to overwrite the file?', 2)``. +This function can be called in several ways: + +* giving only the mandatory argument: + ``ask_ok('Do you really want to quit?')`` +* giving one of the optional arguments: + ``ask_ok('OK to overwrite the file?', 2)`` +* or even giving all arguments: + ``ask_ok('OK to overwrite the file?', 2, 'Come on, only yes or no!')`` This example also introduces the :keyword:`in` keyword. This tests whether or not a sequence contains a certain value. Modified: python/branches/py3k/Lib/test/test_pep352.py ============================================================================== --- python/branches/py3k/Lib/test/test_pep352.py (original) +++ python/branches/py3k/Lib/test/test_pep352.py Mon Jun 8 15:41:29 2009 @@ -16,7 +16,7 @@ def verify_instance_interface(self, ins): for attr in ("args", "__str__", "__repr__"): - self.failUnless(hasattr(ins, attr), + self.assertTrue(hasattr(ins, attr), "%s missing %s attribute" % (ins.__class__.__name__, attr)) @@ -85,7 +85,7 @@ def interface_test_driver(self, results): for test_name, (given, expected) in zip(self.interface_tests, results): - self.failUnlessEqual(given, expected, "%s: %s != %s" % (test_name, + self.assertEqual(given, expected, "%s: %s != %s" % (test_name, given, expected)) def test_interface_single_arg(self): Modified: python/branches/py3k/Misc/developers.txt ============================================================================== --- python/branches/py3k/Misc/developers.txt (original) +++ python/branches/py3k/Misc/developers.txt Mon Jun 8 15:41:29 2009 @@ -17,6 +17,9 @@ Permissions History ------------------- +- Ezio Melotti was given SVN access on June 7 2009 by GFB, for work on and + fixes to the documentation. + - Paul Kippes was given commit privileges at PyCon 2009 by BAC to work on 3to2. - Ron DuPlain was given commit privileges at PyCon 2009 by BAC to work on 3to2. Modified: python/branches/py3k/Objects/unicodeobject.c ============================================================================== --- python/branches/py3k/Objects/unicodeobject.c (original) +++ python/branches/py3k/Objects/unicodeobject.c Mon Jun 8 15:41:29 2009 @@ -6830,7 +6830,7 @@ /* This code should go into some future Unicode collation support module. The basic comparison should compare ordinals on a naive - basis (this is what Java does and thus JPython too). */ + basis (this is what Java does and thus Jython too). */ /* speedy UTF-16 code point order comparison */ /* gleaned from: */ From buildbot at python.org Mon Jun 8 16:30:31 2009 From: buildbot at python.org (buildbot at python.org) Date: Mon, 08 Jun 2009 14:30:31 +0000 Subject: [Python-checkins] buildbot failure in sparc solaris10 gcc 3.x Message-ID: <20090608143031.9D334D9EF@mail.python.org> The Buildbot has detected a new failure of sparc solaris10 gcc 3.x. Full details are available at: http://www.python.org/dev/buildbot/all/sparc%20solaris10%20gcc%203.x/builds/803 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: loewis-sun Build Reason: Build Source Stamp: [branch branches/py3k] HEAD Blamelist: georg.brandl BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_posix ====================================================================== ERROR: test_getcwd_long_pathnames (test.test_posix.PosixTester) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home2/buildbot/slave/3.x.loewis-sun/build/Lib/test/test_posix.py", line 251, in test_getcwd_long_pathnames support.rmtree(base_path) File "/home2/buildbot/slave/3.x.loewis-sun/build/Lib/test/support.py", line 181, in rmtree shutil.rmtree(path) File "/home2/buildbot/slave/3.x.loewis-sun/build/Lib/shutil.py", line 239, in rmtree onerror(os.rmdir, path, sys.exc_info()) File "/home2/buildbot/slave/3.x.loewis-sun/build/Lib/shutil.py", line 237, in rmtree os.rmdir(path) OSError: [Errno 22] Invalid argument: '/home2/buildbot/slave/3.x.loewis-sun/build/@test.getcwd/@test.getcwd' sincerely, -The Buildbot From python-checkins at python.org Mon Jun 8 18:03:41 2009 From: python-checkins at python.org (georg.brandl) Date: Mon, 8 Jun 2009 18:03:41 +0200 (CEST) Subject: [Python-checkins] r73296 - python/trunk/Doc/library/string.rst Message-ID: <20090608160341.E49EBDA62@mail.python.org> Author: georg.brandl Date: Mon Jun 8 18:03:41 2009 New Revision: 73296 Log: #6238: add fillchar to string.just function family. Modified: python/trunk/Doc/library/string.rst Modified: python/trunk/Doc/library/string.rst ============================================================================== --- python/trunk/Doc/library/string.rst (original) +++ python/trunk/Doc/library/string.rst Mon Jun 8 18:03:41 2009 @@ -829,14 +829,15 @@ Return a copy of *s*, but with lower case letters converted to upper case. -.. function:: ljust(s, width) - rjust(s, width) - center(s, width) +.. function:: ljust(s, width[, fillchar]) + rjust(s, width[, fillchar]) + center(s, width[, fillchar]) These functions respectively left-justify, right-justify and center a string in a field of given width. They return a string that is at least *width* - characters wide, created by padding the string *s* with spaces until the given - width on the right, left or both sides. The string is never truncated. + characters wide, created by padding the string *s* with the character *fillchar* + (default is a space) until the given width on the right, left or both sides. + The string is never truncated. .. function:: zfill(s, width) From python-checkins at python.org Mon Jun 8 18:05:50 2009 From: python-checkins at python.org (georg.brandl) Date: Mon, 8 Jun 2009 18:05:50 +0200 (CEST) Subject: [Python-checkins] r73297 - python/branches/py3k Message-ID: <20090608160550.8761AD94A@mail.python.org> Author: georg.brandl Date: Mon Jun 8 18:05:50 2009 New Revision: 73297 Log: Blocked revisions 73296 via svnmerge ........ r73296 | georg.brandl | 2009-06-08 18:03:41 +0200 (Mo, 08 Jun 2009) | 1 line #6238: add fillchar to string.just function family. ........ Modified: python/branches/py3k/ (props changed) From python-checkins at python.org Mon Jun 8 20:32:09 2009 From: python-checkins at python.org (brett.cannon) Date: Mon, 8 Jun 2009 20:32:09 +0200 (CEST) Subject: [Python-checkins] r73298 - peps/trunk/pep-0374.txt Message-ID: <20090608183209.44731DB2A@mail.python.org> Author: brett.cannon Date: Mon Jun 8 20:32:09 2009 New Revision: 73298 Log: Remove a redundant section. Modified: peps/trunk/pep-0374.txt Modified: peps/trunk/pep-0374.txt ============================================================================== --- peps/trunk/pep-0374.txt (original) +++ peps/trunk/pep-0374.txt Mon Jun 8 20:32:09 2009 @@ -97,31 +97,6 @@ the future as the state of DVCSs evolves. -Chosen DVCS -=========== - -At PyCon 2009, a `decision -`_ -was made to go with Mercurial. - -The choice to go with Mercurial was made for four important reasons: - -* According to a small survey, Python developers are more interested in - using Mercurial than in Bazaar or Git. - -* Mercurial is written in Python, which is congruent with the python-dev - tendency to 'eat their own dogfood'. - -* Mercurial is significantly faster than bzr (it's slower than git, though - by a much smaller difference). - -* Mercurial is easier to learn for SVN users than bzr. - -Although all of these points can be debated, in the end a pronouncement from -the BDFL was made to go with hg as the chosen DVCS for the Python project. A -detailed plan for the migration strategy has been deferred to PEP 385. - - Terminology =========== From python-checkins at python.org Mon Jun 8 20:41:36 2009 From: python-checkins at python.org (georg.brandl) Date: Mon, 8 Jun 2009 20:41:36 +0200 (CEST) Subject: [Python-checkins] r73299 - python/trunk/Lib/multiprocessing/queues.py Message-ID: <20090608184136.7638EEE9AB@mail.python.org> Author: georg.brandl Date: Mon Jun 8 20:41:36 2009 New Revision: 73299 Log: Typo fix. Modified: python/trunk/Lib/multiprocessing/queues.py Modified: python/trunk/Lib/multiprocessing/queues.py ============================================================================== --- python/trunk/Lib/multiprocessing/queues.py (original) +++ python/trunk/Lib/multiprocessing/queues.py Mon Jun 8 20:41:36 2009 @@ -109,7 +109,7 @@ self._rlock.release() def qsize(self): - # Raises NotImplementError on Mac OSX because of broken sem_getvalue() + # Raises NotImplementedError on Mac OSX because of broken sem_getvalue() return self._maxsize - self._sem._semlock._get_value() def empty(self): From python-checkins at python.org Mon Jun 8 20:59:09 2009 From: python-checkins at python.org (georg.brandl) Date: Mon, 8 Jun 2009 20:59:09 +0200 (CEST) Subject: [Python-checkins] r73300 - in python/branches/py3k/Doc/tutorial: controlflow.rst datastructures.rst Message-ID: <20090608185909.DF6DFD990@mail.python.org> Author: georg.brandl Date: Mon Jun 8 20:59:09 2009 New Revision: 73300 Log: Elaborate encoding recommendations, and fix ambiguous wording for list comprehensions. Modified: python/branches/py3k/Doc/tutorial/controlflow.rst python/branches/py3k/Doc/tutorial/datastructures.rst Modified: python/branches/py3k/Doc/tutorial/controlflow.rst ============================================================================== --- python/branches/py3k/Doc/tutorial/controlflow.rst (original) +++ python/branches/py3k/Doc/tutorial/controlflow.rst Mon Jun 8 20:59:09 2009 @@ -675,7 +675,12 @@ (see :ref:`tut-firstclasses` for more on classes and methods). * Don't use fancy encodings if your code is meant to be used in international - environments. Plain ASCII works best in any case. + environments. Python's default, UTF-8, or even plain ASCII work best in any + case. + +* Likewise, don't use non-ASCII characters in identifiers if there is only the + slightest chance people speaking a different language will read or maintain + the code. .. rubric:: Footnotes Modified: python/branches/py3k/Doc/tutorial/datastructures.rst ============================================================================== --- python/branches/py3k/Doc/tutorial/datastructures.rst (original) +++ python/branches/py3k/Doc/tutorial/datastructures.rst Mon Jun 8 20:59:09 2009 @@ -162,12 +162,11 @@ some operations applied to each member of the sequence, or to create a subsequence of those elements that satisfy a certain condition. - -Each list comprehension consists of an expression followed by a :keyword:`for` -clause, then zero or more :keyword:`for` or :keyword:`if` clauses. The result -will be a list resulting from evaluating the expression in the context of the -:keyword:`for` and :keyword:`if` clauses which follow it. If the expression -would evaluate to a tuple, it must be parenthesized. +A list comprehension consists of brackets containing an expression followed +by a :keyword:`for` clause, then zero or more :keyword:`for` or :keyword:`if` +clauses. The result will be a list resulting from evaluating the expression in +the context of the :keyword:`for` and :keyword:`if` clauses which follow it. If +the expression would evaluate to a tuple, it must be parenthesized. Here we take a list of numbers and return a list of three times each number:: @@ -348,8 +347,8 @@ >>> x, y, z = t This is called, appropriately enough, *sequence unpacking* and works for any -sequence on the right-hand side. Sequence unpacking requires the list of -variables on the left to have the same number of elements as the length of the +sequence on the right-hand side. Sequence unpacking requires that there are as +many variables on the left side of the equals sign as there are elements in the sequence. Note that multiple assignment is really just a combination of tuple packing and sequence unpacking. From python-checkins at python.org Mon Jun 8 21:11:54 2009 From: python-checkins at python.org (thomas.heller) Date: Mon, 8 Jun 2009 21:11:54 +0200 (CEST) Subject: [Python-checkins] r73301 - python/branches/py3k/Doc/library/ctypes.rst Message-ID: <20090608191154.9264FDB73@mail.python.org> Author: thomas.heller Date: Mon Jun 8 21:11:54 2009 New Revision: 73301 Log: Fix typo. Modified: python/branches/py3k/Doc/library/ctypes.rst Modified: python/branches/py3k/Doc/library/ctypes.rst ============================================================================== --- python/branches/py3k/Doc/library/ctypes.rst (original) +++ python/branches/py3k/Doc/library/ctypes.rst Mon Jun 8 21:11:54 2009 @@ -247,7 +247,7 @@ +----------------------+--------------------------------+----------------------------+ | :class:`c_longdouble`| ``long double`` | float | +----------------------+--------------------------------+----------------------------+ - | :class:`c_char_p` | ``char *`` (NUL terminated) | bytes objcet or ``None`` | + | :class:`c_char_p` | ``char *`` (NUL terminated) | bytes object or ``None`` | +----------------------+--------------------------------+----------------------------+ | :class:`c_wchar_p` | ``wchar_t *`` (NUL terminated) | string or ``None`` | +----------------------+--------------------------------+----------------------------+ From python-checkins at python.org Mon Jun 8 22:25:56 2009 From: python-checkins at python.org (georg.brandl) Date: Mon, 8 Jun 2009 22:25:56 +0200 (CEST) Subject: [Python-checkins] r73302 - python/branches/py3k/Doc/tutorial/datastructures.rst Message-ID: <20090608202556.1EB59D52A@mail.python.org> Author: georg.brandl Date: Mon Jun 8 22:25:55 2009 New Revision: 73302 Log: Fix markup. Modified: python/branches/py3k/Doc/tutorial/datastructures.rst Modified: python/branches/py3k/Doc/tutorial/datastructures.rst ============================================================================== --- python/branches/py3k/Doc/tutorial/datastructures.rst (original) +++ python/branches/py3k/Doc/tutorial/datastructures.rst Mon Jun 8 22:25:55 2009 @@ -365,9 +365,9 @@ eliminating duplicate entries. Set objects also support mathematical operations like union, intersection, difference, and symmetric difference. -Curly braces or the :func:`set` function can be use to create sets. Note: -To create an empty set you have to use set(), not {}; the latter creates -an empty dictionary, a data structure that we discuss in the next section. +Curly braces or the :func:`set` function can be use to create sets. Note: To +create an empty set you have to use ``set()``, not ``{}``; the latter creates an +empty dictionary, a data structure that we discuss in the next section. Here is a brief demonstration:: From python-checkins at python.org Mon Jun 8 22:55:00 2009 From: python-checkins at python.org (ronald.oussoren) Date: Mon, 8 Jun 2009 22:55:00 +0200 (CEST) Subject: [Python-checkins] r73303 - python/trunk/Makefile.pre.in Message-ID: <20090608205500.22867D947@mail.python.org> Author: ronald.oussoren Date: Mon Jun 8 22:54:59 2009 New Revision: 73303 Log: This checkin adds a symlink to the lib directory of a framework install of Python (on OSX), and the end result of that is that the combination of ``python-config --ldflags`` and ``python-config --libs`` refers to an actually existing location. I've done this in preference to changing python-config to specify '-framework Python' for linking because that doesn't work when you have multiple versions of python installed (because '-framework Python' will always link to the 'Current' version of the framework, without a possibility to specify a specific version). Modified: python/trunk/Makefile.pre.in Modified: python/trunk/Makefile.pre.in ============================================================================== --- python/trunk/Makefile.pre.in (original) +++ python/trunk/Makefile.pre.in Mon Jun 8 22:54:59 2009 @@ -1068,6 +1068,7 @@ # install (which includes python-config) happy. frameworkinstallmaclib: ln -fs "../../../$(PYTHONFRAMEWORK)" "$(DESTDIR)$(prefix)/lib/python$(VERSION)/config/libpython$(VERSION).a" + ln -fs "../$(PYTHONFRAMEWORK)" "$(DESTDIR)$(prefix)/lib/libpython$(VERSION).dylib" cd Mac && $(MAKE) installmacsubtree DESTDIR="$(DESTDIR)" # This installs the IDE, the Launcher and other apps into /Applications From python-checkins at python.org Mon Jun 8 23:04:41 2009 From: python-checkins at python.org (ronald.oussoren) Date: Mon, 8 Jun 2009 23:04:41 +0200 (CEST) Subject: [Python-checkins] r73304 - in python/branches/py3k: Makefile.pre.in Message-ID: <20090608210441.7EA0BD777@mail.python.org> Author: ronald.oussoren Date: Mon Jun 8 23:04:41 2009 New Revision: 73304 Log: Merged revisions 73303 via svnmerge from svn+ssh://pythondev at svn.python.org/python/trunk ........ r73303 | ronald.oussoren | 2009-06-08 13:54:59 -0700 (Mon, 08 Jun 2009) | 11 lines This checkin adds a symlink to the lib directory of a framework install of Python (on OSX), and the end result of that is that the combination of ``python-config --ldflags`` and ``python-config --libs`` refers to an actually existing location. I've done this in preference to changing python-config to specify '-framework Python' for linking because that doesn't work when you have multiple versions of python installed (because '-framework Python' will always link to the 'Current' version of the framework, without a possibility to specify a specific version). ........ Modified: python/branches/py3k/ (props changed) python/branches/py3k/Makefile.pre.in Modified: python/branches/py3k/Makefile.pre.in ============================================================================== --- python/branches/py3k/Makefile.pre.in (original) +++ python/branches/py3k/Makefile.pre.in Mon Jun 8 23:04:41 2009 @@ -1068,6 +1068,7 @@ # install (which includes python-config) happy. frameworkinstallmaclib: ln -fs "../../../$(PYTHONFRAMEWORK)" "$(DESTDIR)$(prefix)/lib/python$(VERSION)/config/libpython$(VERSION).a" + ln -fs "../$(PYTHONFRAMEWORK)" "$(DESTDIR)$(prefix)/lib/libpython$(VERSION).dylib" # This installs the IDE, the Launcher and other apps into /Applications frameworkinstallapps: From python-checkins at python.org Mon Jun 8 23:12:42 2009 From: python-checkins at python.org (ronald.oussoren) Date: Mon, 8 Jun 2009 23:12:42 +0200 (CEST) Subject: [Python-checkins] r73305 - in python/trunk: Misc/NEWS configure configure.in Message-ID: <20090608211242.EA271D964@mail.python.org> Author: ronald.oussoren Date: Mon Jun 8 23:12:41 2009 New Revision: 73305 Log: This is a fix for Issue5809: you shouldn't specify both --enable-framework and --enable-shared Modified: python/trunk/Misc/NEWS python/trunk/configure python/trunk/configure.in Modified: python/trunk/Misc/NEWS ============================================================================== --- python/trunk/Misc/NEWS (original) +++ python/trunk/Misc/NEWS Mon Jun 8 23:12:41 2009 @@ -1005,6 +1005,9 @@ Build ----- +- Issue 5809: Specifying both --enable-framework and --enable-shared is + an error. Configure now explicity tells you about this. + - Issue #3585: Add pkg-config support. It creates a python-2.7.pc file and a python.pc symlink in the $(LIBDIR)/pkgconfig directory. Patch by Clinton Roy. Modified: python/trunk/configure ============================================================================== --- python/trunk/configure (original) +++ python/trunk/configure Mon Jun 8 23:12:41 2009 @@ -1,12 +1,12 @@ #! /bin/sh -# From configure.in Revision: 72871 . +# From configure.in Revision: 72898 . # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.63 for python 2.7. +# Generated by GNU Autoconf 2.61 for python 2.7. # # Report bugs to . # # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, -# 2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. +# 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. # This configure script is free software; the Free Software Foundation # gives unlimited permission to copy, distribute and modify it. ## --------------------- ## @@ -18,7 +18,7 @@ if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: - # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which + # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST @@ -40,45 +40,17 @@ as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits -as_nl=' -' -export as_nl -# Printing a long string crashes Solaris 7 /usr/bin/printf. -as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' -as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo -as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo -if (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then - as_echo='printf %s\n' - as_echo_n='printf %s' -else - if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then - as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' - as_echo_n='/usr/ucb/echo -n' - else - as_echo_body='eval expr "X$1" : "X\\(.*\\)"' - as_echo_n_body='eval - arg=$1; - case $arg in - *"$as_nl"*) - expr "X$arg" : "X\\(.*\\)$as_nl"; - arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; - esac; - expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" - ' - export as_echo_n_body - as_echo_n='sh -c $as_echo_n_body as_echo' - fi - export as_echo_body - as_echo='sh -c $as_echo_body as_echo' -fi - # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then - PATH_SEPARATOR=: - (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { - (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || - PATH_SEPARATOR=';' - } + echo "#! /bin/sh" >conf$$.sh + echo "exit 0" >>conf$$.sh + chmod +x conf$$.sh + if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then + PATH_SEPARATOR=';' + else + PATH_SEPARATOR=: + fi + rm -f conf$$.sh fi # Support unset when possible. @@ -94,6 +66,8 @@ # there to prevent editors from complaining about space-tab. # (If _AS_PATH_WALK were called with IFS unset, it would disable word # splitting by setting IFS to empty value.) +as_nl=' +' IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. @@ -116,7 +90,7 @@ as_myself=$0 fi if test ! -f "$as_myself"; then - $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 + echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 { (exit 1); exit 1; } fi @@ -129,10 +103,17 @@ PS4='+ ' # NLS nuisances. -LC_ALL=C -export LC_ALL -LANGUAGE=C -export LANGUAGE +for as_var in \ + LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ + LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ + LC_TELEPHONE LC_TIME +do + if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then + eval $as_var=C; export $as_var + else + ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var + fi +done # Required to use basename. if expr a : '\(a\)' >/dev/null 2>&1 && @@ -154,7 +135,7 @@ $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X/"$0" | +echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q @@ -180,7 +161,7 @@ as_have_required=no fi - if test $as_have_required = yes && (eval ": + if test $as_have_required = yes && (eval ": (as_func_return () { (exit \$1) } @@ -262,7 +243,7 @@ if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: - # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which + # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST @@ -283,7 +264,7 @@ if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: - # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which + # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST @@ -363,10 +344,10 @@ if test "x$CONFIG_SHELL" != x; then for as_var in BASH_ENV ENV - do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var - done - export CONFIG_SHELL - exec "$CONFIG_SHELL" "$as_myself" ${1+"$@"} + do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var + done + export CONFIG_SHELL + exec "$CONFIG_SHELL" "$as_myself" ${1+"$@"} fi @@ -435,10 +416,9 @@ test \$exitcode = 0") || { echo No shell found that supports shell functions. - echo Please tell bug-autoconf at gnu.org about your system, - echo including any error possibly output before this message. - echo This can help us improve future autoconf versions. - echo Configuration will now proceed without shell functions. + echo Please tell autoconf at gnu.org about your system, + echo including any error possibly output before this + echo message } @@ -474,7 +454,7 @@ s/-\n.*// ' >$as_me.lineno && chmod +x "$as_me.lineno" || - { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2 + { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2 { (exit 1); exit 1; }; } # Don't try to exec as it changes $[0], causing all sort of problems @@ -502,6 +482,7 @@ *) ECHO_N='-n';; esac + if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr @@ -514,22 +495,19 @@ rm -f conf$$.dir/conf$$.file else rm -f conf$$.dir - mkdir conf$$.dir 2>/dev/null + mkdir conf$$.dir fi -if (echo >conf$$.file) 2>/dev/null; then - if ln -s conf$$.file conf$$ 2>/dev/null; then - as_ln_s='ln -s' - # ... but there are two gotchas: - # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. - # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. - # In both cases, we have to default to `cp -p'. - ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || - as_ln_s='cp -p' - elif ln conf$$.file conf$$ 2>/dev/null; then - as_ln_s=ln - else +echo >conf$$.file +if ln -s conf$$.file conf$$ 2>/dev/null; then + as_ln_s='ln -s' + # ... but there are two gotchas: + # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. + # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. + # In both cases, we have to default to `cp -p'. + ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || as_ln_s='cp -p' - fi +elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln else as_ln_s='cp -p' fi @@ -554,10 +532,10 @@ as_test_x=' eval sh -c '\'' if test -d "$1"; then - test -d "$1/."; + test -d "$1/."; else case $1 in - -*)set "./$1";; + -*)set "./$1";; esac; case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in ???[sx]*):;;*)false;;esac;fi @@ -638,160 +616,128 @@ # include #endif" -ac_subst_vars='LTLIBOBJS -SRCDIRS -THREADHEADERS -UNICODE_OBJS -LIBC -LIBM -HAVE_GETHOSTBYNAME -HAVE_GETHOSTBYNAME_R -HAVE_GETHOSTBYNAME_R_3_ARG -HAVE_GETHOSTBYNAME_R_5_ARG -HAVE_GETHOSTBYNAME_R_6_ARG -LIBOBJS -TRUE -MACHDEP_OBJS -DYNLOADFILE -DLINCLDIR -THREADOBJ -LDLAST -USE_THREAD_MODULE -SIGNAL_OBJS -USE_SIGNAL_MODULE -SHLIBS -CFLAGSFORSHARED -LINKFORSHARED -CCSHARED -BLDSHARED -LDSHARED -SO -LIBTOOL_CRUFT -OTHER_LIBTOOL_OPT -UNIVERSAL_ARCH_FLAGS -BASECFLAGS -OPT -LN -INSTALL_DATA -INSTALL_SCRIPT -INSTALL_PROGRAM -SVNVERSION -ARFLAGS -AR -RANLIB -GNULD -LINKCC -RUNSHARED -INSTSONAME -LDLIBRARYDIR -BLDLIBRARY -DLLLIBRARY -LDLIBRARY -LIBRARY -BUILDEXEEXT -EGREP -GREP -CPP -MAINCC -CXX -OBJEXT -EXEEXT -ac_ct_CC -CPPFLAGS -LDFLAGS -CFLAGS -CC -EXPORT_MACOSX_DEPLOYMENT_TARGET -CONFIGURE_MACOSX_DEPLOYMENT_TARGET -EXTRAMACHDEPPATH -EXTRAPLATDIR -SGI_ABI -MACHDEP -FRAMEWORKUNIXTOOLSPREFIX -FRAMEWORKALTINSTALLLAST -FRAMEWORKALTINSTALLFIRST -FRAMEWORKINSTALLLAST -FRAMEWORKINSTALLFIRST -PYTHONFRAMEWORKINSTALLDIR -PYTHONFRAMEWORKPREFIX -PYTHONFRAMEWORKDIR -PYTHONFRAMEWORKIDENTIFIER -PYTHONFRAMEWORK -ARCH_RUN_32BIT -UNIVERSALSDK -CONFIG_ARGS -SOVERSION -VERSION -target_alias -host_alias -build_alias -LIBS -ECHO_T -ECHO_N -ECHO_C -DEFS -mandir -localedir -libdir -psdir -pdfdir -dvidir -htmldir -infodir -docdir -oldincludedir -includedir -localstatedir -sharedstatedir -sysconfdir -datadir -datarootdir -libexecdir -sbindir -bindir -program_transform_name -prefix -exec_prefix -PACKAGE_BUGREPORT -PACKAGE_STRING -PACKAGE_VERSION -PACKAGE_TARNAME -PACKAGE_NAME +ac_subst_vars='SHELL PATH_SEPARATOR -SHELL' +PACKAGE_NAME +PACKAGE_TARNAME +PACKAGE_VERSION +PACKAGE_STRING +PACKAGE_BUGREPORT +exec_prefix +prefix +program_transform_name +bindir +sbindir +libexecdir +datarootdir +datadir +sysconfdir +sharedstatedir +localstatedir +includedir +oldincludedir +docdir +infodir +htmldir +dvidir +pdfdir +psdir +libdir +localedir +mandir +DEFS +ECHO_C +ECHO_N +ECHO_T +LIBS +build_alias +host_alias +target_alias +VERSION +SOVERSION +CONFIG_ARGS +UNIVERSALSDK +ARCH_RUN_32BIT +PYTHONFRAMEWORK +PYTHONFRAMEWORKIDENTIFIER +PYTHONFRAMEWORKDIR +PYTHONFRAMEWORKPREFIX +PYTHONFRAMEWORKINSTALLDIR +FRAMEWORKINSTALLFIRST +FRAMEWORKINSTALLLAST +FRAMEWORKALTINSTALLFIRST +FRAMEWORKALTINSTALLLAST +FRAMEWORKUNIXTOOLSPREFIX +MACHDEP +SGI_ABI +EXTRAPLATDIR +EXTRAMACHDEPPATH +CONFIGURE_MACOSX_DEPLOYMENT_TARGET +EXPORT_MACOSX_DEPLOYMENT_TARGET +CC +CFLAGS +LDFLAGS +CPPFLAGS +ac_ct_CC +EXEEXT +OBJEXT +CXX +MAINCC +CPP +GREP +EGREP +BUILDEXEEXT +LIBRARY +LDLIBRARY +DLLLIBRARY +BLDLIBRARY +LDLIBRARYDIR +INSTSONAME +RUNSHARED +LINKCC +GNULD +RANLIB +AR +ARFLAGS +SVNVERSION +INSTALL_PROGRAM +INSTALL_SCRIPT +INSTALL_DATA +LN +OPT +BASECFLAGS +UNIVERSAL_ARCH_FLAGS +OTHER_LIBTOOL_OPT +LIBTOOL_CRUFT +SO +LDSHARED +BLDSHARED +CCSHARED +LINKFORSHARED +CFLAGSFORSHARED +SHLIBS +USE_SIGNAL_MODULE +SIGNAL_OBJS +USE_THREAD_MODULE +LDLAST +THREADOBJ +DLINCLDIR +DYNLOADFILE +MACHDEP_OBJS +TRUE +LIBOBJS +HAVE_GETHOSTBYNAME_R_6_ARG +HAVE_GETHOSTBYNAME_R_5_ARG +HAVE_GETHOSTBYNAME_R_3_ARG +HAVE_GETHOSTBYNAME_R +HAVE_GETHOSTBYNAME +LIBM +LIBC +UNICODE_OBJS +THREADHEADERS +SRCDIRS +LTLIBOBJS' ac_subst_files='' -ac_user_opts=' -enable_option_checking -enable_universalsdk -with_universal_archs -with_framework_name -enable_framework -with_gcc -with_cxx_main -with_suffix -enable_shared -enable_profiling -with_pydebug -enable_toolbox_glue -with_libs -with_system_ffi -with_dbmliborder -with_signal_module -with_dec_threads -with_threads -with_thread -with_pth -enable_ipv6 -with_doc_strings -with_tsc -with_pymalloc -with_wctype_functions -with_fpectl -with_libm -with_libc -enable_big_digits -enable_unicode -' ac_precious_vars='build_alias host_alias target_alias @@ -806,8 +752,6 @@ # Initialize some variables set by options. ac_init_help= ac_init_version=false -ac_unrecognized_opts= -ac_unrecognized_sep= # The variables have the same names as the options, with # dashes changed to underlines. cache_file=/dev/null @@ -906,21 +850,13 @@ datarootdir=$ac_optarg ;; -disable-* | --disable-*) - ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'` + ac_feature=`expr "x$ac_option" : 'x-*disable-\(.*\)'` # Reject names that are not valid shell variable names. - expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && - { $as_echo "$as_me: error: invalid feature name: $ac_useropt" >&2 + expr "x$ac_feature" : ".*[^-._$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid feature name: $ac_feature" >&2 { (exit 1); exit 1; }; } - ac_useropt_orig=$ac_useropt - ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` - case $ac_user_opts in - *" -"enable_$ac_useropt" -"*) ;; - *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--disable-$ac_useropt_orig" - ac_unrecognized_sep=', ';; - esac - eval enable_$ac_useropt=no ;; + ac_feature=`echo $ac_feature | sed 's/[-.]/_/g'` + eval enable_$ac_feature=no ;; -docdir | --docdir | --docdi | --doc | --do) ac_prev=docdir ;; @@ -933,21 +869,13 @@ dvidir=$ac_optarg ;; -enable-* | --enable-*) - ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` + ac_feature=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` # Reject names that are not valid shell variable names. - expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && - { $as_echo "$as_me: error: invalid feature name: $ac_useropt" >&2 + expr "x$ac_feature" : ".*[^-._$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid feature name: $ac_feature" >&2 { (exit 1); exit 1; }; } - ac_useropt_orig=$ac_useropt - ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` - case $ac_user_opts in - *" -"enable_$ac_useropt" -"*) ;; - *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--enable-$ac_useropt_orig" - ac_unrecognized_sep=', ';; - esac - eval enable_$ac_useropt=\$ac_optarg ;; + ac_feature=`echo $ac_feature | sed 's/[-.]/_/g'` + eval enable_$ac_feature=\$ac_optarg ;; -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ @@ -1138,38 +1066,22 @@ ac_init_version=: ;; -with-* | --with-*) - ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` + ac_package=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` # Reject names that are not valid shell variable names. - expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && - { $as_echo "$as_me: error: invalid package name: $ac_useropt" >&2 + expr "x$ac_package" : ".*[^-._$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid package name: $ac_package" >&2 { (exit 1); exit 1; }; } - ac_useropt_orig=$ac_useropt - ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` - case $ac_user_opts in - *" -"with_$ac_useropt" -"*) ;; - *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--with-$ac_useropt_orig" - ac_unrecognized_sep=', ';; - esac - eval with_$ac_useropt=\$ac_optarg ;; + ac_package=`echo $ac_package | sed 's/[-.]/_/g'` + eval with_$ac_package=\$ac_optarg ;; -without-* | --without-*) - ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'` + ac_package=`expr "x$ac_option" : 'x-*without-\(.*\)'` # Reject names that are not valid shell variable names. - expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && - { $as_echo "$as_me: error: invalid package name: $ac_useropt" >&2 + expr "x$ac_package" : ".*[^-._$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid package name: $ac_package" >&2 { (exit 1); exit 1; }; } - ac_useropt_orig=$ac_useropt - ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` - case $ac_user_opts in - *" -"with_$ac_useropt" -"*) ;; - *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--without-$ac_useropt_orig" - ac_unrecognized_sep=', ';; - esac - eval with_$ac_useropt=no ;; + ac_package=`echo $ac_package | sed 's/[-.]/_/g'` + eval with_$ac_package=no ;; --x) # Obsolete; use --with-x. @@ -1189,7 +1101,7 @@ | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) x_libraries=$ac_optarg ;; - -*) { $as_echo "$as_me: error: unrecognized option: $ac_option + -*) { echo "$as_me: error: unrecognized option: $ac_option Try \`$0 --help' for more information." >&2 { (exit 1); exit 1; }; } ;; @@ -1198,16 +1110,16 @@ ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` # Reject names that are not valid shell variable names. expr "x$ac_envvar" : ".*[^_$as_cr_alnum]" >/dev/null && - { $as_echo "$as_me: error: invalid variable name: $ac_envvar" >&2 + { echo "$as_me: error: invalid variable name: $ac_envvar" >&2 { (exit 1); exit 1; }; } eval $ac_envvar=\$ac_optarg export $ac_envvar ;; *) # FIXME: should be removed in autoconf 3.0. - $as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2 + echo "$as_me: WARNING: you should use --build, --host, --target" >&2 expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && - $as_echo "$as_me: WARNING: invalid host type: $ac_option" >&2 + echo "$as_me: WARNING: invalid host type: $ac_option" >&2 : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option} ;; @@ -1216,38 +1128,22 @@ if test -n "$ac_prev"; then ac_option=--`echo $ac_prev | sed 's/_/-/g'` - { $as_echo "$as_me: error: missing argument to $ac_option" >&2 + { echo "$as_me: error: missing argument to $ac_option" >&2 { (exit 1); exit 1; }; } fi -if test -n "$ac_unrecognized_opts"; then - case $enable_option_checking in - no) ;; - fatal) { $as_echo "$as_me: error: unrecognized options: $ac_unrecognized_opts" >&2 - { (exit 1); exit 1; }; } ;; - *) $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;; - esac -fi - -# Check all directory arguments for consistency. +# Be sure to have absolute directory names. for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ datadir sysconfdir sharedstatedir localstatedir includedir \ oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ libdir localedir mandir do eval ac_val=\$$ac_var - # Remove trailing slashes. - case $ac_val in - */ ) - ac_val=`expr "X$ac_val" : 'X\(.*[^/]\)' \| "X$ac_val" : 'X\(.*\)'` - eval $ac_var=\$ac_val;; - esac - # Be sure to have absolute directory names. case $ac_val in [\\/$]* | ?:[\\/]* ) continue;; NONE | '' ) case $ac_var in *prefix ) continue;; esac;; esac - { $as_echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 + { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 { (exit 1); exit 1; }; } done @@ -1262,7 +1158,7 @@ if test "x$host_alias" != x; then if test "x$build_alias" = x; then cross_compiling=maybe - $as_echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host. + echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host. If a cross compiler is detected then cross compile mode will be used." >&2 elif test "x$build_alias" != "x$host_alias"; then cross_compiling=yes @@ -1278,10 +1174,10 @@ ac_pwd=`pwd` && test -n "$ac_pwd" && ac_ls_di=`ls -di .` && ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` || - { $as_echo "$as_me: error: working directory cannot be determined" >&2 + { echo "$as_me: error: Working directory cannot be determined" >&2 { (exit 1); exit 1; }; } test "X$ac_ls_di" = "X$ac_pwd_ls_di" || - { $as_echo "$as_me: error: pwd does not report name of working directory" >&2 + { echo "$as_me: error: pwd does not report name of working directory" >&2 { (exit 1); exit 1; }; } @@ -1289,12 +1185,12 @@ if test -z "$srcdir"; then ac_srcdir_defaulted=yes # Try the directory containing this script, then the parent directory. - ac_confdir=`$as_dirname -- "$as_myself" || -$as_expr X"$as_myself" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$as_myself" : 'X\(//\)[^/]' \| \ - X"$as_myself" : 'X\(//\)$' \| \ - X"$as_myself" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X"$as_myself" | + ac_confdir=`$as_dirname -- "$0" || +$as_expr X"$0" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$0" : 'X\(//\)[^/]' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)' \| . 2>/dev/null || +echo X"$0" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q @@ -1321,12 +1217,12 @@ fi if test ! -r "$srcdir/$ac_unique_file"; then test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .." - { $as_echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2 + { echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2 { (exit 1); exit 1; }; } fi ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work" ac_abs_confdir=`( - cd "$srcdir" && test -r "./$ac_unique_file" || { $as_echo "$as_me: error: $ac_msg" >&2 + cd "$srcdir" && test -r "./$ac_unique_file" || { echo "$as_me: error: $ac_msg" >&2 { (exit 1); exit 1; }; } pwd)` # When building in place, set srcdir=. @@ -1375,9 +1271,9 @@ Installation directories: --prefix=PREFIX install architecture-independent files in PREFIX - [$ac_default_prefix] + [$ac_default_prefix] --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX - [PREFIX] + [PREFIX] By default, \`make install' will install all the files in \`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify @@ -1387,25 +1283,25 @@ For better control, use the options below. Fine tuning of the installation directories: - --bindir=DIR user executables [EPREFIX/bin] - --sbindir=DIR system admin executables [EPREFIX/sbin] - --libexecdir=DIR program executables [EPREFIX/libexec] - --sysconfdir=DIR read-only single-machine data [PREFIX/etc] - --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] - --localstatedir=DIR modifiable single-machine data [PREFIX/var] - --libdir=DIR object code libraries [EPREFIX/lib] - --includedir=DIR C header files [PREFIX/include] - --oldincludedir=DIR C header files for non-gcc [/usr/include] - --datarootdir=DIR read-only arch.-independent data root [PREFIX/share] - --datadir=DIR read-only architecture-independent data [DATAROOTDIR] - --infodir=DIR info documentation [DATAROOTDIR/info] - --localedir=DIR locale-dependent data [DATAROOTDIR/locale] - --mandir=DIR man documentation [DATAROOTDIR/man] - --docdir=DIR documentation root [DATAROOTDIR/doc/python] - --htmldir=DIR html documentation [DOCDIR] - --dvidir=DIR dvi documentation [DOCDIR] - --pdfdir=DIR pdf documentation [DOCDIR] - --psdir=DIR ps documentation [DOCDIR] + --bindir=DIR user executables [EPREFIX/bin] + --sbindir=DIR system admin executables [EPREFIX/sbin] + --libexecdir=DIR program executables [EPREFIX/libexec] + --sysconfdir=DIR read-only single-machine data [PREFIX/etc] + --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] + --localstatedir=DIR modifiable single-machine data [PREFIX/var] + --libdir=DIR object code libraries [EPREFIX/lib] + --includedir=DIR C header files [PREFIX/include] + --oldincludedir=DIR C header files for non-gcc [/usr/include] + --datarootdir=DIR read-only arch.-independent data root [PREFIX/share] + --datadir=DIR read-only architecture-independent data [DATAROOTDIR] + --infodir=DIR info documentation [DATAROOTDIR/info] + --localedir=DIR locale-dependent data [DATAROOTDIR/locale] + --mandir=DIR man documentation [DATAROOTDIR/man] + --docdir=DIR documentation root [DATAROOTDIR/doc/python] + --htmldir=DIR html documentation [DOCDIR] + --dvidir=DIR dvi documentation [DOCDIR] + --pdfdir=DIR pdf documentation [DOCDIR] + --psdir=DIR ps documentation [DOCDIR] _ACEOF cat <<\_ACEOF @@ -1419,7 +1315,6 @@ cat <<\_ACEOF Optional Features: - --disable-option-checking ignore unrecognized --enable/--with options --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) --enable-FEATURE[=ARG] include FEATURE [ARG=yes] --enable-universalsdk[=SDKDIR] @@ -1493,17 +1388,15 @@ if test "$ac_init_help" = "recursive"; then # If there are subdirs, report their specific --help. for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue - test -d "$ac_dir" || - { cd "$srcdir" && ac_pwd=`pwd` && srcdir=. && test -d "$ac_dir"; } || - continue + test -d "$ac_dir" || continue ac_builddir=. case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) - ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` + ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` # A ".." for each directory in $ac_dir_suffix. - ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` + ac_top_builddir_sub=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,/..,g;s,/,,'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; @@ -1539,7 +1432,7 @@ echo && $SHELL "$ac_srcdir/configure" --help=recursive else - $as_echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 + echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 fi || ac_status=$? cd "$ac_pwd" || { ac_status=$?; break; } done @@ -1549,10 +1442,10 @@ if $ac_init_version; then cat <<\_ACEOF python configure 2.7 -generated by GNU Autoconf 2.63 +generated by GNU Autoconf 2.61 Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, -2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. +2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. This configure script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. _ACEOF @@ -1563,7 +1456,7 @@ running configure, to aid debugging if configure makes a mistake. It was created by python $as_me 2.7, which was -generated by GNU Autoconf 2.63. Invocation command line was +generated by GNU Autoconf 2.61. Invocation command line was $ $0 $@ @@ -1599,7 +1492,7 @@ do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. - $as_echo "PATH: $as_dir" + echo "PATH: $as_dir" done IFS=$as_save_IFS @@ -1634,7 +1527,7 @@ | -silent | --silent | --silen | --sile | --sil) continue ;; *\'*) - ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; + ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; esac case $ac_pass in 1) ac_configure_args0="$ac_configure_args0 '$ac_arg'" ;; @@ -1686,12 +1579,11 @@ case $ac_val in #( *${as_nl}*) case $ac_var in #( - *_cv_*) { $as_echo "$as_me:$LINENO: WARNING: cache variable $ac_var contains a newline" >&5 -$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; + *_cv_*) { echo "$as_me:$LINENO: WARNING: Cache variable $ac_var contains a newline." >&5 +echo "$as_me: WARNING: Cache variable $ac_var contains a newline." >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( - BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( *) $as_unset $ac_var ;; esac ;; esac @@ -1721,9 +1613,9 @@ do eval ac_val=\$$ac_var case $ac_val in - *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; + *\'\''*) ac_val=`echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac - $as_echo "$ac_var='\''$ac_val'\''" + echo "$ac_var='\''$ac_val'\''" done | sort echo @@ -1738,9 +1630,9 @@ do eval ac_val=\$$ac_var case $ac_val in - *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; + *\'\''*) ac_val=`echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac - $as_echo "$ac_var='\''$ac_val'\''" + echo "$ac_var='\''$ac_val'\''" done | sort echo fi @@ -1756,8 +1648,8 @@ echo fi test "$ac_signal" != 0 && - $as_echo "$as_me: caught signal $ac_signal" - $as_echo "$as_me: exit $exit_status" + echo "$as_me: caught signal $ac_signal" + echo "$as_me: exit $exit_status" } >&5 rm -f core *.core core.conftest.* && rm -f -r conftest* confdefs* conf$$* $ac_clean_files && @@ -1799,24 +1691,21 @@ # Let the site file select an alternate cache file if it wants to. -# Prefer an explicitly selected file to automatically selected ones. -ac_site_file1=NONE -ac_site_file2=NONE +# Prefer explicitly selected file to automatically selected ones. if test -n "$CONFIG_SITE"; then - ac_site_file1=$CONFIG_SITE + set x "$CONFIG_SITE" elif test "x$prefix" != xNONE; then - ac_site_file1=$prefix/share/config.site - ac_site_file2=$prefix/etc/config.site + set x "$prefix/share/config.site" "$prefix/etc/config.site" else - ac_site_file1=$ac_default_prefix/share/config.site - ac_site_file2=$ac_default_prefix/etc/config.site + set x "$ac_default_prefix/share/config.site" \ + "$ac_default_prefix/etc/config.site" fi -for ac_site_file in "$ac_site_file1" "$ac_site_file2" +shift +for ac_site_file do - test "x$ac_site_file" = xNONE && continue if test -r "$ac_site_file"; then - { $as_echo "$as_me:$LINENO: loading site script $ac_site_file" >&5 -$as_echo "$as_me: loading site script $ac_site_file" >&6;} + { echo "$as_me:$LINENO: loading site script $ac_site_file" >&5 +echo "$as_me: loading site script $ac_site_file" >&6;} sed 's/^/| /' "$ac_site_file" >&5 . "$ac_site_file" fi @@ -1826,16 +1715,16 @@ # Some versions of bash will fail to source /dev/null (special # files actually), so we avoid doing that. if test -f "$cache_file"; then - { $as_echo "$as_me:$LINENO: loading cache $cache_file" >&5 -$as_echo "$as_me: loading cache $cache_file" >&6;} + { echo "$as_me:$LINENO: loading cache $cache_file" >&5 +echo "$as_me: loading cache $cache_file" >&6;} case $cache_file in [\\/]* | ?:[\\/]* ) . "$cache_file";; *) . "./$cache_file";; esac fi else - { $as_echo "$as_me:$LINENO: creating cache $cache_file" >&5 -$as_echo "$as_me: creating cache $cache_file" >&6;} + { echo "$as_me:$LINENO: creating cache $cache_file" >&5 +echo "$as_me: creating cache $cache_file" >&6;} >$cache_file fi @@ -1849,38 +1738,29 @@ eval ac_new_val=\$ac_env_${ac_var}_value case $ac_old_set,$ac_new_set in set,) - { $as_echo "$as_me:$LINENO: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 -$as_echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} + { echo "$as_me:$LINENO: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 +echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} ac_cache_corrupted=: ;; ,set) - { $as_echo "$as_me:$LINENO: error: \`$ac_var' was not set in the previous run" >&5 -$as_echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} + { echo "$as_me:$LINENO: error: \`$ac_var' was not set in the previous run" >&5 +echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} ac_cache_corrupted=: ;; ,);; *) if test "x$ac_old_val" != "x$ac_new_val"; then - # differences in whitespace do not lead to failure. - ac_old_val_w=`echo x $ac_old_val` - ac_new_val_w=`echo x $ac_new_val` - if test "$ac_old_val_w" != "$ac_new_val_w"; then - { $as_echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5 -$as_echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} - ac_cache_corrupted=: - else - { $as_echo "$as_me:$LINENO: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5 -$as_echo "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;} - eval $ac_var=\$ac_old_val - fi - { $as_echo "$as_me:$LINENO: former value: \`$ac_old_val'" >&5 -$as_echo "$as_me: former value: \`$ac_old_val'" >&2;} - { $as_echo "$as_me:$LINENO: current value: \`$ac_new_val'" >&5 -$as_echo "$as_me: current value: \`$ac_new_val'" >&2;} + { echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5 +echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} + { echo "$as_me:$LINENO: former value: $ac_old_val" >&5 +echo "$as_me: former value: $ac_old_val" >&2;} + { echo "$as_me:$LINENO: current value: $ac_new_val" >&5 +echo "$as_me: current value: $ac_new_val" >&2;} + ac_cache_corrupted=: fi;; esac # Pass precious variables to config.status. if test "$ac_new_set" = set; then case $ac_new_val in - *\'*) ac_arg=$ac_var=`$as_echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; + *\'*) ac_arg=$ac_var=`echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; *) ac_arg=$ac_var=$ac_new_val ;; esac case " $ac_configure_args " in @@ -1890,12 +1770,10 @@ fi done if $ac_cache_corrupted; then - { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} - { $as_echo "$as_me:$LINENO: error: changes in the environment can compromise the build" >&5 -$as_echo "$as_me: error: changes in the environment can compromise the build" >&2;} - { { $as_echo "$as_me:$LINENO: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5 -$as_echo "$as_me: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&2;} + { echo "$as_me:$LINENO: error: changes in the environment can compromise the build" >&5 +echo "$as_me: error: changes in the environment can compromise the build" >&2;} + { { echo "$as_me:$LINENO: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5 +echo "$as_me: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&2;} { (exit 1); exit 1; }; } fi @@ -2037,20 +1915,20 @@ UNIVERSAL_ARCHS="32-bit" -{ $as_echo "$as_me:$LINENO: checking for --with-universal-archs" >&5 -$as_echo_n "checking for --with-universal-archs... " >&6; } +{ echo "$as_me:$LINENO: checking for --with-universal-archs" >&5 +echo $ECHO_N "checking for --with-universal-archs... $ECHO_C" >&6; } # Check whether --with-universal-archs was given. if test "${with_universal_archs+set}" = set; then withval=$with_universal_archs; - { $as_echo "$as_me:$LINENO: result: $withval" >&5 -$as_echo "$withval" >&6; } + { echo "$as_me:$LINENO: result: $withval" >&5 +echo "${ECHO_T}$withval" >&6; } UNIVERSAL_ARCHS="$withval" else - { $as_echo "$as_me:$LINENO: result: 32-bit" >&5 -$as_echo "32-bit" >&6; } + { echo "$as_me:$LINENO: result: 32-bit" >&5 +echo "${ECHO_T}32-bit" >&6; } fi @@ -2174,8 +2052,8 @@ ## # Set name for machine-dependent library files -{ $as_echo "$as_me:$LINENO: checking MACHDEP" >&5 -$as_echo_n "checking MACHDEP... " >&6; } +{ echo "$as_me:$LINENO: checking MACHDEP" >&5 +echo $ECHO_N "checking MACHDEP... $ECHO_C" >&6; } if test -z "$MACHDEP" then ac_sys_system=`uname -s` @@ -2338,14 +2216,14 @@ LDFLAGS="$SGI_ABI $LDFLAGS" MACHDEP=`echo "${MACHDEP}${SGI_ABI}" | sed 's/ *//g'` fi -{ $as_echo "$as_me:$LINENO: result: $MACHDEP" >&5 -$as_echo "$MACHDEP" >&6; } +{ echo "$as_me:$LINENO: result: $MACHDEP" >&5 +echo "${ECHO_T}$MACHDEP" >&6; } # And add extra plat-mac for darwin -{ $as_echo "$as_me:$LINENO: checking EXTRAPLATDIR" >&5 -$as_echo_n "checking EXTRAPLATDIR... " >&6; } +{ echo "$as_me:$LINENO: checking EXTRAPLATDIR" >&5 +echo $ECHO_N "checking EXTRAPLATDIR... $ECHO_C" >&6; } if test -z "$EXTRAPLATDIR" then case $MACHDEP in @@ -2359,8 +2237,8 @@ ;; esac fi -{ $as_echo "$as_me:$LINENO: result: $EXTRAPLATDIR" >&5 -$as_echo "$EXTRAPLATDIR" >&6; } +{ echo "$as_me:$LINENO: result: $EXTRAPLATDIR" >&5 +echo "${ECHO_T}$EXTRAPLATDIR" >&6; } # Record the configure-time value of MACOSX_DEPLOYMENT_TARGET, # it may influence the way we can build extensions, so distutils @@ -2370,11 +2248,11 @@ CONFIGURE_MACOSX_DEPLOYMENT_TARGET= EXPORT_MACOSX_DEPLOYMENT_TARGET='#' -{ $as_echo "$as_me:$LINENO: checking machine type as reported by uname -m" >&5 -$as_echo_n "checking machine type as reported by uname -m... " >&6; } +{ echo "$as_me:$LINENO: checking machine type as reported by uname -m" >&5 +echo $ECHO_N "checking machine type as reported by uname -m... $ECHO_C" >&6; } ac_sys_machine=`uname -m` -{ $as_echo "$as_me:$LINENO: result: $ac_sys_machine" >&5 -$as_echo "$ac_sys_machine" >&6; } +{ echo "$as_me:$LINENO: result: $ac_sys_machine" >&5 +echo "${ECHO_T}$ac_sys_machine" >&6; } # checks for alternative programs @@ -2386,8 +2264,8 @@ # XXX shouldn't some/most/all of this code be merged with the stuff later # on that fiddles with OPT and BASECFLAGS? -{ $as_echo "$as_me:$LINENO: checking for --without-gcc" >&5 -$as_echo_n "checking for --without-gcc... " >&6; } +{ echo "$as_me:$LINENO: checking for --without-gcc" >&5 +echo $ECHO_N "checking for --without-gcc... $ECHO_C" >&6; } # Check whether --with-gcc was given. if test "${with_gcc+set}" = set; then @@ -2420,8 +2298,8 @@ OPT="$OPT -O" ;; *) - { { $as_echo "$as_me:$LINENO: error: Unknown BeOS platform \"$BE_HOST_CPU\"" >&5 -$as_echo "$as_me: error: Unknown BeOS platform \"$BE_HOST_CPU\"" >&2;} + { { echo "$as_me:$LINENO: error: Unknown BeOS platform \"$BE_HOST_CPU\"" >&5 +echo "$as_me: error: Unknown BeOS platform \"$BE_HOST_CPU\"" >&2;} { (exit 1); exit 1; }; } ;; esac @@ -2435,15 +2313,15 @@ esac fi -{ $as_echo "$as_me:$LINENO: result: $without_gcc" >&5 -$as_echo "$without_gcc" >&6; } +{ echo "$as_me:$LINENO: result: $without_gcc" >&5 +echo "${ECHO_T}$without_gcc" >&6; } # If the user switches compilers, we can't believe the cache if test ! -z "$ac_cv_prog_CC" -a ! -z "$CC" -a "$CC" != "$ac_cv_prog_CC" then - { { $as_echo "$as_me:$LINENO: error: cached CC is different -- throw away $cache_file + { { echo "$as_me:$LINENO: error: cached CC is different -- throw away $cache_file (it is also a good idea to do 'make clean' before compiling)" >&5 -$as_echo "$as_me: error: cached CC is different -- throw away $cache_file +echo "$as_me: error: cached CC is different -- throw away $cache_file (it is also a good idea to do 'make clean' before compiling)" >&2;} { (exit 1); exit 1; }; } fi @@ -2456,10 +2334,10 @@ if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. set dummy ${ac_tool_prefix}gcc; ac_word=$2 -{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } if test "${ac_cv_prog_CC+set}" = set; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. @@ -2472,7 +2350,7 @@ for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CC="${ac_tool_prefix}gcc" - $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -2483,11 +2361,11 @@ fi CC=$ac_cv_prog_CC if test -n "$CC"; then - { $as_echo "$as_me:$LINENO: result: $CC" >&5 -$as_echo "$CC" >&6; } + { echo "$as_me:$LINENO: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6; } else - { $as_echo "$as_me:$LINENO: result: no" >&5 -$as_echo "no" >&6; } + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } fi @@ -2496,10 +2374,10 @@ ac_ct_CC=$CC # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 -{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } if test "${ac_cv_prog_ac_ct_CC+set}" = set; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. @@ -2512,7 +2390,7 @@ for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_CC="gcc" - $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -2523,11 +2401,11 @@ fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then - { $as_echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 -$as_echo "$ac_ct_CC" >&6; } + { echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 +echo "${ECHO_T}$ac_ct_CC" >&6; } else - { $as_echo "$as_me:$LINENO: result: no" >&5 -$as_echo "no" >&6; } + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } fi if test "x$ac_ct_CC" = x; then @@ -2535,8 +2413,12 @@ else case $cross_compiling:$ac_tool_warned in yes:) -{ $as_echo "$as_me:$LINENO: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools +whose name does not start with the host triplet. If you think this +configuration is useful to you, please write to autoconf at gnu.org." >&5 +echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools +whose name does not start with the host triplet. If you think this +configuration is useful to you, please write to autoconf at gnu.org." >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC @@ -2549,10 +2431,10 @@ if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. set dummy ${ac_tool_prefix}cc; ac_word=$2 -{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } if test "${ac_cv_prog_CC+set}" = set; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. @@ -2565,7 +2447,7 @@ for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CC="${ac_tool_prefix}cc" - $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -2576,11 +2458,11 @@ fi CC=$ac_cv_prog_CC if test -n "$CC"; then - { $as_echo "$as_me:$LINENO: result: $CC" >&5 -$as_echo "$CC" >&6; } + { echo "$as_me:$LINENO: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6; } else - { $as_echo "$as_me:$LINENO: result: no" >&5 -$as_echo "no" >&6; } + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } fi @@ -2589,10 +2471,10 @@ if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 -{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } if test "${ac_cv_prog_CC+set}" = set; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. @@ -2610,7 +2492,7 @@ continue fi ac_cv_prog_CC="cc" - $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -2633,11 +2515,11 @@ fi CC=$ac_cv_prog_CC if test -n "$CC"; then - { $as_echo "$as_me:$LINENO: result: $CC" >&5 -$as_echo "$CC" >&6; } + { echo "$as_me:$LINENO: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6; } else - { $as_echo "$as_me:$LINENO: result: no" >&5 -$as_echo "no" >&6; } + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } fi @@ -2648,10 +2530,10 @@ do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 -{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } if test "${ac_cv_prog_CC+set}" = set; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. @@ -2664,7 +2546,7 @@ for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CC="$ac_tool_prefix$ac_prog" - $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -2675,11 +2557,11 @@ fi CC=$ac_cv_prog_CC if test -n "$CC"; then - { $as_echo "$as_me:$LINENO: result: $CC" >&5 -$as_echo "$CC" >&6; } + { echo "$as_me:$LINENO: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6; } else - { $as_echo "$as_me:$LINENO: result: no" >&5 -$as_echo "no" >&6; } + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } fi @@ -2692,10 +2574,10 @@ do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 -{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } if test "${ac_cv_prog_ac_ct_CC+set}" = set; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. @@ -2708,7 +2590,7 @@ for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_CC="$ac_prog" - $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -2719,11 +2601,11 @@ fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then - { $as_echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 -$as_echo "$ac_ct_CC" >&6; } + { echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 +echo "${ECHO_T}$ac_ct_CC" >&6; } else - { $as_echo "$as_me:$LINENO: result: no" >&5 -$as_echo "no" >&6; } + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } fi @@ -2735,8 +2617,12 @@ else case $cross_compiling:$ac_tool_warned in yes:) -{ $as_echo "$as_me:$LINENO: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools +whose name does not start with the host triplet. If you think this +configuration is useful to you, please write to autoconf at gnu.org." >&5 +echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools +whose name does not start with the host triplet. If you think this +configuration is useful to you, please write to autoconf at gnu.org." >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC @@ -2746,50 +2632,44 @@ fi -test -z "$CC" && { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -{ { $as_echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH +test -z "$CC" && { { echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH See \`config.log' for more details." >&5 -$as_echo "$as_me: error: no acceptable C compiler found in \$PATH +echo "$as_me: error: no acceptable C compiler found in \$PATH See \`config.log' for more details." >&2;} - { (exit 1); exit 1; }; }; } + { (exit 1); exit 1; }; } # Provide some information about the compiler. -$as_echo "$as_me:$LINENO: checking for C compiler version" >&5 -set X $ac_compile -ac_compiler=$2 +echo "$as_me:$LINENO: checking for C compiler version" >&5 +ac_compiler=`set X $ac_compile; echo $2` { (ac_try="$ac_compiler --version >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compiler --version >&5") 2>&5 ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } { (ac_try="$ac_compiler -v >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compiler -v >&5") 2>&5 ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } { (ac_try="$ac_compiler -V >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compiler -V >&5") 2>&5 ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } cat >conftest.$ac_ext <<_ACEOF @@ -2808,22 +2688,27 @@ } _ACEOF ac_clean_files_save=$ac_clean_files -ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out" +ac_clean_files="$ac_clean_files a.out a.exe b.out" # Try to create an executable without -o first, disregard a.out. # It will help us diagnose broken compilers, and finding out an intuition # of exeext. -{ $as_echo "$as_me:$LINENO: checking for C compiler default output file name" >&5 -$as_echo_n "checking for C compiler default output file name... " >&6; } -ac_link_default=`$as_echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` - -# The possible output files: -ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*" - +{ echo "$as_me:$LINENO: checking for C compiler default output file name" >&5 +echo $ECHO_N "checking for C compiler default output file name... $ECHO_C" >&6; } +ac_link_default=`echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` +# +# List of possible output files, starting from the most likely. +# The algorithm is not robust to junk in `.', hence go to wildcards (a.*) +# only as a last resort. b.out is created by i960 compilers. +ac_files='a_out.exe a.exe conftest.exe a.out conftest a.* conftest.* b.out' +# +# The IRIX 6 linker writes into existing files which may not be +# executable, retaining their permissions. Remove them first so a +# subsequent execution test works. ac_rmfiles= for ac_file in $ac_files do case $ac_file in - *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.o | *.obj ) ;; * ) ac_rmfiles="$ac_rmfiles $ac_file";; esac done @@ -2834,11 +2719,10 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link_default") 2>&5 ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then # Autoconf-2.13 could set the ac_cv_exeext variable to `no'. # So ignore a value of `no', otherwise this would lead to `EXEEXT = no' @@ -2849,7 +2733,7 @@ do test -f "$ac_file" || continue case $ac_file in - *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.o | *.obj ) ;; [ab].out ) # We found the default executable, but exeext='' is most @@ -2876,27 +2760,25 @@ ac_file='' fi -{ $as_echo "$as_me:$LINENO: result: $ac_file" >&5 -$as_echo "$ac_file" >&6; } +{ echo "$as_me:$LINENO: result: $ac_file" >&5 +echo "${ECHO_T}$ac_file" >&6; } if test -z "$ac_file"; then - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -{ { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -{ { $as_echo "$as_me:$LINENO: error: C compiler cannot create executables +{ { echo "$as_me:$LINENO: error: C compiler cannot create executables See \`config.log' for more details." >&5 -$as_echo "$as_me: error: C compiler cannot create executables +echo "$as_me: error: C compiler cannot create executables See \`config.log' for more details." >&2;} - { (exit 77); exit 77; }; }; } + { (exit 77); exit 77; }; } fi ac_exeext=$ac_cv_exeext # Check that the compiler produces executables we can run. If not, either # the compiler is broken, or we cross compile. -{ $as_echo "$as_me:$LINENO: checking whether the C compiler works" >&5 -$as_echo_n "checking whether the C compiler works... " >&6; } +{ echo "$as_me:$LINENO: checking whether the C compiler works" >&5 +echo $ECHO_N "checking whether the C compiler works... $ECHO_C" >&6; } # FIXME: These cross compiler hacks should be removed for Autoconf 3.0 # If not cross compiling, check that we can run a simple program. if test "$cross_compiling" != yes; then @@ -2905,53 +2787,49 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_try") 2>&5 ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then cross_compiling=no else if test "$cross_compiling" = maybe; then cross_compiling=yes else - { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -{ { $as_echo "$as_me:$LINENO: error: cannot run C compiled programs. + { { echo "$as_me:$LINENO: error: cannot run C compiled programs. If you meant to cross compile, use \`--host'. See \`config.log' for more details." >&5 -$as_echo "$as_me: error: cannot run C compiled programs. +echo "$as_me: error: cannot run C compiled programs. If you meant to cross compile, use \`--host'. See \`config.log' for more details." >&2;} - { (exit 1); exit 1; }; }; } + { (exit 1); exit 1; }; } fi fi fi -{ $as_echo "$as_me:$LINENO: result: yes" >&5 -$as_echo "yes" >&6; } +{ echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; } -rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out +rm -f a.out a.exe conftest$ac_cv_exeext b.out ac_clean_files=$ac_clean_files_save # Check that the compiler produces executables we can run. If not, either # the compiler is broken, or we cross compile. -{ $as_echo "$as_me:$LINENO: checking whether we are cross compiling" >&5 -$as_echo_n "checking whether we are cross compiling... " >&6; } -{ $as_echo "$as_me:$LINENO: result: $cross_compiling" >&5 -$as_echo "$cross_compiling" >&6; } +{ echo "$as_me:$LINENO: checking whether we are cross compiling" >&5 +echo $ECHO_N "checking whether we are cross compiling... $ECHO_C" >&6; } +{ echo "$as_me:$LINENO: result: $cross_compiling" >&5 +echo "${ECHO_T}$cross_compiling" >&6; } -{ $as_echo "$as_me:$LINENO: checking for suffix of executables" >&5 -$as_echo_n "checking for suffix of executables... " >&6; } +{ echo "$as_me:$LINENO: checking for suffix of executables" >&5 +echo $ECHO_N "checking for suffix of executables... $ECHO_C" >&6; } if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>&5 ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then # If both `conftest.exe' and `conftest' are `present' (well, observable) # catch `conftest.exe'. For instance with Cygwin, `ls conftest' will @@ -2960,33 +2838,31 @@ for ac_file in conftest.exe conftest conftest.*; do test -f "$ac_file" || continue case $ac_file in - *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.o | *.obj ) ;; *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` break;; * ) break;; esac done else - { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -{ { $as_echo "$as_me:$LINENO: error: cannot compute suffix of executables: cannot compile and link + { { echo "$as_me:$LINENO: error: cannot compute suffix of executables: cannot compile and link See \`config.log' for more details." >&5 -$as_echo "$as_me: error: cannot compute suffix of executables: cannot compile and link +echo "$as_me: error: cannot compute suffix of executables: cannot compile and link See \`config.log' for more details." >&2;} - { (exit 1); exit 1; }; }; } + { (exit 1); exit 1; }; } fi rm -f conftest$ac_cv_exeext -{ $as_echo "$as_me:$LINENO: result: $ac_cv_exeext" >&5 -$as_echo "$ac_cv_exeext" >&6; } +{ echo "$as_me:$LINENO: result: $ac_cv_exeext" >&5 +echo "${ECHO_T}$ac_cv_exeext" >&6; } rm -f conftest.$ac_ext EXEEXT=$ac_cv_exeext ac_exeext=$EXEEXT -{ $as_echo "$as_me:$LINENO: checking for suffix of object files" >&5 -$as_echo_n "checking for suffix of object files... " >&6; } +{ echo "$as_me:$LINENO: checking for suffix of object files" >&5 +echo $ECHO_N "checking for suffix of object files... $ECHO_C" >&6; } if test "${ac_cv_objext+set}" = set; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ @@ -3009,43 +2885,40 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>&5 ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then for ac_file in conftest.o conftest.obj conftest.*; do test -f "$ac_file" || continue; case $ac_file in - *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM ) ;; + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf ) ;; *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` break;; esac done else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -{ { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -{ { $as_echo "$as_me:$LINENO: error: cannot compute suffix of object files: cannot compile +{ { echo "$as_me:$LINENO: error: cannot compute suffix of object files: cannot compile See \`config.log' for more details." >&5 -$as_echo "$as_me: error: cannot compute suffix of object files: cannot compile +echo "$as_me: error: cannot compute suffix of object files: cannot compile See \`config.log' for more details." >&2;} - { (exit 1); exit 1; }; }; } + { (exit 1); exit 1; }; } fi rm -f conftest.$ac_cv_objext conftest.$ac_ext fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_objext" >&5 -$as_echo "$ac_cv_objext" >&6; } +{ echo "$as_me:$LINENO: result: $ac_cv_objext" >&5 +echo "${ECHO_T}$ac_cv_objext" >&6; } OBJEXT=$ac_cv_objext ac_objext=$OBJEXT -{ $as_echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5 -$as_echo_n "checking whether we are using the GNU C compiler... " >&6; } +{ echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5 +echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6; } if test "${ac_cv_c_compiler_gnu+set}" = set; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ @@ -3071,21 +2944,20 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_compiler_gnu=yes else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_compiler_gnu=no @@ -3095,19 +2967,15 @@ ac_cv_c_compiler_gnu=$ac_compiler_gnu fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5 -$as_echo "$ac_cv_c_compiler_gnu" >&6; } -if test $ac_compiler_gnu = yes; then - GCC=yes -else - GCC= -fi +{ echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5 +echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6; } +GCC=`test $ac_compiler_gnu = yes && echo yes` ac_test_CFLAGS=${CFLAGS+set} ac_save_CFLAGS=$CFLAGS -{ $as_echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5 -$as_echo_n "checking whether $CC accepts -g... " >&6; } +{ echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5 +echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6; } if test "${ac_cv_prog_cc_g+set}" = set; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_save_c_werror_flag=$ac_c_werror_flag ac_c_werror_flag=yes @@ -3134,21 +3002,20 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_prog_cc_g=yes else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 CFLAGS="" @@ -3173,21 +3040,20 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then : else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_c_werror_flag=$ac_save_c_werror_flag @@ -3213,21 +3079,20 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_prog_cc_g=yes else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 @@ -3242,8 +3107,8 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_c_werror_flag=$ac_save_c_werror_flag fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5 -$as_echo "$ac_cv_prog_cc_g" >&6; } +{ echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5 +echo "${ECHO_T}$ac_cv_prog_cc_g" >&6; } if test "$ac_test_CFLAGS" = set; then CFLAGS=$ac_save_CFLAGS elif test $ac_cv_prog_cc_g = yes; then @@ -3259,10 +3124,10 @@ CFLAGS= fi fi -{ $as_echo "$as_me:$LINENO: checking for $CC option to accept ISO C89" >&5 -$as_echo_n "checking for $CC option to accept ISO C89... " >&6; } +{ echo "$as_me:$LINENO: checking for $CC option to accept ISO C89" >&5 +echo $ECHO_N "checking for $CC option to accept ISO C89... $ECHO_C" >&6; } if test "${ac_cv_prog_cc_c89+set}" = set; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_cv_prog_cc_c89=no ac_save_CC=$CC @@ -3333,21 +3198,20 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_prog_cc_c89=$ac_arg else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 @@ -3363,15 +3227,15 @@ # AC_CACHE_VAL case "x$ac_cv_prog_cc_c89" in x) - { $as_echo "$as_me:$LINENO: result: none needed" >&5 -$as_echo "none needed" >&6; } ;; + { echo "$as_me:$LINENO: result: none needed" >&5 +echo "${ECHO_T}none needed" >&6; } ;; xno) - { $as_echo "$as_me:$LINENO: result: unsupported" >&5 -$as_echo "unsupported" >&6; } ;; + { echo "$as_me:$LINENO: result: unsupported" >&5 +echo "${ECHO_T}unsupported" >&6; } ;; *) CC="$CC $ac_cv_prog_cc_c89" - { $as_echo "$as_me:$LINENO: result: $ac_cv_prog_cc_c89" >&5 -$as_echo "$ac_cv_prog_cc_c89" >&6; } ;; + { echo "$as_me:$LINENO: result: $ac_cv_prog_cc_c89" >&5 +echo "${ECHO_T}$ac_cv_prog_cc_c89" >&6; } ;; esac @@ -3384,8 +3248,8 @@ -{ $as_echo "$as_me:$LINENO: checking for --with-cxx-main=" >&5 -$as_echo_n "checking for --with-cxx-main=... " >&6; } +{ echo "$as_me:$LINENO: checking for --with-cxx-main=" >&5 +echo $ECHO_N "checking for --with-cxx-main=... $ECHO_C" >&6; } # Check whether --with-cxx_main was given. if test "${with_cxx_main+set}" = set; then @@ -3410,8 +3274,8 @@ fi -{ $as_echo "$as_me:$LINENO: result: $with_cxx_main" >&5 -$as_echo "$with_cxx_main" >&6; } +{ echo "$as_me:$LINENO: result: $with_cxx_main" >&5 +echo "${ECHO_T}$with_cxx_main" >&6; } preset_cxx="$CXX" if test -z "$CXX" @@ -3419,10 +3283,10 @@ case "$CC" in gcc) # Extract the first word of "g++", so it can be a program name with args. set dummy g++; ac_word=$2 -{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } if test "${ac_cv_path_CXX+set}" = set; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else case $CXX in [\\/]* | ?:[\\/]*) @@ -3437,7 +3301,7 @@ for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_path_CXX="$as_dir/$ac_word$ac_exec_ext" - $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -3450,20 +3314,20 @@ fi CXX=$ac_cv_path_CXX if test -n "$CXX"; then - { $as_echo "$as_me:$LINENO: result: $CXX" >&5 -$as_echo "$CXX" >&6; } + { echo "$as_me:$LINENO: result: $CXX" >&5 +echo "${ECHO_T}$CXX" >&6; } else - { $as_echo "$as_me:$LINENO: result: no" >&5 -$as_echo "no" >&6; } + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } fi ;; cc) # Extract the first word of "c++", so it can be a program name with args. set dummy c++; ac_word=$2 -{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } if test "${ac_cv_path_CXX+set}" = set; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else case $CXX in [\\/]* | ?:[\\/]*) @@ -3478,7 +3342,7 @@ for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_path_CXX="$as_dir/$ac_word$ac_exec_ext" - $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -3491,11 +3355,11 @@ fi CXX=$ac_cv_path_CXX if test -n "$CXX"; then - { $as_echo "$as_me:$LINENO: result: $CXX" >&5 -$as_echo "$CXX" >&6; } + { echo "$as_me:$LINENO: result: $CXX" >&5 +echo "${ECHO_T}$CXX" >&6; } else - { $as_echo "$as_me:$LINENO: result: no" >&5 -$as_echo "no" >&6; } + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } fi ;; @@ -3511,10 +3375,10 @@ do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 -{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } if test "${ac_cv_prog_CXX+set}" = set; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CXX"; then ac_cv_prog_CXX="$CXX" # Let the user override the test. @@ -3527,7 +3391,7 @@ for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CXX="$ac_prog" - $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -3538,11 +3402,11 @@ fi CXX=$ac_cv_prog_CXX if test -n "$CXX"; then - { $as_echo "$as_me:$LINENO: result: $CXX" >&5 -$as_echo "$CXX" >&6; } + { echo "$as_me:$LINENO: result: $CXX" >&5 +echo "${ECHO_T}$CXX" >&6; } else - { $as_echo "$as_me:$LINENO: result: no" >&5 -$as_echo "no" >&6; } + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } fi @@ -3557,12 +3421,12 @@ fi if test "$preset_cxx" != "$CXX" then - { $as_echo "$as_me:$LINENO: WARNING: + { echo "$as_me:$LINENO: WARNING: By default, distutils will build C++ extension modules with \"$CXX\". If this is not intended, then set CXX on the configure command line. " >&5 -$as_echo "$as_me: WARNING: +echo "$as_me: WARNING: By default, distutils will build C++ extension modules with \"$CXX\". If this is not intended, then set CXX on the configure command line. @@ -3577,15 +3441,15 @@ ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu -{ $as_echo "$as_me:$LINENO: checking how to run the C preprocessor" >&5 -$as_echo_n "checking how to run the C preprocessor... " >&6; } +{ echo "$as_me:$LINENO: checking how to run the C preprocessor" >&5 +echo $ECHO_N "checking how to run the C preprocessor... $ECHO_C" >&6; } # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= fi if test -z "$CPP"; then if test "${ac_cv_prog_CPP+set}" = set; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else # Double quotes because CPP needs to be expanded for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" @@ -3617,21 +3481,20 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then : else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Broken: fails on valid input. @@ -3655,14 +3518,13 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err @@ -3670,7 +3532,7 @@ # Broken: success on invalid input. continue else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Passes both tests. @@ -3695,8 +3557,8 @@ else ac_cv_prog_CPP=$CPP fi -{ $as_echo "$as_me:$LINENO: result: $CPP" >&5 -$as_echo "$CPP" >&6; } +{ echo "$as_me:$LINENO: result: $CPP" >&5 +echo "${ECHO_T}$CPP" >&6; } ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do @@ -3724,21 +3586,20 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then : else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Broken: fails on valid input. @@ -3762,14 +3623,13 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err @@ -3777,7 +3637,7 @@ # Broken: success on invalid input. continue else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Passes both tests. @@ -3793,13 +3653,11 @@ if $ac_preproc_ok; then : else - { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -{ { $as_echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check + { { echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check See \`config.log' for more details." >&5 -$as_echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check +echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check See \`config.log' for more details." >&2;} - { (exit 1); exit 1; }; }; } + { (exit 1); exit 1; }; } fi ac_ext=c @@ -3809,37 +3667,42 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu -{ $as_echo "$as_me:$LINENO: checking for grep that handles long lines and -e" >&5 -$as_echo_n "checking for grep that handles long lines and -e... " >&6; } +{ echo "$as_me:$LINENO: checking for grep that handles long lines and -e" >&5 +echo $ECHO_N "checking for grep that handles long lines and -e... $ECHO_C" >&6; } +if test "${ac_cv_path_GREP+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + # Extract the first word of "grep ggrep" to use in msg output +if test -z "$GREP"; then +set dummy grep ggrep; ac_prog_name=$2 if test "${ac_cv_path_GREP+set}" = set; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else - if test -z "$GREP"; then ac_path_GREP_found=false - # Loop through the user's path and test for each of PROGNAME-LIST - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +# Loop through the user's path and test for each of PROGNAME-LIST +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in grep ggrep; do - for ac_exec_ext in '' $ac_executable_extensions; do - ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext" - { test -f "$ac_path_GREP" && $as_test_x "$ac_path_GREP"; } || continue -# Check for GNU ac_path_GREP and select it if it is found. + for ac_exec_ext in '' $ac_executable_extensions; do + ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext" + { test -f "$ac_path_GREP" && $as_test_x "$ac_path_GREP"; } || continue + # Check for GNU ac_path_GREP and select it if it is found. # Check for GNU $ac_path_GREP case `"$ac_path_GREP" --version 2>&1` in *GNU*) ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;; *) ac_count=0 - $as_echo_n 0123456789 >"conftest.in" + echo $ECHO_N "0123456789$ECHO_C" >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" - $as_echo 'GREP' >> "conftest.nl" + echo 'GREP' >> "conftest.nl" "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break ac_count=`expr $ac_count + 1` @@ -3850,582 +3713,149 @@ fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break - done - rm -f conftest.in conftest.tmp conftest.nl conftest.out;; -esac - - $ac_path_GREP_found && break 3 - done - done -done -IFS=$as_save_IFS - if test -z "$ac_cv_path_GREP"; then - { { $as_echo "$as_me:$LINENO: error: no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&5 -$as_echo "$as_me: error: no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&2;} - { (exit 1); exit 1; }; } - fi -else - ac_cv_path_GREP=$GREP -fi - -fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_path_GREP" >&5 -$as_echo "$ac_cv_path_GREP" >&6; } - GREP="$ac_cv_path_GREP" - - -{ $as_echo "$as_me:$LINENO: checking for egrep" >&5 -$as_echo_n "checking for egrep... " >&6; } -if test "${ac_cv_path_EGREP+set}" = set; then - $as_echo_n "(cached) " >&6 -else - if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 - then ac_cv_path_EGREP="$GREP -E" - else - if test -z "$EGREP"; then - ac_path_EGREP_found=false - # Loop through the user's path and test for each of PROGNAME-LIST - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_prog in egrep; do - for ac_exec_ext in '' $ac_executable_extensions; do - ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext" - { test -f "$ac_path_EGREP" && $as_test_x "$ac_path_EGREP"; } || continue -# Check for GNU ac_path_EGREP and select it if it is found. - # Check for GNU $ac_path_EGREP -case `"$ac_path_EGREP" --version 2>&1` in -*GNU*) - ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;; -*) - ac_count=0 - $as_echo_n 0123456789 >"conftest.in" - while : - do - cat "conftest.in" "conftest.in" >"conftest.tmp" - mv "conftest.tmp" "conftest.in" - cp "conftest.in" "conftest.nl" - $as_echo 'EGREP' >> "conftest.nl" - "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break - diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break - ac_count=`expr $ac_count + 1` - if test $ac_count -gt ${ac_path_EGREP_max-0}; then - # Best one so far, save it but keep looking for a better one - ac_cv_path_EGREP="$ac_path_EGREP" - ac_path_EGREP_max=$ac_count - fi - # 10*(2^10) chars as input seems more than enough - test $ac_count -gt 10 && break - done - rm -f conftest.in conftest.tmp conftest.nl conftest.out;; -esac - - $ac_path_EGREP_found && break 3 - done - done -done -IFS=$as_save_IFS - if test -z "$ac_cv_path_EGREP"; then - { { $as_echo "$as_me:$LINENO: error: no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&5 -$as_echo "$as_me: error: no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&2;} - { (exit 1); exit 1; }; } - fi -else - ac_cv_path_EGREP=$EGREP -fi - - fi -fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_path_EGREP" >&5 -$as_echo "$ac_cv_path_EGREP" >&6; } - EGREP="$ac_cv_path_EGREP" - - -{ $as_echo "$as_me:$LINENO: checking for ANSI C header files" >&5 -$as_echo_n "checking for ANSI C header files... " >&6; } -if test "${ac_cv_header_stdc+set}" = set; then - $as_echo_n "(cached) " >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include -#include -#include -#include - -int -main () -{ - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - ac_cv_header_stdc=yes -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_cv_header_stdc=no -fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - -if test $ac_cv_header_stdc = yes; then - # SunOS 4.x string.h does not declare mem*, contrary to ANSI. - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include - -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "memchr" >/dev/null 2>&1; then - : -else - ac_cv_header_stdc=no -fi -rm -f conftest* - -fi - -if test $ac_cv_header_stdc = yes; then - # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include - -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "free" >/dev/null 2>&1; then - : -else - ac_cv_header_stdc=no -fi -rm -f conftest* - -fi - -if test $ac_cv_header_stdc = yes; then - # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. - if test "$cross_compiling" = yes; then - : -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include -#include -#if ((' ' & 0x0FF) == 0x020) -# define ISLOWER(c) ('a' <= (c) && (c) <= 'z') -# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) -#else -# define ISLOWER(c) \ - (('a' <= (c) && (c) <= 'i') \ - || ('j' <= (c) && (c) <= 'r') \ - || ('s' <= (c) && (c) <= 'z')) -# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) -#endif - -#define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) -int -main () -{ - int i; - for (i = 0; i < 256; i++) - if (XOR (islower (i), ISLOWER (i)) - || toupper (i) != TOUPPER (i)) - return 2; - return 0; -} -_ACEOF -rm -f conftest$ac_exeext -if { (ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_link") 2>&5 - ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { ac_try='./conftest$ac_exeext' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - : -else - $as_echo "$as_me: program exited with status $ac_status" >&5 -$as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -( exit $ac_status ) -ac_cv_header_stdc=no -fi -rm -rf conftest.dSYM -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext -fi - - -fi -fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5 -$as_echo "$ac_cv_header_stdc" >&6; } -if test $ac_cv_header_stdc = yes; then - -cat >>confdefs.h <<\_ACEOF -#define STDC_HEADERS 1 -_ACEOF - -fi - -# On IRIX 5.3, sys/types and inttypes.h are conflicting. - - - - - - - - - -for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ - inttypes.h stdint.h unistd.h -do -as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` -{ $as_echo "$as_me:$LINENO: checking for $ac_header" >&5 -$as_echo_n "checking for $ac_header... " >&6; } -if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then - $as_echo_n "(cached) " >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_includes_default - -#include <$ac_header> -_ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - eval "$as_ac_Header=yes" -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - eval "$as_ac_Header=no" -fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -ac_res=`eval 'as_val=${'$as_ac_Header'} - $as_echo "$as_val"'` - { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } -as_val=`eval 'as_val=${'$as_ac_Header'} - $as_echo "$as_val"'` - if test "x$as_val" = x""yes; then - cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 -_ACEOF - -fi - -done - - - - if test "${ac_cv_header_minix_config_h+set}" = set; then - { $as_echo "$as_me:$LINENO: checking for minix/config.h" >&5 -$as_echo_n "checking for minix/config.h... " >&6; } -if test "${ac_cv_header_minix_config_h+set}" = set; then - $as_echo_n "(cached) " >&6 -fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_minix_config_h" >&5 -$as_echo "$ac_cv_header_minix_config_h" >&6; } -else - # Is the header compilable? -{ $as_echo "$as_me:$LINENO: checking minix/config.h usability" >&5 -$as_echo_n "checking minix/config.h usability... " >&6; } -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_includes_default -#include -_ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; + done + rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - ac_header_compiler=yes -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - ac_header_compiler=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 -$as_echo "$ac_header_compiler" >&6; } + $ac_path_GREP_found && break 3 + done +done + +done +IFS=$as_save_IFS -# Is the header present? -{ $as_echo "$as_me:$LINENO: checking minix/config.h presence" >&5 -$as_echo_n "checking minix/config.h presence... " >&6; } -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include -_ACEOF -if { (ac_try="$ac_cpp conftest.$ac_ext" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null && { - test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || - test ! -s conftest.err - }; then - ac_header_preproc=yes -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - ac_header_preproc=no fi -rm -f conftest.err conftest.$ac_ext -{ $as_echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 -$as_echo "$ac_header_preproc" >&6; } +GREP="$ac_cv_path_GREP" +if test -z "$GREP"; then + { { echo "$as_me:$LINENO: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&5 +echo "$as_me: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&2;} + { (exit 1); exit 1; }; } +fi -# So? What about this header? -case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in - yes:no: ) - { $as_echo "$as_me:$LINENO: WARNING: minix/config.h: accepted by the compiler, rejected by the preprocessor!" >&5 -$as_echo "$as_me: WARNING: minix/config.h: accepted by the compiler, rejected by the preprocessor!" >&2;} - { $as_echo "$as_me:$LINENO: WARNING: minix/config.h: proceeding with the compiler's result" >&5 -$as_echo "$as_me: WARNING: minix/config.h: proceeding with the compiler's result" >&2;} - ac_header_preproc=yes - ;; - no:yes:* ) - { $as_echo "$as_me:$LINENO: WARNING: minix/config.h: present but cannot be compiled" >&5 -$as_echo "$as_me: WARNING: minix/config.h: present but cannot be compiled" >&2;} - { $as_echo "$as_me:$LINENO: WARNING: minix/config.h: check for missing prerequisite headers?" >&5 -$as_echo "$as_me: WARNING: minix/config.h: check for missing prerequisite headers?" >&2;} - { $as_echo "$as_me:$LINENO: WARNING: minix/config.h: see the Autoconf documentation" >&5 -$as_echo "$as_me: WARNING: minix/config.h: see the Autoconf documentation" >&2;} - { $as_echo "$as_me:$LINENO: WARNING: minix/config.h: section \"Present But Cannot Be Compiled\"" >&5 -$as_echo "$as_me: WARNING: minix/config.h: section \"Present But Cannot Be Compiled\"" >&2;} - { $as_echo "$as_me:$LINENO: WARNING: minix/config.h: proceeding with the preprocessor's result" >&5 -$as_echo "$as_me: WARNING: minix/config.h: proceeding with the preprocessor's result" >&2;} - { $as_echo "$as_me:$LINENO: WARNING: minix/config.h: in the future, the compiler will take precedence" >&5 -$as_echo "$as_me: WARNING: minix/config.h: in the future, the compiler will take precedence" >&2;} - ( cat <<\_ASBOX -## -------------------------------------- ## -## Report this to http://bugs.python.org/ ## -## -------------------------------------- ## -_ASBOX - ) | sed "s/^/$as_me: WARNING: /" >&2 - ;; -esac -{ $as_echo "$as_me:$LINENO: checking for minix/config.h" >&5 -$as_echo_n "checking for minix/config.h... " >&6; } -if test "${ac_cv_header_minix_config_h+set}" = set; then - $as_echo_n "(cached) " >&6 else - ac_cv_header_minix_config_h=$ac_header_preproc + ac_cv_path_GREP=$GREP fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_minix_config_h" >&5 -$as_echo "$ac_cv_header_minix_config_h" >&6; } + fi -if test "x$ac_cv_header_minix_config_h" = x""yes; then - MINIX=yes +{ echo "$as_me:$LINENO: result: $ac_cv_path_GREP" >&5 +echo "${ECHO_T}$ac_cv_path_GREP" >&6; } + GREP="$ac_cv_path_GREP" + + +{ echo "$as_me:$LINENO: checking for egrep" >&5 +echo $ECHO_N "checking for egrep... $ECHO_C" >&6; } +if test "${ac_cv_path_EGREP+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - MINIX= -fi + if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 + then ac_cv_path_EGREP="$GREP -E" + else + # Extract the first word of "egrep" to use in msg output +if test -z "$EGREP"; then +set dummy egrep; ac_prog_name=$2 +if test "${ac_cv_path_EGREP+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_path_EGREP_found=false +# Loop through the user's path and test for each of PROGNAME-LIST +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_prog in egrep; do + for ac_exec_ext in '' $ac_executable_extensions; do + ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext" + { test -f "$ac_path_EGREP" && $as_test_x "$ac_path_EGREP"; } || continue + # Check for GNU ac_path_EGREP and select it if it is found. + # Check for GNU $ac_path_EGREP +case `"$ac_path_EGREP" --version 2>&1` in +*GNU*) + ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;; +*) + ac_count=0 + echo $ECHO_N "0123456789$ECHO_C" >"conftest.in" + while : + do + cat "conftest.in" "conftest.in" >"conftest.tmp" + mv "conftest.tmp" "conftest.in" + cp "conftest.in" "conftest.nl" + echo 'EGREP' >> "conftest.nl" + "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break + diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break + ac_count=`expr $ac_count + 1` + if test $ac_count -gt ${ac_path_EGREP_max-0}; then + # Best one so far, save it but keep looking for a better one + ac_cv_path_EGREP="$ac_path_EGREP" + ac_path_EGREP_max=$ac_count + fi + # 10*(2^10) chars as input seems more than enough + test $ac_count -gt 10 && break + done + rm -f conftest.in conftest.tmp conftest.nl conftest.out;; +esac - if test "$MINIX" = yes; then + $ac_path_EGREP_found && break 3 + done +done -cat >>confdefs.h <<\_ACEOF -#define _POSIX_SOURCE 1 -_ACEOF +done +IFS=$as_save_IFS -cat >>confdefs.h <<\_ACEOF -#define _POSIX_1_SOURCE 2 -_ACEOF +fi + +EGREP="$ac_cv_path_EGREP" +if test -z "$EGREP"; then + { { echo "$as_me:$LINENO: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&5 +echo "$as_me: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&2;} + { (exit 1); exit 1; }; } +fi +else + ac_cv_path_EGREP=$EGREP +fi -cat >>confdefs.h <<\_ACEOF -#define _MINIX 1 -_ACEOF - fi + fi +fi +{ echo "$as_me:$LINENO: result: $ac_cv_path_EGREP" >&5 +echo "${ECHO_T}$ac_cv_path_EGREP" >&6; } + EGREP="$ac_cv_path_EGREP" - { $as_echo "$as_me:$LINENO: checking whether it is safe to define __EXTENSIONS__" >&5 -$as_echo_n "checking whether it is safe to define __EXTENSIONS__... " >&6; } -if test "${ac_cv_safe_to_define___extensions__+set}" = set; then - $as_echo_n "(cached) " >&6 -else - cat >conftest.$ac_ext <<_ACEOF +{ echo "$as_me:$LINENO: checking for AIX" >&5 +echo $ECHO_N "checking for AIX... $ECHO_C" >&6; } +cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ +#ifdef _AIX + yes +#endif -# define __EXTENSIONS__ 1 - $ac_includes_default -int -main () -{ - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - ac_cv_safe_to_define___extensions__=yes -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_cv_safe_to_define___extensions__=no -fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_safe_to_define___extensions__" >&5 -$as_echo "$ac_cv_safe_to_define___extensions__" >&6; } - test $ac_cv_safe_to_define___extensions__ = yes && - cat >>confdefs.h <<\_ACEOF -#define __EXTENSIONS__ 1 _ACEOF - - cat >>confdefs.h <<\_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "yes" >/dev/null 2>&1; then + { echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; } +cat >>confdefs.h <<\_ACEOF #define _ALL_SOURCE 1 _ACEOF - cat >>confdefs.h <<\_ACEOF -#define _GNU_SOURCE 1 -_ACEOF - - cat >>confdefs.h <<\_ACEOF -#define _POSIX_PTHREAD_SEMANTICS 1 -_ACEOF - - cat >>confdefs.h <<\_ACEOF -#define _TANDEM_SOURCE 1 -_ACEOF +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi +rm -f conftest* @@ -4438,8 +3868,8 @@ esac -{ $as_echo "$as_me:$LINENO: checking for --with-suffix" >&5 -$as_echo_n "checking for --with-suffix... " >&6; } +{ echo "$as_me:$LINENO: checking for --with-suffix" >&5 +echo $ECHO_N "checking for --with-suffix... $ECHO_C" >&6; } # Check whether --with-suffix was given. if test "${with_suffix+set}" = set; then @@ -4451,26 +3881,26 @@ esac fi -{ $as_echo "$as_me:$LINENO: result: $EXEEXT" >&5 -$as_echo "$EXEEXT" >&6; } +{ echo "$as_me:$LINENO: result: $EXEEXT" >&5 +echo "${ECHO_T}$EXEEXT" >&6; } # Test whether we're running on a non-case-sensitive system, in which # case we give a warning if no ext is given -{ $as_echo "$as_me:$LINENO: checking for case-insensitive build directory" >&5 -$as_echo_n "checking for case-insensitive build directory... " >&6; } +{ echo "$as_me:$LINENO: checking for case-insensitive build directory" >&5 +echo $ECHO_N "checking for case-insensitive build directory... $ECHO_C" >&6; } if test ! -d CaseSensitiveTestDir; then mkdir CaseSensitiveTestDir fi if test -d casesensitivetestdir then - { $as_echo "$as_me:$LINENO: result: yes" >&5 -$as_echo "yes" >&6; } + { echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; } BUILDEXEEXT=.exe else - { $as_echo "$as_me:$LINENO: result: no" >&5 -$as_echo "no" >&6; } + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } BUILDEXEEXT=$EXEEXT fi rmdir CaseSensitiveTestDir @@ -4503,14 +3933,14 @@ -{ $as_echo "$as_me:$LINENO: checking LIBRARY" >&5 -$as_echo_n "checking LIBRARY... " >&6; } +{ echo "$as_me:$LINENO: checking LIBRARY" >&5 +echo $ECHO_N "checking LIBRARY... $ECHO_C" >&6; } if test -z "$LIBRARY" then LIBRARY='libpython$(VERSION).a' fi -{ $as_echo "$as_me:$LINENO: result: $LIBRARY" >&5 -$as_echo "$LIBRARY" >&6; } +{ echo "$as_me:$LINENO: result: $LIBRARY" >&5 +echo "${ECHO_T}$LIBRARY" >&6; } # LDLIBRARY is the name of the library to link against (as opposed to the # name of the library into which to insert object files). BLDLIBRARY is also @@ -4545,8 +3975,8 @@ # This is altered for AIX in order to build the export list before # linking. -{ $as_echo "$as_me:$LINENO: checking LINKCC" >&5 -$as_echo_n "checking LINKCC... " >&6; } +{ echo "$as_me:$LINENO: checking LINKCC" >&5 +echo $ECHO_N "checking LINKCC... $ECHO_C" >&6; } if test -z "$LINKCC" then LINKCC='$(PURIFY) $(MAINCC)' @@ -4566,8 +3996,8 @@ LINKCC=qcc;; esac fi -{ $as_echo "$as_me:$LINENO: result: $LINKCC" >&5 -$as_echo "$LINKCC" >&6; } +{ echo "$as_me:$LINENO: result: $LINKCC" >&5 +echo "${ECHO_T}$LINKCC" >&6; } # GNULD is set to "yes" if the GNU linker is used. If this goes wrong # make sure we default having it set to "no": this is used by @@ -4575,8 +4005,8 @@ # to linker command lines, and failing to detect GNU ld simply results # in the same bahaviour as before. -{ $as_echo "$as_me:$LINENO: checking for GNU ld" >&5 -$as_echo_n "checking for GNU ld... " >&6; } +{ echo "$as_me:$LINENO: checking for GNU ld" >&5 +echo $ECHO_N "checking for GNU ld... $ECHO_C" >&6; } ac_prog=ld if test "$GCC" = yes; then ac_prog=`$CC -print-prog-name=ld` @@ -4587,11 +4017,11 @@ *) GNULD=no;; esac -{ $as_echo "$as_me:$LINENO: result: $GNULD" >&5 -$as_echo "$GNULD" >&6; } +{ echo "$as_me:$LINENO: result: $GNULD" >&5 +echo "${ECHO_T}$GNULD" >&6; } -{ $as_echo "$as_me:$LINENO: checking for --enable-shared" >&5 -$as_echo_n "checking for --enable-shared... " >&6; } +{ echo "$as_me:$LINENO: checking for --enable-shared" >&5 +echo $ECHO_N "checking for --enable-shared... $ECHO_C" >&6; } # Check whether --enable-shared was given. if test "${enable_shared+set}" = set; then enableval=$enable_shared; @@ -4607,11 +4037,11 @@ enable_shared="no";; esac fi -{ $as_echo "$as_me:$LINENO: result: $enable_shared" >&5 -$as_echo "$enable_shared" >&6; } +{ echo "$as_me:$LINENO: result: $enable_shared" >&5 +echo "${ECHO_T}$enable_shared" >&6; } -{ $as_echo "$as_me:$LINENO: checking for --enable-profiling" >&5 -$as_echo_n "checking for --enable-profiling... " >&6; } +{ echo "$as_me:$LINENO: checking for --enable-profiling" >&5 +echo $ECHO_N "checking for --enable-profiling... $ECHO_C" >&6; } # Check whether --enable-profiling was given. if test "${enable_profiling+set}" = set; then enableval=$enable_profiling; ac_save_cc="$CC" @@ -4633,32 +4063,29 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>&5 ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_try") 2>&5 ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_enable_profiling="yes" else - $as_echo "$as_me: program exited with status $ac_status" >&5 -$as_echo "$as_me: failed program was:" >&5 + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) ac_enable_profiling="no" fi -rm -rf conftest.dSYM rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi @@ -4666,8 +4093,8 @@ CC="$ac_save_cc" fi -{ $as_echo "$as_me:$LINENO: result: $ac_enable_profiling" >&5 -$as_echo "$ac_enable_profiling" >&6; } +{ echo "$as_me:$LINENO: result: $ac_enable_profiling" >&5 +echo "${ECHO_T}$ac_enable_profiling" >&6; } case "$ac_enable_profiling" in "yes") @@ -4676,8 +4103,8 @@ ;; esac -{ $as_echo "$as_me:$LINENO: checking LDLIBRARY" >&5 -$as_echo_n "checking LDLIBRARY... " >&6; } +{ echo "$as_me:$LINENO: checking LDLIBRARY" >&5 +echo $ECHO_N "checking LDLIBRARY... $ECHO_C" >&6; } # MacOSX framework builds need more magic. LDLIBRARY is the dynamic # library that we build, but we do not want to link against it (we @@ -4764,16 +4191,16 @@ esac fi -{ $as_echo "$as_me:$LINENO: result: $LDLIBRARY" >&5 -$as_echo "$LDLIBRARY" >&6; } +{ echo "$as_me:$LINENO: result: $LDLIBRARY" >&5 +echo "${ECHO_T}$LDLIBRARY" >&6; } if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. set dummy ${ac_tool_prefix}ranlib; ac_word=$2 -{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } if test "${ac_cv_prog_RANLIB+set}" = set; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$RANLIB"; then ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. @@ -4786,7 +4213,7 @@ for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" - $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -4797,11 +4224,11 @@ fi RANLIB=$ac_cv_prog_RANLIB if test -n "$RANLIB"; then - { $as_echo "$as_me:$LINENO: result: $RANLIB" >&5 -$as_echo "$RANLIB" >&6; } + { echo "$as_me:$LINENO: result: $RANLIB" >&5 +echo "${ECHO_T}$RANLIB" >&6; } else - { $as_echo "$as_me:$LINENO: result: no" >&5 -$as_echo "no" >&6; } + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } fi @@ -4810,10 +4237,10 @@ ac_ct_RANLIB=$RANLIB # Extract the first word of "ranlib", so it can be a program name with args. set dummy ranlib; ac_word=$2 -{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } if test "${ac_cv_prog_ac_ct_RANLIB+set}" = set; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$ac_ct_RANLIB"; then ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test. @@ -4826,7 +4253,7 @@ for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_RANLIB="ranlib" - $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -4837,11 +4264,11 @@ fi ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB if test -n "$ac_ct_RANLIB"; then - { $as_echo "$as_me:$LINENO: result: $ac_ct_RANLIB" >&5 -$as_echo "$ac_ct_RANLIB" >&6; } + { echo "$as_me:$LINENO: result: $ac_ct_RANLIB" >&5 +echo "${ECHO_T}$ac_ct_RANLIB" >&6; } else - { $as_echo "$as_me:$LINENO: result: no" >&5 -$as_echo "no" >&6; } + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } fi if test "x$ac_ct_RANLIB" = x; then @@ -4849,8 +4276,12 @@ else case $cross_compiling:$ac_tool_warned in yes:) -{ $as_echo "$as_me:$LINENO: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools +whose name does not start with the host triplet. If you think this +configuration is useful to you, please write to autoconf at gnu.org." >&5 +echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools +whose name does not start with the host triplet. If you think this +configuration is useful to you, please write to autoconf at gnu.org." >&2;} ac_tool_warned=yes ;; esac RANLIB=$ac_ct_RANLIB @@ -4864,10 +4295,10 @@ do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 -{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } if test "${ac_cv_prog_AR+set}" = set; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$AR"; then ac_cv_prog_AR="$AR" # Let the user override the test. @@ -4880,7 +4311,7 @@ for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_AR="$ac_prog" - $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -4891,11 +4322,11 @@ fi AR=$ac_cv_prog_AR if test -n "$AR"; then - { $as_echo "$as_me:$LINENO: result: $AR" >&5 -$as_echo "$AR" >&6; } + { echo "$as_me:$LINENO: result: $AR" >&5 +echo "${ECHO_T}$AR" >&6; } else - { $as_echo "$as_me:$LINENO: result: no" >&5 -$as_echo "no" >&6; } + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } fi @@ -4914,10 +4345,10 @@ # Extract the first word of "svnversion", so it can be a program name with args. set dummy svnversion; ac_word=$2 -{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } if test "${ac_cv_prog_SVNVERSION+set}" = set; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$SVNVERSION"; then ac_cv_prog_SVNVERSION="$SVNVERSION" # Let the user override the test. @@ -4930,7 +4361,7 @@ for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_SVNVERSION="found" - $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -4942,11 +4373,11 @@ fi SVNVERSION=$ac_cv_prog_SVNVERSION if test -n "$SVNVERSION"; then - { $as_echo "$as_me:$LINENO: result: $SVNVERSION" >&5 -$as_echo "$SVNVERSION" >&6; } + { echo "$as_me:$LINENO: result: $SVNVERSION" >&5 +echo "${ECHO_T}$SVNVERSION" >&6; } else - { $as_echo "$as_me:$LINENO: result: no" >&5 -$as_echo "no" >&6; } + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } fi @@ -4982,8 +4413,8 @@ fi done if test -z "$ac_aux_dir"; then - { { $as_echo "$as_me:$LINENO: error: cannot find install-sh or install.sh in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" >&5 -$as_echo "$as_me: error: cannot find install-sh or install.sh in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" >&2;} + { { echo "$as_me:$LINENO: error: cannot find install-sh or install.sh in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" >&5 +echo "$as_me: error: cannot find install-sh or install.sh in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" >&2;} { (exit 1); exit 1; }; } fi @@ -5009,12 +4440,11 @@ # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # OS/2's system install, which has a completely different semantic # ./install, which can be erroneously created by make from ./install.sh. -# Reject install programs that cannot install multiple files. -{ $as_echo "$as_me:$LINENO: checking for a BSD-compatible install" >&5 -$as_echo_n "checking for a BSD-compatible install... " >&6; } +{ echo "$as_me:$LINENO: checking for a BSD-compatible install" >&5 +echo $ECHO_N "checking for a BSD-compatible install... $ECHO_C" >&6; } if test -z "$INSTALL"; then if test "${ac_cv_path_install+set}" = set; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH @@ -5043,29 +4473,17 @@ # program-specific install script used by HP pwplus--don't use. : else - rm -rf conftest.one conftest.two conftest.dir - echo one > conftest.one - echo two > conftest.two - mkdir conftest.dir - if "$as_dir/$ac_prog$ac_exec_ext" -c conftest.one conftest.two "`pwd`/conftest.dir" && - test -s conftest.one && test -s conftest.two && - test -s conftest.dir/conftest.one && - test -s conftest.dir/conftest.two - then - ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" - break 3 - fi + ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" + break 3 fi fi done done ;; esac - done IFS=$as_save_IFS -rm -rf conftest.one conftest.two conftest.dir fi if test "${ac_cv_path_install+set}" = set; then @@ -5078,8 +4496,8 @@ INSTALL=$ac_install_sh fi fi -{ $as_echo "$as_me:$LINENO: result: $INSTALL" >&5 -$as_echo "$INSTALL" >&6; } +{ echo "$as_me:$LINENO: result: $INSTALL" >&5 +echo "${ECHO_T}$INSTALL" >&6; } # Use test -z because SunOS4 sh mishandles braces in ${var-val}. # It thinks the first close brace ends the variable substitution. @@ -5102,8 +4520,8 @@ fi # Check for --with-pydebug -{ $as_echo "$as_me:$LINENO: checking for --with-pydebug" >&5 -$as_echo_n "checking for --with-pydebug... " >&6; } +{ echo "$as_me:$LINENO: checking for --with-pydebug" >&5 +echo $ECHO_N "checking for --with-pydebug... $ECHO_C" >&6; } # Check whether --with-pydebug was given. if test "${with_pydebug+set}" = set; then @@ -5115,15 +4533,15 @@ #define Py_DEBUG 1 _ACEOF - { $as_echo "$as_me:$LINENO: result: yes" >&5 -$as_echo "yes" >&6; }; + { echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; }; Py_DEBUG='true' -else { $as_echo "$as_me:$LINENO: result: no" >&5 -$as_echo "no" >&6; }; Py_DEBUG='false' +else { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; }; Py_DEBUG='false' fi else - { $as_echo "$as_me:$LINENO: result: no" >&5 -$as_echo "no" >&6; } + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } fi @@ -5201,8 +4619,8 @@ # Python violates C99 rules, by casting between incompatible # pointer types. GCC may generate bad code as a result of that, # so use -fno-strict-aliasing if supported. - { $as_echo "$as_me:$LINENO: checking whether $CC accepts -fno-strict-aliasing" >&5 -$as_echo_n "checking whether $CC accepts -fno-strict-aliasing... " >&6; } + { echo "$as_me:$LINENO: checking whether $CC accepts -fno-strict-aliasing" >&5 +echo $ECHO_N "checking whether $CC accepts -fno-strict-aliasing... $ECHO_C" >&6; } ac_save_cc="$CC" CC="$CC -fno-strict-aliasing" if test "$cross_compiling" = yes; then @@ -5222,39 +4640,36 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>&5 ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_try") 2>&5 ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_no_strict_aliasing_ok=yes else - $as_echo "$as_me: program exited with status $ac_status" >&5 -$as_echo "$as_me: failed program was:" >&5 + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) ac_cv_no_strict_aliasing_ok=no fi -rm -rf conftest.dSYM rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi CC="$ac_save_cc" - { $as_echo "$as_me:$LINENO: result: $ac_cv_no_strict_aliasing_ok" >&5 -$as_echo "$ac_cv_no_strict_aliasing_ok" >&6; } + { echo "$as_me:$LINENO: result: $ac_cv_no_strict_aliasing_ok" >&5 +echo "${ECHO_T}$ac_cv_no_strict_aliasing_ok" >&6; } if test $ac_cv_no_strict_aliasing_ok = yes then BASECFLAGS="$BASECFLAGS -fno-strict-aliasing" @@ -5293,8 +4708,8 @@ ARCH_RUN_32BIT="arch -i386 -ppc" else - { { $as_echo "$as_me:$LINENO: error: proper usage is --with-universalarch=32-bit|64-bit|all" >&5 -$as_echo "$as_me: error: proper usage is --with-universalarch=32-bit|64-bit|all" >&2;} + { { echo "$as_me:$LINENO: error: proper usage is --with-universalarch=32-bit|64-bit|all" >&5 +echo "$as_me: error: proper usage is --with-universalarch=32-bit|64-bit|all" >&2;} { (exit 1); exit 1; }; } fi @@ -5368,10 +4783,10 @@ ac_cv_opt_olimit_ok=no fi -{ $as_echo "$as_me:$LINENO: checking whether $CC accepts -OPT:Olimit=0" >&5 -$as_echo_n "checking whether $CC accepts -OPT:Olimit=0... " >&6; } +{ echo "$as_me:$LINENO: checking whether $CC accepts -OPT:Olimit=0" >&5 +echo $ECHO_N "checking whether $CC accepts -OPT:Olimit=0... $ECHO_C" >&6; } if test "${ac_cv_opt_olimit_ok+set}" = set; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_save_cc="$CC" CC="$CC -OPT:Olimit=0" @@ -5392,32 +4807,29 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>&5 ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_try") 2>&5 ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_opt_olimit_ok=yes else - $as_echo "$as_me: program exited with status $ac_status" >&5 -$as_echo "$as_me: failed program was:" >&5 + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) ac_cv_opt_olimit_ok=no fi -rm -rf conftest.dSYM rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi @@ -5425,8 +4837,8 @@ CC="$ac_save_cc" fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_opt_olimit_ok" >&5 -$as_echo "$ac_cv_opt_olimit_ok" >&6; } +{ echo "$as_me:$LINENO: result: $ac_cv_opt_olimit_ok" >&5 +echo "${ECHO_T}$ac_cv_opt_olimit_ok" >&6; } if test $ac_cv_opt_olimit_ok = yes; then case $ac_sys_system in # XXX is this branch needed? On MacOSX 10.2.2 the result of the @@ -5439,10 +4851,10 @@ ;; esac else - { $as_echo "$as_me:$LINENO: checking whether $CC accepts -Olimit 1500" >&5 -$as_echo_n "checking whether $CC accepts -Olimit 1500... " >&6; } + { echo "$as_me:$LINENO: checking whether $CC accepts -Olimit 1500" >&5 +echo $ECHO_N "checking whether $CC accepts -Olimit 1500... $ECHO_C" >&6; } if test "${ac_cv_olimit_ok+set}" = set; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_save_cc="$CC" CC="$CC -Olimit 1500" @@ -5463,32 +4875,29 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>&5 ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_try") 2>&5 ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_olimit_ok=yes else - $as_echo "$as_me: program exited with status $ac_status" >&5 -$as_echo "$as_me: failed program was:" >&5 + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) ac_cv_olimit_ok=no fi -rm -rf conftest.dSYM rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi @@ -5496,8 +4905,8 @@ CC="$ac_save_cc" fi - { $as_echo "$as_me:$LINENO: result: $ac_cv_olimit_ok" >&5 -$as_echo "$ac_cv_olimit_ok" >&6; } + { echo "$as_me:$LINENO: result: $ac_cv_olimit_ok" >&5 +echo "${ECHO_T}$ac_cv_olimit_ok" >&6; } if test $ac_cv_olimit_ok = yes; then BASECFLAGS="$BASECFLAGS -Olimit 1500" fi @@ -5506,8 +4915,8 @@ # Check whether GCC supports PyArg_ParseTuple format if test "$GCC" = "yes" then - { $as_echo "$as_me:$LINENO: checking whether gcc supports ParseTuple __format__" >&5 -$as_echo_n "checking whether gcc supports ParseTuple __format__... " >&6; } + { echo "$as_me:$LINENO: checking whether gcc supports ParseTuple __format__" >&5 +echo $ECHO_N "checking whether gcc supports ParseTuple __format__... $ECHO_C" >&6; } save_CFLAGS=$CFLAGS CFLAGS="$CFLAGS -Werror" cat >conftest.$ac_ext <<_ACEOF @@ -5533,14 +4942,13 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err @@ -5550,14 +4958,14 @@ #define HAVE_ATTRIBUTE_FORMAT_PARSETUPLE 1 _ACEOF - { $as_echo "$as_me:$LINENO: result: yes" >&5 -$as_echo "yes" >&6; } + { echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; } else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 - { $as_echo "$as_me:$LINENO: result: no" >&5 -$as_echo "no" >&6; } + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } fi @@ -5570,10 +4978,10 @@ # complain if unaccepted options are passed (e.g. gcc on Mac OS X). # So we have to see first whether pthreads are available without # options before we can check whether -Kpthread improves anything. -{ $as_echo "$as_me:$LINENO: checking whether pthreads are available without options" >&5 -$as_echo_n "checking whether pthreads are available without options... " >&6; } +{ echo "$as_me:$LINENO: checking whether pthreads are available without options" >&5 +echo $ECHO_N "checking whether pthreads are available without options... $ECHO_C" >&6; } if test "${ac_cv_pthread_is_default+set}" = set; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else if test "$cross_compiling" = yes; then ac_cv_pthread_is_default=no @@ -5604,21 +5012,19 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>&5 ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_try") 2>&5 ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_pthread_is_default=yes @@ -5626,14 +5032,13 @@ ac_cv_pthread=no else - $as_echo "$as_me: program exited with status $ac_status" >&5 -$as_echo "$as_me: failed program was:" >&5 + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) ac_cv_pthread_is_default=no fi -rm -rf conftest.dSYM rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi @@ -5641,8 +5046,8 @@ fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_pthread_is_default" >&5 -$as_echo "$ac_cv_pthread_is_default" >&6; } +{ echo "$as_me:$LINENO: result: $ac_cv_pthread_is_default" >&5 +echo "${ECHO_T}$ac_cv_pthread_is_default" >&6; } if test $ac_cv_pthread_is_default = yes @@ -5654,10 +5059,10 @@ # Some compilers won't report that they do not support -Kpthread, # so we need to run a program to see whether it really made the # function available. -{ $as_echo "$as_me:$LINENO: checking whether $CC accepts -Kpthread" >&5 -$as_echo_n "checking whether $CC accepts -Kpthread... " >&6; } +{ echo "$as_me:$LINENO: checking whether $CC accepts -Kpthread" >&5 +echo $ECHO_N "checking whether $CC accepts -Kpthread... $ECHO_C" >&6; } if test "${ac_cv_kpthread+set}" = set; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_save_cc="$CC" CC="$CC -Kpthread" @@ -5690,32 +5095,29 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>&5 ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_try") 2>&5 ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_kpthread=yes else - $as_echo "$as_me: program exited with status $ac_status" >&5 -$as_echo "$as_me: failed program was:" >&5 + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) ac_cv_kpthread=no fi -rm -rf conftest.dSYM rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi @@ -5723,8 +5125,8 @@ CC="$ac_save_cc" fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_kpthread" >&5 -$as_echo "$ac_cv_kpthread" >&6; } +{ echo "$as_me:$LINENO: result: $ac_cv_kpthread" >&5 +echo "${ECHO_T}$ac_cv_kpthread" >&6; } fi if test $ac_cv_kpthread = no -a $ac_cv_pthread_is_default = no @@ -5734,10 +5136,10 @@ # Some compilers won't report that they do not support -Kthread, # so we need to run a program to see whether it really made the # function available. -{ $as_echo "$as_me:$LINENO: checking whether $CC accepts -Kthread" >&5 -$as_echo_n "checking whether $CC accepts -Kthread... " >&6; } +{ echo "$as_me:$LINENO: checking whether $CC accepts -Kthread" >&5 +echo $ECHO_N "checking whether $CC accepts -Kthread... $ECHO_C" >&6; } if test "${ac_cv_kthread+set}" = set; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_save_cc="$CC" CC="$CC -Kthread" @@ -5770,32 +5172,29 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>&5 ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_try") 2>&5 ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_kthread=yes else - $as_echo "$as_me: program exited with status $ac_status" >&5 -$as_echo "$as_me: failed program was:" >&5 + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) ac_cv_kthread=no fi -rm -rf conftest.dSYM rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi @@ -5803,8 +5202,8 @@ CC="$ac_save_cc" fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_kthread" >&5 -$as_echo "$ac_cv_kthread" >&6; } +{ echo "$as_me:$LINENO: result: $ac_cv_kthread" >&5 +echo "${ECHO_T}$ac_cv_kthread" >&6; } fi if test $ac_cv_kthread = no -a $ac_cv_pthread_is_default = no @@ -5814,10 +5213,10 @@ # Some compilers won't report that they do not support -pthread, # so we need to run a program to see whether it really made the # function available. -{ $as_echo "$as_me:$LINENO: checking whether $CC accepts -pthread" >&5 -$as_echo_n "checking whether $CC accepts -pthread... " >&6; } +{ echo "$as_me:$LINENO: checking whether $CC accepts -pthread" >&5 +echo $ECHO_N "checking whether $CC accepts -pthread... $ECHO_C" >&6; } if test "${ac_cv_thread+set}" = set; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_save_cc="$CC" CC="$CC -pthread" @@ -5850,32 +5249,29 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>&5 ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_try") 2>&5 ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_pthread=yes else - $as_echo "$as_me: program exited with status $ac_status" >&5 -$as_echo "$as_me: failed program was:" >&5 + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) ac_cv_pthread=no fi -rm -rf conftest.dSYM rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi @@ -5883,8 +5279,8 @@ CC="$ac_save_cc" fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_pthread" >&5 -$as_echo "$ac_cv_pthread" >&6; } +{ echo "$as_me:$LINENO: result: $ac_cv_pthread" >&5 +echo "${ECHO_T}$ac_cv_pthread" >&6; } fi # If we have set a CC compiler flag for thread support then @@ -5892,8 +5288,8 @@ ac_cv_cxx_thread=no if test ! -z "$CXX" then -{ $as_echo "$as_me:$LINENO: checking whether $CXX also accepts flags for thread support" >&5 -$as_echo_n "checking whether $CXX also accepts flags for thread support... " >&6; } +{ echo "$as_me:$LINENO: checking whether $CXX also accepts flags for thread support" >&5 +echo $ECHO_N "checking whether $CXX also accepts flags for thread support... $ECHO_C" >&6; } ac_save_cxx="$CXX" if test "$ac_cv_kpthread" = "yes" @@ -5923,17 +5319,17 @@ fi rm -fr conftest* fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_cxx_thread" >&5 -$as_echo "$ac_cv_cxx_thread" >&6; } +{ echo "$as_me:$LINENO: result: $ac_cv_cxx_thread" >&5 +echo "${ECHO_T}$ac_cv_cxx_thread" >&6; } fi CXX="$ac_save_cxx" # checks for header files -{ $as_echo "$as_me:$LINENO: checking for ANSI C header files" >&5 -$as_echo_n "checking for ANSI C header files... " >&6; } +{ echo "$as_me:$LINENO: checking for ANSI C header files" >&5 +echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6; } if test "${ac_cv_header_stdc+set}" = set; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ @@ -5960,21 +5356,20 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_header_stdc=yes else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_header_stdc=no @@ -6048,66 +5443,132 @@ # define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) #endif -#define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) -int -main () -{ - int i; - for (i = 0; i < 256; i++) - if (XOR (islower (i), ISLOWER (i)) - || toupper (i) != TOUPPER (i)) - return 2; - return 0; -} +#define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) +int +main () +{ + int i; + for (i = 0; i < 256; i++) + if (XOR (islower (i), ISLOWER (i)) + || toupper (i) != TOUPPER (i)) + return 2; + return 0; +} +_ACEOF +rm -f conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + : +else + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +( exit $ac_status ) +ac_cv_header_stdc=no +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi + + +fi +fi +{ echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5 +echo "${ECHO_T}$ac_cv_header_stdc" >&6; } +if test $ac_cv_header_stdc = yes; then + +cat >>confdefs.h <<\_ACEOF +#define STDC_HEADERS 1 +_ACEOF + +fi + +# On IRIX 5.3, sys/types and inttypes.h are conflicting. + + + + + + + + + +for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ + inttypes.h stdint.h unistd.h +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +{ echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } +if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default + +#include <$ac_header> _ACEOF -rm -f conftest$ac_exeext -if { (ac_try="$ac_link" +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_link") 2>&5 - ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { ac_try='./conftest$ac_exeext' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_try") 2>&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - : + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + eval "$as_ac_Header=yes" else - $as_echo "$as_me: program exited with status $ac_status" >&5 -$as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -( exit $ac_status ) -ac_cv_header_stdc=no -fi -rm -rf conftest.dSYM -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext + eval "$as_ac_Header=no" fi - -fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5 -$as_echo "$ac_cv_header_stdc" >&6; } -if test $ac_cv_header_stdc = yes; then - -cat >>confdefs.h <<\_ACEOF -#define STDC_HEADERS 1 +ac_res=`eval echo '${'$as_ac_Header'}'` + { echo "$as_me:$LINENO: result: $ac_res" >&5 +echo "${ECHO_T}$ac_res" >&6; } +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi +done + + @@ -6175,21 +5636,20 @@ sys/resource.h netpacket/packet.h sysexits.h bluetooth.h \ bluetooth/bluetooth.h linux/tipc.h do -as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then - { $as_echo "$as_me:$LINENO: checking for $ac_header" >&5 -$as_echo_n "checking for $ac_header... " >&6; } + { echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 fi -ac_res=`eval 'as_val=${'$as_ac_Header'} - $as_echo "$as_val"'` - { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } +ac_res=`eval echo '${'$as_ac_Header'}'` + { echo "$as_me:$LINENO: result: $ac_res" >&5 +echo "${ECHO_T}$ac_res" >&6; } else # Is the header compilable? -{ $as_echo "$as_me:$LINENO: checking $ac_header usability" >&5 -$as_echo_n "checking $ac_header usability... " >&6; } +{ echo "$as_me:$LINENO: checking $ac_header usability" >&5 +echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF @@ -6205,33 +5665,32 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_header_compiler=yes else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_compiler=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 -$as_echo "$ac_header_compiler" >&6; } +{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6; } # Is the header present? -{ $as_echo "$as_me:$LINENO: checking $ac_header presence" >&5 -$as_echo_n "checking $ac_header presence... " >&6; } +{ echo "$as_me:$LINENO: checking $ac_header presence" >&5 +echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF @@ -6245,52 +5704,51 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then ac_header_preproc=yes else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_preproc=no fi rm -f conftest.err conftest.$ac_ext -{ $as_echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 -$as_echo "$ac_header_preproc" >&6; } +{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6; } # So? What about this header? case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in yes:no: ) - { $as_echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 -$as_echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} - { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 -$as_echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} ac_header_preproc=yes ;; no:yes:* ) - { $as_echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 -$as_echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} - { $as_echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 -$as_echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} - { $as_echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 -$as_echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} - { $as_echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 -$as_echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} - { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 -$as_echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} - { $as_echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 -$as_echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 +echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 +echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 +echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 +echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} ( cat <<\_ASBOX ## -------------------------------------- ## ## Report this to http://bugs.python.org/ ## @@ -6299,24 +5757,21 @@ ) | sed "s/^/$as_me: WARNING: /" >&2 ;; esac -{ $as_echo "$as_me:$LINENO: checking for $ac_header" >&5 -$as_echo_n "checking for $ac_header... " >&6; } +{ echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else eval "$as_ac_Header=\$ac_header_preproc" fi -ac_res=`eval 'as_val=${'$as_ac_Header'} - $as_echo "$as_val"'` - { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } +ac_res=`eval echo '${'$as_ac_Header'}'` + { echo "$as_me:$LINENO: result: $ac_res" >&5 +echo "${ECHO_T}$ac_res" >&6; } fi -as_val=`eval 'as_val=${'$as_ac_Header'} - $as_echo "$as_val"'` - if test "x$as_val" = x""yes; then +if test `eval echo '${'$as_ac_Header'}'` = yes; then cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi @@ -6330,11 +5785,11 @@ ac_header_dirent=no for ac_hdr in dirent.h sys/ndir.h sys/dir.h ndir.h; do - as_ac_Header=`$as_echo "ac_cv_header_dirent_$ac_hdr" | $as_tr_sh` -{ $as_echo "$as_me:$LINENO: checking for $ac_hdr that defines DIR" >&5 -$as_echo_n "checking for $ac_hdr that defines DIR... " >&6; } + as_ac_Header=`echo "ac_cv_header_dirent_$ac_hdr" | $as_tr_sh` +{ echo "$as_me:$LINENO: checking for $ac_hdr that defines DIR" >&5 +echo $ECHO_N "checking for $ac_hdr that defines DIR... $ECHO_C" >&6; } if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ @@ -6360,21 +5815,20 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then eval "$as_ac_Header=yes" else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 eval "$as_ac_Header=no" @@ -6382,15 +5836,12 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi -ac_res=`eval 'as_val=${'$as_ac_Header'} - $as_echo "$as_val"'` - { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } -as_val=`eval 'as_val=${'$as_ac_Header'} - $as_echo "$as_val"'` - if test "x$as_val" = x""yes; then +ac_res=`eval echo '${'$as_ac_Header'}'` + { echo "$as_me:$LINENO: result: $ac_res" >&5 +echo "${ECHO_T}$ac_res" >&6; } +if test `eval echo '${'$as_ac_Header'}'` = yes; then cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_hdr" | $as_tr_cpp` 1 +#define `echo "HAVE_$ac_hdr" | $as_tr_cpp` 1 _ACEOF ac_header_dirent=$ac_hdr; break @@ -6399,10 +5850,10 @@ done # Two versions of opendir et al. are in -ldir and -lx on SCO Xenix. if test $ac_header_dirent = dirent.h; then - { $as_echo "$as_me:$LINENO: checking for library containing opendir" >&5 -$as_echo_n "checking for library containing opendir... " >&6; } + { echo "$as_me:$LINENO: checking for library containing opendir" >&5 +echo $ECHO_N "checking for library containing opendir... $ECHO_C" >&6; } if test "${ac_cv_search_opendir+set}" = set; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_func_search_save_LIBS=$LIBS cat >conftest.$ac_ext <<_ACEOF @@ -6440,30 +5891,26 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err - } && test -s conftest$ac_exeext && { - test "$cross_compiling" = yes || - $as_test_x conftest$ac_exeext - }; then + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then ac_cv_search_opendir=$ac_res else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi -rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext if test "${ac_cv_search_opendir+set}" = set; then @@ -6478,8 +5925,8 @@ rm conftest.$ac_ext LIBS=$ac_func_search_save_LIBS fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_search_opendir" >&5 -$as_echo "$ac_cv_search_opendir" >&6; } +{ echo "$as_me:$LINENO: result: $ac_cv_search_opendir" >&5 +echo "${ECHO_T}$ac_cv_search_opendir" >&6; } ac_res=$ac_cv_search_opendir if test "$ac_res" != no; then test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" @@ -6487,10 +5934,10 @@ fi else - { $as_echo "$as_me:$LINENO: checking for library containing opendir" >&5 -$as_echo_n "checking for library containing opendir... " >&6; } + { echo "$as_me:$LINENO: checking for library containing opendir" >&5 +echo $ECHO_N "checking for library containing opendir... $ECHO_C" >&6; } if test "${ac_cv_search_opendir+set}" = set; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_func_search_save_LIBS=$LIBS cat >conftest.$ac_ext <<_ACEOF @@ -6528,30 +5975,26 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err - } && test -s conftest$ac_exeext && { - test "$cross_compiling" = yes || - $as_test_x conftest$ac_exeext - }; then + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then ac_cv_search_opendir=$ac_res else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi -rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext if test "${ac_cv_search_opendir+set}" = set; then @@ -6566,8 +6009,8 @@ rm conftest.$ac_ext LIBS=$ac_func_search_save_LIBS fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_search_opendir" >&5 -$as_echo "$ac_cv_search_opendir" >&6; } +{ echo "$as_me:$LINENO: result: $ac_cv_search_opendir" >&5 +echo "${ECHO_T}$ac_cv_search_opendir" >&6; } ac_res=$ac_cv_search_opendir if test "$ac_res" != no; then test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" @@ -6576,10 +6019,10 @@ fi -{ $as_echo "$as_me:$LINENO: checking whether sys/types.h defines makedev" >&5 -$as_echo_n "checking whether sys/types.h defines makedev... " >&6; } +{ echo "$as_me:$LINENO: checking whether sys/types.h defines makedev" >&5 +echo $ECHO_N "checking whether sys/types.h defines makedev... $ECHO_C" >&6; } if test "${ac_cv_header_sys_types_h_makedev+set}" = set; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ @@ -6602,50 +6045,46 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err - } && test -s conftest$ac_exeext && { - test "$cross_compiling" = yes || - $as_test_x conftest$ac_exeext - }; then + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then ac_cv_header_sys_types_h_makedev=yes else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_header_sys_types_h_makedev=no fi -rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_sys_types_h_makedev" >&5 -$as_echo "$ac_cv_header_sys_types_h_makedev" >&6; } +{ echo "$as_me:$LINENO: result: $ac_cv_header_sys_types_h_makedev" >&5 +echo "${ECHO_T}$ac_cv_header_sys_types_h_makedev" >&6; } if test $ac_cv_header_sys_types_h_makedev = no; then if test "${ac_cv_header_sys_mkdev_h+set}" = set; then - { $as_echo "$as_me:$LINENO: checking for sys/mkdev.h" >&5 -$as_echo_n "checking for sys/mkdev.h... " >&6; } + { echo "$as_me:$LINENO: checking for sys/mkdev.h" >&5 +echo $ECHO_N "checking for sys/mkdev.h... $ECHO_C" >&6; } if test "${ac_cv_header_sys_mkdev_h+set}" = set; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_sys_mkdev_h" >&5 -$as_echo "$ac_cv_header_sys_mkdev_h" >&6; } +{ echo "$as_me:$LINENO: result: $ac_cv_header_sys_mkdev_h" >&5 +echo "${ECHO_T}$ac_cv_header_sys_mkdev_h" >&6; } else # Is the header compilable? -{ $as_echo "$as_me:$LINENO: checking sys/mkdev.h usability" >&5 -$as_echo_n "checking sys/mkdev.h usability... " >&6; } +{ echo "$as_me:$LINENO: checking sys/mkdev.h usability" >&5 +echo $ECHO_N "checking sys/mkdev.h usability... $ECHO_C" >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF @@ -6661,33 +6100,32 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_header_compiler=yes else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_compiler=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 -$as_echo "$ac_header_compiler" >&6; } +{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6; } # Is the header present? -{ $as_echo "$as_me:$LINENO: checking sys/mkdev.h presence" >&5 -$as_echo_n "checking sys/mkdev.h presence... " >&6; } +{ echo "$as_me:$LINENO: checking sys/mkdev.h presence" >&5 +echo $ECHO_N "checking sys/mkdev.h presence... $ECHO_C" >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF @@ -6701,52 +6139,51 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then ac_header_preproc=yes else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_preproc=no fi rm -f conftest.err conftest.$ac_ext -{ $as_echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 -$as_echo "$ac_header_preproc" >&6; } +{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6; } # So? What about this header? case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in yes:no: ) - { $as_echo "$as_me:$LINENO: WARNING: sys/mkdev.h: accepted by the compiler, rejected by the preprocessor!" >&5 -$as_echo "$as_me: WARNING: sys/mkdev.h: accepted by the compiler, rejected by the preprocessor!" >&2;} - { $as_echo "$as_me:$LINENO: WARNING: sys/mkdev.h: proceeding with the compiler's result" >&5 -$as_echo "$as_me: WARNING: sys/mkdev.h: proceeding with the compiler's result" >&2;} + { echo "$as_me:$LINENO: WARNING: sys/mkdev.h: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: sys/mkdev.h: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: sys/mkdev.h: proceeding with the compiler's result" >&5 +echo "$as_me: WARNING: sys/mkdev.h: proceeding with the compiler's result" >&2;} ac_header_preproc=yes ;; no:yes:* ) - { $as_echo "$as_me:$LINENO: WARNING: sys/mkdev.h: present but cannot be compiled" >&5 -$as_echo "$as_me: WARNING: sys/mkdev.h: present but cannot be compiled" >&2;} - { $as_echo "$as_me:$LINENO: WARNING: sys/mkdev.h: check for missing prerequisite headers?" >&5 -$as_echo "$as_me: WARNING: sys/mkdev.h: check for missing prerequisite headers?" >&2;} - { $as_echo "$as_me:$LINENO: WARNING: sys/mkdev.h: see the Autoconf documentation" >&5 -$as_echo "$as_me: WARNING: sys/mkdev.h: see the Autoconf documentation" >&2;} - { $as_echo "$as_me:$LINENO: WARNING: sys/mkdev.h: section \"Present But Cannot Be Compiled\"" >&5 -$as_echo "$as_me: WARNING: sys/mkdev.h: section \"Present But Cannot Be Compiled\"" >&2;} - { $as_echo "$as_me:$LINENO: WARNING: sys/mkdev.h: proceeding with the preprocessor's result" >&5 -$as_echo "$as_me: WARNING: sys/mkdev.h: proceeding with the preprocessor's result" >&2;} - { $as_echo "$as_me:$LINENO: WARNING: sys/mkdev.h: in the future, the compiler will take precedence" >&5 -$as_echo "$as_me: WARNING: sys/mkdev.h: in the future, the compiler will take precedence" >&2;} + { echo "$as_me:$LINENO: WARNING: sys/mkdev.h: present but cannot be compiled" >&5 +echo "$as_me: WARNING: sys/mkdev.h: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: sys/mkdev.h: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: sys/mkdev.h: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: sys/mkdev.h: see the Autoconf documentation" >&5 +echo "$as_me: WARNING: sys/mkdev.h: see the Autoconf documentation" >&2;} + { echo "$as_me:$LINENO: WARNING: sys/mkdev.h: section \"Present But Cannot Be Compiled\"" >&5 +echo "$as_me: WARNING: sys/mkdev.h: section \"Present But Cannot Be Compiled\"" >&2;} + { echo "$as_me:$LINENO: WARNING: sys/mkdev.h: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: sys/mkdev.h: proceeding with the preprocessor's result" >&2;} + { echo "$as_me:$LINENO: WARNING: sys/mkdev.h: in the future, the compiler will take precedence" >&5 +echo "$as_me: WARNING: sys/mkdev.h: in the future, the compiler will take precedence" >&2;} ( cat <<\_ASBOX ## -------------------------------------- ## ## Report this to http://bugs.python.org/ ## @@ -6755,18 +6192,18 @@ ) | sed "s/^/$as_me: WARNING: /" >&2 ;; esac -{ $as_echo "$as_me:$LINENO: checking for sys/mkdev.h" >&5 -$as_echo_n "checking for sys/mkdev.h... " >&6; } +{ echo "$as_me:$LINENO: checking for sys/mkdev.h" >&5 +echo $ECHO_N "checking for sys/mkdev.h... $ECHO_C" >&6; } if test "${ac_cv_header_sys_mkdev_h+set}" = set; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_cv_header_sys_mkdev_h=$ac_header_preproc fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_sys_mkdev_h" >&5 -$as_echo "$ac_cv_header_sys_mkdev_h" >&6; } +{ echo "$as_me:$LINENO: result: $ac_cv_header_sys_mkdev_h" >&5 +echo "${ECHO_T}$ac_cv_header_sys_mkdev_h" >&6; } fi -if test "x$ac_cv_header_sys_mkdev_h" = x""yes; then +if test $ac_cv_header_sys_mkdev_h = yes; then cat >>confdefs.h <<\_ACEOF #define MAJOR_IN_MKDEV 1 @@ -6778,17 +6215,17 @@ if test $ac_cv_header_sys_mkdev_h = no; then if test "${ac_cv_header_sys_sysmacros_h+set}" = set; then - { $as_echo "$as_me:$LINENO: checking for sys/sysmacros.h" >&5 -$as_echo_n "checking for sys/sysmacros.h... " >&6; } + { echo "$as_me:$LINENO: checking for sys/sysmacros.h" >&5 +echo $ECHO_N "checking for sys/sysmacros.h... $ECHO_C" >&6; } if test "${ac_cv_header_sys_sysmacros_h+set}" = set; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_sys_sysmacros_h" >&5 -$as_echo "$ac_cv_header_sys_sysmacros_h" >&6; } +{ echo "$as_me:$LINENO: result: $ac_cv_header_sys_sysmacros_h" >&5 +echo "${ECHO_T}$ac_cv_header_sys_sysmacros_h" >&6; } else # Is the header compilable? -{ $as_echo "$as_me:$LINENO: checking sys/sysmacros.h usability" >&5 -$as_echo_n "checking sys/sysmacros.h usability... " >&6; } +{ echo "$as_me:$LINENO: checking sys/sysmacros.h usability" >&5 +echo $ECHO_N "checking sys/sysmacros.h usability... $ECHO_C" >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF @@ -6804,33 +6241,32 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_header_compiler=yes else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_compiler=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 -$as_echo "$ac_header_compiler" >&6; } +{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6; } # Is the header present? -{ $as_echo "$as_me:$LINENO: checking sys/sysmacros.h presence" >&5 -$as_echo_n "checking sys/sysmacros.h presence... " >&6; } +{ echo "$as_me:$LINENO: checking sys/sysmacros.h presence" >&5 +echo $ECHO_N "checking sys/sysmacros.h presence... $ECHO_C" >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF @@ -6844,52 +6280,51 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then ac_header_preproc=yes else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_preproc=no fi rm -f conftest.err conftest.$ac_ext -{ $as_echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 -$as_echo "$ac_header_preproc" >&6; } +{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6; } # So? What about this header? case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in yes:no: ) - { $as_echo "$as_me:$LINENO: WARNING: sys/sysmacros.h: accepted by the compiler, rejected by the preprocessor!" >&5 -$as_echo "$as_me: WARNING: sys/sysmacros.h: accepted by the compiler, rejected by the preprocessor!" >&2;} - { $as_echo "$as_me:$LINENO: WARNING: sys/sysmacros.h: proceeding with the compiler's result" >&5 -$as_echo "$as_me: WARNING: sys/sysmacros.h: proceeding with the compiler's result" >&2;} + { echo "$as_me:$LINENO: WARNING: sys/sysmacros.h: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: sys/sysmacros.h: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: sys/sysmacros.h: proceeding with the compiler's result" >&5 +echo "$as_me: WARNING: sys/sysmacros.h: proceeding with the compiler's result" >&2;} ac_header_preproc=yes ;; no:yes:* ) - { $as_echo "$as_me:$LINENO: WARNING: sys/sysmacros.h: present but cannot be compiled" >&5 -$as_echo "$as_me: WARNING: sys/sysmacros.h: present but cannot be compiled" >&2;} - { $as_echo "$as_me:$LINENO: WARNING: sys/sysmacros.h: check for missing prerequisite headers?" >&5 -$as_echo "$as_me: WARNING: sys/sysmacros.h: check for missing prerequisite headers?" >&2;} - { $as_echo "$as_me:$LINENO: WARNING: sys/sysmacros.h: see the Autoconf documentation" >&5 -$as_echo "$as_me: WARNING: sys/sysmacros.h: see the Autoconf documentation" >&2;} - { $as_echo "$as_me:$LINENO: WARNING: sys/sysmacros.h: section \"Present But Cannot Be Compiled\"" >&5 -$as_echo "$as_me: WARNING: sys/sysmacros.h: section \"Present But Cannot Be Compiled\"" >&2;} - { $as_echo "$as_me:$LINENO: WARNING: sys/sysmacros.h: proceeding with the preprocessor's result" >&5 -$as_echo "$as_me: WARNING: sys/sysmacros.h: proceeding with the preprocessor's result" >&2;} - { $as_echo "$as_me:$LINENO: WARNING: sys/sysmacros.h: in the future, the compiler will take precedence" >&5 -$as_echo "$as_me: WARNING: sys/sysmacros.h: in the future, the compiler will take precedence" >&2;} + { echo "$as_me:$LINENO: WARNING: sys/sysmacros.h: present but cannot be compiled" >&5 +echo "$as_me: WARNING: sys/sysmacros.h: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: sys/sysmacros.h: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: sys/sysmacros.h: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: sys/sysmacros.h: see the Autoconf documentation" >&5 +echo "$as_me: WARNING: sys/sysmacros.h: see the Autoconf documentation" >&2;} + { echo "$as_me:$LINENO: WARNING: sys/sysmacros.h: section \"Present But Cannot Be Compiled\"" >&5 +echo "$as_me: WARNING: sys/sysmacros.h: section \"Present But Cannot Be Compiled\"" >&2;} + { echo "$as_me:$LINENO: WARNING: sys/sysmacros.h: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: sys/sysmacros.h: proceeding with the preprocessor's result" >&2;} + { echo "$as_me:$LINENO: WARNING: sys/sysmacros.h: in the future, the compiler will take precedence" >&5 +echo "$as_me: WARNING: sys/sysmacros.h: in the future, the compiler will take precedence" >&2;} ( cat <<\_ASBOX ## -------------------------------------- ## ## Report this to http://bugs.python.org/ ## @@ -6898,18 +6333,18 @@ ) | sed "s/^/$as_me: WARNING: /" >&2 ;; esac -{ $as_echo "$as_me:$LINENO: checking for sys/sysmacros.h" >&5 -$as_echo_n "checking for sys/sysmacros.h... " >&6; } +{ echo "$as_me:$LINENO: checking for sys/sysmacros.h" >&5 +echo $ECHO_N "checking for sys/sysmacros.h... $ECHO_C" >&6; } if test "${ac_cv_header_sys_sysmacros_h+set}" = set; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_cv_header_sys_sysmacros_h=$ac_header_preproc fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_sys_sysmacros_h" >&5 -$as_echo "$ac_cv_header_sys_sysmacros_h" >&6; } +{ echo "$as_me:$LINENO: result: $ac_cv_header_sys_sysmacros_h" >&5 +echo "${ECHO_T}$ac_cv_header_sys_sysmacros_h" >&6; } fi -if test "x$ac_cv_header_sys_sysmacros_h" = x""yes; then +if test $ac_cv_header_sys_sysmacros_h = yes; then cat >>confdefs.h <<\_ACEOF #define MAJOR_IN_SYSMACROS 1 @@ -6926,11 +6361,11 @@ for ac_header in term.h do -as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` -{ $as_echo "$as_me:$LINENO: checking for $ac_header" >&5 -$as_echo_n "checking for $ac_header... " >&6; } +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +{ echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ @@ -6952,21 +6387,20 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then eval "$as_ac_Header=yes" else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 eval "$as_ac_Header=no" @@ -6974,15 +6408,12 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi -ac_res=`eval 'as_val=${'$as_ac_Header'} - $as_echo "$as_val"'` - { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } -as_val=`eval 'as_val=${'$as_ac_Header'} - $as_echo "$as_val"'` - if test "x$as_val" = x""yes; then +ac_res=`eval echo '${'$as_ac_Header'}'` + { echo "$as_me:$LINENO: result: $ac_res" >&5 +echo "${ECHO_T}$ac_res" >&6; } +if test `eval echo '${'$as_ac_Header'}'` = yes; then cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi @@ -6994,11 +6425,11 @@ for ac_header in linux/netlink.h do -as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` -{ $as_echo "$as_me:$LINENO: checking for $ac_header" >&5 -$as_echo_n "checking for $ac_header... " >&6; } +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +{ echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ @@ -7023,21 +6454,20 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then eval "$as_ac_Header=yes" else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 eval "$as_ac_Header=no" @@ -7045,15 +6475,12 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi -ac_res=`eval 'as_val=${'$as_ac_Header'} - $as_echo "$as_val"'` - { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } -as_val=`eval 'as_val=${'$as_ac_Header'} - $as_echo "$as_val"'` - if test "x$as_val" = x""yes; then +ac_res=`eval echo '${'$as_ac_Header'}'` + { echo "$as_me:$LINENO: result: $ac_res" >&5 +echo "${ECHO_T}$ac_res" >&6; } +if test `eval echo '${'$as_ac_Header'}'` = yes; then cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi @@ -7063,8 +6490,8 @@ # checks for typedefs was_it_defined=no -{ $as_echo "$as_me:$LINENO: checking for clock_t in time.h" >&5 -$as_echo_n "checking for clock_t in time.h... " >&6; } +{ echo "$as_me:$LINENO: checking for clock_t in time.h" >&5 +echo $ECHO_N "checking for clock_t in time.h... $ECHO_C" >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF @@ -7088,12 +6515,12 @@ fi rm -f conftest* -{ $as_echo "$as_me:$LINENO: result: $was_it_defined" >&5 -$as_echo "$was_it_defined" >&6; } +{ echo "$as_me:$LINENO: result: $was_it_defined" >&5 +echo "${ECHO_T}$was_it_defined" >&6; } # Check whether using makedev requires defining _OSF_SOURCE -{ $as_echo "$as_me:$LINENO: checking for makedev" >&5 -$as_echo_n "checking for makedev... " >&6; } +{ echo "$as_me:$LINENO: checking for makedev" >&5 +echo $ECHO_N "checking for makedev... $ECHO_C" >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF @@ -7115,30 +6542,26 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err - } && test -s conftest$ac_exeext && { - test "$cross_compiling" = yes || - $as_test_x conftest$ac_exeext - }; then + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then ac_cv_has_makedev=yes else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_has_makedev=no fi -rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext if test "$ac_cv_has_makedev" = "no"; then @@ -7167,30 +6590,26 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err - } && test -s conftest$ac_exeext && { - test "$cross_compiling" = yes || - $as_test_x conftest$ac_exeext - }; then + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then ac_cv_has_makedev=yes else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_has_makedev=no fi -rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext if test "$ac_cv_has_makedev" = "yes"; then @@ -7201,8 +6620,8 @@ fi fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_has_makedev" >&5 -$as_echo "$ac_cv_has_makedev" >&6; } +{ echo "$as_me:$LINENO: result: $ac_cv_has_makedev" >&5 +echo "${ECHO_T}$ac_cv_has_makedev" >&6; } if test "$ac_cv_has_makedev" = "yes"; then cat >>confdefs.h <<\_ACEOF @@ -7219,8 +6638,8 @@ # work-around, disable LFS on such configurations use_lfs=yes -{ $as_echo "$as_me:$LINENO: checking Solaris LFS bug" >&5 -$as_echo_n "checking Solaris LFS bug... " >&6; } +{ echo "$as_me:$LINENO: checking Solaris LFS bug" >&5 +echo $ECHO_N "checking Solaris LFS bug... $ECHO_C" >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF @@ -7246,29 +6665,28 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then sol_lfs_bug=no else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 sol_lfs_bug=yes fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -{ $as_echo "$as_me:$LINENO: result: $sol_lfs_bug" >&5 -$as_echo "$sol_lfs_bug" >&6; } +{ echo "$as_me:$LINENO: result: $sol_lfs_bug" >&5 +echo "${ECHO_T}$sol_lfs_bug" >&6; } if test "$sol_lfs_bug" = "yes"; then use_lfs=no fi @@ -7296,46 +6714,11 @@ EOF # Type availability checks -{ $as_echo "$as_me:$LINENO: checking for mode_t" >&5 -$as_echo_n "checking for mode_t... " >&6; } +{ echo "$as_me:$LINENO: checking for mode_t" >&5 +echo $ECHO_N "checking for mode_t... $ECHO_C" >&6; } if test "${ac_cv_type_mode_t+set}" = set; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else - ac_cv_type_mode_t=no -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_includes_default -int -main () -{ -if (sizeof (mode_t)) - return 0; - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF @@ -7343,11 +6726,14 @@ cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default +typedef mode_t ac__type_new_; int main () { -if (sizeof ((mode_t))) - return 0; +if ((ac__type_new_ *) 0) + return 0; +if (sizeof (ac__type_new_)) + return 0; ; return 0; } @@ -7358,39 +6744,30 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then - : -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_cv_type_mode_t=yes -fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + ac_cv_type_mode_t=yes else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 - + ac_cv_type_mode_t=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_type_mode_t" >&5 -$as_echo "$ac_cv_type_mode_t" >&6; } -if test "x$ac_cv_type_mode_t" = x""yes; then +{ echo "$as_me:$LINENO: result: $ac_cv_type_mode_t" >&5 +echo "${ECHO_T}$ac_cv_type_mode_t" >&6; } +if test $ac_cv_type_mode_t = yes; then : else @@ -7400,46 +6777,11 @@ fi -{ $as_echo "$as_me:$LINENO: checking for off_t" >&5 -$as_echo_n "checking for off_t... " >&6; } +{ echo "$as_me:$LINENO: checking for off_t" >&5 +echo $ECHO_N "checking for off_t... $ECHO_C" >&6; } if test "${ac_cv_type_off_t+set}" = set; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else - ac_cv_type_off_t=no -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_includes_default -int -main () -{ -if (sizeof (off_t)) - return 0; - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF @@ -7447,11 +6789,14 @@ cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default +typedef off_t ac__type_new_; int main () { -if (sizeof ((off_t))) - return 0; +if ((ac__type_new_ *) 0) + return 0; +if (sizeof (ac__type_new_)) + return 0; ; return 0; } @@ -7462,39 +6807,30 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then - : + ac_cv_type_off_t=yes else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 - ac_cv_type_off_t=yes + ac_cv_type_off_t=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_type_off_t" >&5 -$as_echo "$ac_cv_type_off_t" >&6; } -if test "x$ac_cv_type_off_t" = x""yes; then +{ echo "$as_me:$LINENO: result: $ac_cv_type_off_t" >&5 +echo "${ECHO_T}$ac_cv_type_off_t" >&6; } +if test $ac_cv_type_off_t = yes; then : else @@ -7504,46 +6840,11 @@ fi -{ $as_echo "$as_me:$LINENO: checking for pid_t" >&5 -$as_echo_n "checking for pid_t... " >&6; } +{ echo "$as_me:$LINENO: checking for pid_t" >&5 +echo $ECHO_N "checking for pid_t... $ECHO_C" >&6; } if test "${ac_cv_type_pid_t+set}" = set; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else - ac_cv_type_pid_t=no -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_includes_default -int -main () -{ -if (sizeof (pid_t)) - return 0; - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF @@ -7551,11 +6852,14 @@ cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default +typedef pid_t ac__type_new_; int main () { -if (sizeof ((pid_t))) - return 0; +if ((ac__type_new_ *) 0) + return 0; +if (sizeof (ac__type_new_)) + return 0; ; return 0; } @@ -7566,39 +6870,30 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then - : -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_cv_type_pid_t=yes -fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + ac_cv_type_pid_t=yes else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 - + ac_cv_type_pid_t=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_type_pid_t" >&5 -$as_echo "$ac_cv_type_pid_t" >&6; } -if test "x$ac_cv_type_pid_t" = x""yes; then +{ echo "$as_me:$LINENO: result: $ac_cv_type_pid_t" >&5 +echo "${ECHO_T}$ac_cv_type_pid_t" >&6; } +if test $ac_cv_type_pid_t = yes; then : else @@ -7608,10 +6903,10 @@ fi -{ $as_echo "$as_me:$LINENO: checking return type of signal handlers" >&5 -$as_echo_n "checking return type of signal handlers... " >&6; } +{ echo "$as_me:$LINENO: checking return type of signal handlers" >&5 +echo $ECHO_N "checking return type of signal handlers... $ECHO_C" >&6; } if test "${ac_cv_type_signal+set}" = set; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ @@ -7636,21 +6931,20 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_type_signal=int else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_type_signal=void @@ -7658,54 +6952,19 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_type_signal" >&5 -$as_echo "$ac_cv_type_signal" >&6; } +{ echo "$as_me:$LINENO: result: $ac_cv_type_signal" >&5 +echo "${ECHO_T}$ac_cv_type_signal" >&6; } cat >>confdefs.h <<_ACEOF #define RETSIGTYPE $ac_cv_type_signal _ACEOF -{ $as_echo "$as_me:$LINENO: checking for size_t" >&5 -$as_echo_n "checking for size_t... " >&6; } +{ echo "$as_me:$LINENO: checking for size_t" >&5 +echo $ECHO_N "checking for size_t... $ECHO_C" >&6; } if test "${ac_cv_type_size_t+set}" = set; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else - ac_cv_type_size_t=no -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_includes_default -int -main () -{ -if (sizeof (size_t)) - return 0; - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF @@ -7713,11 +6972,14 @@ cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default +typedef size_t ac__type_new_; int main () { -if (sizeof ((size_t))) - return 0; +if ((ac__type_new_ *) 0) + return 0; +if (sizeof (ac__type_new_)) + return 0; ; return 0; } @@ -7728,39 +6990,30 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then - : -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_cv_type_size_t=yes -fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + ac_cv_type_size_t=yes else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 - + ac_cv_type_size_t=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_type_size_t" >&5 -$as_echo "$ac_cv_type_size_t" >&6; } -if test "x$ac_cv_type_size_t" = x""yes; then +{ echo "$as_me:$LINENO: result: $ac_cv_type_size_t" >&5 +echo "${ECHO_T}$ac_cv_type_size_t" >&6; } +if test $ac_cv_type_size_t = yes; then : else @@ -7770,10 +7023,10 @@ fi -{ $as_echo "$as_me:$LINENO: checking for uid_t in sys/types.h" >&5 -$as_echo_n "checking for uid_t in sys/types.h... " >&6; } +{ echo "$as_me:$LINENO: checking for uid_t in sys/types.h" >&5 +echo $ECHO_N "checking for uid_t in sys/types.h... $ECHO_C" >&6; } if test "${ac_cv_type_uid_t+set}" = set; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ @@ -7793,8 +7046,8 @@ rm -f conftest* fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_type_uid_t" >&5 -$as_echo "$ac_cv_type_uid_t" >&6; } +{ echo "$as_me:$LINENO: result: $ac_cv_type_uid_t" >&5 +echo "${ECHO_T}$ac_cv_type_uid_t" >&6; } if test $ac_cv_type_uid_t = no; then cat >>confdefs.h <<\_ACEOF @@ -7809,10 +7062,10 @@ fi - { $as_echo "$as_me:$LINENO: checking for uint32_t" >&5 -$as_echo_n "checking for uint32_t... " >&6; } + { echo "$as_me:$LINENO: checking for uint32_t" >&5 +echo $ECHO_N "checking for uint32_t... $ECHO_C" >&6; } if test "${ac_cv_c_uint32_t+set}" = set; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_cv_c_uint32_t=no for ac_type in 'uint32_t' 'unsigned int' 'unsigned long int' \ @@ -7840,14 +7093,13 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err @@ -7858,7 +7110,7 @@ esac else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 @@ -7868,8 +7120,8 @@ test "$ac_cv_c_uint32_t" != no && break done fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_c_uint32_t" >&5 -$as_echo "$ac_cv_c_uint32_t" >&6; } +{ echo "$as_me:$LINENO: result: $ac_cv_c_uint32_t" >&5 +echo "${ECHO_T}$ac_cv_c_uint32_t" >&6; } case $ac_cv_c_uint32_t in #( no|yes) ;; #( *) @@ -7886,10 +7138,10 @@ esac - { $as_echo "$as_me:$LINENO: checking for uint64_t" >&5 -$as_echo_n "checking for uint64_t... " >&6; } + { echo "$as_me:$LINENO: checking for uint64_t" >&5 +echo $ECHO_N "checking for uint64_t... $ECHO_C" >&6; } if test "${ac_cv_c_uint64_t+set}" = set; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_cv_c_uint64_t=no for ac_type in 'uint64_t' 'unsigned int' 'unsigned long int' \ @@ -7917,14 +7169,13 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err @@ -7935,7 +7186,7 @@ esac else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 @@ -7945,8 +7196,8 @@ test "$ac_cv_c_uint64_t" != no && break done fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_c_uint64_t" >&5 -$as_echo "$ac_cv_c_uint64_t" >&6; } +{ echo "$as_me:$LINENO: result: $ac_cv_c_uint64_t" >&5 +echo "${ECHO_T}$ac_cv_c_uint64_t" >&6; } case $ac_cv_c_uint64_t in #( no|yes) ;; #( *) @@ -7963,10 +7214,10 @@ esac - { $as_echo "$as_me:$LINENO: checking for int32_t" >&5 -$as_echo_n "checking for int32_t... " >&6; } + { echo "$as_me:$LINENO: checking for int32_t" >&5 +echo $ECHO_N "checking for int32_t... $ECHO_C" >&6; } if test "${ac_cv_c_int32_t+set}" = set; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_cv_c_int32_t=no for ac_type in 'int32_t' 'int' 'long int' \ @@ -7994,14 +7245,13 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err @@ -8017,7 +7267,7 @@ main () { static int test_array [1 - 2 * !(($ac_type) (((($ac_type) 1 << (32 - 2)) - 1) * 2 + 1) - < ($ac_type) (((($ac_type) 1 << (32 - 2)) - 1) * 2 + 2))]; + < ($ac_type) (((($ac_type) 1 << (32 - 2)) - 1) * 2 + 2))]; test_array [0] = 0 ; @@ -8030,21 +7280,20 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then : else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 case $ac_type in @@ -8056,7 +7305,7 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 @@ -8066,8 +7315,8 @@ test "$ac_cv_c_int32_t" != no && break done fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_c_int32_t" >&5 -$as_echo "$ac_cv_c_int32_t" >&6; } +{ echo "$as_me:$LINENO: result: $ac_cv_c_int32_t" >&5 +echo "${ECHO_T}$ac_cv_c_int32_t" >&6; } case $ac_cv_c_int32_t in #( no|yes) ;; #( *) @@ -8079,10 +7328,10 @@ esac - { $as_echo "$as_me:$LINENO: checking for int64_t" >&5 -$as_echo_n "checking for int64_t... " >&6; } + { echo "$as_me:$LINENO: checking for int64_t" >&5 +echo $ECHO_N "checking for int64_t... $ECHO_C" >&6; } if test "${ac_cv_c_int64_t+set}" = set; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_cv_c_int64_t=no for ac_type in 'int64_t' 'int' 'long int' \ @@ -8110,14 +7359,13 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err @@ -8133,7 +7381,7 @@ main () { static int test_array [1 - 2 * !(($ac_type) (((($ac_type) 1 << (64 - 2)) - 1) * 2 + 1) - < ($ac_type) (((($ac_type) 1 << (64 - 2)) - 1) * 2 + 2))]; + < ($ac_type) (((($ac_type) 1 << (64 - 2)) - 1) * 2 + 2))]; test_array [0] = 0 ; @@ -8146,21 +7394,20 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then : else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 case $ac_type in @@ -8172,7 +7419,7 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 @@ -8182,8 +7429,8 @@ test "$ac_cv_c_int64_t" != no && break done fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_c_int64_t" >&5 -$as_echo "$ac_cv_c_int64_t" >&6; } +{ echo "$as_me:$LINENO: result: $ac_cv_c_int64_t" >&5 +echo "${ECHO_T}$ac_cv_c_int64_t" >&6; } case $ac_cv_c_int64_t in #( no|yes) ;; #( *) @@ -8194,24 +7441,26 @@ ;; esac -{ $as_echo "$as_me:$LINENO: checking for ssize_t" >&5 -$as_echo_n "checking for ssize_t... " >&6; } +{ echo "$as_me:$LINENO: checking for ssize_t" >&5 +echo $ECHO_N "checking for ssize_t... $ECHO_C" >&6; } if test "${ac_cv_type_ssize_t+set}" = set; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else - ac_cv_type_ssize_t=no -cat >conftest.$ac_ext <<_ACEOF + cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default +typedef ssize_t ac__type_new_; int main () { -if (sizeof (ssize_t)) - return 0; +if ((ac__type_new_ *) 0) + return 0; +if (sizeof (ac__type_new_)) + return 0; ; return 0; } @@ -8222,18 +7471,45 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then + ac_cv_type_ssize_t=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_type_ssize_t=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ echo "$as_me:$LINENO: result: $ac_cv_type_ssize_t" >&5 +echo "${ECHO_T}$ac_cv_type_ssize_t" >&6; } +if test $ac_cv_type_ssize_t = yes; then + +cat >>confdefs.h <<\_ACEOF +#define HAVE_SSIZE_T 1 +_ACEOF + +fi + + +# Sizes of various common basic types +# ANSI C requires sizeof(char) == 1, so no need to check it +{ echo "$as_me:$LINENO: checking for int" >&5 +echo $ECHO_N "checking for int... $ECHO_C" >&6; } +if test "${ac_cv_type_int+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF @@ -8241,11 +7517,14 @@ cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default +typedef int ac__type_new_; int main () { -if (sizeof ((ssize_t))) - return 0; +if ((ac__type_new_ *) 0) + return 0; +if (sizeof (ac__type_new_)) + return 0; ; return 0; } @@ -8256,57 +7535,38 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then - : -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_cv_type_ssize_t=yes -fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - -fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_type_ssize_t" >&5 -$as_echo "$ac_cv_type_ssize_t" >&6; } -if test "x$ac_cv_type_ssize_t" = x""yes; then - -cat >>confdefs.h <<\_ACEOF -#define HAVE_SSIZE_T 1 -_ACEOF + ac_cv_type_int=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + ac_cv_type_int=no fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ echo "$as_me:$LINENO: result: $ac_cv_type_int" >&5 +echo "${ECHO_T}$ac_cv_type_int" >&6; } -# Sizes of various common basic types -# ANSI C requires sizeof(char) == 1, so no need to check it # The cast to long int works around a bug in the HP C Compiler # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. # This bug is HP SR number 8606223364. -{ $as_echo "$as_me:$LINENO: checking size of int" >&5 -$as_echo_n "checking size of int... " >&6; } +{ echo "$as_me:$LINENO: checking size of int" >&5 +echo $ECHO_N "checking size of int... $ECHO_C" >&6; } if test "${ac_cv_sizeof_int+set}" = set; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else if test "$cross_compiling" = yes; then # Depending upon the size, compute the lo and hi bounds. @@ -8317,10 +7577,11 @@ cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default + typedef int ac__type_sizeof_; int main () { -static int test_array [1 - 2 * !(((long int) (sizeof (int))) >= 0)]; +static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) >= 0)]; test_array [0] = 0 ; @@ -8333,14 +7594,13 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err @@ -8354,10 +7614,11 @@ cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default + typedef int ac__type_sizeof_; int main () { -static int test_array [1 - 2 * !(((long int) (sizeof (int))) <= $ac_mid)]; +static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) <= $ac_mid)]; test_array [0] = 0 ; @@ -8370,21 +7631,20 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_hi=$ac_mid; break else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo=`expr $ac_mid + 1` @@ -8398,7 +7658,7 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 cat >conftest.$ac_ext <<_ACEOF @@ -8408,10 +7668,11 @@ cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default + typedef int ac__type_sizeof_; int main () { -static int test_array [1 - 2 * !(((long int) (sizeof (int))) < 0)]; +static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) < 0)]; test_array [0] = 0 ; @@ -8424,14 +7685,13 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err @@ -8445,10 +7705,11 @@ cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default + typedef int ac__type_sizeof_; int main () { -static int test_array [1 - 2 * !(((long int) (sizeof (int))) >= $ac_mid)]; +static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) >= $ac_mid)]; test_array [0] = 0 ; @@ -8461,21 +7722,20 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_lo=$ac_mid; break else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_hi=`expr '(' $ac_mid ')' - 1` @@ -8489,7 +7749,7 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo= ac_hi= @@ -8509,10 +7769,11 @@ cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default + typedef int ac__type_sizeof_; int main () { -static int test_array [1 - 2 * !(((long int) (sizeof (int))) <= $ac_mid)]; +static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) <= $ac_mid)]; test_array [0] = 0 ; @@ -8525,21 +7786,20 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_hi=$ac_mid else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo=`expr '(' $ac_mid ')' + 1` @@ -8550,13 +7810,11 @@ case $ac_lo in ?*) ac_cv_sizeof_int=$ac_lo;; '') if test "$ac_cv_type_int" = yes; then - { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -{ { $as_echo "$as_me:$LINENO: error: cannot compute sizeof (int) + { { echo "$as_me:$LINENO: error: cannot compute sizeof (int) See \`config.log' for more details." >&5 -$as_echo "$as_me: error: cannot compute sizeof (int) +echo "$as_me: error: cannot compute sizeof (int) See \`config.log' for more details." >&2;} - { (exit 77); exit 77; }; }; } + { (exit 77); exit 77; }; } else ac_cv_sizeof_int=0 fi ;; @@ -8569,8 +7827,9 @@ cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default -static long int longval () { return (long int) (sizeof (int)); } -static unsigned long int ulongval () { return (long int) (sizeof (int)); } + typedef int ac__type_sizeof_; +static long int longval () { return (long int) (sizeof (ac__type_sizeof_)); } +static unsigned long int ulongval () { return (long int) (sizeof (ac__type_sizeof_)); } #include #include int @@ -8580,22 +7839,20 @@ FILE *f = fopen ("conftest.val", "w"); if (! f) return 1; - if (((long int) (sizeof (int))) < 0) + if (((long int) (sizeof (ac__type_sizeof_))) < 0) { long int i = longval (); - if (i != ((long int) (sizeof (int)))) + if (i != ((long int) (sizeof (ac__type_sizeof_)))) return 1; - fprintf (f, "%ld", i); + fprintf (f, "%ld\n", i); } else { unsigned long int i = ulongval (); - if (i != ((long int) (sizeof (int)))) + if (i != ((long int) (sizeof (ac__type_sizeof_)))) return 1; - fprintf (f, "%lu", i); + fprintf (f, "%lu\n", i); } - /* Do not output a trailing newline, as this causes \r\n confusion - on some platforms. */ return ferror (f) || fclose (f) != 0; ; @@ -8608,48 +7865,43 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>&5 ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_try") 2>&5 ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_sizeof_int=`cat conftest.val` else - $as_echo "$as_me: program exited with status $ac_status" >&5 -$as_echo "$as_me: failed program was:" >&5 + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) if test "$ac_cv_type_int" = yes; then - { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -{ { $as_echo "$as_me:$LINENO: error: cannot compute sizeof (int) + { { echo "$as_me:$LINENO: error: cannot compute sizeof (int) See \`config.log' for more details." >&5 -$as_echo "$as_me: error: cannot compute sizeof (int) +echo "$as_me: error: cannot compute sizeof (int) See \`config.log' for more details." >&2;} - { (exit 77); exit 77; }; }; } + { (exit 77); exit 77; }; } else ac_cv_sizeof_int=0 fi fi -rm -rf conftest.dSYM rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi rm -f conftest.val fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_sizeof_int" >&5 -$as_echo "$ac_cv_sizeof_int" >&6; } +{ echo "$as_me:$LINENO: result: $ac_cv_sizeof_int" >&5 +echo "${ECHO_T}$ac_cv_sizeof_int" >&6; } @@ -8658,14 +7910,68 @@ _ACEOF +{ echo "$as_me:$LINENO: checking for long" >&5 +echo $ECHO_N "checking for long... $ECHO_C" >&6; } +if test "${ac_cv_type_long+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +typedef long ac__type_new_; +int +main () +{ +if ((ac__type_new_ *) 0) + return 0; +if (sizeof (ac__type_new_)) + return 0; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_cv_type_long=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_type_long=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ echo "$as_me:$LINENO: result: $ac_cv_type_long" >&5 +echo "${ECHO_T}$ac_cv_type_long" >&6; } + # The cast to long int works around a bug in the HP C Compiler # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. # This bug is HP SR number 8606223364. -{ $as_echo "$as_me:$LINENO: checking size of long" >&5 -$as_echo_n "checking size of long... " >&6; } +{ echo "$as_me:$LINENO: checking size of long" >&5 +echo $ECHO_N "checking size of long... $ECHO_C" >&6; } if test "${ac_cv_sizeof_long+set}" = set; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else if test "$cross_compiling" = yes; then # Depending upon the size, compute the lo and hi bounds. @@ -8676,10 +7982,11 @@ cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default + typedef long ac__type_sizeof_; int main () { -static int test_array [1 - 2 * !(((long int) (sizeof (long))) >= 0)]; +static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) >= 0)]; test_array [0] = 0 ; @@ -8692,14 +7999,13 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err @@ -8713,10 +8019,11 @@ cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default + typedef long ac__type_sizeof_; int main () { -static int test_array [1 - 2 * !(((long int) (sizeof (long))) <= $ac_mid)]; +static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) <= $ac_mid)]; test_array [0] = 0 ; @@ -8729,21 +8036,20 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_hi=$ac_mid; break else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo=`expr $ac_mid + 1` @@ -8757,7 +8063,7 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 cat >conftest.$ac_ext <<_ACEOF @@ -8767,10 +8073,11 @@ cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default + typedef long ac__type_sizeof_; int main () { -static int test_array [1 - 2 * !(((long int) (sizeof (long))) < 0)]; +static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) < 0)]; test_array [0] = 0 ; @@ -8783,14 +8090,13 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err @@ -8804,10 +8110,11 @@ cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default + typedef long ac__type_sizeof_; int main () { -static int test_array [1 - 2 * !(((long int) (sizeof (long))) >= $ac_mid)]; +static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) >= $ac_mid)]; test_array [0] = 0 ; @@ -8820,21 +8127,20 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_lo=$ac_mid; break else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_hi=`expr '(' $ac_mid ')' - 1` @@ -8848,7 +8154,7 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo= ac_hi= @@ -8868,10 +8174,11 @@ cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default + typedef long ac__type_sizeof_; int main () { -static int test_array [1 - 2 * !(((long int) (sizeof (long))) <= $ac_mid)]; +static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) <= $ac_mid)]; test_array [0] = 0 ; @@ -8884,21 +8191,20 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_hi=$ac_mid else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo=`expr '(' $ac_mid ')' + 1` @@ -8909,13 +8215,11 @@ case $ac_lo in ?*) ac_cv_sizeof_long=$ac_lo;; '') if test "$ac_cv_type_long" = yes; then - { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -{ { $as_echo "$as_me:$LINENO: error: cannot compute sizeof (long) + { { echo "$as_me:$LINENO: error: cannot compute sizeof (long) See \`config.log' for more details." >&5 -$as_echo "$as_me: error: cannot compute sizeof (long) +echo "$as_me: error: cannot compute sizeof (long) See \`config.log' for more details." >&2;} - { (exit 77); exit 77; }; }; } + { (exit 77); exit 77; }; } else ac_cv_sizeof_long=0 fi ;; @@ -8928,8 +8232,9 @@ cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default -static long int longval () { return (long int) (sizeof (long)); } -static unsigned long int ulongval () { return (long int) (sizeof (long)); } + typedef long ac__type_sizeof_; +static long int longval () { return (long int) (sizeof (ac__type_sizeof_)); } +static unsigned long int ulongval () { return (long int) (sizeof (ac__type_sizeof_)); } #include #include int @@ -8939,22 +8244,20 @@ FILE *f = fopen ("conftest.val", "w"); if (! f) return 1; - if (((long int) (sizeof (long))) < 0) + if (((long int) (sizeof (ac__type_sizeof_))) < 0) { long int i = longval (); - if (i != ((long int) (sizeof (long)))) + if (i != ((long int) (sizeof (ac__type_sizeof_)))) return 1; - fprintf (f, "%ld", i); + fprintf (f, "%ld\n", i); } else { unsigned long int i = ulongval (); - if (i != ((long int) (sizeof (long)))) + if (i != ((long int) (sizeof (ac__type_sizeof_)))) return 1; - fprintf (f, "%lu", i); + fprintf (f, "%lu\n", i); } - /* Do not output a trailing newline, as this causes \r\n confusion - on some platforms. */ return ferror (f) || fclose (f) != 0; ; @@ -8967,48 +8270,43 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>&5 ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_try") 2>&5 ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_sizeof_long=`cat conftest.val` else - $as_echo "$as_me: program exited with status $ac_status" >&5 -$as_echo "$as_me: failed program was:" >&5 + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) if test "$ac_cv_type_long" = yes; then - { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -{ { $as_echo "$as_me:$LINENO: error: cannot compute sizeof (long) + { { echo "$as_me:$LINENO: error: cannot compute sizeof (long) See \`config.log' for more details." >&5 -$as_echo "$as_me: error: cannot compute sizeof (long) +echo "$as_me: error: cannot compute sizeof (long) See \`config.log' for more details." >&2;} - { (exit 77); exit 77; }; }; } + { (exit 77); exit 77; }; } else ac_cv_sizeof_long=0 fi fi -rm -rf conftest.dSYM rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi rm -f conftest.val fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_sizeof_long" >&5 -$as_echo "$ac_cv_sizeof_long" >&6; } +{ echo "$as_me:$LINENO: result: $ac_cv_sizeof_long" >&5 +echo "${ECHO_T}$ac_cv_sizeof_long" >&6; } @@ -9017,14 +8315,68 @@ _ACEOF +{ echo "$as_me:$LINENO: checking for void *" >&5 +echo $ECHO_N "checking for void *... $ECHO_C" >&6; } +if test "${ac_cv_type_void_p+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +typedef void * ac__type_new_; +int +main () +{ +if ((ac__type_new_ *) 0) + return 0; +if (sizeof (ac__type_new_)) + return 0; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_cv_type_void_p=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_type_void_p=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ echo "$as_me:$LINENO: result: $ac_cv_type_void_p" >&5 +echo "${ECHO_T}$ac_cv_type_void_p" >&6; } + # The cast to long int works around a bug in the HP C Compiler # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. # This bug is HP SR number 8606223364. -{ $as_echo "$as_me:$LINENO: checking size of void *" >&5 -$as_echo_n "checking size of void *... " >&6; } +{ echo "$as_me:$LINENO: checking size of void *" >&5 +echo $ECHO_N "checking size of void *... $ECHO_C" >&6; } if test "${ac_cv_sizeof_void_p+set}" = set; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else if test "$cross_compiling" = yes; then # Depending upon the size, compute the lo and hi bounds. @@ -9035,10 +8387,11 @@ cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default + typedef void * ac__type_sizeof_; int main () { -static int test_array [1 - 2 * !(((long int) (sizeof (void *))) >= 0)]; +static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) >= 0)]; test_array [0] = 0 ; @@ -9051,14 +8404,13 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err @@ -9072,10 +8424,11 @@ cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default + typedef void * ac__type_sizeof_; int main () { -static int test_array [1 - 2 * !(((long int) (sizeof (void *))) <= $ac_mid)]; +static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) <= $ac_mid)]; test_array [0] = 0 ; @@ -9088,21 +8441,20 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_hi=$ac_mid; break else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo=`expr $ac_mid + 1` @@ -9116,7 +8468,7 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 cat >conftest.$ac_ext <<_ACEOF @@ -9126,10 +8478,11 @@ cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default + typedef void * ac__type_sizeof_; int main () { -static int test_array [1 - 2 * !(((long int) (sizeof (void *))) < 0)]; +static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) < 0)]; test_array [0] = 0 ; @@ -9142,14 +8495,13 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err @@ -9163,10 +8515,11 @@ cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default + typedef void * ac__type_sizeof_; int main () { -static int test_array [1 - 2 * !(((long int) (sizeof (void *))) >= $ac_mid)]; +static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) >= $ac_mid)]; test_array [0] = 0 ; @@ -9179,21 +8532,20 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_lo=$ac_mid; break else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_hi=`expr '(' $ac_mid ')' - 1` @@ -9207,7 +8559,7 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo= ac_hi= @@ -9227,10 +8579,11 @@ cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default + typedef void * ac__type_sizeof_; int main () { -static int test_array [1 - 2 * !(((long int) (sizeof (void *))) <= $ac_mid)]; +static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) <= $ac_mid)]; test_array [0] = 0 ; @@ -9243,21 +8596,20 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_hi=$ac_mid else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo=`expr '(' $ac_mid ')' + 1` @@ -9268,13 +8620,11 @@ case $ac_lo in ?*) ac_cv_sizeof_void_p=$ac_lo;; '') if test "$ac_cv_type_void_p" = yes; then - { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -{ { $as_echo "$as_me:$LINENO: error: cannot compute sizeof (void *) + { { echo "$as_me:$LINENO: error: cannot compute sizeof (void *) See \`config.log' for more details." >&5 -$as_echo "$as_me: error: cannot compute sizeof (void *) +echo "$as_me: error: cannot compute sizeof (void *) See \`config.log' for more details." >&2;} - { (exit 77); exit 77; }; }; } + { (exit 77); exit 77; }; } else ac_cv_sizeof_void_p=0 fi ;; @@ -9287,8 +8637,9 @@ cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default -static long int longval () { return (long int) (sizeof (void *)); } -static unsigned long int ulongval () { return (long int) (sizeof (void *)); } + typedef void * ac__type_sizeof_; +static long int longval () { return (long int) (sizeof (ac__type_sizeof_)); } +static unsigned long int ulongval () { return (long int) (sizeof (ac__type_sizeof_)); } #include #include int @@ -9298,22 +8649,20 @@ FILE *f = fopen ("conftest.val", "w"); if (! f) return 1; - if (((long int) (sizeof (void *))) < 0) + if (((long int) (sizeof (ac__type_sizeof_))) < 0) { long int i = longval (); - if (i != ((long int) (sizeof (void *)))) + if (i != ((long int) (sizeof (ac__type_sizeof_)))) return 1; - fprintf (f, "%ld", i); + fprintf (f, "%ld\n", i); } else { unsigned long int i = ulongval (); - if (i != ((long int) (sizeof (void *)))) + if (i != ((long int) (sizeof (ac__type_sizeof_)))) return 1; - fprintf (f, "%lu", i); + fprintf (f, "%lu\n", i); } - /* Do not output a trailing newline, as this causes \r\n confusion - on some platforms. */ return ferror (f) || fclose (f) != 0; ; @@ -9326,48 +8675,43 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>&5 ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_try") 2>&5 ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_sizeof_void_p=`cat conftest.val` else - $as_echo "$as_me: program exited with status $ac_status" >&5 -$as_echo "$as_me: failed program was:" >&5 + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) if test "$ac_cv_type_void_p" = yes; then - { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -{ { $as_echo "$as_me:$LINENO: error: cannot compute sizeof (void *) + { { echo "$as_me:$LINENO: error: cannot compute sizeof (void *) See \`config.log' for more details." >&5 -$as_echo "$as_me: error: cannot compute sizeof (void *) +echo "$as_me: error: cannot compute sizeof (void *) See \`config.log' for more details." >&2;} - { (exit 77); exit 77; }; }; } + { (exit 77); exit 77; }; } else ac_cv_sizeof_void_p=0 fi fi -rm -rf conftest.dSYM rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi rm -f conftest.val fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_sizeof_void_p" >&5 -$as_echo "$ac_cv_sizeof_void_p" >&6; } +{ echo "$as_me:$LINENO: result: $ac_cv_sizeof_void_p" >&5 +echo "${ECHO_T}$ac_cv_sizeof_void_p" >&6; } @@ -9376,14 +8720,68 @@ _ACEOF +{ echo "$as_me:$LINENO: checking for short" >&5 +echo $ECHO_N "checking for short... $ECHO_C" >&6; } +if test "${ac_cv_type_short+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +typedef short ac__type_new_; +int +main () +{ +if ((ac__type_new_ *) 0) + return 0; +if (sizeof (ac__type_new_)) + return 0; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_cv_type_short=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_type_short=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ echo "$as_me:$LINENO: result: $ac_cv_type_short" >&5 +echo "${ECHO_T}$ac_cv_type_short" >&6; } + # The cast to long int works around a bug in the HP C Compiler # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. # This bug is HP SR number 8606223364. -{ $as_echo "$as_me:$LINENO: checking size of short" >&5 -$as_echo_n "checking size of short... " >&6; } +{ echo "$as_me:$LINENO: checking size of short" >&5 +echo $ECHO_N "checking size of short... $ECHO_C" >&6; } if test "${ac_cv_sizeof_short+set}" = set; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else if test "$cross_compiling" = yes; then # Depending upon the size, compute the lo and hi bounds. @@ -9394,10 +8792,11 @@ cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default + typedef short ac__type_sizeof_; int main () { -static int test_array [1 - 2 * !(((long int) (sizeof (short))) >= 0)]; +static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) >= 0)]; test_array [0] = 0 ; @@ -9410,14 +8809,13 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err @@ -9431,10 +8829,11 @@ cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default + typedef short ac__type_sizeof_; int main () { -static int test_array [1 - 2 * !(((long int) (sizeof (short))) <= $ac_mid)]; +static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) <= $ac_mid)]; test_array [0] = 0 ; @@ -9447,21 +8846,20 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_hi=$ac_mid; break else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo=`expr $ac_mid + 1` @@ -9475,7 +8873,7 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 cat >conftest.$ac_ext <<_ACEOF @@ -9485,10 +8883,11 @@ cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default + typedef short ac__type_sizeof_; int main () { -static int test_array [1 - 2 * !(((long int) (sizeof (short))) < 0)]; +static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) < 0)]; test_array [0] = 0 ; @@ -9501,14 +8900,13 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err @@ -9522,10 +8920,11 @@ cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default + typedef short ac__type_sizeof_; int main () { -static int test_array [1 - 2 * !(((long int) (sizeof (short))) >= $ac_mid)]; +static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) >= $ac_mid)]; test_array [0] = 0 ; @@ -9538,21 +8937,20 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_lo=$ac_mid; break else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_hi=`expr '(' $ac_mid ')' - 1` @@ -9566,7 +8964,7 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo= ac_hi= @@ -9586,10 +8984,11 @@ cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default + typedef short ac__type_sizeof_; int main () { -static int test_array [1 - 2 * !(((long int) (sizeof (short))) <= $ac_mid)]; +static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) <= $ac_mid)]; test_array [0] = 0 ; @@ -9602,21 +9001,20 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_hi=$ac_mid else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo=`expr '(' $ac_mid ')' + 1` @@ -9627,13 +9025,11 @@ case $ac_lo in ?*) ac_cv_sizeof_short=$ac_lo;; '') if test "$ac_cv_type_short" = yes; then - { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -{ { $as_echo "$as_me:$LINENO: error: cannot compute sizeof (short) + { { echo "$as_me:$LINENO: error: cannot compute sizeof (short) See \`config.log' for more details." >&5 -$as_echo "$as_me: error: cannot compute sizeof (short) +echo "$as_me: error: cannot compute sizeof (short) See \`config.log' for more details." >&2;} - { (exit 77); exit 77; }; }; } + { (exit 77); exit 77; }; } else ac_cv_sizeof_short=0 fi ;; @@ -9646,8 +9042,9 @@ cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default -static long int longval () { return (long int) (sizeof (short)); } -static unsigned long int ulongval () { return (long int) (sizeof (short)); } + typedef short ac__type_sizeof_; +static long int longval () { return (long int) (sizeof (ac__type_sizeof_)); } +static unsigned long int ulongval () { return (long int) (sizeof (ac__type_sizeof_)); } #include #include int @@ -9657,22 +9054,20 @@ FILE *f = fopen ("conftest.val", "w"); if (! f) return 1; - if (((long int) (sizeof (short))) < 0) + if (((long int) (sizeof (ac__type_sizeof_))) < 0) { long int i = longval (); - if (i != ((long int) (sizeof (short)))) + if (i != ((long int) (sizeof (ac__type_sizeof_)))) return 1; - fprintf (f, "%ld", i); + fprintf (f, "%ld\n", i); } else { unsigned long int i = ulongval (); - if (i != ((long int) (sizeof (short)))) + if (i != ((long int) (sizeof (ac__type_sizeof_)))) return 1; - fprintf (f, "%lu", i); + fprintf (f, "%lu\n", i); } - /* Do not output a trailing newline, as this causes \r\n confusion - on some platforms. */ return ferror (f) || fclose (f) != 0; ; @@ -9685,48 +9080,43 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>&5 ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_try") 2>&5 ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_sizeof_short=`cat conftest.val` else - $as_echo "$as_me: program exited with status $ac_status" >&5 -$as_echo "$as_me: failed program was:" >&5 + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) if test "$ac_cv_type_short" = yes; then - { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -{ { $as_echo "$as_me:$LINENO: error: cannot compute sizeof (short) + { { echo "$as_me:$LINENO: error: cannot compute sizeof (short) See \`config.log' for more details." >&5 -$as_echo "$as_me: error: cannot compute sizeof (short) +echo "$as_me: error: cannot compute sizeof (short) See \`config.log' for more details." >&2;} - { (exit 77); exit 77; }; }; } + { (exit 77); exit 77; }; } else ac_cv_sizeof_short=0 fi fi -rm -rf conftest.dSYM rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi rm -f conftest.val fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_sizeof_short" >&5 -$as_echo "$ac_cv_sizeof_short" >&6; } +{ echo "$as_me:$LINENO: result: $ac_cv_sizeof_short" >&5 +echo "${ECHO_T}$ac_cv_sizeof_short" >&6; } @@ -9735,14 +9125,68 @@ _ACEOF +{ echo "$as_me:$LINENO: checking for float" >&5 +echo $ECHO_N "checking for float... $ECHO_C" >&6; } +if test "${ac_cv_type_float+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +typedef float ac__type_new_; +int +main () +{ +if ((ac__type_new_ *) 0) + return 0; +if (sizeof (ac__type_new_)) + return 0; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_cv_type_float=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_type_float=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ echo "$as_me:$LINENO: result: $ac_cv_type_float" >&5 +echo "${ECHO_T}$ac_cv_type_float" >&6; } + # The cast to long int works around a bug in the HP C Compiler # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. # This bug is HP SR number 8606223364. -{ $as_echo "$as_me:$LINENO: checking size of float" >&5 -$as_echo_n "checking size of float... " >&6; } +{ echo "$as_me:$LINENO: checking size of float" >&5 +echo $ECHO_N "checking size of float... $ECHO_C" >&6; } if test "${ac_cv_sizeof_float+set}" = set; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else if test "$cross_compiling" = yes; then # Depending upon the size, compute the lo and hi bounds. @@ -9753,10 +9197,11 @@ cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default + typedef float ac__type_sizeof_; int main () { -static int test_array [1 - 2 * !(((long int) (sizeof (float))) >= 0)]; +static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) >= 0)]; test_array [0] = 0 ; @@ -9769,14 +9214,13 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err @@ -9790,10 +9234,11 @@ cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default + typedef float ac__type_sizeof_; int main () { -static int test_array [1 - 2 * !(((long int) (sizeof (float))) <= $ac_mid)]; +static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) <= $ac_mid)]; test_array [0] = 0 ; @@ -9806,21 +9251,20 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_hi=$ac_mid; break else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo=`expr $ac_mid + 1` @@ -9834,7 +9278,7 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 cat >conftest.$ac_ext <<_ACEOF @@ -9844,10 +9288,11 @@ cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default + typedef float ac__type_sizeof_; int main () { -static int test_array [1 - 2 * !(((long int) (sizeof (float))) < 0)]; +static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) < 0)]; test_array [0] = 0 ; @@ -9860,14 +9305,13 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err @@ -9881,10 +9325,11 @@ cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default + typedef float ac__type_sizeof_; int main () { -static int test_array [1 - 2 * !(((long int) (sizeof (float))) >= $ac_mid)]; +static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) >= $ac_mid)]; test_array [0] = 0 ; @@ -9897,21 +9342,20 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_lo=$ac_mid; break else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_hi=`expr '(' $ac_mid ')' - 1` @@ -9925,7 +9369,7 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo= ac_hi= @@ -9945,10 +9389,11 @@ cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default + typedef float ac__type_sizeof_; int main () { -static int test_array [1 - 2 * !(((long int) (sizeof (float))) <= $ac_mid)]; +static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) <= $ac_mid)]; test_array [0] = 0 ; @@ -9961,21 +9406,20 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_hi=$ac_mid else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo=`expr '(' $ac_mid ')' + 1` @@ -9986,13 +9430,11 @@ case $ac_lo in ?*) ac_cv_sizeof_float=$ac_lo;; '') if test "$ac_cv_type_float" = yes; then - { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -{ { $as_echo "$as_me:$LINENO: error: cannot compute sizeof (float) + { { echo "$as_me:$LINENO: error: cannot compute sizeof (float) See \`config.log' for more details." >&5 -$as_echo "$as_me: error: cannot compute sizeof (float) +echo "$as_me: error: cannot compute sizeof (float) See \`config.log' for more details." >&2;} - { (exit 77); exit 77; }; }; } + { (exit 77); exit 77; }; } else ac_cv_sizeof_float=0 fi ;; @@ -10005,8 +9447,9 @@ cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default -static long int longval () { return (long int) (sizeof (float)); } -static unsigned long int ulongval () { return (long int) (sizeof (float)); } + typedef float ac__type_sizeof_; +static long int longval () { return (long int) (sizeof (ac__type_sizeof_)); } +static unsigned long int ulongval () { return (long int) (sizeof (ac__type_sizeof_)); } #include #include int @@ -10016,22 +9459,20 @@ FILE *f = fopen ("conftest.val", "w"); if (! f) return 1; - if (((long int) (sizeof (float))) < 0) + if (((long int) (sizeof (ac__type_sizeof_))) < 0) { long int i = longval (); - if (i != ((long int) (sizeof (float)))) + if (i != ((long int) (sizeof (ac__type_sizeof_)))) return 1; - fprintf (f, "%ld", i); + fprintf (f, "%ld\n", i); } else { unsigned long int i = ulongval (); - if (i != ((long int) (sizeof (float)))) + if (i != ((long int) (sizeof (ac__type_sizeof_)))) return 1; - fprintf (f, "%lu", i); + fprintf (f, "%lu\n", i); } - /* Do not output a trailing newline, as this causes \r\n confusion - on some platforms. */ return ferror (f) || fclose (f) != 0; ; @@ -10044,48 +9485,43 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>&5 ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_try") 2>&5 ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_sizeof_float=`cat conftest.val` else - $as_echo "$as_me: program exited with status $ac_status" >&5 -$as_echo "$as_me: failed program was:" >&5 + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) if test "$ac_cv_type_float" = yes; then - { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -{ { $as_echo "$as_me:$LINENO: error: cannot compute sizeof (float) + { { echo "$as_me:$LINENO: error: cannot compute sizeof (float) See \`config.log' for more details." >&5 -$as_echo "$as_me: error: cannot compute sizeof (float) +echo "$as_me: error: cannot compute sizeof (float) See \`config.log' for more details." >&2;} - { (exit 77); exit 77; }; }; } + { (exit 77); exit 77; }; } else ac_cv_sizeof_float=0 fi fi -rm -rf conftest.dSYM rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi rm -f conftest.val fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_sizeof_float" >&5 -$as_echo "$ac_cv_sizeof_float" >&6; } +{ echo "$as_me:$LINENO: result: $ac_cv_sizeof_float" >&5 +echo "${ECHO_T}$ac_cv_sizeof_float" >&6; } @@ -10094,14 +9530,68 @@ _ACEOF +{ echo "$as_me:$LINENO: checking for double" >&5 +echo $ECHO_N "checking for double... $ECHO_C" >&6; } +if test "${ac_cv_type_double+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +typedef double ac__type_new_; +int +main () +{ +if ((ac__type_new_ *) 0) + return 0; +if (sizeof (ac__type_new_)) + return 0; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_cv_type_double=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_type_double=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ echo "$as_me:$LINENO: result: $ac_cv_type_double" >&5 +echo "${ECHO_T}$ac_cv_type_double" >&6; } + # The cast to long int works around a bug in the HP C Compiler # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. # This bug is HP SR number 8606223364. -{ $as_echo "$as_me:$LINENO: checking size of double" >&5 -$as_echo_n "checking size of double... " >&6; } +{ echo "$as_me:$LINENO: checking size of double" >&5 +echo $ECHO_N "checking size of double... $ECHO_C" >&6; } if test "${ac_cv_sizeof_double+set}" = set; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else if test "$cross_compiling" = yes; then # Depending upon the size, compute the lo and hi bounds. @@ -10112,10 +9602,11 @@ cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default + typedef double ac__type_sizeof_; int main () { -static int test_array [1 - 2 * !(((long int) (sizeof (double))) >= 0)]; +static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) >= 0)]; test_array [0] = 0 ; @@ -10128,14 +9619,13 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err @@ -10149,10 +9639,11 @@ cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default + typedef double ac__type_sizeof_; int main () { -static int test_array [1 - 2 * !(((long int) (sizeof (double))) <= $ac_mid)]; +static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) <= $ac_mid)]; test_array [0] = 0 ; @@ -10165,21 +9656,20 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_hi=$ac_mid; break else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo=`expr $ac_mid + 1` @@ -10193,7 +9683,7 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 cat >conftest.$ac_ext <<_ACEOF @@ -10203,10 +9693,11 @@ cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default + typedef double ac__type_sizeof_; int main () { -static int test_array [1 - 2 * !(((long int) (sizeof (double))) < 0)]; +static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) < 0)]; test_array [0] = 0 ; @@ -10219,14 +9710,13 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err @@ -10240,10 +9730,11 @@ cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default + typedef double ac__type_sizeof_; int main () { -static int test_array [1 - 2 * !(((long int) (sizeof (double))) >= $ac_mid)]; +static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) >= $ac_mid)]; test_array [0] = 0 ; @@ -10256,21 +9747,20 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_lo=$ac_mid; break else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_hi=`expr '(' $ac_mid ')' - 1` @@ -10284,7 +9774,7 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo= ac_hi= @@ -10304,10 +9794,11 @@ cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default + typedef double ac__type_sizeof_; int main () { -static int test_array [1 - 2 * !(((long int) (sizeof (double))) <= $ac_mid)]; +static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) <= $ac_mid)]; test_array [0] = 0 ; @@ -10320,21 +9811,20 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_hi=$ac_mid else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo=`expr '(' $ac_mid ')' + 1` @@ -10345,13 +9835,11 @@ case $ac_lo in ?*) ac_cv_sizeof_double=$ac_lo;; '') if test "$ac_cv_type_double" = yes; then - { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -{ { $as_echo "$as_me:$LINENO: error: cannot compute sizeof (double) + { { echo "$as_me:$LINENO: error: cannot compute sizeof (double) See \`config.log' for more details." >&5 -$as_echo "$as_me: error: cannot compute sizeof (double) +echo "$as_me: error: cannot compute sizeof (double) See \`config.log' for more details." >&2;} - { (exit 77); exit 77; }; }; } + { (exit 77); exit 77; }; } else ac_cv_sizeof_double=0 fi ;; @@ -10364,8 +9852,9 @@ cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default -static long int longval () { return (long int) (sizeof (double)); } -static unsigned long int ulongval () { return (long int) (sizeof (double)); } + typedef double ac__type_sizeof_; +static long int longval () { return (long int) (sizeof (ac__type_sizeof_)); } +static unsigned long int ulongval () { return (long int) (sizeof (ac__type_sizeof_)); } #include #include int @@ -10375,22 +9864,20 @@ FILE *f = fopen ("conftest.val", "w"); if (! f) return 1; - if (((long int) (sizeof (double))) < 0) + if (((long int) (sizeof (ac__type_sizeof_))) < 0) { long int i = longval (); - if (i != ((long int) (sizeof (double)))) + if (i != ((long int) (sizeof (ac__type_sizeof_)))) return 1; - fprintf (f, "%ld", i); + fprintf (f, "%ld\n", i); } else { unsigned long int i = ulongval (); - if (i != ((long int) (sizeof (double)))) + if (i != ((long int) (sizeof (ac__type_sizeof_)))) return 1; - fprintf (f, "%lu", i); + fprintf (f, "%lu\n", i); } - /* Do not output a trailing newline, as this causes \r\n confusion - on some platforms. */ return ferror (f) || fclose (f) != 0; ; @@ -10403,64 +9890,113 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>&5 ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_try") 2>&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_sizeof_double=`cat conftest.val` +else + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +( exit $ac_status ) +if test "$ac_cv_type_double" = yes; then + { { echo "$as_me:$LINENO: error: cannot compute sizeof (double) +See \`config.log' for more details." >&5 +echo "$as_me: error: cannot compute sizeof (double) +See \`config.log' for more details." >&2;} + { (exit 77); exit 77; }; } + else + ac_cv_sizeof_double=0 + fi +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi +rm -f conftest.val +fi +{ echo "$as_me:$LINENO: result: $ac_cv_sizeof_double" >&5 +echo "${ECHO_T}$ac_cv_sizeof_double" >&6; } + + + +cat >>confdefs.h <<_ACEOF +#define SIZEOF_DOUBLE $ac_cv_sizeof_double +_ACEOF + + +{ echo "$as_me:$LINENO: checking for fpos_t" >&5 +echo $ECHO_N "checking for fpos_t... $ECHO_C" >&6; } +if test "${ac_cv_type_fpos_t+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +typedef fpos_t ac__type_new_; +int +main () +{ +if ((ac__type_new_ *) 0) + return 0; +if (sizeof (ac__type_new_)) + return 0; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_sizeof_double=`cat conftest.val` + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_cv_type_fpos_t=yes else - $as_echo "$as_me: program exited with status $ac_status" >&5 -$as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -( exit $ac_status ) -if test "$ac_cv_type_double" = yes; then - { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -{ { $as_echo "$as_me:$LINENO: error: cannot compute sizeof (double) -See \`config.log' for more details." >&5 -$as_echo "$as_me: error: cannot compute sizeof (double) -See \`config.log' for more details." >&2;} - { (exit 77); exit 77; }; }; } - else - ac_cv_sizeof_double=0 - fi -fi -rm -rf conftest.dSYM -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext + ac_cv_type_fpos_t=no fi -rm -f conftest.val -fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_sizeof_double" >&5 -$as_echo "$ac_cv_sizeof_double" >&6; } - - - -cat >>confdefs.h <<_ACEOF -#define SIZEOF_DOUBLE $ac_cv_sizeof_double -_ACEOF +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ echo "$as_me:$LINENO: result: $ac_cv_type_fpos_t" >&5 +echo "${ECHO_T}$ac_cv_type_fpos_t" >&6; } # The cast to long int works around a bug in the HP C Compiler # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. # This bug is HP SR number 8606223364. -{ $as_echo "$as_me:$LINENO: checking size of fpos_t" >&5 -$as_echo_n "checking size of fpos_t... " >&6; } +{ echo "$as_me:$LINENO: checking size of fpos_t" >&5 +echo $ECHO_N "checking size of fpos_t... $ECHO_C" >&6; } if test "${ac_cv_sizeof_fpos_t+set}" = set; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else if test "$cross_compiling" = yes; then # Depending upon the size, compute the lo and hi bounds. @@ -10471,10 +10007,11 @@ cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default + typedef fpos_t ac__type_sizeof_; int main () { -static int test_array [1 - 2 * !(((long int) (sizeof (fpos_t))) >= 0)]; +static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) >= 0)]; test_array [0] = 0 ; @@ -10487,14 +10024,13 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err @@ -10508,10 +10044,11 @@ cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default + typedef fpos_t ac__type_sizeof_; int main () { -static int test_array [1 - 2 * !(((long int) (sizeof (fpos_t))) <= $ac_mid)]; +static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) <= $ac_mid)]; test_array [0] = 0 ; @@ -10524,21 +10061,20 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_hi=$ac_mid; break else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo=`expr $ac_mid + 1` @@ -10552,7 +10088,7 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 cat >conftest.$ac_ext <<_ACEOF @@ -10562,10 +10098,11 @@ cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default + typedef fpos_t ac__type_sizeof_; int main () { -static int test_array [1 - 2 * !(((long int) (sizeof (fpos_t))) < 0)]; +static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) < 0)]; test_array [0] = 0 ; @@ -10578,14 +10115,13 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err @@ -10599,10 +10135,11 @@ cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default + typedef fpos_t ac__type_sizeof_; int main () { -static int test_array [1 - 2 * !(((long int) (sizeof (fpos_t))) >= $ac_mid)]; +static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) >= $ac_mid)]; test_array [0] = 0 ; @@ -10615,21 +10152,20 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_lo=$ac_mid; break else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_hi=`expr '(' $ac_mid ')' - 1` @@ -10643,7 +10179,7 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo= ac_hi= @@ -10663,10 +10199,11 @@ cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default + typedef fpos_t ac__type_sizeof_; int main () { -static int test_array [1 - 2 * !(((long int) (sizeof (fpos_t))) <= $ac_mid)]; +static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) <= $ac_mid)]; test_array [0] = 0 ; @@ -10679,21 +10216,20 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_hi=$ac_mid else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo=`expr '(' $ac_mid ')' + 1` @@ -10704,13 +10240,11 @@ case $ac_lo in ?*) ac_cv_sizeof_fpos_t=$ac_lo;; '') if test "$ac_cv_type_fpos_t" = yes; then - { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -{ { $as_echo "$as_me:$LINENO: error: cannot compute sizeof (fpos_t) + { { echo "$as_me:$LINENO: error: cannot compute sizeof (fpos_t) See \`config.log' for more details." >&5 -$as_echo "$as_me: error: cannot compute sizeof (fpos_t) +echo "$as_me: error: cannot compute sizeof (fpos_t) See \`config.log' for more details." >&2;} - { (exit 77); exit 77; }; }; } + { (exit 77); exit 77; }; } else ac_cv_sizeof_fpos_t=0 fi ;; @@ -10723,8 +10257,9 @@ cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default -static long int longval () { return (long int) (sizeof (fpos_t)); } -static unsigned long int ulongval () { return (long int) (sizeof (fpos_t)); } + typedef fpos_t ac__type_sizeof_; +static long int longval () { return (long int) (sizeof (ac__type_sizeof_)); } +static unsigned long int ulongval () { return (long int) (sizeof (ac__type_sizeof_)); } #include #include int @@ -10734,22 +10269,20 @@ FILE *f = fopen ("conftest.val", "w"); if (! f) return 1; - if (((long int) (sizeof (fpos_t))) < 0) + if (((long int) (sizeof (ac__type_sizeof_))) < 0) { long int i = longval (); - if (i != ((long int) (sizeof (fpos_t)))) + if (i != ((long int) (sizeof (ac__type_sizeof_)))) return 1; - fprintf (f, "%ld", i); + fprintf (f, "%ld\n", i); } else { unsigned long int i = ulongval (); - if (i != ((long int) (sizeof (fpos_t)))) + if (i != ((long int) (sizeof (ac__type_sizeof_)))) return 1; - fprintf (f, "%lu", i); + fprintf (f, "%lu\n", i); } - /* Do not output a trailing newline, as this causes \r\n confusion - on some platforms. */ return ferror (f) || fclose (f) != 0; ; @@ -10762,48 +10295,43 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>&5 ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_try") 2>&5 ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_sizeof_fpos_t=`cat conftest.val` else - $as_echo "$as_me: program exited with status $ac_status" >&5 -$as_echo "$as_me: failed program was:" >&5 + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) if test "$ac_cv_type_fpos_t" = yes; then - { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -{ { $as_echo "$as_me:$LINENO: error: cannot compute sizeof (fpos_t) + { { echo "$as_me:$LINENO: error: cannot compute sizeof (fpos_t) See \`config.log' for more details." >&5 -$as_echo "$as_me: error: cannot compute sizeof (fpos_t) +echo "$as_me: error: cannot compute sizeof (fpos_t) See \`config.log' for more details." >&2;} - { (exit 77); exit 77; }; }; } + { (exit 77); exit 77; }; } else ac_cv_sizeof_fpos_t=0 fi fi -rm -rf conftest.dSYM rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi rm -f conftest.val fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_sizeof_fpos_t" >&5 -$as_echo "$ac_cv_sizeof_fpos_t" >&6; } +{ echo "$as_me:$LINENO: result: $ac_cv_sizeof_fpos_t" >&5 +echo "${ECHO_T}$ac_cv_sizeof_fpos_t" >&6; } @@ -10812,14 +10340,68 @@ _ACEOF +{ echo "$as_me:$LINENO: checking for size_t" >&5 +echo $ECHO_N "checking for size_t... $ECHO_C" >&6; } +if test "${ac_cv_type_size_t+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +typedef size_t ac__type_new_; +int +main () +{ +if ((ac__type_new_ *) 0) + return 0; +if (sizeof (ac__type_new_)) + return 0; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_cv_type_size_t=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_type_size_t=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ echo "$as_me:$LINENO: result: $ac_cv_type_size_t" >&5 +echo "${ECHO_T}$ac_cv_type_size_t" >&6; } + # The cast to long int works around a bug in the HP C Compiler # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. # This bug is HP SR number 8606223364. -{ $as_echo "$as_me:$LINENO: checking size of size_t" >&5 -$as_echo_n "checking size of size_t... " >&6; } +{ echo "$as_me:$LINENO: checking size of size_t" >&5 +echo $ECHO_N "checking size of size_t... $ECHO_C" >&6; } if test "${ac_cv_sizeof_size_t+set}" = set; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else if test "$cross_compiling" = yes; then # Depending upon the size, compute the lo and hi bounds. @@ -10830,10 +10412,11 @@ cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default + typedef size_t ac__type_sizeof_; int main () { -static int test_array [1 - 2 * !(((long int) (sizeof (size_t))) >= 0)]; +static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) >= 0)]; test_array [0] = 0 ; @@ -10846,14 +10429,13 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err @@ -10867,10 +10449,11 @@ cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default + typedef size_t ac__type_sizeof_; int main () { -static int test_array [1 - 2 * !(((long int) (sizeof (size_t))) <= $ac_mid)]; +static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) <= $ac_mid)]; test_array [0] = 0 ; @@ -10883,21 +10466,20 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_hi=$ac_mid; break else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo=`expr $ac_mid + 1` @@ -10911,7 +10493,7 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 cat >conftest.$ac_ext <<_ACEOF @@ -10921,10 +10503,11 @@ cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default + typedef size_t ac__type_sizeof_; int main () { -static int test_array [1 - 2 * !(((long int) (sizeof (size_t))) < 0)]; +static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) < 0)]; test_array [0] = 0 ; @@ -10937,14 +10520,13 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err @@ -10958,10 +10540,11 @@ cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default + typedef size_t ac__type_sizeof_; int main () { -static int test_array [1 - 2 * !(((long int) (sizeof (size_t))) >= $ac_mid)]; +static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) >= $ac_mid)]; test_array [0] = 0 ; @@ -10974,21 +10557,20 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_lo=$ac_mid; break else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_hi=`expr '(' $ac_mid ')' - 1` @@ -11002,7 +10584,7 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo= ac_hi= @@ -11022,10 +10604,11 @@ cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default + typedef size_t ac__type_sizeof_; int main () { -static int test_array [1 - 2 * !(((long int) (sizeof (size_t))) <= $ac_mid)]; +static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) <= $ac_mid)]; test_array [0] = 0 ; @@ -11038,21 +10621,20 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_hi=$ac_mid else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo=`expr '(' $ac_mid ')' + 1` @@ -11063,13 +10645,11 @@ case $ac_lo in ?*) ac_cv_sizeof_size_t=$ac_lo;; '') if test "$ac_cv_type_size_t" = yes; then - { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -{ { $as_echo "$as_me:$LINENO: error: cannot compute sizeof (size_t) + { { echo "$as_me:$LINENO: error: cannot compute sizeof (size_t) See \`config.log' for more details." >&5 -$as_echo "$as_me: error: cannot compute sizeof (size_t) +echo "$as_me: error: cannot compute sizeof (size_t) See \`config.log' for more details." >&2;} - { (exit 77); exit 77; }; }; } + { (exit 77); exit 77; }; } else ac_cv_sizeof_size_t=0 fi ;; @@ -11082,8 +10662,9 @@ cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default -static long int longval () { return (long int) (sizeof (size_t)); } -static unsigned long int ulongval () { return (long int) (sizeof (size_t)); } + typedef size_t ac__type_sizeof_; +static long int longval () { return (long int) (sizeof (ac__type_sizeof_)); } +static unsigned long int ulongval () { return (long int) (sizeof (ac__type_sizeof_)); } #include #include int @@ -11093,22 +10674,20 @@ FILE *f = fopen ("conftest.val", "w"); if (! f) return 1; - if (((long int) (sizeof (size_t))) < 0) + if (((long int) (sizeof (ac__type_sizeof_))) < 0) { long int i = longval (); - if (i != ((long int) (sizeof (size_t)))) + if (i != ((long int) (sizeof (ac__type_sizeof_)))) return 1; - fprintf (f, "%ld", i); + fprintf (f, "%ld\n", i); } else { unsigned long int i = ulongval (); - if (i != ((long int) (sizeof (size_t)))) + if (i != ((long int) (sizeof (ac__type_sizeof_)))) return 1; - fprintf (f, "%lu", i); + fprintf (f, "%lu\n", i); } - /* Do not output a trailing newline, as this causes \r\n confusion - on some platforms. */ return ferror (f) || fclose (f) != 0; ; @@ -11121,48 +10700,43 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>&5 ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_try") 2>&5 ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_sizeof_size_t=`cat conftest.val` else - $as_echo "$as_me: program exited with status $ac_status" >&5 -$as_echo "$as_me: failed program was:" >&5 + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) if test "$ac_cv_type_size_t" = yes; then - { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -{ { $as_echo "$as_me:$LINENO: error: cannot compute sizeof (size_t) + { { echo "$as_me:$LINENO: error: cannot compute sizeof (size_t) See \`config.log' for more details." >&5 -$as_echo "$as_me: error: cannot compute sizeof (size_t) +echo "$as_me: error: cannot compute sizeof (size_t) See \`config.log' for more details." >&2;} - { (exit 77); exit 77; }; }; } + { (exit 77); exit 77; }; } else ac_cv_sizeof_size_t=0 fi fi -rm -rf conftest.dSYM rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi rm -f conftest.val fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_sizeof_size_t" >&5 -$as_echo "$ac_cv_sizeof_size_t" >&6; } +{ echo "$as_me:$LINENO: result: $ac_cv_sizeof_size_t" >&5 +echo "${ECHO_T}$ac_cv_sizeof_size_t" >&6; } @@ -11171,14 +10745,68 @@ _ACEOF +{ echo "$as_me:$LINENO: checking for pid_t" >&5 +echo $ECHO_N "checking for pid_t... $ECHO_C" >&6; } +if test "${ac_cv_type_pid_t+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +typedef pid_t ac__type_new_; +int +main () +{ +if ((ac__type_new_ *) 0) + return 0; +if (sizeof (ac__type_new_)) + return 0; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_cv_type_pid_t=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_type_pid_t=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ echo "$as_me:$LINENO: result: $ac_cv_type_pid_t" >&5 +echo "${ECHO_T}$ac_cv_type_pid_t" >&6; } + # The cast to long int works around a bug in the HP C Compiler # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. # This bug is HP SR number 8606223364. -{ $as_echo "$as_me:$LINENO: checking size of pid_t" >&5 -$as_echo_n "checking size of pid_t... " >&6; } +{ echo "$as_me:$LINENO: checking size of pid_t" >&5 +echo $ECHO_N "checking size of pid_t... $ECHO_C" >&6; } if test "${ac_cv_sizeof_pid_t+set}" = set; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else if test "$cross_compiling" = yes; then # Depending upon the size, compute the lo and hi bounds. @@ -11189,10 +10817,11 @@ cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default + typedef pid_t ac__type_sizeof_; int main () { -static int test_array [1 - 2 * !(((long int) (sizeof (pid_t))) >= 0)]; +static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) >= 0)]; test_array [0] = 0 ; @@ -11205,14 +10834,13 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err @@ -11226,10 +10854,11 @@ cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default + typedef pid_t ac__type_sizeof_; int main () { -static int test_array [1 - 2 * !(((long int) (sizeof (pid_t))) <= $ac_mid)]; +static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) <= $ac_mid)]; test_array [0] = 0 ; @@ -11242,21 +10871,20 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_hi=$ac_mid; break else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo=`expr $ac_mid + 1` @@ -11270,7 +10898,7 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 cat >conftest.$ac_ext <<_ACEOF @@ -11280,10 +10908,11 @@ cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default + typedef pid_t ac__type_sizeof_; int main () { -static int test_array [1 - 2 * !(((long int) (sizeof (pid_t))) < 0)]; +static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) < 0)]; test_array [0] = 0 ; @@ -11296,14 +10925,13 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err @@ -11317,10 +10945,11 @@ cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default + typedef pid_t ac__type_sizeof_; int main () { -static int test_array [1 - 2 * !(((long int) (sizeof (pid_t))) >= $ac_mid)]; +static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) >= $ac_mid)]; test_array [0] = 0 ; @@ -11333,21 +10962,20 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_lo=$ac_mid; break else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_hi=`expr '(' $ac_mid ')' - 1` @@ -11361,7 +10989,7 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo= ac_hi= @@ -11381,10 +11009,11 @@ cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default + typedef pid_t ac__type_sizeof_; int main () { -static int test_array [1 - 2 * !(((long int) (sizeof (pid_t))) <= $ac_mid)]; +static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) <= $ac_mid)]; test_array [0] = 0 ; @@ -11397,21 +11026,20 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_hi=$ac_mid else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo=`expr '(' $ac_mid ')' + 1` @@ -11422,13 +11050,11 @@ case $ac_lo in ?*) ac_cv_sizeof_pid_t=$ac_lo;; '') if test "$ac_cv_type_pid_t" = yes; then - { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -{ { $as_echo "$as_me:$LINENO: error: cannot compute sizeof (pid_t) + { { echo "$as_me:$LINENO: error: cannot compute sizeof (pid_t) See \`config.log' for more details." >&5 -$as_echo "$as_me: error: cannot compute sizeof (pid_t) +echo "$as_me: error: cannot compute sizeof (pid_t) See \`config.log' for more details." >&2;} - { (exit 77); exit 77; }; }; } + { (exit 77); exit 77; }; } else ac_cv_sizeof_pid_t=0 fi ;; @@ -11441,8 +11067,9 @@ cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default -static long int longval () { return (long int) (sizeof (pid_t)); } -static unsigned long int ulongval () { return (long int) (sizeof (pid_t)); } + typedef pid_t ac__type_sizeof_; +static long int longval () { return (long int) (sizeof (ac__type_sizeof_)); } +static unsigned long int ulongval () { return (long int) (sizeof (ac__type_sizeof_)); } #include #include int @@ -11452,22 +11079,20 @@ FILE *f = fopen ("conftest.val", "w"); if (! f) return 1; - if (((long int) (sizeof (pid_t))) < 0) + if (((long int) (sizeof (ac__type_sizeof_))) < 0) { long int i = longval (); - if (i != ((long int) (sizeof (pid_t)))) + if (i != ((long int) (sizeof (ac__type_sizeof_)))) return 1; - fprintf (f, "%ld", i); + fprintf (f, "%ld\n", i); } else { unsigned long int i = ulongval (); - if (i != ((long int) (sizeof (pid_t)))) + if (i != ((long int) (sizeof (ac__type_sizeof_)))) return 1; - fprintf (f, "%lu", i); + fprintf (f, "%lu\n", i); } - /* Do not output a trailing newline, as this causes \r\n confusion - on some platforms. */ return ferror (f) || fclose (f) != 0; ; @@ -11480,48 +11105,43 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>&5 ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_try") 2>&5 ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_sizeof_pid_t=`cat conftest.val` else - $as_echo "$as_me: program exited with status $ac_status" >&5 -$as_echo "$as_me: failed program was:" >&5 + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) if test "$ac_cv_type_pid_t" = yes; then - { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -{ { $as_echo "$as_me:$LINENO: error: cannot compute sizeof (pid_t) + { { echo "$as_me:$LINENO: error: cannot compute sizeof (pid_t) See \`config.log' for more details." >&5 -$as_echo "$as_me: error: cannot compute sizeof (pid_t) +echo "$as_me: error: cannot compute sizeof (pid_t) See \`config.log' for more details." >&2;} - { (exit 77); exit 77; }; }; } + { (exit 77); exit 77; }; } else ac_cv_sizeof_pid_t=0 fi fi -rm -rf conftest.dSYM rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi rm -f conftest.val fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_sizeof_pid_t" >&5 -$as_echo "$ac_cv_sizeof_pid_t" >&6; } +{ echo "$as_me:$LINENO: result: $ac_cv_sizeof_pid_t" >&5 +echo "${ECHO_T}$ac_cv_sizeof_pid_t" >&6; } @@ -11531,8 +11151,8 @@ -{ $as_echo "$as_me:$LINENO: checking for long long support" >&5 -$as_echo_n "checking for long long support... " >&6; } +{ echo "$as_me:$LINENO: checking for long long support" >&5 +echo $ECHO_N "checking for long long support... $ECHO_C" >&6; } have_long_long=no cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ @@ -11555,14 +11175,13 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err @@ -11576,24 +11195,78 @@ have_long_long=yes else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -{ $as_echo "$as_me:$LINENO: result: $have_long_long" >&5 -$as_echo "$have_long_long" >&6; } +{ echo "$as_me:$LINENO: result: $have_long_long" >&5 +echo "${ECHO_T}$have_long_long" >&6; } if test "$have_long_long" = yes ; then +{ echo "$as_me:$LINENO: checking for long long" >&5 +echo $ECHO_N "checking for long long... $ECHO_C" >&6; } +if test "${ac_cv_type_long_long+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +typedef long long ac__type_new_; +int +main () +{ +if ((ac__type_new_ *) 0) + return 0; +if (sizeof (ac__type_new_)) + return 0; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_cv_type_long_long=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_type_long_long=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ echo "$as_me:$LINENO: result: $ac_cv_type_long_long" >&5 +echo "${ECHO_T}$ac_cv_type_long_long" >&6; } + # The cast to long int works around a bug in the HP C Compiler # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. # This bug is HP SR number 8606223364. -{ $as_echo "$as_me:$LINENO: checking size of long long" >&5 -$as_echo_n "checking size of long long... " >&6; } +{ echo "$as_me:$LINENO: checking size of long long" >&5 +echo $ECHO_N "checking size of long long... $ECHO_C" >&6; } if test "${ac_cv_sizeof_long_long+set}" = set; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else if test "$cross_compiling" = yes; then # Depending upon the size, compute the lo and hi bounds. @@ -11604,10 +11277,11 @@ cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default + typedef long long ac__type_sizeof_; int main () { -static int test_array [1 - 2 * !(((long int) (sizeof (long long))) >= 0)]; +static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) >= 0)]; test_array [0] = 0 ; @@ -11620,14 +11294,13 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err @@ -11641,10 +11314,11 @@ cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default + typedef long long ac__type_sizeof_; int main () { -static int test_array [1 - 2 * !(((long int) (sizeof (long long))) <= $ac_mid)]; +static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) <= $ac_mid)]; test_array [0] = 0 ; @@ -11657,21 +11331,20 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_hi=$ac_mid; break else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo=`expr $ac_mid + 1` @@ -11685,7 +11358,7 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 cat >conftest.$ac_ext <<_ACEOF @@ -11695,10 +11368,11 @@ cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default + typedef long long ac__type_sizeof_; int main () { -static int test_array [1 - 2 * !(((long int) (sizeof (long long))) < 0)]; +static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) < 0)]; test_array [0] = 0 ; @@ -11711,14 +11385,13 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err @@ -11732,10 +11405,11 @@ cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default + typedef long long ac__type_sizeof_; int main () { -static int test_array [1 - 2 * !(((long int) (sizeof (long long))) >= $ac_mid)]; +static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) >= $ac_mid)]; test_array [0] = 0 ; @@ -11748,21 +11422,20 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_lo=$ac_mid; break else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_hi=`expr '(' $ac_mid ')' - 1` @@ -11776,7 +11449,7 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo= ac_hi= @@ -11796,10 +11469,11 @@ cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default + typedef long long ac__type_sizeof_; int main () { -static int test_array [1 - 2 * !(((long int) (sizeof (long long))) <= $ac_mid)]; +static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) <= $ac_mid)]; test_array [0] = 0 ; @@ -11812,21 +11486,20 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_hi=$ac_mid else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo=`expr '(' $ac_mid ')' + 1` @@ -11837,13 +11510,11 @@ case $ac_lo in ?*) ac_cv_sizeof_long_long=$ac_lo;; '') if test "$ac_cv_type_long_long" = yes; then - { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -{ { $as_echo "$as_me:$LINENO: error: cannot compute sizeof (long long) + { { echo "$as_me:$LINENO: error: cannot compute sizeof (long long) See \`config.log' for more details." >&5 -$as_echo "$as_me: error: cannot compute sizeof (long long) +echo "$as_me: error: cannot compute sizeof (long long) See \`config.log' for more details." >&2;} - { (exit 77); exit 77; }; }; } + { (exit 77); exit 77; }; } else ac_cv_sizeof_long_long=0 fi ;; @@ -11856,8 +11527,9 @@ cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default -static long int longval () { return (long int) (sizeof (long long)); } -static unsigned long int ulongval () { return (long int) (sizeof (long long)); } + typedef long long ac__type_sizeof_; +static long int longval () { return (long int) (sizeof (ac__type_sizeof_)); } +static unsigned long int ulongval () { return (long int) (sizeof (ac__type_sizeof_)); } #include #include int @@ -11867,22 +11539,20 @@ FILE *f = fopen ("conftest.val", "w"); if (! f) return 1; - if (((long int) (sizeof (long long))) < 0) + if (((long int) (sizeof (ac__type_sizeof_))) < 0) { long int i = longval (); - if (i != ((long int) (sizeof (long long)))) + if (i != ((long int) (sizeof (ac__type_sizeof_)))) return 1; - fprintf (f, "%ld", i); + fprintf (f, "%ld\n", i); } else { unsigned long int i = ulongval (); - if (i != ((long int) (sizeof (long long)))) + if (i != ((long int) (sizeof (ac__type_sizeof_)))) return 1; - fprintf (f, "%lu", i); + fprintf (f, "%lu\n", i); } - /* Do not output a trailing newline, as this causes \r\n confusion - on some platforms. */ return ferror (f) || fclose (f) != 0; ; @@ -11895,48 +11565,43 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>&5 ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_try") 2>&5 ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_sizeof_long_long=`cat conftest.val` else - $as_echo "$as_me: program exited with status $ac_status" >&5 -$as_echo "$as_me: failed program was:" >&5 + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) if test "$ac_cv_type_long_long" = yes; then - { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -{ { $as_echo "$as_me:$LINENO: error: cannot compute sizeof (long long) + { { echo "$as_me:$LINENO: error: cannot compute sizeof (long long) See \`config.log' for more details." >&5 -$as_echo "$as_me: error: cannot compute sizeof (long long) +echo "$as_me: error: cannot compute sizeof (long long) See \`config.log' for more details." >&2;} - { (exit 77); exit 77; }; }; } + { (exit 77); exit 77; }; } else ac_cv_sizeof_long_long=0 fi fi -rm -rf conftest.dSYM rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi rm -f conftest.val fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_sizeof_long_long" >&5 -$as_echo "$ac_cv_sizeof_long_long" >&6; } +{ echo "$as_me:$LINENO: result: $ac_cv_sizeof_long_long" >&5 +echo "${ECHO_T}$ac_cv_sizeof_long_long" >&6; } @@ -11947,8 +11612,8 @@ fi -{ $as_echo "$as_me:$LINENO: checking for long double support" >&5 -$as_echo_n "checking for long double support... " >&6; } +{ echo "$as_me:$LINENO: checking for long double support" >&5 +echo $ECHO_N "checking for long double support... $ECHO_C" >&6; } have_long_double=no cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ @@ -11971,14 +11636,13 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err @@ -11992,24 +11656,78 @@ have_long_double=yes else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -{ $as_echo "$as_me:$LINENO: result: $have_long_double" >&5 -$as_echo "$have_long_double" >&6; } +{ echo "$as_me:$LINENO: result: $have_long_double" >&5 +echo "${ECHO_T}$have_long_double" >&6; } if test "$have_long_double" = yes ; then +{ echo "$as_me:$LINENO: checking for long double" >&5 +echo $ECHO_N "checking for long double... $ECHO_C" >&6; } +if test "${ac_cv_type_long_double+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +typedef long double ac__type_new_; +int +main () +{ +if ((ac__type_new_ *) 0) + return 0; +if (sizeof (ac__type_new_)) + return 0; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_cv_type_long_double=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_type_long_double=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ echo "$as_me:$LINENO: result: $ac_cv_type_long_double" >&5 +echo "${ECHO_T}$ac_cv_type_long_double" >&6; } + # The cast to long int works around a bug in the HP C Compiler # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. # This bug is HP SR number 8606223364. -{ $as_echo "$as_me:$LINENO: checking size of long double" >&5 -$as_echo_n "checking size of long double... " >&6; } +{ echo "$as_me:$LINENO: checking size of long double" >&5 +echo $ECHO_N "checking size of long double... $ECHO_C" >&6; } if test "${ac_cv_sizeof_long_double+set}" = set; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else if test "$cross_compiling" = yes; then # Depending upon the size, compute the lo and hi bounds. @@ -12020,10 +11738,11 @@ cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default + typedef long double ac__type_sizeof_; int main () { -static int test_array [1 - 2 * !(((long int) (sizeof (long double))) >= 0)]; +static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) >= 0)]; test_array [0] = 0 ; @@ -12036,14 +11755,13 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err @@ -12057,10 +11775,11 @@ cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default + typedef long double ac__type_sizeof_; int main () { -static int test_array [1 - 2 * !(((long int) (sizeof (long double))) <= $ac_mid)]; +static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) <= $ac_mid)]; test_array [0] = 0 ; @@ -12073,21 +11792,20 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_hi=$ac_mid; break else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo=`expr $ac_mid + 1` @@ -12101,7 +11819,7 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 cat >conftest.$ac_ext <<_ACEOF @@ -12111,10 +11829,11 @@ cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default + typedef long double ac__type_sizeof_; int main () { -static int test_array [1 - 2 * !(((long int) (sizeof (long double))) < 0)]; +static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) < 0)]; test_array [0] = 0 ; @@ -12127,14 +11846,13 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err @@ -12148,10 +11866,11 @@ cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default + typedef long double ac__type_sizeof_; int main () { -static int test_array [1 - 2 * !(((long int) (sizeof (long double))) >= $ac_mid)]; +static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) >= $ac_mid)]; test_array [0] = 0 ; @@ -12164,21 +11883,20 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_lo=$ac_mid; break else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_hi=`expr '(' $ac_mid ')' - 1` @@ -12192,7 +11910,7 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo= ac_hi= @@ -12212,10 +11930,11 @@ cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default + typedef long double ac__type_sizeof_; int main () { -static int test_array [1 - 2 * !(((long int) (sizeof (long double))) <= $ac_mid)]; +static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) <= $ac_mid)]; test_array [0] = 0 ; @@ -12228,21 +11947,20 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_hi=$ac_mid else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo=`expr '(' $ac_mid ')' + 1` @@ -12253,13 +11971,11 @@ case $ac_lo in ?*) ac_cv_sizeof_long_double=$ac_lo;; '') if test "$ac_cv_type_long_double" = yes; then - { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -{ { $as_echo "$as_me:$LINENO: error: cannot compute sizeof (long double) + { { echo "$as_me:$LINENO: error: cannot compute sizeof (long double) See \`config.log' for more details." >&5 -$as_echo "$as_me: error: cannot compute sizeof (long double) +echo "$as_me: error: cannot compute sizeof (long double) See \`config.log' for more details." >&2;} - { (exit 77); exit 77; }; }; } + { (exit 77); exit 77; }; } else ac_cv_sizeof_long_double=0 fi ;; @@ -12272,8 +11988,9 @@ cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default -static long int longval () { return (long int) (sizeof (long double)); } -static unsigned long int ulongval () { return (long int) (sizeof (long double)); } + typedef long double ac__type_sizeof_; +static long int longval () { return (long int) (sizeof (ac__type_sizeof_)); } +static unsigned long int ulongval () { return (long int) (sizeof (ac__type_sizeof_)); } #include #include int @@ -12283,22 +12000,20 @@ FILE *f = fopen ("conftest.val", "w"); if (! f) return 1; - if (((long int) (sizeof (long double))) < 0) + if (((long int) (sizeof (ac__type_sizeof_))) < 0) { long int i = longval (); - if (i != ((long int) (sizeof (long double)))) + if (i != ((long int) (sizeof (ac__type_sizeof_)))) return 1; - fprintf (f, "%ld", i); + fprintf (f, "%ld\n", i); } else { unsigned long int i = ulongval (); - if (i != ((long int) (sizeof (long double)))) + if (i != ((long int) (sizeof (ac__type_sizeof_)))) return 1; - fprintf (f, "%lu", i); + fprintf (f, "%lu\n", i); } - /* Do not output a trailing newline, as this causes \r\n confusion - on some platforms. */ return ferror (f) || fclose (f) != 0; ; @@ -12311,48 +12026,43 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>&5 ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_try") 2>&5 ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_sizeof_long_double=`cat conftest.val` else - $as_echo "$as_me: program exited with status $ac_status" >&5 -$as_echo "$as_me: failed program was:" >&5 + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) if test "$ac_cv_type_long_double" = yes; then - { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -{ { $as_echo "$as_me:$LINENO: error: cannot compute sizeof (long double) + { { echo "$as_me:$LINENO: error: cannot compute sizeof (long double) See \`config.log' for more details." >&5 -$as_echo "$as_me: error: cannot compute sizeof (long double) +echo "$as_me: error: cannot compute sizeof (long double) See \`config.log' for more details." >&2;} - { (exit 77); exit 77; }; }; } + { (exit 77); exit 77; }; } else ac_cv_sizeof_long_double=0 fi fi -rm -rf conftest.dSYM rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi rm -f conftest.val fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_sizeof_long_double" >&5 -$as_echo "$ac_cv_sizeof_long_double" >&6; } +{ echo "$as_me:$LINENO: result: $ac_cv_sizeof_long_double" >&5 +echo "${ECHO_T}$ac_cv_sizeof_long_double" >&6; } @@ -12363,8 +12073,8 @@ fi -{ $as_echo "$as_me:$LINENO: checking for _Bool support" >&5 -$as_echo_n "checking for _Bool support... " >&6; } +{ echo "$as_me:$LINENO: checking for _Bool support" >&5 +echo $ECHO_N "checking for _Bool support... $ECHO_C" >&6; } have_c99_bool=no cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ @@ -12387,14 +12097,13 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err @@ -12408,24 +12117,78 @@ have_c99_bool=yes else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -{ $as_echo "$as_me:$LINENO: result: $have_c99_bool" >&5 -$as_echo "$have_c99_bool" >&6; } +{ echo "$as_me:$LINENO: result: $have_c99_bool" >&5 +echo "${ECHO_T}$have_c99_bool" >&6; } if test "$have_c99_bool" = yes ; then +{ echo "$as_me:$LINENO: checking for _Bool" >&5 +echo $ECHO_N "checking for _Bool... $ECHO_C" >&6; } +if test "${ac_cv_type__Bool+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +typedef _Bool ac__type_new_; +int +main () +{ +if ((ac__type_new_ *) 0) + return 0; +if (sizeof (ac__type_new_)) + return 0; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_cv_type__Bool=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_type__Bool=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ echo "$as_me:$LINENO: result: $ac_cv_type__Bool" >&5 +echo "${ECHO_T}$ac_cv_type__Bool" >&6; } + # The cast to long int works around a bug in the HP C Compiler # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. # This bug is HP SR number 8606223364. -{ $as_echo "$as_me:$LINENO: checking size of _Bool" >&5 -$as_echo_n "checking size of _Bool... " >&6; } +{ echo "$as_me:$LINENO: checking size of _Bool" >&5 +echo $ECHO_N "checking size of _Bool... $ECHO_C" >&6; } if test "${ac_cv_sizeof__Bool+set}" = set; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else if test "$cross_compiling" = yes; then # Depending upon the size, compute the lo and hi bounds. @@ -12436,10 +12199,11 @@ cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default + typedef _Bool ac__type_sizeof_; int main () { -static int test_array [1 - 2 * !(((long int) (sizeof (_Bool))) >= 0)]; +static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) >= 0)]; test_array [0] = 0 ; @@ -12452,14 +12216,13 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err @@ -12473,10 +12236,11 @@ cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default + typedef _Bool ac__type_sizeof_; int main () { -static int test_array [1 - 2 * !(((long int) (sizeof (_Bool))) <= $ac_mid)]; +static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) <= $ac_mid)]; test_array [0] = 0 ; @@ -12489,21 +12253,20 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_hi=$ac_mid; break else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo=`expr $ac_mid + 1` @@ -12517,7 +12280,7 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 cat >conftest.$ac_ext <<_ACEOF @@ -12527,10 +12290,11 @@ cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default + typedef _Bool ac__type_sizeof_; int main () { -static int test_array [1 - 2 * !(((long int) (sizeof (_Bool))) < 0)]; +static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) < 0)]; test_array [0] = 0 ; @@ -12543,14 +12307,13 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err @@ -12564,10 +12327,11 @@ cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default + typedef _Bool ac__type_sizeof_; int main () { -static int test_array [1 - 2 * !(((long int) (sizeof (_Bool))) >= $ac_mid)]; +static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) >= $ac_mid)]; test_array [0] = 0 ; @@ -12580,21 +12344,20 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_lo=$ac_mid; break else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_hi=`expr '(' $ac_mid ')' - 1` @@ -12608,7 +12371,7 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo= ac_hi= @@ -12628,10 +12391,11 @@ cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default + typedef _Bool ac__type_sizeof_; int main () { -static int test_array [1 - 2 * !(((long int) (sizeof (_Bool))) <= $ac_mid)]; +static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) <= $ac_mid)]; test_array [0] = 0 ; @@ -12644,21 +12408,20 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_hi=$ac_mid else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo=`expr '(' $ac_mid ')' + 1` @@ -12669,13 +12432,11 @@ case $ac_lo in ?*) ac_cv_sizeof__Bool=$ac_lo;; '') if test "$ac_cv_type__Bool" = yes; then - { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -{ { $as_echo "$as_me:$LINENO: error: cannot compute sizeof (_Bool) + { { echo "$as_me:$LINENO: error: cannot compute sizeof (_Bool) See \`config.log' for more details." >&5 -$as_echo "$as_me: error: cannot compute sizeof (_Bool) +echo "$as_me: error: cannot compute sizeof (_Bool) See \`config.log' for more details." >&2;} - { (exit 77); exit 77; }; }; } + { (exit 77); exit 77; }; } else ac_cv_sizeof__Bool=0 fi ;; @@ -12688,8 +12449,9 @@ cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default -static long int longval () { return (long int) (sizeof (_Bool)); } -static unsigned long int ulongval () { return (long int) (sizeof (_Bool)); } + typedef _Bool ac__type_sizeof_; +static long int longval () { return (long int) (sizeof (ac__type_sizeof_)); } +static unsigned long int ulongval () { return (long int) (sizeof (ac__type_sizeof_)); } #include #include int @@ -12699,22 +12461,20 @@ FILE *f = fopen ("conftest.val", "w"); if (! f) return 1; - if (((long int) (sizeof (_Bool))) < 0) + if (((long int) (sizeof (ac__type_sizeof_))) < 0) { long int i = longval (); - if (i != ((long int) (sizeof (_Bool)))) + if (i != ((long int) (sizeof (ac__type_sizeof_)))) return 1; - fprintf (f, "%ld", i); + fprintf (f, "%ld\n", i); } else { unsigned long int i = ulongval (); - if (i != ((long int) (sizeof (_Bool)))) + if (i != ((long int) (sizeof (ac__type_sizeof_)))) return 1; - fprintf (f, "%lu", i); + fprintf (f, "%lu\n", i); } - /* Do not output a trailing newline, as this causes \r\n confusion - on some platforms. */ return ferror (f) || fclose (f) != 0; ; @@ -12727,48 +12487,43 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>&5 ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_try") 2>&5 ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_sizeof__Bool=`cat conftest.val` else - $as_echo "$as_me: program exited with status $ac_status" >&5 -$as_echo "$as_me: failed program was:" >&5 + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) if test "$ac_cv_type__Bool" = yes; then - { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -{ { $as_echo "$as_me:$LINENO: error: cannot compute sizeof (_Bool) + { { echo "$as_me:$LINENO: error: cannot compute sizeof (_Bool) See \`config.log' for more details." >&5 -$as_echo "$as_me: error: cannot compute sizeof (_Bool) +echo "$as_me: error: cannot compute sizeof (_Bool) See \`config.log' for more details." >&2;} - { (exit 77); exit 77; }; }; } + { (exit 77); exit 77; }; } else ac_cv_sizeof__Bool=0 fi fi -rm -rf conftest.dSYM rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi rm -f conftest.val fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_sizeof__Bool" >&5 -$as_echo "$ac_cv_sizeof__Bool" >&6; } +{ echo "$as_me:$LINENO: result: $ac_cv_sizeof__Bool" >&5 +echo "${ECHO_T}$ac_cv_sizeof__Bool" >&6; } @@ -12779,13 +12534,12 @@ fi -{ $as_echo "$as_me:$LINENO: checking for uintptr_t" >&5 -$as_echo_n "checking for uintptr_t... " >&6; } +{ echo "$as_me:$LINENO: checking for uintptr_t" >&5 +echo $ECHO_N "checking for uintptr_t... $ECHO_C" >&6; } if test "${ac_cv_type_uintptr_t+set}" = set; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else - ac_cv_type_uintptr_t=no -cat >conftest.$ac_ext <<_ACEOF + cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -12795,11 +12549,14 @@ #include #endif +typedef uintptr_t ac__type_new_; int main () { -if (sizeof (uintptr_t)) - return 0; +if ((ac__type_new_ *) 0) + return 0; +if (sizeof (ac__type_new_)) + return 0; ; return 0; } @@ -12810,33 +12567,55 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then + ac_cv_type_uintptr_t=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_type_uintptr_t=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ echo "$as_me:$LINENO: result: $ac_cv_type_uintptr_t" >&5 +echo "${ECHO_T}$ac_cv_type_uintptr_t" >&6; } +if test $ac_cv_type_uintptr_t = yes; then + +cat >>confdefs.h <<_ACEOF +#define HAVE_UINTPTR_T 1 +_ACEOF + +{ echo "$as_me:$LINENO: checking for uintptr_t" >&5 +echo $ECHO_N "checking for uintptr_t... $ECHO_C" >&6; } +if test "${ac_cv_type_uintptr_t+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#ifdef HAVE_STDINT_H - #include - #endif - +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +typedef uintptr_t ac__type_new_; int main () { -if (sizeof ((uintptr_t))) - return 0; +if ((ac__type_new_ *) 0) + return 0; +if (sizeof (ac__type_new_)) + return 0; ; return 0; } @@ -12847,52 +12626,38 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then - : -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_cv_type_uintptr_t=yes -fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + ac_cv_type_uintptr_t=yes else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 - + ac_cv_type_uintptr_t=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_type_uintptr_t" >&5 -$as_echo "$ac_cv_type_uintptr_t" >&6; } -if test "x$ac_cv_type_uintptr_t" = x""yes; then - -cat >>confdefs.h <<_ACEOF -#define HAVE_UINTPTR_T 1 -_ACEOF +{ echo "$as_me:$LINENO: result: $ac_cv_type_uintptr_t" >&5 +echo "${ECHO_T}$ac_cv_type_uintptr_t" >&6; } # The cast to long int works around a bug in the HP C Compiler # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. # This bug is HP SR number 8606223364. -{ $as_echo "$as_me:$LINENO: checking size of uintptr_t" >&5 -$as_echo_n "checking size of uintptr_t... " >&6; } +{ echo "$as_me:$LINENO: checking size of uintptr_t" >&5 +echo $ECHO_N "checking size of uintptr_t... $ECHO_C" >&6; } if test "${ac_cv_sizeof_uintptr_t+set}" = set; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else if test "$cross_compiling" = yes; then # Depending upon the size, compute the lo and hi bounds. @@ -12903,10 +12668,11 @@ cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default + typedef uintptr_t ac__type_sizeof_; int main () { -static int test_array [1 - 2 * !(((long int) (sizeof (uintptr_t))) >= 0)]; +static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) >= 0)]; test_array [0] = 0 ; @@ -12919,14 +12685,13 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err @@ -12940,10 +12705,11 @@ cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default + typedef uintptr_t ac__type_sizeof_; int main () { -static int test_array [1 - 2 * !(((long int) (sizeof (uintptr_t))) <= $ac_mid)]; +static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) <= $ac_mid)]; test_array [0] = 0 ; @@ -12956,21 +12722,20 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_hi=$ac_mid; break else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo=`expr $ac_mid + 1` @@ -12984,7 +12749,7 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 cat >conftest.$ac_ext <<_ACEOF @@ -12994,10 +12759,11 @@ cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default + typedef uintptr_t ac__type_sizeof_; int main () { -static int test_array [1 - 2 * !(((long int) (sizeof (uintptr_t))) < 0)]; +static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) < 0)]; test_array [0] = 0 ; @@ -13010,14 +12776,13 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err @@ -13031,10 +12796,11 @@ cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default + typedef uintptr_t ac__type_sizeof_; int main () { -static int test_array [1 - 2 * !(((long int) (sizeof (uintptr_t))) >= $ac_mid)]; +static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) >= $ac_mid)]; test_array [0] = 0 ; @@ -13047,21 +12813,20 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_lo=$ac_mid; break else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_hi=`expr '(' $ac_mid ')' - 1` @@ -13075,7 +12840,7 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo= ac_hi= @@ -13095,10 +12860,11 @@ cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default + typedef uintptr_t ac__type_sizeof_; int main () { -static int test_array [1 - 2 * !(((long int) (sizeof (uintptr_t))) <= $ac_mid)]; +static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) <= $ac_mid)]; test_array [0] = 0 ; @@ -13111,21 +12877,20 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_hi=$ac_mid else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo=`expr '(' $ac_mid ')' + 1` @@ -13136,13 +12901,11 @@ case $ac_lo in ?*) ac_cv_sizeof_uintptr_t=$ac_lo;; '') if test "$ac_cv_type_uintptr_t" = yes; then - { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -{ { $as_echo "$as_me:$LINENO: error: cannot compute sizeof (uintptr_t) + { { echo "$as_me:$LINENO: error: cannot compute sizeof (uintptr_t) See \`config.log' for more details." >&5 -$as_echo "$as_me: error: cannot compute sizeof (uintptr_t) +echo "$as_me: error: cannot compute sizeof (uintptr_t) See \`config.log' for more details." >&2;} - { (exit 77); exit 77; }; }; } + { (exit 77); exit 77; }; } else ac_cv_sizeof_uintptr_t=0 fi ;; @@ -13155,8 +12918,9 @@ cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default -static long int longval () { return (long int) (sizeof (uintptr_t)); } -static unsigned long int ulongval () { return (long int) (sizeof (uintptr_t)); } + typedef uintptr_t ac__type_sizeof_; +static long int longval () { return (long int) (sizeof (ac__type_sizeof_)); } +static unsigned long int ulongval () { return (long int) (sizeof (ac__type_sizeof_)); } #include #include int @@ -13166,22 +12930,20 @@ FILE *f = fopen ("conftest.val", "w"); if (! f) return 1; - if (((long int) (sizeof (uintptr_t))) < 0) + if (((long int) (sizeof (ac__type_sizeof_))) < 0) { long int i = longval (); - if (i != ((long int) (sizeof (uintptr_t)))) + if (i != ((long int) (sizeof (ac__type_sizeof_)))) return 1; - fprintf (f, "%ld", i); + fprintf (f, "%ld\n", i); } else { unsigned long int i = ulongval (); - if (i != ((long int) (sizeof (uintptr_t)))) + if (i != ((long int) (sizeof (ac__type_sizeof_)))) return 1; - fprintf (f, "%lu", i); + fprintf (f, "%lu\n", i); } - /* Do not output a trailing newline, as this causes \r\n confusion - on some platforms. */ return ferror (f) || fclose (f) != 0; ; @@ -13194,48 +12956,43 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>&5 ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_try") 2>&5 ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_sizeof_uintptr_t=`cat conftest.val` else - $as_echo "$as_me: program exited with status $ac_status" >&5 -$as_echo "$as_me: failed program was:" >&5 + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) if test "$ac_cv_type_uintptr_t" = yes; then - { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -{ { $as_echo "$as_me:$LINENO: error: cannot compute sizeof (uintptr_t) + { { echo "$as_me:$LINENO: error: cannot compute sizeof (uintptr_t) See \`config.log' for more details." >&5 -$as_echo "$as_me: error: cannot compute sizeof (uintptr_t) +echo "$as_me: error: cannot compute sizeof (uintptr_t) See \`config.log' for more details." >&2;} - { (exit 77); exit 77; }; }; } + { (exit 77); exit 77; }; } else ac_cv_sizeof_uintptr_t=0 fi fi -rm -rf conftest.dSYM rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi rm -f conftest.val fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_sizeof_uintptr_t" >&5 -$as_echo "$ac_cv_sizeof_uintptr_t" >&6; } +{ echo "$as_me:$LINENO: result: $ac_cv_sizeof_uintptr_t" >&5 +echo "${ECHO_T}$ac_cv_sizeof_uintptr_t" >&6; } @@ -13249,10 +13006,10 @@ # Hmph. AC_CHECK_SIZEOF() doesn't include . -{ $as_echo "$as_me:$LINENO: checking size of off_t" >&5 -$as_echo_n "checking size of off_t... " >&6; } +{ echo "$as_me:$LINENO: checking size of off_t" >&5 +echo $ECHO_N "checking size of off_t... $ECHO_C" >&6; } if test "${ac_cv_sizeof_off_t+set}" = set; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else if test "$cross_compiling" = yes; then ac_cv_sizeof_off_t=4 @@ -13279,32 +13036,29 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>&5 ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_try") 2>&5 ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_sizeof_off_t=`cat conftestval` else - $as_echo "$as_me: program exited with status $ac_status" >&5 -$as_echo "$as_me: failed program was:" >&5 + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) ac_cv_sizeof_off_t=0 fi -rm -rf conftest.dSYM rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi @@ -13312,16 +13066,16 @@ fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_sizeof_off_t" >&5 -$as_echo "$ac_cv_sizeof_off_t" >&6; } +{ echo "$as_me:$LINENO: result: $ac_cv_sizeof_off_t" >&5 +echo "${ECHO_T}$ac_cv_sizeof_off_t" >&6; } cat >>confdefs.h <<_ACEOF #define SIZEOF_OFF_T $ac_cv_sizeof_off_t _ACEOF -{ $as_echo "$as_me:$LINENO: checking whether to enable large file support" >&5 -$as_echo_n "checking whether to enable large file support... " >&6; } +{ echo "$as_me:$LINENO: checking whether to enable large file support" >&5 +echo $ECHO_N "checking whether to enable large file support... $ECHO_C" >&6; } if test "$have_long_long" = yes -a \ "$ac_cv_sizeof_off_t" -gt "$ac_cv_sizeof_long" -a \ "$ac_cv_sizeof_long_long" -ge "$ac_cv_sizeof_off_t"; then @@ -13330,18 +13084,18 @@ #define HAVE_LARGEFILE_SUPPORT 1 _ACEOF - { $as_echo "$as_me:$LINENO: result: yes" >&5 -$as_echo "yes" >&6; } + { echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; } else - { $as_echo "$as_me:$LINENO: result: no" >&5 -$as_echo "no" >&6; } + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } fi # AC_CHECK_SIZEOF() doesn't include . -{ $as_echo "$as_me:$LINENO: checking size of time_t" >&5 -$as_echo_n "checking size of time_t... " >&6; } +{ echo "$as_me:$LINENO: checking size of time_t" >&5 +echo $ECHO_N "checking size of time_t... $ECHO_C" >&6; } if test "${ac_cv_sizeof_time_t+set}" = set; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else if test "$cross_compiling" = yes; then ac_cv_sizeof_time_t=4 @@ -13368,32 +13122,29 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>&5 ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_try") 2>&5 ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_sizeof_time_t=`cat conftestval` else - $as_echo "$as_me: program exited with status $ac_status" >&5 -$as_echo "$as_me: failed program was:" >&5 + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) ac_cv_sizeof_time_t=0 fi -rm -rf conftest.dSYM rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi @@ -13401,8 +13152,8 @@ fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_sizeof_time_t" >&5 -$as_echo "$ac_cv_sizeof_time_t" >&6; } +{ echo "$as_me:$LINENO: result: $ac_cv_sizeof_time_t" >&5 +echo "${ECHO_T}$ac_cv_sizeof_time_t" >&6; } cat >>confdefs.h <<_ACEOF #define SIZEOF_TIME_T $ac_cv_sizeof_time_t @@ -13419,8 +13170,8 @@ elif test "$ac_cv_pthread" = "yes" then CC="$CC -pthread" fi -{ $as_echo "$as_me:$LINENO: checking for pthread_t" >&5 -$as_echo_n "checking for pthread_t... " >&6; } +{ echo "$as_me:$LINENO: checking for pthread_t" >&5 +echo $ECHO_N "checking for pthread_t... $ECHO_C" >&6; } have_pthread_t=no cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ @@ -13443,35 +13194,34 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then have_pthread_t=yes else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -{ $as_echo "$as_me:$LINENO: result: $have_pthread_t" >&5 -$as_echo "$have_pthread_t" >&6; } +{ echo "$as_me:$LINENO: result: $have_pthread_t" >&5 +echo "${ECHO_T}$have_pthread_t" >&6; } if test "$have_pthread_t" = yes ; then # AC_CHECK_SIZEOF() doesn't include . - { $as_echo "$as_me:$LINENO: checking size of pthread_t" >&5 -$as_echo_n "checking size of pthread_t... " >&6; } + { echo "$as_me:$LINENO: checking size of pthread_t" >&5 +echo $ECHO_N "checking size of pthread_t... $ECHO_C" >&6; } if test "${ac_cv_sizeof_pthread_t+set}" = set; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else if test "$cross_compiling" = yes; then ac_cv_sizeof_pthread_t=4 @@ -13498,32 +13248,29 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>&5 ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_try") 2>&5 ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_sizeof_pthread_t=`cat conftestval` else - $as_echo "$as_me: program exited with status $ac_status" >&5 -$as_echo "$as_me: failed program was:" >&5 + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) ac_cv_sizeof_pthread_t=0 fi -rm -rf conftest.dSYM rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi @@ -13531,8 +13278,8 @@ fi - { $as_echo "$as_me:$LINENO: result: $ac_cv_sizeof_pthread_t" >&5 -$as_echo "$ac_cv_sizeof_pthread_t" >&6; } + { echo "$as_me:$LINENO: result: $ac_cv_sizeof_pthread_t" >&5 +echo "${ECHO_T}$ac_cv_sizeof_pthread_t" >&6; } cat >>confdefs.h <<_ACEOF #define SIZEOF_PTHREAD_T $ac_cv_sizeof_pthread_t @@ -13541,8 +13288,8 @@ fi CC="$ac_save_cc" -{ $as_echo "$as_me:$LINENO: checking for --enable-toolbox-glue" >&5 -$as_echo_n "checking for --enable-toolbox-glue... " >&6; } +{ echo "$as_me:$LINENO: checking for --enable-toolbox-glue" >&5 +echo $ECHO_N "checking for --enable-toolbox-glue... $ECHO_C" >&6; } # Check whether --enable-toolbox-glue was given. if test "${enable_toolbox_glue+set}" = set; then enableval=$enable_toolbox_glue; @@ -13573,8 +13320,8 @@ extra_undefs="" ;; esac -{ $as_echo "$as_me:$LINENO: result: $enable_toolbox_glue" >&5 -$as_echo "$enable_toolbox_glue" >&6; } +{ echo "$as_me:$LINENO: result: $enable_toolbox_glue" >&5 +echo "${ECHO_T}$enable_toolbox_glue" >&6; } @@ -13611,8 +13358,8 @@ LIBTOOL_CRUFT=$LIBTOOL_CRUFT' -compatibility_version $(VERSION) -current_version $(VERSION)';; esac -{ $as_echo "$as_me:$LINENO: checking for --enable-framework" >&5 -$as_echo_n "checking for --enable-framework... " >&6; } +{ echo "$as_me:$LINENO: checking for --enable-framework" >&5 +echo $ECHO_N "checking for --enable-framework... $ECHO_C" >&6; } if test "$enable_framework" then BASECFLAGS="$BASECFLAGS -fno-common -dynamic" @@ -13623,15 +13370,21 @@ #define WITH_NEXT_FRAMEWORK 1 _ACEOF - { $as_echo "$as_me:$LINENO: result: yes" >&5 -$as_echo "yes" >&6; } + { echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; } + if test $enable_shared = "yes" + then + { { echo "$as_me:$LINENO: error: Specifying both --enable-shared and --enable-framework is not supported, use only --enable-framework instead" >&5 +echo "$as_me: error: Specifying both --enable-shared and --enable-framework is not supported, use only --enable-framework instead" >&2;} + { (exit 1); exit 1; }; } + fi else - { $as_echo "$as_me:$LINENO: result: no" >&5 -$as_echo "no" >&6; } + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } fi -{ $as_echo "$as_me:$LINENO: checking for dyld" >&5 -$as_echo_n "checking for dyld... " >&6; } +{ echo "$as_me:$LINENO: checking for dyld" >&5 +echo $ECHO_N "checking for dyld... $ECHO_C" >&6; } case $ac_sys_system/$ac_sys_release in Darwin/*) @@ -13639,12 +13392,12 @@ #define WITH_DYLD 1 _ACEOF - { $as_echo "$as_me:$LINENO: result: always on for Darwin" >&5 -$as_echo "always on for Darwin" >&6; } + { echo "$as_me:$LINENO: result: always on for Darwin" >&5 +echo "${ECHO_T}always on for Darwin" >&6; } ;; *) - { $as_echo "$as_me:$LINENO: result: no" >&5 -$as_echo "no" >&6; } + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } ;; esac @@ -13656,8 +13409,8 @@ # SO is the extension of shared libraries `(including the dot!) # -- usually .so, .sl on HP-UX, .dll on Cygwin -{ $as_echo "$as_me:$LINENO: checking SO" >&5 -$as_echo_n "checking SO... " >&6; } +{ echo "$as_me:$LINENO: checking SO" >&5 +echo $ECHO_N "checking SO... $ECHO_C" >&6; } if test -z "$SO" then case $ac_sys_system in @@ -13682,8 +13435,8 @@ echo '=====================================================================' sleep 10 fi -{ $as_echo "$as_me:$LINENO: result: $SO" >&5 -$as_echo "$SO" >&6; } +{ echo "$as_me:$LINENO: result: $SO" >&5 +echo "${ECHO_T}$SO" >&6; } cat >>confdefs.h <<_ACEOF @@ -13694,8 +13447,8 @@ # -- "cc -G" on SunOS 5.x, "ld -shared" on IRIX 5 # (Shared libraries in this instance are shared modules to be loaded into # Python, as opposed to building Python itself as a shared library.) -{ $as_echo "$as_me:$LINENO: checking LDSHARED" >&5 -$as_echo_n "checking LDSHARED... " >&6; } +{ echo "$as_me:$LINENO: checking LDSHARED" >&5 +echo $ECHO_N "checking LDSHARED... $ECHO_C" >&6; } if test -z "$LDSHARED" then case $ac_sys_system/$ac_sys_release in @@ -13801,13 +13554,13 @@ *) LDSHARED="ld";; esac fi -{ $as_echo "$as_me:$LINENO: result: $LDSHARED" >&5 -$as_echo "$LDSHARED" >&6; } +{ echo "$as_me:$LINENO: result: $LDSHARED" >&5 +echo "${ECHO_T}$LDSHARED" >&6; } BLDSHARED=${BLDSHARED-$LDSHARED} # CCSHARED are the C *flags* used to create objects to go into a shared # library (module) -- this is only needed for a few systems -{ $as_echo "$as_me:$LINENO: checking CCSHARED" >&5 -$as_echo_n "checking CCSHARED... " >&6; } +{ echo "$as_me:$LINENO: checking CCSHARED" >&5 +echo $ECHO_N "checking CCSHARED... $ECHO_C" >&6; } if test -z "$CCSHARED" then case $ac_sys_system/$ac_sys_release in @@ -13842,12 +13595,12 @@ atheos*) CCSHARED="-fPIC";; esac fi -{ $as_echo "$as_me:$LINENO: result: $CCSHARED" >&5 -$as_echo "$CCSHARED" >&6; } +{ echo "$as_me:$LINENO: result: $CCSHARED" >&5 +echo "${ECHO_T}$CCSHARED" >&6; } # LINKFORSHARED are the flags passed to the $(CC) command that links # the python executable -- this is only needed for a few systems -{ $as_echo "$as_me:$LINENO: checking LINKFORSHARED" >&5 -$as_echo_n "checking LINKFORSHARED... " >&6; } +{ echo "$as_me:$LINENO: checking LINKFORSHARED" >&5 +echo $ECHO_N "checking LINKFORSHARED... $ECHO_C" >&6; } if test -z "$LINKFORSHARED" then case $ac_sys_system/$ac_sys_release in @@ -13902,13 +13655,13 @@ LINKFORSHARED='-Wl,-E -N 2048K';; esac fi -{ $as_echo "$as_me:$LINENO: result: $LINKFORSHARED" >&5 -$as_echo "$LINKFORSHARED" >&6; } +{ echo "$as_me:$LINENO: result: $LINKFORSHARED" >&5 +echo "${ECHO_T}$LINKFORSHARED" >&6; } -{ $as_echo "$as_me:$LINENO: checking CFLAGSFORSHARED" >&5 -$as_echo_n "checking CFLAGSFORSHARED... " >&6; } +{ echo "$as_me:$LINENO: checking CFLAGSFORSHARED" >&5 +echo $ECHO_N "checking CFLAGSFORSHARED... $ECHO_C" >&6; } if test ! "$LIBRARY" = "$LDLIBRARY" then case $ac_sys_system in @@ -13920,8 +13673,8 @@ CFLAGSFORSHARED='$(CCSHARED)' esac fi -{ $as_echo "$as_me:$LINENO: result: $CFLAGSFORSHARED" >&5 -$as_echo "$CFLAGSFORSHARED" >&6; } +{ echo "$as_me:$LINENO: result: $CFLAGSFORSHARED" >&5 +echo "${ECHO_T}$CFLAGSFORSHARED" >&6; } # SHLIBS are libraries (except -lc and -lm) to link to the python shared # library (with --enable-shared). @@ -13932,22 +13685,22 @@ # don't need to link LIBS explicitly. The default should be only changed # on systems where this approach causes problems. -{ $as_echo "$as_me:$LINENO: checking SHLIBS" >&5 -$as_echo_n "checking SHLIBS... " >&6; } +{ echo "$as_me:$LINENO: checking SHLIBS" >&5 +echo $ECHO_N "checking SHLIBS... $ECHO_C" >&6; } case "$ac_sys_system" in *) SHLIBS='$(LIBS)';; esac -{ $as_echo "$as_me:$LINENO: result: $SHLIBS" >&5 -$as_echo "$SHLIBS" >&6; } +{ echo "$as_me:$LINENO: result: $SHLIBS" >&5 +echo "${ECHO_T}$SHLIBS" >&6; } # checks for libraries -{ $as_echo "$as_me:$LINENO: checking for dlopen in -ldl" >&5 -$as_echo_n "checking for dlopen in -ldl... " >&6; } +{ echo "$as_me:$LINENO: checking for dlopen in -ldl" >&5 +echo $ECHO_N "checking for dlopen in -ldl... $ECHO_C" >&6; } if test "${ac_cv_lib_dl_dlopen+set}" = set; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ldl $LIBS" @@ -13979,37 +13732,33 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err - } && test -s conftest$ac_exeext && { - test "$cross_compiling" = yes || - $as_test_x conftest$ac_exeext - }; then + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then ac_cv_lib_dl_dlopen=yes else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_dl_dlopen=no fi -rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_dl_dlopen" >&5 -$as_echo "$ac_cv_lib_dl_dlopen" >&6; } -if test "x$ac_cv_lib_dl_dlopen" = x""yes; then +{ echo "$as_me:$LINENO: result: $ac_cv_lib_dl_dlopen" >&5 +echo "${ECHO_T}$ac_cv_lib_dl_dlopen" >&6; } +if test $ac_cv_lib_dl_dlopen = yes; then cat >>confdefs.h <<_ACEOF #define HAVE_LIBDL 1 _ACEOF @@ -14019,10 +13768,10 @@ fi # Dynamic linking for SunOS/Solaris and SYSV -{ $as_echo "$as_me:$LINENO: checking for shl_load in -ldld" >&5 -$as_echo_n "checking for shl_load in -ldld... " >&6; } +{ echo "$as_me:$LINENO: checking for shl_load in -ldld" >&5 +echo $ECHO_N "checking for shl_load in -ldld... $ECHO_C" >&6; } if test "${ac_cv_lib_dld_shl_load+set}" = set; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ldld $LIBS" @@ -14054,37 +13803,33 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err - } && test -s conftest$ac_exeext && { - test "$cross_compiling" = yes || - $as_test_x conftest$ac_exeext - }; then + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then ac_cv_lib_dld_shl_load=yes else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_dld_shl_load=no fi -rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_dld_shl_load" >&5 -$as_echo "$ac_cv_lib_dld_shl_load" >&6; } -if test "x$ac_cv_lib_dld_shl_load" = x""yes; then +{ echo "$as_me:$LINENO: result: $ac_cv_lib_dld_shl_load" >&5 +echo "${ECHO_T}$ac_cv_lib_dld_shl_load" >&6; } +if test $ac_cv_lib_dld_shl_load = yes; then cat >>confdefs.h <<_ACEOF #define HAVE_LIBDLD 1 _ACEOF @@ -14096,10 +13841,10 @@ # only check for sem_init if thread support is requested if test "$with_threads" = "yes" -o -z "$with_threads"; then - { $as_echo "$as_me:$LINENO: checking for library containing sem_init" >&5 -$as_echo_n "checking for library containing sem_init... " >&6; } + { echo "$as_me:$LINENO: checking for library containing sem_init" >&5 +echo $ECHO_N "checking for library containing sem_init... $ECHO_C" >&6; } if test "${ac_cv_search_sem_init+set}" = set; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_func_search_save_LIBS=$LIBS cat >conftest.$ac_ext <<_ACEOF @@ -14137,30 +13882,26 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err - } && test -s conftest$ac_exeext && { - test "$cross_compiling" = yes || - $as_test_x conftest$ac_exeext - }; then + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then ac_cv_search_sem_init=$ac_res else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi -rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext if test "${ac_cv_search_sem_init+set}" = set; then @@ -14175,8 +13916,8 @@ rm conftest.$ac_ext LIBS=$ac_func_search_save_LIBS fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_search_sem_init" >&5 -$as_echo "$ac_cv_search_sem_init" >&6; } +{ echo "$as_me:$LINENO: result: $ac_cv_search_sem_init" >&5 +echo "${ECHO_T}$ac_cv_search_sem_init" >&6; } ac_res=$ac_cv_search_sem_init if test "$ac_res" != no; then test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" @@ -14188,10 +13929,10 @@ fi # check if we need libintl for locale functions -{ $as_echo "$as_me:$LINENO: checking for textdomain in -lintl" >&5 -$as_echo_n "checking for textdomain in -lintl... " >&6; } +{ echo "$as_me:$LINENO: checking for textdomain in -lintl" >&5 +echo $ECHO_N "checking for textdomain in -lintl... $ECHO_C" >&6; } if test "${ac_cv_lib_intl_textdomain+set}" = set; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lintl $LIBS" @@ -14223,37 +13964,33 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err - } && test -s conftest$ac_exeext && { - test "$cross_compiling" = yes || - $as_test_x conftest$ac_exeext - }; then + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then ac_cv_lib_intl_textdomain=yes else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_intl_textdomain=no fi -rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_intl_textdomain" >&5 -$as_echo "$ac_cv_lib_intl_textdomain" >&6; } -if test "x$ac_cv_lib_intl_textdomain" = x""yes; then +{ echo "$as_me:$LINENO: result: $ac_cv_lib_intl_textdomain" >&5 +echo "${ECHO_T}$ac_cv_lib_intl_textdomain" >&6; } +if test $ac_cv_lib_intl_textdomain = yes; then cat >>confdefs.h <<\_ACEOF #define WITH_LIBINTL 1 @@ -14264,8 +14001,8 @@ # checks for system dependent C++ extensions support case "$ac_sys_system" in - AIX*) { $as_echo "$as_me:$LINENO: checking for genuine AIX C++ extensions support" >&5 -$as_echo_n "checking for genuine AIX C++ extensions support... " >&6; } + AIX*) { echo "$as_me:$LINENO: checking for genuine AIX C++ extensions support" >&5 +echo $ECHO_N "checking for genuine AIX C++ extensions support... $ECHO_C" >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF @@ -14287,37 +14024,33 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err - } && test -s conftest$ac_exeext && { - test "$cross_compiling" = yes || - $as_test_x conftest$ac_exeext - }; then + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then cat >>confdefs.h <<\_ACEOF #define AIX_GENUINE_CPLUSPLUS 1 _ACEOF - { $as_echo "$as_me:$LINENO: result: yes" >&5 -$as_echo "yes" >&6; } + { echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; } else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 - { $as_echo "$as_me:$LINENO: result: no" >&5 -$as_echo "no" >&6; } + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } fi -rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext;; *) ;; @@ -14325,10 +14058,10 @@ # Most SVR4 platforms (e.g. Solaris) need -lsocket and -lnsl. # BeOS' sockets are stashed in libnet. -{ $as_echo "$as_me:$LINENO: checking for t_open in -lnsl" >&5 -$as_echo_n "checking for t_open in -lnsl... " >&6; } +{ echo "$as_me:$LINENO: checking for t_open in -lnsl" >&5 +echo $ECHO_N "checking for t_open in -lnsl... $ECHO_C" >&6; } if test "${ac_cv_lib_nsl_t_open+set}" = set; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lnsl $LIBS" @@ -14360,44 +14093,40 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err - } && test -s conftest$ac_exeext && { - test "$cross_compiling" = yes || - $as_test_x conftest$ac_exeext - }; then + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then ac_cv_lib_nsl_t_open=yes else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_nsl_t_open=no fi -rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_nsl_t_open" >&5 -$as_echo "$ac_cv_lib_nsl_t_open" >&6; } -if test "x$ac_cv_lib_nsl_t_open" = x""yes; then +{ echo "$as_me:$LINENO: result: $ac_cv_lib_nsl_t_open" >&5 +echo "${ECHO_T}$ac_cv_lib_nsl_t_open" >&6; } +if test $ac_cv_lib_nsl_t_open = yes; then LIBS="-lnsl $LIBS" fi # SVR4 -{ $as_echo "$as_me:$LINENO: checking for socket in -lsocket" >&5 -$as_echo_n "checking for socket in -lsocket... " >&6; } +{ echo "$as_me:$LINENO: checking for socket in -lsocket" >&5 +echo $ECHO_N "checking for socket in -lsocket... $ECHO_C" >&6; } if test "${ac_cv_lib_socket_socket+set}" = set; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lsocket $LIBS $LIBS" @@ -14429,47 +14158,43 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err - } && test -s conftest$ac_exeext && { - test "$cross_compiling" = yes || - $as_test_x conftest$ac_exeext - }; then + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then ac_cv_lib_socket_socket=yes else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_socket_socket=no fi -rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_socket_socket" >&5 -$as_echo "$ac_cv_lib_socket_socket" >&6; } -if test "x$ac_cv_lib_socket_socket" = x""yes; then +{ echo "$as_me:$LINENO: result: $ac_cv_lib_socket_socket" >&5 +echo "${ECHO_T}$ac_cv_lib_socket_socket" >&6; } +if test $ac_cv_lib_socket_socket = yes; then LIBS="-lsocket $LIBS" fi # SVR4 sockets case "$ac_sys_system" in BeOS*) -{ $as_echo "$as_me:$LINENO: checking for socket in -lnet" >&5 -$as_echo_n "checking for socket in -lnet... " >&6; } +{ echo "$as_me:$LINENO: checking for socket in -lnet" >&5 +echo $ECHO_N "checking for socket in -lnet... $ECHO_C" >&6; } if test "${ac_cv_lib_net_socket+set}" = set; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lnet $LIBS $LIBS" @@ -14501,62 +14226,58 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err - } && test -s conftest$ac_exeext && { - test "$cross_compiling" = yes || - $as_test_x conftest$ac_exeext - }; then + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then ac_cv_lib_net_socket=yes else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_net_socket=no fi -rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_net_socket" >&5 -$as_echo "$ac_cv_lib_net_socket" >&6; } -if test "x$ac_cv_lib_net_socket" = x""yes; then +{ echo "$as_me:$LINENO: result: $ac_cv_lib_net_socket" >&5 +echo "${ECHO_T}$ac_cv_lib_net_socket" >&6; } +if test $ac_cv_lib_net_socket = yes; then LIBS="-lnet $LIBS" fi # BeOS ;; esac -{ $as_echo "$as_me:$LINENO: checking for --with-libs" >&5 -$as_echo_n "checking for --with-libs... " >&6; } +{ echo "$as_me:$LINENO: checking for --with-libs" >&5 +echo $ECHO_N "checking for --with-libs... $ECHO_C" >&6; } # Check whether --with-libs was given. if test "${with_libs+set}" = set; then withval=$with_libs; -{ $as_echo "$as_me:$LINENO: result: $withval" >&5 -$as_echo "$withval" >&6; } +{ echo "$as_me:$LINENO: result: $withval" >&5 +echo "${ECHO_T}$withval" >&6; } LIBS="$withval $LIBS" else - { $as_echo "$as_me:$LINENO: result: no" >&5 -$as_echo "no" >&6; } + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } fi # Check for use of the system libffi library -{ $as_echo "$as_me:$LINENO: checking for --with-system-ffi" >&5 -$as_echo_n "checking for --with-system-ffi... " >&6; } +{ echo "$as_me:$LINENO: checking for --with-system-ffi" >&5 +echo $ECHO_N "checking for --with-system-ffi... $ECHO_C" >&6; } # Check whether --with-system_ffi was given. if test "${with_system_ffi+set}" = set; then @@ -14564,41 +14285,41 @@ fi -{ $as_echo "$as_me:$LINENO: result: $with_system_ffi" >&5 -$as_echo "$with_system_ffi" >&6; } +{ echo "$as_me:$LINENO: result: $with_system_ffi" >&5 +echo "${ECHO_T}$with_system_ffi" >&6; } # Check for --with-dbmliborder -{ $as_echo "$as_me:$LINENO: checking for --with-dbmliborder" >&5 -$as_echo_n "checking for --with-dbmliborder... " >&6; } +{ echo "$as_me:$LINENO: checking for --with-dbmliborder" >&5 +echo $ECHO_N "checking for --with-dbmliborder... $ECHO_C" >&6; } # Check whether --with-dbmliborder was given. if test "${with_dbmliborder+set}" = set; then withval=$with_dbmliborder; if test x$with_dbmliborder = xyes then -{ { $as_echo "$as_me:$LINENO: error: proper usage is --with-dbmliborder=db1:db2:..." >&5 -$as_echo "$as_me: error: proper usage is --with-dbmliborder=db1:db2:..." >&2;} +{ { echo "$as_me:$LINENO: error: proper usage is --with-dbmliborder=db1:db2:..." >&5 +echo "$as_me: error: proper usage is --with-dbmliborder=db1:db2:..." >&2;} { (exit 1); exit 1; }; } else for db in `echo $with_dbmliborder | sed 's/:/ /g'`; do if test x$db != xndbm && test x$db != xgdbm && test x$db != xbdb then - { { $as_echo "$as_me:$LINENO: error: proper usage is --with-dbmliborder=db1:db2:..." >&5 -$as_echo "$as_me: error: proper usage is --with-dbmliborder=db1:db2:..." >&2;} + { { echo "$as_me:$LINENO: error: proper usage is --with-dbmliborder=db1:db2:..." >&5 +echo "$as_me: error: proper usage is --with-dbmliborder=db1:db2:..." >&2;} { (exit 1); exit 1; }; } fi done fi fi -{ $as_echo "$as_me:$LINENO: result: $with_dbmliborder" >&5 -$as_echo "$with_dbmliborder" >&6; } +{ echo "$as_me:$LINENO: result: $with_dbmliborder" >&5 +echo "${ECHO_T}$with_dbmliborder" >&6; } # Determine if signalmodule should be used. -{ $as_echo "$as_me:$LINENO: checking for --with-signal-module" >&5 -$as_echo_n "checking for --with-signal-module... " >&6; } +{ echo "$as_me:$LINENO: checking for --with-signal-module" >&5 +echo $ECHO_N "checking for --with-signal-module... $ECHO_C" >&6; } # Check whether --with-signal-module was given. if test "${with_signal_module+set}" = set; then @@ -14609,8 +14330,8 @@ if test -z "$with_signal_module" then with_signal_module="yes" fi -{ $as_echo "$as_me:$LINENO: result: $with_signal_module" >&5 -$as_echo "$with_signal_module" >&6; } +{ echo "$as_me:$LINENO: result: $with_signal_module" >&5 +echo "${ECHO_T}$with_signal_module" >&6; } if test "${with_signal_module}" = "yes"; then USE_SIGNAL_MODULE="" @@ -14624,22 +14345,22 @@ USE_THREAD_MODULE="" -{ $as_echo "$as_me:$LINENO: checking for --with-dec-threads" >&5 -$as_echo_n "checking for --with-dec-threads... " >&6; } +{ echo "$as_me:$LINENO: checking for --with-dec-threads" >&5 +echo $ECHO_N "checking for --with-dec-threads... $ECHO_C" >&6; } # Check whether --with-dec-threads was given. if test "${with_dec_threads+set}" = set; then withval=$with_dec_threads; -{ $as_echo "$as_me:$LINENO: result: $withval" >&5 -$as_echo "$withval" >&6; } +{ echo "$as_me:$LINENO: result: $withval" >&5 +echo "${ECHO_T}$withval" >&6; } LDLAST=-threads if test "${with_thread+set}" != set; then with_thread="$withval"; fi else - { $as_echo "$as_me:$LINENO: result: no" >&5 -$as_echo "no" >&6; } + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } fi @@ -14652,8 +14373,8 @@ -{ $as_echo "$as_me:$LINENO: checking for --with-threads" >&5 -$as_echo_n "checking for --with-threads... " >&6; } +{ echo "$as_me:$LINENO: checking for --with-threads" >&5 +echo $ECHO_N "checking for --with-threads... $ECHO_C" >&6; } # Check whether --with-threads was given. if test "${with_threads+set}" = set; then @@ -14672,8 +14393,8 @@ if test -z "$with_threads" then with_threads="yes" fi -{ $as_echo "$as_me:$LINENO: result: $with_threads" >&5 -$as_echo "$with_threads" >&6; } +{ echo "$as_me:$LINENO: result: $with_threads" >&5 +echo "${ECHO_T}$with_threads" >&6; } if test "$with_threads" = "no" @@ -14739,8 +14460,8 @@ # According to the POSIX spec, a pthreads implementation must # define _POSIX_THREADS in unistd.h. Some apparently don't # (e.g. gnu pth with pthread emulation) - { $as_echo "$as_me:$LINENO: checking for _POSIX_THREADS in unistd.h" >&5 -$as_echo_n "checking for _POSIX_THREADS in unistd.h... " >&6; } + { echo "$as_me:$LINENO: checking for _POSIX_THREADS in unistd.h" >&5 +echo $ECHO_N "checking for _POSIX_THREADS in unistd.h... $ECHO_C" >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF @@ -14762,25 +14483,25 @@ fi rm -f conftest* - { $as_echo "$as_me:$LINENO: result: $unistd_defines_pthreads" >&5 -$as_echo "$unistd_defines_pthreads" >&6; } + { echo "$as_me:$LINENO: result: $unistd_defines_pthreads" >&5 +echo "${ECHO_T}$unistd_defines_pthreads" >&6; } cat >>confdefs.h <<\_ACEOF #define _REENTRANT 1 _ACEOF if test "${ac_cv_header_cthreads_h+set}" = set; then - { $as_echo "$as_me:$LINENO: checking for cthreads.h" >&5 -$as_echo_n "checking for cthreads.h... " >&6; } + { echo "$as_me:$LINENO: checking for cthreads.h" >&5 +echo $ECHO_N "checking for cthreads.h... $ECHO_C" >&6; } if test "${ac_cv_header_cthreads_h+set}" = set; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_cthreads_h" >&5 -$as_echo "$ac_cv_header_cthreads_h" >&6; } +{ echo "$as_me:$LINENO: result: $ac_cv_header_cthreads_h" >&5 +echo "${ECHO_T}$ac_cv_header_cthreads_h" >&6; } else # Is the header compilable? -{ $as_echo "$as_me:$LINENO: checking cthreads.h usability" >&5 -$as_echo_n "checking cthreads.h usability... " >&6; } +{ echo "$as_me:$LINENO: checking cthreads.h usability" >&5 +echo $ECHO_N "checking cthreads.h usability... $ECHO_C" >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF @@ -14796,33 +14517,32 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_header_compiler=yes else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_compiler=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 -$as_echo "$ac_header_compiler" >&6; } +{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6; } # Is the header present? -{ $as_echo "$as_me:$LINENO: checking cthreads.h presence" >&5 -$as_echo_n "checking cthreads.h presence... " >&6; } +{ echo "$as_me:$LINENO: checking cthreads.h presence" >&5 +echo $ECHO_N "checking cthreads.h presence... $ECHO_C" >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF @@ -14836,52 +14556,51 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then ac_header_preproc=yes else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_preproc=no fi rm -f conftest.err conftest.$ac_ext -{ $as_echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 -$as_echo "$ac_header_preproc" >&6; } +{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6; } # So? What about this header? case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in yes:no: ) - { $as_echo "$as_me:$LINENO: WARNING: cthreads.h: accepted by the compiler, rejected by the preprocessor!" >&5 -$as_echo "$as_me: WARNING: cthreads.h: accepted by the compiler, rejected by the preprocessor!" >&2;} - { $as_echo "$as_me:$LINENO: WARNING: cthreads.h: proceeding with the compiler's result" >&5 -$as_echo "$as_me: WARNING: cthreads.h: proceeding with the compiler's result" >&2;} + { echo "$as_me:$LINENO: WARNING: cthreads.h: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: cthreads.h: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: cthreads.h: proceeding with the compiler's result" >&5 +echo "$as_me: WARNING: cthreads.h: proceeding with the compiler's result" >&2;} ac_header_preproc=yes ;; no:yes:* ) - { $as_echo "$as_me:$LINENO: WARNING: cthreads.h: present but cannot be compiled" >&5 -$as_echo "$as_me: WARNING: cthreads.h: present but cannot be compiled" >&2;} - { $as_echo "$as_me:$LINENO: WARNING: cthreads.h: check for missing prerequisite headers?" >&5 -$as_echo "$as_me: WARNING: cthreads.h: check for missing prerequisite headers?" >&2;} - { $as_echo "$as_me:$LINENO: WARNING: cthreads.h: see the Autoconf documentation" >&5 -$as_echo "$as_me: WARNING: cthreads.h: see the Autoconf documentation" >&2;} - { $as_echo "$as_me:$LINENO: WARNING: cthreads.h: section \"Present But Cannot Be Compiled\"" >&5 -$as_echo "$as_me: WARNING: cthreads.h: section \"Present But Cannot Be Compiled\"" >&2;} - { $as_echo "$as_me:$LINENO: WARNING: cthreads.h: proceeding with the preprocessor's result" >&5 -$as_echo "$as_me: WARNING: cthreads.h: proceeding with the preprocessor's result" >&2;} - { $as_echo "$as_me:$LINENO: WARNING: cthreads.h: in the future, the compiler will take precedence" >&5 -$as_echo "$as_me: WARNING: cthreads.h: in the future, the compiler will take precedence" >&2;} + { echo "$as_me:$LINENO: WARNING: cthreads.h: present but cannot be compiled" >&5 +echo "$as_me: WARNING: cthreads.h: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: cthreads.h: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: cthreads.h: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: cthreads.h: see the Autoconf documentation" >&5 +echo "$as_me: WARNING: cthreads.h: see the Autoconf documentation" >&2;} + { echo "$as_me:$LINENO: WARNING: cthreads.h: section \"Present But Cannot Be Compiled\"" >&5 +echo "$as_me: WARNING: cthreads.h: section \"Present But Cannot Be Compiled\"" >&2;} + { echo "$as_me:$LINENO: WARNING: cthreads.h: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: cthreads.h: proceeding with the preprocessor's result" >&2;} + { echo "$as_me:$LINENO: WARNING: cthreads.h: in the future, the compiler will take precedence" >&5 +echo "$as_me: WARNING: cthreads.h: in the future, the compiler will take precedence" >&2;} ( cat <<\_ASBOX ## -------------------------------------- ## ## Report this to http://bugs.python.org/ ## @@ -14890,18 +14609,18 @@ ) | sed "s/^/$as_me: WARNING: /" >&2 ;; esac -{ $as_echo "$as_me:$LINENO: checking for cthreads.h" >&5 -$as_echo_n "checking for cthreads.h... " >&6; } +{ echo "$as_me:$LINENO: checking for cthreads.h" >&5 +echo $ECHO_N "checking for cthreads.h... $ECHO_C" >&6; } if test "${ac_cv_header_cthreads_h+set}" = set; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_cv_header_cthreads_h=$ac_header_preproc fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_cthreads_h" >&5 -$as_echo "$ac_cv_header_cthreads_h" >&6; } +{ echo "$as_me:$LINENO: result: $ac_cv_header_cthreads_h" >&5 +echo "${ECHO_T}$ac_cv_header_cthreads_h" >&6; } fi -if test "x$ac_cv_header_cthreads_h" = x""yes; then +if test $ac_cv_header_cthreads_h = yes; then cat >>confdefs.h <<\_ACEOF #define WITH_THREAD 1 _ACEOF @@ -14920,17 +14639,17 @@ else if test "${ac_cv_header_mach_cthreads_h+set}" = set; then - { $as_echo "$as_me:$LINENO: checking for mach/cthreads.h" >&5 -$as_echo_n "checking for mach/cthreads.h... " >&6; } + { echo "$as_me:$LINENO: checking for mach/cthreads.h" >&5 +echo $ECHO_N "checking for mach/cthreads.h... $ECHO_C" >&6; } if test "${ac_cv_header_mach_cthreads_h+set}" = set; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_mach_cthreads_h" >&5 -$as_echo "$ac_cv_header_mach_cthreads_h" >&6; } +{ echo "$as_me:$LINENO: result: $ac_cv_header_mach_cthreads_h" >&5 +echo "${ECHO_T}$ac_cv_header_mach_cthreads_h" >&6; } else # Is the header compilable? -{ $as_echo "$as_me:$LINENO: checking mach/cthreads.h usability" >&5 -$as_echo_n "checking mach/cthreads.h usability... " >&6; } +{ echo "$as_me:$LINENO: checking mach/cthreads.h usability" >&5 +echo $ECHO_N "checking mach/cthreads.h usability... $ECHO_C" >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF @@ -14946,33 +14665,32 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_header_compiler=yes else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_compiler=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 -$as_echo "$ac_header_compiler" >&6; } +{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6; } # Is the header present? -{ $as_echo "$as_me:$LINENO: checking mach/cthreads.h presence" >&5 -$as_echo_n "checking mach/cthreads.h presence... " >&6; } +{ echo "$as_me:$LINENO: checking mach/cthreads.h presence" >&5 +echo $ECHO_N "checking mach/cthreads.h presence... $ECHO_C" >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF @@ -14986,52 +14704,51 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then ac_header_preproc=yes else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_preproc=no fi rm -f conftest.err conftest.$ac_ext -{ $as_echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 -$as_echo "$ac_header_preproc" >&6; } +{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6; } # So? What about this header? case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in yes:no: ) - { $as_echo "$as_me:$LINENO: WARNING: mach/cthreads.h: accepted by the compiler, rejected by the preprocessor!" >&5 -$as_echo "$as_me: WARNING: mach/cthreads.h: accepted by the compiler, rejected by the preprocessor!" >&2;} - { $as_echo "$as_me:$LINENO: WARNING: mach/cthreads.h: proceeding with the compiler's result" >&5 -$as_echo "$as_me: WARNING: mach/cthreads.h: proceeding with the compiler's result" >&2;} + { echo "$as_me:$LINENO: WARNING: mach/cthreads.h: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: mach/cthreads.h: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: mach/cthreads.h: proceeding with the compiler's result" >&5 +echo "$as_me: WARNING: mach/cthreads.h: proceeding with the compiler's result" >&2;} ac_header_preproc=yes ;; no:yes:* ) - { $as_echo "$as_me:$LINENO: WARNING: mach/cthreads.h: present but cannot be compiled" >&5 -$as_echo "$as_me: WARNING: mach/cthreads.h: present but cannot be compiled" >&2;} - { $as_echo "$as_me:$LINENO: WARNING: mach/cthreads.h: check for missing prerequisite headers?" >&5 -$as_echo "$as_me: WARNING: mach/cthreads.h: check for missing prerequisite headers?" >&2;} - { $as_echo "$as_me:$LINENO: WARNING: mach/cthreads.h: see the Autoconf documentation" >&5 -$as_echo "$as_me: WARNING: mach/cthreads.h: see the Autoconf documentation" >&2;} - { $as_echo "$as_me:$LINENO: WARNING: mach/cthreads.h: section \"Present But Cannot Be Compiled\"" >&5 -$as_echo "$as_me: WARNING: mach/cthreads.h: section \"Present But Cannot Be Compiled\"" >&2;} - { $as_echo "$as_me:$LINENO: WARNING: mach/cthreads.h: proceeding with the preprocessor's result" >&5 -$as_echo "$as_me: WARNING: mach/cthreads.h: proceeding with the preprocessor's result" >&2;} - { $as_echo "$as_me:$LINENO: WARNING: mach/cthreads.h: in the future, the compiler will take precedence" >&5 -$as_echo "$as_me: WARNING: mach/cthreads.h: in the future, the compiler will take precedence" >&2;} + { echo "$as_me:$LINENO: WARNING: mach/cthreads.h: present but cannot be compiled" >&5 +echo "$as_me: WARNING: mach/cthreads.h: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: mach/cthreads.h: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: mach/cthreads.h: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: mach/cthreads.h: see the Autoconf documentation" >&5 +echo "$as_me: WARNING: mach/cthreads.h: see the Autoconf documentation" >&2;} + { echo "$as_me:$LINENO: WARNING: mach/cthreads.h: section \"Present But Cannot Be Compiled\"" >&5 +echo "$as_me: WARNING: mach/cthreads.h: section \"Present But Cannot Be Compiled\"" >&2;} + { echo "$as_me:$LINENO: WARNING: mach/cthreads.h: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: mach/cthreads.h: proceeding with the preprocessor's result" >&2;} + { echo "$as_me:$LINENO: WARNING: mach/cthreads.h: in the future, the compiler will take precedence" >&5 +echo "$as_me: WARNING: mach/cthreads.h: in the future, the compiler will take precedence" >&2;} ( cat <<\_ASBOX ## -------------------------------------- ## ## Report this to http://bugs.python.org/ ## @@ -15040,18 +14757,18 @@ ) | sed "s/^/$as_me: WARNING: /" >&2 ;; esac -{ $as_echo "$as_me:$LINENO: checking for mach/cthreads.h" >&5 -$as_echo_n "checking for mach/cthreads.h... " >&6; } +{ echo "$as_me:$LINENO: checking for mach/cthreads.h" >&5 +echo $ECHO_N "checking for mach/cthreads.h... $ECHO_C" >&6; } if test "${ac_cv_header_mach_cthreads_h+set}" = set; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_cv_header_mach_cthreads_h=$ac_header_preproc fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_mach_cthreads_h" >&5 -$as_echo "$ac_cv_header_mach_cthreads_h" >&6; } +{ echo "$as_me:$LINENO: result: $ac_cv_header_mach_cthreads_h" >&5 +echo "${ECHO_T}$ac_cv_header_mach_cthreads_h" >&6; } fi -if test "x$ac_cv_header_mach_cthreads_h" = x""yes; then +if test $ac_cv_header_mach_cthreads_h = yes; then cat >>confdefs.h <<\_ACEOF #define WITH_THREAD 1 _ACEOF @@ -15068,13 +14785,13 @@ THREADOBJ="Python/thread.o" else - { $as_echo "$as_me:$LINENO: checking for --with-pth" >&5 -$as_echo_n "checking for --with-pth... " >&6; } + { echo "$as_me:$LINENO: checking for --with-pth" >&5 +echo $ECHO_N "checking for --with-pth... $ECHO_C" >&6; } # Check whether --with-pth was given. if test "${with_pth+set}" = set; then - withval=$with_pth; { $as_echo "$as_me:$LINENO: result: $withval" >&5 -$as_echo "$withval" >&6; } + withval=$with_pth; { echo "$as_me:$LINENO: result: $withval" >&5 +echo "${ECHO_T}$withval" >&6; } cat >>confdefs.h <<\_ACEOF #define WITH_THREAD 1 _ACEOF @@ -15087,16 +14804,16 @@ LIBS="-lpth $LIBS" THREADOBJ="Python/thread.o" else - { $as_echo "$as_me:$LINENO: result: no" >&5 -$as_echo "no" >&6; } + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } # Just looking for pthread_create in libpthread is not enough: # on HP/UX, pthread.h renames pthread_create to a different symbol name. # So we really have to include pthread.h, and then link. _libs=$LIBS LIBS="$LIBS -lpthread" - { $as_echo "$as_me:$LINENO: checking for pthread_create in -lpthread" >&5 -$as_echo_n "checking for pthread_create in -lpthread... " >&6; } + { echo "$as_me:$LINENO: checking for pthread_create in -lpthread" >&5 +echo $ECHO_N "checking for pthread_create in -lpthread... $ECHO_C" >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF @@ -15121,24 +14838,21 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err - } && test -s conftest$ac_exeext && { - test "$cross_compiling" = yes || - $as_test_x conftest$ac_exeext - }; then + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then - { $as_echo "$as_me:$LINENO: result: yes" >&5 -$as_echo "yes" >&6; } + { echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; } cat >>confdefs.h <<\_ACEOF #define WITH_THREAD 1 _ACEOF @@ -15146,15 +14860,15 @@ posix_threads=yes THREADOBJ="Python/thread.o" else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 LIBS=$_libs - { $as_echo "$as_me:$LINENO: checking for pthread_detach" >&5 -$as_echo_n "checking for pthread_detach... " >&6; } + { echo "$as_me:$LINENO: checking for pthread_detach" >&5 +echo $ECHO_N "checking for pthread_detach... $ECHO_C" >&6; } if test "${ac_cv_func_pthread_detach+set}" = set; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ @@ -15207,36 +14921,32 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err - } && test -s conftest$ac_exeext && { - test "$cross_compiling" = yes || - $as_test_x conftest$ac_exeext - }; then + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then ac_cv_func_pthread_detach=yes else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_func_pthread_detach=no fi -rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_func_pthread_detach" >&5 -$as_echo "$ac_cv_func_pthread_detach" >&6; } -if test "x$ac_cv_func_pthread_detach" = x""yes; then +{ echo "$as_me:$LINENO: result: $ac_cv_func_pthread_detach" >&5 +echo "${ECHO_T}$ac_cv_func_pthread_detach" >&6; } +if test $ac_cv_func_pthread_detach = yes; then cat >>confdefs.h <<\_ACEOF #define WITH_THREAD 1 _ACEOF @@ -15246,17 +14956,17 @@ else if test "${ac_cv_header_atheos_threads_h+set}" = set; then - { $as_echo "$as_me:$LINENO: checking for atheos/threads.h" >&5 -$as_echo_n "checking for atheos/threads.h... " >&6; } + { echo "$as_me:$LINENO: checking for atheos/threads.h" >&5 +echo $ECHO_N "checking for atheos/threads.h... $ECHO_C" >&6; } if test "${ac_cv_header_atheos_threads_h+set}" = set; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_atheos_threads_h" >&5 -$as_echo "$ac_cv_header_atheos_threads_h" >&6; } +{ echo "$as_me:$LINENO: result: $ac_cv_header_atheos_threads_h" >&5 +echo "${ECHO_T}$ac_cv_header_atheos_threads_h" >&6; } else # Is the header compilable? -{ $as_echo "$as_me:$LINENO: checking atheos/threads.h usability" >&5 -$as_echo_n "checking atheos/threads.h usability... " >&6; } +{ echo "$as_me:$LINENO: checking atheos/threads.h usability" >&5 +echo $ECHO_N "checking atheos/threads.h usability... $ECHO_C" >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF @@ -15272,33 +14982,32 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_header_compiler=yes else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_compiler=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 -$as_echo "$ac_header_compiler" >&6; } +{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6; } # Is the header present? -{ $as_echo "$as_me:$LINENO: checking atheos/threads.h presence" >&5 -$as_echo_n "checking atheos/threads.h presence... " >&6; } +{ echo "$as_me:$LINENO: checking atheos/threads.h presence" >&5 +echo $ECHO_N "checking atheos/threads.h presence... $ECHO_C" >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF @@ -15312,52 +15021,51 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then ac_header_preproc=yes else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_preproc=no fi rm -f conftest.err conftest.$ac_ext -{ $as_echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 -$as_echo "$ac_header_preproc" >&6; } +{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6; } # So? What about this header? case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in yes:no: ) - { $as_echo "$as_me:$LINENO: WARNING: atheos/threads.h: accepted by the compiler, rejected by the preprocessor!" >&5 -$as_echo "$as_me: WARNING: atheos/threads.h: accepted by the compiler, rejected by the preprocessor!" >&2;} - { $as_echo "$as_me:$LINENO: WARNING: atheos/threads.h: proceeding with the compiler's result" >&5 -$as_echo "$as_me: WARNING: atheos/threads.h: proceeding with the compiler's result" >&2;} + { echo "$as_me:$LINENO: WARNING: atheos/threads.h: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: atheos/threads.h: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: atheos/threads.h: proceeding with the compiler's result" >&5 +echo "$as_me: WARNING: atheos/threads.h: proceeding with the compiler's result" >&2;} ac_header_preproc=yes ;; no:yes:* ) - { $as_echo "$as_me:$LINENO: WARNING: atheos/threads.h: present but cannot be compiled" >&5 -$as_echo "$as_me: WARNING: atheos/threads.h: present but cannot be compiled" >&2;} - { $as_echo "$as_me:$LINENO: WARNING: atheos/threads.h: check for missing prerequisite headers?" >&5 -$as_echo "$as_me: WARNING: atheos/threads.h: check for missing prerequisite headers?" >&2;} - { $as_echo "$as_me:$LINENO: WARNING: atheos/threads.h: see the Autoconf documentation" >&5 -$as_echo "$as_me: WARNING: atheos/threads.h: see the Autoconf documentation" >&2;} - { $as_echo "$as_me:$LINENO: WARNING: atheos/threads.h: section \"Present But Cannot Be Compiled\"" >&5 -$as_echo "$as_me: WARNING: atheos/threads.h: section \"Present But Cannot Be Compiled\"" >&2;} - { $as_echo "$as_me:$LINENO: WARNING: atheos/threads.h: proceeding with the preprocessor's result" >&5 -$as_echo "$as_me: WARNING: atheos/threads.h: proceeding with the preprocessor's result" >&2;} - { $as_echo "$as_me:$LINENO: WARNING: atheos/threads.h: in the future, the compiler will take precedence" >&5 -$as_echo "$as_me: WARNING: atheos/threads.h: in the future, the compiler will take precedence" >&2;} + { echo "$as_me:$LINENO: WARNING: atheos/threads.h: present but cannot be compiled" >&5 +echo "$as_me: WARNING: atheos/threads.h: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: atheos/threads.h: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: atheos/threads.h: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: atheos/threads.h: see the Autoconf documentation" >&5 +echo "$as_me: WARNING: atheos/threads.h: see the Autoconf documentation" >&2;} + { echo "$as_me:$LINENO: WARNING: atheos/threads.h: section \"Present But Cannot Be Compiled\"" >&5 +echo "$as_me: WARNING: atheos/threads.h: section \"Present But Cannot Be Compiled\"" >&2;} + { echo "$as_me:$LINENO: WARNING: atheos/threads.h: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: atheos/threads.h: proceeding with the preprocessor's result" >&2;} + { echo "$as_me:$LINENO: WARNING: atheos/threads.h: in the future, the compiler will take precedence" >&5 +echo "$as_me: WARNING: atheos/threads.h: in the future, the compiler will take precedence" >&2;} ( cat <<\_ASBOX ## -------------------------------------- ## ## Report this to http://bugs.python.org/ ## @@ -15366,18 +15074,18 @@ ) | sed "s/^/$as_me: WARNING: /" >&2 ;; esac -{ $as_echo "$as_me:$LINENO: checking for atheos/threads.h" >&5 -$as_echo_n "checking for atheos/threads.h... " >&6; } +{ echo "$as_me:$LINENO: checking for atheos/threads.h" >&5 +echo $ECHO_N "checking for atheos/threads.h... $ECHO_C" >&6; } if test "${ac_cv_header_atheos_threads_h+set}" = set; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_cv_header_atheos_threads_h=$ac_header_preproc fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_atheos_threads_h" >&5 -$as_echo "$ac_cv_header_atheos_threads_h" >&6; } +{ echo "$as_me:$LINENO: result: $ac_cv_header_atheos_threads_h" >&5 +echo "${ECHO_T}$ac_cv_header_atheos_threads_h" >&6; } fi -if test "x$ac_cv_header_atheos_threads_h" = x""yes; then +if test $ac_cv_header_atheos_threads_h = yes; then cat >>confdefs.h <<\_ACEOF #define WITH_THREAD 1 _ACEOF @@ -15391,17 +15099,17 @@ else if test "${ac_cv_header_kernel_OS_h+set}" = set; then - { $as_echo "$as_me:$LINENO: checking for kernel/OS.h" >&5 -$as_echo_n "checking for kernel/OS.h... " >&6; } + { echo "$as_me:$LINENO: checking for kernel/OS.h" >&5 +echo $ECHO_N "checking for kernel/OS.h... $ECHO_C" >&6; } if test "${ac_cv_header_kernel_OS_h+set}" = set; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_kernel_OS_h" >&5 -$as_echo "$ac_cv_header_kernel_OS_h" >&6; } +{ echo "$as_me:$LINENO: result: $ac_cv_header_kernel_OS_h" >&5 +echo "${ECHO_T}$ac_cv_header_kernel_OS_h" >&6; } else # Is the header compilable? -{ $as_echo "$as_me:$LINENO: checking kernel/OS.h usability" >&5 -$as_echo_n "checking kernel/OS.h usability... " >&6; } +{ echo "$as_me:$LINENO: checking kernel/OS.h usability" >&5 +echo $ECHO_N "checking kernel/OS.h usability... $ECHO_C" >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF @@ -15417,33 +15125,32 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_header_compiler=yes else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_compiler=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 -$as_echo "$ac_header_compiler" >&6; } +{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6; } # Is the header present? -{ $as_echo "$as_me:$LINENO: checking kernel/OS.h presence" >&5 -$as_echo_n "checking kernel/OS.h presence... " >&6; } +{ echo "$as_me:$LINENO: checking kernel/OS.h presence" >&5 +echo $ECHO_N "checking kernel/OS.h presence... $ECHO_C" >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF @@ -15457,52 +15164,51 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then ac_header_preproc=yes else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_preproc=no fi rm -f conftest.err conftest.$ac_ext -{ $as_echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 -$as_echo "$ac_header_preproc" >&6; } +{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6; } # So? What about this header? case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in yes:no: ) - { $as_echo "$as_me:$LINENO: WARNING: kernel/OS.h: accepted by the compiler, rejected by the preprocessor!" >&5 -$as_echo "$as_me: WARNING: kernel/OS.h: accepted by the compiler, rejected by the preprocessor!" >&2;} - { $as_echo "$as_me:$LINENO: WARNING: kernel/OS.h: proceeding with the compiler's result" >&5 -$as_echo "$as_me: WARNING: kernel/OS.h: proceeding with the compiler's result" >&2;} + { echo "$as_me:$LINENO: WARNING: kernel/OS.h: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: kernel/OS.h: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: kernel/OS.h: proceeding with the compiler's result" >&5 +echo "$as_me: WARNING: kernel/OS.h: proceeding with the compiler's result" >&2;} ac_header_preproc=yes ;; no:yes:* ) - { $as_echo "$as_me:$LINENO: WARNING: kernel/OS.h: present but cannot be compiled" >&5 -$as_echo "$as_me: WARNING: kernel/OS.h: present but cannot be compiled" >&2;} - { $as_echo "$as_me:$LINENO: WARNING: kernel/OS.h: check for missing prerequisite headers?" >&5 -$as_echo "$as_me: WARNING: kernel/OS.h: check for missing prerequisite headers?" >&2;} - { $as_echo "$as_me:$LINENO: WARNING: kernel/OS.h: see the Autoconf documentation" >&5 -$as_echo "$as_me: WARNING: kernel/OS.h: see the Autoconf documentation" >&2;} - { $as_echo "$as_me:$LINENO: WARNING: kernel/OS.h: section \"Present But Cannot Be Compiled\"" >&5 -$as_echo "$as_me: WARNING: kernel/OS.h: section \"Present But Cannot Be Compiled\"" >&2;} - { $as_echo "$as_me:$LINENO: WARNING: kernel/OS.h: proceeding with the preprocessor's result" >&5 -$as_echo "$as_me: WARNING: kernel/OS.h: proceeding with the preprocessor's result" >&2;} - { $as_echo "$as_me:$LINENO: WARNING: kernel/OS.h: in the future, the compiler will take precedence" >&5 -$as_echo "$as_me: WARNING: kernel/OS.h: in the future, the compiler will take precedence" >&2;} + { echo "$as_me:$LINENO: WARNING: kernel/OS.h: present but cannot be compiled" >&5 +echo "$as_me: WARNING: kernel/OS.h: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: kernel/OS.h: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: kernel/OS.h: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: kernel/OS.h: see the Autoconf documentation" >&5 +echo "$as_me: WARNING: kernel/OS.h: see the Autoconf documentation" >&2;} + { echo "$as_me:$LINENO: WARNING: kernel/OS.h: section \"Present But Cannot Be Compiled\"" >&5 +echo "$as_me: WARNING: kernel/OS.h: section \"Present But Cannot Be Compiled\"" >&2;} + { echo "$as_me:$LINENO: WARNING: kernel/OS.h: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: kernel/OS.h: proceeding with the preprocessor's result" >&2;} + { echo "$as_me:$LINENO: WARNING: kernel/OS.h: in the future, the compiler will take precedence" >&5 +echo "$as_me: WARNING: kernel/OS.h: in the future, the compiler will take precedence" >&2;} ( cat <<\_ASBOX ## -------------------------------------- ## ## Report this to http://bugs.python.org/ ## @@ -15511,18 +15217,18 @@ ) | sed "s/^/$as_me: WARNING: /" >&2 ;; esac -{ $as_echo "$as_me:$LINENO: checking for kernel/OS.h" >&5 -$as_echo_n "checking for kernel/OS.h... " >&6; } +{ echo "$as_me:$LINENO: checking for kernel/OS.h" >&5 +echo $ECHO_N "checking for kernel/OS.h... $ECHO_C" >&6; } if test "${ac_cv_header_kernel_OS_h+set}" = set; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_cv_header_kernel_OS_h=$ac_header_preproc fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_kernel_OS_h" >&5 -$as_echo "$ac_cv_header_kernel_OS_h" >&6; } +{ echo "$as_me:$LINENO: result: $ac_cv_header_kernel_OS_h" >&5 +echo "${ECHO_T}$ac_cv_header_kernel_OS_h" >&6; } fi -if test "x$ac_cv_header_kernel_OS_h" = x""yes; then +if test $ac_cv_header_kernel_OS_h = yes; then cat >>confdefs.h <<\_ACEOF #define WITH_THREAD 1 _ACEOF @@ -15535,10 +15241,10 @@ THREADOBJ="Python/thread.o" else - { $as_echo "$as_me:$LINENO: checking for pthread_create in -lpthreads" >&5 -$as_echo_n "checking for pthread_create in -lpthreads... " >&6; } + { echo "$as_me:$LINENO: checking for pthread_create in -lpthreads" >&5 +echo $ECHO_N "checking for pthread_create in -lpthreads... $ECHO_C" >&6; } if test "${ac_cv_lib_pthreads_pthread_create+set}" = set; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lpthreads $LIBS" @@ -15570,37 +15276,33 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err - } && test -s conftest$ac_exeext && { - test "$cross_compiling" = yes || - $as_test_x conftest$ac_exeext - }; then + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then ac_cv_lib_pthreads_pthread_create=yes else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_pthreads_pthread_create=no fi -rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_pthreads_pthread_create" >&5 -$as_echo "$ac_cv_lib_pthreads_pthread_create" >&6; } -if test "x$ac_cv_lib_pthreads_pthread_create" = x""yes; then +{ echo "$as_me:$LINENO: result: $ac_cv_lib_pthreads_pthread_create" >&5 +echo "${ECHO_T}$ac_cv_lib_pthreads_pthread_create" >&6; } +if test $ac_cv_lib_pthreads_pthread_create = yes; then cat >>confdefs.h <<\_ACEOF #define WITH_THREAD 1 _ACEOF @@ -15610,10 +15312,10 @@ THREADOBJ="Python/thread.o" else - { $as_echo "$as_me:$LINENO: checking for pthread_create in -lc_r" >&5 -$as_echo_n "checking for pthread_create in -lc_r... " >&6; } + { echo "$as_me:$LINENO: checking for pthread_create in -lc_r" >&5 +echo $ECHO_N "checking for pthread_create in -lc_r... $ECHO_C" >&6; } if test "${ac_cv_lib_c_r_pthread_create+set}" = set; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lc_r $LIBS" @@ -15645,37 +15347,33 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err - } && test -s conftest$ac_exeext && { - test "$cross_compiling" = yes || - $as_test_x conftest$ac_exeext - }; then + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then ac_cv_lib_c_r_pthread_create=yes else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_c_r_pthread_create=no fi -rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_c_r_pthread_create" >&5 -$as_echo "$ac_cv_lib_c_r_pthread_create" >&6; } -if test "x$ac_cv_lib_c_r_pthread_create" = x""yes; then +{ echo "$as_me:$LINENO: result: $ac_cv_lib_c_r_pthread_create" >&5 +echo "${ECHO_T}$ac_cv_lib_c_r_pthread_create" >&6; } +if test $ac_cv_lib_c_r_pthread_create = yes; then cat >>confdefs.h <<\_ACEOF #define WITH_THREAD 1 _ACEOF @@ -15685,10 +15383,10 @@ THREADOBJ="Python/thread.o" else - { $as_echo "$as_me:$LINENO: checking for __pthread_create_system in -lpthread" >&5 -$as_echo_n "checking for __pthread_create_system in -lpthread... " >&6; } + { echo "$as_me:$LINENO: checking for __pthread_create_system in -lpthread" >&5 +echo $ECHO_N "checking for __pthread_create_system in -lpthread... $ECHO_C" >&6; } if test "${ac_cv_lib_pthread___pthread_create_system+set}" = set; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lpthread $LIBS" @@ -15720,37 +15418,33 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err - } && test -s conftest$ac_exeext && { - test "$cross_compiling" = yes || - $as_test_x conftest$ac_exeext - }; then + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then ac_cv_lib_pthread___pthread_create_system=yes else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_pthread___pthread_create_system=no fi -rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_pthread___pthread_create_system" >&5 -$as_echo "$ac_cv_lib_pthread___pthread_create_system" >&6; } -if test "x$ac_cv_lib_pthread___pthread_create_system" = x""yes; then +{ echo "$as_me:$LINENO: result: $ac_cv_lib_pthread___pthread_create_system" >&5 +echo "${ECHO_T}$ac_cv_lib_pthread___pthread_create_system" >&6; } +if test $ac_cv_lib_pthread___pthread_create_system = yes; then cat >>confdefs.h <<\_ACEOF #define WITH_THREAD 1 _ACEOF @@ -15760,10 +15454,10 @@ THREADOBJ="Python/thread.o" else - { $as_echo "$as_me:$LINENO: checking for pthread_create in -lcma" >&5 -$as_echo_n "checking for pthread_create in -lcma... " >&6; } + { echo "$as_me:$LINENO: checking for pthread_create in -lcma" >&5 +echo $ECHO_N "checking for pthread_create in -lcma... $ECHO_C" >&6; } if test "${ac_cv_lib_cma_pthread_create+set}" = set; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lcma $LIBS" @@ -15795,37 +15489,33 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err - } && test -s conftest$ac_exeext && { - test "$cross_compiling" = yes || - $as_test_x conftest$ac_exeext - }; then + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then ac_cv_lib_cma_pthread_create=yes else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_cma_pthread_create=no fi -rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_cma_pthread_create" >&5 -$as_echo "$ac_cv_lib_cma_pthread_create" >&6; } -if test "x$ac_cv_lib_cma_pthread_create" = x""yes; then +{ echo "$as_me:$LINENO: result: $ac_cv_lib_cma_pthread_create" >&5 +echo "${ECHO_T}$ac_cv_lib_cma_pthread_create" >&6; } +if test $ac_cv_lib_cma_pthread_create = yes; then cat >>confdefs.h <<\_ACEOF #define WITH_THREAD 1 _ACEOF @@ -15855,7 +15545,6 @@ fi -rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext fi @@ -15867,10 +15556,10 @@ - { $as_echo "$as_me:$LINENO: checking for usconfig in -lmpc" >&5 -$as_echo_n "checking for usconfig in -lmpc... " >&6; } + { echo "$as_me:$LINENO: checking for usconfig in -lmpc" >&5 +echo $ECHO_N "checking for usconfig in -lmpc... $ECHO_C" >&6; } if test "${ac_cv_lib_mpc_usconfig+set}" = set; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lmpc $LIBS" @@ -15902,37 +15591,33 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err - } && test -s conftest$ac_exeext && { - test "$cross_compiling" = yes || - $as_test_x conftest$ac_exeext - }; then + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then ac_cv_lib_mpc_usconfig=yes else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_mpc_usconfig=no fi -rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_mpc_usconfig" >&5 -$as_echo "$ac_cv_lib_mpc_usconfig" >&6; } -if test "x$ac_cv_lib_mpc_usconfig" = x""yes; then +{ echo "$as_me:$LINENO: result: $ac_cv_lib_mpc_usconfig" >&5 +echo "${ECHO_T}$ac_cv_lib_mpc_usconfig" >&6; } +if test $ac_cv_lib_mpc_usconfig = yes; then cat >>confdefs.h <<\_ACEOF #define WITH_THREAD 1 _ACEOF @@ -15944,10 +15629,10 @@ if test "$posix_threads" != "yes"; then - { $as_echo "$as_me:$LINENO: checking for thr_create in -lthread" >&5 -$as_echo_n "checking for thr_create in -lthread... " >&6; } + { echo "$as_me:$LINENO: checking for thr_create in -lthread" >&5 +echo $ECHO_N "checking for thr_create in -lthread... $ECHO_C" >&6; } if test "${ac_cv_lib_thread_thr_create+set}" = set; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lthread $LIBS" @@ -15979,37 +15664,33 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err - } && test -s conftest$ac_exeext && { - test "$cross_compiling" = yes || - $as_test_x conftest$ac_exeext - }; then + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then ac_cv_lib_thread_thr_create=yes else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_thread_thr_create=no fi -rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_thread_thr_create" >&5 -$as_echo "$ac_cv_lib_thread_thr_create" >&6; } -if test "x$ac_cv_lib_thread_thr_create" = x""yes; then +{ echo "$as_me:$LINENO: result: $ac_cv_lib_thread_thr_create" >&5 +echo "${ECHO_T}$ac_cv_lib_thread_thr_create" >&6; } +if test $ac_cv_lib_thread_thr_create = yes; then cat >>confdefs.h <<\_ACEOF #define WITH_THREAD 1 _ACEOF @@ -16062,10 +15743,10 @@ ;; esac - { $as_echo "$as_me:$LINENO: checking if PTHREAD_SCOPE_SYSTEM is supported" >&5 -$as_echo_n "checking if PTHREAD_SCOPE_SYSTEM is supported... " >&6; } + { echo "$as_me:$LINENO: checking if PTHREAD_SCOPE_SYSTEM is supported" >&5 +echo $ECHO_N "checking if PTHREAD_SCOPE_SYSTEM is supported... $ECHO_C" >&6; } if test "${ac_cv_pthread_system_supported+set}" = set; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else if test "$cross_compiling" = yes; then ac_cv_pthread_system_supported=no @@ -16095,32 +15776,29 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>&5 ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_try") 2>&5 ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_pthread_system_supported=yes else - $as_echo "$as_me: program exited with status $ac_status" >&5 -$as_echo "$as_me: failed program was:" >&5 + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) ac_cv_pthread_system_supported=no fi -rm -rf conftest.dSYM rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi @@ -16128,8 +15806,8 @@ fi - { $as_echo "$as_me:$LINENO: result: $ac_cv_pthread_system_supported" >&5 -$as_echo "$ac_cv_pthread_system_supported" >&6; } + { echo "$as_me:$LINENO: result: $ac_cv_pthread_system_supported" >&5 +echo "${ECHO_T}$ac_cv_pthread_system_supported" >&6; } if test "$ac_cv_pthread_system_supported" = "yes"; then cat >>confdefs.h <<\_ACEOF @@ -16140,11 +15818,11 @@ for ac_func in pthread_sigmask do -as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` -{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5 -$as_echo_n "checking for $ac_func... " >&6; } +as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` +{ echo "$as_me:$LINENO: checking for $ac_func" >&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6; } if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ @@ -16197,42 +15875,35 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err - } && test -s conftest$ac_exeext && { - test "$cross_compiling" = yes || - $as_test_x conftest$ac_exeext - }; then + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then eval "$as_ac_var=yes" else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 eval "$as_ac_var=no" fi -rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext fi -ac_res=`eval 'as_val=${'$as_ac_var'} - $as_echo "$as_val"'` - { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } -as_val=`eval 'as_val=${'$as_ac_var'} - $as_echo "$as_val"'` - if test "x$as_val" = x""yes; then +ac_res=`eval echo '${'$as_ac_var'}'` + { echo "$as_me:$LINENO: result: $ac_res" >&5 +echo "${ECHO_T}$ac_res" >&6; } +if test `eval echo '${'$as_ac_var'}'` = yes; then cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 +#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF case $ac_sys_system in CYGWIN*) @@ -16252,18 +15923,18 @@ # Check for enable-ipv6 -{ $as_echo "$as_me:$LINENO: checking if --enable-ipv6 is specified" >&5 -$as_echo_n "checking if --enable-ipv6 is specified... " >&6; } +{ echo "$as_me:$LINENO: checking if --enable-ipv6 is specified" >&5 +echo $ECHO_N "checking if --enable-ipv6 is specified... $ECHO_C" >&6; } # Check whether --enable-ipv6 was given. if test "${enable_ipv6+set}" = set; then enableval=$enable_ipv6; case "$enableval" in no) - { $as_echo "$as_me:$LINENO: result: no" >&5 -$as_echo "no" >&6; } + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } ipv6=no ;; - *) { $as_echo "$as_me:$LINENO: result: yes" >&5 -$as_echo "yes" >&6; } + *) { echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; } cat >>confdefs.h <<\_ACEOF #define ENABLE_IPV6 1 _ACEOF @@ -16274,8 +15945,8 @@ else if test "$cross_compiling" = yes; then - { $as_echo "$as_me:$LINENO: result: no" >&5 -$as_echo "no" >&6; } + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } ipv6=no else @@ -16303,44 +15974,41 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>&5 ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_try") 2>&5 ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - { $as_echo "$as_me:$LINENO: result: yes" >&5 -$as_echo "yes" >&6; } + { echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; } ipv6=yes else - $as_echo "$as_me: program exited with status $ac_status" >&5 -$as_echo "$as_me: failed program was:" >&5 + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) -{ $as_echo "$as_me:$LINENO: result: no" >&5 -$as_echo "no" >&6; } +{ echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } ipv6=no fi -rm -rf conftest.dSYM rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi if test "$ipv6" = "yes"; then - { $as_echo "$as_me:$LINENO: checking if RFC2553 API is available" >&5 -$as_echo_n "checking if RFC2553 API is available... " >&6; } + { echo "$as_me:$LINENO: checking if RFC2553 API is available" >&5 +echo $ECHO_N "checking if RFC2553 API is available... $ECHO_C" >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF @@ -16364,27 +16032,26 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then - { $as_echo "$as_me:$LINENO: result: yes" >&5 -$as_echo "yes" >&6; } + { echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; } ipv6=yes else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 - { $as_echo "$as_me:$LINENO: result: no" >&5 -$as_echo "no" >&6; } + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } ipv6=no fi @@ -16406,8 +16073,8 @@ ipv6trylibc=no if test "$ipv6" = "yes"; then - { $as_echo "$as_me:$LINENO: checking ipv6 stack type" >&5 -$as_echo_n "checking ipv6 stack type... " >&6; } + { echo "$as_me:$LINENO: checking ipv6 stack type" >&5 +echo $ECHO_N "checking ipv6 stack type... $ECHO_C" >&6; } for i in inria kame linux-glibc linux-inet6 solaris toshiba v6d zeta; do case $i in @@ -16563,8 +16230,8 @@ break fi done - { $as_echo "$as_me:$LINENO: result: $ipv6type" >&5 -$as_echo "$ipv6type" >&6; } + { echo "$as_me:$LINENO: result: $ipv6type" >&5 +echo "${ECHO_T}$ipv6type" >&6; } fi if test "$ipv6" = "yes" -a "$ipv6lib" != "none"; then @@ -16583,8 +16250,8 @@ fi fi -{ $as_echo "$as_me:$LINENO: checking for OSX 10.5 SDK or later" >&5 -$as_echo_n "checking for OSX 10.5 SDK or later... " >&6; } +{ echo "$as_me:$LINENO: checking for OSX 10.5 SDK or later" >&5 +echo $ECHO_N "checking for OSX 10.5 SDK or later... $ECHO_C" >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF @@ -16606,14 +16273,13 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err @@ -16623,22 +16289,22 @@ #define HAVE_OSX105_SDK 1 _ACEOF - { $as_echo "$as_me:$LINENO: result: yes" >&5 -$as_echo "yes" >&6; } + { echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; } else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 - { $as_echo "$as_me:$LINENO: result: no" >&5 -$as_echo "no" >&6; } + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext # Check for --with-doc-strings -{ $as_echo "$as_me:$LINENO: checking for --with-doc-strings" >&5 -$as_echo_n "checking for --with-doc-strings... " >&6; } +{ echo "$as_me:$LINENO: checking for --with-doc-strings" >&5 +echo $ECHO_N "checking for --with-doc-strings... $ECHO_C" >&6; } # Check whether --with-doc-strings was given. if test "${with_doc_strings+set}" = set; then @@ -16657,12 +16323,12 @@ _ACEOF fi -{ $as_echo "$as_me:$LINENO: result: $with_doc_strings" >&5 -$as_echo "$with_doc_strings" >&6; } +{ echo "$as_me:$LINENO: result: $with_doc_strings" >&5 +echo "${ECHO_T}$with_doc_strings" >&6; } # Check for Python-specific malloc support -{ $as_echo "$as_me:$LINENO: checking for --with-tsc" >&5 -$as_echo_n "checking for --with-tsc... " >&6; } +{ echo "$as_me:$LINENO: checking for --with-tsc" >&5 +echo $ECHO_N "checking for --with-tsc... $ECHO_C" >&6; } # Check whether --with-tsc was given. if test "${with_tsc+set}" = set; then @@ -16674,20 +16340,20 @@ #define WITH_TSC 1 _ACEOF - { $as_echo "$as_me:$LINENO: result: yes" >&5 -$as_echo "yes" >&6; } -else { $as_echo "$as_me:$LINENO: result: no" >&5 -$as_echo "no" >&6; } + { echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; } +else { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } fi else - { $as_echo "$as_me:$LINENO: result: no" >&5 -$as_echo "no" >&6; } + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } fi # Check for Python-specific malloc support -{ $as_echo "$as_me:$LINENO: checking for --with-pymalloc" >&5 -$as_echo_n "checking for --with-pymalloc... " >&6; } +{ echo "$as_me:$LINENO: checking for --with-pymalloc" >&5 +echo $ECHO_N "checking for --with-pymalloc... $ECHO_C" >&6; } # Check whether --with-pymalloc was given. if test "${with_pymalloc+set}" = set; then @@ -16706,12 +16372,12 @@ _ACEOF fi -{ $as_echo "$as_me:$LINENO: result: $with_pymalloc" >&5 -$as_echo "$with_pymalloc" >&6; } +{ echo "$as_me:$LINENO: result: $with_pymalloc" >&5 +echo "${ECHO_T}$with_pymalloc" >&6; } # Check for --with-wctype-functions -{ $as_echo "$as_me:$LINENO: checking for --with-wctype-functions" >&5 -$as_echo_n "checking for --with-wctype-functions... " >&6; } +{ echo "$as_me:$LINENO: checking for --with-wctype-functions" >&5 +echo $ECHO_N "checking for --with-wctype-functions... $ECHO_C" >&6; } # Check whether --with-wctype-functions was given. if test "${with_wctype_functions+set}" = set; then @@ -16723,14 +16389,14 @@ #define WANT_WCTYPE_FUNCTIONS 1 _ACEOF - { $as_echo "$as_me:$LINENO: result: yes" >&5 -$as_echo "yes" >&6; } -else { $as_echo "$as_me:$LINENO: result: no" >&5 -$as_echo "no" >&6; } + { echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; } +else { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } fi else - { $as_echo "$as_me:$LINENO: result: no" >&5 -$as_echo "no" >&6; } + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } fi @@ -16743,11 +16409,11 @@ for ac_func in dlopen do -as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` -{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5 -$as_echo_n "checking for $ac_func... " >&6; } +as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` +{ echo "$as_me:$LINENO: checking for $ac_func" >&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6; } if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ @@ -16800,42 +16466,35 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err - } && test -s conftest$ac_exeext && { - test "$cross_compiling" = yes || - $as_test_x conftest$ac_exeext - }; then + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then eval "$as_ac_var=yes" else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 eval "$as_ac_var=no" fi -rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext fi -ac_res=`eval 'as_val=${'$as_ac_var'} - $as_echo "$as_val"'` - { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } -as_val=`eval 'as_val=${'$as_ac_var'} - $as_echo "$as_val"'` - if test "x$as_val" = x""yes; then +ac_res=`eval echo '${'$as_ac_var'}'` + { echo "$as_me:$LINENO: result: $ac_res" >&5 +echo "${ECHO_T}$ac_res" >&6; } +if test `eval echo '${'$as_ac_var'}'` = yes; then cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 +#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF fi @@ -16845,8 +16504,8 @@ # DYNLOADFILE specifies which dynload_*.o file we will use for dynamic # loading of modules. -{ $as_echo "$as_me:$LINENO: checking DYNLOADFILE" >&5 -$as_echo_n "checking DYNLOADFILE... " >&6; } +{ echo "$as_me:$LINENO: checking DYNLOADFILE" >&5 +echo $ECHO_N "checking DYNLOADFILE... $ECHO_C" >&6; } if test -z "$DYNLOADFILE" then case $ac_sys_system/$ac_sys_release in @@ -16871,8 +16530,8 @@ ;; esac fi -{ $as_echo "$as_me:$LINENO: result: $DYNLOADFILE" >&5 -$as_echo "$DYNLOADFILE" >&6; } +{ echo "$as_me:$LINENO: result: $DYNLOADFILE" >&5 +echo "${ECHO_T}$DYNLOADFILE" >&6; } if test "$DYNLOADFILE" != "dynload_stub.o" then @@ -16885,16 +16544,16 @@ # MACHDEP_OBJS can be set to platform-specific object files needed by Python -{ $as_echo "$as_me:$LINENO: checking MACHDEP_OBJS" >&5 -$as_echo_n "checking MACHDEP_OBJS... " >&6; } +{ echo "$as_me:$LINENO: checking MACHDEP_OBJS" >&5 +echo $ECHO_N "checking MACHDEP_OBJS... $ECHO_C" >&6; } if test -z "$MACHDEP_OBJS" then MACHDEP_OBJS=$extra_machdep_objs else MACHDEP_OBJS="$MACHDEP_OBJS $extra_machdep_objs" fi -{ $as_echo "$as_me:$LINENO: result: MACHDEP_OBJS" >&5 -$as_echo "MACHDEP_OBJS" >&6; } +{ echo "$as_me:$LINENO: result: MACHDEP_OBJS" >&5 +echo "${ECHO_T}MACHDEP_OBJS" >&6; } # checks for library functions @@ -16996,11 +16655,11 @@ sysconf tcgetpgrp tcsetpgrp tempnam timegm times tmpfile tmpnam tmpnam_r \ truncate uname unsetenv utimes waitpid wait3 wait4 wcscoll _getpty do -as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` -{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5 -$as_echo_n "checking for $ac_func... " >&6; } +as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` +{ echo "$as_me:$LINENO: checking for $ac_func" >&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6; } if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ @@ -17053,42 +16712,35 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err - } && test -s conftest$ac_exeext && { - test "$cross_compiling" = yes || - $as_test_x conftest$ac_exeext - }; then + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then eval "$as_ac_var=yes" else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 eval "$as_ac_var=no" fi -rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext fi -ac_res=`eval 'as_val=${'$as_ac_var'} - $as_echo "$as_val"'` - { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } -as_val=`eval 'as_val=${'$as_ac_var'} - $as_echo "$as_val"'` - if test "x$as_val" = x""yes; then +ac_res=`eval echo '${'$as_ac_var'}'` + { echo "$as_me:$LINENO: result: $ac_res" >&5 +echo "${ECHO_T}$ac_res" >&6; } +if test `eval echo '${'$as_ac_var'}'` = yes; then cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 +#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF fi @@ -17097,8 +16749,8 @@ # For some functions, having a definition is not sufficient, since # we want to take their address. -{ $as_echo "$as_me:$LINENO: checking for chroot" >&5 -$as_echo_n "checking for chroot... " >&6; } +{ echo "$as_me:$LINENO: checking for chroot" >&5 +echo $ECHO_N "checking for chroot... $ECHO_C" >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF @@ -17120,14 +16772,13 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err @@ -17137,20 +16788,20 @@ #define HAVE_CHROOT 1 _ACEOF - { $as_echo "$as_me:$LINENO: result: yes" >&5 -$as_echo "yes" >&6; } + { echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; } else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 - { $as_echo "$as_me:$LINENO: result: no" >&5 -$as_echo "no" >&6; } + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -{ $as_echo "$as_me:$LINENO: checking for link" >&5 -$as_echo_n "checking for link... " >&6; } +{ echo "$as_me:$LINENO: checking for link" >&5 +echo $ECHO_N "checking for link... $ECHO_C" >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF @@ -17172,14 +16823,13 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err @@ -17189,20 +16839,20 @@ #define HAVE_LINK 1 _ACEOF - { $as_echo "$as_me:$LINENO: result: yes" >&5 -$as_echo "yes" >&6; } + { echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; } else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 - { $as_echo "$as_me:$LINENO: result: no" >&5 -$as_echo "no" >&6; } + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -{ $as_echo "$as_me:$LINENO: checking for symlink" >&5 -$as_echo_n "checking for symlink... " >&6; } +{ echo "$as_me:$LINENO: checking for symlink" >&5 +echo $ECHO_N "checking for symlink... $ECHO_C" >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF @@ -17224,14 +16874,13 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err @@ -17241,20 +16890,20 @@ #define HAVE_SYMLINK 1 _ACEOF - { $as_echo "$as_me:$LINENO: result: yes" >&5 -$as_echo "yes" >&6; } + { echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; } else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 - { $as_echo "$as_me:$LINENO: result: no" >&5 -$as_echo "no" >&6; } + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -{ $as_echo "$as_me:$LINENO: checking for fchdir" >&5 -$as_echo_n "checking for fchdir... " >&6; } +{ echo "$as_me:$LINENO: checking for fchdir" >&5 +echo $ECHO_N "checking for fchdir... $ECHO_C" >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF @@ -17276,14 +16925,13 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err @@ -17293,20 +16941,20 @@ #define HAVE_FCHDIR 1 _ACEOF - { $as_echo "$as_me:$LINENO: result: yes" >&5 -$as_echo "yes" >&6; } + { echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; } else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 - { $as_echo "$as_me:$LINENO: result: no" >&5 -$as_echo "no" >&6; } + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -{ $as_echo "$as_me:$LINENO: checking for fsync" >&5 -$as_echo_n "checking for fsync... " >&6; } +{ echo "$as_me:$LINENO: checking for fsync" >&5 +echo $ECHO_N "checking for fsync... $ECHO_C" >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF @@ -17328,14 +16976,13 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err @@ -17345,20 +16992,20 @@ #define HAVE_FSYNC 1 _ACEOF - { $as_echo "$as_me:$LINENO: result: yes" >&5 -$as_echo "yes" >&6; } + { echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; } else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 - { $as_echo "$as_me:$LINENO: result: no" >&5 -$as_echo "no" >&6; } + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -{ $as_echo "$as_me:$LINENO: checking for fdatasync" >&5 -$as_echo_n "checking for fdatasync... " >&6; } +{ echo "$as_me:$LINENO: checking for fdatasync" >&5 +echo $ECHO_N "checking for fdatasync... $ECHO_C" >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF @@ -17380,14 +17027,13 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err @@ -17397,20 +17043,20 @@ #define HAVE_FDATASYNC 1 _ACEOF - { $as_echo "$as_me:$LINENO: result: yes" >&5 -$as_echo "yes" >&6; } + { echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; } else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 - { $as_echo "$as_me:$LINENO: result: no" >&5 -$as_echo "no" >&6; } + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -{ $as_echo "$as_me:$LINENO: checking for epoll" >&5 -$as_echo_n "checking for epoll... " >&6; } +{ echo "$as_me:$LINENO: checking for epoll" >&5 +echo $ECHO_N "checking for epoll... $ECHO_C" >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF @@ -17432,14 +17078,13 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err @@ -17449,20 +17094,20 @@ #define HAVE_EPOLL 1 _ACEOF - { $as_echo "$as_me:$LINENO: result: yes" >&5 -$as_echo "yes" >&6; } + { echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; } else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 - { $as_echo "$as_me:$LINENO: result: no" >&5 -$as_echo "no" >&6; } + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -{ $as_echo "$as_me:$LINENO: checking for kqueue" >&5 -$as_echo_n "checking for kqueue... " >&6; } +{ echo "$as_me:$LINENO: checking for kqueue" >&5 +echo $ECHO_N "checking for kqueue... $ECHO_C" >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF @@ -17487,14 +17132,13 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err @@ -17504,14 +17148,14 @@ #define HAVE_KQUEUE 1 _ACEOF - { $as_echo "$as_me:$LINENO: result: yes" >&5 -$as_echo "yes" >&6; } + { echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; } else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 - { $as_echo "$as_me:$LINENO: result: no" >&5 -$as_echo "no" >&6; } + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } fi @@ -17522,8 +17166,8 @@ # address to avoid compiler warnings and potential miscompilations # because of the missing prototypes. -{ $as_echo "$as_me:$LINENO: checking for ctermid_r" >&5 -$as_echo_n "checking for ctermid_r... " >&6; } +{ echo "$as_me:$LINENO: checking for ctermid_r" >&5 +echo $ECHO_N "checking for ctermid_r... $ECHO_C" >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF @@ -17548,14 +17192,13 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err @@ -17565,21 +17208,21 @@ #define HAVE_CTERMID_R 1 _ACEOF - { $as_echo "$as_me:$LINENO: result: yes" >&5 -$as_echo "yes" >&6; } + { echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; } else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 - { $as_echo "$as_me:$LINENO: result: no" >&5 -$as_echo "no" >&6; } + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -{ $as_echo "$as_me:$LINENO: checking for flock" >&5 -$as_echo_n "checking for flock... " >&6; } +{ echo "$as_me:$LINENO: checking for flock" >&5 +echo $ECHO_N "checking for flock... $ECHO_C" >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF @@ -17604,14 +17247,13 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err @@ -17621,21 +17263,21 @@ #define HAVE_FLOCK 1 _ACEOF - { $as_echo "$as_me:$LINENO: result: yes" >&5 -$as_echo "yes" >&6; } + { echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; } else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 - { $as_echo "$as_me:$LINENO: result: no" >&5 -$as_echo "no" >&6; } + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -{ $as_echo "$as_me:$LINENO: checking for getpagesize" >&5 -$as_echo_n "checking for getpagesize... " >&6; } +{ echo "$as_me:$LINENO: checking for getpagesize" >&5 +echo $ECHO_N "checking for getpagesize... $ECHO_C" >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF @@ -17660,14 +17302,13 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err @@ -17677,14 +17318,14 @@ #define HAVE_GETPAGESIZE 1 _ACEOF - { $as_echo "$as_me:$LINENO: result: yes" >&5 -$as_echo "yes" >&6; } + { echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; } else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 - { $as_echo "$as_me:$LINENO: result: no" >&5 -$as_echo "no" >&6; } + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } fi @@ -17694,10 +17335,10 @@ do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 -{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } if test "${ac_cv_prog_TRUE+set}" = set; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$TRUE"; then ac_cv_prog_TRUE="$TRUE" # Let the user override the test. @@ -17710,7 +17351,7 @@ for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_TRUE="$ac_prog" - $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -17721,11 +17362,11 @@ fi TRUE=$ac_cv_prog_TRUE if test -n "$TRUE"; then - { $as_echo "$as_me:$LINENO: result: $TRUE" >&5 -$as_echo "$TRUE" >&6; } + { echo "$as_me:$LINENO: result: $TRUE" >&5 +echo "${ECHO_T}$TRUE" >&6; } else - { $as_echo "$as_me:$LINENO: result: no" >&5 -$as_echo "no" >&6; } + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } fi @@ -17734,10 +17375,10 @@ test -n "$TRUE" || TRUE="/bin/true" -{ $as_echo "$as_me:$LINENO: checking for inet_aton in -lc" >&5 -$as_echo_n "checking for inet_aton in -lc... " >&6; } +{ echo "$as_me:$LINENO: checking for inet_aton in -lc" >&5 +echo $ECHO_N "checking for inet_aton in -lc... $ECHO_C" >&6; } if test "${ac_cv_lib_c_inet_aton+set}" = set; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lc $LIBS" @@ -17769,44 +17410,40 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err - } && test -s conftest$ac_exeext && { - test "$cross_compiling" = yes || - $as_test_x conftest$ac_exeext - }; then + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then ac_cv_lib_c_inet_aton=yes else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_c_inet_aton=no fi -rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_c_inet_aton" >&5 -$as_echo "$ac_cv_lib_c_inet_aton" >&6; } -if test "x$ac_cv_lib_c_inet_aton" = x""yes; then +{ echo "$as_me:$LINENO: result: $ac_cv_lib_c_inet_aton" >&5 +echo "${ECHO_T}$ac_cv_lib_c_inet_aton" >&6; } +if test $ac_cv_lib_c_inet_aton = yes; then $ac_cv_prog_TRUE else -{ $as_echo "$as_me:$LINENO: checking for inet_aton in -lresolv" >&5 -$as_echo_n "checking for inet_aton in -lresolv... " >&6; } +{ echo "$as_me:$LINENO: checking for inet_aton in -lresolv" >&5 +echo $ECHO_N "checking for inet_aton in -lresolv... $ECHO_C" >&6; } if test "${ac_cv_lib_resolv_inet_aton+set}" = set; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lresolv $LIBS" @@ -17838,37 +17475,33 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err - } && test -s conftest$ac_exeext && { - test "$cross_compiling" = yes || - $as_test_x conftest$ac_exeext - }; then + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then ac_cv_lib_resolv_inet_aton=yes else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_resolv_inet_aton=no fi -rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_resolv_inet_aton" >&5 -$as_echo "$ac_cv_lib_resolv_inet_aton" >&6; } -if test "x$ac_cv_lib_resolv_inet_aton" = x""yes; then +{ echo "$as_me:$LINENO: result: $ac_cv_lib_resolv_inet_aton" >&5 +echo "${ECHO_T}$ac_cv_lib_resolv_inet_aton" >&6; } +if test $ac_cv_lib_resolv_inet_aton = yes; then cat >>confdefs.h <<_ACEOF #define HAVE_LIBRESOLV 1 _ACEOF @@ -17883,16 +17516,14 @@ # On Tru64, chflags seems to be present, but calling it will # exit Python -{ $as_echo "$as_me:$LINENO: checking for chflags" >&5 -$as_echo_n "checking for chflags... " >&6; } +{ echo "$as_me:$LINENO: checking for chflags" >&5 +echo $ECHO_N "checking for chflags... $ECHO_C" >&6; } if test "$cross_compiling" = yes; then - { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -{ { $as_echo "$as_me:$LINENO: error: cannot run test program while cross compiling + { { echo "$as_me:$LINENO: error: cannot run test program while cross compiling See \`config.log' for more details." >&5 -$as_echo "$as_me: error: cannot run test program while cross compiling +echo "$as_me: error: cannot run test program while cross compiling See \`config.log' for more details." >&2;} - { (exit 1); exit 1; }; }; } + { (exit 1); exit 1; }; } else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ @@ -17917,55 +17548,50 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>&5 ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_try") 2>&5 ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then cat >>confdefs.h <<\_ACEOF #define HAVE_CHFLAGS 1 _ACEOF - { $as_echo "$as_me:$LINENO: result: yes" >&5 -$as_echo "yes" >&6; } + { echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; } else - $as_echo "$as_me: program exited with status $ac_status" >&5 -$as_echo "$as_me: failed program was:" >&5 + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) -{ $as_echo "$as_me:$LINENO: result: no" >&5 -$as_echo "no" >&6; } +{ echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } fi -rm -rf conftest.dSYM rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi -{ $as_echo "$as_me:$LINENO: checking for lchflags" >&5 -$as_echo_n "checking for lchflags... " >&6; } +{ echo "$as_me:$LINENO: checking for lchflags" >&5 +echo $ECHO_N "checking for lchflags... $ECHO_C" >&6; } if test "$cross_compiling" = yes; then - { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -{ { $as_echo "$as_me:$LINENO: error: cannot run test program while cross compiling + { { echo "$as_me:$LINENO: error: cannot run test program while cross compiling See \`config.log' for more details." >&5 -$as_echo "$as_me: error: cannot run test program while cross compiling +echo "$as_me: error: cannot run test program while cross compiling See \`config.log' for more details." >&2;} - { (exit 1); exit 1; }; }; } + { (exit 1); exit 1; }; } else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ @@ -17990,40 +17616,37 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>&5 ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_try") 2>&5 ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then cat >>confdefs.h <<\_ACEOF #define HAVE_LCHFLAGS 1 _ACEOF - { $as_echo "$as_me:$LINENO: result: yes" >&5 -$as_echo "yes" >&6; } + { echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; } else - $as_echo "$as_me: program exited with status $ac_status" >&5 -$as_echo "$as_me: failed program was:" >&5 + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) -{ $as_echo "$as_me:$LINENO: result: no" >&5 -$as_echo "no" >&6; } +{ echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } fi -rm -rf conftest.dSYM rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi @@ -18038,10 +17661,10 @@ ;; esac -{ $as_echo "$as_me:$LINENO: checking for inflateCopy in -lz" >&5 -$as_echo_n "checking for inflateCopy in -lz... " >&6; } +{ echo "$as_me:$LINENO: checking for inflateCopy in -lz" >&5 +echo $ECHO_N "checking for inflateCopy in -lz... $ECHO_C" >&6; } if test "${ac_cv_lib_z_inflateCopy+set}" = set; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lz $LIBS" @@ -18073,37 +17696,33 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err - } && test -s conftest$ac_exeext && { - test "$cross_compiling" = yes || - $as_test_x conftest$ac_exeext - }; then + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then ac_cv_lib_z_inflateCopy=yes else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_z_inflateCopy=no fi -rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_z_inflateCopy" >&5 -$as_echo "$ac_cv_lib_z_inflateCopy" >&6; } -if test "x$ac_cv_lib_z_inflateCopy" = x""yes; then +{ echo "$as_me:$LINENO: result: $ac_cv_lib_z_inflateCopy" >&5 +echo "${ECHO_T}$ac_cv_lib_z_inflateCopy" >&6; } +if test $ac_cv_lib_z_inflateCopy = yes; then cat >>confdefs.h <<\_ACEOF #define HAVE_ZLIB_COPY 1 @@ -18119,8 +17738,8 @@ ;; esac -{ $as_echo "$as_me:$LINENO: checking for hstrerror" >&5 -$as_echo_n "checking for hstrerror... " >&6; } +{ echo "$as_me:$LINENO: checking for hstrerror" >&5 +echo $ECHO_N "checking for hstrerror... $ECHO_C" >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF @@ -18145,43 +17764,39 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err - } && test -s conftest$ac_exeext && { - test "$cross_compiling" = yes || - $as_test_x conftest$ac_exeext - }; then + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then cat >>confdefs.h <<\_ACEOF #define HAVE_HSTRERROR 1 _ACEOF - { $as_echo "$as_me:$LINENO: result: yes" >&5 -$as_echo "yes" >&6; } + { echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; } else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 - { $as_echo "$as_me:$LINENO: result: no" >&5 -$as_echo "no" >&6; } + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } fi -rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext -{ $as_echo "$as_me:$LINENO: checking for inet_aton" >&5 -$as_echo_n "checking for inet_aton... " >&6; } +{ echo "$as_me:$LINENO: checking for inet_aton" >&5 +echo $ECHO_N "checking for inet_aton... $ECHO_C" >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF @@ -18209,43 +17824,39 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err - } && test -s conftest$ac_exeext && { - test "$cross_compiling" = yes || - $as_test_x conftest$ac_exeext - }; then + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then cat >>confdefs.h <<\_ACEOF #define HAVE_INET_ATON 1 _ACEOF - { $as_echo "$as_me:$LINENO: result: yes" >&5 -$as_echo "yes" >&6; } + { echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; } else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 - { $as_echo "$as_me:$LINENO: result: no" >&5 -$as_echo "no" >&6; } + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } fi -rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext -{ $as_echo "$as_me:$LINENO: checking for inet_pton" >&5 -$as_echo_n "checking for inet_pton... " >&6; } +{ echo "$as_me:$LINENO: checking for inet_pton" >&5 +echo $ECHO_N "checking for inet_pton... $ECHO_C" >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF @@ -18273,14 +17884,13 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err @@ -18290,22 +17900,22 @@ #define HAVE_INET_PTON 1 _ACEOF - { $as_echo "$as_me:$LINENO: result: yes" >&5 -$as_echo "yes" >&6; } + { echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; } else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 - { $as_echo "$as_me:$LINENO: result: no" >&5 -$as_echo "no" >&6; } + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext # On some systems, setgroups is in unistd.h, on others, in grp.h -{ $as_echo "$as_me:$LINENO: checking for setgroups" >&5 -$as_echo_n "checking for setgroups... " >&6; } +{ echo "$as_me:$LINENO: checking for setgroups" >&5 +echo $ECHO_N "checking for setgroups... $ECHO_C" >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF @@ -18333,14 +17943,13 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err @@ -18350,14 +17959,14 @@ #define HAVE_SETGROUPS 1 _ACEOF - { $as_echo "$as_me:$LINENO: result: yes" >&5 -$as_echo "yes" >&6; } + { echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; } else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 - { $as_echo "$as_me:$LINENO: result: no" >&5 -$as_echo "no" >&6; } + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } fi @@ -18368,11 +17977,11 @@ for ac_func in openpty do -as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` -{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5 -$as_echo_n "checking for $ac_func... " >&6; } +as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` +{ echo "$as_me:$LINENO: checking for $ac_func" >&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6; } if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ @@ -18425,49 +18034,42 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err - } && test -s conftest$ac_exeext && { - test "$cross_compiling" = yes || - $as_test_x conftest$ac_exeext - }; then + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then eval "$as_ac_var=yes" else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 eval "$as_ac_var=no" fi -rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext fi -ac_res=`eval 'as_val=${'$as_ac_var'} - $as_echo "$as_val"'` - { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } -as_val=`eval 'as_val=${'$as_ac_var'} - $as_echo "$as_val"'` - if test "x$as_val" = x""yes; then +ac_res=`eval echo '${'$as_ac_var'}'` + { echo "$as_me:$LINENO: result: $ac_res" >&5 +echo "${ECHO_T}$ac_res" >&6; } +if test `eval echo '${'$as_ac_var'}'` = yes; then cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 +#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF else - { $as_echo "$as_me:$LINENO: checking for openpty in -lutil" >&5 -$as_echo_n "checking for openpty in -lutil... " >&6; } + { echo "$as_me:$LINENO: checking for openpty in -lutil" >&5 +echo $ECHO_N "checking for openpty in -lutil... $ECHO_C" >&6; } if test "${ac_cv_lib_util_openpty+set}" = set; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lutil $LIBS" @@ -18499,46 +18101,42 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err - } && test -s conftest$ac_exeext && { - test "$cross_compiling" = yes || - $as_test_x conftest$ac_exeext - }; then + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then ac_cv_lib_util_openpty=yes else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_util_openpty=no fi -rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_util_openpty" >&5 -$as_echo "$ac_cv_lib_util_openpty" >&6; } -if test "x$ac_cv_lib_util_openpty" = x""yes; then +{ echo "$as_me:$LINENO: result: $ac_cv_lib_util_openpty" >&5 +echo "${ECHO_T}$ac_cv_lib_util_openpty" >&6; } +if test $ac_cv_lib_util_openpty = yes; then cat >>confdefs.h <<\_ACEOF #define HAVE_OPENPTY 1 _ACEOF LIBS="$LIBS -lutil" else - { $as_echo "$as_me:$LINENO: checking for openpty in -lbsd" >&5 -$as_echo_n "checking for openpty in -lbsd... " >&6; } + { echo "$as_me:$LINENO: checking for openpty in -lbsd" >&5 +echo $ECHO_N "checking for openpty in -lbsd... $ECHO_C" >&6; } if test "${ac_cv_lib_bsd_openpty+set}" = set; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lbsd $LIBS" @@ -18570,37 +18168,33 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err - } && test -s conftest$ac_exeext && { - test "$cross_compiling" = yes || - $as_test_x conftest$ac_exeext - }; then + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then ac_cv_lib_bsd_openpty=yes else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_bsd_openpty=no fi -rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_bsd_openpty" >&5 -$as_echo "$ac_cv_lib_bsd_openpty" >&6; } -if test "x$ac_cv_lib_bsd_openpty" = x""yes; then +{ echo "$as_me:$LINENO: result: $ac_cv_lib_bsd_openpty" >&5 +echo "${ECHO_T}$ac_cv_lib_bsd_openpty" >&6; } +if test $ac_cv_lib_bsd_openpty = yes; then cat >>confdefs.h <<\_ACEOF #define HAVE_OPENPTY 1 _ACEOF @@ -18617,11 +18211,11 @@ for ac_func in forkpty do -as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` -{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5 -$as_echo_n "checking for $ac_func... " >&6; } +as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` +{ echo "$as_me:$LINENO: checking for $ac_func" >&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6; } if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ @@ -18674,49 +18268,42 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err - } && test -s conftest$ac_exeext && { - test "$cross_compiling" = yes || - $as_test_x conftest$ac_exeext - }; then + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then eval "$as_ac_var=yes" else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 eval "$as_ac_var=no" fi -rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext fi -ac_res=`eval 'as_val=${'$as_ac_var'} - $as_echo "$as_val"'` - { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } -as_val=`eval 'as_val=${'$as_ac_var'} - $as_echo "$as_val"'` - if test "x$as_val" = x""yes; then +ac_res=`eval echo '${'$as_ac_var'}'` + { echo "$as_me:$LINENO: result: $ac_res" >&5 +echo "${ECHO_T}$ac_res" >&6; } +if test `eval echo '${'$as_ac_var'}'` = yes; then cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 +#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF else - { $as_echo "$as_me:$LINENO: checking for forkpty in -lutil" >&5 -$as_echo_n "checking for forkpty in -lutil... " >&6; } + { echo "$as_me:$LINENO: checking for forkpty in -lutil" >&5 +echo $ECHO_N "checking for forkpty in -lutil... $ECHO_C" >&6; } if test "${ac_cv_lib_util_forkpty+set}" = set; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lutil $LIBS" @@ -18748,46 +18335,42 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err - } && test -s conftest$ac_exeext && { - test "$cross_compiling" = yes || - $as_test_x conftest$ac_exeext - }; then + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then ac_cv_lib_util_forkpty=yes else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_util_forkpty=no fi -rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_util_forkpty" >&5 -$as_echo "$ac_cv_lib_util_forkpty" >&6; } -if test "x$ac_cv_lib_util_forkpty" = x""yes; then +{ echo "$as_me:$LINENO: result: $ac_cv_lib_util_forkpty" >&5 +echo "${ECHO_T}$ac_cv_lib_util_forkpty" >&6; } +if test $ac_cv_lib_util_forkpty = yes; then cat >>confdefs.h <<\_ACEOF #define HAVE_FORKPTY 1 _ACEOF LIBS="$LIBS -lutil" else - { $as_echo "$as_me:$LINENO: checking for forkpty in -lbsd" >&5 -$as_echo_n "checking for forkpty in -lbsd... " >&6; } + { echo "$as_me:$LINENO: checking for forkpty in -lbsd" >&5 +echo $ECHO_N "checking for forkpty in -lbsd... $ECHO_C" >&6; } if test "${ac_cv_lib_bsd_forkpty+set}" = set; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lbsd $LIBS" @@ -18819,37 +18402,33 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err - } && test -s conftest$ac_exeext && { - test "$cross_compiling" = yes || - $as_test_x conftest$ac_exeext - }; then + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then ac_cv_lib_bsd_forkpty=yes else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_bsd_forkpty=no fi -rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_bsd_forkpty" >&5 -$as_echo "$ac_cv_lib_bsd_forkpty" >&6; } -if test "x$ac_cv_lib_bsd_forkpty" = x""yes; then +{ echo "$as_me:$LINENO: result: $ac_cv_lib_bsd_forkpty" >&5 +echo "${ECHO_T}$ac_cv_lib_bsd_forkpty" >&6; } +if test $ac_cv_lib_bsd_forkpty = yes; then cat >>confdefs.h <<\_ACEOF #define HAVE_FORKPTY 1 _ACEOF @@ -18868,11 +18447,11 @@ for ac_func in memmove do -as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` -{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5 -$as_echo_n "checking for $ac_func... " >&6; } +as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` +{ echo "$as_me:$LINENO: checking for $ac_func" >&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6; } if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ @@ -18925,42 +18504,35 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err - } && test -s conftest$ac_exeext && { - test "$cross_compiling" = yes || - $as_test_x conftest$ac_exeext - }; then + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then eval "$as_ac_var=yes" else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 eval "$as_ac_var=no" fi -rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext fi -ac_res=`eval 'as_val=${'$as_ac_var'} - $as_echo "$as_val"'` - { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } -as_val=`eval 'as_val=${'$as_ac_var'} - $as_echo "$as_val"'` - if test "x$as_val" = x""yes; then +ac_res=`eval echo '${'$as_ac_var'}'` + { echo "$as_me:$LINENO: result: $ac_res" >&5 +echo "${ECHO_T}$ac_res" >&6; } +if test `eval echo '${'$as_ac_var'}'` = yes; then cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 +#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF fi @@ -18976,11 +18548,11 @@ for ac_func in fseek64 fseeko fstatvfs ftell64 ftello statvfs do -as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` -{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5 -$as_echo_n "checking for $ac_func... " >&6; } +as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` +{ echo "$as_me:$LINENO: checking for $ac_func" >&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6; } if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ @@ -19033,42 +18605,35 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err - } && test -s conftest$ac_exeext && { - test "$cross_compiling" = yes || - $as_test_x conftest$ac_exeext - }; then + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then eval "$as_ac_var=yes" else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 eval "$as_ac_var=no" fi -rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext fi -ac_res=`eval 'as_val=${'$as_ac_var'} - $as_echo "$as_val"'` - { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } -as_val=`eval 'as_val=${'$as_ac_var'} - $as_echo "$as_val"'` - if test "x$as_val" = x""yes; then +ac_res=`eval echo '${'$as_ac_var'}'` + { echo "$as_me:$LINENO: result: $ac_res" >&5 +echo "${ECHO_T}$ac_res" >&6; } +if test `eval echo '${'$as_ac_var'}'` = yes; then cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 +#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF fi @@ -19080,11 +18645,11 @@ for ac_func in dup2 getcwd strdup do -as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` -{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5 -$as_echo_n "checking for $ac_func... " >&6; } +as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` +{ echo "$as_me:$LINENO: checking for $ac_func" >&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6; } if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ @@ -19137,42 +18702,35 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err - } && test -s conftest$ac_exeext && { - test "$cross_compiling" = yes || - $as_test_x conftest$ac_exeext - }; then + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then eval "$as_ac_var=yes" else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 eval "$as_ac_var=no" fi -rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext fi -ac_res=`eval 'as_val=${'$as_ac_var'} - $as_echo "$as_val"'` - { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } -as_val=`eval 'as_val=${'$as_ac_var'} - $as_echo "$as_val"'` - if test "x$as_val" = x""yes; then +ac_res=`eval echo '${'$as_ac_var'}'` + { echo "$as_me:$LINENO: result: $ac_res" >&5 +echo "${ECHO_T}$ac_res" >&6; } +if test `eval echo '${'$as_ac_var'}'` = yes; then cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 +#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF else @@ -19189,11 +18747,11 @@ for ac_func in getpgrp do -as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` -{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5 -$as_echo_n "checking for $ac_func... " >&6; } +as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` +{ echo "$as_me:$LINENO: checking for $ac_func" >&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6; } if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ @@ -19246,42 +18804,35 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err - } && test -s conftest$ac_exeext && { - test "$cross_compiling" = yes || - $as_test_x conftest$ac_exeext - }; then + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then eval "$as_ac_var=yes" else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 eval "$as_ac_var=no" fi -rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext fi -ac_res=`eval 'as_val=${'$as_ac_var'} - $as_echo "$as_val"'` - { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } -as_val=`eval 'as_val=${'$as_ac_var'} - $as_echo "$as_val"'` - if test "x$as_val" = x""yes; then +ac_res=`eval echo '${'$as_ac_var'}'` + { echo "$as_me:$LINENO: result: $ac_res" >&5 +echo "${ECHO_T}$ac_res" >&6; } +if test `eval echo '${'$as_ac_var'}'` = yes; then cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 +#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ @@ -19304,14 +18855,13 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err @@ -19323,7 +18873,7 @@ else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 @@ -19337,11 +18887,11 @@ for ac_func in setpgrp do -as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` -{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5 -$as_echo_n "checking for $ac_func... " >&6; } +as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` +{ echo "$as_me:$LINENO: checking for $ac_func" >&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6; } if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ @@ -19394,42 +18944,35 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err - } && test -s conftest$ac_exeext && { - test "$cross_compiling" = yes || - $as_test_x conftest$ac_exeext - }; then + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then eval "$as_ac_var=yes" else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 eval "$as_ac_var=no" fi -rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext fi -ac_res=`eval 'as_val=${'$as_ac_var'} - $as_echo "$as_val"'` - { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } -as_val=`eval 'as_val=${'$as_ac_var'} - $as_echo "$as_val"'` - if test "x$as_val" = x""yes; then +ac_res=`eval echo '${'$as_ac_var'}'` + { echo "$as_me:$LINENO: result: $ac_res" >&5 +echo "${ECHO_T}$ac_res" >&6; } +if test `eval echo '${'$as_ac_var'}'` = yes; then cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 +#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ @@ -19452,14 +18995,13 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err @@ -19471,7 +19013,7 @@ else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 @@ -19485,11 +19027,11 @@ for ac_func in gettimeofday do -as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` -{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5 -$as_echo_n "checking for $ac_func... " >&6; } +as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` +{ echo "$as_me:$LINENO: checking for $ac_func" >&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6; } if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ @@ -19542,42 +19084,35 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err - } && test -s conftest$ac_exeext && { - test "$cross_compiling" = yes || - $as_test_x conftest$ac_exeext - }; then + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then eval "$as_ac_var=yes" else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 eval "$as_ac_var=no" fi -rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext fi -ac_res=`eval 'as_val=${'$as_ac_var'} - $as_echo "$as_val"'` - { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } -as_val=`eval 'as_val=${'$as_ac_var'} - $as_echo "$as_val"'` - if test "x$as_val" = x""yes; then +ac_res=`eval echo '${'$as_ac_var'}'` + { echo "$as_me:$LINENO: result: $ac_res" >&5 +echo "${ECHO_T}$ac_res" >&6; } +if test `eval echo '${'$as_ac_var'}'` = yes; then cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 +#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ @@ -19600,21 +19135,20 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then : else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 @@ -19631,8 +19165,8 @@ done -{ $as_echo "$as_me:$LINENO: checking for major" >&5 -$as_echo_n "checking for major... " >&6; } +{ echo "$as_me:$LINENO: checking for major" >&5 +echo $ECHO_N "checking for major... $ECHO_C" >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF @@ -19664,48 +19198,44 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err - } && test -s conftest$ac_exeext && { - test "$cross_compiling" = yes || - $as_test_x conftest$ac_exeext - }; then + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then cat >>confdefs.h <<\_ACEOF #define HAVE_DEVICE_MACROS 1 _ACEOF - { $as_echo "$as_me:$LINENO: result: yes" >&5 -$as_echo "yes" >&6; } + { echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; } else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 - { $as_echo "$as_me:$LINENO: result: no" >&5 -$as_echo "no" >&6; } + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } fi -rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext # On OSF/1 V5.1, getaddrinfo is available, but a define # for [no]getaddrinfo in netdb.h. -{ $as_echo "$as_me:$LINENO: checking for getaddrinfo" >&5 -$as_echo_n "checking for getaddrinfo... " >&6; } +{ echo "$as_me:$LINENO: checking for getaddrinfo" >&5 +echo $ECHO_N "checking for getaddrinfo... $ECHO_C" >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF @@ -19734,29 +19264,26 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err - } && test -s conftest$ac_exeext && { - test "$cross_compiling" = yes || - $as_test_x conftest$ac_exeext - }; then + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then -{ $as_echo "$as_me:$LINENO: result: yes" >&5 -$as_echo "yes" >&6; } -{ $as_echo "$as_me:$LINENO: checking getaddrinfo bug" >&5 -$as_echo_n "checking getaddrinfo bug... " >&6; } +{ echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; } +{ echo "$as_me:$LINENO: checking getaddrinfo bug" >&5 +echo $ECHO_N "checking getaddrinfo bug... $ECHO_C" >&6; } if test "$cross_compiling" = yes; then - { $as_echo "$as_me:$LINENO: result: buggy" >&5 -$as_echo "buggy" >&6; } + { echo "$as_me:$LINENO: result: buggy" >&5 +echo "${ECHO_T}buggy" >&6; } buggygetaddrinfo=yes else cat >conftest.$ac_ext <<_ACEOF @@ -19859,52 +19386,48 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>&5 ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_try") 2>&5 ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - { $as_echo "$as_me:$LINENO: result: good" >&5 -$as_echo "good" >&6; } + { echo "$as_me:$LINENO: result: good" >&5 +echo "${ECHO_T}good" >&6; } buggygetaddrinfo=no else - $as_echo "$as_me: program exited with status $ac_status" >&5 -$as_echo "$as_me: failed program was:" >&5 + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) -{ $as_echo "$as_me:$LINENO: result: buggy" >&5 -$as_echo "buggy" >&6; } +{ echo "$as_me:$LINENO: result: buggy" >&5 +echo "${ECHO_T}buggy" >&6; } buggygetaddrinfo=yes fi -rm -rf conftest.dSYM rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -{ $as_echo "$as_me:$LINENO: result: no" >&5 -$as_echo "no" >&6; } +{ echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } buggygetaddrinfo=yes fi -rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext @@ -19924,11 +19447,11 @@ for ac_func in getnameinfo do -as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` -{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5 -$as_echo_n "checking for $ac_func... " >&6; } +as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` +{ echo "$as_me:$LINENO: checking for $ac_func" >&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6; } if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ @@ -19981,42 +19504,35 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err - } && test -s conftest$ac_exeext && { - test "$cross_compiling" = yes || - $as_test_x conftest$ac_exeext - }; then + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then eval "$as_ac_var=yes" else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 eval "$as_ac_var=no" fi -rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext fi -ac_res=`eval 'as_val=${'$as_ac_var'} - $as_echo "$as_val"'` - { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } -as_val=`eval 'as_val=${'$as_ac_var'} - $as_echo "$as_val"'` - if test "x$as_val" = x""yes; then +ac_res=`eval echo '${'$as_ac_var'}'` + { echo "$as_me:$LINENO: result: $ac_res" >&5 +echo "${ECHO_T}$ac_res" >&6; } +if test `eval echo '${'$as_ac_var'}'` = yes; then cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 +#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF fi @@ -20024,10 +19540,10 @@ # checks for structures -{ $as_echo "$as_me:$LINENO: checking whether time.h and sys/time.h may both be included" >&5 -$as_echo_n "checking whether time.h and sys/time.h may both be included... " >&6; } +{ echo "$as_me:$LINENO: checking whether time.h and sys/time.h may both be included" >&5 +echo $ECHO_N "checking whether time.h and sys/time.h may both be included... $ECHO_C" >&6; } if test "${ac_cv_header_time+set}" = set; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ @@ -20054,21 +19570,20 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_header_time=yes else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_header_time=no @@ -20076,8 +19591,8 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_time" >&5 -$as_echo "$ac_cv_header_time" >&6; } +{ echo "$as_me:$LINENO: result: $ac_cv_header_time" >&5 +echo "${ECHO_T}$ac_cv_header_time" >&6; } if test $ac_cv_header_time = yes; then cat >>confdefs.h <<\_ACEOF @@ -20086,10 +19601,10 @@ fi -{ $as_echo "$as_me:$LINENO: checking whether struct tm is in sys/time.h or time.h" >&5 -$as_echo_n "checking whether struct tm is in sys/time.h or time.h... " >&6; } +{ echo "$as_me:$LINENO: checking whether struct tm is in sys/time.h or time.h" >&5 +echo $ECHO_N "checking whether struct tm is in sys/time.h or time.h... $ECHO_C" >&6; } if test "${ac_cv_struct_tm+set}" = set; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ @@ -20105,7 +19620,7 @@ { struct tm tm; int *p = &tm.tm_sec; - return !p; + return !p; ; return 0; } @@ -20116,21 +19631,20 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_struct_tm=time.h else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_struct_tm=sys/time.h @@ -20138,8 +19652,8 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_struct_tm" >&5 -$as_echo "$ac_cv_struct_tm" >&6; } +{ echo "$as_me:$LINENO: result: $ac_cv_struct_tm" >&5 +echo "${ECHO_T}$ac_cv_struct_tm" >&6; } if test $ac_cv_struct_tm = sys/time.h; then cat >>confdefs.h <<\_ACEOF @@ -20148,10 +19662,10 @@ fi -{ $as_echo "$as_me:$LINENO: checking for struct tm.tm_zone" >&5 -$as_echo_n "checking for struct tm.tm_zone... " >&6; } +{ echo "$as_me:$LINENO: checking for struct tm.tm_zone" >&5 +echo $ECHO_N "checking for struct tm.tm_zone... $ECHO_C" >&6; } if test "${ac_cv_member_struct_tm_tm_zone+set}" = set; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ @@ -20179,21 +19693,20 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_member_struct_tm_tm_zone=yes else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 cat >conftest.$ac_ext <<_ACEOF @@ -20222,21 +19735,20 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_member_struct_tm_tm_zone=yes else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_member_struct_tm_tm_zone=no @@ -20247,9 +19759,9 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_member_struct_tm_tm_zone" >&5 -$as_echo "$ac_cv_member_struct_tm_tm_zone" >&6; } -if test "x$ac_cv_member_struct_tm_tm_zone" = x""yes; then +{ echo "$as_me:$LINENO: result: $ac_cv_member_struct_tm_tm_zone" >&5 +echo "${ECHO_T}$ac_cv_member_struct_tm_tm_zone" >&6; } +if test $ac_cv_member_struct_tm_tm_zone = yes; then cat >>confdefs.h <<_ACEOF #define HAVE_STRUCT_TM_TM_ZONE 1 @@ -20265,10 +19777,10 @@ _ACEOF else - { $as_echo "$as_me:$LINENO: checking whether tzname is declared" >&5 -$as_echo_n "checking whether tzname is declared... " >&6; } + { echo "$as_me:$LINENO: checking whether tzname is declared" >&5 +echo $ECHO_N "checking whether tzname is declared... $ECHO_C" >&6; } if test "${ac_cv_have_decl_tzname+set}" = set; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ @@ -20295,21 +19807,20 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_have_decl_tzname=yes else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_have_decl_tzname=no @@ -20317,9 +19828,9 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_have_decl_tzname" >&5 -$as_echo "$ac_cv_have_decl_tzname" >&6; } -if test "x$ac_cv_have_decl_tzname" = x""yes; then +{ echo "$as_me:$LINENO: result: $ac_cv_have_decl_tzname" >&5 +echo "${ECHO_T}$ac_cv_have_decl_tzname" >&6; } +if test $ac_cv_have_decl_tzname = yes; then cat >>confdefs.h <<_ACEOF #define HAVE_DECL_TZNAME 1 @@ -20335,10 +19846,10 @@ fi - { $as_echo "$as_me:$LINENO: checking for tzname" >&5 -$as_echo_n "checking for tzname... " >&6; } + { echo "$as_me:$LINENO: checking for tzname" >&5 +echo $ECHO_N "checking for tzname... $ECHO_C" >&6; } if test "${ac_cv_var_tzname+set}" = set; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ @@ -20365,35 +19876,31 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err - } && test -s conftest$ac_exeext && { - test "$cross_compiling" = yes || - $as_test_x conftest$ac_exeext - }; then + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then ac_cv_var_tzname=yes else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_var_tzname=no fi -rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_var_tzname" >&5 -$as_echo "$ac_cv_var_tzname" >&6; } +{ echo "$as_me:$LINENO: result: $ac_cv_var_tzname" >&5 +echo "${ECHO_T}$ac_cv_var_tzname" >&6; } if test $ac_cv_var_tzname = yes; then cat >>confdefs.h <<\_ACEOF @@ -20403,10 +19910,10 @@ fi fi -{ $as_echo "$as_me:$LINENO: checking for struct stat.st_rdev" >&5 -$as_echo_n "checking for struct stat.st_rdev... " >&6; } +{ echo "$as_me:$LINENO: checking for struct stat.st_rdev" >&5 +echo $ECHO_N "checking for struct stat.st_rdev... $ECHO_C" >&6; } if test "${ac_cv_member_struct_stat_st_rdev+set}" = set; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ @@ -20431,21 +19938,20 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_member_struct_stat_st_rdev=yes else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 cat >conftest.$ac_ext <<_ACEOF @@ -20471,21 +19977,20 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_member_struct_stat_st_rdev=yes else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_member_struct_stat_st_rdev=no @@ -20496,9 +20001,9 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_member_struct_stat_st_rdev" >&5 -$as_echo "$ac_cv_member_struct_stat_st_rdev" >&6; } -if test "x$ac_cv_member_struct_stat_st_rdev" = x""yes; then +{ echo "$as_me:$LINENO: result: $ac_cv_member_struct_stat_st_rdev" >&5 +echo "${ECHO_T}$ac_cv_member_struct_stat_st_rdev" >&6; } +if test $ac_cv_member_struct_stat_st_rdev = yes; then cat >>confdefs.h <<_ACEOF #define HAVE_STRUCT_STAT_ST_RDEV 1 @@ -20507,10 +20012,10 @@ fi -{ $as_echo "$as_me:$LINENO: checking for struct stat.st_blksize" >&5 -$as_echo_n "checking for struct stat.st_blksize... " >&6; } +{ echo "$as_me:$LINENO: checking for struct stat.st_blksize" >&5 +echo $ECHO_N "checking for struct stat.st_blksize... $ECHO_C" >&6; } if test "${ac_cv_member_struct_stat_st_blksize+set}" = set; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ @@ -20535,21 +20040,20 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_member_struct_stat_st_blksize=yes else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 cat >conftest.$ac_ext <<_ACEOF @@ -20575,21 +20079,20 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_member_struct_stat_st_blksize=yes else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_member_struct_stat_st_blksize=no @@ -20600,9 +20103,9 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_member_struct_stat_st_blksize" >&5 -$as_echo "$ac_cv_member_struct_stat_st_blksize" >&6; } -if test "x$ac_cv_member_struct_stat_st_blksize" = x""yes; then +{ echo "$as_me:$LINENO: result: $ac_cv_member_struct_stat_st_blksize" >&5 +echo "${ECHO_T}$ac_cv_member_struct_stat_st_blksize" >&6; } +if test $ac_cv_member_struct_stat_st_blksize = yes; then cat >>confdefs.h <<_ACEOF #define HAVE_STRUCT_STAT_ST_BLKSIZE 1 @@ -20611,10 +20114,10 @@ fi -{ $as_echo "$as_me:$LINENO: checking for struct stat.st_flags" >&5 -$as_echo_n "checking for struct stat.st_flags... " >&6; } +{ echo "$as_me:$LINENO: checking for struct stat.st_flags" >&5 +echo $ECHO_N "checking for struct stat.st_flags... $ECHO_C" >&6; } if test "${ac_cv_member_struct_stat_st_flags+set}" = set; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ @@ -20639,21 +20142,20 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_member_struct_stat_st_flags=yes else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 cat >conftest.$ac_ext <<_ACEOF @@ -20679,21 +20181,20 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_member_struct_stat_st_flags=yes else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_member_struct_stat_st_flags=no @@ -20704,9 +20205,9 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_member_struct_stat_st_flags" >&5 -$as_echo "$ac_cv_member_struct_stat_st_flags" >&6; } -if test "x$ac_cv_member_struct_stat_st_flags" = x""yes; then +{ echo "$as_me:$LINENO: result: $ac_cv_member_struct_stat_st_flags" >&5 +echo "${ECHO_T}$ac_cv_member_struct_stat_st_flags" >&6; } +if test $ac_cv_member_struct_stat_st_flags = yes; then cat >>confdefs.h <<_ACEOF #define HAVE_STRUCT_STAT_ST_FLAGS 1 @@ -20715,10 +20216,10 @@ fi -{ $as_echo "$as_me:$LINENO: checking for struct stat.st_gen" >&5 -$as_echo_n "checking for struct stat.st_gen... " >&6; } +{ echo "$as_me:$LINENO: checking for struct stat.st_gen" >&5 +echo $ECHO_N "checking for struct stat.st_gen... $ECHO_C" >&6; } if test "${ac_cv_member_struct_stat_st_gen+set}" = set; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ @@ -20743,21 +20244,20 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_member_struct_stat_st_gen=yes else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 cat >conftest.$ac_ext <<_ACEOF @@ -20783,21 +20283,20 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_member_struct_stat_st_gen=yes else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_member_struct_stat_st_gen=no @@ -20808,9 +20307,9 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_member_struct_stat_st_gen" >&5 -$as_echo "$ac_cv_member_struct_stat_st_gen" >&6; } -if test "x$ac_cv_member_struct_stat_st_gen" = x""yes; then +{ echo "$as_me:$LINENO: result: $ac_cv_member_struct_stat_st_gen" >&5 +echo "${ECHO_T}$ac_cv_member_struct_stat_st_gen" >&6; } +if test $ac_cv_member_struct_stat_st_gen = yes; then cat >>confdefs.h <<_ACEOF #define HAVE_STRUCT_STAT_ST_GEN 1 @@ -20819,10 +20318,10 @@ fi -{ $as_echo "$as_me:$LINENO: checking for struct stat.st_birthtime" >&5 -$as_echo_n "checking for struct stat.st_birthtime... " >&6; } +{ echo "$as_me:$LINENO: checking for struct stat.st_birthtime" >&5 +echo $ECHO_N "checking for struct stat.st_birthtime... $ECHO_C" >&6; } if test "${ac_cv_member_struct_stat_st_birthtime+set}" = set; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ @@ -20847,21 +20346,20 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_member_struct_stat_st_birthtime=yes else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 cat >conftest.$ac_ext <<_ACEOF @@ -20887,21 +20385,20 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_member_struct_stat_st_birthtime=yes else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_member_struct_stat_st_birthtime=no @@ -20912,9 +20409,9 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_member_struct_stat_st_birthtime" >&5 -$as_echo "$ac_cv_member_struct_stat_st_birthtime" >&6; } -if test "x$ac_cv_member_struct_stat_st_birthtime" = x""yes; then +{ echo "$as_me:$LINENO: result: $ac_cv_member_struct_stat_st_birthtime" >&5 +echo "${ECHO_T}$ac_cv_member_struct_stat_st_birthtime" >&6; } +if test $ac_cv_member_struct_stat_st_birthtime = yes; then cat >>confdefs.h <<_ACEOF #define HAVE_STRUCT_STAT_ST_BIRTHTIME 1 @@ -20923,10 +20420,10 @@ fi -{ $as_echo "$as_me:$LINENO: checking for struct stat.st_blocks" >&5 -$as_echo_n "checking for struct stat.st_blocks... " >&6; } +{ echo "$as_me:$LINENO: checking for struct stat.st_blocks" >&5 +echo $ECHO_N "checking for struct stat.st_blocks... $ECHO_C" >&6; } if test "${ac_cv_member_struct_stat_st_blocks+set}" = set; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ @@ -20951,21 +20448,20 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_member_struct_stat_st_blocks=yes else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 cat >conftest.$ac_ext <<_ACEOF @@ -20991,21 +20487,20 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_member_struct_stat_st_blocks=yes else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_member_struct_stat_st_blocks=no @@ -21016,9 +20511,9 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_member_struct_stat_st_blocks" >&5 -$as_echo "$ac_cv_member_struct_stat_st_blocks" >&6; } -if test "x$ac_cv_member_struct_stat_st_blocks" = x""yes; then +{ echo "$as_me:$LINENO: result: $ac_cv_member_struct_stat_st_blocks" >&5 +echo "${ECHO_T}$ac_cv_member_struct_stat_st_blocks" >&6; } +if test $ac_cv_member_struct_stat_st_blocks = yes; then cat >>confdefs.h <<_ACEOF #define HAVE_STRUCT_STAT_ST_BLOCKS 1 @@ -21040,10 +20535,10 @@ -{ $as_echo "$as_me:$LINENO: checking for time.h that defines altzone" >&5 -$as_echo_n "checking for time.h that defines altzone... " >&6; } +{ echo "$as_me:$LINENO: checking for time.h that defines altzone" >&5 +echo $ECHO_N "checking for time.h that defines altzone... $ECHO_C" >&6; } if test "${ac_cv_header_time_altzone+set}" = set; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ @@ -21066,21 +20561,20 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_header_time_altzone=yes else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_header_time_altzone=no @@ -21089,8 +20583,8 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_time_altzone" >&5 -$as_echo "$ac_cv_header_time_altzone" >&6; } +{ echo "$as_me:$LINENO: result: $ac_cv_header_time_altzone" >&5 +echo "${ECHO_T}$ac_cv_header_time_altzone" >&6; } if test $ac_cv_header_time_altzone = yes; then cat >>confdefs.h <<\_ACEOF @@ -21100,8 +20594,8 @@ fi was_it_defined=no -{ $as_echo "$as_me:$LINENO: checking whether sys/select.h and sys/time.h may both be included" >&5 -$as_echo_n "checking whether sys/select.h and sys/time.h may both be included... " >&6; } +{ echo "$as_me:$LINENO: checking whether sys/select.h and sys/time.h may both be included" >&5 +echo $ECHO_N "checking whether sys/select.h and sys/time.h may both be included... $ECHO_C" >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF @@ -21127,14 +20621,13 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err @@ -21148,20 +20641,20 @@ was_it_defined=yes else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -{ $as_echo "$as_me:$LINENO: result: $was_it_defined" >&5 -$as_echo "$was_it_defined" >&6; } +{ echo "$as_me:$LINENO: result: $was_it_defined" >&5 +echo "${ECHO_T}$was_it_defined" >&6; } -{ $as_echo "$as_me:$LINENO: checking for addrinfo" >&5 -$as_echo_n "checking for addrinfo... " >&6; } +{ echo "$as_me:$LINENO: checking for addrinfo" >&5 +echo $ECHO_N "checking for addrinfo... $ECHO_C" >&6; } if test "${ac_cv_struct_addrinfo+set}" = set; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ @@ -21185,21 +20678,20 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_struct_addrinfo=yes else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_struct_addrinfo=no @@ -21208,8 +20700,8 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_struct_addrinfo" >&5 -$as_echo "$ac_cv_struct_addrinfo" >&6; } +{ echo "$as_me:$LINENO: result: $ac_cv_struct_addrinfo" >&5 +echo "${ECHO_T}$ac_cv_struct_addrinfo" >&6; } if test $ac_cv_struct_addrinfo = yes; then cat >>confdefs.h <<\_ACEOF @@ -21218,10 +20710,10 @@ fi -{ $as_echo "$as_me:$LINENO: checking for sockaddr_storage" >&5 -$as_echo_n "checking for sockaddr_storage... " >&6; } +{ echo "$as_me:$LINENO: checking for sockaddr_storage" >&5 +echo $ECHO_N "checking for sockaddr_storage... $ECHO_C" >&6; } if test "${ac_cv_struct_sockaddr_storage+set}" = set; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ @@ -21246,21 +20738,20 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_struct_sockaddr_storage=yes else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_struct_sockaddr_storage=no @@ -21269,8 +20760,8 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_struct_sockaddr_storage" >&5 -$as_echo "$ac_cv_struct_sockaddr_storage" >&6; } +{ echo "$as_me:$LINENO: result: $ac_cv_struct_sockaddr_storage" >&5 +echo "${ECHO_T}$ac_cv_struct_sockaddr_storage" >&6; } if test $ac_cv_struct_sockaddr_storage = yes; then cat >>confdefs.h <<\_ACEOF @@ -21282,10 +20773,10 @@ # checks for compiler characteristics -{ $as_echo "$as_me:$LINENO: checking whether char is unsigned" >&5 -$as_echo_n "checking whether char is unsigned... " >&6; } +{ echo "$as_me:$LINENO: checking whether char is unsigned" >&5 +echo $ECHO_N "checking whether char is unsigned... $ECHO_C" >&6; } if test "${ac_cv_c_char_unsigned+set}" = set; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ @@ -21310,21 +20801,20 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_c_char_unsigned=no else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_c_char_unsigned=yes @@ -21332,8 +20822,8 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_c_char_unsigned" >&5 -$as_echo "$ac_cv_c_char_unsigned" >&6; } +{ echo "$as_me:$LINENO: result: $ac_cv_c_char_unsigned" >&5 +echo "${ECHO_T}$ac_cv_c_char_unsigned" >&6; } if test $ac_cv_c_char_unsigned = yes && test "$GCC" != yes; then cat >>confdefs.h <<\_ACEOF #define __CHAR_UNSIGNED__ 1 @@ -21341,10 +20831,10 @@ fi -{ $as_echo "$as_me:$LINENO: checking for an ANSI C-conforming const" >&5 -$as_echo_n "checking for an ANSI C-conforming const... " >&6; } +{ echo "$as_me:$LINENO: checking for an ANSI C-conforming const" >&5 +echo $ECHO_N "checking for an ANSI C-conforming const... $ECHO_C" >&6; } if test "${ac_cv_c_const+set}" = set; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ @@ -21416,21 +20906,20 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_c_const=yes else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_c_const=no @@ -21438,20 +20927,20 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_c_const" >&5 -$as_echo "$ac_cv_c_const" >&6; } +{ echo "$as_me:$LINENO: result: $ac_cv_c_const" >&5 +echo "${ECHO_T}$ac_cv_c_const" >&6; } if test $ac_cv_c_const = no; then cat >>confdefs.h <<\_ACEOF -#define const /**/ +#define const _ACEOF fi works=no -{ $as_echo "$as_me:$LINENO: checking for working volatile" >&5 -$as_echo_n "checking for working volatile... " >&6; } +{ echo "$as_me:$LINENO: checking for working volatile" >&5 +echo $ECHO_N "checking for working volatile... $ECHO_C" >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF @@ -21473,38 +20962,37 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then works=yes else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 cat >>confdefs.h <<\_ACEOF -#define volatile /**/ +#define volatile _ACEOF fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -{ $as_echo "$as_me:$LINENO: result: $works" >&5 -$as_echo "$works" >&6; } +{ echo "$as_me:$LINENO: result: $works" >&5 +echo "${ECHO_T}$works" >&6; } works=no -{ $as_echo "$as_me:$LINENO: checking for working signed char" >&5 -$as_echo_n "checking for working signed char... " >&6; } +{ echo "$as_me:$LINENO: checking for working signed char" >&5 +echo $ECHO_N "checking for working signed char... $ECHO_C" >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF @@ -21526,38 +21014,37 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then works=yes else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 cat >>confdefs.h <<\_ACEOF -#define signed /**/ +#define signed _ACEOF fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -{ $as_echo "$as_me:$LINENO: result: $works" >&5 -$as_echo "$works" >&6; } +{ echo "$as_me:$LINENO: result: $works" >&5 +echo "${ECHO_T}$works" >&6; } have_prototypes=no -{ $as_echo "$as_me:$LINENO: checking for prototypes" >&5 -$as_echo_n "checking for prototypes... " >&6; } +{ echo "$as_me:$LINENO: checking for prototypes" >&5 +echo $ECHO_N "checking for prototypes... $ECHO_C" >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF @@ -21579,14 +21066,13 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err @@ -21600,19 +21086,19 @@ have_prototypes=yes else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -{ $as_echo "$as_me:$LINENO: result: $have_prototypes" >&5 -$as_echo "$have_prototypes" >&6; } +{ echo "$as_me:$LINENO: result: $have_prototypes" >&5 +echo "${ECHO_T}$have_prototypes" >&6; } works=no -{ $as_echo "$as_me:$LINENO: checking for variable length prototypes and stdarg.h" >&5 -$as_echo_n "checking for variable length prototypes and stdarg.h... " >&6; } +{ echo "$as_me:$LINENO: checking for variable length prototypes and stdarg.h" >&5 +echo $ECHO_N "checking for variable length prototypes and stdarg.h... $ECHO_C" >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF @@ -21644,14 +21130,13 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err @@ -21665,19 +21150,19 @@ works=yes else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -{ $as_echo "$as_me:$LINENO: result: $works" >&5 -$as_echo "$works" >&6; } +{ echo "$as_me:$LINENO: result: $works" >&5 +echo "${ECHO_T}$works" >&6; } # check for socketpair -{ $as_echo "$as_me:$LINENO: checking for socketpair" >&5 -$as_echo_n "checking for socketpair... " >&6; } +{ echo "$as_me:$LINENO: checking for socketpair" >&5 +echo $ECHO_N "checking for socketpair... $ECHO_C" >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF @@ -21702,14 +21187,13 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err @@ -21719,22 +21203,22 @@ #define HAVE_SOCKETPAIR 1 _ACEOF - { $as_echo "$as_me:$LINENO: result: yes" >&5 -$as_echo "yes" >&6; } + { echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; } else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 - { $as_echo "$as_me:$LINENO: result: no" >&5 -$as_echo "no" >&6; } + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext # check if sockaddr has sa_len member -{ $as_echo "$as_me:$LINENO: checking if sockaddr has sa_len member" >&5 -$as_echo_n "checking if sockaddr has sa_len member... " >&6; } +{ echo "$as_me:$LINENO: checking if sockaddr has sa_len member" >&5 +echo $ECHO_N "checking if sockaddr has sa_len member... $ECHO_C" >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF @@ -21758,38 +21242,37 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then - { $as_echo "$as_me:$LINENO: result: yes" >&5 -$as_echo "yes" >&6; } + { echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; } cat >>confdefs.h <<\_ACEOF #define HAVE_SOCKADDR_SA_LEN 1 _ACEOF else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 - { $as_echo "$as_me:$LINENO: result: no" >&5 -$as_echo "no" >&6; } + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext va_list_is_array=no -{ $as_echo "$as_me:$LINENO: checking whether va_list is an array" >&5 -$as_echo_n "checking whether va_list is an array... " >&6; } +{ echo "$as_me:$LINENO: checking whether va_list is an array" >&5 +echo $ECHO_N "checking whether va_list is an array... $ECHO_C" >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF @@ -21817,21 +21300,20 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then : else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 @@ -21845,17 +21327,17 @@ fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -{ $as_echo "$as_me:$LINENO: result: $va_list_is_array" >&5 -$as_echo "$va_list_is_array" >&6; } +{ echo "$as_me:$LINENO: result: $va_list_is_array" >&5 +echo "${ECHO_T}$va_list_is_array" >&6; } # sigh -- gethostbyname_r is a mess; it can have 3, 5 or 6 arguments :-( -{ $as_echo "$as_me:$LINENO: checking for gethostbyname_r" >&5 -$as_echo_n "checking for gethostbyname_r... " >&6; } +{ echo "$as_me:$LINENO: checking for gethostbyname_r" >&5 +echo $ECHO_N "checking for gethostbyname_r... $ECHO_C" >&6; } if test "${ac_cv_func_gethostbyname_r+set}" = set; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ @@ -21908,43 +21390,39 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err - } && test -s conftest$ac_exeext && { - test "$cross_compiling" = yes || - $as_test_x conftest$ac_exeext - }; then + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then ac_cv_func_gethostbyname_r=yes else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_func_gethostbyname_r=no fi -rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_func_gethostbyname_r" >&5 -$as_echo "$ac_cv_func_gethostbyname_r" >&6; } -if test "x$ac_cv_func_gethostbyname_r" = x""yes; then +{ echo "$as_me:$LINENO: result: $ac_cv_func_gethostbyname_r" >&5 +echo "${ECHO_T}$ac_cv_func_gethostbyname_r" >&6; } +if test $ac_cv_func_gethostbyname_r = yes; then cat >>confdefs.h <<\_ACEOF #define HAVE_GETHOSTBYNAME_R 1 _ACEOF - { $as_echo "$as_me:$LINENO: checking gethostbyname_r with 6 args" >&5 -$as_echo_n "checking gethostbyname_r with 6 args... " >&6; } + { echo "$as_me:$LINENO: checking gethostbyname_r with 6 args" >&5 +echo $ECHO_N "checking gethostbyname_r with 6 args... $ECHO_C" >&6; } OLD_CFLAGS=$CFLAGS CFLAGS="$CFLAGS $MY_CPPFLAGS $MY_THREAD_CPPFLAGS $MY_CFLAGS" cat >conftest.$ac_ext <<_ACEOF @@ -21978,14 +21456,13 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err @@ -22000,18 +21477,18 @@ #define HAVE_GETHOSTBYNAME_R_6_ARG 1 _ACEOF - { $as_echo "$as_me:$LINENO: result: yes" >&5 -$as_echo "yes" >&6; } + { echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; } else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 - { $as_echo "$as_me:$LINENO: result: no" >&5 -$as_echo "no" >&6; } - { $as_echo "$as_me:$LINENO: checking gethostbyname_r with 5 args" >&5 -$as_echo_n "checking gethostbyname_r with 5 args... " >&6; } + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } + { echo "$as_me:$LINENO: checking gethostbyname_r with 5 args" >&5 +echo $ECHO_N "checking gethostbyname_r with 5 args... $ECHO_C" >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF @@ -22043,14 +21520,13 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err @@ -22065,18 +21541,18 @@ #define HAVE_GETHOSTBYNAME_R_5_ARG 1 _ACEOF - { $as_echo "$as_me:$LINENO: result: yes" >&5 -$as_echo "yes" >&6; } + { echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; } else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 - { $as_echo "$as_me:$LINENO: result: no" >&5 -$as_echo "no" >&6; } - { $as_echo "$as_me:$LINENO: checking gethostbyname_r with 3 args" >&5 -$as_echo_n "checking gethostbyname_r with 3 args... " >&6; } + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } + { echo "$as_me:$LINENO: checking gethostbyname_r with 3 args" >&5 +echo $ECHO_N "checking gethostbyname_r with 3 args... $ECHO_C" >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF @@ -22106,14 +21582,13 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err @@ -22128,16 +21603,16 @@ #define HAVE_GETHOSTBYNAME_R_3_ARG 1 _ACEOF - { $as_echo "$as_me:$LINENO: result: yes" >&5 -$as_echo "yes" >&6; } + { echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; } else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 - { $as_echo "$as_me:$LINENO: result: no" >&5 -$as_echo "no" >&6; } + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } fi @@ -22157,11 +21632,11 @@ for ac_func in gethostbyname do -as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` -{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5 -$as_echo_n "checking for $ac_func... " >&6; } +as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` +{ echo "$as_me:$LINENO: checking for $ac_func" >&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6; } if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ @@ -22214,42 +21689,35 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err - } && test -s conftest$ac_exeext && { - test "$cross_compiling" = yes || - $as_test_x conftest$ac_exeext - }; then + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then eval "$as_ac_var=yes" else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 eval "$as_ac_var=no" fi -rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext fi -ac_res=`eval 'as_val=${'$as_ac_var'} - $as_echo "$as_val"'` - { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } -as_val=`eval 'as_val=${'$as_ac_var'} - $as_echo "$as_val"'` - if test "x$as_val" = x""yes; then +ac_res=`eval echo '${'$as_ac_var'}'` + { echo "$as_me:$LINENO: result: $ac_res" >&5 +echo "${ECHO_T}$ac_res" >&6; } +if test `eval echo '${'$as_ac_var'}'` = yes; then cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 +#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF fi @@ -22268,10 +21736,10 @@ # (none yet) # Linux requires this for correct f.p. operations -{ $as_echo "$as_me:$LINENO: checking for __fpu_control" >&5 -$as_echo_n "checking for __fpu_control... " >&6; } +{ echo "$as_me:$LINENO: checking for __fpu_control" >&5 +echo $ECHO_N "checking for __fpu_control... $ECHO_C" >&6; } if test "${ac_cv_func___fpu_control+set}" = set; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ @@ -22324,43 +21792,39 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err - } && test -s conftest$ac_exeext && { - test "$cross_compiling" = yes || - $as_test_x conftest$ac_exeext - }; then + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then ac_cv_func___fpu_control=yes else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_func___fpu_control=no fi -rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_func___fpu_control" >&5 -$as_echo "$ac_cv_func___fpu_control" >&6; } -if test "x$ac_cv_func___fpu_control" = x""yes; then +{ echo "$as_me:$LINENO: result: $ac_cv_func___fpu_control" >&5 +echo "${ECHO_T}$ac_cv_func___fpu_control" >&6; } +if test $ac_cv_func___fpu_control = yes; then : else -{ $as_echo "$as_me:$LINENO: checking for __fpu_control in -lieee" >&5 -$as_echo_n "checking for __fpu_control in -lieee... " >&6; } +{ echo "$as_me:$LINENO: checking for __fpu_control in -lieee" >&5 +echo $ECHO_N "checking for __fpu_control in -lieee... $ECHO_C" >&6; } if test "${ac_cv_lib_ieee___fpu_control+set}" = set; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lieee $LIBS" @@ -22392,37 +21856,33 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err - } && test -s conftest$ac_exeext && { - test "$cross_compiling" = yes || - $as_test_x conftest$ac_exeext - }; then + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then ac_cv_lib_ieee___fpu_control=yes else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_ieee___fpu_control=no fi -rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_ieee___fpu_control" >&5 -$as_echo "$ac_cv_lib_ieee___fpu_control" >&6; } -if test "x$ac_cv_lib_ieee___fpu_control" = x""yes; then +{ echo "$as_me:$LINENO: result: $ac_cv_lib_ieee___fpu_control" >&5 +echo "${ECHO_T}$ac_cv_lib_ieee___fpu_control" >&6; } +if test $ac_cv_lib_ieee___fpu_control = yes; then cat >>confdefs.h <<_ACEOF #define HAVE_LIBIEEE 1 _ACEOF @@ -22436,8 +21896,8 @@ # Check for --with-fpectl -{ $as_echo "$as_me:$LINENO: checking for --with-fpectl" >&5 -$as_echo_n "checking for --with-fpectl... " >&6; } +{ echo "$as_me:$LINENO: checking for --with-fpectl" >&5 +echo $ECHO_N "checking for --with-fpectl... $ECHO_C" >&6; } # Check whether --with-fpectl was given. if test "${with_fpectl+set}" = set; then @@ -22449,14 +21909,14 @@ #define WANT_SIGFPE_HANDLER 1 _ACEOF - { $as_echo "$as_me:$LINENO: result: yes" >&5 -$as_echo "yes" >&6; } -else { $as_echo "$as_me:$LINENO: result: no" >&5 -$as_echo "no" >&6; } + { echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; } +else { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } fi else - { $as_echo "$as_me:$LINENO: result: no" >&5 -$as_echo "no" >&6; } + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } fi @@ -22467,53 +21927,53 @@ BeOS) ;; *) LIBM=-lm esac -{ $as_echo "$as_me:$LINENO: checking for --with-libm=STRING" >&5 -$as_echo_n "checking for --with-libm=STRING... " >&6; } +{ echo "$as_me:$LINENO: checking for --with-libm=STRING" >&5 +echo $ECHO_N "checking for --with-libm=STRING... $ECHO_C" >&6; } # Check whether --with-libm was given. if test "${with_libm+set}" = set; then withval=$with_libm; if test "$withval" = no then LIBM= - { $as_echo "$as_me:$LINENO: result: force LIBM empty" >&5 -$as_echo "force LIBM empty" >&6; } + { echo "$as_me:$LINENO: result: force LIBM empty" >&5 +echo "${ECHO_T}force LIBM empty" >&6; } elif test "$withval" != yes then LIBM=$withval - { $as_echo "$as_me:$LINENO: result: set LIBM=\"$withval\"" >&5 -$as_echo "set LIBM=\"$withval\"" >&6; } -else { { $as_echo "$as_me:$LINENO: error: proper usage is --with-libm=STRING" >&5 -$as_echo "$as_me: error: proper usage is --with-libm=STRING" >&2;} + { echo "$as_me:$LINENO: result: set LIBM=\"$withval\"" >&5 +echo "${ECHO_T}set LIBM=\"$withval\"" >&6; } +else { { echo "$as_me:$LINENO: error: proper usage is --with-libm=STRING" >&5 +echo "$as_me: error: proper usage is --with-libm=STRING" >&2;} { (exit 1); exit 1; }; } fi else - { $as_echo "$as_me:$LINENO: result: default LIBM=\"$LIBM\"" >&5 -$as_echo "default LIBM=\"$LIBM\"" >&6; } + { echo "$as_me:$LINENO: result: default LIBM=\"$LIBM\"" >&5 +echo "${ECHO_T}default LIBM=\"$LIBM\"" >&6; } fi # check for --with-libc=... -{ $as_echo "$as_me:$LINENO: checking for --with-libc=STRING" >&5 -$as_echo_n "checking for --with-libc=STRING... " >&6; } +{ echo "$as_me:$LINENO: checking for --with-libc=STRING" >&5 +echo $ECHO_N "checking for --with-libc=STRING... $ECHO_C" >&6; } # Check whether --with-libc was given. if test "${with_libc+set}" = set; then withval=$with_libc; if test "$withval" = no then LIBC= - { $as_echo "$as_me:$LINENO: result: force LIBC empty" >&5 -$as_echo "force LIBC empty" >&6; } + { echo "$as_me:$LINENO: result: force LIBC empty" >&5 +echo "${ECHO_T}force LIBC empty" >&6; } elif test "$withval" != yes then LIBC=$withval - { $as_echo "$as_me:$LINENO: result: set LIBC=\"$withval\"" >&5 -$as_echo "set LIBC=\"$withval\"" >&6; } -else { { $as_echo "$as_me:$LINENO: error: proper usage is --with-libc=STRING" >&5 -$as_echo "$as_me: error: proper usage is --with-libc=STRING" >&2;} + { echo "$as_me:$LINENO: result: set LIBC=\"$withval\"" >&5 +echo "${ECHO_T}set LIBC=\"$withval\"" >&6; } +else { { echo "$as_me:$LINENO: error: proper usage is --with-libc=STRING" >&5 +echo "$as_me: error: proper usage is --with-libc=STRING" >&2;} { (exit 1); exit 1; }; } fi else - { $as_echo "$as_me:$LINENO: result: default LIBC=\"$LIBC\"" >&5 -$as_echo "default LIBC=\"$LIBC\"" >&6; } + { echo "$as_me:$LINENO: result: default LIBC=\"$LIBC\"" >&5 +echo "${ECHO_T}default LIBC=\"$LIBC\"" >&6; } fi @@ -22529,10 +21989,10 @@ # IEEE 754 platforms. On IEEE 754, test should return 1 if rounding # mode is round-to-nearest and double rounding issues are present, and # 0 otherwise. See http://bugs.python.org/issue2937 for more info. -{ $as_echo "$as_me:$LINENO: checking for x87-style double rounding" >&5 -$as_echo_n "checking for x87-style double rounding... " >&6; } +{ echo "$as_me:$LINENO: checking for x87-style double rounding" >&5 +echo $ECHO_N "checking for x87-style double rounding... $ECHO_C" >&6; } if test "${ac_cv_x87_double_rounding+set}" = set; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else if test "$cross_compiling" = yes; then @@ -22571,40 +22031,37 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>&5 ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_try") 2>&5 ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_x87_double_rounding=no else - $as_echo "$as_me: program exited with status $ac_status" >&5 -$as_echo "$as_me: failed program was:" >&5 + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) ac_cv_x87_double_rounding=yes fi -rm -rf conftest.dSYM rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_x87_double_rounding" >&5 -$as_echo "$ac_cv_x87_double_rounding" >&6; } +{ echo "$as_me:$LINENO: result: $ac_cv_x87_double_rounding" >&5 +echo "${ECHO_T}$ac_cv_x87_double_rounding" >&6; } if test "$ac_cv_x87_double_rounding" = yes then @@ -22615,16 +22072,14 @@ fi # Multiprocessing check for broken sem_getvalue -{ $as_echo "$as_me:$LINENO: checking for broken sem_getvalue" >&5 -$as_echo_n "checking for broken sem_getvalue... " >&6; } +{ echo "$as_me:$LINENO: checking for broken sem_getvalue" >&5 +echo $ECHO_N "checking for broken sem_getvalue... $ECHO_C" >&6; } if test "$cross_compiling" = yes; then - { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -{ { $as_echo "$as_me:$LINENO: error: cannot run test program while cross compiling + { { echo "$as_me:$LINENO: error: cannot run test program while cross compiling See \`config.log' for more details." >&5 -$as_echo "$as_me: error: cannot run test program while cross compiling +echo "$as_me: error: cannot run test program while cross compiling See \`config.log' for more details." >&2;} - { (exit 1); exit 1; }; }; } + { (exit 1); exit 1; }; } else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ @@ -22661,32 +22116,30 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>&5 ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_try") 2>&5 ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - { $as_echo "$as_me:$LINENO: result: no" >&5 -$as_echo "no" >&6; } + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } else - $as_echo "$as_me: program exited with status $ac_status" >&5 -$as_echo "$as_me: failed program was:" >&5 + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) -{ $as_echo "$as_me:$LINENO: result: yes" >&5 -$as_echo "yes" >&6; } +{ echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; } cat >>confdefs.h <<\_ACEOF #define HAVE_BROKEN_SEM_GETVALUE 1 @@ -22694,7 +22147,6 @@ fi -rm -rf conftest.dSYM rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi @@ -22702,10 +22154,10 @@ # On FreeBSD 6.2, it appears that tanh(-0.) returns 0. instead of # -0. on some architectures. -{ $as_echo "$as_me:$LINENO: checking whether tanh preserves the sign of zero" >&5 -$as_echo_n "checking whether tanh preserves the sign of zero... " >&6; } +{ echo "$as_me:$LINENO: checking whether tanh preserves the sign of zero" >&5 +echo $ECHO_N "checking whether tanh preserves the sign of zero... $ECHO_C" >&6; } if test "${ac_cv_tanh_preserves_zero_sign+set}" = set; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else if test "$cross_compiling" = yes; then @@ -22736,40 +22188,37 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>&5 ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_try") 2>&5 ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_tanh_preserves_zero_sign=yes else - $as_echo "$as_me: program exited with status $ac_status" >&5 -$as_echo "$as_me: failed program was:" >&5 + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) ac_cv_tanh_preserves_zero_sign=no fi -rm -rf conftest.dSYM rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_tanh_preserves_zero_sign" >&5 -$as_echo "$ac_cv_tanh_preserves_zero_sign" >&6; } +{ echo "$as_me:$LINENO: result: $ac_cv_tanh_preserves_zero_sign" >&5 +echo "${ECHO_T}$ac_cv_tanh_preserves_zero_sign" >&6; } if test "$ac_cv_tanh_preserves_zero_sign" = yes then @@ -22790,11 +22239,11 @@ for ac_func in acosh asinh atanh copysign expm1 finite hypot log1p round do -as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` -{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5 -$as_echo_n "checking for $ac_func... " >&6; } +as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` +{ echo "$as_me:$LINENO: checking for $ac_func" >&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6; } if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ @@ -22847,51 +22296,44 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err - } && test -s conftest$ac_exeext && { - test "$cross_compiling" = yes || - $as_test_x conftest$ac_exeext - }; then + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then eval "$as_ac_var=yes" else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 eval "$as_ac_var=no" fi -rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext fi -ac_res=`eval 'as_val=${'$as_ac_var'} - $as_echo "$as_val"'` - { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } -as_val=`eval 'as_val=${'$as_ac_var'} - $as_echo "$as_val"'` - if test "x$as_val" = x""yes; then +ac_res=`eval echo '${'$as_ac_var'}'` + { echo "$as_me:$LINENO: result: $ac_res" >&5 +echo "${ECHO_T}$ac_res" >&6; } +if test `eval echo '${'$as_ac_var'}'` = yes; then cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 +#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF fi done -{ $as_echo "$as_me:$LINENO: checking whether isinf is declared" >&5 -$as_echo_n "checking whether isinf is declared... " >&6; } +{ echo "$as_me:$LINENO: checking whether isinf is declared" >&5 +echo $ECHO_N "checking whether isinf is declared... $ECHO_C" >&6; } if test "${ac_cv_have_decl_isinf+set}" = set; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ @@ -22918,21 +22360,20 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_have_decl_isinf=yes else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_have_decl_isinf=no @@ -22940,9 +22381,9 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_have_decl_isinf" >&5 -$as_echo "$ac_cv_have_decl_isinf" >&6; } -if test "x$ac_cv_have_decl_isinf" = x""yes; then +{ echo "$as_me:$LINENO: result: $ac_cv_have_decl_isinf" >&5 +echo "${ECHO_T}$ac_cv_have_decl_isinf" >&6; } +if test $ac_cv_have_decl_isinf = yes; then cat >>confdefs.h <<_ACEOF #define HAVE_DECL_ISINF 1 @@ -22956,10 +22397,10 @@ fi -{ $as_echo "$as_me:$LINENO: checking whether isnan is declared" >&5 -$as_echo_n "checking whether isnan is declared... " >&6; } +{ echo "$as_me:$LINENO: checking whether isnan is declared" >&5 +echo $ECHO_N "checking whether isnan is declared... $ECHO_C" >&6; } if test "${ac_cv_have_decl_isnan+set}" = set; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ @@ -22986,21 +22427,20 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_have_decl_isnan=yes else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_have_decl_isnan=no @@ -23008,9 +22448,9 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_have_decl_isnan" >&5 -$as_echo "$ac_cv_have_decl_isnan" >&6; } -if test "x$ac_cv_have_decl_isnan" = x""yes; then +{ echo "$as_me:$LINENO: result: $ac_cv_have_decl_isnan" >&5 +echo "${ECHO_T}$ac_cv_have_decl_isnan" >&6; } +if test $ac_cv_have_decl_isnan = yes; then cat >>confdefs.h <<_ACEOF #define HAVE_DECL_ISNAN 1 @@ -23024,10 +22464,10 @@ fi -{ $as_echo "$as_me:$LINENO: checking whether isfinite is declared" >&5 -$as_echo_n "checking whether isfinite is declared... " >&6; } +{ echo "$as_me:$LINENO: checking whether isfinite is declared" >&5 +echo $ECHO_N "checking whether isfinite is declared... $ECHO_C" >&6; } if test "${ac_cv_have_decl_isfinite+set}" = set; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ @@ -23054,21 +22494,20 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_have_decl_isfinite=yes else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_have_decl_isfinite=no @@ -23076,9 +22515,9 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_have_decl_isfinite" >&5 -$as_echo "$ac_cv_have_decl_isfinite" >&6; } -if test "x$ac_cv_have_decl_isfinite" = x""yes; then +{ echo "$as_me:$LINENO: result: $ac_cv_have_decl_isfinite" >&5 +echo "${ECHO_T}$ac_cv_have_decl_isfinite" >&6; } +if test $ac_cv_have_decl_isfinite = yes; then cat >>confdefs.h <<_ACEOF #define HAVE_DECL_ISFINITE 1 @@ -23098,8 +22537,8 @@ LIBS=$LIBS_SAVE # determine what size digit to use for Python's longs -{ $as_echo "$as_me:$LINENO: checking digit size for Python's longs" >&5 -$as_echo_n "checking digit size for Python's longs... " >&6; } +{ echo "$as_me:$LINENO: checking digit size for Python's longs" >&5 +echo $ECHO_N "checking digit size for Python's longs... $ECHO_C" >&6; } # Check whether --enable-big-digits was given. if test "${enable_big_digits+set}" = set; then enableval=$enable_big_digits; case $enable_big_digits in @@ -23110,12 +22549,12 @@ 15|30) ;; *) - { { $as_echo "$as_me:$LINENO: error: bad value $enable_big_digits for --enable-big-digits; value should be 15 or 30" >&5 -$as_echo "$as_me: error: bad value $enable_big_digits for --enable-big-digits; value should be 15 or 30" >&2;} + { { echo "$as_me:$LINENO: error: bad value $enable_big_digits for --enable-big-digits; value should be 15 or 30" >&5 +echo "$as_me: error: bad value $enable_big_digits for --enable-big-digits; value should be 15 or 30" >&2;} { (exit 1); exit 1; }; } ;; esac -{ $as_echo "$as_me:$LINENO: result: $enable_big_digits" >&5 -$as_echo "$enable_big_digits" >&6; } +{ echo "$as_me:$LINENO: result: $enable_big_digits" >&5 +echo "${ECHO_T}$enable_big_digits" >&6; } cat >>confdefs.h <<_ACEOF #define PYLONG_BITS_IN_DIGIT $enable_big_digits @@ -23123,24 +22562,24 @@ else - { $as_echo "$as_me:$LINENO: result: no value specified" >&5 -$as_echo "no value specified" >&6; } + { echo "$as_me:$LINENO: result: no value specified" >&5 +echo "${ECHO_T}no value specified" >&6; } fi # check for wchar.h if test "${ac_cv_header_wchar_h+set}" = set; then - { $as_echo "$as_me:$LINENO: checking for wchar.h" >&5 -$as_echo_n "checking for wchar.h... " >&6; } + { echo "$as_me:$LINENO: checking for wchar.h" >&5 +echo $ECHO_N "checking for wchar.h... $ECHO_C" >&6; } if test "${ac_cv_header_wchar_h+set}" = set; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_wchar_h" >&5 -$as_echo "$ac_cv_header_wchar_h" >&6; } +{ echo "$as_me:$LINENO: result: $ac_cv_header_wchar_h" >&5 +echo "${ECHO_T}$ac_cv_header_wchar_h" >&6; } else # Is the header compilable? -{ $as_echo "$as_me:$LINENO: checking wchar.h usability" >&5 -$as_echo_n "checking wchar.h usability... " >&6; } +{ echo "$as_me:$LINENO: checking wchar.h usability" >&5 +echo $ECHO_N "checking wchar.h usability... $ECHO_C" >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF @@ -23156,33 +22595,32 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_header_compiler=yes else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_compiler=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 -$as_echo "$ac_header_compiler" >&6; } +{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6; } # Is the header present? -{ $as_echo "$as_me:$LINENO: checking wchar.h presence" >&5 -$as_echo_n "checking wchar.h presence... " >&6; } +{ echo "$as_me:$LINENO: checking wchar.h presence" >&5 +echo $ECHO_N "checking wchar.h presence... $ECHO_C" >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF @@ -23196,52 +22634,51 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then ac_header_preproc=yes else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_preproc=no fi rm -f conftest.err conftest.$ac_ext -{ $as_echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 -$as_echo "$ac_header_preproc" >&6; } +{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6; } # So? What about this header? case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in yes:no: ) - { $as_echo "$as_me:$LINENO: WARNING: wchar.h: accepted by the compiler, rejected by the preprocessor!" >&5 -$as_echo "$as_me: WARNING: wchar.h: accepted by the compiler, rejected by the preprocessor!" >&2;} - { $as_echo "$as_me:$LINENO: WARNING: wchar.h: proceeding with the compiler's result" >&5 -$as_echo "$as_me: WARNING: wchar.h: proceeding with the compiler's result" >&2;} + { echo "$as_me:$LINENO: WARNING: wchar.h: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: wchar.h: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: wchar.h: proceeding with the compiler's result" >&5 +echo "$as_me: WARNING: wchar.h: proceeding with the compiler's result" >&2;} ac_header_preproc=yes ;; no:yes:* ) - { $as_echo "$as_me:$LINENO: WARNING: wchar.h: present but cannot be compiled" >&5 -$as_echo "$as_me: WARNING: wchar.h: present but cannot be compiled" >&2;} - { $as_echo "$as_me:$LINENO: WARNING: wchar.h: check for missing prerequisite headers?" >&5 -$as_echo "$as_me: WARNING: wchar.h: check for missing prerequisite headers?" >&2;} - { $as_echo "$as_me:$LINENO: WARNING: wchar.h: see the Autoconf documentation" >&5 -$as_echo "$as_me: WARNING: wchar.h: see the Autoconf documentation" >&2;} - { $as_echo "$as_me:$LINENO: WARNING: wchar.h: section \"Present But Cannot Be Compiled\"" >&5 -$as_echo "$as_me: WARNING: wchar.h: section \"Present But Cannot Be Compiled\"" >&2;} - { $as_echo "$as_me:$LINENO: WARNING: wchar.h: proceeding with the preprocessor's result" >&5 -$as_echo "$as_me: WARNING: wchar.h: proceeding with the preprocessor's result" >&2;} - { $as_echo "$as_me:$LINENO: WARNING: wchar.h: in the future, the compiler will take precedence" >&5 -$as_echo "$as_me: WARNING: wchar.h: in the future, the compiler will take precedence" >&2;} + { echo "$as_me:$LINENO: WARNING: wchar.h: present but cannot be compiled" >&5 +echo "$as_me: WARNING: wchar.h: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: wchar.h: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: wchar.h: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: wchar.h: see the Autoconf documentation" >&5 +echo "$as_me: WARNING: wchar.h: see the Autoconf documentation" >&2;} + { echo "$as_me:$LINENO: WARNING: wchar.h: section \"Present But Cannot Be Compiled\"" >&5 +echo "$as_me: WARNING: wchar.h: section \"Present But Cannot Be Compiled\"" >&2;} + { echo "$as_me:$LINENO: WARNING: wchar.h: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: wchar.h: proceeding with the preprocessor's result" >&2;} + { echo "$as_me:$LINENO: WARNING: wchar.h: in the future, the compiler will take precedence" >&5 +echo "$as_me: WARNING: wchar.h: in the future, the compiler will take precedence" >&2;} ( cat <<\_ASBOX ## -------------------------------------- ## ## Report this to http://bugs.python.org/ ## @@ -23250,18 +22687,18 @@ ) | sed "s/^/$as_me: WARNING: /" >&2 ;; esac -{ $as_echo "$as_me:$LINENO: checking for wchar.h" >&5 -$as_echo_n "checking for wchar.h... " >&6; } +{ echo "$as_me:$LINENO: checking for wchar.h" >&5 +echo $ECHO_N "checking for wchar.h... $ECHO_C" >&6; } if test "${ac_cv_header_wchar_h+set}" = set; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_cv_header_wchar_h=$ac_header_preproc fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_wchar_h" >&5 -$as_echo "$ac_cv_header_wchar_h" >&6; } +{ echo "$as_me:$LINENO: result: $ac_cv_header_wchar_h" >&5 +echo "${ECHO_T}$ac_cv_header_wchar_h" >&6; } fi -if test "x$ac_cv_header_wchar_h" = x""yes; then +if test $ac_cv_header_wchar_h = yes; then cat >>confdefs.h <<\_ACEOF @@ -23280,14 +22717,69 @@ # determine wchar_t size if test "$wchar_h" = yes then - # The cast to long int works around a bug in the HP C Compiler + { echo "$as_me:$LINENO: checking for wchar_t" >&5 +echo $ECHO_N "checking for wchar_t... $ECHO_C" >&6; } +if test "${ac_cv_type_wchar_t+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include + +typedef wchar_t ac__type_new_; +int +main () +{ +if ((ac__type_new_ *) 0) + return 0; +if (sizeof (ac__type_new_)) + return 0; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_cv_type_wchar_t=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_type_wchar_t=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ echo "$as_me:$LINENO: result: $ac_cv_type_wchar_t" >&5 +echo "${ECHO_T}$ac_cv_type_wchar_t" >&6; } + +# The cast to long int works around a bug in the HP C Compiler # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. # This bug is HP SR number 8606223364. -{ $as_echo "$as_me:$LINENO: checking size of wchar_t" >&5 -$as_echo_n "checking size of wchar_t... " >&6; } +{ echo "$as_me:$LINENO: checking size of wchar_t" >&5 +echo $ECHO_N "checking size of wchar_t... $ECHO_C" >&6; } if test "${ac_cv_sizeof_wchar_t+set}" = set; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else if test "$cross_compiling" = yes; then # Depending upon the size, compute the lo and hi bounds. @@ -23299,10 +22791,11 @@ /* end confdefs.h. */ #include + typedef wchar_t ac__type_sizeof_; int main () { -static int test_array [1 - 2 * !(((long int) (sizeof (wchar_t))) >= 0)]; +static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) >= 0)]; test_array [0] = 0 ; @@ -23315,14 +22808,13 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err @@ -23337,10 +22829,11 @@ /* end confdefs.h. */ #include + typedef wchar_t ac__type_sizeof_; int main () { -static int test_array [1 - 2 * !(((long int) (sizeof (wchar_t))) <= $ac_mid)]; +static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) <= $ac_mid)]; test_array [0] = 0 ; @@ -23353,21 +22846,20 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_hi=$ac_mid; break else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo=`expr $ac_mid + 1` @@ -23381,7 +22873,7 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 cat >conftest.$ac_ext <<_ACEOF @@ -23392,10 +22884,11 @@ /* end confdefs.h. */ #include + typedef wchar_t ac__type_sizeof_; int main () { -static int test_array [1 - 2 * !(((long int) (sizeof (wchar_t))) < 0)]; +static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) < 0)]; test_array [0] = 0 ; @@ -23408,14 +22901,13 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err @@ -23430,10 +22922,11 @@ /* end confdefs.h. */ #include + typedef wchar_t ac__type_sizeof_; int main () { -static int test_array [1 - 2 * !(((long int) (sizeof (wchar_t))) >= $ac_mid)]; +static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) >= $ac_mid)]; test_array [0] = 0 ; @@ -23446,21 +22939,20 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_lo=$ac_mid; break else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_hi=`expr '(' $ac_mid ')' - 1` @@ -23474,7 +22966,7 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo= ac_hi= @@ -23495,10 +22987,11 @@ /* end confdefs.h. */ #include + typedef wchar_t ac__type_sizeof_; int main () { -static int test_array [1 - 2 * !(((long int) (sizeof (wchar_t))) <= $ac_mid)]; +static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) <= $ac_mid)]; test_array [0] = 0 ; @@ -23511,21 +23004,20 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_hi=$ac_mid else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo=`expr '(' $ac_mid ')' + 1` @@ -23536,13 +23028,11 @@ case $ac_lo in ?*) ac_cv_sizeof_wchar_t=$ac_lo;; '') if test "$ac_cv_type_wchar_t" = yes; then - { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -{ { $as_echo "$as_me:$LINENO: error: cannot compute sizeof (wchar_t) + { { echo "$as_me:$LINENO: error: cannot compute sizeof (wchar_t) See \`config.log' for more details." >&5 -$as_echo "$as_me: error: cannot compute sizeof (wchar_t) +echo "$as_me: error: cannot compute sizeof (wchar_t) See \`config.log' for more details." >&2;} - { (exit 77); exit 77; }; }; } + { (exit 77); exit 77; }; } else ac_cv_sizeof_wchar_t=0 fi ;; @@ -23556,8 +23046,9 @@ /* end confdefs.h. */ #include -static long int longval () { return (long int) (sizeof (wchar_t)); } -static unsigned long int ulongval () { return (long int) (sizeof (wchar_t)); } + typedef wchar_t ac__type_sizeof_; +static long int longval () { return (long int) (sizeof (ac__type_sizeof_)); } +static unsigned long int ulongval () { return (long int) (sizeof (ac__type_sizeof_)); } #include #include int @@ -23567,22 +23058,20 @@ FILE *f = fopen ("conftest.val", "w"); if (! f) return 1; - if (((long int) (sizeof (wchar_t))) < 0) + if (((long int) (sizeof (ac__type_sizeof_))) < 0) { long int i = longval (); - if (i != ((long int) (sizeof (wchar_t)))) + if (i != ((long int) (sizeof (ac__type_sizeof_)))) return 1; - fprintf (f, "%ld", i); + fprintf (f, "%ld\n", i); } else { unsigned long int i = ulongval (); - if (i != ((long int) (sizeof (wchar_t)))) + if (i != ((long int) (sizeof (ac__type_sizeof_)))) return 1; - fprintf (f, "%lu", i); + fprintf (f, "%lu\n", i); } - /* Do not output a trailing newline, as this causes \r\n confusion - on some platforms. */ return ferror (f) || fclose (f) != 0; ; @@ -23595,48 +23084,43 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>&5 ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_try") 2>&5 ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_sizeof_wchar_t=`cat conftest.val` else - $as_echo "$as_me: program exited with status $ac_status" >&5 -$as_echo "$as_me: failed program was:" >&5 + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) if test "$ac_cv_type_wchar_t" = yes; then - { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -{ { $as_echo "$as_me:$LINENO: error: cannot compute sizeof (wchar_t) + { { echo "$as_me:$LINENO: error: cannot compute sizeof (wchar_t) See \`config.log' for more details." >&5 -$as_echo "$as_me: error: cannot compute sizeof (wchar_t) +echo "$as_me: error: cannot compute sizeof (wchar_t) See \`config.log' for more details." >&2;} - { (exit 77); exit 77; }; }; } + { (exit 77); exit 77; }; } else ac_cv_sizeof_wchar_t=0 fi fi -rm -rf conftest.dSYM rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi rm -f conftest.val fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_sizeof_wchar_t" >&5 -$as_echo "$ac_cv_sizeof_wchar_t" >&6; } +{ echo "$as_me:$LINENO: result: $ac_cv_sizeof_wchar_t" >&5 +echo "${ECHO_T}$ac_cv_sizeof_wchar_t" >&6; } @@ -23647,8 +23131,8 @@ fi -{ $as_echo "$as_me:$LINENO: checking for UCS-4 tcl" >&5 -$as_echo_n "checking for UCS-4 tcl... " >&6; } +{ echo "$as_me:$LINENO: checking for UCS-4 tcl" >&5 +echo $ECHO_N "checking for UCS-4 tcl... $ECHO_C" >&6; } have_ucs4_tcl=no cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ @@ -23675,14 +23159,13 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err @@ -23696,24 +23179,24 @@ have_ucs4_tcl=yes else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -{ $as_echo "$as_me:$LINENO: result: $have_ucs4_tcl" >&5 -$as_echo "$have_ucs4_tcl" >&6; } +{ echo "$as_me:$LINENO: result: $have_ucs4_tcl" >&5 +echo "${ECHO_T}$have_ucs4_tcl" >&6; } # check whether wchar_t is signed or not if test "$wchar_h" = yes then # check whether wchar_t is signed or not - { $as_echo "$as_me:$LINENO: checking whether wchar_t is signed" >&5 -$as_echo_n "checking whether wchar_t is signed... " >&6; } + { echo "$as_me:$LINENO: checking whether wchar_t is signed" >&5 +echo $ECHO_N "checking whether wchar_t is signed... $ECHO_C" >&6; } if test "${ac_cv_wchar_t_signed+set}" = set; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else if test "$cross_compiling" = yes; then @@ -23740,44 +23223,41 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>&5 ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_try") 2>&5 ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_wchar_t_signed=yes else - $as_echo "$as_me: program exited with status $ac_status" >&5 -$as_echo "$as_me: failed program was:" >&5 + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) ac_cv_wchar_t_signed=no fi -rm -rf conftest.dSYM rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi - { $as_echo "$as_me:$LINENO: result: $ac_cv_wchar_t_signed" >&5 -$as_echo "$ac_cv_wchar_t_signed" >&6; } + { echo "$as_me:$LINENO: result: $ac_cv_wchar_t_signed" >&5 +echo "${ECHO_T}$ac_cv_wchar_t_signed" >&6; } fi -{ $as_echo "$as_me:$LINENO: checking what type to use for unicode" >&5 -$as_echo_n "checking what type to use for unicode... " >&6; } +{ echo "$as_me:$LINENO: checking what type to use for unicode" >&5 +echo $ECHO_N "checking what type to use for unicode... $ECHO_C" >&6; } # Check whether --enable-unicode was given. if test "${enable_unicode+set}" = set; then enableval=$enable_unicode; @@ -23821,220 +23301,74 @@ if test "$enable_unicode" = "no" then UNICODE_OBJS="" - { $as_echo "$as_me:$LINENO: result: not used" >&5 -$as_echo "not used" >&6; } -else - UNICODE_OBJS="Objects/unicodeobject.o Objects/unicodectype.o" - -cat >>confdefs.h <<\_ACEOF -#define Py_USING_UNICODE 1 -_ACEOF - - - # wchar_t is only usable if it maps to an unsigned type - if test "$unicode_size" = "$ac_cv_sizeof_wchar_t" \ - -a "$ac_cv_wchar_t_signed" = "no" - then - PY_UNICODE_TYPE="wchar_t" - -cat >>confdefs.h <<\_ACEOF -#define HAVE_USABLE_WCHAR_T 1 -_ACEOF - - cat >>confdefs.h <<\_ACEOF -#define PY_UNICODE_TYPE wchar_t -_ACEOF - - elif test "$ac_cv_sizeof_short" = "$unicode_size" - then - PY_UNICODE_TYPE="unsigned short" - cat >>confdefs.h <<\_ACEOF -#define PY_UNICODE_TYPE unsigned short -_ACEOF - - elif test "$ac_cv_sizeof_long" = "$unicode_size" - then - PY_UNICODE_TYPE="unsigned long" - cat >>confdefs.h <<\_ACEOF -#define PY_UNICODE_TYPE unsigned long -_ACEOF - - else - PY_UNICODE_TYPE="no type found" - fi - { $as_echo "$as_me:$LINENO: result: $PY_UNICODE_TYPE" >&5 -$as_echo "$PY_UNICODE_TYPE" >&6; } -fi - -# check for endianness - - { $as_echo "$as_me:$LINENO: checking whether byte ordering is bigendian" >&5 -$as_echo_n "checking whether byte ordering is bigendian... " >&6; } -if test "${ac_cv_c_bigendian+set}" = set; then - $as_echo_n "(cached) " >&6 -else - ac_cv_c_bigendian=unknown - # See if we're dealing with a universal compiler. - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#ifndef __APPLE_CC__ - not a universal capable compiler - #endif - typedef int dummy; - -_ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - - # Check for potential -arch flags. It is not universal unless - # there are some -arch flags. Note that *ppc* also matches - # ppc64. This check is also rather less than ideal. - case "${CC} ${CFLAGS} ${CPPFLAGS} ${LDFLAGS}" in #( - *-arch*ppc*|*-arch*i386*|*-arch*x86_64*) ac_cv_c_bigendian=universal;; - esac -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - -fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - if test $ac_cv_c_bigendian = unknown; then - # See if sys/param.h defines the BYTE_ORDER macro. - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include - #include - -int -main () -{ -#if ! (defined BYTE_ORDER && defined BIG_ENDIAN \ - && defined LITTLE_ENDIAN && BYTE_ORDER && BIG_ENDIAN \ - && LITTLE_ENDIAN) - bogus endian macros - #endif - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - # It does; now see whether it defined to BIG_ENDIAN or not. - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include - #include - -int -main () -{ -#if BYTE_ORDER != BIG_ENDIAN - not big endian - #endif - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - ac_cv_c_bigendian=yes + { echo "$as_me:$LINENO: result: not used" >&5 +echo "${ECHO_T}not used" >&6; } else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 + UNICODE_OBJS="Objects/unicodeobject.o Objects/unicodectype.o" - ac_cv_c_bigendian=no -fi +cat >>confdefs.h <<\_ACEOF +#define Py_USING_UNICODE 1 +_ACEOF -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 + # wchar_t is only usable if it maps to an unsigned type + if test "$unicode_size" = "$ac_cv_sizeof_wchar_t" \ + -a "$ac_cv_wchar_t_signed" = "no" + then + PY_UNICODE_TYPE="wchar_t" + +cat >>confdefs.h <<\_ACEOF +#define HAVE_USABLE_WCHAR_T 1 +_ACEOF + + cat >>confdefs.h <<\_ACEOF +#define PY_UNICODE_TYPE wchar_t +_ACEOF + + elif test "$ac_cv_sizeof_short" = "$unicode_size" + then + PY_UNICODE_TYPE="unsigned short" + cat >>confdefs.h <<\_ACEOF +#define PY_UNICODE_TYPE unsigned short +_ACEOF + + elif test "$ac_cv_sizeof_long" = "$unicode_size" + then + PY_UNICODE_TYPE="unsigned long" + cat >>confdefs.h <<\_ACEOF +#define PY_UNICODE_TYPE unsigned long +_ACEOF + else + PY_UNICODE_TYPE="no type found" + fi + { echo "$as_me:$LINENO: result: $PY_UNICODE_TYPE" >&5 +echo "${ECHO_T}$PY_UNICODE_TYPE" >&6; } fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - fi - if test $ac_cv_c_bigendian = unknown; then - # See if defines _LITTLE_ENDIAN or _BIG_ENDIAN (e.g., Solaris). - cat >conftest.$ac_ext <<_ACEOF +# check for endianness +{ echo "$as_me:$LINENO: checking whether byte ordering is bigendian" >&5 +echo $ECHO_N "checking whether byte ordering is bigendian... $ECHO_C" >&6; } +if test "${ac_cv_c_bigendian+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + # See if sys/param.h defines the BYTE_ORDER macro. +cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -#include +#include +#include int main () { -#if ! (defined _LITTLE_ENDIAN || defined _BIG_ENDIAN) - bogus endian macros - #endif +#if ! (defined BYTE_ORDER && defined BIG_ENDIAN && defined LITTLE_ENDIAN \ + && BYTE_ORDER && BIG_ENDIAN && LITTLE_ENDIAN) + bogus endian macros +#endif ; return 0; @@ -24046,33 +23380,33 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then - # It does; now see whether it defined to _BIG_ENDIAN or not. - cat >conftest.$ac_ext <<_ACEOF + # It does; now see whether it defined to BIG_ENDIAN or not. +cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -#include +#include +#include int main () { -#ifndef _BIG_ENDIAN - not big endian - #endif +#if BYTE_ORDER != BIG_ENDIAN + not big endian +#endif ; return 0; @@ -24084,21 +23418,20 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_c_bigendian=yes else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_c_bigendian=no @@ -24106,44 +23439,29 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 - -fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - fi - if test $ac_cv_c_bigendian = unknown; then - # Compile a test program. - if test "$cross_compiling" = yes; then - # Try to guess by grepping values from an object file. - cat >conftest.$ac_ext <<_ACEOF + # It does not; compile a test program. +if test "$cross_compiling" = yes; then + # try to guess the endianness by grepping values into an object file + ac_cv_c_bigendian=unknown + cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -short int ascii_mm[] = - { 0x4249, 0x4765, 0x6E44, 0x6961, 0x6E53, 0x7953, 0 }; - short int ascii_ii[] = - { 0x694C, 0x5454, 0x656C, 0x6E45, 0x6944, 0x6E61, 0 }; - int use_ascii (int i) { - return ascii_mm[i] + ascii_ii[i]; - } - short int ebcdic_ii[] = - { 0x89D3, 0xE3E3, 0x8593, 0x95C5, 0x89C4, 0x9581, 0 }; - short int ebcdic_mm[] = - { 0xC2C9, 0xC785, 0x95C4, 0x8981, 0x95E2, 0xA8E2, 0 }; - int use_ebcdic (int i) { - return ebcdic_mm[i] + ebcdic_ii[i]; - } - extern int foo; - +short int ascii_mm[] = { 0x4249, 0x4765, 0x6E44, 0x6961, 0x6E53, 0x7953, 0 }; +short int ascii_ii[] = { 0x694C, 0x5454, 0x656C, 0x6E45, 0x6944, 0x6E61, 0 }; +void _ascii () { char *s = (char *) ascii_mm; s = (char *) ascii_ii; } +short int ebcdic_ii[] = { 0x89D3, 0xE3E3, 0x8593, 0x95C5, 0x89C4, 0x9581, 0 }; +short int ebcdic_mm[] = { 0xC2C9, 0xC785, 0x95C4, 0x8981, 0x95E2, 0xA8E2, 0 }; +void _ebcdic () { char *s = (char *) ebcdic_mm; s = (char *) ebcdic_ii; } int main () { -return use_ascii (foo) == use_ebcdic (foo); + _ascii (); _ebcdic (); ; return 0; } @@ -24154,31 +23472,30 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then - if grep BIGenDianSyS conftest.$ac_objext >/dev/null; then - ac_cv_c_bigendian=yes - fi - if grep LiTTleEnDian conftest.$ac_objext >/dev/null ; then - if test "$ac_cv_c_bigendian" = unknown; then - ac_cv_c_bigendian=no - else - # finding both strings is unlikely to happen, but who knows? - ac_cv_c_bigendian=unknown - fi - fi + if grep BIGenDianSyS conftest.$ac_objext >/dev/null ; then + ac_cv_c_bigendian=yes +fi +if grep LiTTleEnDian conftest.$ac_objext >/dev/null ; then + if test "$ac_cv_c_bigendian" = unknown; then + ac_cv_c_bigendian=no + else + # finding both strings is unlikely to happen, but who knows? + ac_cv_c_bigendian=unknown + fi +fi else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 @@ -24197,14 +23514,14 @@ main () { - /* Are we little or big endian? From Harbison&Steele. */ - union - { - long int l; - char c[sizeof (long int)]; - } u; - u.l = 1; - return u.c[sizeof (long int) - 1] == 1; + /* Are we little or big endian? From Harbison&Steele. */ + union + { + long int l; + char c[sizeof (long int)]; + } u; + u.l = 1; + return u.c[sizeof (long int) - 1] == 1; ; return 0; @@ -24216,70 +23533,63 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>&5 ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_try") 2>&5 ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_c_bigendian=no else - $as_echo "$as_me: program exited with status $ac_status" >&5 -$as_echo "$as_me: failed program was:" >&5 + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) ac_cv_c_bigendian=yes fi -rm -rf conftest.dSYM rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi - fi fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_c_bigendian" >&5 -$as_echo "$ac_cv_c_bigendian" >&6; } - case $ac_cv_c_bigendian in #( - yes) - cat >>confdefs.h <<\_ACEOF -#define WORDS_BIGENDIAN 1 -_ACEOF -;; #( - no) - ;; #( - universal) + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ echo "$as_me:$LINENO: result: $ac_cv_c_bigendian" >&5 +echo "${ECHO_T}$ac_cv_c_bigendian" >&6; } +case $ac_cv_c_bigendian in + yes) cat >>confdefs.h <<\_ACEOF -#define AC_APPLE_UNIVERSAL_BUILD 1 +#define WORDS_BIGENDIAN 1 _ACEOF - - ;; #( - *) - { { $as_echo "$as_me:$LINENO: error: unknown endianness - presetting ac_cv_c_bigendian=no (or yes) will help" >&5 -$as_echo "$as_me: error: unknown endianness - presetting ac_cv_c_bigendian=no (or yes) will help" >&2;} + ;; + no) + ;; + *) + { { echo "$as_me:$LINENO: error: unknown endianness +presetting ac_cv_c_bigendian=no (or yes) will help" >&5 +echo "$as_me: error: unknown endianness +presetting ac_cv_c_bigendian=no (or yes) will help" >&2;} { (exit 1); exit 1; }; } ;; - esac +esac # Check whether right shifting a negative integer extends the sign bit # or fills with zeros (like the Cray J90, according to Tim Peters). -{ $as_echo "$as_me:$LINENO: checking whether right shift extends the sign bit" >&5 -$as_echo_n "checking whether right shift extends the sign bit... " >&6; } +{ echo "$as_me:$LINENO: checking whether right shift extends the sign bit" >&5 +echo $ECHO_N "checking whether right shift extends the sign bit... $ECHO_C" >&6; } if test "${ac_cv_rshift_extends_sign+set}" = set; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else if test "$cross_compiling" = yes; then @@ -24304,40 +23614,37 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>&5 ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_try") 2>&5 ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_rshift_extends_sign=yes else - $as_echo "$as_me: program exited with status $ac_status" >&5 -$as_echo "$as_me: failed program was:" >&5 + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) ac_cv_rshift_extends_sign=no fi -rm -rf conftest.dSYM rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_rshift_extends_sign" >&5 -$as_echo "$ac_cv_rshift_extends_sign" >&6; } +{ echo "$as_me:$LINENO: result: $ac_cv_rshift_extends_sign" >&5 +echo "${ECHO_T}$ac_cv_rshift_extends_sign" >&6; } if test "$ac_cv_rshift_extends_sign" = no then @@ -24348,10 +23655,10 @@ fi # check for getc_unlocked and related locking functions -{ $as_echo "$as_me:$LINENO: checking for getc_unlocked() and friends" >&5 -$as_echo_n "checking for getc_unlocked() and friends... " >&6; } +{ echo "$as_me:$LINENO: checking for getc_unlocked() and friends" >&5 +echo $ECHO_N "checking for getc_unlocked() and friends... $ECHO_C" >&6; } if test "${ac_cv_have_getc_unlocked+set}" = set; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF @@ -24380,36 +23687,32 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err - } && test -s conftest$ac_exeext && { - test "$cross_compiling" = yes || - $as_test_x conftest$ac_exeext - }; then + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then ac_cv_have_getc_unlocked=yes else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_have_getc_unlocked=no fi -rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_have_getc_unlocked" >&5 -$as_echo "$ac_cv_have_getc_unlocked" >&6; } +{ echo "$as_me:$LINENO: result: $ac_cv_have_getc_unlocked" >&5 +echo "${ECHO_T}$ac_cv_have_getc_unlocked" >&6; } if test "$ac_cv_have_getc_unlocked" = yes then @@ -24427,8 +23730,8 @@ # library. NOTE: Keep the precedence of listed libraries synchronised # with setup.py. py_cv_lib_readline=no -{ $as_echo "$as_me:$LINENO: checking how to link readline libs" >&5 -$as_echo_n "checking how to link readline libs... " >&6; } +{ echo "$as_me:$LINENO: checking how to link readline libs" >&5 +echo $ECHO_N "checking how to link readline libs... $ECHO_C" >&6; } for py_libtermcap in "" ncursesw ncurses curses termcap; do if test -z "$py_libtermcap"; then READLINE_LIBS="-lreadline" @@ -24464,30 +23767,26 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err - } && test -s conftest$ac_exeext && { - test "$cross_compiling" = yes || - $as_test_x conftest$ac_exeext - }; then + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then py_cv_lib_readline=yes else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi -rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext if test $py_cv_lib_readline = yes; then @@ -24497,11 +23796,11 @@ # Uncomment this line if you want to use READINE_LIBS in Makefile or scripts #AC_SUBST([READLINE_LIBS]) if test $py_cv_lib_readline = no; then - { $as_echo "$as_me:$LINENO: result: none" >&5 -$as_echo "none" >&6; } + { echo "$as_me:$LINENO: result: none" >&5 +echo "${ECHO_T}none" >&6; } else - { $as_echo "$as_me:$LINENO: result: $READLINE_LIBS" >&5 -$as_echo "$READLINE_LIBS" >&6; } + { echo "$as_me:$LINENO: result: $READLINE_LIBS" >&5 +echo "${ECHO_T}$READLINE_LIBS" >&6; } cat >>confdefs.h <<\_ACEOF #define HAVE_LIBREADLINE 1 @@ -24510,10 +23809,10 @@ fi # check for readline 2.1 -{ $as_echo "$as_me:$LINENO: checking for rl_callback_handler_install in -lreadline" >&5 -$as_echo_n "checking for rl_callback_handler_install in -lreadline... " >&6; } +{ echo "$as_me:$LINENO: checking for rl_callback_handler_install in -lreadline" >&5 +echo $ECHO_N "checking for rl_callback_handler_install in -lreadline... $ECHO_C" >&6; } if test "${ac_cv_lib_readline_rl_callback_handler_install+set}" = set; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lreadline $READLINE_LIBS $LIBS" @@ -24545,37 +23844,33 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err - } && test -s conftest$ac_exeext && { - test "$cross_compiling" = yes || - $as_test_x conftest$ac_exeext - }; then + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then ac_cv_lib_readline_rl_callback_handler_install=yes else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_readline_rl_callback_handler_install=no fi -rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_readline_rl_callback_handler_install" >&5 -$as_echo "$ac_cv_lib_readline_rl_callback_handler_install" >&6; } -if test "x$ac_cv_lib_readline_rl_callback_handler_install" = x""yes; then +{ echo "$as_me:$LINENO: result: $ac_cv_lib_readline_rl_callback_handler_install" >&5 +echo "${ECHO_T}$ac_cv_lib_readline_rl_callback_handler_install" >&6; } +if test $ac_cv_lib_readline_rl_callback_handler_install = yes; then cat >>confdefs.h <<\_ACEOF #define HAVE_RL_CALLBACK 1 @@ -24598,21 +23893,20 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then have_readline=yes else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 have_readline=no @@ -24643,10 +23937,10 @@ fi # check for readline 4.0 -{ $as_echo "$as_me:$LINENO: checking for rl_pre_input_hook in -lreadline" >&5 -$as_echo_n "checking for rl_pre_input_hook in -lreadline... " >&6; } +{ echo "$as_me:$LINENO: checking for rl_pre_input_hook in -lreadline" >&5 +echo $ECHO_N "checking for rl_pre_input_hook in -lreadline... $ECHO_C" >&6; } if test "${ac_cv_lib_readline_rl_pre_input_hook+set}" = set; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lreadline $READLINE_LIBS $LIBS" @@ -24678,37 +23972,33 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err - } && test -s conftest$ac_exeext && { - test "$cross_compiling" = yes || - $as_test_x conftest$ac_exeext - }; then + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then ac_cv_lib_readline_rl_pre_input_hook=yes else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_readline_rl_pre_input_hook=no fi -rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_readline_rl_pre_input_hook" >&5 -$as_echo "$ac_cv_lib_readline_rl_pre_input_hook" >&6; } -if test "x$ac_cv_lib_readline_rl_pre_input_hook" = x""yes; then +{ echo "$as_me:$LINENO: result: $ac_cv_lib_readline_rl_pre_input_hook" >&5 +echo "${ECHO_T}$ac_cv_lib_readline_rl_pre_input_hook" >&6; } +if test $ac_cv_lib_readline_rl_pre_input_hook = yes; then cat >>confdefs.h <<\_ACEOF #define HAVE_RL_PRE_INPUT_HOOK 1 @@ -24718,10 +24008,10 @@ # also in 4.0 -{ $as_echo "$as_me:$LINENO: checking for rl_completion_display_matches_hook in -lreadline" >&5 -$as_echo_n "checking for rl_completion_display_matches_hook in -lreadline... " >&6; } +{ echo "$as_me:$LINENO: checking for rl_completion_display_matches_hook in -lreadline" >&5 +echo $ECHO_N "checking for rl_completion_display_matches_hook in -lreadline... $ECHO_C" >&6; } if test "${ac_cv_lib_readline_rl_completion_display_matches_hook+set}" = set; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lreadline $READLINE_LIBS $LIBS" @@ -24753,37 +24043,33 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err - } && test -s conftest$ac_exeext && { - test "$cross_compiling" = yes || - $as_test_x conftest$ac_exeext - }; then + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then ac_cv_lib_readline_rl_completion_display_matches_hook=yes else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_readline_rl_completion_display_matches_hook=no fi -rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_readline_rl_completion_display_matches_hook" >&5 -$as_echo "$ac_cv_lib_readline_rl_completion_display_matches_hook" >&6; } -if test "x$ac_cv_lib_readline_rl_completion_display_matches_hook" = x""yes; then +{ echo "$as_me:$LINENO: result: $ac_cv_lib_readline_rl_completion_display_matches_hook" >&5 +echo "${ECHO_T}$ac_cv_lib_readline_rl_completion_display_matches_hook" >&6; } +if test $ac_cv_lib_readline_rl_completion_display_matches_hook = yes; then cat >>confdefs.h <<\_ACEOF #define HAVE_RL_COMPLETION_DISPLAY_MATCHES_HOOK 1 @@ -24793,10 +24079,10 @@ # check for readline 4.2 -{ $as_echo "$as_me:$LINENO: checking for rl_completion_matches in -lreadline" >&5 -$as_echo_n "checking for rl_completion_matches in -lreadline... " >&6; } +{ echo "$as_me:$LINENO: checking for rl_completion_matches in -lreadline" >&5 +echo $ECHO_N "checking for rl_completion_matches in -lreadline... $ECHO_C" >&6; } if test "${ac_cv_lib_readline_rl_completion_matches+set}" = set; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lreadline $READLINE_LIBS $LIBS" @@ -24828,37 +24114,33 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err - } && test -s conftest$ac_exeext && { - test "$cross_compiling" = yes || - $as_test_x conftest$ac_exeext - }; then + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then ac_cv_lib_readline_rl_completion_matches=yes else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_readline_rl_completion_matches=no fi -rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_readline_rl_completion_matches" >&5 -$as_echo "$ac_cv_lib_readline_rl_completion_matches" >&6; } -if test "x$ac_cv_lib_readline_rl_completion_matches" = x""yes; then +{ echo "$as_me:$LINENO: result: $ac_cv_lib_readline_rl_completion_matches" >&5 +echo "${ECHO_T}$ac_cv_lib_readline_rl_completion_matches" >&6; } +if test $ac_cv_lib_readline_rl_completion_matches = yes; then cat >>confdefs.h <<\_ACEOF #define HAVE_RL_COMPLETION_MATCHES 1 @@ -24881,21 +24163,20 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then have_readline=yes else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 have_readline=no @@ -24928,10 +24209,10 @@ # End of readline checks: restore LIBS LIBS=$LIBS_no_readline -{ $as_echo "$as_me:$LINENO: checking for broken nice()" >&5 -$as_echo_n "checking for broken nice()... " >&6; } +{ echo "$as_me:$LINENO: checking for broken nice()" >&5 +echo $ECHO_N "checking for broken nice()... $ECHO_C" >&6; } if test "${ac_cv_broken_nice+set}" = set; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else if test "$cross_compiling" = yes; then @@ -24959,40 +24240,37 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>&5 ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_try") 2>&5 ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_broken_nice=yes else - $as_echo "$as_me: program exited with status $ac_status" >&5 -$as_echo "$as_me: failed program was:" >&5 + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) ac_cv_broken_nice=no fi -rm -rf conftest.dSYM rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_broken_nice" >&5 -$as_echo "$ac_cv_broken_nice" >&6; } +{ echo "$as_me:$LINENO: result: $ac_cv_broken_nice" >&5 +echo "${ECHO_T}$ac_cv_broken_nice" >&6; } if test "$ac_cv_broken_nice" = yes then @@ -25002,8 +24280,8 @@ fi -{ $as_echo "$as_me:$LINENO: checking for broken poll()" >&5 -$as_echo_n "checking for broken poll()... " >&6; } +{ echo "$as_me:$LINENO: checking for broken poll()" >&5 +echo $ECHO_N "checking for broken poll()... $ECHO_C" >&6; } if test "$cross_compiling" = yes; then ac_cv_broken_poll=no else @@ -25045,38 +24323,35 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>&5 ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_try") 2>&5 ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_broken_poll=yes else - $as_echo "$as_me: program exited with status $ac_status" >&5 -$as_echo "$as_me: failed program was:" >&5 + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) ac_cv_broken_poll=no fi -rm -rf conftest.dSYM rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_broken_poll" >&5 -$as_echo "$ac_cv_broken_poll" >&6; } +{ echo "$as_me:$LINENO: result: $ac_cv_broken_poll" >&5 +echo "${ECHO_T}$ac_cv_broken_poll" >&6; } if test "$ac_cv_broken_poll" = yes then @@ -25089,10 +24364,10 @@ # Before we can test tzset, we need to check if struct tm has a tm_zone # (which is not required by ISO C or UNIX spec) and/or if we support # tzname[] -{ $as_echo "$as_me:$LINENO: checking for struct tm.tm_zone" >&5 -$as_echo_n "checking for struct tm.tm_zone... " >&6; } +{ echo "$as_me:$LINENO: checking for struct tm.tm_zone" >&5 +echo $ECHO_N "checking for struct tm.tm_zone... $ECHO_C" >&6; } if test "${ac_cv_member_struct_tm_tm_zone+set}" = set; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ @@ -25120,21 +24395,20 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_member_struct_tm_tm_zone=yes else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 cat >conftest.$ac_ext <<_ACEOF @@ -25163,21 +24437,20 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_member_struct_tm_tm_zone=yes else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_member_struct_tm_tm_zone=no @@ -25188,9 +24461,9 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_member_struct_tm_tm_zone" >&5 -$as_echo "$ac_cv_member_struct_tm_tm_zone" >&6; } -if test "x$ac_cv_member_struct_tm_tm_zone" = x""yes; then +{ echo "$as_me:$LINENO: result: $ac_cv_member_struct_tm_tm_zone" >&5 +echo "${ECHO_T}$ac_cv_member_struct_tm_tm_zone" >&6; } +if test $ac_cv_member_struct_tm_tm_zone = yes; then cat >>confdefs.h <<_ACEOF #define HAVE_STRUCT_TM_TM_ZONE 1 @@ -25206,10 +24479,10 @@ _ACEOF else - { $as_echo "$as_me:$LINENO: checking whether tzname is declared" >&5 -$as_echo_n "checking whether tzname is declared... " >&6; } + { echo "$as_me:$LINENO: checking whether tzname is declared" >&5 +echo $ECHO_N "checking whether tzname is declared... $ECHO_C" >&6; } if test "${ac_cv_have_decl_tzname+set}" = set; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ @@ -25236,21 +24509,20 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_have_decl_tzname=yes else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_have_decl_tzname=no @@ -25258,9 +24530,9 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_have_decl_tzname" >&5 -$as_echo "$ac_cv_have_decl_tzname" >&6; } -if test "x$ac_cv_have_decl_tzname" = x""yes; then +{ echo "$as_me:$LINENO: result: $ac_cv_have_decl_tzname" >&5 +echo "${ECHO_T}$ac_cv_have_decl_tzname" >&6; } +if test $ac_cv_have_decl_tzname = yes; then cat >>confdefs.h <<_ACEOF #define HAVE_DECL_TZNAME 1 @@ -25276,10 +24548,10 @@ fi - { $as_echo "$as_me:$LINENO: checking for tzname" >&5 -$as_echo_n "checking for tzname... " >&6; } + { echo "$as_me:$LINENO: checking for tzname" >&5 +echo $ECHO_N "checking for tzname... $ECHO_C" >&6; } if test "${ac_cv_var_tzname+set}" = set; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ @@ -25306,35 +24578,31 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err - } && test -s conftest$ac_exeext && { - test "$cross_compiling" = yes || - $as_test_x conftest$ac_exeext - }; then + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then ac_cv_var_tzname=yes else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_var_tzname=no fi -rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_var_tzname" >&5 -$as_echo "$ac_cv_var_tzname" >&6; } +{ echo "$as_me:$LINENO: result: $ac_cv_var_tzname" >&5 +echo "${ECHO_T}$ac_cv_var_tzname" >&6; } if test $ac_cv_var_tzname = yes; then cat >>confdefs.h <<\_ACEOF @@ -25346,10 +24614,10 @@ # check tzset(3) exists and works like we expect it to -{ $as_echo "$as_me:$LINENO: checking for working tzset()" >&5 -$as_echo_n "checking for working tzset()... " >&6; } +{ echo "$as_me:$LINENO: checking for working tzset()" >&5 +echo $ECHO_N "checking for working tzset()... $ECHO_C" >&6; } if test "${ac_cv_working_tzset+set}" = set; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else if test "$cross_compiling" = yes; then @@ -25432,40 +24700,37 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>&5 ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_try") 2>&5 ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_working_tzset=yes else - $as_echo "$as_me: program exited with status $ac_status" >&5 -$as_echo "$as_me: failed program was:" >&5 + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) ac_cv_working_tzset=no fi -rm -rf conftest.dSYM rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_working_tzset" >&5 -$as_echo "$ac_cv_working_tzset" >&6; } +{ echo "$as_me:$LINENO: result: $ac_cv_working_tzset" >&5 +echo "${ECHO_T}$ac_cv_working_tzset" >&6; } if test "$ac_cv_working_tzset" = yes then @@ -25476,10 +24741,10 @@ fi # Look for subsecond timestamps in struct stat -{ $as_echo "$as_me:$LINENO: checking for tv_nsec in struct stat" >&5 -$as_echo_n "checking for tv_nsec in struct stat... " >&6; } +{ echo "$as_me:$LINENO: checking for tv_nsec in struct stat" >&5 +echo $ECHO_N "checking for tv_nsec in struct stat... $ECHO_C" >&6; } if test "${ac_cv_stat_tv_nsec+set}" = set; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ @@ -25505,21 +24770,20 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_stat_tv_nsec=yes else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_stat_tv_nsec=no @@ -25528,8 +24792,8 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_stat_tv_nsec" >&5 -$as_echo "$ac_cv_stat_tv_nsec" >&6; } +{ echo "$as_me:$LINENO: result: $ac_cv_stat_tv_nsec" >&5 +echo "${ECHO_T}$ac_cv_stat_tv_nsec" >&6; } if test "$ac_cv_stat_tv_nsec" = yes then @@ -25540,10 +24804,10 @@ fi # Look for BSD style subsecond timestamps in struct stat -{ $as_echo "$as_me:$LINENO: checking for tv_nsec2 in struct stat" >&5 -$as_echo_n "checking for tv_nsec2 in struct stat... " >&6; } +{ echo "$as_me:$LINENO: checking for tv_nsec2 in struct stat" >&5 +echo $ECHO_N "checking for tv_nsec2 in struct stat... $ECHO_C" >&6; } if test "${ac_cv_stat_tv_nsec2+set}" = set; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ @@ -25569,21 +24833,20 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_stat_tv_nsec2=yes else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_stat_tv_nsec2=no @@ -25592,8 +24855,8 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_stat_tv_nsec2" >&5 -$as_echo "$ac_cv_stat_tv_nsec2" >&6; } +{ echo "$as_me:$LINENO: result: $ac_cv_stat_tv_nsec2" >&5 +echo "${ECHO_T}$ac_cv_stat_tv_nsec2" >&6; } if test "$ac_cv_stat_tv_nsec2" = yes then @@ -25604,10 +24867,10 @@ fi # On HP/UX 11.0, mvwdelch is a block with a return statement -{ $as_echo "$as_me:$LINENO: checking whether mvwdelch is an expression" >&5 -$as_echo_n "checking whether mvwdelch is an expression... " >&6; } +{ echo "$as_me:$LINENO: checking whether mvwdelch is an expression" >&5 +echo $ECHO_N "checking whether mvwdelch is an expression... $ECHO_C" >&6; } if test "${ac_cv_mvwdelch_is_expression+set}" = set; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ @@ -25633,21 +24896,20 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_mvwdelch_is_expression=yes else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_mvwdelch_is_expression=no @@ -25656,8 +24918,8 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_mvwdelch_is_expression" >&5 -$as_echo "$ac_cv_mvwdelch_is_expression" >&6; } +{ echo "$as_me:$LINENO: result: $ac_cv_mvwdelch_is_expression" >&5 +echo "${ECHO_T}$ac_cv_mvwdelch_is_expression" >&6; } if test "$ac_cv_mvwdelch_is_expression" = yes then @@ -25668,10 +24930,10 @@ fi -{ $as_echo "$as_me:$LINENO: checking whether WINDOW has _flags" >&5 -$as_echo_n "checking whether WINDOW has _flags... " >&6; } +{ echo "$as_me:$LINENO: checking whether WINDOW has _flags" >&5 +echo $ECHO_N "checking whether WINDOW has _flags... $ECHO_C" >&6; } if test "${ac_cv_window_has_flags+set}" = set; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ @@ -25697,21 +24959,20 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_window_has_flags=yes else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_window_has_flags=no @@ -25720,8 +24981,8 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_window_has_flags" >&5 -$as_echo "$ac_cv_window_has_flags" >&6; } +{ echo "$as_me:$LINENO: result: $ac_cv_window_has_flags" >&5 +echo "${ECHO_T}$ac_cv_window_has_flags" >&6; } if test "$ac_cv_window_has_flags" = yes @@ -25733,8 +24994,8 @@ fi -{ $as_echo "$as_me:$LINENO: checking for is_term_resized" >&5 -$as_echo_n "checking for is_term_resized... " >&6; } +{ echo "$as_me:$LINENO: checking for is_term_resized" >&5 +echo $ECHO_N "checking for is_term_resized... $ECHO_C" >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF @@ -25756,14 +25017,13 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err @@ -25773,21 +25033,21 @@ #define HAVE_CURSES_IS_TERM_RESIZED 1 _ACEOF - { $as_echo "$as_me:$LINENO: result: yes" >&5 -$as_echo "yes" >&6; } + { echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; } else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 - { $as_echo "$as_me:$LINENO: result: no" >&5 -$as_echo "no" >&6; } + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -{ $as_echo "$as_me:$LINENO: checking for resize_term" >&5 -$as_echo_n "checking for resize_term... " >&6; } +{ echo "$as_me:$LINENO: checking for resize_term" >&5 +echo $ECHO_N "checking for resize_term... $ECHO_C" >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF @@ -25809,14 +25069,13 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err @@ -25826,21 +25085,21 @@ #define HAVE_CURSES_RESIZE_TERM 1 _ACEOF - { $as_echo "$as_me:$LINENO: result: yes" >&5 -$as_echo "yes" >&6; } + { echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; } else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 - { $as_echo "$as_me:$LINENO: result: no" >&5 -$as_echo "no" >&6; } + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -{ $as_echo "$as_me:$LINENO: checking for resizeterm" >&5 -$as_echo_n "checking for resizeterm... " >&6; } +{ echo "$as_me:$LINENO: checking for resizeterm" >&5 +echo $ECHO_N "checking for resizeterm... $ECHO_C" >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF @@ -25862,14 +25121,13 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err @@ -25879,63 +25137,61 @@ #define HAVE_CURSES_RESIZETERM 1 _ACEOF - { $as_echo "$as_me:$LINENO: result: yes" >&5 -$as_echo "yes" >&6; } + { echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; } else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 - { $as_echo "$as_me:$LINENO: result: no" >&5 -$as_echo "no" >&6; } + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -{ $as_echo "$as_me:$LINENO: checking for /dev/ptmx" >&5 -$as_echo_n "checking for /dev/ptmx... " >&6; } +{ echo "$as_me:$LINENO: checking for /dev/ptmx" >&5 +echo $ECHO_N "checking for /dev/ptmx... $ECHO_C" >&6; } if test -r /dev/ptmx then - { $as_echo "$as_me:$LINENO: result: yes" >&5 -$as_echo "yes" >&6; } + { echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; } cat >>confdefs.h <<\_ACEOF #define HAVE_DEV_PTMX 1 _ACEOF else - { $as_echo "$as_me:$LINENO: result: no" >&5 -$as_echo "no" >&6; } + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } fi -{ $as_echo "$as_me:$LINENO: checking for /dev/ptc" >&5 -$as_echo_n "checking for /dev/ptc... " >&6; } +{ echo "$as_me:$LINENO: checking for /dev/ptc" >&5 +echo $ECHO_N "checking for /dev/ptc... $ECHO_C" >&6; } if test -r /dev/ptc then - { $as_echo "$as_me:$LINENO: result: yes" >&5 -$as_echo "yes" >&6; } + { echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; } cat >>confdefs.h <<\_ACEOF #define HAVE_DEV_PTC 1 _ACEOF else - { $as_echo "$as_me:$LINENO: result: no" >&5 -$as_echo "no" >&6; } + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } fi -{ $as_echo "$as_me:$LINENO: checking for %zd printf() format support" >&5 -$as_echo_n "checking for %zd printf() format support... " >&6; } +{ echo "$as_me:$LINENO: checking for %zd printf() format support" >&5 +echo $ECHO_N "checking for %zd printf() format support... $ECHO_C" >&6; } if test "$cross_compiling" = yes; then - { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -{ { $as_echo "$as_me:$LINENO: error: cannot run test program while cross compiling + { { echo "$as_me:$LINENO: error: cannot run test program while cross compiling See \`config.log' for more details." >&5 -$as_echo "$as_me: error: cannot run test program while cross compiling +echo "$as_me: error: cannot run test program while cross compiling See \`config.log' for more details." >&2;} - { (exit 1); exit 1; }; }; } + { (exit 1); exit 1; }; } else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ @@ -25984,92 +25240,46 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>&5 ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_try") 2>&5 ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - { $as_echo "$as_me:$LINENO: result: yes" >&5 -$as_echo "yes" >&6; } + { echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; } cat >>confdefs.h <<\_ACEOF #define PY_FORMAT_SIZE_T "z" _ACEOF else - $as_echo "$as_me: program exited with status $ac_status" >&5 -$as_echo "$as_me: failed program was:" >&5 + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) -{ $as_echo "$as_me:$LINENO: result: no" >&5 -$as_echo "no" >&6; } +{ echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } fi -rm -rf conftest.dSYM rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi -{ $as_echo "$as_me:$LINENO: checking for socklen_t" >&5 -$as_echo_n "checking for socklen_t... " >&6; } +{ echo "$as_me:$LINENO: checking for socklen_t" >&5 +echo $ECHO_N "checking for socklen_t... $ECHO_C" >&6; } if test "${ac_cv_type_socklen_t+set}" = set; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else - ac_cv_type_socklen_t=no -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -#ifdef HAVE_SYS_TYPES_H -#include -#endif -#ifdef HAVE_SYS_SOCKET_H -#include -#endif - - -int -main () -{ -if (sizeof (socklen_t)) - return 0; - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF @@ -26085,11 +25295,14 @@ #endif +typedef socklen_t ac__type_new_; int main () { -if (sizeof ((socklen_t))) - return 0; +if ((ac__type_new_ *) 0) + return 0; +if (sizeof (ac__type_new_)) + return 0; ; return 0; } @@ -26100,39 +25313,30 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then - : -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_cv_type_socklen_t=yes -fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + ac_cv_type_socklen_t=yes else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 - + ac_cv_type_socklen_t=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_type_socklen_t" >&5 -$as_echo "$ac_cv_type_socklen_t" >&6; } -if test "x$ac_cv_type_socklen_t" = x""yes; then +{ echo "$as_me:$LINENO: result: $ac_cv_type_socklen_t" >&5 +echo "${ECHO_T}$ac_cv_type_socklen_t" >&6; } +if test $ac_cv_type_socklen_t = yes; then : else @@ -26152,15 +25356,15 @@ SRCDIRS="Parser Grammar Objects Python Modules Mac" -{ $as_echo "$as_me:$LINENO: checking for build directories" >&5 -$as_echo_n "checking for build directories... " >&6; } +{ echo "$as_me:$LINENO: checking for build directories" >&5 +echo $ECHO_N "checking for build directories... $ECHO_C" >&6; } for dir in $SRCDIRS; do if test ! -d $dir; then mkdir $dir fi done -{ $as_echo "$as_me:$LINENO: result: done" >&5 -$as_echo "done" >&6; } +{ echo "$as_me:$LINENO: result: done" >&5 +echo "${ECHO_T}done" >&6; } # generate output files ac_config_files="$ac_config_files Makefile.pre Modules/Setup.config Misc/python.pc" @@ -26192,12 +25396,11 @@ case $ac_val in #( *${as_nl}*) case $ac_var in #( - *_cv_*) { $as_echo "$as_me:$LINENO: WARNING: cache variable $ac_var contains a newline" >&5 -$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; + *_cv_*) { echo "$as_me:$LINENO: WARNING: Cache variable $ac_var contains a newline." >&5 +echo "$as_me: WARNING: Cache variable $ac_var contains a newline." >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( - BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( *) $as_unset $ac_var ;; esac ;; esac @@ -26230,12 +25433,12 @@ if diff "$cache_file" confcache >/dev/null 2>&1; then :; else if test -w "$cache_file"; then test "x$cache_file" != "x/dev/null" && - { $as_echo "$as_me:$LINENO: updating cache $cache_file" >&5 -$as_echo "$as_me: updating cache $cache_file" >&6;} + { echo "$as_me:$LINENO: updating cache $cache_file" >&5 +echo "$as_me: updating cache $cache_file" >&6;} cat confcache >$cache_file else - { $as_echo "$as_me:$LINENO: not updating unwritable cache $cache_file" >&5 -$as_echo "$as_me: not updating unwritable cache $cache_file" >&6;} + { echo "$as_me:$LINENO: not updating unwritable cache $cache_file" >&5 +echo "$as_me: not updating unwritable cache $cache_file" >&6;} fi fi rm -f confcache @@ -26251,7 +25454,7 @@ for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue # 1. Remove the extension, and $U if already installed. ac_script='s/\$U\././;s/\.o$//;s/\.obj$//' - ac_i=`$as_echo "$ac_i" | sed "$ac_script"` + ac_i=`echo "$ac_i" | sed "$ac_script"` # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR # will be set to the directory where LIBOBJS objects are built. ac_libobjs="$ac_libobjs \${LIBOBJDIR}$ac_i\$U.$ac_objext" @@ -26263,14 +25466,12 @@ - : ${CONFIG_STATUS=./config.status} -ac_write_fail=0 ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files $CONFIG_STATUS" -{ $as_echo "$as_me:$LINENO: creating $CONFIG_STATUS" >&5 -$as_echo "$as_me: creating $CONFIG_STATUS" >&6;} -cat >$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +{ echo "$as_me:$LINENO: creating $CONFIG_STATUS" >&5 +echo "$as_me: creating $CONFIG_STATUS" >&6;} +cat >$CONFIG_STATUS <<_ACEOF #! $SHELL # Generated by $as_me. # Run this file to recreate the current configuration. @@ -26283,7 +25484,7 @@ SHELL=\${CONFIG_SHELL-$SHELL} _ACEOF -cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +cat >>$CONFIG_STATUS <<\_ACEOF ## --------------------- ## ## M4sh Initialization. ## ## --------------------- ## @@ -26293,7 +25494,7 @@ if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: - # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which + # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST @@ -26315,45 +25516,17 @@ as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits -as_nl=' -' -export as_nl -# Printing a long string crashes Solaris 7 /usr/bin/printf. -as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' -as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo -as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo -if (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then - as_echo='printf %s\n' - as_echo_n='printf %s' -else - if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then - as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' - as_echo_n='/usr/ucb/echo -n' - else - as_echo_body='eval expr "X$1" : "X\\(.*\\)"' - as_echo_n_body='eval - arg=$1; - case $arg in - *"$as_nl"*) - expr "X$arg" : "X\\(.*\\)$as_nl"; - arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; - esac; - expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" - ' - export as_echo_n_body - as_echo_n='sh -c $as_echo_n_body as_echo' - fi - export as_echo_body - as_echo='sh -c $as_echo_body as_echo' -fi - # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then - PATH_SEPARATOR=: - (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { - (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || - PATH_SEPARATOR=';' - } + echo "#! /bin/sh" >conf$$.sh + echo "exit 0" >>conf$$.sh + chmod +x conf$$.sh + if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then + PATH_SEPARATOR=';' + else + PATH_SEPARATOR=: + fi + rm -f conf$$.sh fi # Support unset when possible. @@ -26369,6 +25542,8 @@ # there to prevent editors from complaining about space-tab. # (If _AS_PATH_WALK were called with IFS unset, it would disable word # splitting by setting IFS to empty value.) +as_nl=' +' IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. @@ -26391,7 +25566,7 @@ as_myself=$0 fi if test ! -f "$as_myself"; then - $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 + echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 { (exit 1); exit 1; } fi @@ -26404,10 +25579,17 @@ PS4='+ ' # NLS nuisances. -LC_ALL=C -export LC_ALL -LANGUAGE=C -export LANGUAGE +for as_var in \ + LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ + LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ + LC_TELEPHONE LC_TIME +do + if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then + eval $as_var=C; export $as_var + else + ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var + fi +done # Required to use basename. if expr a : '\(a\)' >/dev/null 2>&1 && @@ -26429,7 +25611,7 @@ $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X/"$0" | +echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q @@ -26480,7 +25662,7 @@ s/-\n.*// ' >$as_me.lineno && chmod +x "$as_me.lineno" || - { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2 + { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2 { (exit 1); exit 1; }; } # Don't try to exec as it changes $[0], causing all sort of problems @@ -26508,6 +25690,7 @@ *) ECHO_N='-n';; esac + if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr @@ -26520,22 +25703,19 @@ rm -f conf$$.dir/conf$$.file else rm -f conf$$.dir - mkdir conf$$.dir 2>/dev/null + mkdir conf$$.dir fi -if (echo >conf$$.file) 2>/dev/null; then - if ln -s conf$$.file conf$$ 2>/dev/null; then - as_ln_s='ln -s' - # ... but there are two gotchas: - # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. - # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. - # In both cases, we have to default to `cp -p'. - ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || - as_ln_s='cp -p' - elif ln conf$$.file conf$$ 2>/dev/null; then - as_ln_s=ln - else +echo >conf$$.file +if ln -s conf$$.file conf$$ 2>/dev/null; then + as_ln_s='ln -s' + # ... but there are two gotchas: + # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. + # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. + # In both cases, we have to default to `cp -p'. + ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || as_ln_s='cp -p' - fi +elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln else as_ln_s='cp -p' fi @@ -26560,10 +25740,10 @@ as_test_x=' eval sh -c '\'' if test -d "$1"; then - test -d "$1/."; + test -d "$1/."; else case $1 in - -*)set "./$1";; + -*)set "./$1";; esac; case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in ???[sx]*):;;*)false;;esac;fi @@ -26586,7 +25766,7 @@ # values after options handling. ac_log=" This file was extended by python $as_me 2.7, which was -generated by GNU Autoconf 2.63. Invocation command line was +generated by GNU Autoconf 2.61. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS @@ -26599,39 +25779,29 @@ _ACEOF -case $ac_config_files in *" -"*) set x $ac_config_files; shift; ac_config_files=$*;; -esac - -case $ac_config_headers in *" -"*) set x $ac_config_headers; shift; ac_config_headers=$*;; -esac - - -cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +cat >>$CONFIG_STATUS <<_ACEOF # Files that config.status was made for. -config_files="`echo $ac_config_files`" -config_headers="`echo $ac_config_headers`" +config_files="$ac_config_files" +config_headers="$ac_config_headers" _ACEOF -cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +cat >>$CONFIG_STATUS <<\_ACEOF ac_cs_usage="\ \`$as_me' instantiates files from templates according to the current configuration. -Usage: $0 [OPTION]... [FILE]... +Usage: $0 [OPTIONS] [FILE]... -h, --help print this help, then exit -V, --version print version number and configuration settings, then exit - -q, --quiet, --silent - do not print progress messages + -q, --quiet do not print progress messages -d, --debug don't remove temporary files --recheck update $as_me by reconfiguring in the same conditions - --file=FILE[:TEMPLATE] - instantiate the configuration file FILE - --header=FILE[:TEMPLATE] - instantiate the configuration header FILE + --file=FILE[:TEMPLATE] + instantiate the configuration file FILE + --header=FILE[:TEMPLATE] + instantiate the configuration header FILE Configuration files: $config_files @@ -26642,24 +25812,24 @@ Report bugs to ." _ACEOF -cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +cat >>$CONFIG_STATUS <<_ACEOF ac_cs_version="\\ python config.status 2.7 -configured by $0, generated by GNU Autoconf 2.63, - with options \\"`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\" +configured by $0, generated by GNU Autoconf 2.61, + with options \\"`echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\" -Copyright (C) 2008 Free Software Foundation, Inc. +Copyright (C) 2006 Free Software Foundation, Inc. This config.status script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it." ac_pwd='$ac_pwd' srcdir='$srcdir' INSTALL='$INSTALL' -test -n "\$AWK" || AWK=awk _ACEOF -cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 -# The default lists apply if the user does not specify any file. +cat >>$CONFIG_STATUS <<\_ACEOF +# If no file are specified by the user, then we need to provide default +# value. By we need to know if files were specified by the user. ac_need_defaults=: while test $# != 0 do @@ -26681,36 +25851,30 @@ -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) ac_cs_recheck=: ;; --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) - $as_echo "$ac_cs_version"; exit ;; + echo "$ac_cs_version"; exit ;; --debug | --debu | --deb | --de | --d | -d ) debug=: ;; --file | --fil | --fi | --f ) $ac_shift - case $ac_optarg in - *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; - esac - CONFIG_FILES="$CONFIG_FILES '$ac_optarg'" + CONFIG_FILES="$CONFIG_FILES $ac_optarg" ac_need_defaults=false;; --header | --heade | --head | --hea ) $ac_shift - case $ac_optarg in - *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; - esac - CONFIG_HEADERS="$CONFIG_HEADERS '$ac_optarg'" + CONFIG_HEADERS="$CONFIG_HEADERS $ac_optarg" ac_need_defaults=false;; --he | --h) # Conflict between --help and --header - { $as_echo "$as_me: error: ambiguous option: $1 + { echo "$as_me: error: ambiguous option: $1 Try \`$0 --help' for more information." >&2 { (exit 1); exit 1; }; };; --help | --hel | -h ) - $as_echo "$ac_cs_usage"; exit ;; + echo "$ac_cs_usage"; exit ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil | --si | --s) ac_cs_silent=: ;; # This is an error. - -*) { $as_echo "$as_me: error: unrecognized option: $1 + -*) { echo "$as_me: error: unrecognized option: $1 Try \`$0 --help' for more information." >&2 { (exit 1); exit 1; }; } ;; @@ -26729,32 +25893,30 @@ fi _ACEOF -cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +cat >>$CONFIG_STATUS <<_ACEOF if \$ac_cs_recheck; then - set X '$SHELL' '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion - shift - \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6 - CONFIG_SHELL='$SHELL' + echo "running CONFIG_SHELL=$SHELL $SHELL $0 "$ac_configure_args \$ac_configure_extra_args " --no-create --no-recursion" >&6 + CONFIG_SHELL=$SHELL export CONFIG_SHELL - exec "\$@" + exec $SHELL "$0"$ac_configure_args \$ac_configure_extra_args --no-create --no-recursion fi _ACEOF -cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +cat >>$CONFIG_STATUS <<\_ACEOF exec 5>>config.log { echo sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX ## Running $as_me. ## _ASBOX - $as_echo "$ac_log" + echo "$ac_log" } >&5 _ACEOF -cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +cat >>$CONFIG_STATUS <<_ACEOF _ACEOF -cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +cat >>$CONFIG_STATUS <<\_ACEOF # Handling of arguments. for ac_config_target in $ac_config_targets @@ -26770,8 +25932,8 @@ "Modules/Setup.config") CONFIG_FILES="$CONFIG_FILES Modules/Setup.config" ;; "Misc/python.pc") CONFIG_FILES="$CONFIG_FILES Misc/python.pc" ;; - *) { { $as_echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5 -$as_echo "$as_me: error: invalid argument: $ac_config_target" >&2;} + *) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5 +echo "$as_me: error: invalid argument: $ac_config_target" >&2;} { (exit 1); exit 1; }; };; esac done @@ -26811,145 +25973,227 @@ (umask 077 && mkdir "$tmp") } || { - $as_echo "$as_me: cannot create a temporary directory in ." >&2 + echo "$me: cannot create a temporary directory in ." >&2 { (exit 1); exit 1; } } -# Set up the scripts for CONFIG_FILES section. -# No need to generate them if there are no CONFIG_FILES. -# This happens for instance with `./config.status config.h'. -if test -n "$CONFIG_FILES"; then - +# +# Set up the sed scripts for CONFIG_FILES section. +# -ac_cr=' -' -ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' /dev/null` -if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then - ac_cs_awk_cr='\\r' -else - ac_cs_awk_cr=$ac_cr -fi +# No need to generate the scripts if there are no CONFIG_FILES. +# This happens for instance when ./config.status config.h +if test -n "$CONFIG_FILES"; then -echo 'BEGIN {' >"$tmp/subs1.awk" && _ACEOF -{ - echo "cat >conf$$subs.awk <<_ACEOF" && - echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' && - echo "_ACEOF" -} >conf$$subs.sh || - { { $as_echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5 -$as_echo "$as_me: error: could not make $CONFIG_STATUS" >&2;} - { (exit 1); exit 1; }; } -ac_delim_num=`echo "$ac_subst_vars" | grep -c '$'` + ac_delim='%!_!# ' for ac_last_try in false false false false false :; do - . ./conf$$subs.sh || - { { $as_echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5 -$as_echo "$as_me: error: could not make $CONFIG_STATUS" >&2;} - { (exit 1); exit 1; }; } + cat >conf$$subs.sed <<_ACEOF +SHELL!$SHELL$ac_delim +PATH_SEPARATOR!$PATH_SEPARATOR$ac_delim +PACKAGE_NAME!$PACKAGE_NAME$ac_delim +PACKAGE_TARNAME!$PACKAGE_TARNAME$ac_delim +PACKAGE_VERSION!$PACKAGE_VERSION$ac_delim +PACKAGE_STRING!$PACKAGE_STRING$ac_delim +PACKAGE_BUGREPORT!$PACKAGE_BUGREPORT$ac_delim +exec_prefix!$exec_prefix$ac_delim +prefix!$prefix$ac_delim +program_transform_name!$program_transform_name$ac_delim +bindir!$bindir$ac_delim +sbindir!$sbindir$ac_delim +libexecdir!$libexecdir$ac_delim +datarootdir!$datarootdir$ac_delim +datadir!$datadir$ac_delim +sysconfdir!$sysconfdir$ac_delim +sharedstatedir!$sharedstatedir$ac_delim +localstatedir!$localstatedir$ac_delim +includedir!$includedir$ac_delim +oldincludedir!$oldincludedir$ac_delim +docdir!$docdir$ac_delim +infodir!$infodir$ac_delim +htmldir!$htmldir$ac_delim +dvidir!$dvidir$ac_delim +pdfdir!$pdfdir$ac_delim +psdir!$psdir$ac_delim +libdir!$libdir$ac_delim +localedir!$localedir$ac_delim +mandir!$mandir$ac_delim +DEFS!$DEFS$ac_delim +ECHO_C!$ECHO_C$ac_delim +ECHO_N!$ECHO_N$ac_delim +ECHO_T!$ECHO_T$ac_delim +LIBS!$LIBS$ac_delim +build_alias!$build_alias$ac_delim +host_alias!$host_alias$ac_delim +target_alias!$target_alias$ac_delim +VERSION!$VERSION$ac_delim +SOVERSION!$SOVERSION$ac_delim +CONFIG_ARGS!$CONFIG_ARGS$ac_delim +UNIVERSALSDK!$UNIVERSALSDK$ac_delim +ARCH_RUN_32BIT!$ARCH_RUN_32BIT$ac_delim +PYTHONFRAMEWORK!$PYTHONFRAMEWORK$ac_delim +PYTHONFRAMEWORKIDENTIFIER!$PYTHONFRAMEWORKIDENTIFIER$ac_delim +PYTHONFRAMEWORKDIR!$PYTHONFRAMEWORKDIR$ac_delim +PYTHONFRAMEWORKPREFIX!$PYTHONFRAMEWORKPREFIX$ac_delim +PYTHONFRAMEWORKINSTALLDIR!$PYTHONFRAMEWORKINSTALLDIR$ac_delim +FRAMEWORKINSTALLFIRST!$FRAMEWORKINSTALLFIRST$ac_delim +FRAMEWORKINSTALLLAST!$FRAMEWORKINSTALLLAST$ac_delim +FRAMEWORKALTINSTALLFIRST!$FRAMEWORKALTINSTALLFIRST$ac_delim +FRAMEWORKALTINSTALLLAST!$FRAMEWORKALTINSTALLLAST$ac_delim +FRAMEWORKUNIXTOOLSPREFIX!$FRAMEWORKUNIXTOOLSPREFIX$ac_delim +MACHDEP!$MACHDEP$ac_delim +SGI_ABI!$SGI_ABI$ac_delim +EXTRAPLATDIR!$EXTRAPLATDIR$ac_delim +EXTRAMACHDEPPATH!$EXTRAMACHDEPPATH$ac_delim +CONFIGURE_MACOSX_DEPLOYMENT_TARGET!$CONFIGURE_MACOSX_DEPLOYMENT_TARGET$ac_delim +EXPORT_MACOSX_DEPLOYMENT_TARGET!$EXPORT_MACOSX_DEPLOYMENT_TARGET$ac_delim +CC!$CC$ac_delim +CFLAGS!$CFLAGS$ac_delim +LDFLAGS!$LDFLAGS$ac_delim +CPPFLAGS!$CPPFLAGS$ac_delim +ac_ct_CC!$ac_ct_CC$ac_delim +EXEEXT!$EXEEXT$ac_delim +OBJEXT!$OBJEXT$ac_delim +CXX!$CXX$ac_delim +MAINCC!$MAINCC$ac_delim +CPP!$CPP$ac_delim +GREP!$GREP$ac_delim +EGREP!$EGREP$ac_delim +BUILDEXEEXT!$BUILDEXEEXT$ac_delim +LIBRARY!$LIBRARY$ac_delim +LDLIBRARY!$LDLIBRARY$ac_delim +DLLLIBRARY!$DLLLIBRARY$ac_delim +BLDLIBRARY!$BLDLIBRARY$ac_delim +LDLIBRARYDIR!$LDLIBRARYDIR$ac_delim +INSTSONAME!$INSTSONAME$ac_delim +RUNSHARED!$RUNSHARED$ac_delim +LINKCC!$LINKCC$ac_delim +GNULD!$GNULD$ac_delim +RANLIB!$RANLIB$ac_delim +AR!$AR$ac_delim +ARFLAGS!$ARFLAGS$ac_delim +SVNVERSION!$SVNVERSION$ac_delim +INSTALL_PROGRAM!$INSTALL_PROGRAM$ac_delim +INSTALL_SCRIPT!$INSTALL_SCRIPT$ac_delim +INSTALL_DATA!$INSTALL_DATA$ac_delim +LN!$LN$ac_delim +OPT!$OPT$ac_delim +BASECFLAGS!$BASECFLAGS$ac_delim +UNIVERSAL_ARCH_FLAGS!$UNIVERSAL_ARCH_FLAGS$ac_delim +OTHER_LIBTOOL_OPT!$OTHER_LIBTOOL_OPT$ac_delim +LIBTOOL_CRUFT!$LIBTOOL_CRUFT$ac_delim +SO!$SO$ac_delim +LDSHARED!$LDSHARED$ac_delim +BLDSHARED!$BLDSHARED$ac_delim +CCSHARED!$CCSHARED$ac_delim +_ACEOF - ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X` - if test $ac_delim_n = $ac_delim_num; then + if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 97; then break elif $ac_last_try; then - { { $as_echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5 -$as_echo "$as_me: error: could not make $CONFIG_STATUS" >&2;} + { { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5 +echo "$as_me: error: could not make $CONFIG_STATUS" >&2;} { (exit 1); exit 1; }; } else ac_delim="$ac_delim!$ac_delim _$ac_delim!! " fi done -rm -f conf$$subs.sh -cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 -cat >>"\$tmp/subs1.awk" <<\\_ACAWK && -_ACEOF -sed -n ' -h -s/^/S["/; s/!.*/"]=/ -p -g -s/^[^!]*!// -:repl -t repl -s/'"$ac_delim"'$// -t delim -:nl -h -s/\(.\{148\}\).*/\1/ -t more1 -s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/ -p -n -b repl -:more1 -s/["\\]/\\&/g; s/^/"/; s/$/"\\/ -p -g -s/.\{148\}// -t nl -:delim -h -s/\(.\{148\}\).*/\1/ -t more2 -s/["\\]/\\&/g; s/^/"/; s/$/"/ -p -b -:more2 -s/["\\]/\\&/g; s/^/"/; s/$/"\\/ -p -g -s/.\{148\}// -t delim -' >$CONFIG_STATUS || ac_write_fail=1 -rm -f conf$$subs.awk -cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 -_ACAWK -cat >>"\$tmp/subs1.awk" <<_ACAWK && - for (key in S) S_is_set[key] = 1 - FS = "" +ac_eof=`sed -n '/^CEOF[0-9]*$/s/CEOF/0/p' conf$$subs.sed` +if test -n "$ac_eof"; then + ac_eof=`echo "$ac_eof" | sort -nru | sed 1q` + ac_eof=`expr $ac_eof + 1` +fi -} -{ - line = $ 0 - nfields = split(line, field, "@") - substed = 0 - len = length(field[1]) - for (i = 2; i < nfields; i++) { - key = field[i] - keylen = length(key) - if (S_is_set[key]) { - value = S[key] - line = substr(line, 1, len) "" value "" substr(line, len + keylen + 3) - len += length(value) + length(field[++i]) - substed = 1 - } else - len += 1 + keylen - } +cat >>$CONFIG_STATUS <<_ACEOF +cat >"\$tmp/subs-1.sed" <<\CEOF$ac_eof +/@[a-zA-Z_][a-zA-Z_0-9]*@/!b +_ACEOF +sed ' +s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g +s/^/s,@/; s/!/@,|#_!!_#|/ +:n +t n +s/'"$ac_delim"'$/,g/; t +s/$/\\/; p +N; s/^.*\n//; s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g; b n +' >>$CONFIG_STATUS >$CONFIG_STATUS <<_ACEOF +CEOF$ac_eof +_ACEOF - print line -} -_ACAWK +ac_delim='%!_!# ' +for ac_last_try in false false false false false :; do + cat >conf$$subs.sed <<_ACEOF +LINKFORSHARED!$LINKFORSHARED$ac_delim +CFLAGSFORSHARED!$CFLAGSFORSHARED$ac_delim +SHLIBS!$SHLIBS$ac_delim +USE_SIGNAL_MODULE!$USE_SIGNAL_MODULE$ac_delim +SIGNAL_OBJS!$SIGNAL_OBJS$ac_delim +USE_THREAD_MODULE!$USE_THREAD_MODULE$ac_delim +LDLAST!$LDLAST$ac_delim +THREADOBJ!$THREADOBJ$ac_delim +DLINCLDIR!$DLINCLDIR$ac_delim +DYNLOADFILE!$DYNLOADFILE$ac_delim +MACHDEP_OBJS!$MACHDEP_OBJS$ac_delim +TRUE!$TRUE$ac_delim +LIBOBJS!$LIBOBJS$ac_delim +HAVE_GETHOSTBYNAME_R_6_ARG!$HAVE_GETHOSTBYNAME_R_6_ARG$ac_delim +HAVE_GETHOSTBYNAME_R_5_ARG!$HAVE_GETHOSTBYNAME_R_5_ARG$ac_delim +HAVE_GETHOSTBYNAME_R_3_ARG!$HAVE_GETHOSTBYNAME_R_3_ARG$ac_delim +HAVE_GETHOSTBYNAME_R!$HAVE_GETHOSTBYNAME_R$ac_delim +HAVE_GETHOSTBYNAME!$HAVE_GETHOSTBYNAME$ac_delim +LIBM!$LIBM$ac_delim +LIBC!$LIBC$ac_delim +UNICODE_OBJS!$UNICODE_OBJS$ac_delim +THREADHEADERS!$THREADHEADERS$ac_delim +SRCDIRS!$SRCDIRS$ac_delim +LTLIBOBJS!$LTLIBOBJS$ac_delim _ACEOF -cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 -if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then - sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g" -else - cat -fi < "$tmp/subs1.awk" > "$tmp/subs.awk" \ - || { { $as_echo "$as_me:$LINENO: error: could not setup config files machinery" >&5 -$as_echo "$as_me: error: could not setup config files machinery" >&2;} + + if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 24; then + break + elif $ac_last_try; then + { { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5 +echo "$as_me: error: could not make $CONFIG_STATUS" >&2;} { (exit 1); exit 1; }; } + else + ac_delim="$ac_delim!$ac_delim _$ac_delim!! " + fi +done + +ac_eof=`sed -n '/^CEOF[0-9]*$/s/CEOF/0/p' conf$$subs.sed` +if test -n "$ac_eof"; then + ac_eof=`echo "$ac_eof" | sort -nru | sed 1q` + ac_eof=`expr $ac_eof + 1` +fi + +cat >>$CONFIG_STATUS <<_ACEOF +cat >"\$tmp/subs-2.sed" <<\CEOF$ac_eof +/@[a-zA-Z_][a-zA-Z_0-9]*@/!b end +_ACEOF +sed ' +s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g +s/^/s,@/; s/!/@,|#_!!_#|/ +:n +t n +s/'"$ac_delim"'$/,g/; t +s/$/\\/; p +N; s/^.*\n//; s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g; b n +' >>$CONFIG_STATUS >$CONFIG_STATUS <<_ACEOF +:end +s/|#_!!_#|//g +CEOF$ac_eof _ACEOF + # VPATH may cause trouble with some makes, so we remove $(srcdir), # ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and # trailing colons and then remove the whole line if VPATH becomes empty @@ -26965,133 +26209,19 @@ }' fi -cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +cat >>$CONFIG_STATUS <<\_ACEOF fi # test -n "$CONFIG_FILES" -# Set up the scripts for CONFIG_HEADERS section. -# No need to generate them if there are no CONFIG_HEADERS. -# This happens for instance with `./config.status Makefile'. -if test -n "$CONFIG_HEADERS"; then -cat >"$tmp/defines.awk" <<\_ACAWK || -BEGIN { -_ACEOF - -# Transform confdefs.h into an awk script `defines.awk', embedded as -# here-document in config.status, that substitutes the proper values into -# config.h.in to produce config.h. - -# Create a delimiter string that does not exist in confdefs.h, to ease -# handling of long lines. -ac_delim='%!_!# ' -for ac_last_try in false false :; do - ac_t=`sed -n "/$ac_delim/p" confdefs.h` - if test -z "$ac_t"; then - break - elif $ac_last_try; then - { { $as_echo "$as_me:$LINENO: error: could not make $CONFIG_HEADERS" >&5 -$as_echo "$as_me: error: could not make $CONFIG_HEADERS" >&2;} - { (exit 1); exit 1; }; } - else - ac_delim="$ac_delim!$ac_delim _$ac_delim!! " - fi -done - -# For the awk script, D is an array of macro values keyed by name, -# likewise P contains macro parameters if any. Preserve backslash -# newline sequences. - -ac_word_re=[_$as_cr_Letters][_$as_cr_alnum]* -sed -n ' -s/.\{148\}/&'"$ac_delim"'/g -t rset -:rset -s/^[ ]*#[ ]*define[ ][ ]*/ / -t def -d -:def -s/\\$// -t bsnl -s/["\\]/\\&/g -s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ -D["\1"]=" \3"/p -s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2"/p -d -:bsnl -s/["\\]/\\&/g -s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ -D["\1"]=" \3\\\\\\n"\\/p -t cont -s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2\\\\\\n"\\/p -t cont -d -:cont -n -s/.\{148\}/&'"$ac_delim"'/g -t clear -:clear -s/\\$// -t bsnlc -s/["\\]/\\&/g; s/^/"/; s/$/"/p -d -:bsnlc -s/["\\]/\\&/g; s/^/"/; s/$/\\\\\\n"\\/p -b cont -' >$CONFIG_STATUS || ac_write_fail=1 - -cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 - for (key in D) D_is_set[key] = 1 - FS = "" -} -/^[\t ]*#[\t ]*(define|undef)[\t ]+$ac_word_re([\t (]|\$)/ { - line = \$ 0 - split(line, arg, " ") - if (arg[1] == "#") { - defundef = arg[2] - mac1 = arg[3] - } else { - defundef = substr(arg[1], 2) - mac1 = arg[2] - } - split(mac1, mac2, "(") #) - macro = mac2[1] - prefix = substr(line, 1, index(line, defundef) - 1) - if (D_is_set[macro]) { - # Preserve the white space surrounding the "#". - print prefix "define", macro P[macro] D[macro] - next - } else { - # Replace #undef with comments. This is necessary, for example, - # in the case of _POSIX_SOURCE, which is predefined and required - # on some systems where configure will not decide to define it. - if (defundef == "undef") { - print "/*", prefix defundef, macro, "*/" - next - } - } -} -{ print } -_ACAWK -_ACEOF -cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 - { { $as_echo "$as_me:$LINENO: error: could not setup config headers machinery" >&5 -$as_echo "$as_me: error: could not setup config headers machinery" >&2;} - { (exit 1); exit 1; }; } -fi # test -n "$CONFIG_HEADERS" - -eval set X " :F $CONFIG_FILES :H $CONFIG_HEADERS " -shift -for ac_tag +for ac_tag in :F $CONFIG_FILES :H $CONFIG_HEADERS do case $ac_tag in :[FHLC]) ac_mode=$ac_tag; continue;; esac case $ac_mode$ac_tag in :[FHL]*:*);; - :L* | :C*:*) { { $as_echo "$as_me:$LINENO: error: invalid tag $ac_tag" >&5 -$as_echo "$as_me: error: invalid tag $ac_tag" >&2;} + :L* | :C*:*) { { echo "$as_me:$LINENO: error: Invalid tag $ac_tag." >&5 +echo "$as_me: error: Invalid tag $ac_tag." >&2;} { (exit 1); exit 1; }; };; :[FH]-) ac_tag=-:-;; :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; @@ -27120,38 +26250,26 @@ [\\/$]*) false;; *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; esac || - { { $as_echo "$as_me:$LINENO: error: cannot find input file: $ac_f" >&5 -$as_echo "$as_me: error: cannot find input file: $ac_f" >&2;} + { { echo "$as_me:$LINENO: error: cannot find input file: $ac_f" >&5 +echo "$as_me: error: cannot find input file: $ac_f" >&2;} { (exit 1); exit 1; }; };; esac - case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac - ac_file_inputs="$ac_file_inputs '$ac_f'" + ac_file_inputs="$ac_file_inputs $ac_f" done # Let's still pretend it is `configure' which instantiates (i.e., don't # use $as_me), people would be surprised to read: # /* config.h. Generated by config.status. */ - configure_input='Generated from '` - $as_echo "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g' - `' by configure.' + configure_input="Generated from "`IFS=: + echo $* | sed 's|^[^:]*/||;s|:[^:]*/|, |g'`" by configure." if test x"$ac_file" != x-; then configure_input="$ac_file. $configure_input" - { $as_echo "$as_me:$LINENO: creating $ac_file" >&5 -$as_echo "$as_me: creating $ac_file" >&6;} + { echo "$as_me:$LINENO: creating $ac_file" >&5 +echo "$as_me: creating $ac_file" >&6;} fi - # Neutralize special characters interpreted by sed in replacement strings. - case $configure_input in #( - *\&* | *\|* | *\\* ) - ac_sed_conf_input=`$as_echo "$configure_input" | - sed 's/[\\\\&|]/\\\\&/g'`;; #( - *) ac_sed_conf_input=$configure_input;; - esac case $ac_tag in - *:-:* | *:-) cat >"$tmp/stdin" \ - || { { $as_echo "$as_me:$LINENO: error: could not create $ac_file" >&5 -$as_echo "$as_me: error: could not create $ac_file" >&2;} - { (exit 1); exit 1; }; } ;; + *:-:* | *:-) cat >"$tmp/stdin";; esac ;; esac @@ -27161,7 +26279,7 @@ X"$ac_file" : 'X\(//\)[^/]' \| \ X"$ac_file" : 'X\(//\)$' \| \ X"$ac_file" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X"$ac_file" | +echo X"$ac_file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q @@ -27187,7 +26305,7 @@ as_dirs= while :; do case $as_dir in #( - *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( + *\'*) as_qdir=`echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #( *) as_qdir=$as_dir;; esac as_dirs="'$as_qdir' $as_dirs" @@ -27196,7 +26314,7 @@ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X"$as_dir" | +echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q @@ -27217,17 +26335,17 @@ test -d "$as_dir" && break done test -z "$as_dirs" || eval "mkdir $as_dirs" - } || test -d "$as_dir" || { { $as_echo "$as_me:$LINENO: error: cannot create directory $as_dir" >&5 -$as_echo "$as_me: error: cannot create directory $as_dir" >&2;} + } || test -d "$as_dir" || { { echo "$as_me:$LINENO: error: cannot create directory $as_dir" >&5 +echo "$as_me: error: cannot create directory $as_dir" >&2;} { (exit 1); exit 1; }; }; } ac_builddir=. case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) - ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` + ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` # A ".." for each directory in $ac_dir_suffix. - ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` + ac_top_builddir_sub=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,/..,g;s,/,,'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; @@ -27267,13 +26385,12 @@ esac _ACEOF -cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +cat >>$CONFIG_STATUS <<\_ACEOF # If the template does not know about datarootdir, expand it. # FIXME: This hack should be removed a few years after 2.60. ac_datarootdir_hack=; ac_datarootdir_seen= -ac_sed_dataroot=' -/datarootdir/ { +case `sed -n '/datarootdir/ { p q } @@ -27282,14 +26399,13 @@ /@infodir@/p /@localedir@/p /@mandir@/p -' -case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in +' $ac_file_inputs` in *datarootdir*) ac_datarootdir_seen=yes;; *@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) - { $as_echo "$as_me:$LINENO: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 -$as_echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 +echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} _ACEOF -cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +cat >>$CONFIG_STATUS <<_ACEOF ac_datarootdir_hack=' s&@datadir@&$datadir&g s&@docdir@&$docdir&g @@ -27303,16 +26419,15 @@ # Neutralize VPATH when `$srcdir' = `.'. # Shell code in configure.ac might set extrasub. # FIXME: do we really want to maintain this feature? -cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 -ac_sed_extra="$ac_vpsub +cat >>$CONFIG_STATUS <<_ACEOF + sed "$ac_vpsub $extrasub _ACEOF -cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +cat >>$CONFIG_STATUS <<\_ACEOF :t /@[a-zA-Z_][a-zA-Z_0-9]*@/!b -s|@configure_input@|$ac_sed_conf_input|;t t +s&@configure_input@&$configure_input&;t t s&@top_builddir@&$ac_top_builddir_sub&;t t -s&@top_build_prefix@&$ac_top_build_prefix&;t t s&@srcdir@&$ac_srcdir&;t t s&@abs_srcdir@&$ac_abs_srcdir&;t t s&@top_srcdir@&$ac_top_srcdir&;t t @@ -27322,58 +26437,119 @@ s&@abs_top_builddir@&$ac_abs_top_builddir&;t t s&@INSTALL@&$ac_INSTALL&;t t $ac_datarootdir_hack -" -eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$tmp/subs.awk" >$tmp/out \ - || { { $as_echo "$as_me:$LINENO: error: could not create $ac_file" >&5 -$as_echo "$as_me: error: could not create $ac_file" >&2;} - { (exit 1); exit 1; }; } +" $ac_file_inputs | sed -f "$tmp/subs-1.sed" | sed -f "$tmp/subs-2.sed" >$tmp/out test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && { ac_out=`sed -n '/\${datarootdir}/p' "$tmp/out"`; test -n "$ac_out"; } && { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' "$tmp/out"`; test -z "$ac_out"; } && - { $as_echo "$as_me:$LINENO: WARNING: $ac_file contains a reference to the variable \`datarootdir' + { echo "$as_me:$LINENO: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined." >&5 -$as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' +echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined." >&2;} rm -f "$tmp/stdin" case $ac_file in - -) cat "$tmp/out" && rm -f "$tmp/out";; - *) rm -f "$ac_file" && mv "$tmp/out" "$ac_file";; - esac \ - || { { $as_echo "$as_me:$LINENO: error: could not create $ac_file" >&5 -$as_echo "$as_me: error: could not create $ac_file" >&2;} - { (exit 1); exit 1; }; } + -) cat "$tmp/out"; rm -f "$tmp/out";; + *) rm -f "$ac_file"; mv "$tmp/out" $ac_file;; + esac ;; :H) # # CONFIG_HEADER # +_ACEOF + +# Transform confdefs.h into a sed script `conftest.defines', that +# substitutes the proper values into config.h.in to produce config.h. +rm -f conftest.defines conftest.tail +# First, append a space to every undef/define line, to ease matching. +echo 's/$/ /' >conftest.defines +# Then, protect against being on the right side of a sed subst, or in +# an unquoted here document, in config.status. If some macros were +# called several times there might be several #defines for the same +# symbol, which is useless. But do not sort them, since the last +# AC_DEFINE must be honored. +ac_word_re=[_$as_cr_Letters][_$as_cr_alnum]* +# These sed commands are passed to sed as "A NAME B PARAMS C VALUE D", where +# NAME is the cpp macro being defined, VALUE is the value it is being given. +# PARAMS is the parameter list in the macro definition--in most cases, it's +# just an empty string. +ac_dA='s,^\\([ #]*\\)[^ ]*\\([ ]*' +ac_dB='\\)[ (].*,\\1define\\2' +ac_dC=' ' +ac_dD=' ,' + +uniq confdefs.h | + sed -n ' + t rset + :rset + s/^[ ]*#[ ]*define[ ][ ]*// + t ok + d + :ok + s/[\\&,]/\\&/g + s/^\('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/ '"$ac_dA"'\1'"$ac_dB"'\2'"${ac_dC}"'\3'"$ac_dD"'/p + s/^\('"$ac_word_re"'\)[ ]*\(.*\)/'"$ac_dA"'\1'"$ac_dB$ac_dC"'\2'"$ac_dD"'/p + ' >>conftest.defines + +# Remove the space that was appended to ease matching. +# Then replace #undef with comments. This is necessary, for +# example, in the case of _POSIX_SOURCE, which is predefined and required +# on some systems where configure will not decide to define it. +# (The regexp can be short, since the line contains either #define or #undef.) +echo 's/ $// +s,^[ #]*u.*,/* & */,' >>conftest.defines + +# Break up conftest.defines: +ac_max_sed_lines=50 + +# First sed command is: sed -f defines.sed $ac_file_inputs >"$tmp/out1" +# Second one is: sed -f defines.sed "$tmp/out1" >"$tmp/out2" +# Third one will be: sed -f defines.sed "$tmp/out2" >"$tmp/out1" +# et cetera. +ac_in='$ac_file_inputs' +ac_out='"$tmp/out1"' +ac_nxt='"$tmp/out2"' + +while : +do + # Write a here document: + cat >>$CONFIG_STATUS <<_ACEOF + # First, check the format of the line: + cat >"\$tmp/defines.sed" <<\\CEOF +/^[ ]*#[ ]*undef[ ][ ]*$ac_word_re[ ]*\$/b def +/^[ ]*#[ ]*define[ ][ ]*$ac_word_re[( ]/b def +b +:def +_ACEOF + sed ${ac_max_sed_lines}q conftest.defines >>$CONFIG_STATUS + echo 'CEOF + sed -f "$tmp/defines.sed"' "$ac_in >$ac_out" >>$CONFIG_STATUS + ac_in=$ac_out; ac_out=$ac_nxt; ac_nxt=$ac_in + sed 1,${ac_max_sed_lines}d conftest.defines >conftest.tail + grep . conftest.tail >/dev/null || break + rm -f conftest.defines + mv conftest.tail conftest.defines +done +rm -f conftest.defines conftest.tail + +echo "ac_result=$ac_in" >>$CONFIG_STATUS +cat >>$CONFIG_STATUS <<\_ACEOF if test x"$ac_file" != x-; then - { - $as_echo "/* $configure_input */" \ - && eval '$AWK -f "$tmp/defines.awk"' "$ac_file_inputs" - } >"$tmp/config.h" \ - || { { $as_echo "$as_me:$LINENO: error: could not create $ac_file" >&5 -$as_echo "$as_me: error: could not create $ac_file" >&2;} - { (exit 1); exit 1; }; } - if diff "$ac_file" "$tmp/config.h" >/dev/null 2>&1; then - { $as_echo "$as_me:$LINENO: $ac_file is unchanged" >&5 -$as_echo "$as_me: $ac_file is unchanged" >&6;} + echo "/* $configure_input */" >"$tmp/config.h" + cat "$ac_result" >>"$tmp/config.h" + if diff $ac_file "$tmp/config.h" >/dev/null 2>&1; then + { echo "$as_me:$LINENO: $ac_file is unchanged" >&5 +echo "$as_me: $ac_file is unchanged" >&6;} else - rm -f "$ac_file" - mv "$tmp/config.h" "$ac_file" \ - || { { $as_echo "$as_me:$LINENO: error: could not create $ac_file" >&5 -$as_echo "$as_me: error: could not create $ac_file" >&2;} - { (exit 1); exit 1; }; } + rm -f $ac_file + mv "$tmp/config.h" $ac_file fi else - $as_echo "/* $configure_input */" \ - && eval '$AWK -f "$tmp/defines.awk"' "$ac_file_inputs" \ - || { { $as_echo "$as_me:$LINENO: error: could not create -" >&5 -$as_echo "$as_me: error: could not create -" >&2;} - { (exit 1); exit 1; }; } + echo "/* $configure_input */" + cat "$ac_result" fi + rm -f "$tmp/out12" ;; @@ -27387,11 +26563,6 @@ chmod +x $CONFIG_STATUS ac_clean_files=$ac_clean_files_save -test $ac_write_fail = 0 || - { { $as_echo "$as_me:$LINENO: error: write failure creating $CONFIG_STATUS" >&5 -$as_echo "$as_me: error: write failure creating $CONFIG_STATUS" >&2;} - { (exit 1); exit 1; }; } - # configure is writing to config.log, and then calls config.status. # config.status does its own redirection, appending to config.log. @@ -27413,10 +26584,6 @@ # would make configure fail if this is the last instruction. $ac_cs_success || { (exit 1); exit 1; } fi -if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then - { $as_echo "$as_me:$LINENO: WARNING: unrecognized options: $ac_unrecognized_opts" >&5 -$as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} -fi echo "creating Modules/Setup" @@ -27438,12 +26605,12 @@ case $ac_sys_system in BeOS) - { $as_echo "$as_me:$LINENO: WARNING: + { echo "$as_me:$LINENO: WARNING: Support for BeOS is deprecated as of Python 2.6. See PEP 11 for the gory details. " >&5 -$as_echo "$as_me: WARNING: +echo "$as_me: WARNING: Support for BeOS is deprecated as of Python 2.6. See PEP 11 for the gory details. Modified: python/trunk/configure.in ============================================================================== --- python/trunk/configure.in (original) +++ python/trunk/configure.in Mon Jun 8 23:12:41 2009 @@ -1592,6 +1592,10 @@ [Define if you want to produce an OpenStep/Rhapsody framework (shared library plus accessory files).]) AC_MSG_RESULT(yes) + if test $enable_shared = "yes" + then + AC_MSG_ERROR([Specifying both --enable-shared and --enable-framework is not supported, use only --enable-framework instead]) + fi else AC_MSG_RESULT(no) fi From python-checkins at python.org Mon Jun 8 23:19:36 2009 From: python-checkins at python.org (ronald.oussoren) Date: Mon, 8 Jun 2009 23:19:36 +0200 (CEST) Subject: [Python-checkins] r73306 - in python/branches/release26-maint: Misc/NEWS configure configure.in Message-ID: <20090608211936.87911D921@mail.python.org> Author: ronald.oussoren Date: Mon Jun 8 23:19:36 2009 New Revision: 73306 Log: Merged revisions 73305 via svnmerge from svn+ssh://pythondev at svn.python.org/python/trunk ........ r73305 | ronald.oussoren | 2009-06-08 14:12:41 -0700 (Mon, 08 Jun 2009) | 4 lines This is a fix for Issue5809: you shouldn't specify both --enable-framework and --enable-shared ........ Modified: python/branches/release26-maint/ (props changed) python/branches/release26-maint/Misc/NEWS python/branches/release26-maint/configure python/branches/release26-maint/configure.in Modified: python/branches/release26-maint/Misc/NEWS ============================================================================== --- python/branches/release26-maint/Misc/NEWS (original) +++ python/branches/release26-maint/Misc/NEWS Mon Jun 8 23:19:36 2009 @@ -578,6 +578,9 @@ Build ----- +- Issue 5809: Specifying both --enable-framework and --enable-shared is + an error. Configure now explicity tells you about this. + - Link the shared python library with $(MODLIBS). - Issue #5134: Silence compiler warnings when compiling sqlite with VC++. Modified: python/branches/release26-maint/configure ============================================================================== --- python/branches/release26-maint/configure (original) +++ python/branches/release26-maint/configure Mon Jun 8 23:19:36 2009 @@ -1,5 +1,5 @@ #! /bin/sh -# From configure.in Revision: 72275 . +# From configure.in Revision: 72873 . # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.61 for python 2.6. # @@ -12951,6 +12951,12 @@ { echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6; } + if test $enable_shared = "yes" + then + { { echo "$as_me:$LINENO: error: Specifying both --enable-shared and --enable-framework is not supported, use only --enable-framework instead" >&5 +echo "$as_me: error: Specifying both --enable-shared and --enable-framework is not supported, use only --enable-framework instead" >&2;} + { (exit 1); exit 1; }; } + fi else { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } Modified: python/branches/release26-maint/configure.in ============================================================================== --- python/branches/release26-maint/configure.in (original) +++ python/branches/release26-maint/configure.in Mon Jun 8 23:19:36 2009 @@ -1553,6 +1553,10 @@ [Define if you want to produce an OpenStep/Rhapsody framework (shared library plus accessory files).]) AC_MSG_RESULT(yes) + if test $enable_shared = "yes" + then + AC_MSG_ERROR([Specifying both --enable-shared and --enable-framework is not supported, use only --enable-framework instead]) + fi else AC_MSG_RESULT(no) fi From python-checkins at python.org Mon Jun 8 23:22:57 2009 From: python-checkins at python.org (ronald.oussoren) Date: Mon, 8 Jun 2009 23:22:57 +0200 (CEST) Subject: [Python-checkins] r73307 - in python/branches/py3k: Misc/NEWS configure configure.in Message-ID: <20090608212257.DABCFC515@mail.python.org> Author: ronald.oussoren Date: Mon Jun 8 23:22:57 2009 New Revision: 73307 Log: Merged revisions 73305 via svnmerge from svn+ssh://pythondev at svn.python.org/python/trunk ........ r73305 | ronald.oussoren | 2009-06-08 14:12:41 -0700 (Mon, 08 Jun 2009) | 4 lines This is a fix for Issue5809: you shouldn't specify both --enable-framework and --enable-shared ........ Modified: python/branches/py3k/ (props changed) python/branches/py3k/Misc/NEWS python/branches/py3k/configure python/branches/py3k/configure.in Modified: python/branches/py3k/Misc/NEWS ============================================================================== --- python/branches/py3k/Misc/NEWS (original) +++ python/branches/py3k/Misc/NEWS Mon Jun 8 23:22:57 2009 @@ -64,6 +64,10 @@ - Issue #6154: Make sure the intl library is added to LIBS if needed. Also added LIBS to OS X framework builds. +- Issue #5809: Specifying both --enable-framework and --enable-shared is + an error. Configure now explicity tells you about this. + + What's New in Python 3.1 release candidate 1? ============================================= Modified: python/branches/py3k/configure ============================================================================== --- python/branches/py3k/configure (original) +++ python/branches/py3k/configure Mon Jun 8 23:22:57 2009 @@ -1,5 +1,5 @@ #! /bin/sh -# From configure.in Revision: 73142 . +# From configure.in Revision: 73274 . # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.61 for python 3.1. # @@ -13286,6 +13286,12 @@ { echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6; } + if test $enable_shared = "yes" + then + { { echo "$as_me:$LINENO: error: Specifying both --enable-shared and --enable-framework is not supported, use only --enable-framework instead" >&5 +echo "$as_me: error: Specifying both --enable-shared and --enable-framework is not supported, use only --enable-framework instead" >&2;} + { (exit 1); exit 1; }; } + fi else { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } Modified: python/branches/py3k/configure.in ============================================================================== --- python/branches/py3k/configure.in (original) +++ python/branches/py3k/configure.in Mon Jun 8 23:22:57 2009 @@ -1522,6 +1522,10 @@ [Define if you want to produce an OpenStep/Rhapsody framework (shared library plus accessory files).]) AC_MSG_RESULT(yes) + if test $enable_shared = "yes" + then + AC_MSG_ERROR([Specifying both --enable-shared and --enable-framework is not supported, use only --enable-framework instead]) + fi else AC_MSG_RESULT(no) fi From buildbot at python.org Mon Jun 8 23:46:30 2009 From: buildbot at python.org (buildbot at python.org) Date: Mon, 08 Jun 2009 21:46:30 +0000 Subject: [Python-checkins] buildbot failure in x86 osx.5 trunk Message-ID: <20090608214630.E14F1D9C5@mail.python.org> The Buildbot has detected a new failure of x86 osx.5 trunk. Full details are available at: http://www.python.org/dev/buildbot/all/x86%20osx.5%20trunk/builds/1156 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: heller-x86-osx5 Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: ronald.oussoren BUILD FAILED: failed test Excerpt from the test logfile: sincerely, -The Buildbot From buildbot at python.org Tue Jun 9 00:11:55 2009 From: buildbot at python.org (buildbot at python.org) Date: Mon, 08 Jun 2009 22:11:55 +0000 Subject: [Python-checkins] buildbot failure in x86 osx.5 3.x Message-ID: <20090608221156.8B949DBFC@mail.python.org> The Buildbot has detected a new failure of x86 osx.5 3.x. Full details are available at: http://www.python.org/dev/buildbot/all/x86%20osx.5%203.x/builds/1011 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: heller-x86-osx5 Build Reason: Build Source Stamp: [branch branches/py3k] HEAD Blamelist: georg.brandl,ronald.oussoren,thomas.heller BUILD FAILED: failed test Excerpt from the test logfile: 2 tests failed: test_asynchat test_smtplib make: *** [buildbottest] Error 1 sincerely, -The Buildbot From python-checkins at python.org Tue Jun 9 00:18:32 2009 From: python-checkins at python.org (benjamin.peterson) Date: Tue, 9 Jun 2009 00:18:32 +0200 (CEST) Subject: [Python-checkins] r73308 - python/trunk/Python/ast.c Message-ID: <20090608221832.3B8FEDA49@mail.python.org> Author: benjamin.peterson Date: Tue Jun 9 00:18:32 2009 New Revision: 73308 Log: remove useless assertion Modified: python/trunk/Python/ast.c Modified: python/trunk/Python/ast.c ============================================================================== --- python/trunk/Python/ast.c (original) +++ python/trunk/Python/ast.c Tue Jun 9 00:18:32 2009 @@ -3130,7 +3130,6 @@ n = CHILD(n, 0); } if (TYPE(n) == small_stmt) { - REQ(n, small_stmt); n = CHILD(n, 0); /* small_stmt: expr_stmt | print_stmt | del_stmt | pass_stmt | flow_stmt | import_stmt | global_stmt | exec_stmt From buildbot at python.org Tue Jun 9 00:38:24 2009 From: buildbot at python.org (buildbot at python.org) Date: Mon, 08 Jun 2009 22:38:24 +0000 Subject: [Python-checkins] buildbot failure in sparc solaris10 gcc 3.x Message-ID: <20090608223824.DFA4BDBAC@mail.python.org> The Buildbot has detected a new failure of sparc solaris10 gcc 3.x. Full details are available at: http://www.python.org/dev/buildbot/all/sparc%20solaris10%20gcc%203.x/builds/805 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: loewis-sun Build Reason: Build Source Stamp: [branch branches/py3k] HEAD Blamelist: georg.brandl,ronald.oussoren,thomas.heller BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_posix ====================================================================== ERROR: test_getcwd_long_pathnames (test.test_posix.PosixTester) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home2/buildbot/slave/3.x.loewis-sun/build/Lib/test/test_posix.py", line 251, in test_getcwd_long_pathnames support.rmtree(base_path) File "/home2/buildbot/slave/3.x.loewis-sun/build/Lib/test/support.py", line 181, in rmtree shutil.rmtree(path) File "/home2/buildbot/slave/3.x.loewis-sun/build/Lib/shutil.py", line 239, in rmtree onerror(os.rmdir, path, sys.exc_info()) File "/home2/buildbot/slave/3.x.loewis-sun/build/Lib/shutil.py", line 237, in rmtree os.rmdir(path) OSError: [Errno 22] Invalid argument: '/home2/buildbot/slave/3.x.loewis-sun/build/@test.getcwd/@test.getcwd' sincerely, -The Buildbot From python-checkins at python.org Tue Jun 9 01:07:16 2009 From: python-checkins at python.org (raymond.hettinger) Date: Tue, 9 Jun 2009 01:07:16 +0200 (CEST) Subject: [Python-checkins] r73309 - peps/trunk/pep-0375.txt Message-ID: <20090608230716.D8FF5D9FA@mail.python.org> Author: raymond.hettinger Date: Tue Jun 9 01:07:16 2009 New Revision: 73309 Log: Update PEP to reflect removal of ipaddr Modified: peps/trunk/pep-0375.txt Modified: peps/trunk/pep-0375.txt ============================================================================== --- peps/trunk/pep-0375.txt (original) +++ peps/trunk/pep-0375.txt Tue Jun 9 01:07:16 2009 @@ -47,7 +47,6 @@ - importlib - io in C -- Adding an IP Address library to the stdlib [#iplib]_. - Update simplejson to the latest external version [#simplejson]_. - Ordered dictionary for collections [#ordered]_. - auto-numbered replacement fields in str.format() strings [#strformat]_ @@ -58,9 +57,6 @@ Footnotes ========= -.. [#iplib] - http://bugs.python.org/issue3959 - .. [#simplejson] http://bugs.python.org/issue4136 From python-checkins at python.org Tue Jun 9 01:12:46 2009 From: python-checkins at python.org (benjamin.peterson) Date: Tue, 9 Jun 2009 01:12:46 +0200 (CEST) Subject: [Python-checkins] r73310 - peps/trunk/pep-0375.txt Message-ID: <20090608231246.4BEF7DB1E@mail.python.org> Author: benjamin.peterson Date: Tue Jun 9 01:12:46 2009 New Revision: 73310 Log: remove etree upgrade Modified: peps/trunk/pep-0375.txt Modified: peps/trunk/pep-0375.txt ============================================================================== --- peps/trunk/pep-0375.txt (original) +++ peps/trunk/pep-0375.txt Tue Jun 9 01:12:46 2009 @@ -50,7 +50,6 @@ - Update simplejson to the latest external version [#simplejson]_. - Ordered dictionary for collections [#ordered]_. - auto-numbered replacement fields in str.format() strings [#strformat]_ -- Upgrading xml.etree to the latest external version [#etree]_ - Nested with-statements in one with statement From python-checkins at python.org Tue Jun 9 01:17:54 2009 From: python-checkins at python.org (raymond.hettinger) Date: Tue, 9 Jun 2009 01:17:54 +0200 (CEST) Subject: [Python-checkins] r73311 - peps/trunk/pep-0375.txt Message-ID: <20090608231754.DCC48C54A@mail.python.org> Author: raymond.hettinger Date: Tue Jun 9 01:17:54 2009 New Revision: 73311 Log: ElementTree didn't show up on time. Modified: peps/trunk/pep-0375.txt Modified: peps/trunk/pep-0375.txt ============================================================================== --- peps/trunk/pep-0375.txt (original) +++ peps/trunk/pep-0375.txt Tue Jun 9 01:17:54 2009 @@ -65,9 +65,6 @@ .. [#strformat] http://bugs.python.org/issue5237 -.. [#etree] - http://bugs.python.org/issue1143 - Copyright From python-checkins at python.org Tue Jun 9 01:44:14 2009 From: python-checkins at python.org (benjamin.peterson) Date: Tue, 9 Jun 2009 01:44:14 +0200 (CEST) Subject: [Python-checkins] r73312 - in python/trunk: Lib/test/test_generators.py Lib/test/test_genexps.py Lib/test/test_syntax.py Python/ast.c Message-ID: <20090608234414.03C93C452@mail.python.org> Author: benjamin.peterson Date: Tue Jun 9 01:44:13 2009 New Revision: 73312 Log: remove error checks already done in set_context() Modified: python/trunk/Lib/test/test_generators.py python/trunk/Lib/test/test_genexps.py python/trunk/Lib/test/test_syntax.py python/trunk/Python/ast.c Modified: python/trunk/Lib/test/test_generators.py ============================================================================== --- python/trunk/Lib/test/test_generators.py (original) +++ python/trunk/Lib/test/test_generators.py Tue Jun 9 01:44:13 2009 @@ -1588,7 +1588,7 @@ Traceback (most recent call last): ... File "", line 1 -SyntaxError: augmented assignment to yield expression not possible +SyntaxError: can't assign to yield expression Now check some throw() conditions: Modified: python/trunk/Lib/test/test_genexps.py ============================================================================== --- python/trunk/Lib/test/test_genexps.py (original) +++ python/trunk/Lib/test/test_genexps.py Tue Jun 9 01:44:13 2009 @@ -144,7 +144,7 @@ Traceback (most recent call last): ... File "", line 1 - SyntaxError: augmented assignment to generator expression not possible + SyntaxError: can't assign to generator expression ########### Tests borrowed from or inspired by test_generators.py ############ Modified: python/trunk/Lib/test/test_syntax.py ============================================================================== --- python/trunk/Lib/test/test_syntax.py (original) +++ python/trunk/Lib/test/test_syntax.py Tue Jun 9 01:44:13 2009 @@ -248,12 +248,12 @@ SyntaxError: keyword can't be an expression -From ast_for_expr_stmt(): +More set_context(): >>> (x for x in x) += 1 Traceback (most recent call last): File "", line 1 -SyntaxError: augmented assignment to generator expression not possible +SyntaxError: can't assign to generator expression >>> None += 1 Traceback (most recent call last): File "", line 1 @@ -261,7 +261,7 @@ >>> f() += 1 Traceback (most recent call last): File "", line 1 -SyntaxError: illegal expression for augmented assignment +SyntaxError: can't assign to function call Test continue in finally in weird combinations. Modified: python/trunk/Python/ast.c ============================================================================== --- python/trunk/Python/ast.c (original) +++ python/trunk/Python/ast.c Tue Jun 9 01:44:13 2009 @@ -2088,31 +2088,6 @@ expr1 = ast_for_testlist(c, ch); if (!expr1) return NULL; - /* TODO(nas): Remove duplicated error checks (set_context does it) */ - switch (expr1->kind) { - case GeneratorExp_kind: - ast_error(ch, "augmented assignment to generator " - "expression not possible"); - return NULL; - case Yield_kind: - ast_error(ch, "augmented assignment to yield " - "expression not possible"); - return NULL; - case Name_kind: { - const char *var_name = PyBytes_AS_STRING(expr1->v.Name.id); - if ((var_name[0] == 'N' || var_name[0] == 'T' || var_name[0] == 'F') && - !forbidden_check(c, ch, var_name)) - return NULL; - break; - } - case Attribute_kind: - case Subscript_kind: - break; - default: - ast_error(ch, "illegal expression for augmented " - "assignment"); - return NULL; - } if(!set_context(c, expr1, Store, ch)) return NULL; From python-checkins at python.org Tue Jun 9 02:44:22 2009 From: python-checkins at python.org (r.david.murray) Date: Tue, 9 Jun 2009 02:44:22 +0200 (CEST) Subject: [Python-checkins] r73313 - in python/trunk/Doc/library: os.rst subprocess.rst Message-ID: <20090609004422.BE49DDA4E@mail.python.org> Author: r.david.murray Date: Tue Jun 9 02:44:22 2009 New Revision: 73313 Log: Issue 2947: document how return code handling translates from os.popen to subprocess. Also fixes reference link in the os.spawn documentation. Modified: python/trunk/Doc/library/os.rst python/trunk/Doc/library/subprocess.rst Modified: python/trunk/Doc/library/os.rst ============================================================================== --- python/trunk/Doc/library/os.rst (original) +++ python/trunk/Doc/library/os.rst Tue Jun 9 02:44:22 2009 @@ -1715,8 +1715,8 @@ (Note that the :mod:`subprocess` module provides more powerful facilities for spawning new processes and retrieving their results; using that module is - preferable to using these functions. Check specially the *Replacing Older - Functions with the subprocess Module* section in that documentation page.) + preferable to using these functions. Check especially the + :ref:`subprocess-replacements` section.) If *mode* is :const:`P_NOWAIT`, this function returns the process id of the new process; if *mode* is :const:`P_WAIT`, returns the process's exit code if it Modified: python/trunk/Doc/library/subprocess.rst ============================================================================== --- python/trunk/Doc/library/subprocess.rst (original) +++ python/trunk/Doc/library/subprocess.rst Tue Jun 9 02:44:22 2009 @@ -392,8 +392,8 @@ output = p2.communicate()[0] -Replacing os.system() -^^^^^^^^^^^^^^^^^^^^^ +Replacing :func:`os.system` +^^^^^^^^^^^^^^^^^^^^^^^^^^^ :: @@ -420,8 +420,8 @@ print >>sys.stderr, "Execution failed:", e -Replacing the os.spawn family -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +Replacing the :func:`os.spawn ` family +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ P_NOWAIT example:: @@ -448,8 +448,8 @@ Popen(["/bin/mycmd", "myarg"], env={"PATH": "/usr/bin"}) -Replacing os.popen, os.popen2, os.popen3 -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +Replacing :func:`os.popen`, :func:`os.popen2`, :func:`os.popen3` +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ :: @@ -491,9 +491,23 @@ stdin=PIPE, stdout=PIPE, stderr=STDOUT, close_fds=True) (child_stdin, child_stdout_and_stderr) = (p.stdin, p.stdout) +Return code handling translates as follows:: -Replacing functions from the popen2 module -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + pipe = os.popen(cmd, 'w') + ... + rc = pipe.close() + if rc != None and rc % 256: + print "There were some errors" + ==> + process = Popen(cmd, 'w', stdin=PIPE) + ... + process.stdin.close() + if process.wait() != 0: + print "There were some errors" + + +Replacing functions from the :mod:`popen2` module +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ .. note:: From python-checkins at python.org Tue Jun 9 14:38:09 2009 From: python-checkins at python.org (eric.smith) Date: Tue, 9 Jun 2009 14:38:09 +0200 (CEST) Subject: [Python-checkins] r73314 - python/trunk/Lib/test/formatfloat_testcases.txt Message-ID: <20090609123809.01333DBDF@mail.python.org> Author: eric.smith Date: Tue Jun 9 14:38:08 2009 New Revision: 73314 Log: Restored a test that was erroneously removed. See issue 6198. Modified: python/trunk/Lib/test/formatfloat_testcases.txt Modified: python/trunk/Lib/test/formatfloat_testcases.txt ============================================================================== --- python/trunk/Lib/test/formatfloat_testcases.txt (original) +++ python/trunk/Lib/test/formatfloat_testcases.txt Tue Jun 9 14:38:08 2009 @@ -61,7 +61,7 @@ -- makes a difference when the precision is 0. %#.0f 0 -> 0. %#.1f 0 -> 0.0 ---%#.0f 1.5 -> 2. See issue 6198. +%#.0f 1.5 -> 2. -- %#.0f 2.5 -> 2. See issue 6198. %#.0f 10.1 -> 10. %#.0f 1234.56 -> 1235. From python-checkins at python.org Tue Jun 9 14:38:46 2009 From: python-checkins at python.org (eric.smith) Date: Tue, 9 Jun 2009 14:38:46 +0200 (CEST) Subject: [Python-checkins] r73315 - python/branches/release26-maint Message-ID: <20090609123846.CE2F6DBDF@mail.python.org> Author: eric.smith Date: Tue Jun 9 14:38:46 2009 New Revision: 73315 Log: Blocked revisions 73314 via svnmerge ........ r73314 | eric.smith | 2009-06-09 08:38:08 -0400 (Tue, 09 Jun 2009) | 1 line Restored a test that was erroneously removed. See issue 6198. ........ Modified: python/branches/release26-maint/ (props changed) From python-checkins at python.org Tue Jun 9 14:39:29 2009 From: python-checkins at python.org (eric.smith) Date: Tue, 9 Jun 2009 14:39:29 +0200 (CEST) Subject: [Python-checkins] r73316 - python/branches/py3k Message-ID: <20090609123929.51AD7DBDF@mail.python.org> Author: eric.smith Date: Tue Jun 9 14:39:29 2009 New Revision: 73316 Log: Blocked revisions 73314 via svnmerge ........ r73314 | eric.smith | 2009-06-09 08:38:08 -0400 (Tue, 09 Jun 2009) | 1 line Restored a test that was erroneously removed. See issue 6198. ........ Modified: python/branches/py3k/ (props changed) From buildbot at python.org Tue Jun 9 17:16:47 2009 From: buildbot at python.org (buildbot at python.org) Date: Tue, 09 Jun 2009 15:16:47 +0000 Subject: [Python-checkins] buildbot failure in sparc solaris10 gcc 3.x Message-ID: <20090609151647.A1127DC32@mail.python.org> The Buildbot has detected a new failure of sparc solaris10 gcc 3.x. Full details are available at: http://www.python.org/dev/buildbot/all/sparc%20solaris10%20gcc%203.x/builds/807 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: loewis-sun Build Reason: Build Source Stamp: [branch branches/py3k] HEAD Blamelist: eric.smith BUILD FAILED: failed test Excerpt from the test logfile: 2 tests failed: test_coding test_posix ====================================================================== ERROR: test_file_parse (test.test_coding.CodingTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home2/buildbot/slave/3.x.loewis-sun/build/Lib/test/test_coding.py", line 45, in test_file_parse __import__(TESTFN) ImportError: No module named @test ====================================================================== ERROR: test_getcwd_long_pathnames (test.test_posix.PosixTester) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home2/buildbot/slave/3.x.loewis-sun/build/Lib/test/test_posix.py", line 251, in test_getcwd_long_pathnames support.rmtree(base_path) File "/home2/buildbot/slave/3.x.loewis-sun/build/Lib/test/support.py", line 181, in rmtree shutil.rmtree(path) File "/home2/buildbot/slave/3.x.loewis-sun/build/Lib/shutil.py", line 239, in rmtree onerror(os.rmdir, path, sys.exc_info()) File "/home2/buildbot/slave/3.x.loewis-sun/build/Lib/shutil.py", line 237, in rmtree os.rmdir(path) OSError: [Errno 22] Invalid argument: '/home2/buildbot/slave/3.x.loewis-sun/build/@test.getcwd/@test.getcwd' sincerely, -The Buildbot From python-checkins at python.org Tue Jun 9 19:24:27 2009 From: python-checkins at python.org (benjamin.peterson) Date: Tue, 9 Jun 2009 19:24:27 +0200 (CEST) Subject: [Python-checkins] r73317 - python/trunk/Makefile.pre.in Message-ID: <20090609172427.1C9C2DCB8@mail.python.org> Author: benjamin.peterson Date: Tue Jun 9 19:24:26 2009 New Revision: 73317 Log: make ast.c depend on the grammar Modified: python/trunk/Makefile.pre.in Modified: python/trunk/Makefile.pre.in ============================================================================== --- python/trunk/Makefile.pre.in (original) +++ python/trunk/Makefile.pre.in Tue Jun 9 19:24:26 2009 @@ -541,7 +541,7 @@ $(AST_C): $(AST_ASDL) $(ASDLGEN_FILES) $(ASDLGEN) -c $(AST_C_DIR) $(AST_ASDL) -Python/compile.o Python/symtable.o: $(GRAMMAR_H) $(AST_H) +Python/compile.o Python/symtable.o Python/ast.o: $(GRAMMAR_H) $(AST_H) Python/getplatform.o: $(srcdir)/Python/getplatform.c $(CC) -c $(PY_CFLAGS) -DPLATFORM='"$(MACHDEP)"' -o $@ $(srcdir)/Python/getplatform.c From python-checkins at python.org Tue Jun 9 19:29:51 2009 From: python-checkins at python.org (benjamin.peterson) Date: Tue, 9 Jun 2009 19:29:51 +0200 (CEST) Subject: [Python-checkins] r73318 - python/trunk/Grammar/Grammar Message-ID: <20090609172951.5E77CDCFC@mail.python.org> Author: benjamin.peterson Date: Tue Jun 9 19:29:51 2009 New Revision: 73318 Log: explain why keyword names are not just NAME Modified: python/trunk/Grammar/Grammar Modified: python/trunk/Grammar/Grammar ============================================================================== --- python/trunk/Grammar/Grammar (original) +++ python/trunk/Grammar/Grammar Tue Jun 9 19:29:51 2009 @@ -133,7 +133,9 @@ arglist: (argument ',')* (argument [','] |'*' test (',' argument)* [',' '**' test] |'**' test) -argument: test [gen_for] | test '=' test # Really [keyword '='] test +# The reason that keywords are test nodes instead of NAME is that using NAME +# results in an amiguity. ast.c makes sure it's a NAME. +argument: test [gen_for] | test '=' test list_iter: list_for | list_if list_for: 'for' exprlist 'in' testlist_safe [list_iter] From buildbot at python.org Tue Jun 9 20:54:34 2009 From: buildbot at python.org (buildbot at python.org) Date: Tue, 09 Jun 2009 18:54:34 +0000 Subject: [Python-checkins] buildbot failure in x86 osx.5 trunk Message-ID: <20090609185434.CC6E2DA35@mail.python.org> The Buildbot has detected a new failure of x86 osx.5 trunk. Full details are available at: http://www.python.org/dev/buildbot/all/x86%20osx.5%20trunk/builds/1162 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: heller-x86-osx5 Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: benjamin.peterson BUILD FAILED: failed test Excerpt from the test logfile: Traceback (most recent call last): File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/threading.py", line 524, in __bootstrap_inner self.run() File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/test/test_poplib.py", line 131, in run asyncore.loop(timeout=0.1, count=1) File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/asyncore.py", line 211, in loop poll_fun(timeout, map) File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/asyncore.py", line 148, in poll read(obj) File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/asyncore.py", line 80, in read obj.handle_error() File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/asyncore.py", line 76, in read obj.handle_read_event() File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/asyncore.py", line 421, in handle_read_event self.handle_read() File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/test/test_ssl.py", line 408, in handle_read self.send(data.lower()) File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/asyncore.py", line 522, in send self.initiate_send() File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/asyncore.py", line 509, in initiate_send num_sent = dispatcher.send(self, self.out_buffer[:512]) File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/asyncore.py", line 357, in send result = self.socket.send(data) File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/socket.py", line 167, in _dummy raise error(EBADF, 'Bad file descriptor') error: [Errno 9] Bad file descriptor sincerely, -The Buildbot From python-checkins at python.org Tue Jun 9 23:01:05 2009 From: python-checkins at python.org (raymond.hettinger) Date: Tue, 9 Jun 2009 23:01:05 +0200 (CEST) Subject: [Python-checkins] r73319 - python/branches/py3k/Doc/whatsnew/3.1.rst Message-ID: <20090609210105.5FA91D707@mail.python.org> Author: raymond.hettinger Date: Tue Jun 9 23:01:05 2009 New Revision: 73319 Log: Add example for the change to pickle and note the effect of the fix_imports option. Modified: python/branches/py3k/Doc/whatsnew/3.1.rst Modified: python/branches/py3k/Doc/whatsnew/3.1.rst ============================================================================== --- python/branches/py3k/Doc/whatsnew/3.1.rst (original) +++ python/branches/py3k/Doc/whatsnew/3.1.rst Tue Jun 9 23:01:05 2009 @@ -376,6 +376,30 @@ (Contributed by Derek Morr; :issue:`1655` and :issue:`1664`.) +* The :mod:`pickle` module has been adapted for better interoperability with + Python 2.x when used with protocol 2 or lower. The reorganization of the + standard library changed the formal reference for many objects. For + example, ``__builtin__.set`` in Python 2 is called ``builtins.set`` in Python + 3. This change cofounded efforts to share data between different versions of + Python. But now when protocol 2 or lower is selected, the pickler will + automatically use the old Python 2 names for both loading and dumping. This + remapping is turned-on by default but can be disabled with the *fix_imports* + option:: + + >>> s = {1, 2, 3} + >>> pickle.dumps(s, protocol=0) + b'c__builtin__\nset\np0\n((lp1\nL1L\naL2L\naL3L\natp2\nRp3\n.' + >>> pickle.dumps(s, protocol=0, fix_imports=False) + b'cbuiltins\nset\np0\n((lp1\nL1L\naL2L\naL3L\natp2\nRp3\n.' + + An unfortunate but unavoidable side-effect of this change is that protocol 2 + pickles produced by Python 3.1 won't be readable with Python 3.0. The latest + pickle protocol, protocol 3, should be used when migrating data between + Python 3.x implementations, as it doesn't attempt to remain compatible with + Python 2.x. + + (Contributed by Alexandre Vassalotti and Antoine Pitrou, :issue:`6137`.) + * A new module, :mod:`importlib` was added. It provides a complete, portable, pure Python reference implementation of the :keyword:`import` statement and its counterpart, the :func:`__import__` function. It represents a substantial @@ -384,24 +408,6 @@ (Contributed by Brett Cannon.) -* :mod:`pickle` is now more compatible with Python 2.x when using a - 2.x-compatible protocol (that is, protocol 2 or lower), through translation - of some standard library module names to or from their Python 2.x - equivalents. - - This means that more (protocol 2 or lower) pickles produced by Python 3.1 - will be reusable by Python 2.x, and vice-versa. Standard set objects are - an example of this improvement. - - This has the (unfortunate but unavoidable) side effect that some - protocol 2 pickles produced by Python 3.1 won't be readable with - Python 3.0. The latest pickle protocol, protocol 3, should be used when - migrating data between Python 3.x implementations, as it doesn't attempt - to remain compatible with Python 2.x. - - (Contributed by Alexandre Vassalotti and Antoine Pitrou, :issue:`6137`.) - - Optimizations ============= From python-checkins at python.org Tue Jun 9 23:07:46 2009 From: python-checkins at python.org (raymond.hettinger) Date: Tue, 9 Jun 2009 23:07:46 +0200 (CEST) Subject: [Python-checkins] r73320 - python/branches/py3k/Doc/whatsnew/3.1.rst Message-ID: <20090609210746.E45B8C3DD@mail.python.org> Author: raymond.hettinger Date: Tue Jun 9 23:07:46 2009 New Revision: 73320 Log: Add notes for porting issues related to pickles. Modified: python/branches/py3k/Doc/whatsnew/3.1.rst Modified: python/branches/py3k/Doc/whatsnew/3.1.rst ============================================================================== --- python/branches/py3k/Doc/whatsnew/3.1.rst (original) +++ python/branches/py3k/Doc/whatsnew/3.1.rst Tue Jun 9 23:07:46 2009 @@ -541,3 +541,8 @@ Got: 2.718281828459045 ********************************************************************** + +* The automatic name remapping in the pickle module for protocol 2 or lower can + make Python 3.1 pickles unreadable in Python 3.0. One solution is to use + protocol 3. Another solution is to set the *fix_imports* option to **False**. + See the discussion above for more details. From python-checkins at python.org Tue Jun 9 23:13:43 2009 From: python-checkins at python.org (benjamin.peterson) Date: Tue, 9 Jun 2009 23:13:43 +0200 (CEST) Subject: [Python-checkins] r73321 - python/trunk/Lib/symbol.py Message-ID: <20090609211343.42651D7DA@mail.python.org> Author: benjamin.peterson Date: Tue Jun 9 23:13:43 2009 New Revision: 73321 Log: update symbol.py from with statement changes Modified: python/trunk/Lib/symbol.py Modified: python/trunk/Lib/symbol.py ============================================================================== --- python/trunk/Lib/symbol.py (original) +++ python/trunk/Lib/symbol.py Tue Jun 9 23:13:43 2009 @@ -52,7 +52,7 @@ for_stmt = 295 try_stmt = 296 with_stmt = 297 -with_var = 298 +with_item = 298 except_clause = 299 suite = 300 testlist_safe = 301 From python-checkins at python.org Tue Jun 9 23:30:01 2009 From: python-checkins at python.org (amaury.forgeotdarc) Date: Tue, 9 Jun 2009 23:30:01 +0200 (CEST) Subject: [Python-checkins] r73322 - in python/branches/py3k: Lib/test/test_cmd_line.py Misc/NEWS PC/getpathp.c Message-ID: <20090609213001.F21F5D641@mail.python.org> Author: amaury.forgeotdarc Date: Tue Jun 9 23:30:01 2009 New Revision: 73322 Log: #5924: on Windows, a large PYTHONPATH (more than 255 chars) was completely ignored. Will backport to 3.0. Modified: python/branches/py3k/Lib/test/test_cmd_line.py python/branches/py3k/Misc/NEWS python/branches/py3k/PC/getpathp.c Modified: python/branches/py3k/Lib/test/test_cmd_line.py ============================================================================== --- python/branches/py3k/Lib/test/test_cmd_line.py (original) +++ python/branches/py3k/Lib/test/test_cmd_line.py Tue Jun 9 23:30:01 2009 @@ -171,6 +171,16 @@ self.assertEqual(rc, 0) self.assert_(data.startswith(b'x'), data) + def test_large_PYTHONPATH(self): + with test.support.EnvironmentVarGuard() as env: + path1 = "ABCDE" * 100 + path2 = "FGHIJ" * 100 + env['PYTHONPATH'] = path1 + os.pathsep + path2 + p = _spawn_python('-S', '-c', 'import sys; print(sys.path)') + stdout, _ = p.communicate() + self.assert_(path1.encode('ascii') in stdout) + self.assert_(path2.encode('ascii') in stdout) + def test_main(): test.support.run_unittest(CmdLineTest) Modified: python/branches/py3k/Misc/NEWS ============================================================================== --- python/branches/py3k/Misc/NEWS (original) +++ python/branches/py3k/Misc/NEWS Tue Jun 9 23:30:01 2009 @@ -12,6 +12,9 @@ Core and Builtins ----------------- +- Issue #5924: On Windows, a large PYTHONPATH environment variable + (more than 255 characters) would be completely ignored. + - Issue #4547: When debugging a very large function, it was not always possible to update the lineno attribute of the current frame. Modified: python/branches/py3k/PC/getpathp.c ============================================================================== --- python/branches/py3k/PC/getpathp.c (original) +++ python/branches/py3k/PC/getpathp.c Tue Jun 9 23:30:01 2009 @@ -424,8 +424,6 @@ wchar_t *buf; size_t bufsz; wchar_t *pythonhome = Py_GetPythonHome(); - char *_envpath = Py_GETENV("PYTHONPATH"); - wchar_t wenvpath[MAXPATHLEN+1]; wchar_t *envpath = NULL; #ifdef MS_WINDOWS @@ -434,13 +432,20 @@ wchar_t *userpath = NULL; wchar_t zip_path[MAXPATHLEN+1]; size_t len; -#endif + + if (!Py_IgnoreEnvironmentFlag) { + envpath = _wgetenv(L"PYTHONPATH"); + } +#else + char *_envpath = Py_GETENV("PYTHONPATH"); + wchar_t wenvpath[MAXPATHLEN+1]; if (_envpath) { size_t r = mbstowcs(wenvpath, _envpath, MAXPATHLEN+1); envpath = wenvpath; if (r == (size_t)-1 || r >= MAXPATHLEN) envpath = NULL; } +#endif get_progpath(); /* progpath guaranteed \0 terminated in MAXPATH+1 bytes. */ From python-checkins at python.org Tue Jun 9 23:31:38 2009 From: python-checkins at python.org (amaury.forgeotdarc) Date: Tue, 9 Jun 2009 23:31:38 +0200 (CEST) Subject: [Python-checkins] r73323 - in python/branches/release30-maint: Lib/test/test_cmd_line.py Misc/NEWS PC/getpathp.c Message-ID: <20090609213138.9EABEDD88@mail.python.org> Author: amaury.forgeotdarc Date: Tue Jun 9 23:31:38 2009 New Revision: 73323 Log: Merged revisions 73322 via svnmerge from svn+ssh://pythondev at svn.python.org/python/branches/py3k ........ r73322 | amaury.forgeotdarc | 2009-06-09 23:30:01 +0200 (mar., 09 juin 2009) | 4 lines #5924: on Windows, a large PYTHONPATH (more than 255 chars) was completely ignored. Will backport to 3.0. ........ Modified: python/branches/release30-maint/ (props changed) python/branches/release30-maint/Lib/test/test_cmd_line.py python/branches/release30-maint/Misc/NEWS python/branches/release30-maint/PC/getpathp.c Modified: python/branches/release30-maint/Lib/test/test_cmd_line.py ============================================================================== --- python/branches/release30-maint/Lib/test/test_cmd_line.py (original) +++ python/branches/release30-maint/Lib/test/test_cmd_line.py Tue Jun 9 23:31:38 2009 @@ -169,6 +169,16 @@ self.assertEqual(rc, 0) self.assert_(data.startswith(b'x'), data) + def test_large_PYTHONPATH(self): + with test.support.EnvironmentVarGuard() as env: + path1 = "ABCDE" * 100 + path2 = "FGHIJ" * 100 + env['PYTHONPATH'] = path1 + os.pathsep + path2 + p = _spawn_python('-S', '-c', 'import sys; print(sys.path)') + stdout, _ = p.communicate() + self.assert_(path1.encode('ascii') in stdout) + self.assert_(path2.encode('ascii') in stdout) + def test_main(): test.support.run_unittest(CmdLineTest) Modified: python/branches/release30-maint/Misc/NEWS ============================================================================== --- python/branches/release30-maint/Misc/NEWS (original) +++ python/branches/release30-maint/Misc/NEWS Tue Jun 9 23:31:38 2009 @@ -12,6 +12,9 @@ Core and Builtins ----------------- +- Issue #5924: On Windows, a large PYTHONPATH environment variable + (more than 255 characters) would be completely ignored. + - Issue #4547: When debugging a very large function, it was not always possible to update the lineno attribute of the current frame. Modified: python/branches/release30-maint/PC/getpathp.c ============================================================================== --- python/branches/release30-maint/PC/getpathp.c (original) +++ python/branches/release30-maint/PC/getpathp.c Tue Jun 9 23:31:38 2009 @@ -424,8 +424,6 @@ wchar_t *buf; size_t bufsz; wchar_t *pythonhome = Py_GetPythonHome(); - char *_envpath = Py_GETENV("PYTHONPATH"); - wchar_t wenvpath[MAXPATHLEN+1]; wchar_t *envpath = NULL; #ifdef MS_WINDOWS @@ -434,13 +432,20 @@ wchar_t *userpath = NULL; wchar_t zip_path[MAXPATHLEN+1]; size_t len; -#endif + + if (!Py_IgnoreEnvironmentFlag) { + envpath = _wgetenv(L"PYTHONPATH"); + } +#else + char *_envpath = Py_GETENV("PYTHONPATH"); + wchar_t wenvpath[MAXPATHLEN+1]; if (_envpath) { size_t r = mbstowcs(wenvpath, _envpath, MAXPATHLEN+1); envpath = wenvpath; if (r == (size_t)-1 || r >= MAXPATHLEN) envpath = NULL; } +#endif get_progpath(); /* progpath guaranteed \0 terminated in MAXPATH+1 bytes. */ From buildbot at python.org Tue Jun 9 23:44:48 2009 From: buildbot at python.org (buildbot at python.org) Date: Tue, 09 Jun 2009 21:44:48 +0000 Subject: [Python-checkins] buildbot failure in OS X x86 trunk Message-ID: <20090609214448.F1FD5D743@mail.python.org> The Buildbot has detected a new failure of OS X x86 trunk. Full details are available at: http://www.python.org/dev/buildbot/all/OS%20X%20x86%20trunk/builds/664 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: noller-osx86 Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: benjamin.peterson BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_curses Traceback (most recent call last): File "./Lib/test/regrtest.py", line 652, in runtest_inner the_package = __import__(abstest, globals(), locals(), []) File "/Users/buildbot/buildarea/trunk.noller-osx86/build/Lib/test/test_curses.py", line 26, in raise unittest.SkipTest, "$TERM=%r, calling initscr() may cause exit" % term NameError: name 'unittest' is not defined make: *** [buildbottest] Error 1 sincerely, -The Buildbot From buildbot at python.org Wed Jun 10 00:27:14 2009 From: buildbot at python.org (buildbot at python.org) Date: Tue, 09 Jun 2009 22:27:14 +0000 Subject: [Python-checkins] buildbot failure in amd64 gentoo 3.0 Message-ID: <20090609222715.00C05DED2@mail.python.org> The Buildbot has detected a new failure of amd64 gentoo 3.0. Full details are available at: http://www.python.org/dev/buildbot/all/amd64%20gentoo%203.0/builds/58 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: norwitz-amd64 Build Reason: Build Source Stamp: [branch branches/release30-maint] HEAD Blamelist: amaury.forgeotdarc BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_cmd_line ====================================================================== ERROR: test_large_PYTHONPATH (test.test_cmd_line.CmdLineTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/buildbot/slave/py-build/3.0.norwitz-amd64/build/Lib/test/test_cmd_line.py", line 176, in test_large_PYTHONPATH env['PYTHONPATH'] = path1 + os.pathsep + path2 TypeError: 'EnvironmentVarGuard' object does not support item assignment make: *** [buildbottest] Error 1 sincerely, -The Buildbot From python-checkins at python.org Wed Jun 10 00:53:17 2009 From: python-checkins at python.org (amaury.forgeotdarc) Date: Wed, 10 Jun 2009 00:53:17 +0200 (CEST) Subject: [Python-checkins] r73324 - python/trunk/Lib/os.py Message-ID: <20090609225317.19A2CDD5A@mail.python.org> Author: amaury.forgeotdarc Date: Wed Jun 10 00:53:16 2009 New Revision: 73324 Log: Avoid invoking the parser/compiler just to test the presence of a function. Modified: python/trunk/Lib/os.py Modified: python/trunk/Lib/os.py ============================================================================== --- python/trunk/Lib/os.py (original) +++ python/trunk/Lib/os.py Wed Jun 10 00:53:16 2009 @@ -514,11 +514,7 @@ __all__.append("getenv") def _exists(name): - try: - eval(name) - return True - except NameError: - return False + return name in globals() # Supply spawn*() (probably only for Unix) if _exists("fork") and not _exists("spawnv") and _exists("execv"): From python-checkins at python.org Wed Jun 10 01:08:13 2009 From: python-checkins at python.org (amaury.forgeotdarc) Date: Wed, 10 Jun 2009 01:08:13 +0200 (CEST) Subject: [Python-checkins] r73325 - in python/trunk: Doc/whatsnew/2.7.rst PC/_winreg.c Message-ID: <20090609230813.A62A0DDB4@mail.python.org> Author: amaury.forgeotdarc Date: Wed Jun 10 01:08:13 2009 New Revision: 73325 Log: #6201: Fix test_winreg on Windows: since the introduction of the SETUP_WITH opcode, __enter__ and __exit__ methods must belong to the type, and are not retrieved at the instance level (__dict__ or __getattr__). Add a note in whatsnew about this incompatibility; old style classes are not affected. Modified: python/trunk/Doc/whatsnew/2.7.rst python/trunk/PC/_winreg.c Modified: python/trunk/Doc/whatsnew/2.7.rst ============================================================================== --- python/trunk/Doc/whatsnew/2.7.rst (original) +++ python/trunk/Doc/whatsnew/2.7.rst Wed Jun 10 01:08:13 2009 @@ -669,7 +669,11 @@ This section lists previously described changes and other bugfixes that may require changes to your code: -To be written. +* Because of an optimization for the :keyword:`with` statement, the special + methods :meth:`__enter__` and :meth:`__exit__` must belong to the object's + type, and cannot be directly attached to the object's instance. This + affects new-styles classes (derived from :class:`object`) or C extension + types. (:issue:`6101`.) .. ====================================================================== Modified: python/trunk/PC/_winreg.c ============================================================================== --- python/trunk/PC/_winreg.c (original) +++ python/trunk/PC/_winreg.c Wed Jun 10 01:08:13 2009 @@ -469,9 +469,23 @@ PyHKEY_unaryFailureFunc, /* nb_hex */ }; +static PyObject *PyHKEY_CloseMethod(PyObject *self, PyObject *args); +static PyObject *PyHKEY_DetachMethod(PyObject *self, PyObject *args); +static PyObject *PyHKEY_Enter(PyObject *self); +static PyObject *PyHKEY_Exit(PyObject *self, PyObject *args); -/* fwd declare __getattr__ */ -static PyObject *PyHKEY_getattr(PyObject *self, const char *name); +static struct PyMethodDef PyHKEY_methods[] = { + {"Close", PyHKEY_CloseMethod, METH_VARARGS, PyHKEY_Close_doc}, + {"Detach", PyHKEY_DetachMethod, METH_VARARGS, PyHKEY_Detach_doc}, + {"__enter__", (PyCFunction)PyHKEY_Enter, METH_NOARGS, NULL}, + {"__exit__", PyHKEY_Exit, METH_VARARGS, NULL}, + {NULL} +}; + +static PyMemberDef PyHKEY_memberlist[] = { + {"handle", T_PYSSIZET, offsetof(PyHKEYObject, hkey), READONLY}, + {NULL} /* Sentinel */ +}; /* The type itself */ PyTypeObject PyHKEY_Type = @@ -482,7 +496,7 @@ 0, PyHKEY_deallocFunc, /* tp_dealloc */ PyHKEY_printFunc, /* tp_print */ - PyHKEY_getattr, /* tp_getattr */ + 0, /* tp_getattr */ 0, /* tp_setattr */ PyHKEY_compareFunc, /* tp_compare */ 0, /* tp_repr */ @@ -495,15 +509,16 @@ 0, /* tp_getattro */ 0, /* tp_setattro */ 0, /* tp_as_buffer */ - 0, /* tp_flags */ + Py_TPFLAGS_DEFAULT, /* tp_flags */ PyHKEY_doc, /* tp_doc */ -}; - -#define OFF(e) offsetof(PyHKEYObject, e) - -static struct memberlist PyHKEY_memberlist[] = { - {"handle", T_INT, OFF(hkey)}, - {NULL} /* Sentinel */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + PyHKEY_methods, /* tp_methods */ + PyHKEY_memberlist, /* tp_members */ }; /************************************************************************ @@ -550,28 +565,6 @@ } -static struct PyMethodDef PyHKEY_methods[] = { - {"Close", PyHKEY_CloseMethod, METH_VARARGS, PyHKEY_Close_doc}, - {"Detach", PyHKEY_DetachMethod, METH_VARARGS, PyHKEY_Detach_doc}, - {"__enter__", (PyCFunction)PyHKEY_Enter, METH_NOARGS, NULL}, - {"__exit__", PyHKEY_Exit, METH_VARARGS, NULL}, - {NULL} -}; - -/*static*/ PyObject * -PyHKEY_getattr(PyObject *self, const char *name) -{ - PyObject *res; - - res = Py_FindMethod(PyHKEY_methods, self, name); - if (res != NULL) - return res; - PyErr_Clear(); - if (strcmp(name, "handle") == 0) - return PyLong_FromVoidPtr(((PyHKEYObject *)self)->hkey); - return PyMember_Get((char *)self, PyHKEY_memberlist, name); -} - /************************************************************************ The public PyHKEY API (well, not public yet :-) ************************************************************************/ @@ -1634,7 +1627,8 @@ if (m == NULL) return; d = PyModule_GetDict(m); - PyHKEY_Type.ob_type = &PyType_Type; + if (PyType_Ready(&PyHKEY_Type) < 0) + return; PyHKEY_Type.tp_doc = PyHKEY_doc; Py_INCREF(&PyHKEY_Type); if (PyDict_SetItemString(d, "HKEYType", From python-checkins at python.org Wed Jun 10 01:18:50 2009 From: python-checkins at python.org (amaury.forgeotdarc) Date: Wed, 10 Jun 2009 01:18:50 +0200 (CEST) Subject: [Python-checkins] r73326 - python/trunk/Doc/whatsnew/2.7.rst Message-ID: <20090609231850.C56C4DAA9@mail.python.org> Author: amaury.forgeotdarc Date: Wed Jun 10 01:18:50 2009 New Revision: 73326 Log: Both kind of types are concerned. Modified: python/trunk/Doc/whatsnew/2.7.rst Modified: python/trunk/Doc/whatsnew/2.7.rst ============================================================================== --- python/trunk/Doc/whatsnew/2.7.rst (original) +++ python/trunk/Doc/whatsnew/2.7.rst Wed Jun 10 01:18:50 2009 @@ -672,7 +672,7 @@ * Because of an optimization for the :keyword:`with` statement, the special methods :meth:`__enter__` and :meth:`__exit__` must belong to the object's type, and cannot be directly attached to the object's instance. This - affects new-styles classes (derived from :class:`object`) or C extension + affects new-styles classes (derived from :class:`object`) and C extension types. (:issue:`6101`.) .. ====================================================================== From python-checkins at python.org Wed Jun 10 01:21:02 2009 From: python-checkins at python.org (amaury.forgeotdarc) Date: Wed, 10 Jun 2009 01:21:02 +0200 (CEST) Subject: [Python-checkins] r73327 - python/branches/py3k Message-ID: <20090609232102.0DA85C4AC@mail.python.org> Author: amaury.forgeotdarc Date: Wed Jun 10 01:21:01 2009 New Revision: 73327 Log: Blocked revisions 73325-73326 via svnmerge ........ r73325 | amaury.forgeotdarc | 2009-06-10 01:08:13 +0200 (mer., 10 juin 2009) | 8 lines #6201: Fix test_winreg on Windows: since the introduction of the SETUP_WITH opcode, __enter__ and __exit__ methods must belong to the type, and are not retrieved at the instance level (__dict__ or __getattr__). Add a note in whatsnew about this incompatibility; old style classes are not affected. ........ r73326 | amaury.forgeotdarc | 2009-06-10 01:18:50 +0200 (mer., 10 juin 2009) | 2 lines Both kind of types are concerned. ........ Modified: python/branches/py3k/ (props changed) From python-checkins at python.org Wed Jun 10 01:37:11 2009 From: python-checkins at python.org (amaury.forgeotdarc) Date: Wed, 10 Jun 2009 01:37:11 +0200 (CEST) Subject: [Python-checkins] r73328 - python/trunk/Lib/test/test_curses.py Message-ID: <20090609233711.70B9ADB36@mail.python.org> Author: amaury.forgeotdarc Date: Wed Jun 10 01:37:11 2009 New Revision: 73328 Log: Missing import in test_curses, uncovered by some buildbots. (There are still a few test files that don't use the standard layout) Modified: python/trunk/Lib/test/test_curses.py Modified: python/trunk/Lib/test/test_curses.py ============================================================================== --- python/trunk/Lib/test/test_curses.py (original) +++ python/trunk/Lib/test/test_curses.py Wed Jun 10 01:37:11 2009 @@ -15,6 +15,7 @@ # 'curses' resource be given on the regrtest command line using the -u # option. If not available, nothing after this line will be executed. +import unittest from test.test_support import requires, import_module requires('curses') curses = import_module('curses') From python-checkins at python.org Wed Jun 10 01:45:08 2009 From: python-checkins at python.org (amaury.forgeotdarc) Date: Wed, 10 Jun 2009 01:45:08 +0200 (CEST) Subject: [Python-checkins] r73329 - python/branches/release30-maint/Lib/test/test_cmd_line.py Message-ID: <20090609234508.7ED6AEEA19@mail.python.org> Author: amaury.forgeotdarc Date: Wed Jun 10 01:45:08 2009 New Revision: 73329 Log: 3.0: EnvironmentVarGuard doesn't implemement the mapping protocol. Modified: python/branches/release30-maint/Lib/test/test_cmd_line.py Modified: python/branches/release30-maint/Lib/test/test_cmd_line.py ============================================================================== --- python/branches/release30-maint/Lib/test/test_cmd_line.py (original) +++ python/branches/release30-maint/Lib/test/test_cmd_line.py Wed Jun 10 01:45:08 2009 @@ -173,7 +173,7 @@ with test.support.EnvironmentVarGuard() as env: path1 = "ABCDE" * 100 path2 = "FGHIJ" * 100 - env['PYTHONPATH'] = path1 + os.pathsep + path2 + env.set('PYTHONPATH', path1 + os.pathsep + path2) p = _spawn_python('-S', '-c', 'import sys; print(sys.path)') stdout, _ = p.communicate() self.assert_(path1.encode('ascii') in stdout) From python-checkins at python.org Wed Jun 10 01:51:56 2009 From: python-checkins at python.org (amaury.forgeotdarc) Date: Wed, 10 Jun 2009 01:51:56 +0200 (CEST) Subject: [Python-checkins] r73330 - in python/branches/py3k: Lib/test/test_curses.py Message-ID: <20090609235156.64B54DAF8@mail.python.org> Author: amaury.forgeotdarc Date: Wed Jun 10 01:51:56 2009 New Revision: 73330 Log: Merged revisions 73328 via svnmerge from svn+ssh://pythondev at svn.python.org/python/trunk ........ r73328 | amaury.forgeotdarc | 2009-06-10 01:37:11 +0200 (mer., 10 juin 2009) | 3 lines Missing import in test_curses, uncovered by some buildbots. (There are still a few test files that don't use the standard layout) ........ Modified: python/branches/py3k/ (props changed) python/branches/py3k/Lib/test/test_curses.py Modified: python/branches/py3k/Lib/test/test_curses.py ============================================================================== --- python/branches/py3k/Lib/test/test_curses.py (original) +++ python/branches/py3k/Lib/test/test_curses.py Wed Jun 10 01:51:56 2009 @@ -15,6 +15,7 @@ # 'curses' resource be given on the regrtest command line using the -u # option. If not available, nothing after this line will be executed. +import unittest from test.support import requires, import_module requires('curses') From buildbot at python.org Wed Jun 10 02:09:52 2009 From: buildbot at python.org (buildbot at python.org) Date: Wed, 10 Jun 2009 00:09:52 +0000 Subject: [Python-checkins] buildbot failure in sparc solaris10 gcc 3.0 Message-ID: <20090610000953.04B6BDA85@mail.python.org> The Buildbot has detected a new failure of sparc solaris10 gcc 3.0. Full details are available at: http://www.python.org/dev/buildbot/all/sparc%20solaris10%20gcc%203.0/builds/401 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: loewis-sun Build Reason: Build Source Stamp: [branch branches/release30-maint] HEAD Blamelist: amaury.forgeotdarc BUILD FAILED: failed test Excerpt from the test logfile: 3 tests failed: test_cmd_line test_posix test_subprocess ====================================================================== ERROR: test_large_PYTHONPATH (test.test_cmd_line.CmdLineTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home2/buildbot/slave/3.0.loewis-sun/build/Lib/test/test_cmd_line.py", line 176, in test_large_PYTHONPATH env['PYTHONPATH'] = path1 + os.pathsep + path2 TypeError: 'EnvironmentVarGuard' object does not support item assignment ====================================================================== ERROR: test_getcwd_long_pathnames (test.test_posix.PosixTester) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home2/buildbot/slave/3.0.loewis-sun/build/Lib/test/test_posix.py", line 252, in test_getcwd_long_pathnames support.rmtree(base_path) File "/home2/buildbot/slave/3.0.loewis-sun/build/Lib/test/support.py", line 98, in rmtree shutil.rmtree(path) File "/home2/buildbot/slave/3.0.loewis-sun/build/Lib/shutil.py", line 225, in rmtree onerror(os.rmdir, path, sys.exc_info()) File "/home2/buildbot/slave/3.0.loewis-sun/build/Lib/shutil.py", line 223, in rmtree os.rmdir(path) OSError: [Errno 22] Invalid argument: '/home2/buildbot/slave/3.0.loewis-sun/build/@test.getcwd/@test.getcwd' ====================================================================== FAIL: test_executable (test.test_subprocess.ProcessTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home2/buildbot/slave/3.0.loewis-sun/build/Lib/test/test_subprocess.py", line 115, in test_executable self.assertEqual(p.returncode, 47) AssertionError: -6 != 47 sincerely, -The Buildbot From buildbot at python.org Wed Jun 10 03:52:52 2009 From: buildbot at python.org (buildbot at python.org) Date: Wed, 10 Jun 2009 01:52:52 +0000 Subject: [Python-checkins] buildbot failure in sparc solaris10 gcc 3.x Message-ID: <20090610015252.73BAFDA56@mail.python.org> The Buildbot has detected a new failure of sparc solaris10 gcc 3.x. Full details are available at: http://www.python.org/dev/buildbot/all/sparc%20solaris10%20gcc%203.x/builds/809 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: loewis-sun Build Reason: Build Source Stamp: [branch branches/py3k] HEAD Blamelist: amaury.forgeotdarc BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_posix ====================================================================== ERROR: test_getcwd_long_pathnames (test.test_posix.PosixTester) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home2/buildbot/slave/3.x.loewis-sun/build/Lib/test/test_posix.py", line 251, in test_getcwd_long_pathnames support.rmtree(base_path) File "/home2/buildbot/slave/3.x.loewis-sun/build/Lib/test/support.py", line 181, in rmtree shutil.rmtree(path) File "/home2/buildbot/slave/3.x.loewis-sun/build/Lib/shutil.py", line 239, in rmtree onerror(os.rmdir, path, sys.exc_info()) File "/home2/buildbot/slave/3.x.loewis-sun/build/Lib/shutil.py", line 237, in rmtree os.rmdir(path) OSError: [Errno 22] Invalid argument: '/home2/buildbot/slave/3.x.loewis-sun/build/@test.getcwd/@test.getcwd' sincerely, -The Buildbot From ncoghlan at gmail.com Wed Jun 10 13:43:13 2009 From: ncoghlan at gmail.com (Nick Coghlan) Date: Wed, 10 Jun 2009 21:43:13 +1000 Subject: [Python-checkins] r73319 - python/branches/py3k/Doc/whatsnew/3.1.rst In-Reply-To: <20090609210105.5FA91D707@mail.python.org> References: <20090609210105.5FA91D707@mail.python.org> Message-ID: <4A2F9C51.10000@gmail.com> raymond.hettinger wrote: > Author: raymond.hettinger > Date: Tue Jun 9 23:01:05 2009 > New Revision: 73319 > > Log: > Add example for the change to pickle and note the effect of the fix_imports option. > > Modified: > python/branches/py3k/Doc/whatsnew/3.1.rst > > Modified: python/branches/py3k/Doc/whatsnew/3.1.rst > ============================================================================== > --- python/branches/py3k/Doc/whatsnew/3.1.rst (original) > +++ python/branches/py3k/Doc/whatsnew/3.1.rst Tue Jun 9 23:01:05 2009 > @@ -376,6 +376,30 @@ > > (Contributed by Derek Morr; :issue:`1655` and :issue:`1664`.) > > +* The :mod:`pickle` module has been adapted for better interoperability with > + Python 2.x when used with protocol 2 or lower. The reorganization of the > + standard library changed the formal reference for many objects. For > + example, ``__builtin__.set`` in Python 2 is called ``builtins.set`` in Python > + 3. This change cofounded efforts to share data between different versions of ^^^^^^^^^ Missing the 'n' from confounded. Cheers, Nick. -- Nick Coghlan | ncoghlan at gmail.com | Brisbane, Australia --------------------------------------------------------------- From ncoghlan at gmail.com Wed Jun 10 13:44:00 2009 From: ncoghlan at gmail.com (Nick Coghlan) Date: Wed, 10 Jun 2009 21:44:00 +1000 Subject: [Python-checkins] r73318 - python/trunk/Grammar/Grammar In-Reply-To: <20090609172951.5E77CDCFC@mail.python.org> References: <20090609172951.5E77CDCFC@mail.python.org> Message-ID: <4A2F9C80.6090108@gmail.com> benjamin.peterson wrote: > Author: benjamin.peterson > Date: Tue Jun 9 19:29:51 2009 > New Revision: 73318 > > Log: > explain why keyword names are not just NAME > > Modified: > python/trunk/Grammar/Grammar > > Modified: python/trunk/Grammar/Grammar > ============================================================================== > --- python/trunk/Grammar/Grammar (original) > +++ python/trunk/Grammar/Grammar Tue Jun 9 19:29:51 2009 > @@ -133,7 +133,9 @@ > arglist: (argument ',')* (argument [','] > |'*' test (',' argument)* [',' '**' test] > |'**' test) > -argument: test [gen_for] | test '=' test # Really [keyword '='] test > +# The reason that keywords are test nodes instead of NAME is that using NAME > +# results in an amiguity. ast.c makes sure it's a NAME. ^^^^^^^^ Missing the 'b' from ambiguity. Cheers, Nick. -- Nick Coghlan | ncoghlan at gmail.com | Brisbane, Australia --------------------------------------------------------------- From ncoghlan at gmail.com Wed Jun 10 13:45:56 2009 From: ncoghlan at gmail.com (Nick Coghlan) Date: Wed, 10 Jun 2009 21:45:56 +1000 Subject: [Python-checkins] r73326 - python/trunk/Doc/whatsnew/2.7.rst In-Reply-To: <20090609231850.C56C4DAA9@mail.python.org> References: <20090609231850.C56C4DAA9@mail.python.org> Message-ID: <4A2F9CF4.7080209@gmail.com> amaury.forgeotdarc wrote: > Modified: python/trunk/Doc/whatsnew/2.7.rst > ============================================================================== > --- python/trunk/Doc/whatsnew/2.7.rst (original) > +++ python/trunk/Doc/whatsnew/2.7.rst Wed Jun 10 01:18:50 2009 > @@ -672,7 +672,7 @@ > * Because of an optimization for the :keyword:`with` statement, the special > methods :meth:`__enter__` and :meth:`__exit__` must belong to the object's > type, and cannot be directly attached to the object's instance. This > - affects new-styles classes (derived from :class:`object`) or C extension > + affects new-styles classes (derived from :class:`object`) and C extension ^ And to round out tonight's trio of typos, an unintended 's' here. Cheers, Nick. -- Nick Coghlan | ncoghlan at gmail.com | Brisbane, Australia --------------------------------------------------------------- From python-checkins at python.org Wed Jun 10 15:45:32 2009 From: python-checkins at python.org (benjamin.peterson) Date: Wed, 10 Jun 2009 15:45:32 +0200 (CEST) Subject: [Python-checkins] r73331 - python/trunk/Grammar/Grammar Message-ID: <20090610134532.1F0DADCAC@mail.python.org> Author: benjamin.peterson Date: Wed Jun 10 15:45:31 2009 New Revision: 73331 Log: fix spelling Modified: python/trunk/Grammar/Grammar Modified: python/trunk/Grammar/Grammar ============================================================================== --- python/trunk/Grammar/Grammar (original) +++ python/trunk/Grammar/Grammar Wed Jun 10 15:45:31 2009 @@ -134,7 +134,7 @@ |'*' test (',' argument)* [',' '**' test] |'**' test) # The reason that keywords are test nodes instead of NAME is that using NAME -# results in an amiguity. ast.c makes sure it's a NAME. +# results in an ambiguity. ast.c makes sure it's a NAME. argument: test [gen_for] | test '=' test list_iter: list_for | list_if From rdmurray at bitdance.com Wed Jun 10 15:56:58 2009 From: rdmurray at bitdance.com (R. David Murray) Date: Wed, 10 Jun 2009 09:56:58 -0400 (EDT) Subject: [Python-checkins] r73326 - python/trunk/Doc/whatsnew/2.7.rst In-Reply-To: <4A2F9CF4.7080209@gmail.com> References: <20090609231850.C56C4DAA9@mail.python.org> <4A2F9CF4.7080209@gmail.com> Message-ID: On Wed, 10 Jun 2009 at 21:45, Nick Coghlan wrote: > amaury.forgeotdarc wrote: >> Modified: python/trunk/Doc/whatsnew/2.7.rst >> ============================================================================== >> --- python/trunk/Doc/whatsnew/2.7.rst (original) >> +++ python/trunk/Doc/whatsnew/2.7.rst Wed Jun 10 01:18:50 2009 >> @@ -672,7 +672,7 @@ >> * Because of an optimization for the :keyword:`with` statement, the special >> methods :meth:`__enter__` and :meth:`__exit__` must belong to the object's >> type, and cannot be directly attached to the object's instance. This >> - affects new-styles classes (derived from :class:`object`) or C extension >> + affects new-styles classes (derived from :class:`object`) and C extension > ^ > > And to round out tonight's trio of typos, an unintended 's' here. Unless I'm remembering wrong, the introduction of the with opcode was actually done _so that_ __enter__ and __exit__ would be looked up only on the object's type. That is, the cause and effect implied by your statement is the reverse of what happened, Amaury :). The optimization was a side benefit. The reason this was done, IIUC, is that at some point Guido decreed that all special methods should be looked up on the type, and Benjamin went through the code base and made that consistently true. There are several other special methods for which this changed in 3.1, not just __enter__ and __exit__. You'd have to check the commit logs or talk to Benjamin for a list. --David From python-checkins at python.org Wed Jun 10 17:38:52 2009 From: python-checkins at python.org (raymond.hettinger) Date: Wed, 10 Jun 2009 17:38:52 +0200 (CEST) Subject: [Python-checkins] r73332 - python/branches/py3k/Doc/whatsnew/3.1.rst Message-ID: <20090610153852.E9B87D32A@mail.python.org> Author: raymond.hettinger Date: Wed Jun 10 17:38:52 2009 New Revision: 73332 Log: Fix funny typo. Modified: python/branches/py3k/Doc/whatsnew/3.1.rst Modified: python/branches/py3k/Doc/whatsnew/3.1.rst ============================================================================== --- python/branches/py3k/Doc/whatsnew/3.1.rst (original) +++ python/branches/py3k/Doc/whatsnew/3.1.rst Wed Jun 10 17:38:52 2009 @@ -380,7 +380,7 @@ Python 2.x when used with protocol 2 or lower. The reorganization of the standard library changed the formal reference for many objects. For example, ``__builtin__.set`` in Python 2 is called ``builtins.set`` in Python - 3. This change cofounded efforts to share data between different versions of + 3. This change confounded efforts to share data between different versions of Python. But now when protocol 2 or lower is selected, the pickler will automatically use the old Python 2 names for both loading and dumping. This remapping is turned-on by default but can be disabled with the *fix_imports* From python-checkins at python.org Wed Jun 10 18:13:42 2009 From: python-checkins at python.org (raymond.hettinger) Date: Wed, 10 Jun 2009 18:13:42 +0200 (CEST) Subject: [Python-checkins] r73333 - python/branches/py3k/Lib/contextlib.py Message-ID: <20090610161342.D2C26DAEC@mail.python.org> Author: raymond.hettinger Date: Wed Jun 10 18:13:42 2009 New Revision: 73333 Log: Issue 6256: Fix stacklevel in warning message. Modified: python/branches/py3k/Lib/contextlib.py Modified: python/branches/py3k/Lib/contextlib.py ============================================================================== --- python/branches/py3k/Lib/contextlib.py (original) +++ python/branches/py3k/Lib/contextlib.py Wed Jun 10 18:13:42 2009 @@ -103,7 +103,7 @@ """ warn("With-statements now directly support multiple context managers", - DeprecationWarning, 2) + DeprecationWarning, 3) exits = [] vars = [] exc = (None, None, None) From python-checkins at python.org Wed Jun 10 18:15:02 2009 From: python-checkins at python.org (raymond.hettinger) Date: Wed, 10 Jun 2009 18:15:02 +0200 (CEST) Subject: [Python-checkins] r73334 - python/trunk/Lib/contextlib.py Message-ID: <20090610161502.A1470DBBF@mail.python.org> Author: raymond.hettinger Date: Wed Jun 10 18:15:02 2009 New Revision: 73334 Log: Issue 6256: Fix stacklevel in warning message. Modified: python/trunk/Lib/contextlib.py Modified: python/trunk/Lib/contextlib.py ============================================================================== --- python/trunk/Lib/contextlib.py (original) +++ python/trunk/Lib/contextlib.py Wed Jun 10 18:15:02 2009 @@ -103,7 +103,7 @@ """ warn("With-statements now directly support multiple context managers", - DeprecationWarning, 2) + DeprecationWarning, 3) exits = [] vars = [] exc = (None, None, None) From python-checkins at python.org Wed Jun 10 18:15:40 2009 From: python-checkins at python.org (raymond.hettinger) Date: Wed, 10 Jun 2009 18:15:40 +0200 (CEST) Subject: [Python-checkins] r73335 - python/trunk/Modules/audioop.c Message-ID: <20090610161540.B2769DBC2@mail.python.org> Author: raymond.hettinger Date: Wed Jun 10 18:15:40 2009 New Revision: 73335 Log: Fix signed/unsigned compiler warning. Modified: python/trunk/Modules/audioop.c Modified: python/trunk/Modules/audioop.c ============================================================================== --- python/trunk/Modules/audioop.c (original) +++ python/trunk/Modules/audioop.c Wed Jun 10 18:15:40 2009 @@ -1116,7 +1116,7 @@ outrate /= d; alloc_size = sizeof(int) * (unsigned)nchannels; - if (alloc_size < nchannels) { + if (alloc_size < (unsigned)nchannels) { PyErr_SetString(PyExc_MemoryError, "not enough memory for output buffer"); return 0; From buildbot at python.org Wed Jun 10 18:58:38 2009 From: buildbot at python.org (buildbot at python.org) Date: Wed, 10 Jun 2009 16:58:38 +0000 Subject: [Python-checkins] buildbot failure in OS X x86 trunk Message-ID: <20090610165838.B31DDDBCF@mail.python.org> The Buildbot has detected a new failure of OS X x86 trunk. Full details are available at: http://www.python.org/dev/buildbot/all/OS%20X%20x86%20trunk/builds/669 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: noller-osx86 Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: raymond.hettinger BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_platform make: *** [buildbottest] Error 1 sincerely, -The Buildbot From buildbot at python.org Wed Jun 10 19:02:41 2009 From: buildbot at python.org (buildbot at python.org) Date: Wed, 10 Jun 2009 17:02:41 +0000 Subject: [Python-checkins] buildbot failure in sparc solaris10 gcc 3.x Message-ID: <20090610170241.A6C0DDA3F@mail.python.org> The Buildbot has detected a new failure of sparc solaris10 gcc 3.x. Full details are available at: http://www.python.org/dev/buildbot/all/sparc%20solaris10%20gcc%203.x/builds/811 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: loewis-sun Build Reason: Build Source Stamp: [branch branches/py3k] HEAD Blamelist: raymond.hettinger BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_posix ====================================================================== ERROR: test_getcwd_long_pathnames (test.test_posix.PosixTester) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home2/buildbot/slave/3.x.loewis-sun/build/Lib/test/test_posix.py", line 251, in test_getcwd_long_pathnames support.rmtree(base_path) File "/home2/buildbot/slave/3.x.loewis-sun/build/Lib/test/support.py", line 181, in rmtree shutil.rmtree(path) File "/home2/buildbot/slave/3.x.loewis-sun/build/Lib/shutil.py", line 239, in rmtree onerror(os.rmdir, path, sys.exc_info()) File "/home2/buildbot/slave/3.x.loewis-sun/build/Lib/shutil.py", line 237, in rmtree os.rmdir(path) OSError: [Errno 22] Invalid argument: '/home2/buildbot/slave/3.x.loewis-sun/build/@test.getcwd/@test.getcwd' sincerely, -The Buildbot From buildbot at python.org Wed Jun 10 20:02:43 2009 From: buildbot at python.org (buildbot at python.org) Date: Wed, 10 Jun 2009 18:02:43 +0000 Subject: [Python-checkins] buildbot failure in x86 XP-4 3.x Message-ID: <20090610180243.EE54DDEA3@mail.python.org> The Buildbot has detected a new failure of x86 XP-4 3.x. Full details are available at: http://www.python.org/dev/buildbot/all/x86%20XP-4%203.x/builds/678 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: bolen-windows Build Reason: Build Source Stamp: [branch branches/py3k] HEAD Blamelist: raymond.hettinger BUILD FAILED: failed test Excerpt from the test logfile: Traceback (most recent call last): File "E:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\test\test_import.py", line 63, in test_with_extension self.fail("import from %s failed: %s" % (ext, err)) File "E:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\unittest.py", line 540, in fail raise self.failureException(msg) AssertionError: import from .PY failed: No module named @test Traceback (most recent call last): File "E:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\test\test_import.py", line 80, in testImport test_with_extension(ext) File "E:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\test\test_import.py", line 73, in test_with_extension del sys.modules[TESTFN] KeyError: '@test' 1 test failed: test_import ====================================================================== ERROR: testImport (test.test_import.ImportTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "E:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\test\test_import.py", line 61, in test_with_extension mod = __import__(TESTFN) ImportError: No module named @test Traceback (most recent call last): File "E:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\test\test_import.py", line 63, in test_with_extension self.fail("import from %s failed: %s" % (ext, err)) File "E:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\unittest.py", line 540, in fail raise self.failureException(msg) AssertionError: import from .PY failed: No module named @test Traceback (most recent call last): File "E:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\test\test_import.py", line 80, in testImport test_with_extension(ext) File "E:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\test\test_import.py", line 73, in test_with_extension del sys.modules[TESTFN] KeyError: '@test' Traceback (most recent call last): File "E:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\test\test_import.py", line 63, in test_with_extension self.fail("import from %s failed: %s" % (ext, err)) File "E:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\unittest.py", line 540, in fail raise self.failureException(msg) AssertionError: import from .PY failed: No module named @test Traceback (most recent call last): File "E:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\test\test_import.py", line 80, in testImport test_with_extension(ext) File "E:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\test\test_import.py", line 73, in test_with_extension del sys.modules[TESTFN] KeyError: '@test' sincerely, -The Buildbot From python-checkins at python.org Wed Jun 10 20:49:50 2009 From: python-checkins at python.org (tarek.ziade) Date: Wed, 10 Jun 2009 20:49:50 +0200 (CEST) Subject: [Python-checkins] r73336 - in python/trunk/Lib/distutils: cygwinccompiler.py tests/test_cygwinccompiler.py Message-ID: <20090610184950.B45BBC48E@mail.python.org> Author: tarek.ziade Date: Wed Jun 10 20:49:50 2009 New Revision: 73336 Log: Distutils: started code cleanup and test coverage for cygwinccompiler Added: python/trunk/Lib/distutils/tests/test_cygwinccompiler.py (contents, props changed) Modified: python/trunk/Lib/distutils/cygwinccompiler.py Modified: python/trunk/Lib/distutils/cygwinccompiler.py ============================================================================== --- python/trunk/Lib/distutils/cygwinccompiler.py (original) +++ python/trunk/Lib/distutils/cygwinccompiler.py Wed Jun 10 20:49:50 2009 @@ -47,12 +47,19 @@ __revision__ = "$Id$" -import os,sys,copy +import os +import sys +import copy +from subprocess import Popen, PIPE +import re + from distutils.ccompiler import gen_preprocess_options, gen_lib_options from distutils.unixccompiler import UnixCCompiler from distutils.file_util import write_file from distutils.errors import DistutilsExecError, CompileError, UnknownFileError from distutils import log +from distutils.version import LooseVersion +from distutils.spawn import find_executable def get_msvcr(): """Include the appropriate MSVC runtime library if Python was built @@ -348,16 +355,16 @@ CONFIG_H_UNCERTAIN = "uncertain" def check_config_h(): + """Check if the current Python installation appears amenable to building + extensions with GCC. + + Returns a tuple (status, details), where 'status' is one of the following + constants: + + - CONFIG_H_OK: all is well, go ahead and compile + - CONFIG_H_NOTOK: doesn't look good + - CONFIG_H_UNCERTAIN: not sure -- unable to read pyconfig.h - """Check if the current Python installation (specifically, pyconfig.h) - appears amenable to building extensions with GCC. Returns a tuple - (status, details), where 'status' is one of the following constants: - CONFIG_H_OK - all is well, go ahead and compile - CONFIG_H_NOTOK - doesn't look good - CONFIG_H_UNCERTAIN - not sure -- unable to read pyconfig.h 'details' is a human-readable string explaining the situation. Note there are two ways to conclude "OK": either 'sys.version' contains @@ -369,77 +376,49 @@ # "pyconfig.h" check -- should probably be renamed... from distutils import sysconfig - import string - # if sys.version contains GCC then python was compiled with - # GCC, and the pyconfig.h file should be OK - if string.find(sys.version,"GCC") >= 0: - return (CONFIG_H_OK, "sys.version mentions 'GCC'") + # if sys.version contains GCC then python was compiled with GCC, and the + # pyconfig.h file should be OK + if "GCC" in sys.version: + return CONFIG_H_OK, "sys.version mentions 'GCC'" + + # let's see if __GNUC__ is mentioned in python.h fn = sysconfig.get_config_h_filename() try: - # It would probably better to read single lines to search. - # But we do this only once, and it is fast enough - f = open(fn) - s = f.read() - f.close() - + with open(fn) as config_h: + if "__GNUC__" in config_h.read(): + return CONFIG_H_OK, "'%s' mentions '__GNUC__'" % fn + else: + return CONFIG_H_NOTOK, "'%s' does not mention '__GNUC__'" % fn except IOError, exc: - # if we can't read this file, we cannot say it is wrong - # the compiler will complain later about this file as missing return (CONFIG_H_UNCERTAIN, "couldn't read '%s': %s" % (fn, exc.strerror)) - else: - # "pyconfig.h" contains an "#ifdef __GNUC__" or something similar - if string.find(s,"__GNUC__") >= 0: - return (CONFIG_H_OK, "'%s' mentions '__GNUC__'" % fn) - else: - return (CONFIG_H_NOTOK, "'%s' does not mention '__GNUC__'" % fn) +RE_VERSION = re.compile('(\d+\.\d+(\.\d+)*)') +def _find_exe_version(cmd): + """Find the version of an executable by running `cmd` in the shell. + If the command is not found, or the output does not match + `RE_VERSION`, returns None. + """ + executable = cmd.split()[0] + if find_executable(executable) is None: + return None + out = Popen(cmd, shell=True, stdout=PIPE).stdout + try: + out_string = out.read() + finally: + out.close() + result = RE_VERSION.search(out_string) + if result is None: + return None + return LooseVersion(result.group(1)) def get_versions(): """ Try to find out the versions of gcc, ld and dllwrap. - If not possible it returns None for it. + + If not possible it returns None for it. """ - from distutils.version import LooseVersion - from distutils.spawn import find_executable - import re - - gcc_exe = find_executable('gcc') - if gcc_exe: - out = os.popen(gcc_exe + ' -dumpversion','r') - out_string = out.read() - out.close() - result = re.search('(\d+\.\d+(\.\d+)*)',out_string) - if result: - gcc_version = LooseVersion(result.group(1)) - else: - gcc_version = None - else: - gcc_version = None - ld_exe = find_executable('ld') - if ld_exe: - out = os.popen(ld_exe + ' -v','r') - out_string = out.read() - out.close() - result = re.search('(\d+\.\d+(\.\d+)*)',out_string) - if result: - ld_version = LooseVersion(result.group(1)) - else: - ld_version = None - else: - ld_version = None - dllwrap_exe = find_executable('dllwrap') - if dllwrap_exe: - out = os.popen(dllwrap_exe + ' --version','r') - out_string = out.read() - out.close() - result = re.search(' (\d+\.\d+(\.\d+)*)',out_string) - if result: - dllwrap_version = LooseVersion(result.group(1)) - else: - dllwrap_version = None - else: - dllwrap_version = None - return (gcc_version, ld_version, dllwrap_version) + commands = ['gcc -dumpversion', 'ld -v', 'dllwrap --version'] + return tuple([_find_exe_version(cmd) for cmd in commands]) Added: python/trunk/Lib/distutils/tests/test_cygwinccompiler.py ============================================================================== --- (empty file) +++ python/trunk/Lib/distutils/tests/test_cygwinccompiler.py Wed Jun 10 20:49:50 2009 @@ -0,0 +1,120 @@ +"""Tests for distutils.cygwinccompiler.""" +import unittest +import sys +import os +from StringIO import StringIO +import subprocess + +from distutils import cygwinccompiler +from distutils.cygwinccompiler import (CygwinCCompiler, check_config_h, + CONFIG_H_OK, CONFIG_H_NOTOK, + CONFIG_H_UNCERTAIN, get_versions) +from distutils.tests import support + +class FakePopen(object): + test_class = None + + def __init__(self, cmd, shell, stdout): + self.cmd = cmd.split()[0] + exes = self.test_class._exes + if self.cmd in exes: + self.stdout = StringIO(exes[self.cmd]) + else: + self.stdout = os.popen(cmd, 'r') + + +class CygwinCCompilerTestCase(support.TempdirManager, + unittest.TestCase): + + def setUp(self): + super(CygwinCCompilerTestCase, self).setUp() + self.version = sys.version + self.python_h = os.path.join(self.mkdtemp(), 'python.h') + from distutils import sysconfig + self.old_get_config_h_filename = sysconfig.get_config_h_filename + sysconfig.get_config_h_filename = self._get_config_h_filename + self.old_find_executable = cygwinccompiler.find_executable + cygwinccompiler.find_executable = self._find_executable + self._exes = {} + self.old_popen = cygwinccompiler.Popen + FakePopen.test_class = self + cygwinccompiler.Popen = FakePopen + + def tearDown(self): + sys.version = self.version + from distutils import sysconfig + sysconfig.get_config_h_filename = self.old_get_config_h_filename + cygwinccompiler.find_executable = self.old_find_executable + cygwinccompiler.Popen = self.old_popen + super(CygwinCCompilerTestCase, self).tearDown() + + def _get_config_h_filename(self): + return self.python_h + + def _find_executable(self, name): + if name in self._exes: + return name + return None + + def test_check_config_h(self): + + # check_config_h looks for "GCC" in sys.version first + # returns CONFIG_H_OK if found + sys.version = ('2.6.1 (r261:67515, Dec 6 2008, 16:42:21) \n[GCC ' + '4.0.1 (Apple Computer, Inc. build 5370)]') + + self.assertEquals(check_config_h()[0], CONFIG_H_OK) + + # then it tries to see if it can find "__GNUC__" in pyconfig.h + sys.version = 'something without the *CC word' + + # if the file doesn't exist it returns CONFIG_H_UNCERTAIN + self.assertEquals(check_config_h()[0], CONFIG_H_UNCERTAIN) + + # if it exists but does not contain __GNUC__, it returns CONFIG_H_NOTOK + self.write_file(self.python_h, 'xxx') + self.assertEquals(check_config_h()[0], CONFIG_H_NOTOK) + + # and CONFIG_H_OK if __GNUC__ is found + self.write_file(self.python_h, 'xxx __GNUC__ xxx') + self.assertEquals(check_config_h()[0], CONFIG_H_OK) + + def test_get_versions(self): + + # get_versions calls distutils.spawn.find_executable on + # 'gcc', 'ld' and 'dllwrap' + self.assertEquals(get_versions(), (None, None, None)) + + # Let's fake we have 'gcc' and it returns '3.4.5' + self._exes['gcc'] = 'gcc (GCC) 3.4.5 (mingw special)\nFSF' + res = get_versions() + self.assertEquals(str(res[0]), '3.4.5') + + # and let's see what happens when the version + # doesn't match the regular expression + # (\d+\.\d+(\.\d+)*) + self._exes['gcc'] = 'very strange output' + res = get_versions() + self.assertEquals(res[0], None) + + # same thing for ld + self._exes['ld'] = 'GNU ld version 2.17.50 20060824' + res = get_versions() + self.assertEquals(str(res[1]), '2.17.50') + self._exes['ld'] = '@(#)PROGRAM:ld PROJECT:ld64-77' + res = get_versions() + self.assertEquals(res[1], None) + + # and dllwrap + self._exes['dllwrap'] = 'GNU dllwrap 2.17.50 20060824\nFSF' + res = get_versions() + self.assertEquals(str(res[2]), '2.17.50') + self._exes['dllwrap'] = 'Cheese Wrap' + res = get_versions() + self.assertEquals(res[2], None) + +def test_suite(): + return unittest.makeSuite(CygwinCCompilerTestCase) + +if __name__ == '__main__': + test_support.run_unittest(test_suite()) From python-checkins at python.org Wed Jun 10 20:51:50 2009 From: python-checkins at python.org (tarek.ziade) Date: Wed, 10 Jun 2009 20:51:50 +0200 (CEST) Subject: [Python-checkins] r73337 - python/branches/release26-maint Message-ID: <20090610185150.3E1B1C352@mail.python.org> Author: tarek.ziade Date: Wed Jun 10 20:51:50 2009 New Revision: 73337 Log: Blocked revisions 73336 via svnmerge ........ r73336 | tarek.ziade | 2009-06-10 20:49:50 +0200 (Wed, 10 Jun 2009) | 1 line Distutils: started code cleanup and test coverage for cygwinccompiler ........ Modified: python/branches/release26-maint/ (props changed) From python-checkins at python.org Wed Jun 10 20:56:36 2009 From: python-checkins at python.org (tarek.ziade) Date: Wed, 10 Jun 2009 20:56:36 +0200 (CEST) Subject: [Python-checkins] r73338 - in python/branches/py3k: Lib/distutils/cygwinccompiler.py Lib/distutils/tests/test_cygwinccompiler.py Message-ID: <20090610185636.2C596DED6@mail.python.org> Author: tarek.ziade Date: Wed Jun 10 20:56:35 2009 New Revision: 73338 Log: Merged revisions 73336 via svnmerge from svn+ssh://pythondev at svn.python.org/python/trunk ........ r73336 | tarek.ziade | 2009-06-10 20:49:50 +0200 (Wed, 10 Jun 2009) | 1 line Distutils: started code cleanup and test coverage for cygwinccompiler ........ Added: python/branches/py3k/Lib/distutils/tests/test_cygwinccompiler.py - copied, changed from r73336, /python/trunk/Lib/distutils/tests/test_cygwinccompiler.py Modified: python/branches/py3k/ (props changed) python/branches/py3k/Lib/distutils/cygwinccompiler.py Modified: python/branches/py3k/Lib/distutils/cygwinccompiler.py ============================================================================== --- python/branches/py3k/Lib/distutils/cygwinccompiler.py (original) +++ python/branches/py3k/Lib/distutils/cygwinccompiler.py Wed Jun 10 20:56:35 2009 @@ -47,12 +47,19 @@ __revision__ = "$Id$" -import os,sys,copy +import os +import sys +import copy +from subprocess import Popen, PIPE +import re + from distutils.ccompiler import gen_preprocess_options, gen_lib_options from distutils.unixccompiler import UnixCCompiler from distutils.file_util import write_file from distutils.errors import DistutilsExecError, CompileError, UnknownFileError from distutils import log +from distutils.version import LooseVersion +from distutils.spawn import find_executable def get_msvcr(): """Include the appropriate MSVC runtime library if Python was built @@ -347,16 +354,16 @@ CONFIG_H_UNCERTAIN = "uncertain" def check_config_h(): + """Check if the current Python installation appears amenable to building + extensions with GCC. + + Returns a tuple (status, details), where 'status' is one of the following + constants: + + - CONFIG_H_OK: all is well, go ahead and compile + - CONFIG_H_NOTOK: doesn't look good + - CONFIG_H_UNCERTAIN: not sure -- unable to read pyconfig.h - """Check if the current Python installation (specifically, pyconfig.h) - appears amenable to building extensions with GCC. Returns a tuple - (status, details), where 'status' is one of the following constants: - CONFIG_H_OK - all is well, go ahead and compile - CONFIG_H_NOTOK - doesn't look good - CONFIG_H_UNCERTAIN - not sure -- unable to read pyconfig.h 'details' is a human-readable string explaining the situation. Note there are two ways to conclude "OK": either 'sys.version' contains @@ -368,76 +375,49 @@ # "pyconfig.h" check -- should probably be renamed... from distutils import sysconfig - # if sys.version contains GCC then python was compiled with - # GCC, and the pyconfig.h file should be OK - if sys.version.find("GCC") >= 0: - return (CONFIG_H_OK, "sys.version mentions 'GCC'") + # if sys.version contains GCC then python was compiled with GCC, and the + # pyconfig.h file should be OK + if "GCC" in sys.version: + return CONFIG_H_OK, "sys.version mentions 'GCC'" + + # let's see if __GNUC__ is mentioned in python.h fn = sysconfig.get_config_h_filename() try: - # It would probably better to read single lines to search. - # But we do this only once, and it is fast enough - f = open(fn) - s = f.read() - f.close() - + with open(fn) as config_h: + if "__GNUC__" in config_h.read(): + return CONFIG_H_OK, "'%s' mentions '__GNUC__'" % fn + else: + return CONFIG_H_NOTOK, "'%s' does not mention '__GNUC__'" % fn except IOError as exc: - # if we can't read this file, we cannot say it is wrong - # the compiler will complain later about this file as missing return (CONFIG_H_UNCERTAIN, "couldn't read '%s': %s" % (fn, exc.strerror)) - else: - # "pyconfig.h" contains an "#ifdef __GNUC__" or something similar - if s.find("__GNUC__") >= 0: - return (CONFIG_H_OK, "'%s' mentions '__GNUC__'" % fn) - else: - return (CONFIG_H_NOTOK, "'%s' does not mention '__GNUC__'" % fn) +RE_VERSION = re.compile('(\d+\.\d+(\.\d+)*)') +def _find_exe_version(cmd): + """Find the version of an executable by running `cmd` in the shell. + If the command is not found, or the output does not match + `RE_VERSION`, returns None. + """ + executable = cmd.split()[0] + if find_executable(executable) is None: + return None + out = Popen(cmd, shell=True, stdout=PIPE).stdout + try: + out_string = out.read() + finally: + out.close() + result = RE_VERSION.search(out_string) + if result is None: + return None + return LooseVersion(result.group(1)) def get_versions(): """ Try to find out the versions of gcc, ld and dllwrap. - If not possible it returns None for it. + + If not possible it returns None for it. """ - from distutils.version import LooseVersion - from distutils.spawn import find_executable - import re - - gcc_exe = find_executable('gcc') - if gcc_exe: - out = os.popen(gcc_exe + ' -dumpversion','r') - out_string = out.read() - out.close() - result = re.search('(\d+\.\d+(\.\d+)*)', out_string, re.ASCII) - if result: - gcc_version = LooseVersion(result.group(1)) - else: - gcc_version = None - else: - gcc_version = None - ld_exe = find_executable('ld') - if ld_exe: - out = os.popen(ld_exe + ' -v','r') - out_string = out.read() - out.close() - result = re.search('(\d+\.\d+(\.\d+)*)', out_string, re.ASCII) - if result: - ld_version = LooseVersion(result.group(1)) - else: - ld_version = None - else: - ld_version = None - dllwrap_exe = find_executable('dllwrap') - if dllwrap_exe: - out = os.popen(dllwrap_exe + ' --version','r') - out_string = out.read() - out.close() - result = re.search(' (\d+\.\d+(\.\d+)*)', out_string, re.ASCII) - if result: - dllwrap_version = LooseVersion(result.group(1)) - else: - dllwrap_version = None - else: - dllwrap_version = None - return (gcc_version, ld_version, dllwrap_version) + commands = ['gcc -dumpversion', 'ld -v', 'dllwrap --version'] + return tuple([_find_exe_version(cmd) for cmd in commands]) Copied: python/branches/py3k/Lib/distutils/tests/test_cygwinccompiler.py (from r73336, /python/trunk/Lib/distutils/tests/test_cygwinccompiler.py) ============================================================================== --- /python/trunk/Lib/distutils/tests/test_cygwinccompiler.py (original) +++ python/branches/py3k/Lib/distutils/tests/test_cygwinccompiler.py Wed Jun 10 20:56:35 2009 @@ -2,7 +2,7 @@ import unittest import sys import os -from StringIO import StringIO +from io import StringIO import subprocess from distutils import cygwinccompiler From python-checkins at python.org Wed Jun 10 20:58:43 2009 From: python-checkins at python.org (tarek.ziade) Date: Wed, 10 Jun 2009 20:58:43 +0200 (CEST) Subject: [Python-checkins] r73339 - python/branches/release30-maint Message-ID: <20090610185843.CFC58C2AF@mail.python.org> Author: tarek.ziade Date: Wed Jun 10 20:58:43 2009 New Revision: 73339 Log: Blocked revisions 73338 via svnmerge ................ r73338 | tarek.ziade | 2009-06-10 20:56:35 +0200 (Wed, 10 Jun 2009) | 9 lines Merged revisions 73336 via svnmerge from svn+ssh://pythondev at svn.python.org/python/trunk ........ r73336 | tarek.ziade | 2009-06-10 20:49:50 +0200 (Wed, 10 Jun 2009) | 1 line Distutils: started code cleanup and test coverage for cygwinccompiler ........ ................ Modified: python/branches/release30-maint/ (props changed) From buildbot at python.org Wed Jun 10 21:43:13 2009 From: buildbot at python.org (buildbot at python.org) Date: Wed, 10 Jun 2009 19:43:13 +0000 Subject: [Python-checkins] buildbot failure in OS X x86 2.6 Message-ID: <20090610194313.681BDDC11@mail.python.org> The Buildbot has detected a new failure of OS X x86 2.6. Full details are available at: http://www.python.org/dev/buildbot/all/OS%20X%20x86%202.6/builds/369 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: noller-osx86 Build Reason: Build Source Stamp: [branch branches/release26-maint] HEAD Blamelist: tarek.ziade BUILD FAILED: failed test Excerpt from the test logfile: 2 tests failed: test_asynchat test_smtplib make: *** [buildbottest] Error 1 sincerely, -The Buildbot From buildbot at python.org Wed Jun 10 22:12:20 2009 From: buildbot at python.org (buildbot at python.org) Date: Wed, 10 Jun 2009 20:12:20 +0000 Subject: [Python-checkins] buildbot failure in x86 osx.5 3.x Message-ID: <20090610201220.8E590DCA8@mail.python.org> The Buildbot has detected a new failure of x86 osx.5 3.x. Full details are available at: http://www.python.org/dev/buildbot/all/x86%20osx.5%203.x/builds/1018 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: heller-x86-osx5 Build Reason: Build Source Stamp: [branch branches/py3k] HEAD Blamelist: tarek.ziade BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_sys make: *** [buildbottest] Error 1 sincerely, -The Buildbot From python-checkins at python.org Wed Jun 10 22:30:19 2009 From: python-checkins at python.org (amaury.forgeotdarc) Date: Wed, 10 Jun 2009 22:30:19 +0200 (CEST) Subject: [Python-checkins] r73340 - python/trunk/Doc/whatsnew/2.7.rst Message-ID: <20090610203019.54FB0D66D@mail.python.org> Author: amaury.forgeotdarc Date: Wed Jun 10 22:30:19 2009 New Revision: 73340 Log: Fix a typo spotted by Nick Coghlan. Modified: python/trunk/Doc/whatsnew/2.7.rst Modified: python/trunk/Doc/whatsnew/2.7.rst ============================================================================== --- python/trunk/Doc/whatsnew/2.7.rst (original) +++ python/trunk/Doc/whatsnew/2.7.rst Wed Jun 10 22:30:19 2009 @@ -672,7 +672,7 @@ * Because of an optimization for the :keyword:`with` statement, the special methods :meth:`__enter__` and :meth:`__exit__` must belong to the object's type, and cannot be directly attached to the object's instance. This - affects new-styles classes (derived from :class:`object`) and C extension + affects new-style classes (derived from :class:`object`) and C extension types. (:issue:`6101`.) .. ====================================================================== From buildbot at python.org Thu Jun 11 00:16:42 2009 From: buildbot at python.org (buildbot at python.org) Date: Wed, 10 Jun 2009 22:16:42 +0000 Subject: [Python-checkins] buildbot failure in sparc solaris10 gcc 3.0 Message-ID: <20090610221642.364F7C558@mail.python.org> The Buildbot has detected a new failure of sparc solaris10 gcc 3.0. Full details are available at: http://www.python.org/dev/buildbot/all/sparc%20solaris10%20gcc%203.0/builds/403 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: loewis-sun Build Reason: Build Source Stamp: [branch branches/release30-maint] HEAD Blamelist: tarek.ziade BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_posix ====================================================================== ERROR: test_getcwd_long_pathnames (test.test_posix.PosixTester) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home2/buildbot/slave/3.0.loewis-sun/build/Lib/test/test_posix.py", line 252, in test_getcwd_long_pathnames support.rmtree(base_path) File "/home2/buildbot/slave/3.0.loewis-sun/build/Lib/test/support.py", line 98, in rmtree shutil.rmtree(path) File "/home2/buildbot/slave/3.0.loewis-sun/build/Lib/shutil.py", line 225, in rmtree onerror(os.rmdir, path, sys.exc_info()) File "/home2/buildbot/slave/3.0.loewis-sun/build/Lib/shutil.py", line 223, in rmtree os.rmdir(path) OSError: [Errno 22] Invalid argument: '/home2/buildbot/slave/3.0.loewis-sun/build/@test.getcwd/@test.getcwd' sincerely, -The Buildbot From python-checkins at python.org Thu Jun 11 10:12:20 2009 From: python-checkins at python.org (tarek.ziade) Date: Thu, 11 Jun 2009 10:12:20 +0200 (CEST) Subject: [Python-checkins] r73341 - in python/trunk: Lib/distutils/sysconfig.py Lib/distutils/tests/test_sysconfig.py Misc/NEWS Message-ID: <20090611081220.7C2B0C510@mail.python.org> Author: tarek.ziade Date: Thu Jun 11 10:12:20 2009 New Revision: 73341 Log: Fixed #5201: now distutils.sysconfig.parse_makefile() understands '53264' in Makefiles Modified: python/trunk/Lib/distutils/sysconfig.py python/trunk/Lib/distutils/tests/test_sysconfig.py python/trunk/Misc/NEWS Modified: python/trunk/Lib/distutils/sysconfig.py ============================================================================== --- python/trunk/Lib/distutils/sysconfig.py (original) +++ python/trunk/Lib/distutils/sysconfig.py Thu Jun 11 10:12:20 2009 @@ -285,18 +285,25 @@ while 1: line = fp.readline() - if line is None: # eof + if line is None: # eof break m = _variable_rx.match(line) if m: n, v = m.group(1, 2) - v = string.strip(v) - if "$" in v: + v = v.strip() + # `$$' is a literal `$' in make + tmpv = v.replace('$$', '') + + if "$" in tmpv: notdone[n] = v else: - try: v = int(v) - except ValueError: pass - done[n] = v + try: + v = int(v) + except ValueError: + # insert literal `$' + done[n] = v.replace('$$', '$') + else: + done[n] = v # do variable interpolation here while notdone: @@ -324,7 +331,7 @@ else: try: value = int(value) except ValueError: - done[name] = string.strip(value) + done[name] = value.strip() else: done[name] = value del notdone[name] Modified: python/trunk/Lib/distutils/tests/test_sysconfig.py ============================================================================== --- python/trunk/Lib/distutils/tests/test_sysconfig.py (original) +++ python/trunk/Lib/distutils/tests/test_sysconfig.py Thu Jun 11 10:12:20 2009 @@ -1,5 +1,6 @@ """Tests for distutils.sysconfig.""" import os +import test import unittest from distutils import sysconfig @@ -9,6 +10,14 @@ class SysconfigTestCase(support.EnvironGuard, unittest.TestCase): + def setUp(self): + super(SysconfigTestCase, self).setUp() + self.makefile = None + + def tearDown(self): + if self.makefile is not None: + os.unlink(self.makefile) + super(SysconfigTestCase, self).tearDown() def test_get_config_h_filename(self): config_h = sysconfig.get_config_h_filename() @@ -56,8 +65,32 @@ sysconfig.customize_compiler(comp) self.assertEquals(comp.exes['archiver'], 'my_ar -arflags') + def test_parse_makefile_base(self): + self.makefile = test.test_support.TESTFN + fd = open(self.makefile, 'w') + fd.write(r"CONFIG_ARGS= '--arg1=optarg1' 'ENV=LIB'" '\n') + fd.write('VAR=$OTHER\nOTHER=foo') + fd.close() + d = sysconfig.parse_makefile(self.makefile) + self.assertEquals(d, {'CONFIG_ARGS': "'--arg1=optarg1' 'ENV=LIB'", + 'OTHER': 'foo'}) + + def test_parse_makefile_literal_dollar(self): + self.makefile = test.test_support.TESTFN + fd = open(self.makefile, 'w') + fd.write(r"CONFIG_ARGS= '--arg1=optarg1' 'ENV=\$$LIB'" '\n') + fd.write('VAR=$OTHER\nOTHER=foo') + fd.close() + d = sysconfig.parse_makefile(self.makefile) + self.assertEquals(d, {'CONFIG_ARGS': r"'--arg1=optarg1' 'ENV=\$LIB'", + 'OTHER': 'foo'}) + def test_suite(): suite = unittest.TestSuite() suite.addTest(unittest.makeSuite(SysconfigTestCase)) return suite + + +if __name__ == '__main__': + test.test_support.run_unittest(test_suite()) Modified: python/trunk/Misc/NEWS ============================================================================== --- python/trunk/Misc/NEWS (original) +++ python/trunk/Misc/NEWS Thu Jun 11 10:12:20 2009 @@ -317,6 +317,10 @@ Library ------- +- Issue #5201: distutils.sysconfig.parse_makefile() now understands `$$` + in Makefiles. This prevents compile errors when using syntax like: + `LDFLAGS='-rpath=\$$LIB:/some/other/path'`. Patch by Floris Bruynooghe. + - Issue #5767: Removed sgmlop support from xmlrpclib. - Issue #6131: test_modulefinder leaked when run after test_distutils. From python-checkins at python.org Thu Jun 11 10:26:40 2009 From: python-checkins at python.org (tarek.ziade) Date: Thu, 11 Jun 2009 10:26:40 +0200 (CEST) Subject: [Python-checkins] r73342 - in python/branches/release26-maint: Lib/distutils/sysconfig.py Lib/distutils/tests/test_sysconfig.py Misc/NEWS Message-ID: <20090611082640.76D0CD83B@mail.python.org> Author: tarek.ziade Date: Thu Jun 11 10:26:40 2009 New Revision: 73342 Log: Merged revisions 73341 via svnmerge from svn+ssh://pythondev at svn.python.org/python/trunk ........ r73341 | tarek.ziade | 2009-06-11 10:12:20 +0200 (Thu, 11 Jun 2009) | 1 line Fixed #5201: now distutils.sysconfig.parse_makefile() understands '53264' in Makefiles ........ Modified: python/branches/release26-maint/ (props changed) python/branches/release26-maint/Lib/distutils/sysconfig.py python/branches/release26-maint/Lib/distutils/tests/test_sysconfig.py python/branches/release26-maint/Misc/NEWS Modified: python/branches/release26-maint/Lib/distutils/sysconfig.py ============================================================================== --- python/branches/release26-maint/Lib/distutils/sysconfig.py (original) +++ python/branches/release26-maint/Lib/distutils/sysconfig.py Thu Jun 11 10:26:40 2009 @@ -275,18 +275,25 @@ while 1: line = fp.readline() - if line is None: # eof + if line is None: # eof break m = _variable_rx.match(line) if m: n, v = m.group(1, 2) - v = string.strip(v) - if "$" in v: + v = v.strip() + # `$$' is a literal `$' in make + tmpv = v.replace('$$', '') + + if "$" in tmpv: notdone[n] = v else: - try: v = int(v) - except ValueError: pass - done[n] = v + try: + v = int(v) + except ValueError: + # insert literal `$' + done[n] = v.replace('$$', '$') + else: + done[n] = v # do variable interpolation here while notdone: @@ -314,7 +321,7 @@ else: try: value = int(value) except ValueError: - done[name] = string.strip(value) + done[name] = value.strip() else: done[name] = value del notdone[name] Modified: python/branches/release26-maint/Lib/distutils/tests/test_sysconfig.py ============================================================================== --- python/branches/release26-maint/Lib/distutils/tests/test_sysconfig.py (original) +++ python/branches/release26-maint/Lib/distutils/tests/test_sysconfig.py Thu Jun 11 10:26:40 2009 @@ -2,11 +2,20 @@ from distutils import sysconfig import os +import test import unittest from test.test_support import TESTFN class SysconfigTestCase(unittest.TestCase): + def setUp(self): + super(SysconfigTestCase, self).setUp() + self.makefile = None + + def tearDown(self): + if self.makefile is not None: + os.unlink(self.makefile) + super(SysconfigTestCase, self).tearDown() def test_get_config_h_filename(self): config_h = sysconfig.get_config_h_filename() @@ -51,8 +60,22 @@ self.assert_(isinstance(cvars, dict)) self.assert_(cvars) + def test_parse_makefile_literal_dollar(self): + self.makefile = test.test_support.TESTFN + fd = open(self.makefile, 'w') + fd.write(r"CONFIG_ARGS= '--arg1=optarg1' 'ENV=\$$LIB'" '\n') + fd.write('VAR=$OTHER\nOTHER=foo') + fd.close() + d = sysconfig.parse_makefile(self.makefile) + self.assertEquals(d, {'CONFIG_ARGS': r"'--arg1=optarg1' 'ENV=\$LIB'", + 'OTHER': 'foo'}) + def test_suite(): suite = unittest.TestSuite() suite.addTest(unittest.makeSuite(SysconfigTestCase)) return suite + + +if __name__ == '__main__': + test.test_support.run_unittest(test_suite()) Modified: python/branches/release26-maint/Misc/NEWS ============================================================================== --- python/branches/release26-maint/Misc/NEWS (original) +++ python/branches/release26-maint/Misc/NEWS Thu Jun 11 10:26:40 2009 @@ -234,6 +234,10 @@ Library ------- +- Issue #5201: distutils.sysconfig.parse_makefile() now understands `$$` + in Makefiles. This prevents compile errors when using syntax like: + `LDFLAGS='-rpath=\$$LIB:/some/other/path'`. Patch by Floris Bruynooghe. + - Issue #6062: In distutils, fixed the package option of build_ext. Feedback and tests on pywin32 by Tim Golden. From python-checkins at python.org Thu Jun 11 10:31:17 2009 From: python-checkins at python.org (tarek.ziade) Date: Thu, 11 Jun 2009 10:31:17 +0200 (CEST) Subject: [Python-checkins] r73343 - in python/branches/py3k: Lib/distutils/sysconfig.py Lib/distutils/tests/test_sysconfig.py Misc/NEWS Message-ID: <20090611083117.9E5A3D988@mail.python.org> Author: tarek.ziade Date: Thu Jun 11 10:31:17 2009 New Revision: 73343 Log: Merged revisions 73341 via svnmerge from svn+ssh://pythondev at svn.python.org/python/trunk ........ r73341 | tarek.ziade | 2009-06-11 10:12:20 +0200 (Thu, 11 Jun 2009) | 1 line Fixed #5201: now distutils.sysconfig.parse_makefile() understands '53264' in Makefiles ........ Modified: python/branches/py3k/ (props changed) python/branches/py3k/Lib/distutils/sysconfig.py python/branches/py3k/Lib/distutils/tests/test_sysconfig.py python/branches/py3k/Misc/NEWS Modified: python/branches/py3k/Lib/distutils/sysconfig.py ============================================================================== --- python/branches/py3k/Lib/distutils/sysconfig.py (original) +++ python/branches/py3k/Lib/distutils/sysconfig.py Thu Jun 11 10:31:17 2009 @@ -286,12 +286,19 @@ if m: n, v = m.group(1, 2) v = v.strip() - if "$" in v: + # `$$' is a literal `$' in make + tmpv = v.replace('$$', '') + + if "$" in tmpv: notdone[n] = v else: - try: v = int(v) - except ValueError: pass - done[n] = v + try: + v = int(v) + except ValueError: + # insert literal `$' + done[n] = v.replace('$$', '$') + else: + done[n] = v # do variable interpolation here while notdone: Modified: python/branches/py3k/Lib/distutils/tests/test_sysconfig.py ============================================================================== --- python/branches/py3k/Lib/distutils/tests/test_sysconfig.py (original) +++ python/branches/py3k/Lib/distutils/tests/test_sysconfig.py Thu Jun 11 10:31:17 2009 @@ -1,14 +1,23 @@ """Tests for distutils.sysconfig.""" import os +import test import unittest from distutils import sysconfig from distutils.ccompiler import get_default_compiler from distutils.tests import support -from test.support import TESTFN +from test.support import TESTFN, run_unittest class SysconfigTestCase(support.EnvironGuard, unittest.TestCase): + def setUp(self): + super(SysconfigTestCase, self).setUp() + self.makefile = None + + def tearDown(self): + if self.makefile is not None: + os.unlink(self.makefile) + super(SysconfigTestCase, self).tearDown() def test_get_config_h_filename(self): config_h = sysconfig.get_config_h_filename() @@ -56,8 +65,32 @@ sysconfig.customize_compiler(comp) self.assertEquals(comp.exes['archiver'], 'my_ar -arflags') + def test_parse_makefile_base(self): + self.makefile = TESTFN + fd = open(self.makefile, 'w') + fd.write(r"CONFIG_ARGS= '--arg1=optarg1' 'ENV=LIB'" '\n') + fd.write('VAR=$OTHER\nOTHER=foo') + fd.close() + d = sysconfig.parse_makefile(self.makefile) + self.assertEquals(d, {'CONFIG_ARGS': "'--arg1=optarg1' 'ENV=LIB'", + 'OTHER': 'foo'}) + + def test_parse_makefile_literal_dollar(self): + self.makefile = TESTFN + fd = open(self.makefile, 'w') + fd.write(r"CONFIG_ARGS= '--arg1=optarg1' 'ENV=\$$LIB'" '\n') + fd.write('VAR=$OTHER\nOTHER=foo') + fd.close() + d = sysconfig.parse_makefile(self.makefile) + self.assertEquals(d, {'CONFIG_ARGS': r"'--arg1=optarg1' 'ENV=\$LIB'", + 'OTHER': 'foo'}) + def test_suite(): suite = unittest.TestSuite() suite.addTest(unittest.makeSuite(SysconfigTestCase)) return suite + + +if __name__ == '__main__': + run_unittest(test_suite()) Modified: python/branches/py3k/Misc/NEWS ============================================================================== --- python/branches/py3k/Misc/NEWS (original) +++ python/branches/py3k/Misc/NEWS Thu Jun 11 10:31:17 2009 @@ -772,6 +772,10 @@ Library ------- +- Issue #5201: distutils.sysconfig.parse_makefile() now understands `$$` + in Makefiles. This prevents compile errors when using syntax like: + `LDFLAGS='-rpath=\$$LIB:/some/other/path'`. Patch by Floris Bruynooghe. + - Issue #6131: test_modulefinder leaked when run after test_distutils. Patch by Hirokazu Yamamoto. From python-checkins at python.org Thu Jun 11 10:35:26 2009 From: python-checkins at python.org (tarek.ziade) Date: Thu, 11 Jun 2009 10:35:26 +0200 (CEST) Subject: [Python-checkins] r73344 - in python/branches/release30-maint: Lib/distutils/sysconfig.py Lib/distutils/tests/test_sysconfig.py Misc/NEWS Message-ID: <20090611083526.8FC1DC53E@mail.python.org> Author: tarek.ziade Date: Thu Jun 11 10:35:26 2009 New Revision: 73344 Log: Merged revisions 73343 via svnmerge from svn+ssh://pythondev at svn.python.org/python/branches/py3k ................ r73343 | tarek.ziade | 2009-06-11 10:31:17 +0200 (Thu, 11 Jun 2009) | 9 lines Merged revisions 73341 via svnmerge from svn+ssh://pythondev at svn.python.org/python/trunk ........ r73341 | tarek.ziade | 2009-06-11 10:12:20 +0200 (Thu, 11 Jun 2009) | 1 line Fixed #5201: now distutils.sysconfig.parse_makefile() understands '53264' in Makefiles ........ ................ Modified: python/branches/release30-maint/ (props changed) python/branches/release30-maint/Lib/distutils/sysconfig.py python/branches/release30-maint/Lib/distutils/tests/test_sysconfig.py python/branches/release30-maint/Misc/NEWS Modified: python/branches/release30-maint/Lib/distutils/sysconfig.py ============================================================================== --- python/branches/release30-maint/Lib/distutils/sysconfig.py (original) +++ python/branches/release30-maint/Lib/distutils/sysconfig.py Thu Jun 11 10:35:26 2009 @@ -276,12 +276,19 @@ if m: n, v = m.group(1, 2) v = v.strip() - if "$" in v: + # `$$' is a literal `$' in make + tmpv = v.replace('$$', '') + + if "$" in tmpv: notdone[n] = v else: - try: v = int(v) - except ValueError: pass - done[n] = v + try: + v = int(v) + except ValueError: + # insert literal `$' + done[n] = v.replace('$$', '$') + else: + done[n] = v # do variable interpolation here while notdone: Modified: python/branches/release30-maint/Lib/distutils/tests/test_sysconfig.py ============================================================================== --- python/branches/release30-maint/Lib/distutils/tests/test_sysconfig.py (original) +++ python/branches/release30-maint/Lib/distutils/tests/test_sysconfig.py Thu Jun 11 10:35:26 2009 @@ -2,11 +2,20 @@ from distutils import sysconfig import os +import test import unittest -from test.support import TESTFN +from test.support import TESTFN, run_unittest class SysconfigTestCase(unittest.TestCase): + def setUp(self): + super(SysconfigTestCase, self).setUp() + self.makefile = None + + def tearDown(self): + if self.makefile is not None: + os.unlink(self.makefile) + super(SysconfigTestCase, self).tearDown() def test_get_config_h_filename(self): config_h = sysconfig.get_config_h_filename() @@ -51,8 +60,22 @@ self.assert_(isinstance(cvars, dict)) self.assert_(cvars) + def test_parse_makefile_literal_dollar(self): + self.makefile = TESTFN + fd = open(self.makefile, 'w') + fd.write(r"CONFIG_ARGS= '--arg1=optarg1' 'ENV=\$$LIB'" '\n') + fd.write('VAR=$OTHER\nOTHER=foo') + fd.close() + d = sysconfig.parse_makefile(self.makefile) + self.assertEquals(d, {'CONFIG_ARGS': r"'--arg1=optarg1' 'ENV=\$LIB'", + 'OTHER': 'foo'}) + def test_suite(): suite = unittest.TestSuite() suite.addTest(unittest.makeSuite(SysconfigTestCase)) return suite + + +if __name__ == '__main__': + run_unittest(test_suite()) Modified: python/branches/release30-maint/Misc/NEWS ============================================================================== --- python/branches/release30-maint/Misc/NEWS (original) +++ python/branches/release30-maint/Misc/NEWS Thu Jun 11 10:35:26 2009 @@ -323,6 +323,10 @@ Library ------- +- Issue #5201: distutils.sysconfig.parse_makefile() now understands `$$` + in Makefiles. This prevents compile errors when using syntax like: + `LDFLAGS='-rpath=\$$LIB:/some/other/path'`. Patch by Floris Bruynooghe. + - Issue #6062: In distutils, fixed the package option of build_ext. Feedback and tests on pywin32 by Tim Golden. From python-checkins at python.org Thu Jun 11 10:43:27 2009 From: python-checkins at python.org (tarek.ziade) Date: Thu, 11 Jun 2009 10:43:27 +0200 (CEST) Subject: [Python-checkins] r73345 - python/trunk/Lib/distutils/sysconfig.py Message-ID: <20090611084327.0F2A9D8CE@mail.python.org> Author: tarek.ziade Date: Thu Jun 11 10:43:26 2009 New Revision: 73345 Log: removed the last string.split() call Modified: python/trunk/Lib/distutils/sysconfig.py Modified: python/trunk/Lib/distutils/sysconfig.py ============================================================================== --- python/trunk/Lib/distutils/sysconfig.py (original) +++ python/trunk/Lib/distutils/sysconfig.py Thu Jun 11 10:43:26 2009 @@ -13,7 +13,6 @@ import os import re -import string import sys from distutils.errors import DistutilsPlatformError @@ -435,7 +434,7 @@ # relative to the srcdir, which after installation no longer makes # sense. python_lib = get_python_lib(standard_lib=1) - linkerscript_path = string.split(g['LDSHARED'])[0] + linkerscript_path = g['LDSHARED'].split()[0] linkerscript_name = os.path.basename(linkerscript_path) linkerscript = os.path.join(python_lib, 'config', linkerscript_name) From python-checkins at python.org Thu Jun 11 10:44:38 2009 From: python-checkins at python.org (tarek.ziade) Date: Thu, 11 Jun 2009 10:44:38 +0200 (CEST) Subject: [Python-checkins] r73346 - python/branches/release26-maint Message-ID: <20090611084438.6D610DA4E@mail.python.org> Author: tarek.ziade Date: Thu Jun 11 10:44:38 2009 New Revision: 73346 Log: Blocked revisions 73345 via svnmerge ........ r73345 | tarek.ziade | 2009-06-11 10:43:26 +0200 (Thu, 11 Jun 2009) | 1 line removed the last string.split() call ........ Modified: python/branches/release26-maint/ (props changed) From python-checkins at python.org Thu Jun 11 10:45:42 2009 From: python-checkins at python.org (tarek.ziade) Date: Thu, 11 Jun 2009 10:45:42 +0200 (CEST) Subject: [Python-checkins] r73347 - python/branches/py3k Message-ID: <20090611084542.AC6F2D89A@mail.python.org> Author: tarek.ziade Date: Thu Jun 11 10:45:42 2009 New Revision: 73347 Log: Blocked revisions 73345 via svnmerge ........ r73345 | tarek.ziade | 2009-06-11 10:43:26 +0200 (Thu, 11 Jun 2009) | 1 line removed the last string.split() call ........ Modified: python/branches/py3k/ (props changed) From python-checkins at python.org Thu Jun 11 11:13:37 2009 From: python-checkins at python.org (tarek.ziade) Date: Thu, 11 Jun 2009 11:13:37 +0200 (CEST) Subject: [Python-checkins] r73348 - in python/trunk: Lib/distutils/cygwinccompiler.py Lib/distutils/tests/test_cygwinccompiler.py Misc/NEWS Message-ID: <20090611091337.0DE26C479@mail.python.org> Author: tarek.ziade Date: Thu Jun 11 11:13:36 2009 New Revision: 73348 Log: #6263 fixed syntax error in distutils.cygwinccompiler Modified: python/trunk/Lib/distutils/cygwinccompiler.py python/trunk/Lib/distutils/tests/test_cygwinccompiler.py python/trunk/Misc/NEWS Modified: python/trunk/Lib/distutils/cygwinccompiler.py ============================================================================== --- python/trunk/Lib/distutils/cygwinccompiler.py (original) +++ python/trunk/Lib/distutils/cygwinccompiler.py Thu Jun 11 11:13:36 2009 @@ -81,7 +81,7 @@ # VS2008 / MSVC 9.0 return ['msvcr90'] else: - raise ValueError("Unknown MS Compiler version %i " % msc_Ver) + raise ValueError("Unknown MS Compiler version %s " % msc_ver) class CygwinCCompiler (UnixCCompiler): Modified: python/trunk/Lib/distutils/tests/test_cygwinccompiler.py ============================================================================== --- python/trunk/Lib/distutils/tests/test_cygwinccompiler.py (original) +++ python/trunk/Lib/distutils/tests/test_cygwinccompiler.py Thu Jun 11 11:13:36 2009 @@ -8,7 +8,8 @@ from distutils import cygwinccompiler from distutils.cygwinccompiler import (CygwinCCompiler, check_config_h, CONFIG_H_OK, CONFIG_H_NOTOK, - CONFIG_H_UNCERTAIN, get_versions) + CONFIG_H_UNCERTAIN, get_versions, + get_msvcr) from distutils.tests import support class FakePopen(object): @@ -113,6 +114,38 @@ res = get_versions() self.assertEquals(res[2], None) + def test_get_msvcr(self): + + # none + sys.version = ('2.6.1 (r261:67515, Dec 6 2008, 16:42:21) ' + '\n[GCC 4.0.1 (Apple Computer, Inc. build 5370)]') + self.assertEquals(get_msvcr(), None) + + # MSVC 7.0 + sys.version = ('2.5.1 (r251:54863, Apr 18 2007, 08:51:08) ' + '[MSC v.1300 32 bits (Intel)]') + self.assertEquals(get_msvcr(), ['msvcr70']) + + # MSVC 7.1 + sys.version = ('2.5.1 (r251:54863, Apr 18 2007, 08:51:08) ' + '[MSC v.1310 32 bits (Intel)]') + self.assertEquals(get_msvcr(), ['msvcr71']) + + # VS2005 / MSVC 8.0 + sys.version = ('2.5.1 (r251:54863, Apr 18 2007, 08:51:08) ' + '[MSC v.1400 32 bits (Intel)]') + self.assertEquals(get_msvcr(), ['msvcr80']) + + # VS2008 / MSVC 9.0 + sys.version = ('2.5.1 (r251:54863, Apr 18 2007, 08:51:08) ' + '[MSC v.1500 32 bits (Intel)]') + self.assertEquals(get_msvcr(), ['msvcr90']) + + # unknown + sys.version = ('2.5.1 (r251:54863, Apr 18 2007, 08:51:08) ' + '[MSC v.1999 32 bits (Intel)]') + self.assertRaises(ValueError, get_msvcr) + def test_suite(): return unittest.makeSuite(CygwinCCompilerTestCase) Modified: python/trunk/Misc/NEWS ============================================================================== --- python/trunk/Misc/NEWS (original) +++ python/trunk/Misc/NEWS Thu Jun 11 11:13:36 2009 @@ -317,6 +317,8 @@ Library ------- +- Issue #6263: Fixed syntax error in distutils.cygwincompiler. + - Issue #5201: distutils.sysconfig.parse_makefile() now understands `$$` in Makefiles. This prevents compile errors when using syntax like: `LDFLAGS='-rpath=\$$LIB:/some/other/path'`. Patch by Floris Bruynooghe. From python-checkins at python.org Thu Jun 11 11:17:21 2009 From: python-checkins at python.org (tarek.ziade) Date: Thu, 11 Jun 2009 11:17:21 +0200 (CEST) Subject: [Python-checkins] r73349 - in python/branches/release26-maint: Lib/distutils/cygwinccompiler.py Misc/NEWS Message-ID: <20090611091721.17EEFC504@mail.python.org> Author: tarek.ziade Date: Thu Jun 11 11:17:19 2009 New Revision: 73349 Log: Merged revisions 73348 via svnmerge from svn+ssh://pythondev at svn.python.org/python/trunk ........ r73348 | tarek.ziade | 2009-06-11 11:13:36 +0200 (Thu, 11 Jun 2009) | 1 line #6263 fixed syntax error in distutils.cygwinccompiler ........ Modified: python/branches/release26-maint/ (props changed) python/branches/release26-maint/Lib/distutils/cygwinccompiler.py python/branches/release26-maint/Misc/NEWS Modified: python/branches/release26-maint/Lib/distutils/cygwinccompiler.py ============================================================================== --- python/branches/release26-maint/Lib/distutils/cygwinccompiler.py (original) +++ python/branches/release26-maint/Lib/distutils/cygwinccompiler.py Thu Jun 11 11:17:19 2009 @@ -76,7 +76,7 @@ # VS2008 / MSVC 9.0 return ['msvcr90'] else: - raise ValueError("Unknown MS Compiler version %i " % msc_Ver) + raise ValueError("Unknown MS Compiler version %s " % msc_ver) class CygwinCCompiler (UnixCCompiler): Modified: python/branches/release26-maint/Misc/NEWS ============================================================================== --- python/branches/release26-maint/Misc/NEWS (original) +++ python/branches/release26-maint/Misc/NEWS Thu Jun 11 11:17:19 2009 @@ -234,6 +234,8 @@ Library ------- +- Issue #6263: Fixed syntax error in distutils.cygwincompiler. + - Issue #5201: distutils.sysconfig.parse_makefile() now understands `$$` in Makefiles. This prevents compile errors when using syntax like: `LDFLAGS='-rpath=\$$LIB:/some/other/path'`. Patch by Floris Bruynooghe. From python-checkins at python.org Thu Jun 11 11:23:41 2009 From: python-checkins at python.org (vinay.sajip) Date: Thu, 11 Jun 2009 11:23:41 +0200 (CEST) Subject: [Python-checkins] r73350 - in python/trunk: Lib/logging/handlers.py Misc/NEWS Message-ID: <20090611092341.59456C551@mail.python.org> Author: vinay.sajip Date: Thu Jun 11 11:23:41 2009 New Revision: 73350 Log: Issue #5262: Fixed bug in next roll over time computation in TimedRotatingFileHandler. Modified: python/trunk/Lib/logging/handlers.py python/trunk/Misc/NEWS Modified: python/trunk/Lib/logging/handlers.py ============================================================================== --- python/trunk/Lib/logging/handlers.py (original) +++ python/trunk/Lib/logging/handlers.py Thu Jun 11 11:23:41 2009 @@ -204,7 +204,13 @@ self.extMatch = re.compile(self.extMatch) self.interval = self.interval * interval # multiply by units requested self.rolloverAt = currentTime + self.interval + # If we are rolling over at midnight or weekly, then the interval is already known. + # What we need to figure out is WHEN the next interval is. + self.adjustRollover(currentTime) + + #print "Will rollover at %d, %d seconds from now" % (self.rolloverAt, self.rolloverAt - currentTime) + def adjustRollover(self, currentTime): # If we are rolling over at midnight or weekly, then the interval is already known. # What we need to figure out is WHEN the next interval is. In other words, # if you are rolling over at midnight, then your base interval is 1 day, @@ -214,7 +220,7 @@ # the rest. Note that this code doesn't care about leap seconds. :) if self.when == 'MIDNIGHT' or self.when.startswith('W'): # This could be done with less code, but I wanted it to be clear - if utc: + if self.utc: t = time.gmtime(currentTime) else: t = time.localtime(currentTime) @@ -240,7 +246,7 @@ # The calculations described in 2) and 3) above need to have a day added. # This is because the above time calculation takes us to midnight on this # day, i.e. the start of the next day. - if when.startswith('W'): + if self.when.startswith('W'): day = t[6] # 0 is Monday if day != self.dayOfWeek: if day < self.dayOfWeek: @@ -248,7 +254,7 @@ else: daysToWait = 6 - day + self.dayOfWeek + 1 newRolloverAt = self.rolloverAt + (daysToWait * (60 * 60 * 24)) - if not utc: + if not self.utc: dstNow = t[-1] dstAtRollover = time.localtime(newRolloverAt)[-1] if dstNow != dstAtRollover: @@ -258,8 +264,6 @@ newRolloverAt = newRolloverAt + 3600 self.rolloverAt = newRolloverAt - #print "Will rollover at %d, %d seconds from now" % (self.rolloverAt, self.rolloverAt - currentTime) - def shouldRollover(self, record): """ Determine if rollover should occur. @@ -341,6 +345,7 @@ else: # DST bows out before next rollover, so we need to add an hour newRolloverAt = newRolloverAt + 3600 self.rolloverAt = newRolloverAt + self.adjustRollover(time.time()) class WatchedFileHandler(logging.FileHandler): """ Modified: python/trunk/Misc/NEWS ============================================================================== --- python/trunk/Misc/NEWS (original) +++ python/trunk/Misc/NEWS Thu Jun 11 11:23:41 2009 @@ -317,6 +317,9 @@ Library ------- +- Issue #5262: Fixed bug in next rollover time computation in + TimedRotatingFileHandler. + - Issue #6263: Fixed syntax error in distutils.cygwincompiler. - Issue #5201: distutils.sysconfig.parse_makefile() now understands `$$` @@ -351,7 +354,7 @@ - Issue #1424152: Fix for httplib, urllib2 to support SSL while working through proxy. Original patch by Christopher Li, changes made by Senthil Kumaran. - + - Issue #1983: Fix functions taking or returning a process identifier to use the dedicated C type ``pid_t`` instead of a C ``int``. Some platforms have a process identifier type wider than the standard C integer type. @@ -359,7 +362,7 @@ - Issue #4066: smtplib.SMTP_SSL._get_socket now correctly returns the socket. Patch by Farhan Ahmad, test by Marcin Bachry. -- Issue #6062: In distutils, fixed the package option of build_ext. Feedback +- Issue #6062: In distutils, fixed the package option of build_ext. Feedback and tests on pywin32 by Tim Golden. - Issue #6053: Fixed distutils tests on win32. patch by Hirokazu Yamamoto. @@ -367,7 +370,7 @@ - Issue #6046: Fixed the library extension when distutils build_ext is used inplace. Initial patch by Roumen Petrov. -- Issue #6041: Now distutils `sdist` and `register` commands use `check` as a +- Issue #6041: Now distutils `sdist` and `register` commands use `check` as a subcommand. - Issue #2116: Weak references and weak dictionaries now support copy()ing and @@ -517,8 +520,8 @@ - unittest.assertNotEqual() now uses the inequality operator (!=) instead of the equality operator. - -- Issue #6001: Test discovery for unittest. Implemented in + +- Issue #6001: Test discovery for unittest. Implemented in unittest.TestLoader.discover and from the command line. - Issue #5679: The methods unittest.TestCase.addCleanup and doCleanups were added. @@ -528,11 +531,11 @@ - Issue #3379: unittest.main now takes an optional exit argument. If False main doesn't call sys.exit allowing it to be used from the interactive interpreter. - -- Issue #5995: unittest.main now takes an optional verbosity argument allowing + +- Issue #5995: unittest.main now takes an optional verbosity argument allowing test modules to be run with a higher than default verbosity. - -- Issue #5995: A fix to allow you to run "python -m unittest test_module" or + +- Issue #5995: A fix to allow you to run "python -m unittest test_module" or "python -m unittest test_module.TestClass" from the command line. - Issue #5728: unittest.TestResult has new startTestRun and stopTestRun methods; From python-checkins at python.org Thu Jun 11 11:25:41 2009 From: python-checkins at python.org (tarek.ziade) Date: Thu, 11 Jun 2009 11:25:41 +0200 (CEST) Subject: [Python-checkins] r73351 - in python/branches/py3k: Lib/distutils/cygwinccompiler.py Lib/distutils/tests/test_cygwinccompiler.py Misc/NEWS Message-ID: <20090611092541.C874FD62A@mail.python.org> Author: tarek.ziade Date: Thu Jun 11 11:25:41 2009 New Revision: 73351 Log: Merged revisions 73348 via svnmerge from svn+ssh://pythondev at svn.python.org/python/trunk ........ r73348 | tarek.ziade | 2009-06-11 11:13:36 +0200 (Thu, 11 Jun 2009) | 1 line #6263 fixed syntax error in distutils.cygwinccompiler ........ Modified: python/branches/py3k/ (props changed) python/branches/py3k/Lib/distutils/cygwinccompiler.py python/branches/py3k/Lib/distutils/tests/test_cygwinccompiler.py python/branches/py3k/Misc/NEWS Modified: python/branches/py3k/Lib/distutils/cygwinccompiler.py ============================================================================== --- python/branches/py3k/Lib/distutils/cygwinccompiler.py (original) +++ python/branches/py3k/Lib/distutils/cygwinccompiler.py Thu Jun 11 11:25:41 2009 @@ -81,7 +81,7 @@ # VS2008 / MSVC 9.0 return ['msvcr90'] else: - raise ValueError("Unknown MS Compiler version %i " % msc_Ver) + raise ValueError("Unknown MS Compiler version %s " % msc_ver) class CygwinCCompiler (UnixCCompiler): Modified: python/branches/py3k/Lib/distutils/tests/test_cygwinccompiler.py ============================================================================== --- python/branches/py3k/Lib/distutils/tests/test_cygwinccompiler.py (original) +++ python/branches/py3k/Lib/distutils/tests/test_cygwinccompiler.py Thu Jun 11 11:25:41 2009 @@ -8,7 +8,8 @@ from distutils import cygwinccompiler from distutils.cygwinccompiler import (CygwinCCompiler, check_config_h, CONFIG_H_OK, CONFIG_H_NOTOK, - CONFIG_H_UNCERTAIN, get_versions) + CONFIG_H_UNCERTAIN, get_versions, + get_msvcr) from distutils.tests import support class FakePopen(object): @@ -113,6 +114,38 @@ res = get_versions() self.assertEquals(res[2], None) + def test_get_msvcr(self): + + # none + sys.version = ('2.6.1 (r261:67515, Dec 6 2008, 16:42:21) ' + '\n[GCC 4.0.1 (Apple Computer, Inc. build 5370)]') + self.assertEquals(get_msvcr(), None) + + # MSVC 7.0 + sys.version = ('2.5.1 (r251:54863, Apr 18 2007, 08:51:08) ' + '[MSC v.1300 32 bits (Intel)]') + self.assertEquals(get_msvcr(), ['msvcr70']) + + # MSVC 7.1 + sys.version = ('2.5.1 (r251:54863, Apr 18 2007, 08:51:08) ' + '[MSC v.1310 32 bits (Intel)]') + self.assertEquals(get_msvcr(), ['msvcr71']) + + # VS2005 / MSVC 8.0 + sys.version = ('2.5.1 (r251:54863, Apr 18 2007, 08:51:08) ' + '[MSC v.1400 32 bits (Intel)]') + self.assertEquals(get_msvcr(), ['msvcr80']) + + # VS2008 / MSVC 9.0 + sys.version = ('2.5.1 (r251:54863, Apr 18 2007, 08:51:08) ' + '[MSC v.1500 32 bits (Intel)]') + self.assertEquals(get_msvcr(), ['msvcr90']) + + # unknown + sys.version = ('2.5.1 (r251:54863, Apr 18 2007, 08:51:08) ' + '[MSC v.1999 32 bits (Intel)]') + self.assertRaises(ValueError, get_msvcr) + def test_suite(): return unittest.makeSuite(CygwinCCompilerTestCase) Modified: python/branches/py3k/Misc/NEWS ============================================================================== --- python/branches/py3k/Misc/NEWS (original) +++ python/branches/py3k/Misc/NEWS Thu Jun 11 11:25:41 2009 @@ -772,6 +772,8 @@ Library ------- +- Issue #6263: Fixed syntax error in distutils.cygwincompiler. + - Issue #5201: distutils.sysconfig.parse_makefile() now understands `$$` in Makefiles. This prevents compile errors when using syntax like: `LDFLAGS='-rpath=\$$LIB:/some/other/path'`. Patch by Floris Bruynooghe. From python-checkins at python.org Thu Jun 11 11:29:47 2009 From: python-checkins at python.org (tarek.ziade) Date: Thu, 11 Jun 2009 11:29:47 +0200 (CEST) Subject: [Python-checkins] r73352 - in python/branches/release30-maint: Lib/distutils/cygwinccompiler.py Misc/NEWS Message-ID: <20090611092947.F1D42C524@mail.python.org> Author: tarek.ziade Date: Thu Jun 11 11:29:47 2009 New Revision: 73352 Log: Merged revisions 73351 via svnmerge from svn+ssh://pythondev at svn.python.org/python/branches/py3k ................ r73351 | tarek.ziade | 2009-06-11 11:25:41 +0200 (Thu, 11 Jun 2009) | 9 lines Merged revisions 73348 via svnmerge from svn+ssh://pythondev at svn.python.org/python/trunk ........ r73348 | tarek.ziade | 2009-06-11 11:13:36 +0200 (Thu, 11 Jun 2009) | 1 line #6263 fixed syntax error in distutils.cygwinccompiler ........ ................ Modified: python/branches/release30-maint/ (props changed) python/branches/release30-maint/Lib/distutils/cygwinccompiler.py python/branches/release30-maint/Misc/NEWS Modified: python/branches/release30-maint/Lib/distutils/cygwinccompiler.py ============================================================================== --- python/branches/release30-maint/Lib/distutils/cygwinccompiler.py (original) +++ python/branches/release30-maint/Lib/distutils/cygwinccompiler.py Thu Jun 11 11:29:47 2009 @@ -74,7 +74,7 @@ # VS2008 / MSVC 9.0 return ['msvcr90'] else: - raise ValueError("Unknown MS Compiler version %i " % msc_Ver) + raise ValueError("Unknown MS Compiler version %s " % msc_ver) class CygwinCCompiler (UnixCCompiler): Modified: python/branches/release30-maint/Misc/NEWS ============================================================================== --- python/branches/release30-maint/Misc/NEWS (original) +++ python/branches/release30-maint/Misc/NEWS Thu Jun 11 11:29:47 2009 @@ -323,6 +323,8 @@ Library ------- +- Issue #6263: Fixed syntax error in distutils.cygwincompiler. + - Issue #5201: distutils.sysconfig.parse_makefile() now understands `$$` in Makefiles. This prevents compile errors when using syntax like: `LDFLAGS='-rpath=\$$LIB:/some/other/path'`. Patch by Floris Bruynooghe. From python-checkins at python.org Thu Jun 11 11:53:36 2009 From: python-checkins at python.org (vinay.sajip) Date: Thu, 11 Jun 2009 11:53:36 +0200 (CEST) Subject: [Python-checkins] r73353 - python/trunk/Lib/logging/handlers.py Message-ID: <20090611095336.0AC51C52C@mail.python.org> Author: vinay.sajip Date: Thu Jun 11 11:53:35 2009 New Revision: 73353 Log: Issue #5262: Improved fix. Modified: python/trunk/Lib/logging/handlers.py Modified: python/trunk/Lib/logging/handlers.py ============================================================================== --- python/trunk/Lib/logging/handlers.py (original) +++ python/trunk/Lib/logging/handlers.py Thu Jun 11 11:53:35 2009 @@ -172,7 +172,6 @@ # # Case of the 'when' specifier is not important; lower or upper case # will work. - currentTime = int(time.time()) if self.when == 'S': self.interval = 1 # one second self.suffix = "%Y-%m-%d_%H-%M-%S" @@ -203,14 +202,15 @@ self.extMatch = re.compile(self.extMatch) self.interval = self.interval * interval # multiply by units requested - self.rolloverAt = currentTime + self.interval - # If we are rolling over at midnight or weekly, then the interval is already known. - # What we need to figure out is WHEN the next interval is. - self.adjustRollover(currentTime) + self.rolloverAt = self.computeRollover(int(time.time())) #print "Will rollover at %d, %d seconds from now" % (self.rolloverAt, self.rolloverAt - currentTime) - def adjustRollover(self, currentTime): + def computeRollover(self, currentTime): + """ + Work out the rollover time based on the specified time. + """ + result = currentTime + self.interval # If we are rolling over at midnight or weekly, then the interval is already known. # What we need to figure out is WHEN the next interval is. In other words, # if you are rolling over at midnight, then your base interval is 1 day, @@ -230,7 +230,7 @@ # r is the number of seconds left between now and midnight r = _MIDNIGHT - ((currentHour * 60 + currentMinute) * 60 + currentSecond) - self.rolloverAt = currentTime + r + result = currentTime + r # If we are rolling over on a certain day, add in the number of days until # the next rollover, but offset by 1 since we just calculated the time # until the next day starts. There are three cases: @@ -253,7 +253,7 @@ daysToWait = self.dayOfWeek - day else: daysToWait = 6 - day + self.dayOfWeek + 1 - newRolloverAt = self.rolloverAt + (daysToWait * (60 * 60 * 24)) + newRolloverAt = result + (daysToWait * (60 * 60 * 24)) if not self.utc: dstNow = t[-1] dstAtRollover = time.localtime(newRolloverAt)[-1] @@ -262,7 +262,8 @@ newRolloverAt = newRolloverAt - 3600 else: # DST bows out before next rollover, so we need to add an hour newRolloverAt = newRolloverAt + 3600 - self.rolloverAt = newRolloverAt + result = newRolloverAt + return result def shouldRollover(self, record): """ @@ -331,8 +332,8 @@ #print "%s -> %s" % (self.baseFilename, dfn) self.mode = 'w' self.stream = self._open() - newRolloverAt = self.rolloverAt + self.interval currentTime = int(time.time()) + newRolloverAt = self.computeRollover(currentTime) while newRolloverAt <= currentTime: newRolloverAt = newRolloverAt + self.interval #If DST changes and midnight or weekly rollover, adjust for this. @@ -345,7 +346,6 @@ else: # DST bows out before next rollover, so we need to add an hour newRolloverAt = newRolloverAt + 3600 self.rolloverAt = newRolloverAt - self.adjustRollover(time.time()) class WatchedFileHandler(logging.FileHandler): """ From python-checkins at python.org Thu Jun 11 11:55:10 2009 From: python-checkins at python.org (tarek.ziade) Date: Thu, 11 Jun 2009 11:55:10 +0200 (CEST) Subject: [Python-checkins] r73354 - python/trunk/Lib/distutils/cygwinccompiler.py Message-ID: <20090611095510.200F6D51A@mail.python.org> Author: tarek.ziade Date: Thu Jun 11 11:55:09 2009 New Revision: 73354 Log: pep8-fied cygwinccompiler module Modified: python/trunk/Lib/distutils/cygwinccompiler.py Modified: python/trunk/Lib/distutils/cygwinccompiler.py ============================================================================== --- python/trunk/Lib/distutils/cygwinccompiler.py (original) +++ python/trunk/Lib/distutils/cygwinccompiler.py Thu Jun 11 11:55:09 2009 @@ -84,8 +84,9 @@ raise ValueError("Unknown MS Compiler version %s " % msc_ver) -class CygwinCCompiler (UnixCCompiler): - +class CygwinCCompiler(UnixCCompiler): + """ Handles the Cygwin port of the GNU C compiler to Windows. + """ compiler_type = 'cygwin' obj_extension = ".o" static_lib_extension = ".a" @@ -94,11 +95,11 @@ shared_lib_format = "%s%s" exe_extension = ".exe" - def __init__ (self, verbose=0, dry_run=0, force=0): + def __init__(self, verbose=0, dry_run=0, force=0): - UnixCCompiler.__init__ (self, verbose, dry_run, force) + UnixCCompiler.__init__(self, verbose, dry_run, force) - (status, details) = check_config_h() + status, details = check_config_h() self.debug_print("Python's GCC status: %s (details: %s)" % (status, details)) if status is not CONFIG_H_OK: @@ -153,10 +154,8 @@ # with MSVC 7.0 or later. self.dll_libraries = get_msvcr() - # __init__ () - - def _compile(self, obj, src, ext, cc_args, extra_postargs, pp_opts): + """Compiles the source by spawing GCC and windres if needed.""" if ext == '.rc' or ext == '.res': # gcc needs '.res' and '.rc' compiled to object files !!! try: @@ -170,21 +169,11 @@ except DistutilsExecError, msg: raise CompileError, msg - def link (self, - target_desc, - objects, - output_filename, - output_dir=None, - libraries=None, - library_dirs=None, - runtime_library_dirs=None, - export_symbols=None, - debug=0, - extra_preargs=None, - extra_postargs=None, - build_temp=None, - target_lang=None): - + def link(self, target_desc, objects, output_filename, output_dir=None, + libraries=None, library_dirs=None, runtime_library_dirs=None, + export_symbols=None, debug=0, extra_preargs=None, + extra_postargs=None, build_temp=None, target_lang=None): + """Link the objects.""" # use separate copies, so we can modify the lists extra_preargs = copy.copy(extra_preargs or []) libraries = copy.copy(libraries or []) @@ -249,64 +238,44 @@ if not debug: extra_preargs.append("-s") - UnixCCompiler.link(self, - target_desc, - objects, - output_filename, - output_dir, - libraries, - library_dirs, + UnixCCompiler.link(self, target_desc, objects, output_filename, + output_dir, libraries, library_dirs, runtime_library_dirs, None, # export_symbols, we do this in our def-file - debug, - extra_preargs, - extra_postargs, - build_temp, + debug, extra_preargs, extra_postargs, build_temp, target_lang) - # link () - # -- Miscellaneous methods ----------------------------------------- - # overwrite the one from CCompiler to support rc and res-files - def object_filenames (self, - source_filenames, - strip_dir=0, - output_dir=''): - if output_dir is None: output_dir = '' + def object_filenames(self, source_filenames, strip_dir=0, output_dir=''): + """Adds supports for rc and res files.""" + if output_dir is None: + output_dir = '' obj_names = [] for src_name in source_filenames: # use normcase to make sure '.rc' is really '.rc' and not '.RC' - (base, ext) = os.path.splitext (os.path.normcase(src_name)) + base, ext = os.path.splitext(os.path.normcase(src_name)) if ext not in (self.src_extensions + ['.rc','.res']): raise UnknownFileError, \ - "unknown file type '%s' (from '%s')" % \ - (ext, src_name) + "unknown file type '%s' (from '%s')" % (ext, src_name) if strip_dir: base = os.path.basename (base) - if ext == '.res' or ext == '.rc': + if ext in ('.res', '.rc'): # these need to be compiled to object files - obj_names.append (os.path.join (output_dir, - base + ext + self.obj_extension)) + obj_names.append (os.path.join(output_dir, + base + ext + self.obj_extension)) else: - obj_names.append (os.path.join (output_dir, - base + self.obj_extension)) + obj_names.append (os.path.join(output_dir, + base + self.obj_extension)) return obj_names - # object_filenames () - -# class CygwinCCompiler - - # the same as cygwin plus some additional parameters -class Mingw32CCompiler (CygwinCCompiler): - +class Mingw32CCompiler(CygwinCCompiler): + """ Handles the Mingw32 port of the GNU C compiler to Windows. + """ compiler_type = 'mingw32' - def __init__ (self, - verbose=0, - dry_run=0, - force=0): + def __init__(self, verbose=0, dry_run=0, force=0): CygwinCCompiler.__init__ (self, verbose, dry_run, force) @@ -342,10 +311,6 @@ # with MSVC 7.0 or later. self.dll_libraries = get_msvcr() - # __init__ () - -# class Mingw32CCompiler - # Because these compilers aren't configured in Python's pyconfig.h file by # default, we should at least warn the user if he is using a unmodified # version. From python-checkins at python.org Thu Jun 11 11:57:11 2009 From: python-checkins at python.org (tarek.ziade) Date: Thu, 11 Jun 2009 11:57:11 +0200 (CEST) Subject: [Python-checkins] r73355 - python/branches/release26-maint Message-ID: <20090611095711.C7C13C52F@mail.python.org> Author: tarek.ziade Date: Thu Jun 11 11:57:11 2009 New Revision: 73355 Log: Blocked revisions 73354 via svnmerge ........ r73354 | tarek.ziade | 2009-06-11 11:55:09 +0200 (Thu, 11 Jun 2009) | 1 line pep8-fied cygwinccompiler module ........ Modified: python/branches/release26-maint/ (props changed) From python-checkins at python.org Thu Jun 11 12:00:56 2009 From: python-checkins at python.org (tarek.ziade) Date: Thu, 11 Jun 2009 12:00:56 +0200 (CEST) Subject: [Python-checkins] r73356 - in python/branches/py3k: Lib/distutils/cygwinccompiler.py Message-ID: <20090611100056.41610C53E@mail.python.org> Author: tarek.ziade Date: Thu Jun 11 12:00:56 2009 New Revision: 73356 Log: Merged revisions 73354 via svnmerge from svn+ssh://pythondev at svn.python.org/python/trunk ........ r73354 | tarek.ziade | 2009-06-11 11:55:09 +0200 (Thu, 11 Jun 2009) | 1 line pep8-fied cygwinccompiler module ........ Modified: python/branches/py3k/ (props changed) python/branches/py3k/Lib/distutils/cygwinccompiler.py Modified: python/branches/py3k/Lib/distutils/cygwinccompiler.py ============================================================================== --- python/branches/py3k/Lib/distutils/cygwinccompiler.py (original) +++ python/branches/py3k/Lib/distutils/cygwinccompiler.py Thu Jun 11 12:00:56 2009 @@ -84,8 +84,9 @@ raise ValueError("Unknown MS Compiler version %s " % msc_ver) -class CygwinCCompiler (UnixCCompiler): - +class CygwinCCompiler(UnixCCompiler): + """ Handles the Cygwin port of the GNU C compiler to Windows. + """ compiler_type = 'cygwin' obj_extension = ".o" static_lib_extension = ".a" @@ -94,11 +95,11 @@ shared_lib_format = "%s%s" exe_extension = ".exe" - def __init__ (self, verbose=0, dry_run=0, force=0): + def __init__(self, verbose=0, dry_run=0, force=0): - UnixCCompiler.__init__ (self, verbose, dry_run, force) + UnixCCompiler.__init__(self, verbose, dry_run, force) - (status, details) = check_config_h() + status, details = check_config_h() self.debug_print("Python's GCC status: %s (details: %s)" % (status, details)) if status is not CONFIG_H_OK: @@ -153,10 +154,8 @@ # with MSVC 7.0 or later. self.dll_libraries = get_msvcr() - # __init__ () - - def _compile(self, obj, src, ext, cc_args, extra_postargs, pp_opts): + """Compiles the source by spawing GCC and windres if needed.""" if ext == '.rc' or ext == '.res': # gcc needs '.res' and '.rc' compiled to object files !!! try: @@ -170,21 +169,11 @@ except DistutilsExecError as msg: raise CompileError(msg) - def link (self, - target_desc, - objects, - output_filename, - output_dir=None, - libraries=None, - library_dirs=None, - runtime_library_dirs=None, - export_symbols=None, - debug=0, - extra_preargs=None, - extra_postargs=None, - build_temp=None, - target_lang=None): - + def link(self, target_desc, objects, output_filename, output_dir=None, + libraries=None, library_dirs=None, runtime_library_dirs=None, + export_symbols=None, debug=0, extra_preargs=None, + extra_postargs=None, build_temp=None, target_lang=None): + """Link the objects.""" # use separate copies, so we can modify the lists extra_preargs = copy.copy(extra_preargs or []) libraries = copy.copy(libraries or []) @@ -249,63 +238,44 @@ if not debug: extra_preargs.append("-s") - UnixCCompiler.link(self, - target_desc, - objects, - output_filename, - output_dir, - libraries, - library_dirs, + UnixCCompiler.link(self, target_desc, objects, output_filename, + output_dir, libraries, library_dirs, runtime_library_dirs, None, # export_symbols, we do this in our def-file - debug, - extra_preargs, - extra_postargs, - build_temp, + debug, extra_preargs, extra_postargs, build_temp, target_lang) - # link () - # -- Miscellaneous methods ----------------------------------------- - # overwrite the one from CCompiler to support rc and res-files - def object_filenames (self, - source_filenames, - strip_dir=0, - output_dir=''): - if output_dir is None: output_dir = '' + def object_filenames(self, source_filenames, strip_dir=0, output_dir=''): + """Adds supports for rc and res files.""" + if output_dir is None: + output_dir = '' obj_names = [] for src_name in source_filenames: # use normcase to make sure '.rc' is really '.rc' and not '.RC' - (base, ext) = os.path.splitext (os.path.normcase(src_name)) + base, ext = os.path.splitext(os.path.normcase(src_name)) if ext not in (self.src_extensions + ['.rc','.res']): raise UnknownFileError("unknown file type '%s' (from '%s')" % \ (ext, src_name)) if strip_dir: base = os.path.basename (base) - if ext == '.res' or ext == '.rc': + if ext in ('.res', '.rc'): # these need to be compiled to object files - obj_names.append (os.path.join (output_dir, - base + ext + self.obj_extension)) + obj_names.append (os.path.join(output_dir, + base + ext + self.obj_extension)) else: - obj_names.append (os.path.join (output_dir, - base + self.obj_extension)) + obj_names.append (os.path.join(output_dir, + base + self.obj_extension)) return obj_names - # object_filenames () - -# class CygwinCCompiler - - # the same as cygwin plus some additional parameters -class Mingw32CCompiler (CygwinCCompiler): - +class Mingw32CCompiler(CygwinCCompiler): + """ Handles the Mingw32 port of the GNU C compiler to Windows. + """ compiler_type = 'mingw32' - def __init__ (self, - verbose=0, - dry_run=0, - force=0): + def __init__(self, verbose=0, dry_run=0, force=0): CygwinCCompiler.__init__ (self, verbose, dry_run, force) @@ -341,10 +311,6 @@ # with MSVC 7.0 or later. self.dll_libraries = get_msvcr() - # __init__ () - -# class Mingw32CCompiler - # Because these compilers aren't configured in Python's pyconfig.h file by # default, we should at least warn the user if he is using a unmodified # version. From python-checkins at python.org Thu Jun 11 12:01:04 2009 From: python-checkins at python.org (vinay.sajip) Date: Thu, 11 Jun 2009 12:01:04 +0200 (CEST) Subject: [Python-checkins] r73357 - in python/branches/release26-maint: Lib/logging/handlers.py Misc/NEWS Message-ID: <20090611100104.C053FD6CC@mail.python.org> Author: vinay.sajip Date: Thu Jun 11 12:01:04 2009 New Revision: 73357 Log: Issue #5262: Fixed bug in next roll over time computation in TimedRotatingFileHandler. Modified: python/branches/release26-maint/Lib/logging/handlers.py python/branches/release26-maint/Misc/NEWS Modified: python/branches/release26-maint/Lib/logging/handlers.py ============================================================================== --- python/branches/release26-maint/Lib/logging/handlers.py (original) +++ python/branches/release26-maint/Lib/logging/handlers.py Thu Jun 11 12:01:04 2009 @@ -203,8 +203,15 @@ self.extMatch = re.compile(self.extMatch) self.interval = self.interval * interval # multiply by units requested - self.rolloverAt = currentTime + self.interval + self.rolloverAt = self.computeRollover(int(time.time())) + #print "Will rollover at %d, %d seconds from now" % (self.rolloverAt, self.rolloverAt - currentTime) + + def computeRollover(self, currentTime): + """ + Work out the rollover time based on the specified time. + """ + result = currentTime + self.interval # If we are rolling over at midnight or weekly, then the interval is already known. # What we need to figure out is WHEN the next interval is. In other words, # if you are rolling over at midnight, then your base interval is 1 day, @@ -214,7 +221,7 @@ # the rest. Note that this code doesn't care about leap seconds. :) if self.when == 'MIDNIGHT' or self.when.startswith('W'): # This could be done with less code, but I wanted it to be clear - if utc: + if self.utc: t = time.gmtime(currentTime) else: t = time.localtime(currentTime) @@ -224,7 +231,7 @@ # r is the number of seconds left between now and midnight r = _MIDNIGHT - ((currentHour * 60 + currentMinute) * 60 + currentSecond) - self.rolloverAt = currentTime + r + result = currentTime + r # If we are rolling over on a certain day, add in the number of days until # the next rollover, but offset by 1 since we just calculated the time # until the next day starts. There are three cases: @@ -240,15 +247,15 @@ # The calculations described in 2) and 3) above need to have a day added. # This is because the above time calculation takes us to midnight on this # day, i.e. the start of the next day. - if when.startswith('W'): + if self.when.startswith('W'): day = t[6] # 0 is Monday if day != self.dayOfWeek: if day < self.dayOfWeek: daysToWait = self.dayOfWeek - day else: daysToWait = 6 - day + self.dayOfWeek + 1 - newRolloverAt = self.rolloverAt + (daysToWait * (60 * 60 * 24)) - if not utc: + newRolloverAt = result + (daysToWait * (60 * 60 * 24)) + if not self.utc: dstNow = t[-1] dstAtRollover = time.localtime(newRolloverAt)[-1] if dstNow != dstAtRollover: @@ -256,9 +263,8 @@ newRolloverAt = newRolloverAt - 3600 else: # DST bows out before next rollover, so we need to add an hour newRolloverAt = newRolloverAt + 3600 - self.rolloverAt = newRolloverAt - - #print "Will rollover at %d, %d seconds from now" % (self.rolloverAt, self.rolloverAt - currentTime) + result = newRolloverAt + return result def shouldRollover(self, record): """ @@ -327,8 +333,8 @@ #print "%s -> %s" % (self.baseFilename, dfn) self.mode = 'w' self.stream = self._open() - newRolloverAt = self.rolloverAt + self.interval currentTime = int(time.time()) + newRolloverAt = self.computeRollover(currentTime) while newRolloverAt <= currentTime: newRolloverAt = newRolloverAt + self.interval #If DST changes and midnight or weekly rollover, adjust for this. Modified: python/branches/release26-maint/Misc/NEWS ============================================================================== --- python/branches/release26-maint/Misc/NEWS (original) +++ python/branches/release26-maint/Misc/NEWS Thu Jun 11 12:01:04 2009 @@ -56,6 +56,9 @@ Library ------- +- Issue #5262: Fixed bug in next rollover time computation in + TimedRotatingFileHandler. + - Issue #6121: pydoc now ignores leading and trailing spaces in the argument to the 'help' function. @@ -240,7 +243,7 @@ in Makefiles. This prevents compile errors when using syntax like: `LDFLAGS='-rpath=\$$LIB:/some/other/path'`. Patch by Floris Bruynooghe. -- Issue #6062: In distutils, fixed the package option of build_ext. Feedback +- Issue #6062: In distutils, fixed the package option of build_ext. Feedback and tests on pywin32 by Tim Golden. - Issue #1309567: Fix linecache behavior of stripping subdirectories when From python-checkins at python.org Thu Jun 11 12:03:19 2009 From: python-checkins at python.org (tarek.ziade) Date: Thu, 11 Jun 2009 12:03:19 +0200 (CEST) Subject: [Python-checkins] r73358 - python/branches/release30-maint Message-ID: <20090611100319.997A9D89B@mail.python.org> Author: tarek.ziade Date: Thu Jun 11 12:03:19 2009 New Revision: 73358 Log: Blocked revisions 73356 via svnmerge ................ r73356 | tarek.ziade | 2009-06-11 12:00:56 +0200 (Thu, 11 Jun 2009) | 9 lines Merged revisions 73354 via svnmerge from svn+ssh://pythondev at svn.python.org/python/trunk ........ r73354 | tarek.ziade | 2009-06-11 11:55:09 +0200 (Thu, 11 Jun 2009) | 1 line pep8-fied cygwinccompiler module ........ ................ Modified: python/branches/release30-maint/ (props changed) From python-checkins at python.org Thu Jun 11 12:11:48 2009 From: python-checkins at python.org (vinay.sajip) Date: Thu, 11 Jun 2009 12:11:48 +0200 (CEST) Subject: [Python-checkins] r73359 - in python/branches/py3k: Lib/logging/handlers.py Misc/NEWS Message-ID: <20090611101148.66D51C53E@mail.python.org> Author: vinay.sajip Date: Thu Jun 11 12:11:47 2009 New Revision: 73359 Log: Issue #5262: Fixed bug in next roll over time computation in TimedRotatingFileHandler. Modified: python/branches/py3k/Lib/logging/handlers.py python/branches/py3k/Misc/NEWS Modified: python/branches/py3k/Lib/logging/handlers.py ============================================================================== --- python/branches/py3k/Lib/logging/handlers.py (original) +++ python/branches/py3k/Lib/logging/handlers.py Thu Jun 11 12:11:47 2009 @@ -172,7 +172,6 @@ # # Case of the 'when' specifier is not important; lower or upper case # will work. - currentTime = int(time.time()) if self.when == 'S': self.interval = 1 # one second self.suffix = "%Y-%m-%d_%H-%M-%S" @@ -203,8 +202,13 @@ self.extMatch = re.compile(self.extMatch, re.ASCII) self.interval = self.interval * interval # multiply by units requested - self.rolloverAt = currentTime + self.interval + self.rolloverAt = self.computeRollover(int(time.time())) + def computeRollover(self, currentTime): + """ + Work out the rollover time based on the specified time. + """ + result = currentTime + self.interval # If we are rolling over at midnight or weekly, then the interval is already known. # What we need to figure out is WHEN the next interval is. In other words, # if you are rolling over at midnight, then your base interval is 1 day, @@ -214,7 +218,7 @@ # the rest. Note that this code doesn't care about leap seconds. :) if self.when == 'MIDNIGHT' or self.when.startswith('W'): # This could be done with less code, but I wanted it to be clear - if utc: + if self.utc: t = time.gmtime(currentTime) else: t = time.localtime(currentTime) @@ -224,7 +228,7 @@ # r is the number of seconds left between now and midnight r = _MIDNIGHT - ((currentHour * 60 + currentMinute) * 60 + currentSecond) - self.rolloverAt = currentTime + r + result = currentTime + r # If we are rolling over on a certain day, add in the number of days until # the next rollover, but offset by 1 since we just calculated the time # until the next day starts. There are three cases: @@ -240,15 +244,15 @@ # The calculations described in 2) and 3) above need to have a day added. # This is because the above time calculation takes us to midnight on this # day, i.e. the start of the next day. - if when.startswith('W'): + if self.when.startswith('W'): day = t[6] # 0 is Monday if day != self.dayOfWeek: if day < self.dayOfWeek: daysToWait = self.dayOfWeek - day else: daysToWait = 6 - day + self.dayOfWeek + 1 - newRolloverAt = self.rolloverAt + (daysToWait * (60 * 60 * 24)) - if not utc: + newRolloverAt = result + (daysToWait * (60 * 60 * 24)) + if not self.utc: dstNow = t[-1] dstAtRollover = time.localtime(newRolloverAt)[-1] if dstNow != dstAtRollover: @@ -256,9 +260,8 @@ newRolloverAt = newRolloverAt - 3600 else: # DST bows out before next rollover, so we need to add an hour newRolloverAt = newRolloverAt + 3600 - self.rolloverAt = newRolloverAt - - #print "Will rollover at %d, %d seconds from now" % (self.rolloverAt, self.rolloverAt - currentTime) + result = newRolloverAt + return result def shouldRollover(self, record): """ @@ -327,8 +330,8 @@ #print "%s -> %s" % (self.baseFilename, dfn) self.mode = 'w' self.stream = self._open() - newRolloverAt = self.rolloverAt + self.interval currentTime = int(time.time()) + newRolloverAt = self.computeRollover(currentTime) while newRolloverAt <= currentTime: newRolloverAt = newRolloverAt + self.interval #If DST changes and midnight or weekly rollover, adjust for this. Modified: python/branches/py3k/Misc/NEWS ============================================================================== --- python/branches/py3k/Misc/NEWS (original) +++ python/branches/py3k/Misc/NEWS Thu Jun 11 12:11:47 2009 @@ -24,6 +24,9 @@ Library ------- +- Issue #5262: Fixed bug in next rollover time computation in + TimedRotatingFileHandler. + - Issue #6217: The C implementation of io.TextIOWrapper didn't include the errors property. Additionally, the errors and encoding properties of StringIO are always None now. @@ -347,7 +350,7 @@ - Issue #5150: IDLE's format menu now has an option to strip trailing whitespace. -- Issue #5940: distutils.command.build_clib.check_library_list was not doing +- Issue #5940: distutils.command.build_clib.check_library_list was not doing the right type checkings anymore. - Issue #4875: On win32, ctypes.util.find_library does no longer @@ -783,7 +786,7 @@ - Issue #6048: Now Distutils uses the tarfile module in archive_util. -- Issue #6062: In distutils, fixed the package option of build_ext. Feedback +- Issue #6062: In distutils, fixed the package option of build_ext. Feedback and tests on pywin32 by Tim Golden. - Issue #6053: Fixed distutils tests on win32. patch by Hirokazu Yamamoto. @@ -791,7 +794,7 @@ - Issue #6046: Fixed the library extension when distutils build_ext is used inplace. Initial patch by Roumen Petrov. -- Issue #6041: Now distutils `sdist` and `register` commands use `check` as a +- Issue #6041: Now distutils `sdist` and `register` commands use `check` as a subcommand. - Issue #6022: a test file was created in the current working directory by @@ -812,7 +815,7 @@ - Issue #2245: aifc now skips chunk types it doesn't recognize, per spec. -- Issue #5874: distutils.tests.test_config_cmd is not locale-sensitive +- Issue #5874: distutils.tests.test_config_cmd is not locale-sensitive anymore. - Issue #5810: Fixed Distutils test_build_scripts so it uses @@ -1221,7 +1224,7 @@ linker, rather than always exit successfully. Patch by Floris Bruynooghe. - Issue #4587: Add configure option --with-dbmliborder=db1:db2:... to specify - the order that backends for the dbm extension are checked. + the order that backends for the dbm extension are checked. - Link the shared python library with $(MODLIBS). From buildbot at python.org Thu Jun 11 12:47:12 2009 From: buildbot at python.org (buildbot at python.org) Date: Thu, 11 Jun 2009 10:47:12 +0000 Subject: [Python-checkins] buildbot failure in sparc solaris10 gcc 3.x Message-ID: <20090611104712.DA690C547@mail.python.org> The Buildbot has detected a new failure of sparc solaris10 gcc 3.x. Full details are available at: http://www.python.org/dev/buildbot/all/sparc%20solaris10%20gcc%203.x/builds/813 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: loewis-sun Build Reason: Build Source Stamp: [branch branches/py3k] HEAD Blamelist: tarek.ziade BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_posix ====================================================================== ERROR: test_getcwd_long_pathnames (test.test_posix.PosixTester) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home2/buildbot/slave/3.x.loewis-sun/build/Lib/test/test_posix.py", line 251, in test_getcwd_long_pathnames support.rmtree(base_path) File "/home2/buildbot/slave/3.x.loewis-sun/build/Lib/test/support.py", line 181, in rmtree shutil.rmtree(path) File "/home2/buildbot/slave/3.x.loewis-sun/build/Lib/shutil.py", line 239, in rmtree onerror(os.rmdir, path, sys.exc_info()) File "/home2/buildbot/slave/3.x.loewis-sun/build/Lib/shutil.py", line 237, in rmtree os.rmdir(path) OSError: [Errno 22] Invalid argument: '/home2/buildbot/slave/3.x.loewis-sun/build/@test.getcwd/@test.getcwd' sincerely, -The Buildbot From buildbot at python.org Thu Jun 11 13:02:15 2009 From: buildbot at python.org (buildbot at python.org) Date: Thu, 11 Jun 2009 11:02:15 +0000 Subject: [Python-checkins] buildbot failure in amd64 gentoo 3.x Message-ID: <20090611110215.CF845C54C@mail.python.org> The Buildbot has detected a new failure of amd64 gentoo 3.x. Full details are available at: http://www.python.org/dev/buildbot/all/amd64%20gentoo%203.x/builds/796 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: norwitz-amd64 Build Reason: Build Source Stamp: [branch branches/py3k] HEAD Blamelist: tarek.ziade BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_mailbox make: *** [buildbottest] Error 1 sincerely, -The Buildbot From buildbot at python.org Thu Jun 11 13:04:50 2009 From: buildbot at python.org (buildbot at python.org) Date: Thu, 11 Jun 2009 11:04:50 +0000 Subject: [Python-checkins] buildbot failure in x86 XP-4 trunk Message-ID: <20090611110451.1E53BC55D@mail.python.org> The Buildbot has detected a new failure of x86 XP-4 trunk. Full details are available at: http://www.python.org/dev/buildbot/all/x86%20XP-4%20trunk/builds/2231 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: bolen-windows Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: amaury.forgeotdarc,tarek.ziade BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_bsddb3 ====================================================================== ERROR: test01_basic_replication (bsddb.test.test_replication.DBReplicationManager) ---------------------------------------------------------------------- Traceback (most recent call last): File "E:\cygwin\home\db3l\buildarea\trunk.bolen-windows\build\lib\bsddb\test\test_replication.py", line 170, in test01_basic_replication mode=0666, txn=txn) DBNoSuchFileError: (2, 'No such file or directory -- connection closed: Successful return: 0') ====================================================================== ERROR: test01_basic_replication (bsddb.test.test_replication.DBReplicationManager) ---------------------------------------------------------------------- Traceback (most recent call last): File "E:\cygwin\home\db3l\buildarea\trunk.bolen-windows\build\lib\bsddb\test\test_replication.py", line 58, in tearDown if self.dbClient : DBError: (0, 'DB object has been closed') ====================================================================== FAIL: test01_basic_replication (bsddb.test.test_replication.DBBaseReplication) ---------------------------------------------------------------------- Traceback (most recent call last): File "E:\cygwin\home\db3l\buildarea\trunk.bolen-windows\build\lib\bsddb\test\test_replication.py", line 315, in test01_basic_replication self.assertTrue(time.time() Author: georg.brandl Date: Thu Jun 11 13:33:24 2009 New Revision: 73360 Log: Recorded merge of revisions 73350,73353 via svnmerge from svn+ssh://pythondev at svn.python.org/python/trunk ........ r73350 | vinay.sajip | 2009-06-11 11:23:41 +0200 (Do, 11 Jun 2009) | 1 line Issue #5262: Fixed bug in next roll over time computation in TimedRotatingFileHandler. ........ r73353 | vinay.sajip | 2009-06-11 11:53:35 +0200 (Do, 11 Jun 2009) | 1 line Issue #5262: Improved fix. ........ Modified: python/branches/py3k/ (props changed) From buildbot at python.org Thu Jun 11 17:14:02 2009 From: buildbot at python.org (buildbot at python.org) Date: Thu, 11 Jun 2009 15:14:02 +0000 Subject: [Python-checkins] buildbot failure in sparc solaris10 gcc 3.0 Message-ID: <20090611151402.31CD1D9C1@mail.python.org> The Buildbot has detected a new failure of sparc solaris10 gcc 3.0. Full details are available at: http://www.python.org/dev/buildbot/all/sparc%20solaris10%20gcc%203.0/builds/405 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: loewis-sun Build Reason: Build Source Stamp: [branch branches/release30-maint] HEAD Blamelist: tarek.ziade BUILD FAILED: failed test Excerpt from the test logfile: 3 tests failed: test_distutils test_posix test_subprocess ====================================================================== FAIL: test_get_python_inc (distutils.tests.test_sysconfig.SysconfigTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home2/buildbot/slave/3.0.loewis-sun/build/Lib/distutils/tests/test_sysconfig.py", line 54, in test_get_python_inc self.assert_(os.path.isdir(inc_dir), inc_dir) AssertionError: /home2/buildbot/slave/3.0.loewis-sun/build/@test.getcwd/Include ====================================================================== ERROR: test_getcwd_long_pathnames (test.test_posix.PosixTester) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home2/buildbot/slave/3.0.loewis-sun/build/Lib/test/test_posix.py", line 252, in test_getcwd_long_pathnames support.rmtree(base_path) File "/home2/buildbot/slave/3.0.loewis-sun/build/Lib/test/support.py", line 98, in rmtree shutil.rmtree(path) File "/home2/buildbot/slave/3.0.loewis-sun/build/Lib/shutil.py", line 225, in rmtree onerror(os.rmdir, path, sys.exc_info()) File "/home2/buildbot/slave/3.0.loewis-sun/build/Lib/shutil.py", line 223, in rmtree os.rmdir(path) OSError: [Errno 22] Invalid argument: '/home2/buildbot/slave/3.0.loewis-sun/build/@test.getcwd/@test.getcwd' ====================================================================== FAIL: test_executable (test.test_subprocess.ProcessTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home2/buildbot/slave/3.0.loewis-sun/build/Lib/test/test_subprocess.py", line 115, in test_executable self.assertEqual(p.returncode, 47) AssertionError: -6 != 47 sincerely, -The Buildbot From python-checkins at python.org Thu Jun 11 18:25:53 2009 From: python-checkins at python.org (benjamin.peterson) Date: Thu, 11 Jun 2009 18:25:53 +0200 (CEST) Subject: [Python-checkins] r73361 - python/trunk/Python/ast.c Message-ID: <20090611162553.11BA4D8D3@mail.python.org> Author: benjamin.peterson Date: Thu Jun 11 18:25:52 2009 New Revision: 73361 Log: remove duplicate check Modified: python/trunk/Python/ast.c Modified: python/trunk/Python/ast.c ============================================================================== --- python/trunk/Python/ast.c (original) +++ python/trunk/Python/ast.c Thu Jun 11 18:25:52 2009 @@ -2120,10 +2120,6 @@ for (i = 0; i < NCH(n) - 2; i += 2) { expr_ty e; node *ch = CHILD(n, i); - if (TYPE(ch) == yield_expr) { - ast_error(ch, "assignment to yield expression not possible"); - return NULL; - } e = ast_for_testlist(c, ch); /* set context to assign */ From buildbot at python.org Thu Jun 11 18:37:39 2009 From: buildbot at python.org (buildbot at python.org) Date: Thu, 11 Jun 2009 16:37:39 +0000 Subject: [Python-checkins] buildbot failure in OS X x86 trunk Message-ID: <20090611163739.C1E5DD437@mail.python.org> The Buildbot has detected a new failure of OS X x86 trunk. Full details are available at: http://www.python.org/dev/buildbot/all/OS%20X%20x86%20trunk/builds/674 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: noller-osx86 Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: benjamin.peterson BUILD FAILED: failed test Excerpt from the test logfile: make: *** [buildbottest] Abort trap sincerely, -The Buildbot From buildbot at python.org Thu Jun 11 18:40:09 2009 From: buildbot at python.org (buildbot at python.org) Date: Thu, 11 Jun 2009 16:40:09 +0000 Subject: [Python-checkins] buildbot failure in x86 osx.5 trunk Message-ID: <20090611164009.CFCC8D4EA@mail.python.org> The Buildbot has detected a new failure of x86 osx.5 trunk. Full details are available at: http://www.python.org/dev/buildbot/all/x86%20osx.5%20trunk/builds/1173 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: heller-x86-osx5 Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: benjamin.peterson BUILD FAILED: failed test Excerpt from the test logfile: make: *** [buildbottest] Abort trap sincerely, -The Buildbot From buildbot at python.org Thu Jun 11 18:47:05 2009 From: buildbot at python.org (buildbot at python.org) Date: Thu, 11 Jun 2009 16:47:05 +0000 Subject: [Python-checkins] buildbot failure in amd64 gentoo trunk Message-ID: <20090611164705.2973ED769@mail.python.org> The Buildbot has detected a new failure of amd64 gentoo trunk. Full details are available at: http://www.python.org/dev/buildbot/all/amd64%20gentoo%20trunk/builds/153 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: norwitz-amd64 Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: benjamin.peterson BUILD FAILED: failed test Excerpt from the test logfile: make: *** [buildbottest] Aborted (core dumped) sincerely, -The Buildbot From buildbot at python.org Thu Jun 11 19:43:15 2009 From: buildbot at python.org (buildbot at python.org) Date: Thu, 11 Jun 2009 17:43:15 +0000 Subject: [Python-checkins] buildbot failure in sparc solaris10 gcc 3.x Message-ID: <20090611174315.14A44C533@mail.python.org> The Buildbot has detected a new failure of sparc solaris10 gcc 3.x. Full details are available at: http://www.python.org/dev/buildbot/all/sparc%20solaris10%20gcc%203.x/builds/815 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: loewis-sun Build Reason: Build Source Stamp: [branch branches/py3k] HEAD Blamelist: georg.brandl BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_posix ====================================================================== ERROR: test_getcwd_long_pathnames (test.test_posix.PosixTester) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home2/buildbot/slave/3.x.loewis-sun/build/Lib/test/test_posix.py", line 251, in test_getcwd_long_pathnames support.rmtree(base_path) File "/home2/buildbot/slave/3.x.loewis-sun/build/Lib/test/support.py", line 181, in rmtree shutil.rmtree(path) File "/home2/buildbot/slave/3.x.loewis-sun/build/Lib/shutil.py", line 239, in rmtree onerror(os.rmdir, path, sys.exc_info()) File "/home2/buildbot/slave/3.x.loewis-sun/build/Lib/shutil.py", line 237, in rmtree os.rmdir(path) OSError: [Errno 22] Invalid argument: '/home2/buildbot/slave/3.x.loewis-sun/build/@test.getcwd/@test.getcwd' sincerely, -The Buildbot From python-checkins at python.org Thu Jun 11 19:49:39 2009 From: python-checkins at python.org (benjamin.peterson) Date: Thu, 11 Jun 2009 19:49:39 +0200 (CEST) Subject: [Python-checkins] r73362 - python/trunk/Python/ast.c Message-ID: <20090611174939.079F1DA9B@mail.python.org> Author: benjamin.peterson Date: Thu Jun 11 19:49:38 2009 New Revision: 73362 Log: revert r73361 Modified: python/trunk/Python/ast.c Modified: python/trunk/Python/ast.c ============================================================================== --- python/trunk/Python/ast.c (original) +++ python/trunk/Python/ast.c Thu Jun 11 19:49:38 2009 @@ -2120,6 +2120,10 @@ for (i = 0; i < NCH(n) - 2; i += 2) { expr_ty e; node *ch = CHILD(n, i); + if (TYPE(ch) == yield_expr) { + ast_error(ch, "assignment to yield expression not possible"); + return NULL; + } e = ast_for_testlist(c, ch); /* set context to assign */ From python-checkins at python.org Thu Jun 11 19:51:17 2009 From: python-checkins at python.org (benjamin.peterson) Date: Thu, 11 Jun 2009 19:51:17 +0200 (CEST) Subject: [Python-checkins] r73363 - python/trunk/Lib/filecmp.py Message-ID: <20090611175117.AF0DDD944@mail.python.org> Author: benjamin.peterson Date: Thu Jun 11 19:51:17 2009 New Revision: 73363 Log: use multi-with syntax Modified: python/trunk/Lib/filecmp.py Modified: python/trunk/Lib/filecmp.py ============================================================================== --- python/trunk/Lib/filecmp.py (original) +++ python/trunk/Lib/filecmp.py Thu Jun 11 19:51:17 2009 @@ -11,7 +11,6 @@ import os import stat -import contextlib from itertools import ifilter, ifilterfalse, imap, izip __all__ = ["cmp","dircmp","cmpfiles"] @@ -63,7 +62,7 @@ def _do_cmp(f1, f2): bufsize = BUFSIZE - with contextlib.nested(open(f1, 'rb'), open(f2, 'rb')) as (fp1, fp2): + with open(f1, 'rb') as fp1, open(f2, 'rb') as fp2: while True: b1 = fp1.read(bufsize) b2 = fp2.read(bufsize) From buildbot at python.org Thu Jun 11 23:30:15 2009 From: buildbot at python.org (buildbot at python.org) Date: Thu, 11 Jun 2009 21:30:15 +0000 Subject: [Python-checkins] buildbot failure in x86 XP-4 3.x Message-ID: <20090611213015.B5B7BDAAD@mail.python.org> The Buildbot has detected a new failure of x86 XP-4 3.x. Full details are available at: http://www.python.org/dev/buildbot/all/x86%20XP-4%203.x/builds/681 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: bolen-windows Build Reason: Build Source Stamp: [branch branches/py3k] HEAD Blamelist: georg.brandl,tarek.ziade,vinay.sajip BUILD FAILED: failed test Excerpt from the test logfile: Traceback (most recent call last): File "E:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\test\test_import.py", line 63, in test_with_extension self.fail("import from %s failed: %s" % (ext, err)) File "E:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\unittest.py", line 540, in fail raise self.failureException(msg) AssertionError: import from .PY failed: No module named @test Traceback (most recent call last): File "E:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\test\test_import.py", line 80, in testImport test_with_extension(ext) File "E:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\test\test_import.py", line 73, in test_with_extension del sys.modules[TESTFN] KeyError: '@test' 1 test failed: test_import ====================================================================== ERROR: testImport (test.test_import.ImportTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "E:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\test\test_import.py", line 61, in test_with_extension mod = __import__(TESTFN) ImportError: No module named @test Traceback (most recent call last): File "E:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\test\test_import.py", line 63, in test_with_extension self.fail("import from %s failed: %s" % (ext, err)) File "E:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\unittest.py", line 540, in fail raise self.failureException(msg) AssertionError: import from .PY failed: No module named @test Traceback (most recent call last): File "E:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\test\test_import.py", line 80, in testImport test_with_extension(ext) File "E:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\test\test_import.py", line 73, in test_with_extension del sys.modules[TESTFN] KeyError: '@test' Traceback (most recent call last): File "E:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\test\test_import.py", line 63, in test_with_extension self.fail("import from %s failed: %s" % (ext, err)) File "E:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\unittest.py", line 540, in fail raise self.failureException(msg) AssertionError: import from .PY failed: No module named @test Traceback (most recent call last): File "E:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\test\test_import.py", line 80, in testImport test_with_extension(ext) File "E:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\test\test_import.py", line 73, in test_with_extension del sys.modules[TESTFN] KeyError: '@test' sincerely, -The Buildbot From python-checkins at python.org Fri Jun 12 00:01:25 2009 From: python-checkins at python.org (raymond.hettinger) Date: Fri, 12 Jun 2009 00:01:25 +0200 (CEST) Subject: [Python-checkins] r73364 - python/branches/py3k/Doc/library/bisect.rst Message-ID: <20090611220125.285FADA9B@mail.python.org> Author: raymond.hettinger Date: Fri Jun 12 00:01:24 2009 New Revision: 73364 Log: Add example of how to do key lookups with bisect(). Modified: python/branches/py3k/Doc/library/bisect.rst Modified: python/branches/py3k/Doc/library/bisect.rst ============================================================================== --- python/branches/py3k/Doc/library/bisect.rst (original) +++ python/branches/py3k/Doc/library/bisect.rst Fri Jun 12 00:01:24 2009 @@ -68,4 +68,22 @@ >>> map(grade, [33, 99, 77, 44, 12, 88]) ['E', 'A', 'B', 'D', 'F', 'A'] +Unlike the :func:`sorted` function, it does not make sense for the :func:`bisect` +functions to have *key* or *reversed* arguments because that would lead to an +inefficent design (successive calls to bisect functions would not "remember" +all of the previous key lookups). +Instead, it is better to search a list of precomputed keys to find the index +of the record in question:: + + >>> data = [('red', 5), ('blue', 1), ('yellow', 8), ('black', 0)] + >>> data.sort(key=lambda r: r[1]) # precomputed list of keys + >>> keys = [r[1] for r in data] + >>> data[bisect_left(keys, 0)] + ('black', 0) + >>> data[bisect_left(keys, 1)] + ('blue', 1) + >>> data[bisect_left(keys, 5)] + ('red', 5) + >>> data[bisect_left(keys, 8)] + ('yellow', 8) From python-checkins at python.org Fri Jun 12 00:01:32 2009 From: python-checkins at python.org (benjamin.peterson) Date: Fri, 12 Jun 2009 00:01:32 +0200 (CEST) Subject: [Python-checkins] r73365 - sandbox/trunk/2to3/lib2to3/tests/data/different_encoding.py Message-ID: <20090611220132.6F169DAF2@mail.python.org> Author: benjamin.peterson Date: Fri Jun 12 00:01:32 2009 New Revision: 73365 Log: normalize whitespace Modified: sandbox/trunk/2to3/lib2to3/tests/data/different_encoding.py Modified: sandbox/trunk/2to3/lib2to3/tests/data/different_encoding.py ============================================================================== --- sandbox/trunk/2to3/lib2to3/tests/data/different_encoding.py (original) +++ sandbox/trunk/2to3/lib2to3/tests/data/different_encoding.py Fri Jun 12 00:01:32 2009 @@ -1,4 +1,3 @@ #!/usr/bin/env python # -*- coding: iso-8859-1 -*- print u'??????????????????????????????????????????????????????????????' - From python-checkins at python.org Fri Jun 12 00:03:21 2009 From: python-checkins at python.org (raymond.hettinger) Date: Fri, 12 Jun 2009 00:03:21 +0200 (CEST) Subject: [Python-checkins] r73366 - python/branches/release30-maint/Doc/library/bisect.rst Message-ID: <20090611220321.6A88FD578@mail.python.org> Author: raymond.hettinger Date: Fri Jun 12 00:03:21 2009 New Revision: 73366 Log: Add example of how to do key lookups with bisect(). Modified: python/branches/release30-maint/Doc/library/bisect.rst Modified: python/branches/release30-maint/Doc/library/bisect.rst ============================================================================== --- python/branches/release30-maint/Doc/library/bisect.rst (original) +++ python/branches/release30-maint/Doc/library/bisect.rst Fri Jun 12 00:03:21 2009 @@ -77,4 +77,22 @@ >>> map(grade, [33, 99, 77, 44, 12, 88]) ['E', 'A', 'B', 'D', 'F', 'A'] +Unlike the :func:`sorted` function, it does not make sense for the :func:`bisect` +functions to have *key* or *reversed* arguments because that would lead to an +inefficent design (successive calls to bisect functions would not "remember" +all of the previous key lookups). +Instead, it is better to search a list of precomputed keys to find the index +of the record in question:: + + >>> data = [('red', 5), ('blue', 1), ('yellow', 8), ('black', 0)] + >>> data.sort(key=lambda r: r[1]) # precomputed list of keys + >>> keys = [r[1] for r in data] + >>> data[bisect_left(keys, 0)] + ('black', 0) + >>> data[bisect_left(keys, 1)] + ('blue', 1) + >>> data[bisect_left(keys, 5)] + ('red', 5) + >>> data[bisect_left(keys, 8)] + ('yellow', 8) From python-checkins at python.org Fri Jun 12 00:04:00 2009 From: python-checkins at python.org (raymond.hettinger) Date: Fri, 12 Jun 2009 00:04:00 +0200 (CEST) Subject: [Python-checkins] r73367 - python/trunk/Doc/library/bisect.rst Message-ID: <20090611220400.82F74D5B4@mail.python.org> Author: raymond.hettinger Date: Fri Jun 12 00:04:00 2009 New Revision: 73367 Log: Add example of how to do key lookups with bisect(). Modified: python/trunk/Doc/library/bisect.rst Modified: python/trunk/Doc/library/bisect.rst ============================================================================== --- python/trunk/Doc/library/bisect.rst (original) +++ python/trunk/Doc/library/bisect.rst Fri Jun 12 00:04:00 2009 @@ -85,4 +85,22 @@ >>> map(grade, [33, 99, 77, 44, 12, 88]) ['E', 'A', 'B', 'D', 'F', 'A'] +Unlike the :func:`sorted` function, it does not make sense for the :func:`bisect` +functions to have *key* or *reversed* arguments because that would lead to an +inefficent design (successive calls to bisect functions would not "remember" +all of the previous key lookups). +Instead, it is better to search a list of precomputed keys to find the index +of the record in question:: + + >>> data = [('red', 5), ('blue', 1), ('yellow', 8), ('black', 0)] + >>> data.sort(key=lambda r: r[1]) # precomputed list of keys + >>> keys = [r[1] for r in data] + >>> data[bisect_left(keys, 0)] + ('black', 0) + >>> data[bisect_left(keys, 1)] + ('blue', 1) + >>> data[bisect_left(keys, 5)] + ('red', 5) + >>> data[bisect_left(keys, 8)] + ('yellow', 8) From python-checkins at python.org Fri Jun 12 00:04:49 2009 From: python-checkins at python.org (raymond.hettinger) Date: Fri, 12 Jun 2009 00:04:49 +0200 (CEST) Subject: [Python-checkins] r73368 - python/branches/release26-maint/Doc/library/bisect.rst Message-ID: <20090611220449.26603D5C3@mail.python.org> Author: raymond.hettinger Date: Fri Jun 12 00:04:49 2009 New Revision: 73368 Log: Add example of how to do key lookups with bisect(). Modified: python/branches/release26-maint/Doc/library/bisect.rst Modified: python/branches/release26-maint/Doc/library/bisect.rst ============================================================================== --- python/branches/release26-maint/Doc/library/bisect.rst (original) +++ python/branches/release26-maint/Doc/library/bisect.rst Fri Jun 12 00:04:49 2009 @@ -85,4 +85,22 @@ >>> map(grade, [33, 99, 77, 44, 12, 88]) ['E', 'A', 'B', 'D', 'F', 'A'] +Unlike the :func:`sorted` function, it does not make sense for the :func:`bisect` +functions to have *key* or *reversed* arguments because that would lead to an +inefficent design (successive calls to bisect functions would not "remember" +all of the previous key lookups). +Instead, it is better to search a list of precomputed keys to find the index +of the record in question:: + + >>> data = [('red', 5), ('blue', 1), ('yellow', 8), ('black', 0)] + >>> data.sort(key=lambda r: r[1]) # precomputed list of keys + >>> keys = [r[1] for r in data] + >>> data[bisect_left(keys, 0)] + ('black', 0) + >>> data[bisect_left(keys, 1)] + ('blue', 1) + >>> data[bisect_left(keys, 5)] + ('red', 5) + >>> data[bisect_left(keys, 8)] + ('yellow', 8) From python-checkins at python.org Fri Jun 12 00:06:06 2009 From: python-checkins at python.org (raymond.hettinger) Date: Fri, 12 Jun 2009 00:06:06 +0200 (CEST) Subject: [Python-checkins] r73369 - python/branches/py3k/Doc/library/bisect.rst Message-ID: <20090611220606.3A8DFDAF2@mail.python.org> Author: raymond.hettinger Date: Fri Jun 12 00:06:06 2009 New Revision: 73369 Log: Move comment to correct line. Modified: python/branches/py3k/Doc/library/bisect.rst Modified: python/branches/py3k/Doc/library/bisect.rst ============================================================================== --- python/branches/py3k/Doc/library/bisect.rst (original) +++ python/branches/py3k/Doc/library/bisect.rst Fri Jun 12 00:06:06 2009 @@ -77,8 +77,8 @@ of the record in question:: >>> data = [('red', 5), ('blue', 1), ('yellow', 8), ('black', 0)] - >>> data.sort(key=lambda r: r[1]) # precomputed list of keys - >>> keys = [r[1] for r in data] + >>> data.sort(key=lambda r: r[1]) + >>> keys = [r[1] for r in data] # precomputed list of keys >>> data[bisect_left(keys, 0)] ('black', 0) >>> data[bisect_left(keys, 1)] From python-checkins at python.org Fri Jun 12 00:06:46 2009 From: python-checkins at python.org (benjamin.peterson) Date: Fri, 12 Jun 2009 00:06:46 +0200 (CEST) Subject: [Python-checkins] r73370 - in python/trunk/Lib/lib2to3: Grammar.txt fixer_base.py fixer_util.py fixes/fix_apply.py fixes/fix_basestring.py fixes/fix_buffer.py fixes/fix_callable.py fixes/fix_dict.py fixes/fix_except.py fixes/fix_exec.py fixes/fix_execfile.py fixes/fix_filter.py fixes/fix_funcattrs.py fixes/fix_future.py fixes/fix_getcwdu.py fixes/fix_has_key.py fixes/fix_idioms.py fixes/fix_import.py fixes/fix_imports.py fixes/fix_input.py fixes/fix_intern.py fixes/fix_isinstance.py fixes/fix_itertools.py fixes/fix_itertools_imports.py fixes/fix_long.py fixes/fix_map.py fixes/fix_metaclass.py fixes/fix_methodattrs.py fixes/fix_ne.py fixes/fix_next.py fixes/fix_nonzero.py fixes/fix_numliterals.py fixes/fix_paren.py fixes/fix_print.py fixes/fix_raise.py fixes/fix_raw_input.py fixes/fix_reduce.py fixes/fix_renames.py fixes/fix_repr.py fixes/fix_set_literal.py fixes/fix_standarderror.py fixes/fix_sys_exc.py fixes/fix_throw.py fixes/fix_tuple_params.py fixes/fix_types.py fixes/fix_unicode.py fixes/fix_urllib.py fixes/fix_ws_comma.py fixes/fix_xrange.py fixes/fix_xreadlines.py fixes/fix_zip.py patcomp.py pytree.py refactor.py tests/data/README tests/data/different_encoding.py tests/data/fixers/myfixes/fix_parrot.py tests/data/py2_test_grammar.py tests/data/py3_test_grammar.py tests/pytree_idempotency.py tests/support.py tests/test_all_fixers.py tests/test_fixers.py tests/test_parser.py tests/test_pytree.py tests/test_util.py Message-ID: <20090611220646.A0A05DAC5@mail.python.org> Author: benjamin.peterson Date: Fri Jun 12 00:06:46 2009 New Revision: 73370 Log: Merged revisions 72523,72950-72951,72994,73003,73033,73036-73040,73091-73093,73096,73179-73181,73192,73231,73244,73255-73256,73365 via svnmerge from svn+ssh://pythondev at svn.python.org/sandbox/trunk/2to3/lib2to3 ........ r72523 | benjamin.peterson | 2009-05-09 14:42:26 -0500 (Sat, 09 May 2009) | 1 line remove parenthesis ........ r72950 | benjamin.peterson | 2009-05-26 18:19:45 -0500 (Tue, 26 May 2009) | 1 line remove unused imports ........ r72951 | benjamin.peterson | 2009-05-26 18:27:00 -0500 (Tue, 26 May 2009) | 1 line this is no longer executable ........ r72994 | benjamin.peterson | 2009-05-28 15:32:54 -0500 (Thu, 28 May 2009) | 1 line fix test_all_fixers on Windows #6134 ........ r73003 | benjamin.peterson | 2009-05-28 21:57:28 -0500 (Thu, 28 May 2009) | 4 lines make 2to3 test utilities easier to use with other applications (3to2) Patch by Joe Amenta ........ r73033 | benjamin.peterson | 2009-05-29 16:58:32 -0500 (Fri, 29 May 2009) | 1 line update grammar for multi with statement ........ r73036 | benjamin.peterson | 2009-05-29 17:33:20 -0500 (Fri, 29 May 2009) | 1 line simplify fix_unicode ........ r73037 | benjamin.peterson | 2009-05-29 17:53:03 -0500 (Fri, 29 May 2009) | 1 line add custom error for pattern syntax errors ........ r73038 | benjamin.peterson | 2009-05-29 17:55:00 -0500 (Fri, 29 May 2009) | 1 line complain if details are attached to a token ........ r73039 | benjamin.peterson | 2009-05-29 18:00:28 -0500 (Fri, 29 May 2009) | 1 line add a test for whitespace ........ r73040 | benjamin.peterson | 2009-05-29 18:01:17 -0500 (Fri, 29 May 2009) | 1 line a fix for emacs highlighting ........ r73091 | benjamin.peterson | 2009-05-31 20:55:25 -0500 (Sun, 31 May 2009) | 1 line deprecate set_prefix() and get_prefix() in favor of a prefix property ........ r73092 | benjamin.peterson | 2009-05-31 21:00:51 -0500 (Sun, 31 May 2009) | 1 line change hideous java naming scheme ........ r73093 | benjamin.peterson | 2009-05-31 21:01:39 -0500 (Sun, 31 May 2009) | 1 line remove dated comment ........ r73096 | benjamin.peterson | 2009-05-31 21:40:53 -0500 (Sun, 31 May 2009) | 1 line group tests ........ r73179 | benjamin.peterson | 2009-06-03 13:09:53 -0500 (Wed, 03 Jun 2009) | 1 line handle the case where there's multiple trailers #6185 ........ r73180 | benjamin.peterson | 2009-06-03 13:18:05 -0500 (Wed, 03 Jun 2009) | 1 line scrap __main__ section ........ r73181 | benjamin.peterson | 2009-06-03 13:24:48 -0500 (Wed, 03 Jun 2009) | 1 line remove shebang lines and __main__ sections ........ r73192 | benjamin.peterson | 2009-06-03 19:16:30 -0500 (Wed, 03 Jun 2009) | 4 lines actually test something here Thanks to Joe Amenta for noticing.y ........ r73231 | benjamin.peterson | 2009-06-04 13:38:50 -0500 (Thu, 04 Jun 2009) | 1 line remove unused variable ........ r73244 | benjamin.peterson | 2009-06-05 08:39:25 -0500 (Fri, 05 Jun 2009) | 1 line allow fixers to give different options in setUp ........ r73255 | benjamin.peterson | 2009-06-06 11:23:46 -0500 (Sat, 06 Jun 2009) | 1 line fix the except fixer on one line suites #6222 ........ r73256 | benjamin.peterson | 2009-06-06 11:27:40 -0500 (Sat, 06 Jun 2009) | 1 line test one-line else and finally clauses ........ r73365 | benjamin.peterson | 2009-06-11 17:01:32 -0500 (Thu, 11 Jun 2009) | 1 line normalize whitespace ........ Modified: python/trunk/Lib/lib2to3/ (props changed) python/trunk/Lib/lib2to3/Grammar.txt python/trunk/Lib/lib2to3/fixer_base.py python/trunk/Lib/lib2to3/fixer_util.py python/trunk/Lib/lib2to3/fixes/fix_apply.py python/trunk/Lib/lib2to3/fixes/fix_basestring.py python/trunk/Lib/lib2to3/fixes/fix_buffer.py python/trunk/Lib/lib2to3/fixes/fix_callable.py python/trunk/Lib/lib2to3/fixes/fix_dict.py python/trunk/Lib/lib2to3/fixes/fix_except.py python/trunk/Lib/lib2to3/fixes/fix_exec.py python/trunk/Lib/lib2to3/fixes/fix_execfile.py python/trunk/Lib/lib2to3/fixes/fix_filter.py python/trunk/Lib/lib2to3/fixes/fix_funcattrs.py python/trunk/Lib/lib2to3/fixes/fix_future.py python/trunk/Lib/lib2to3/fixes/fix_getcwdu.py python/trunk/Lib/lib2to3/fixes/fix_has_key.py python/trunk/Lib/lib2to3/fixes/fix_idioms.py python/trunk/Lib/lib2to3/fixes/fix_import.py python/trunk/Lib/lib2to3/fixes/fix_imports.py python/trunk/Lib/lib2to3/fixes/fix_input.py python/trunk/Lib/lib2to3/fixes/fix_intern.py python/trunk/Lib/lib2to3/fixes/fix_isinstance.py (contents, props changed) python/trunk/Lib/lib2to3/fixes/fix_itertools.py python/trunk/Lib/lib2to3/fixes/fix_itertools_imports.py python/trunk/Lib/lib2to3/fixes/fix_long.py python/trunk/Lib/lib2to3/fixes/fix_map.py python/trunk/Lib/lib2to3/fixes/fix_metaclass.py python/trunk/Lib/lib2to3/fixes/fix_methodattrs.py python/trunk/Lib/lib2to3/fixes/fix_ne.py python/trunk/Lib/lib2to3/fixes/fix_next.py python/trunk/Lib/lib2to3/fixes/fix_nonzero.py python/trunk/Lib/lib2to3/fixes/fix_numliterals.py python/trunk/Lib/lib2to3/fixes/fix_paren.py python/trunk/Lib/lib2to3/fixes/fix_print.py python/trunk/Lib/lib2to3/fixes/fix_raise.py python/trunk/Lib/lib2to3/fixes/fix_raw_input.py python/trunk/Lib/lib2to3/fixes/fix_reduce.py (props changed) python/trunk/Lib/lib2to3/fixes/fix_renames.py python/trunk/Lib/lib2to3/fixes/fix_repr.py python/trunk/Lib/lib2to3/fixes/fix_set_literal.py python/trunk/Lib/lib2to3/fixes/fix_standarderror.py python/trunk/Lib/lib2to3/fixes/fix_sys_exc.py python/trunk/Lib/lib2to3/fixes/fix_throw.py python/trunk/Lib/lib2to3/fixes/fix_tuple_params.py python/trunk/Lib/lib2to3/fixes/fix_types.py python/trunk/Lib/lib2to3/fixes/fix_unicode.py python/trunk/Lib/lib2to3/fixes/fix_urllib.py python/trunk/Lib/lib2to3/fixes/fix_ws_comma.py python/trunk/Lib/lib2to3/fixes/fix_xrange.py python/trunk/Lib/lib2to3/fixes/fix_xreadlines.py python/trunk/Lib/lib2to3/fixes/fix_zip.py python/trunk/Lib/lib2to3/patcomp.py python/trunk/Lib/lib2to3/pytree.py python/trunk/Lib/lib2to3/refactor.py python/trunk/Lib/lib2to3/tests/data/README (props changed) python/trunk/Lib/lib2to3/tests/data/different_encoding.py python/trunk/Lib/lib2to3/tests/data/fixers/myfixes/fix_parrot.py python/trunk/Lib/lib2to3/tests/data/py2_test_grammar.py python/trunk/Lib/lib2to3/tests/data/py3_test_grammar.py python/trunk/Lib/lib2to3/tests/pytree_idempotency.py python/trunk/Lib/lib2to3/tests/support.py python/trunk/Lib/lib2to3/tests/test_all_fixers.py python/trunk/Lib/lib2to3/tests/test_fixers.py python/trunk/Lib/lib2to3/tests/test_parser.py python/trunk/Lib/lib2to3/tests/test_pytree.py python/trunk/Lib/lib2to3/tests/test_util.py Modified: python/trunk/Lib/lib2to3/Grammar.txt ============================================================================== --- python/trunk/Lib/lib2to3/Grammar.txt (original) +++ python/trunk/Lib/lib2to3/Grammar.txt Fri Jun 12 00:06:46 2009 @@ -90,7 +90,8 @@ ['else' ':' suite] ['finally' ':' suite] | 'finally' ':' suite)) -with_stmt: 'with' test [ with_var ] ':' suite +with_stmt: 'with' with_item (',' with_item)* ':' suite +with_item: test ['as' expr] with_var: 'as' expr # NB compile.c makes sure that the default except clause is last except_clause: 'except' [test [(',' | 'as') test]] Modified: python/trunk/Lib/lib2to3/fixer_base.py ============================================================================== --- python/trunk/Lib/lib2to3/fixer_base.py (original) +++ python/trunk/Lib/lib2to3/fixer_base.py Fri Jun 12 00:06:46 2009 @@ -120,7 +120,7 @@ """ lineno = node.get_lineno() for_output = node.clone() - for_output.set_prefix(u"") + for_output.prefix = u"" msg = "Line %d: could not convert: %s" self.log_message(msg % (lineno, for_output)) if reason: Modified: python/trunk/Lib/lib2to3/fixer_util.py ============================================================================== --- python/trunk/Lib/lib2to3/fixer_util.py (original) +++ python/trunk/Lib/lib2to3/fixer_util.py Fri Jun 12 00:06:46 2009 @@ -27,11 +27,11 @@ if not isinstance(target, list): target = [target] if not isinstance(source, list): - source.set_prefix(" ") + source.prefix = u" " source = [source] return Node(syms.atom, - target + [Leaf(token.EQUAL, "=", prefix=" ")] + source) + target + [Leaf(token.EQUAL, u"=", prefix=u" ")] + source) def Name(name, prefix=None): """Return a NAME leaf""" @@ -60,7 +60,7 @@ """A function call""" node = Node(syms.power, [func_name, ArgList(args)]) if prefix is not None: - node.set_prefix(prefix) + node.prefix = prefix return node def Newline(): @@ -89,18 +89,18 @@ If test is None, the "if test" part is omitted. """ - xp.set_prefix(u"") - fp.set_prefix(u" ") - it.set_prefix(u" ") + xp.prefix = u"" + fp.prefix = u" " + it.prefix = u" " for_leaf = Leaf(token.NAME, u"for") - for_leaf.set_prefix(u" ") + for_leaf.prefix = u" " in_leaf = Leaf(token.NAME, u"in") - in_leaf.set_prefix(u" ") + in_leaf.prefix = u" " inner_args = [for_leaf, fp, in_leaf, it] if test: - test.set_prefix(u" ") + test.prefix = u" " if_leaf = Leaf(token.NAME, u"if") - if_leaf.set_prefix(u" ") + if_leaf.prefix = u" " inner_args.append(Node(syms.comp_if, [if_leaf, test])) inner = Node(syms.listmaker, [xp, Node(syms.comp_for, inner_args)]) return Node(syms.atom, Modified: python/trunk/Lib/lib2to3/fixes/fix_apply.py ============================================================================== --- python/trunk/Lib/lib2to3/fixes/fix_apply.py (original) +++ python/trunk/Lib/lib2to3/fixes/fix_apply.py Fri Jun 12 00:06:46 2009 @@ -33,25 +33,25 @@ func = results["func"] args = results["args"] kwds = results.get("kwds") - prefix = node.get_prefix() + prefix = node.prefix func = func.clone() if (func.type not in (token.NAME, syms.atom) and (func.type != syms.power or func.children[-2].type == token.DOUBLESTAR)): # Need to parenthesize func = parenthesize(func) - func.set_prefix("") + func.prefix = "" args = args.clone() - args.set_prefix("") + args.prefix = "" if kwds is not None: kwds = kwds.clone() - kwds.set_prefix("") + kwds.prefix = "" l_newargs = [pytree.Leaf(token.STAR, u"*"), args] if kwds is not None: l_newargs.extend([Comma(), pytree.Leaf(token.DOUBLESTAR, u"**"), kwds]) - l_newargs[-2].set_prefix(u" ") # that's the ** token + l_newargs[-2].prefix = u" " # that's the ** token # XXX Sometimes we could be cleverer, e.g. apply(f, (x, y) + t) # can be translated into f(x, y, *t) instead of f(*(x, y) + t) #new = pytree.Node(syms.power, (func, ArgList(l_newargs))) Modified: python/trunk/Lib/lib2to3/fixes/fix_basestring.py ============================================================================== --- python/trunk/Lib/lib2to3/fixes/fix_basestring.py (original) +++ python/trunk/Lib/lib2to3/fixes/fix_basestring.py Fri Jun 12 00:06:46 2009 @@ -10,4 +10,4 @@ PATTERN = "'basestring'" def transform(self, node, results): - return Name(u"str", prefix=node.get_prefix()) + return Name(u"str", prefix=node.prefix) Modified: python/trunk/Lib/lib2to3/fixes/fix_buffer.py ============================================================================== --- python/trunk/Lib/lib2to3/fixes/fix_buffer.py (original) +++ python/trunk/Lib/lib2to3/fixes/fix_buffer.py Fri Jun 12 00:06:46 2009 @@ -13,9 +13,9 @@ explicit = True # The user must ask for this fixer PATTERN = """ - power< name='buffer' trailer< '(' [any] ')' > > + power< name='buffer' trailer< '(' [any] ')' > any* > """ def transform(self, node, results): name = results["name"] - name.replace(Name(u"memoryview", prefix=name.get_prefix())) + name.replace(Name(u"memoryview", prefix=name.prefix)) Modified: python/trunk/Lib/lib2to3/fixes/fix_callable.py ============================================================================== --- python/trunk/Lib/lib2to3/fixes/fix_callable.py (original) +++ python/trunk/Lib/lib2to3/fixes/fix_callable.py Fri Jun 12 00:06:46 2009 @@ -28,4 +28,4 @@ func = results["func"] args = [func.clone(), String(u', '), String(u"'__call__'")] - return Call(Name(u"hasattr"), args, prefix=node.get_prefix()) + return Call(Name(u"hasattr"), args, prefix=node.prefix) Modified: python/trunk/Lib/lib2to3/fixes/fix_dict.py ============================================================================== --- python/trunk/Lib/lib2to3/fixes/fix_dict.py (original) +++ python/trunk/Lib/lib2to3/fixes/fix_dict.py Fri Jun 12 00:06:46 2009 @@ -61,15 +61,15 @@ args = head + [pytree.Node(syms.trailer, [Dot(), Name(method_name, - prefix=method.get_prefix())]), + prefix=method.prefix)]), results["parens"].clone()] new = pytree.Node(syms.power, args) if not special: - new.set_prefix(u"") + new.prefix = u"" new = Call(Name(isiter and u"iter" or u"list"), [new]) if tail: new = pytree.Node(syms.power, [new] + tail) - new.set_prefix(node.get_prefix()) + new.prefix = node.prefix return new P1 = "power< func=NAME trailer< '(' node=any ')' > any* >" Modified: python/trunk/Lib/lib2to3/fixes/fix_except.py ============================================================================== --- python/trunk/Lib/lib2to3/fixes/fix_except.py (original) +++ python/trunk/Lib/lib2to3/fixes/fix_except.py Fri Jun 12 00:06:46 2009 @@ -36,11 +36,11 @@ class FixExcept(fixer_base.BaseFix): PATTERN = """ - try_stmt< 'try' ':' suite - cleanup=(except_clause ':' suite)+ - tail=(['except' ':' suite] - ['else' ':' suite] - ['finally' ':' suite]) > + try_stmt< 'try' ':' (simple_stmt | suite) + cleanup=(except_clause ':' (simple_stmt | suite))+ + tail=(['except' ':' (simple_stmt | suite)] + ['else' ':' (simple_stmt | suite)] + ['finally' ':' (simple_stmt | suite)]) > """ def transform(self, node, results): @@ -58,7 +58,7 @@ # Generate a new N for the except clause new_N = Name(self.new_name(), prefix=u" ") target = N.clone() - target.set_prefix(u"") + target.prefix = u"" N.replace(new_N) new_N = new_N.clone() @@ -82,10 +82,10 @@ for child in reversed(suite_stmts[:i]): e_suite.insert_child(0, child) e_suite.insert_child(i, assign) - elif N.get_prefix() == u"": + elif N.prefix == u"": # No space after a comma is legal; no space after "as", # not so much. - N.set_prefix(u" ") + N.prefix = u" " #TODO(cwinter) fix this when children becomes a smart list children = [c.clone() for c in node.children[:3]] + try_cleanup + tail Modified: python/trunk/Lib/lib2to3/fixes/fix_exec.py ============================================================================== --- python/trunk/Lib/lib2to3/fixes/fix_exec.py (original) +++ python/trunk/Lib/lib2to3/fixes/fix_exec.py Fri Jun 12 00:06:46 2009 @@ -30,10 +30,10 @@ b = results.get("b") c = results.get("c") args = [a.clone()] - args[0].set_prefix("") + args[0].prefix = "" if b is not None: args.extend([Comma(), b.clone()]) if c is not None: args.extend([Comma(), c.clone()]) - return Call(Name(u"exec"), args, prefix=node.get_prefix()) + return Call(Name(u"exec"), args, prefix=node.prefix) Modified: python/trunk/Lib/lib2to3/fixes/fix_execfile.py ============================================================================== --- python/trunk/Lib/lib2to3/fixes/fix_execfile.py (original) +++ python/trunk/Lib/lib2to3/fixes/fix_execfile.py Fri Jun 12 00:06:46 2009 @@ -38,7 +38,7 @@ # Wrap the open call in a compile call. This is so the filename will be # preserved in the execed code. filename_arg = filename.clone() - filename_arg.set_prefix(u" ") + filename_arg.prefix = u" " exec_str = String(u"'exec'", u" ") compile_args = open_expr + [Comma(), filename_arg, Comma(), exec_str] compile_call = Call(Name(u"compile"), compile_args, u"") @@ -48,4 +48,4 @@ args.extend([Comma(), globals.clone()]) if locals is not None: args.extend([Comma(), locals.clone()]) - return Call(Name(u"exec"), args, prefix=node.get_prefix()) + return Call(Name(u"exec"), args, prefix=node.prefix) Modified: python/trunk/Lib/lib2to3/fixes/fix_filter.py ============================================================================== --- python/trunk/Lib/lib2to3/fixes/fix_filter.py (original) +++ python/trunk/Lib/lib2to3/fixes/fix_filter.py Fri Jun 12 00:06:46 2009 @@ -69,7 +69,7 @@ if in_special_context(node): return None new = node.clone() - new.set_prefix(u"") + new.prefix = u"" new = Call(Name(u"list"), [new]) - new.set_prefix(node.get_prefix()) + new.prefix = node.prefix return new Modified: python/trunk/Lib/lib2to3/fixes/fix_funcattrs.py ============================================================================== --- python/trunk/Lib/lib2to3/fixes/fix_funcattrs.py (original) +++ python/trunk/Lib/lib2to3/fixes/fix_funcattrs.py Fri Jun 12 00:06:46 2009 @@ -16,4 +16,4 @@ def transform(self, node, results): attr = results["attr"][0] attr.replace(Name((u"__%s__" % attr.value[5:]), - prefix=attr.get_prefix())) + prefix=attr.prefix)) Modified: python/trunk/Lib/lib2to3/fixes/fix_future.py ============================================================================== --- python/trunk/Lib/lib2to3/fixes/fix_future.py (original) +++ python/trunk/Lib/lib2to3/fixes/fix_future.py Fri Jun 12 00:06:46 2009 @@ -16,5 +16,5 @@ def transform(self, node, results): new = BlankLine() - new.prefix = node.get_prefix() + new.prefix = node.prefix return new Modified: python/trunk/Lib/lib2to3/fixes/fix_getcwdu.py ============================================================================== --- python/trunk/Lib/lib2to3/fixes/fix_getcwdu.py (original) +++ python/trunk/Lib/lib2to3/fixes/fix_getcwdu.py Fri Jun 12 00:06:46 2009 @@ -15,4 +15,4 @@ def transform(self, node, results): name = results["name"] - name.replace(Name(u"getcwd", prefix=name.get_prefix())) + name.replace(Name(u"getcwd", prefix=name.prefix)) Modified: python/trunk/Lib/lib2to3/fixes/fix_has_key.py ============================================================================== --- python/trunk/Lib/lib2to3/fixes/fix_has_key.py (original) +++ python/trunk/Lib/lib2to3/fixes/fix_has_key.py Fri Jun 12 00:06:46 2009 @@ -78,7 +78,7 @@ return None negation = results.get("negation") anchor = results["anchor"] - prefix = node.get_prefix() + prefix = node.prefix before = [n.clone() for n in results["before"]] arg = results["arg"].clone() after = results.get("after") @@ -91,7 +91,7 @@ before = before[0] else: before = pytree.Node(syms.power, before) - before.set_prefix(u" ") + before.prefix = u" " n_op = Name(u"in", prefix=u" ") if negation: n_not = Name(u"not", prefix=u" ") @@ -105,5 +105,5 @@ syms.arith_expr, syms.term, syms.factor, syms.power): new = parenthesize(new) - new.set_prefix(prefix) + new.prefix = prefix return new Modified: python/trunk/Lib/lib2to3/fixes/fix_idioms.py ============================================================================== --- python/trunk/Lib/lib2to3/fixes/fix_idioms.py (original) +++ python/trunk/Lib/lib2to3/fixes/fix_idioms.py Fri Jun 12 00:06:46 2009 @@ -101,18 +101,18 @@ def transform_isinstance(self, node, results): x = results["x"].clone() # The thing inside of type() T = results["T"].clone() # The type being compared against - x.set_prefix("") - T.set_prefix(" ") - test = Call(Name("isinstance"), [x, Comma(), T]) + x.prefix = u"" + T.prefix = u" " + test = Call(Name(u"isinstance"), [x, Comma(), T]) if "n" in results: - test.set_prefix(u" ") + test.prefix = u" " test = Node(syms.not_test, [Name(u"not"), test]) - test.set_prefix(node.get_prefix()) + test.prefix = node.prefix return test def transform_while(self, node, results): one = results["while"] - one.replace(Name(u"True", prefix=one.get_prefix())) + one.replace(Name(u"True", prefix=one.prefix)) def transform_sort(self, node, results): sort_stmt = results["sort"] @@ -121,14 +121,14 @@ simple_expr = results.get("expr") if list_call: - list_call.replace(Name(u"sorted", prefix=list_call.get_prefix())) + list_call.replace(Name(u"sorted", prefix=list_call.prefix)) elif simple_expr: new = simple_expr.clone() - new.set_prefix(u"") + new.prefix = u"" simple_expr.replace(Call(Name(u"sorted"), [new], - prefix=simple_expr.get_prefix())) + prefix=simple_expr.prefix)) else: raise RuntimeError("should not have reached here") sort_stmt.remove() if next_stmt: - next_stmt[0].set_prefix(sort_stmt.get_prefix()) + next_stmt[0].prefix = sort_stmt.prefix Modified: python/trunk/Lib/lib2to3/fixes/fix_import.py ============================================================================== --- python/trunk/Lib/lib2to3/fixes/fix_import.py (original) +++ python/trunk/Lib/lib2to3/fixes/fix_import.py Fri Jun 12 00:06:46 2009 @@ -73,7 +73,7 @@ return new = FromImport('.', [imp]) - new.set_prefix(node.get_prefix()) + new.prefix = node.prefix return new def probably_a_local_import(self, imp_name): Modified: python/trunk/Lib/lib2to3/fixes/fix_imports.py ============================================================================== --- python/trunk/Lib/lib2to3/fixes/fix_imports.py (original) +++ python/trunk/Lib/lib2to3/fixes/fix_imports.py Fri Jun 12 00:06:46 2009 @@ -124,7 +124,7 @@ if import_mod: mod_name = import_mod.value new_name = unicode(self.mapping[mod_name]) - import_mod.replace(Name(new_name, prefix=import_mod.get_prefix())) + import_mod.replace(Name(new_name, prefix=import_mod.prefix)) if "name_import" in results: # If it's not a "from x import x, y" or "import x as y" import, # marked its usage to be replaced. @@ -142,4 +142,4 @@ bare_name = results["bare_with_attr"][0] new_name = self.replace.get(bare_name.value) if new_name: - bare_name.replace(Name(new_name, prefix=bare_name.get_prefix())) + bare_name.replace(Name(new_name, prefix=bare_name.prefix)) Modified: python/trunk/Lib/lib2to3/fixes/fix_input.py ============================================================================== --- python/trunk/Lib/lib2to3/fixes/fix_input.py (original) +++ python/trunk/Lib/lib2to3/fixes/fix_input.py Fri Jun 12 00:06:46 2009 @@ -22,5 +22,5 @@ return new = node.clone() - new.set_prefix(u"") - return Call(Name(u"eval"), [new], prefix=node.get_prefix()) + new.prefix = u"" + return Call(Name(u"eval"), [new], prefix=node.prefix) Modified: python/trunk/Lib/lib2to3/fixes/fix_intern.py ============================================================================== --- python/trunk/Lib/lib2to3/fixes/fix_intern.py (original) +++ python/trunk/Lib/lib2to3/fixes/fix_intern.py Fri Jun 12 00:06:46 2009 @@ -39,6 +39,6 @@ [results["lpar"].clone(), newarglist, results["rpar"].clone()])] + after) - new.set_prefix(node.get_prefix()) + new.prefix = node.prefix touch_import(None, u'sys', node) return new Modified: python/trunk/Lib/lib2to3/fixes/fix_isinstance.py ============================================================================== --- python/trunk/Lib/lib2to3/fixes/fix_isinstance.py (original) +++ python/trunk/Lib/lib2to3/fixes/fix_isinstance.py Fri Jun 12 00:06:46 2009 @@ -45,7 +45,7 @@ del new_args[-1] if len(new_args) == 1: atom = testlist.parent - new_args[0].set_prefix(atom.get_prefix()) + new_args[0].prefix = atom.prefix atom.replace(new_args[0]) else: args[:] = new_args Modified: python/trunk/Lib/lib2to3/fixes/fix_itertools.py ============================================================================== --- python/trunk/Lib/lib2to3/fixes/fix_itertools.py (original) +++ python/trunk/Lib/lib2to3/fixes/fix_itertools.py Fri Jun 12 00:06:46 2009 @@ -30,12 +30,12 @@ if 'it' in results and func.value != u'ifilterfalse': dot, it = (results['dot'], results['it']) # Remove the 'itertools' - prefix = it.get_prefix() + prefix = it.prefix it.remove() # Replace the node wich contains ('.', 'function') with the # function (to be consistant with the second part of the pattern) dot.remove() func.parent.replace(func) - prefix = prefix or func.get_prefix() + prefix = prefix or func.prefix func.replace(Name(func.value[1:], prefix=prefix)) Modified: python/trunk/Lib/lib2to3/fixes/fix_itertools_imports.py ============================================================================== --- python/trunk/Lib/lib2to3/fixes/fix_itertools_imports.py (original) +++ python/trunk/Lib/lib2to3/fixes/fix_itertools_imports.py Fri Jun 12 00:06:46 2009 @@ -46,7 +46,7 @@ # If there are no imports left, just get rid of the entire statement if not (imports.children or getattr(imports, 'value', None)) or \ imports.parent is None: - p = node.get_prefix() + p = node.prefix node = BlankLine() node.prefix = p return node Modified: python/trunk/Lib/lib2to3/fixes/fix_long.py ============================================================================== --- python/trunk/Lib/lib2to3/fixes/fix_long.py (original) +++ python/trunk/Lib/lib2to3/fixes/fix_long.py Fri Jun 12 00:06:46 2009 @@ -18,5 +18,5 @@ def transform(self, node, results): if is_probably_builtin(node): new = self.static_int.clone() - new.set_prefix(node.get_prefix()) + new.prefix = node.prefix return new Modified: python/trunk/Lib/lib2to3/fixes/fix_map.py ============================================================================== --- python/trunk/Lib/lib2to3/fixes/fix_map.py (original) +++ python/trunk/Lib/lib2to3/fixes/fix_map.py Fri Jun 12 00:06:46 2009 @@ -63,7 +63,7 @@ if node.parent.type == syms.simple_stmt: self.warning(node, "You should use a for loop here") new = node.clone() - new.set_prefix(u"") + new.prefix = u"" new = Call(Name(u"list"), [new]) elif "map_lambda" in results: new = ListComp(results.get("xp").clone(), @@ -76,7 +76,7 @@ if in_special_context(node): return None new = node.clone() - new.set_prefix(u"") + new.prefix = u"" new = Call(Name(u"list"), [new]) - new.set_prefix(node.get_prefix()) + new.prefix = node.prefix return new Modified: python/trunk/Lib/lib2to3/fixes/fix_metaclass.py ============================================================================== --- python/trunk/Lib/lib2to3/fixes/fix_metaclass.py (original) +++ python/trunk/Lib/lib2to3/fixes/fix_metaclass.py Fri Jun 12 00:06:46 2009 @@ -89,7 +89,7 @@ parent.insert_child(i, new_stmt) new_leaf1 = new_stmt.children[0].children[0] old_leaf1 = stmt_node.children[0].children[0] - new_leaf1.set_prefix(old_leaf1.get_prefix()) + new_leaf1.prefix = old_leaf1.prefix def remove_trailing_newline(node): @@ -136,7 +136,7 @@ node = kids.pop() if isinstance(node, Leaf) and node.type != token.DEDENT: if node.prefix: - node.set_prefix('') + node.prefix = u'' return else: kids.extend(node.children[::-1]) @@ -191,19 +191,19 @@ # now stick the metaclass in the arglist meta_txt = last_metaclass.children[0].children[0] meta_txt.value = 'metaclass' - orig_meta_prefix = meta_txt.get_prefix() + orig_meta_prefix = meta_txt.prefix if arglist.children: arglist.append_child(Leaf(token.COMMA, u',')) - meta_txt.set_prefix(u' ') + meta_txt.prefix = u' ' else: - meta_txt.set_prefix(u'') + meta_txt.prefix = u'' # compact the expression "metaclass = Meta" -> "metaclass=Meta" expr_stmt = last_metaclass.children[0] assert expr_stmt.type == syms.expr_stmt - expr_stmt.children[1].set_prefix(u'') - expr_stmt.children[2].set_prefix(u'') + expr_stmt.children[1].prefix = u'' + expr_stmt.children[2].prefix = u'' arglist.append_child(last_metaclass) @@ -214,7 +214,7 @@ # one-liner that was just __metaclass_ suite.remove() pass_leaf = Leaf(text_type, u'pass') - pass_leaf.set_prefix(orig_meta_prefix) + pass_leaf.prefix = orig_meta_prefix node.append_child(pass_leaf) node.append_child(Leaf(token.NEWLINE, u'\n')) Modified: python/trunk/Lib/lib2to3/fixes/fix_methodattrs.py ============================================================================== --- python/trunk/Lib/lib2to3/fixes/fix_methodattrs.py (original) +++ python/trunk/Lib/lib2to3/fixes/fix_methodattrs.py Fri Jun 12 00:06:46 2009 @@ -20,4 +20,4 @@ def transform(self, node, results): attr = results["attr"][0] new = unicode(MAP[attr.value]) - attr.replace(Name(new, prefix=attr.get_prefix())) + attr.replace(Name(new, prefix=attr.prefix)) Modified: python/trunk/Lib/lib2to3/fixes/fix_ne.py ============================================================================== --- python/trunk/Lib/lib2to3/fixes/fix_ne.py (original) +++ python/trunk/Lib/lib2to3/fixes/fix_ne.py Fri Jun 12 00:06:46 2009 @@ -17,6 +17,5 @@ return node.type == token.NOTEQUAL and node.value == u"<>" def transform(self, node, results): - new = pytree.Leaf(token.NOTEQUAL, u"!=") - new.set_prefix(node.get_prefix()) + new = pytree.Leaf(token.NOTEQUAL, u"!=", prefix=node.prefix) return new Modified: python/trunk/Lib/lib2to3/fixes/fix_next.py ============================================================================== --- python/trunk/Lib/lib2to3/fixes/fix_next.py (original) +++ python/trunk/Lib/lib2to3/fixes/fix_next.py Fri Jun 12 00:06:46 2009 @@ -48,17 +48,16 @@ base = results.get("base") attr = results.get("attr") name = results.get("name") - mod = results.get("mod") if base: if self.shadowed_next: - attr.replace(Name(u"__next__", prefix=attr.get_prefix())) + attr.replace(Name(u"__next__", prefix=attr.prefix)) else: base = [n.clone() for n in base] - base[0].set_prefix(u"") - node.replace(Call(Name(u"next", prefix=node.get_prefix()), base)) + base[0].prefix = u"" + node.replace(Call(Name(u"next", prefix=node.prefix), base)) elif name: - n = Name(u"__next__", prefix=name.get_prefix()) + n = Name(u"__next__", prefix=name.prefix) name.replace(n) elif attr: # We don't do this transformation if we're assigning to "x.next". Modified: python/trunk/Lib/lib2to3/fixes/fix_nonzero.py ============================================================================== --- python/trunk/Lib/lib2to3/fixes/fix_nonzero.py (original) +++ python/trunk/Lib/lib2to3/fixes/fix_nonzero.py Fri Jun 12 00:06:46 2009 @@ -16,5 +16,5 @@ def transform(self, node, results): name = results["name"] - new = Name(u"__bool__", prefix=name.get_prefix()) + new = Name(u"__bool__", prefix=name.prefix) name.replace(new) Modified: python/trunk/Lib/lib2to3/fixes/fix_numliterals.py ============================================================================== --- python/trunk/Lib/lib2to3/fixes/fix_numliterals.py (original) +++ python/trunk/Lib/lib2to3/fixes/fix_numliterals.py Fri Jun 12 00:06:46 2009 @@ -24,4 +24,4 @@ elif val.startswith(u'0') and val.isdigit() and len(set(val)) > 1: val = u"0o" + val[1:] - return Number(val, prefix=node.get_prefix()) + return Number(val, prefix=node.prefix) Modified: python/trunk/Lib/lib2to3/fixes/fix_paren.py ============================================================================== --- python/trunk/Lib/lib2to3/fixes/fix_paren.py (original) +++ python/trunk/Lib/lib2to3/fixes/fix_paren.py Fri Jun 12 00:06:46 2009 @@ -36,7 +36,7 @@ target = results["target"] lparen = LParen() - lparen.set_prefix(target.get_prefix()) - target.set_prefix(u"") # Make it hug the parentheses + lparen.prefix = target.prefix + target.prefix = u"" # Make it hug the parentheses target.insert_child(0, lparen) target.append_child(RParen()) Modified: python/trunk/Lib/lib2to3/fixes/fix_print.py ============================================================================== --- python/trunk/Lib/lib2to3/fixes/fix_print.py (original) +++ python/trunk/Lib/lib2to3/fixes/fix_print.py Fri Jun 12 00:06:46 2009 @@ -45,7 +45,7 @@ if bare_print: # Special-case print all by itself bare_print.replace(Call(Name(u"print"), [], - prefix=bare_print.get_prefix())) + prefix=bare_print.prefix)) return assert node.children[0] == Name(u"print") args = node.children[1:] @@ -65,7 +65,7 @@ # Now synthesize a print(args, sep=..., end=..., file=...) node. l_args = [arg.clone() for arg in args] if l_args: - l_args[0].set_prefix(u"") + l_args[0].prefix = u"" if sep is not None or end is not None or file is not None: if sep is not None: self.add_kwarg(l_args, u"sep", String(repr(sep))) @@ -74,17 +74,17 @@ if file is not None: self.add_kwarg(l_args, u"file", file) n_stmt = Call(Name(u"print"), l_args) - n_stmt.set_prefix(node.get_prefix()) + n_stmt.prefix = node.prefix return n_stmt def add_kwarg(self, l_nodes, s_kwd, n_expr): # XXX All this prefix-setting may lose comments (though rarely) - n_expr.set_prefix(u"") + n_expr.prefix = u"" n_argument = pytree.Node(self.syms.argument, (Name(s_kwd), pytree.Leaf(token.EQUAL, u"="), n_expr)) if l_nodes: l_nodes.append(Comma()) - n_argument.set_prefix(u" ") + n_argument.prefix = u" " l_nodes.append(n_argument) Modified: python/trunk/Lib/lib2to3/fixes/fix_raise.py ============================================================================== --- python/trunk/Lib/lib2to3/fixes/fix_raise.py (original) +++ python/trunk/Lib/lib2to3/fixes/fix_raise.py Fri Jun 12 00:06:46 2009 @@ -52,31 +52,31 @@ # exc.children[1:-1] is the unparenthesized tuple # exc.children[1].children[0] is the first element of the tuple exc = exc.children[1].children[0].clone() - exc.set_prefix(" ") + exc.prefix = " " if "val" not in results: # One-argument raise new = pytree.Node(syms.raise_stmt, [Name(u"raise"), exc]) - new.set_prefix(node.get_prefix()) + new.prefix = node.prefix return new val = results["val"].clone() if is_tuple(val): args = [c.clone() for c in val.children[1:-1]] else: - val.set_prefix(u"") + val.prefix = u"" args = [val] if "tb" in results: tb = results["tb"].clone() - tb.set_prefix(u"") + tb.prefix = u"" e = Call(exc, args) with_tb = Attr(e, Name(u'with_traceback')) + [ArgList([tb])] new = pytree.Node(syms.simple_stmt, [Name(u"raise")] + with_tb) - new.set_prefix(node.get_prefix()) + new.prefix = node.prefix return new else: return pytree.Node(syms.raise_stmt, [Name(u"raise"), Call(exc, args)], - prefix=node.get_prefix()) + prefix=node.prefix) Modified: python/trunk/Lib/lib2to3/fixes/fix_raw_input.py ============================================================================== --- python/trunk/Lib/lib2to3/fixes/fix_raw_input.py (original) +++ python/trunk/Lib/lib2to3/fixes/fix_raw_input.py Fri Jun 12 00:06:46 2009 @@ -13,4 +13,4 @@ def transform(self, node, results): name = results["name"] - name.replace(Name(u"input", prefix=name.get_prefix())) + name.replace(Name(u"input", prefix=name.prefix)) Modified: python/trunk/Lib/lib2to3/fixes/fix_renames.py ============================================================================== --- python/trunk/Lib/lib2to3/fixes/fix_renames.py (original) +++ python/trunk/Lib/lib2to3/fixes/fix_renames.py Fri Jun 12 00:06:46 2009 @@ -66,4 +66,4 @@ if mod_name and attr_name: new_attr = unicode(LOOKUP[(mod_name.value, attr_name.value)]) - attr_name.replace(Name(new_attr, prefix=attr_name.get_prefix())) + attr_name.replace(Name(new_attr, prefix=attr_name.prefix)) Modified: python/trunk/Lib/lib2to3/fixes/fix_repr.py ============================================================================== --- python/trunk/Lib/lib2to3/fixes/fix_repr.py (original) +++ python/trunk/Lib/lib2to3/fixes/fix_repr.py Fri Jun 12 00:06:46 2009 @@ -19,4 +19,4 @@ if expr.type == self.syms.testlist1: expr = parenthesize(expr) - return Call(Name(u"repr"), [expr], prefix=node.get_prefix()) + return Call(Name(u"repr"), [expr], prefix=node.prefix) Modified: python/trunk/Lib/lib2to3/fixes/fix_set_literal.py ============================================================================== --- python/trunk/Lib/lib2to3/fixes/fix_set_literal.py (original) +++ python/trunk/Lib/lib2to3/fixes/fix_set_literal.py Fri Jun 12 00:06:46 2009 @@ -38,15 +38,15 @@ literal.extend(n.clone() for n in items.children) literal.append(pytree.Leaf(token.RBRACE, u"}")) # Set the prefix of the right brace to that of the ')' or ']' - literal[-1].set_prefix(items.next_sibling.get_prefix()) + literal[-1].prefix = items.next_sibling.prefix maker = pytree.Node(syms.dictsetmaker, literal) - maker.set_prefix(node.get_prefix()) + maker.prefix = node.prefix # If the original was a one tuple, we need to remove the extra comma. if len(maker.children) == 4: n = maker.children[2] n.remove() - maker.children[-1].set_prefix(n.get_prefix()) + maker.children[-1].prefix = n.prefix # Finally, replace the set call with our shiny new literal. return maker Modified: python/trunk/Lib/lib2to3/fixes/fix_standarderror.py ============================================================================== --- python/trunk/Lib/lib2to3/fixes/fix_standarderror.py (original) +++ python/trunk/Lib/lib2to3/fixes/fix_standarderror.py Fri Jun 12 00:06:46 2009 @@ -15,4 +15,4 @@ """ def transform(self, node, results): - return Name(u"Exception", prefix=node.get_prefix()) + return Name(u"Exception", prefix=node.prefix) Modified: python/trunk/Lib/lib2to3/fixes/fix_sys_exc.py ============================================================================== --- python/trunk/Lib/lib2to3/fixes/fix_sys_exc.py (original) +++ python/trunk/Lib/lib2to3/fixes/fix_sys_exc.py Fri Jun 12 00:06:46 2009 @@ -22,8 +22,8 @@ sys_attr = results["attribute"][0] index = Number(self.exc_info.index(sys_attr.value)) - call = Call(Name(u"exc_info"), prefix=sys_attr.get_prefix()) + call = Call(Name(u"exc_info"), prefix=sys_attr.prefix) attr = Attr(Name(u"sys"), call) - attr[1].children[0].set_prefix(results["dot"].get_prefix()) + attr[1].children[0].prefix = results["dot"].prefix attr.append(Subscript(index)) - return Node(syms.power, attr, prefix=node.get_prefix()) + return Node(syms.power, attr, prefix=node.prefix) Modified: python/trunk/Lib/lib2to3/fixes/fix_throw.py ============================================================================== --- python/trunk/Lib/lib2to3/fixes/fix_throw.py (original) +++ python/trunk/Lib/lib2to3/fixes/fix_throw.py Fri Jun 12 00:06:46 2009 @@ -40,14 +40,14 @@ if is_tuple(val): args = [c.clone() for c in val.children[1:-1]] else: - val.set_prefix(u"") + val.prefix = u"" args = [val] throw_args = results["args"] if "tb" in results: tb = results["tb"].clone() - tb.set_prefix(u"") + tb.prefix = u"" e = Call(exc, args) with_tb = Attr(e, Name(u'with_traceback')) + [ArgList([tb])] Modified: python/trunk/Lib/lib2to3/fixes/fix_tuple_params.py ============================================================================== --- python/trunk/Lib/lib2to3/fixes/fix_tuple_params.py (original) +++ python/trunk/Lib/lib2to3/fixes/fix_tuple_params.py Fri Jun 12 00:06:46 2009 @@ -63,10 +63,10 @@ def handle_tuple(tuple_arg, add_prefix=False): n = Name(self.new_name()) arg = tuple_arg.clone() - arg.set_prefix(u"") + arg.prefix = u"" stmt = Assign(arg, n.clone()) if add_prefix: - n.set_prefix(u" ") + n.prefix = u" " tuple_arg.replace(n) new_lines.append(pytree.Node(syms.simple_stmt, [stmt, end.clone()])) @@ -91,14 +91,14 @@ # TODO(cwinter) suite-cleanup after = start if start == 0: - new_lines[0].set_prefix(u" ") + new_lines[0].prefix = u" " elif is_docstring(suite[0].children[start]): - new_lines[0].set_prefix(indent) + new_lines[0].prefix = indent after = start + 1 suite[0].children[after:after] = new_lines for i in range(after+1, after+len(new_lines)+1): - suite[0].children[i].set_prefix(indent) + suite[0].children[i].prefix = indent suite[0].changed() def transform_lambda(self, node, results): @@ -109,7 +109,7 @@ # Replace lambda ((((x)))): x with lambda x: x if inner.type == token.NAME: inner = inner.clone() - inner.set_prefix(u" ") + inner.prefix = u" " args.replace(inner) return @@ -124,7 +124,7 @@ subscripts = [c.clone() for c in to_index[n.value]] new = pytree.Node(syms.power, [new_param.clone()] + subscripts) - new.set_prefix(n.get_prefix()) + new.prefix = n.prefix n.replace(new) Modified: python/trunk/Lib/lib2to3/fixes/fix_types.py ============================================================================== --- python/trunk/Lib/lib2to3/fixes/fix_types.py (original) +++ python/trunk/Lib/lib2to3/fixes/fix_types.py Fri Jun 12 00:06:46 2009 @@ -58,5 +58,5 @@ def transform(self, node, results): new_value = unicode(_TYPE_MAPPING.get(results["name"].value)) if new_value: - return Name(new_value, prefix=node.get_prefix()) + return Name(new_value, prefix=node.prefix) return None Modified: python/trunk/Lib/lib2to3/fixes/fix_unicode.py ============================================================================== --- python/trunk/Lib/lib2to3/fixes/fix_unicode.py (original) +++ python/trunk/Lib/lib2to3/fixes/fix_unicode.py Fri Jun 12 00:06:46 2009 @@ -6,23 +6,20 @@ from ..pgen2 import token from .. import fixer_base +_mapping = {u"unichr" : u"chr", u"unicode" : u"str"} +_literal_re = re.compile(ur"[uU][rR]?[\'\"]") + class FixUnicode(fixer_base.BaseFix): - PATTERN = "STRING | NAME<'unicode' | 'unichr'>" + PATTERN = "STRING | 'unicode' | 'unichr'" def transform(self, node, results): if node.type == token.NAME: - if node.value == u"unicode": - new = node.clone() - new.value = u"str" - return new - if node.value == u"unichr": - new = node.clone() - new.value = u"chr" - return new - # XXX Warn when __unicode__ found? + new = node.clone() + new.value = _mapping[node.value] + return new elif node.type == token.STRING: - if re.match(ur"[uU][rR]?[\'\"]", node.value): + if _literal_re.match(node.value): new = node.clone() new.value = new.value[1:] return new Modified: python/trunk/Lib/lib2to3/fixes/fix_urllib.py ============================================================================== --- python/trunk/Lib/lib2to3/fixes/fix_urllib.py (original) +++ python/trunk/Lib/lib2to3/fixes/fix_urllib.py Fri Jun 12 00:06:46 2009 @@ -78,7 +78,7 @@ replacements. """ import_mod = results.get('module') - pref = import_mod.get_prefix() + pref = import_mod.prefix names = [] @@ -94,7 +94,7 @@ module. """ mod_member = results.get('mod_member') - pref = mod_member.get_prefix() + pref = mod_member.prefix member = results.get('member') # Simple case with only a single member being imported @@ -162,7 +162,7 @@ break if new_name: module_dot.replace(Name(new_name, - prefix=module_dot.get_prefix())) + prefix=module_dot.prefix)) else: self.cannot_convert(node, 'This is an invalid module element') Modified: python/trunk/Lib/lib2to3/fixes/fix_ws_comma.py ============================================================================== --- python/trunk/Lib/lib2to3/fixes/fix_ws_comma.py (original) +++ python/trunk/Lib/lib2to3/fixes/fix_ws_comma.py Fri Jun 12 00:06:46 2009 @@ -26,14 +26,14 @@ comma = False for child in new.children: if child in self.SEPS: - prefix = child.get_prefix() + prefix = child.prefix if prefix.isspace() and u"\n" not in prefix: - child.set_prefix(u"") + child.prefix = u"" comma = True else: if comma: - prefix = child.get_prefix() + prefix = child.prefix if not prefix: - child.set_prefix(u" ") + child.prefix = u" " comma = False return new Modified: python/trunk/Lib/lib2to3/fixes/fix_xrange.py ============================================================================== --- python/trunk/Lib/lib2to3/fixes/fix_xrange.py (original) +++ python/trunk/Lib/lib2to3/fixes/fix_xrange.py Fri Jun 12 00:06:46 2009 @@ -28,14 +28,14 @@ def transform_xrange(self, node, results): name = results["name"] - name.replace(Name(u"range", prefix=name.get_prefix())) + name.replace(Name(u"range", prefix=name.prefix)) def transform_range(self, node, results): if not self.in_special_context(node): range_call = Call(Name(u"range"), [results["args"].clone()]) # Encase the range call in list(). list_call = Call(Name(u"list"), [range_call], - prefix=node.get_prefix()) + prefix=node.prefix) # Put things that were after the range() call after the list call. for n in results["rest"]: list_call.append_child(n) Modified: python/trunk/Lib/lib2to3/fixes/fix_xreadlines.py ============================================================================== --- python/trunk/Lib/lib2to3/fixes/fix_xreadlines.py (original) +++ python/trunk/Lib/lib2to3/fixes/fix_xreadlines.py Fri Jun 12 00:06:46 2009 @@ -19,6 +19,6 @@ no_call = results.get("no_call") if no_call: - no_call.replace(Name(u"__iter__", prefix=no_call.get_prefix())) + no_call.replace(Name(u"__iter__", prefix=no_call.prefix)) else: node.replace([x.clone() for x in results["call"]]) Modified: python/trunk/Lib/lib2to3/fixes/fix_zip.py ============================================================================== --- python/trunk/Lib/lib2to3/fixes/fix_zip.py (original) +++ python/trunk/Lib/lib2to3/fixes/fix_zip.py Fri Jun 12 00:06:46 2009 @@ -28,7 +28,7 @@ return None new = node.clone() - new.set_prefix(u"") + new.prefix = u"" new = Call(Name(u"list"), [new]) - new.set_prefix(node.get_prefix()) + new.prefix = node.prefix return new Modified: python/trunk/Lib/lib2to3/patcomp.py ============================================================================== --- python/trunk/Lib/lib2to3/patcomp.py (original) +++ python/trunk/Lib/lib2to3/patcomp.py Fri Jun 12 00:06:46 2009 @@ -14,10 +14,7 @@ import os # Fairly local imports -from .pgen2 import driver -from .pgen2 import literals -from .pgen2 import token -from .pgen2 import tokenize +from .pgen2 import driver, literals, token, tokenize, parse # Really local imports from . import pytree @@ -28,6 +25,10 @@ "PatternGrammar.txt") +class PatternSyntaxError(Exception): + pass + + def tokenize_wrapper(input): """Tokenizes a string suppressing significant whitespace.""" skip = set((token.NEWLINE, token.INDENT, token.DEDENT)) @@ -54,7 +55,10 @@ def compile_pattern(self, input, debug=False): """Compiles a pattern string to a nested pytree.*Pattern object.""" tokens = tokenize_wrapper(input) - root = self.driver.parse_tokens(tokens, debug=debug) + try: + root = self.driver.parse_tokens(tokens, debug=debug) + except parse.ParseError as e: + raise PatternSyntaxError(str(e)) return self.compile_node(root) def compile_node(self, node): @@ -139,7 +143,9 @@ value = node.value if value.isupper(): if value not in TOKEN_MAP: - raise SyntaxError("Invalid token: %r" % value) + raise PatternSyntaxError("Invalid token: %r" % value) + if nodes[1:]: + raise PatternSyntaxError("Can't have details for token") return pytree.LeafPattern(TOKEN_MAP[value]) else: if value == "any": @@ -147,7 +153,7 @@ elif not value.startswith("_"): type = getattr(self.pysyms, value, None) if type is None: - raise SyntaxError("Invalid symbol: %r" % value) + raise PatternSyntaxError("Invalid symbol: %r" % value) if nodes[1:]: # Details present content = [self.compile_node(nodes[1].children[1])] else: Modified: python/trunk/Lib/lib2to3/pytree.py ============================================================================== --- python/trunk/Lib/lib2to3/pytree.py (original) +++ python/trunk/Lib/lib2to3/pytree.py Fri Jun 12 00:06:46 2009 @@ -13,6 +13,7 @@ __author__ = "Guido van Rossum " import sys +import warnings from StringIO import StringIO @@ -111,17 +112,21 @@ """ Set the prefix for the node (see Leaf class). - This must be implemented by the concrete subclass. + DEPRECATED; use the prefix property directly. """ - raise NotImplementedError + warnings.warn("set_prefix() is deprecated; use the prefix property", + DeprecationWarning, stacklevel=2) + self.prefix = prefix def get_prefix(self): """ Return the prefix for the node (see Leaf class). - This must be implemented by the concrete subclass. + DEPRECATED; use the prefix property directly. """ - raise NotImplementedError + warnings.warn("get_prefix() is deprecated; use the prefix property", + DeprecationWarning, stacklevel=2) + return self.prefix def replace(self, new): """Replace this node with a new one in the parent.""" @@ -209,12 +214,12 @@ def get_suffix(self): """ Return the string immediately following the invocant node. This is - effectively equivalent to node.next_sibling.get_prefix() + effectively equivalent to node.next_sibling.prefix """ next_sib = self.next_sibling if next_sib is None: return u"" - return next_sib.get_prefix() + return next_sib.prefix if sys.version_info < (3, 0): def __str__(self): @@ -241,7 +246,7 @@ assert ch.parent is None, repr(ch) ch.parent = self if prefix is not None: - self.set_prefix(prefix) + self.prefix = prefix def __repr__(self): """Return a canonical string representation.""" @@ -282,24 +287,19 @@ for node in child.post_order(): yield node - def set_prefix(self, prefix): - """ - Set the prefix for the node. - - This passes the responsibility on to the first child. - """ - if self.children: - self.children[0].set_prefix(prefix) - - def get_prefix(self): + @property + def prefix(self): """ - Return the prefix for the node. - - This passes the call on to the first child. + The whitespace and comments preceding this node in the input. """ if not self.children: return "" - return self.children[0].get_prefix() + return self.children[0].prefix + + @prefix.setter + def prefix(self, prefix): + if self.children: + self.children[0].prefix = prefix def set_child(self, i, child): """ @@ -335,9 +335,9 @@ """Concrete implementation for leaf nodes.""" # Default values for instance variables - prefix = "" # Whitespace and comments preceding this token in the input - lineno = 0 # Line where this token starts in the input - column = 0 # Column where this token tarts in the input + _prefix = "" # Whitespace and comments preceding this token in the input + lineno = 0 # Line where this token starts in the input + column = 0 # Column where this token tarts in the input def __init__(self, type, value, context=None, prefix=None): """ @@ -348,11 +348,11 @@ """ assert 0 <= type < 256, type if context is not None: - self.prefix, (self.lineno, self.column) = context + self._prefix, (self.lineno, self.column) = context self.type = type self.value = value if prefix is not None: - self.prefix = prefix + self._prefix = prefix def __repr__(self): """Return a canonical string representation.""" @@ -388,14 +388,17 @@ """Return a pre-order iterator for the tree.""" yield self - def set_prefix(self, prefix): - """Set the prefix for the node.""" - self.changed() - self.prefix = prefix + @property + def prefix(self): + """ + The whitespace and comments preceding this token in the input. + """ + return self._prefix - def get_prefix(self): - """Return the prefix for the node.""" - return self.prefix + @prefix.setter + def prefix(self, prefix): + self.changed() + self._prefix = prefix def convert(gr, raw_node): Modified: python/trunk/Lib/lib2to3/refactor.py ============================================================================== --- python/trunk/Lib/lib2to3/refactor.py (original) +++ python/trunk/Lib/lib2to3/refactor.py Fri Jun 12 00:06:46 2009 @@ -1,4 +1,3 @@ -#!/usr/bin/env python2.5 # Copyright 2006 Google, Inc. All Rights Reserved. # Licensed to PSF under a Contributor Agreement. @@ -23,11 +22,7 @@ # Local imports from .pgen2 import driver, tokenize - -from . import pytree -from . import patcomp -from . import fixes -from . import pygram +from . import pytree, pygram def get_all_fix_names(fixer_pkg, remove_prefix=True): Modified: python/trunk/Lib/lib2to3/tests/data/different_encoding.py ============================================================================== --- python/trunk/Lib/lib2to3/tests/data/different_encoding.py (original) +++ python/trunk/Lib/lib2to3/tests/data/different_encoding.py Fri Jun 12 00:06:46 2009 @@ -1,4 +1,3 @@ #!/usr/bin/env python # -*- coding: iso-8859-1 -*- -print(u'??????????????????????????????????????????????????????????????') - +print u'??????????????????????????????????????????????????????????????' Modified: python/trunk/Lib/lib2to3/tests/data/fixers/myfixes/fix_parrot.py ============================================================================== --- python/trunk/Lib/lib2to3/tests/data/fixers/myfixes/fix_parrot.py (original) +++ python/trunk/Lib/lib2to3/tests/data/fixers/myfixes/fix_parrot.py Fri Jun 12 00:06:46 2009 @@ -10,4 +10,4 @@ def transform(self, node, results): name = results["name"] - name.replace(Name("cheese", name.get_prefix())) + name.replace(Name("cheese", name.prefix)) Modified: python/trunk/Lib/lib2to3/tests/data/py2_test_grammar.py ============================================================================== --- python/trunk/Lib/lib2to3/tests/data/py2_test_grammar.py (original) +++ python/trunk/Lib/lib2to3/tests/data/py2_test_grammar.py Fri Jun 12 00:06:46 2009 @@ -1,5 +1,3 @@ -# Python 2's Lib/test/test_grammar.py (r66189) - # Python test set -- part 1, grammar. # This just tests whether the parser accepts them all. @@ -922,6 +920,26 @@ self.assertEqual([x for x, in [(4,), (5,), (6,)]], [4, 5, 6]) self.assertEqual(list(x for x, in [(7,), (8,), (9,)]), [7, 8, 9]) + def test_with_statement(self): + class manager(object): + def __enter__(self): + return (1, 2) + def __exit__(self, *args): + pass + + with manager(): + pass + with manager() as x: + pass + with manager() as (x, y): + pass + with manager(), manager(): + pass + with manager() as x, manager() as y: + pass + with manager() as x, manager(): + pass + def testIfElseExpr(self): # Test ifelse expressions in various cases def _checkeval(msg, ret): Modified: python/trunk/Lib/lib2to3/tests/data/py3_test_grammar.py ============================================================================== --- python/trunk/Lib/lib2to3/tests/data/py3_test_grammar.py (original) +++ python/trunk/Lib/lib2to3/tests/data/py3_test_grammar.py Fri Jun 12 00:06:46 2009 @@ -868,6 +868,26 @@ self.assertEqual([x for x, in [(4,), (5,), (6,)]], [4, 5, 6]) self.assertEqual(list(x for x, in [(7,), (8,), (9,)]), [7, 8, 9]) + def test_with_statement(self): + class manager(object): + def __enter__(self): + return (1, 2) + def __exit__(self, *args): + pass + + with manager(): + pass + with manager() as x: + pass + with manager() as (x, y): + pass + with manager(), manager(): + pass + with manager() as x, manager() as y: + pass + with manager() as x, manager(): + pass + def testIfElseExpr(self): # Test ifelse expressions in various cases def _checkeval(msg, ret): Modified: python/trunk/Lib/lib2to3/tests/pytree_idempotency.py ============================================================================== --- python/trunk/Lib/lib2to3/tests/pytree_idempotency.py (original) +++ python/trunk/Lib/lib2to3/tests/pytree_idempotency.py Fri Jun 12 00:06:46 2009 @@ -1,4 +1,4 @@ -#!/usr/bin/env python2.5 +#!/usr/bin/env python # Copyright 2006 Google, Inc. All Rights Reserved. # Licensed to PSF under a Contributor Agreement. Modified: python/trunk/Lib/lib2to3/tests/support.py ============================================================================== --- python/trunk/Lib/lib2to3/tests/support.py (original) +++ python/trunk/Lib/lib2to3/tests/support.py Fri Jun 12 00:06:46 2009 @@ -30,7 +30,7 @@ def reformat(string): return dedent(string) + u"\n\n" -def get_refactorer(fixers=None, options=None): +def get_refactorer(fixer_pkg="lib2to3", fixers=None, options=None): """ A convenience function for creating a RefactoringTool for tests. @@ -39,9 +39,9 @@ be passed to the RefactoringTool. """ if fixers is not None: - fixers = ["lib2to3.fixes.fix_" + fix for fix in fixers] + fixers = [fixer_pkg + ".fixes.fix_" + fix for fix in fixers] else: - fixers = refactor.get_fixers_from_package("lib2to3.fixes") + fixers = refactor.get_fixers_from_package(fixer_pkg + ".fixes") options = options or {} return refactor.RefactoringTool(fixers, options, explicit=True) Modified: python/trunk/Lib/lib2to3/tests/test_all_fixers.py ============================================================================== --- python/trunk/Lib/lib2to3/tests/test_all_fixers.py (original) +++ python/trunk/Lib/lib2to3/tests/test_all_fixers.py Fri Jun 12 00:06:46 2009 @@ -1,4 +1,3 @@ -#!/usr/bin/env python2.5 """Tests that run all fixer modules over an input stream. This has been broken out into its own test module because of its @@ -6,18 +5,13 @@ """ # Author: Collin Winter -# Testing imports -try: - from . import support -except ImportError: - import support - # Python imports import unittest # Local imports from .. import pytree from .. import refactor +from . import support class Test_all(support.TestCase): def setUp(self): @@ -28,8 +22,3 @@ for filepath in support.all_project_files(): print "Fixing %s..." % filepath self.refactor.refactor_file(filepath) - - -if __name__ == "__main__": - import __main__ - support.run_all_tests(__main__) Modified: python/trunk/Lib/lib2to3/tests/test_fixers.py ============================================================================== --- python/trunk/Lib/lib2to3/tests/test_fixers.py (original) +++ python/trunk/Lib/lib2to3/tests/test_fixers.py Fri Jun 12 00:06:46 2009 @@ -1,12 +1,4 @@ -#!/usr/bin/env python2.5 """ Test suite for the fixer modules """ -# Author: Collin Winter - -# Testing imports -try: - from tests import support -except ImportError: - import support # Python imports import os @@ -16,14 +8,19 @@ # Local imports from lib2to3 import pygram, pytree, refactor, fixer_util +from lib2to3.tests import support class FixerTestCase(support.TestCase): - def setUp(self, fix_list=None): + + # Other test cases can subclass this class and replace "fixer_pkg" with + # their own. + def setUp(self, fix_list=None, fixer_pkg="lib2to3", options=None): if fix_list is None: fix_list = [self.fixer] - options = {"print_function" : False} - self.refactor = support.get_refactorer(fix_list, options) + if options is None: + options = {"print_function" : False} + self.refactor = support.get_refactorer(fixer_pkg, fix_list, options) self.fixer_log = [] self.filename = u"" @@ -62,7 +59,7 @@ fixes = [self.fixer] fixes.extend(names) options = {"print_function" : False} - r = support.get_refactorer(fixes, options) + r = support.get_refactorer("lib2to3", fixes, options) (pre, post) = r.get_fixers() n = "fix_" + self.fixer if post and post[-1].__class__.__module__.endswith(n): @@ -419,6 +416,7 @@ def test_5(self): b = """print; print whatever;""" a = """print(); print(whatever);""" + self.check(b, a) def test_tuple(self): b = """print (a, b, c)""" @@ -782,6 +780,52 @@ pass""" self.check(b, a) + def test_one_line_suites(self): + b = """ + try: raise TypeError + except TypeError, e: + pass + """ + a = """ + try: raise TypeError + except TypeError as e: + pass + """ + self.check(b, a) + b = """ + try: + raise TypeError + except TypeError, e: pass + """ + a = """ + try: + raise TypeError + except TypeError as e: pass + """ + self.check(b, a) + b = """ + try: raise TypeError + except TypeError, e: pass + """ + a = """ + try: raise TypeError + except TypeError as e: pass + """ + self.check(b, a) + b = """ + try: raise TypeError + except TypeError, e: pass + else: function() + finally: done() + """ + a = """ + try: raise TypeError + except TypeError as e: pass + else: function() + finally: done() + """ + self.check(b, a) + # These should not be touched: def test_unchanged_1(self): @@ -2640,11 +2684,29 @@ class Test_unicode(FixerTestCase): fixer = "unicode" + def test_whitespace(self): + b = """unicode( x)""" + a = """str( x)""" + self.check(b, a) + + b = """ unicode(x )""" + a = """ str(x )""" + self.check(b, a) + + b = """ u'h'""" + a = """ 'h'""" + self.check(b, a) + def test_unicode_call(self): b = """unicode(x, y, z)""" a = """str(x, y, z)""" self.check(b, a) + def test_unichr(self): + b = """unichr(u'h')""" + a = """chr('h')""" + self.check(b, a) + def test_unicode_literal_1(self): b = '''u"x"''' a = '''"x"''' @@ -2656,8 +2718,8 @@ self.check(b, a) def test_unicode_literal_3(self): - b = """UR'''x'''""" - a = """R'''x'''""" + b = """UR'''x''' """ + a = """R'''x''' """ self.check(b, a) class Test_callable(FixerTestCase): @@ -3306,6 +3368,11 @@ a = """x = memoryview(y)""" self.check(b, a) + def test_slicing(self): + b = """buffer(y)[4:5]""" + a = """memoryview(y)[4:5]""" + self.check(b, a) + class Test_future(FixerTestCase): fixer = "future" @@ -4028,8 +4095,3 @@ b = """os.getcwdu ( )""" a = """os.getcwd ( )""" self.check(b, a) - - -if __name__ == "__main__": - import __main__ - support.run_all_tests(__main__) Modified: python/trunk/Lib/lib2to3/tests/test_parser.py ============================================================================== --- python/trunk/Lib/lib2to3/tests/test_parser.py (original) +++ python/trunk/Lib/lib2to3/tests/test_parser.py Fri Jun 12 00:06:46 2009 @@ -1,4 +1,3 @@ -#!/usr/bin/env python2.5 """Test suite for 2to3's parser and grammar files. This is the place to add tests for changes to 2to3's grammar, such as those @@ -6,7 +5,6 @@ parts of the grammar we've changed, we also make sure we can parse the test_grammar.py files from both Python 2 and Python 3. """ -# Author: Collin Winter # Testing imports from . import support @@ -198,7 +196,7 @@ def diff(fn, result): - f = open("@", "w") + f = open("@", "wb") try: f.write(result) finally: @@ -207,8 +205,3 @@ return os.system("diff -u %s @" % fn) finally: os.remove("@") - - -if __name__ == "__main__": - import __main__ - support.run_all_tests(__main__) Modified: python/trunk/Lib/lib2to3/tests/test_pytree.py ============================================================================== --- python/trunk/Lib/lib2to3/tests/test_pytree.py (original) +++ python/trunk/Lib/lib2to3/tests/test_pytree.py Fri Jun 12 00:06:46 2009 @@ -1,4 +1,3 @@ -#!/usr/bin/env python2.5 # Copyright 2006 Google, Inc. All Rights Reserved. # Licensed to PSF under a Contributor Agreement. @@ -10,11 +9,12 @@ especially when debugging a test. """ +import warnings + # Testing imports from . import support -# Local imports (XXX should become a package) -from .. import pytree +from lib2to3 import pytree try: sorted @@ -28,34 +28,48 @@ """Unit tests for nodes (Base, Leaf, Node).""" - def testBaseCantConstruct(self): + def test_deprecated_prefix_methods(self): + l = pytree.Leaf(100, "foo") + with warnings.catch_warnings(record=True) as w: + self.assertEqual(l.get_prefix(), "") + l.set_prefix("hi") + self.assertEqual(l.prefix, "hi") + self.assertEqual(len(w), 2) + for warning in w: + self.assertTrue(warning.category is DeprecationWarning) + self.assertEqual(str(w[0].message), "get_prefix() is deprecated; " \ + "use the prefix property") + self.assertEqual(str(w[1].message), "set_prefix() is deprecated; " \ + "use the prefix property") + + def test_instantiate_base(self): if __debug__: # Test that instantiating Base() raises an AssertionError self.assertRaises(AssertionError, pytree.Base) - def testLeaf(self): + def test_leaf(self): l1 = pytree.Leaf(100, "foo") self.assertEqual(l1.type, 100) self.assertEqual(l1.value, "foo") - def testLeafRepr(self): + def test_leaf_repr(self): l1 = pytree.Leaf(100, "foo") self.assertEqual(repr(l1), "Leaf(100, 'foo')") - def testLeafStr(self): + def test_leaf_str(self): l1 = pytree.Leaf(100, "foo") self.assertEqual(str(l1), "foo") l2 = pytree.Leaf(100, "foo", context=(" ", (10, 1))) self.assertEqual(str(l2), " foo") - def testLeafStrNumericValue(self): + def test_leaf_str_numeric_value(self): # Make sure that the Leaf's value is stringified. Failing to # do this can cause a TypeError in certain situations. l1 = pytree.Leaf(2, 5) - l1.set_prefix("foo_") + l1.prefix = "foo_" self.assertEqual(str(l1), "foo_5") - def testLeafEq(self): + def test_leaf_equality(self): l1 = pytree.Leaf(100, "foo") l2 = pytree.Leaf(100, "foo", context=(" ", (1, 0))) self.assertEqual(l1, l2) @@ -64,67 +78,67 @@ self.assertNotEqual(l1, l3) self.assertNotEqual(l1, l4) - def testLeafPrefix(self): + def test_leaf_prefix(self): l1 = pytree.Leaf(100, "foo") - self.assertEqual(l1.get_prefix(), "") + self.assertEqual(l1.prefix, "") self.failIf(l1.was_changed) - l1.set_prefix(" ##\n\n") - self.assertEqual(l1.get_prefix(), " ##\n\n") + l1.prefix = " ##\n\n" + self.assertEqual(l1.prefix, " ##\n\n") self.failUnless(l1.was_changed) - def testNode(self): + def test_node(self): l1 = pytree.Leaf(100, "foo") l2 = pytree.Leaf(200, "bar") n1 = pytree.Node(1000, [l1, l2]) self.assertEqual(n1.type, 1000) self.assertEqual(n1.children, [l1, l2]) - def testNodeRepr(self): + def test_node_repr(self): l1 = pytree.Leaf(100, "foo") l2 = pytree.Leaf(100, "bar", context=(" ", (1, 0))) n1 = pytree.Node(1000, [l1, l2]) self.assertEqual(repr(n1), "Node(1000, [%s, %s])" % (repr(l1), repr(l2))) - def testNodeStr(self): + def test_node_str(self): l1 = pytree.Leaf(100, "foo") l2 = pytree.Leaf(100, "bar", context=(" ", (1, 0))) n1 = pytree.Node(1000, [l1, l2]) self.assertEqual(str(n1), "foo bar") - def testNodePrefix(self): + def test_node_prefix(self): l1 = pytree.Leaf(100, "foo") - self.assertEqual(l1.get_prefix(), "") + self.assertEqual(l1.prefix, "") n1 = pytree.Node(1000, [l1]) - self.assertEqual(n1.get_prefix(), "") - n1.set_prefix(" ") - self.assertEqual(n1.get_prefix(), " ") - self.assertEqual(l1.get_prefix(), " ") + self.assertEqual(n1.prefix, "") + n1.prefix = " " + self.assertEqual(n1.prefix, " ") + self.assertEqual(l1.prefix, " ") - def testGetSuffix(self): + def test_get_suffix(self): l1 = pytree.Leaf(100, "foo", prefix="a") l2 = pytree.Leaf(100, "bar", prefix="b") n1 = pytree.Node(1000, [l1, l2]) - self.assertEqual(l1.get_suffix(), l2.get_prefix()) + self.assertEqual(l1.get_suffix(), l2.prefix) self.assertEqual(l2.get_suffix(), "") self.assertEqual(n1.get_suffix(), "") l3 = pytree.Leaf(100, "bar", prefix="c") n2 = pytree.Node(1000, [n1, l3]) - self.assertEqual(n1.get_suffix(), l3.get_prefix()) + self.assertEqual(n1.get_suffix(), l3.prefix) self.assertEqual(l3.get_suffix(), "") self.assertEqual(n2.get_suffix(), "") - def testNodeEq(self): + def test_node_equality(self): n1 = pytree.Node(1000, ()) n2 = pytree.Node(1000, [], context=(" ", (1, 0))) self.assertEqual(n1, n2) n3 = pytree.Node(1001, ()) self.assertNotEqual(n1, n3) - def testNodeEqRecursive(self): + def test_node_recursive_equality(self): l1 = pytree.Leaf(100, "foo") l2 = pytree.Leaf(100, "foo") n1 = pytree.Node(1000, [l1]) @@ -134,7 +148,7 @@ n3 = pytree.Node(1000, [l3]) self.assertNotEqual(n1, n3) - def testReplace(self): + def test_replace(self): l1 = pytree.Leaf(100, "foo") l2 = pytree.Leaf(100, "+") l3 = pytree.Leaf(100, "bar") @@ -148,7 +162,7 @@ self.failUnless(isinstance(n1.children, list)) self.failUnless(n1.was_changed) - def testReplaceWithList(self): + def test_replace_with_list(self): l1 = pytree.Leaf(100, "foo") l2 = pytree.Leaf(100, "+") l3 = pytree.Leaf(100, "bar") @@ -158,34 +172,30 @@ self.assertEqual(str(n1), "foo**bar") self.failUnless(isinstance(n1.children, list)) - def testPostOrder(self): + def test_post_order(self): l1 = pytree.Leaf(100, "foo") l2 = pytree.Leaf(100, "bar") n1 = pytree.Node(1000, [l1, l2]) self.assertEqual(list(n1.post_order()), [l1, l2, n1]) - def testPreOrder(self): + def test_pre_order(self): l1 = pytree.Leaf(100, "foo") l2 = pytree.Leaf(100, "bar") n1 = pytree.Node(1000, [l1, l2]) self.assertEqual(list(n1.pre_order()), [n1, l1, l2]) - def testChangedLeaf(self): + def test_changed(self): l1 = pytree.Leaf(100, "f") self.failIf(l1.was_changed) - l1.changed() self.failUnless(l1.was_changed) - def testChangedNode(self): l1 = pytree.Leaf(100, "f") n1 = pytree.Node(1000, [l1]) self.failIf(n1.was_changed) - n1.changed() self.failUnless(n1.was_changed) - def testChangedRecursive(self): l1 = pytree.Leaf(100, "foo") l2 = pytree.Leaf(100, "+") l3 = pytree.Leaf(100, "bar") @@ -200,23 +210,23 @@ self.failUnless(n2.was_changed) self.failIf(l1.was_changed) - def testLeafConstructorPrefix(self): + def test_leaf_constructor_prefix(self): for prefix in ("xyz_", ""): l1 = pytree.Leaf(100, "self", prefix=prefix) self.failUnless(str(l1), prefix + "self") - self.assertEqual(l1.get_prefix(), prefix) + self.assertEqual(l1.prefix, prefix) - def testNodeConstructorPrefix(self): + def test_node_constructor_prefix(self): for prefix in ("xyz_", ""): l1 = pytree.Leaf(100, "self") l2 = pytree.Leaf(100, "foo", prefix="_") n1 = pytree.Node(1000, [l1, l2], prefix=prefix) self.failUnless(str(n1), prefix + "self_foo") - self.assertEqual(n1.get_prefix(), prefix) - self.assertEqual(l1.get_prefix(), prefix) - self.assertEqual(l2.get_prefix(), "_") + self.assertEqual(n1.prefix, prefix) + self.assertEqual(l1.prefix, prefix) + self.assertEqual(l2.prefix, "_") - def testRemove(self): + def test_remove(self): l1 = pytree.Leaf(100, "foo") l2 = pytree.Leaf(100, "foo") n1 = pytree.Node(1000, [l1, l2]) @@ -239,7 +249,7 @@ self.failUnless(n1.was_changed) self.failUnless(n2.was_changed) - def testRemoveParentless(self): + def test_remove_parentless(self): n1 = pytree.Node(1000, []) n1.remove() self.assertEqual(n1.parent, None) @@ -248,7 +258,7 @@ l1.remove() self.assertEqual(l1.parent, None) - def testNodeSetChild(self): + def test_node_set_child(self): l1 = pytree.Leaf(100, "foo") n1 = pytree.Node(1000, [l1]) @@ -269,7 +279,7 @@ # I don't care what it raises, so long as it's an exception self.assertRaises(Exception, n1.set_child, 0, list) - def testNodeInsertChild(self): + def test_node_insert_child(self): l1 = pytree.Leaf(100, "foo") n1 = pytree.Node(1000, [l1]) @@ -285,7 +295,7 @@ # I don't care what it raises, so long as it's an exception self.assertRaises(Exception, n1.insert_child, 0, list) - def testNodeAppendChild(self): + def test_node_append_child(self): n1 = pytree.Node(1000, []) l1 = pytree.Leaf(100, "foo") @@ -301,7 +311,7 @@ # I don't care what it raises, so long as it's an exception self.assertRaises(Exception, n1.append_child, list) - def testNodeNextSibling(self): + def test_node_next_sibling(self): n1 = pytree.Node(1000, []) n2 = pytree.Node(1000, []) p1 = pytree.Node(1000, [n1, n2]) @@ -310,7 +320,7 @@ self.assertEqual(n2.next_sibling, None) self.assertEqual(p1.next_sibling, None) - def testLeafNextSibling(self): + def test_leaf_next_sibling(self): l1 = pytree.Leaf(100, "a") l2 = pytree.Leaf(100, "b") p1 = pytree.Node(1000, [l1, l2]) @@ -319,7 +329,7 @@ self.assertEqual(l2.next_sibling, None) self.assertEqual(p1.next_sibling, None) - def testNodePrevSibling(self): + def test_node_prev_sibling(self): n1 = pytree.Node(1000, []) n2 = pytree.Node(1000, []) p1 = pytree.Node(1000, [n1, n2]) @@ -328,7 +338,7 @@ self.assertEqual(n1.prev_sibling, None) self.assertEqual(p1.prev_sibling, None) - def testLeafPrevSibling(self): + def test_leaf_prev_sibling(self): l1 = pytree.Leaf(100, "a") l2 = pytree.Leaf(100, "b") p1 = pytree.Node(1000, [l1, l2]) @@ -342,7 +352,7 @@ """Unit tests for tree matching patterns.""" - def testBasicPatterns(self): + def test_basic_patterns(self): # Build a tree l1 = pytree.Leaf(100, "foo") l2 = pytree.Leaf(100, "bar") @@ -378,7 +388,7 @@ self.assertFalse(pn.match(l2, results=r)) self.assertEqual(r, {}) - def testWildcardPatterns(self): + def test_wildcard(self): # Build a tree for testing l1 = pytree.Leaf(100, "foo") l2 = pytree.Leaf(100, "bar") @@ -409,7 +419,7 @@ self.assert_(r["pl"] is l3) r = {} - def testGenerateMatches(self): + def test_generate_matches(self): la = pytree.Leaf(1, "a") lb = pytree.Leaf(1, "b") lc = pytree.Leaf(1, "c") @@ -439,7 +449,7 @@ for c in "abcdef": self.assertEqual(r["p" + c], pytree.Leaf(1, c)) - def testHasKeyExample(self): + def test_has_key_example(self): pattern = pytree.NodePattern(331, (pytree.LeafPattern(7), pytree.WildcardPattern(name="args"), @@ -451,8 +461,3 @@ r = {} self.assert_(pattern.match(node, r)) self.assertEqual(r["args"], [l2]) - - -if __name__ == "__main__": - import __main__ - support.run_all_tests(__main__) Modified: python/trunk/Lib/lib2to3/tests/test_util.py ============================================================================== --- python/trunk/Lib/lib2to3/tests/test_util.py (original) +++ python/trunk/Lib/lib2to3/tests/test_util.py Fri Jun 12 00:06:46 2009 @@ -1,6 +1,4 @@ -#!/usr/bin/env python2.5 """ Test suite for the code in fixes.util """ -# Author: Collin Winter # Testing imports from . import support @@ -552,8 +550,3 @@ node = parse('bar()') fixer_util.touch_import(None, "cgi", node) self.assertEqual(str(node), 'import cgi\nbar()\n\n') - - -if __name__ == "__main__": - import __main__ - support.run_all_tests(__main__) From python-checkins at python.org Fri Jun 12 00:07:13 2009 From: python-checkins at python.org (raymond.hettinger) Date: Fri, 12 Jun 2009 00:07:13 +0200 (CEST) Subject: [Python-checkins] r73371 - python/branches/release30-maint/Doc/library/bisect.rst Message-ID: <20090611220713.23388D8D3@mail.python.org> Author: raymond.hettinger Date: Fri Jun 12 00:07:12 2009 New Revision: 73371 Log: Move comment to correct line. Modified: python/branches/release30-maint/Doc/library/bisect.rst Modified: python/branches/release30-maint/Doc/library/bisect.rst ============================================================================== --- python/branches/release30-maint/Doc/library/bisect.rst (original) +++ python/branches/release30-maint/Doc/library/bisect.rst Fri Jun 12 00:07:12 2009 @@ -86,8 +86,8 @@ of the record in question:: >>> data = [('red', 5), ('blue', 1), ('yellow', 8), ('black', 0)] - >>> data.sort(key=lambda r: r[1]) # precomputed list of keys - >>> keys = [r[1] for r in data] + >>> data.sort(key=lambda r: r[1]) + >>> keys = [r[1] for r in data] # precomputed list of keys >>> data[bisect_left(keys, 0)] ('black', 0) >>> data[bisect_left(keys, 1)] From python-checkins at python.org Fri Jun 12 00:08:10 2009 From: python-checkins at python.org (raymond.hettinger) Date: Fri, 12 Jun 2009 00:08:10 +0200 (CEST) Subject: [Python-checkins] r73372 - python/trunk/Doc/library/bisect.rst Message-ID: <20090611220810.A62AAC2AC@mail.python.org> Author: raymond.hettinger Date: Fri Jun 12 00:08:10 2009 New Revision: 73372 Log: Move comment to correct line. Modified: python/trunk/Doc/library/bisect.rst Modified: python/trunk/Doc/library/bisect.rst ============================================================================== --- python/trunk/Doc/library/bisect.rst (original) +++ python/trunk/Doc/library/bisect.rst Fri Jun 12 00:08:10 2009 @@ -94,8 +94,8 @@ of the record in question:: >>> data = [('red', 5), ('blue', 1), ('yellow', 8), ('black', 0)] - >>> data.sort(key=lambda r: r[1]) # precomputed list of keys - >>> keys = [r[1] for r in data] + >>> data.sort(key=lambda r: r[1]) + >>> keys = [r[1] for r in data] # precomputed list of keys >>> data[bisect_left(keys, 0)] ('black', 0) >>> data[bisect_left(keys, 1)] From python-checkins at python.org Fri Jun 12 00:08:48 2009 From: python-checkins at python.org (raymond.hettinger) Date: Fri, 12 Jun 2009 00:08:48 +0200 (CEST) Subject: [Python-checkins] r73373 - python/branches/release26-maint/Doc/library/bisect.rst Message-ID: <20090611220848.B1A25D501@mail.python.org> Author: raymond.hettinger Date: Fri Jun 12 00:08:48 2009 New Revision: 73373 Log: Add example of how to do key lookups with bisect(). Modified: python/branches/release26-maint/Doc/library/bisect.rst Modified: python/branches/release26-maint/Doc/library/bisect.rst ============================================================================== --- python/branches/release26-maint/Doc/library/bisect.rst (original) +++ python/branches/release26-maint/Doc/library/bisect.rst Fri Jun 12 00:08:48 2009 @@ -94,8 +94,8 @@ of the record in question:: >>> data = [('red', 5), ('blue', 1), ('yellow', 8), ('black', 0)] - >>> data.sort(key=lambda r: r[1]) # precomputed list of keys - >>> keys = [r[1] for r in data] + >>> data.sort(key=lambda r: r[1]) + >>> keys = [r[1] for r in data] # precomputed list of keys >>> data[bisect_left(keys, 0)] ('black', 0) >>> data[bisect_left(keys, 1)] From python-checkins at python.org Fri Jun 12 00:09:02 2009 From: python-checkins at python.org (benjamin.peterson) Date: Fri, 12 Jun 2009 00:09:02 +0200 (CEST) Subject: [Python-checkins] r73374 - python/branches/py3k Message-ID: <20090611220902.E6CEAD7AB@mail.python.org> Author: benjamin.peterson Date: Fri Jun 12 00:09:02 2009 New Revision: 73374 Log: Blocked revisions 73182,73184,73238,73252,73281,73334,73361-73362,73367 via svnmerge ........ r73182 | josiah.carlson | 2009-06-03 14:46:21 -0500 (Wed, 03 Jun 2009) | 4 lines This fixes bug 5798 on OS X. This should also fix disconnect behavior cross-platform. ........ r73184 | josiah.carlson | 2009-06-03 14:51:52 -0500 (Wed, 03 Jun 2009) | 2 lines Fix for line wrap ugly. ........ r73238 | hirokazu.yamamoto | 2009-06-05 00:15:58 -0500 (Fri, 05 Jun 2009) | 1 line Fix test__locale on windows (Backport of r72365) ........ r73252 | georg.brandl | 2009-06-06 00:54:34 -0500 (Sat, 06 Jun 2009) | 1 line #6206: fix test__locale. ........ r73281 | benjamin.peterson | 2009-06-07 17:55:36 -0500 (Sun, 07 Jun 2009) | 1 line remove has_key ........ r73334 | raymond.hettinger | 2009-06-10 11:15:02 -0500 (Wed, 10 Jun 2009) | 1 line Issue 6256: Fix stacklevel in warning message. ........ r73361 | benjamin.peterson | 2009-06-11 11:25:52 -0500 (Thu, 11 Jun 2009) | 1 line remove duplicate check ........ r73362 | benjamin.peterson | 2009-06-11 12:49:38 -0500 (Thu, 11 Jun 2009) | 1 line revert r73361 ........ r73367 | raymond.hettinger | 2009-06-11 17:04:00 -0500 (Thu, 11 Jun 2009) | 1 line Add example of how to do key lookups with bisect(). ........ Modified: python/branches/py3k/ (props changed) From python-checkins at python.org Fri Jun 12 00:12:47 2009 From: python-checkins at python.org (benjamin.peterson) Date: Fri, 12 Jun 2009 00:12:47 +0200 (CEST) Subject: [Python-checkins] r73375 - python/branches/py3k Message-ID: <20090611221247.D71D0D3E8@mail.python.org> Author: benjamin.peterson Date: Fri Jun 12 00:12:47 2009 New Revision: 73375 Log: Blocked revisions 73372 via svnmerge ........ r73372 | raymond.hettinger | 2009-06-11 17:08:10 -0500 (Thu, 11 Jun 2009) | 1 line Move comment to correct line. ........ Modified: python/branches/py3k/ (props changed) From python-checkins at python.org Fri Jun 12 00:29:23 2009 From: python-checkins at python.org (benjamin.peterson) Date: Fri, 12 Jun 2009 00:29:23 +0200 (CEST) Subject: [Python-checkins] r73376 - python/trunk/Python/ast.c Message-ID: <20090611222923.BE7BDDB03@mail.python.org> Author: benjamin.peterson Date: Fri Jun 12 00:29:23 2009 New Revision: 73376 Log: remove check for case handled in sub-function Modified: python/trunk/Python/ast.c Modified: python/trunk/Python/ast.c ============================================================================== --- python/trunk/Python/ast.c (original) +++ python/trunk/Python/ast.c Fri Jun 12 00:29:23 2009 @@ -1347,9 +1347,6 @@ if (TYPE(ch) == yield_expr) return ast_for_expr(c, ch); - if ((NCH(ch) > 1) && (TYPE(CHILD(ch, 1)) == gen_for)) - return ast_for_genexp(c, ch); - return ast_for_testlist_gexp(c, ch); case LSQB: /* list (or list comprehension) */ ch = CHILD(n, 1); From python-checkins at python.org Fri Jun 12 00:54:12 2009 From: python-checkins at python.org (benjamin.peterson) Date: Fri, 12 Jun 2009 00:54:12 +0200 (CEST) Subject: [Python-checkins] r73377 - in python/branches/py3k: Doc/library/os.rst Doc/library/subprocess.rst Doc/whatsnew/2.7.rst Grammar/Grammar Lib/multiprocessing/queues.py Lib/os.py Lib/symbol.py Lib/test/test_generators.py Lib/test/test_genexps.py Lib/test/test_syntax.py Makefile.pre.in Objects/dictobject.c Parser/asdl.py Parser/asdl_c.py Python/ast.c Message-ID: <20090611225412.39303D526@mail.python.org> Author: benjamin.peterson Date: Fri Jun 12 00:54:11 2009 New Revision: 73377 Log: Merged revisions 73196,73278-73280,73299,73308,73312-73313,73317-73318,73321,73324,73331,73335,73340,73363 via svnmerge from svn+ssh://pythondev at svn.python.org/python/trunk ........ r73196 | benjamin.peterson | 2009-06-03 20:40:29 -0500 (Wed, 03 Jun 2009) | 1 line use the offical api ........ r73278 | benjamin.peterson | 2009-06-07 17:33:11 -0500 (Sun, 07 Jun 2009) | 1 line inherit from object ........ r73279 | benjamin.peterson | 2009-06-07 17:35:00 -0500 (Sun, 07 Jun 2009) | 1 line always inherit from an appropiate base class ........ r73280 | benjamin.peterson | 2009-06-07 17:54:35 -0500 (Sun, 07 Jun 2009) | 1 line use booleans for flags ........ r73299 | georg.brandl | 2009-06-08 13:41:36 -0500 (Mon, 08 Jun 2009) | 1 line Typo fix. ........ r73308 | benjamin.peterson | 2009-06-08 17:18:32 -0500 (Mon, 08 Jun 2009) | 1 line remove useless assertion ........ r73312 | benjamin.peterson | 2009-06-08 18:44:13 -0500 (Mon, 08 Jun 2009) | 1 line remove error checks already done in set_context() ........ r73313 | r.david.murray | 2009-06-08 19:44:22 -0500 (Mon, 08 Jun 2009) | 4 lines Issue 2947: document how return code handling translates from os.popen to subprocess. Also fixes reference link in the os.spawn documentation. ........ r73317 | benjamin.peterson | 2009-06-09 12:24:26 -0500 (Tue, 09 Jun 2009) | 1 line make ast.c depend on the grammar ........ r73318 | benjamin.peterson | 2009-06-09 12:29:51 -0500 (Tue, 09 Jun 2009) | 1 line explain why keyword names are not just NAME ........ r73321 | benjamin.peterson | 2009-06-09 16:13:43 -0500 (Tue, 09 Jun 2009) | 1 line update symbol.py from with statement changes ........ r73324 | amaury.forgeotdarc | 2009-06-09 17:53:16 -0500 (Tue, 09 Jun 2009) | 2 lines Avoid invoking the parser/compiler just to test the presence of a function. ........ r73331 | benjamin.peterson | 2009-06-10 08:45:31 -0500 (Wed, 10 Jun 2009) | 1 line fix spelling ........ r73335 | raymond.hettinger | 2009-06-10 11:15:40 -0500 (Wed, 10 Jun 2009) | 1 line Fix signed/unsigned compiler warning. ........ r73340 | amaury.forgeotdarc | 2009-06-10 15:30:19 -0500 (Wed, 10 Jun 2009) | 2 lines Fix a typo spotted by Nick Coghlan. ........ r73363 | benjamin.peterson | 2009-06-11 12:51:17 -0500 (Thu, 11 Jun 2009) | 1 line use multi-with syntax ........ Modified: python/branches/py3k/ (props changed) python/branches/py3k/Doc/library/os.rst python/branches/py3k/Doc/library/subprocess.rst python/branches/py3k/Doc/whatsnew/2.7.rst python/branches/py3k/Grammar/Grammar python/branches/py3k/Lib/multiprocessing/queues.py python/branches/py3k/Lib/os.py python/branches/py3k/Lib/symbol.py python/branches/py3k/Lib/test/test_generators.py python/branches/py3k/Lib/test/test_genexps.py python/branches/py3k/Lib/test/test_syntax.py python/branches/py3k/Makefile.pre.in python/branches/py3k/Objects/dictobject.c python/branches/py3k/Parser/asdl.py python/branches/py3k/Parser/asdl_c.py python/branches/py3k/Python/ast.c Modified: python/branches/py3k/Doc/library/os.rst ============================================================================== --- python/branches/py3k/Doc/library/os.rst (original) +++ python/branches/py3k/Doc/library/os.rst Fri Jun 12 00:54:11 2009 @@ -1470,8 +1470,8 @@ (Note that the :mod:`subprocess` module provides more powerful facilities for spawning new processes and retrieving their results; using that module is - preferable to using these functions. Check specially the *Replacing Older - Functions with the subprocess Module* section in that documentation page.) + preferable to using these functions. Check especially the + :ref:`subprocess-replacements` section.) If *mode* is :const:`P_NOWAIT`, this function returns the process id of the new process; if *mode* is :const:`P_WAIT`, returns the process's exit code if it Modified: python/branches/py3k/Doc/library/subprocess.rst ============================================================================== --- python/branches/py3k/Doc/library/subprocess.rst (original) +++ python/branches/py3k/Doc/library/subprocess.rst Fri Jun 12 00:54:11 2009 @@ -412,8 +412,8 @@ output = p2.communicate()[0] -Replacing os.system() -^^^^^^^^^^^^^^^^^^^^^ +Replacing :func:`os.system` +^^^^^^^^^^^^^^^^^^^^^^^^^^^ :: @@ -440,8 +440,8 @@ print("Execution failed:", e, file=sys.stderr) -Replacing the os.spawn family -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +Replacing the :func:`os.spawn ` family +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ P_NOWAIT example:: @@ -468,17 +468,85 @@ Popen(["/bin/mycmd", "myarg"], env={"PATH": "/usr/bin"}) -Replacing os.popen -^^^^^^^^^^^^^^^^^^ + +Replacing :func:`os.popen`, :func:`os.popen2`, :func:`os.popen3` +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +:: + + (child_stdin, child_stdout) = os.popen2(cmd, mode, bufsize) + ==> + p = Popen(cmd, shell=True, bufsize=bufsize, + stdin=PIPE, stdout=PIPE, close_fds=True) + (child_stdin, child_stdout) = (p.stdin, p.stdout) + +:: + + (child_stdin, + child_stdout, + child_stderr) = os.popen3(cmd, mode, bufsize) + ==> + p = Popen(cmd, shell=True, bufsize=bufsize, + stdin=PIPE, stdout=PIPE, stderr=PIPE, close_fds=True) + (child_stdin, + child_stdout, + child_stderr) = (p.stdin, p.stdout, p.stderr) + +:: + + (child_stdin, child_stdout_and_stderr) = os.popen4(cmd, mode, bufsize) + ==> + p = Popen(cmd, shell=True, bufsize=bufsize, + stdin=PIPE, stdout=PIPE, stderr=STDOUT, close_fds=True) + (child_stdin, child_stdout_and_stderr) = (p.stdin, p.stdout) + +Return code handling translates as follows:: + + pipe = os.popen(cmd, 'w') + ... + rc = pipe.close() + if rc != None and rc % 256: + print "There were some errors" + ==> + process = Popen(cmd, 'w', stdin=PIPE) + ... + process.stdin.close() + if process.wait() != 0: + print "There were some errors" + + +Replacing functions from the :mod:`popen2` module +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +.. note:: + + If the cmd argument to popen2 functions is a string, the command is executed + through /bin/sh. If it is a list, the command is directly executed. :: - pipe = os.popen(cmd, 'r', bufsize) + (child_stdout, child_stdin) = popen2.popen2("somestring", bufsize, mode) ==> - pipe = Popen(cmd, shell=True, bufsize=bufsize, stdout=PIPE).stdout + p = Popen(["somestring"], shell=True, bufsize=bufsize, + stdin=PIPE, stdout=PIPE, close_fds=True) + (child_stdout, child_stdin) = (p.stdout, p.stdin) :: - pipe = os.popen(cmd, 'w', bufsize) + (child_stdout, child_stdin) = popen2.popen2(["mycmd", "myarg"], bufsize, mode) ==> - pipe = Popen(cmd, shell=True, bufsize=bufsize, stdin=PIPE).stdin + p = Popen(["mycmd", "myarg"], bufsize=bufsize, + stdin=PIPE, stdout=PIPE, close_fds=True) + (child_stdout, child_stdin) = (p.stdout, p.stdin) + +:class:`popen2.Popen3` and :class:`popen2.Popen4` basically work as +:class:`subprocess.Popen`, except that: + +* :class:`Popen` raises an exception if the execution fails. + +* the *capturestderr* argument is replaced with the *stderr* argument. + +* ``stdin=PIPE`` and ``stdout=PIPE`` must be specified. + +* popen2 closes all file descriptors by default, but you have to specify + ``close_fds=True`` with :class:`Popen`. Modified: python/branches/py3k/Doc/whatsnew/2.7.rst ============================================================================== --- python/branches/py3k/Doc/whatsnew/2.7.rst (original) +++ python/branches/py3k/Doc/whatsnew/2.7.rst Fri Jun 12 00:54:11 2009 @@ -663,7 +663,11 @@ This section lists previously described changes and other bugfixes that may require changes to your code: -To be written. +* Because of an optimization for the :keyword:`with` statement, the special + methods :meth:`__enter__` and :meth:`__exit__` must belong to the object's + type, and cannot be directly attached to the object's instance. This + affects new-style classes (derived from :class:`object`) and C extension + types. (:issue:`6101`.) .. ====================================================================== Modified: python/branches/py3k/Grammar/Grammar ============================================================================== --- python/branches/py3k/Grammar/Grammar (original) +++ python/branches/py3k/Grammar/Grammar Fri Jun 12 00:54:11 2009 @@ -116,8 +116,9 @@ arglist: (argument ',')* (argument [','] |'*' test (',' argument)* [',' '**' test] |'**' test) +# The reason that keywords are test nodes instead of NAME is that using NAME +# results in an ambiguity. ast.c makes sure it's a NAME. argument: test [comp_for] | test '=' test # Really [keyword '='] test - comp_iter: comp_for | comp_if comp_for: 'for' exprlist 'in' or_test [comp_iter] comp_if: 'if' test_nocond [comp_iter] Modified: python/branches/py3k/Lib/multiprocessing/queues.py ============================================================================== --- python/branches/py3k/Lib/multiprocessing/queues.py (original) +++ python/branches/py3k/Lib/multiprocessing/queues.py Fri Jun 12 00:54:11 2009 @@ -109,7 +109,7 @@ self._rlock.release() def qsize(self): - # Raises NotImplementError on Mac OSX because of broken sem_getvalue() + # Raises NotImplementedError on Mac OSX because of broken sem_getvalue() return self._maxsize - self._sem._semlock._get_value() def empty(self): Modified: python/branches/py3k/Lib/os.py ============================================================================== --- python/branches/py3k/Lib/os.py (original) +++ python/branches/py3k/Lib/os.py Fri Jun 12 00:54:11 2009 @@ -437,11 +437,7 @@ __all__.append("getenv") def _exists(name): - try: - eval(name) - return True - except NameError: - return False + return name in globals() # Supply spawn*() (probably only for Unix) if _exists("fork") and not _exists("spawnv") and _exists("execv"): Modified: python/branches/py3k/Lib/symbol.py ============================================================================== --- python/branches/py3k/Lib/symbol.py (original) +++ python/branches/py3k/Lib/symbol.py Fri Jun 12 00:54:11 2009 @@ -52,7 +52,7 @@ for_stmt = 295 try_stmt = 296 with_stmt = 297 -with_var = 298 +with_item = 298 except_clause = 299 suite = 300 test = 301 Modified: python/branches/py3k/Lib/test/test_generators.py ============================================================================== --- python/branches/py3k/Lib/test/test_generators.py (original) +++ python/branches/py3k/Lib/test/test_generators.py Fri Jun 12 00:54:11 2009 @@ -1584,7 +1584,7 @@ >>> def f(): (yield bar) += y Traceback (most recent call last): ... -SyntaxError: augmented assignment to yield expression not possible +SyntaxError: can't assign to yield expression Now check some throw() conditions: Modified: python/branches/py3k/Lib/test/test_genexps.py ============================================================================== --- python/branches/py3k/Lib/test/test_genexps.py (original) +++ python/branches/py3k/Lib/test/test_genexps.py Fri Jun 12 00:54:11 2009 @@ -142,7 +142,7 @@ >>> (y for y in (1,2)) += 10 Traceback (most recent call last): ... - SyntaxError: augmented assignment to generator expression not possible + SyntaxError: can't assign to generator expression ########### Tests borrowed from or inspired by test_generators.py ############ Modified: python/branches/py3k/Lib/test/test_syntax.py ============================================================================== --- python/branches/py3k/Lib/test/test_syntax.py (original) +++ python/branches/py3k/Lib/test/test_syntax.py Fri Jun 12 00:54:11 2009 @@ -222,17 +222,17 @@ SyntaxError: keyword can't be an expression -From ast_for_expr_stmt(): +More set_context(): >>> (x for x in x) += 1 Traceback (most recent call last): -SyntaxError: augmented assignment to generator expression not possible +SyntaxError: can't assign to generator expression >>> None += 1 Traceback (most recent call last): SyntaxError: assignment to keyword >>> f() += 1 Traceback (most recent call last): -SyntaxError: illegal expression for augmented assignment +SyntaxError: can't assign to function call Test continue in finally in weird combinations. Modified: python/branches/py3k/Makefile.pre.in ============================================================================== --- python/branches/py3k/Makefile.pre.in (original) +++ python/branches/py3k/Makefile.pre.in Fri Jun 12 00:54:11 2009 @@ -562,7 +562,7 @@ $(AST_C): $(AST_ASDL) $(ASDLGEN_FILES) $(ASDLGEN) -c $(AST_C_DIR) $(AST_ASDL) -Python/compile.o Python/symtable.o: $(GRAMMAR_H) $(AST_H) +Python/compile.o Python/symtable.o Python/ast.o: $(GRAMMAR_H) $(AST_H) Python/getplatform.o: $(srcdir)/Python/getplatform.c $(CC) -c $(PY_CFLAGS) -DPLATFORM='"$(MACHDEP)"' -o $@ $(srcdir)/Python/getplatform.c Modified: python/branches/py3k/Objects/dictobject.c ============================================================================== --- python/branches/py3k/Objects/dictobject.c (original) +++ python/branches/py3k/Objects/dictobject.c Fri Jun 12 00:54:11 2009 @@ -717,7 +717,7 @@ /* We can arrive here with a NULL tstate during initialization: try running "python -Wi" for an example related to string interning. Let's just hope that no exception occurs then... */ - tstate = _PyThreadState_Current; + tstate = PyThreadState_GET(); if (tstate != NULL && tstate->curexc_type != NULL) { /* preserve the existing exception */ PyObject *err_type, *err_value, *err_tb; Modified: python/branches/py3k/Parser/asdl.py ============================================================================== --- python/branches/py3k/Parser/asdl.py (original) +++ python/branches/py3k/Parser/asdl.py Fri Jun 12 00:54:11 2009 @@ -20,7 +20,7 @@ sys.stdout.write(string + "\n") -class Token: +class Token(object): # spark seems to dispatch in the parser based on a token's # type attribute def __init__(self, type, lineno): @@ -221,20 +221,20 @@ def p_field_2(self, info): " field ::= Id * Id " type, _, name = info - return Field(type, name, seq=1) + return Field(type, name, seq=True) def p_field_3(self, info): " field ::= Id ? Id " type, _, name = info - return Field(type, name, opt=1) + return Field(type, name, opt=True) def p_field_4(self, type_): " field ::= Id * " - return Field(type_[0], seq=1) + return Field(type_[0], seq=True) def p_field_5(self, type_): " field ::= Id ? " - return Field(type[0], opt=1) + return Field(type[0], opt=True) builtin_types = ("identifier", "string", "int", "bool", "object") @@ -242,7 +242,7 @@ # not sure if any of the methods are useful yet, but I'm adding them # piecemeal as they seem helpful -class AST: +class AST(object): pass # a marker class class Module(AST): @@ -274,7 +274,7 @@ return "Constructor(%s, %s)" % (self.name, self.fields) class Field(AST): - def __init__(self, type, name=None, seq=0, opt=0): + def __init__(self, type, name=None, seq=False, opt=False): self.type = type self.name = name self.seq = seq @@ -282,9 +282,9 @@ def __repr__(self): if self.seq: - extra = ", seq=1" + extra = ", seq=True" elif self.opt: - extra = ", opt=1" + extra = ", opt=True" else: extra = "" if self.name is None: @@ -312,7 +312,7 @@ class VisitorBase(object): - def __init__(self, skip=0): + def __init__(self, skip=False): self.cache = {} self.skip = skip @@ -347,7 +347,7 @@ class Check(VisitorBase): def __init__(self): - super(Check, self).__init__(skip=1) + super(Check, self).__init__(skip=True) self.cons = {} self.errors = 0 self.types = {} Modified: python/branches/py3k/Parser/asdl_c.py ============================================================================== --- python/branches/py3k/Parser/asdl_c.py (original) +++ python/branches/py3k/Parser/asdl_c.py Fri Jun 12 00:54:11 2009 @@ -86,7 +86,7 @@ self.file = file super(EmitVisitor, self).__init__() - def emit(self, s, depth, reflow=1): + def emit(self, s, depth, reflow=True): # XXX reflow long lines? if reflow: lines = reflow_lines(s, depth) @@ -255,7 +255,7 @@ ctype = get_c_type(type) self.emit_function(cons.name, ctype, args, attrs) - def emit_function(self, name, ctype, args, attrs, union=1): + def emit_function(self, name, ctype, args, attrs, union=True): args = args + attrs if args: argstr = ", ".join(["%s %s" % (atype, aname) @@ -267,19 +267,19 @@ for i in range(1, len(args)+1): margs += ", a%d" % i self.emit("#define %s(%s) _Py_%s(%s)" % (name, margs, name, margs), 0, - reflow = 0) - self.emit("%s _Py_%s(%s);" % (ctype, name, argstr), 0) + reflow=False) + self.emit("%s _Py_%s(%s);" % (ctype, name, argstr), False) def visitProduct(self, prod, name): self.emit_function(name, get_c_type(name), - self.get_args(prod.fields), [], union=0) + self.get_args(prod.fields), [], union=False) class FunctionVisitor(PrototypeVisitor): """Visitor to generate constructor functions for AST.""" - def emit_function(self, name, ctype, args, attrs, union=1): - def emit(s, depth=0, reflow=1): + def emit_function(self, name, ctype, args, attrs, union=True): + def emit(s, depth=0, reflow=True): self.emit(s, depth, reflow) argstr = ", ".join(["%s %s" % (atype, aname) for atype, aname, opt in args + attrs]) @@ -297,7 +297,7 @@ emit("PyErr_SetString(PyExc_ValueError,", 2) msg = "field %s is required for %s" % (argname, name) emit(' "%s");' % msg, - 2, reflow=0) + 2, reflow=False) emit('return NULL;', 2) emit('}', 1) @@ -313,7 +313,7 @@ emit("") def emit_body_union(self, name, args, attrs): - def emit(s, depth=0, reflow=1): + def emit(s, depth=0, reflow=True): self.emit(s, depth, reflow) emit("p->kind = %s_kind;" % name, 1) for argtype, argname, opt in args: @@ -322,7 +322,7 @@ emit("p->%s = %s;" % (argname, argname), 1) def emit_body_struct(self, name, args, attrs): - def emit(s, depth=0, reflow=1): + def emit(s, depth=0, reflow=True): self.emit(s, depth, reflow) for argtype, argname, opt in args: emit("p->%s = %s;" % (argname, argname), 1) Modified: python/branches/py3k/Python/ast.c ============================================================================== --- python/branches/py3k/Python/ast.c (original) +++ python/branches/py3k/Python/ast.c Fri Jun 12 00:54:11 2009 @@ -2103,29 +2103,6 @@ expr1 = ast_for_testlist(c, ch); if (!expr1) return NULL; - /* TODO(nas): Remove duplicated error checks (set_context does it) */ - switch (expr1->kind) { - case GeneratorExp_kind: - ast_error(ch, "augmented assignment to generator " - "expression not possible"); - return NULL; - case Yield_kind: - ast_error(ch, "augmented assignment to yield " - "expression not possible"); - return NULL; - case Name_kind: { - if (forbidden_name(expr1, ch)) - return NULL; - break; - } - case Attribute_kind: - case Subscript_kind: - break; - default: - ast_error(ch, "illegal expression for augmented " - "assignment"); - return NULL; - } if(!set_context(c, expr1, Store, ch)) return NULL; @@ -3086,7 +3063,6 @@ n = CHILD(n, 0); } if (TYPE(n) == small_stmt) { - REQ(n, small_stmt); n = CHILD(n, 0); /* small_stmt: expr_stmt | del_stmt | pass_stmt | flow_stmt | import_stmt | global_stmt | nonlocal_stmt | assert_stmt From python-checkins at python.org Fri Jun 12 00:59:12 2009 From: python-checkins at python.org (benjamin.peterson) Date: Fri, 12 Jun 2009 00:59:12 +0200 (CEST) Subject: [Python-checkins] r73378 - python/branches/py3k Message-ID: <20090611225912.8CEB0C4EB@mail.python.org> Author: benjamin.peterson Date: Fri Jun 12 00:59:12 2009 New Revision: 73378 Log: Blocked revisions 73145 via svnmerge ........ r73145 | kristjan.jonsson | 2009-06-02 08:14:08 -0500 (Tue, 02 Jun 2009) | 2 lines http://bugs.python.org/issue6117 Fix O(n**2) performance problem in socket._fileobject ........ Modified: python/branches/py3k/ (props changed) From buildbot at python.org Fri Jun 12 01:00:13 2009 From: buildbot at python.org (buildbot at python.org) Date: Thu, 11 Jun 2009 23:00:13 +0000 Subject: [Python-checkins] buildbot failure in OS X x86 trunk Message-ID: <20090611230013.507DCC4F6@mail.python.org> The Buildbot has detected a new failure of OS X x86 trunk. Full details are available at: http://www.python.org/dev/buildbot/all/OS%20X%20x86%20trunk/builds/677 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: noller-osx86 Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: benjamin.peterson BUILD FAILED: failed test Excerpt from the test logfile: make: *** [buildbottest] Abort trap sincerely, -The Buildbot From python-checkins at python.org Fri Jun 12 01:06:21 2009 From: python-checkins at python.org (benjamin.peterson) Date: Fri, 12 Jun 2009 01:06:21 +0200 (CEST) Subject: [Python-checkins] r73379 - sandbox/trunk/2to3/lib2to3/fixes/fix_dict.py Message-ID: <20090611230621.5B30EDA39@mail.python.org> Author: benjamin.peterson Date: Fri Jun 12 01:06:21 2009 New Revision: 73379 Log: use a real conditional expresion Modified: sandbox/trunk/2to3/lib2to3/fixes/fix_dict.py Modified: sandbox/trunk/2to3/lib2to3/fixes/fix_dict.py ============================================================================== --- sandbox/trunk/2to3/lib2to3/fixes/fix_dict.py (original) +++ sandbox/trunk/2to3/lib2to3/fixes/fix_dict.py Fri Jun 12 01:06:21 2009 @@ -66,7 +66,7 @@ new = pytree.Node(syms.power, args) if not special: new.prefix = u"" - new = Call(Name(isiter and u"iter" or u"list"), [new]) + new = Call(u"iter" if isiter else u"list"), [new]) if tail: new = pytree.Node(syms.power, [new] + tail) new.prefix = node.prefix From python-checkins at python.org Fri Jun 12 01:12:14 2009 From: python-checkins at python.org (raymond.hettinger) Date: Fri, 12 Jun 2009 01:12:14 +0200 (CEST) Subject: [Python-checkins] r73380 - in python/branches/py3k: Doc/library/random.rst Lib/random.py Message-ID: <20090611231214.9BBEDC539@mail.python.org> Author: raymond.hettinger Date: Fri Jun 12 01:12:14 2009 New Revision: 73380 Log: Issue 6261: Clarify behavior of random.uniform(). Modified: python/branches/py3k/Doc/library/random.rst python/branches/py3k/Lib/random.py Modified: python/branches/py3k/Doc/library/random.rst ============================================================================== --- python/branches/py3k/Doc/library/random.rst (original) +++ python/branches/py3k/Doc/library/random.rst Fri Jun 12 01:12:14 2009 @@ -142,6 +142,8 @@ Return a random floating point number *N* such that ``a <= N <= b`` for ``a <= b`` and ``b <= N <= a`` for ``b < a``. + The end-point value ``b`` may or may not be included in the range + depending on floating-point rounding in the equation ``a + (b-a) * random()``. .. function:: triangular(low, high, mode) Modified: python/branches/py3k/Lib/random.py ============================================================================== --- python/branches/py3k/Lib/random.py (original) +++ python/branches/py3k/Lib/random.py Fri Jun 12 01:12:14 2009 @@ -333,7 +333,7 @@ ## -------------------- uniform distribution ------------------- def uniform(self, a, b): - """Get a random number in the range [a, b).""" + "Get a random number in the range [a, b) or [a, b] depending on rounding." return a + (b-a) * self.random() ## -------------------- triangular -------------------- From python-checkins at python.org Fri Jun 12 01:14:13 2009 From: python-checkins at python.org (raymond.hettinger) Date: Fri, 12 Jun 2009 01:14:13 +0200 (CEST) Subject: [Python-checkins] r73381 - in python/branches/release30-maint: Doc/library/random.rst Lib/random.py Message-ID: <20090611231413.1828CD63E@mail.python.org> Author: raymond.hettinger Date: Fri Jun 12 01:14:12 2009 New Revision: 73381 Log: Issue 6261: Clarify behavior of random.uniform(). Modified: python/branches/release30-maint/Doc/library/random.rst python/branches/release30-maint/Lib/random.py Modified: python/branches/release30-maint/Doc/library/random.rst ============================================================================== --- python/branches/release30-maint/Doc/library/random.rst (original) +++ python/branches/release30-maint/Doc/library/random.rst Fri Jun 12 01:14:12 2009 @@ -142,6 +142,8 @@ Return a random floating point number *N* such that ``a <= N <= b`` for ``a <= b`` and ``b <= N <= a`` for ``b < a``. + The end-point value ``b`` may or may not be included in the range + depending on floating-point rounding in the equation ``a + (b-a) * random()``. .. function:: triangular(low, high, mode) Modified: python/branches/release30-maint/Lib/random.py ============================================================================== --- python/branches/release30-maint/Lib/random.py (original) +++ python/branches/release30-maint/Lib/random.py Fri Jun 12 01:14:12 2009 @@ -333,7 +333,7 @@ ## -------------------- uniform distribution ------------------- def uniform(self, a, b): - """Get a random number in the range [a, b).""" + "Get a random number in the range [a, b) or [a, b] depending on rounding." return a + (b-a) * self.random() ## -------------------- triangular -------------------- From python-checkins at python.org Fri Jun 12 01:14:53 2009 From: python-checkins at python.org (raymond.hettinger) Date: Fri, 12 Jun 2009 01:14:53 +0200 (CEST) Subject: [Python-checkins] r73382 - in python/trunk: Doc/library/random.rst Lib/random.py Message-ID: <20090611231453.53369D2AA@mail.python.org> Author: raymond.hettinger Date: Fri Jun 12 01:14:53 2009 New Revision: 73382 Log: Issue 6261: Clarify behavior of random.uniform(). Modified: python/trunk/Doc/library/random.rst python/trunk/Lib/random.py Modified: python/trunk/Doc/library/random.rst ============================================================================== --- python/trunk/Doc/library/random.rst (original) +++ python/trunk/Doc/library/random.rst Fri Jun 12 01:14:53 2009 @@ -191,6 +191,8 @@ Return a random floating point number *N* such that ``a <= N <= b`` for ``a <= b`` and ``b <= N <= a`` for ``b < a``. + The end-point value ``b`` may or may not be included in the range + depending on floating-point rounding in the equation ``a + (b-a) * random()``. .. function:: triangular(low, high, mode) Modified: python/trunk/Lib/random.py ============================================================================== --- python/trunk/Lib/random.py (original) +++ python/trunk/Lib/random.py Fri Jun 12 01:14:53 2009 @@ -349,7 +349,7 @@ ## -------------------- uniform distribution ------------------- def uniform(self, a, b): - """Get a random number in the range [a, b).""" + "Get a random number in the range [a, b) or [a, b] depending on rounding." return a + (b-a) * self.random() ## -------------------- triangular -------------------- From python-checkins at python.org Fri Jun 12 01:18:54 2009 From: python-checkins at python.org (raymond.hettinger) Date: Fri, 12 Jun 2009 01:18:54 +0200 (CEST) Subject: [Python-checkins] r73383 - in python/branches/release26-maint: Doc/library/random.rst Lib/random.py Message-ID: <20090611231854.A4499D578@mail.python.org> Author: raymond.hettinger Date: Fri Jun 12 01:18:54 2009 New Revision: 73383 Log: Issue 6261: Clarify behavior of random.uniform(). Modified: python/branches/release26-maint/Doc/library/random.rst python/branches/release26-maint/Lib/random.py Modified: python/branches/release26-maint/Doc/library/random.rst ============================================================================== --- python/branches/release26-maint/Doc/library/random.rst (original) +++ python/branches/release26-maint/Doc/library/random.rst Fri Jun 12 01:18:54 2009 @@ -191,6 +191,8 @@ Return a random floating point number *N* such that ``a <= N <= b`` for ``a <= b`` and ``b <= N <= a`` for ``b < a``. + The end-point value ``b`` may or may not be included in the range + depending on floating-point rounding in the equation ``a + (b-a) * random()``. .. function:: triangular(low, high, mode) Modified: python/branches/release26-maint/Lib/random.py ============================================================================== --- python/branches/release26-maint/Lib/random.py (original) +++ python/branches/release26-maint/Lib/random.py Fri Jun 12 01:18:54 2009 @@ -349,7 +349,7 @@ ## -------------------- uniform distribution ------------------- def uniform(self, a, b): - """Get a random number in the range [a, b).""" + "Get a random number in the range [a, b) or [a, b] depending on rounding." return a + (b-a) * self.random() ## -------------------- triangular -------------------- From python-checkins at python.org Fri Jun 12 01:47:38 2009 From: python-checkins at python.org (benjamin.peterson) Date: Fri, 12 Jun 2009 01:47:38 +0200 (CEST) Subject: [Python-checkins] r73384 - in python/branches/py3k: Lib/lib2to3/Grammar.txt Lib/lib2to3/fixer_base.py Lib/lib2to3/fixer_util.py Lib/lib2to3/fixes/fix_apply.py Lib/lib2to3/fixes/fix_basestring.py Lib/lib2to3/fixes/fix_buffer.py Lib/lib2to3/fixes/fix_callable.py Lib/lib2to3/fixes/fix_dict.py Lib/lib2to3/fixes/fix_except.py Lib/lib2to3/fixes/fix_exec.py Lib/lib2to3/fixes/fix_execfile.py Lib/lib2to3/fixes/fix_filter.py Lib/lib2to3/fixes/fix_funcattrs.py Lib/lib2to3/fixes/fix_future.py Lib/lib2to3/fixes/fix_getcwdu.py Lib/lib2to3/fixes/fix_has_key.py Lib/lib2to3/fixes/fix_idioms.py Lib/lib2to3/fixes/fix_import.py Lib/lib2to3/fixes/fix_imports.py Lib/lib2to3/fixes/fix_input.py Lib/lib2to3/fixes/fix_intern.py Lib/lib2to3/fixes/fix_isinstance.py Lib/lib2to3/fixes/fix_itertools.py Lib/lib2to3/fixes/fix_itertools_imports.py Lib/lib2to3/fixes/fix_long.py Lib/lib2to3/fixes/fix_map.py Lib/lib2to3/fixes/fix_metaclass.py Lib/lib2to3/fixes/fix_methodattrs.py Lib/lib2to3/fixes/fix_ne.py Lib/lib2to3/fixes/fix_next.py Lib/lib2to3/fixes/fix_nonzero.py Lib/lib2to3/fixes/fix_numliterals.py Lib/lib2to3/fixes/fix_paren.py Lib/lib2to3/fixes/fix_print.py Lib/lib2to3/fixes/fix_raise.py Lib/lib2to3/fixes/fix_raw_input.py Lib/lib2to3/fixes/fix_reduce.py Lib/lib2to3/fixes/fix_renames.py Lib/lib2to3/fixes/fix_repr.py Lib/lib2to3/fixes/fix_set_literal.py Lib/lib2to3/fixes/fix_standarderror.py Lib/lib2to3/fixes/fix_sys_exc.py Lib/lib2to3/fixes/fix_throw.py Lib/lib2to3/fixes/fix_tuple_params.py Lib/lib2to3/fixes/fix_types.py Lib/lib2to3/fixes/fix_unicode.py Lib/lib2to3/fixes/fix_urllib.py Lib/lib2to3/fixes/fix_ws_comma.py Lib/lib2to3/fixes/fix_xrange.py Lib/lib2to3/fixes/fix_xreadlines.py Lib/lib2to3/fixes/fix_zip.py Lib/lib2to3/patcomp.py Lib/lib2to3/pytree.py Lib/lib2to3/refactor.py Lib/lib2to3/tests/data/README Lib/lib2to3/tests/data/different_encoding.py Lib/lib2to3/tests/data/fixers/myfixes/fix_parrot.py Lib/lib2to3/tests/data/py2_test_grammar.py Lib/lib2to3/tests/data/py3_test_grammar.py Lib/lib2to3/tests/pytree_idempotency.py Lib/lib2to3/tests/support.py Lib/lib2to3/tests/test_all_fixers.py Lib/lib2to3/tests/test_fixers.py Lib/lib2to3/tests/test_parser.py Lib/lib2to3/tests/test_pytree.py Lib/lib2to3/tests/test_util.py Message-ID: <20090611234738.A730AC47F@mail.python.org> Author: benjamin.peterson Date: Fri Jun 12 01:47:38 2009 New Revision: 73384 Log: Merged revisions 73370 via svnmerge from svn+ssh://pythondev at svn.python.org/python/trunk ................ r73370 | benjamin.peterson | 2009-06-11 17:06:46 -0500 (Thu, 11 Jun 2009) | 105 lines Merged revisions 72523,72950-72951,72994,73003,73033,73036-73040,73091-73093,73096,73179-73181,73192,73231,73244,73255-73256,73365 via svnmerge from svn+ssh://pythondev at svn.python.org/sandbox/trunk/2to3/lib2to3 ........ r72523 | benjamin.peterson | 2009-05-09 14:42:26 -0500 (Sat, 09 May 2009) | 1 line remove parenthesis ........ r72950 | benjamin.peterson | 2009-05-26 18:19:45 -0500 (Tue, 26 May 2009) | 1 line remove unused imports ........ r72951 | benjamin.peterson | 2009-05-26 18:27:00 -0500 (Tue, 26 May 2009) | 1 line this is no longer executable ........ r72994 | benjamin.peterson | 2009-05-28 15:32:54 -0500 (Thu, 28 May 2009) | 1 line fix test_all_fixers on Windows #6134 ........ r73003 | benjamin.peterson | 2009-05-28 21:57:28 -0500 (Thu, 28 May 2009) | 4 lines make 2to3 test utilities easier to use with other applications (3to2) Patch by Joe Amenta ........ r73033 | benjamin.peterson | 2009-05-29 16:58:32 -0500 (Fri, 29 May 2009) | 1 line update grammar for multi with statement ........ r73036 | benjamin.peterson | 2009-05-29 17:33:20 -0500 (Fri, 29 May 2009) | 1 line simplify fix_unicode ........ r73037 | benjamin.peterson | 2009-05-29 17:53:03 -0500 (Fri, 29 May 2009) | 1 line add custom error for pattern syntax errors ........ r73038 | benjamin.peterson | 2009-05-29 17:55:00 -0500 (Fri, 29 May 2009) | 1 line complain if details are attached to a token ........ r73039 | benjamin.peterson | 2009-05-29 18:00:28 -0500 (Fri, 29 May 2009) | 1 line add a test for whitespace ........ r73040 | benjamin.peterson | 2009-05-29 18:01:17 -0500 (Fri, 29 May 2009) | 1 line a fix for emacs highlighting ........ r73091 | benjamin.peterson | 2009-05-31 20:55:25 -0500 (Sun, 31 May 2009) | 1 line deprecate set_prefix() and get_prefix() in favor of a prefix property ........ r73092 | benjamin.peterson | 2009-05-31 21:00:51 -0500 (Sun, 31 May 2009) | 1 line change hideous java naming scheme ........ r73093 | benjamin.peterson | 2009-05-31 21:01:39 -0500 (Sun, 31 May 2009) | 1 line remove dated comment ........ r73096 | benjamin.peterson | 2009-05-31 21:40:53 -0500 (Sun, 31 May 2009) | 1 line group tests ........ r73179 | benjamin.peterson | 2009-06-03 13:09:53 -0500 (Wed, 03 Jun 2009) | 1 line handle the case where there's multiple trailers #6185 ........ r73180 | benjamin.peterson | 2009-06-03 13:18:05 -0500 (Wed, 03 Jun 2009) | 1 line scrap __main__ section ........ r73181 | benjamin.peterson | 2009-06-03 13:24:48 -0500 (Wed, 03 Jun 2009) | 1 line remove shebang lines and __main__ sections ........ r73192 | benjamin.peterson | 2009-06-03 19:16:30 -0500 (Wed, 03 Jun 2009) | 4 lines actually test something here Thanks to Joe Amenta for noticing.y ........ r73231 | benjamin.peterson | 2009-06-04 13:38:50 -0500 (Thu, 04 Jun 2009) | 1 line remove unused variable ........ r73244 | benjamin.peterson | 2009-06-05 08:39:25 -0500 (Fri, 05 Jun 2009) | 1 line allow fixers to give different options in setUp ........ r73255 | benjamin.peterson | 2009-06-06 11:23:46 -0500 (Sat, 06 Jun 2009) | 1 line fix the except fixer on one line suites #6222 ........ r73256 | benjamin.peterson | 2009-06-06 11:27:40 -0500 (Sat, 06 Jun 2009) | 1 line test one-line else and finally clauses ........ r73365 | benjamin.peterson | 2009-06-11 17:01:32 -0500 (Thu, 11 Jun 2009) | 1 line normalize whitespace ........ ................ Modified: python/branches/py3k/ (props changed) python/branches/py3k/Lib/lib2to3/Grammar.txt python/branches/py3k/Lib/lib2to3/fixer_base.py python/branches/py3k/Lib/lib2to3/fixer_util.py python/branches/py3k/Lib/lib2to3/fixes/fix_apply.py python/branches/py3k/Lib/lib2to3/fixes/fix_basestring.py python/branches/py3k/Lib/lib2to3/fixes/fix_buffer.py python/branches/py3k/Lib/lib2to3/fixes/fix_callable.py python/branches/py3k/Lib/lib2to3/fixes/fix_dict.py python/branches/py3k/Lib/lib2to3/fixes/fix_except.py python/branches/py3k/Lib/lib2to3/fixes/fix_exec.py python/branches/py3k/Lib/lib2to3/fixes/fix_execfile.py python/branches/py3k/Lib/lib2to3/fixes/fix_filter.py python/branches/py3k/Lib/lib2to3/fixes/fix_funcattrs.py python/branches/py3k/Lib/lib2to3/fixes/fix_future.py python/branches/py3k/Lib/lib2to3/fixes/fix_getcwdu.py python/branches/py3k/Lib/lib2to3/fixes/fix_has_key.py python/branches/py3k/Lib/lib2to3/fixes/fix_idioms.py python/branches/py3k/Lib/lib2to3/fixes/fix_import.py python/branches/py3k/Lib/lib2to3/fixes/fix_imports.py python/branches/py3k/Lib/lib2to3/fixes/fix_input.py python/branches/py3k/Lib/lib2to3/fixes/fix_intern.py python/branches/py3k/Lib/lib2to3/fixes/fix_isinstance.py (contents, props changed) python/branches/py3k/Lib/lib2to3/fixes/fix_itertools.py python/branches/py3k/Lib/lib2to3/fixes/fix_itertools_imports.py python/branches/py3k/Lib/lib2to3/fixes/fix_long.py python/branches/py3k/Lib/lib2to3/fixes/fix_map.py python/branches/py3k/Lib/lib2to3/fixes/fix_metaclass.py python/branches/py3k/Lib/lib2to3/fixes/fix_methodattrs.py python/branches/py3k/Lib/lib2to3/fixes/fix_ne.py python/branches/py3k/Lib/lib2to3/fixes/fix_next.py python/branches/py3k/Lib/lib2to3/fixes/fix_nonzero.py python/branches/py3k/Lib/lib2to3/fixes/fix_numliterals.py python/branches/py3k/Lib/lib2to3/fixes/fix_paren.py python/branches/py3k/Lib/lib2to3/fixes/fix_print.py python/branches/py3k/Lib/lib2to3/fixes/fix_raise.py python/branches/py3k/Lib/lib2to3/fixes/fix_raw_input.py python/branches/py3k/Lib/lib2to3/fixes/fix_reduce.py (props changed) python/branches/py3k/Lib/lib2to3/fixes/fix_renames.py python/branches/py3k/Lib/lib2to3/fixes/fix_repr.py python/branches/py3k/Lib/lib2to3/fixes/fix_set_literal.py python/branches/py3k/Lib/lib2to3/fixes/fix_standarderror.py python/branches/py3k/Lib/lib2to3/fixes/fix_sys_exc.py python/branches/py3k/Lib/lib2to3/fixes/fix_throw.py python/branches/py3k/Lib/lib2to3/fixes/fix_tuple_params.py python/branches/py3k/Lib/lib2to3/fixes/fix_types.py python/branches/py3k/Lib/lib2to3/fixes/fix_unicode.py python/branches/py3k/Lib/lib2to3/fixes/fix_urllib.py python/branches/py3k/Lib/lib2to3/fixes/fix_ws_comma.py python/branches/py3k/Lib/lib2to3/fixes/fix_xrange.py python/branches/py3k/Lib/lib2to3/fixes/fix_xreadlines.py python/branches/py3k/Lib/lib2to3/fixes/fix_zip.py python/branches/py3k/Lib/lib2to3/patcomp.py python/branches/py3k/Lib/lib2to3/pytree.py python/branches/py3k/Lib/lib2to3/refactor.py python/branches/py3k/Lib/lib2to3/tests/data/README (props changed) python/branches/py3k/Lib/lib2to3/tests/data/different_encoding.py python/branches/py3k/Lib/lib2to3/tests/data/fixers/myfixes/fix_parrot.py python/branches/py3k/Lib/lib2to3/tests/data/py2_test_grammar.py python/branches/py3k/Lib/lib2to3/tests/data/py3_test_grammar.py python/branches/py3k/Lib/lib2to3/tests/pytree_idempotency.py python/branches/py3k/Lib/lib2to3/tests/support.py python/branches/py3k/Lib/lib2to3/tests/test_all_fixers.py python/branches/py3k/Lib/lib2to3/tests/test_fixers.py python/branches/py3k/Lib/lib2to3/tests/test_parser.py python/branches/py3k/Lib/lib2to3/tests/test_pytree.py python/branches/py3k/Lib/lib2to3/tests/test_util.py Modified: python/branches/py3k/Lib/lib2to3/Grammar.txt ============================================================================== --- python/branches/py3k/Lib/lib2to3/Grammar.txt (original) +++ python/branches/py3k/Lib/lib2to3/Grammar.txt Fri Jun 12 01:47:38 2009 @@ -90,7 +90,8 @@ ['else' ':' suite] ['finally' ':' suite] | 'finally' ':' suite)) -with_stmt: 'with' test [ with_var ] ':' suite +with_stmt: 'with' with_item (',' with_item)* ':' suite +with_item: test ['as' expr] with_var: 'as' expr # NB compile.c makes sure that the default except clause is last except_clause: 'except' [test [(',' | 'as') test]] Modified: python/branches/py3k/Lib/lib2to3/fixer_base.py ============================================================================== --- python/branches/py3k/Lib/lib2to3/fixer_base.py (original) +++ python/branches/py3k/Lib/lib2to3/fixer_base.py Fri Jun 12 01:47:38 2009 @@ -120,7 +120,7 @@ """ lineno = node.get_lineno() for_output = node.clone() - for_output.set_prefix("") + for_output.prefix = "" msg = "Line %d: could not convert: %s" self.log_message(msg % (lineno, for_output)) if reason: Modified: python/branches/py3k/Lib/lib2to3/fixer_util.py ============================================================================== --- python/branches/py3k/Lib/lib2to3/fixer_util.py (original) +++ python/branches/py3k/Lib/lib2to3/fixer_util.py Fri Jun 12 01:47:38 2009 @@ -27,7 +27,7 @@ if not isinstance(target, list): target = [target] if not isinstance(source, list): - source.set_prefix(" ") + source.prefix = " " source = [source] return Node(syms.atom, @@ -60,7 +60,7 @@ """A function call""" node = Node(syms.power, [func_name, ArgList(args)]) if prefix is not None: - node.set_prefix(prefix) + node.prefix = prefix return node def Newline(): @@ -89,18 +89,18 @@ If test is None, the "if test" part is omitted. """ - xp.set_prefix("") - fp.set_prefix(" ") - it.set_prefix(" ") + xp.prefix = "" + fp.prefix = " " + it.prefix = " " for_leaf = Leaf(token.NAME, "for") - for_leaf.set_prefix(" ") + for_leaf.prefix = " " in_leaf = Leaf(token.NAME, "in") - in_leaf.set_prefix(" ") + in_leaf.prefix = " " inner_args = [for_leaf, fp, in_leaf, it] if test: - test.set_prefix(" ") + test.prefix = " " if_leaf = Leaf(token.NAME, "if") - if_leaf.set_prefix(" ") + if_leaf.prefix = " " inner_args.append(Node(syms.comp_if, [if_leaf, test])) inner = Node(syms.listmaker, [xp, Node(syms.comp_for, inner_args)]) return Node(syms.atom, Modified: python/branches/py3k/Lib/lib2to3/fixes/fix_apply.py ============================================================================== --- python/branches/py3k/Lib/lib2to3/fixes/fix_apply.py (original) +++ python/branches/py3k/Lib/lib2to3/fixes/fix_apply.py Fri Jun 12 01:47:38 2009 @@ -33,25 +33,25 @@ func = results["func"] args = results["args"] kwds = results.get("kwds") - prefix = node.get_prefix() + prefix = node.prefix func = func.clone() if (func.type not in (token.NAME, syms.atom) and (func.type != syms.power or func.children[-2].type == token.DOUBLESTAR)): # Need to parenthesize func = parenthesize(func) - func.set_prefix("") + func.prefix = "" args = args.clone() - args.set_prefix("") + args.prefix = "" if kwds is not None: kwds = kwds.clone() - kwds.set_prefix("") + kwds.prefix = "" l_newargs = [pytree.Leaf(token.STAR, "*"), args] if kwds is not None: l_newargs.extend([Comma(), pytree.Leaf(token.DOUBLESTAR, "**"), kwds]) - l_newargs[-2].set_prefix(" ") # that's the ** token + l_newargs[-2].prefix = " " # that's the ** token # XXX Sometimes we could be cleverer, e.g. apply(f, (x, y) + t) # can be translated into f(x, y, *t) instead of f(*(x, y) + t) #new = pytree.Node(syms.power, (func, ArgList(l_newargs))) Modified: python/branches/py3k/Lib/lib2to3/fixes/fix_basestring.py ============================================================================== --- python/branches/py3k/Lib/lib2to3/fixes/fix_basestring.py (original) +++ python/branches/py3k/Lib/lib2to3/fixes/fix_basestring.py Fri Jun 12 01:47:38 2009 @@ -10,4 +10,4 @@ PATTERN = "'basestring'" def transform(self, node, results): - return Name("str", prefix=node.get_prefix()) + return Name("str", prefix=node.prefix) Modified: python/branches/py3k/Lib/lib2to3/fixes/fix_buffer.py ============================================================================== --- python/branches/py3k/Lib/lib2to3/fixes/fix_buffer.py (original) +++ python/branches/py3k/Lib/lib2to3/fixes/fix_buffer.py Fri Jun 12 01:47:38 2009 @@ -13,9 +13,9 @@ explicit = True # The user must ask for this fixer PATTERN = """ - power< name='buffer' trailer< '(' [any] ')' > > + power< name='buffer' trailer< '(' [any] ')' > any* > """ def transform(self, node, results): name = results["name"] - name.replace(Name("memoryview", prefix=name.get_prefix())) + name.replace(Name("memoryview", prefix=name.prefix)) Modified: python/branches/py3k/Lib/lib2to3/fixes/fix_callable.py ============================================================================== --- python/branches/py3k/Lib/lib2to3/fixes/fix_callable.py (original) +++ python/branches/py3k/Lib/lib2to3/fixes/fix_callable.py Fri Jun 12 01:47:38 2009 @@ -28,4 +28,4 @@ func = results["func"] args = [func.clone(), String(', '), String("'__call__'")] - return Call(Name("hasattr"), args, prefix=node.get_prefix()) + return Call(Name("hasattr"), args, prefix=node.prefix) Modified: python/branches/py3k/Lib/lib2to3/fixes/fix_dict.py ============================================================================== --- python/branches/py3k/Lib/lib2to3/fixes/fix_dict.py (original) +++ python/branches/py3k/Lib/lib2to3/fixes/fix_dict.py Fri Jun 12 01:47:38 2009 @@ -61,15 +61,15 @@ args = head + [pytree.Node(syms.trailer, [Dot(), Name(method_name, - prefix=method.get_prefix())]), + prefix=method.prefix)]), results["parens"].clone()] new = pytree.Node(syms.power, args) if not special: - new.set_prefix("") + new.prefix = "" new = Call(Name(isiter and "iter" or "list"), [new]) if tail: new = pytree.Node(syms.power, [new] + tail) - new.set_prefix(node.get_prefix()) + new.prefix = node.prefix return new P1 = "power< func=NAME trailer< '(' node=any ')' > any* >" Modified: python/branches/py3k/Lib/lib2to3/fixes/fix_except.py ============================================================================== --- python/branches/py3k/Lib/lib2to3/fixes/fix_except.py (original) +++ python/branches/py3k/Lib/lib2to3/fixes/fix_except.py Fri Jun 12 01:47:38 2009 @@ -36,11 +36,11 @@ class FixExcept(fixer_base.BaseFix): PATTERN = """ - try_stmt< 'try' ':' suite - cleanup=(except_clause ':' suite)+ - tail=(['except' ':' suite] - ['else' ':' suite] - ['finally' ':' suite]) > + try_stmt< 'try' ':' (simple_stmt | suite) + cleanup=(except_clause ':' (simple_stmt | suite))+ + tail=(['except' ':' (simple_stmt | suite)] + ['else' ':' (simple_stmt | suite)] + ['finally' ':' (simple_stmt | suite)]) > """ def transform(self, node, results): @@ -58,7 +58,7 @@ # Generate a new N for the except clause new_N = Name(self.new_name(), prefix=" ") target = N.clone() - target.set_prefix("") + target.prefix = "" N.replace(new_N) new_N = new_N.clone() @@ -82,10 +82,10 @@ for child in reversed(suite_stmts[:i]): e_suite.insert_child(0, child) e_suite.insert_child(i, assign) - elif N.get_prefix() == "": + elif N.prefix == "": # No space after a comma is legal; no space after "as", # not so much. - N.set_prefix(" ") + N.prefix = " " #TODO(cwinter) fix this when children becomes a smart list children = [c.clone() for c in node.children[:3]] + try_cleanup + tail Modified: python/branches/py3k/Lib/lib2to3/fixes/fix_exec.py ============================================================================== --- python/branches/py3k/Lib/lib2to3/fixes/fix_exec.py (original) +++ python/branches/py3k/Lib/lib2to3/fixes/fix_exec.py Fri Jun 12 01:47:38 2009 @@ -30,10 +30,10 @@ b = results.get("b") c = results.get("c") args = [a.clone()] - args[0].set_prefix("") + args[0].prefix = "" if b is not None: args.extend([Comma(), b.clone()]) if c is not None: args.extend([Comma(), c.clone()]) - return Call(Name("exec"), args, prefix=node.get_prefix()) + return Call(Name("exec"), args, prefix=node.prefix) Modified: python/branches/py3k/Lib/lib2to3/fixes/fix_execfile.py ============================================================================== --- python/branches/py3k/Lib/lib2to3/fixes/fix_execfile.py (original) +++ python/branches/py3k/Lib/lib2to3/fixes/fix_execfile.py Fri Jun 12 01:47:38 2009 @@ -38,7 +38,7 @@ # Wrap the open call in a compile call. This is so the filename will be # preserved in the execed code. filename_arg = filename.clone() - filename_arg.set_prefix(" ") + filename_arg.prefix = " " exec_str = String("'exec'", " ") compile_args = open_expr + [Comma(), filename_arg, Comma(), exec_str] compile_call = Call(Name("compile"), compile_args, "") @@ -48,4 +48,4 @@ args.extend([Comma(), globals.clone()]) if locals is not None: args.extend([Comma(), locals.clone()]) - return Call(Name("exec"), args, prefix=node.get_prefix()) + return Call(Name("exec"), args, prefix=node.prefix) Modified: python/branches/py3k/Lib/lib2to3/fixes/fix_filter.py ============================================================================== --- python/branches/py3k/Lib/lib2to3/fixes/fix_filter.py (original) +++ python/branches/py3k/Lib/lib2to3/fixes/fix_filter.py Fri Jun 12 01:47:38 2009 @@ -69,7 +69,7 @@ if in_special_context(node): return None new = node.clone() - new.set_prefix("") + new.prefix = "" new = Call(Name("list"), [new]) - new.set_prefix(node.get_prefix()) + new.prefix = node.prefix return new Modified: python/branches/py3k/Lib/lib2to3/fixes/fix_funcattrs.py ============================================================================== --- python/branches/py3k/Lib/lib2to3/fixes/fix_funcattrs.py (original) +++ python/branches/py3k/Lib/lib2to3/fixes/fix_funcattrs.py Fri Jun 12 01:47:38 2009 @@ -16,4 +16,4 @@ def transform(self, node, results): attr = results["attr"][0] attr.replace(Name(("__%s__" % attr.value[5:]), - prefix=attr.get_prefix())) + prefix=attr.prefix)) Modified: python/branches/py3k/Lib/lib2to3/fixes/fix_future.py ============================================================================== --- python/branches/py3k/Lib/lib2to3/fixes/fix_future.py (original) +++ python/branches/py3k/Lib/lib2to3/fixes/fix_future.py Fri Jun 12 01:47:38 2009 @@ -16,5 +16,5 @@ def transform(self, node, results): new = BlankLine() - new.prefix = node.get_prefix() + new.prefix = node.prefix return new Modified: python/branches/py3k/Lib/lib2to3/fixes/fix_getcwdu.py ============================================================================== --- python/branches/py3k/Lib/lib2to3/fixes/fix_getcwdu.py (original) +++ python/branches/py3k/Lib/lib2to3/fixes/fix_getcwdu.py Fri Jun 12 01:47:38 2009 @@ -15,4 +15,4 @@ def transform(self, node, results): name = results["name"] - name.replace(Name("getcwd", prefix=name.get_prefix())) + name.replace(Name("getcwd", prefix=name.prefix)) Modified: python/branches/py3k/Lib/lib2to3/fixes/fix_has_key.py ============================================================================== --- python/branches/py3k/Lib/lib2to3/fixes/fix_has_key.py (original) +++ python/branches/py3k/Lib/lib2to3/fixes/fix_has_key.py Fri Jun 12 01:47:38 2009 @@ -78,7 +78,7 @@ return None negation = results.get("negation") anchor = results["anchor"] - prefix = node.get_prefix() + prefix = node.prefix before = [n.clone() for n in results["before"]] arg = results["arg"].clone() after = results.get("after") @@ -91,7 +91,7 @@ before = before[0] else: before = pytree.Node(syms.power, before) - before.set_prefix(" ") + before.prefix = " " n_op = Name("in", prefix=" ") if negation: n_not = Name("not", prefix=" ") @@ -105,5 +105,5 @@ syms.arith_expr, syms.term, syms.factor, syms.power): new = parenthesize(new) - new.set_prefix(prefix) + new.prefix = prefix return new Modified: python/branches/py3k/Lib/lib2to3/fixes/fix_idioms.py ============================================================================== --- python/branches/py3k/Lib/lib2to3/fixes/fix_idioms.py (original) +++ python/branches/py3k/Lib/lib2to3/fixes/fix_idioms.py Fri Jun 12 01:47:38 2009 @@ -101,18 +101,18 @@ def transform_isinstance(self, node, results): x = results["x"].clone() # The thing inside of type() T = results["T"].clone() # The type being compared against - x.set_prefix("") - T.set_prefix(" ") + x.prefix = "" + T.prefix = " " test = Call(Name("isinstance"), [x, Comma(), T]) if "n" in results: - test.set_prefix(" ") + test.prefix = " " test = Node(syms.not_test, [Name("not"), test]) - test.set_prefix(node.get_prefix()) + test.prefix = node.prefix return test def transform_while(self, node, results): one = results["while"] - one.replace(Name("True", prefix=one.get_prefix())) + one.replace(Name("True", prefix=one.prefix)) def transform_sort(self, node, results): sort_stmt = results["sort"] @@ -121,14 +121,14 @@ simple_expr = results.get("expr") if list_call: - list_call.replace(Name("sorted", prefix=list_call.get_prefix())) + list_call.replace(Name("sorted", prefix=list_call.prefix)) elif simple_expr: new = simple_expr.clone() - new.set_prefix("") + new.prefix = "" simple_expr.replace(Call(Name("sorted"), [new], - prefix=simple_expr.get_prefix())) + prefix=simple_expr.prefix)) else: raise RuntimeError("should not have reached here") sort_stmt.remove() if next_stmt: - next_stmt[0].set_prefix(sort_stmt.get_prefix()) + next_stmt[0].prefix = sort_stmt.prefix Modified: python/branches/py3k/Lib/lib2to3/fixes/fix_import.py ============================================================================== --- python/branches/py3k/Lib/lib2to3/fixes/fix_import.py (original) +++ python/branches/py3k/Lib/lib2to3/fixes/fix_import.py Fri Jun 12 01:47:38 2009 @@ -73,7 +73,7 @@ return new = FromImport('.', [imp]) - new.set_prefix(node.get_prefix()) + new.prefix = node.prefix return new def probably_a_local_import(self, imp_name): Modified: python/branches/py3k/Lib/lib2to3/fixes/fix_imports.py ============================================================================== --- python/branches/py3k/Lib/lib2to3/fixes/fix_imports.py (original) +++ python/branches/py3k/Lib/lib2to3/fixes/fix_imports.py Fri Jun 12 01:47:38 2009 @@ -124,7 +124,7 @@ if import_mod: mod_name = import_mod.value new_name = self.mapping[mod_name] - import_mod.replace(Name(new_name, prefix=import_mod.get_prefix())) + import_mod.replace(Name(new_name, prefix=import_mod.prefix)) if "name_import" in results: # If it's not a "from x import x, y" or "import x as y" import, # marked its usage to be replaced. @@ -142,4 +142,4 @@ bare_name = results["bare_with_attr"][0] new_name = self.replace.get(bare_name.value) if new_name: - bare_name.replace(Name(new_name, prefix=bare_name.get_prefix())) + bare_name.replace(Name(new_name, prefix=bare_name.prefix)) Modified: python/branches/py3k/Lib/lib2to3/fixes/fix_input.py ============================================================================== --- python/branches/py3k/Lib/lib2to3/fixes/fix_input.py (original) +++ python/branches/py3k/Lib/lib2to3/fixes/fix_input.py Fri Jun 12 01:47:38 2009 @@ -22,5 +22,5 @@ return new = node.clone() - new.set_prefix("") - return Call(Name("eval"), [new], prefix=node.get_prefix()) + new.prefix = "" + return Call(Name("eval"), [new], prefix=node.prefix) Modified: python/branches/py3k/Lib/lib2to3/fixes/fix_intern.py ============================================================================== --- python/branches/py3k/Lib/lib2to3/fixes/fix_intern.py (original) +++ python/branches/py3k/Lib/lib2to3/fixes/fix_intern.py Fri Jun 12 01:47:38 2009 @@ -39,6 +39,6 @@ [results["lpar"].clone(), newarglist, results["rpar"].clone()])] + after) - new.set_prefix(node.get_prefix()) + new.prefix = node.prefix touch_import(None, 'sys', node) return new Modified: python/branches/py3k/Lib/lib2to3/fixes/fix_isinstance.py ============================================================================== --- python/branches/py3k/Lib/lib2to3/fixes/fix_isinstance.py (original) +++ python/branches/py3k/Lib/lib2to3/fixes/fix_isinstance.py Fri Jun 12 01:47:38 2009 @@ -45,7 +45,7 @@ del new_args[-1] if len(new_args) == 1: atom = testlist.parent - new_args[0].set_prefix(atom.get_prefix()) + new_args[0].prefix = atom.prefix atom.replace(new_args[0]) else: args[:] = new_args Modified: python/branches/py3k/Lib/lib2to3/fixes/fix_itertools.py ============================================================================== --- python/branches/py3k/Lib/lib2to3/fixes/fix_itertools.py (original) +++ python/branches/py3k/Lib/lib2to3/fixes/fix_itertools.py Fri Jun 12 01:47:38 2009 @@ -30,12 +30,12 @@ if 'it' in results and func.value != 'ifilterfalse': dot, it = (results['dot'], results['it']) # Remove the 'itertools' - prefix = it.get_prefix() + prefix = it.prefix it.remove() # Replace the node wich contains ('.', 'function') with the # function (to be consistant with the second part of the pattern) dot.remove() func.parent.replace(func) - prefix = prefix or func.get_prefix() + prefix = prefix or func.prefix func.replace(Name(func.value[1:], prefix=prefix)) Modified: python/branches/py3k/Lib/lib2to3/fixes/fix_itertools_imports.py ============================================================================== --- python/branches/py3k/Lib/lib2to3/fixes/fix_itertools_imports.py (original) +++ python/branches/py3k/Lib/lib2to3/fixes/fix_itertools_imports.py Fri Jun 12 01:47:38 2009 @@ -46,7 +46,7 @@ # If there are no imports left, just get rid of the entire statement if not (imports.children or getattr(imports, 'value', None)) or \ imports.parent is None: - p = node.get_prefix() + p = node.prefix node = BlankLine() node.prefix = p return node Modified: python/branches/py3k/Lib/lib2to3/fixes/fix_long.py ============================================================================== --- python/branches/py3k/Lib/lib2to3/fixes/fix_long.py (original) +++ python/branches/py3k/Lib/lib2to3/fixes/fix_long.py Fri Jun 12 01:47:38 2009 @@ -18,5 +18,5 @@ def transform(self, node, results): if is_probably_builtin(node): new = self.static_int.clone() - new.set_prefix(node.get_prefix()) + new.prefix = node.prefix return new Modified: python/branches/py3k/Lib/lib2to3/fixes/fix_map.py ============================================================================== --- python/branches/py3k/Lib/lib2to3/fixes/fix_map.py (original) +++ python/branches/py3k/Lib/lib2to3/fixes/fix_map.py Fri Jun 12 01:47:38 2009 @@ -63,7 +63,7 @@ if node.parent.type == syms.simple_stmt: self.warning(node, "You should use a for loop here") new = node.clone() - new.set_prefix("") + new.prefix = "" new = Call(Name("list"), [new]) elif "map_lambda" in results: new = ListComp(results.get("xp").clone(), @@ -76,7 +76,7 @@ if in_special_context(node): return None new = node.clone() - new.set_prefix("") + new.prefix = "" new = Call(Name("list"), [new]) - new.set_prefix(node.get_prefix()) + new.prefix = node.prefix return new Modified: python/branches/py3k/Lib/lib2to3/fixes/fix_metaclass.py ============================================================================== --- python/branches/py3k/Lib/lib2to3/fixes/fix_metaclass.py (original) +++ python/branches/py3k/Lib/lib2to3/fixes/fix_metaclass.py Fri Jun 12 01:47:38 2009 @@ -89,7 +89,7 @@ parent.insert_child(i, new_stmt) new_leaf1 = new_stmt.children[0].children[0] old_leaf1 = stmt_node.children[0].children[0] - new_leaf1.set_prefix(old_leaf1.get_prefix()) + new_leaf1.prefix = old_leaf1.prefix def remove_trailing_newline(node): @@ -136,7 +136,7 @@ node = kids.pop() if isinstance(node, Leaf) and node.type != token.DEDENT: if node.prefix: - node.set_prefix('') + node.prefix = '' return else: kids.extend(node.children[::-1]) @@ -191,19 +191,19 @@ # now stick the metaclass in the arglist meta_txt = last_metaclass.children[0].children[0] meta_txt.value = 'metaclass' - orig_meta_prefix = meta_txt.get_prefix() + orig_meta_prefix = meta_txt.prefix if arglist.children: arglist.append_child(Leaf(token.COMMA, ',')) - meta_txt.set_prefix(' ') + meta_txt.prefix = ' ' else: - meta_txt.set_prefix('') + meta_txt.prefix = '' # compact the expression "metaclass = Meta" -> "metaclass=Meta" expr_stmt = last_metaclass.children[0] assert expr_stmt.type == syms.expr_stmt - expr_stmt.children[1].set_prefix('') - expr_stmt.children[2].set_prefix('') + expr_stmt.children[1].prefix = '' + expr_stmt.children[2].prefix = '' arglist.append_child(last_metaclass) @@ -214,7 +214,7 @@ # one-liner that was just __metaclass_ suite.remove() pass_leaf = Leaf(text_type, 'pass') - pass_leaf.set_prefix(orig_meta_prefix) + pass_leaf.prefix = orig_meta_prefix node.append_child(pass_leaf) node.append_child(Leaf(token.NEWLINE, '\n')) Modified: python/branches/py3k/Lib/lib2to3/fixes/fix_methodattrs.py ============================================================================== --- python/branches/py3k/Lib/lib2to3/fixes/fix_methodattrs.py (original) +++ python/branches/py3k/Lib/lib2to3/fixes/fix_methodattrs.py Fri Jun 12 01:47:38 2009 @@ -20,4 +20,4 @@ def transform(self, node, results): attr = results["attr"][0] new = MAP[attr.value] - attr.replace(Name(new, prefix=attr.get_prefix())) + attr.replace(Name(new, prefix=attr.prefix)) Modified: python/branches/py3k/Lib/lib2to3/fixes/fix_ne.py ============================================================================== --- python/branches/py3k/Lib/lib2to3/fixes/fix_ne.py (original) +++ python/branches/py3k/Lib/lib2to3/fixes/fix_ne.py Fri Jun 12 01:47:38 2009 @@ -17,6 +17,5 @@ return node.type == token.NOTEQUAL and node.value == "<>" def transform(self, node, results): - new = pytree.Leaf(token.NOTEQUAL, "!=") - new.set_prefix(node.get_prefix()) + new = pytree.Leaf(token.NOTEQUAL, "!=", prefix=node.prefix) return new Modified: python/branches/py3k/Lib/lib2to3/fixes/fix_next.py ============================================================================== --- python/branches/py3k/Lib/lib2to3/fixes/fix_next.py (original) +++ python/branches/py3k/Lib/lib2to3/fixes/fix_next.py Fri Jun 12 01:47:38 2009 @@ -48,17 +48,16 @@ base = results.get("base") attr = results.get("attr") name = results.get("name") - mod = results.get("mod") if base: if self.shadowed_next: - attr.replace(Name("__next__", prefix=attr.get_prefix())) + attr.replace(Name("__next__", prefix=attr.prefix)) else: base = [n.clone() for n in base] - base[0].set_prefix("") - node.replace(Call(Name("next", prefix=node.get_prefix()), base)) + base[0].prefix = "" + node.replace(Call(Name("next", prefix=node.prefix), base)) elif name: - n = Name("__next__", prefix=name.get_prefix()) + n = Name("__next__", prefix=name.prefix) name.replace(n) elif attr: # We don't do this transformation if we're assigning to "x.next". Modified: python/branches/py3k/Lib/lib2to3/fixes/fix_nonzero.py ============================================================================== --- python/branches/py3k/Lib/lib2to3/fixes/fix_nonzero.py (original) +++ python/branches/py3k/Lib/lib2to3/fixes/fix_nonzero.py Fri Jun 12 01:47:38 2009 @@ -16,5 +16,5 @@ def transform(self, node, results): name = results["name"] - new = Name("__bool__", prefix=name.get_prefix()) + new = Name("__bool__", prefix=name.prefix) name.replace(new) Modified: python/branches/py3k/Lib/lib2to3/fixes/fix_numliterals.py ============================================================================== --- python/branches/py3k/Lib/lib2to3/fixes/fix_numliterals.py (original) +++ python/branches/py3k/Lib/lib2to3/fixes/fix_numliterals.py Fri Jun 12 01:47:38 2009 @@ -24,4 +24,4 @@ elif val.startswith('0') and val.isdigit() and len(set(val)) > 1: val = "0o" + val[1:] - return Number(val, prefix=node.get_prefix()) + return Number(val, prefix=node.prefix) Modified: python/branches/py3k/Lib/lib2to3/fixes/fix_paren.py ============================================================================== --- python/branches/py3k/Lib/lib2to3/fixes/fix_paren.py (original) +++ python/branches/py3k/Lib/lib2to3/fixes/fix_paren.py Fri Jun 12 01:47:38 2009 @@ -36,7 +36,7 @@ target = results["target"] lparen = LParen() - lparen.set_prefix(target.get_prefix()) - target.set_prefix("") # Make it hug the parentheses + lparen.prefix = target.prefix + target.prefix = "" # Make it hug the parentheses target.insert_child(0, lparen) target.append_child(RParen()) Modified: python/branches/py3k/Lib/lib2to3/fixes/fix_print.py ============================================================================== --- python/branches/py3k/Lib/lib2to3/fixes/fix_print.py (original) +++ python/branches/py3k/Lib/lib2to3/fixes/fix_print.py Fri Jun 12 01:47:38 2009 @@ -45,7 +45,7 @@ if bare_print: # Special-case print all by itself bare_print.replace(Call(Name("print"), [], - prefix=bare_print.get_prefix())) + prefix=bare_print.prefix)) return assert node.children[0] == Name("print") args = node.children[1:] @@ -65,7 +65,7 @@ # Now synthesize a print(args, sep=..., end=..., file=...) node. l_args = [arg.clone() for arg in args] if l_args: - l_args[0].set_prefix("") + l_args[0].prefix = "" if sep is not None or end is not None or file is not None: if sep is not None: self.add_kwarg(l_args, "sep", String(repr(sep))) @@ -74,17 +74,17 @@ if file is not None: self.add_kwarg(l_args, "file", file) n_stmt = Call(Name("print"), l_args) - n_stmt.set_prefix(node.get_prefix()) + n_stmt.prefix = node.prefix return n_stmt def add_kwarg(self, l_nodes, s_kwd, n_expr): # XXX All this prefix-setting may lose comments (though rarely) - n_expr.set_prefix("") + n_expr.prefix = "" n_argument = pytree.Node(self.syms.argument, (Name(s_kwd), pytree.Leaf(token.EQUAL, "="), n_expr)) if l_nodes: l_nodes.append(Comma()) - n_argument.set_prefix(" ") + n_argument.prefix = " " l_nodes.append(n_argument) Modified: python/branches/py3k/Lib/lib2to3/fixes/fix_raise.py ============================================================================== --- python/branches/py3k/Lib/lib2to3/fixes/fix_raise.py (original) +++ python/branches/py3k/Lib/lib2to3/fixes/fix_raise.py Fri Jun 12 01:47:38 2009 @@ -52,31 +52,31 @@ # exc.children[1:-1] is the unparenthesized tuple # exc.children[1].children[0] is the first element of the tuple exc = exc.children[1].children[0].clone() - exc.set_prefix(" ") + exc.prefix = " " if "val" not in results: # One-argument raise new = pytree.Node(syms.raise_stmt, [Name("raise"), exc]) - new.set_prefix(node.get_prefix()) + new.prefix = node.prefix return new val = results["val"].clone() if is_tuple(val): args = [c.clone() for c in val.children[1:-1]] else: - val.set_prefix("") + val.prefix = "" args = [val] if "tb" in results: tb = results["tb"].clone() - tb.set_prefix("") + tb.prefix = "" e = Call(exc, args) with_tb = Attr(e, Name('with_traceback')) + [ArgList([tb])] new = pytree.Node(syms.simple_stmt, [Name("raise")] + with_tb) - new.set_prefix(node.get_prefix()) + new.prefix = node.prefix return new else: return pytree.Node(syms.raise_stmt, [Name("raise"), Call(exc, args)], - prefix=node.get_prefix()) + prefix=node.prefix) Modified: python/branches/py3k/Lib/lib2to3/fixes/fix_raw_input.py ============================================================================== --- python/branches/py3k/Lib/lib2to3/fixes/fix_raw_input.py (original) +++ python/branches/py3k/Lib/lib2to3/fixes/fix_raw_input.py Fri Jun 12 01:47:38 2009 @@ -13,4 +13,4 @@ def transform(self, node, results): name = results["name"] - name.replace(Name("input", prefix=name.get_prefix())) + name.replace(Name("input", prefix=name.prefix)) Modified: python/branches/py3k/Lib/lib2to3/fixes/fix_renames.py ============================================================================== --- python/branches/py3k/Lib/lib2to3/fixes/fix_renames.py (original) +++ python/branches/py3k/Lib/lib2to3/fixes/fix_renames.py Fri Jun 12 01:47:38 2009 @@ -66,4 +66,4 @@ if mod_name and attr_name: new_attr = LOOKUP[(mod_name.value, attr_name.value)] - attr_name.replace(Name(new_attr, prefix=attr_name.get_prefix())) + attr_name.replace(Name(new_attr, prefix=attr_name.prefix)) Modified: python/branches/py3k/Lib/lib2to3/fixes/fix_repr.py ============================================================================== --- python/branches/py3k/Lib/lib2to3/fixes/fix_repr.py (original) +++ python/branches/py3k/Lib/lib2to3/fixes/fix_repr.py Fri Jun 12 01:47:38 2009 @@ -19,4 +19,4 @@ if expr.type == self.syms.testlist1: expr = parenthesize(expr) - return Call(Name("repr"), [expr], prefix=node.get_prefix()) + return Call(Name("repr"), [expr], prefix=node.prefix) Modified: python/branches/py3k/Lib/lib2to3/fixes/fix_set_literal.py ============================================================================== --- python/branches/py3k/Lib/lib2to3/fixes/fix_set_literal.py (original) +++ python/branches/py3k/Lib/lib2to3/fixes/fix_set_literal.py Fri Jun 12 01:47:38 2009 @@ -38,15 +38,15 @@ literal.extend(n.clone() for n in items.children) literal.append(pytree.Leaf(token.RBRACE, "}")) # Set the prefix of the right brace to that of the ')' or ']' - literal[-1].set_prefix(items.next_sibling.get_prefix()) + literal[-1].prefix = items.next_sibling.prefix maker = pytree.Node(syms.dictsetmaker, literal) - maker.set_prefix(node.get_prefix()) + maker.prefix = node.prefix # If the original was a one tuple, we need to remove the extra comma. if len(maker.children) == 4: n = maker.children[2] n.remove() - maker.children[-1].set_prefix(n.get_prefix()) + maker.children[-1].prefix = n.prefix # Finally, replace the set call with our shiny new literal. return maker Modified: python/branches/py3k/Lib/lib2to3/fixes/fix_standarderror.py ============================================================================== --- python/branches/py3k/Lib/lib2to3/fixes/fix_standarderror.py (original) +++ python/branches/py3k/Lib/lib2to3/fixes/fix_standarderror.py Fri Jun 12 01:47:38 2009 @@ -15,4 +15,4 @@ """ def transform(self, node, results): - return Name("Exception", prefix=node.get_prefix()) + return Name("Exception", prefix=node.prefix) Modified: python/branches/py3k/Lib/lib2to3/fixes/fix_sys_exc.py ============================================================================== --- python/branches/py3k/Lib/lib2to3/fixes/fix_sys_exc.py (original) +++ python/branches/py3k/Lib/lib2to3/fixes/fix_sys_exc.py Fri Jun 12 01:47:38 2009 @@ -22,8 +22,8 @@ sys_attr = results["attribute"][0] index = Number(self.exc_info.index(sys_attr.value)) - call = Call(Name("exc_info"), prefix=sys_attr.get_prefix()) + call = Call(Name("exc_info"), prefix=sys_attr.prefix) attr = Attr(Name("sys"), call) - attr[1].children[0].set_prefix(results["dot"].get_prefix()) + attr[1].children[0].prefix = results["dot"].prefix attr.append(Subscript(index)) - return Node(syms.power, attr, prefix=node.get_prefix()) + return Node(syms.power, attr, prefix=node.prefix) Modified: python/branches/py3k/Lib/lib2to3/fixes/fix_throw.py ============================================================================== --- python/branches/py3k/Lib/lib2to3/fixes/fix_throw.py (original) +++ python/branches/py3k/Lib/lib2to3/fixes/fix_throw.py Fri Jun 12 01:47:38 2009 @@ -40,14 +40,14 @@ if is_tuple(val): args = [c.clone() for c in val.children[1:-1]] else: - val.set_prefix("") + val.prefix = "" args = [val] throw_args = results["args"] if "tb" in results: tb = results["tb"].clone() - tb.set_prefix("") + tb.prefix = "" e = Call(exc, args) with_tb = Attr(e, Name('with_traceback')) + [ArgList([tb])] Modified: python/branches/py3k/Lib/lib2to3/fixes/fix_tuple_params.py ============================================================================== --- python/branches/py3k/Lib/lib2to3/fixes/fix_tuple_params.py (original) +++ python/branches/py3k/Lib/lib2to3/fixes/fix_tuple_params.py Fri Jun 12 01:47:38 2009 @@ -63,10 +63,10 @@ def handle_tuple(tuple_arg, add_prefix=False): n = Name(self.new_name()) arg = tuple_arg.clone() - arg.set_prefix("") + arg.prefix = "" stmt = Assign(arg, n.clone()) if add_prefix: - n.set_prefix(" ") + n.prefix = " " tuple_arg.replace(n) new_lines.append(pytree.Node(syms.simple_stmt, [stmt, end.clone()])) @@ -91,14 +91,14 @@ # TODO(cwinter) suite-cleanup after = start if start == 0: - new_lines[0].set_prefix(" ") + new_lines[0].prefix = " " elif is_docstring(suite[0].children[start]): - new_lines[0].set_prefix(indent) + new_lines[0].prefix = indent after = start + 1 suite[0].children[after:after] = new_lines for i in range(after+1, after+len(new_lines)+1): - suite[0].children[i].set_prefix(indent) + suite[0].children[i].prefix = indent suite[0].changed() def transform_lambda(self, node, results): @@ -109,7 +109,7 @@ # Replace lambda ((((x)))): x with lambda x: x if inner.type == token.NAME: inner = inner.clone() - inner.set_prefix(" ") + inner.prefix = " " args.replace(inner) return @@ -124,7 +124,7 @@ subscripts = [c.clone() for c in to_index[n.value]] new = pytree.Node(syms.power, [new_param.clone()] + subscripts) - new.set_prefix(n.get_prefix()) + new.prefix = n.prefix n.replace(new) Modified: python/branches/py3k/Lib/lib2to3/fixes/fix_types.py ============================================================================== --- python/branches/py3k/Lib/lib2to3/fixes/fix_types.py (original) +++ python/branches/py3k/Lib/lib2to3/fixes/fix_types.py Fri Jun 12 01:47:38 2009 @@ -58,5 +58,5 @@ def transform(self, node, results): new_value = _TYPE_MAPPING.get(results["name"].value) if new_value: - return Name(new_value, prefix=node.get_prefix()) + return Name(new_value, prefix=node.prefix) return None Modified: python/branches/py3k/Lib/lib2to3/fixes/fix_unicode.py ============================================================================== --- python/branches/py3k/Lib/lib2to3/fixes/fix_unicode.py (original) +++ python/branches/py3k/Lib/lib2to3/fixes/fix_unicode.py Fri Jun 12 01:47:38 2009 @@ -6,23 +6,20 @@ from ..pgen2 import token from .. import fixer_base +_mapping = {"unichr" : "chr", "unicode" : "str"} +_literal_re = re.compile(r"[uU][rR]?[\'\"]") + class FixUnicode(fixer_base.BaseFix): - PATTERN = "STRING | NAME<'unicode' | 'unichr'>" + PATTERN = "STRING | 'unicode' | 'unichr'" def transform(self, node, results): if node.type == token.NAME: - if node.value == "unicode": - new = node.clone() - new.value = "str" - return new - if node.value == "unichr": - new = node.clone() - new.value = "chr" - return new - # XXX Warn when __unicode__ found? + new = node.clone() + new.value = _mapping[node.value] + return new elif node.type == token.STRING: - if re.match(r"[uU][rR]?[\'\"]", node.value): + if _literal_re.match(node.value): new = node.clone() new.value = new.value[1:] return new Modified: python/branches/py3k/Lib/lib2to3/fixes/fix_urllib.py ============================================================================== --- python/branches/py3k/Lib/lib2to3/fixes/fix_urllib.py (original) +++ python/branches/py3k/Lib/lib2to3/fixes/fix_urllib.py Fri Jun 12 01:47:38 2009 @@ -78,7 +78,7 @@ replacements. """ import_mod = results.get('module') - pref = import_mod.get_prefix() + pref = import_mod.prefix names = [] @@ -94,7 +94,7 @@ module. """ mod_member = results.get('mod_member') - pref = mod_member.get_prefix() + pref = mod_member.prefix member = results.get('member') # Simple case with only a single member being imported @@ -162,7 +162,7 @@ break if new_name: module_dot.replace(Name(new_name, - prefix=module_dot.get_prefix())) + prefix=module_dot.prefix)) else: self.cannot_convert(node, 'This is an invalid module element') Modified: python/branches/py3k/Lib/lib2to3/fixes/fix_ws_comma.py ============================================================================== --- python/branches/py3k/Lib/lib2to3/fixes/fix_ws_comma.py (original) +++ python/branches/py3k/Lib/lib2to3/fixes/fix_ws_comma.py Fri Jun 12 01:47:38 2009 @@ -26,14 +26,14 @@ comma = False for child in new.children: if child in self.SEPS: - prefix = child.get_prefix() + prefix = child.prefix if prefix.isspace() and "\n" not in prefix: - child.set_prefix("") + child.prefix = "" comma = True else: if comma: - prefix = child.get_prefix() + prefix = child.prefix if not prefix: - child.set_prefix(" ") + child.prefix = " " comma = False return new Modified: python/branches/py3k/Lib/lib2to3/fixes/fix_xrange.py ============================================================================== --- python/branches/py3k/Lib/lib2to3/fixes/fix_xrange.py (original) +++ python/branches/py3k/Lib/lib2to3/fixes/fix_xrange.py Fri Jun 12 01:47:38 2009 @@ -28,14 +28,14 @@ def transform_xrange(self, node, results): name = results["name"] - name.replace(Name("range", prefix=name.get_prefix())) + name.replace(Name("range", prefix=name.prefix)) def transform_range(self, node, results): if not self.in_special_context(node): range_call = Call(Name("range"), [results["args"].clone()]) # Encase the range call in list(). list_call = Call(Name("list"), [range_call], - prefix=node.get_prefix()) + prefix=node.prefix) # Put things that were after the range() call after the list call. for n in results["rest"]: list_call.append_child(n) Modified: python/branches/py3k/Lib/lib2to3/fixes/fix_xreadlines.py ============================================================================== --- python/branches/py3k/Lib/lib2to3/fixes/fix_xreadlines.py (original) +++ python/branches/py3k/Lib/lib2to3/fixes/fix_xreadlines.py Fri Jun 12 01:47:38 2009 @@ -19,6 +19,6 @@ no_call = results.get("no_call") if no_call: - no_call.replace(Name("__iter__", prefix=no_call.get_prefix())) + no_call.replace(Name("__iter__", prefix=no_call.prefix)) else: node.replace([x.clone() for x in results["call"]]) Modified: python/branches/py3k/Lib/lib2to3/fixes/fix_zip.py ============================================================================== --- python/branches/py3k/Lib/lib2to3/fixes/fix_zip.py (original) +++ python/branches/py3k/Lib/lib2to3/fixes/fix_zip.py Fri Jun 12 01:47:38 2009 @@ -28,7 +28,7 @@ return None new = node.clone() - new.set_prefix("") + new.prefix = "" new = Call(Name("list"), [new]) - new.set_prefix(node.get_prefix()) + new.prefix = node.prefix return new Modified: python/branches/py3k/Lib/lib2to3/patcomp.py ============================================================================== --- python/branches/py3k/Lib/lib2to3/patcomp.py (original) +++ python/branches/py3k/Lib/lib2to3/patcomp.py Fri Jun 12 01:47:38 2009 @@ -14,10 +14,7 @@ import os # Fairly local imports -from .pgen2 import driver -from .pgen2 import literals -from .pgen2 import token -from .pgen2 import tokenize +from .pgen2 import driver, literals, token, tokenize, parse # Really local imports from . import pytree @@ -28,6 +25,10 @@ "PatternGrammar.txt") +class PatternSyntaxError(Exception): + pass + + def tokenize_wrapper(input): """Tokenizes a string suppressing significant whitespace.""" skip = set((token.NEWLINE, token.INDENT, token.DEDENT)) @@ -54,7 +55,10 @@ def compile_pattern(self, input, debug=False): """Compiles a pattern string to a nested pytree.*Pattern object.""" tokens = tokenize_wrapper(input) - root = self.driver.parse_tokens(tokens, debug=debug) + try: + root = self.driver.parse_tokens(tokens, debug=debug) + except parse.ParseError as e: + raise PatternSyntaxError(str(e)) return self.compile_node(root) def compile_node(self, node): @@ -139,7 +143,9 @@ value = node.value if value.isupper(): if value not in TOKEN_MAP: - raise SyntaxError("Invalid token: %r" % value) + raise PatternSyntaxError("Invalid token: %r" % value) + if nodes[1:]: + raise PatternSyntaxError("Can't have details for token") return pytree.LeafPattern(TOKEN_MAP[value]) else: if value == "any": @@ -147,7 +153,7 @@ elif not value.startswith("_"): type = getattr(self.pysyms, value, None) if type is None: - raise SyntaxError("Invalid symbol: %r" % value) + raise PatternSyntaxError("Invalid symbol: %r" % value) if nodes[1:]: # Details present content = [self.compile_node(nodes[1].children[1])] else: Modified: python/branches/py3k/Lib/lib2to3/pytree.py ============================================================================== --- python/branches/py3k/Lib/lib2to3/pytree.py (original) +++ python/branches/py3k/Lib/lib2to3/pytree.py Fri Jun 12 01:47:38 2009 @@ -13,6 +13,7 @@ __author__ = "Guido van Rossum " import sys +import warnings from io import StringIO @@ -111,17 +112,21 @@ """ Set the prefix for the node (see Leaf class). - This must be implemented by the concrete subclass. + DEPRECATED; use the prefix property directly. """ - raise NotImplementedError + warnings.warn("set_prefix() is deprecated; use the prefix property", + DeprecationWarning, stacklevel=2) + self.prefix = prefix def get_prefix(self): """ Return the prefix for the node (see Leaf class). - This must be implemented by the concrete subclass. + DEPRECATED; use the prefix property directly. """ - raise NotImplementedError + warnings.warn("get_prefix() is deprecated; use the prefix property", + DeprecationWarning, stacklevel=2) + return self.prefix def replace(self, new): """Replace this node with a new one in the parent.""" @@ -209,12 +214,12 @@ def get_suffix(self): """ Return the string immediately following the invocant node. This is - effectively equivalent to node.next_sibling.get_prefix() + effectively equivalent to node.next_sibling.prefix """ next_sib = self.next_sibling if next_sib is None: return "" - return next_sib.get_prefix() + return next_sib.prefix if sys.version_info < (3, 0): def __str__(self): @@ -241,7 +246,7 @@ assert ch.parent is None, repr(ch) ch.parent = self if prefix is not None: - self.set_prefix(prefix) + self.prefix = prefix def __repr__(self): """Return a canonical string representation.""" @@ -282,24 +287,19 @@ for node in child.post_order(): yield node - def set_prefix(self, prefix): - """ - Set the prefix for the node. - - This passes the responsibility on to the first child. - """ - if self.children: - self.children[0].set_prefix(prefix) - - def get_prefix(self): + @property + def prefix(self): """ - Return the prefix for the node. - - This passes the call on to the first child. + The whitespace and comments preceding this node in the input. """ if not self.children: return "" - return self.children[0].get_prefix() + return self.children[0].prefix + + @prefix.setter + def prefix(self, prefix): + if self.children: + self.children[0].prefix = prefix def set_child(self, i, child): """ @@ -335,9 +335,9 @@ """Concrete implementation for leaf nodes.""" # Default values for instance variables - prefix = "" # Whitespace and comments preceding this token in the input - lineno = 0 # Line where this token starts in the input - column = 0 # Column where this token tarts in the input + _prefix = "" # Whitespace and comments preceding this token in the input + lineno = 0 # Line where this token starts in the input + column = 0 # Column where this token tarts in the input def __init__(self, type, value, context=None, prefix=None): """ @@ -348,11 +348,11 @@ """ assert 0 <= type < 256, type if context is not None: - self.prefix, (self.lineno, self.column) = context + self._prefix, (self.lineno, self.column) = context self.type = type self.value = value if prefix is not None: - self.prefix = prefix + self._prefix = prefix def __repr__(self): """Return a canonical string representation.""" @@ -388,14 +388,17 @@ """Return a pre-order iterator for the tree.""" yield self - def set_prefix(self, prefix): - """Set the prefix for the node.""" - self.changed() - self.prefix = prefix + @property + def prefix(self): + """ + The whitespace and comments preceding this token in the input. + """ + return self._prefix - def get_prefix(self): - """Return the prefix for the node.""" - return self.prefix + @prefix.setter + def prefix(self, prefix): + self.changed() + self._prefix = prefix def convert(gr, raw_node): Modified: python/branches/py3k/Lib/lib2to3/refactor.py ============================================================================== --- python/branches/py3k/Lib/lib2to3/refactor.py (original) +++ python/branches/py3k/Lib/lib2to3/refactor.py Fri Jun 12 01:47:38 2009 @@ -1,4 +1,3 @@ -#!/usr/bin/env python2.5 # Copyright 2006 Google, Inc. All Rights Reserved. # Licensed to PSF under a Contributor Agreement. @@ -23,11 +22,7 @@ # Local imports from .pgen2 import driver, tokenize - -from . import pytree -from . import patcomp -from . import fixes -from . import pygram +from . import pytree, pygram def get_all_fix_names(fixer_pkg, remove_prefix=True): Modified: python/branches/py3k/Lib/lib2to3/tests/data/different_encoding.py ============================================================================== --- python/branches/py3k/Lib/lib2to3/tests/data/different_encoding.py (original) +++ python/branches/py3k/Lib/lib2to3/tests/data/different_encoding.py Fri Jun 12 01:47:38 2009 @@ -1,4 +1,3 @@ #!/usr/bin/env python # -*- coding: iso-8859-1 -*- -print(u'??????????????????????????????????????????????????????????????') - +print u'??????????????????????????????????????????????????????????????' Modified: python/branches/py3k/Lib/lib2to3/tests/data/fixers/myfixes/fix_parrot.py ============================================================================== --- python/branches/py3k/Lib/lib2to3/tests/data/fixers/myfixes/fix_parrot.py (original) +++ python/branches/py3k/Lib/lib2to3/tests/data/fixers/myfixes/fix_parrot.py Fri Jun 12 01:47:38 2009 @@ -10,4 +10,4 @@ def transform(self, node, results): name = results["name"] - name.replace(Name("cheese", name.get_prefix())) + name.replace(Name("cheese", name.prefix)) Modified: python/branches/py3k/Lib/lib2to3/tests/data/py2_test_grammar.py ============================================================================== --- python/branches/py3k/Lib/lib2to3/tests/data/py2_test_grammar.py (original) +++ python/branches/py3k/Lib/lib2to3/tests/data/py2_test_grammar.py Fri Jun 12 01:47:38 2009 @@ -1,5 +1,3 @@ -# Python 2's Lib/test/test_grammar.py (r66189) - # Python test set -- part 1, grammar. # This just tests whether the parser accepts them all. @@ -922,6 +920,26 @@ self.assertEqual([x for x, in [(4,), (5,), (6,)]], [4, 5, 6]) self.assertEqual(list(x for x, in [(7,), (8,), (9,)]), [7, 8, 9]) + def test_with_statement(self): + class manager(object): + def __enter__(self): + return (1, 2) + def __exit__(self, *args): + pass + + with manager(): + pass + with manager() as x: + pass + with manager() as (x, y): + pass + with manager(), manager(): + pass + with manager() as x, manager() as y: + pass + with manager() as x, manager(): + pass + def testIfElseExpr(self): # Test ifelse expressions in various cases def _checkeval(msg, ret): Modified: python/branches/py3k/Lib/lib2to3/tests/data/py3_test_grammar.py ============================================================================== --- python/branches/py3k/Lib/lib2to3/tests/data/py3_test_grammar.py (original) +++ python/branches/py3k/Lib/lib2to3/tests/data/py3_test_grammar.py Fri Jun 12 01:47:38 2009 @@ -868,6 +868,26 @@ self.assertEqual([x for x, in [(4,), (5,), (6,)]], [4, 5, 6]) self.assertEqual(list(x for x, in [(7,), (8,), (9,)]), [7, 8, 9]) + def test_with_statement(self): + class manager(object): + def __enter__(self): + return (1, 2) + def __exit__(self, *args): + pass + + with manager(): + pass + with manager() as x: + pass + with manager() as (x, y): + pass + with manager(), manager(): + pass + with manager() as x, manager() as y: + pass + with manager() as x, manager(): + pass + def testIfElseExpr(self): # Test ifelse expressions in various cases def _checkeval(msg, ret): Modified: python/branches/py3k/Lib/lib2to3/tests/pytree_idempotency.py ============================================================================== --- python/branches/py3k/Lib/lib2to3/tests/pytree_idempotency.py (original) +++ python/branches/py3k/Lib/lib2to3/tests/pytree_idempotency.py Fri Jun 12 01:47:38 2009 @@ -1,4 +1,4 @@ -#!/usr/bin/env python2.5 +#!/usr/bin/env python # Copyright 2006 Google, Inc. All Rights Reserved. # Licensed to PSF under a Contributor Agreement. Modified: python/branches/py3k/Lib/lib2to3/tests/support.py ============================================================================== --- python/branches/py3k/Lib/lib2to3/tests/support.py (original) +++ python/branches/py3k/Lib/lib2to3/tests/support.py Fri Jun 12 01:47:38 2009 @@ -30,7 +30,7 @@ def reformat(string): return dedent(string) + "\n\n" -def get_refactorer(fixers=None, options=None): +def get_refactorer(fixer_pkg="lib2to3", fixers=None, options=None): """ A convenience function for creating a RefactoringTool for tests. @@ -39,9 +39,9 @@ be passed to the RefactoringTool. """ if fixers is not None: - fixers = ["lib2to3.fixes.fix_" + fix for fix in fixers] + fixers = [fixer_pkg + ".fixes.fix_" + fix for fix in fixers] else: - fixers = refactor.get_fixers_from_package("lib2to3.fixes") + fixers = refactor.get_fixers_from_package(fixer_pkg + ".fixes") options = options or {} return refactor.RefactoringTool(fixers, options, explicit=True) Modified: python/branches/py3k/Lib/lib2to3/tests/test_all_fixers.py ============================================================================== --- python/branches/py3k/Lib/lib2to3/tests/test_all_fixers.py (original) +++ python/branches/py3k/Lib/lib2to3/tests/test_all_fixers.py Fri Jun 12 01:47:38 2009 @@ -1,4 +1,3 @@ -#!/usr/bin/env python2.5 """Tests that run all fixer modules over an input stream. This has been broken out into its own test module because of its @@ -6,18 +5,13 @@ """ # Author: Collin Winter -# Testing imports -try: - from . import support -except ImportError: - import support - # Python imports import unittest # Local imports from .. import pytree from .. import refactor +from . import support class Test_all(support.TestCase): @@ -29,8 +23,3 @@ for filepath in support.all_project_files(): print("Fixing %s..." % filepath) self.refactor.refactor_file(filepath) - - -if __name__ == "__main__": - import __main__ - support.run_all_tests(__main__) Modified: python/branches/py3k/Lib/lib2to3/tests/test_fixers.py ============================================================================== --- python/branches/py3k/Lib/lib2to3/tests/test_fixers.py (original) +++ python/branches/py3k/Lib/lib2to3/tests/test_fixers.py Fri Jun 12 01:47:38 2009 @@ -1,12 +1,4 @@ -#!/usr/bin/env python2.5 """ Test suite for the fixer modules """ -# Author: Collin Winter - -# Testing imports -try: - from tests import support -except ImportError: - from . import support # Python imports import os @@ -16,14 +8,19 @@ # Local imports from lib2to3 import pygram, pytree, refactor, fixer_util +from lib2to3.tests import support class FixerTestCase(support.TestCase): - def setUp(self, fix_list=None): + + # Other test cases can subclass this class and replace "fixer_pkg" with + # their own. + def setUp(self, fix_list=None, fixer_pkg="lib2to3", options=None): if fix_list is None: fix_list = [self.fixer] - options = {"print_function" : False} - self.refactor = support.get_refactorer(fix_list, options) + if options is None: + options = {"print_function" : False} + self.refactor = support.get_refactorer(fixer_pkg, fix_list, options) self.fixer_log = [] self.filename = "" @@ -62,7 +59,7 @@ fixes = [self.fixer] fixes.extend(names) options = {"print_function" : False} - r = support.get_refactorer(fixes, options) + r = support.get_refactorer("lib2to3", fixes, options) (pre, post) = r.get_fixers() n = "fix_" + self.fixer if post and post[-1].__class__.__module__.endswith(n): @@ -419,6 +416,7 @@ def test_5(self): b = """print; print whatever;""" a = """print(); print(whatever);""" + self.check(b, a) def test_tuple(self): b = """print (a, b, c)""" @@ -782,6 +780,52 @@ pass""" self.check(b, a) + def test_one_line_suites(self): + b = """ + try: raise TypeError + except TypeError, e: + pass + """ + a = """ + try: raise TypeError + except TypeError as e: + pass + """ + self.check(b, a) + b = """ + try: + raise TypeError + except TypeError, e: pass + """ + a = """ + try: + raise TypeError + except TypeError as e: pass + """ + self.check(b, a) + b = """ + try: raise TypeError + except TypeError, e: pass + """ + a = """ + try: raise TypeError + except TypeError as e: pass + """ + self.check(b, a) + b = """ + try: raise TypeError + except TypeError, e: pass + else: function() + finally: done() + """ + a = """ + try: raise TypeError + except TypeError as e: pass + else: function() + finally: done() + """ + self.check(b, a) + # These should not be touched: def test_unchanged_1(self): @@ -2640,11 +2684,29 @@ class Test_unicode(FixerTestCase): fixer = "unicode" + def test_whitespace(self): + b = """unicode( x)""" + a = """str( x)""" + self.check(b, a) + + b = """ unicode(x )""" + a = """ str(x )""" + self.check(b, a) + + b = """ u'h'""" + a = """ 'h'""" + self.check(b, a) + def test_unicode_call(self): b = """unicode(x, y, z)""" a = """str(x, y, z)""" self.check(b, a) + def test_unichr(self): + b = """unichr(u'h')""" + a = """chr('h')""" + self.check(b, a) + def test_unicode_literal_1(self): b = '''u"x"''' a = '''"x"''' @@ -2656,8 +2718,8 @@ self.check(b, a) def test_unicode_literal_3(self): - b = """UR'''x'''""" - a = """R'''x'''""" + b = """UR'''x''' """ + a = """R'''x''' """ self.check(b, a) class Test_callable(FixerTestCase): @@ -3306,6 +3368,11 @@ a = """x = memoryview(y)""" self.check(b, a) + def test_slicing(self): + b = """buffer(y)[4:5]""" + a = """memoryview(y)[4:5]""" + self.check(b, a) + class Test_future(FixerTestCase): fixer = "future" @@ -4028,8 +4095,3 @@ b = """os.getcwdu ( )""" a = """os.getcwd ( )""" self.check(b, a) - - -if __name__ == "__main__": - import __main__ - support.run_all_tests(__main__) Modified: python/branches/py3k/Lib/lib2to3/tests/test_parser.py ============================================================================== --- python/branches/py3k/Lib/lib2to3/tests/test_parser.py (original) +++ python/branches/py3k/Lib/lib2to3/tests/test_parser.py Fri Jun 12 01:47:38 2009 @@ -1,4 +1,3 @@ -#!/usr/bin/env python2.5 """Test suite for 2to3's parser and grammar files. This is the place to add tests for changes to 2to3's grammar, such as those @@ -6,7 +5,6 @@ parts of the grammar we've changed, we also make sure we can parse the test_grammar.py files from both Python 2 and Python 3. """ -# Author: Collin Winter # Testing imports from . import support @@ -198,7 +196,7 @@ def diff(fn, result): - f = open("@", "w") + f = open("@", "wb") try: f.write(result) finally: @@ -207,8 +205,3 @@ return os.system("diff -u %s @" % fn) finally: os.remove("@") - - -if __name__ == "__main__": - import __main__ - support.run_all_tests(__main__) Modified: python/branches/py3k/Lib/lib2to3/tests/test_pytree.py ============================================================================== --- python/branches/py3k/Lib/lib2to3/tests/test_pytree.py (original) +++ python/branches/py3k/Lib/lib2to3/tests/test_pytree.py Fri Jun 12 01:47:38 2009 @@ -1,4 +1,3 @@ -#!/usr/bin/env python2.5 # Copyright 2006 Google, Inc. All Rights Reserved. # Licensed to PSF under a Contributor Agreement. @@ -10,11 +9,12 @@ especially when debugging a test. """ +import warnings + # Testing imports from . import support -# Local imports (XXX should become a package) -from .. import pytree +from lib2to3 import pytree try: sorted @@ -28,34 +28,48 @@ """Unit tests for nodes (Base, Leaf, Node).""" - def testBaseCantConstruct(self): + def test_deprecated_prefix_methods(self): + l = pytree.Leaf(100, "foo") + with warnings.catch_warnings(record=True) as w: + self.assertEqual(l.get_prefix(), "") + l.set_prefix("hi") + self.assertEqual(l.prefix, "hi") + self.assertEqual(len(w), 2) + for warning in w: + self.assertTrue(warning.category is DeprecationWarning) + self.assertEqual(str(w[0].message), "get_prefix() is deprecated; " \ + "use the prefix property") + self.assertEqual(str(w[1].message), "set_prefix() is deprecated; " \ + "use the prefix property") + + def test_instantiate_base(self): if __debug__: # Test that instantiating Base() raises an AssertionError self.assertRaises(AssertionError, pytree.Base) - def testLeaf(self): + def test_leaf(self): l1 = pytree.Leaf(100, "foo") self.assertEqual(l1.type, 100) self.assertEqual(l1.value, "foo") - def testLeafRepr(self): + def test_leaf_repr(self): l1 = pytree.Leaf(100, "foo") self.assertEqual(repr(l1), "Leaf(100, 'foo')") - def testLeafStr(self): + def test_leaf_str(self): l1 = pytree.Leaf(100, "foo") self.assertEqual(str(l1), "foo") l2 = pytree.Leaf(100, "foo", context=(" ", (10, 1))) self.assertEqual(str(l2), " foo") - def testLeafStrNumericValue(self): + def test_leaf_str_numeric_value(self): # Make sure that the Leaf's value is stringified. Failing to # do this can cause a TypeError in certain situations. l1 = pytree.Leaf(2, 5) - l1.set_prefix("foo_") + l1.prefix = "foo_" self.assertEqual(str(l1), "foo_5") - def testLeafEq(self): + def test_leaf_equality(self): l1 = pytree.Leaf(100, "foo") l2 = pytree.Leaf(100, "foo", context=(" ", (1, 0))) self.assertEqual(l1, l2) @@ -64,67 +78,67 @@ self.assertNotEqual(l1, l3) self.assertNotEqual(l1, l4) - def testLeafPrefix(self): + def test_leaf_prefix(self): l1 = pytree.Leaf(100, "foo") - self.assertEqual(l1.get_prefix(), "") + self.assertEqual(l1.prefix, "") self.failIf(l1.was_changed) - l1.set_prefix(" ##\n\n") - self.assertEqual(l1.get_prefix(), " ##\n\n") + l1.prefix = " ##\n\n" + self.assertEqual(l1.prefix, " ##\n\n") self.failUnless(l1.was_changed) - def testNode(self): + def test_node(self): l1 = pytree.Leaf(100, "foo") l2 = pytree.Leaf(200, "bar") n1 = pytree.Node(1000, [l1, l2]) self.assertEqual(n1.type, 1000) self.assertEqual(n1.children, [l1, l2]) - def testNodeRepr(self): + def test_node_repr(self): l1 = pytree.Leaf(100, "foo") l2 = pytree.Leaf(100, "bar", context=(" ", (1, 0))) n1 = pytree.Node(1000, [l1, l2]) self.assertEqual(repr(n1), "Node(1000, [%s, %s])" % (repr(l1), repr(l2))) - def testNodeStr(self): + def test_node_str(self): l1 = pytree.Leaf(100, "foo") l2 = pytree.Leaf(100, "bar", context=(" ", (1, 0))) n1 = pytree.Node(1000, [l1, l2]) self.assertEqual(str(n1), "foo bar") - def testNodePrefix(self): + def test_node_prefix(self): l1 = pytree.Leaf(100, "foo") - self.assertEqual(l1.get_prefix(), "") + self.assertEqual(l1.prefix, "") n1 = pytree.Node(1000, [l1]) - self.assertEqual(n1.get_prefix(), "") - n1.set_prefix(" ") - self.assertEqual(n1.get_prefix(), " ") - self.assertEqual(l1.get_prefix(), " ") + self.assertEqual(n1.prefix, "") + n1.prefix = " " + self.assertEqual(n1.prefix, " ") + self.assertEqual(l1.prefix, " ") - def testGetSuffix(self): + def test_get_suffix(self): l1 = pytree.Leaf(100, "foo", prefix="a") l2 = pytree.Leaf(100, "bar", prefix="b") n1 = pytree.Node(1000, [l1, l2]) - self.assertEqual(l1.get_suffix(), l2.get_prefix()) + self.assertEqual(l1.get_suffix(), l2.prefix) self.assertEqual(l2.get_suffix(), "") self.assertEqual(n1.get_suffix(), "") l3 = pytree.Leaf(100, "bar", prefix="c") n2 = pytree.Node(1000, [n1, l3]) - self.assertEqual(n1.get_suffix(), l3.get_prefix()) + self.assertEqual(n1.get_suffix(), l3.prefix) self.assertEqual(l3.get_suffix(), "") self.assertEqual(n2.get_suffix(), "") - def testNodeEq(self): + def test_node_equality(self): n1 = pytree.Node(1000, ()) n2 = pytree.Node(1000, [], context=(" ", (1, 0))) self.assertEqual(n1, n2) n3 = pytree.Node(1001, ()) self.assertNotEqual(n1, n3) - def testNodeEqRecursive(self): + def test_node_recursive_equality(self): l1 = pytree.Leaf(100, "foo") l2 = pytree.Leaf(100, "foo") n1 = pytree.Node(1000, [l1]) @@ -134,7 +148,7 @@ n3 = pytree.Node(1000, [l3]) self.assertNotEqual(n1, n3) - def testReplace(self): + def test_replace(self): l1 = pytree.Leaf(100, "foo") l2 = pytree.Leaf(100, "+") l3 = pytree.Leaf(100, "bar") @@ -148,7 +162,7 @@ self.failUnless(isinstance(n1.children, list)) self.failUnless(n1.was_changed) - def testReplaceWithList(self): + def test_replace_with_list(self): l1 = pytree.Leaf(100, "foo") l2 = pytree.Leaf(100, "+") l3 = pytree.Leaf(100, "bar") @@ -158,34 +172,30 @@ self.assertEqual(str(n1), "foo**bar") self.failUnless(isinstance(n1.children, list)) - def testPostOrder(self): + def test_post_order(self): l1 = pytree.Leaf(100, "foo") l2 = pytree.Leaf(100, "bar") n1 = pytree.Node(1000, [l1, l2]) self.assertEqual(list(n1.post_order()), [l1, l2, n1]) - def testPreOrder(self): + def test_pre_order(self): l1 = pytree.Leaf(100, "foo") l2 = pytree.Leaf(100, "bar") n1 = pytree.Node(1000, [l1, l2]) self.assertEqual(list(n1.pre_order()), [n1, l1, l2]) - def testChangedLeaf(self): + def test_changed(self): l1 = pytree.Leaf(100, "f") self.failIf(l1.was_changed) - l1.changed() self.failUnless(l1.was_changed) - def testChangedNode(self): l1 = pytree.Leaf(100, "f") n1 = pytree.Node(1000, [l1]) self.failIf(n1.was_changed) - n1.changed() self.failUnless(n1.was_changed) - def testChangedRecursive(self): l1 = pytree.Leaf(100, "foo") l2 = pytree.Leaf(100, "+") l3 = pytree.Leaf(100, "bar") @@ -200,23 +210,23 @@ self.failUnless(n2.was_changed) self.failIf(l1.was_changed) - def testLeafConstructorPrefix(self): + def test_leaf_constructor_prefix(self): for prefix in ("xyz_", ""): l1 = pytree.Leaf(100, "self", prefix=prefix) self.failUnless(str(l1), prefix + "self") - self.assertEqual(l1.get_prefix(), prefix) + self.assertEqual(l1.prefix, prefix) - def testNodeConstructorPrefix(self): + def test_node_constructor_prefix(self): for prefix in ("xyz_", ""): l1 = pytree.Leaf(100, "self") l2 = pytree.Leaf(100, "foo", prefix="_") n1 = pytree.Node(1000, [l1, l2], prefix=prefix) self.failUnless(str(n1), prefix + "self_foo") - self.assertEqual(n1.get_prefix(), prefix) - self.assertEqual(l1.get_prefix(), prefix) - self.assertEqual(l2.get_prefix(), "_") + self.assertEqual(n1.prefix, prefix) + self.assertEqual(l1.prefix, prefix) + self.assertEqual(l2.prefix, "_") - def testRemove(self): + def test_remove(self): l1 = pytree.Leaf(100, "foo") l2 = pytree.Leaf(100, "foo") n1 = pytree.Node(1000, [l1, l2]) @@ -239,7 +249,7 @@ self.failUnless(n1.was_changed) self.failUnless(n2.was_changed) - def testRemoveParentless(self): + def test_remove_parentless(self): n1 = pytree.Node(1000, []) n1.remove() self.assertEqual(n1.parent, None) @@ -248,7 +258,7 @@ l1.remove() self.assertEqual(l1.parent, None) - def testNodeSetChild(self): + def test_node_set_child(self): l1 = pytree.Leaf(100, "foo") n1 = pytree.Node(1000, [l1]) @@ -269,7 +279,7 @@ # I don't care what it raises, so long as it's an exception self.assertRaises(Exception, n1.set_child, 0, list) - def testNodeInsertChild(self): + def test_node_insert_child(self): l1 = pytree.Leaf(100, "foo") n1 = pytree.Node(1000, [l1]) @@ -285,7 +295,7 @@ # I don't care what it raises, so long as it's an exception self.assertRaises(Exception, n1.insert_child, 0, list) - def testNodeAppendChild(self): + def test_node_append_child(self): n1 = pytree.Node(1000, []) l1 = pytree.Leaf(100, "foo") @@ -301,7 +311,7 @@ # I don't care what it raises, so long as it's an exception self.assertRaises(Exception, n1.append_child, list) - def testNodeNextSibling(self): + def test_node_next_sibling(self): n1 = pytree.Node(1000, []) n2 = pytree.Node(1000, []) p1 = pytree.Node(1000, [n1, n2]) @@ -310,7 +320,7 @@ self.assertEqual(n2.next_sibling, None) self.assertEqual(p1.next_sibling, None) - def testLeafNextSibling(self): + def test_leaf_next_sibling(self): l1 = pytree.Leaf(100, "a") l2 = pytree.Leaf(100, "b") p1 = pytree.Node(1000, [l1, l2]) @@ -319,7 +329,7 @@ self.assertEqual(l2.next_sibling, None) self.assertEqual(p1.next_sibling, None) - def testNodePrevSibling(self): + def test_node_prev_sibling(self): n1 = pytree.Node(1000, []) n2 = pytree.Node(1000, []) p1 = pytree.Node(1000, [n1, n2]) @@ -328,7 +338,7 @@ self.assertEqual(n1.prev_sibling, None) self.assertEqual(p1.prev_sibling, None) - def testLeafPrevSibling(self): + def test_leaf_prev_sibling(self): l1 = pytree.Leaf(100, "a") l2 = pytree.Leaf(100, "b") p1 = pytree.Node(1000, [l1, l2]) @@ -342,7 +352,7 @@ """Unit tests for tree matching patterns.""" - def testBasicPatterns(self): + def test_basic_patterns(self): # Build a tree l1 = pytree.Leaf(100, "foo") l2 = pytree.Leaf(100, "bar") @@ -378,7 +388,7 @@ self.assertFalse(pn.match(l2, results=r)) self.assertEqual(r, {}) - def testWildcardPatterns(self): + def test_wildcard(self): # Build a tree for testing l1 = pytree.Leaf(100, "foo") l2 = pytree.Leaf(100, "bar") @@ -409,7 +419,7 @@ self.assert_(r["pl"] is l3) r = {} - def testGenerateMatches(self): + def test_generate_matches(self): la = pytree.Leaf(1, "a") lb = pytree.Leaf(1, "b") lc = pytree.Leaf(1, "c") @@ -439,7 +449,7 @@ for c in "abcdef": self.assertEqual(r["p" + c], pytree.Leaf(1, c)) - def testHasKeyExample(self): + def test_has_key_example(self): pattern = pytree.NodePattern(331, (pytree.LeafPattern(7), pytree.WildcardPattern(name="args"), @@ -451,8 +461,3 @@ r = {} self.assert_(pattern.match(node, r)) self.assertEqual(r["args"], [l2]) - - -if __name__ == "__main__": - import __main__ - support.run_all_tests(__main__) Modified: python/branches/py3k/Lib/lib2to3/tests/test_util.py ============================================================================== --- python/branches/py3k/Lib/lib2to3/tests/test_util.py (original) +++ python/branches/py3k/Lib/lib2to3/tests/test_util.py Fri Jun 12 01:47:38 2009 @@ -1,6 +1,4 @@ -#!/usr/bin/env python2.5 """ Test suite for the code in fixes.util """ -# Author: Collin Winter # Testing imports from . import support @@ -552,8 +550,3 @@ node = parse('bar()') fixer_util.touch_import(None, "cgi", node) self.assertEqual(str(node), 'import cgi\nbar()\n\n') - - -if __name__ == "__main__": - import __main__ - support.run_all_tests(__main__) From buildbot at python.org Fri Jun 12 03:30:51 2009 From: buildbot at python.org (buildbot at python.org) Date: Fri, 12 Jun 2009 01:30:51 +0000 Subject: [Python-checkins] buildbot failure in x86 osx.5 trunk Message-ID: <20090612013051.BAEB0C521@mail.python.org> The Buildbot has detected a new failure of x86 osx.5 trunk. Full details are available at: http://www.python.org/dev/buildbot/all/x86%20osx.5%20trunk/builds/1177 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: heller-x86-osx5 Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: raymond.hettinger BUILD FAILED: failed test Excerpt from the test logfile: sincerely, -The Buildbot From python-checkins at python.org Fri Jun 12 04:07:12 2009 From: python-checkins at python.org (benjamin.peterson) Date: Fri, 12 Jun 2009 04:07:12 +0200 (CEST) Subject: [Python-checkins] r73385 - in python/branches/py3k/Modules/_io: _iomodule.c _iomodule.h bufferedio.c bytesio.c fileio.c iobase.c stringio.c textio.c Message-ID: <20090612020712.C0041D51A@mail.python.org> Author: benjamin.peterson Date: Fri Jun 12 04:07:12 2009 New Revision: 73385 Log: move to a naming scheme with all lowercase and underscores Modified: python/branches/py3k/Modules/_io/_iomodule.c python/branches/py3k/Modules/_io/_iomodule.h python/branches/py3k/Modules/_io/bufferedio.c python/branches/py3k/Modules/_io/bytesio.c python/branches/py3k/Modules/_io/fileio.c python/branches/py3k/Modules/_io/iobase.c python/branches/py3k/Modules/_io/stringio.c python/branches/py3k/Modules/_io/textio.c Modified: python/branches/py3k/Modules/_io/_iomodule.c ============================================================================== --- python/branches/py3k/Modules/_io/_iomodule.c (original) +++ python/branches/py3k/Modules/_io/_iomodule.c Fri Jun 12 04:07:12 2009 @@ -94,7 +94,7 @@ */ static int -BlockingIOError_init(PyBlockingIOErrorObject *self, PyObject *args, +blockingioerror_init(PyBlockingIOErrorObject *self, PyObject *args, PyObject *kwds) { PyObject *myerrno = NULL, *strerror = NULL; @@ -123,7 +123,7 @@ return 0; } -static PyMemberDef BlockingIOError_members[] = { +static PyMemberDef blockingioerror_members[] = { {"characters_written", T_PYSSIZET, offsetof(PyBlockingIOErrorObject, written), 0}, {NULL} /* Sentinel */ }; @@ -158,14 +158,14 @@ 0, /* tp_iter */ 0, /* tp_iternext */ 0, /* tp_methods */ - BlockingIOError_members, /* tp_members */ + blockingioerror_members, /* tp_members */ 0, /* tp_getset */ 0, /* tp_base */ 0, /* tp_dict */ 0, /* tp_descr_get */ 0, /* tp_descr_set */ 0, /* tp_dictoffset */ - (initproc)BlockingIOError_init, /* tp_init */ + (initproc)blockingioerror_init, /* tp_init */ 0, /* tp_alloc */ 0, /* tp_new */ }; Modified: python/branches/py3k/Modules/_io/_iomodule.h ============================================================================== --- python/branches/py3k/Modules/_io/_iomodule.h (original) +++ python/branches/py3k/Modules/_io/_iomodule.h Fri Jun 12 04:07:12 2009 @@ -23,10 +23,10 @@ * with args=NULL, and return a new reference. * BUT when args=Py_True is passed, they return a borrowed reference. */ -extern PyObject* _PyIOBase_checkReadable(PyObject *self, PyObject *args); -extern PyObject* _PyIOBase_checkWritable(PyObject *self, PyObject *args); -extern PyObject* _PyIOBase_checkSeekable(PyObject *self, PyObject *args); -extern PyObject* _PyIOBase_checkClosed(PyObject *self, PyObject *args); +extern PyObject* _PyIOBase_check_readable(PyObject *self, PyObject *args); +extern PyObject* _PyIOBase_check_writable(PyObject *self, PyObject *args); +extern PyObject* _PyIOBase_check_seekable(PyObject *self, PyObject *args); +extern PyObject* _PyIOBase_check_closed(PyObject *self, PyObject *args); /* Helper for finalization. This function will revive an object ready to be deallocated and try to Modified: python/branches/py3k/Modules/_io/bufferedio.c ============================================================================== --- python/branches/py3k/Modules/_io/bufferedio.c (original) +++ python/branches/py3k/Modules/_io/bufferedio.c Fri Jun 12 04:07:12 2009 @@ -16,7 +16,7 @@ /* * BufferedIOBase class, inherits from IOBase. */ -PyDoc_STRVAR(BufferedIOBase_doc, +PyDoc_STRVAR(bufferediobase_doc, "Base class for buffered IO objects.\n" "\n" "The main difference with RawIOBase is that the read() method\n" @@ -33,7 +33,7 @@ ); static PyObject * -BufferedIOBase_readinto(PyObject *self, PyObject *args) +bufferediobase_readinto(PyObject *self, PyObject *args) { Py_buffer buf; Py_ssize_t len; @@ -67,25 +67,25 @@ } static PyObject * -BufferedIOBase_unsupported(const char *message) +bufferediobase_unsupported(const char *message) { PyErr_SetString(IO_STATE->unsupported_operation, message); return NULL; } -PyDoc_STRVAR(BufferedIOBase_detach_doc, +PyDoc_STRVAR(bufferediobase_detach_doc, "Disconnect this buffer from its underlying raw stream and return it.\n" "\n" "After the raw stream has been detached, the buffer is in an unusable\n" "state.\n"); static PyObject * -BufferedIOBase_detach(PyObject *self) +bufferediobase_detach(PyObject *self) { - return BufferedIOBase_unsupported("detach"); + return bufferediobase_unsupported("detach"); } -PyDoc_STRVAR(BufferedIOBase_read_doc, +PyDoc_STRVAR(bufferediobase_read_doc, "Read and return up to n bytes.\n" "\n" "If the argument is omitted, None, or negative, reads and\n" @@ -104,12 +104,12 @@ "mode and no data is available at the moment.\n"); static PyObject * -BufferedIOBase_read(PyObject *self, PyObject *args) +bufferediobase_read(PyObject *self, PyObject *args) { - return BufferedIOBase_unsupported("read"); + return bufferediobase_unsupported("read"); } -PyDoc_STRVAR(BufferedIOBase_read1_doc, +PyDoc_STRVAR(bufferediobase_read1_doc, "Read and return up to n bytes, with at most one read() call\n" "to the underlying raw stream. A short result does not imply\n" "that EOF is imminent.\n" @@ -117,12 +117,12 @@ "Returns an empty bytes object on EOF.\n"); static PyObject * -BufferedIOBase_read1(PyObject *self, PyObject *args) +bufferediobase_read1(PyObject *self, PyObject *args) { - return BufferedIOBase_unsupported("read1"); + return bufferediobase_unsupported("read1"); } -PyDoc_STRVAR(BufferedIOBase_write_doc, +PyDoc_STRVAR(bufferediobase_write_doc, "Write the given buffer to the IO stream.\n" "\n" "Returns the number of bytes written, which is never less than\n" @@ -132,18 +132,18 @@ "underlying raw stream cannot accept more data at the moment.\n"); static PyObject * -BufferedIOBase_write(PyObject *self, PyObject *args) +bufferediobase_write(PyObject *self, PyObject *args) { - return BufferedIOBase_unsupported("write"); + return bufferediobase_unsupported("write"); } -static PyMethodDef BufferedIOBase_methods[] = { - {"detach", (PyCFunction)BufferedIOBase_detach, METH_NOARGS, BufferedIOBase_detach_doc}, - {"read", BufferedIOBase_read, METH_VARARGS, BufferedIOBase_read_doc}, - {"read1", BufferedIOBase_read1, METH_VARARGS, BufferedIOBase_read1_doc}, - {"readinto", BufferedIOBase_readinto, METH_VARARGS, NULL}, - {"write", BufferedIOBase_write, METH_VARARGS, BufferedIOBase_write_doc}, +static PyMethodDef bufferediobase_methods[] = { + {"detach", (PyCFunction)bufferediobase_detach, METH_NOARGS, bufferediobase_detach_doc}, + {"read", bufferediobase_read, METH_VARARGS, bufferediobase_read_doc}, + {"read1", bufferediobase_read1, METH_VARARGS, bufferediobase_read1_doc}, + {"readinto", bufferediobase_readinto, METH_VARARGS, NULL}, + {"write", bufferediobase_write, METH_VARARGS, bufferediobase_write_doc}, {NULL, NULL} }; @@ -168,14 +168,14 @@ 0, /*tp_setattro*/ 0, /*tp_as_buffer*/ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /*tp_flags*/ - BufferedIOBase_doc, /* tp_doc */ + bufferediobase_doc, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompare */ 0, /* tp_weaklistoffset */ 0, /* tp_iter */ 0, /* tp_iternext */ - BufferedIOBase_methods, /* tp_methods */ + bufferediobase_methods, /* tp_methods */ 0, /* tp_members */ 0, /* tp_getset */ &PyIOBase_Type, /* tp_base */ @@ -231,7 +231,7 @@ PyObject *dict; PyObject *weakreflist; -} BufferedObject; +} buffered; /* Implementation notes: @@ -245,19 +245,18 @@ * The absolute position of the raw stream is cached, if possible, in the `abs_pos` member. It must be updated every time an operation is done on the raw stream. If not sure, it can be reinitialized by calling - _Buffered_raw_tell(), which queries the raw stream (_Buffered_raw_seek() + _buffered_raw_tell(), which queries the raw stream (_buffered_raw_seek() also does it). To read it, use RAW_TELL(). - * Three helpers, _BufferedReader_raw_read, _BufferedWriter_raw_write and - _BufferedWriter_flush_unlocked do a lot of useful housekeeping. + * Three helpers, _bufferedreader_raw_read, _bufferedwriter_raw_write and + _bufferedwriter_flush_unlocked do a lot of useful housekeeping. NOTE: we should try to maintain block alignment of reads and writes to the raw stream (according to the buffer size), but for now it is only done in read() and friends. - XXX: method naming is a bit messy. */ -/* These macros protect the BufferedObject against concurrent operations. */ +/* These macros protect the buffered object against concurrent operations. */ #ifdef WITH_THREAD #define ENTER_BUFFERED(self) \ @@ -299,7 +298,7 @@ #define IS_CLOSED(self) \ (self->fast_closed_checks \ ? _PyFileIO_closed(self->raw) \ - : BufferedIOMixin_closed(self)) + : buffered_closed(self)) #define CHECK_CLOSED(self, error_msg) \ if (IS_CLOSED(self)) { \ @@ -330,7 +329,7 @@ && self->raw_pos >= 0) ? self->raw_pos - self->pos : 0) #define RAW_TELL(self) \ - (self->abs_pos != -1 ? self->abs_pos : _Buffered_raw_tell(self)) + (self->abs_pos != -1 ? self->abs_pos : _buffered_raw_tell(self)) #define MINUS_LAST_BLOCK(self, size) \ (self->buffer_mask ? \ @@ -339,7 +338,7 @@ static void -BufferedObject_dealloc(BufferedObject *self) +buffered_dealloc(buffered *self) { if (self->ok && _PyIOBase_finalize((PyObject *) self) < 0) return; @@ -363,7 +362,7 @@ } static int -Buffered_traverse(BufferedObject *self, visitproc visit, void *arg) +buffered_traverse(buffered *self, visitproc visit, void *arg) { Py_VISIT(self->raw); Py_VISIT(self->dict); @@ -371,7 +370,7 @@ } static int -Buffered_clear(BufferedObject *self) +buffered_clear(buffered *self) { if (self->ok && _PyIOBase_finalize((PyObject *) self) < 0) return -1; @@ -390,14 +389,14 @@ /* Flush and close */ static PyObject * -BufferedIOMixin_flush(BufferedObject *self, PyObject *args) +buffered_simple_flush(buffered *self, PyObject *args) { CHECK_INITIALIZED(self) return PyObject_CallMethodObjArgs(self->raw, _PyIO_str_flush, NULL); } static int -BufferedIOMixin_closed(BufferedObject *self) +buffered_closed(buffered *self) { int closed; PyObject *res; @@ -411,14 +410,14 @@ } static PyObject * -BufferedIOMixin_closed_get(BufferedObject *self, void *context) +buffered_closed_get(buffered *self, void *context) { CHECK_INITIALIZED(self) return PyObject_GetAttr(self->raw, _PyIO_str_closed); } static PyObject * -BufferedIOMixin_close(BufferedObject *self, PyObject *args) +buffered_close(buffered *self, PyObject *args) { PyObject *res = NULL; int r; @@ -426,7 +425,7 @@ CHECK_INITIALIZED(self) ENTER_BUFFERED(self) - r = BufferedIOMixin_closed(self); + r = buffered_closed(self); if (r < 0) goto end; if (r > 0) { @@ -457,7 +456,7 @@ /* detach */ static PyObject * -BufferedIOMixin_detach(BufferedObject *self, PyObject *args) +buffered_detach(buffered *self, PyObject *args) { PyObject *raw, *res; CHECK_INITIALIZED(self) @@ -475,35 +474,35 @@ /* Inquiries */ static PyObject * -BufferedIOMixin_seekable(BufferedObject *self, PyObject *args) +buffered_seekable(buffered *self, PyObject *args) { CHECK_INITIALIZED(self) return PyObject_CallMethodObjArgs(self->raw, _PyIO_str_seekable, NULL); } static PyObject * -BufferedIOMixin_readable(BufferedObject *self, PyObject *args) +buffered_readable(buffered *self, PyObject *args) { CHECK_INITIALIZED(self) return PyObject_CallMethodObjArgs(self->raw, _PyIO_str_readable, NULL); } static PyObject * -BufferedIOMixin_writable(BufferedObject *self, PyObject *args) +buffered_writable(buffered *self, PyObject *args) { CHECK_INITIALIZED(self) return PyObject_CallMethodObjArgs(self->raw, _PyIO_str_writable, NULL); } static PyObject * -BufferedIOMixin_name_get(BufferedObject *self, void *context) +buffered_name_get(buffered *self, void *context) { CHECK_INITIALIZED(self) return PyObject_GetAttrString(self->raw, "name"); } static PyObject * -BufferedIOMixin_mode_get(BufferedObject *self, void *context) +buffered_mode_get(buffered *self, void *context) { CHECK_INITIALIZED(self) return PyObject_GetAttrString(self->raw, "mode"); @@ -512,14 +511,14 @@ /* Lower-level APIs */ static PyObject * -BufferedIOMixin_fileno(BufferedObject *self, PyObject *args) +buffered_fileno(buffered *self, PyObject *args) { CHECK_INITIALIZED(self) return PyObject_CallMethodObjArgs(self->raw, _PyIO_str_fileno, NULL); } static PyObject * -BufferedIOMixin_isatty(BufferedObject *self, PyObject *args) +buffered_isatty(buffered *self, PyObject *args) { CHECK_INITIALIZED(self) return PyObject_CallMethodObjArgs(self->raw, _PyIO_str_isatty, NULL); @@ -528,21 +527,21 @@ /* Forward decls */ static PyObject * -_BufferedWriter_flush_unlocked(BufferedObject *, int); +_bufferedwriter_flush_unlocked(buffered *, int); static Py_ssize_t -_BufferedReader_fill_buffer(BufferedObject *self); +_bufferedreader_fill_buffer(buffered *self); static void -_BufferedReader_reset_buf(BufferedObject *self); +_bufferedreader_reset_buf(buffered *self); static void -_BufferedWriter_reset_buf(BufferedObject *self); +_bufferedwriter_reset_buf(buffered *self); static PyObject * -_BufferedReader_peek_unlocked(BufferedObject *self, Py_ssize_t); +_bufferedreader_peek_unlocked(buffered *self, Py_ssize_t); static PyObject * -_BufferedReader_read_all(BufferedObject *self); +_bufferedreader_read_all(buffered *self); static PyObject * -_BufferedReader_read_fast(BufferedObject *self, Py_ssize_t); +_bufferedreader_read_fast(buffered *self, Py_ssize_t); static PyObject * -_BufferedReader_read_generic(BufferedObject *self, Py_ssize_t); +_bufferedreader_read_generic(buffered *self, Py_ssize_t); /* @@ -552,7 +551,7 @@ /* Returns the address of the `written` member if a BlockingIOError was raised, NULL otherwise. The error is always re-raised. */ static Py_ssize_t * -_Buffered_check_blocking_error(void) +_buffered_check_blocking_error(void) { PyObject *t, *v, *tb; PyBlockingIOErrorObject *err; @@ -569,7 +568,7 @@ } static Py_off_t -_Buffered_raw_tell(BufferedObject *self) +_buffered_raw_tell(buffered *self) { Py_off_t n; PyObject *res; @@ -589,7 +588,7 @@ } static Py_off_t -_Buffered_raw_seek(BufferedObject *self, Py_off_t target, int whence) +_buffered_raw_seek(buffered *self, Py_off_t target, int whence) { PyObject *res, *posobj, *whenceobj; Py_off_t n; @@ -621,7 +620,7 @@ } static int -_Buffered_init(BufferedObject *self) +_buffered_init(buffered *self) { Py_ssize_t n; if (self->buffer_size <= 0) { @@ -651,7 +650,7 @@ self->buffer_mask = self->buffer_size - 1; else self->buffer_mask = 0; - if (_Buffered_raw_tell(self) == -1) + if (_buffered_raw_tell(self) == -1) PyErr_Clear(); return 0; } @@ -661,7 +660,7 @@ */ static PyObject * -Buffered_flush(BufferedObject *self, PyObject *args) +buffered_flush(buffered *self, PyObject *args) { PyObject *res; @@ -669,15 +668,15 @@ CHECK_CLOSED(self, "flush of closed file") ENTER_BUFFERED(self) - res = _BufferedWriter_flush_unlocked(self, 0); + res = _bufferedwriter_flush_unlocked(self, 0); if (res != NULL && self->readable) { /* Rewind the raw stream so that its position corresponds to the current logical position. */ Py_off_t n; - n = _Buffered_raw_seek(self, -RAW_OFFSET(self), 1); + n = _buffered_raw_seek(self, -RAW_OFFSET(self), 1); if (n == -1) Py_CLEAR(res); - _BufferedReader_reset_buf(self); + _bufferedreader_reset_buf(self); } LEAVE_BUFFERED(self) @@ -685,7 +684,7 @@ } static PyObject * -Buffered_peek(BufferedObject *self, PyObject *args) +buffered_peek(buffered *self, PyObject *args) { Py_ssize_t n = 0; PyObject *res = NULL; @@ -698,12 +697,12 @@ ENTER_BUFFERED(self) if (self->writable) { - res = _BufferedWriter_flush_unlocked(self, 1); + res = _bufferedwriter_flush_unlocked(self, 1); if (res == NULL) goto end; Py_CLEAR(res); } - res = _BufferedReader_peek_unlocked(self, n); + res = _bufferedreader_peek_unlocked(self, n); end: LEAVE_BUFFERED(self) @@ -711,7 +710,7 @@ } static PyObject * -Buffered_read(BufferedObject *self, PyObject *args) +buffered_read(buffered *self, PyObject *args) { Py_ssize_t n = -1; PyObject *res; @@ -731,15 +730,15 @@ if (n == -1) { /* The number of bytes is unspecified, read until the end of stream */ ENTER_BUFFERED(self) - res = _BufferedReader_read_all(self); + res = _bufferedreader_read_all(self); LEAVE_BUFFERED(self) } else { - res = _BufferedReader_read_fast(self, n); + res = _bufferedreader_read_fast(self, n); if (res == Py_None) { Py_DECREF(res); ENTER_BUFFERED(self) - res = _BufferedReader_read_generic(self, n); + res = _bufferedreader_read_generic(self, n); LEAVE_BUFFERED(self) } } @@ -748,7 +747,7 @@ } static PyObject * -Buffered_read1(BufferedObject *self, PyObject *args) +buffered_read1(buffered *self, PyObject *args) { Py_ssize_t n, have, r; PyObject *res = NULL; @@ -769,7 +768,7 @@ ENTER_BUFFERED(self) if (self->writable) { - res = _BufferedWriter_flush_unlocked(self, 1); + res = _bufferedwriter_flush_unlocked(self, 1); if (res == NULL) goto end; Py_CLEAR(res); @@ -795,8 +794,8 @@ } /* Fill the buffer from the raw stream, and copy it to the result. */ - _BufferedReader_reset_buf(self); - r = _BufferedReader_fill_buffer(self); + _bufferedreader_reset_buf(self); + r = _bufferedreader_fill_buffer(self); if (r == -1) goto end; if (r == -2) @@ -814,7 +813,7 @@ } static PyObject * -Buffered_readinto(BufferedObject *self, PyObject *args) +buffered_readinto(buffered *self, PyObject *args) { PyObject *res = NULL; @@ -823,20 +822,20 @@ /* TODO: use raw.readinto() instead! */ if (self->writable) { ENTER_BUFFERED(self) - res = _BufferedWriter_flush_unlocked(self, 0); + res = _bufferedwriter_flush_unlocked(self, 0); LEAVE_BUFFERED(self) if (res == NULL) goto end; Py_DECREF(res); } - res = BufferedIOBase_readinto((PyObject *)self, args); + res = bufferediobase_readinto((PyObject *)self, args); end: return res; } static PyObject * -_Buffered_readline(BufferedObject *self, Py_ssize_t limit) +_buffered_readline(buffered *self, Py_ssize_t limit) { PyObject *res = NULL; PyObject *chunks = NULL; @@ -870,7 +869,7 @@ /* Now we try to get some more from the raw stream */ if (self->writable) { - res = _BufferedWriter_flush_unlocked(self, 1); + res = _bufferedwriter_flush_unlocked(self, 1); if (res == NULL) goto end; Py_CLEAR(res); @@ -893,8 +892,8 @@ } for (;;) { - _BufferedReader_reset_buf(self); - n = _BufferedReader_fill_buffer(self); + _bufferedreader_reset_buf(self); + n = _bufferedreader_fill_buffer(self); if (n == -1) goto end; if (n <= 0) @@ -945,7 +944,7 @@ } static PyObject * -Buffered_readline(BufferedObject *self, PyObject *args) +buffered_readline(buffered *self, PyObject *args) { Py_ssize_t limit = -1; @@ -954,17 +953,17 @@ if (!PyArg_ParseTuple(args, "|n:readline", &limit)) { return NULL; } - return _Buffered_readline(self, limit); + return _buffered_readline(self, limit); } static PyObject * -Buffered_tell(BufferedObject *self, PyObject *args) +buffered_tell(buffered *self, PyObject *args) { Py_off_t pos; CHECK_INITIALIZED(self) - pos = _Buffered_raw_tell(self); + pos = _buffered_raw_tell(self); if (pos == -1) return NULL; pos -= RAW_OFFSET(self); @@ -973,7 +972,7 @@ } static PyObject * -Buffered_seek(BufferedObject *self, PyObject *args) +buffered_seek(buffered *self, PyObject *args) { Py_off_t target, n; int whence = 0; @@ -1022,23 +1021,23 @@ /* Fallback: invoke raw seek() method and clear buffer */ if (self->writable) { - res = _BufferedWriter_flush_unlocked(self, 0); + res = _bufferedwriter_flush_unlocked(self, 0); if (res == NULL) goto end; Py_CLEAR(res); - _BufferedWriter_reset_buf(self); + _bufferedwriter_reset_buf(self); } /* TODO: align on block boundary and read buffer if needed? */ if (whence == 1) target -= RAW_OFFSET(self); - n = _Buffered_raw_seek(self, target, whence); + n = _buffered_raw_seek(self, target, whence); if (n == -1) goto end; self->raw_pos = -1; res = PyLong_FromOff_t(n); if (res != NULL && self->readable) - _BufferedReader_reset_buf(self); + _bufferedreader_reset_buf(self); end: LEAVE_BUFFERED(self) @@ -1046,7 +1045,7 @@ } static PyObject * -Buffered_truncate(BufferedObject *self, PyObject *args) +buffered_truncate(buffered *self, PyObject *args) { PyObject *pos = Py_None; PyObject *res = NULL; @@ -1059,7 +1058,7 @@ ENTER_BUFFERED(self) if (self->writable) { - res = _BufferedWriter_flush_unlocked(self, 0); + res = _bufferedwriter_flush_unlocked(self, 0); if (res == NULL) goto end; Py_CLEAR(res); @@ -1068,16 +1067,16 @@ if (pos == Py_None) { /* Rewind the raw stream so that its position corresponds to the current logical position. */ - if (_Buffered_raw_seek(self, -RAW_OFFSET(self), 1) == -1) + if (_buffered_raw_seek(self, -RAW_OFFSET(self), 1) == -1) goto end; } - _BufferedReader_reset_buf(self); + _bufferedreader_reset_buf(self); } res = PyObject_CallMethodObjArgs(self->raw, _PyIO_str_truncate, pos, NULL); if (res == NULL) goto end; /* Reset cached position */ - if (_Buffered_raw_tell(self) == -1) + if (_buffered_raw_tell(self) == -1) PyErr_Clear(); end: @@ -1086,7 +1085,7 @@ } static PyObject * -Buffered_iternext(BufferedObject *self) +buffered_iternext(buffered *self) { PyObject *line; PyTypeObject *tp; @@ -1097,7 +1096,7 @@ if (tp == &PyBufferedReader_Type || tp == &PyBufferedRandom_Type) { /* Skip method call overhead for speed */ - line = _Buffered_readline(self, -1); + line = _buffered_readline(self, -1); } else { line = PyObject_CallMethodObjArgs((PyObject *)self, @@ -1124,7 +1123,7 @@ } static PyObject * -Buffered_repr(BufferedObject *self) +buffered_repr(buffered *self) { PyObject *nameobj, *res; @@ -1148,16 +1147,16 @@ * class BufferedReader */ -PyDoc_STRVAR(BufferedReader_doc, +PyDoc_STRVAR(bufferedreader_doc, "Create a new buffered reader using the given readable raw IO object."); -static void _BufferedReader_reset_buf(BufferedObject *self) +static void _bufferedreader_reset_buf(buffered *self) { self->read_end = -1; } static int -BufferedReader_init(BufferedObject *self, PyObject *args, PyObject *kwds) +bufferedreader_init(buffered *self, PyObject *args, PyObject *kwds) { char *kwlist[] = {"raw", "buffer_size", NULL}; Py_ssize_t buffer_size = DEFAULT_BUFFER_SIZE; @@ -1171,7 +1170,7 @@ return -1; } - if (_PyIOBase_checkReadable(raw, Py_True) == NULL) + if (_PyIOBase_check_readable(raw, Py_True) == NULL) return -1; Py_CLEAR(self->raw); @@ -1181,9 +1180,9 @@ self->readable = 1; self->writable = 0; - if (_Buffered_init(self) < 0) + if (_buffered_init(self) < 0) return -1; - _BufferedReader_reset_buf(self); + _bufferedreader_reset_buf(self); self->fast_closed_checks = (Py_TYPE(self) == &PyBufferedReader_Type && Py_TYPE(raw) == &PyFileIO_Type); @@ -1193,7 +1192,7 @@ } static Py_ssize_t -_BufferedReader_raw_read(BufferedObject *self, char *start, Py_ssize_t len) +_bufferedreader_raw_read(buffered *self, char *start, Py_ssize_t len) { Py_buffer buf; PyObject *memobj, *res; @@ -1227,7 +1226,7 @@ } static Py_ssize_t -_BufferedReader_fill_buffer(BufferedObject *self) +_bufferedreader_fill_buffer(buffered *self) { Py_ssize_t start, len, n; if (VALID_READ_BUFFER(self)) @@ -1235,7 +1234,7 @@ else start = 0; len = self->buffer_size - start; - n = _BufferedReader_raw_read(self, self->buffer + start, len); + n = _bufferedreader_raw_read(self, self->buffer + start, len); if (n <= 0) return n; self->read_end = start + n; @@ -1244,7 +1243,7 @@ } static PyObject * -_BufferedReader_read_all(BufferedObject *self) +_bufferedreader_read_all(buffered *self) { Py_ssize_t current_size; PyObject *res, *data = NULL; @@ -1263,10 +1262,10 @@ return NULL; } } - _BufferedReader_reset_buf(self); + _bufferedreader_reset_buf(self); /* We're going past the buffer's bounds, flush it */ if (self->writable) { - res = _BufferedWriter_flush_unlocked(self, 1); + res = _bufferedwriter_flush_unlocked(self, 1); if (res == NULL) { Py_DECREF(chunks); return NULL; @@ -1316,7 +1315,7 @@ /* Read n bytes from the buffer if it can, otherwise return None. This function is simple enough that it can run unlocked. */ static PyObject * -_BufferedReader_read_fast(BufferedObject *self, Py_ssize_t n) +_bufferedreader_read_fast(buffered *self, Py_ssize_t n) { Py_ssize_t current_size; @@ -1335,7 +1334,7 @@ * or until an EOF occurs or until read() would block. */ static PyObject * -_BufferedReader_read_generic(BufferedObject *self, Py_ssize_t n) +_bufferedreader_read_generic(buffered *self, Py_ssize_t n) { PyObject *res = NULL; Py_ssize_t current_size, remaining, written; @@ -1343,7 +1342,7 @@ current_size = Py_SAFE_DOWNCAST(READAHEAD(self), Py_off_t, Py_ssize_t); if (n <= current_size) - return _BufferedReader_read_fast(self, n); + return _bufferedreader_read_fast(self, n); res = PyBytes_FromStringAndSize(NULL, n); if (res == NULL) @@ -1356,14 +1355,14 @@ remaining -= current_size; written += current_size; } - _BufferedReader_reset_buf(self); + _bufferedreader_reset_buf(self); while (remaining > 0) { /* We want to read a whole block at the end into buffer. If we had readv() we could do this in one pass. */ Py_ssize_t r = MINUS_LAST_BLOCK(self, remaining); if (r == 0) break; - r = _BufferedReader_raw_read(self, out + written, r); + r = _bufferedreader_raw_read(self, out + written, r); if (r == -1) goto error; if (r == 0 || r == -2) { @@ -1385,7 +1384,7 @@ self->raw_pos = 0; self->read_end = 0; while (self->read_end < self->buffer_size) { - Py_ssize_t r = _BufferedReader_fill_buffer(self); + Py_ssize_t r = _bufferedreader_fill_buffer(self); if (r == -1) goto error; if (r == 0 || r == -2) { @@ -1423,7 +1422,7 @@ } static PyObject * -_BufferedReader_peek_unlocked(BufferedObject *self, Py_ssize_t n) +_bufferedreader_peek_unlocked(buffered *self, Py_ssize_t n) { Py_ssize_t have, r; @@ -1439,8 +1438,8 @@ } /* Fill the buffer from the raw stream, and copy it to the result. */ - _BufferedReader_reset_buf(self); - r = _BufferedReader_fill_buffer(self); + _bufferedreader_reset_buf(self); + r = _bufferedreader_fill_buffer(self); if (r == -1) return NULL; if (r == -2) @@ -1449,36 +1448,36 @@ return PyBytes_FromStringAndSize(self->buffer, r); } -static PyMethodDef BufferedReader_methods[] = { +static PyMethodDef bufferedreader_methods[] = { /* BufferedIOMixin methods */ - {"detach", (PyCFunction)BufferedIOMixin_detach, METH_NOARGS}, - {"flush", (PyCFunction)BufferedIOMixin_flush, METH_NOARGS}, - {"close", (PyCFunction)BufferedIOMixin_close, METH_NOARGS}, - {"seekable", (PyCFunction)BufferedIOMixin_seekable, METH_NOARGS}, - {"readable", (PyCFunction)BufferedIOMixin_readable, METH_NOARGS}, - {"writable", (PyCFunction)BufferedIOMixin_writable, METH_NOARGS}, - {"fileno", (PyCFunction)BufferedIOMixin_fileno, METH_NOARGS}, - {"isatty", (PyCFunction)BufferedIOMixin_isatty, METH_NOARGS}, - - {"read", (PyCFunction)Buffered_read, METH_VARARGS}, - {"peek", (PyCFunction)Buffered_peek, METH_VARARGS}, - {"read1", (PyCFunction)Buffered_read1, METH_VARARGS}, - {"readline", (PyCFunction)Buffered_readline, METH_VARARGS}, - {"seek", (PyCFunction)Buffered_seek, METH_VARARGS}, - {"tell", (PyCFunction)Buffered_tell, METH_NOARGS}, - {"truncate", (PyCFunction)Buffered_truncate, METH_VARARGS}, + {"detach", (PyCFunction)buffered_detach, METH_NOARGS}, + {"flush", (PyCFunction)buffered_simple_flush, METH_NOARGS}, + {"close", (PyCFunction)buffered_close, METH_NOARGS}, + {"seekable", (PyCFunction)buffered_seekable, METH_NOARGS}, + {"readable", (PyCFunction)buffered_readable, METH_NOARGS}, + {"writable", (PyCFunction)buffered_writable, METH_NOARGS}, + {"fileno", (PyCFunction)buffered_fileno, METH_NOARGS}, + {"isatty", (PyCFunction)buffered_isatty, METH_NOARGS}, + + {"read", (PyCFunction)buffered_read, METH_VARARGS}, + {"peek", (PyCFunction)buffered_peek, METH_VARARGS}, + {"read1", (PyCFunction)buffered_read1, METH_VARARGS}, + {"readline", (PyCFunction)buffered_readline, METH_VARARGS}, + {"seek", (PyCFunction)buffered_seek, METH_VARARGS}, + {"tell", (PyCFunction)buffered_tell, METH_NOARGS}, + {"truncate", (PyCFunction)buffered_truncate, METH_VARARGS}, {NULL, NULL} }; -static PyMemberDef BufferedReader_members[] = { - {"raw", T_OBJECT, offsetof(BufferedObject, raw), 0}, +static PyMemberDef bufferedreader_members[] = { + {"raw", T_OBJECT, offsetof(buffered, raw), 0}, {NULL} }; -static PyGetSetDef BufferedReader_getset[] = { - {"closed", (getter)BufferedIOMixin_closed_get, NULL, NULL}, - {"name", (getter)BufferedIOMixin_name_get, NULL, NULL}, - {"mode", (getter)BufferedIOMixin_mode_get, NULL, NULL}, +static PyGetSetDef bufferedreader_getset[] = { + {"closed", (getter)buffered_closed_get, NULL, NULL}, + {"name", (getter)buffered_name_get, NULL, NULL}, + {"mode", (getter)buffered_mode_get, NULL, NULL}, {NULL} }; @@ -1486,14 +1485,14 @@ PyTypeObject PyBufferedReader_Type = { PyVarObject_HEAD_INIT(NULL, 0) "_io.BufferedReader", /*tp_name*/ - sizeof(BufferedObject), /*tp_basicsize*/ + sizeof(buffered), /*tp_basicsize*/ 0, /*tp_itemsize*/ - (destructor)BufferedObject_dealloc, /*tp_dealloc*/ + (destructor)buffered_dealloc, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ 0, /*tp_compare */ - (reprfunc)Buffered_repr, /*tp_repr*/ + (reprfunc)buffered_repr, /*tp_repr*/ 0, /*tp_as_number*/ 0, /*tp_as_sequence*/ 0, /*tp_as_mapping*/ @@ -1505,22 +1504,22 @@ 0, /*tp_as_buffer*/ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE | Py_TPFLAGS_HAVE_GC, /*tp_flags*/ - BufferedReader_doc, /* tp_doc */ - (traverseproc)Buffered_traverse, /* tp_traverse */ - (inquiry)Buffered_clear, /* tp_clear */ + bufferedreader_doc, /* tp_doc */ + (traverseproc)buffered_traverse, /* tp_traverse */ + (inquiry)buffered_clear, /* tp_clear */ 0, /* tp_richcompare */ - offsetof(BufferedObject, weakreflist), /*tp_weaklistoffset*/ + offsetof(buffered, weakreflist), /*tp_weaklistoffset*/ 0, /* tp_iter */ - (iternextfunc)Buffered_iternext, /* tp_iternext */ - BufferedReader_methods, /* tp_methods */ - BufferedReader_members, /* tp_members */ - BufferedReader_getset, /* tp_getset */ + (iternextfunc)buffered_iternext, /* tp_iternext */ + bufferedreader_methods, /* tp_methods */ + bufferedreader_members, /* tp_members */ + bufferedreader_getset, /* tp_getset */ 0, /* tp_base */ 0, /* tp_dict */ 0, /* tp_descr_get */ 0, /* tp_descr_set */ - offsetof(BufferedObject, dict), /* tp_dictoffset */ - (initproc)BufferedReader_init, /* tp_init */ + offsetof(buffered, dict), /* tp_dictoffset */ + (initproc)bufferedreader_init, /* tp_init */ 0, /* tp_alloc */ PyType_GenericNew, /* tp_new */ }; @@ -1539,7 +1538,7 @@ /* * class BufferedWriter */ -PyDoc_STRVAR(BufferedWriter_doc, +PyDoc_STRVAR(bufferedwriter_doc, "A buffer for a writeable sequential RawIO object.\n" "\n" "The constructor creates a BufferedWriter for the given writeable raw\n" @@ -1548,14 +1547,14 @@ ); static void -_BufferedWriter_reset_buf(BufferedObject *self) +_bufferedwriter_reset_buf(buffered *self) { self->write_pos = 0; self->write_end = -1; } static int -BufferedWriter_init(BufferedObject *self, PyObject *args, PyObject *kwds) +bufferedwriter_init(buffered *self, PyObject *args, PyObject *kwds) { /* TODO: properly deprecate max_buffer_size */ char *kwlist[] = {"raw", "buffer_size", "max_buffer_size", NULL}; @@ -1574,7 +1573,7 @@ if (max_buffer_size != -234 && !complain_about_max_buffer_size()) return -1; - if (_PyIOBase_checkWritable(raw, Py_True) == NULL) + if (_PyIOBase_check_writable(raw, Py_True) == NULL) return -1; Py_CLEAR(self->raw); @@ -1584,9 +1583,9 @@ self->writable = 1; self->buffer_size = buffer_size; - if (_Buffered_init(self) < 0) + if (_buffered_init(self) < 0) return -1; - _BufferedWriter_reset_buf(self); + _bufferedwriter_reset_buf(self); self->pos = 0; self->fast_closed_checks = (Py_TYPE(self) == &PyBufferedWriter_Type && @@ -1597,7 +1596,7 @@ } static Py_ssize_t -_BufferedWriter_raw_write(BufferedObject *self, char *start, Py_ssize_t len) +_bufferedwriter_raw_write(buffered *self, char *start, Py_ssize_t len) { Py_buffer buf; PyObject *memobj, *res; @@ -1628,7 +1627,7 @@ /* `restore_pos` is 1 if we need to restore the raw stream position at the end, 0 otherwise. */ static PyObject * -_BufferedWriter_flush_unlocked(BufferedObject *self, int restore_pos) +_bufferedwriter_flush_unlocked(buffered *self, int restore_pos) { Py_ssize_t written = 0; Py_off_t n, rewind; @@ -1638,19 +1637,19 @@ /* First, rewind */ rewind = RAW_OFFSET(self) + (self->pos - self->write_pos); if (rewind != 0) { - n = _Buffered_raw_seek(self, -rewind, 1); + n = _buffered_raw_seek(self, -rewind, 1); if (n < 0) { goto error; } self->raw_pos -= rewind; } while (self->write_pos < self->write_end) { - n = _BufferedWriter_raw_write(self, + n = _bufferedwriter_raw_write(self, self->buffer + self->write_pos, Py_SAFE_DOWNCAST(self->write_end - self->write_pos, Py_off_t, Py_ssize_t)); if (n == -1) { - Py_ssize_t *w = _Buffered_check_blocking_error(); + Py_ssize_t *w = _buffered_check_blocking_error(); if (w == NULL) goto error; self->write_pos += *w; @@ -1668,14 +1667,14 @@ if (restore_pos) { Py_off_t forward = rewind - written; if (forward != 0) { - n = _Buffered_raw_seek(self, forward, 1); + n = _buffered_raw_seek(self, forward, 1); if (n < 0) { goto error; } self->raw_pos += forward; } } - _BufferedWriter_reset_buf(self); + _bufferedwriter_reset_buf(self); end: Py_RETURN_NONE; @@ -1685,7 +1684,7 @@ } static PyObject * -BufferedWriter_write(BufferedObject *self, PyObject *args) +bufferedwriter_write(buffered *self, PyObject *args) { PyObject *res = NULL; Py_buffer buf; @@ -1723,13 +1722,13 @@ } /* First write the current buffer */ - res = _BufferedWriter_flush_unlocked(self, 0); + res = _bufferedwriter_flush_unlocked(self, 0); if (res == NULL) { - Py_ssize_t *w = _Buffered_check_blocking_error(); + Py_ssize_t *w = _buffered_check_blocking_error(); if (w == NULL) goto error; if (self->readable) - _BufferedReader_reset_buf(self); + _bufferedreader_reset_buf(self); /* Make some place by shifting the buffer. */ assert(VALID_WRITE_BUFFER(self)); memmove(self->buffer, self->buffer + self->write_pos, @@ -1762,10 +1761,10 @@ remaining = buf.len; written = 0; while (remaining > self->buffer_size) { - n = _BufferedWriter_raw_write( + n = _bufferedwriter_raw_write( self, (char *) buf.buf + written, buf.len - written); if (n == -1) { - Py_ssize_t *w = _Buffered_check_blocking_error(); + Py_ssize_t *w = _buffered_check_blocking_error(); if (w == NULL) goto error; written += *w; @@ -1788,7 +1787,7 @@ remaining -= n; } if (self->readable) - _BufferedReader_reset_buf(self); + _bufferedreader_reset_buf(self); if (remaining > 0) { memcpy(self->buffer, (char *) buf.buf + written, remaining); written += remaining; @@ -1808,33 +1807,33 @@ return res; } -static PyMethodDef BufferedWriter_methods[] = { +static PyMethodDef bufferedwriter_methods[] = { /* BufferedIOMixin methods */ - {"close", (PyCFunction)BufferedIOMixin_close, METH_NOARGS}, - {"detach", (PyCFunction)BufferedIOMixin_detach, METH_NOARGS}, - {"seekable", (PyCFunction)BufferedIOMixin_seekable, METH_NOARGS}, - {"readable", (PyCFunction)BufferedIOMixin_readable, METH_NOARGS}, - {"writable", (PyCFunction)BufferedIOMixin_writable, METH_NOARGS}, - {"fileno", (PyCFunction)BufferedIOMixin_fileno, METH_NOARGS}, - {"isatty", (PyCFunction)BufferedIOMixin_isatty, METH_NOARGS}, - - {"write", (PyCFunction)BufferedWriter_write, METH_VARARGS}, - {"truncate", (PyCFunction)Buffered_truncate, METH_VARARGS}, - {"flush", (PyCFunction)Buffered_flush, METH_NOARGS}, - {"seek", (PyCFunction)Buffered_seek, METH_VARARGS}, - {"tell", (PyCFunction)Buffered_tell, METH_NOARGS}, + {"close", (PyCFunction)buffered_close, METH_NOARGS}, + {"detach", (PyCFunction)buffered_detach, METH_NOARGS}, + {"seekable", (PyCFunction)buffered_seekable, METH_NOARGS}, + {"readable", (PyCFunction)buffered_readable, METH_NOARGS}, + {"writable", (PyCFunction)buffered_writable, METH_NOARGS}, + {"fileno", (PyCFunction)buffered_fileno, METH_NOARGS}, + {"isatty", (PyCFunction)buffered_isatty, METH_NOARGS}, + + {"write", (PyCFunction)bufferedwriter_write, METH_VARARGS}, + {"truncate", (PyCFunction)buffered_truncate, METH_VARARGS}, + {"flush", (PyCFunction)buffered_flush, METH_NOARGS}, + {"seek", (PyCFunction)buffered_seek, METH_VARARGS}, + {"tell", (PyCFunction)buffered_tell, METH_NOARGS}, {NULL, NULL} }; -static PyMemberDef BufferedWriter_members[] = { - {"raw", T_OBJECT, offsetof(BufferedObject, raw), 0}, +static PyMemberDef bufferedwriter_members[] = { + {"raw", T_OBJECT, offsetof(buffered, raw), 0}, {NULL} }; -static PyGetSetDef BufferedWriter_getset[] = { - {"closed", (getter)BufferedIOMixin_closed_get, NULL, NULL}, - {"name", (getter)BufferedIOMixin_name_get, NULL, NULL}, - {"mode", (getter)BufferedIOMixin_mode_get, NULL, NULL}, +static PyGetSetDef bufferedwriter_getset[] = { + {"closed", (getter)buffered_closed_get, NULL, NULL}, + {"name", (getter)buffered_name_get, NULL, NULL}, + {"mode", (getter)buffered_mode_get, NULL, NULL}, {NULL} }; @@ -1842,14 +1841,14 @@ PyTypeObject PyBufferedWriter_Type = { PyVarObject_HEAD_INIT(NULL, 0) "_io.BufferedWriter", /*tp_name*/ - sizeof(BufferedObject), /*tp_basicsize*/ + sizeof(buffered), /*tp_basicsize*/ 0, /*tp_itemsize*/ - (destructor)BufferedObject_dealloc, /*tp_dealloc*/ + (destructor)buffered_dealloc, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ 0, /*tp_compare */ - (reprfunc)Buffered_repr, /*tp_repr*/ + (reprfunc)buffered_repr, /*tp_repr*/ 0, /*tp_as_number*/ 0, /*tp_as_sequence*/ 0, /*tp_as_mapping*/ @@ -1861,22 +1860,22 @@ 0, /*tp_as_buffer*/ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE | Py_TPFLAGS_HAVE_GC, /*tp_flags*/ - BufferedWriter_doc, /* tp_doc */ - (traverseproc)Buffered_traverse, /* tp_traverse */ - (inquiry)Buffered_clear, /* tp_clear */ + bufferedwriter_doc, /* tp_doc */ + (traverseproc)buffered_traverse, /* tp_traverse */ + (inquiry)buffered_clear, /* tp_clear */ 0, /* tp_richcompare */ - offsetof(BufferedObject, weakreflist), /*tp_weaklistoffset*/ + offsetof(buffered, weakreflist), /*tp_weaklistoffset*/ 0, /* tp_iter */ 0, /* tp_iternext */ - BufferedWriter_methods, /* tp_methods */ - BufferedWriter_members, /* tp_members */ - BufferedWriter_getset, /* tp_getset */ + bufferedwriter_methods, /* tp_methods */ + bufferedwriter_members, /* tp_members */ + bufferedwriter_getset, /* tp_getset */ 0, /* tp_base */ 0, /* tp_dict */ 0, /* tp_descr_get */ 0, /* tp_descr_set */ - offsetof(BufferedObject, dict), /* tp_dictoffset */ - (initproc)BufferedWriter_init, /* tp_init */ + offsetof(buffered, dict), /* tp_dictoffset */ + (initproc)bufferedwriter_init, /* tp_init */ 0, /* tp_alloc */ PyType_GenericNew, /* tp_new */ }; @@ -1887,7 +1886,7 @@ * BufferedRWPair */ -PyDoc_STRVAR(BufferedRWPair_doc, +PyDoc_STRVAR(bufferedrwpair_doc, "A buffered reader and writer object together.\n" "\n" "A buffered reader object and buffered writer object put together to\n" @@ -1905,15 +1904,14 @@ typedef struct { PyObject_HEAD - BufferedObject *reader; - BufferedObject *writer; + buffered *reader; + buffered *writer; PyObject *dict; PyObject *weakreflist; -} BufferedRWPairObject; +} rwpair; static int -BufferedRWPair_init(BufferedRWPairObject *self, PyObject *args, - PyObject *kwds) +bufferedrwpair_init(rwpair *self, PyObject *args, PyObject *kwds) { PyObject *reader, *writer; Py_ssize_t buffer_size = DEFAULT_BUFFER_SIZE; @@ -1927,17 +1925,17 @@ if (max_buffer_size != -234 && !complain_about_max_buffer_size()) return -1; - if (_PyIOBase_checkReadable(reader, Py_True) == NULL) + if (_PyIOBase_check_readable(reader, Py_True) == NULL) return -1; - if (_PyIOBase_checkWritable(writer, Py_True) == NULL) + if (_PyIOBase_check_writable(writer, Py_True) == NULL) return -1; - self->reader = (BufferedObject *) PyObject_CallFunction( + self->reader = (buffered *) PyObject_CallFunction( (PyObject *) &PyBufferedReader_Type, "On", reader, buffer_size); if (self->reader == NULL) return -1; - self->writer = (BufferedObject *) PyObject_CallFunction( + self->writer = (buffered *) PyObject_CallFunction( (PyObject *) &PyBufferedWriter_Type, "On", writer, buffer_size); if (self->writer == NULL) { Py_CLEAR(self->reader); @@ -1948,14 +1946,14 @@ } static int -BufferedRWPair_traverse(BufferedRWPairObject *self, visitproc visit, void *arg) +bufferedrwpair_traverse(rwpair *self, visitproc visit, void *arg) { Py_VISIT(self->dict); return 0; } static int -BufferedRWPair_clear(BufferedRWPairObject *self) +bufferedrwpair_clear(rwpair *self) { Py_CLEAR(self->reader); Py_CLEAR(self->writer); @@ -1964,7 +1962,7 @@ } static void -BufferedRWPair_dealloc(BufferedRWPairObject *self) +bufferedrwpair_dealloc(rwpair *self) { _PyObject_GC_UNTRACK(self); Py_CLEAR(self->reader); @@ -1974,7 +1972,7 @@ } static PyObject * -_forward_call(BufferedObject *self, const char *name, PyObject *args) +_forward_call(buffered *self, const char *name, PyObject *args) { PyObject *func = PyObject_GetAttrString((PyObject *)self, name); PyObject *ret; @@ -1990,55 +1988,55 @@ } static PyObject * -BufferedRWPair_read(BufferedRWPairObject *self, PyObject *args) +bufferedrwpair_read(rwpair *self, PyObject *args) { return _forward_call(self->reader, "read", args); } static PyObject * -BufferedRWPair_peek(BufferedRWPairObject *self, PyObject *args) +bufferedrwpair_peek(rwpair *self, PyObject *args) { return _forward_call(self->reader, "peek", args); } static PyObject * -BufferedRWPair_read1(BufferedRWPairObject *self, PyObject *args) +bufferedrwpair_read1(rwpair *self, PyObject *args) { return _forward_call(self->reader, "read1", args); } static PyObject * -BufferedRWPair_readinto(BufferedRWPairObject *self, PyObject *args) +bufferedrwpair_readinto(rwpair *self, PyObject *args) { return _forward_call(self->reader, "readinto", args); } static PyObject * -BufferedRWPair_write(BufferedRWPairObject *self, PyObject *args) +bufferedrwpair_write(rwpair *self, PyObject *args) { return _forward_call(self->writer, "write", args); } static PyObject * -BufferedRWPair_flush(BufferedRWPairObject *self, PyObject *args) +bufferedrwpair_flush(rwpair *self, PyObject *args) { return _forward_call(self->writer, "flush", args); } static PyObject * -BufferedRWPair_readable(BufferedRWPairObject *self, PyObject *args) +bufferedrwpair_readable(rwpair *self, PyObject *args) { return _forward_call(self->reader, "readable", args); } static PyObject * -BufferedRWPair_writable(BufferedRWPairObject *self, PyObject *args) +bufferedrwpair_writable(rwpair *self, PyObject *args) { return _forward_call(self->writer, "writable", args); } static PyObject * -BufferedRWPair_close(BufferedRWPairObject *self, PyObject *args) +bufferedrwpair_close(rwpair *self, PyObject *args) { PyObject *ret = _forward_call(self->writer, "close", args); if (ret == NULL) @@ -2049,7 +2047,7 @@ } static PyObject * -BufferedRWPair_isatty(BufferedRWPairObject *self, PyObject *args) +bufferedrwpair_isatty(rwpair *self, PyObject *args) { PyObject *ret = _forward_call(self->writer, "isatty", args); @@ -2063,40 +2061,40 @@ } static PyObject * -BufferedRWPair_closed_get(BufferedRWPairObject *self, void *context) +bufferedrwpair_closed_get(rwpair *self, void *context) { return PyObject_GetAttr((PyObject *) self->writer, _PyIO_str_closed); } -static PyMethodDef BufferedRWPair_methods[] = { - {"read", (PyCFunction)BufferedRWPair_read, METH_VARARGS}, - {"peek", (PyCFunction)BufferedRWPair_peek, METH_VARARGS}, - {"read1", (PyCFunction)BufferedRWPair_read1, METH_VARARGS}, - {"readinto", (PyCFunction)BufferedRWPair_readinto, METH_VARARGS}, +static PyMethodDef bufferedrwpair_methods[] = { + {"read", (PyCFunction)bufferedrwpair_read, METH_VARARGS}, + {"peek", (PyCFunction)bufferedrwpair_peek, METH_VARARGS}, + {"read1", (PyCFunction)bufferedrwpair_read1, METH_VARARGS}, + {"readinto", (PyCFunction)bufferedrwpair_readinto, METH_VARARGS}, - {"write", (PyCFunction)BufferedRWPair_write, METH_VARARGS}, - {"flush", (PyCFunction)BufferedRWPair_flush, METH_NOARGS}, + {"write", (PyCFunction)bufferedrwpair_write, METH_VARARGS}, + {"flush", (PyCFunction)bufferedrwpair_flush, METH_NOARGS}, - {"readable", (PyCFunction)BufferedRWPair_readable, METH_NOARGS}, - {"writable", (PyCFunction)BufferedRWPair_writable, METH_NOARGS}, + {"readable", (PyCFunction)bufferedrwpair_readable, METH_NOARGS}, + {"writable", (PyCFunction)bufferedrwpair_writable, METH_NOARGS}, - {"close", (PyCFunction)BufferedRWPair_close, METH_NOARGS}, - {"isatty", (PyCFunction)BufferedRWPair_isatty, METH_NOARGS}, + {"close", (PyCFunction)bufferedrwpair_close, METH_NOARGS}, + {"isatty", (PyCFunction)bufferedrwpair_isatty, METH_NOARGS}, {NULL, NULL} }; -static PyGetSetDef BufferedRWPair_getset[] = { - {"closed", (getter)BufferedRWPair_closed_get, NULL, NULL}, +static PyGetSetDef bufferedrwpair_getset[] = { + {"closed", (getter)bufferedrwpair_closed_get, NULL, NULL}, {NULL} }; PyTypeObject PyBufferedRWPair_Type = { PyVarObject_HEAD_INIT(NULL, 0) "_io.BufferedRWPair", /*tp_name*/ - sizeof(BufferedRWPairObject), /*tp_basicsize*/ + sizeof(rwpair), /*tp_basicsize*/ 0, /*tp_itemsize*/ - (destructor)BufferedRWPair_dealloc, /*tp_dealloc*/ + (destructor)bufferedrwpair_dealloc, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ @@ -2113,22 +2111,22 @@ 0, /*tp_as_buffer*/ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE | Py_TPFLAGS_HAVE_GC, /* tp_flags */ - BufferedRWPair_doc, /* tp_doc */ - (traverseproc)BufferedRWPair_traverse, /* tp_traverse */ - (inquiry)BufferedRWPair_clear, /* tp_clear */ + bufferedrwpair_doc, /* tp_doc */ + (traverseproc)bufferedrwpair_traverse, /* tp_traverse */ + (inquiry)bufferedrwpair_clear, /* tp_clear */ 0, /* tp_richcompare */ - offsetof(BufferedRWPairObject, weakreflist), /*tp_weaklistoffset*/ + offsetof(rwpair, weakreflist), /*tp_weaklistoffset*/ 0, /* tp_iter */ 0, /* tp_iternext */ - BufferedRWPair_methods, /* tp_methods */ + bufferedrwpair_methods, /* tp_methods */ 0, /* tp_members */ - BufferedRWPair_getset, /* tp_getset */ + bufferedrwpair_getset, /* tp_getset */ 0, /* tp_base */ 0, /* tp_dict */ 0, /* tp_descr_get */ 0, /* tp_descr_set */ - offsetof(BufferedRWPairObject, dict), /* tp_dictoffset */ - (initproc)BufferedRWPair_init, /* tp_init */ + offsetof(rwpair, dict), /* tp_dictoffset */ + (initproc)bufferedrwpair_init, /* tp_init */ 0, /* tp_alloc */ PyType_GenericNew, /* tp_new */ }; @@ -2139,7 +2137,7 @@ * BufferedRandom */ -PyDoc_STRVAR(BufferedRandom_doc, +PyDoc_STRVAR(bufferedrandom_doc, "A buffered interface to random access streams.\n" "\n" "The constructor creates a reader and writer for a seekable stream,\n" @@ -2148,7 +2146,7 @@ ); static int -BufferedRandom_init(BufferedObject *self, PyObject *args, PyObject *kwds) +bufferedrandom_init(buffered *self, PyObject *args, PyObject *kwds) { char *kwlist[] = {"raw", "buffer_size", "max_buffer_size", NULL}; Py_ssize_t buffer_size = DEFAULT_BUFFER_SIZE; @@ -2166,11 +2164,11 @@ if (max_buffer_size != -234 && !complain_about_max_buffer_size()) return -1; - if (_PyIOBase_checkSeekable(raw, Py_True) == NULL) + if (_PyIOBase_check_seekable(raw, Py_True) == NULL) return -1; - if (_PyIOBase_checkReadable(raw, Py_True) == NULL) + if (_PyIOBase_check_readable(raw, Py_True) == NULL) return -1; - if (_PyIOBase_checkWritable(raw, Py_True) == NULL) + if (_PyIOBase_check_writable(raw, Py_True) == NULL) return -1; Py_CLEAR(self->raw); @@ -2180,10 +2178,10 @@ self->readable = 1; self->writable = 1; - if (_Buffered_init(self) < 0) + if (_buffered_init(self) < 0) return -1; - _BufferedReader_reset_buf(self); - _BufferedWriter_reset_buf(self); + _bufferedreader_reset_buf(self); + _bufferedwriter_reset_buf(self); self->pos = 0; self->fast_closed_checks = (Py_TYPE(self) == &PyBufferedRandom_Type && @@ -2193,39 +2191,39 @@ return 0; } -static PyMethodDef BufferedRandom_methods[] = { +static PyMethodDef bufferedrandom_methods[] = { /* BufferedIOMixin methods */ - {"close", (PyCFunction)BufferedIOMixin_close, METH_NOARGS}, - {"detach", (PyCFunction)BufferedIOMixin_detach, METH_NOARGS}, - {"seekable", (PyCFunction)BufferedIOMixin_seekable, METH_NOARGS}, - {"readable", (PyCFunction)BufferedIOMixin_readable, METH_NOARGS}, - {"writable", (PyCFunction)BufferedIOMixin_writable, METH_NOARGS}, - {"fileno", (PyCFunction)BufferedIOMixin_fileno, METH_NOARGS}, - {"isatty", (PyCFunction)BufferedIOMixin_isatty, METH_NOARGS}, - - {"flush", (PyCFunction)Buffered_flush, METH_NOARGS}, - - {"seek", (PyCFunction)Buffered_seek, METH_VARARGS}, - {"tell", (PyCFunction)Buffered_tell, METH_NOARGS}, - {"truncate", (PyCFunction)Buffered_truncate, METH_VARARGS}, - {"read", (PyCFunction)Buffered_read, METH_VARARGS}, - {"read1", (PyCFunction)Buffered_read1, METH_VARARGS}, - {"readinto", (PyCFunction)Buffered_readinto, METH_VARARGS}, - {"readline", (PyCFunction)Buffered_readline, METH_VARARGS}, - {"peek", (PyCFunction)Buffered_peek, METH_VARARGS}, - {"write", (PyCFunction)BufferedWriter_write, METH_VARARGS}, + {"close", (PyCFunction)buffered_close, METH_NOARGS}, + {"detach", (PyCFunction)buffered_detach, METH_NOARGS}, + {"seekable", (PyCFunction)buffered_seekable, METH_NOARGS}, + {"readable", (PyCFunction)buffered_readable, METH_NOARGS}, + {"writable", (PyCFunction)buffered_writable, METH_NOARGS}, + {"fileno", (PyCFunction)buffered_fileno, METH_NOARGS}, + {"isatty", (PyCFunction)buffered_isatty, METH_NOARGS}, + + {"flush", (PyCFunction)buffered_flush, METH_NOARGS}, + + {"seek", (PyCFunction)buffered_seek, METH_VARARGS}, + {"tell", (PyCFunction)buffered_tell, METH_NOARGS}, + {"truncate", (PyCFunction)buffered_truncate, METH_VARARGS}, + {"read", (PyCFunction)buffered_read, METH_VARARGS}, + {"read1", (PyCFunction)buffered_read1, METH_VARARGS}, + {"readinto", (PyCFunction)buffered_readinto, METH_VARARGS}, + {"readline", (PyCFunction)buffered_readline, METH_VARARGS}, + {"peek", (PyCFunction)buffered_peek, METH_VARARGS}, + {"write", (PyCFunction)bufferedwriter_write, METH_VARARGS}, {NULL, NULL} }; -static PyMemberDef BufferedRandom_members[] = { - {"raw", T_OBJECT, offsetof(BufferedObject, raw), 0}, +static PyMemberDef bufferedrandom_members[] = { + {"raw", T_OBJECT, offsetof(buffered, raw), 0}, {NULL} }; -static PyGetSetDef BufferedRandom_getset[] = { - {"closed", (getter)BufferedIOMixin_closed_get, NULL, NULL}, - {"name", (getter)BufferedIOMixin_name_get, NULL, NULL}, - {"mode", (getter)BufferedIOMixin_mode_get, NULL, NULL}, +static PyGetSetDef bufferedrandom_getset[] = { + {"closed", (getter)buffered_closed_get, NULL, NULL}, + {"name", (getter)buffered_name_get, NULL, NULL}, + {"mode", (getter)buffered_mode_get, NULL, NULL}, {NULL} }; @@ -2233,14 +2231,14 @@ PyTypeObject PyBufferedRandom_Type = { PyVarObject_HEAD_INIT(NULL, 0) "_io.BufferedRandom", /*tp_name*/ - sizeof(BufferedObject), /*tp_basicsize*/ + sizeof(buffered), /*tp_basicsize*/ 0, /*tp_itemsize*/ - (destructor)BufferedObject_dealloc, /*tp_dealloc*/ + (destructor)buffered_dealloc, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ 0, /*tp_compare */ - (reprfunc)Buffered_repr, /*tp_repr*/ + (reprfunc)buffered_repr, /*tp_repr*/ 0, /*tp_as_number*/ 0, /*tp_as_sequence*/ 0, /*tp_as_mapping*/ @@ -2252,22 +2250,22 @@ 0, /*tp_as_buffer*/ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE | Py_TPFLAGS_HAVE_GC, /*tp_flags*/ - BufferedRandom_doc, /* tp_doc */ - (traverseproc)Buffered_traverse, /* tp_traverse */ - (inquiry)Buffered_clear, /* tp_clear */ + bufferedrandom_doc, /* tp_doc */ + (traverseproc)buffered_traverse, /* tp_traverse */ + (inquiry)buffered_clear, /* tp_clear */ 0, /* tp_richcompare */ - offsetof(BufferedObject, weakreflist), /*tp_weaklistoffset*/ + offsetof(buffered, weakreflist), /*tp_weaklistoffset*/ 0, /* tp_iter */ - (iternextfunc)Buffered_iternext, /* tp_iternext */ - BufferedRandom_methods, /* tp_methods */ - BufferedRandom_members, /* tp_members */ - BufferedRandom_getset, /* tp_getset */ + (iternextfunc)buffered_iternext, /* tp_iternext */ + bufferedrandom_methods, /* tp_methods */ + bufferedrandom_members, /* tp_members */ + bufferedrandom_getset, /* tp_getset */ 0, /* tp_base */ 0, /*tp_dict*/ 0, /* tp_descr_get */ 0, /* tp_descr_set */ - offsetof(BufferedObject, dict), /*tp_dictoffset*/ - (initproc)BufferedRandom_init, /* tp_init */ + offsetof(buffered, dict), /*tp_dictoffset*/ + (initproc)bufferedrandom_init, /* tp_init */ 0, /* tp_alloc */ PyType_GenericNew, /* tp_new */ }; Modified: python/branches/py3k/Modules/_io/bytesio.c ============================================================================== --- python/branches/py3k/Modules/_io/bytesio.c (original) +++ python/branches/py3k/Modules/_io/bytesio.c Fri Jun 12 04:07:12 2009 @@ -10,7 +10,7 @@ size_t buf_size; PyObject *dict; PyObject *weakreflist; -} BytesIOObject; +} bytesio; #define CHECK_CLOSED(self) \ if ((self)->buf == NULL) { \ @@ -23,7 +23,7 @@ object. Returns the length between the current position to the next newline character. */ static Py_ssize_t -get_line(BytesIOObject *self, char **output) +get_line(bytesio *self, char **output) { char *n; const char *str_end; @@ -56,7 +56,7 @@ The caller should ensure that the 'size' argument is non-negative. Returns 0 on success, -1 otherwise. */ static int -resize_buffer(BytesIOObject *self, size_t size) +resize_buffer(bytesio *self, size_t size) { /* Here, unsigned types are used to avoid dealing with signed integer overflow, which is undefined in C. */ @@ -108,7 +108,7 @@ /* Internal routine for writing a string of bytes to the buffer of a BytesIO object. Returns the number of bytes wrote, or -1 on error. */ static Py_ssize_t -write_bytes(BytesIOObject *self, const char *bytes, Py_ssize_t len) +write_bytes(bytesio *self, const char *bytes, Py_ssize_t len) { assert(self->buf != NULL); assert(self->pos >= 0); @@ -146,7 +146,7 @@ } static PyObject * -bytesio_get_closed(BytesIOObject *self) +bytesio_get_closed(bytesio *self) { if (self->buf == NULL) { Py_RETURN_TRUE; @@ -158,7 +158,7 @@ /* Generic getter for the writable, readable and seekable properties */ static PyObject * -return_true(BytesIOObject *self) +return_true(bytesio *self) { Py_RETURN_TRUE; } @@ -167,7 +167,7 @@ "flush() -> None. Does nothing."); static PyObject * -bytesio_flush(BytesIOObject *self) +bytesio_flush(bytesio *self) { Py_RETURN_NONE; } @@ -178,7 +178,7 @@ "Retrieve the entire contents of the BytesIO object."); static PyObject * -bytesio_getvalue(BytesIOObject *self) +bytesio_getvalue(bytesio *self) { CHECK_CLOSED(self); return PyBytes_FromStringAndSize(self->buf, self->string_size); @@ -191,7 +191,7 @@ "to a tty-like device."); static PyObject * -bytesio_isatty(BytesIOObject *self) +bytesio_isatty(bytesio *self) { CHECK_CLOSED(self); Py_RETURN_FALSE; @@ -201,7 +201,7 @@ "tell() -> current file position, an integer\n"); static PyObject * -bytesio_tell(BytesIOObject *self) +bytesio_tell(bytesio *self) { CHECK_CLOSED(self); return PyLong_FromSsize_t(self->pos); @@ -214,7 +214,7 @@ "Return an empty string at EOF."); static PyObject * -bytesio_read(BytesIOObject *self, PyObject *args) +bytesio_read(bytesio *self, PyObject *args) { Py_ssize_t size, n; char *output; @@ -263,7 +263,7 @@ "Return an empty string at EOF."); static PyObject * -bytesio_read1(BytesIOObject *self, PyObject *n) +bytesio_read1(bytesio *self, PyObject *n) { PyObject *arg, *res; @@ -283,7 +283,7 @@ "Return an empty string at EOF.\n"); static PyObject * -bytesio_readline(BytesIOObject *self, PyObject *args) +bytesio_readline(bytesio *self, PyObject *args) { Py_ssize_t size, n; char *output; @@ -328,7 +328,7 @@ "total number of bytes in the lines returned.\n"); static PyObject * -bytesio_readlines(BytesIOObject *self, PyObject *args) +bytesio_readlines(bytesio *self, PyObject *args) { Py_ssize_t maxsize, size, n; PyObject *result, *line; @@ -387,7 +387,7 @@ "is set not to block as has no data to read."); static PyObject * -bytesio_readinto(BytesIOObject *self, PyObject *buffer) +bytesio_readinto(bytesio *self, PyObject *buffer) { void *raw_buffer; Py_ssize_t len; @@ -415,7 +415,7 @@ "Returns the new size. Imply an absolute seek to the position size."); static PyObject * -bytesio_truncate(BytesIOObject *self, PyObject *args) +bytesio_truncate(bytesio *self, PyObject *args) { Py_ssize_t size; PyObject *arg = Py_None; @@ -457,7 +457,7 @@ } static PyObject * -bytesio_iternext(BytesIOObject *self) +bytesio_iternext(bytesio *self) { char *next; Py_ssize_t n; @@ -482,7 +482,7 @@ "Returns the new absolute position."); static PyObject * -bytesio_seek(BytesIOObject *self, PyObject *args) +bytesio_seek(bytesio *self, PyObject *args) { Py_ssize_t pos; int mode = 0; @@ -536,7 +536,7 @@ "Return the number of bytes written."); static PyObject * -bytesio_write(BytesIOObject *self, PyObject *obj) +bytesio_write(bytesio *self, PyObject *obj) { Py_ssize_t n = 0; Py_buffer buf; @@ -564,7 +564,7 @@ "each string."); static PyObject * -bytesio_writelines(BytesIOObject *self, PyObject *v) +bytesio_writelines(bytesio *self, PyObject *v) { PyObject *it, *item; PyObject *ret; @@ -597,7 +597,7 @@ "close() -> None. Disable all I/O operations."); static PyObject * -bytesio_close(BytesIOObject *self) +bytesio_close(bytesio *self) { if (self->buf != NULL) { PyMem_Free(self->buf); @@ -607,7 +607,7 @@ } static void -bytesio_dealloc(BytesIOObject *self) +bytesio_dealloc(bytesio *self) { if (self->buf != NULL) { PyMem_Free(self->buf); @@ -620,10 +620,10 @@ static PyObject * bytesio_new(PyTypeObject *type, PyObject *args, PyObject *kwds) { - BytesIOObject *self; + bytesio *self; assert(type != NULL && type->tp_alloc != NULL); - self = (BytesIOObject *)type->tp_alloc(type, 0); + self = (bytesio *)type->tp_alloc(type, 0); if (self == NULL) return NULL; @@ -640,7 +640,7 @@ } static int -bytesio_init(BytesIOObject *self, PyObject *args, PyObject *kwds) +bytesio_init(bytesio *self, PyObject *args, PyObject *kwds) { PyObject *initvalue = NULL; @@ -664,7 +664,7 @@ } static int -bytesio_traverse(BytesIOObject *self, visitproc visit, void *arg) +bytesio_traverse(bytesio *self, visitproc visit, void *arg) { Py_VISIT(self->dict); Py_VISIT(self->weakreflist); @@ -672,7 +672,7 @@ } static int -bytesio_clear(BytesIOObject *self) +bytesio_clear(bytesio *self) { Py_CLEAR(self->dict); if (self->weakreflist != NULL) @@ -717,7 +717,7 @@ PyTypeObject PyBytesIO_Type = { PyVarObject_HEAD_INIT(NULL, 0) "_io.BytesIO", /*tp_name*/ - sizeof(BytesIOObject), /*tp_basicsize*/ + sizeof(bytesio), /*tp_basicsize*/ 0, /*tp_itemsize*/ (destructor)bytesio_dealloc, /*tp_dealloc*/ 0, /*tp_print*/ @@ -740,7 +740,7 @@ (traverseproc)bytesio_traverse, /*tp_traverse*/ (inquiry)bytesio_clear, /*tp_clear*/ 0, /*tp_richcompare*/ - offsetof(BytesIOObject, weakreflist), /*tp_weaklistoffset*/ + offsetof(bytesio, weakreflist), /*tp_weaklistoffset*/ PyObject_SelfIter, /*tp_iter*/ (iternextfunc)bytesio_iternext, /*tp_iternext*/ bytesio_methods, /*tp_methods*/ @@ -750,7 +750,7 @@ 0, /*tp_dict*/ 0, /*tp_descr_get*/ 0, /*tp_descr_set*/ - offsetof(BytesIOObject, dict), /*tp_dictoffset*/ + offsetof(bytesio, dict), /*tp_dictoffset*/ (initproc)bytesio_init, /*tp_init*/ 0, /*tp_alloc*/ bytesio_new, /*tp_new*/ Modified: python/branches/py3k/Modules/_io/fileio.c ============================================================================== --- python/branches/py3k/Modules/_io/fileio.c (original) +++ python/branches/py3k/Modules/_io/fileio.c Fri Jun 12 04:07:12 2009 @@ -51,7 +51,7 @@ int closefd : 1; PyObject *weakreflist; PyObject *dict; -} PyFileIOObject; +} fileio; PyTypeObject PyFileIO_Type; @@ -60,7 +60,7 @@ int _PyFileIO_closed(PyObject *self) { - return ((PyFileIOObject *)self)->fd < 0; + return ((fileio *)self)->fd < 0; } static PyObject * @@ -70,7 +70,7 @@ /* Returns 0 on success, -1 with exception set on failure. */ static int -internal_close(PyFileIOObject *self) +internal_close(fileio *self) { int err = 0; int save_errno = 0; @@ -98,7 +98,7 @@ } static PyObject * -fileio_close(PyFileIOObject *self) +fileio_close(fileio *self) { if (!self->closefd) { self->fd = -1; @@ -115,11 +115,11 @@ static PyObject * fileio_new(PyTypeObject *type, PyObject *args, PyObject *kwds) { - PyFileIOObject *self; + fileio *self; assert(type != NULL && type->tp_alloc != NULL); - self = (PyFileIOObject *) type->tp_alloc(type, 0); + self = (fileio *) type->tp_alloc(type, 0); if (self != NULL) { self->fd = -1; self->readable = 0; @@ -137,7 +137,7 @@ directories, so we need a check. */ static int -dircheck(PyFileIOObject* self, const char *name) +dircheck(fileio* self, const char *name) { #if defined(HAVE_FSTAT) && defined(S_IFDIR) && defined(EISDIR) struct stat buf; @@ -181,7 +181,7 @@ static int fileio_init(PyObject *oself, PyObject *args, PyObject *kwds) { - PyFileIOObject *self = (PyFileIOObject *) oself; + fileio *self = (fileio *) oself; static char *kwlist[] = {"file", "mode", "closefd", NULL}; const char *name = NULL; PyObject *nameobj, *stringobj = NULL; @@ -380,21 +380,21 @@ } static int -fileio_traverse(PyFileIOObject *self, visitproc visit, void *arg) +fileio_traverse(fileio *self, visitproc visit, void *arg) { Py_VISIT(self->dict); return 0; } static int -fileio_clear(PyFileIOObject *self) +fileio_clear(fileio *self) { Py_CLEAR(self->dict); return 0; } static void -fileio_dealloc(PyFileIOObject *self) +fileio_dealloc(fileio *self) { if (_PyIOBase_finalize((PyObject *) self) < 0) return; @@ -420,7 +420,7 @@ } static PyObject * -fileio_fileno(PyFileIOObject *self) +fileio_fileno(fileio *self) { if (self->fd < 0) return err_closed(); @@ -428,7 +428,7 @@ } static PyObject * -fileio_readable(PyFileIOObject *self) +fileio_readable(fileio *self) { if (self->fd < 0) return err_closed(); @@ -436,7 +436,7 @@ } static PyObject * -fileio_writable(PyFileIOObject *self) +fileio_writable(fileio *self) { if (self->fd < 0) return err_closed(); @@ -444,7 +444,7 @@ } static PyObject * -fileio_seekable(PyFileIOObject *self) +fileio_seekable(fileio *self) { if (self->fd < 0) return err_closed(); @@ -462,7 +462,7 @@ } static PyObject * -fileio_readinto(PyFileIOObject *self, PyObject *args) +fileio_readinto(fileio *self, PyObject *args) { Py_buffer pbuf; Py_ssize_t n; @@ -494,7 +494,7 @@ } static size_t -new_buffersize(PyFileIOObject *self, size_t currentsize) +new_buffersize(fileio *self, size_t currentsize) { #ifdef HAVE_FSTAT off_t pos, end; @@ -524,7 +524,7 @@ } static PyObject * -fileio_readall(PyFileIOObject *self) +fileio_readall(fileio *self) { PyObject *result; Py_ssize_t total = 0; @@ -590,7 +590,7 @@ } static PyObject * -fileio_read(PyFileIOObject *self, PyObject *args) +fileio_read(fileio *self, PyObject *args) { char *ptr; Py_ssize_t n; @@ -641,7 +641,7 @@ } static PyObject * -fileio_write(PyFileIOObject *self, PyObject *args) +fileio_write(fileio *self, PyObject *args) { Py_buffer pbuf; Py_ssize_t n; @@ -734,7 +734,7 @@ } static PyObject * -fileio_seek(PyFileIOObject *self, PyObject *args) +fileio_seek(fileio *self, PyObject *args) { PyObject *posobj; int whence = 0; @@ -749,7 +749,7 @@ } static PyObject * -fileio_tell(PyFileIOObject *self, PyObject *args) +fileio_tell(fileio *self, PyObject *args) { if (self->fd < 0) return err_closed(); @@ -759,7 +759,7 @@ #ifdef HAVE_FTRUNCATE static PyObject * -fileio_truncate(PyFileIOObject *self, PyObject *args) +fileio_truncate(fileio *self, PyObject *args) { PyObject *posobj = NULL; Py_off_t pos; @@ -831,7 +831,7 @@ #endif static char * -mode_string(PyFileIOObject *self) +mode_string(fileio *self) { if (self->readable) { if (self->writable) @@ -844,7 +844,7 @@ } static PyObject * -fileio_repr(PyFileIOObject *self) +fileio_repr(fileio *self) { PyObject *nameobj, *res; @@ -869,7 +869,7 @@ } static PyObject * -fileio_isatty(PyFileIOObject *self) +fileio_isatty(fileio *self) { long res; @@ -980,19 +980,19 @@ /* 'closed' and 'mode' are attributes for backwards compatibility reasons. */ static PyObject * -get_closed(PyFileIOObject *self, void *closure) +get_closed(fileio *self, void *closure) { return PyBool_FromLong((long)(self->fd < 0)); } static PyObject * -get_closefd(PyFileIOObject *self, void *closure) +get_closefd(fileio *self, void *closure) { return PyBool_FromLong((long)(self->closefd)); } static PyObject * -get_mode(PyFileIOObject *self, void *closure) +get_mode(fileio *self, void *closure) { return PyUnicode_FromString(mode_string(self)); } @@ -1008,7 +1008,7 @@ PyTypeObject PyFileIO_Type = { PyVarObject_HEAD_INIT(NULL, 0) "_io.FileIO", - sizeof(PyFileIOObject), + sizeof(fileio), 0, (destructor)fileio_dealloc, /* tp_dealloc */ 0, /* tp_print */ @@ -1031,7 +1031,7 @@ (traverseproc)fileio_traverse, /* tp_traverse */ (inquiry)fileio_clear, /* tp_clear */ 0, /* tp_richcompare */ - offsetof(PyFileIOObject, weakreflist), /* tp_weaklistoffset */ + offsetof(fileio, weakreflist), /* tp_weaklistoffset */ 0, /* tp_iter */ 0, /* tp_iternext */ fileio_methods, /* tp_methods */ @@ -1041,7 +1041,7 @@ 0, /* tp_dict */ 0, /* tp_descr_get */ 0, /* tp_descr_set */ - offsetof(PyFileIOObject, dict), /* tp_dictoffset */ + offsetof(fileio, dict), /* tp_dictoffset */ fileio_init, /* tp_init */ PyType_GenericAlloc, /* tp_alloc */ fileio_new, /* tp_new */ Modified: python/branches/py3k/Modules/_io/iobase.c ============================================================================== --- python/branches/py3k/Modules/_io/iobase.c (original) +++ python/branches/py3k/Modules/_io/iobase.c Fri Jun 12 04:07:12 2009 @@ -22,9 +22,9 @@ PyObject *dict; PyObject *weakreflist; -} IOBaseObject; +} iobase; -PyDoc_STRVAR(IOBase_doc, +PyDoc_STRVAR(iobase_doc, "The abstract base class for all I/O classes, acting on streams of\n" "bytes. There is no public constructor.\n" "\n" @@ -63,7 +63,7 @@ /* Internal methods */ static PyObject * -IOBase_unsupported(const char *message) +iobase_unsupported(const char *message) { PyErr_SetString(IO_STATE->unsupported_operation, message); return NULL; @@ -71,7 +71,7 @@ /* Positionning */ -PyDoc_STRVAR(IOBase_seek_doc, +PyDoc_STRVAR(iobase_seek_doc, "Change stream position.\n" "\n" "Change the stream position to byte offset offset. offset is\n" @@ -85,41 +85,41 @@ "Return the new absolute position."); static PyObject * -IOBase_seek(PyObject *self, PyObject *args) +iobase_seek(PyObject *self, PyObject *args) { - return IOBase_unsupported("seek"); + return iobase_unsupported("seek"); } -PyDoc_STRVAR(IOBase_tell_doc, +PyDoc_STRVAR(iobase_tell_doc, "Return current stream position."); static PyObject * -IOBase_tell(PyObject *self, PyObject *args) +iobase_tell(PyObject *self, PyObject *args) { return PyObject_CallMethod(self, "seek", "ii", 0, 1); } -PyDoc_STRVAR(IOBase_truncate_doc, +PyDoc_STRVAR(iobase_truncate_doc, "Truncate file to size bytes.\n" "\n" "Size defaults to the current IO position as reported by tell(). Return\n" "the new size."); static PyObject * -IOBase_truncate(PyObject *self, PyObject *args) +iobase_truncate(PyObject *self, PyObject *args) { - return IOBase_unsupported("truncate"); + return iobase_unsupported("truncate"); } /* Flush and close methods */ -PyDoc_STRVAR(IOBase_flush_doc, +PyDoc_STRVAR(iobase_flush_doc, "Flush write buffers, if applicable.\n" "\n" "This is not implemented for read-only and non-blocking streams.\n"); static PyObject * -IOBase_flush(PyObject *self, PyObject *args) +iobase_flush(PyObject *self, PyObject *args) { /* XXX Should this return the number of bytes written??? */ if (IS_CLOSED(self)) { @@ -129,13 +129,13 @@ Py_RETURN_NONE; } -PyDoc_STRVAR(IOBase_close_doc, +PyDoc_STRVAR(iobase_close_doc, "Flush and close the IO object.\n" "\n" "This method has no effect if the file is already closed.\n"); static int -IOBase_closed(PyObject *self) +iobase_closed(PyObject *self) { PyObject *res; int closed; @@ -150,15 +150,15 @@ } static PyObject * -IOBase_closed_get(PyObject *self, void *context) +iobase_closed_get(PyObject *self, void *context) { return PyBool_FromLong(IS_CLOSED(self)); } PyObject * -_PyIOBase_checkClosed(PyObject *self, PyObject *args) +_PyIOBase_check_closed(PyObject *self, PyObject *args) { - if (IOBase_closed(self)) { + if (iobase_closed(self)) { PyErr_SetString(PyExc_ValueError, "I/O operation on closed file."); return NULL; } @@ -173,7 +173,7 @@ whatever behaviour a non-trivial derived class will implement. */ static PyObject * -IOBase_close(PyObject *self, PyObject *args) +iobase_close(PyObject *self, PyObject *args) { PyObject *res; @@ -260,14 +260,14 @@ } static int -IOBase_traverse(IOBaseObject *self, visitproc visit, void *arg) +iobase_traverse(iobase *self, visitproc visit, void *arg) { Py_VISIT(self->dict); return 0; } static int -IOBase_clear(IOBaseObject *self) +iobase_clear(iobase *self) { if (_PyIOBase_finalize((PyObject *) self) < 0) return -1; @@ -278,7 +278,7 @@ /* Destructor */ static void -IOBase_dealloc(IOBaseObject *self) +iobase_dealloc(iobase *self) { /* NOTE: since IOBaseObject has its own dict, Python-defined attributes are still available here for close() to use. @@ -301,20 +301,20 @@ /* Inquiry methods */ -PyDoc_STRVAR(IOBase_seekable_doc, +PyDoc_STRVAR(iobase_seekable_doc, "Return whether object supports random access.\n" "\n" "If False, seek(), tell() and truncate() will raise IOError.\n" "This method may need to do a test seek()."); static PyObject * -IOBase_seekable(PyObject *self, PyObject *args) +iobase_seekable(PyObject *self, PyObject *args) { Py_RETURN_FALSE; } PyObject * -_PyIOBase_checkSeekable(PyObject *self, PyObject *args) +_PyIOBase_check_seekable(PyObject *self, PyObject *args) { PyObject *res = PyObject_CallMethodObjArgs(self, _PyIO_str_seekable, NULL); if (res == NULL) @@ -330,20 +330,20 @@ return res; } -PyDoc_STRVAR(IOBase_readable_doc, +PyDoc_STRVAR(iobase_readable_doc, "Return whether object was opened for reading.\n" "\n" "If False, read() will raise IOError."); static PyObject * -IOBase_readable(PyObject *self, PyObject *args) +iobase_readable(PyObject *self, PyObject *args) { Py_RETURN_FALSE; } /* May be called with any object */ PyObject * -_PyIOBase_checkReadable(PyObject *self, PyObject *args) +_PyIOBase_check_readable(PyObject *self, PyObject *args) { PyObject *res = PyObject_CallMethodObjArgs(self, _PyIO_str_readable, NULL); if (res == NULL) @@ -359,20 +359,20 @@ return res; } -PyDoc_STRVAR(IOBase_writable_doc, +PyDoc_STRVAR(iobase_writable_doc, "Return whether object was opened for writing.\n" "\n" "If False, read() will raise IOError."); static PyObject * -IOBase_writable(PyObject *self, PyObject *args) +iobase_writable(PyObject *self, PyObject *args) { Py_RETURN_FALSE; } /* May be called with any object */ PyObject * -_PyIOBase_checkWritable(PyObject *self, PyObject *args) +_PyIOBase_check_writable(PyObject *self, PyObject *args) { PyObject *res = PyObject_CallMethodObjArgs(self, _PyIO_str_writable, NULL); if (res == NULL) @@ -391,9 +391,9 @@ /* Context manager */ static PyObject * -IOBase_enter(PyObject *self, PyObject *args) +iobase_enter(PyObject *self, PyObject *args) { - if (_PyIOBase_checkClosed(self, Py_True) == NULL) + if (_PyIOBase_check_closed(self, Py_True) == NULL) return NULL; Py_INCREF(self); @@ -401,7 +401,7 @@ } static PyObject * -IOBase_exit(PyObject *self, PyObject *args) +iobase_exit(PyObject *self, PyObject *args) { return PyObject_CallMethodObjArgs(self, _PyIO_str_close, NULL); } @@ -410,33 +410,33 @@ /* XXX Should these be present even if unimplemented? */ -PyDoc_STRVAR(IOBase_fileno_doc, +PyDoc_STRVAR(iobase_fileno_doc, "Returns underlying file descriptor if one exists.\n" "\n" "An IOError is raised if the IO object does not use a file descriptor.\n"); static PyObject * -IOBase_fileno(PyObject *self, PyObject *args) +iobase_fileno(PyObject *self, PyObject *args) { - return IOBase_unsupported("fileno"); + return iobase_unsupported("fileno"); } -PyDoc_STRVAR(IOBase_isatty_doc, +PyDoc_STRVAR(iobase_isatty_doc, "Return whether this is an 'interactive' stream.\n" "\n" "Return False if it can't be determined.\n"); static PyObject * -IOBase_isatty(PyObject *self, PyObject *args) +iobase_isatty(PyObject *self, PyObject *args) { - if (_PyIOBase_checkClosed(self, Py_True) == NULL) + if (_PyIOBase_check_closed(self, Py_True) == NULL) return NULL; Py_RETURN_FALSE; } /* Readline(s) and writelines */ -PyDoc_STRVAR(IOBase_readline_doc, +PyDoc_STRVAR(iobase_readline_doc, "Read and return a line from the stream.\n" "\n" "If limit is specified, at most limit bytes will be read.\n" @@ -446,7 +446,7 @@ "terminator(s) recognized.\n"); static PyObject * -IOBase_readline(PyObject *self, PyObject *args) +iobase_readline(PyObject *self, PyObject *args) { /* For backwards compatibility, a (slowish) readline(). */ @@ -541,9 +541,9 @@ } static PyObject * -IOBase_iter(PyObject *self) +iobase_iter(PyObject *self) { - if (_PyIOBase_checkClosed(self, Py_True) == NULL) + if (_PyIOBase_check_closed(self, Py_True) == NULL) return NULL; Py_INCREF(self); @@ -551,7 +551,7 @@ } static PyObject * -IOBase_iternext(PyObject *self) +iobase_iternext(PyObject *self) { PyObject *line = PyObject_CallMethodObjArgs(self, _PyIO_str_readline, NULL); @@ -566,7 +566,7 @@ return line; } -PyDoc_STRVAR(IOBase_readlines_doc, +PyDoc_STRVAR(iobase_readlines_doc, "Return a list of lines from the stream.\n" "\n" "hint can be specified to control the number of lines read: no more\n" @@ -574,7 +574,7 @@ "lines so far exceeds hint."); static PyObject * -IOBase_readlines(PyObject *self, PyObject *args) +iobase_readlines(PyObject *self, PyObject *args) { Py_ssize_t hint = -1, length = 0; PyObject *hintobj = Py_None, *result; @@ -631,7 +631,7 @@ } static PyObject * -IOBase_writelines(PyObject *self, PyObject *args) +iobase_writelines(PyObject *self, PyObject *args) { PyObject *lines, *iter, *res; @@ -639,7 +639,7 @@ return NULL; } - if (_PyIOBase_checkClosed(self, Py_True) == NULL) + if (_PyIOBase_check_closed(self, Py_True) == NULL) return NULL; iter = PyObject_GetIter(lines); @@ -669,37 +669,37 @@ Py_RETURN_NONE; } -static PyMethodDef IOBase_methods[] = { - {"seek", IOBase_seek, METH_VARARGS, IOBase_seek_doc}, - {"tell", IOBase_tell, METH_NOARGS, IOBase_tell_doc}, - {"truncate", IOBase_truncate, METH_VARARGS, IOBase_truncate_doc}, - {"flush", IOBase_flush, METH_NOARGS, IOBase_flush_doc}, - {"close", IOBase_close, METH_NOARGS, IOBase_close_doc}, - - {"seekable", IOBase_seekable, METH_NOARGS, IOBase_seekable_doc}, - {"readable", IOBase_readable, METH_NOARGS, IOBase_readable_doc}, - {"writable", IOBase_writable, METH_NOARGS, IOBase_writable_doc}, - - {"_checkClosed", _PyIOBase_checkClosed, METH_NOARGS}, - {"_checkSeekable", _PyIOBase_checkSeekable, METH_NOARGS}, - {"_checkReadable", _PyIOBase_checkReadable, METH_NOARGS}, - {"_checkWritable", _PyIOBase_checkWritable, METH_NOARGS}, - - {"fileno", IOBase_fileno, METH_NOARGS, IOBase_fileno_doc}, - {"isatty", IOBase_isatty, METH_NOARGS, IOBase_isatty_doc}, - - {"__enter__", IOBase_enter, METH_NOARGS}, - {"__exit__", IOBase_exit, METH_VARARGS}, - - {"readline", IOBase_readline, METH_VARARGS, IOBase_readline_doc}, - {"readlines", IOBase_readlines, METH_VARARGS, IOBase_readlines_doc}, - {"writelines", IOBase_writelines, METH_VARARGS}, +static PyMethodDef iobase_methods[] = { + {"seek", iobase_seek, METH_VARARGS, iobase_seek_doc}, + {"tell", iobase_tell, METH_NOARGS, iobase_tell_doc}, + {"truncate", iobase_truncate, METH_VARARGS, iobase_truncate_doc}, + {"flush", iobase_flush, METH_NOARGS, iobase_flush_doc}, + {"close", iobase_close, METH_NOARGS, iobase_close_doc}, + + {"seekable", iobase_seekable, METH_NOARGS, iobase_seekable_doc}, + {"readable", iobase_readable, METH_NOARGS, iobase_readable_doc}, + {"writable", iobase_writable, METH_NOARGS, iobase_writable_doc}, + + {"_checkClosed", _PyIOBase_check_closed, METH_NOARGS}, + {"_checkSeekable", _PyIOBase_check_seekable, METH_NOARGS}, + {"_checkReadable", _PyIOBase_check_readable, METH_NOARGS}, + {"_checkWritable", _PyIOBase_check_writable, METH_NOARGS}, + + {"fileno", iobase_fileno, METH_NOARGS, iobase_fileno_doc}, + {"isatty", iobase_isatty, METH_NOARGS, iobase_isatty_doc}, + + {"__enter__", iobase_enter, METH_NOARGS}, + {"__exit__", iobase_exit, METH_VARARGS}, + + {"readline", iobase_readline, METH_VARARGS, iobase_readline_doc}, + {"readlines", iobase_readlines, METH_VARARGS, iobase_readlines_doc}, + {"writelines", iobase_writelines, METH_VARARGS}, {NULL, NULL} }; -static PyGetSetDef IOBase_getset[] = { - {"closed", (getter)IOBase_closed_get, NULL, NULL}, +static PyGetSetDef iobase_getset[] = { + {"closed", (getter)iobase_closed_get, NULL, NULL}, {NULL} }; @@ -707,9 +707,9 @@ PyTypeObject PyIOBase_Type = { PyVarObject_HEAD_INIT(NULL, 0) "_io._IOBase", /*tp_name*/ - sizeof(IOBaseObject), /*tp_basicsize*/ + sizeof(iobase), /*tp_basicsize*/ 0, /*tp_itemsize*/ - (destructor)IOBase_dealloc, /*tp_dealloc*/ + (destructor)iobase_dealloc, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ @@ -726,21 +726,21 @@ 0, /*tp_as_buffer*/ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE | Py_TPFLAGS_HAVE_GC, /*tp_flags*/ - IOBase_doc, /* tp_doc */ - (traverseproc)IOBase_traverse, /* tp_traverse */ - (inquiry)IOBase_clear, /* tp_clear */ + iobase_doc, /* tp_doc */ + (traverseproc)iobase_traverse, /* tp_traverse */ + (inquiry)iobase_clear, /* tp_clear */ 0, /* tp_richcompare */ - offsetof(IOBaseObject, weakreflist), /* tp_weaklistoffset */ - IOBase_iter, /* tp_iter */ - IOBase_iternext, /* tp_iternext */ - IOBase_methods, /* tp_methods */ + offsetof(iobase, weakreflist), /* tp_weaklistoffset */ + iobase_iter, /* tp_iter */ + iobase_iternext, /* tp_iternext */ + iobase_methods, /* tp_methods */ 0, /* tp_members */ - IOBase_getset, /* tp_getset */ + iobase_getset, /* tp_getset */ 0, /* tp_base */ 0, /* tp_dict */ 0, /* tp_descr_get */ 0, /* tp_descr_set */ - offsetof(IOBaseObject, dict), /* tp_dictoffset */ + offsetof(iobase, dict), /* tp_dictoffset */ 0, /* tp_init */ 0, /* tp_alloc */ PyType_GenericNew, /* tp_new */ @@ -750,7 +750,7 @@ /* * RawIOBase class, Inherits from IOBase. */ -PyDoc_STRVAR(RawIOBase_doc, +PyDoc_STRVAR(rawiobase_doc, "Base class for raw binary I/O."); /* @@ -766,7 +766,7 @@ */ static PyObject * -RawIOBase_read(PyObject *self, PyObject *args) +rawiobase_read(PyObject *self, PyObject *args) { Py_ssize_t n = -1; PyObject *b, *res; @@ -803,11 +803,11 @@ } -PyDoc_STRVAR(RawIOBase_readall_doc, +PyDoc_STRVAR(rawiobase_readall_doc, "Read until EOF, using multiple read() call."); static PyObject * -RawIOBase_readall(PyObject *self, PyObject *args) +rawiobase_readall(PyObject *self, PyObject *args) { int r; PyObject *chunks = PyList_New(0); @@ -846,9 +846,9 @@ return result; } -static PyMethodDef RawIOBase_methods[] = { - {"read", RawIOBase_read, METH_VARARGS}, - {"readall", RawIOBase_readall, METH_NOARGS, RawIOBase_readall_doc}, +static PyMethodDef rawiobase_methods[] = { + {"read", rawiobase_read, METH_VARARGS}, + {"readall", rawiobase_readall, METH_NOARGS, rawiobase_readall_doc}, {NULL, NULL} }; @@ -873,14 +873,14 @@ 0, /*tp_setattro*/ 0, /*tp_as_buffer*/ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /*tp_flags*/ - RawIOBase_doc, /* tp_doc */ + rawiobase_doc, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompare */ 0, /* tp_weaklistoffset */ 0, /* tp_iter */ 0, /* tp_iternext */ - RawIOBase_methods, /* tp_methods */ + rawiobase_methods, /* tp_methods */ 0, /* tp_members */ 0, /* tp_getset */ &PyIOBase_Type, /* tp_base */ Modified: python/branches/py3k/Modules/_io/stringio.c ============================================================================== --- python/branches/py3k/Modules/_io/stringio.c (original) +++ python/branches/py3k/Modules/_io/stringio.c Fri Jun 12 04:07:12 2009 @@ -24,7 +24,7 @@ PyObject *dict; PyObject *weakreflist; -} StringIOObject; +} stringio; #define CHECK_INITIALIZED(self) \ if (self->ok <= 0) { \ @@ -51,7 +51,7 @@ buffer of StringIO objects. The caller should ensure that the 'size' argument is non-negative. Returns 0 on success, -1 otherwise. */ static int -resize_buffer(StringIOObject *self, size_t size) +resize_buffer(stringio *self, size_t size) { /* Here, unsigned types are used to avoid dealing with signed integer overflow, which is undefined in C. */ @@ -106,7 +106,7 @@ /* Internal routine for writing a whole PyUnicode object to the buffer of a StringIO object. Returns 0 on success, or -1 on error. */ static Py_ssize_t -write_str(StringIOObject *self, PyObject *obj) +write_str(stringio *self, PyObject *obj) { Py_UNICODE *str; Py_ssize_t len; @@ -186,7 +186,7 @@ "Retrieve the entire contents of the object."); static PyObject * -stringio_getvalue(StringIOObject *self) +stringio_getvalue(stringio *self) { CHECK_INITIALIZED(self); CHECK_CLOSED(self); @@ -197,7 +197,7 @@ "Tell the current file position."); static PyObject * -stringio_tell(StringIOObject *self) +stringio_tell(stringio *self) { CHECK_INITIALIZED(self); CHECK_CLOSED(self); @@ -211,7 +211,7 @@ "is reached. Return an empty string at EOF.\n"); static PyObject * -stringio_read(StringIOObject *self, PyObject *args) +stringio_read(stringio *self, PyObject *args) { Py_ssize_t size, n; Py_UNICODE *output; @@ -252,7 +252,7 @@ /* Internal helper, used by stringio_readline and stringio_iternext */ static PyObject * -_stringio_readline(StringIOObject *self, Py_ssize_t limit) +_stringio_readline(stringio *self, Py_ssize_t limit) { Py_UNICODE *start, *end, old_char; Py_ssize_t len, consumed; @@ -286,7 +286,7 @@ "Returns an empty string if EOF is hit immediately.\n"); static PyObject * -stringio_readline(StringIOObject *self, PyObject *args) +stringio_readline(stringio *self, PyObject *args) { PyObject *arg = Py_None; Py_ssize_t limit = -1; @@ -310,7 +310,7 @@ } static PyObject * -stringio_iternext(StringIOObject *self) +stringio_iternext(stringio *self) { PyObject *line; @@ -354,7 +354,7 @@ "Returns the new absolute position.\n"); static PyObject * -stringio_truncate(StringIOObject *self, PyObject *args) +stringio_truncate(stringio *self, PyObject *args) { Py_ssize_t size; PyObject *arg = Py_None; @@ -405,7 +405,7 @@ "Returns the new absolute position.\n"); static PyObject * -stringio_seek(StringIOObject *self, PyObject *args) +stringio_seek(stringio *self, PyObject *args) { Py_ssize_t pos; int mode = 0; @@ -453,7 +453,7 @@ "the length of the string.\n"); static PyObject * -stringio_write(StringIOObject *self, PyObject *obj) +stringio_write(stringio *self, PyObject *obj) { Py_ssize_t size; @@ -479,7 +479,7 @@ "This method has no effect if the file is already closed.\n"); static PyObject * -stringio_close(StringIOObject *self) +stringio_close(stringio *self) { self->closed = 1; /* Free up some memory */ @@ -492,21 +492,21 @@ } static int -stringio_traverse(StringIOObject *self, visitproc visit, void *arg) +stringio_traverse(stringio *self, visitproc visit, void *arg) { Py_VISIT(self->dict); return 0; } static int -stringio_clear(StringIOObject *self) +stringio_clear(stringio *self) { Py_CLEAR(self->dict); return 0; } static void -stringio_dealloc(StringIOObject *self) +stringio_dealloc(stringio *self) { _PyObject_GC_UNTRACK(self); Py_CLEAR(self->readnl); @@ -522,10 +522,10 @@ static PyObject * stringio_new(PyTypeObject *type, PyObject *args, PyObject *kwds) { - StringIOObject *self; + stringio *self; assert(type != NULL && type->tp_alloc != NULL); - self = (StringIOObject *)type->tp_alloc(type, 0); + self = (stringio *)type->tp_alloc(type, 0); if (self == NULL) return NULL; @@ -542,7 +542,7 @@ } static int -stringio_init(StringIOObject *self, PyObject *args, PyObject *kwds) +stringio_init(stringio *self, PyObject *args, PyObject *kwds) { char *kwlist[] = {"initial_value", "newline", NULL}; PyObject *value = NULL; @@ -625,28 +625,28 @@ /* Properties and pseudo-properties */ static PyObject * -stringio_seekable(StringIOObject *self, PyObject *args) +stringio_seekable(stringio *self, PyObject *args) { CHECK_INITIALIZED(self); Py_RETURN_TRUE; } static PyObject * -stringio_readable(StringIOObject *self, PyObject *args) +stringio_readable(stringio *self, PyObject *args) { CHECK_INITIALIZED(self); Py_RETURN_TRUE; } static PyObject * -stringio_writable(StringIOObject *self, PyObject *args) +stringio_writable(stringio *self, PyObject *args) { CHECK_INITIALIZED(self); Py_RETURN_TRUE; } static PyObject * -stringio_buffer(StringIOObject *self, void *context) +stringio_buffer(stringio *self, void *context) { PyErr_SetString(IO_STATE->unsupported_operation, "buffer attribute is unsupported on type StringIO"); @@ -654,14 +654,14 @@ } static PyObject * -stringio_closed(StringIOObject *self, void *context) +stringio_closed(stringio *self, void *context) { CHECK_INITIALIZED(self); return PyBool_FromLong(self->closed); } static PyObject * -stringio_line_buffering(StringIOObject *self, void *context) +stringio_line_buffering(stringio *self, void *context) { CHECK_INITIALIZED(self); CHECK_CLOSED(self); @@ -669,7 +669,7 @@ } static PyObject * -stringio_newlines(StringIOObject *self, void *context) +stringio_newlines(stringio *self, void *context) { CHECK_INITIALIZED(self); CHECK_CLOSED(self); @@ -711,7 +711,7 @@ PyTypeObject PyStringIO_Type = { PyVarObject_HEAD_INIT(NULL, 0) "_io.StringIO", /*tp_name*/ - sizeof(StringIOObject), /*tp_basicsize*/ + sizeof(stringio), /*tp_basicsize*/ 0, /*tp_itemsize*/ (destructor)stringio_dealloc, /*tp_dealloc*/ 0, /*tp_print*/ @@ -734,7 +734,7 @@ (traverseproc)stringio_traverse, /*tp_traverse*/ (inquiry)stringio_clear, /*tp_clear*/ 0, /*tp_richcompare*/ - offsetof(StringIOObject, weakreflist), /*tp_weaklistoffset*/ + offsetof(stringio, weakreflist), /*tp_weaklistoffset*/ 0, /*tp_iter*/ (iternextfunc)stringio_iternext, /*tp_iternext*/ stringio_methods, /*tp_methods*/ @@ -744,7 +744,7 @@ 0, /*tp_dict*/ 0, /*tp_descr_get*/ 0, /*tp_descr_set*/ - offsetof(StringIOObject, dict), /*tp_dictoffset*/ + offsetof(stringio, dict), /*tp_dictoffset*/ (initproc)stringio_init, /*tp_init*/ 0, /*tp_alloc*/ stringio_new, /*tp_new*/ Modified: python/branches/py3k/Modules/_io/textio.c ============================================================================== --- python/branches/py3k/Modules/_io/textio.c (original) +++ python/branches/py3k/Modules/_io/textio.c Fri Jun 12 04:07:12 2009 @@ -13,7 +13,7 @@ /* TextIOBase */ -PyDoc_STRVAR(TextIOBase_doc, +PyDoc_STRVAR(textiobase_doc, "Base class for text I/O.\n" "\n" "This class provides a character and line based interface to stream\n" @@ -28,7 +28,7 @@ return NULL; } -PyDoc_STRVAR(TextIOBase_detach_doc, +PyDoc_STRVAR(textiobase_detach_doc, "Separate the underlying buffer from the TextIOBase and return it.\n" "\n" "After the underlying buffer has been detached, the TextIO is in an\n" @@ -36,12 +36,12 @@ ); static PyObject * -TextIOBase_detach(PyObject *self) +textiobase_detach(PyObject *self) { return _unsupported("detach"); } -PyDoc_STRVAR(TextIOBase_read_doc, +PyDoc_STRVAR(textiobase_read_doc, "Read at most n characters from stream.\n" "\n" "Read from underlying buffer until we have n characters or we hit EOF.\n" @@ -49,48 +49,48 @@ ); static PyObject * -TextIOBase_read(PyObject *self, PyObject *args) +textiobase_read(PyObject *self, PyObject *args) { return _unsupported("read"); } -PyDoc_STRVAR(TextIOBase_readline_doc, +PyDoc_STRVAR(textiobase_readline_doc, "Read until newline or EOF.\n" "\n" "Returns an empty string if EOF is hit immediately.\n" ); static PyObject * -TextIOBase_readline(PyObject *self, PyObject *args) +textiobase_readline(PyObject *self, PyObject *args) { return _unsupported("readline"); } -PyDoc_STRVAR(TextIOBase_write_doc, +PyDoc_STRVAR(textiobase_write_doc, "Write string to stream.\n" "Returns the number of characters written (which is always equal to\n" "the length of the string).\n" ); static PyObject * -TextIOBase_write(PyObject *self, PyObject *args) +textiobase_write(PyObject *self, PyObject *args) { return _unsupported("write"); } -PyDoc_STRVAR(TextIOBase_encoding_doc, +PyDoc_STRVAR(textiobase_encoding_doc, "Encoding of the text stream.\n" "\n" "Subclasses should override.\n" ); static PyObject * -TextIOBase_encoding_get(PyObject *self, void *context) +textiobase_encoding_get(PyObject *self, void *context) { Py_RETURN_NONE; } -PyDoc_STRVAR(TextIOBase_newlines_doc, +PyDoc_STRVAR(textiobase_newlines_doc, "Line endings translated so far.\n" "\n" "Only line endings translated during reading are considered.\n" @@ -99,36 +99,36 @@ ); static PyObject * -TextIOBase_newlines_get(PyObject *self, void *context) +textiobase_newlines_get(PyObject *self, void *context) { Py_RETURN_NONE; } -PyDoc_STRVAR(TextIOBase_errors_doc, +PyDoc_STRVAR(textiobase_errors_doc, "The error setting of the decoder or encoder.\n" "\n" "Subclasses should override.\n" ); static PyObject * -TextIOBase_errors_get(PyObject *self, void *context) +textiobase_errors_get(PyObject *self, void *context) { Py_RETURN_NONE; } -static PyMethodDef TextIOBase_methods[] = { - {"detach", (PyCFunction)TextIOBase_detach, METH_NOARGS, TextIOBase_detach_doc}, - {"read", TextIOBase_read, METH_VARARGS, TextIOBase_read_doc}, - {"readline", TextIOBase_readline, METH_VARARGS, TextIOBase_readline_doc}, - {"write", TextIOBase_write, METH_VARARGS, TextIOBase_write_doc}, +static PyMethodDef textiobase_methods[] = { + {"detach", (PyCFunction)textiobase_detach, METH_NOARGS, textiobase_detach_doc}, + {"read", textiobase_read, METH_VARARGS, textiobase_read_doc}, + {"readline", textiobase_readline, METH_VARARGS, textiobase_readline_doc}, + {"write", textiobase_write, METH_VARARGS, textiobase_write_doc}, {NULL, NULL} }; -static PyGetSetDef TextIOBase_getset[] = { - {"encoding", (getter)TextIOBase_encoding_get, NULL, TextIOBase_encoding_doc}, - {"newlines", (getter)TextIOBase_newlines_get, NULL, TextIOBase_newlines_doc}, - {"errors", (getter)TextIOBase_errors_get, NULL, TextIOBase_errors_doc}, +static PyGetSetDef textiobase_getset[] = { + {"encoding", (getter)textiobase_encoding_get, NULL, textiobase_encoding_doc}, + {"newlines", (getter)textiobase_newlines_get, NULL, textiobase_newlines_doc}, + {"errors", (getter)textiobase_errors_get, NULL, textiobase_errors_doc}, {NULL} }; @@ -153,16 +153,16 @@ 0, /*tp_setattro*/ 0, /*tp_as_buffer*/ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /*tp_flags*/ - TextIOBase_doc, /* tp_doc */ + textiobase_doc, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompare */ 0, /* tp_weaklistoffset */ 0, /* tp_iter */ 0, /* tp_iternext */ - TextIOBase_methods, /* tp_methods */ + textiobase_methods, /* tp_methods */ 0, /* tp_members */ - TextIOBase_getset, /* tp_getset */ + textiobase_getset, /* tp_getset */ &PyIOBase_Type, /* tp_base */ 0, /* tp_dict */ 0, /* tp_descr_get */ @@ -176,7 +176,7 @@ /* IncrementalNewlineDecoder */ -PyDoc_STRVAR(IncrementalNewlineDecoder_doc, +PyDoc_STRVAR(incrementalnewlinedecoder_doc, "Codec used when reading a file in universal newlines mode. It wraps\n" "another incremental decoder, translating \\r\\n and \\r into \\n. It also\n" "records the types of newlines encountered. When used with\n" @@ -193,10 +193,10 @@ int pendingcr:1; int translate:1; unsigned int seennl:3; -} PyNewLineDecoderObject; +} nldecoder_object; static int -IncrementalNewlineDecoder_init(PyNewLineDecoderObject *self, +incrementalnewlinedecoder_init(nldecoder_object *self, PyObject *args, PyObject *kwds) { PyObject *decoder; @@ -229,7 +229,7 @@ } static void -IncrementalNewlineDecoder_dealloc(PyNewLineDecoderObject *self) +incrementalnewlinedecoder_dealloc(nldecoder_object *self) { Py_CLEAR(self->decoder); Py_CLEAR(self->errors); @@ -247,7 +247,7 @@ { PyObject *output; Py_ssize_t output_len; - PyNewLineDecoderObject *self = (PyNewLineDecoderObject *) _self; + nldecoder_object *self = (nldecoder_object *) _self; if (self->decoder == NULL) { PyErr_SetString(PyExc_ValueError, @@ -460,7 +460,7 @@ } static PyObject * -IncrementalNewlineDecoder_decode(PyNewLineDecoderObject *self, +incrementalnewlinedecoder_decode(nldecoder_object *self, PyObject *args, PyObject *kwds) { char *kwlist[] = {"input", "final", NULL}; @@ -474,7 +474,7 @@ } static PyObject * -IncrementalNewlineDecoder_getstate(PyNewLineDecoderObject *self, PyObject *args) +incrementalnewlinedecoder_getstate(nldecoder_object *self, PyObject *args) { PyObject *buffer; unsigned PY_LONG_LONG flag; @@ -502,7 +502,7 @@ } static PyObject * -IncrementalNewlineDecoder_setstate(PyNewLineDecoderObject *self, PyObject *state) +incrementalnewlinedecoder_setstate(nldecoder_object *self, PyObject *state) { PyObject *buffer; unsigned PY_LONG_LONG flag; @@ -521,7 +521,7 @@ } static PyObject * -IncrementalNewlineDecoder_reset(PyNewLineDecoderObject *self, PyObject *args) +incrementalnewlinedecoder_reset(nldecoder_object *self, PyObject *args) { self->seennl = 0; self->pendingcr = 0; @@ -532,7 +532,7 @@ } static PyObject * -IncrementalNewlineDecoder_newlines_get(PyNewLineDecoderObject *self, void *context) +incrementalnewlinedecoder_newlines_get(nldecoder_object *self, void *context) { switch (self->seennl) { case SEEN_CR: @@ -556,25 +556,25 @@ } -static PyMethodDef IncrementalNewlineDecoder_methods[] = { - {"decode", (PyCFunction)IncrementalNewlineDecoder_decode, METH_VARARGS|METH_KEYWORDS}, - {"getstate", (PyCFunction)IncrementalNewlineDecoder_getstate, METH_NOARGS}, - {"setstate", (PyCFunction)IncrementalNewlineDecoder_setstate, METH_O}, - {"reset", (PyCFunction)IncrementalNewlineDecoder_reset, METH_NOARGS}, +static PyMethodDef incrementalnewlinedecoder_methods[] = { + {"decode", (PyCFunction)incrementalnewlinedecoder_decode, METH_VARARGS|METH_KEYWORDS}, + {"getstate", (PyCFunction)incrementalnewlinedecoder_getstate, METH_NOARGS}, + {"setstate", (PyCFunction)incrementalnewlinedecoder_setstate, METH_O}, + {"reset", (PyCFunction)incrementalnewlinedecoder_reset, METH_NOARGS}, {NULL} }; -static PyGetSetDef IncrementalNewlineDecoder_getset[] = { - {"newlines", (getter)IncrementalNewlineDecoder_newlines_get, NULL, NULL}, +static PyGetSetDef incrementalnewlinedecoder_getset[] = { + {"newlines", (getter)incrementalnewlinedecoder_newlines_get, NULL, NULL}, {NULL} }; PyTypeObject PyIncrementalNewlineDecoder_Type = { PyVarObject_HEAD_INIT(NULL, 0) "_io.IncrementalNewlineDecoder", /*tp_name*/ - sizeof(PyNewLineDecoderObject), /*tp_basicsize*/ + sizeof(nldecoder_object), /*tp_basicsize*/ 0, /*tp_itemsize*/ - (destructor)IncrementalNewlineDecoder_dealloc, /*tp_dealloc*/ + (destructor)incrementalnewlinedecoder_dealloc, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ @@ -590,22 +590,22 @@ 0, /*tp_setattro*/ 0, /*tp_as_buffer*/ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /*tp_flags*/ - IncrementalNewlineDecoder_doc, /* tp_doc */ + incrementalnewlinedecoder_doc, /* tp_doc */ 0, /* tp_traverse */ 0, /* tp_clear */ 0, /* tp_richcompare */ 0, /*tp_weaklistoffset*/ 0, /* tp_iter */ 0, /* tp_iternext */ - IncrementalNewlineDecoder_methods, /* tp_methods */ + incrementalnewlinedecoder_methods, /* tp_methods */ 0, /* tp_members */ - IncrementalNewlineDecoder_getset, /* tp_getset */ + incrementalnewlinedecoder_getset, /* tp_getset */ 0, /* tp_base */ 0, /* tp_dict */ 0, /* tp_descr_get */ 0, /* tp_descr_set */ 0, /* tp_dictoffset */ - (initproc)IncrementalNewlineDecoder_init, /* tp_init */ + (initproc)incrementalnewlinedecoder_init, /* tp_init */ 0, /* tp_alloc */ PyType_GenericNew, /* tp_new */ }; @@ -613,7 +613,7 @@ /* TextIOWrapper */ -PyDoc_STRVAR(TextIOWrapper_doc, +PyDoc_STRVAR(textiowrapper_doc, "Character and line based layer over a BufferedIOBase object, buffer.\n" "\n" "encoding gives the name of the encoding that the stream will be\n" @@ -689,14 +689,14 @@ PyObject *weakreflist; PyObject *dict; -} PyTextIOWrapperObject; +} textio; /* A couple of specialized cases in order to bypass the slow incremental encoding methods for the most popular encodings. */ static PyObject * -ascii_encode(PyTextIOWrapperObject *self, PyObject *text) +ascii_encode(textio *self, PyObject *text) { return PyUnicode_EncodeASCII(PyUnicode_AS_UNICODE(text), PyUnicode_GET_SIZE(text), @@ -704,7 +704,7 @@ } static PyObject * -utf16be_encode(PyTextIOWrapperObject *self, PyObject *text) +utf16be_encode(textio *self, PyObject *text) { return PyUnicode_EncodeUTF16(PyUnicode_AS_UNICODE(text), PyUnicode_GET_SIZE(text), @@ -712,7 +712,7 @@ } static PyObject * -utf16le_encode(PyTextIOWrapperObject *self, PyObject *text) +utf16le_encode(textio *self, PyObject *text) { return PyUnicode_EncodeUTF16(PyUnicode_AS_UNICODE(text), PyUnicode_GET_SIZE(text), @@ -720,7 +720,7 @@ } static PyObject * -utf16_encode(PyTextIOWrapperObject *self, PyObject *text) +utf16_encode(textio *self, PyObject *text) { if (!self->encoding_start_of_stream) { /* Skip the BOM and use native byte ordering */ @@ -736,7 +736,7 @@ } static PyObject * -utf32be_encode(PyTextIOWrapperObject *self, PyObject *text) +utf32be_encode(textio *self, PyObject *text) { return PyUnicode_EncodeUTF32(PyUnicode_AS_UNICODE(text), PyUnicode_GET_SIZE(text), @@ -744,7 +744,7 @@ } static PyObject * -utf32le_encode(PyTextIOWrapperObject *self, PyObject *text) +utf32le_encode(textio *self, PyObject *text) { return PyUnicode_EncodeUTF32(PyUnicode_AS_UNICODE(text), PyUnicode_GET_SIZE(text), @@ -752,7 +752,7 @@ } static PyObject * -utf32_encode(PyTextIOWrapperObject *self, PyObject *text) +utf32_encode(textio *self, PyObject *text) { if (!self->encoding_start_of_stream) { /* Skip the BOM and use native byte ordering */ @@ -768,7 +768,7 @@ } static PyObject * -utf8_encode(PyTextIOWrapperObject *self, PyObject *text) +utf8_encode(textio *self, PyObject *text) { return PyUnicode_EncodeUTF8(PyUnicode_AS_UNICODE(text), PyUnicode_GET_SIZE(text), @@ -776,7 +776,7 @@ } static PyObject * -latin1_encode(PyTextIOWrapperObject *self, PyObject *text) +latin1_encode(textio *self, PyObject *text) { return PyUnicode_EncodeLatin1(PyUnicode_AS_UNICODE(text), PyUnicode_GET_SIZE(text), @@ -805,7 +805,7 @@ static int -TextIOWrapper_init(PyTextIOWrapperObject *self, PyObject *args, PyObject *kwds) +textiowrapper_init(textio *self, PyObject *args, PyObject *kwds) { char *kwlist[] = {"buffer", "encoding", "errors", "newline", "line_buffering", @@ -1068,7 +1068,7 @@ } static int -_TextIOWrapper_clear(PyTextIOWrapperObject *self) +_textiowrapper_clear(textio *self) { if (self->ok && _PyIOBase_finalize((PyObject *) self) < 0) return -1; @@ -1087,9 +1087,9 @@ } static void -TextIOWrapper_dealloc(PyTextIOWrapperObject *self) +textiowrapper_dealloc(textio *self) { - if (_TextIOWrapper_clear(self) < 0) + if (_textiowrapper_clear(self) < 0) return; _PyObject_GC_UNTRACK(self); if (self->weakreflist != NULL) @@ -1099,7 +1099,7 @@ } static int -TextIOWrapper_traverse(PyTextIOWrapperObject *self, visitproc visit, void *arg) +textiowrapper_traverse(textio *self, visitproc visit, void *arg) { Py_VISIT(self->buffer); Py_VISIT(self->encoding); @@ -1117,16 +1117,16 @@ } static int -TextIOWrapper_clear(PyTextIOWrapperObject *self) +textiowrapper_clear(textio *self) { - if (_TextIOWrapper_clear(self) < 0) + if (_textiowrapper_clear(self) < 0) return -1; Py_CLEAR(self->dict); return 0; } static PyObject * -TextIOWrapper_closed_get(PyTextIOWrapperObject *self, void *context); +textiowrapper_closed_get(textio *self, void *context); /* This macro takes some shortcuts to make the common case faster. */ #define CHECK_CLOSED(self) \ @@ -1137,7 +1137,7 @@ if (self->raw != NULL) \ r = _PyFileIO_closed(self->raw); \ else { \ - _res = TextIOWrapper_closed_get(self, NULL); \ + _res = textiowrapper_closed_get(self, NULL); \ if (_res == NULL) \ return NULL; \ r = PyObject_IsTrue(_res); \ @@ -1151,7 +1151,7 @@ return NULL; \ } \ } \ - else if (_PyIOBase_checkClosed((PyObject *)self, Py_True) == NULL) \ + else if (_PyIOBase_check_closed((PyObject *)self, Py_True) == NULL) \ return NULL; \ } while (0) @@ -1181,7 +1181,7 @@ static PyObject * -TextIOWrapper_detach(PyTextIOWrapperObject *self) +textiowrapper_detach(textio *self) { PyObject *buffer, *res; CHECK_INITIALIZED(self); @@ -1211,7 +1211,7 @@ /* Flush the internal write buffer. This doesn't explicitly flush the underlying buffered object, though. */ static int -_TextIOWrapper_writeflush(PyTextIOWrapperObject *self) +_textiowrapper_writeflush(textio *self) { PyObject *b, *ret; @@ -1232,7 +1232,7 @@ } static PyObject * -TextIOWrapper_write(PyTextIOWrapperObject *self, PyObject *args) +textiowrapper_write(textio *self, PyObject *args) { PyObject *ret; PyObject *text; /* owned reference */ @@ -1305,7 +1305,7 @@ self->pending_bytes_count += PyBytes_GET_SIZE(b); Py_DECREF(b); if (self->pending_bytes_count > self->chunk_size || needflush) { - if (_TextIOWrapper_writeflush(self) < 0) + if (_textiowrapper_writeflush(self) < 0) return NULL; } @@ -1331,7 +1331,7 @@ /* Steal a reference to chars and store it in the decoded_char buffer; */ static void -TextIOWrapper_set_decoded_chars(PyTextIOWrapperObject *self, PyObject *chars) +textiowrapper_set_decoded_chars(textio *self, PyObject *chars) { Py_CLEAR(self->decoded_chars); self->decoded_chars = chars; @@ -1339,7 +1339,7 @@ } static PyObject * -TextIOWrapper_get_decoded_chars(PyTextIOWrapperObject *self, Py_ssize_t n) +textiowrapper_get_decoded_chars(textio *self, Py_ssize_t n) { PyObject *chars; Py_ssize_t avail; @@ -1374,7 +1374,7 @@ /* Read and decode the next chunk of data from the BufferedReader. */ static int -TextIOWrapper_read_chunk(PyTextIOWrapperObject *self) +textiowrapper_read_chunk(textio *self) { PyObject *dec_buffer = NULL; PyObject *dec_flags = NULL; @@ -1439,7 +1439,7 @@ /* TODO sanity check: isinstance(decoded_chars, unicode) */ if (decoded_chars == NULL) goto fail; - TextIOWrapper_set_decoded_chars(self, decoded_chars); + textiowrapper_set_decoded_chars(self, decoded_chars); if (PyUnicode_GET_SIZE(decoded_chars) > 0) eof = 0; @@ -1467,7 +1467,7 @@ } static PyObject * -TextIOWrapper_read(PyTextIOWrapperObject *self, PyObject *args) +textiowrapper_read(textio *self, PyObject *args) { Py_ssize_t n = -1; PyObject *result = NULL, *chunks = NULL; @@ -1484,7 +1484,7 @@ return NULL; } - if (_TextIOWrapper_writeflush(self) < 0) + if (_textiowrapper_writeflush(self) < 0) return NULL; if (n < 0) { @@ -1499,7 +1499,7 @@ if (decoded == NULL) goto fail; - result = TextIOWrapper_get_decoded_chars(self, -1); + result = textiowrapper_get_decoded_chars(self, -1); if (result == NULL) { Py_DECREF(decoded); @@ -1517,14 +1517,14 @@ int res = 1; Py_ssize_t remaining = n; - result = TextIOWrapper_get_decoded_chars(self, n); + result = textiowrapper_get_decoded_chars(self, n); if (result == NULL) goto fail; remaining -= PyUnicode_GET_SIZE(result); /* Keep reading chunks until we have n characters to return */ while (remaining > 0) { - res = TextIOWrapper_read_chunk(self); + res = textiowrapper_read_chunk(self); if (res < 0) goto fail; if (res == 0) /* EOF */ @@ -1537,7 +1537,7 @@ if (PyList_Append(chunks, result) < 0) goto fail; Py_DECREF(result); - result = TextIOWrapper_get_decoded_chars(self, remaining); + result = textiowrapper_get_decoded_chars(self, remaining); if (result == NULL) goto fail; remaining -= PyUnicode_GET_SIZE(result); @@ -1662,7 +1662,7 @@ } static PyObject * -_TextIOWrapper_readline(PyTextIOWrapperObject *self, Py_ssize_t limit) +_textiowrapper_readline(textio *self, Py_ssize_t limit) { PyObject *line = NULL, *chunks = NULL, *remaining = NULL; Py_ssize_t start, endpos, chunked, offset_to_buffer; @@ -1670,7 +1670,7 @@ CHECK_CLOSED(self); - if (_TextIOWrapper_writeflush(self) < 0) + if (_textiowrapper_writeflush(self) < 0) return NULL; chunked = 0; @@ -1684,7 +1684,7 @@ res = 1; while (!self->decoded_chars || !PyUnicode_GET_SIZE(self->decoded_chars)) { - res = TextIOWrapper_read_chunk(self); + res = textiowrapper_read_chunk(self); if (res < 0) goto error; if (res == 0) @@ -1692,7 +1692,7 @@ } if (res == 0) { /* end of file */ - TextIOWrapper_set_decoded_chars(self, NULL); + textiowrapper_set_decoded_chars(self, NULL); Py_CLEAR(self->snapshot); start = endpos = offset_to_buffer = 0; break; @@ -1763,7 +1763,7 @@ } Py_CLEAR(line); /* We have consumed the buffer */ - TextIOWrapper_set_decoded_chars(self, NULL); + textiowrapper_set_decoded_chars(self, NULL); } if (line != NULL) { @@ -1816,7 +1816,7 @@ } static PyObject * -TextIOWrapper_readline(PyTextIOWrapperObject *self, PyObject *args) +textiowrapper_readline(textio *self, PyObject *args) { Py_ssize_t limit = -1; @@ -1824,7 +1824,7 @@ if (!PyArg_ParseTuple(args, "|n:readline", &limit)) { return NULL; } - return _TextIOWrapper_readline(self, limit); + return _textiowrapper_readline(self, limit); } /* Seek and Tell */ @@ -1835,7 +1835,7 @@ int bytes_to_feed; int chars_to_skip; char need_eof; -} CookieStruct; +} cookie_type; /* To speed up cookie packing/unpacking, we store the fields in a temporary @@ -1876,7 +1876,7 @@ #endif static int -TextIOWrapper_parseCookie(CookieStruct *cookie, PyObject *cookieObj) +textiowrapper_parse_cookie(cookie_type *cookie, PyObject *cookieObj) { unsigned char buffer[COOKIE_BUF_LEN]; PyLongObject *cookieLong = (PyLongObject *)PyNumber_Long(cookieObj); @@ -1900,7 +1900,7 @@ } static PyObject * -TextIOWrapper_buildCookie(CookieStruct *cookie) +textiowrapper_build_cookie(cookie_type *cookie) { unsigned char buffer[COOKIE_BUF_LEN]; @@ -1915,8 +1915,7 @@ #undef IS_LITTLE_ENDIAN static int -_TextIOWrapper_decoder_setstate(PyTextIOWrapperObject *self, - CookieStruct *cookie) +_textiowrapper_decoder_setstate(textio *self, cookie_type *cookie) { PyObject *res; /* When seeking to the start of the stream, we call decoder.reset() @@ -1937,11 +1936,10 @@ } static int -_TextIOWrapper_encoder_setstate(PyTextIOWrapperObject *self, - CookieStruct *cookie) +_textiowrapper_encoder_setstate(textio *self, cookie_type *cookie) { PyObject *res; - /* Same as _TextIOWrapper_decoder_setstate() above. */ + /* Same as _textiowrapper_decoder_setstate() above. */ if (cookie->start_pos == 0 && cookie->dec_flags == 0) { res = PyObject_CallMethodObjArgs(self->encoder, _PyIO_str_reset, NULL); self->encoding_start_of_stream = 1; @@ -1958,10 +1956,10 @@ } static PyObject * -TextIOWrapper_seek(PyTextIOWrapperObject *self, PyObject *args) +textiowrapper_seek(textio *self, PyObject *args) { PyObject *cookieObj, *posobj; - CookieStruct cookie; + cookie_type cookie; int whence = 0; PyObject *res; int cmp; @@ -2018,7 +2016,7 @@ goto fail; Py_DECREF(res); - TextIOWrapper_set_decoded_chars(self, NULL); + textiowrapper_set_decoded_chars(self, NULL); Py_CLEAR(self->snapshot); if (self->decoder) { res = PyObject_CallMethod(self->decoder, "reset", NULL); @@ -2055,7 +2053,7 @@ /* The strategy of seek() is to go back to the safe start point * and replay the effect of read(chars_to_skip) from there. */ - if (TextIOWrapper_parseCookie(&cookie, cookieObj) < 0) + if (textiowrapper_parse_cookie(&cookie, cookieObj) < 0) goto fail; /* Seek back to the safe start point. */ @@ -2069,12 +2067,12 @@ goto fail; Py_DECREF(res); - TextIOWrapper_set_decoded_chars(self, NULL); + textiowrapper_set_decoded_chars(self, NULL); Py_CLEAR(self->snapshot); /* Restore the decoder to its state from the safe start point. */ if (self->decoder) { - if (_TextIOWrapper_decoder_setstate(self, &cookie) < 0) + if (_textiowrapper_decoder_setstate(self, &cookie) < 0) goto fail; } @@ -2101,7 +2099,7 @@ if (decoded == NULL) goto fail; - TextIOWrapper_set_decoded_chars(self, decoded); + textiowrapper_set_decoded_chars(self, decoded); /* Skip chars_to_skip of the decoded characters. */ if (PyUnicode_GetSize(self->decoded_chars) < cookie.chars_to_skip) { @@ -2118,7 +2116,7 @@ /* Finally, reset the encoder (merely useful for proper BOM handling) */ if (self->encoder) { - if (_TextIOWrapper_encoder_setstate(self, &cookie) < 0) + if (_textiowrapper_encoder_setstate(self, &cookie) < 0) goto fail; } return cookieObj; @@ -2129,11 +2127,11 @@ } static PyObject * -TextIOWrapper_tell(PyTextIOWrapperObject *self, PyObject *args) +textiowrapper_tell(textio *self, PyObject *args) { PyObject *res; PyObject *posobj = NULL; - CookieStruct cookie = {0,0,0,0,0}; + cookie_type cookie = {0,0,0,0,0}; PyObject *next_input; Py_ssize_t chars_to_skip, chars_decoded; PyObject *saved_state = NULL; @@ -2153,7 +2151,7 @@ goto fail; } - if (_TextIOWrapper_writeflush(self) < 0) + if (_textiowrapper_writeflush(self) < 0) return NULL; res = PyObject_CallMethod((PyObject *)self, "flush", NULL); if (res == NULL) @@ -2189,7 +2187,7 @@ if (self->decoded_chars_used == 0) { /* We haven't moved from the snapshot point. */ Py_DECREF(posobj); - return TextIOWrapper_buildCookie(&cookie); + return textiowrapper_build_cookie(&cookie); } chars_to_skip = self->decoded_chars_used; @@ -2203,7 +2201,7 @@ goto fail; /* Note our initial start point. */ - if (_TextIOWrapper_decoder_setstate(self, &cookie) < 0) + if (_textiowrapper_decoder_setstate(self, &cookie) < 0) goto fail; /* Feed the decoder one byte at a time. As we go, note the @@ -2280,7 +2278,7 @@ /* The returned cookie corresponds to the last safe start point. */ cookie.chars_to_skip = Py_SAFE_DOWNCAST(chars_to_skip, Py_ssize_t, int); - return TextIOWrapper_buildCookie(&cookie); + return textiowrapper_build_cookie(&cookie); fail: Py_XDECREF(posobj); @@ -2300,7 +2298,7 @@ } static PyObject * -TextIOWrapper_truncate(PyTextIOWrapperObject *self, PyObject *args) +textiowrapper_truncate(textio *self, PyObject *args) { PyObject *pos = Py_None; PyObject *res; @@ -2327,7 +2325,7 @@ } static PyObject * -TextIOWrapper_repr(PyTextIOWrapperObject *self) +textiowrapper_repr(textio *self) { PyObject *nameobj, *res; @@ -2354,53 +2352,53 @@ /* Inquiries */ static PyObject * -TextIOWrapper_fileno(PyTextIOWrapperObject *self, PyObject *args) +textiowrapper_fileno(textio *self, PyObject *args) { CHECK_INITIALIZED(self); return PyObject_CallMethod(self->buffer, "fileno", NULL); } static PyObject * -TextIOWrapper_seekable(PyTextIOWrapperObject *self, PyObject *args) +textiowrapper_seekable(textio *self, PyObject *args) { CHECK_INITIALIZED(self); return PyObject_CallMethod(self->buffer, "seekable", NULL); } static PyObject * -TextIOWrapper_readable(PyTextIOWrapperObject *self, PyObject *args) +textiowrapper_readable(textio *self, PyObject *args) { CHECK_INITIALIZED(self); return PyObject_CallMethod(self->buffer, "readable", NULL); } static PyObject * -TextIOWrapper_writable(PyTextIOWrapperObject *self, PyObject *args) +textiowrapper_writable(textio *self, PyObject *args) { CHECK_INITIALIZED(self); return PyObject_CallMethod(self->buffer, "writable", NULL); } static PyObject * -TextIOWrapper_isatty(PyTextIOWrapperObject *self, PyObject *args) +textiowrapper_isatty(textio *self, PyObject *args) { CHECK_INITIALIZED(self); return PyObject_CallMethod(self->buffer, "isatty", NULL); } static PyObject * -TextIOWrapper_flush(PyTextIOWrapperObject *self, PyObject *args) +textiowrapper_flush(textio *self, PyObject *args) { CHECK_INITIALIZED(self); CHECK_CLOSED(self); self->telling = self->seekable; - if (_TextIOWrapper_writeflush(self) < 0) + if (_textiowrapper_writeflush(self) < 0) return NULL; return PyObject_CallMethod(self->buffer, "flush", NULL); } static PyObject * -TextIOWrapper_close(PyTextIOWrapperObject *self, PyObject *args) +textiowrapper_close(textio *self, PyObject *args) { PyObject *res; CHECK_INITIALIZED(self); @@ -2416,7 +2414,7 @@ } static PyObject * -TextIOWrapper_iternext(PyTextIOWrapperObject *self) +textiowrapper_iternext(textio *self) { PyObject *line; @@ -2425,7 +2423,7 @@ self->telling = 0; if (Py_TYPE(self) == &PyTextIOWrapper_Type) { /* Skip method call overhead for speed */ - line = _TextIOWrapper_readline(self, -1); + line = _textiowrapper_readline(self, -1); } else { line = PyObject_CallMethodObjArgs((PyObject *)self, @@ -2454,21 +2452,21 @@ } static PyObject * -TextIOWrapper_name_get(PyTextIOWrapperObject *self, void *context) +textiowrapper_name_get(textio *self, void *context) { CHECK_INITIALIZED(self); return PyObject_GetAttrString(self->buffer, "name"); } static PyObject * -TextIOWrapper_closed_get(PyTextIOWrapperObject *self, void *context) +textiowrapper_closed_get(textio *self, void *context) { CHECK_INITIALIZED(self); return PyObject_GetAttr(self->buffer, _PyIO_str_closed); } static PyObject * -TextIOWrapper_newlines_get(PyTextIOWrapperObject *self, void *context) +textiowrapper_newlines_get(textio *self, void *context) { PyObject *res; CHECK_INITIALIZED(self); @@ -2488,22 +2486,21 @@ } static PyObject * -TextIOWrapper_errors_get(PyTextIOWrapperObject *self, void *context) +textiowrapper_errors_get(textio *self, void *context) { CHECK_INITIALIZED(self); return PyUnicode_FromString(PyBytes_AS_STRING(self->errors)); } static PyObject * -TextIOWrapper_chunk_size_get(PyTextIOWrapperObject *self, void *context) +textiowrapper_chunk_size_get(textio *self, void *context) { CHECK_INITIALIZED(self); return PyLong_FromSsize_t(self->chunk_size); } static int -TextIOWrapper_chunk_size_set(PyTextIOWrapperObject *self, - PyObject *arg, void *context) +textiowrapper_chunk_size_set(textio *self, PyObject *arg, void *context) { Py_ssize_t n; CHECK_INITIALIZED_INT(self); @@ -2519,56 +2516,56 @@ return 0; } -static PyMethodDef TextIOWrapper_methods[] = { - {"detach", (PyCFunction)TextIOWrapper_detach, METH_NOARGS}, - {"write", (PyCFunction)TextIOWrapper_write, METH_VARARGS}, - {"read", (PyCFunction)TextIOWrapper_read, METH_VARARGS}, - {"readline", (PyCFunction)TextIOWrapper_readline, METH_VARARGS}, - {"flush", (PyCFunction)TextIOWrapper_flush, METH_NOARGS}, - {"close", (PyCFunction)TextIOWrapper_close, METH_NOARGS}, - - {"fileno", (PyCFunction)TextIOWrapper_fileno, METH_NOARGS}, - {"seekable", (PyCFunction)TextIOWrapper_seekable, METH_NOARGS}, - {"readable", (PyCFunction)TextIOWrapper_readable, METH_NOARGS}, - {"writable", (PyCFunction)TextIOWrapper_writable, METH_NOARGS}, - {"isatty", (PyCFunction)TextIOWrapper_isatty, METH_NOARGS}, - - {"seek", (PyCFunction)TextIOWrapper_seek, METH_VARARGS}, - {"tell", (PyCFunction)TextIOWrapper_tell, METH_NOARGS}, - {"truncate", (PyCFunction)TextIOWrapper_truncate, METH_VARARGS}, +static PyMethodDef textiowrapper_methods[] = { + {"detach", (PyCFunction)textiowrapper_detach, METH_NOARGS}, + {"write", (PyCFunction)textiowrapper_write, METH_VARARGS}, + {"read", (PyCFunction)textiowrapper_read, METH_VARARGS}, + {"readline", (PyCFunction)textiowrapper_readline, METH_VARARGS}, + {"flush", (PyCFunction)textiowrapper_flush, METH_NOARGS}, + {"close", (PyCFunction)textiowrapper_close, METH_NOARGS}, + + {"fileno", (PyCFunction)textiowrapper_fileno, METH_NOARGS}, + {"seekable", (PyCFunction)textiowrapper_seekable, METH_NOARGS}, + {"readable", (PyCFunction)textiowrapper_readable, METH_NOARGS}, + {"writable", (PyCFunction)textiowrapper_writable, METH_NOARGS}, + {"isatty", (PyCFunction)textiowrapper_isatty, METH_NOARGS}, + + {"seek", (PyCFunction)textiowrapper_seek, METH_VARARGS}, + {"tell", (PyCFunction)textiowrapper_tell, METH_NOARGS}, + {"truncate", (PyCFunction)textiowrapper_truncate, METH_VARARGS}, {NULL, NULL} }; -static PyMemberDef TextIOWrapper_members[] = { - {"encoding", T_OBJECT, offsetof(PyTextIOWrapperObject, encoding), READONLY}, - {"buffer", T_OBJECT, offsetof(PyTextIOWrapperObject, buffer), READONLY}, - {"line_buffering", T_BOOL, offsetof(PyTextIOWrapperObject, line_buffering), READONLY}, +static PyMemberDef textiowrapper_members[] = { + {"encoding", T_OBJECT, offsetof(textio, encoding), READONLY}, + {"buffer", T_OBJECT, offsetof(textio, buffer), READONLY}, + {"line_buffering", T_BOOL, offsetof(textio, line_buffering), READONLY}, {NULL} }; -static PyGetSetDef TextIOWrapper_getset[] = { - {"name", (getter)TextIOWrapper_name_get, NULL, NULL}, - {"closed", (getter)TextIOWrapper_closed_get, NULL, NULL}, +static PyGetSetDef textiowrapper_getset[] = { + {"name", (getter)textiowrapper_name_get, NULL, NULL}, + {"closed", (getter)textiowrapper_closed_get, NULL, NULL}, /* {"mode", (getter)TextIOWrapper_mode_get, NULL, NULL}, */ - {"newlines", (getter)TextIOWrapper_newlines_get, NULL, NULL}, - {"errors", (getter)TextIOWrapper_errors_get, NULL, NULL}, - {"_CHUNK_SIZE", (getter)TextIOWrapper_chunk_size_get, - (setter)TextIOWrapper_chunk_size_set, NULL}, + {"newlines", (getter)textiowrapper_newlines_get, NULL, NULL}, + {"errors", (getter)textiowrapper_errors_get, NULL, NULL}, + {"_CHUNK_SIZE", (getter)textiowrapper_chunk_size_get, + (setter)textiowrapper_chunk_size_set, NULL}, {NULL} }; PyTypeObject PyTextIOWrapper_Type = { PyVarObject_HEAD_INIT(NULL, 0) "_io.TextIOWrapper", /*tp_name*/ - sizeof(PyTextIOWrapperObject), /*tp_basicsize*/ + sizeof(textio), /*tp_basicsize*/ 0, /*tp_itemsize*/ - (destructor)TextIOWrapper_dealloc, /*tp_dealloc*/ + (destructor)textiowrapper_dealloc, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tps_etattr*/ 0, /*tp_compare */ - (reprfunc)TextIOWrapper_repr,/*tp_repr*/ + (reprfunc)textiowrapper_repr,/*tp_repr*/ 0, /*tp_as_number*/ 0, /*tp_as_sequence*/ 0, /*tp_as_mapping*/ @@ -2580,22 +2577,22 @@ 0, /*tp_as_buffer*/ Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE | Py_TPFLAGS_HAVE_GC, /*tp_flags*/ - TextIOWrapper_doc, /* tp_doc */ - (traverseproc)TextIOWrapper_traverse, /* tp_traverse */ - (inquiry)TextIOWrapper_clear, /* tp_clear */ + textiowrapper_doc, /* tp_doc */ + (traverseproc)textiowrapper_traverse, /* tp_traverse */ + (inquiry)textiowrapper_clear, /* tp_clear */ 0, /* tp_richcompare */ - offsetof(PyTextIOWrapperObject, weakreflist), /*tp_weaklistoffset*/ + offsetof(textio, weakreflist), /*tp_weaklistoffset*/ 0, /* tp_iter */ - (iternextfunc)TextIOWrapper_iternext, /* tp_iternext */ - TextIOWrapper_methods, /* tp_methods */ - TextIOWrapper_members, /* tp_members */ - TextIOWrapper_getset, /* tp_getset */ + (iternextfunc)textiowrapper_iternext, /* tp_iternext */ + textiowrapper_methods, /* tp_methods */ + textiowrapper_members, /* tp_members */ + textiowrapper_getset, /* tp_getset */ 0, /* tp_base */ 0, /* tp_dict */ 0, /* tp_descr_get */ 0, /* tp_descr_set */ - offsetof(PyTextIOWrapperObject, dict), /*tp_dictoffset*/ - (initproc)TextIOWrapper_init, /* tp_init */ + offsetof(textio, dict), /*tp_dictoffset*/ + (initproc)textiowrapper_init, /* tp_init */ 0, /* tp_alloc */ PyType_GenericNew, /* tp_new */ }; From buildbot at python.org Fri Jun 12 05:15:10 2009 From: buildbot at python.org (buildbot at python.org) Date: Fri, 12 Jun 2009 03:15:10 +0000 Subject: [Python-checkins] buildbot failure in sparc solaris10 gcc 3.x Message-ID: <20090612031510.20E5DD26C@mail.python.org> The Buildbot has detected a new failure of sparc solaris10 gcc 3.x. Full details are available at: http://www.python.org/dev/buildbot/all/sparc%20solaris10%20gcc%203.x/builds/817 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: loewis-sun Build Reason: Build Source Stamp: [branch branches/py3k] HEAD Blamelist: benjamin.peterson,raymond.hettinger BUILD FAILED: failed test Excerpt from the test logfile: 2 tests failed: test_import test_posix ====================================================================== ERROR: test_getcwd_long_pathnames (test.test_posix.PosixTester) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home2/buildbot/slave/3.x.loewis-sun/build/Lib/test/test_posix.py", line 251, in test_getcwd_long_pathnames support.rmtree(base_path) File "/home2/buildbot/slave/3.x.loewis-sun/build/Lib/test/support.py", line 181, in rmtree shutil.rmtree(path) File "/home2/buildbot/slave/3.x.loewis-sun/build/Lib/shutil.py", line 239, in rmtree onerror(os.rmdir, path, sys.exc_info()) File "/home2/buildbot/slave/3.x.loewis-sun/build/Lib/shutil.py", line 237, in rmtree os.rmdir(path) OSError: [Errno 22] Invalid argument: '/home2/buildbot/slave/3.x.loewis-sun/build/@test.getcwd/@test.getcwd' sincerely, -The Buildbot From ncoghlan at gmail.com Fri Jun 12 11:24:30 2009 From: ncoghlan at gmail.com (Nick Coghlan) Date: Fri, 12 Jun 2009 19:24:30 +1000 Subject: [Python-checkins] r73379 - sandbox/trunk/2to3/lib2to3/fixes/fix_dict.py In-Reply-To: <20090611230621.5B30EDA39@mail.python.org> References: <20090611230621.5B30EDA39@mail.python.org> Message-ID: <4A321ECE.1050905@gmail.com> benjamin.peterson wrote: > Author: benjamin.peterson > Date: Fri Jun 12 01:06:21 2009 > New Revision: 73379 > > Log: > use a real conditional expresion > > Modified: > sandbox/trunk/2to3/lib2to3/fixes/fix_dict.py > > Modified: sandbox/trunk/2to3/lib2to3/fixes/fix_dict.py > ============================================================================== > --- sandbox/trunk/2to3/lib2to3/fixes/fix_dict.py (original) > +++ sandbox/trunk/2to3/lib2to3/fixes/fix_dict.py Fri Jun 12 01:06:21 2009 > @@ -66,7 +66,7 @@ > new = pytree.Node(syms.power, args) > if not special: > new.prefix = u"" > - new = Call(Name(isiter and u"iter" or u"list"), [new]) > + new = Call(u"iter" if isiter else u"list"), [new]) I'm not all that familiar with 2to3 - was the removal of the call to Name() here deliberate? Cheers, Nick. -- Nick Coghlan | ncoghlan at gmail.com | Brisbane, Australia --------------------------------------------------------------- From python-checkins at python.org Fri Jun 12 12:00:17 2009 From: python-checkins at python.org (tarek.ziade) Date: Fri, 12 Jun 2009 12:00:17 +0200 (CEST) Subject: [Python-checkins] r73386 - peps/trunk/pep-0376.txt Message-ID: <20090612100017.A69B2C545@mail.python.org> Author: tarek.ziade Date: Fri Jun 12 12:00:17 2009 New Revision: 73386 Log: renamed APIs Modified: peps/trunk/pep-0376.txt Modified: peps/trunk/pep-0376.txt ============================================================================== --- peps/trunk/pep-0376.txt (original) +++ peps/trunk/pep-0376.txt Fri Jun 12 12:00:17 2009 @@ -24,7 +24,7 @@ Definitions =========== -A **project** is a distribution of one or several files, which can be Python +A **project** is a distribution of one or several files, which can be Python modules, extensions or data. It is distributed using a `setup.py` script with Distutils and/or Setuptools. The `setup.py` script indicates where each elements should be installed. @@ -130,7 +130,7 @@ Notice that this change is based on the standard proposed by `EggFormats`. Although, this standard proposes two ways to install files : -- a self-contained directory that can be zipped or left unzipped and that +- a self-contained directory that can be zipped or left unzipped and that contains the project files *and* the `.egg-info` directory. - a distinct `.egg-info` directory located in the site-packages directory. @@ -156,7 +156,7 @@ name + '-' + version + '.egg-info' The egg-info directory name is created using a new function called -``egg_info_dirname(name, version)`` added to ``pkgutil``. ``name`` is +``egginfo_dirname(name, version)`` added to ``pkgutil``. ``name`` is converted to a standard distribution name any runs of non-alphanumeric characters are replaced with a single '-'. ``version`` is converted to a standard version string. Spaces become dots, and all other @@ -166,13 +166,13 @@ Examples:: - >>> egg_info_dirname('zlib', '2.5.2') + >>> egginfo_dirname('zlib', '2.5.2') 'zlib-2.5.2.egg-info' - >>> egg_info_dirname('python-ldap', '2.5') + >>> egginfo_dirname('python-ldap', '2.5') 'python_ldap-2.5.egg-info' - >>> egg_info_dirname('python-ldap', '2.5 a---5') + >>> egginfo_dirname('python-ldap', '2.5 a---5') 'python_ldap-2.5.a_5.egg-info' Adding a RECORD file in the .egg-info directory @@ -183,7 +183,7 @@ to the files listed by the `record` option of the `install` command, and will be generated by default. This will allow uninstallation, as explained later in this PEP. The `install` command will also provide an option to prevent the `RECORD` -file from being written and this option should be used when creating system +file from being written and this option should be used when creating system packages. Third-party installation tools also should not overwrite or delete files @@ -253,14 +253,14 @@ The `install` command will have a new option called `installer`. This option is the name of the tool used to invoke the installation. It's an normalized -lower-case string matching `[a-z0-9_\-\.]`. +lower-case string matching `[a-z0-9_\-\.]`. $ python setup.py install --installer=pkg-system It will default to `distutils` if not provided. -When a project is installed, the INSTALLER file is generated in the -`.egg-info` directory with this value, to keep track of **who** installed the +When a project is installed, the INSTALLER file is generated in the +`.egg-info` directory with this value, to keep track of **who** installed the project. The file is a single-line text file. New APIs in pkgutil @@ -271,24 +271,24 @@ The API is organized in three classes: -- ``EggInfo``: manages an `.egg-info` directory. -- ``EggInfoDirectory``: manages a directory that contains some `.egg-info` +- ``Distribution``: manages an `.egg-info` directory. +- ``DistributionDirectory``: manages a directory that contains some `.egg-info` directories. -- ``EggInfoDirectories``: manages ``EggInfoDirectory`` instances. +- ``DistributionDirectories``: manages ``EggInfoDirectory`` instances. -EggInfo class -------------- +Distribution class +------------------ -A new class called ``EggInfo`` is created with a the path of the `.egg-info` -directory provided to the contructor. It reads the metadata contained in -`PKG-INFO` when it is instanciated. +A new class called ``Distribution`` is created with a the path of the +`.egg-info` directory provided to the contructor. It reads the metadata +contained in `PKG-INFO` when it is instanciated. -``EggInfo`` provides the following attributes: +``Distribution`` provides the following attributes: -- ``name``: The name of the project +- ``name``: The name of the distribution. -- ``metadata``: A ``DistributionMetadata`` instance loaded with the project's - PKG-INFO file +- ``metadata``: A ``DistributionMetadata`` instance loaded with the + distribution's PKG-INFO file. And following methods: @@ -303,21 +303,21 @@ Returns ``True`` if ``path`` is listed in `RECORD`. ``path`` can be a local absolute path or a relative '/'-separated path. -- ``get_egg_info(path, binary=False)`` -> file object +- ``get_egginfo_file(path, binary=False)`` -> file object Returns a file located under the `.egg-info` directory. Returns a ``file`` instance for the file pointed by ``path``. - ``path`` has to be a '/'-separated path relative to the `.egg-info` + ``path`` has to be a '/'-separated path relative to the `.egg-info` directory or an absolute path. - If ``path`` is an absolute path and doesn't start with the `.egg-info` + If ``path`` is an absolute path and doesn't start with the `.egg-info` directory path, a ``DistutilsError`` is raised. If ``binary`` is ``True``, opens the file in binary mode. -- ``get_egg_info_files(local=False)`` -> iterator of paths +- ``get_egginfo_files(local=False)`` -> iterator of paths Iterates over the `RECORD` entries and return paths for each line if the path is pointing a file located in the `.egg-info` directory or one of its @@ -327,130 +327,119 @@ local absolute path. Otherwise the raw value from `RECORD` is returned. -EggInfoDirectory class ----------------------- +DistributionDirectory class +--------------------------- -A new class called ``EggInfoDirectory`` is created with a path corresponding -to a directory. For each `.egg-info` directory founded in `path`, the class -creates a corresponding ``EggInfo``. +A new class called ``DistributionDirectory`` is created with a path +corresponding to a directory. For each `.egg-info` directory founded in +`path`, the class creates a corresponding ``Distribution``. -The class is iterable, and returns every ``EggInfo`` instance created. +The class is a ``set`` of ``Distribution`` instances. ``DistributionDirectory`` +provides a ``path`` attribute corresponding to the path is was created with. -It also provides two methods: +It also provides two methods besides the ones from ``set``: -- ``file_users(path)`` -> Iterator of ``EggInfo``. +- ``file_users(path)`` -> Iterator of ``Distribution``. - Returns all ``EggInfo`` which uses ``path``, by calling - ``EggInfo.uses(path)`` on all ``EggInfo`` instances. + Returns all ``Distribution`` which uses ``path``, by calling + ``Distribution.uses(path)`` on all ``Distribution`` instances. -- ``owner(path)`` -> ``EggInfo`` instance or None +- ``owner(path)`` -> ``Distribution`` instance or None - If ``path`` is used by only one ``EggInfo`` instance, returns it. + If ``path`` is used by only one ``Distribution`` instance, returns it. Otherwise returns None. -EggInfoDirectories class -------------------------- +DistributionDirectories class +----------------------------- -A new class called ``EggInfoDirectories`` is created. It's a collection of -``EggInfoDirectory`` instances. The constructor takes one optional +A new class called ``DistributionDirectories`` is created. It's a collection of +``DistributionDirectory`` instances. The constructor takes one optional argument ``use_cache`` set to ``True`` by default. When ``True``, -``EggInfoDirectories`` will use a global cache to reduce the numbers of I/O -accesses and speed up the lookups. +``DistributionDirectories`` will use a global cache to reduce the numbers of +I/O accesses and speed up the lookups. -The cache is a global mapping containing ``EggInfoDirectory`` instances. -When an ``EggInfoDirectories`` object is created, it will use the cache to +The cache is a global mapping containing ``DistributionDirectory`` instances. +When an ``DistributionDirectories`` object is created, it will use the cache to add an entry for each path it visits, or reuse existing entries. The cache -usage can be disabled at any time with the `use_cache` attribute. +usage can be disabled at any time with the ``use_cache`` attribute. The cache can also be emptied with the global ``purge_cache`` function. -The class is iterable, and returns every ``EggInfo`` instance from every -``EggInfoDirectory`` instance it contains. +The class is a ``dict`` where the values are ``DistributionDirectory`` +instances and the keys are their path attributes. -``EggInfoDirectories`` also provides the following container and helper -methods: +``EggInfoDirectories`` also provides the following methods besides the ones +from ``dict``: - ``append(path)`` - Creates an ``EggInfoDirectory`` instance. for ``path`` appends it. - -- ``remove(egg_info_dir)`` - - Removes the ``EggInfoDirectory`` instance for the given ``path``. - -- ``clear()`` - - Removes all elements. + Creates an ``DistributionDirectory`` instance for ``path`` and adds it + in the mapping. - ``load(paths)`` - Creates and adds ``EggInfoDirectory`` instances corresponding to ``paths``. + Creates and adds ``DistributionDirectory`` instances corresponding to + ``paths``. - ``reload()`` Reloads existing entries. -- ``get_egg_infos()`` -> Iterator of ``EggInfo`` instances. +- ``get_distributions()`` -> Iterator of ``Distribution`` instances. - Iterates over all ``EggInfo`` contained in ``EggInfoDirectory`` instances. + Iterates over all ``Distribution`` contained in ``DistributionDirectory`` + instances. -- ``get_egg_info(project_name)`` -> ``EggInfo`` or None. +- ``get_distribution(project_name)`` -> ``Distribution`` or None. - Returns an EggInfo instance for the given project name. + Returns a ``Distribution`` instance for the given project name. If not found, returns None. -- ``get_file_users(path)`` -> Iterator of ``EggInfo`` instances. +- ``get_file_users(path)`` -> Iterator of ``Distribution`` instances. Iterates over all projects to find out which project uses the file. - Returns ``EggInfo`` instances. + Returns ``Distribution`` instances. .egg-info functions ------------------- The new functions added in the ``pkgutil`` are : -- ``get_egg_infos(paths=sys.path)`` -> iterator +- ``get_distributions()`` -> iterator of ``Distribution`` instance. Provides an iterator that looks for ``.egg-info`` directories in ``sys.path`` - and returns ``EggInfo`` instances for each one of them. + and returns ``Distribution`` instances for each one of them. -- ``get_egg_info(project_name, paths=sys.path)`` -> path or None +- ``get_distribution(name)`` -> ``Distribution`` or None. Scans all elements in ``sys.path`` and looks for all directories ending with - ``.egg-info``. Returns an ``EggInfo`` corresponding to the ``.egg-info`` - directory that contains a PKG-INFO that matches `project_name` for the `name` + ``.egg-info``. Returns an ``Distribution`` corresponding to the ``.egg-info`` + directory that contains a PKG-INFO that matches `name` for the `name` metadata. Notice that there should be at most one result. The first result founded will be returned. If the directory is not found, returns None. -- ``get_file_users(path, paths=sys.path)`` -> iterator of ``EggInfo`` instances. +- ``get_file_users(path)`` -> iterator of ``Distribution`` instances. Iterates over all projects to find out which project uses ``path``. ``path`` can be a local absolute path or a relative '/'-separated path. -All these functions use the same global instance of ``EggInfoDirectories`` to -use the cache. Notice that the cache is never emptied explicitely so it keeps -on growing everytime it is used with new paths. +All these functions use the same global instance of ``DistributionDirectories``to use the cache. Notice that the cache is never emptied explicitely. Example ------- Let's use some of the new APIs with our `zlib` example:: - >>> from pkgutil import get_egg_info, get_file_users - >>> egg_info = get_egg_info('zlib') - >>> egg_info.name + >>> from pkgutil import get_distribution, get_file_users + >>> dist = get_distribution('zlib') + >>> dist.name 'zlib' - >>> egg_info.metadata.version - '2.5.2' - - '/opt/local/lib/python2.6/site-packages/zlib-2.5.2.egg-info' - >>> metadata = get_metadata('zlib') - >>> metadata.version + >>> dist.metadata.version '2.5.2' - >>> for path, hash, size in egg_info.get_installed_files():: + >>> for path, hash, size in dist.get_installed_files():: ... print '%s %s %d %s' % (path, hash, size) ... zlib/include/zconf.h b690274f621402dda63bf11ba5373bf2 9544 @@ -460,10 +449,10 @@ zlib-2.5.2.egg-info/PKG-INFO 6fe57de576d749536082d8e205b77748 195 zlib-2.5.2.egg-info/RECORD None None - >>> egg_info.uses('zlib/include/zlib.h') + >>> dist.uses('zlib/include/zlib.h') True - >>> egg_info.get_file('zlib/include/zlib.h') + >>> dist.get_egginfo_file('PKG-INFO') PEP 262 replacement @@ -542,7 +531,7 @@ the ``uninstall`` function takes an extra argument ``installer`` which default to ``distutils``. -When called, ``uninstall`` will control that the ``INSTALLER`` file matches +When called, ``uninstall`` will control that the ``INSTALLER`` file matches this argument. If not, it will raise a ``DistutilsUninstallError``:: >>> uninstall('zlib') @@ -552,7 +541,7 @@ >>> uninstall('zlib', installer='cool-pkg-manager') -This allows a third-party application to use the ``uninstall`` function +This allows a third-party application to use the ``uninstall`` function and make sure it's the only program that can remove a project it has previously installed. This is useful when a third-party program that relies on Distutils APIs does extra steps on the system at installation time, From python-checkins at python.org Fri Jun 12 13:25:59 2009 From: python-checkins at python.org (raymond.hettinger) Date: Fri, 12 Jun 2009 13:25:59 +0200 (CEST) Subject: [Python-checkins] r73387 - python/branches/py3k/Lib/importlib/test/import_/test_meta_path.py Message-ID: <20090612112559.81FF7D784@mail.python.org> Author: raymond.hettinger Date: Fri Jun 12 13:25:59 2009 New Revision: 73387 Log: Fixup/simplify another nested context manager. Modified: python/branches/py3k/Lib/importlib/test/import_/test_meta_path.py Modified: python/branches/py3k/Lib/importlib/test/import_/test_meta_path.py ============================================================================== --- python/branches/py3k/Lib/importlib/test/import_/test_meta_path.py (original) +++ python/branches/py3k/Lib/importlib/test/import_/test_meta_path.py Fri Jun 12 13:25:59 2009 @@ -1,6 +1,5 @@ from .. import util from . import util as import_util -from contextlib import nested from types import MethodType import unittest @@ -18,8 +17,7 @@ mod = 'top_level' first = util.mock_modules(mod) second = util.mock_modules(mod) - context = nested(util.mock_modules(mod), util.mock_modules(mod)) - with context as (first, second): + with util.mock_modules(mod) as first, util.mock_modules(mod) as second: first.modules[mod] = 42 second.modules[mod] = -13 with util.import_state(meta_path=[first, second]): @@ -28,9 +26,8 @@ def test_continuing(self): # [continuing] mod_name = 'for_real' - first = util.mock_modules('nonexistent') - second = util.mock_modules(mod_name) - with nested(first, second): + with util.mock_modules('nonexistent') as first, \ + util.mock_modules(mod_name) as second: first.find_module = lambda self, fullname, path=None: None second.modules[mod_name] = 42 with util.import_state(meta_path=[first, second]): From buildbot at python.org Fri Jun 12 14:15:03 2009 From: buildbot at python.org (buildbot at python.org) Date: Fri, 12 Jun 2009 12:15:03 +0000 Subject: [Python-checkins] buildbot failure in sparc solaris10 gcc 3.x Message-ID: <20090612121503.518D0C4D3@mail.python.org> The Buildbot has detected a new failure of sparc solaris10 gcc 3.x. Full details are available at: http://www.python.org/dev/buildbot/all/sparc%20solaris10%20gcc%203.x/builds/819 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: loewis-sun Build Reason: Build Source Stamp: [branch branches/py3k] HEAD Blamelist: raymond.hettinger BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_posix ====================================================================== ERROR: test_getcwd_long_pathnames (test.test_posix.PosixTester) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home2/buildbot/slave/3.x.loewis-sun/build/Lib/test/test_posix.py", line 251, in test_getcwd_long_pathnames support.rmtree(base_path) File "/home2/buildbot/slave/3.x.loewis-sun/build/Lib/test/support.py", line 181, in rmtree shutil.rmtree(path) File "/home2/buildbot/slave/3.x.loewis-sun/build/Lib/shutil.py", line 239, in rmtree onerror(os.rmdir, path, sys.exc_info()) File "/home2/buildbot/slave/3.x.loewis-sun/build/Lib/shutil.py", line 237, in rmtree os.rmdir(path) OSError: [Errno 22] Invalid argument: '/home2/buildbot/slave/3.x.loewis-sun/build/@test.getcwd/@test.getcwd' sincerely, -The Buildbot From buildbot at python.org Fri Jun 12 14:27:26 2009 From: buildbot at python.org (buildbot at python.org) Date: Fri, 12 Jun 2009 12:27:26 +0000 Subject: [Python-checkins] buildbot failure in x86 XP-4 3.x Message-ID: <20090612122726.E7CDBD5AD@mail.python.org> The Buildbot has detected a new failure of x86 XP-4 3.x. Full details are available at: http://www.python.org/dev/buildbot/all/x86%20XP-4%203.x/builds/685 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: bolen-windows Build Reason: Build Source Stamp: [branch branches/py3k] HEAD Blamelist: raymond.hettinger BUILD FAILED: failed test Excerpt from the test logfile: Traceback (most recent call last): File "E:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\test\test_import.py", line 63, in test_with_extension self.fail("import from %s failed: %s" % (ext, err)) File "E:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\unittest.py", line 540, in fail raise self.failureException(msg) AssertionError: import from .PY failed: No module named @test Traceback (most recent call last): File "E:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\test\test_import.py", line 80, in testImport test_with_extension(ext) File "E:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\test\test_import.py", line 73, in test_with_extension del sys.modules[TESTFN] KeyError: '@test' 1 test failed: test_import ====================================================================== ERROR: testImport (test.test_import.ImportTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "E:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\test\test_import.py", line 61, in test_with_extension mod = __import__(TESTFN) ImportError: No module named @test Traceback (most recent call last): File "E:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\test\test_import.py", line 63, in test_with_extension self.fail("import from %s failed: %s" % (ext, err)) File "E:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\unittest.py", line 540, in fail raise self.failureException(msg) AssertionError: import from .PY failed: No module named @test Traceback (most recent call last): File "E:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\test\test_import.py", line 80, in testImport test_with_extension(ext) File "E:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\test\test_import.py", line 73, in test_with_extension del sys.modules[TESTFN] KeyError: '@test' Traceback (most recent call last): File "E:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\test\test_import.py", line 63, in test_with_extension self.fail("import from %s failed: %s" % (ext, err)) File "E:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\unittest.py", line 540, in fail raise self.failureException(msg) AssertionError: import from .PY failed: No module named @test Traceback (most recent call last): File "E:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\test\test_import.py", line 80, in testImport test_with_extension(ext) File "E:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\test\test_import.py", line 73, in test_with_extension del sys.modules[TESTFN] KeyError: '@test' sincerely, -The Buildbot From eric at trueblade.com Fri Jun 12 14:26:20 2009 From: eric at trueblade.com (Eric Smith) Date: Fri, 12 Jun 2009 08:26:20 -0400 Subject: [Python-checkins] r73379 - sandbox/trunk/2to3/lib2to3/fixes/fix_dict.py In-Reply-To: <4A321ECE.1050905@gmail.com> References: <20090611230621.5B30EDA39@mail.python.org> <4A321ECE.1050905@gmail.com> Message-ID: <4A32496C.2000609@trueblade.com> Nick Coghlan wrote: > benjamin.peterson wrote: >> Author: benjamin.peterson >> Date: Fri Jun 12 01:06:21 2009 >> New Revision: 73379 >> >> Log: >> use a real conditional expresion >> >> Modified: >> sandbox/trunk/2to3/lib2to3/fixes/fix_dict.py >> >> Modified: sandbox/trunk/2to3/lib2to3/fixes/fix_dict.py >> ============================================================================== >> --- sandbox/trunk/2to3/lib2to3/fixes/fix_dict.py (original) >> +++ sandbox/trunk/2to3/lib2to3/fixes/fix_dict.py Fri Jun 12 01:06:21 2009 >> @@ -66,7 +66,7 @@ >> new = pytree.Node(syms.power, args) >> if not special: >> new.prefix = u"" >> - new = Call(Name(isiter and u"iter" or u"list"), [new]) >> + new = Call(u"iter" if isiter else u"list"), [new]) > > I'm not all that familiar with 2to3 - was the removal of the call to > Name() here deliberate? Probably not deliberate, since it leaves a syntax error with mismatched parens. From python-checkins at python.org Fri Jun 12 16:44:29 2009 From: python-checkins at python.org (benjamin.peterson) Date: Fri, 12 Jun 2009 16:44:29 +0200 (CEST) Subject: [Python-checkins] r73388 - sandbox/trunk/2to3/lib2to3/fixes/fix_dict.py Message-ID: <20090612144429.2BBEED7BA@mail.python.org> Author: benjamin.peterson Date: Fri Jun 12 16:44:29 2009 New Revision: 73388 Log: fix typo in last fix Modified: sandbox/trunk/2to3/lib2to3/fixes/fix_dict.py Modified: sandbox/trunk/2to3/lib2to3/fixes/fix_dict.py ============================================================================== --- sandbox/trunk/2to3/lib2to3/fixes/fix_dict.py (original) +++ sandbox/trunk/2to3/lib2to3/fixes/fix_dict.py Fri Jun 12 16:44:29 2009 @@ -66,7 +66,7 @@ new = pytree.Node(syms.power, args) if not special: new.prefix = u"" - new = Call(u"iter" if isiter else u"list"), [new]) + new = Call(Name(u"iter" if isiter else u"list"), [new]) if tail: new = pytree.Node(syms.power, [new] + tail) new.prefix = node.prefix From python-checkins at python.org Fri Jun 12 17:33:19 2009 From: python-checkins at python.org (r.david.murray) Date: Fri, 12 Jun 2009 17:33:19 +0200 (CEST) Subject: [Python-checkins] r73389 - in python/branches/py3k: Lib/doctest.py Lib/test/test_doctest.py Misc/NEWS Message-ID: <20090612153319.D88BFC514@mail.python.org> Author: r.david.murray Date: Fri Jun 12 17:33:19 2009 New Revision: 73389 Log: Issue #6195: fix doctest to no longer try to read 'source' data from binary files. Modified: python/branches/py3k/Lib/doctest.py python/branches/py3k/Lib/test/test_doctest.py python/branches/py3k/Misc/NEWS Modified: python/branches/py3k/Lib/doctest.py ============================================================================== --- python/branches/py3k/Lib/doctest.py (original) +++ python/branches/py3k/Lib/doctest.py Fri Jun 12 17:33:19 2009 @@ -812,20 +812,28 @@ # DocTestFinder._find_lineno to find the line number for a # given object's docstring. try: - file = inspect.getsourcefile(obj) or inspect.getfile(obj) - if module is not None: - # Supply the module globals in case the module was - # originally loaded via a PEP 302 loader and - # file is not a valid filesystem path - source_lines = linecache.getlines(file, module.__dict__) - else: - # No access to a loader, so assume it's a normal - # filesystem path - source_lines = linecache.getlines(file) - if not source_lines: - source_lines = None + file = inspect.getsourcefile(obj) except TypeError: source_lines = None + else: + if not file: + # Check to see if it's one of our special internal "files" + # (see __patched_linecache_getlines). + file = inspect.getfile(obj) + if not file[0]+file[-2:] == '<]>': file = None + if file is None: source_lines = None + else: + if module is not None: + # Supply the module globals in case the module was + # originally loaded via a PEP 302 loader and + # file is not a valid filesystem path + source_lines = linecache.getlines(file, module.__dict__) + else: + # No access to a loader, so assume it's a normal + # filesystem path + source_lines = linecache.getlines(file) + if not source_lines: + source_lines = None # Initialize globals, and merge in extraglobs. if globs is None: Modified: python/branches/py3k/Lib/test/test_doctest.py ============================================================================== --- python/branches/py3k/Lib/test/test_doctest.py (original) +++ python/branches/py3k/Lib/test/test_doctest.py Fri Jun 12 17:33:19 2009 @@ -2288,6 +2288,17 @@ >>> doctest.master = None # Reset master. """ +def test_testmod(): r""" +Tests for the testmod function. More might be useful, but for now we're just +testing the case raised by Issue 6195, where trying to doctest a C module would +fail with a UnicodeDecodeError because doctest tried to read the "source" lines +out of the binary module. + + >>> import unicodedata + >>> doctest.testmod(unicodedata) + TestResults(failed=0, attempted=0) +""" + ###################################################################### ## Main ###################################################################### Modified: python/branches/py3k/Misc/NEWS ============================================================================== --- python/branches/py3k/Misc/NEWS (original) +++ python/branches/py3k/Misc/NEWS Fri Jun 12 17:33:19 2009 @@ -24,6 +24,9 @@ Library ------- +- Issue #6195: fixed doctest to no longer try to read 'source' data from + binary files. + - Issue #5262: Fixed bug in next rollover time computation in TimedRotatingFileHandler. From python-checkins at python.org Fri Jun 12 19:28:31 2009 From: python-checkins at python.org (martin.v.loewis) Date: Fri, 12 Jun 2009 19:28:31 +0200 (CEST) Subject: [Python-checkins] r73390 - in python/trunk: Lib/distutils/command/bdist_msi.py Lib/msilib/__init__.py Misc/NEWS Message-ID: <20090612172831.57491DC01@mail.python.org> Author: martin.v.loewis Date: Fri Jun 12 19:28:31 2009 New Revision: 73390 Log: Support AMD64 in msilib. Set Win64 on reglocator. Fixes #6258. Modified: python/trunk/Lib/distutils/command/bdist_msi.py python/trunk/Lib/msilib/__init__.py python/trunk/Misc/NEWS Modified: python/trunk/Lib/distutils/command/bdist_msi.py ============================================================================== --- python/trunk/Lib/distutils/command/bdist_msi.py (original) +++ python/trunk/Lib/distutils/command/bdist_msi.py Fri Jun 12 19:28:31 2009 @@ -342,9 +342,14 @@ exe_action = "PythonExe" + ver target_dir_prop = "TARGETDIR" + ver exe_prop = "PYTHON" + ver + if msilib.Win64: + # type: msidbLocatorTypeRawValue + msidbLocatorType64bit + Type = 2+16 + else: + Type = 2 add_data(self.db, "RegLocator", - [(machine_reg, 2, install_path, None, 2), - (user_reg, 1, install_path, None, 2)]) + [(machine_reg, 2, install_path, None, Type), + (user_reg, 1, install_path, None, Type)]) add_data(self.db, "AppSearch", [(machine_prop, machine_reg), (user_prop, user_reg)]) Modified: python/trunk/Lib/msilib/__init__.py ============================================================================== --- python/trunk/Lib/msilib/__init__.py (original) +++ python/trunk/Lib/msilib/__init__.py Fri Jun 12 19:28:31 2009 @@ -2,9 +2,11 @@ # Copyright (C) 2005 Martin v. L?wis # Licensed to PSF under a Contributor Agreement. from _msi import * -import os, string, re +import os, string, re, sys -Win64=0 +AMD64 = "AMD64" in sys.version +Itanium = "Itanium" in sys.version +Win64 = AMD64 or Itanium # Partially taken from Wine datasizemask= 0x00ff @@ -145,8 +147,10 @@ si.SetProperty(PID_TITLE, "Installation Database") si.SetProperty(PID_SUBJECT, ProductName) si.SetProperty(PID_AUTHOR, Manufacturer) - if Win64: + if Itanium: si.SetProperty(PID_TEMPLATE, "Intel64;1033") + elif AMD64: + si.SetProperty(PID_TEMPLATE, "x64;1033") else: si.SetProperty(PID_TEMPLATE, "Intel;1033") si.SetProperty(PID_REVNUMBER, gen_uuid()) Modified: python/trunk/Misc/NEWS ============================================================================== --- python/trunk/Misc/NEWS (original) +++ python/trunk/Misc/NEWS Fri Jun 12 19:28:31 2009 @@ -317,6 +317,8 @@ Library ------- +- Issue #6258: Support AMD64 in bdist_msi. + - Issue #5262: Fixed bug in next rollover time computation in TimedRotatingFileHandler. From python-checkins at python.org Fri Jun 12 19:31:41 2009 From: python-checkins at python.org (martin.v.loewis) Date: Fri, 12 Jun 2009 19:31:41 +0200 (CEST) Subject: [Python-checkins] r73391 - in python/branches/py3k: Lib/distutils/command/bdist_msi.py Lib/msilib/__init__.py Misc/NEWS Message-ID: <20090612173141.3959DD72B@mail.python.org> Author: martin.v.loewis Date: Fri Jun 12 19:31:41 2009 New Revision: 73391 Log: Merged revisions 73390 via svnmerge from svn+ssh://pythondev at svn.python.org/python/trunk ........ r73390 | martin.v.loewis | 2009-06-12 19:28:31 +0200 (Fr, 12 Jun 2009) | 3 lines Support AMD64 in msilib. Set Win64 on reglocator. Fixes #6258. ........ Modified: python/branches/py3k/ (props changed) python/branches/py3k/Lib/distutils/command/bdist_msi.py python/branches/py3k/Lib/msilib/__init__.py python/branches/py3k/Misc/NEWS Modified: python/branches/py3k/Lib/distutils/command/bdist_msi.py ============================================================================== --- python/branches/py3k/Lib/distutils/command/bdist_msi.py (original) +++ python/branches/py3k/Lib/distutils/command/bdist_msi.py Fri Jun 12 19:31:41 2009 @@ -341,9 +341,14 @@ exe_action = "PythonExe" + ver target_dir_prop = "TARGETDIR" + ver exe_prop = "PYTHON" + ver + if msilib.Win64: + # type: msidbLocatorTypeRawValue + msidbLocatorType64bit + Type = 2+16 + else: + Type = 2 add_data(self.db, "RegLocator", - [(machine_reg, 2, install_path, None, 2), - (user_reg, 1, install_path, None, 2)]) + [(machine_reg, 2, install_path, None, Type), + (user_reg, 1, install_path, None, Type)]) add_data(self.db, "AppSearch", [(machine_prop, machine_reg), (user_prop, user_reg)]) Modified: python/branches/py3k/Lib/msilib/__init__.py ============================================================================== --- python/branches/py3k/Lib/msilib/__init__.py (original) +++ python/branches/py3k/Lib/msilib/__init__.py Fri Jun 12 19:31:41 2009 @@ -2,9 +2,11 @@ # Copyright (C) 2005 Martin v. L?wis # Licensed to PSF under a Contributor Agreement. from _msi import * -import os, string, re +import os, string, re, sys -Win64=0 +AMD64 = "AMD64" in sys.version +Itanium = "Itanium" in sys.version +Win64 = AMD64 or Itanium # Partially taken from Wine datasizemask= 0x00ff @@ -145,8 +147,10 @@ si.SetProperty(PID_TITLE, "Installation Database") si.SetProperty(PID_SUBJECT, ProductName) si.SetProperty(PID_AUTHOR, Manufacturer) - if Win64: + if Itanium: si.SetProperty(PID_TEMPLATE, "Intel64;1033") + elif AMD64: + si.SetProperty(PID_TEMPLATE, "x64;1033") else: si.SetProperty(PID_TEMPLATE, "Intel;1033") si.SetProperty(PID_REVNUMBER, gen_uuid()) Modified: python/branches/py3k/Misc/NEWS ============================================================================== --- python/branches/py3k/Misc/NEWS (original) +++ python/branches/py3k/Misc/NEWS Fri Jun 12 19:31:41 2009 @@ -24,6 +24,8 @@ Library ------- +- Issue #6258: Support AMD64 in bdist_msi. + - Issue #6195: fixed doctest to no longer try to read 'source' data from binary files. From buildbot at python.org Fri Jun 12 20:28:15 2009 From: buildbot at python.org (buildbot at python.org) Date: Fri, 12 Jun 2009 18:28:15 +0000 Subject: [Python-checkins] buildbot failure in x86 osx.5 3.x Message-ID: <20090612182815.52C61D9BD@mail.python.org> The Buildbot has detected a new failure of x86 osx.5 3.x. Full details are available at: http://www.python.org/dev/buildbot/all/x86%20osx.5%203.x/builds/1028 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: heller-x86-osx5 Build Reason: Build Source Stamp: [branch branches/py3k] HEAD Blamelist: martin.v.loewis BUILD FAILED: failed test Excerpt from the test logfile: Traceback (most recent call last): File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/threading.py", line 509, in _bootstrap_inner self.run() File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/test/test_ftplib.py", line 205, in run asyncore.loop(timeout=0.1, count=1) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/asyncore.py", line 210, in loop poll_fun(timeout, map) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/asyncore.py", line 147, in poll read(obj) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/asyncore.py", line 79, in read obj.handle_error() File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/asyncore.py", line 75, in read obj.handle_read_event() File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/asyncore.py", line 420, in handle_read_event self.handle_read() File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/asynchat.py", line 178, in handle_read self.found_terminator() File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/test/test_ftplib.py", line 71, in found_terminator method(arg) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/test/test_ftplib.py", line 97, in cmd_pasv conn, addr = sock.accept() File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/socket.py", line 120, in accept fd, addr = self._accept() socket.timeout: timed out Traceback (most recent call last): File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/linecache.py", line 130, in updatecache lines = fp.readlines() IOError: [Errno 9] Bad file descriptor Traceback (most recent call last): File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/threading.py", line 482, in _bootstrap self._bootstrap_inner() File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/threading.py", line 522, in _bootstrap_inner (self.name, _format_exc())) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/traceback.py", line 268, in format_exc format_exception(etype, value, tb, limit, chain)) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/traceback.py", line 185, in format_exception list.extend(format_tb(tb, limit)) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/traceback.py", line 75, in format_tb return format_list(extract_tb(tb, limit)) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/traceback.py", line 100, in extract_tb line = linecache.getline(filename, lineno, f.f_globals) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/linecache.py", line 15, in getline lines = getlines(filename, module_globals) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/linecache.py", line 41, in getlines return updatecache(filename, module_globals) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/linecache.py", line 130, in updatecache lines = fp.readlines() IOError: [Errno 9] Bad file descriptor 1 test failed: test_ftplib make: *** [buildbottest] Error 1 sincerely, -The Buildbot From python-checkins at python.org Fri Jun 12 20:40:16 2009 From: python-checkins at python.org (raymond.hettinger) Date: Fri, 12 Jun 2009 20:40:16 +0200 (CEST) Subject: [Python-checkins] r73392 - in python/branches/py3k: Lib/test/test_range.py Misc/NEWS Objects/rangeobject.c Message-ID: <20090612184016.9FA94DBCA@mail.python.org> Author: raymond.hettinger Date: Fri Jun 12 20:40:16 2009 New Revision: 73392 Log: Fix SystemError and a wasps nest of ref counting issues. Modified: python/branches/py3k/Lib/test/test_range.py python/branches/py3k/Misc/NEWS python/branches/py3k/Objects/rangeobject.c Modified: python/branches/py3k/Lib/test/test_range.py ============================================================================== --- python/branches/py3k/Lib/test/test_range.py (original) +++ python/branches/py3k/Lib/test/test_range.py Fri Jun 12 20:40:16 2009 @@ -71,6 +71,13 @@ self.assertEquals(list(pickle.loads(pickle.dumps(r, proto))), list(r)) + def test_odd_bug(self): + # This used to raise a "SystemError: NULL result without error" + # because the range validation step was eating the exception + # before NULL was returned. + with self.assertRaises(TypeError): + range([], 1, -1) + def test_main(): test.support.run_unittest(RangeTest) Modified: python/branches/py3k/Misc/NEWS ============================================================================== --- python/branches/py3k/Misc/NEWS (original) +++ python/branches/py3k/Misc/NEWS Fri Jun 12 20:40:16 2009 @@ -12,6 +12,8 @@ Core and Builtins ----------------- +- Fixed SystemError triggered by "range([], 1, -1)". + - Issue #5924: On Windows, a large PYTHONPATH environment variable (more than 255 characters) would be completely ignored. Modified: python/branches/py3k/Objects/rangeobject.c ============================================================================== --- python/branches/py3k/Objects/rangeobject.c (original) +++ python/branches/py3k/Objects/rangeobject.c Fri Jun 12 20:40:16 2009 @@ -59,26 +59,42 @@ if (PyTuple_Size(args) <= 1) { if (!PyArg_UnpackTuple(args, "range", 1, 1, &stop)) - goto Fail; + return NULL; stop = PyNumber_Index(stop); if (!stop) - goto Fail; + return NULL; start = PyLong_FromLong(0); + if (!start) { + Py_DECREF(stop); + return NULL; + } step = PyLong_FromLong(1); - if (!start || !step) - goto Fail; + if (!step) { + Py_DECREF(stop); + Py_DECREF(start); + return NULL; + } } else { if (!PyArg_UnpackTuple(args, "range", 2, 3, &start, &stop, &step)) - goto Fail; + return NULL; /* Convert borrowed refs to owned refs */ start = PyNumber_Index(start); + if (!start) + return NULL; stop = PyNumber_Index(stop); - step = validate_step(step); - if (!start || !stop || !step) - goto Fail; + if (!stop) { + Py_DECREF(start); + return NULL; + } + step = validate_step(step); /* Caution, this can clear exceptions */ + if (!step) { + Py_DECREF(start); + Py_DECREF(stop); + return NULL; + } } obj = PyObject_New(rangeobject, &PyRange_Type); From python-checkins at python.org Fri Jun 12 20:56:58 2009 From: python-checkins at python.org (alexandre.vassalotti) Date: Fri, 12 Jun 2009 20:56:58 +0200 (CEST) Subject: [Python-checkins] r73393 - python/trunk/Objects/exceptions.c Message-ID: <20090612185658.05AD4D481@mail.python.org> Author: alexandre.vassalotti Date: Fri Jun 12 20:56:57 2009 New Revision: 73393 Log: Clear reference to the static PyExc_RecursionErrorInst in _PyExc_Fini. Modified: python/trunk/Objects/exceptions.c Modified: python/trunk/Objects/exceptions.c ============================================================================== --- python/trunk/Objects/exceptions.c (original) +++ python/trunk/Objects/exceptions.c Fri Jun 12 20:56:57 2009 @@ -2136,6 +2136,6 @@ void _PyExc_Fini(void) { - Py_XDECREF(PyExc_MemoryErrorInst); - PyExc_MemoryErrorInst = NULL; + Py_CLEAR(PyExc_MemoryErrorInst); + Py_CLEAR(PyExc_RecursionErrorInst); } From buildbot at python.org Fri Jun 12 21:10:09 2009 From: buildbot at python.org (buildbot at python.org) Date: Fri, 12 Jun 2009 19:10:09 +0000 Subject: [Python-checkins] buildbot failure in sparc solaris10 gcc 3.x Message-ID: <20090612191009.22D41DA73@mail.python.org> The Buildbot has detected a new failure of sparc solaris10 gcc 3.x. Full details are available at: http://www.python.org/dev/buildbot/all/sparc%20solaris10%20gcc%203.x/builds/821 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: loewis-sun Build Reason: Build Source Stamp: [branch branches/py3k] HEAD Blamelist: martin.v.loewis BUILD FAILED: failed test Excerpt from the test logfile: 2 tests failed: test_posix test_telnetlib ====================================================================== ERROR: test_getcwd_long_pathnames (test.test_posix.PosixTester) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home2/buildbot/slave/3.x.loewis-sun/build/Lib/test/test_posix.py", line 251, in test_getcwd_long_pathnames support.rmtree(base_path) File "/home2/buildbot/slave/3.x.loewis-sun/build/Lib/test/support.py", line 181, in rmtree shutil.rmtree(path) File "/home2/buildbot/slave/3.x.loewis-sun/build/Lib/shutil.py", line 239, in rmtree onerror(os.rmdir, path, sys.exc_info()) File "/home2/buildbot/slave/3.x.loewis-sun/build/Lib/shutil.py", line 237, in rmtree os.rmdir(path) OSError: [Errno 22] Invalid argument: '/home2/buildbot/slave/3.x.loewis-sun/build/@test.getcwd/@test.getcwd' sincerely, -The Buildbot From python-checkins at python.org Fri Jun 12 22:14:09 2009 From: python-checkins at python.org (antoine.pitrou) Date: Fri, 12 Jun 2009 22:14:09 +0200 (CEST) Subject: [Python-checkins] r73394 - in python/trunk: Doc/library/io.rst Lib/_pyio.py Lib/io.py Lib/test/test_bufio.py Lib/test/test_file.py Lib/test/test_fileio.py Lib/test/test_io.py Lib/test/test_largefile.py Lib/test/test_memoryio.py Lib/test/test_support.py Lib/test/test_univnewlines.py Misc/NEWS Modules/_bytesio.c Modules/_fileio.c Modules/_io Modules/_io/_iomodule.c Modules/_io/_iomodule.h Modules/_io/bufferedio.c Modules/_io/bytesio.c Modules/_io/fileio.c Modules/_io/iobase.c Modules/_io/stringio.c Modules/_io/textio.c setup.py Message-ID: <20090612201409.5420FDAA9@mail.python.org> Author: antoine.pitrou Date: Fri Jun 12 22:14:08 2009 New Revision: 73394 Log: Issue #6215: backport the 3.1 io lib Added: python/trunk/Lib/_pyio.py (contents, props changed) python/trunk/Modules/_io/ python/trunk/Modules/_io/_iomodule.c (contents, props changed) python/trunk/Modules/_io/_iomodule.h (contents, props changed) python/trunk/Modules/_io/bufferedio.c (contents, props changed) python/trunk/Modules/_io/bytesio.c (contents, props changed) python/trunk/Modules/_io/fileio.c (contents, props changed) python/trunk/Modules/_io/iobase.c (contents, props changed) python/trunk/Modules/_io/stringio.c (contents, props changed) python/trunk/Modules/_io/textio.c (contents, props changed) Removed: python/trunk/Modules/_bytesio.c python/trunk/Modules/_fileio.c Modified: python/trunk/Doc/library/io.rst python/trunk/Lib/io.py python/trunk/Lib/test/test_bufio.py python/trunk/Lib/test/test_file.py python/trunk/Lib/test/test_fileio.py python/trunk/Lib/test/test_io.py python/trunk/Lib/test/test_largefile.py python/trunk/Lib/test/test_memoryio.py python/trunk/Lib/test/test_support.py python/trunk/Lib/test/test_univnewlines.py python/trunk/Misc/NEWS python/trunk/setup.py Modified: python/trunk/Doc/library/io.rst ============================================================================== --- python/trunk/Doc/library/io.rst (original) +++ python/trunk/Doc/library/io.rst Fri Jun 12 22:14:08 2009 @@ -573,6 +573,10 @@ The name of the encoding used to decode the stream's bytes into strings, and to encode strings into bytes. + .. attribute:: errors + + The error setting of the decoder or encoder. + .. attribute:: newlines A string, a tuple of strings, or ``None``, indicating the newlines @@ -625,13 +629,9 @@ If *line_buffering* is ``True``, :meth:`flush` is implied when a call to write contains a newline character. - :class:`TextIOWrapper` provides these data attributes in addition to those of + :class:`TextIOWrapper` provides one attribute in addition to those of :class:`TextIOBase` and its parents: - .. attribute:: errors - - The encoding and decoding error setting. - .. attribute:: line_buffering Whether line buffering is enabled. Added: python/trunk/Lib/_pyio.py ============================================================================== --- (empty file) +++ python/trunk/Lib/_pyio.py Fri Jun 12 22:14:08 2009 @@ -0,0 +1,1962 @@ +""" +Python implementation of the io module. +""" + +from __future__ import print_function +from __future__ import unicode_literals + +import os +import abc +import codecs +import warnings +# Import _thread instead of threading to reduce startup cost +try: + from thread import allocate_lock as Lock +except ImportError: + from dummy_thread import allocate_lock as Lock + +import io +from io import __all__ +from io import SEEK_SET, SEEK_CUR, SEEK_END + +__metaclass__ = type + +# open() uses st_blksize whenever we can +DEFAULT_BUFFER_SIZE = 8 * 1024 # bytes + +# NOTE: Base classes defined here are registered with the "official" ABCs +# defined in io.py. We don't use real inheritance though, because we don't +# want to inherit the C implementations. + + +class BlockingIOError(IOError): + + """Exception raised when I/O would block on a non-blocking I/O stream.""" + + def __init__(self, errno, strerror, characters_written=0): + super(IOError, self).__init__(errno, strerror) + if not isinstance(characters_written, (int, long)): + raise TypeError("characters_written must be a integer") + self.characters_written = characters_written + + +def open(file, mode="r", buffering=None, + encoding=None, errors=None, + newline=None, closefd=True): + + r"""Open file and return a stream. Raise IOError upon failure. + + file is either a text or byte string giving the name (and the path + if the file isn't in the current working directory) of the file to + be opened or an integer file descriptor of the file to be + wrapped. (If a file descriptor is given, it is closed when the + returned I/O object is closed, unless closefd is set to False.) + + mode is an optional string that specifies the mode in which the file + is opened. It defaults to 'r' which means open for reading in text + mode. Other common values are 'w' for writing (truncating the file if + it already exists), and 'a' for appending (which on some Unix systems, + means that all writes append to the end of the file regardless of the + current seek position). In text mode, if encoding is not specified the + encoding used is platform dependent. (For reading and writing raw + bytes use binary mode and leave encoding unspecified.) The available + modes are: + + ========= =============================================================== + Character Meaning + --------- --------------------------------------------------------------- + 'r' open for reading (default) + 'w' open for writing, truncating the file first + 'a' open for writing, appending to the end of the file if it exists + 'b' binary mode + 't' text mode (default) + '+' open a disk file for updating (reading and writing) + 'U' universal newline mode (for backwards compatibility; unneeded + for new code) + ========= =============================================================== + + The default mode is 'rt' (open for reading text). For binary random + access, the mode 'w+b' opens and truncates the file to 0 bytes, while + 'r+b' opens the file without truncation. + + Python distinguishes between files opened in binary and text modes, + even when the underlying operating system doesn't. Files opened in + binary mode (appending 'b' to the mode argument) return contents as + bytes objects without any decoding. In text mode (the default, or when + 't' is appended to the mode argument), the contents of the file are + returned as strings, the bytes having been first decoded using a + platform-dependent encoding or using the specified encoding if given. + + buffering is an optional integer used to set the buffering policy. By + default full buffering is on. Pass 0 to switch buffering off (only + allowed in binary mode), 1 to set line buffering, and an integer > 1 + for full buffering. + + encoding is the name of the encoding used to decode or encode the + file. This should only be used in text mode. The default encoding is + platform dependent, but any encoding supported by Python can be + passed. See the codecs module for the list of supported encodings. + + errors is an optional string that specifies how encoding errors are to + be handled---this argument should not be used in binary mode. Pass + 'strict' to raise a ValueError exception if there is an encoding error + (the default of None has the same effect), or pass 'ignore' to ignore + errors. (Note that ignoring encoding errors can lead to data loss.) + See the documentation for codecs.register for a list of the permitted + encoding error strings. + + newline controls how universal newlines works (it only applies to text + mode). It can be None, '', '\n', '\r', and '\r\n'. It works as + follows: + + * On input, if newline is None, universal newlines mode is + enabled. Lines in the input can end in '\n', '\r', or '\r\n', and + these are translated into '\n' before being returned to the + caller. If it is '', universal newline mode is enabled, but line + endings are returned to the caller untranslated. If it has any of + the other legal values, input lines are only terminated by the given + string, and the line ending is returned to the caller untranslated. + + * On output, if newline is None, any '\n' characters written are + translated to the system default line separator, os.linesep. If + newline is '', no translation takes place. If newline is any of the + other legal values, any '\n' characters written are translated to + the given string. + + If closefd is False, the underlying file descriptor will be kept open + when the file is closed. This does not work when a file name is given + and must be True in that case. + + open() returns a file object whose type depends on the mode, and + through which the standard file operations such as reading and writing + are performed. When open() is used to open a file in a text mode ('w', + 'r', 'wt', 'rt', etc.), it returns a TextIOWrapper. When used to open + a file in a binary mode, the returned class varies: in read binary + mode, it returns a BufferedReader; in write binary and append binary + modes, it returns a BufferedWriter, and in read/write mode, it returns + a BufferedRandom. + + It is also possible to use a string or bytearray as a file for both + reading and writing. For strings StringIO can be used like a file + opened in a text mode, and for bytes a BytesIO can be used like a file + opened in a binary mode. + """ + if not isinstance(file, (basestring, int, long)): + raise TypeError("invalid file: %r" % file) + if not isinstance(mode, basestring): + raise TypeError("invalid mode: %r" % mode) + if buffering is not None and not isinstance(buffering, (int, long)): + raise TypeError("invalid buffering: %r" % buffering) + if encoding is not None and not isinstance(encoding, basestring): + raise TypeError("invalid encoding: %r" % encoding) + if errors is not None and not isinstance(errors, basestring): + raise TypeError("invalid errors: %r" % errors) + modes = set(mode) + if modes - set("arwb+tU") or len(mode) > len(modes): + raise ValueError("invalid mode: %r" % mode) + reading = "r" in modes + writing = "w" in modes + appending = "a" in modes + updating = "+" in modes + text = "t" in modes + binary = "b" in modes + if "U" in modes: + if writing or appending: + raise ValueError("can't use U and writing mode at once") + reading = True + if text and binary: + raise ValueError("can't have text and binary mode at once") + if reading + writing + appending > 1: + raise ValueError("can't have read/write/append mode at once") + if not (reading or writing or appending): + raise ValueError("must have exactly one of read/write/append mode") + if binary and encoding is not None: + raise ValueError("binary mode doesn't take an encoding argument") + if binary and errors is not None: + raise ValueError("binary mode doesn't take an errors argument") + if binary and newline is not None: + raise ValueError("binary mode doesn't take a newline argument") + raw = FileIO(file, + (reading and "r" or "") + + (writing and "w" or "") + + (appending and "a" or "") + + (updating and "+" or ""), + closefd) + if buffering is None: + buffering = -1 + line_buffering = False + if buffering == 1 or buffering < 0 and raw.isatty(): + buffering = -1 + line_buffering = True + if buffering < 0: + buffering = DEFAULT_BUFFER_SIZE + try: + bs = os.fstat(raw.fileno()).st_blksize + except (os.error, AttributeError): + pass + else: + if bs > 1: + buffering = bs + if buffering < 0: + raise ValueError("invalid buffering size") + if buffering == 0: + if binary: + return raw + raise ValueError("can't have unbuffered text I/O") + if updating: + buffer = BufferedRandom(raw, buffering) + elif writing or appending: + buffer = BufferedWriter(raw, buffering) + elif reading: + buffer = BufferedReader(raw, buffering) + else: + raise ValueError("unknown mode: %r" % mode) + if binary: + return buffer + text = TextIOWrapper(buffer, encoding, errors, newline, line_buffering) + text.mode = mode + return text + + +class DocDescriptor: + """Helper for builtins.open.__doc__ + """ + def __get__(self, obj, typ): + return ( + "open(file, mode='r', buffering=None, encoding=None, " + "errors=None, newline=None, closefd=True)\n\n" + + open.__doc__) + +class OpenWrapper: + """Wrapper for builtins.open + + Trick so that open won't become a bound method when stored + as a class variable (as dbm.dumb does). + + See initstdio() in Python/pythonrun.c. + """ + __doc__ = DocDescriptor() + + def __new__(cls, *args, **kwargs): + return open(*args, **kwargs) + + +class UnsupportedOperation(ValueError, IOError): + pass + + +class IOBase: + __metaclass__ = abc.ABCMeta + + """The abstract base class for all I/O classes, acting on streams of + bytes. There is no public constructor. + + This class provides dummy implementations for many methods that + derived classes can override selectively; the default implementations + represent a file that cannot be read, written or seeked. + + Even though IOBase does not declare read, readinto, or write because + their signatures will vary, implementations and clients should + consider those methods part of the interface. Also, implementations + may raise a IOError when operations they do not support are called. + + The basic type used for binary data read from or written to a file is + bytes. bytearrays are accepted too, and in some cases (such as + readinto) needed. Text I/O classes work with str data. + + Note that calling any method (even inquiries) on a closed stream is + undefined. Implementations may raise IOError in this case. + + IOBase (and its subclasses) support the iterator protocol, meaning + that an IOBase object can be iterated over yielding the lines in a + stream. + + IOBase also supports the :keyword:`with` statement. In this example, + fp is closed after the suite of the with statement is complete: + + with open('spam.txt', 'r') as fp: + fp.write('Spam and eggs!') + """ + + ### Internal ### + + def _unsupported(self, name): + """Internal: raise an exception for unsupported operations.""" + raise UnsupportedOperation("%s.%s() not supported" % + (self.__class__.__name__, name)) + + ### Positioning ### + + def seek(self, pos, whence=0): + """Change stream position. + + Change the stream position to byte offset offset. offset is + interpreted relative to the position indicated by whence. Values + for whence are: + + * 0 -- start of stream (the default); offset should be zero or positive + * 1 -- current stream position; offset may be negative + * 2 -- end of stream; offset is usually negative + + Return the new absolute position. + """ + self._unsupported("seek") + + def tell(self): + """Return current stream position.""" + return self.seek(0, 1) + + def truncate(self, pos=None): + """Truncate file to size bytes. + + Size defaults to the current IO position as reported by tell(). Return + the new size. + """ + self._unsupported("truncate") + + ### Flush and close ### + + def flush(self): + """Flush write buffers, if applicable. + + This is not implemented for read-only and non-blocking streams. + """ + # XXX Should this return the number of bytes written??? + + __closed = False + + def close(self): + """Flush and close the IO object. + + This method has no effect if the file is already closed. + """ + if not self.__closed: + try: + self.flush() + except IOError: + pass # If flush() fails, just give up + self.__closed = True + + def __del__(self): + """Destructor. Calls close().""" + # The try/except block is in case this is called at program + # exit time, when it's possible that globals have already been + # deleted, and then the close() call might fail. Since + # there's nothing we can do about such failures and they annoy + # the end users, we suppress the traceback. + try: + self.close() + except: + pass + + ### Inquiries ### + + def seekable(self): + """Return whether object supports random access. + + If False, seek(), tell() and truncate() will raise IOError. + This method may need to do a test seek(). + """ + return False + + def _checkSeekable(self, msg=None): + """Internal: raise an IOError if file is not seekable + """ + if not self.seekable(): + raise IOError("File or stream is not seekable." + if msg is None else msg) + + + def readable(self): + """Return whether object was opened for reading. + + If False, read() will raise IOError. + """ + return False + + def _checkReadable(self, msg=None): + """Internal: raise an IOError if file is not readable + """ + if not self.readable(): + raise IOError("File or stream is not readable." + if msg is None else msg) + + def writable(self): + """Return whether object was opened for writing. + + If False, write() and truncate() will raise IOError. + """ + return False + + def _checkWritable(self, msg=None): + """Internal: raise an IOError if file is not writable + """ + if not self.writable(): + raise IOError("File or stream is not writable." + if msg is None else msg) + + @property + def closed(self): + """closed: bool. True iff the file has been closed. + + For backwards compatibility, this is a property, not a predicate. + """ + return self.__closed + + def _checkClosed(self, msg=None): + """Internal: raise an ValueError if file is closed + """ + if self.closed: + raise ValueError("I/O operation on closed file." + if msg is None else msg) + + ### Context manager ### + + def __enter__(self): + """Context management protocol. Returns self.""" + self._checkClosed() + return self + + def __exit__(self, *args): + """Context management protocol. Calls close()""" + self.close() + + ### Lower-level APIs ### + + # XXX Should these be present even if unimplemented? + + def fileno(self): + """Returns underlying file descriptor if one exists. + + An IOError is raised if the IO object does not use a file descriptor. + """ + self._unsupported("fileno") + + def isatty(self): + """Return whether this is an 'interactive' stream. + + Return False if it can't be determined. + """ + self._checkClosed() + return False + + ### Readline[s] and writelines ### + + def readline(self, limit=-1): + r"""Read and return a line from the stream. + + If limit is specified, at most limit bytes will be read. + + The line terminator is always b'\n' for binary files; for text + files, the newlines argument to open can be used to select the line + terminator(s) recognized. + """ + # For backwards compatibility, a (slowish) readline(). + if hasattr(self, "peek"): + def nreadahead(): + readahead = self.peek(1) + if not readahead: + return 1 + n = (readahead.find(b"\n") + 1) or len(readahead) + if limit >= 0: + n = min(n, limit) + return n + else: + def nreadahead(): + return 1 + if limit is None: + limit = -1 + elif not isinstance(limit, (int, long)): + raise TypeError("limit must be an integer") + res = bytearray() + while limit < 0 or len(res) < limit: + b = self.read(nreadahead()) + if not b: + break + res += b + if res.endswith(b"\n"): + break + return bytes(res) + + def __iter__(self): + self._checkClosed() + return self + + def next(self): + line = self.readline() + if not line: + raise StopIteration + return line + + def readlines(self, hint=None): + """Return a list of lines from the stream. + + hint can be specified to control the number of lines read: no more + lines will be read if the total size (in bytes/characters) of all + lines so far exceeds hint. + """ + if hint is not None and not isinstance(hint, (int, long)): + raise TypeError("integer or None expected") + if hint is None or hint <= 0: + return list(self) + n = 0 + lines = [] + for line in self: + lines.append(line) + n += len(line) + if n >= hint: + break + return lines + + def writelines(self, lines): + self._checkClosed() + for line in lines: + self.write(line) + +io.IOBase.register(IOBase) + + +class RawIOBase(IOBase): + + """Base class for raw binary I/O.""" + + # The read() method is implemented by calling readinto(); derived + # classes that want to support read() only need to implement + # readinto() as a primitive operation. In general, readinto() can be + # more efficient than read(). + + # (It would be tempting to also provide an implementation of + # readinto() in terms of read(), in case the latter is a more suitable + # primitive operation, but that would lead to nasty recursion in case + # a subclass doesn't implement either.) + + def read(self, n=-1): + """Read and return up to n bytes. + + Returns an empty bytes object on EOF, or None if the object is + set not to block and has no data to read. + """ + if n is None: + n = -1 + if n < 0: + return self.readall() + b = bytearray(n.__index__()) + n = self.readinto(b) + del b[n:] + return bytes(b) + + def readall(self): + """Read until EOF, using multiple read() call.""" + res = bytearray() + while True: + data = self.read(DEFAULT_BUFFER_SIZE) + if not data: + break + res += data + return bytes(res) + + def readinto(self, b): + """Read up to len(b) bytes into b. + + Returns number of bytes read (0 for EOF), or None if the object + is set not to block as has no data to read. + """ + self._unsupported("readinto") + + def write(self, b): + """Write the given buffer to the IO stream. + + Returns the number of bytes written, which may be less than len(b). + """ + self._unsupported("write") + +io.RawIOBase.register(RawIOBase) +from _io import FileIO +RawIOBase.register(FileIO) + + +class BufferedIOBase(IOBase): + + """Base class for buffered IO objects. + + The main difference with RawIOBase is that the read() method + supports omitting the size argument, and does not have a default + implementation that defers to readinto(). + + In addition, read(), readinto() and write() may raise + BlockingIOError if the underlying raw stream is in non-blocking + mode and not ready; unlike their raw counterparts, they will never + return None. + + A typical implementation should not inherit from a RawIOBase + implementation, but wrap one. + """ + + def read(self, n=None): + """Read and return up to n bytes. + + If the argument is omitted, None, or negative, reads and + returns all data until EOF. + + If the argument is positive, and the underlying raw stream is + not 'interactive', multiple raw reads may be issued to satisfy + the byte count (unless EOF is reached first). But for + interactive raw streams (XXX and for pipes?), at most one raw + read will be issued, and a short result does not imply that + EOF is imminent. + + Returns an empty bytes array on EOF. + + Raises BlockingIOError if the underlying raw stream has no + data at the moment. + """ + self._unsupported("read") + + def read1(self, n=None): + """Read up to n bytes with at most one read() system call.""" + self._unsupported("read1") + + def readinto(self, b): + """Read up to len(b) bytes into b. + + Like read(), this may issue multiple reads to the underlying raw + stream, unless the latter is 'interactive'. + + Returns the number of bytes read (0 for EOF). + + Raises BlockingIOError if the underlying raw stream has no + data at the moment. + """ + # XXX This ought to work with anything that supports the buffer API + data = self.read(len(b)) + n = len(data) + try: + b[:n] = data + except TypeError as err: + import array + if not isinstance(b, array.array): + raise err + b[:n] = array.array(b'b', data) + return n + + def write(self, b): + """Write the given buffer to the IO stream. + + Return the number of bytes written, which is never less than + len(b). + + Raises BlockingIOError if the buffer is full and the + underlying raw stream cannot accept more data at the moment. + """ + self._unsupported("write") + + def detach(self): + """ + Separate the underlying raw stream from the buffer and return it. + + After the raw stream has been detached, the buffer is in an unusable + state. + """ + self._unsupported("detach") + +io.BufferedIOBase.register(BufferedIOBase) + + +class _BufferedIOMixin(BufferedIOBase): + + """A mixin implementation of BufferedIOBase with an underlying raw stream. + + This passes most requests on to the underlying raw stream. It + does *not* provide implementations of read(), readinto() or + write(). + """ + + def __init__(self, raw): + self.raw = raw + + ### Positioning ### + + def seek(self, pos, whence=0): + new_position = self.raw.seek(pos, whence) + if new_position < 0: + raise IOError("seek() returned an invalid position") + return new_position + + def tell(self): + pos = self.raw.tell() + if pos < 0: + raise IOError("tell() returned an invalid position") + return pos + + def truncate(self, pos=None): + # Flush the stream. We're mixing buffered I/O with lower-level I/O, + # and a flush may be necessary to synch both views of the current + # file state. + self.flush() + + if pos is None: + pos = self.tell() + # XXX: Should seek() be used, instead of passing the position + # XXX directly to truncate? + return self.raw.truncate(pos) + + ### Flush and close ### + + def flush(self): + self.raw.flush() + + def close(self): + if not self.closed and self.raw is not None: + try: + self.flush() + except IOError: + pass # If flush() fails, just give up + self.raw.close() + + def detach(self): + if self.raw is None: + raise ValueError("raw stream already detached") + self.flush() + raw = self.raw + self.raw = None + return raw + + ### Inquiries ### + + def seekable(self): + return self.raw.seekable() + + def readable(self): + return self.raw.readable() + + def writable(self): + return self.raw.writable() + + @property + def closed(self): + return self.raw.closed + + @property + def name(self): + return self.raw.name + + @property + def mode(self): + return self.raw.mode + + def __repr__(self): + clsname = self.__class__.__name__ + try: + name = self.name + except AttributeError: + return "<_pyio.{0}>".format(clsname) + else: + return "<_pyio.{0} name={1!r}>".format(clsname, name) + + ### Lower-level APIs ### + + def fileno(self): + return self.raw.fileno() + + def isatty(self): + return self.raw.isatty() + + +class BytesIO(BufferedIOBase): + + """Buffered I/O implementation using an in-memory bytes buffer.""" + + def __init__(self, initial_bytes=None): + buf = bytearray() + if initial_bytes is not None: + buf.extend(initial_bytes) + self._buffer = buf + self._pos = 0 + + def getvalue(self): + """Return the bytes value (contents) of the buffer + """ + if self.closed: + raise ValueError("getvalue on closed file") + return bytes(self._buffer) + + def read(self, n=None): + if self.closed: + raise ValueError("read from closed file") + if n is None: + n = -1 + if not isinstance(n, (int, long)): + raise TypeError("integer argument expected, got {0!r}".format( + type(n))) + if n < 0: + n = len(self._buffer) + if len(self._buffer) <= self._pos: + return b"" + newpos = min(len(self._buffer), self._pos + n) + b = self._buffer[self._pos : newpos] + self._pos = newpos + return bytes(b) + + def read1(self, n): + """This is the same as read. + """ + return self.read(n) + + def write(self, b): + if self.closed: + raise ValueError("write to closed file") + if isinstance(b, unicode): + raise TypeError("can't write unicode to binary stream") + n = len(b) + if n == 0: + return 0 + pos = self._pos + if pos > len(self._buffer): + # Inserts null bytes between the current end of the file + # and the new write position. + padding = b'\x00' * (pos - len(self._buffer)) + self._buffer += padding + self._buffer[pos:pos + n] = b + self._pos += n + return n + + def seek(self, pos, whence=0): + if self.closed: + raise ValueError("seek on closed file") + try: + pos = pos.__index__() + except AttributeError as err: + raise TypeError("an integer is required") + if whence == 0: + if pos < 0: + raise ValueError("negative seek position %r" % (pos,)) + self._pos = pos + elif whence == 1: + self._pos = max(0, self._pos + pos) + elif whence == 2: + self._pos = max(0, len(self._buffer) + pos) + else: + raise ValueError("invalid whence value") + return self._pos + + def tell(self): + if self.closed: + raise ValueError("tell on closed file") + return self._pos + + def truncate(self, pos=None): + if self.closed: + raise ValueError("truncate on closed file") + if pos is None: + pos = self._pos + elif pos < 0: + raise ValueError("negative truncate position %r" % (pos,)) + del self._buffer[pos:] + return self.seek(pos) + + def readable(self): + return True + + def writable(self): + return True + + def seekable(self): + return True + + +class BufferedReader(_BufferedIOMixin): + + """BufferedReader(raw[, buffer_size]) + + A buffer for a readable, sequential BaseRawIO object. + + The constructor creates a BufferedReader for the given readable raw + stream and buffer_size. If buffer_size is omitted, DEFAULT_BUFFER_SIZE + is used. + """ + + def __init__(self, raw, buffer_size=DEFAULT_BUFFER_SIZE): + """Create a new buffered reader using the given readable raw IO object. + """ + if not raw.readable(): + raise IOError('"raw" argument must be readable.') + + _BufferedIOMixin.__init__(self, raw) + if buffer_size <= 0: + raise ValueError("invalid buffer size") + self.buffer_size = buffer_size + self._reset_read_buf() + self._read_lock = Lock() + + def _reset_read_buf(self): + self._read_buf = b"" + self._read_pos = 0 + + def read(self, n=None): + """Read n bytes. + + Returns exactly n bytes of data unless the underlying raw IO + stream reaches EOF or if the call would block in non-blocking + mode. If n is negative, read until EOF or until read() would + block. + """ + if n is not None and n < -1: + raise ValueError("invalid number of bytes to read") + with self._read_lock: + return self._read_unlocked(n) + + def _read_unlocked(self, n=None): + nodata_val = b"" + empty_values = (b"", None) + buf = self._read_buf + pos = self._read_pos + + # Special case for when the number of bytes to read is unspecified. + if n is None or n == -1: + self._reset_read_buf() + chunks = [buf[pos:]] # Strip the consumed bytes. + current_size = 0 + while True: + # Read until EOF or until read() would block. + chunk = self.raw.read() + if chunk in empty_values: + nodata_val = chunk + break + current_size += len(chunk) + chunks.append(chunk) + return b"".join(chunks) or nodata_val + + # The number of bytes to read is specified, return at most n bytes. + avail = len(buf) - pos # Length of the available buffered data. + if n <= avail: + # Fast path: the data to read is fully buffered. + self._read_pos += n + return buf[pos:pos+n] + # Slow path: read from the stream until enough bytes are read, + # or until an EOF occurs or until read() would block. + chunks = [buf[pos:]] + wanted = max(self.buffer_size, n) + while avail < n: + chunk = self.raw.read(wanted) + if chunk in empty_values: + nodata_val = chunk + break + avail += len(chunk) + chunks.append(chunk) + # n is more then avail only when an EOF occurred or when + # read() would have blocked. + n = min(n, avail) + out = b"".join(chunks) + self._read_buf = out[n:] # Save the extra data in the buffer. + self._read_pos = 0 + return out[:n] if out else nodata_val + + def peek(self, n=0): + """Returns buffered bytes without advancing the position. + + The argument indicates a desired minimal number of bytes; we + do at most one raw read to satisfy it. We never return more + than self.buffer_size. + """ + with self._read_lock: + return self._peek_unlocked(n) + + def _peek_unlocked(self, n=0): + want = min(n, self.buffer_size) + have = len(self._read_buf) - self._read_pos + if have < want or have <= 0: + to_read = self.buffer_size - have + current = self.raw.read(to_read) + if current: + self._read_buf = self._read_buf[self._read_pos:] + current + self._read_pos = 0 + return self._read_buf[self._read_pos:] + + def read1(self, n): + """Reads up to n bytes, with at most one read() system call.""" + # Returns up to n bytes. If at least one byte is buffered, we + # only return buffered bytes. Otherwise, we do one raw read. + if n < 0: + raise ValueError("number of bytes to read must be positive") + if n == 0: + return b"" + with self._read_lock: + self._peek_unlocked(1) + return self._read_unlocked( + min(n, len(self._read_buf) - self._read_pos)) + + def tell(self): + return _BufferedIOMixin.tell(self) - len(self._read_buf) + self._read_pos + + def seek(self, pos, whence=0): + if not (0 <= whence <= 2): + raise ValueError("invalid whence value") + with self._read_lock: + if whence == 1: + pos -= len(self._read_buf) - self._read_pos + pos = _BufferedIOMixin.seek(self, pos, whence) + self._reset_read_buf() + return pos + +class BufferedWriter(_BufferedIOMixin): + + """A buffer for a writeable sequential RawIO object. + + The constructor creates a BufferedWriter for the given writeable raw + stream. If the buffer_size is not given, it defaults to + DEFAULT_BUFFER_SIZE. + """ + + _warning_stack_offset = 2 + + def __init__(self, raw, + buffer_size=DEFAULT_BUFFER_SIZE, max_buffer_size=None): + if not raw.writable(): + raise IOError('"raw" argument must be writable.') + + _BufferedIOMixin.__init__(self, raw) + if buffer_size <= 0: + raise ValueError("invalid buffer size") + if max_buffer_size is not None: + warnings.warn("max_buffer_size is deprecated", DeprecationWarning, + self._warning_stack_offset) + self.buffer_size = buffer_size + self._write_buf = bytearray() + self._write_lock = Lock() + + def write(self, b): + if self.closed: + raise ValueError("write to closed file") + if isinstance(b, unicode): + raise TypeError("can't write unicode to binary stream") + with self._write_lock: + # XXX we can implement some more tricks to try and avoid + # partial writes + if len(self._write_buf) > self.buffer_size: + # We're full, so let's pre-flush the buffer + try: + self._flush_unlocked() + except BlockingIOError as e: + # We can't accept anything else. + # XXX Why not just let the exception pass through? + raise BlockingIOError(e.errno, e.strerror, 0) + before = len(self._write_buf) + self._write_buf.extend(b) + written = len(self._write_buf) - before + if len(self._write_buf) > self.buffer_size: + try: + self._flush_unlocked() + except BlockingIOError as e: + if len(self._write_buf) > self.buffer_size: + # We've hit the buffer_size. We have to accept a partial + # write and cut back our buffer. + overage = len(self._write_buf) - self.buffer_size + written -= overage + self._write_buf = self._write_buf[:self.buffer_size] + raise BlockingIOError(e.errno, e.strerror, written) + return written + + def truncate(self, pos=None): + with self._write_lock: + self._flush_unlocked() + if pos is None: + pos = self.raw.tell() + return self.raw.truncate(pos) + + def flush(self): + with self._write_lock: + self._flush_unlocked() + + def _flush_unlocked(self): + if self.closed: + raise ValueError("flush of closed file") + written = 0 + try: + while self._write_buf: + n = self.raw.write(self._write_buf) + if n > len(self._write_buf) or n < 0: + raise IOError("write() returned incorrect number of bytes") + del self._write_buf[:n] + written += n + except BlockingIOError as e: + n = e.characters_written + del self._write_buf[:n] + written += n + raise BlockingIOError(e.errno, e.strerror, written) + + def tell(self): + return _BufferedIOMixin.tell(self) + len(self._write_buf) + + def seek(self, pos, whence=0): + if not (0 <= whence <= 2): + raise ValueError("invalid whence") + with self._write_lock: + self._flush_unlocked() + return _BufferedIOMixin.seek(self, pos, whence) + + +class BufferedRWPair(BufferedIOBase): + + """A buffered reader and writer object together. + + A buffered reader object and buffered writer object put together to + form a sequential IO object that can read and write. This is typically + used with a socket or two-way pipe. + + reader and writer are RawIOBase objects that are readable and + writeable respectively. If the buffer_size is omitted it defaults to + DEFAULT_BUFFER_SIZE. + """ + + # XXX The usefulness of this (compared to having two separate IO + # objects) is questionable. + + def __init__(self, reader, writer, + buffer_size=DEFAULT_BUFFER_SIZE, max_buffer_size=None): + """Constructor. + + The arguments are two RawIO instances. + """ + if max_buffer_size is not None: + warnings.warn("max_buffer_size is deprecated", DeprecationWarning, 2) + + if not reader.readable(): + raise IOError('"reader" argument must be readable.') + + if not writer.writable(): + raise IOError('"writer" argument must be writable.') + + self.reader = BufferedReader(reader, buffer_size) + self.writer = BufferedWriter(writer, buffer_size) + + def read(self, n=None): + if n is None: + n = -1 + return self.reader.read(n) + + def readinto(self, b): + return self.reader.readinto(b) + + def write(self, b): + return self.writer.write(b) + + def peek(self, n=0): + return self.reader.peek(n) + + def read1(self, n): + return self.reader.read1(n) + + def readable(self): + return self.reader.readable() + + def writable(self): + return self.writer.writable() + + def flush(self): + return self.writer.flush() + + def close(self): + self.writer.close() + self.reader.close() + + def isatty(self): + return self.reader.isatty() or self.writer.isatty() + + @property + def closed(self): + return self.writer.closed + + +class BufferedRandom(BufferedWriter, BufferedReader): + + """A buffered interface to random access streams. + + The constructor creates a reader and writer for a seekable stream, + raw, given in the first argument. If the buffer_size is omitted it + defaults to DEFAULT_BUFFER_SIZE. + """ + + _warning_stack_offset = 3 + + def __init__(self, raw, + buffer_size=DEFAULT_BUFFER_SIZE, max_buffer_size=None): + raw._checkSeekable() + BufferedReader.__init__(self, raw, buffer_size) + BufferedWriter.__init__(self, raw, buffer_size, max_buffer_size) + + def seek(self, pos, whence=0): + if not (0 <= whence <= 2): + raise ValueError("invalid whence") + self.flush() + if self._read_buf: + # Undo read ahead. + with self._read_lock: + self.raw.seek(self._read_pos - len(self._read_buf), 1) + # First do the raw seek, then empty the read buffer, so that + # if the raw seek fails, we don't lose buffered data forever. + pos = self.raw.seek(pos, whence) + with self._read_lock: + self._reset_read_buf() + if pos < 0: + raise IOError("seek() returned invalid position") + return pos + + def tell(self): + if self._write_buf: + return BufferedWriter.tell(self) + else: + return BufferedReader.tell(self) + + def truncate(self, pos=None): + if pos is None: + pos = self.tell() + # Use seek to flush the read buffer. + self.seek(pos) + return BufferedWriter.truncate(self) + + def read(self, n=None): + if n is None: + n = -1 + self.flush() + return BufferedReader.read(self, n) + + def readinto(self, b): + self.flush() + return BufferedReader.readinto(self, b) + + def peek(self, n=0): + self.flush() + return BufferedReader.peek(self, n) + + def read1(self, n): + self.flush() + return BufferedReader.read1(self, n) + + def write(self, b): + if self._read_buf: + # Undo readahead + with self._read_lock: + self.raw.seek(self._read_pos - len(self._read_buf), 1) + self._reset_read_buf() + return BufferedWriter.write(self, b) + + +class TextIOBase(IOBase): + + """Base class for text I/O. + + This class provides a character and line based interface to stream + I/O. There is no readinto method because Python's character strings + are immutable. There is no public constructor. + """ + + def read(self, n=-1): + """Read at most n characters from stream. + + Read from underlying buffer until we have n characters or we hit EOF. + If n is negative or omitted, read until EOF. + """ + self._unsupported("read") + + def write(self, s): + """Write string s to stream.""" + self._unsupported("write") + + def truncate(self, pos=None): + """Truncate size to pos.""" + self._unsupported("truncate") + + def readline(self): + """Read until newline or EOF. + + Returns an empty string if EOF is hit immediately. + """ + self._unsupported("readline") + + def detach(self): + """ + Separate the underlying buffer from the TextIOBase and return it. + + After the underlying buffer has been detached, the TextIO is in an + unusable state. + """ + self._unsupported("detach") + + @property + def encoding(self): + """Subclasses should override.""" + return None + + @property + def newlines(self): + """Line endings translated so far. + + Only line endings translated during reading are considered. + + Subclasses should override. + """ + return None + + @property + def errors(self): + """Error setting of the decoder or encoder. + + Subclasses should override.""" + return None + +io.TextIOBase.register(TextIOBase) + + +class IncrementalNewlineDecoder(codecs.IncrementalDecoder): + r"""Codec used when reading a file in universal newlines mode. It wraps + another incremental decoder, translating \r\n and \r into \n. It also + records the types of newlines encountered. When used with + translate=False, it ensures that the newline sequence is returned in + one piece. + """ + def __init__(self, decoder, translate, errors='strict'): + codecs.IncrementalDecoder.__init__(self, errors=errors) + self.translate = translate + self.decoder = decoder + self.seennl = 0 + self.pendingcr = False + + def decode(self, input, final=False): + # decode input (with the eventual \r from a previous pass) + if self.decoder is None: + output = input + else: + output = self.decoder.decode(input, final=final) + if self.pendingcr and (output or final): + output = "\r" + output + self.pendingcr = False + + # retain last \r even when not translating data: + # then readline() is sure to get \r\n in one pass + if output.endswith("\r") and not final: + output = output[:-1] + self.pendingcr = True + + # Record which newlines are read + crlf = output.count('\r\n') + cr = output.count('\r') - crlf + lf = output.count('\n') - crlf + self.seennl |= (lf and self._LF) | (cr and self._CR) \ + | (crlf and self._CRLF) + + if self.translate: + if crlf: + output = output.replace("\r\n", "\n") + if cr: + output = output.replace("\r", "\n") + + return output + + def getstate(self): + if self.decoder is None: + buf = b"" + flag = 0 + else: + buf, flag = self.decoder.getstate() + flag <<= 1 + if self.pendingcr: + flag |= 1 + return buf, flag + + def setstate(self, state): + buf, flag = state + self.pendingcr = bool(flag & 1) + if self.decoder is not None: + self.decoder.setstate((buf, flag >> 1)) + + def reset(self): + self.seennl = 0 + self.pendingcr = False + if self.decoder is not None: + self.decoder.reset() + + _LF = 1 + _CR = 2 + _CRLF = 4 + + @property + def newlines(self): + return (None, + "\n", + "\r", + ("\r", "\n"), + "\r\n", + ("\n", "\r\n"), + ("\r", "\r\n"), + ("\r", "\n", "\r\n") + )[self.seennl] + + +class TextIOWrapper(TextIOBase): + + r"""Character and line based layer over a BufferedIOBase object, buffer. + + encoding gives the name of the encoding that the stream will be + decoded or encoded with. It defaults to locale.getpreferredencoding. + + errors determines the strictness of encoding and decoding (see the + codecs.register) and defaults to "strict". + + newline can be None, '', '\n', '\r', or '\r\n'. It controls the + handling of line endings. If it is None, universal newlines is + enabled. With this enabled, on input, the lines endings '\n', '\r', + or '\r\n' are translated to '\n' before being returned to the + caller. Conversely, on output, '\n' is translated to the system + default line seperator, os.linesep. If newline is any other of its + legal values, that newline becomes the newline when the file is read + and it is returned untranslated. On output, '\n' is converted to the + newline. + + If line_buffering is True, a call to flush is implied when a call to + write contains a newline character. + """ + + _CHUNK_SIZE = 2048 + + def __init__(self, buffer, encoding=None, errors=None, newline=None, + line_buffering=False): + if newline is not None and not isinstance(newline, basestring): + raise TypeError("illegal newline type: %r" % (type(newline),)) + if newline not in (None, "", "\n", "\r", "\r\n"): + raise ValueError("illegal newline value: %r" % (newline,)) + if encoding is None: + try: + encoding = os.device_encoding(buffer.fileno()) + except (AttributeError, UnsupportedOperation): + pass + if encoding is None: + try: + import locale + except ImportError: + # Importing locale may fail if Python is being built + encoding = "ascii" + else: + encoding = locale.getpreferredencoding() + + if not isinstance(encoding, basestring): + raise ValueError("invalid encoding: %r" % encoding) + + if errors is None: + errors = "strict" + else: + if not isinstance(errors, basestring): + raise ValueError("invalid errors: %r" % errors) + + self.buffer = buffer + self._line_buffering = line_buffering + self._encoding = encoding + self._errors = errors + self._readuniversal = not newline + self._readtranslate = newline is None + self._readnl = newline + self._writetranslate = newline != '' + self._writenl = newline or os.linesep + self._encoder = None + self._decoder = None + self._decoded_chars = '' # buffer for text returned from decoder + self._decoded_chars_used = 0 # offset into _decoded_chars for read() + self._snapshot = None # info for reconstructing decoder state + self._seekable = self._telling = self.buffer.seekable() + + if self._seekable and self.writable(): + position = self.buffer.tell() + if position != 0: + try: + self._get_encoder().setstate(0) + except LookupError: + # Sometimes the encoder doesn't exist + pass + + # self._snapshot is either None, or a tuple (dec_flags, next_input) + # where dec_flags is the second (integer) item of the decoder state + # and next_input is the chunk of input bytes that comes next after the + # snapshot point. We use this to reconstruct decoder states in tell(). + + # Naming convention: + # - "bytes_..." for integer variables that count input bytes + # - "chars_..." for integer variables that count decoded characters + + def __repr__(self): + try: + name = self.name + except AttributeError: + return "<_pyio.TextIOWrapper encoding='{0}'>".format(self.encoding) + else: + return "<_pyio.TextIOWrapper name={0!r} encoding='{1}'>".format( + name, self.encoding) + + @property + def encoding(self): + return self._encoding + + @property + def errors(self): + return self._errors + + @property + def line_buffering(self): + return self._line_buffering + + def seekable(self): + return self._seekable + + def readable(self): + return self.buffer.readable() + + def writable(self): + return self.buffer.writable() + + def flush(self): + self.buffer.flush() + self._telling = self._seekable + + def close(self): + if self.buffer is not None: + try: + self.flush() + except IOError: + pass # If flush() fails, just give up + self.buffer.close() + + @property + def closed(self): + return self.buffer.closed + + @property + def name(self): + return self.buffer.name + + def fileno(self): + return self.buffer.fileno() + + def isatty(self): + return self.buffer.isatty() + + def write(self, s): + if self.closed: + raise ValueError("write to closed file") + if not isinstance(s, unicode): + raise TypeError("can't write %s to text stream" % + s.__class__.__name__) + length = len(s) + haslf = (self._writetranslate or self._line_buffering) and "\n" in s + if haslf and self._writetranslate and self._writenl != "\n": + s = s.replace("\n", self._writenl) + encoder = self._encoder or self._get_encoder() + # XXX What if we were just reading? + b = encoder.encode(s) + self.buffer.write(b) + if self._line_buffering and (haslf or "\r" in s): + self.flush() + self._snapshot = None + if self._decoder: + self._decoder.reset() + return length + + def _get_encoder(self): + make_encoder = codecs.getincrementalencoder(self._encoding) + self._encoder = make_encoder(self._errors) + return self._encoder + + def _get_decoder(self): + make_decoder = codecs.getincrementaldecoder(self._encoding) + decoder = make_decoder(self._errors) + if self._readuniversal: + decoder = IncrementalNewlineDecoder(decoder, self._readtranslate) + self._decoder = decoder + return decoder + + # The following three methods implement an ADT for _decoded_chars. + # Text returned from the decoder is buffered here until the client + # requests it by calling our read() or readline() method. + def _set_decoded_chars(self, chars): + """Set the _decoded_chars buffer.""" + self._decoded_chars = chars + self._decoded_chars_used = 0 + + def _get_decoded_chars(self, n=None): + """Advance into the _decoded_chars buffer.""" + offset = self._decoded_chars_used + if n is None: + chars = self._decoded_chars[offset:] + else: + chars = self._decoded_chars[offset:offset + n] + self._decoded_chars_used += len(chars) + return chars + + def _rewind_decoded_chars(self, n): + """Rewind the _decoded_chars buffer.""" + if self._decoded_chars_used < n: + raise AssertionError("rewind decoded_chars out of bounds") + self._decoded_chars_used -= n + + def _read_chunk(self): + """ + Read and decode the next chunk of data from the BufferedReader. + """ + + # The return value is True unless EOF was reached. The decoded + # string is placed in self._decoded_chars (replacing its previous + # value). The entire input chunk is sent to the decoder, though + # some of it may remain buffered in the decoder, yet to be + # converted. + + if self._decoder is None: + raise ValueError("no decoder") + + if self._telling: + # To prepare for tell(), we need to snapshot a point in the + # file where the decoder's input buffer is empty. + + dec_buffer, dec_flags = self._decoder.getstate() + # Given this, we know there was a valid snapshot point + # len(dec_buffer) bytes ago with decoder state (b'', dec_flags). + + # Read a chunk, decode it, and put the result in self._decoded_chars. + input_chunk = self.buffer.read1(self._CHUNK_SIZE) + eof = not input_chunk + self._set_decoded_chars(self._decoder.decode(input_chunk, eof)) + + if self._telling: + # At the snapshot point, len(dec_buffer) bytes before the read, + # the next input to be decoded is dec_buffer + input_chunk. + self._snapshot = (dec_flags, dec_buffer + input_chunk) + + return not eof + + def _pack_cookie(self, position, dec_flags=0, + bytes_to_feed=0, need_eof=0, chars_to_skip=0): + # The meaning of a tell() cookie is: seek to position, set the + # decoder flags to dec_flags, read bytes_to_feed bytes, feed them + # into the decoder with need_eof as the EOF flag, then skip + # chars_to_skip characters of the decoded result. For most simple + # decoders, tell() will often just give a byte offset in the file. + return (position | (dec_flags<<64) | (bytes_to_feed<<128) | + (chars_to_skip<<192) | bool(need_eof)<<256) + + def _unpack_cookie(self, bigint): + rest, position = divmod(bigint, 1<<64) + rest, dec_flags = divmod(rest, 1<<64) + rest, bytes_to_feed = divmod(rest, 1<<64) + need_eof, chars_to_skip = divmod(rest, 1<<64) + return position, dec_flags, bytes_to_feed, need_eof, chars_to_skip + + def tell(self): + if not self._seekable: + raise IOError("underlying stream is not seekable") + if not self._telling: + raise IOError("telling position disabled by next() call") + self.flush() + position = self.buffer.tell() + decoder = self._decoder + if decoder is None or self._snapshot is None: + if self._decoded_chars: + # This should never happen. + raise AssertionError("pending decoded text") + return position + + # Skip backward to the snapshot point (see _read_chunk). + dec_flags, next_input = self._snapshot + position -= len(next_input) + + # How many decoded characters have been used up since the snapshot? + chars_to_skip = self._decoded_chars_used + if chars_to_skip == 0: + # We haven't moved from the snapshot point. + return self._pack_cookie(position, dec_flags) + + # Starting from the snapshot position, we will walk the decoder + # forward until it gives us enough decoded characters. + saved_state = decoder.getstate() + try: + # Note our initial start point. + decoder.setstate((b'', dec_flags)) + start_pos = position + start_flags, bytes_fed, chars_decoded = dec_flags, 0, 0 + need_eof = 0 + + # Feed the decoder one byte at a time. As we go, note the + # nearest "safe start point" before the current location + # (a point where the decoder has nothing buffered, so seek() + # can safely start from there and advance to this location). + for next_byte in next_input: + bytes_fed += 1 + chars_decoded += len(decoder.decode(next_byte)) + dec_buffer, dec_flags = decoder.getstate() + if not dec_buffer and chars_decoded <= chars_to_skip: + # Decoder buffer is empty, so this is a safe start point. + start_pos += bytes_fed + chars_to_skip -= chars_decoded + start_flags, bytes_fed, chars_decoded = dec_flags, 0, 0 + if chars_decoded >= chars_to_skip: + break + else: + # We didn't get enough decoded data; signal EOF to get more. + chars_decoded += len(decoder.decode(b'', final=True)) + need_eof = 1 + if chars_decoded < chars_to_skip: + raise IOError("can't reconstruct logical file position") + + # The returned cookie corresponds to the last safe start point. + return self._pack_cookie( + start_pos, start_flags, bytes_fed, need_eof, chars_to_skip) + finally: + decoder.setstate(saved_state) + + def truncate(self, pos=None): + self.flush() + if pos is None: + pos = self.tell() + self.seek(pos) + return self.buffer.truncate() + + def detach(self): + if self.buffer is None: + raise ValueError("buffer is already detached") + self.flush() + buffer = self.buffer + self.buffer = None + return buffer + + def seek(self, cookie, whence=0): + if self.closed: + raise ValueError("tell on closed file") + if not self._seekable: + raise IOError("underlying stream is not seekable") + if whence == 1: # seek relative to current position + if cookie != 0: + raise IOError("can't do nonzero cur-relative seeks") + # Seeking to the current position should attempt to + # sync the underlying buffer with the current position. + whence = 0 + cookie = self.tell() + if whence == 2: # seek relative to end of file + if cookie != 0: + raise IOError("can't do nonzero end-relative seeks") + self.flush() + position = self.buffer.seek(0, 2) + self._set_decoded_chars('') + self._snapshot = None + if self._decoder: + self._decoder.reset() + return position + if whence != 0: + raise ValueError("invalid whence (%r, should be 0, 1 or 2)" % + (whence,)) + if cookie < 0: + raise ValueError("negative seek position %r" % (cookie,)) + self.flush() + + # The strategy of seek() is to go back to the safe start point + # and replay the effect of read(chars_to_skip) from there. + start_pos, dec_flags, bytes_to_feed, need_eof, chars_to_skip = \ + self._unpack_cookie(cookie) + + # Seek back to the safe start point. + self.buffer.seek(start_pos) + self._set_decoded_chars('') + self._snapshot = None + + # Restore the decoder to its state from the safe start point. + if cookie == 0 and self._decoder: + self._decoder.reset() + elif self._decoder or dec_flags or chars_to_skip: + self._decoder = self._decoder or self._get_decoder() + self._decoder.setstate((b'', dec_flags)) + self._snapshot = (dec_flags, b'') + + if chars_to_skip: + # Just like _read_chunk, feed the decoder and save a snapshot. + input_chunk = self.buffer.read(bytes_to_feed) + self._set_decoded_chars( + self._decoder.decode(input_chunk, need_eof)) + self._snapshot = (dec_flags, input_chunk) + + # Skip chars_to_skip of the decoded characters. + if len(self._decoded_chars) < chars_to_skip: + raise IOError("can't restore logical file position") + self._decoded_chars_used = chars_to_skip + + # Finally, reset the encoder (merely useful for proper BOM handling) + try: + encoder = self._encoder or self._get_encoder() + except LookupError: + # Sometimes the encoder doesn't exist + pass + else: + if cookie != 0: + encoder.setstate(0) + else: + encoder.reset() + return cookie + + def read(self, n=None): + self._checkReadable() + if n is None: + n = -1 + decoder = self._decoder or self._get_decoder() + if n < 0: + # Read everything. + result = (self._get_decoded_chars() + + decoder.decode(self.buffer.read(), final=True)) + self._set_decoded_chars('') + self._snapshot = None + return result + else: + # Keep reading chunks until we have n characters to return. + eof = False + result = self._get_decoded_chars(n) + while len(result) < n and not eof: + eof = not self._read_chunk() + result += self._get_decoded_chars(n - len(result)) + return result + + def next(self): + self._telling = False + line = self.readline() + if not line: + self._snapshot = None + self._telling = self._seekable + raise StopIteration + return line + + def readline(self, limit=None): + if self.closed: + raise ValueError("read from closed file") + if limit is None: + limit = -1 + elif not isinstance(limit, (int, long)): + raise TypeError("limit must be an integer") + + # Grab all the decoded text (we will rewind any extra bits later). + line = self._get_decoded_chars() + + start = 0 + # Make the decoder if it doesn't already exist. + if not self._decoder: + self._get_decoder() + + pos = endpos = None + while True: + if self._readtranslate: + # Newlines are already translated, only search for \n + pos = line.find('\n', start) + if pos >= 0: + endpos = pos + 1 + break + else: + start = len(line) + + elif self._readuniversal: + # Universal newline search. Find any of \r, \r\n, \n + # The decoder ensures that \r\n are not split in two pieces + + # In C we'd look for these in parallel of course. + nlpos = line.find("\n", start) + crpos = line.find("\r", start) + if crpos == -1: + if nlpos == -1: + # Nothing found + start = len(line) + else: + # Found \n + endpos = nlpos + 1 + break + elif nlpos == -1: + # Found lone \r + endpos = crpos + 1 + break + elif nlpos < crpos: + # Found \n + endpos = nlpos + 1 + break + elif nlpos == crpos + 1: + # Found \r\n + endpos = crpos + 2 + break + else: + # Found \r + endpos = crpos + 1 + break + else: + # non-universal + pos = line.find(self._readnl) + if pos >= 0: + endpos = pos + len(self._readnl) + break + + if limit >= 0 and len(line) >= limit: + endpos = limit # reached length limit + break + + # No line ending seen yet - get more data' + while self._read_chunk(): + if self._decoded_chars: + break + if self._decoded_chars: + line += self._get_decoded_chars() + else: + # end of file + self._set_decoded_chars('') + self._snapshot = None + return line + + if limit >= 0 and endpos > limit: + endpos = limit # don't exceed limit + + # Rewind _decoded_chars to just after the line ending we found. + self._rewind_decoded_chars(len(line) - endpos) + return line[:endpos] + + @property + def newlines(self): + return self._decoder.newlines if self._decoder else None + + +class StringIO(TextIOWrapper): + """Text I/O implementation using an in-memory buffer. + + The initial_value argument sets the value of object. The newline + argument is like the one of TextIOWrapper's constructor. + """ + + def __init__(self, initial_value="", newline="\n"): + super(StringIO, self).__init__(BytesIO(), + encoding="utf-8", + errors="strict", + newline=newline) + # Issue #5645: make universal newlines semantics the same as in the + # C version, even under Windows. + if newline is None: + self._writetranslate = False + if initial_value: + if not isinstance(initial_value, unicode): + initial_value = unicode(initial_value) + self.write(initial_value) + self.seek(0) + + def getvalue(self): + self.flush() + return self.buffer.getvalue().decode(self._encoding, self._errors) + + def __repr__(self): + # TextIOWrapper tells the encoding in its repr. In StringIO, + # that's a implementation detail. + return object.__repr__(self) + + @property + def errors(self): + return None + + @property + def encoding(self): + return None + + def detach(self): + # This doesn't make sense on StringIO. + self._unsupported("detach") Modified: python/trunk/Lib/io.py ============================================================================== --- python/trunk/Lib/io.py (original) +++ python/trunk/Lib/io.py Fri Jun 12 22:14:08 2009 @@ -1,5 +1,4 @@ -""" -The io module provides the Python interfaces to stream handling. The +"""The io module provides the Python interfaces to stream handling. The builtin open function is defined in this module. At the top of the I/O hierarchy is the abstract base class IOBase. It @@ -35,9 +34,6 @@ """ # New I/O library conforming to PEP 3116. -# This is a prototype; hopefully eventually some of this will be -# reimplemented in C. - # XXX edge cases when switching between reading/writing # XXX need to support 1 meaning line-buffered # XXX whenever an argument is None, use the default value @@ -45,1825 +41,58 @@ # XXX buffered readinto should work with arbitrary buffer objects # XXX use incremental encoder for text output, at least for UTF-16 and UTF-8-SIG # XXX check writable, readable and seekable in appropriate places -from __future__ import print_function -from __future__ import unicode_literals + __author__ = ("Guido van Rossum , " "Mike Verdone , " - "Mark Russell ") + "Mark Russell , " + "Antoine Pitrou , " + "Amaury Forgeot d'Arc , " + "Benjamin Peterson ") __all__ = ["BlockingIOError", "open", "IOBase", "RawIOBase", "FileIO", "BytesIO", "StringIO", "BufferedIOBase", "BufferedReader", "BufferedWriter", "BufferedRWPair", "BufferedRandom", "TextIOBase", "TextIOWrapper", - "SEEK_SET", "SEEK_CUR", "SEEK_END"] + "UnsupportedOperation", "SEEK_SET", "SEEK_CUR", "SEEK_END"] -import os + +import _io import abc -import codecs -import _fileio -import threading -# open() uses st_blksize whenever we can -DEFAULT_BUFFER_SIZE = 8 * 1024 # bytes +from _io import (DEFAULT_BUFFER_SIZE, BlockingIOError, UnsupportedOperation, + open, FileIO, BytesIO, StringIO, BufferedReader, + BufferedWriter, BufferedRWPair, BufferedRandom, + IncrementalNewlineDecoder, TextIOWrapper) + +OpenWrapper = _io.open # for compatibility with _pyio # for seek() SEEK_SET = 0 SEEK_CUR = 1 SEEK_END = 2 -# py3k has only new style classes -__metaclass__ = type - -class BlockingIOError(IOError): - - """Exception raised when I/O would block on a non-blocking I/O stream.""" - - def __init__(self, errno, strerror, characters_written=0): - IOError.__init__(self, errno, strerror) - self.characters_written = characters_written - - -def open(file, mode="r", buffering=None, encoding=None, errors=None, - newline=None, closefd=True): - r"""Open file and return a stream. If the file cannot be opened, an IOError is - raised. - - file is either a string giving the name (and the path if the file - isn't in the current working directory) of the file to be opened or an - integer file descriptor of the file to be wrapped. (If a file - descriptor is given, it is closed when the returned I/O object is - closed, unless closefd is set to False.) - - mode is an optional string that specifies the mode in which the file - is opened. It defaults to 'r' which means open for reading in text - mode. Other common values are 'w' for writing (truncating the file if - it already exists), and 'a' for appending (which on some Unix systems, - means that all writes append to the end of the file regardless of the - current seek position). In text mode, if encoding is not specified the - encoding used is platform dependent. (For reading and writing raw - bytes use binary mode and leave encoding unspecified.) The available - modes are: - - ========= =============================================================== - Character Meaning - --------- --------------------------------------------------------------- - 'r' open for reading (default) - 'w' open for writing, truncating the file first - 'a' open for writing, appending to the end of the file if it exists - 'b' binary mode - 't' text mode (default) - '+' open a disk file for updating (reading and writing) - 'U' universal newline mode (for backwards compatibility; unneeded - for new code) - ========= =============================================================== - - The default mode is 'rt' (open for reading text). For binary random - access, the mode 'w+b' opens and truncates the file to 0 bytes, while - 'r+b' opens the file without truncation. - - Python distinguishes between files opened in binary and text modes, - even when the underlying operating system doesn't. Files opened in - binary mode (appending 'b' to the mode argument) return contents as - bytes objects without any decoding. In text mode (the default, or when - 't' is appended to the mode argument), the contents of the file are - returned as strings, the bytes having been first decoded using a - platform-dependent encoding or using the specified encoding if given. - - buffering is an optional integer used to set the buffering policy. By - default full buffering is on. Pass 0 to switch buffering off (only - allowed in binary mode), 1 to set line buffering, and an integer > 1 - for full buffering. - - encoding is the name of the encoding used to decode or encode the - file. This should only be used in text mode. The default encoding is - platform dependent, but any encoding supported by Python can be - passed. See the codecs module for the list of supported encodings. - - errors is an optional string that specifies how encoding errors are to - be handled---this argument should not be used in binary mode. Pass - 'strict' to raise a ValueError exception if there is an encoding error - (the default of None has the same effect), or pass 'ignore' to ignore - errors. (Note that ignoring encoding errors can lead to data loss.) - See the documentation for codecs.register for a list of the permitted - encoding error strings. - - newline controls how universal newlines works (it only applies to text - mode). It can be None, '', '\n', '\r', and '\r\n'. It works as - follows: - - * On input, if newline is None, universal newlines mode is - enabled. Lines in the input can end in '\n', '\r', or '\r\n', and - these are translated into '\n' before being returned to the - caller. If it is '', universal newline mode is enabled, but line - endings are returned to the caller untranslated. If it has any of - the other legal values, input lines are only terminated by the given - string, and the line ending is returned to the caller untranslated. - - * On output, if newline is None, any '\n' characters written are - translated to the system default line separator, os.linesep. If - newline is '', no translation takes place. If newline is any of the - other legal values, any '\n' characters written are translated to - the given string. - - If closefd is False, the underlying file descriptor will be kept open - when the file is closed. This does not work when a file name is given - and must be True in that case. - - open() returns a file object whose type depends on the mode, and - through which the standard file operations such as reading and writing - are performed. When open() is used to open a file in a text mode ('w', - 'r', 'wt', 'rt', etc.), it returns a TextIOWrapper. When used to open - a file in a binary mode, the returned class varies: in read binary - mode, it returns a BufferedReader; in write binary and append binary - modes, it returns a BufferedWriter, and in read/write mode, it returns - a BufferedRandom. - - It is also possible to use a string or bytearray as a file for both - reading and writing. For strings StringIO can be used like a file - opened in a text mode, and for bytes a BytesIO can be used like a file - opened in a binary mode. - """ - if not isinstance(file, (basestring, int)): - raise TypeError("invalid file: %r" % file) - if not isinstance(mode, basestring): - raise TypeError("invalid mode: %r" % mode) - if buffering is not None and not isinstance(buffering, int): - raise TypeError("invalid buffering: %r" % buffering) - if encoding is not None and not isinstance(encoding, basestring): - raise TypeError("invalid encoding: %r" % encoding) - if errors is not None and not isinstance(errors, basestring): - raise TypeError("invalid errors: %r" % errors) - modes = set(mode) - if modes - set("arwb+tU") or len(mode) > len(modes): - raise ValueError("invalid mode: %r" % mode) - reading = "r" in modes - writing = "w" in modes - appending = "a" in modes - updating = "+" in modes - text = "t" in modes - binary = "b" in modes - if "U" in modes: - if writing or appending: - raise ValueError("can't use U and writing mode at once") - reading = True - if text and binary: - raise ValueError("can't have text and binary mode at once") - if reading + writing + appending > 1: - raise ValueError("can't have read/write/append mode at once") - if not (reading or writing or appending): - raise ValueError("must have exactly one of read/write/append mode") - if binary and encoding is not None: - raise ValueError("binary mode doesn't take an encoding argument") - if binary and errors is not None: - raise ValueError("binary mode doesn't take an errors argument") - if binary and newline is not None: - raise ValueError("binary mode doesn't take a newline argument") - raw = FileIO(file, - (reading and "r" or "") + - (writing and "w" or "") + - (appending and "a" or "") + - (updating and "+" or ""), - closefd) - if buffering is None: - buffering = -1 - line_buffering = False - if buffering == 1 or buffering < 0 and raw.isatty(): - buffering = -1 - line_buffering = True - if buffering < 0: - buffering = DEFAULT_BUFFER_SIZE - try: - bs = os.fstat(raw.fileno()).st_blksize - except (os.error, AttributeError): - pass - else: - if bs > 1: - buffering = bs - if buffering < 0: - raise ValueError("invalid buffering size") - if buffering == 0: - if binary: - return raw - raise ValueError("can't have unbuffered text I/O") - if updating: - buffer = BufferedRandom(raw, buffering) - elif writing or appending: - buffer = BufferedWriter(raw, buffering) - elif reading: - buffer = BufferedReader(raw, buffering) - else: - raise ValueError("unknown mode: %r" % mode) - if binary: - return buffer - text = TextIOWrapper(buffer, encoding, errors, newline, line_buffering) - text.mode = mode - return text - -class _DocDescriptor: - """Helper for builtins.open.__doc__ - """ - def __get__(self, obj, typ): - return ( - "open(file, mode='r', buffering=None, encoding=None, " - "errors=None, newline=None, closefd=True)\n\n" + - open.__doc__) - -class OpenWrapper: - """Wrapper for builtins.open - - Trick so that open won't become a bound method when stored - as a class variable (as dumbdbm does). - - See initstdio() in Python/pythonrun.c. - """ - __doc__ = _DocDescriptor() - - def __new__(cls, *args, **kwargs): - return open(*args, **kwargs) - +# Declaring ABCs in C is tricky so we do it here. +# Method descriptions and default implementations are inherited from the C +# version however. +class IOBase(_io._IOBase): + __metaclass__ = abc.ABCMeta -class UnsupportedOperation(ValueError, IOError): +class RawIOBase(_io._RawIOBase, IOBase): pass +class BufferedIOBase(_io._BufferedIOBase, IOBase): + pass -class IOBase(object): - - """The abstract base class for all I/O classes, acting on streams of - bytes. There is no public constructor. - - This class provides dummy implementations for many methods that - derived classes can override selectively; the default implementations - represent a file that cannot be read, written or seeked. - - Even though IOBase does not declare read, readinto, or write because - their signatures will vary, implementations and clients should - consider those methods part of the interface. Also, implementations - may raise a IOError when operations they do not support are called. - - The basic type used for binary data read from or written to a file is - bytes. bytearrays are accepted too, and in some cases (such as - readinto) needed. Text I/O classes work with str data. - - Note that calling any method (even inquiries) on a closed stream is - undefined. Implementations may raise IOError in this case. - - IOBase (and its subclasses) support the iterator protocol, meaning - that an IOBase object can be iterated over yielding the lines in a - stream. - - IOBase also supports the :keyword:`with` statement. In this example, - fp is closed after the suite of the with statment is complete: - - with open('spam.txt', 'r') as fp: - fp.write('Spam and eggs!') - """ - - __metaclass__ = abc.ABCMeta +class TextIOBase(_io._TextIOBase, IOBase): + pass - ### Internal ### +RawIOBase.register(FileIO) - def _unsupported(self, name): - """Internal: raise an exception for unsupported operations.""" - raise UnsupportedOperation("%s.%s() not supported" % - (self.__class__.__name__, name)) - - ### Positioning ### - - def seek(self, pos, whence = 0): - """Change stream position. - - Change the stream position to byte offset offset. offset is - interpreted relative to the position indicated by whence. Values - for whence are: - - * 0 -- start of stream (the default); offset should be zero or positive - * 1 -- current stream position; offset may be negative - * 2 -- end of stream; offset is usually negative - - Return the new absolute position. - """ - self._unsupported("seek") - - def tell(self): - """Return current stream position.""" - return self.seek(0, 1) - - def truncate(self, pos = None): - """Truncate file to size bytes. - - Size defaults to the current IO position as reported by tell(). Return - the new size. - """ - self._unsupported("truncate") - - ### Flush and close ### - - def flush(self): - """Flush write buffers, if applicable. - - This is not implemented for read-only and non-blocking streams. - """ - # XXX Should this return the number of bytes written??? - - __closed = False - - def close(self): - """Flush and close the IO object. - - This method has no effect if the file is already closed. - """ - if not self.__closed: - try: - self.flush() - except IOError: - pass # If flush() fails, just give up - self.__closed = True - - def __del__(self): - """Destructor. Calls close().""" - # The try/except block is in case this is called at program - # exit time, when it's possible that globals have already been - # deleted, and then the close() call might fail. Since - # there's nothing we can do about such failures and they annoy - # the end users, we suppress the traceback. - try: - self.close() - except: - pass - - ### Inquiries ### - - def seekable(self): - """Return whether object supports random access. - - If False, seek(), tell() and truncate() will raise IOError. - This method may need to do a test seek(). - """ - return False - - def _checkSeekable(self, msg=None): - """Internal: raise an IOError if file is not seekable - """ - if not self.seekable(): - raise IOError("File or stream is not seekable." - if msg is None else msg) - - - def readable(self): - """Return whether object was opened for reading. - - If False, read() will raise IOError. - """ - return False - - def _checkReadable(self, msg=None): - """Internal: raise an IOError if file is not readable - """ - if not self.readable(): - raise IOError("File or stream is not readable." - if msg is None else msg) - - def writable(self): - """Return whether object was opened for writing. - - If False, write() and truncate() will raise IOError. - """ - return False - - def _checkWritable(self, msg=None): - """Internal: raise an IOError if file is not writable - """ - if not self.writable(): - raise IOError("File or stream is not writable." - if msg is None else msg) - - @property - def closed(self): - """closed: bool. True iff the file has been closed. - - For backwards compatibility, this is a property, not a predicate. - """ - return self.__closed - - def _checkClosed(self, msg=None): - """Internal: raise an ValueError if file is closed - """ - if self.closed: - raise ValueError("I/O operation on closed file." - if msg is None else msg) - - ### Context manager ### - - def __enter__(self): - """Context management protocol. Returns self.""" - self._checkClosed() - return self - - def __exit__(self, *args): - """Context management protocol. Calls close()""" - self.close() - - ### Lower-level APIs ### - - # XXX Should these be present even if unimplemented? - - def fileno(self): - """Returns underlying file descriptor if one exists. - - An IOError is raised if the IO object does not use a file descriptor. - """ - self._unsupported("fileno") - - def isatty(self): - """Return whether this is an 'interactive' stream. - - Return False if it can't be determined. - """ - self._checkClosed() - return False - - ### Readline[s] and writelines ### - - def readline(self, limit = -1): - r"""Read and return a line from the stream. - - If limit is specified, at most limit bytes will be read. - - The line terminator is always b'\n' for binary files; for text - files, the newlines argument to open can be used to select the line - terminator(s) recognized. - """ - self._checkClosed() - if hasattr(self, "peek"): - def nreadahead(): - readahead = self.peek(1) - if not readahead: - return 1 - n = (readahead.find(b"\n") + 1) or len(readahead) - if limit >= 0: - n = min(n, limit) - return n - else: - def nreadahead(): - return 1 - if limit is None: - limit = -1 - if not isinstance(limit, (int, long)): - raise TypeError("limit must be an integer") - res = bytearray() - while limit < 0 or len(res) < limit: - b = self.read(nreadahead()) - if not b: - break - res += b - if res.endswith(b"\n"): - break - return bytes(res) - - def __iter__(self): - self._checkClosed() - return self - - def next(self): - line = self.readline() - if not line: - raise StopIteration - return line - - def readlines(self, hint=None): - """Return a list of lines from the stream. - - hint can be specified to control the number of lines read: no more - lines will be read if the total size (in bytes/characters) of all - lines so far exceeds hint. - """ - if hint is None: - hint = -1 - if not isinstance(hint, (int, long)): - raise TypeError("hint must be an integer") - if hint <= 0: - return list(self) - n = 0 - lines = [] - for line in self: - lines.append(line) - n += len(line) - if n >= hint: - break - return lines - - def writelines(self, lines): - self._checkClosed() - for line in lines: - self.write(line) - - -class RawIOBase(IOBase): - - """Base class for raw binary I/O.""" - - # The read() method is implemented by calling readinto(); derived - # classes that want to support read() only need to implement - # readinto() as a primitive operation. In general, readinto() can be - # more efficient than read(). - - # (It would be tempting to also provide an implementation of - # readinto() in terms of read(), in case the latter is a more suitable - # primitive operation, but that would lead to nasty recursion in case - # a subclass doesn't implement either.) - - def read(self, n = -1): - """Read and return up to n bytes. - - Returns an empty bytes array on EOF, or None if the object is - set not to block and has no data to read. - """ - if n is None: - n = -1 - if n < 0: - return self.readall() - b = bytearray(n.__index__()) - n = self.readinto(b) - del b[n:] - return bytes(b) - - def readall(self): - """Read until EOF, using multiple read() call.""" - res = bytearray() - while True: - data = self.read(DEFAULT_BUFFER_SIZE) - if not data: - break - res += data - return bytes(res) - - def readinto(self, b): - """Read up to len(b) bytes into b. - - Returns number of bytes read (0 for EOF), or None if the object - is set not to block as has no data to read. - """ - self._unsupported("readinto") - - def write(self, b): - """Write the given buffer to the IO stream. - - Returns the number of bytes written, which may be less than len(b). - """ - self._unsupported("write") - - -class FileIO(_fileio._FileIO, RawIOBase): - - """Raw I/O implementation for OS files.""" - - # This multiply inherits from _FileIO and RawIOBase to make - # isinstance(io.FileIO(), io.RawIOBase) return True without requiring - # that _fileio._FileIO inherits from io.RawIOBase (which would be hard - # to do since _fileio.c is written in C). - - def __init__(self, name, mode="r", closefd=True): - _fileio._FileIO.__init__(self, name, mode, closefd) - self._name = name - - def close(self): - _fileio._FileIO.close(self) - RawIOBase.close(self) - - @property - def name(self): - return self._name - - -class BufferedIOBase(IOBase): - - """Base class for buffered IO objects. - - The main difference with RawIOBase is that the read() method - supports omitting the size argument, and does not have a default - implementation that defers to readinto(). - - In addition, read(), readinto() and write() may raise - BlockingIOError if the underlying raw stream is in non-blocking - mode and not ready; unlike their raw counterparts, they will never - return None. - - A typical implementation should not inherit from a RawIOBase - implementation, but wrap one. - """ - - def read(self, n = None): - """Read and return up to n bytes. - - If the argument is omitted, None, or negative, reads and - returns all data until EOF. - - If the argument is positive, and the underlying raw stream is - not 'interactive', multiple raw reads may be issued to satisfy - the byte count (unless EOF is reached first). But for - interactive raw streams (XXX and for pipes?), at most one raw - read will be issued, and a short result does not imply that - EOF is imminent. - - Returns an empty bytes array on EOF. - - Raises BlockingIOError if the underlying raw stream has no - data at the moment. - """ - self._unsupported("read") - - def readinto(self, b): - """Read up to len(b) bytes into b. - - Like read(), this may issue multiple reads to the underlying raw - stream, unless the latter is 'interactive'. - - Returns the number of bytes read (0 for EOF). - - Raises BlockingIOError if the underlying raw stream has no - data at the moment. - """ - # XXX This ought to work with anything that supports the buffer API - data = self.read(len(b)) - n = len(data) - try: - b[:n] = data - except TypeError as err: - import array - if not isinstance(b, array.array): - raise err - b[:n] = array.array(b'b', data) - return n - - def write(self, b): - """Write the given buffer to the IO stream. - - Return the number of bytes written, which is never less than - len(b). - - Raises BlockingIOError if the buffer is full and the - underlying raw stream cannot accept more data at the moment. - """ - self._unsupported("write") - - -class _BufferedIOMixin(BufferedIOBase): - - """A mixin implementation of BufferedIOBase with an underlying raw stream. - - This passes most requests on to the underlying raw stream. It - does *not* provide implementations of read(), readinto() or - write(). - """ - - def __init__(self, raw): - self.raw = raw - - ### Positioning ### - - def seek(self, pos, whence=0): - return self.raw.seek(pos, whence) - - def tell(self): - return self.raw.tell() - - def truncate(self, pos=None): - # Flush the stream. We're mixing buffered I/O with lower-level I/O, - # and a flush may be necessary to synch both views of the current - # file state. - self.flush() - - if pos is None: - pos = self.tell() - # XXX: Should seek() be used, instead of passing the position - # XXX directly to truncate? - return self.raw.truncate(pos) - - ### Flush and close ### - - def flush(self): - self.raw.flush() - - def close(self): - if not self.closed: - try: - self.flush() - except IOError: - pass # If flush() fails, just give up - self.raw.close() - - ### Inquiries ### - - def seekable(self): - return self.raw.seekable() - - def readable(self): - return self.raw.readable() - - def writable(self): - return self.raw.writable() - - @property - def closed(self): - return self.raw.closed - - @property - def name(self): - return self.raw.name - - @property - def mode(self): - return self.raw.mode - - ### Lower-level APIs ### - - def fileno(self): - return self.raw.fileno() - - def isatty(self): - return self.raw.isatty() - - -class _BytesIO(BufferedIOBase): - - """Buffered I/O implementation using an in-memory bytes buffer.""" - - # XXX More docs - - def __init__(self, initial_bytes=None): - buf = bytearray() - if initial_bytes is not None: - buf += bytearray(initial_bytes) - self._buffer = buf - self._pos = 0 - - def getvalue(self): - """Return the bytes value (contents) of the buffer - """ - if self.closed: - raise ValueError("getvalue on closed file") - return bytes(self._buffer) - - def read(self, n=None): - if self.closed: - raise ValueError("read from closed file") - if n is None: - n = -1 - if not isinstance(n, (int, long)): - raise TypeError("argument must be an integer") - if n < 0: - n = len(self._buffer) - if len(self._buffer) <= self._pos: - return b"" - newpos = min(len(self._buffer), self._pos + n) - b = self._buffer[self._pos : newpos] - self._pos = newpos - return bytes(b) - - def read1(self, n): - """this is the same as read. - """ - return self.read(n) - - def write(self, b): - if self.closed: - raise ValueError("write to closed file") - if isinstance(b, unicode): - raise TypeError("can't write unicode to binary stream") - n = len(b) - if n == 0: - return 0 - pos = self._pos - if pos > len(self._buffer): - # Inserts null bytes between the current end of the file - # and the new write position. - padding = b'\x00' * (pos - len(self._buffer)) - self._buffer += padding - self._buffer[pos:pos + n] = b - self._pos += n - return n - - def seek(self, pos, whence=0): - if self.closed: - raise ValueError("seek on closed file") - try: - pos = pos.__index__() - except AttributeError as err: - raise TypeError("an integer is required") # from err - if whence == 0: - if pos < 0: - raise ValueError("negative seek position %r" % (pos,)) - self._pos = pos - elif whence == 1: - self._pos = max(0, self._pos + pos) - elif whence == 2: - self._pos = max(0, len(self._buffer) + pos) - else: - raise ValueError("invalid whence value") - return self._pos - - def tell(self): - if self.closed: - raise ValueError("tell on closed file") - return self._pos - - def truncate(self, pos=None): - if self.closed: - raise ValueError("truncate on closed file") - if pos is None: - pos = self._pos - elif pos < 0: - raise ValueError("negative truncate position %r" % (pos,)) - del self._buffer[pos:] - return self.seek(pos) - - def readable(self): - return True - - def writable(self): - return True - - def seekable(self): - return True - -# Use the faster implementation of BytesIO if available -try: - import _bytesio - - class BytesIO(_bytesio._BytesIO, BufferedIOBase): - __doc__ = _bytesio._BytesIO.__doc__ - -except ImportError: - BytesIO = _BytesIO - - -class BufferedReader(_BufferedIOMixin): - - """BufferedReader(raw[, buffer_size]) - - A buffer for a readable, sequential BaseRawIO object. - - The constructor creates a BufferedReader for the given readable raw - stream and buffer_size. If buffer_size is omitted, DEFAULT_BUFFER_SIZE - is used. - """ - - def __init__(self, raw, buffer_size=DEFAULT_BUFFER_SIZE): - """Create a new buffered reader using the given readable raw IO object. - """ - raw._checkReadable() - _BufferedIOMixin.__init__(self, raw) - self.buffer_size = buffer_size - self._reset_read_buf() - self._read_lock = threading.Lock() - - def _reset_read_buf(self): - self._read_buf = b"" - self._read_pos = 0 - - def read(self, n=None): - """Read n bytes. - - Returns exactly n bytes of data unless the underlying raw IO - stream reaches EOF or if the call would block in non-blocking - mode. If n is negative, read until EOF or until read() would - block. - """ - with self._read_lock: - return self._read_unlocked(n) - - def _read_unlocked(self, n=None): - nodata_val = b"" - empty_values = (b"", None) - buf = self._read_buf - pos = self._read_pos - - # Special case for when the number of bytes to read is unspecified. - if n is None or n == -1: - self._reset_read_buf() - chunks = [buf[pos:]] # Strip the consumed bytes. - current_size = 0 - while True: - # Read until EOF or until read() would block. - chunk = self.raw.read() - if chunk in empty_values: - nodata_val = chunk - break - current_size += len(chunk) - chunks.append(chunk) - return b"".join(chunks) or nodata_val - - # The number of bytes to read is specified, return at most n bytes. - avail = len(buf) - pos # Length of the available buffered data. - if n <= avail: - # Fast path: the data to read is fully buffered. - self._read_pos += n - return buf[pos:pos+n] - # Slow path: read from the stream until enough bytes are read, - # or until an EOF occurs or until read() would block. - chunks = [buf[pos:]] - wanted = max(self.buffer_size, n) - while avail < n: - chunk = self.raw.read(wanted) - if chunk in empty_values: - nodata_val = chunk - break - avail += len(chunk) - chunks.append(chunk) - # n is more then avail only when an EOF occurred or when - # read() would have blocked. - n = min(n, avail) - out = b"".join(chunks) - self._read_buf = out[n:] # Save the extra data in the buffer. - self._read_pos = 0 - return out[:n] if out else nodata_val - - def peek(self, n=0): - """Returns buffered bytes without advancing the position. - - The argument indicates a desired minimal number of bytes; we - do at most one raw read to satisfy it. We never return more - than self.buffer_size. - """ - with self._read_lock: - return self._peek_unlocked(n) - - def _peek_unlocked(self, n=0): - want = min(n, self.buffer_size) - have = len(self._read_buf) - self._read_pos - if have < want: - to_read = self.buffer_size - have - current = self.raw.read(to_read) - if current: - self._read_buf = self._read_buf[self._read_pos:] + current - self._read_pos = 0 - return self._read_buf[self._read_pos:] - - def read1(self, n): - """Reads up to n bytes, with at most one read() system call.""" - # Returns up to n bytes. If at least one byte is buffered, we - # only return buffered bytes. Otherwise, we do one raw read. - if n <= 0: - return b"" - with self._read_lock: - self._peek_unlocked(1) - return self._read_unlocked( - min(n, len(self._read_buf) - self._read_pos)) - - def tell(self): - return self.raw.tell() - len(self._read_buf) + self._read_pos - - def seek(self, pos, whence=0): - with self._read_lock: - if whence == 1: - pos -= len(self._read_buf) - self._read_pos - pos = self.raw.seek(pos, whence) - self._reset_read_buf() - return pos - - -class BufferedWriter(_BufferedIOMixin): - - """A buffer for a writeable sequential RawIO object. - - The constructor creates a BufferedWriter for the given writeable raw - stream. If the buffer_size is not given, it defaults to - DEAFULT_BUFFER_SIZE. If max_buffer_size is omitted, it defaults to - twice the buffer size. - """ - - def __init__(self, raw, - buffer_size=DEFAULT_BUFFER_SIZE, max_buffer_size=None): - raw._checkWritable() - _BufferedIOMixin.__init__(self, raw) - self.buffer_size = buffer_size - self.max_buffer_size = (2*buffer_size - if max_buffer_size is None - else max_buffer_size) - self._write_buf = bytearray() - self._write_lock = threading.Lock() - - def write(self, b): - if self.closed: - raise ValueError("write to closed file") - if isinstance(b, unicode): - raise TypeError("can't write unicode to binary stream") - with self._write_lock: - # XXX we can implement some more tricks to try and avoid - # partial writes - if len(self._write_buf) > self.buffer_size: - # We're full, so let's pre-flush the buffer - try: - self._flush_unlocked() - except BlockingIOError as e: - # We can't accept anything else. - # XXX Why not just let the exception pass through? - raise BlockingIOError(e.errno, e.strerror, 0) - before = len(self._write_buf) - self._write_buf.extend(b) - written = len(self._write_buf) - before - if len(self._write_buf) > self.buffer_size: - try: - self._flush_unlocked() - except BlockingIOError as e: - if len(self._write_buf) > self.max_buffer_size: - # We've hit max_buffer_size. We have to accept a - # partial write and cut back our buffer. - overage = len(self._write_buf) - self.max_buffer_size - self._write_buf = self._write_buf[:self.max_buffer_size] - raise BlockingIOError(e.errno, e.strerror, overage) - return written - - def truncate(self, pos=None): - with self._write_lock: - self._flush_unlocked() - if pos is None: - pos = self.raw.tell() - return self.raw.truncate(pos) - - def flush(self): - with self._write_lock: - self._flush_unlocked() - - def _flush_unlocked(self): - if self.closed: - raise ValueError("flush of closed file") - written = 0 - try: - while self._write_buf: - n = self.raw.write(self._write_buf) - del self._write_buf[:n] - written += n - except BlockingIOError as e: - n = e.characters_written - del self._write_buf[:n] - written += n - raise BlockingIOError(e.errno, e.strerror, written) - - def tell(self): - return self.raw.tell() + len(self._write_buf) - - def seek(self, pos, whence=0): - with self._write_lock: - self._flush_unlocked() - return self.raw.seek(pos, whence) - - -class BufferedRWPair(BufferedIOBase): - - """A buffered reader and writer object together. - - A buffered reader object and buffered writer object put together to - form a sequential IO object that can read and write. This is typically - used with a socket or two-way pipe. - - reader and writer are RawIOBase objects that are readable and - writeable respectively. If the buffer_size is omitted it defaults to - DEFAULT_BUFFER_SIZE. The max_buffer_size (for the buffered writer) - defaults to twice the buffer size. - """ - - # XXX The usefulness of this (compared to having two separate IO - # objects) is questionable. - - def __init__(self, reader, writer, - buffer_size=DEFAULT_BUFFER_SIZE, max_buffer_size=None): - """Constructor. - - The arguments are two RawIO instances. - """ - reader._checkReadable() - writer._checkWritable() - self.reader = BufferedReader(reader, buffer_size) - self.writer = BufferedWriter(writer, buffer_size, max_buffer_size) - - def read(self, n=None): - if n is None: - n = -1 - return self.reader.read(n) - - def readinto(self, b): - return self.reader.readinto(b) - - def write(self, b): - return self.writer.write(b) - - def peek(self, n=0): - return self.reader.peek(n) - - def read1(self, n): - return self.reader.read1(n) - - def readable(self): - return self.reader.readable() - - def writable(self): - return self.writer.writable() - - def flush(self): - return self.writer.flush() - - def close(self): - self.writer.close() - self.reader.close() - - def isatty(self): - return self.reader.isatty() or self.writer.isatty() - - @property - def closed(self): - return self.writer.closed - - -class BufferedRandom(BufferedWriter, BufferedReader): - - """A buffered interface to random access streams. - - The constructor creates a reader and writer for a seekable stream, - raw, given in the first argument. If the buffer_size is omitted it - defaults to DEFAULT_BUFFER_SIZE. The max_buffer_size (for the buffered - writer) defaults to twice the buffer size. - """ - - def __init__(self, raw, - buffer_size=DEFAULT_BUFFER_SIZE, max_buffer_size=None): - raw._checkSeekable() - BufferedReader.__init__(self, raw, buffer_size) - BufferedWriter.__init__(self, raw, buffer_size, max_buffer_size) - - def seek(self, pos, whence=0): - self.flush() - # First do the raw seek, then empty the read buffer, so that - # if the raw seek fails, we don't lose buffered data forever. - pos = self.raw.seek(pos, whence) - with self._read_lock: - self._reset_read_buf() - return pos - - def tell(self): - if self._write_buf: - return self.raw.tell() + len(self._write_buf) - else: - return BufferedReader.tell(self) - - def truncate(self, pos=None): - if pos is None: - pos = self.tell() - # Use seek to flush the read buffer. - self.seek(pos) - return BufferedWriter.truncate(self) - - def read(self, n=None): - if n is None: - n = -1 - self.flush() - return BufferedReader.read(self, n) - - def readinto(self, b): - self.flush() - return BufferedReader.readinto(self, b) - - def peek(self, n=0): - self.flush() - return BufferedReader.peek(self, n) - - def read1(self, n): - self.flush() - return BufferedReader.read1(self, n) - - def write(self, b): - if self._read_buf: - # Undo readahead - with self._read_lock: - self.raw.seek(self._read_pos - len(self._read_buf), 1) - self._reset_read_buf() - return BufferedWriter.write(self, b) - - -class TextIOBase(IOBase): - - """Base class for text I/O. - - This class provides a character and line based interface to stream - I/O. There is no readinto method because Python's character strings - are immutable. There is no public constructor. - """ - - def read(self, n = -1): - """Read at most n characters from stream. - - Read from underlying buffer until we have n characters or we hit EOF. - If n is negative or omitted, read until EOF. - """ - self._unsupported("read") - - def write(self, s): - """Write string s to stream.""" - self._unsupported("write") - - def truncate(self, pos = None): - """Truncate size to pos.""" - self._unsupported("truncate") - - def readline(self): - """Read until newline or EOF. - - Returns an empty string if EOF is hit immediately. - """ - self._unsupported("readline") - - @property - def encoding(self): - """Subclasses should override.""" - return None - - @property - def newlines(self): - """Line endings translated so far. - - Only line endings translated during reading are considered. - - Subclasses should override. - """ - return None - - -class IncrementalNewlineDecoder(codecs.IncrementalDecoder): - """Codec used when reading a file in universal newlines mode. - It wraps another incremental decoder, translating \\r\\n and \\r into \\n. - It also records the types of newlines encountered. - When used with translate=False, it ensures that the newline sequence is - returned in one piece. - """ - def __init__(self, decoder, translate, errors='strict'): - codecs.IncrementalDecoder.__init__(self, errors=errors) - self.translate = translate - self.decoder = decoder - self.seennl = 0 - self.pendingcr = False - - def decode(self, input, final=False): - # decode input (with the eventual \r from a previous pass) - output = self.decoder.decode(input, final=final) - if self.pendingcr and (output or final): - output = "\r" + output - self.pendingcr = False - - # retain last \r even when not translating data: - # then readline() is sure to get \r\n in one pass - if output.endswith("\r") and not final: - output = output[:-1] - self.pendingcr = True - - # Record which newlines are read - crlf = output.count('\r\n') - cr = output.count('\r') - crlf - lf = output.count('\n') - crlf - self.seennl |= (lf and self._LF) | (cr and self._CR) \ - | (crlf and self._CRLF) - - if self.translate: - if crlf: - output = output.replace("\r\n", "\n") - if cr: - output = output.replace("\r", "\n") - - return output - - def getstate(self): - buf, flag = self.decoder.getstate() - flag <<= 1 - if self.pendingcr: - flag |= 1 - return buf, flag - - def setstate(self, state): - buf, flag = state - self.pendingcr = bool(flag & 1) - self.decoder.setstate((buf, flag >> 1)) - - def reset(self): - self.seennl = 0 - self.pendingcr = False - self.decoder.reset() - - _LF = 1 - _CR = 2 - _CRLF = 4 - - @property - def newlines(self): - return (None, - "\n", - "\r", - ("\r", "\n"), - "\r\n", - ("\n", "\r\n"), - ("\r", "\r\n"), - ("\r", "\n", "\r\n") - )[self.seennl] - - -class TextIOWrapper(TextIOBase): - - r"""Character and line based layer over a BufferedIOBase object, buffer. - - encoding gives the name of the encoding that the stream will be - decoded or encoded with. It defaults to locale.getpreferredencoding. - - errors determines the strictness of encoding and decoding (see the - codecs.register) and defaults to "strict". - - newline can be None, '', '\n', '\r', or '\r\n'. It controls the - handling of line endings. If it is None, universal newlines is - enabled. With this enabled, on input, the lines endings '\n', '\r', - or '\r\n' are translated to '\n' before being returned to the - caller. Conversely, on output, '\n' is translated to the system - default line separator, os.linesep. If newline is any other of its - legal values, that newline becomes the newline when the file is read - and it is returned untranslated. On output, '\n' is converted to the - newline. - - If line_buffering is True, a call to flush is implied when a call to - write contains a newline character. - """ - - _CHUNK_SIZE = 128 - - def __init__(self, buffer, encoding=None, errors=None, newline=None, - line_buffering=False): - if newline not in (None, "", "\n", "\r", "\r\n"): - raise ValueError("illegal newline value: %r" % (newline,)) - if encoding is None: - try: - encoding = os.device_encoding(buffer.fileno()) - except (AttributeError, UnsupportedOperation): - pass - if encoding is None: - try: - import locale - except ImportError: - # Importing locale may fail if Python is being built - encoding = "ascii" - else: - encoding = locale.getpreferredencoding() - - if not isinstance(encoding, basestring): - raise ValueError("invalid encoding: %r" % encoding) - - if errors is None: - errors = "strict" - else: - if not isinstance(errors, basestring): - raise ValueError("invalid errors: %r" % errors) - - self.buffer = buffer - self._line_buffering = line_buffering - self._encoding = encoding - self._errors = errors - self._readuniversal = not newline - self._readtranslate = newline is None - self._readnl = newline - self._writetranslate = newline != '' - self._writenl = newline or os.linesep - self._encoder = None - self._decoder = None - self._decoded_chars = '' # buffer for text returned from decoder - self._decoded_chars_used = 0 # offset into _decoded_chars for read() - self._snapshot = None # info for reconstructing decoder state - self._seekable = self._telling = self.buffer.seekable() - - # self._snapshot is either None, or a tuple (dec_flags, next_input) - # where dec_flags is the second (integer) item of the decoder state - # and next_input is the chunk of input bytes that comes next after the - # snapshot point. We use this to reconstruct decoder states in tell(). - - # Naming convention: - # - "bytes_..." for integer variables that count input bytes - # - "chars_..." for integer variables that count decoded characters - - @property - def encoding(self): - return self._encoding - - @property - def errors(self): - return self._errors - - @property - def line_buffering(self): - return self._line_buffering - - def seekable(self): - return self._seekable - - def readable(self): - return self.buffer.readable() - - def writable(self): - return self.buffer.writable() - - def flush(self): - self.buffer.flush() - self._telling = self._seekable - - def close(self): - try: - self.flush() - except: - pass # If flush() fails, just give up - self.buffer.close() - - @property - def closed(self): - return self.buffer.closed - - @property - def name(self): - return self.buffer.name - - def fileno(self): - return self.buffer.fileno() - - def isatty(self): - return self.buffer.isatty() - - def write(self, s): - if self.closed: - raise ValueError("write to closed file") - if not isinstance(s, unicode): - raise TypeError("can't write %s to text stream" % - s.__class__.__name__) - length = len(s) - haslf = (self._writetranslate or self._line_buffering) and "\n" in s - if haslf and self._writetranslate and self._writenl != "\n": - s = s.replace("\n", self._writenl) - encoder = self._encoder or self._get_encoder() - # XXX What if we were just reading? - b = encoder.encode(s) - self.buffer.write(b) - if self._line_buffering and (haslf or "\r" in s): - self.flush() - self._snapshot = None - if self._decoder: - self._decoder.reset() - return length - - def _get_encoder(self): - make_encoder = codecs.getincrementalencoder(self._encoding) - self._encoder = make_encoder(self._errors) - return self._encoder - - def _get_decoder(self): - make_decoder = codecs.getincrementaldecoder(self._encoding) - decoder = make_decoder(self._errors) - if self._readuniversal: - decoder = IncrementalNewlineDecoder(decoder, self._readtranslate) - self._decoder = decoder - return decoder - - # The following three methods implement an ADT for _decoded_chars. - # Text returned from the decoder is buffered here until the client - # requests it by calling our read() or readline() method. - def _set_decoded_chars(self, chars): - """Set the _decoded_chars buffer.""" - self._decoded_chars = chars - self._decoded_chars_used = 0 - - def _get_decoded_chars(self, n=None): - """Advance into the _decoded_chars buffer.""" - offset = self._decoded_chars_used - if n is None: - chars = self._decoded_chars[offset:] - else: - chars = self._decoded_chars[offset:offset + n] - self._decoded_chars_used += len(chars) - return chars - - def _rewind_decoded_chars(self, n): - """Rewind the _decoded_chars buffer.""" - if self._decoded_chars_used < n: - raise AssertionError("rewind decoded_chars out of bounds") - self._decoded_chars_used -= n - - def _read_chunk(self): - """ - Read and decode the next chunk of data from the BufferedReader. - - The return value is True unless EOF was reached. The decoded string - is placed in self._decoded_chars (replacing its previous value). - The entire input chunk is sent to the decoder, though some of it - may remain buffered in the decoder, yet to be converted. - """ - - if self._decoder is None: - raise ValueError("no decoder") - - if self._telling: - # To prepare for tell(), we need to snapshot a point in the - # file where the decoder's input buffer is empty. - - dec_buffer, dec_flags = self._decoder.getstate() - # Given this, we know there was a valid snapshot point - # len(dec_buffer) bytes ago with decoder state (b'', dec_flags). - - # Read a chunk, decode it, and put the result in self._decoded_chars. - input_chunk = self.buffer.read1(self._CHUNK_SIZE) - eof = not input_chunk - self._set_decoded_chars(self._decoder.decode(input_chunk, eof)) - - if self._telling: - # At the snapshot point, len(dec_buffer) bytes before the read, - # the next input to be decoded is dec_buffer + input_chunk. - self._snapshot = (dec_flags, dec_buffer + input_chunk) - - return not eof - - def _pack_cookie(self, position, dec_flags=0, - bytes_to_feed=0, need_eof=0, chars_to_skip=0): - # The meaning of a tell() cookie is: seek to position, set the - # decoder flags to dec_flags, read bytes_to_feed bytes, feed them - # into the decoder with need_eof as the EOF flag, then skip - # chars_to_skip characters of the decoded result. For most simple - # decoders, tell() will often just give a byte offset in the file. - return (position | (dec_flags<<64) | (bytes_to_feed<<128) | - (chars_to_skip<<192) | bool(need_eof)<<256) - - def _unpack_cookie(self, bigint): - rest, position = divmod(bigint, 1<<64) - rest, dec_flags = divmod(rest, 1<<64) - rest, bytes_to_feed = divmod(rest, 1<<64) - need_eof, chars_to_skip = divmod(rest, 1<<64) - return position, dec_flags, bytes_to_feed, need_eof, chars_to_skip - - def tell(self): - if not self._seekable: - raise IOError("underlying stream is not seekable") - if not self._telling: - raise IOError("telling position disabled by next() call") - self.flush() - position = self.buffer.tell() - decoder = self._decoder - if decoder is None or self._snapshot is None: - if self._decoded_chars: - # This should never happen. - raise AssertionError("pending decoded text") - return position - - # Skip backward to the snapshot point (see _read_chunk). - dec_flags, next_input = self._snapshot - position -= len(next_input) - - # How many decoded characters have been used up since the snapshot? - chars_to_skip = self._decoded_chars_used - if chars_to_skip == 0: - # We haven't moved from the snapshot point. - return self._pack_cookie(position, dec_flags) - - # Starting from the snapshot position, we will walk the decoder - # forward until it gives us enough decoded characters. - saved_state = decoder.getstate() - try: - # Note our initial start point. - decoder.setstate((b'', dec_flags)) - start_pos = position - start_flags, bytes_fed, chars_decoded = dec_flags, 0, 0 - need_eof = 0 - - # Feed the decoder one byte at a time. As we go, note the - # nearest "safe start point" before the current location - # (a point where the decoder has nothing buffered, so seek() - # can safely start from there and advance to this location). - for next_byte in next_input: - bytes_fed += 1 - chars_decoded += len(decoder.decode(next_byte)) - dec_buffer, dec_flags = decoder.getstate() - if not dec_buffer and chars_decoded <= chars_to_skip: - # Decoder buffer is empty, so this is a safe start point. - start_pos += bytes_fed - chars_to_skip -= chars_decoded - start_flags, bytes_fed, chars_decoded = dec_flags, 0, 0 - if chars_decoded >= chars_to_skip: - break - else: - # We didn't get enough decoded data; signal EOF to get more. - chars_decoded += len(decoder.decode(b'', final=True)) - need_eof = 1 - if chars_decoded < chars_to_skip: - raise IOError("can't reconstruct logical file position") - - # The returned cookie corresponds to the last safe start point. - return self._pack_cookie( - start_pos, start_flags, bytes_fed, need_eof, chars_to_skip) - finally: - decoder.setstate(saved_state) - - def truncate(self, pos=None): - self.flush() - if pos is None: - pos = self.tell() - self.seek(pos) - return self.buffer.truncate() - - def seek(self, cookie, whence=0): - if self.closed: - raise ValueError("tell on closed file") - if not self._seekable: - raise IOError("underlying stream is not seekable") - if whence == 1: # seek relative to current position - if cookie != 0: - raise IOError("can't do nonzero cur-relative seeks") - # Seeking to the current position should attempt to - # sync the underlying buffer with the current position. - whence = 0 - cookie = self.tell() - if whence == 2: # seek relative to end of file - if cookie != 0: - raise IOError("can't do nonzero end-relative seeks") - self.flush() - position = self.buffer.seek(0, 2) - self._set_decoded_chars('') - self._snapshot = None - if self._decoder: - self._decoder.reset() - return position - if whence != 0: - raise ValueError("invalid whence (%r, should be 0, 1 or 2)" % - (whence,)) - if cookie < 0: - raise ValueError("negative seek position %r" % (cookie,)) - self.flush() - - # The strategy of seek() is to go back to the safe start point - # and replay the effect of read(chars_to_skip) from there. - start_pos, dec_flags, bytes_to_feed, need_eof, chars_to_skip = \ - self._unpack_cookie(cookie) - - # Seek back to the safe start point. - self.buffer.seek(start_pos) - self._set_decoded_chars('') - self._snapshot = None - - # Restore the decoder to its state from the safe start point. - if self._decoder or dec_flags or chars_to_skip: - self._decoder = self._decoder or self._get_decoder() - self._decoder.setstate((b'', dec_flags)) - self._snapshot = (dec_flags, b'') - - if chars_to_skip: - # Just like _read_chunk, feed the decoder and save a snapshot. - input_chunk = self.buffer.read(bytes_to_feed) - self._set_decoded_chars( - self._decoder.decode(input_chunk, need_eof)) - self._snapshot = (dec_flags, input_chunk) - - # Skip chars_to_skip of the decoded characters. - if len(self._decoded_chars) < chars_to_skip: - raise IOError("can't restore logical file position") - self._decoded_chars_used = chars_to_skip - - return cookie - - def read(self, n=None): - if n is None: - n = -1 - decoder = self._decoder or self._get_decoder() - if n < 0: - # Read everything. - result = (self._get_decoded_chars() + - decoder.decode(self.buffer.read(), final=True)) - self._set_decoded_chars('') - self._snapshot = None - return result - else: - # Keep reading chunks until we have n characters to return. - eof = False - result = self._get_decoded_chars(n) - while len(result) < n and not eof: - eof = not self._read_chunk() - result += self._get_decoded_chars(n - len(result)) - return result - - def next(self): - self._telling = False - line = self.readline() - if not line: - self._snapshot = None - self._telling = self._seekable - raise StopIteration - return line - - def readline(self, limit=None): - if self.closed: - raise ValueError("read from closed file") - if limit is None: - limit = -1 - if not isinstance(limit, (int, long)): - raise TypeError("limit must be an integer") - - # Grab all the decoded text (we will rewind any extra bits later). - line = self._get_decoded_chars() - - start = 0 - decoder = self._decoder or self._get_decoder() - - pos = endpos = None - while True: - if self._readtranslate: - # Newlines are already translated, only search for \n - pos = line.find('\n', start) - if pos >= 0: - endpos = pos + 1 - break - else: - start = len(line) - - elif self._readuniversal: - # Universal newline search. Find any of \r, \r\n, \n - # The decoder ensures that \r\n are not split in two pieces - - # In C we'd look for these in parallel of course. - nlpos = line.find("\n", start) - crpos = line.find("\r", start) - if crpos == -1: - if nlpos == -1: - # Nothing found - start = len(line) - else: - # Found \n - endpos = nlpos + 1 - break - elif nlpos == -1: - # Found lone \r - endpos = crpos + 1 - break - elif nlpos < crpos: - # Found \n - endpos = nlpos + 1 - break - elif nlpos == crpos + 1: - # Found \r\n - endpos = crpos + 2 - break - else: - # Found \r - endpos = crpos + 1 - break - else: - # non-universal - pos = line.find(self._readnl) - if pos >= 0: - endpos = pos + len(self._readnl) - break - - if limit >= 0 and len(line) >= limit: - endpos = limit # reached length limit - break - - # No line ending seen yet - get more data - more_line = '' - while self._read_chunk(): - if self._decoded_chars: - break - if self._decoded_chars: - line += self._get_decoded_chars() - else: - # end of file - self._set_decoded_chars('') - self._snapshot = None - return line - - if limit >= 0 and endpos > limit: - endpos = limit # don't exceed limit - - # Rewind _decoded_chars to just after the line ending we found. - self._rewind_decoded_chars(len(line) - endpos) - return line[:endpos] - - @property - def newlines(self): - return self._decoder.newlines if self._decoder else None - -class StringIO(TextIOWrapper): - - """An in-memory stream for text. The initial_value argument sets the - value of object. The other arguments are like those of TextIOWrapper's - constructor. - """ - - def __init__(self, initial_value="", encoding="utf-8", - errors="strict", newline="\n"): - super(StringIO, self).__init__(BytesIO(), - encoding=encoding, - errors=errors, - newline=newline) - if initial_value: - if not isinstance(initial_value, unicode): - initial_value = unicode(initial_value) - self.write(initial_value) - self.seek(0) - - def getvalue(self): - self.flush() - return self.buffer.getvalue().decode(self._encoding, self._errors) +for klass in (BytesIO, BufferedReader, BufferedWriter, BufferedRandom, + BufferedRWPair): + BufferedIOBase.register(klass) + +for klass in (StringIO, TextIOWrapper): + TextIOBase.register(klass) +del klass Modified: python/trunk/Lib/test/test_bufio.py ============================================================================== --- python/trunk/Lib/test/test_bufio.py (original) +++ python/trunk/Lib/test/test_bufio.py Fri Jun 12 22:14:08 2009 @@ -1,12 +1,15 @@ import unittest -from test import test_support +from test import test_support as support -# Simple test to ensure that optimizations in fileobject.c deliver -# the expected results. For best testing, run this under a debug-build -# Python too (to exercise asserts in the C code). +import io # C implementation. +import _pyio as pyio # Python implementation. -lengths = range(1, 257) + [512, 1000, 1024, 2048, 4096, 8192, 10000, - 16384, 32768, 65536, 1000000] +# Simple test to ensure that optimizations in the IO library deliver the +# expected results. For best testing, run this under a debug-build Python too +# (to exercise asserts in the C code). + +lengths = list(range(1, 257)) + [512, 1000, 1024, 2048, 4096, 8192, 10000, + 16384, 32768, 65536, 1000000] class BufferSizeTest(unittest.TestCase): def try_one(self, s): @@ -14,27 +17,27 @@ # .readline()s deliver what we wrote. # Ensure we can open TESTFN for writing. - test_support.unlink(test_support.TESTFN) + support.unlink(support.TESTFN) # Since C doesn't guarantee we can write/read arbitrary bytes in text # files, use binary mode. - f = open(test_support.TESTFN, "wb") + f = self.open(support.TESTFN, "wb") try: # write once with \n and once without f.write(s) - f.write("\n") + f.write(b"\n") f.write(s) f.close() - f = open(test_support.TESTFN, "rb") + f = open(support.TESTFN, "rb") line = f.readline() - self.assertEqual(line, s + "\n") + self.assertEqual(line, s + b"\n") line = f.readline() self.assertEqual(line, s) line = f.readline() self.assert_(not line) # Must be at EOF f.close() finally: - test_support.unlink(test_support.TESTFN) + support.unlink(support.TESTFN) def drive_one(self, pattern): for length in lengths: @@ -47,19 +50,27 @@ teststring = pattern * q + pattern[:r] self.assertEqual(len(teststring), length) self.try_one(teststring) - self.try_one(teststring + "x") + self.try_one(teststring + b"x") self.try_one(teststring[:-1]) def test_primepat(self): # A pattern with prime length, to avoid simple relationships with # stdio buffer sizes. - self.drive_one("1234567890\00\01\02\03\04\05\06") + self.drive_one(b"1234567890\00\01\02\03\04\05\06") def test_nullpat(self): - self.drive_one("\0" * 1000) + self.drive_one(bytes(1000)) + + +class CBufferSizeTest(BufferSizeTest): + open = io.open + +class PyBufferSizeTest(BufferSizeTest): + open = staticmethod(pyio.open) + def test_main(): - test_support.run_unittest(BufferSizeTest) + support.run_unittest(CBufferSizeTest, PyBufferSizeTest) if __name__ == "__main__": test_main() Modified: python/trunk/Lib/test/test_file.py ============================================================================== --- python/trunk/Lib/test/test_file.py (original) +++ python/trunk/Lib/test/test_file.py Fri Jun 12 22:14:08 2009 @@ -1,13 +1,14 @@ +from __future__ import print_function + import sys import os import unittest -import itertools -import time -import threading from array import array from weakref import proxy -from test import test_support +import io +import _pyio as pyio + from test.test_support import TESTFN, findfile, run_unittest from UserList import UserList @@ -15,7 +16,7 @@ # file tests for which a test file is automatically set up def setUp(self): - self.f = open(TESTFN, 'wb') + self.f = self.open(TESTFN, 'wb') def tearDown(self): if self.f: @@ -25,7 +26,7 @@ def testWeakRefs(self): # verify weak references p = proxy(self.f) - p.write('teststring') + p.write(b'teststring') self.assertEquals(self.f.tell(), p.tell()) self.f.close() self.f = None @@ -34,35 +35,35 @@ def testAttributes(self): # verify expected attributes exist f = self.f - softspace = f.softspace f.name # merely shouldn't blow up f.mode # ditto f.closed # ditto - # verify softspace is writable - f.softspace = softspace # merely shouldn't blow up - - # verify the others aren't - for attr in 'name', 'mode', 'closed': - self.assertRaises((AttributeError, TypeError), setattr, f, attr, 'oops') - def testReadinto(self): # verify readinto - self.f.write('12') + self.f.write(b'12') self.f.close() - a = array('c', 'x'*10) - self.f = open(TESTFN, 'rb') + a = array('b', b'x'*10) + self.f = self.open(TESTFN, 'rb') n = self.f.readinto(a) - self.assertEquals('12', a.tostring()[:n]) + self.assertEquals(b'12', a.tostring()[:n]) + + def testReadinto_text(self): + # verify readinto refuses text files + a = array('b', b'x'*10) + self.f.close() + self.f = self.open(TESTFN, 'r') + if hasattr(self.f, "readinto"): + self.assertRaises(TypeError, self.f.readinto, a) def testWritelinesUserList(self): # verify writelines with instance sequence - l = UserList(['1', '2']) + l = UserList([b'1', b'2']) self.f.writelines(l) self.f.close() - self.f = open(TESTFN, 'rb') + self.f = self.open(TESTFN, 'rb') buf = self.f.read() - self.assertEquals(buf, '12') + self.assertEquals(buf, b'12') def testWritelinesIntegers(self): # verify writelines with integers @@ -81,36 +82,43 @@ self.assertRaises(TypeError, self.f.writelines, [NonString(), NonString()]) - def testRepr(self): - # verify repr works - self.assert_(repr(self.f).startswith(">sys.__stdout__, ( + print(( ' Skipping sys.stdin.seek(-1), it may crash the interpreter.' - ' Test manually.') - self.assertRaises(IOError, sys.stdin.truncate) - - def testUnicodeOpen(self): - # verify repr works for unicode too - f = open(unicode(TESTFN), "w") - self.assert_(repr(f).startswith(" + # "file.truncate fault on windows" + os.unlink(TESTFN) + f = self.open(TESTFN, 'wb') - def bug801631(): - # SF bug - # "file.truncate fault on windows" - f = open(TESTFN, 'wb') - f.write('12345678901') # 11 bytes + try: + f.write(b'12345678901') # 11 bytes f.close() - f = open(TESTFN,'rb+') + f = self.open(TESTFN,'rb+') data = f.read(5) - if data != '12345': + if data != b'12345': self.fail("Read on file opened for update failed %r" % data) if f.tell() != 5: self.fail("File pos after read wrong %d" % f.tell()) @@ -234,56 +220,42 @@ size = os.path.getsize(TESTFN) if size != 5: self.fail("File size after ftruncate wrong %d" % size) - - try: - bug801631() finally: + f.close() os.unlink(TESTFN) def testIteration(self): # Test the complex interaction when mixing file-iteration and the - # various read* methods. Ostensibly, the mixture could just be tested - # to work when it should work according to the Python language, - # instead of fail when it should fail according to the current CPython - # implementation. People don't always program Python the way they - # should, though, and the implemenation might change in subtle ways, - # so we explicitly test for errors, too; the test will just have to - # be updated when the implementation changes. + # various read* methods. dataoffset = 16384 - filler = "ham\n" + filler = b"ham\n" assert not dataoffset % len(filler), \ "dataoffset must be multiple of len(filler)" nchunks = dataoffset // len(filler) testlines = [ - "spam, spam and eggs\n", - "eggs, spam, ham and spam\n", - "saussages, spam, spam and eggs\n", - "spam, ham, spam and eggs\n", - "spam, spam, spam, spam, spam, ham, spam\n", - "wonderful spaaaaaam.\n" + b"spam, spam and eggs\n", + b"eggs, spam, ham and spam\n", + b"saussages, spam, spam and eggs\n", + b"spam, ham, spam and eggs\n", + b"spam, spam, spam, spam, spam, ham, spam\n", + b"wonderful spaaaaaam.\n" ] methods = [("readline", ()), ("read", ()), ("readlines", ()), - ("readinto", (array("c", " "*100),))] + ("readinto", (array("b", b" "*100),))] try: # Prepare the testfile - bag = open(TESTFN, "w") + bag = self.open(TESTFN, "wb") bag.write(filler * nchunks) bag.writelines(testlines) bag.close() # Test for appropriate errors mixing read* and iteration for methodname, args in methods: - f = open(TESTFN) - if f.next() != filler: + f = self.open(TESTFN, 'rb') + if next(f) != filler: self.fail, "Broken testfile" meth = getattr(f, methodname) - try: - meth(*args) - except ValueError: - pass - else: - self.fail("%s%r after next() didn't raise ValueError" % - (methodname, args)) + meth(*args) # This simply shouldn't fail f.close() # Test to see if harmless (by accident) mixing of read* and @@ -293,9 +265,9 @@ # ("h", "a", "m", "\n"), so 4096 lines of that should get us # exactly on the buffer boundary for any power-of-2 buffersize # between 4 and 16384 (inclusive). - f = open(TESTFN) + f = self.open(TESTFN, 'rb') for i in range(nchunks): - f.next() + next(f) testline = testlines.pop(0) try: line = f.readline() @@ -306,7 +278,7 @@ self.fail("readline() after next() with empty buffer " "failed. Got %r, expected %r" % (line, testline)) testline = testlines.pop(0) - buf = array("c", "\x00" * len(testline)) + buf = array("b", b"\x00" * len(testline)) try: f.readinto(buf) except ValueError: @@ -335,7 +307,7 @@ self.fail("readlines() after next() with empty buffer " "failed. Got %r, expected %r" % (line, testline)) # Reading after iteration hit EOF shouldn't hurt either - f = open(TESTFN) + f = self.open(TESTFN, 'rb') try: for line in f: pass @@ -351,222 +323,19 @@ finally: os.unlink(TESTFN) -class FileSubclassTests(unittest.TestCase): - - def testExit(self): - # test that exiting with context calls subclass' close - class C(file): - def __init__(self, *args): - self.subclass_closed = False - file.__init__(self, *args) - def close(self): - self.subclass_closed = True - file.close(self) +class COtherFileTests(OtherFileTests): + open = io.open - with C(TESTFN, 'w') as f: - pass - self.failUnless(f.subclass_closed) - - -class FileThreadingTests(unittest.TestCase): - # These tests check the ability to call various methods of file objects - # (including close()) concurrently without crashing the Python interpreter. - # See #815646, #595601 - - def setUp(self): - self.f = None - self.filename = TESTFN - with open(self.filename, "w") as f: - f.write("\n".join("0123456789")) - self._count_lock = threading.Lock() - self.close_count = 0 - self.close_success_count = 0 - - def tearDown(self): - if self.f: - try: - self.f.close() - except (EnvironmentError, ValueError): - pass - try: - os.remove(self.filename) - except EnvironmentError: - pass - - def _create_file(self): - self.f = open(self.filename, "w+") - - def _close_file(self): - with self._count_lock: - self.close_count += 1 - self.f.close() - with self._count_lock: - self.close_success_count += 1 - - def _close_and_reopen_file(self): - self._close_file() - # if close raises an exception thats fine, self.f remains valid so - # we don't need to reopen. - self._create_file() - - def _run_workers(self, func, nb_workers, duration=0.2): - with self._count_lock: - self.close_count = 0 - self.close_success_count = 0 - self.do_continue = True - threads = [] - try: - for i in range(nb_workers): - t = threading.Thread(target=func) - t.start() - threads.append(t) - for _ in xrange(100): - time.sleep(duration/100) - with self._count_lock: - if self.close_count-self.close_success_count > nb_workers+1: - if test_support.verbose: - print 'Q', - break - time.sleep(duration) - finally: - self.do_continue = False - for t in threads: - t.join() - - def _test_close_open_io(self, io_func, nb_workers=5): - def worker(): - self._create_file() - funcs = itertools.cycle(( - lambda: io_func(), - lambda: self._close_and_reopen_file(), - )) - for f in funcs: - if not self.do_continue: - break - try: - f() - except (IOError, ValueError): - pass - self._run_workers(worker, nb_workers) - if test_support.verbose: - # Useful verbose statistics when tuning this test to take - # less time to run but still ensuring that its still useful. - # - # the percent of close calls that raised an error - percent = 100. - 100.*self.close_success_count/self.close_count - print self.close_count, ('%.4f ' % percent), - - def test_close_open(self): - def io_func(): - pass - self._test_close_open_io(io_func) - - def test_close_open_flush(self): - def io_func(): - self.f.flush() - self._test_close_open_io(io_func) - - def test_close_open_iter(self): - def io_func(): - list(iter(self.f)) - self._test_close_open_io(io_func) - - def test_close_open_isatty(self): - def io_func(): - self.f.isatty() - self._test_close_open_io(io_func) - - def test_close_open_print(self): - def io_func(): - print >> self.f, '' - self._test_close_open_io(io_func) - - def test_close_open_read(self): - def io_func(): - self.f.read(0) - self._test_close_open_io(io_func) - - def test_close_open_readinto(self): - def io_func(): - a = array('c', 'xxxxx') - self.f.readinto(a) - self._test_close_open_io(io_func) - - def test_close_open_readline(self): - def io_func(): - self.f.readline() - self._test_close_open_io(io_func) - - def test_close_open_readlines(self): - def io_func(): - self.f.readlines() - self._test_close_open_io(io_func) - - def test_close_open_seek(self): - def io_func(): - self.f.seek(0, 0) - self._test_close_open_io(io_func) - - def test_close_open_tell(self): - def io_func(): - self.f.tell() - self._test_close_open_io(io_func) - - def test_close_open_truncate(self): - def io_func(): - self.f.truncate() - self._test_close_open_io(io_func) - - def test_close_open_write(self): - def io_func(): - self.f.write('') - self._test_close_open_io(io_func) - - def test_close_open_writelines(self): - def io_func(): - self.f.writelines('') - self._test_close_open_io(io_func) - - -class StdoutTests(unittest.TestCase): - - def test_move_stdout_on_write(self): - # Issue 3242: sys.stdout can be replaced (and freed) during a - # print statement; prevent a segfault in this case - save_stdout = sys.stdout - - class File: - def write(self, data): - if '\n' in data: - sys.stdout = save_stdout - - try: - sys.stdout = File() - print "some text" - finally: - sys.stdout = save_stdout - - def test_del_stdout_before_print(self): - # Issue 4597: 'print' with no argument wasn't reporting when - # sys.stdout was deleted. - save_stdout = sys.stdout - del sys.stdout - try: - print - except RuntimeError as e: - self.assertEquals(str(e), "lost sys.stdout") - else: - self.fail("Expected RuntimeError") - finally: - sys.stdout = save_stdout +class PyOtherFileTests(OtherFileTests): + open = staticmethod(pyio.open) def test_main(): # Historically, these tests have been sloppy about removing TESTFN. # So get rid of it no matter what. try: - run_unittest(AutoFileTests, OtherFileTests, FileSubclassTests, - FileThreadingTests, StdoutTests) + run_unittest(CAutoFileTests, PyAutoFileTests, + COtherFileTests, PyOtherFileTests) finally: if os.path.exists(TESTFN): os.unlink(TESTFN) Modified: python/trunk/Lib/test/test_fileio.py ============================================================================== --- python/trunk/Lib/test/test_fileio.py (original) +++ python/trunk/Lib/test/test_fileio.py Fri Jun 12 22:14:08 2009 @@ -1,23 +1,26 @@ # Adapted from test_file.py by Daniel Stutzbach -#from __future__ import unicode_literals + +from __future__ import unicode_literals import sys import os +import errno import unittest from array import array from weakref import proxy +from functools import wraps from test.test_support import (TESTFN, findfile, check_warnings, run_unittest, make_bad_fd) -from UserList import UserList +from test.test_support import py3k_bytes as bytes -import _fileio +from _io import FileIO as _FileIO class AutoFileTests(unittest.TestCase): # file tests for which a test file is automatically set up def setUp(self): - self.f = _fileio._FileIO(TESTFN, 'w') + self.f = _FileIO(TESTFN, 'w') def tearDown(self): if self.f: @@ -34,7 +37,7 @@ self.assertRaises(ReferenceError, getattr, p, 'tell') def testSeekTell(self): - self.f.write(bytes(bytearray(range(20)))) + self.f.write(bytes(range(20))) self.assertEquals(self.f.tell(), 20) self.f.seek(0) self.assertEquals(self.f.tell(), 0) @@ -61,17 +64,21 @@ def testReadinto(self): # verify readinto - self.f.write(bytes(bytearray([1, 2]))) + self.f.write(b"\x01\x02") self.f.close() - a = array('b', b'x'*10) - self.f = _fileio._FileIO(TESTFN, 'r') + a = array(b'b', b'x'*10) + self.f = _FileIO(TESTFN, 'r') n = self.f.readinto(a) - self.assertEquals(array('b', [1, 2]), a[:n]) + self.assertEquals(array(b'b', [1, 2]), a[:n]) def testRepr(self): - self.assertEquals(repr(self.f), - "_fileio._FileIO(%d, %s)" % (self.f.fileno(), - repr(self.f.mode))) + self.assertEquals(repr(self.f), "<_io.FileIO name=%r mode='%s'>" + % (self.f.name, self.f.mode)) + del self.f.name + self.assertEquals(repr(self.f), "<_io.FileIO fd=%r mode='%s'>" + % (self.f.fileno(), self.f.mode)) + self.f.close() + self.assertEquals(repr(self.f), "<_io.FileIO [closed]>") def testErrors(self): f = self.f @@ -81,7 +88,7 @@ self.assertRaises(ValueError, f.read, 10) # Open for reading f.close() self.assert_(f.closed) - f = _fileio._FileIO(TESTFN, 'r') + f = _FileIO(TESTFN, 'r') self.assertRaises(TypeError, f.readinto, "") self.assert_(not f.closed) f.close() @@ -107,31 +114,131 @@ # Windows always returns "[Errno 13]: Permission denied # Unix calls dircheck() and returns "[Errno 21]: Is a directory" try: - _fileio._FileIO('.', 'r') + _FileIO('.', 'r') except IOError as e: self.assertNotEqual(e.errno, 0) self.assertEqual(e.filename, ".") else: self.fail("Should have raised IOError") + #A set of functions testing that we get expected behaviour if someone has + #manually closed the internal file descriptor. First, a decorator: + def ClosedFD(func): + @wraps(func) + def wrapper(self): + #forcibly close the fd before invoking the problem function + f = self.f + os.close(f.fileno()) + try: + func(self, f) + finally: + try: + self.f.close() + except IOError: + pass + return wrapper + + def ClosedFDRaises(func): + @wraps(func) + def wrapper(self): + #forcibly close the fd before invoking the problem function + f = self.f + os.close(f.fileno()) + try: + func(self, f) + except IOError as e: + self.assertEqual(e.errno, errno.EBADF) + else: + self.fail("Should have raised IOError") + finally: + try: + self.f.close() + except IOError: + pass + return wrapper + + @ClosedFDRaises + def testErrnoOnClose(self, f): + f.close() + + @ClosedFDRaises + def testErrnoOnClosedWrite(self, f): + f.write('a') + + @ClosedFDRaises + def testErrnoOnClosedSeek(self, f): + f.seek(0) + + @ClosedFDRaises + def testErrnoOnClosedTell(self, f): + f.tell() + + @ClosedFDRaises + def testErrnoOnClosedTruncate(self, f): + f.truncate(0) + + @ClosedFD + def testErrnoOnClosedSeekable(self, f): + f.seekable() + + @ClosedFD + def testErrnoOnClosedReadable(self, f): + f.readable() + + @ClosedFD + def testErrnoOnClosedWritable(self, f): + f.writable() + + @ClosedFD + def testErrnoOnClosedFileno(self, f): + f.fileno() + + @ClosedFD + def testErrnoOnClosedIsatty(self, f): + self.assertEqual(f.isatty(), False) + + def ReopenForRead(self): + try: + self.f.close() + except IOError: + pass + self.f = _FileIO(TESTFN, 'r') + os.close(self.f.fileno()) + return self.f + + @ClosedFDRaises + def testErrnoOnClosedRead(self, f): + f = self.ReopenForRead() + f.read(1) + + @ClosedFDRaises + def testErrnoOnClosedReadall(self, f): + f = self.ReopenForRead() + f.readall() + + @ClosedFDRaises + def testErrnoOnClosedReadinto(self, f): + f = self.ReopenForRead() + a = array(b'b', b'x'*10) + f.readinto(a) class OtherFileTests(unittest.TestCase): def testAbles(self): try: - f = _fileio._FileIO(TESTFN, "w") + f = _FileIO(TESTFN, "w") self.assertEquals(f.readable(), False) self.assertEquals(f.writable(), True) self.assertEquals(f.seekable(), True) f.close() - f = _fileio._FileIO(TESTFN, "r") + f = _FileIO(TESTFN, "r") self.assertEquals(f.readable(), True) self.assertEquals(f.writable(), False) self.assertEquals(f.seekable(), True) f.close() - f = _fileio._FileIO(TESTFN, "a+") + f = _FileIO(TESTFN, "a+") self.assertEquals(f.readable(), True) self.assertEquals(f.writable(), True) self.assertEquals(f.seekable(), True) @@ -140,14 +247,14 @@ if sys.platform != "win32": try: - f = _fileio._FileIO("/dev/tty", "a") + f = _FileIO("/dev/tty", "a") except EnvironmentError: # When run in a cron job there just aren't any # ttys, so skip the test. This also handles other # OS'es that don't support /dev/tty. pass else: - f = _fileio._FileIO("/dev/tty", "a") + f = _FileIO("/dev/tty", "a") self.assertEquals(f.readable(), False) self.assertEquals(f.writable(), True) if sys.platform != "darwin" and \ @@ -164,7 +271,7 @@ # check invalid mode strings for mode in ("", "aU", "wU+", "rw", "rt"): try: - f = _fileio._FileIO(TESTFN, mode) + f = _FileIO(TESTFN, mode) except ValueError: pass else: @@ -173,19 +280,35 @@ def testUnicodeOpen(self): # verify repr works for unicode too - f = _fileio._FileIO(str(TESTFN), "w") + f = _FileIO(str(TESTFN), "w") f.close() os.unlink(TESTFN) + def testBytesOpen(self): + # Opening a bytes filename + try: + fn = TESTFN.encode("ascii") + except UnicodeEncodeError: + # Skip test + return + f = _FileIO(fn, "w") + try: + f.write(b"abc") + f.close() + with open(TESTFN, "rb") as f: + self.assertEquals(f.read(), b"abc") + finally: + os.unlink(TESTFN) + def testInvalidFd(self): - self.assertRaises(ValueError, _fileio._FileIO, -10) - self.assertRaises(OSError, _fileio._FileIO, make_bad_fd()) + self.assertRaises(ValueError, _FileIO, -10) + self.assertRaises(OSError, _FileIO, make_bad_fd()) def testBadModeArgument(self): # verify that we get a sensible error message for bad mode argument bad_mode = "qwerty" try: - f = _fileio._FileIO(TESTFN, bad_mode) + f = _FileIO(TESTFN, bad_mode) except ValueError as msg: if msg.args[0] != 0: s = str(msg) @@ -201,13 +324,13 @@ def bug801631(): # SF bug # "file.truncate fault on windows" - f = _fileio._FileIO(TESTFN, 'w') - f.write(bytes(bytearray(range(11)))) + f = _FileIO(TESTFN, 'w') + f.write(bytes(range(11))) f.close() - f = _fileio._FileIO(TESTFN,'r+') + f = _FileIO(TESTFN,'r+') data = f.read(5) - if data != bytes(bytearray(range(5))): + if data != bytes(range(5)): self.fail("Read on file opened for update failed %r" % data) if f.tell() != 5: self.fail("File pos after read wrong %d" % f.tell()) @@ -245,14 +368,14 @@ pass def testInvalidInit(self): - self.assertRaises(TypeError, _fileio._FileIO, "1", 0, 0) + self.assertRaises(TypeError, _FileIO, "1", 0, 0) def testWarnings(self): with check_warnings() as w: self.assertEqual(w.warnings, []) - self.assertRaises(TypeError, _fileio._FileIO, []) + self.assertRaises(TypeError, _FileIO, []) self.assertEqual(w.warnings, []) - self.assertRaises(ValueError, _fileio._FileIO, "/some/invalid/name", "rt") + self.assertRaises(ValueError, _FileIO, "/some/invalid/name", "rt") self.assertEqual(w.warnings, []) Modified: python/trunk/Lib/test/test_io.py ============================================================================== --- python/trunk/Lib/test/test_io.py (original) +++ python/trunk/Lib/test/test_io.py Fri Jun 12 22:14:08 2009 @@ -1,4 +1,24 @@ -"""Unit tests for io.py.""" +"""Unit tests for the io module.""" + +# Tests of io are scattered over the test suite: +# * test_bufio - tests file buffering +# * test_memoryio - tests BytesIO and StringIO +# * test_fileio - tests FileIO +# * test_file - tests the file interface +# * test_io - tests everything else in the io module +# * test_univnewlines - tests universal newline support +# * test_largefile - tests operations on a file greater than 2**32 bytes +# (only enabled with -ulargefile) + +################################################################################ +# ATTENTION TEST WRITERS!!! +################################################################################ +# When writing tests for io, it's important to test both the C and Python +# implementations. This is usually done by writing a base test that refers to +# the type it is testing as a attribute. Then it provides custom subclasses to +# test both implementations. This file has lots of examples. +################################################################################ + from __future__ import print_function from __future__ import unicode_literals @@ -9,27 +29,43 @@ import threading import random import unittest -from itertools import chain, cycle -from test import test_support +import warnings +import weakref +import gc +import abc +from itertools import chain, cycle, count +from collections import deque +from test import test_support as support import codecs -import io # The module under test +import io # C implementation of io +import _pyio as pyio # Python implementation of io + +__metaclass__ = type +bytes = support.py3k_bytes + +def _default_chunk_size(): + """Get the default TextIOWrapper chunk size""" + with io.open(__file__, "r", encoding="latin1") as f: + return f._CHUNK_SIZE -class MockRawIO(io.RawIOBase): +class MockRawIO: def __init__(self, read_stack=()): self._read_stack = list(read_stack) self._write_stack = [] + self._reads = 0 def read(self, n=None): + self._reads += 1 try: return self._read_stack.pop(0) except: return b"" def write(self, b): - self._write_stack.append(b[:]) + self._write_stack.append(bytes(b)) return len(b) def writable(self): @@ -45,46 +81,156 @@ return True def seek(self, pos, whence): - pass + return 0 # wrong but we gotta return something def tell(self): - return 42 + return 0 # same comment as above + + def readinto(self, buf): + self._reads += 1 + max_len = len(buf) + try: + data = self._read_stack[0] + except IndexError: + return 0 + if data is None: + del self._read_stack[0] + return None + n = len(data) + if len(data) <= max_len: + del self._read_stack[0] + buf[:n] = data + return n + else: + buf[:] = data[:max_len] + self._read_stack[0] = data[max_len:] + return max_len + + def truncate(self, pos=None): + return pos + +class CMockRawIO(MockRawIO, io.RawIOBase): + pass + +class PyMockRawIO(MockRawIO, pyio.RawIOBase): + pass + + +class MisbehavedRawIO(MockRawIO): + def write(self, b): + return MockRawIO.write(self, b) * 2 + def read(self, n=None): + return MockRawIO.read(self, n) * 2 + + def seek(self, pos, whence): + return -123 + + def tell(self): + return -456 + + def readinto(self, buf): + MockRawIO.readinto(self, buf) + return len(buf) * 5 + +class CMisbehavedRawIO(MisbehavedRawIO, io.RawIOBase): + pass + +class PyMisbehavedRawIO(MisbehavedRawIO, pyio.RawIOBase): + pass -class MockFileIO(io.BytesIO): + +class CloseFailureIO(MockRawIO): + closed = 0 + + def close(self): + if not self.closed: + self.closed = 1 + raise IOError + +class CCloseFailureIO(CloseFailureIO, io.RawIOBase): + pass + +class PyCloseFailureIO(CloseFailureIO, pyio.RawIOBase): + pass + + +class MockFileIO: def __init__(self, data): self.read_history = [] - io.BytesIO.__init__(self, data) + super(MockFileIO, self).__init__(data) def read(self, n=None): - res = io.BytesIO.read(self, n) + res = super(MockFileIO, self).read(n) self.read_history.append(None if res is None else len(res)) return res + def readinto(self, b): + res = super(MockFileIO, self).readinto(b) + self.read_history.append(res) + return res + +class CMockFileIO(MockFileIO, io.BytesIO): + pass -class MockNonBlockWriterIO(io.RawIOBase): +class PyMockFileIO(MockFileIO, pyio.BytesIO): + pass - def __init__(self, blocking_script): - self._blocking_script = list(blocking_script) + +class MockNonBlockWriterIO: + + def __init__(self): self._write_stack = [] + self._blocker_char = None - def write(self, b): - self._write_stack.append(b[:]) - n = self._blocking_script.pop(0) - if (n < 0): - raise io.BlockingIOError(0, "test blocking", -n) - else: - return n + def pop_written(self): + s = b"".join(self._write_stack) + self._write_stack[:] = [] + return s + + def block_on(self, char): + """Block when a given char is encountered.""" + self._blocker_char = char + + def readable(self): + return True + + def seekable(self): + return True def writable(self): return True + def write(self, b): + b = bytes(b) + n = -1 + if self._blocker_char: + try: + n = b.index(self._blocker_char) + except ValueError: + pass + else: + self._blocker_char = None + self._write_stack.append(b[:n]) + raise self.BlockingIOError(0, "test blocking", n) + self._write_stack.append(b) + return len(b) + +class CMockNonBlockWriterIO(MockNonBlockWriterIO, io.RawIOBase): + BlockingIOError = io.BlockingIOError + +class PyMockNonBlockWriterIO(MockNonBlockWriterIO, pyio.RawIOBase): + BlockingIOError = pyio.BlockingIOError + class IOTest(unittest.TestCase): + def setUp(self): + support.unlink(support.TESTFN) + def tearDown(self): - test_support.unlink(test_support.TESTFN) + support.unlink(support.TESTFN) def write_ops(self, f): self.assertEqual(f.write(b"blah."), 5) @@ -149,60 +295,71 @@ self.assertEqual(f.seek(-1, 2), self.LARGE) self.assertEqual(f.read(2), b"x") + def test_invalid_operations(self): + # Try writing on a file opened in read mode and vice-versa. + for mode in ("w", "wb"): + with open(support.TESTFN, mode) as fp: + self.assertRaises(IOError, fp.read) + self.assertRaises(IOError, fp.readline) + with open(support.TESTFN, "rb") as fp: + self.assertRaises(IOError, fp.write, b"blah") + self.assertRaises(IOError, fp.writelines, [b"blah\n"]) + with open(support.TESTFN, "r") as fp: + self.assertRaises(IOError, fp.write, "blah") + self.assertRaises(IOError, fp.writelines, ["blah\n"]) + def test_raw_file_io(self): - f = io.open(test_support.TESTFN, "wb", buffering=0) - self.assertEqual(f.readable(), False) - self.assertEqual(f.writable(), True) - self.assertEqual(f.seekable(), True) - self.write_ops(f) - f.close() - f = io.open(test_support.TESTFN, "rb", buffering=0) - self.assertEqual(f.readable(), True) - self.assertEqual(f.writable(), False) - self.assertEqual(f.seekable(), True) - self.read_ops(f) - f.close() + with self.open(support.TESTFN, "wb", buffering=0) as f: + self.assertEqual(f.readable(), False) + self.assertEqual(f.writable(), True) + self.assertEqual(f.seekable(), True) + self.write_ops(f) + with self.open(support.TESTFN, "rb", buffering=0) as f: + self.assertEqual(f.readable(), True) + self.assertEqual(f.writable(), False) + self.assertEqual(f.seekable(), True) + self.read_ops(f) def test_buffered_file_io(self): - f = io.open(test_support.TESTFN, "wb") - self.assertEqual(f.readable(), False) - self.assertEqual(f.writable(), True) - self.assertEqual(f.seekable(), True) - self.write_ops(f) - f.close() - f = io.open(test_support.TESTFN, "rb") - self.assertEqual(f.readable(), True) - self.assertEqual(f.writable(), False) - self.assertEqual(f.seekable(), True) - self.read_ops(f, True) - f.close() + with self.open(support.TESTFN, "wb") as f: + self.assertEqual(f.readable(), False) + self.assertEqual(f.writable(), True) + self.assertEqual(f.seekable(), True) + self.write_ops(f) + with self.open(support.TESTFN, "rb") as f: + self.assertEqual(f.readable(), True) + self.assertEqual(f.writable(), False) + self.assertEqual(f.seekable(), True) + self.read_ops(f, True) def test_readline(self): - f = io.open(test_support.TESTFN, "wb") - f.write(b"abc\ndef\nxyzzy\nfoo") - f.close() - f = io.open(test_support.TESTFN, "rb") - self.assertEqual(f.readline(), b"abc\n") - self.assertEqual(f.readline(10), b"def\n") - self.assertEqual(f.readline(2), b"xy") - self.assertEqual(f.readline(4), b"zzy\n") - self.assertEqual(f.readline(), b"foo") - f.close() + with self.open(support.TESTFN, "wb") as f: + f.write(b"abc\ndef\nxyzzy\nfoo\x00bar\nanother line") + with self.open(support.TESTFN, "rb") as f: + self.assertEqual(f.readline(), b"abc\n") + self.assertEqual(f.readline(10), b"def\n") + self.assertEqual(f.readline(2), b"xy") + self.assertEqual(f.readline(4), b"zzy\n") + self.assertEqual(f.readline(), b"foo\x00bar\n") + self.assertEqual(f.readline(), b"another line") + self.assertRaises(TypeError, f.readline, 5.3) + with self.open(support.TESTFN, "r") as f: + self.assertRaises(TypeError, f.readline, 5.3) def test_raw_bytes_io(self): - f = io.BytesIO() + f = self.BytesIO() self.write_ops(f) data = f.getvalue() self.assertEqual(data, b"hello world\n") - f = io.BytesIO(data) + f = self.BytesIO(data) self.read_ops(f, True) def test_large_file_ops(self): # On Windows and Mac OSX this test comsumes large resources; It takes # a long time to build the >2GB file and takes >2GB of disk space # therefore the resource must be enabled to run this test. - if sys.platform[:3] in ('win', 'os2') or sys.platform == 'darwin': - if not test_support.is_resource_enabled("largefile"): + if sys.platform[:3] == 'win' or sys.platform == 'darwin': + if not support.is_resource_enabled("largefile"): print("\nTesting large file ops skipped on %s." % sys.platform, file=sys.stderr) print("It requires %d bytes and a long time." % self.LARGE, @@ -210,22 +367,20 @@ print("Use 'regrtest.py -u largefile test_io' to run it.", file=sys.stderr) return - f = io.open(test_support.TESTFN, "w+b", 0) - self.large_file_ops(f) - f.close() - f = io.open(test_support.TESTFN, "w+b") - self.large_file_ops(f) - f.close() + with self.open(support.TESTFN, "w+b", 0) as f: + self.large_file_ops(f) + with self.open(support.TESTFN, "w+b") as f: + self.large_file_ops(f) def test_with_open(self): for bufsize in (0, 1, 100): f = None - with open(test_support.TESTFN, "wb", bufsize) as f: + with open(support.TESTFN, "wb", bufsize) as f: f.write(b"xxx") self.assertEqual(f.closed, True) f = None try: - with open(test_support.TESTFN, "wb", bufsize) as f: + with open(support.TESTFN, "wb", bufsize) as f: 1/0 except ZeroDivisionError: self.assertEqual(f.closed, True) @@ -234,60 +389,105 @@ # issue 5008 def test_append_mode_tell(self): - with io.open(test_support.TESTFN, "wb") as f: + with self.open(support.TESTFN, "wb") as f: f.write(b"xxx") - with io.open(test_support.TESTFN, "ab", buffering=0) as f: + with self.open(support.TESTFN, "ab", buffering=0) as f: self.assertEqual(f.tell(), 3) - with io.open(test_support.TESTFN, "ab") as f: + with self.open(support.TESTFN, "ab") as f: self.assertEqual(f.tell(), 3) - with io.open(test_support.TESTFN, "a") as f: + with self.open(support.TESTFN, "a") as f: self.assert_(f.tell() > 0) def test_destructor(self): record = [] - class MyFileIO(io.FileIO): + class MyFileIO(self.FileIO): def __del__(self): record.append(1) - io.FileIO.__del__(self) + try: + f = super(MyFileIO, self).__del__ + except AttributeError: + pass + else: + f() def close(self): record.append(2) - io.FileIO.close(self) + super(MyFileIO, self).close() def flush(self): record.append(3) - io.FileIO.flush(self) - f = MyFileIO(test_support.TESTFN, "w") - f.write("xxx") + super(MyFileIO, self).flush() + f = MyFileIO(support.TESTFN, "wb") + f.write(b"xxx") + del f + support.gc_collect() + self.assertEqual(record, [1, 2, 3]) + with open(support.TESTFN, "rb") as f: + self.assertEqual(f.read(), b"xxx") + + def _check_base_destructor(self, base): + record = [] + class MyIO(base): + def __init__(self): + # This exercises the availability of attributes on object + # destruction. + # (in the C version, close() is called by the tp_dealloc + # function, not by __del__) + self.on_del = 1 + self.on_close = 2 + self.on_flush = 3 + def __del__(self): + record.append(self.on_del) + try: + f = super(MyIO, self).__del__ + except AttributeError: + pass + else: + f() + def close(self): + record.append(self.on_close) + super(MyIO, self).close() + def flush(self): + record.append(self.on_flush) + super(MyIO, self).flush() + f = MyIO() del f + support.gc_collect() self.assertEqual(record, [1, 2, 3]) + def test_IOBase_destructor(self): + self._check_base_destructor(self.IOBase) + + def test_RawIOBase_destructor(self): + self._check_base_destructor(self.RawIOBase) + + def test_BufferedIOBase_destructor(self): + self._check_base_destructor(self.BufferedIOBase) + + def test_TextIOBase_destructor(self): + self._check_base_destructor(self.TextIOBase) + def test_close_flushes(self): - f = io.open(test_support.TESTFN, "wb") - f.write(b"xxx") - f.close() - f = io.open(test_support.TESTFN, "rb") - self.assertEqual(f.read(), b"xxx") - f.close() + with self.open(support.TESTFN, "wb") as f: + f.write(b"xxx") + with self.open(support.TESTFN, "rb") as f: + self.assertEqual(f.read(), b"xxx") - def XXXtest_array_writes(self): - # XXX memory view not available yet - a = array.array('i', range(10)) - n = len(memoryview(a)) - f = io.open(test_support.TESTFN, "wb", 0) - self.assertEqual(f.write(a), n) - f.close() - f = io.open(test_support.TESTFN, "wb") - self.assertEqual(f.write(a), n) - f.close() + def test_array_writes(self): + a = array.array(b'i', range(10)) + n = len(a.tostring()) + with self.open(support.TESTFN, "wb", 0) as f: + self.assertEqual(f.write(a), n) + with self.open(support.TESTFN, "wb") as f: + self.assertEqual(f.write(a), n) def test_closefd(self): - self.assertRaises(ValueError, io.open, test_support.TESTFN, 'w', + self.assertRaises(ValueError, self.open, support.TESTFN, 'w', closefd=False) - def testReadClosed(self): - with io.open(test_support.TESTFN, "w") as f: + def test_read_closed(self): + with self.open(support.TESTFN, "w") as f: f.write("egg\n") - with io.open(test_support.TESTFN, "r") as f: - file = io.open(f.fileno(), "r", closefd=False) + with self.open(support.TESTFN, "r") as f: + file = self.open(f.fileno(), "r", closefd=False) self.assertEqual(file.read(), "egg\n") file.seek(0) file.close() @@ -295,86 +495,203 @@ def test_no_closefd_with_filename(self): # can't use closefd in combination with a file name - self.assertRaises(ValueError, - io.open, test_support.TESTFN, "r", closefd=False) + self.assertRaises(ValueError, self.open, support.TESTFN, "r", closefd=False) def test_closefd_attr(self): - with io.open(test_support.TESTFN, "wb") as f: + with self.open(support.TESTFN, "wb") as f: f.write(b"egg\n") - with io.open(test_support.TESTFN, "r") as f: + with self.open(support.TESTFN, "r") as f: self.assertEqual(f.buffer.raw.closefd, True) - file = io.open(f.fileno(), "r", closefd=False) + file = self.open(f.fileno(), "r", closefd=False) self.assertEqual(file.buffer.raw.closefd, False) + def test_garbage_collection(self): + # FileIO objects are collected, and collecting them flushes + # all data to disk. + f = self.FileIO(support.TESTFN, "wb") + f.write(b"abcxxx") + f.f = f + wr = weakref.ref(f) + del f + support.gc_collect() + self.assert_(wr() is None, wr) + with open(support.TESTFN, "rb") as f: + self.assertEqual(f.read(), b"abcxxx") + + def test_unbounded_file(self): + # Issue #1174606: reading from an unbounded stream such as /dev/zero. + zero = "/dev/zero" + if not os.path.exists(zero): + self.skipTest("{0} does not exist".format(zero)) + if sys.maxsize > 0x7FFFFFFF: + self.skipTest("test can only run in a 32-bit address space") + if support.real_max_memuse < support._2G: + self.skipTest("test requires at least 2GB of memory") + with open(zero, "rb", buffering=0) as f: + self.assertRaises(OverflowError, f.read) + with open(zero, "rb") as f: + self.assertRaises(OverflowError, f.read) + with open(zero, "r") as f: + self.assertRaises(OverflowError, f.read) + +class CIOTest(IOTest): + pass + +class PyIOTest(IOTest): + test_array_writes = unittest.skip( + "len(array.array) returns number of elements rather than bytelength" + )(IOTest.test_array_writes) + + +class CommonBufferedTests: + # Tests common to BufferedReader, BufferedWriter and BufferedRandom + + def test_detach(self): + raw = self.MockRawIO() + buf = self.tp(raw) + self.assertIs(buf.detach(), raw) + self.assertRaises(ValueError, buf.detach) + + def test_fileno(self): + rawio = self.MockRawIO() + bufio = self.tp(rawio) -class MemorySeekTestMixin: - - def testInit(self): - buf = self.buftype("1234567890") - bytesIo = self.ioclass(buf) - - def testRead(self): - buf = self.buftype("1234567890") - bytesIo = self.ioclass(buf) - - self.assertEquals(buf[:1], bytesIo.read(1)) - self.assertEquals(buf[1:5], bytesIo.read(4)) - self.assertEquals(buf[5:], bytesIo.read(900)) - self.assertEquals(self.EOF, bytesIo.read()) - - def testReadNoArgs(self): - buf = self.buftype("1234567890") - bytesIo = self.ioclass(buf) - - self.assertEquals(buf, bytesIo.read()) - self.assertEquals(self.EOF, bytesIo.read()) - - def testSeek(self): - buf = self.buftype("1234567890") - bytesIo = self.ioclass(buf) - - bytesIo.read(5) - bytesIo.seek(0) - self.assertEquals(buf, bytesIo.read()) - - bytesIo.seek(3) - self.assertEquals(buf[3:], bytesIo.read()) - self.assertRaises(TypeError, bytesIo.seek, 0.0) - - def testTell(self): - buf = self.buftype("1234567890") - bytesIo = self.ioclass(buf) - - self.assertEquals(0, bytesIo.tell()) - bytesIo.seek(5) - self.assertEquals(5, bytesIo.tell()) - bytesIo.seek(10000) - self.assertEquals(10000, bytesIo.tell()) - - -class BytesIOTest(MemorySeekTestMixin, unittest.TestCase): - @staticmethod - def buftype(s): - return s.encode("utf-8") - ioclass = io.BytesIO - EOF = b"" - - -class StringIOTest(MemorySeekTestMixin, unittest.TestCase): - buftype = str - ioclass = io.StringIO - EOF = "" + self.assertEquals(42, bufio.fileno()) + def test_no_fileno(self): + # XXX will we always have fileno() function? If so, kill + # this test. Else, write it. + pass -class BufferedReaderTest(unittest.TestCase): + def test_invalid_args(self): + rawio = self.MockRawIO() + bufio = self.tp(rawio) + # Invalid whence + self.assertRaises(ValueError, bufio.seek, 0, -1) + self.assertRaises(ValueError, bufio.seek, 0, 3) - def testRead(self): - rawio = MockRawIO((b"abc", b"d", b"efg")) - bufio = io.BufferedReader(rawio) + def test_override_destructor(self): + tp = self.tp + record = [] + class MyBufferedIO(tp): + def __del__(self): + record.append(1) + try: + f = super(MyBufferedIO, self).__del__ + except AttributeError: + pass + else: + f() + def close(self): + record.append(2) + super(MyBufferedIO, self).close() + def flush(self): + record.append(3) + super(MyBufferedIO, self).flush() + rawio = self.MockRawIO() + bufio = MyBufferedIO(rawio) + writable = bufio.writable() + del bufio + support.gc_collect() + if writable: + self.assertEqual(record, [1, 2, 3]) + else: + self.assertEqual(record, [1, 2]) + def test_context_manager(self): + # Test usability as a context manager + rawio = self.MockRawIO() + bufio = self.tp(rawio) + def _with(): + with bufio: + pass + _with() + # bufio should now be closed, and using it a second time should raise + # a ValueError. + self.assertRaises(ValueError, _with) + + def test_error_through_destructor(self): + # Test that the exception state is not modified by a destructor, + # even if close() fails. + rawio = self.CloseFailureIO() + def f(): + self.tp(rawio).xyzzy + with support.captured_output("stderr") as s: + self.assertRaises(AttributeError, f) + s = s.getvalue().strip() + if s: + # The destructor *may* have printed an unraisable error, check it + self.assertEqual(len(s.splitlines()), 1) + self.assert_(s.startswith("Exception IOError: "), s) + self.assert_(s.endswith(" ignored"), s) + + def test_repr(self): + raw = self.MockRawIO() + b = self.tp(raw) + clsname = "%s.%s" % (self.tp.__module__, self.tp.__name__) + self.assertEqual(repr(b), "<%s>" % clsname) + raw.name = "dummy" + self.assertEqual(repr(b), "<%s name=u'dummy'>" % clsname) + raw.name = b"dummy" + self.assertEqual(repr(b), "<%s name='dummy'>" % clsname) + + +class BufferedReaderTest(unittest.TestCase, CommonBufferedTests): + read_mode = "rb" + + def test_constructor(self): + rawio = self.MockRawIO([b"abc"]) + bufio = self.tp(rawio) + bufio.__init__(rawio) + bufio.__init__(rawio, buffer_size=1024) + bufio.__init__(rawio, buffer_size=16) + self.assertEquals(b"abc", bufio.read()) + self.assertRaises(ValueError, bufio.__init__, rawio, buffer_size=0) + self.assertRaises(ValueError, bufio.__init__, rawio, buffer_size=-16) + self.assertRaises(ValueError, bufio.__init__, rawio, buffer_size=-1) + rawio = self.MockRawIO([b"abc"]) + bufio.__init__(rawio) + self.assertEquals(b"abc", bufio.read()) + + def test_read(self): + rawio = self.MockRawIO((b"abc", b"d", b"efg")) + bufio = self.tp(rawio) self.assertEquals(b"abcdef", bufio.read(6)) + # Invalid args + self.assertRaises(ValueError, bufio.read, -2) - def testBuffering(self): + def test_read1(self): + rawio = self.MockRawIO((b"abc", b"d", b"efg")) + bufio = self.tp(rawio) + self.assertEquals(b"a", bufio.read(1)) + self.assertEquals(b"b", bufio.read1(1)) + self.assertEquals(rawio._reads, 1) + self.assertEquals(b"c", bufio.read1(100)) + self.assertEquals(rawio._reads, 1) + self.assertEquals(b"d", bufio.read1(100)) + self.assertEquals(rawio._reads, 2) + self.assertEquals(b"efg", bufio.read1(100)) + self.assertEquals(rawio._reads, 3) + self.assertEquals(b"", bufio.read1(100)) + # Invalid args + self.assertRaises(ValueError, bufio.read1, -1) + + def test_readinto(self): + rawio = self.MockRawIO((b"abc", b"d", b"efg")) + bufio = self.tp(rawio) + b = bytearray(2) + self.assertEquals(bufio.readinto(b), 2) + self.assertEquals(b, b"ab") + self.assertEquals(bufio.readinto(b), 2) + self.assertEquals(b, b"cd") + self.assertEquals(bufio.readinto(b), 2) + self.assertEquals(b, b"ef") + self.assertEquals(bufio.readinto(b), 1) + self.assertEquals(b, b"gf") + self.assertEquals(bufio.readinto(b), 0) + self.assertEquals(b, b"gf") + + def test_buffering(self): data = b"abcdefghi" dlen = len(data) @@ -385,61 +702,52 @@ ] for bufsize, buf_read_sizes, raw_read_sizes in tests: - rawio = MockFileIO(data) - bufio = io.BufferedReader(rawio, buffer_size=bufsize) + rawio = self.MockFileIO(data) + bufio = self.tp(rawio, buffer_size=bufsize) pos = 0 for nbytes in buf_read_sizes: self.assertEquals(bufio.read(nbytes), data[pos:pos+nbytes]) pos += nbytes + # this is mildly implementation-dependent self.assertEquals(rawio.read_history, raw_read_sizes) - def testReadNonBlocking(self): + def test_read_non_blocking(self): # Inject some None's in there to simulate EWOULDBLOCK - rawio = MockRawIO((b"abc", b"d", None, b"efg", None, None)) - bufio = io.BufferedReader(rawio) + rawio = self.MockRawIO((b"abc", b"d", None, b"efg", None, None, None)) + bufio = self.tp(rawio) self.assertEquals(b"abcd", bufio.read(6)) self.assertEquals(b"e", bufio.read(1)) self.assertEquals(b"fg", bufio.read()) + self.assertEquals(b"", bufio.peek(1)) self.assert_(None is bufio.read()) self.assertEquals(b"", bufio.read()) - def testReadToEof(self): - rawio = MockRawIO((b"abc", b"d", b"efg")) - bufio = io.BufferedReader(rawio) + def test_read_past_eof(self): + rawio = self.MockRawIO((b"abc", b"d", b"efg")) + bufio = self.tp(rawio) self.assertEquals(b"abcdefg", bufio.read(9000)) - def testReadNoArgs(self): - rawio = MockRawIO((b"abc", b"d", b"efg")) - bufio = io.BufferedReader(rawio) + def test_read_all(self): + rawio = self.MockRawIO((b"abc", b"d", b"efg")) + bufio = self.tp(rawio) self.assertEquals(b"abcdefg", bufio.read()) - def testFileno(self): - rawio = MockRawIO((b"abc", b"d", b"efg")) - bufio = io.BufferedReader(rawio) - - self.assertEquals(42, bufio.fileno()) - - def testFilenoNoFileno(self): - # XXX will we always have fileno() function? If so, kill - # this test. Else, write it. - pass - - def testThreads(self): + def test_threads(self): try: # Write out many bytes with exactly the same number of 0's, # 1's... 255's. This will help us check that concurrent reading # doesn't duplicate or forget contents. N = 1000 - l = range(256) * N + l = list(range(256)) * N random.shuffle(l) s = bytes(bytearray(l)) - with io.open(test_support.TESTFN, "wb") as f: + with io.open(support.TESTFN, "wb") as f: f.write(s) - with io.open(test_support.TESTFN, "rb", buffering=0) as raw: - bufio = io.BufferedReader(raw, 8) + with io.open(support.TESTFN, self.read_mode, buffering=0) as raw: + bufio = self.tp(raw, 8) errors = [] results = [] def f(): @@ -467,82 +775,242 @@ c = bytes(bytearray([i])) self.assertEqual(s.count(c), N) finally: - test_support.unlink(test_support.TESTFN) - + support.unlink(support.TESTFN) + def test_misbehaved_io(self): + rawio = self.MisbehavedRawIO((b"abc", b"d", b"efg")) + bufio = self.tp(rawio) + self.assertRaises(IOError, bufio.seek, 0) + self.assertRaises(IOError, bufio.tell) + +class CBufferedReaderTest(BufferedReaderTest): + tp = io.BufferedReader + + def test_constructor(self): + BufferedReaderTest.test_constructor(self) + # The allocation can succeed on 32-bit builds, e.g. with more + # than 2GB RAM and a 64-bit kernel. + if sys.maxsize > 0x7FFFFFFF: + rawio = self.MockRawIO() + bufio = self.tp(rawio) + self.assertRaises((OverflowError, MemoryError, ValueError), + bufio.__init__, rawio, sys.maxsize) + + def test_initialization(self): + rawio = self.MockRawIO([b"abc"]) + bufio = self.tp(rawio) + self.assertRaises(ValueError, bufio.__init__, rawio, buffer_size=0) + self.assertRaises(ValueError, bufio.read) + self.assertRaises(ValueError, bufio.__init__, rawio, buffer_size=-16) + self.assertRaises(ValueError, bufio.read) + self.assertRaises(ValueError, bufio.__init__, rawio, buffer_size=-1) + self.assertRaises(ValueError, bufio.read) + + def test_misbehaved_io_read(self): + rawio = self.MisbehavedRawIO((b"abc", b"d", b"efg")) + bufio = self.tp(rawio) + # _pyio.BufferedReader seems to implement reading different, so that + # checking this is not so easy. + self.assertRaises(IOError, bufio.read, 10) + + def test_garbage_collection(self): + # C BufferedReader objects are collected. + # The Python version has __del__, so it ends into gc.garbage instead + rawio = self.FileIO(support.TESTFN, "w+b") + f = self.tp(rawio) + f.f = f + wr = weakref.ref(f) + del f + support.gc_collect() + self.assert_(wr() is None, wr) -class BufferedWriterTest(unittest.TestCase): +class PyBufferedReaderTest(BufferedReaderTest): + tp = pyio.BufferedReader - def testWrite(self): - # Write to the buffered IO but don't overflow the buffer. - writer = MockRawIO() - bufio = io.BufferedWriter(writer, 8) - bufio.write(b"abc") - - self.assertFalse(writer._write_stack) +class BufferedWriterTest(unittest.TestCase, CommonBufferedTests): + write_mode = "wb" + + def test_constructor(self): + rawio = self.MockRawIO() + bufio = self.tp(rawio) + bufio.__init__(rawio) + bufio.__init__(rawio, buffer_size=1024) + bufio.__init__(rawio, buffer_size=16) + self.assertEquals(3, bufio.write(b"abc")) + bufio.flush() + self.assertRaises(ValueError, bufio.__init__, rawio, buffer_size=0) + self.assertRaises(ValueError, bufio.__init__, rawio, buffer_size=-16) + self.assertRaises(ValueError, bufio.__init__, rawio, buffer_size=-1) + bufio.__init__(rawio) + self.assertEquals(3, bufio.write(b"ghi")) + bufio.flush() + self.assertEquals(b"".join(rawio._write_stack), b"abcghi") - def testWriteOverflow(self): - writer = MockRawIO() - bufio = io.BufferedWriter(writer, 8) + def test_detach_flush(self): + raw = self.MockRawIO() + buf = self.tp(raw) + buf.write(b"howdy!") + self.assertFalse(raw._write_stack) + buf.detach() + self.assertEqual(raw._write_stack, [b"howdy!"]) + def test_write(self): + # Write to the buffered IO but don't overflow the buffer. + writer = self.MockRawIO() + bufio = self.tp(writer, 8) bufio.write(b"abc") - bufio.write(b"defghijkl") - - self.assertEquals(b"abcdefghijkl", writer._write_stack[0]) - - def testWriteNonBlocking(self): - raw = MockNonBlockWriterIO((9, 2, 22, -6, 10, 12, 12)) - bufio = io.BufferedWriter(raw, 8, 16) - - bufio.write(b"asdf") - bufio.write(b"asdfa") - self.assertEquals(b"asdfasdfa", raw._write_stack[0]) - - bufio.write(b"asdfasdfasdf") - self.assertEquals(b"asdfasdfasdf", raw._write_stack[1]) - bufio.write(b"asdfasdfasdf") - self.assertEquals(b"dfasdfasdf", raw._write_stack[2]) - self.assertEquals(b"asdfasdfasdf", raw._write_stack[3]) + self.assertFalse(writer._write_stack) - bufio.write(b"asdfasdfasdf") + def test_write_overflow(self): + writer = self.MockRawIO() + bufio = self.tp(writer, 8) + contents = b"abcdefghijklmnop" + for n in range(0, len(contents), 3): + bufio.write(contents[n:n+3]) + flushed = b"".join(writer._write_stack) + # At least (total - 8) bytes were implicitly flushed, perhaps more + # depending on the implementation. + self.assert_(flushed.startswith(contents[:-8]), flushed) + + def check_writes(self, intermediate_func): + # Lots of writes, test the flushed output is as expected. + contents = bytes(range(256)) * 1000 + n = 0 + writer = self.MockRawIO() + bufio = self.tp(writer, 13) + # Generator of write sizes: repeat each N 15 times then proceed to N+1 + def gen_sizes(): + for size in count(1): + for i in range(15): + yield size + sizes = gen_sizes() + while n < len(contents): + size = min(next(sizes), len(contents) - n) + self.assertEquals(bufio.write(contents[n:n+size]), size) + intermediate_func(bufio) + n += size + bufio.flush() + self.assertEquals(contents, + b"".join(writer._write_stack)) - # XXX I don't like this test. It relies too heavily on how the - # algorithm actually works, which we might change. Refactor - # later. + def test_writes(self): + self.check_writes(lambda bufio: None) - def testFileno(self): - rawio = MockRawIO((b"abc", b"d", b"efg")) - bufio = io.BufferedWriter(rawio) + def test_writes_and_flushes(self): + self.check_writes(lambda bufio: bufio.flush()) - self.assertEquals(42, bufio.fileno()) + def test_writes_and_seeks(self): + def _seekabs(bufio): + pos = bufio.tell() + bufio.seek(pos + 1, 0) + bufio.seek(pos - 1, 0) + bufio.seek(pos, 0) + self.check_writes(_seekabs) + def _seekrel(bufio): + pos = bufio.seek(0, 1) + bufio.seek(+1, 1) + bufio.seek(-1, 1) + bufio.seek(pos, 0) + self.check_writes(_seekrel) + + def test_writes_and_truncates(self): + self.check_writes(lambda bufio: bufio.truncate(bufio.tell())) + + def test_write_non_blocking(self): + raw = self.MockNonBlockWriterIO() + bufio = self.tp(raw, 8) + + self.assertEquals(bufio.write(b"abcd"), 4) + self.assertEquals(bufio.write(b"efghi"), 5) + # 1 byte will be written, the rest will be buffered + raw.block_on(b"k") + self.assertEquals(bufio.write(b"jklmn"), 5) - def testFlush(self): - writer = MockRawIO() - bufio = io.BufferedWriter(writer, 8) + # 8 bytes will be written, 8 will be buffered and the rest will be lost + raw.block_on(b"0") + try: + bufio.write(b"opqrwxyz0123456789") + except self.BlockingIOError as e: + written = e.characters_written + else: + self.fail("BlockingIOError should have been raised") + self.assertEquals(written, 16) + self.assertEquals(raw.pop_written(), + b"abcdefghijklmnopqrwxyz") + + self.assertEquals(bufio.write(b"ABCDEFGHI"), 9) + s = raw.pop_written() + # Previously buffered bytes were flushed + self.assertTrue(s.startswith(b"01234567A"), s) + + def test_write_and_rewind(self): + raw = io.BytesIO() + bufio = self.tp(raw, 4) + self.assertEqual(bufio.write(b"abcdef"), 6) + self.assertEqual(bufio.tell(), 6) + bufio.seek(0, 0) + self.assertEqual(bufio.write(b"XY"), 2) + bufio.seek(6, 0) + self.assertEqual(raw.getvalue(), b"XYcdef") + self.assertEqual(bufio.write(b"123456"), 6) + bufio.flush() + self.assertEqual(raw.getvalue(), b"XYcdef123456") + def test_flush(self): + writer = self.MockRawIO() + bufio = self.tp(writer, 8) bufio.write(b"abc") bufio.flush() + self.assertEquals(b"abc", writer._write_stack[0]) + def test_destructor(self): + writer = self.MockRawIO() + bufio = self.tp(writer, 8) + bufio.write(b"abc") + del bufio + support.gc_collect() self.assertEquals(b"abc", writer._write_stack[0]) - def testThreads(self): - # BufferedWriter should not raise exceptions or crash - # when called from multiple threads. + def test_truncate(self): + # Truncate implicitly flushes the buffer. + with io.open(support.TESTFN, self.write_mode, buffering=0) as raw: + bufio = self.tp(raw, 8) + bufio.write(b"abcdef") + self.assertEqual(bufio.truncate(3), 3) + self.assertEqual(bufio.tell(), 3) + with io.open(support.TESTFN, "rb", buffering=0) as f: + self.assertEqual(f.read(), b"abc") + + def test_threads(self): try: + # Write out many bytes from many threads and test they were + # all flushed. + N = 1000 + contents = bytes(range(256)) * N + sizes = cycle([1, 19]) + n = 0 + queue = deque() + while n < len(contents): + size = next(sizes) + queue.append(contents[n:n+size]) + n += size + del contents # We use a real file object because it allows us to # exercise situations where the GIL is released before # writing the buffer to the raw streams. This is in addition # to concurrency issues due to switching threads in the middle # of Python code. - with io.open(test_support.TESTFN, "wb", buffering=0) as raw: - bufio = io.BufferedWriter(raw, 8) + with io.open(support.TESTFN, self.write_mode, buffering=0) as raw: + bufio = self.tp(raw, 8) errors = [] def f(): try: - # Write enough bytes to flush the buffer - s = b"a" * 19 - for i in range(50): + while True: + try: + s = queue.popleft() + except IndexError: + return bufio.write(s) except Exception as e: errors.append(e) @@ -555,37 +1023,218 @@ t.join() self.assertFalse(errors, "the following exceptions were caught: %r" % errors) + bufio.close() + with io.open(support.TESTFN, "rb") as f: + s = f.read() + for i in range(256): + self.assertEquals(s.count(bytes([i])), N) finally: - test_support.unlink(test_support.TESTFN) + support.unlink(support.TESTFN) + + def test_misbehaved_io(self): + rawio = self.MisbehavedRawIO() + bufio = self.tp(rawio, 5) + self.assertRaises(IOError, bufio.seek, 0) + self.assertRaises(IOError, bufio.tell) + self.assertRaises(IOError, bufio.write, b"abcdef") + + def test_max_buffer_size_deprecation(self): + with support.check_warnings() as w: + warnings.simplefilter("always", DeprecationWarning) + self.tp(self.MockRawIO(), 8, 12) + self.assertEqual(len(w.warnings), 1) + warning = w.warnings[0] + self.assertTrue(warning.category is DeprecationWarning) + self.assertEqual(str(warning.message), + "max_buffer_size is deprecated") + + +class CBufferedWriterTest(BufferedWriterTest): + tp = io.BufferedWriter + + def test_constructor(self): + BufferedWriterTest.test_constructor(self) + # The allocation can succeed on 32-bit builds, e.g. with more + # than 2GB RAM and a 64-bit kernel. + if sys.maxsize > 0x7FFFFFFF: + rawio = self.MockRawIO() + bufio = self.tp(rawio) + self.assertRaises((OverflowError, MemoryError, ValueError), + bufio.__init__, rawio, sys.maxsize) + + def test_initialization(self): + rawio = self.MockRawIO() + bufio = self.tp(rawio) + self.assertRaises(ValueError, bufio.__init__, rawio, buffer_size=0) + self.assertRaises(ValueError, bufio.write, b"def") + self.assertRaises(ValueError, bufio.__init__, rawio, buffer_size=-16) + self.assertRaises(ValueError, bufio.write, b"def") + self.assertRaises(ValueError, bufio.__init__, rawio, buffer_size=-1) + self.assertRaises(ValueError, bufio.write, b"def") + + def test_garbage_collection(self): + # C BufferedWriter objects are collected, and collecting them flushes + # all data to disk. + # The Python version has __del__, so it ends into gc.garbage instead + rawio = self.FileIO(support.TESTFN, "w+b") + f = self.tp(rawio) + f.write(b"123xxx") + f.x = f + wr = weakref.ref(f) + del f + support.gc_collect() + self.assert_(wr() is None, wr) + with open(support.TESTFN, "rb") as f: + self.assertEqual(f.read(), b"123xxx") + +class PyBufferedWriterTest(BufferedWriterTest): + tp = pyio.BufferedWriter class BufferedRWPairTest(unittest.TestCase): - def testRWPair(self): - r = MockRawIO(()) - w = MockRawIO() - pair = io.BufferedRWPair(r, w) + def test_constructor(self): + pair = self.tp(self.MockRawIO(), self.MockRawIO()) self.assertFalse(pair.closed) - # XXX More Tests + def test_detach(self): + pair = self.tp(self.MockRawIO(), self.MockRawIO()) + self.assertRaises(self.UnsupportedOperation, pair.detach) + + def test_constructor_max_buffer_size_deprecation(self): + with support.check_warnings() as w: + warnings.simplefilter("always", DeprecationWarning) + self.tp(self.MockRawIO(), self.MockRawIO(), 8, 12) + self.assertEqual(len(w.warnings), 1) + warning = w.warnings[0] + self.assertTrue(warning.category is DeprecationWarning) + self.assertEqual(str(warning.message), + "max_buffer_size is deprecated") + + def test_constructor_with_not_readable(self): + class NotReadable(MockRawIO): + def readable(self): + return False + + self.assertRaises(IOError, self.tp, NotReadable(), self.MockRawIO()) + + def test_constructor_with_not_writeable(self): + class NotWriteable(MockRawIO): + def writable(self): + return False + + self.assertRaises(IOError, self.tp, self.MockRawIO(), NotWriteable()) + + def test_read(self): + pair = self.tp(self.BytesIO(b"abcdef"), self.MockRawIO()) + + self.assertEqual(pair.read(3), b"abc") + self.assertEqual(pair.read(1), b"d") + self.assertEqual(pair.read(), b"ef") + + def test_read1(self): + # .read1() is delegated to the underlying reader object, so this test + # can be shallow. + pair = self.tp(self.BytesIO(b"abcdef"), self.MockRawIO()) + + self.assertEqual(pair.read1(3), b"abc") + + def test_readinto(self): + pair = self.tp(self.BytesIO(b"abcdef"), self.MockRawIO()) + + data = bytearray(5) + self.assertEqual(pair.readinto(data), 5) + self.assertEqual(data, b"abcde") + + def test_write(self): + w = self.MockRawIO() + pair = self.tp(self.MockRawIO(), w) + + pair.write(b"abc") + pair.flush() + pair.write(b"def") + pair.flush() + self.assertEqual(w._write_stack, [b"abc", b"def"]) + + def test_peek(self): + pair = self.tp(self.BytesIO(b"abcdef"), self.MockRawIO()) + + self.assertTrue(pair.peek(3).startswith(b"abc")) + self.assertEqual(pair.read(3), b"abc") + + def test_readable(self): + pair = self.tp(self.MockRawIO(), self.MockRawIO()) + self.assertTrue(pair.readable()) + + def test_writeable(self): + pair = self.tp(self.MockRawIO(), self.MockRawIO()) + self.assertTrue(pair.writable()) + + def test_seekable(self): + # BufferedRWPairs are never seekable, even if their readers and writers + # are. + pair = self.tp(self.MockRawIO(), self.MockRawIO()) + self.assertFalse(pair.seekable()) + + # .flush() is delegated to the underlying writer object and has been + # tested in the test_write method. + + def test_close_and_closed(self): + pair = self.tp(self.MockRawIO(), self.MockRawIO()) + self.assertFalse(pair.closed) + pair.close() + self.assertTrue(pair.closed) + + def test_isatty(self): + class SelectableIsAtty(MockRawIO): + def __init__(self, isatty): + MockRawIO.__init__(self) + self._isatty = isatty + + def isatty(self): + return self._isatty + + pair = self.tp(SelectableIsAtty(False), SelectableIsAtty(False)) + self.assertFalse(pair.isatty()) + + pair = self.tp(SelectableIsAtty(True), SelectableIsAtty(False)) + self.assertTrue(pair.isatty()) + pair = self.tp(SelectableIsAtty(False), SelectableIsAtty(True)) + self.assertTrue(pair.isatty()) -class BufferedRandomTest(unittest.TestCase): + pair = self.tp(SelectableIsAtty(True), SelectableIsAtty(True)) + self.assertTrue(pair.isatty()) - def testReadAndWrite(self): - raw = MockRawIO((b"asdf", b"ghjk")) - rw = io.BufferedRandom(raw, 8, 12) +class CBufferedRWPairTest(BufferedRWPairTest): + tp = io.BufferedRWPair + +class PyBufferedRWPairTest(BufferedRWPairTest): + tp = pyio.BufferedRWPair + + +class BufferedRandomTest(BufferedReaderTest, BufferedWriterTest): + read_mode = "rb+" + write_mode = "wb+" + + def test_constructor(self): + BufferedReaderTest.test_constructor(self) + BufferedWriterTest.test_constructor(self) + + def test_read_and_write(self): + raw = self.MockRawIO((b"asdf", b"ghjk")) + rw = self.tp(raw, 8) self.assertEqual(b"as", rw.read(2)) rw.write(b"ddd") rw.write(b"eee") self.assertFalse(raw._write_stack) # Buffer writes - self.assertEqual(b"ghjk", rw.read()) # This read forces write flush + self.assertEqual(b"ghjk", rw.read()) self.assertEquals(b"dddeee", raw._write_stack[0]) - def testSeekAndTell(self): - raw = io.BytesIO(b"asdfghjkl") - rw = io.BufferedRandom(raw) + def test_seek_and_tell(self): + raw = self.BytesIO(b"asdfghjkl") + rw = self.tp(raw) self.assertEquals(b"as", rw.read(2)) self.assertEquals(2, rw.tell()) @@ -603,6 +1252,115 @@ self.assertEquals(b"fl", rw.read(11)) self.assertRaises(TypeError, rw.seek, 0.0) + def check_flush_and_read(self, read_func): + raw = self.BytesIO(b"abcdefghi") + bufio = self.tp(raw) + + self.assertEquals(b"ab", read_func(bufio, 2)) + bufio.write(b"12") + self.assertEquals(b"ef", read_func(bufio, 2)) + self.assertEquals(6, bufio.tell()) + bufio.flush() + self.assertEquals(6, bufio.tell()) + self.assertEquals(b"ghi", read_func(bufio)) + raw.seek(0, 0) + raw.write(b"XYZ") + # flush() resets the read buffer + bufio.flush() + bufio.seek(0, 0) + self.assertEquals(b"XYZ", read_func(bufio, 3)) + + def test_flush_and_read(self): + self.check_flush_and_read(lambda bufio, *args: bufio.read(*args)) + + def test_flush_and_readinto(self): + def _readinto(bufio, n=-1): + b = bytearray(n if n >= 0 else 9999) + n = bufio.readinto(b) + return bytes(b[:n]) + self.check_flush_and_read(_readinto) + + def test_flush_and_peek(self): + def _peek(bufio, n=-1): + # This relies on the fact that the buffer can contain the whole + # raw stream, otherwise peek() can return less. + b = bufio.peek(n) + if n != -1: + b = b[:n] + bufio.seek(len(b), 1) + return b + self.check_flush_and_read(_peek) + + def test_flush_and_write(self): + raw = self.BytesIO(b"abcdefghi") + bufio = self.tp(raw) + + bufio.write(b"123") + bufio.flush() + bufio.write(b"45") + bufio.flush() + bufio.seek(0, 0) + self.assertEquals(b"12345fghi", raw.getvalue()) + self.assertEquals(b"12345fghi", bufio.read()) + + def test_threads(self): + BufferedReaderTest.test_threads(self) + BufferedWriterTest.test_threads(self) + + def test_writes_and_peek(self): + def _peek(bufio): + bufio.peek(1) + self.check_writes(_peek) + def _peek(bufio): + pos = bufio.tell() + bufio.seek(-1, 1) + bufio.peek(1) + bufio.seek(pos, 0) + self.check_writes(_peek) + + def test_writes_and_reads(self): + def _read(bufio): + bufio.seek(-1, 1) + bufio.read(1) + self.check_writes(_read) + + def test_writes_and_read1s(self): + def _read1(bufio): + bufio.seek(-1, 1) + bufio.read1(1) + self.check_writes(_read1) + + def test_writes_and_readintos(self): + def _read(bufio): + bufio.seek(-1, 1) + bufio.readinto(bytearray(1)) + self.check_writes(_read) + + def test_misbehaved_io(self): + BufferedReaderTest.test_misbehaved_io(self) + BufferedWriterTest.test_misbehaved_io(self) + +class CBufferedRandomTest(CBufferedReaderTest, CBufferedWriterTest, BufferedRandomTest): + tp = io.BufferedRandom + + def test_constructor(self): + BufferedRandomTest.test_constructor(self) + # The allocation can succeed on 32-bit builds, e.g. with more + # than 2GB RAM and a 64-bit kernel. + if sys.maxsize > 0x7FFFFFFF: + rawio = self.MockRawIO() + bufio = self.tp(rawio) + self.assertRaises((OverflowError, MemoryError, ValueError), + bufio.__init__, rawio, sys.maxsize) + + def test_garbage_collection(self): + CBufferedReaderTest.test_garbage_collection(self) + CBufferedWriterTest.test_garbage_collection(self) + +class PyBufferedRandomTest(BufferedRandomTest): + tp = pyio.BufferedRandom + + # To fully exercise seek/tell, the StatefulIncrementalDecoder has these # properties: # - A single output character can correspond to many bytes of input. @@ -736,7 +1494,7 @@ 'm--------------.') ] - def testDecoder(self): + def test_decoder(self): # Try a few one-shot test cases. for input, eof, output in self.test_cases: d = StatefulIncrementalDecoder() @@ -752,98 +1510,115 @@ def setUp(self): self.testdata = b"AAA\r\nBBB\rCCC\r\nDDD\nEEE\r\n" self.normalized = b"AAA\nBBB\nCCC\nDDD\nEEE\n".decode("ascii") + support.unlink(support.TESTFN) def tearDown(self): - test_support.unlink(test_support.TESTFN) + support.unlink(support.TESTFN) - def testLineBuffering(self): - r = io.BytesIO() - b = io.BufferedWriter(r, 1000) - t = io.TextIOWrapper(b, newline="\n", line_buffering=True) - t.write(u"X") + def test_constructor(self): + r = self.BytesIO(b"\xc3\xa9\n\n") + b = self.BufferedReader(r, 1000) + t = self.TextIOWrapper(b) + t.__init__(b, encoding="latin1", newline="\r\n") + self.assertEquals(t.encoding, "latin1") + self.assertEquals(t.line_buffering, False) + t.__init__(b, encoding="utf8", line_buffering=True) + self.assertEquals(t.encoding, "utf8") + self.assertEquals(t.line_buffering, True) + self.assertEquals("\xe9\n", t.readline()) + self.assertRaises(TypeError, t.__init__, b, newline=42) + self.assertRaises(ValueError, t.__init__, b, newline='xyzzy') + + def test_detach(self): + r = self.BytesIO() + b = self.BufferedWriter(r) + t = self.TextIOWrapper(b) + self.assertIs(t.detach(), b) + + t = self.TextIOWrapper(b, encoding="ascii") + t.write("howdy") + self.assertFalse(r.getvalue()) + t.detach() + self.assertEqual(r.getvalue(), b"howdy") + self.assertRaises(ValueError, t.detach) + + def test_repr(self): + raw = self.BytesIO("hello".encode("utf-8")) + b = self.BufferedReader(raw) + t = self.TextIOWrapper(b, encoding="utf-8") + modname = self.TextIOWrapper.__module__ + self.assertEqual(repr(t), + "<%s.TextIOWrapper encoding='utf-8'>" % modname) + raw.name = "dummy" + self.assertEqual(repr(t), + "<%s.TextIOWrapper name=u'dummy' encoding='utf-8'>" % modname) + raw.name = b"dummy" + self.assertEqual(repr(t), + "<%s.TextIOWrapper name='dummy' encoding='utf-8'>" % modname) + + def test_line_buffering(self): + r = self.BytesIO() + b = self.BufferedWriter(r, 1000) + t = self.TextIOWrapper(b, newline="\n", line_buffering=True) + t.write("X") self.assertEquals(r.getvalue(), b"") # No flush happened - t.write(u"Y\nZ") + t.write("Y\nZ") self.assertEquals(r.getvalue(), b"XY\nZ") # All got flushed - t.write(u"A\rB") + t.write("A\rB") self.assertEquals(r.getvalue(), b"XY\nZA\rB") - def testEncodingErrorsReading(self): + def test_encoding(self): + # Check the encoding attribute is always set, and valid + b = self.BytesIO() + t = self.TextIOWrapper(b, encoding="utf8") + self.assertEqual(t.encoding, "utf8") + t = self.TextIOWrapper(b) + self.assert_(t.encoding is not None) + codecs.lookup(t.encoding) + + def test_encoding_errors_reading(self): # (1) default - b = io.BytesIO(b"abc\n\xff\n") - t = io.TextIOWrapper(b, encoding="ascii") + b = self.BytesIO(b"abc\n\xff\n") + t = self.TextIOWrapper(b, encoding="ascii") self.assertRaises(UnicodeError, t.read) # (2) explicit strict - b = io.BytesIO(b"abc\n\xff\n") - t = io.TextIOWrapper(b, encoding="ascii", errors="strict") + b = self.BytesIO(b"abc\n\xff\n") + t = self.TextIOWrapper(b, encoding="ascii", errors="strict") self.assertRaises(UnicodeError, t.read) # (3) ignore - b = io.BytesIO(b"abc\n\xff\n") - t = io.TextIOWrapper(b, encoding="ascii", errors="ignore") + b = self.BytesIO(b"abc\n\xff\n") + t = self.TextIOWrapper(b, encoding="ascii", errors="ignore") self.assertEquals(t.read(), "abc\n\n") # (4) replace - b = io.BytesIO(b"abc\n\xff\n") - t = io.TextIOWrapper(b, encoding="ascii", errors="replace") - self.assertEquals(t.read(), u"abc\n\ufffd\n") + b = self.BytesIO(b"abc\n\xff\n") + t = self.TextIOWrapper(b, encoding="ascii", errors="replace") + self.assertEquals(t.read(), "abc\n\ufffd\n") - def testEncodingErrorsWriting(self): + def test_encoding_errors_writing(self): # (1) default - b = io.BytesIO() - t = io.TextIOWrapper(b, encoding="ascii") - self.assertRaises(UnicodeError, t.write, u"\xff") + b = self.BytesIO() + t = self.TextIOWrapper(b, encoding="ascii") + self.assertRaises(UnicodeError, t.write, "\xff") # (2) explicit strict - b = io.BytesIO() - t = io.TextIOWrapper(b, encoding="ascii", errors="strict") - self.assertRaises(UnicodeError, t.write, u"\xff") + b = self.BytesIO() + t = self.TextIOWrapper(b, encoding="ascii", errors="strict") + self.assertRaises(UnicodeError, t.write, "\xff") # (3) ignore - b = io.BytesIO() - t = io.TextIOWrapper(b, encoding="ascii", errors="ignore", + b = self.BytesIO() + t = self.TextIOWrapper(b, encoding="ascii", errors="ignore", newline="\n") - t.write(u"abc\xffdef\n") + t.write("abc\xffdef\n") t.flush() self.assertEquals(b.getvalue(), b"abcdef\n") # (4) replace - b = io.BytesIO() - t = io.TextIOWrapper(b, encoding="ascii", errors="replace", + b = self.BytesIO() + t = self.TextIOWrapper(b, encoding="ascii", errors="replace", newline="\n") - t.write(u"abc\xffdef\n") + t.write("abc\xffdef\n") t.flush() self.assertEquals(b.getvalue(), b"abc?def\n") - def testNewlinesInput(self): - testdata = b"AAA\nBBB\nCCC\rDDD\rEEE\r\nFFF\r\nGGG" - normalized = testdata.replace(b"\r\n", b"\n").replace(b"\r", b"\n") - for newline, expected in [ - (None, normalized.decode("ascii").splitlines(True)), - ("", testdata.decode("ascii").splitlines(True)), - ("\n", ["AAA\n", "BBB\n", "CCC\rDDD\rEEE\r\n", "FFF\r\n", "GGG"]), - ("\r\n", ["AAA\nBBB\nCCC\rDDD\rEEE\r\n", "FFF\r\n", "GGG"]), - ("\r", ["AAA\nBBB\nCCC\r", "DDD\r", "EEE\r", "\nFFF\r", "\nGGG"]), - ]: - buf = io.BytesIO(testdata) - txt = io.TextIOWrapper(buf, encoding="ascii", newline=newline) - self.assertEquals(txt.readlines(), expected) - txt.seek(0) - self.assertEquals(txt.read(), "".join(expected)) - - def testNewlinesOutput(self): - testdict = { - "": b"AAA\nBBB\nCCC\nX\rY\r\nZ", - "\n": b"AAA\nBBB\nCCC\nX\rY\r\nZ", - "\r": b"AAA\rBBB\rCCC\rX\rY\r\rZ", - "\r\n": b"AAA\r\nBBB\r\nCCC\r\nX\rY\r\r\nZ", - } - tests = [(None, testdict[os.linesep])] + sorted(testdict.items()) - for newline, expected in tests: - buf = io.BytesIO() - txt = io.TextIOWrapper(buf, encoding="ascii", newline=newline) - txt.write("AAA\nB") - txt.write("BB\nCCC\n") - txt.write("X\rY\r\nZ") - txt.flush() - self.assertEquals(buf.closed, False) - self.assertEquals(buf.getvalue(), expected) - - def testNewlines(self): + def test_newlines(self): input_lines = [ "unix\n", "windows\r\n", "os9\r", "last\n", "nonl" ] tests = [ @@ -867,8 +1642,8 @@ for do_reads in (False, True): for bufsize in range(1, 10): for newline, exp_lines in tests: - bufio = io.BufferedReader(io.BytesIO(data), bufsize) - textio = io.TextIOWrapper(bufio, newline=newline, + bufio = self.BufferedReader(self.BytesIO(data), bufsize) + textio = self.TextIOWrapper(bufio, newline=newline, encoding=encoding) if do_reads: got_lines = [] @@ -885,75 +1660,117 @@ self.assertEquals(got_line, exp_line) self.assertEquals(len(got_lines), len(exp_lines)) - def testNewlinesInput(self): - testdata = b"AAA\nBBB\nCCC\rDDD\rEEE\r\nFFF\r\nGGG" + def test_newlines_input(self): + testdata = b"AAA\nBB\x00B\nCCC\rDDD\rEEE\r\nFFF\r\nGGG" normalized = testdata.replace(b"\r\n", b"\n").replace(b"\r", b"\n") for newline, expected in [ (None, normalized.decode("ascii").splitlines(True)), ("", testdata.decode("ascii").splitlines(True)), - ("\n", ["AAA\n", "BBB\n", "CCC\rDDD\rEEE\r\n", "FFF\r\n", "GGG"]), - ("\r\n", ["AAA\nBBB\nCCC\rDDD\rEEE\r\n", "FFF\r\n", "GGG"]), - ("\r", ["AAA\nBBB\nCCC\r", "DDD\r", "EEE\r", "\nFFF\r", "\nGGG"]), + ("\n", ["AAA\n", "BB\x00B\n", "CCC\rDDD\rEEE\r\n", "FFF\r\n", "GGG"]), + ("\r\n", ["AAA\nBB\x00B\nCCC\rDDD\rEEE\r\n", "FFF\r\n", "GGG"]), + ("\r", ["AAA\nBB\x00B\nCCC\r", "DDD\r", "EEE\r", "\nFFF\r", "\nGGG"]), ]: - buf = io.BytesIO(testdata) - txt = io.TextIOWrapper(buf, encoding="ascii", newline=newline) + buf = self.BytesIO(testdata) + txt = self.TextIOWrapper(buf, encoding="ascii", newline=newline) self.assertEquals(txt.readlines(), expected) txt.seek(0) self.assertEquals(txt.read(), "".join(expected)) - def testNewlinesOutput(self): - data = u"AAA\nBBB\rCCC\n" - data_lf = b"AAA\nBBB\rCCC\n" - data_cr = b"AAA\rBBB\rCCC\r" - data_crlf = b"AAA\r\nBBB\rCCC\r\n" - save_linesep = os.linesep - try: - for os.linesep, newline, expected in [ - ("\n", None, data_lf), - ("\r\n", None, data_crlf), - ("\n", "", data_lf), - ("\r\n", "", data_lf), - ("\n", "\n", data_lf), - ("\r\n", "\n", data_lf), - ("\n", "\r", data_cr), - ("\r\n", "\r", data_cr), - ("\n", "\r\n", data_crlf), - ("\r\n", "\r\n", data_crlf), - ]: - buf = io.BytesIO() - txt = io.TextIOWrapper(buf, encoding="ascii", newline=newline) - txt.write(data) - txt.close() - self.assertEquals(buf.closed, True) - self.assertRaises(ValueError, buf.getvalue) - finally: - os.linesep = save_linesep + def test_newlines_output(self): + testdict = { + "": b"AAA\nBBB\nCCC\nX\rY\r\nZ", + "\n": b"AAA\nBBB\nCCC\nX\rY\r\nZ", + "\r": b"AAA\rBBB\rCCC\rX\rY\r\rZ", + "\r\n": b"AAA\r\nBBB\r\nCCC\r\nX\rY\r\r\nZ", + } + tests = [(None, testdict[os.linesep])] + sorted(testdict.items()) + for newline, expected in tests: + buf = self.BytesIO() + txt = self.TextIOWrapper(buf, encoding="ascii", newline=newline) + txt.write("AAA\nB") + txt.write("BB\nCCC\n") + txt.write("X\rY\r\nZ") + txt.flush() + self.assertEquals(buf.closed, False) + self.assertEquals(buf.getvalue(), expected) + + def test_destructor(self): + l = [] + base = self.BytesIO + class MyBytesIO(base): + def close(self): + l.append(self.getvalue()) + base.close(self) + b = MyBytesIO() + t = self.TextIOWrapper(b, encoding="ascii") + t.write("abc") + del t + support.gc_collect() + self.assertEquals([b"abc"], l) + + def test_override_destructor(self): + record = [] + class MyTextIO(self.TextIOWrapper): + def __del__(self): + record.append(1) + try: + f = super(MyTextIO, self).__del__ + except AttributeError: + pass + else: + f() + def close(self): + record.append(2) + super(MyTextIO, self).close() + def flush(self): + record.append(3) + super(MyTextIO, self).flush() + b = self.BytesIO() + t = MyTextIO(b, encoding="ascii") + del t + support.gc_collect() + self.assertEqual(record, [1, 2, 3]) + + def test_error_through_destructor(self): + # Test that the exception state is not modified by a destructor, + # even if close() fails. + rawio = self.CloseFailureIO() + def f(): + self.TextIOWrapper(rawio).xyzzy + with support.captured_output("stderr") as s: + self.assertRaises(AttributeError, f) + s = s.getvalue().strip() + if s: + # The destructor *may* have printed an unraisable error, check it + self.assertEqual(len(s.splitlines()), 1) + self.assert_(s.startswith("Exception IOError: "), s) + self.assert_(s.endswith(" ignored"), s) # Systematic tests of the text I/O API - def testBasicIO(self): + def test_basic_io(self): for chunksize in (1, 2, 3, 4, 5, 15, 16, 17, 31, 32, 33, 63, 64, 65): for enc in "ascii", "latin1", "utf8" :# , "utf-16-be", "utf-16-le": - f = io.open(test_support.TESTFN, "w+", encoding=enc) + f = self.open(support.TESTFN, "w+", encoding=enc) f._CHUNK_SIZE = chunksize - self.assertEquals(f.write(u"abc"), 3) + self.assertEquals(f.write("abc"), 3) f.close() - f = io.open(test_support.TESTFN, "r+", encoding=enc) + f = self.open(support.TESTFN, "r+", encoding=enc) f._CHUNK_SIZE = chunksize self.assertEquals(f.tell(), 0) - self.assertEquals(f.read(), u"abc") + self.assertEquals(f.read(), "abc") cookie = f.tell() self.assertEquals(f.seek(0), 0) - self.assertEquals(f.read(2), u"ab") - self.assertEquals(f.read(1), u"c") - self.assertEquals(f.read(1), u"") - self.assertEquals(f.read(), u"") + self.assertEquals(f.read(2), "ab") + self.assertEquals(f.read(1), "c") + self.assertEquals(f.read(1), "") + self.assertEquals(f.read(), "") self.assertEquals(f.tell(), cookie) self.assertEquals(f.seek(0), 0) self.assertEquals(f.seek(0, 2), cookie) - self.assertEquals(f.write(u"def"), 3) + self.assertEquals(f.write("def"), 3) self.assertEquals(f.seek(cookie), cookie) - self.assertEquals(f.read(), u"def") + self.assertEquals(f.read(), "def") if enc.startswith("utf"): self.multi_line_test(f, enc) f.close() @@ -961,13 +1778,13 @@ def multi_line_test(self, f, enc): f.seek(0) f.truncate() - sample = u"s\xff\u0fff\uffff" + sample = "s\xff\u0fff\uffff" wlines = [] for size in (0, 1, 2, 3, 4, 5, 30, 31, 32, 33, 62, 63, 64, 65, 1000): chars = [] for i in range(size): chars.append(sample[i % len(sample)]) - line = u"".join(chars) + u"\n" + line = "".join(chars) + "\n" wlines.append((f.tell(), line)) f.write(line) f.seek(0) @@ -980,28 +1797,28 @@ rlines.append((pos, line)) self.assertEquals(rlines, wlines) - def testTelling(self): - f = io.open(test_support.TESTFN, "w+", encoding="utf8") + def test_telling(self): + f = self.open(support.TESTFN, "w+", encoding="utf8") p0 = f.tell() - f.write(u"\xff\n") + f.write("\xff\n") p1 = f.tell() - f.write(u"\xff\n") + f.write("\xff\n") p2 = f.tell() f.seek(0) self.assertEquals(f.tell(), p0) - self.assertEquals(f.readline(), u"\xff\n") + self.assertEquals(f.readline(), "\xff\n") self.assertEquals(f.tell(), p1) - self.assertEquals(f.readline(), u"\xff\n") + self.assertEquals(f.readline(), "\xff\n") self.assertEquals(f.tell(), p2) f.seek(0) for line in f: - self.assertEquals(line, u"\xff\n") + self.assertEquals(line, "\xff\n") self.assertRaises(IOError, f.tell) self.assertEquals(f.tell(), p2) f.close() - def testSeeking(self): - chunk_size = io.TextIOWrapper._CHUNK_SIZE + def test_seeking(self): + chunk_size = _default_chunk_size() prefix_size = chunk_size - 2 u_prefix = "a" * prefix_size prefix = bytes(u_prefix.encode("utf-8")) @@ -1009,43 +1826,46 @@ u_suffix = "\u8888\n" suffix = bytes(u_suffix.encode("utf-8")) line = prefix + suffix - f = io.open(test_support.TESTFN, "wb") + f = self.open(support.TESTFN, "wb") f.write(line*2) f.close() - f = io.open(test_support.TESTFN, "r", encoding="utf-8") + f = self.open(support.TESTFN, "r", encoding="utf-8") s = f.read(prefix_size) - self.assertEquals(s, unicode(prefix, "ascii")) + self.assertEquals(s, prefix.decode("ascii")) self.assertEquals(f.tell(), prefix_size) self.assertEquals(f.readline(), u_suffix) - def testSeekingToo(self): + def test_seeking_too(self): # Regression test for a specific bug data = b'\xe0\xbf\xbf\n' - f = io.open(test_support.TESTFN, "wb") + f = self.open(support.TESTFN, "wb") f.write(data) f.close() - f = io.open(test_support.TESTFN, "r", encoding="utf-8") + f = self.open(support.TESTFN, "r", encoding="utf-8") f._CHUNK_SIZE # Just test that it exists f._CHUNK_SIZE = 2 f.readline() f.tell() - def testSeekAndTell(self): - """Test seek/tell using the StatefulIncrementalDecoder.""" + def test_seek_and_tell(self): + #Test seek/tell using the StatefulIncrementalDecoder. + # Make test faster by doing smaller seeks + CHUNK_SIZE = 128 - def testSeekAndTellWithData(data, min_pos=0): + def test_seek_and_tell_with_data(data, min_pos=0): """Tell/seek to various points within a data stream and ensure that the decoded data returned by read() is consistent.""" - f = io.open(test_support.TESTFN, 'wb') + f = self.open(support.TESTFN, 'wb') f.write(data) f.close() - f = io.open(test_support.TESTFN, encoding='test_decoder') + f = self.open(support.TESTFN, encoding='test_decoder') + f._CHUNK_SIZE = CHUNK_SIZE decoded = f.read() f.close() for i in range(min_pos, len(decoded) + 1): # seek positions for j in [1, 5, len(decoded) - i]: # read lengths - f = io.open(test_support.TESTFN, encoding='test_decoder') + f = self.open(support.TESTFN, encoding='test_decoder') self.assertEquals(f.read(i), decoded[:i]) cookie = f.tell() self.assertEquals(f.read(j), decoded[i:i + j]) @@ -1060,23 +1880,22 @@ try: # Try each test case. for input, _, _ in StatefulIncrementalDecoderTest.test_cases: - testSeekAndTellWithData(input) + test_seek_and_tell_with_data(input) # Position each test case so that it crosses a chunk boundary. - CHUNK_SIZE = io.TextIOWrapper._CHUNK_SIZE for input, _, _ in StatefulIncrementalDecoderTest.test_cases: offset = CHUNK_SIZE - len(input)//2 prefix = b'.'*offset # Don't bother seeking into the prefix (takes too long). min_pos = offset*2 - testSeekAndTellWithData(prefix + input, min_pos) + test_seek_and_tell_with_data(prefix + input, min_pos) # Ensure our test decoder won't interfere with subsequent tests. finally: StatefulIncrementalDecoder.codecEnabled = 0 - def testEncodedWrites(self): - data = u"1234567890" + def test_encoded_writes(self): + data = "1234567890" tests = ("utf-16", "utf-16-le", "utf-16-be", @@ -1084,54 +1903,26 @@ "utf-32-le", "utf-32-be") for encoding in tests: - buf = io.BytesIO() - f = io.TextIOWrapper(buf, encoding=encoding) + buf = self.BytesIO() + f = self.TextIOWrapper(buf, encoding=encoding) # Check if the BOM is written only once (see issue1753). f.write(data) f.write(data) f.seek(0) self.assertEquals(f.read(), data * 2) + f.seek(0) + self.assertEquals(f.read(), data * 2) self.assertEquals(buf.getvalue(), (data * 2).encode(encoding)) - def timingTest(self): - timer = time.time - enc = "utf8" - line = "\0\x0f\xff\u0fff\uffff\U000fffff\U0010ffff"*3 + "\n" - nlines = 10000 - nchars = len(line) - nbytes = len(line.encode(enc)) - for chunk_size in (32, 64, 128, 256): - f = io.open(test_support.TESTFN, "w+", encoding=enc) - f._CHUNK_SIZE = chunk_size - t0 = timer() - for i in range(nlines): - f.write(line) - f.flush() - t1 = timer() - f.seek(0) - for line in f: - pass - t2 = timer() - f.seek(0) - while f.readline(): - pass - t3 = timer() - f.seek(0) - while f.readline(): - f.tell() - t4 = timer() - f.close() - if test_support.verbose: - print("\nTiming test: %d lines of %d characters (%d bytes)" % - (nlines, nchars, nbytes)) - print("File chunk size: %6s" % f._CHUNK_SIZE) - print("Writing: %6.3f seconds" % (t1-t0)) - print("Reading using iteration: %6.3f seconds" % (t2-t1)) - print("Reading using readline(): %6.3f seconds" % (t3-t2)) - print("Using readline()+tell(): %6.3f seconds" % (t4-t3)) + def test_unreadable(self): + class UnReadable(self.BytesIO): + def readable(self): + return False + txt = self.TextIOWrapper(UnReadable()) + self.assertRaises(IOError, txt.read) - def testReadOneByOne(self): - txt = io.TextIOWrapper(io.BytesIO(b"AA\r\nBB")) + def test_read_one_by_one(self): + txt = self.TextIOWrapper(self.BytesIO(b"AA\r\nBB")) reads = "" while True: c = txt.read(1) @@ -1141,9 +1932,9 @@ self.assertEquals(reads, "AA\nBB") # read in amounts equal to TextIOWrapper._CHUNK_SIZE which is 128. - def testReadByChunk(self): + def test_read_by_chunk(self): # make sure "\r\n" straddles 128 char boundary. - txt = io.TextIOWrapper(io.BytesIO(b"A" * 127 + b"\r\nB")) + txt = self.TextIOWrapper(self.BytesIO(b"A" * 127 + b"\r\nB")) reads = "" while True: c = txt.read(128) @@ -1153,7 +1944,7 @@ self.assertEquals(reads, "A"*127+"\nB") def test_issue1395_1(self): - txt = io.TextIOWrapper(io.BytesIO(self.testdata), encoding="ascii") + txt = self.TextIOWrapper(self.BytesIO(self.testdata), encoding="ascii") # read one char at a time reads = "" @@ -1165,7 +1956,7 @@ self.assertEquals(reads, self.normalized) def test_issue1395_2(self): - txt = io.TextIOWrapper(io.BytesIO(self.testdata), encoding="ascii") + txt = self.TextIOWrapper(self.BytesIO(self.testdata), encoding="ascii") txt._CHUNK_SIZE = 4 reads = "" @@ -1177,7 +1968,7 @@ self.assertEquals(reads, self.normalized) def test_issue1395_3(self): - txt = io.TextIOWrapper(io.BytesIO(self.testdata), encoding="ascii") + txt = self.TextIOWrapper(self.BytesIO(self.testdata), encoding="ascii") txt._CHUNK_SIZE = 4 reads = txt.read(4) @@ -1188,7 +1979,7 @@ self.assertEquals(reads, self.normalized) def test_issue1395_4(self): - txt = io.TextIOWrapper(io.BytesIO(self.testdata), encoding="ascii") + txt = self.TextIOWrapper(self.BytesIO(self.testdata), encoding="ascii") txt._CHUNK_SIZE = 4 reads = txt.read(4) @@ -1196,7 +1987,7 @@ self.assertEquals(reads, self.normalized) def test_issue1395_5(self): - txt = io.TextIOWrapper(io.BytesIO(self.testdata), encoding="ascii") + txt = self.TextIOWrapper(self.BytesIO(self.testdata), encoding="ascii") txt._CHUNK_SIZE = 4 reads = txt.read(4) @@ -1206,12 +1997,84 @@ self.assertEquals(txt.read(4), "BBB\n") def test_issue2282(self): - buffer = io.BytesIO(self.testdata) - txt = io.TextIOWrapper(buffer, encoding="ascii") + buffer = self.BytesIO(self.testdata) + txt = self.TextIOWrapper(buffer, encoding="ascii") self.assertEqual(buffer.seekable(), txt.seekable()) - def check_newline_decoder_utf8(self, decoder): + @unittest.skip("Issue #6213 with incremental encoders") + def test_append_bom(self): + # The BOM is not written again when appending to a non-empty file + filename = support.TESTFN + for charset in ('utf-8-sig', 'utf-16', 'utf-32'): + with self.open(filename, 'w', encoding=charset) as f: + f.write('aaa') + pos = f.tell() + with self.open(filename, 'rb') as f: + self.assertEquals(f.read(), 'aaa'.encode(charset)) + + with self.open(filename, 'a', encoding=charset) as f: + f.write('xxx') + with self.open(filename, 'rb') as f: + self.assertEquals(f.read(), 'aaaxxx'.encode(charset)) + + @unittest.skip("Issue #6213 with incremental encoders") + def test_seek_bom(self): + # Same test, but when seeking manually + filename = support.TESTFN + for charset in ('utf-8-sig', 'utf-16', 'utf-32'): + with self.open(filename, 'w', encoding=charset) as f: + f.write('aaa') + pos = f.tell() + with self.open(filename, 'r+', encoding=charset) as f: + f.seek(pos) + f.write('zzz') + f.seek(0) + f.write('bbb') + with self.open(filename, 'rb') as f: + self.assertEquals(f.read(), 'bbbzzz'.encode(charset)) + + def test_errors_property(self): + with self.open(support.TESTFN, "w") as f: + self.assertEqual(f.errors, "strict") + with self.open(support.TESTFN, "w", errors="replace") as f: + self.assertEqual(f.errors, "replace") + + +class CTextIOWrapperTest(TextIOWrapperTest): + + def test_initialization(self): + r = self.BytesIO(b"\xc3\xa9\n\n") + b = self.BufferedReader(r, 1000) + t = self.TextIOWrapper(b) + self.assertRaises(TypeError, t.__init__, b, newline=42) + self.assertRaises(ValueError, t.read) + self.assertRaises(ValueError, t.__init__, b, newline='xyzzy') + self.assertRaises(ValueError, t.read) + + def test_garbage_collection(self): + # C TextIOWrapper objects are collected, and collecting them flushes + # all data to disk. + # The Python version has __del__, so it ends in gc.garbage instead. + rawio = io.FileIO(support.TESTFN, "wb") + b = self.BufferedWriter(rawio) + t = self.TextIOWrapper(b, encoding="ascii") + t.write("456def") + t.x = t + wr = weakref.ref(t) + del t + support.gc_collect() + self.assert_(wr() is None, wr) + with open(support.TESTFN, "rb") as f: + self.assertEqual(f.read(), b"456def") + +class PyTextIOWrapperTest(TextIOWrapperTest): + pass + + +class IncrementalNewlineDecoderTest(unittest.TestCase): + + def check_newline_decoding_utf8(self, decoder): # UTF-8 specific tests for a newline decoder def _check_decode(b, s, **kwargs): # We exercise getstate() / setstate() as well as decode() @@ -1253,12 +2116,20 @@ _check_decode(b'\xe8\xa2\x88\r', "\u8888") _check_decode(b'\n', "\n") - def check_newline_decoder(self, decoder, encoding): + def check_newline_decoding(self, decoder, encoding): result = [] - encoder = codecs.getincrementalencoder(encoding)() - def _decode_bytewise(s): - for b in encoder.encode(s): - result.append(decoder.decode(b)) + if encoding is not None: + encoder = codecs.getincrementalencoder(encoding)() + def _decode_bytewise(s): + # Decode one byte at a time + for b in encoder.encode(s): + result.append(decoder.decode(b)) + else: + encoder = None + def _decode_bytewise(s): + # Decode one char at a time + for c in s: + result.append(decoder.decode(c)) self.assertEquals(decoder.newlines, None) _decode_bytewise("abc\n\r") self.assertEquals(decoder.newlines, '\n') @@ -1271,22 +2142,47 @@ _decode_bytewise("abc\r") self.assertEquals("".join(result), "abc\n\nabcabc\nabcabc") decoder.reset() - self.assertEquals(decoder.decode("abc".encode(encoding)), "abc") + input = "abc" + if encoder is not None: + encoder.reset() + input = encoder.encode(input) + self.assertEquals(decoder.decode(input), "abc") self.assertEquals(decoder.newlines, None) def test_newline_decoder(self): encodings = ( - 'utf-8', 'latin-1', + # None meaning the IncrementalNewlineDecoder takes unicode input + # rather than bytes input + None, 'utf-8', 'latin-1', 'utf-16', 'utf-16-le', 'utf-16-be', 'utf-32', 'utf-32-le', 'utf-32-be', ) for enc in encodings: - decoder = codecs.getincrementaldecoder(enc)() - decoder = io.IncrementalNewlineDecoder(decoder, translate=True) - self.check_newline_decoder(decoder, enc) + decoder = enc and codecs.getincrementaldecoder(enc)() + decoder = self.IncrementalNewlineDecoder(decoder, translate=True) + self.check_newline_decoding(decoder, enc) decoder = codecs.getincrementaldecoder("utf-8")() - decoder = io.IncrementalNewlineDecoder(decoder, translate=True) - self.check_newline_decoder_utf8(decoder) + decoder = self.IncrementalNewlineDecoder(decoder, translate=True) + self.check_newline_decoding_utf8(decoder) + + def test_newline_bytes(self): + # Issue 5433: Excessive optimization in IncrementalNewlineDecoder + def _check(dec): + self.assertEquals(dec.newlines, None) + self.assertEquals(dec.decode("\u0D00"), "\u0D00") + self.assertEquals(dec.newlines, None) + self.assertEquals(dec.decode("\u0A00"), "\u0A00") + self.assertEquals(dec.newlines, None) + dec = self.IncrementalNewlineDecoder(None, translate=False) + _check(dec) + dec = self.IncrementalNewlineDecoder(None, translate=True) + _check(dec) + +class CIncrementalNewlineDecoderTest(IncrementalNewlineDecoderTest): + pass + +class PyIncrementalNewlineDecoderTest(IncrementalNewlineDecoderTest): + pass # XXX Tests for open() @@ -1294,40 +2190,39 @@ class MiscIOTest(unittest.TestCase): def tearDown(self): - test_support.unlink(test_support.TESTFN) + support.unlink(support.TESTFN) - def testImport__all__(self): - for name in io.__all__: - obj = getattr(io, name, None) + def test___all__(self): + for name in self.io.__all__: + obj = getattr(self.io, name, None) self.assertTrue(obj is not None, name) if name == "open": continue - elif "error" in name.lower(): + elif "error" in name.lower() or name == "UnsupportedOperation": self.assertTrue(issubclass(obj, Exception), name) elif not name.startswith("SEEK_"): - self.assertTrue(issubclass(obj, io.IOBase)) - + self.assertTrue(issubclass(obj, self.IOBase)) def test_attributes(self): - f = io.open(test_support.TESTFN, "wb", buffering=0) + f = self.open(support.TESTFN, "wb", buffering=0) self.assertEquals(f.mode, "wb") f.close() - f = io.open(test_support.TESTFN, "U") - self.assertEquals(f.name, test_support.TESTFN) - self.assertEquals(f.buffer.name, test_support.TESTFN) - self.assertEquals(f.buffer.raw.name, test_support.TESTFN) + f = self.open(support.TESTFN, "U") + self.assertEquals(f.name, support.TESTFN) + self.assertEquals(f.buffer.name, support.TESTFN) + self.assertEquals(f.buffer.raw.name, support.TESTFN) self.assertEquals(f.mode, "U") self.assertEquals(f.buffer.mode, "rb") self.assertEquals(f.buffer.raw.mode, "rb") f.close() - f = io.open(test_support.TESTFN, "w+") + f = self.open(support.TESTFN, "w+") self.assertEquals(f.mode, "w+") self.assertEquals(f.buffer.mode, "rb+") # Does it really matter? self.assertEquals(f.buffer.raw.mode, "rb+") - g = io.open(f.fileno(), "wb", closefd=False) + g = self.open(f.fileno(), "wb", closefd=False) self.assertEquals(g.mode, "wb") self.assertEquals(g.raw.mode, "wb") self.assertEquals(g.name, f.fileno()) @@ -1335,13 +2230,138 @@ f.close() g.close() + def test_io_after_close(self): + for kwargs in [ + {"mode": "w"}, + {"mode": "wb"}, + {"mode": "w", "buffering": 1}, + {"mode": "w", "buffering": 2}, + {"mode": "wb", "buffering": 0}, + {"mode": "r"}, + {"mode": "rb"}, + {"mode": "r", "buffering": 1}, + {"mode": "r", "buffering": 2}, + {"mode": "rb", "buffering": 0}, + {"mode": "w+"}, + {"mode": "w+b"}, + {"mode": "w+", "buffering": 1}, + {"mode": "w+", "buffering": 2}, + {"mode": "w+b", "buffering": 0}, + ]: + f = self.open(support.TESTFN, **kwargs) + f.close() + self.assertRaises(ValueError, f.flush) + self.assertRaises(ValueError, f.fileno) + self.assertRaises(ValueError, f.isatty) + self.assertRaises(ValueError, f.__iter__) + if hasattr(f, "peek"): + self.assertRaises(ValueError, f.peek, 1) + self.assertRaises(ValueError, f.read) + if hasattr(f, "read1"): + self.assertRaises(ValueError, f.read1, 1024) + if hasattr(f, "readinto"): + self.assertRaises(ValueError, f.readinto, bytearray(1024)) + self.assertRaises(ValueError, f.readline) + self.assertRaises(ValueError, f.readlines) + self.assertRaises(ValueError, f.seek, 0) + self.assertRaises(ValueError, f.tell) + self.assertRaises(ValueError, f.truncate) + self.assertRaises(ValueError, f.write, + b"" if "b" in kwargs['mode'] else "") + self.assertRaises(ValueError, f.writelines, []) + self.assertRaises(ValueError, next, f) + + def test_blockingioerror(self): + # Various BlockingIOError issues + self.assertRaises(TypeError, self.BlockingIOError) + self.assertRaises(TypeError, self.BlockingIOError, 1) + self.assertRaises(TypeError, self.BlockingIOError, 1, 2, 3, 4) + self.assertRaises(TypeError, self.BlockingIOError, 1, "", None) + b = self.BlockingIOError(1, "") + self.assertEqual(b.characters_written, 0) + class C(unicode): + pass + c = C("") + b = self.BlockingIOError(1, c) + c.b = b + b.c = c + wr = weakref.ref(c) + del c, b + support.gc_collect() + self.assert_(wr() is None, wr) + + def test_abcs(self): + # Test the visible base classes are ABCs. + self.assertTrue(isinstance(self.IOBase, abc.ABCMeta)) + self.assertTrue(isinstance(self.RawIOBase, abc.ABCMeta)) + self.assertTrue(isinstance(self.BufferedIOBase, abc.ABCMeta)) + self.assertTrue(isinstance(self.TextIOBase, abc.ABCMeta)) + + def _check_abc_inheritance(self, abcmodule): + with self.open(support.TESTFN, "wb", buffering=0) as f: + self.assertTrue(isinstance(f, abcmodule.IOBase)) + self.assertTrue(isinstance(f, abcmodule.RawIOBase)) + self.assertFalse(isinstance(f, abcmodule.BufferedIOBase)) + self.assertFalse(isinstance(f, abcmodule.TextIOBase)) + with self.open(support.TESTFN, "wb") as f: + self.assertTrue(isinstance(f, abcmodule.IOBase)) + self.assertFalse(isinstance(f, abcmodule.RawIOBase)) + self.assertTrue(isinstance(f, abcmodule.BufferedIOBase)) + self.assertFalse(isinstance(f, abcmodule.TextIOBase)) + with self.open(support.TESTFN, "w") as f: + self.assertTrue(isinstance(f, abcmodule.IOBase)) + self.assertFalse(isinstance(f, abcmodule.RawIOBase)) + self.assertFalse(isinstance(f, abcmodule.BufferedIOBase)) + self.assertTrue(isinstance(f, abcmodule.TextIOBase)) + + def test_abc_inheritance(self): + # Test implementations inherit from their respective ABCs + self._check_abc_inheritance(self) + + def test_abc_inheritance_official(self): + # Test implementations inherit from the official ABCs of the + # baseline "io" module. + self._check_abc_inheritance(io) + +class CMiscIOTest(MiscIOTest): + io = io + +class PyMiscIOTest(MiscIOTest): + io = pyio def test_main(): - test_support.run_unittest(IOTest, BytesIOTest, StringIOTest, - BufferedReaderTest, BufferedWriterTest, - BufferedRWPairTest, BufferedRandomTest, - StatefulIncrementalDecoderTest, - TextIOWrapperTest, MiscIOTest) + tests = (CIOTest, PyIOTest, + CBufferedReaderTest, PyBufferedReaderTest, + CBufferedWriterTest, PyBufferedWriterTest, + CBufferedRWPairTest, PyBufferedRWPairTest, + CBufferedRandomTest, PyBufferedRandomTest, + StatefulIncrementalDecoderTest, + CIncrementalNewlineDecoderTest, PyIncrementalNewlineDecoderTest, + CTextIOWrapperTest, PyTextIOWrapperTest, + CMiscIOTest, PyMiscIOTest, + ) + + # Put the namespaces of the IO module we are testing and some useful mock + # classes in the __dict__ of each test. + mocks = (MockRawIO, MisbehavedRawIO, MockFileIO, CloseFailureIO, + MockNonBlockWriterIO) + all_members = io.__all__ + ["IncrementalNewlineDecoder"] + c_io_ns = dict((name, getattr(io, name)) for name in all_members) + py_io_ns = dict((name, getattr(pyio, name)) for name in all_members) + globs = globals() + c_io_ns.update((x.__name__, globs["C" + x.__name__]) for x in mocks) + py_io_ns.update((x.__name__, globs["Py" + x.__name__]) for x in mocks) + # Avoid turning open into a bound method. + py_io_ns["open"] = pyio.OpenWrapper + for test in tests: + if test.__name__.startswith("C"): + for name, obj in c_io_ns.items(): + setattr(test, name, obj) + elif test.__name__.startswith("Py"): + for name, obj in py_io_ns.items(): + setattr(test, name, obj) + + support.run_unittest(*tests) if __name__ == "__main__": - unittest.main() + test_main() Modified: python/trunk/Lib/test/test_largefile.py ============================================================================== --- python/trunk/Lib/test/test_largefile.py (original) +++ python/trunk/Lib/test/test_largefile.py Fri Jun 12 22:14:08 2009 @@ -1,12 +1,16 @@ """Test largefile support on system where this makes sense. """ +from __future__ import print_function + import os import stat import sys import unittest from test.test_support import run_unittest, TESTFN, verbose, requires, \ unlink +import io # C implementation of io +import _pyio as pyio # Python implementation of io try: import signal @@ -18,10 +22,10 @@ pass # create >2GB file (2GB = 2147483648 bytes) -size = 2500000000L +size = 2500000000 -class TestCase(unittest.TestCase): +class LargeFileTest(unittest.TestCase): """Test that each file function works as expected for a large (i.e. > 2GB, do we have to check > 4GB) files. @@ -33,28 +37,28 @@ def test_seek(self): if verbose: - print 'create large file via seek (may be sparse file) ...' - with open(TESTFN, 'wb') as f: - f.write('z') + print('create large file via seek (may be sparse file) ...') + with self.open(TESTFN, 'wb') as f: + f.write(b'z') f.seek(0) f.seek(size) - f.write('a') + f.write(b'a') f.flush() if verbose: - print 'check file size with os.fstat' + print('check file size with os.fstat') self.assertEqual(os.fstat(f.fileno())[stat.ST_SIZE], size+1) def test_osstat(self): if verbose: - print 'check file size with os.stat' + print('check file size with os.stat') self.assertEqual(os.stat(TESTFN)[stat.ST_SIZE], size+1) def test_seek_read(self): if verbose: - print 'play around with seek() and read() with the built largefile' - with open(TESTFN, 'rb') as f: + print('play around with seek() and read() with the built largefile') + with self.open(TESTFN, 'rb') as f: self.assertEqual(f.tell(), 0) - self.assertEqual(f.read(1), 'z') + self.assertEqual(f.read(1), b'z') self.assertEqual(f.tell(), 1) f.seek(0) self.assertEqual(f.tell(), 0) @@ -77,15 +81,15 @@ f.seek(size) self.assertEqual(f.tell(), size) # the 'a' that was written at the end of file above - self.assertEqual(f.read(1), 'a') + self.assertEqual(f.read(1), b'a') f.seek(-size-1, 1) - self.assertEqual(f.read(1), 'z') + self.assertEqual(f.read(1), b'z') self.assertEqual(f.tell(), 1) def test_lseek(self): if verbose: - print 'play around with os.lseek() with the built largefile' - with open(TESTFN, 'rb') as f: + print('play around with os.lseek() with the built largefile') + with self.open(TESTFN, 'rb') as f: self.assertEqual(os.lseek(f.fileno(), 0, 0), 0) self.assertEqual(os.lseek(f.fileno(), 42, 0), 42) self.assertEqual(os.lseek(f.fileno(), 42, 1), 84) @@ -95,16 +99,16 @@ self.assertEqual(os.lseek(f.fileno(), -size-1, 2), 0) self.assertEqual(os.lseek(f.fileno(), size, 0), size) # the 'a' that was written at the end of file above - self.assertEqual(f.read(1), 'a') + self.assertEqual(f.read(1), b'a') def test_truncate(self): if verbose: - print 'try truncate' - with open(TESTFN, 'r+b') as f: + print('try truncate') + with self.open(TESTFN, 'r+b') as f: # this is already decided before start running the test suite # but we do it anyway for extra protection if not hasattr(f, 'truncate'): - raise unittest.SkipTest, "open().truncate() not available on this system" + raise unittest.SkipTest("open().truncate() not available on this system") f.seek(0, 2) # else we've lost track of the true size self.assertEqual(f.tell(), size+1) @@ -120,17 +124,25 @@ newsize -= 1 f.seek(42) f.truncate(newsize) - self.assertEqual(f.tell(), 42) # else pointer moved - f.seek(0, 2) self.assertEqual(f.tell(), newsize) # else wasn't truncated - + f.seek(0, 2) + self.assertEqual(f.tell(), newsize) # XXX truncate(larger than true size) is ill-defined # across platform; cut it waaaaay back f.seek(0) f.truncate(1) - self.assertEqual(f.tell(), 0) # else pointer moved + self.assertEqual(f.tell(), 1) # else pointer moved + f.seek(0) self.assertEqual(len(f.read()), 1) # else wasn't truncated + def test_seekable(self): + # Issue #5016; seekable() can return False when the current position + # is negative when truncated to an int. + for pos in (2**31-1, 2**31, 2**31+1): + with self.open(TESTFN, 'rb') as f: + f.seek(pos) + self.assert_(f.seekable()) + def test_main(): # On Windows and Mac OSX this test comsumes large resources; It @@ -144,34 +156,39 @@ # Only run if the current filesystem supports large files. # (Skip this test on Windows, since we now always support # large files.) - f = open(TESTFN, 'wb') + f = open(TESTFN, 'wb', buffering=0) try: # 2**31 == 2147483648 - f.seek(2147483649L) + f.seek(2147483649) # Seeking is not enough of a test: you must write and # flush, too! - f.write("x") + f.write(b'x') f.flush() except (IOError, OverflowError): f.close() unlink(TESTFN) - raise unittest.SkipTest, "filesystem does not have largefile support" + raise unittest.SkipTest("filesystem does not have largefile support") else: f.close() suite = unittest.TestSuite() - suite.addTest(TestCase('test_seek')) - suite.addTest(TestCase('test_osstat')) - suite.addTest(TestCase('test_seek_read')) - suite.addTest(TestCase('test_lseek')) - with open(TESTFN, 'w') as f: - if hasattr(f, 'truncate'): - suite.addTest(TestCase('test_truncate')) - unlink(TESTFN) + for _open, prefix in [(io.open, 'C'), (pyio.open, 'Py')]: + class TestCase(LargeFileTest): + pass + TestCase.open = staticmethod(_open) + TestCase.__name__ = prefix + LargeFileTest.__name__ + suite.addTest(TestCase('test_seek')) + suite.addTest(TestCase('test_osstat')) + suite.addTest(TestCase('test_seek_read')) + suite.addTest(TestCase('test_lseek')) + with _open(TESTFN, 'wb') as f: + if hasattr(f, 'truncate'): + suite.addTest(TestCase('test_truncate')) + suite.addTest(TestCase('test_seekable')) + unlink(TESTFN) try: run_unittest(suite) finally: unlink(TESTFN) - if __name__ == '__main__': test_main() Modified: python/trunk/Lib/test/test_memoryio.py ============================================================================== --- python/trunk/Lib/test/test_memoryio.py (original) +++ python/trunk/Lib/test/test_memoryio.py Fri Jun 12 22:14:08 2009 @@ -4,23 +4,66 @@ """ from __future__ import unicode_literals +from __future__ import print_function import unittest -from test import test_support +from test import test_support as support import io +import _pyio as pyio import sys -import array -try: - import _bytesio - has_c_implementation = True -except ImportError: - has_c_implementation = False +class MemorySeekTestMixin: + + def testInit(self): + buf = self.buftype("1234567890") + bytesIo = self.ioclass(buf) + + def testRead(self): + buf = self.buftype("1234567890") + bytesIo = self.ioclass(buf) + + self.assertEquals(buf[:1], bytesIo.read(1)) + self.assertEquals(buf[1:5], bytesIo.read(4)) + self.assertEquals(buf[5:], bytesIo.read(900)) + self.assertEquals(self.EOF, bytesIo.read()) + + def testReadNoArgs(self): + buf = self.buftype("1234567890") + bytesIo = self.ioclass(buf) + + self.assertEquals(buf, bytesIo.read()) + self.assertEquals(self.EOF, bytesIo.read()) + + def testSeek(self): + buf = self.buftype("1234567890") + bytesIo = self.ioclass(buf) + + bytesIo.read(5) + bytesIo.seek(0) + self.assertEquals(buf, bytesIo.read()) + + bytesIo.seek(3) + self.assertEquals(buf[3:], bytesIo.read()) + self.assertRaises(TypeError, bytesIo.seek, 0.0) + + def testTell(self): + buf = self.buftype("1234567890") + bytesIo = self.ioclass(buf) + + self.assertEquals(0, bytesIo.tell()) + bytesIo.seek(5) + self.assertEquals(5, bytesIo.tell()) + bytesIo.seek(10000) + self.assertEquals(10000, bytesIo.tell()) class MemoryTestMixin: + def test_detach(self): + buf = self.ioclass() + self.assertRaises(self.UnsupportedOperation, buf.detach) + def write_ops(self, f, t): self.assertEqual(f.write(t("blah.")), 5) self.assertEqual(f.seek(0), 0) @@ -151,7 +194,7 @@ self.assertEqual(memio.readline(), self.EOF) memio.seek(0) self.assertEqual(type(memio.readline()), type(buf)) - self.assertEqual(memio.readline(None), buf) + self.assertEqual(memio.readline(), buf) self.assertRaises(TypeError, memio.readline, '') memio.close() self.assertRaises(ValueError, memio.readline) @@ -197,7 +240,7 @@ self.assertEqual(i, 10) memio = self.ioclass(buf * 2) memio.close() - self.assertRaises(ValueError, memio.next) + self.assertRaises(ValueError, next, memio) def test_getvalue(self): buf = self.buftype("1234567890") @@ -299,11 +342,14 @@ self.assertEqual(test2(), buf) -class PyBytesIOTest(MemoryTestMixin, unittest.TestCase): +class PyBytesIOTest(MemoryTestMixin, MemorySeekTestMixin, unittest.TestCase): + + UnsupportedOperation = pyio.UnsupportedOperation + @staticmethod def buftype(s): return s.encode("ascii") - ioclass = io._BytesIO + ioclass = pyio.BytesIO EOF = b"" def test_read1(self): @@ -333,7 +379,8 @@ self.assertEqual(memio.readinto(b), 0) self.assertEqual(b, b"") self.assertRaises(TypeError, memio.readinto, '') - a = array.array(b'b', map(ord, b"hello world")) + import array + a = array.array(b'b', b"hello world") memio = self.ioclass(buf) memio.readinto(a) self.assertEqual(a.tostring(), b"1234567890d") @@ -365,19 +412,41 @@ def test_bytes_array(self): buf = b"1234567890" - - a = array.array(b'b', map(ord, buf)) + import array + a = array.array(b'b', buf) memio = self.ioclass(a) self.assertEqual(memio.getvalue(), buf) self.assertEqual(memio.write(a), 10) self.assertEqual(memio.getvalue(), buf) -class PyStringIOTest(MemoryTestMixin, unittest.TestCase): +class PyStringIOTest(MemoryTestMixin, MemorySeekTestMixin, unittest.TestCase): buftype = unicode - ioclass = io.StringIO + ioclass = pyio.StringIO + UnsupportedOperation = pyio.UnsupportedOperation EOF = "" + # TextIO-specific behaviour. + + def test_newlines_property(self): + memio = self.ioclass(newline=None) + # The C StringIO decodes newlines in write() calls, but the Python + # implementation only does when reading. This function forces them to + # be decoded for testing. + def force_decode(): + memio.seek(0) + memio.read() + self.assertEqual(memio.newlines, None) + memio.write("a\n") + force_decode() + self.assertEqual(memio.newlines, "\n") + memio.write("b\r\n") + force_decode() + self.assertEqual(memio.newlines, ("\n", "\r\n")) + memio.write("c\rd") + force_decode() + self.assertEqual(memio.newlines, ("\r", "\n", "\r\n")) + def test_relative_seek(self): memio = self.ioclass() @@ -388,29 +457,107 @@ self.assertRaises(IOError, memio.seek, 1, 1) self.assertRaises(IOError, memio.seek, 1, 2) + def test_textio_properties(self): + memio = self.ioclass() + + # These are just dummy values but we nevertheless check them for fear + # of unexpected breakage. + self.assertIsNone(memio.encoding) + self.assertIsNone(memio.errors) + self.assertFalse(memio.line_buffering) + + def test_newline_none(self): + # newline=None + memio = self.ioclass("a\nb\r\nc\rd", newline=None) + self.assertEqual(list(memio), ["a\n", "b\n", "c\n", "d"]) + memio.seek(0) + self.assertEqual(memio.read(1), "a") + self.assertEqual(memio.read(2), "\nb") + self.assertEqual(memio.read(2), "\nc") + self.assertEqual(memio.read(1), "\n") + memio = self.ioclass(newline=None) + self.assertEqual(2, memio.write("a\n")) + self.assertEqual(3, memio.write("b\r\n")) + self.assertEqual(3, memio.write("c\rd")) + memio.seek(0) + self.assertEqual(memio.read(), "a\nb\nc\nd") + memio = self.ioclass("a\r\nb", newline=None) + self.assertEqual(memio.read(3), "a\nb") + + def test_newline_empty(self): + # newline="" + memio = self.ioclass("a\nb\r\nc\rd", newline="") + self.assertEqual(list(memio), ["a\n", "b\r\n", "c\r", "d"]) + memio.seek(0) + self.assertEqual(memio.read(4), "a\nb\r") + self.assertEqual(memio.read(2), "\nc") + self.assertEqual(memio.read(1), "\r") + memio = self.ioclass(newline="") + self.assertEqual(2, memio.write("a\n")) + self.assertEqual(2, memio.write("b\r")) + self.assertEqual(2, memio.write("\nc")) + self.assertEqual(2, memio.write("\rd")) + memio.seek(0) + self.assertEqual(list(memio), ["a\n", "b\r\n", "c\r", "d"]) + + def test_newline_lf(self): + # newline="\n" + memio = self.ioclass("a\nb\r\nc\rd") + self.assertEqual(list(memio), ["a\n", "b\r\n", "c\rd"]) + + def test_newline_cr(self): + # newline="\r" + memio = self.ioclass("a\nb\r\nc\rd", newline="\r") + memio.seek(0) + self.assertEqual(memio.read(), "a\rb\r\rc\rd") + memio.seek(0) + self.assertEqual(list(memio), ["a\r", "b\r", "\r", "c\r", "d"]) + + def test_newline_crlf(self): + # newline="\r\n" + memio = self.ioclass("a\nb\r\nc\rd", newline="\r\n") + memio.seek(0) + self.assertEqual(memio.read(), "a\r\nb\r\r\nc\rd") + memio.seek(0) + self.assertEqual(list(memio), ["a\r\n", "b\r\r\n", "c\rd"]) + + def test_issue5265(self): + # StringIO can duplicate newlines in universal newlines mode + memio = self.ioclass("a\r\nb\r\n", newline=None) + self.assertEqual(memio.read(5), "a\nb\n") + + +class CBytesIOTest(PyBytesIOTest): + ioclass = io.BytesIO + UnsupportedOperation = io.UnsupportedOperation + + test_bytes_array = unittest.skip( + "array.array() does not have the new buffer API" + )(PyBytesIOTest.test_bytes_array) + + +class CStringIOTest(PyStringIOTest): + ioclass = io.StringIO + UnsupportedOperation = io.UnsupportedOperation + # XXX: For the Python version of io.StringIO, this is highly # dependent on the encoding used for the underlying buffer. - # def test_widechar(self): - # buf = self.buftype("\U0002030a\U00020347") - # memio = self.ioclass(buf) - # - # self.assertEqual(memio.getvalue(), buf) - # self.assertEqual(memio.write(buf), len(buf)) - # self.assertEqual(memio.tell(), len(buf)) - # self.assertEqual(memio.getvalue(), buf) - # self.assertEqual(memio.write(buf), len(buf)) - # self.assertEqual(memio.tell(), len(buf) * 2) - # self.assertEqual(memio.getvalue(), buf + buf) - -if has_c_implementation: - class CBytesIOTest(PyBytesIOTest): - ioclass = io.BytesIO + def test_widechar(self): + buf = self.buftype("\U0002030a\U00020347") + memio = self.ioclass(buf) + + self.assertEqual(memio.getvalue(), buf) + self.assertEqual(memio.write(buf), len(buf)) + self.assertEqual(memio.tell(), len(buf)) + self.assertEqual(memio.getvalue(), buf) + self.assertEqual(memio.write(buf), len(buf)) + self.assertEqual(memio.tell(), len(buf) * 2) + self.assertEqual(memio.getvalue(), buf + buf) + def test_main(): - tests = [PyBytesIOTest, PyStringIOTest] - if has_c_implementation: - tests.extend([CBytesIOTest]) - test_support.run_unittest(*tests) + tests = [PyBytesIOTest, PyStringIOTest, CBytesIOTest, CStringIOTest] + support.run_unittest(*tests) if __name__ == '__main__': test_main() Modified: python/trunk/Lib/test/test_support.py ============================================================================== --- python/trunk/Lib/test/test_support.py (original) +++ python/trunk/Lib/test/test_support.py Fri Jun 12 22:14:08 2009 @@ -29,7 +29,7 @@ "run_with_locale", "set_memlimit", "bigmemtest", "bigaddrspacetest", "BasicTestRunner", "run_unittest", "run_doctest", "threading_setup", "threading_cleanup", "reap_children", "cpython_only", - "check_impl_detail", "get_attribute"] + "check_impl_detail", "get_attribute", "py3k_bytes"] class Error(Exception): """Base class for regression test exceptions.""" @@ -968,3 +968,18 @@ break except: break + +def py3k_bytes(b): + """Emulate the py3k bytes() constructor. + + NOTE: This is only a best effort function. + """ + try: + # memoryview? + return b.tobytes() + except AttributeError: + try: + # iterable of ints? + return b"".join(chr(x) for x in b) + except TypeError: + return bytes(b) Modified: python/trunk/Lib/test/test_univnewlines.py ============================================================================== --- python/trunk/Lib/test/test_univnewlines.py (original) +++ python/trunk/Lib/test/test_univnewlines.py Fri Jun 12 22:14:08 2009 @@ -1,20 +1,25 @@ # Tests universal newline support for both reading and parsing files. + +from __future__ import print_function +from __future__ import unicode_literals + +import io +import _pyio as pyio import unittest import os import sys -from test import test_support +from test import test_support as support if not hasattr(sys.stdin, 'newlines'): - raise unittest.SkipTest, \ - "This Python does not have universal newline support" + raise unittest.SkipTest( + "This Python does not have universal newline support") FATX = 'x' * (2**14) DATA_TEMPLATE = [ "line1=1", - "line2='this is a very long line designed to go past the magic " + - "hundred character limit that is inside fileobject.c and which " + - "is meant to speed up the common case, but we also want to test " + + "line2='this is a very long line designed to go past any default " + + "buffer limits that exist in io.py but we also want to test " + "the uncommon case, naturally.'", "def line3():pass", "line4 = '%s'" % FATX, @@ -28,48 +33,50 @@ # before end-of-file. DATA_MIXED = "\n".join(DATA_TEMPLATE) + "\r" DATA_SPLIT = [x + "\n" for x in DATA_TEMPLATE] -del x class TestGenericUnivNewlines(unittest.TestCase): # use a class variable DATA to define the data to write to the file # and a class variable NEWLINE to set the expected newlines value - READMODE = 'U' + READMODE = 'r' WRITEMODE = 'wb' def setUp(self): - with open(test_support.TESTFN, self.WRITEMODE) as fp: - fp.write(self.DATA) + data = self.DATA + if "b" in self.WRITEMODE: + data = data.encode("ascii") + with self.open(support.TESTFN, self.WRITEMODE) as fp: + fp.write(data) def tearDown(self): try: - os.unlink(test_support.TESTFN) + os.unlink(support.TESTFN) except: pass def test_read(self): - with open(test_support.TESTFN, self.READMODE) as fp: + with self.open(support.TESTFN, self.READMODE) as fp: data = fp.read() self.assertEqual(data, DATA_LF) - self.assertEqual(repr(fp.newlines), repr(self.NEWLINE)) + self.assertEqual(set(fp.newlines), set(self.NEWLINE)) def test_readlines(self): - with open(test_support.TESTFN, self.READMODE) as fp: + with self.open(support.TESTFN, self.READMODE) as fp: data = fp.readlines() self.assertEqual(data, DATA_SPLIT) - self.assertEqual(repr(fp.newlines), repr(self.NEWLINE)) + self.assertEqual(set(fp.newlines), set(self.NEWLINE)) def test_readline(self): - with open(test_support.TESTFN, self.READMODE) as fp: + with self.open(support.TESTFN, self.READMODE) as fp: data = [] d = fp.readline() while d: data.append(d) d = fp.readline() self.assertEqual(data, DATA_SPLIT) - self.assertEqual(repr(fp.newlines), repr(self.NEWLINE)) + self.assertEqual(set(fp.newlines), set(self.NEWLINE)) def test_seek(self): - with open(test_support.TESTFN, self.READMODE) as fp: + with self.open(support.TESTFN, self.READMODE) as fp: fp.readline() pos = fp.tell() data = fp.readlines() @@ -78,19 +85,6 @@ data = fp.readlines() self.assertEqual(data, DATA_SPLIT[1:]) - def test_execfile(self): - namespace = {} - execfile(test_support.TESTFN, namespace) - func = namespace['line3'] - self.assertEqual(func.func_code.co_firstlineno, 3) - self.assertEqual(namespace['line4'], FATX) - - -class TestNativeNewlines(TestGenericUnivNewlines): - NEWLINE = None - DATA = DATA_LF - READMODE = 'r' - WRITEMODE = 'w' class TestCRNewlines(TestGenericUnivNewlines): NEWLINE = '\r' @@ -105,7 +99,7 @@ DATA = DATA_CRLF def test_tell(self): - with open(test_support.TESTFN, self.READMODE) as fp: + with self.open(support.TESTFN, self.READMODE) as fp: self.assertEqual(repr(fp.newlines), repr(None)) data = fp.readline() pos = fp.tell() @@ -117,13 +111,22 @@ def test_main(): - test_support.run_unittest( - TestNativeNewlines, - TestCRNewlines, - TestLFNewlines, - TestCRLFNewlines, - TestMixedNewlines - ) + base_tests = (TestCRNewlines, + TestLFNewlines, + TestCRLFNewlines, + TestMixedNewlines) + tests = [] + # Test the C and Python implementations. + for test in base_tests: + class CTest(test): + open = io.open + CTest.__name__ = str("C" + test.__name__) + class PyTest(test): + open = staticmethod(pyio.open) + PyTest.__name__ = str("Py" + test.__name__) + tests.append(CTest) + tests.append(PyTest) + support.run_unittest(*tests) if __name__ == '__main__': test_main() Modified: python/trunk/Misc/NEWS ============================================================================== --- python/trunk/Misc/NEWS (original) +++ python/trunk/Misc/NEWS Fri Jun 12 22:14:08 2009 @@ -317,6 +317,10 @@ Library ------- +- Issue #6215: All bug fixes and enhancements from the Python 3.1 io library + (including the fast C implementation) have been backported to the standard + ``io`` module. + - Issue #6258: Support AMD64 in bdist_msi. - Issue #5262: Fixed bug in next rollover time computation in Deleted: python/trunk/Modules/_bytesio.c ============================================================================== --- python/trunk/Modules/_bytesio.c Fri Jun 12 22:14:08 2009 +++ (empty file) @@ -1,763 +0,0 @@ -#include "Python.h" - -typedef struct { - PyObject_HEAD - char *buf; - Py_ssize_t pos; - Py_ssize_t string_size; - size_t buf_size; -} BytesIOObject; - -#define CHECK_CLOSED(self) \ - if ((self)->buf == NULL) { \ - PyErr_SetString(PyExc_ValueError, \ - "I/O operation on closed file."); \ - return NULL; \ - } - -/* Internal routine to get a line from the buffer of a BytesIO - object. Returns the length between the current position to the - next newline character. */ -static Py_ssize_t -get_line(BytesIOObject *self, char **output) -{ - char *n; - const char *str_end; - Py_ssize_t len; - - assert(self->buf != NULL); - - /* Move to the end of the line, up to the end of the string, s. */ - str_end = self->buf + self->string_size; - for (n = self->buf + self->pos; - n < str_end && *n != '\n'; - n++); - - /* Skip the newline character */ - if (n < str_end) - n++; - - /* Get the length from the current position to the end of the line. */ - len = n - (self->buf + self->pos); - *output = self->buf + self->pos; - - assert(len >= 0); - assert(self->pos < PY_SSIZE_T_MAX - len); - self->pos += len; - - return len; -} - -/* Internal routine for changing the size of the buffer of BytesIO objects. - The caller should ensure that the 'size' argument is non-negative. Returns - 0 on success, -1 otherwise. */ -static int -resize_buffer(BytesIOObject *self, size_t size) -{ - /* Here, unsigned types are used to avoid dealing with signed integer - overflow, which is undefined in C. */ - size_t alloc = self->buf_size; - char *new_buf = NULL; - - assert(self->buf != NULL); - - /* For simplicity, stay in the range of the signed type. Anyway, Python - doesn't allow strings to be longer than this. */ - if (size > PY_SSIZE_T_MAX) - goto overflow; - - if (size < alloc / 2) { - /* Major downsize; resize down to exact size. */ - alloc = size + 1; - } - else if (size < alloc) { - /* Within allocated size; quick exit */ - return 0; - } - else if (size <= alloc * 1.125) { - /* Moderate upsize; overallocate similar to list_resize() */ - alloc = size + (size >> 3) + (size < 9 ? 3 : 6); - } - else { - /* Major upsize; resize up to exact size */ - alloc = size + 1; - } - - if (alloc > ((size_t)-1) / sizeof(char)) - goto overflow; - new_buf = (char *)PyMem_Realloc(self->buf, alloc * sizeof(char)); - if (new_buf == NULL) { - PyErr_NoMemory(); - return -1; - } - self->buf_size = alloc; - self->buf = new_buf; - - return 0; - - overflow: - PyErr_SetString(PyExc_OverflowError, - "new buffer size too large"); - return -1; -} - -/* Internal routine for writing a string of bytes to the buffer of a BytesIO - object. Returns the number of bytes wrote, or -1 on error. */ -static Py_ssize_t -write_bytes(BytesIOObject *self, const char *bytes, Py_ssize_t len) -{ - assert(self->buf != NULL); - assert(self->pos >= 0); - assert(len >= 0); - - if ((size_t)self->pos + len > self->buf_size) { - if (resize_buffer(self, (size_t)self->pos + len) < 0) - return -1; - } - - if (self->pos > self->string_size) { - /* In case of overseek, pad with null bytes the buffer region between - the end of stream and the current position. - - 0 lo string_size hi - | |<---used--->|<----------available----------->| - | | <--to pad-->|<---to write---> | - 0 buf position - */ - memset(self->buf + self->string_size, '\0', - (self->pos - self->string_size) * sizeof(char)); - } - - /* Copy the data to the internal buffer, overwriting some of the existing - data if self->pos < self->string_size. */ - memcpy(self->buf + self->pos, bytes, len); - self->pos += len; - - /* Set the new length of the internal string if it has changed. */ - if (self->string_size < self->pos) { - self->string_size = self->pos; - } - - return len; -} - -static PyObject * -bytesio_get_closed(BytesIOObject *self) -{ - if (self->buf == NULL) - Py_RETURN_TRUE; - else - Py_RETURN_FALSE; -} - -/* Generic getter for the writable, readable and seekable properties */ -static PyObject * -return_true(BytesIOObject *self) -{ - Py_RETURN_TRUE; -} - -PyDoc_STRVAR(flush_doc, -"flush() -> None. Does nothing."); - -static PyObject * -bytesio_flush(BytesIOObject *self) -{ - Py_RETURN_NONE; -} - -PyDoc_STRVAR(getval_doc, -"getvalue() -> bytes.\n" -"\n" -"Retrieve the entire contents of the BytesIO object."); - -static PyObject * -bytesio_getvalue(BytesIOObject *self) -{ - CHECK_CLOSED(self); - return PyString_FromStringAndSize(self->buf, self->string_size); -} - -PyDoc_STRVAR(isatty_doc, -"isatty() -> False.\n" -"\n" -"Always returns False since BytesIO objects are not connected\n" -"to a tty-like device."); - -static PyObject * -bytesio_isatty(BytesIOObject *self) -{ - CHECK_CLOSED(self); - Py_RETURN_FALSE; -} - -PyDoc_STRVAR(tell_doc, -"tell() -> current file position, an integer\n"); - -static PyObject * -bytesio_tell(BytesIOObject *self) -{ - CHECK_CLOSED(self); - return PyInt_FromSsize_t(self->pos); -} - -PyDoc_STRVAR(read_doc, -"read([size]) -> read at most size bytes, returned as a string.\n" -"\n" -"If the size argument is negative, read until EOF is reached.\n" -"Return an empty string at EOF."); - -static PyObject * -bytesio_read(BytesIOObject *self, PyObject *args) -{ - Py_ssize_t size, n; - char *output; - PyObject *arg = Py_None; - - CHECK_CLOSED(self); - - if (!PyArg_ParseTuple(args, "|O:read", &arg)) - return NULL; - - if (PyInt_Check(arg)) { - size = PyInt_AsSsize_t(arg); - if (size == -1 && PyErr_Occurred()) - return NULL; - } - else if (arg == Py_None) { - /* Read until EOF is reached, by default. */ - size = -1; - } - else { - PyErr_Format(PyExc_TypeError, "integer argument expected, got '%s'", - Py_TYPE(arg)->tp_name); - return NULL; - } - - /* adjust invalid sizes */ - n = self->string_size - self->pos; - if (size < 0 || size > n) { - size = n; - if (size < 0) - size = 0; - } - - assert(self->buf != NULL); - output = self->buf + self->pos; - self->pos += size; - - return PyString_FromStringAndSize(output, size); -} - - -PyDoc_STRVAR(read1_doc, -"read1(size) -> read at most size bytes, returned as a string.\n" -"\n" -"If the size argument is negative or omitted, read until EOF is reached.\n" -"Return an empty string at EOF."); - -static PyObject * -bytesio_read1(BytesIOObject *self, PyObject *n) -{ - PyObject *arg, *res; - - arg = PyTuple_Pack(1, n); - if (arg == NULL) - return NULL; - res = bytesio_read(self, arg); - Py_DECREF(arg); - return res; -} - -PyDoc_STRVAR(readline_doc, -"readline([size]) -> next line from the file, as a string.\n" -"\n" -"Retain newline. A non-negative size argument limits the maximum\n" -"number of bytes to return (an incomplete line may be returned then).\n" -"Return an empty string at EOF.\n"); - -static PyObject * -bytesio_readline(BytesIOObject *self, PyObject *args) -{ - Py_ssize_t size, n; - char *output; - PyObject *arg = Py_None; - - CHECK_CLOSED(self); - - if (!PyArg_ParseTuple(args, "|O:readline", &arg)) - return NULL; - - if (PyInt_Check(arg)) { - size = PyInt_AsSsize_t(arg); - if (size == -1 && PyErr_Occurred()) - return NULL; - } - else if (arg == Py_None) { - /* No size limit, by default. */ - size = -1; - } - else { - PyErr_Format(PyExc_TypeError, "integer argument expected, got '%s'", - Py_TYPE(arg)->tp_name); - return NULL; - } - - n = get_line(self, &output); - - if (size >= 0 && size < n) { - size = n - size; - n -= size; - self->pos -= size; - } - - return PyString_FromStringAndSize(output, n); -} - -PyDoc_STRVAR(readlines_doc, -"readlines([size]) -> list of strings, each a line from the file.\n" -"\n" -"Call readline() repeatedly and return a list of the lines so read.\n" -"The optional size argument, if given, is an approximate bound on the\n" -"total number of bytes in the lines returned.\n"); - -static PyObject * -bytesio_readlines(BytesIOObject *self, PyObject *args) -{ - Py_ssize_t maxsize, size, n; - PyObject *result, *line; - char *output; - PyObject *arg = Py_None; - - CHECK_CLOSED(self); - - if (!PyArg_ParseTuple(args, "|O:readlines", &arg)) - return NULL; - - if (PyInt_Check(arg)) { - maxsize = PyInt_AsSsize_t(arg); - if (maxsize == -1 && PyErr_Occurred()) - return NULL; - } - else if (arg == Py_None) { - /* No size limit, by default. */ - maxsize = -1; - } - else { - PyErr_Format(PyExc_TypeError, "integer argument expected, got '%s'", - Py_TYPE(arg)->tp_name); - return NULL; - } - - size = 0; - result = PyList_New(0); - if (!result) - return NULL; - - while ((n = get_line(self, &output)) != 0) { - line = PyString_FromStringAndSize(output, n); - if (!line) - goto on_error; - if (PyList_Append(result, line) == -1) { - Py_DECREF(line); - goto on_error; - } - Py_DECREF(line); - size += n; - if (maxsize > 0 && size >= maxsize) - break; - } - return result; - - on_error: - Py_DECREF(result); - return NULL; -} - -PyDoc_STRVAR(readinto_doc, -"readinto(bytearray) -> int. Read up to len(b) bytes into b.\n" -"\n" -"Returns number of bytes read (0 for EOF), or None if the object\n" -"is set not to block as has no data to read."); - -static PyObject * -bytesio_readinto(BytesIOObject *self, PyObject *buffer) -{ - void *raw_buffer; - Py_ssize_t len; - - CHECK_CLOSED(self); - - if (PyObject_AsWriteBuffer(buffer, &raw_buffer, &len) == -1) - return NULL; - - if (self->pos + len > self->string_size) - len = self->string_size - self->pos; - - memcpy(raw_buffer, self->buf + self->pos, len); - assert(self->pos + len < PY_SSIZE_T_MAX); - assert(len >= 0); - self->pos += len; - - return PyInt_FromSsize_t(len); -} - -PyDoc_STRVAR(truncate_doc, -"truncate([size]) -> int. Truncate the file to at most size bytes.\n" -"\n" -"Size defaults to the current file position, as returned by tell().\n" -"Returns the new size. Imply an absolute seek to the position size."); - -static PyObject * -bytesio_truncate(BytesIOObject *self, PyObject *args) -{ - Py_ssize_t size; - PyObject *arg = Py_None; - - CHECK_CLOSED(self); - - if (!PyArg_ParseTuple(args, "|O:truncate", &arg)) - return NULL; - - if (PyInt_Check(arg)) { - size = PyInt_AsSsize_t(arg); - if (size == -1 && PyErr_Occurred()) - return NULL; - } - else if (arg == Py_None) { - /* Truncate to current position if no argument is passed. */ - size = self->pos; - } - else { - PyErr_Format(PyExc_TypeError, "integer argument expected, got '%s'", - Py_TYPE(arg)->tp_name); - return NULL; - } - - if (size < 0) { - PyErr_Format(PyExc_ValueError, - "negative size value %zd", size); - return NULL; - } - - if (size < self->string_size) { - self->string_size = size; - if (resize_buffer(self, size) < 0) - return NULL; - } - self->pos = size; - - return PyInt_FromSsize_t(size); -} - -static PyObject * -bytesio_iternext(BytesIOObject *self) -{ - char *next; - Py_ssize_t n; - - CHECK_CLOSED(self); - - n = get_line(self, &next); - - if (!next || n == 0) - return NULL; - - return PyString_FromStringAndSize(next, n); -} - -PyDoc_STRVAR(seek_doc, -"seek(pos, whence=0) -> int. Change stream position.\n" -"\n" -"Seek to byte offset pos relative to position indicated by whence:\n" -" 0 Start of stream (the default). pos should be >= 0;\n" -" 1 Current position - pos may be negative;\n" -" 2 End of stream - pos usually negative.\n" -"Returns the new absolute position."); - -static PyObject * -bytesio_seek(BytesIOObject *self, PyObject *args) -{ - PyObject *pos_obj, *mode_obj; - Py_ssize_t pos; - int mode = 0; - - CHECK_CLOSED(self); - - /* Special-case for 2.x to prevent floats from passing through. - This only needed to make a test in test_io succeed. */ - if (!PyArg_UnpackTuple(args, "seek", 1, 2, &pos_obj, &mode_obj)) - return NULL; - if (PyFloat_Check(pos_obj)) { - PyErr_SetString(PyExc_TypeError, - "position argument must be an integer"); - return NULL; - } - - if (!PyArg_ParseTuple(args, "n|i:seek", &pos, &mode)) - return NULL; - - if (pos < 0 && mode == 0) { - PyErr_Format(PyExc_ValueError, - "negative seek value %zd", pos); - return NULL; - } - - /* mode 0: offset relative to beginning of the string. - mode 1: offset relative to current position. - mode 2: offset relative the end of the string. */ - if (mode == 1) { - if (pos > PY_SSIZE_T_MAX - self->pos) { - PyErr_SetString(PyExc_OverflowError, - "new position too large"); - return NULL; - } - pos += self->pos; - } - else if (mode == 2) { - if (pos > PY_SSIZE_T_MAX - self->string_size) { - PyErr_SetString(PyExc_OverflowError, - "new position too large"); - return NULL; - } - pos += self->string_size; - } - else if (mode != 0) { - PyErr_Format(PyExc_ValueError, - "invalid whence (%i, should be 0, 1 or 2)", mode); - return NULL; - } - - if (pos < 0) - pos = 0; - self->pos = pos; - - return PyInt_FromSsize_t(self->pos); -} - -PyDoc_STRVAR(write_doc, -"write(bytes) -> int. Write bytes to file.\n" -"\n" -"Return the number of bytes written."); - -static PyObject * -bytesio_write(BytesIOObject *self, PyObject *obj) -{ - const char *bytes; - Py_ssize_t size; - Py_ssize_t n = 0; - - CHECK_CLOSED(self); - - /* Special-case in 2.x to prevent unicode objects to pass through. */ - if (PyUnicode_Check(obj)) { - PyErr_SetString(PyExc_TypeError, - "expecting a bytes object, got unicode"); - return NULL; - } - - if (PyObject_AsReadBuffer(obj, (void *)&bytes, &size) < 0) - return NULL; - - if (size != 0) { - n = write_bytes(self, bytes, size); - if (n < 0) - return NULL; - } - - return PyInt_FromSsize_t(n); -} - -PyDoc_STRVAR(writelines_doc, -"writelines(sequence_of_strings) -> None. Write strings to the file.\n" -"\n" -"Note that newlines are not added. The sequence can be any iterable\n" -"object producing strings. This is equivalent to calling write() for\n" -"each string."); - -static PyObject * -bytesio_writelines(BytesIOObject *self, PyObject *v) -{ - PyObject *it, *item; - PyObject *ret; - - CHECK_CLOSED(self); - - it = PyObject_GetIter(v); - if (it == NULL) - return NULL; - - while ((item = PyIter_Next(it)) != NULL) { - ret = bytesio_write(self, item); - Py_DECREF(item); - if (ret == NULL) { - Py_DECREF(it); - return NULL; - } - Py_DECREF(ret); - } - Py_DECREF(it); - - /* See if PyIter_Next failed */ - if (PyErr_Occurred()) - return NULL; - - Py_RETURN_NONE; -} - -PyDoc_STRVAR(close_doc, -"close() -> None. Disable all I/O operations."); - -static PyObject * -bytesio_close(BytesIOObject *self) -{ - if (self->buf != NULL) { - PyMem_Free(self->buf); - self->buf = NULL; - } - Py_RETURN_NONE; -} - -static void -bytesio_dealloc(BytesIOObject *self) -{ - if (self->buf != NULL) { - PyMem_Free(self->buf); - self->buf = NULL; - } - Py_TYPE(self)->tp_free(self); -} - -static PyObject * -bytesio_new(PyTypeObject *type, PyObject *args, PyObject *kwds) -{ - BytesIOObject *self; - - assert(type != NULL && type->tp_alloc != NULL); - self = (BytesIOObject *)type->tp_alloc(type, 0); - if (self == NULL) - return NULL; - - self->string_size = 0; - self->pos = 0; - self->buf_size = 0; - self->buf = (char *)PyMem_Malloc(0); - if (self->buf == NULL) { - Py_DECREF(self); - return PyErr_NoMemory(); - } - - return (PyObject *)self; -} - -static int -bytesio_init(BytesIOObject *self, PyObject *args, PyObject *kwds) -{ - PyObject *initvalue = NULL; - - if (!PyArg_ParseTuple(args, "|O:BytesIO", &initvalue)) - return -1; - - /* In case, __init__ is called multiple times. */ - self->string_size = 0; - self->pos = 0; - - if (initvalue && initvalue != Py_None) { - PyObject *res; - res = bytesio_write(self, initvalue); - if (res == NULL) - return -1; - Py_DECREF(res); - self->pos = 0; - } - - return 0; -} - -static PyGetSetDef bytesio_getsetlist[] = { - {"closed", (getter)bytesio_get_closed, NULL, - "True if the file is closed."}, - {0}, /* sentinel */ -}; - -static struct PyMethodDef bytesio_methods[] = { - {"readable", (PyCFunction)return_true, METH_NOARGS, NULL}, - {"seekable", (PyCFunction)return_true, METH_NOARGS, NULL}, - {"writable", (PyCFunction)return_true, METH_NOARGS, NULL}, - {"close", (PyCFunction)bytesio_close, METH_NOARGS, close_doc}, - {"flush", (PyCFunction)bytesio_flush, METH_NOARGS, flush_doc}, - {"isatty", (PyCFunction)bytesio_isatty, METH_NOARGS, isatty_doc}, - {"tell", (PyCFunction)bytesio_tell, METH_NOARGS, tell_doc}, - {"write", (PyCFunction)bytesio_write, METH_O, write_doc}, - {"writelines", (PyCFunction)bytesio_writelines, METH_O, writelines_doc}, - {"read1", (PyCFunction)bytesio_read1, METH_O, read1_doc}, - {"readinto", (PyCFunction)bytesio_readinto, METH_O, readinto_doc}, - {"readline", (PyCFunction)bytesio_readline, METH_VARARGS, readline_doc}, - {"readlines", (PyCFunction)bytesio_readlines, METH_VARARGS, readlines_doc}, - {"read", (PyCFunction)bytesio_read, METH_VARARGS, read_doc}, - {"getvalue", (PyCFunction)bytesio_getvalue, METH_VARARGS, getval_doc}, - {"seek", (PyCFunction)bytesio_seek, METH_VARARGS, seek_doc}, - {"truncate", (PyCFunction)bytesio_truncate, METH_VARARGS, truncate_doc}, - {NULL, NULL} /* sentinel */ -}; - -PyDoc_STRVAR(bytesio_doc, -"BytesIO([buffer]) -> object\n" -"\n" -"Create a buffered I/O implementation using an in-memory bytes\n" -"buffer, ready for reading and writing."); - -static PyTypeObject BytesIO_Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "_bytesio._BytesIO", /*tp_name*/ - sizeof(BytesIOObject), /*tp_basicsize*/ - 0, /*tp_itemsize*/ - (destructor)bytesio_dealloc, /*tp_dealloc*/ - 0, /*tp_print*/ - 0, /*tp_getattr*/ - 0, /*tp_setattr*/ - 0, /*tp_compare*/ - 0, /*tp_repr*/ - 0, /*tp_as_number*/ - 0, /*tp_as_sequence*/ - 0, /*tp_as_mapping*/ - 0, /*tp_hash*/ - 0, /*tp_call*/ - 0, /*tp_str*/ - 0, /*tp_getattro*/ - 0, /*tp_setattro*/ - 0, /*tp_as_buffer*/ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /*tp_flags*/ - bytesio_doc, /*tp_doc*/ - 0, /*tp_traverse*/ - 0, /*tp_clear*/ - 0, /*tp_richcompare*/ - 0, /*tp_weaklistoffset*/ - PyObject_SelfIter, /*tp_iter*/ - (iternextfunc)bytesio_iternext, /*tp_iternext*/ - bytesio_methods, /*tp_methods*/ - 0, /*tp_members*/ - bytesio_getsetlist, /*tp_getset*/ - 0, /*tp_base*/ - 0, /*tp_dict*/ - 0, /*tp_descr_get*/ - 0, /*tp_descr_set*/ - 0, /*tp_dictoffset*/ - (initproc)bytesio_init, /*tp_init*/ - 0, /*tp_alloc*/ - bytesio_new, /*tp_new*/ -}; - -PyMODINIT_FUNC -init_bytesio(void) -{ - PyObject *m; - - if (PyType_Ready(&BytesIO_Type) < 0) - return; - m = Py_InitModule("_bytesio", NULL); - if (m == NULL) - return; - Py_INCREF(&BytesIO_Type); - PyModule_AddObject(m, "_BytesIO", (PyObject *)&BytesIO_Type); -} Deleted: python/trunk/Modules/_fileio.c ============================================================================== --- python/trunk/Modules/_fileio.c Fri Jun 12 22:14:08 2009 +++ (empty file) @@ -1,935 +0,0 @@ -/* Author: Daniel Stutzbach */ - -#define PY_SSIZE_T_CLEAN -#include "Python.h" -#include -#include -#include -#include /* For offsetof */ - -/* - * Known likely problems: - * - * - Files larger then 2**32-1 - * - Files with unicode filenames - * - Passing numbers greater than 2**32-1 when an integer is expected - * - Making it work on Windows and other oddball platforms - * - * To Do: - * - * - autoconfify header file inclusion - */ - -#ifdef MS_WINDOWS -/* can simulate truncate with Win32 API functions; see file_truncate */ -#define HAVE_FTRUNCATE -#define WIN32_LEAN_AND_MEAN -#include -#endif - -typedef struct { - PyObject_HEAD - int fd; - unsigned readable : 1; - unsigned writable : 1; - int seekable : 2; /* -1 means unknown */ - int closefd : 1; - PyObject *weakreflist; -} PyFileIOObject; - -PyTypeObject PyFileIO_Type; - -#define PyFileIO_Check(op) (PyObject_TypeCheck((op), &PyFileIO_Type)) - -static PyObject * -portable_lseek(int fd, PyObject *posobj, int whence); - -/* Returns 0 on success, errno (which is < 0) on failure. */ -static int -internal_close(PyFileIOObject *self) -{ - int save_errno = 0; - if (self->fd >= 0) { - int fd = self->fd; - self->fd = -1; - Py_BEGIN_ALLOW_THREADS - if (close(fd) < 0) - save_errno = errno; - Py_END_ALLOW_THREADS - } - return save_errno; -} - -static PyObject * -fileio_close(PyFileIOObject *self) -{ - if (!self->closefd) { - self->fd = -1; - Py_RETURN_NONE; - } - errno = internal_close(self); - if (errno < 0) { - PyErr_SetFromErrno(PyExc_IOError); - return NULL; - } - - Py_RETURN_NONE; -} - -static PyObject * -fileio_new(PyTypeObject *type, PyObject *args, PyObject *kews) -{ - PyFileIOObject *self; - - assert(type != NULL && type->tp_alloc != NULL); - - self = (PyFileIOObject *) type->tp_alloc(type, 0); - if (self != NULL) { - self->fd = -1; - self->readable = 0; - self->writable = 0; - self->seekable = -1; - self->closefd = 1; - self->weakreflist = NULL; - } - - return (PyObject *) self; -} - -/* On Unix, open will succeed for directories. - In Python, there should be no file objects referring to - directories, so we need a check. */ - -static int -dircheck(PyFileIOObject* self, char *name) -{ -#if defined(HAVE_FSTAT) && defined(S_IFDIR) && defined(EISDIR) - struct stat buf; - if (self->fd < 0) - return 0; - if (fstat(self->fd, &buf) == 0 && S_ISDIR(buf.st_mode)) { - char *msg = strerror(EISDIR); - PyObject *exc; - internal_close(self); - - exc = PyObject_CallFunction(PyExc_IOError, "(iss)", - EISDIR, msg, name); - PyErr_SetObject(PyExc_IOError, exc); - Py_XDECREF(exc); - return -1; - } -#endif - return 0; -} - -static int -check_fd(int fd) -{ -#if defined(HAVE_FSTAT) - struct stat buf; - if (!_PyVerify_fd(fd) || (fstat(fd, &buf) < 0 && errno == EBADF)) { - PyObject *exc; - char *msg = strerror(EBADF); - exc = PyObject_CallFunction(PyExc_OSError, "(is)", - EBADF, msg); - PyErr_SetObject(PyExc_OSError, exc); - Py_XDECREF(exc); - return -1; - } -#endif - return 0; -} - - -static int -fileio_init(PyObject *oself, PyObject *args, PyObject *kwds) -{ - PyFileIOObject *self = (PyFileIOObject *) oself; - static char *kwlist[] = {"file", "mode", "closefd", NULL}; - char *name = NULL; - char *mode = "r"; - char *s; -#ifdef MS_WINDOWS - Py_UNICODE *widename = NULL; -#endif - int ret = 0; - int rwa = 0, plus = 0, append = 0; - int flags = 0; - int fd = -1; - int closefd = 1; - - assert(PyFileIO_Check(oself)); - if (self->fd >= 0) { - /* Have to close the existing file first. */ - if (internal_close(self) < 0) - return -1; - } - - if (PyArg_ParseTupleAndKeywords(args, kwds, "i|si:fileio", - kwlist, &fd, &mode, &closefd)) { - if (fd < 0) { - PyErr_SetString(PyExc_ValueError, - "Negative filedescriptor"); - return -1; - } - if (check_fd(fd)) - return -1; - } - else { - PyErr_Clear(); - -#ifdef MS_WINDOWS - if (GetVersion() < 0x80000000) { - /* On NT, so wide API available */ - PyObject *po; - if (PyArg_ParseTupleAndKeywords(args, kwds, "U|si:fileio", - kwlist, &po, &mode, &closefd) - ) { - widename = PyUnicode_AS_UNICODE(po); - } else { - /* Drop the argument parsing error as narrow - strings are also valid. */ - PyErr_Clear(); - } - } - if (widename == NULL) -#endif - { - if (!PyArg_ParseTupleAndKeywords(args, kwds, "et|si:fileio", - kwlist, - Py_FileSystemDefaultEncoding, - &name, &mode, &closefd)) - return -1; - } - } - - s = mode; - while (*s) { - switch (*s++) { - case 'r': - if (rwa) { - bad_mode: - PyErr_SetString(PyExc_ValueError, - "Must have exactly one of read/write/append mode"); - goto error; - } - rwa = 1; - self->readable = 1; - break; - case 'w': - if (rwa) - goto bad_mode; - rwa = 1; - self->writable = 1; - flags |= O_CREAT | O_TRUNC; - break; - case 'a': - if (rwa) - goto bad_mode; - rwa = 1; - self->writable = 1; - flags |= O_CREAT; - append = 1; - break; - case 'b': - break; - case '+': - if (plus) - goto bad_mode; - self->readable = self->writable = 1; - plus = 1; - break; - default: - PyErr_Format(PyExc_ValueError, - "invalid mode: %.200s", mode); - goto error; - } - } - - if (!rwa) - goto bad_mode; - - if (self->readable && self->writable) - flags |= O_RDWR; - else if (self->readable) - flags |= O_RDONLY; - else - flags |= O_WRONLY; - -#ifdef O_BINARY - flags |= O_BINARY; -#endif - -#ifdef O_APPEND - if (append) - flags |= O_APPEND; -#endif - - if (fd >= 0) { - self->fd = fd; - self->closefd = closefd; - } - else { - self->closefd = 1; - if (!closefd) { - PyErr_SetString(PyExc_ValueError, - "Cannot use closefd=False with file name"); - goto error; - } - - Py_BEGIN_ALLOW_THREADS - errno = 0; -#ifdef MS_WINDOWS - if (widename != NULL) - self->fd = _wopen(widename, flags, 0666); - else -#endif - self->fd = open(name, flags, 0666); - Py_END_ALLOW_THREADS - if (self->fd < 0) { -#ifdef MS_WINDOWS - if (widename != NULL) - PyErr_SetFromErrnoWithUnicodeFilename(PyExc_IOError, widename); - else -#endif - PyErr_SetFromErrnoWithFilename(PyExc_IOError, name); - goto error; - } - if(dircheck(self, name) < 0) - goto error; - } - - if (append) { - /* For consistent behaviour, we explicitly seek to the - end of file (otherwise, it might be done only on the - first write()). */ - PyObject *pos = portable_lseek(self->fd, NULL, 2); - if (pos == NULL) - goto error; - Py_DECREF(pos); - } - - goto done; - - error: - ret = -1; - - done: - PyMem_Free(name); - return ret; -} - -static void -fileio_dealloc(PyFileIOObject *self) -{ - if (self->weakreflist != NULL) - PyObject_ClearWeakRefs((PyObject *) self); - - if (self->fd >= 0 && self->closefd) { - errno = internal_close(self); - if (errno < 0) { - PySys_WriteStderr("close failed: [Errno %d] %s\n", - errno, strerror(errno)); - } - } - - Py_TYPE(self)->tp_free((PyObject *)self); -} - -static PyObject * -err_closed(void) -{ - PyErr_SetString(PyExc_ValueError, "I/O operation on closed file"); - return NULL; -} - -static PyObject * -err_mode(char *action) -{ - PyErr_Format(PyExc_ValueError, "File not open for %s", action); - return NULL; -} - -static PyObject * -fileio_fileno(PyFileIOObject *self) -{ - if (self->fd < 0) - return err_closed(); - return PyInt_FromLong((long) self->fd); -} - -static PyObject * -fileio_readable(PyFileIOObject *self) -{ - if (self->fd < 0) - return err_closed(); - return PyBool_FromLong((long) self->readable); -} - -static PyObject * -fileio_writable(PyFileIOObject *self) -{ - if (self->fd < 0) - return err_closed(); - return PyBool_FromLong((long) self->writable); -} - -static PyObject * -fileio_seekable(PyFileIOObject *self) -{ - if (self->fd < 0) - return err_closed(); - if (self->seekable < 0) { - int ret; - Py_BEGIN_ALLOW_THREADS - ret = lseek(self->fd, 0, SEEK_CUR); - Py_END_ALLOW_THREADS - if (ret < 0) - self->seekable = 0; - else - self->seekable = 1; - } - return PyBool_FromLong((long) self->seekable); -} - -static PyObject * -fileio_readinto(PyFileIOObject *self, PyObject *args) -{ - Py_buffer pbuf; - Py_ssize_t n; - - if (self->fd < 0) - return err_closed(); - if (!self->readable) - return err_mode("reading"); - - if (!PyArg_ParseTuple(args, "w*", &pbuf)) - return NULL; - - Py_BEGIN_ALLOW_THREADS - errno = 0; - n = read(self->fd, pbuf.buf, pbuf.len); - Py_END_ALLOW_THREADS - PyBuffer_Release(&pbuf); - if (n < 0) { - if (errno == EAGAIN) - Py_RETURN_NONE; - PyErr_SetFromErrno(PyExc_IOError); - return NULL; - } - - return PyLong_FromSsize_t(n); -} - -#define DEFAULT_BUFFER_SIZE (8*1024) - -static PyObject * -fileio_readall(PyFileIOObject *self) -{ - PyObject *result; - Py_ssize_t total = 0; - int n; - - result = PyString_FromStringAndSize(NULL, DEFAULT_BUFFER_SIZE); - if (result == NULL) - return NULL; - - while (1) { - Py_ssize_t newsize = total + DEFAULT_BUFFER_SIZE; - if (PyString_GET_SIZE(result) < newsize) { - if (_PyString_Resize(&result, newsize) < 0) { - if (total == 0) { - Py_DECREF(result); - return NULL; - } - PyErr_Clear(); - break; - } - } - Py_BEGIN_ALLOW_THREADS - errno = 0; - n = read(self->fd, - PyString_AS_STRING(result) + total, - newsize - total); - Py_END_ALLOW_THREADS - if (n == 0) - break; - if (n < 0) { - if (total > 0) - break; - if (errno == EAGAIN) { - Py_DECREF(result); - Py_RETURN_NONE; - } - Py_DECREF(result); - PyErr_SetFromErrno(PyExc_IOError); - return NULL; - } - total += n; - } - - if (PyString_GET_SIZE(result) > total) { - if (_PyString_Resize(&result, total) < 0) { - /* This should never happen, but just in case */ - Py_DECREF(result); - return NULL; - } - } - return result; -} - -static PyObject * -fileio_read(PyFileIOObject *self, PyObject *args) -{ - char *ptr; - Py_ssize_t n; - Py_ssize_t size = -1; - PyObject *bytes; - - if (self->fd < 0) - return err_closed(); - if (!self->readable) - return err_mode("reading"); - - if (!PyArg_ParseTuple(args, "|n", &size)) - return NULL; - - if (size < 0) { - return fileio_readall(self); - } - - bytes = PyString_FromStringAndSize(NULL, size); - if (bytes == NULL) - return NULL; - ptr = PyString_AS_STRING(bytes); - - Py_BEGIN_ALLOW_THREADS - errno = 0; - n = read(self->fd, ptr, size); - Py_END_ALLOW_THREADS - - if (n < 0) { - if (errno == EAGAIN) - Py_RETURN_NONE; - PyErr_SetFromErrno(PyExc_IOError); - return NULL; - } - - if (n != size) { - if (_PyString_Resize(&bytes, n) < 0) { - Py_DECREF(bytes); - return NULL; - } - } - - return (PyObject *) bytes; -} - -static PyObject * -fileio_write(PyFileIOObject *self, PyObject *args) -{ - Py_buffer pbuf; - Py_ssize_t n; - - if (self->fd < 0) - return err_closed(); - if (!self->writable) - return err_mode("writing"); - - if (!PyArg_ParseTuple(args, "s*", &pbuf)) - return NULL; - - Py_BEGIN_ALLOW_THREADS - errno = 0; - n = write(self->fd, pbuf.buf, pbuf.len); - Py_END_ALLOW_THREADS - - PyBuffer_Release(&pbuf); - - if (n < 0) { - if (errno == EAGAIN) - Py_RETURN_NONE; - PyErr_SetFromErrno(PyExc_IOError); - return NULL; - } - - return PyLong_FromSsize_t(n); -} - -/* XXX Windows support below is likely incomplete */ - -#if defined(MS_WIN64) || defined(MS_WINDOWS) -typedef PY_LONG_LONG Py_off_t; -#else -typedef off_t Py_off_t; -#endif - -/* Cribbed from posix_lseek() */ -static PyObject * -portable_lseek(int fd, PyObject *posobj, int whence) -{ - Py_off_t pos, res; - -#ifdef SEEK_SET - /* Turn 0, 1, 2 into SEEK_{SET,CUR,END} */ - switch (whence) { -#if SEEK_SET != 0 - case 0: whence = SEEK_SET; break; -#endif -#if SEEK_CUR != 1 - case 1: whence = SEEK_CUR; break; -#endif -#if SEEK_END != 2 - case 2: whence = SEEK_END; break; -#endif - } -#endif /* SEEK_SET */ - - if (posobj == NULL) - pos = 0; - else { - if(PyFloat_Check(posobj)) { - PyErr_SetString(PyExc_TypeError, "an integer is required"); - return NULL; - } -#if defined(HAVE_LARGEFILE_SUPPORT) - pos = PyLong_AsLongLong(posobj); -#else - pos = PyLong_AsLong(posobj); -#endif - if (PyErr_Occurred()) - return NULL; - } - - Py_BEGIN_ALLOW_THREADS -#if defined(MS_WIN64) || defined(MS_WINDOWS) - res = _lseeki64(fd, pos, whence); -#else - res = lseek(fd, pos, whence); -#endif - Py_END_ALLOW_THREADS - if (res < 0) - return PyErr_SetFromErrno(PyExc_IOError); - -#if defined(HAVE_LARGEFILE_SUPPORT) - return PyLong_FromLongLong(res); -#else - return PyLong_FromLong(res); -#endif -} - -static PyObject * -fileio_seek(PyFileIOObject *self, PyObject *args) -{ - PyObject *posobj; - int whence = 0; - - if (self->fd < 0) - return err_closed(); - - if (!PyArg_ParseTuple(args, "O|i", &posobj, &whence)) - return NULL; - - return portable_lseek(self->fd, posobj, whence); -} - -static PyObject * -fileio_tell(PyFileIOObject *self, PyObject *args) -{ - if (self->fd < 0) - return err_closed(); - - return portable_lseek(self->fd, NULL, 1); -} - -#ifdef HAVE_FTRUNCATE -static PyObject * -fileio_truncate(PyFileIOObject *self, PyObject *args) -{ - PyObject *posobj = NULL; - Py_off_t pos; - int ret; - int fd; - - fd = self->fd; - if (fd < 0) - return err_closed(); - if (!self->writable) - return err_mode("writing"); - - if (!PyArg_ParseTuple(args, "|O", &posobj)) - return NULL; - - if (posobj == Py_None || posobj == NULL) { - /* Get the current position. */ - posobj = portable_lseek(fd, NULL, 1); - if (posobj == NULL) - return NULL; - } - else { - /* Move to the position to be truncated. */ - posobj = portable_lseek(fd, posobj, 0); - } - -#if defined(HAVE_LARGEFILE_SUPPORT) - pos = PyLong_AsLongLong(posobj); -#else - pos = PyLong_AsLong(posobj); -#endif - if (PyErr_Occurred()) - return NULL; - -#ifdef MS_WINDOWS - /* MS _chsize doesn't work if newsize doesn't fit in 32 bits, - so don't even try using it. */ - { - HANDLE hFile; - - /* Truncate. Note that this may grow the file! */ - Py_BEGIN_ALLOW_THREADS - errno = 0; - hFile = (HANDLE)_get_osfhandle(fd); - ret = hFile == (HANDLE)-1; - if (ret == 0) { - ret = SetEndOfFile(hFile) == 0; - if (ret) - errno = EACCES; - } - Py_END_ALLOW_THREADS - } -#else - Py_BEGIN_ALLOW_THREADS - errno = 0; - ret = ftruncate(fd, pos); - Py_END_ALLOW_THREADS -#endif /* !MS_WINDOWS */ - - if (ret != 0) { - PyErr_SetFromErrno(PyExc_IOError); - return NULL; - } - - return posobj; -} -#endif - -static char * -mode_string(PyFileIOObject *self) -{ - if (self->readable) { - if (self->writable) - return "rb+"; - else - return "rb"; - } - else - return "wb"; -} - -static PyObject * -fileio_repr(PyFileIOObject *self) -{ - if (self->fd < 0) - return PyString_FromFormat("_fileio._FileIO(-1)"); - - return PyString_FromFormat("_fileio._FileIO(%d, '%s')", - self->fd, mode_string(self)); -} - -static PyObject * -fileio_isatty(PyFileIOObject *self) -{ - long res; - - if (self->fd < 0) - return err_closed(); - Py_BEGIN_ALLOW_THREADS - res = isatty(self->fd); - Py_END_ALLOW_THREADS - return PyBool_FromLong(res); -} - - -PyDoc_STRVAR(fileio_doc, -"file(name: str[, mode: str]) -> file IO object\n" -"\n" -"Open a file. The mode can be 'r', 'w' or 'a' for reading (default),\n" -"writing or appending. The file will be created if it doesn't exist\n" -"when opened for writing or appending; it will be truncated when\n" -"opened for writing. Add a '+' to the mode to allow simultaneous\n" -"reading and writing."); - -PyDoc_STRVAR(read_doc, -"read(size: int) -> bytes. read at most size bytes, returned as bytes.\n" -"\n" -"Only makes one system call, so less data may be returned than requested\n" -"In non-blocking mode, returns None if no data is available.\n" -"On end-of-file, returns ''."); - -PyDoc_STRVAR(readall_doc, -"readall() -> bytes. read all data from the file, returned as bytes.\n" -"\n" -"In non-blocking mode, returns as much as is immediately available,\n" -"or None if no data is available. On end-of-file, returns ''."); - -PyDoc_STRVAR(write_doc, -"write(b: bytes) -> int. Write bytes b to file, return number written.\n" -"\n" -"Only makes one system call, so not all of the data may be written.\n" -"The number of bytes actually written is returned."); - -PyDoc_STRVAR(fileno_doc, -"fileno() -> int. \"file descriptor\".\n" -"\n" -"This is needed for lower-level file interfaces, such the fcntl module."); - -PyDoc_STRVAR(seek_doc, -"seek(offset: int[, whence: int]) -> None. Move to new file position.\n" -"\n" -"Argument offset is a byte count. Optional argument whence defaults to\n" -"0 (offset from start of file, offset should be >= 0); other values are 1\n" -"(move relative to current position, positive or negative), and 2 (move\n" -"relative to end of file, usually negative, although many platforms allow\n" -"seeking beyond the end of a file)." -"\n" -"Note that not all file objects are seekable."); - -#ifdef HAVE_FTRUNCATE -PyDoc_STRVAR(truncate_doc, -"truncate([size: int]) -> None. Truncate the file to at most size bytes.\n" -"\n" -"Size defaults to the current file position, as returned by tell()." -"The current file position is changed to the value of size."); -#endif - -PyDoc_STRVAR(tell_doc, -"tell() -> int. Current file position"); - -PyDoc_STRVAR(readinto_doc, -"readinto() -> Undocumented. Don't use this; it may go away."); - -PyDoc_STRVAR(close_doc, -"close() -> None. Close the file.\n" -"\n" -"A closed file cannot be used for further I/O operations. close() may be\n" -"called more than once without error. Changes the fileno to -1."); - -PyDoc_STRVAR(isatty_doc, -"isatty() -> bool. True if the file is connected to a tty device."); - -PyDoc_STRVAR(seekable_doc, -"seekable() -> bool. True if file supports random-access."); - -PyDoc_STRVAR(readable_doc, -"readable() -> bool. True if file was opened in a read mode."); - -PyDoc_STRVAR(writable_doc, -"writable() -> bool. True if file was opened in a write mode."); - -static PyMethodDef fileio_methods[] = { - {"read", (PyCFunction)fileio_read, METH_VARARGS, read_doc}, - {"readall", (PyCFunction)fileio_readall, METH_NOARGS, readall_doc}, - {"readinto", (PyCFunction)fileio_readinto, METH_VARARGS, readinto_doc}, - {"write", (PyCFunction)fileio_write, METH_VARARGS, write_doc}, - {"seek", (PyCFunction)fileio_seek, METH_VARARGS, seek_doc}, - {"tell", (PyCFunction)fileio_tell, METH_VARARGS, tell_doc}, -#ifdef HAVE_FTRUNCATE - {"truncate", (PyCFunction)fileio_truncate, METH_VARARGS, truncate_doc}, -#endif - {"close", (PyCFunction)fileio_close, METH_NOARGS, close_doc}, - {"seekable", (PyCFunction)fileio_seekable, METH_NOARGS, seekable_doc}, - {"readable", (PyCFunction)fileio_readable, METH_NOARGS, readable_doc}, - {"writable", (PyCFunction)fileio_writable, METH_NOARGS, writable_doc}, - {"fileno", (PyCFunction)fileio_fileno, METH_NOARGS, fileno_doc}, - {"isatty", (PyCFunction)fileio_isatty, METH_NOARGS, isatty_doc}, - {NULL, NULL} /* sentinel */ -}; - -/* 'closed' and 'mode' are attributes for backwards compatibility reasons. */ - -static PyObject * -get_closed(PyFileIOObject *self, void *closure) -{ - return PyBool_FromLong((long)(self->fd < 0)); -} - -static PyObject * -get_closefd(PyFileIOObject *self, void *closure) -{ - return PyBool_FromLong((long)(self->closefd)); -} - -static PyObject * -get_mode(PyFileIOObject *self, void *closure) -{ - return PyString_FromString(mode_string(self)); -} - -static PyGetSetDef fileio_getsetlist[] = { - {"closed", (getter)get_closed, NULL, "True if the file is closed"}, - {"closefd", (getter)get_closefd, NULL, - "True if the file descriptor will be closed"}, - {"mode", (getter)get_mode, NULL, "String giving the file mode"}, - {0}, -}; - -PyTypeObject PyFileIO_Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "_FileIO", - sizeof(PyFileIOObject), - 0, - (destructor)fileio_dealloc, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_compare */ - (reprfunc)fileio_repr, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - PyObject_GenericGetAttr, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - fileio_doc, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - offsetof(PyFileIOObject, weakreflist), /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - fileio_methods, /* tp_methods */ - 0, /* tp_members */ - fileio_getsetlist, /* tp_getset */ - 0, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - fileio_init, /* tp_init */ - PyType_GenericAlloc, /* tp_alloc */ - fileio_new, /* tp_new */ - PyObject_Del, /* tp_free */ -}; - -static PyMethodDef module_methods[] = { - {NULL, NULL} -}; - -PyMODINIT_FUNC -init_fileio(void) -{ - PyObject *m; /* a module object */ - - m = Py_InitModule3("_fileio", module_methods, - "Fast implementation of io.FileIO."); - if (m == NULL) - return; - if (PyType_Ready(&PyFileIO_Type) < 0) - return; - Py_INCREF(&PyFileIO_Type); - PyModule_AddObject(m, "_FileIO", (PyObject *) &PyFileIO_Type); -} Added: python/trunk/Modules/_io/_iomodule.c ============================================================================== --- (empty file) +++ python/trunk/Modules/_io/_iomodule.c Fri Jun 12 22:14:08 2009 @@ -0,0 +1,735 @@ +/* + An implementation of the new I/O lib as defined by PEP 3116 - "New I/O" + + Classes defined here: UnsupportedOperation, BlockingIOError. + Functions defined here: open(). + + Mostly written by Amaury Forgeot d'Arc +*/ + +#define PY_SSIZE_T_CLEAN +#include "Python.h" +#include "structmember.h" +#include "_iomodule.h" + +#ifdef HAVE_SYS_TYPES_H +#include +#endif /* HAVE_SYS_TYPES_H */ + +#ifdef HAVE_SYS_STAT_H +#include +#endif /* HAVE_SYS_STAT_H */ + + +/* Various interned strings */ + +PyObject *_PyIO_str_close; +PyObject *_PyIO_str_closed; +PyObject *_PyIO_str_decode; +PyObject *_PyIO_str_encode; +PyObject *_PyIO_str_fileno; +PyObject *_PyIO_str_flush; +PyObject *_PyIO_str_getstate; +PyObject *_PyIO_str_isatty; +PyObject *_PyIO_str_newlines; +PyObject *_PyIO_str_nl; +PyObject *_PyIO_str_read; +PyObject *_PyIO_str_read1; +PyObject *_PyIO_str_readable; +PyObject *_PyIO_str_readinto; +PyObject *_PyIO_str_readline; +PyObject *_PyIO_str_reset; +PyObject *_PyIO_str_seek; +PyObject *_PyIO_str_seekable; +PyObject *_PyIO_str_setstate; +PyObject *_PyIO_str_tell; +PyObject *_PyIO_str_truncate; +PyObject *_PyIO_str_writable; +PyObject *_PyIO_str_write; + +PyObject *_PyIO_empty_str; +PyObject *_PyIO_empty_bytes; +PyObject *_PyIO_zero; + + +PyDoc_STRVAR(module_doc, +"The io module provides the Python interfaces to stream handling. The\n" +"builtin open function is defined in this module.\n" +"\n" +"At the top of the I/O hierarchy is the abstract base class IOBase. It\n" +"defines the basic interface to a stream. Note, however, that there is no\n" +"seperation between reading and writing to streams; implementations are\n" +"allowed to throw an IOError if they do not support a given operation.\n" +"\n" +"Extending IOBase is RawIOBase which deals simply with the reading and\n" +"writing of raw bytes to a stream. FileIO subclasses RawIOBase to provide\n" +"an interface to OS files.\n" +"\n" +"BufferedIOBase deals with buffering on a raw byte stream (RawIOBase). Its\n" +"subclasses, BufferedWriter, BufferedReader, and BufferedRWPair buffer\n" +"streams that are readable, writable, and both respectively.\n" +"BufferedRandom provides a buffered interface to random access\n" +"streams. BytesIO is a simple stream of in-memory bytes.\n" +"\n" +"Another IOBase subclass, TextIOBase, deals with the encoding and decoding\n" +"of streams into text. TextIOWrapper, which extends it, is a buffered text\n" +"interface to a buffered raw stream (`BufferedIOBase`). Finally, StringIO\n" +"is a in-memory stream for text.\n" +"\n" +"Argument names are not part of the specification, and only the arguments\n" +"of open() are intended to be used as keyword arguments.\n" +"\n" +"data:\n" +"\n" +"DEFAULT_BUFFER_SIZE\n" +"\n" +" An int containing the default buffer size used by the module's buffered\n" +" I/O classes. open() uses the file's blksize (as obtained by os.stat) if\n" +" possible.\n" + ); + + +/* + * BlockingIOError extends IOError + */ + +static int +blockingioerror_init(PyBlockingIOErrorObject *self, PyObject *args, + PyObject *kwds) +{ + PyObject *myerrno = NULL, *strerror = NULL; + PyObject *baseargs = NULL; + Py_ssize_t written = 0; + + assert(PyTuple_Check(args)); + + self->written = 0; + if (!PyArg_ParseTuple(args, "OO|n:BlockingIOError", + &myerrno, &strerror, &written)) + return -1; + + baseargs = PyTuple_Pack(2, myerrno, strerror); + if (baseargs == NULL) + return -1; + /* This will take care of initializing of myerrno and strerror members */ + if (((PyTypeObject *)PyExc_IOError)->tp_init( + (PyObject *)self, baseargs, kwds) == -1) { + Py_DECREF(baseargs); + return -1; + } + Py_DECREF(baseargs); + + self->written = written; + return 0; +} + +static PyMemberDef blockingioerror_members[] = { + {"characters_written", T_PYSSIZET, offsetof(PyBlockingIOErrorObject, written), 0}, + {NULL} /* Sentinel */ +}; + +static PyTypeObject _PyExc_BlockingIOError = { + PyVarObject_HEAD_INIT(NULL, 0) + "BlockingIOError", /*tp_name*/ + sizeof(PyBlockingIOErrorObject), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + 0, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + 0, /*tp_compare */ + 0, /*tp_repr*/ + 0, /*tp_as_number*/ + 0, /*tp_as_sequence*/ + 0, /*tp_as_mapping*/ + 0, /*tp_hash */ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + 0, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /*tp_flags*/ + PyDoc_STR("Exception raised when I/O would block " + "on a non-blocking I/O stream"), /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + 0, /* tp_methods */ + blockingioerror_members, /* tp_members */ + 0, /* tp_getset */ + 0, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)blockingioerror_init, /* tp_init */ + 0, /* tp_alloc */ + 0, /* tp_new */ +}; +PyObject *PyExc_BlockingIOError = (PyObject *)&_PyExc_BlockingIOError; + + +/* + * The main open() function + */ +PyDoc_STRVAR(open_doc, +"Open file and return a stream. Raise IOError upon failure.\n" +"\n" +"file is either a text or byte string giving the name (and the path\n" +"if the file isn't in the current working directory) of the file to\n" +"be opened or an integer file descriptor of the file to be\n" +"wrapped. (If a file descriptor is given, it is closed when the\n" +"returned I/O object is closed, unless closefd is set to False.)\n" +"\n" +"mode is an optional string that specifies the mode in which the file\n" +"is opened. It defaults to 'r' which means open for reading in text\n" +"mode. Other common values are 'w' for writing (truncating the file if\n" +"it already exists), and 'a' for appending (which on some Unix systems,\n" +"means that all writes append to the end of the file regardless of the\n" +"current seek position). In text mode, if encoding is not specified the\n" +"encoding used is platform dependent. (For reading and writing raw\n" +"bytes use binary mode and leave encoding unspecified.) The available\n" +"modes are:\n" +"\n" +"========= ===============================================================\n" +"Character Meaning\n" +"--------- ---------------------------------------------------------------\n" +"'r' open for reading (default)\n" +"'w' open for writing, truncating the file first\n" +"'a' open for writing, appending to the end of the file if it exists\n" +"'b' binary mode\n" +"'t' text mode (default)\n" +"'+' open a disk file for updating (reading and writing)\n" +"'U' universal newline mode (for backwards compatibility; unneeded\n" +" for new code)\n" +"========= ===============================================================\n" +"\n" +"The default mode is 'rt' (open for reading text). For binary random\n" +"access, the mode 'w+b' opens and truncates the file to 0 bytes, while\n" +"'r+b' opens the file without truncation.\n" +"\n" +"Python distinguishes between files opened in binary and text modes,\n" +"even when the underlying operating system doesn't. Files opened in\n" +"binary mode (appending 'b' to the mode argument) return contents as\n" +"bytes objects without any decoding. In text mode (the default, or when\n" +"'t' is appended to the mode argument), the contents of the file are\n" +"returned as strings, the bytes having been first decoded using a\n" +"platform-dependent encoding or using the specified encoding if given.\n" +"\n" +"buffering is an optional integer used to set the buffering policy. By\n" +"default full buffering is on. Pass 0 to switch buffering off (only\n" +"allowed in binary mode), 1 to set line buffering, and an integer > 1\n" +"for full buffering.\n" +"\n" +"encoding is the name of the encoding used to decode or encode the\n" +"file. This should only be used in text mode. The default encoding is\n" +"platform dependent, but any encoding supported by Python can be\n" +"passed. See the codecs module for the list of supported encodings.\n" +"\n" +"errors is an optional string that specifies how encoding errors are to\n" +"be handled---this argument should not be used in binary mode. Pass\n" +"'strict' to raise a ValueError exception if there is an encoding error\n" +"(the default of None has the same effect), or pass 'ignore' to ignore\n" +"errors. (Note that ignoring encoding errors can lead to data loss.)\n" +"See the documentation for codecs.register for a list of the permitted\n" +"encoding error strings.\n" +"\n" +"newline controls how universal newlines works (it only applies to text\n" +"mode). It can be None, '', '\\n', '\\r', and '\\r\\n'. It works as\n" +"follows:\n" +"\n" +"* On input, if newline is None, universal newlines mode is\n" +" enabled. Lines in the input can end in '\\n', '\\r', or '\\r\\n', and\n" +" these are translated into '\\n' before being returned to the\n" +" caller. If it is '', universal newline mode is enabled, but line\n" +" endings are returned to the caller untranslated. If it has any of\n" +" the other legal values, input lines are only terminated by the given\n" +" string, and the line ending is returned to the caller untranslated.\n" +"\n" +"* On output, if newline is None, any '\\n' characters written are\n" +" translated to the system default line separator, os.linesep. If\n" +" newline is '', no translation takes place. If newline is any of the\n" +" other legal values, any '\\n' characters written are translated to\n" +" the given string.\n" +"\n" +"If closefd is False, the underlying file descriptor will be kept open\n" +"when the file is closed. This does not work when a file name is given\n" +"and must be True in that case.\n" +"\n" +"open() returns a file object whose type depends on the mode, and\n" +"through which the standard file operations such as reading and writing\n" +"are performed. When open() is used to open a file in a text mode ('w',\n" +"'r', 'wt', 'rt', etc.), it returns a TextIOWrapper. When used to open\n" +"a file in a binary mode, the returned class varies: in read binary\n" +"mode, it returns a BufferedReader; in write binary and append binary\n" +"modes, it returns a BufferedWriter, and in read/write mode, it returns\n" +"a BufferedRandom.\n" +"\n" +"It is also possible to use a string or bytearray as a file for both\n" +"reading and writing. For strings StringIO can be used like a file\n" +"opened in a text mode, and for bytes a BytesIO can be used like a file\n" +"opened in a binary mode.\n" + ); + +static PyObject * +io_open(PyObject *self, PyObject *args, PyObject *kwds) +{ + char *kwlist[] = {"file", "mode", "buffering", + "encoding", "errors", "newline", + "closefd", NULL}; + PyObject *file; + char *mode = "r"; + int buffering = -1, closefd = 1; + char *encoding = NULL, *errors = NULL, *newline = NULL; + unsigned i; + + int reading = 0, writing = 0, appending = 0, updating = 0; + int text = 0, binary = 0, universal = 0; + + char rawmode[5], *m; + int line_buffering, isatty; + + PyObject *raw, *modeobj = NULL, *buffer = NULL, *wrapper = NULL; + + if (!PyArg_ParseTupleAndKeywords(args, kwds, "O|sizzzi:open", kwlist, + &file, &mode, &buffering, + &encoding, &errors, &newline, + &closefd)) { + return NULL; + } + + if (!PyUnicode_Check(file) && + !PyBytes_Check(file) && + !PyNumber_Check(file)) { + PyObject *repr = PyObject_Repr(file); + if (repr != NULL) { + PyErr_Format(PyExc_TypeError, "invalid file: %s", + PyString_AS_STRING(repr)); + Py_DECREF(repr); + } + return NULL; + } + + /* Decode mode */ + for (i = 0; i < strlen(mode); i++) { + char c = mode[i]; + + switch (c) { + case 'r': + reading = 1; + break; + case 'w': + writing = 1; + break; + case 'a': + appending = 1; + break; + case '+': + updating = 1; + break; + case 't': + text = 1; + break; + case 'b': + binary = 1; + break; + case 'U': + universal = 1; + reading = 1; + break; + default: + goto invalid_mode; + } + + /* c must not be duplicated */ + if (strchr(mode+i+1, c)) { + invalid_mode: + PyErr_Format(PyExc_ValueError, "invalid mode: '%s'", mode); + return NULL; + } + + } + + m = rawmode; + if (reading) *(m++) = 'r'; + if (writing) *(m++) = 'w'; + if (appending) *(m++) = 'a'; + if (updating) *(m++) = '+'; + *m = '\0'; + + /* Parameters validation */ + if (universal) { + if (writing || appending) { + PyErr_SetString(PyExc_ValueError, + "can't use U and writing mode at once"); + return NULL; + } + reading = 1; + } + + if (text && binary) { + PyErr_SetString(PyExc_ValueError, + "can't have text and binary mode at once"); + return NULL; + } + + if (reading + writing + appending > 1) { + PyErr_SetString(PyExc_ValueError, + "must have exactly one of read/write/append mode"); + return NULL; + } + + if (binary && encoding != NULL) { + PyErr_SetString(PyExc_ValueError, + "binary mode doesn't take an encoding argument"); + return NULL; + } + + if (binary && errors != NULL) { + PyErr_SetString(PyExc_ValueError, + "binary mode doesn't take an errors argument"); + return NULL; + } + + if (binary && newline != NULL) { + PyErr_SetString(PyExc_ValueError, + "binary mode doesn't take a newline argument"); + return NULL; + } + + /* Create the Raw file stream */ + raw = PyObject_CallFunction((PyObject *)&PyFileIO_Type, + "Osi", file, rawmode, closefd); + if (raw == NULL) + return NULL; + + modeobj = PyUnicode_FromString(mode); + if (modeobj == NULL) + goto error; + + /* buffering */ + { + PyObject *res = PyObject_CallMethod(raw, "isatty", NULL); + if (res == NULL) + goto error; + isatty = PyLong_AsLong(res); + Py_DECREF(res); + if (isatty == -1 && PyErr_Occurred()) + goto error; + } + + if (buffering == 1 || (buffering < 0 && isatty)) { + buffering = -1; + line_buffering = 1; + } + else + line_buffering = 0; + + if (buffering < 0) { + buffering = DEFAULT_BUFFER_SIZE; +#ifdef HAVE_STRUCT_STAT_ST_BLKSIZE + { + struct stat st; + long fileno; + PyObject *res = PyObject_CallMethod(raw, "fileno", NULL); + if (res == NULL) + goto error; + + fileno = PyInt_AsLong(res); + Py_DECREF(res); + if (fileno == -1 && PyErr_Occurred()) + goto error; + + if (fstat(fileno, &st) >= 0) + buffering = st.st_blksize; + } +#endif + } + if (buffering < 0) { + PyErr_SetString(PyExc_ValueError, + "invalid buffering size"); + goto error; + } + + /* if not buffering, returns the raw file object */ + if (buffering == 0) { + if (!binary) { + PyErr_SetString(PyExc_ValueError, + "can't have unbuffered text I/O"); + goto error; + } + + Py_DECREF(modeobj); + return raw; + } + + /* wraps into a buffered file */ + { + PyObject *Buffered_class; + + if (updating) + Buffered_class = (PyObject *)&PyBufferedRandom_Type; + else if (writing || appending) + Buffered_class = (PyObject *)&PyBufferedWriter_Type; + else if (reading) + Buffered_class = (PyObject *)&PyBufferedReader_Type; + else { + PyErr_Format(PyExc_ValueError, + "unknown mode: '%s'", mode); + goto error; + } + + buffer = PyObject_CallFunction(Buffered_class, "Oi", raw, buffering); + } + Py_CLEAR(raw); + if (buffer == NULL) + goto error; + + + /* if binary, returns the buffered file */ + if (binary) { + Py_DECREF(modeobj); + return buffer; + } + + /* wraps into a TextIOWrapper */ + wrapper = PyObject_CallFunction((PyObject *)&PyTextIOWrapper_Type, + "Osssi", + buffer, + encoding, errors, newline, + line_buffering); + Py_CLEAR(buffer); + if (wrapper == NULL) + goto error; + + if (PyObject_SetAttrString(wrapper, "mode", modeobj) < 0) + goto error; + Py_DECREF(modeobj); + return wrapper; + + error: + Py_XDECREF(raw); + Py_XDECREF(modeobj); + Py_XDECREF(buffer); + Py_XDECREF(wrapper); + return NULL; +} + +/* + * Private helpers for the io module. + */ + +Py_off_t +PyNumber_AsOff_t(PyObject *item, PyObject *err) +{ + Py_off_t result; + PyObject *runerr; + PyObject *value = PyNumber_Index(item); + if (value == NULL) + return -1; + + if (PyInt_Check(value)) { + /* We assume a long always fits in a Py_off_t... */ + result = (Py_off_t) PyInt_AS_LONG(value); + goto finish; + } + + /* We're done if PyLong_AsSsize_t() returns without error. */ + result = PyLong_AsOff_t(value); + if (result != -1 || !(runerr = PyErr_Occurred())) + goto finish; + + /* Error handling code -- only manage OverflowError differently */ + if (!PyErr_GivenExceptionMatches(runerr, PyExc_OverflowError)) + goto finish; + + PyErr_Clear(); + /* If no error-handling desired then the default clipping + is sufficient. + */ + if (!err) { + assert(PyLong_Check(value)); + /* Whether or not it is less than or equal to + zero is determined by the sign of ob_size + */ + if (_PyLong_Sign(value) < 0) + result = PY_OFF_T_MIN; + else + result = PY_OFF_T_MAX; + } + else { + /* Otherwise replace the error with caller's error object. */ + PyErr_Format(err, + "cannot fit '%.200s' into an offset-sized integer", + item->ob_type->tp_name); + } + + finish: + Py_DECREF(value); + return result; +} + + +/* + * Module definition + */ + +PyObject *_PyIO_os_module = NULL; +PyObject *_PyIO_locale_module = NULL; +PyObject *_PyIO_unsupported_operation = NULL; + +static PyMethodDef module_methods[] = { + {"open", (PyCFunction)io_open, METH_VARARGS|METH_KEYWORDS, open_doc}, + {NULL, NULL} +}; + +PyMODINIT_FUNC +init_io(void) +{ + PyObject *m = Py_InitModule4("_io", module_methods, + module_doc, NULL, PYTHON_API_VERSION); + if (m == NULL) + return; + + /* put os in the module state */ + _PyIO_os_module = PyImport_ImportModule("os"); + if (_PyIO_os_module == NULL) + goto fail; + +#define ADD_TYPE(type, name) \ + if (PyType_Ready(type) < 0) \ + goto fail; \ + Py_INCREF(type); \ + if (PyModule_AddObject(m, name, (PyObject *)type) < 0) { \ + Py_DECREF(type); \ + goto fail; \ + } + + /* DEFAULT_BUFFER_SIZE */ + if (PyModule_AddIntMacro(m, DEFAULT_BUFFER_SIZE) < 0) + goto fail; + + /* UnsupportedOperation inherits from ValueError and IOError */ + _PyIO_unsupported_operation = PyObject_CallFunction( + (PyObject *)&PyType_Type, "s(OO){}", + "UnsupportedOperation", PyExc_ValueError, PyExc_IOError); + if (_PyIO_unsupported_operation == NULL) + goto fail; + Py_INCREF(_PyIO_unsupported_operation); + if (PyModule_AddObject(m, "UnsupportedOperation", + _PyIO_unsupported_operation) < 0) + goto fail; + + /* BlockingIOError */ + _PyExc_BlockingIOError.tp_base = (PyTypeObject *) PyExc_IOError; + ADD_TYPE(&_PyExc_BlockingIOError, "BlockingIOError"); + + /* Concrete base types of the IO ABCs. + (the ABCs themselves are declared through inheritance in io.py) + */ + ADD_TYPE(&PyIOBase_Type, "_IOBase"); + ADD_TYPE(&PyRawIOBase_Type, "_RawIOBase"); + ADD_TYPE(&PyBufferedIOBase_Type, "_BufferedIOBase"); + ADD_TYPE(&PyTextIOBase_Type, "_TextIOBase"); + + /* Implementation of concrete IO objects. */ + /* FileIO */ + PyFileIO_Type.tp_base = &PyRawIOBase_Type; + ADD_TYPE(&PyFileIO_Type, "FileIO"); + + /* BytesIO */ + PyBytesIO_Type.tp_base = &PyBufferedIOBase_Type; + ADD_TYPE(&PyBytesIO_Type, "BytesIO"); + + /* StringIO */ + PyStringIO_Type.tp_base = &PyTextIOBase_Type; + ADD_TYPE(&PyStringIO_Type, "StringIO"); + + /* BufferedReader */ + PyBufferedReader_Type.tp_base = &PyBufferedIOBase_Type; + ADD_TYPE(&PyBufferedReader_Type, "BufferedReader"); + + /* BufferedWriter */ + PyBufferedWriter_Type.tp_base = &PyBufferedIOBase_Type; + ADD_TYPE(&PyBufferedWriter_Type, "BufferedWriter"); + + /* BufferedRWPair */ + PyBufferedRWPair_Type.tp_base = &PyBufferedIOBase_Type; + ADD_TYPE(&PyBufferedRWPair_Type, "BufferedRWPair"); + + /* BufferedRandom */ + PyBufferedRandom_Type.tp_base = &PyBufferedIOBase_Type; + ADD_TYPE(&PyBufferedRandom_Type, "BufferedRandom"); + + /* TextIOWrapper */ + PyTextIOWrapper_Type.tp_base = &PyTextIOBase_Type; + ADD_TYPE(&PyTextIOWrapper_Type, "TextIOWrapper"); + + /* IncrementalNewlineDecoder */ + ADD_TYPE(&PyIncrementalNewlineDecoder_Type, "IncrementalNewlineDecoder"); + + /* Interned strings */ + if (!(_PyIO_str_close = PyString_InternFromString("close"))) + goto fail; + if (!(_PyIO_str_closed = PyString_InternFromString("closed"))) + goto fail; + if (!(_PyIO_str_decode = PyString_InternFromString("decode"))) + goto fail; + if (!(_PyIO_str_encode = PyString_InternFromString("encode"))) + goto fail; + if (!(_PyIO_str_fileno = PyString_InternFromString("fileno"))) + goto fail; + if (!(_PyIO_str_flush = PyString_InternFromString("flush"))) + goto fail; + if (!(_PyIO_str_getstate = PyString_InternFromString("getstate"))) + goto fail; + if (!(_PyIO_str_isatty = PyString_InternFromString("isatty"))) + goto fail; + if (!(_PyIO_str_newlines = PyString_InternFromString("newlines"))) + goto fail; + if (!(_PyIO_str_nl = PyString_InternFromString("\n"))) + goto fail; + if (!(_PyIO_str_read = PyString_InternFromString("read"))) + goto fail; + if (!(_PyIO_str_read1 = PyString_InternFromString("read1"))) + goto fail; + if (!(_PyIO_str_readable = PyString_InternFromString("readable"))) + goto fail; + if (!(_PyIO_str_readinto = PyString_InternFromString("readinto"))) + goto fail; + if (!(_PyIO_str_readline = PyString_InternFromString("readline"))) + goto fail; + if (!(_PyIO_str_reset = PyString_InternFromString("reset"))) + goto fail; + if (!(_PyIO_str_seek = PyString_InternFromString("seek"))) + goto fail; + if (!(_PyIO_str_seekable = PyString_InternFromString("seekable"))) + goto fail; + if (!(_PyIO_str_setstate = PyString_InternFromString("setstate"))) + goto fail; + if (!(_PyIO_str_tell = PyString_InternFromString("tell"))) + goto fail; + if (!(_PyIO_str_truncate = PyString_InternFromString("truncate"))) + goto fail; + if (!(_PyIO_str_write = PyString_InternFromString("write"))) + goto fail; + if (!(_PyIO_str_writable = PyString_InternFromString("writable"))) + goto fail; + + if (!(_PyIO_empty_str = PyUnicode_FromStringAndSize(NULL, 0))) + goto fail; + if (!(_PyIO_empty_bytes = PyBytes_FromStringAndSize(NULL, 0))) + goto fail; + if (!(_PyIO_zero = PyLong_FromLong(0L))) + goto fail; + + return; + + fail: + Py_CLEAR(_PyIO_os_module); + Py_CLEAR(_PyIO_unsupported_operation); + Py_DECREF(m); +} Added: python/trunk/Modules/_io/_iomodule.h ============================================================================== --- (empty file) +++ python/trunk/Modules/_io/_iomodule.h Fri Jun 12 22:14:08 2009 @@ -0,0 +1,146 @@ +/* + * Declarations shared between the different parts of the io module + */ + +/* ABCs */ +extern PyTypeObject PyIOBase_Type; +extern PyTypeObject PyRawIOBase_Type; +extern PyTypeObject PyBufferedIOBase_Type; +extern PyTypeObject PyTextIOBase_Type; + +/* Concrete classes */ +extern PyTypeObject PyFileIO_Type; +extern PyTypeObject PyBytesIO_Type; +extern PyTypeObject PyStringIO_Type; +extern PyTypeObject PyBufferedReader_Type; +extern PyTypeObject PyBufferedWriter_Type; +extern PyTypeObject PyBufferedRWPair_Type; +extern PyTypeObject PyBufferedRandom_Type; +extern PyTypeObject PyTextIOWrapper_Type; +extern PyTypeObject PyIncrementalNewlineDecoder_Type; + +/* These functions are used as METH_NOARGS methods, are normally called + * with args=NULL, and return a new reference. + * BUT when args=Py_True is passed, they return a borrowed reference. + */ +extern PyObject* _PyIOBase_check_readable(PyObject *self, PyObject *args); +extern PyObject* _PyIOBase_check_writable(PyObject *self, PyObject *args); +extern PyObject* _PyIOBase_check_seekable(PyObject *self, PyObject *args); +extern PyObject* _PyIOBase_check_closed(PyObject *self, PyObject *args); + +/* Helper for finalization. + This function will revive an object ready to be deallocated and try to + close() it. It returns 0 if the object can be destroyed, or -1 if it + is alive again. */ +extern int _PyIOBase_finalize(PyObject *self); + +/* Returns true if the given FileIO object is closed. + Doesn't check the argument type, so be careful! */ +extern int _PyFileIO_closed(PyObject *self); + +/* Shortcut to the core of the IncrementalNewlineDecoder.decode method */ +extern PyObject *_PyIncrementalNewlineDecoder_decode( + PyObject *self, PyObject *input, int final); + +/* Finds the first line ending between `start` and `end`. + If found, returns the index after the line ending and doesn't touch + `*consumed`. + If not found, returns -1 and sets `*consumed` to the number of characters + which can be safely put aside until another search. + + NOTE: for performance reasons, `end` must point to a NUL character ('\0'). + Otherwise, the function will scan further and return garbage. */ +extern Py_ssize_t _PyIO_find_line_ending( + int translated, int universal, PyObject *readnl, + Py_UNICODE *start, Py_UNICODE *end, Py_ssize_t *consumed); + + +#define DEFAULT_BUFFER_SIZE (8 * 1024) /* bytes */ + +typedef struct { + /* This is the equivalent of PyException_HEAD in 3.x */ + PyObject_HEAD + PyObject *dict; + PyObject *args; + PyObject *message; + + PyObject *myerrno; + PyObject *strerror; + PyObject *filename; /* Not used, but part of the IOError object */ + Py_ssize_t written; +} PyBlockingIOErrorObject; +PyAPI_DATA(PyObject *) PyExc_BlockingIOError; + +/* + * Offset type for positioning. + */ + +#if defined(MS_WIN64) || defined(MS_WINDOWS) + +/* Windows uses long long for offsets */ +typedef PY_LONG_LONG Py_off_t; +# define PyLong_AsOff_t PyLong_AsLongLong +# define PyLong_FromOff_t PyLong_FromLongLong +# define PY_OFF_T_MAX PY_LLONG_MAX +# define PY_OFF_T_MIN PY_LLONG_MIN + +#else + +/* Other platforms use off_t */ +typedef off_t Py_off_t; +#if (SIZEOF_OFF_T == SIZEOF_SIZE_T) +# define PyLong_AsOff_t PyLong_AsSsize_t +# define PyLong_FromOff_t PyLong_FromSsize_t +# define PY_OFF_T_MAX PY_SSIZE_T_MAX +# define PY_OFF_T_MIN PY_SSIZE_T_MIN +#elif (SIZEOF_OFF_T == SIZEOF_LONG_LONG) +# define PyLong_AsOff_t PyLong_AsLongLong +# define PyLong_FromOff_t PyLong_FromLongLong +# define PY_OFF_T_MAX PY_LLONG_MAX +# define PY_OFF_T_MIN PY_LLONG_MIN +#elif (SIZEOF_OFF_T == SIZEOF_LONG) +# define PyLong_AsOff_t PyLong_AsLong +# define PyLong_FromOff_t PyLong_FromLong +# define PY_OFF_T_MAX LONG_MAX +# define PY_OFF_T_MIN LONG_MIN +#else +# error off_t does not match either size_t, long, or long long! +#endif + +#endif + +extern Py_off_t PyNumber_AsOff_t(PyObject *item, PyObject *err); + +/* Implementation details */ + +extern PyObject *_PyIO_os_module; +extern PyObject *_PyIO_locale_module; +extern PyObject *_PyIO_unsupported_operation; + +extern PyObject *_PyIO_str_close; +extern PyObject *_PyIO_str_closed; +extern PyObject *_PyIO_str_decode; +extern PyObject *_PyIO_str_encode; +extern PyObject *_PyIO_str_fileno; +extern PyObject *_PyIO_str_flush; +extern PyObject *_PyIO_str_getstate; +extern PyObject *_PyIO_str_isatty; +extern PyObject *_PyIO_str_newlines; +extern PyObject *_PyIO_str_nl; +extern PyObject *_PyIO_str_read; +extern PyObject *_PyIO_str_read1; +extern PyObject *_PyIO_str_readable; +extern PyObject *_PyIO_str_readinto; +extern PyObject *_PyIO_str_readline; +extern PyObject *_PyIO_str_reset; +extern PyObject *_PyIO_str_seek; +extern PyObject *_PyIO_str_seekable; +extern PyObject *_PyIO_str_setstate; +extern PyObject *_PyIO_str_tell; +extern PyObject *_PyIO_str_truncate; +extern PyObject *_PyIO_str_writable; +extern PyObject *_PyIO_str_write; + +extern PyObject *_PyIO_empty_str; +extern PyObject *_PyIO_empty_bytes; +extern PyObject *_PyIO_zero; Added: python/trunk/Modules/_io/bufferedio.c ============================================================================== --- (empty file) +++ python/trunk/Modules/_io/bufferedio.c Fri Jun 12 22:14:08 2009 @@ -0,0 +1,2289 @@ +/* + An implementation of Buffered I/O as defined by PEP 3116 - "New I/O" + + Classes defined here: BufferedIOBase, BufferedReader, BufferedWriter, + BufferedRandom. + + Written by Amaury Forgeot d'Arc and Antoine Pitrou +*/ + +#define PY_SSIZE_T_CLEAN +#include "Python.h" +#include "structmember.h" +#include "pythread.h" +#include "_iomodule.h" + +/* + * BufferedIOBase class, inherits from IOBase. + */ +PyDoc_STRVAR(bufferediobase_doc, + "Base class for buffered IO objects.\n" + "\n" + "The main difference with RawIOBase is that the read() method\n" + "supports omitting the size argument, and does not have a default\n" + "implementation that defers to readinto().\n" + "\n" + "In addition, read(), readinto() and write() may raise\n" + "BlockingIOError if the underlying raw stream is in non-blocking\n" + "mode and not ready; unlike their raw counterparts, they will never\n" + "return None.\n" + "\n" + "A typical implementation should not inherit from a RawIOBase\n" + "implementation, but wrap one.\n" + ); + +static PyObject * +bufferediobase_readinto(PyObject *self, PyObject *args) +{ + Py_buffer buf; + Py_ssize_t len; + PyObject *data; + + if (!PyArg_ParseTuple(args, "w*:readinto", &buf)) { + return NULL; + } + + data = PyObject_CallMethod(self, "read", "n", buf.len); + if (data == NULL) + goto error; + + if (!PyBytes_Check(data)) { + Py_DECREF(data); + PyErr_SetString(PyExc_TypeError, "read() should return bytes"); + goto error; + } + + len = Py_SIZE(data); + memcpy(buf.buf, PyBytes_AS_STRING(data), len); + + PyBuffer_Release(&buf); + Py_DECREF(data); + + return PyLong_FromSsize_t(len); + + error: + PyBuffer_Release(&buf); + return NULL; +} + +static PyObject * +bufferediobase_unsupported(const char *message) +{ + PyErr_SetString(_PyIO_unsupported_operation, message); + return NULL; +} + +PyDoc_STRVAR(bufferediobase_detach_doc, + "Disconnect this buffer from its underlying raw stream and return it.\n" + "\n" + "After the raw stream has been detached, the buffer is in an unusable\n" + "state.\n"); + +static PyObject * +bufferediobase_detach(PyObject *self) +{ + return bufferediobase_unsupported("detach"); +} + +PyDoc_STRVAR(bufferediobase_read_doc, + "Read and return up to n bytes.\n" + "\n" + "If the argument is omitted, None, or negative, reads and\n" + "returns all data until EOF.\n" + "\n" + "If the argument is positive, and the underlying raw stream is\n" + "not 'interactive', multiple raw reads may be issued to satisfy\n" + "the byte count (unless EOF is reached first). But for\n" + "interactive raw streams (as well as sockets and pipes), at most\n" + "one raw read will be issued, and a short result does not imply\n" + "that EOF is imminent.\n" + "\n" + "Returns an empty bytes object on EOF.\n" + "\n" + "Returns None if the underlying raw stream was open in non-blocking\n" + "mode and no data is available at the moment.\n"); + +static PyObject * +bufferediobase_read(PyObject *self, PyObject *args) +{ + return bufferediobase_unsupported("read"); +} + +PyDoc_STRVAR(bufferediobase_read1_doc, + "Read and return up to n bytes, with at most one read() call\n" + "to the underlying raw stream. A short result does not imply\n" + "that EOF is imminent.\n" + "\n" + "Returns an empty bytes object on EOF.\n"); + +static PyObject * +bufferediobase_read1(PyObject *self, PyObject *args) +{ + return bufferediobase_unsupported("read1"); +} + +PyDoc_STRVAR(bufferediobase_write_doc, + "Write the given buffer to the IO stream.\n" + "\n" + "Returns the number of bytes written, which is never less than\n" + "len(b).\n" + "\n" + "Raises BlockingIOError if the buffer is full and the\n" + "underlying raw stream cannot accept more data at the moment.\n"); + +static PyObject * +bufferediobase_write(PyObject *self, PyObject *args) +{ + return bufferediobase_unsupported("write"); +} + + +static PyMethodDef bufferediobase_methods[] = { + {"detach", (PyCFunction)bufferediobase_detach, METH_NOARGS, bufferediobase_detach_doc}, + {"read", bufferediobase_read, METH_VARARGS, bufferediobase_read_doc}, + {"read1", bufferediobase_read1, METH_VARARGS, bufferediobase_read1_doc}, + {"readinto", bufferediobase_readinto, METH_VARARGS, NULL}, + {"write", bufferediobase_write, METH_VARARGS, bufferediobase_write_doc}, + {NULL, NULL} +}; + +PyTypeObject PyBufferedIOBase_Type = { + PyVarObject_HEAD_INIT(NULL, 0) + "_io._BufferedIOBase", /*tp_name*/ + 0, /*tp_basicsize*/ + 0, /*tp_itemsize*/ + 0, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + 0, /*tp_compare */ + 0, /*tp_repr*/ + 0, /*tp_as_number*/ + 0, /*tp_as_sequence*/ + 0, /*tp_as_mapping*/ + 0, /*tp_hash */ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + 0, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /*tp_flags*/ + bufferediobase_doc, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + bufferediobase_methods, /* tp_methods */ + 0, /* tp_members */ + 0, /* tp_getset */ + &PyIOBase_Type, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + 0, /* tp_init */ + 0, /* tp_alloc */ + 0, /* tp_new */ +}; + + +typedef struct { + PyObject_HEAD + + PyObject *raw; + int ok; /* Initialized? */ + int detached; + int readable; + int writable; + + /* True if this is a vanilla Buffered object (rather than a user derived + class) *and* the raw stream is a vanilla FileIO object. */ + int fast_closed_checks; + + /* Absolute position inside the raw stream (-1 if unknown). */ + Py_off_t abs_pos; + + /* A static buffer of size `buffer_size` */ + char *buffer; + /* Current logical position in the buffer. */ + Py_off_t pos; + /* Position of the raw stream in the buffer. */ + Py_off_t raw_pos; + + /* Just after the last buffered byte in the buffer, or -1 if the buffer + isn't ready for reading. */ + Py_off_t read_end; + + /* Just after the last byte actually written */ + Py_off_t write_pos; + /* Just after the last byte waiting to be written, or -1 if the buffer + isn't ready for writing. */ + Py_off_t write_end; + +#ifdef WITH_THREAD + PyThread_type_lock lock; +#endif + + Py_ssize_t buffer_size; + Py_ssize_t buffer_mask; + + PyObject *dict; + PyObject *weakreflist; +} buffered; + +/* + Implementation notes: + + * BufferedReader, BufferedWriter and BufferedRandom try to share most + methods (this is helped by the members `readable` and `writable`, which + are initialized in the respective constructors) + * They also share a single buffer for reading and writing. This enables + interleaved reads and writes without flushing. It also makes the logic + a bit trickier to get right. + * The absolute position of the raw stream is cached, if possible, in the + `abs_pos` member. It must be updated every time an operation is done + on the raw stream. If not sure, it can be reinitialized by calling + _buffered_raw_tell(), which queries the raw stream (_buffered_raw_seek() + also does it). To read it, use RAW_TELL(). + * Three helpers, _bufferedreader_raw_read, _bufferedwriter_raw_write and + _bufferedwriter_flush_unlocked do a lot of useful housekeeping. + + NOTE: we should try to maintain block alignment of reads and writes to the + raw stream (according to the buffer size), but for now it is only done + in read() and friends. + +*/ + +/* These macros protect the buffered object against concurrent operations. */ + +#ifdef WITH_THREAD +#define ENTER_BUFFERED(self) \ + Py_BEGIN_ALLOW_THREADS \ + PyThread_acquire_lock(self->lock, 1); \ + Py_END_ALLOW_THREADS + +#define LEAVE_BUFFERED(self) \ + PyThread_release_lock(self->lock); +#else +#define ENTER_BUFFERED(self) +#define LEAVE_BUFFERED(self) +#endif + +#define CHECK_INITIALIZED(self) \ + if (self->ok <= 0) { \ + if (self->detached) { \ + PyErr_SetString(PyExc_ValueError, \ + "raw stream has been detached"); \ + } else { \ + PyErr_SetString(PyExc_ValueError, \ + "I/O operation on uninitialized object"); \ + } \ + return NULL; \ + } + +#define CHECK_INITIALIZED_INT(self) \ + if (self->ok <= 0) { \ + if (self->detached) { \ + PyErr_SetString(PyExc_ValueError, \ + "raw stream has been detached"); \ + } else { \ + PyErr_SetString(PyExc_ValueError, \ + "I/O operation on uninitialized object"); \ + } \ + return -1; \ + } + +#define IS_CLOSED(self) \ + (self->fast_closed_checks \ + ? _PyFileIO_closed(self->raw) \ + : buffered_closed(self)) + +#define CHECK_CLOSED(self, error_msg) \ + if (IS_CLOSED(self)) { \ + PyErr_SetString(PyExc_ValueError, error_msg); \ + return NULL; \ + } + + +#define VALID_READ_BUFFER(self) \ + (self->readable && self->read_end != -1) + +#define VALID_WRITE_BUFFER(self) \ + (self->writable && self->write_end != -1) + +#define ADJUST_POSITION(self, _new_pos) \ + do { \ + self->pos = _new_pos; \ + if (VALID_READ_BUFFER(self) && self->read_end < self->pos) \ + self->read_end = self->pos; \ + } while(0) + +#define READAHEAD(self) \ + ((self->readable && VALID_READ_BUFFER(self)) \ + ? (self->read_end - self->pos) : 0) + +#define RAW_OFFSET(self) \ + (((VALID_READ_BUFFER(self) || VALID_WRITE_BUFFER(self)) \ + && self->raw_pos >= 0) ? self->raw_pos - self->pos : 0) + +#define RAW_TELL(self) \ + (self->abs_pos != -1 ? self->abs_pos : _buffered_raw_tell(self)) + +#define MINUS_LAST_BLOCK(self, size) \ + (self->buffer_mask ? \ + (size & ~self->buffer_mask) : \ + (self->buffer_size * (size / self->buffer_size))) + + +static void +buffered_dealloc(buffered *self) +{ + if (self->ok && _PyIOBase_finalize((PyObject *) self) < 0) + return; + _PyObject_GC_UNTRACK(self); + self->ok = 0; + if (self->weakreflist != NULL) + PyObject_ClearWeakRefs((PyObject *)self); + Py_CLEAR(self->raw); + if (self->buffer) { + PyMem_Free(self->buffer); + self->buffer = NULL; + } +#ifdef WITH_THREAD + if (self->lock) { + PyThread_free_lock(self->lock); + self->lock = NULL; + } +#endif + Py_CLEAR(self->dict); + Py_TYPE(self)->tp_free((PyObject *)self); +} + +static int +buffered_traverse(buffered *self, visitproc visit, void *arg) +{ + Py_VISIT(self->raw); + Py_VISIT(self->dict); + return 0; +} + +static int +buffered_clear(buffered *self) +{ + if (self->ok && _PyIOBase_finalize((PyObject *) self) < 0) + return -1; + self->ok = 0; + Py_CLEAR(self->raw); + Py_CLEAR(self->dict); + return 0; +} + +/* + * _BufferedIOMixin methods + * This is not a class, just a collection of methods that will be reused + * by BufferedReader and BufferedWriter + */ + +/* Flush and close */ + +static PyObject * +buffered_simple_flush(buffered *self, PyObject *args) +{ + CHECK_INITIALIZED(self) + return PyObject_CallMethodObjArgs(self->raw, _PyIO_str_flush, NULL); +} + +static int +buffered_closed(buffered *self) +{ + int closed; + PyObject *res; + CHECK_INITIALIZED_INT(self) + res = PyObject_GetAttr(self->raw, _PyIO_str_closed); + if (res == NULL) + return -1; + closed = PyObject_IsTrue(res); + Py_DECREF(res); + return closed; +} + +static PyObject * +buffered_closed_get(buffered *self, void *context) +{ + CHECK_INITIALIZED(self) + return PyObject_GetAttr(self->raw, _PyIO_str_closed); +} + +static PyObject * +buffered_close(buffered *self, PyObject *args) +{ + PyObject *res = NULL; + int r; + + CHECK_INITIALIZED(self) + ENTER_BUFFERED(self) + + r = buffered_closed(self); + if (r < 0) + goto end; + if (r > 0) { + res = Py_None; + Py_INCREF(res); + goto end; + } + /* flush() will most probably re-take the lock, so drop it first */ + LEAVE_BUFFERED(self) + res = PyObject_CallMethodObjArgs((PyObject *)self, _PyIO_str_flush, NULL); + ENTER_BUFFERED(self) + if (res == NULL) { + /* If flush() fails, just give up */ + if (PyErr_ExceptionMatches(PyExc_IOError)) + PyErr_Clear(); + else + goto end; + } + Py_XDECREF(res); + + res = PyObject_CallMethodObjArgs(self->raw, _PyIO_str_close, NULL); + +end: + LEAVE_BUFFERED(self) + return res; +} + +/* detach */ + +static PyObject * +buffered_detach(buffered *self, PyObject *args) +{ + PyObject *raw, *res; + CHECK_INITIALIZED(self) + res = PyObject_CallMethodObjArgs((PyObject *)self, _PyIO_str_flush, NULL); + if (res == NULL) + return NULL; + Py_DECREF(res); + raw = self->raw; + self->raw = NULL; + self->detached = 1; + self->ok = 0; + return raw; +} + +/* Inquiries */ + +static PyObject * +buffered_seekable(buffered *self, PyObject *args) +{ + CHECK_INITIALIZED(self) + return PyObject_CallMethodObjArgs(self->raw, _PyIO_str_seekable, NULL); +} + +static PyObject * +buffered_readable(buffered *self, PyObject *args) +{ + CHECK_INITIALIZED(self) + return PyObject_CallMethodObjArgs(self->raw, _PyIO_str_readable, NULL); +} + +static PyObject * +buffered_writable(buffered *self, PyObject *args) +{ + CHECK_INITIALIZED(self) + return PyObject_CallMethodObjArgs(self->raw, _PyIO_str_writable, NULL); +} + +static PyObject * +buffered_name_get(buffered *self, void *context) +{ + CHECK_INITIALIZED(self) + return PyObject_GetAttrString(self->raw, "name"); +} + +static PyObject * +buffered_mode_get(buffered *self, void *context) +{ + CHECK_INITIALIZED(self) + return PyObject_GetAttrString(self->raw, "mode"); +} + +/* Lower-level APIs */ + +static PyObject * +buffered_fileno(buffered *self, PyObject *args) +{ + CHECK_INITIALIZED(self) + return PyObject_CallMethodObjArgs(self->raw, _PyIO_str_fileno, NULL); +} + +static PyObject * +buffered_isatty(buffered *self, PyObject *args) +{ + CHECK_INITIALIZED(self) + return PyObject_CallMethodObjArgs(self->raw, _PyIO_str_isatty, NULL); +} + + +/* Forward decls */ +static PyObject * +_bufferedwriter_flush_unlocked(buffered *, int); +static Py_ssize_t +_bufferedreader_fill_buffer(buffered *self); +static void +_bufferedreader_reset_buf(buffered *self); +static void +_bufferedwriter_reset_buf(buffered *self); +static PyObject * +_bufferedreader_peek_unlocked(buffered *self, Py_ssize_t); +static PyObject * +_bufferedreader_read_all(buffered *self); +static PyObject * +_bufferedreader_read_fast(buffered *self, Py_ssize_t); +static PyObject * +_bufferedreader_read_generic(buffered *self, Py_ssize_t); + + +/* + * Helpers + */ + +/* Returns the address of the `written` member if a BlockingIOError was + raised, NULL otherwise. The error is always re-raised. */ +static Py_ssize_t * +_buffered_check_blocking_error(void) +{ + PyObject *t, *v, *tb; + PyBlockingIOErrorObject *err; + + PyErr_Fetch(&t, &v, &tb); + if (v == NULL || !PyErr_GivenExceptionMatches(v, PyExc_BlockingIOError)) { + PyErr_Restore(t, v, tb); + return NULL; + } + err = (PyBlockingIOErrorObject *) v; + /* TODO: sanity check (err->written >= 0) */ + PyErr_Restore(t, v, tb); + return &err->written; +} + +static Py_off_t +_buffered_raw_tell(buffered *self) +{ + Py_off_t n; + PyObject *res; + res = PyObject_CallMethodObjArgs(self->raw, _PyIO_str_tell, NULL); + if (res == NULL) + return -1; + n = PyNumber_AsOff_t(res, PyExc_ValueError); + Py_DECREF(res); + if (n < 0) { + if (!PyErr_Occurred()) + PyErr_Format(PyExc_IOError, + "Raw stream returned invalid position %zd", n); + return -1; + } + self->abs_pos = n; + return n; +} + +static Py_off_t +_buffered_raw_seek(buffered *self, Py_off_t target, int whence) +{ + PyObject *res, *posobj, *whenceobj; + Py_off_t n; + + posobj = PyLong_FromOff_t(target); + if (posobj == NULL) + return -1; + whenceobj = PyLong_FromLong(whence); + if (whenceobj == NULL) { + Py_DECREF(posobj); + return -1; + } + res = PyObject_CallMethodObjArgs(self->raw, _PyIO_str_seek, + posobj, whenceobj, NULL); + Py_DECREF(posobj); + Py_DECREF(whenceobj); + if (res == NULL) + return -1; + n = PyNumber_AsOff_t(res, PyExc_ValueError); + Py_DECREF(res); + if (n < 0) { + if (!PyErr_Occurred()) + PyErr_Format(PyExc_IOError, + "Raw stream returned invalid position %zd", n); + return -1; + } + self->abs_pos = n; + return n; +} + +static int +_buffered_init(buffered *self) +{ + Py_ssize_t n; + if (self->buffer_size <= 0) { + PyErr_SetString(PyExc_ValueError, + "buffer size must be strictly positive"); + return -1; + } + if (self->buffer) + PyMem_Free(self->buffer); + self->buffer = PyMem_Malloc(self->buffer_size); + if (self->buffer == NULL) { + PyErr_NoMemory(); + return -1; + } +#ifdef WITH_THREAD + self->lock = PyThread_allocate_lock(); + if (self->lock == NULL) { + PyErr_SetString(PyExc_RuntimeError, "can't allocate read lock"); + return -1; + } +#endif + /* Find out whether buffer_size is a power of 2 */ + /* XXX is this optimization useful? */ + for (n = self->buffer_size - 1; n & 1; n >>= 1) + ; + if (n == 0) + self->buffer_mask = self->buffer_size - 1; + else + self->buffer_mask = 0; + if (_buffered_raw_tell(self) == -1) + PyErr_Clear(); + return 0; +} + +/* + * Shared methods and wrappers + */ + +static PyObject * +buffered_flush(buffered *self, PyObject *args) +{ + PyObject *res; + + CHECK_INITIALIZED(self) + CHECK_CLOSED(self, "flush of closed file") + + ENTER_BUFFERED(self) + res = _bufferedwriter_flush_unlocked(self, 0); + if (res != NULL && self->readable) { + /* Rewind the raw stream so that its position corresponds to + the current logical position. */ + Py_off_t n; + n = _buffered_raw_seek(self, -RAW_OFFSET(self), 1); + if (n == -1) + Py_CLEAR(res); + _bufferedreader_reset_buf(self); + } + LEAVE_BUFFERED(self) + + return res; +} + +static PyObject * +buffered_peek(buffered *self, PyObject *args) +{ + Py_ssize_t n = 0; + PyObject *res = NULL; + + CHECK_INITIALIZED(self) + if (!PyArg_ParseTuple(args, "|n:peek", &n)) { + return NULL; + } + + ENTER_BUFFERED(self) + + if (self->writable) { + res = _bufferedwriter_flush_unlocked(self, 1); + if (res == NULL) + goto end; + Py_CLEAR(res); + } + res = _bufferedreader_peek_unlocked(self, n); + +end: + LEAVE_BUFFERED(self) + return res; +} + +static PyObject * +buffered_read(buffered *self, PyObject *args) +{ + Py_ssize_t n = -1; + PyObject *res; + + CHECK_INITIALIZED(self) + if (!PyArg_ParseTuple(args, "|n:read", &n)) { + return NULL; + } + if (n < -1) { + PyErr_SetString(PyExc_ValueError, + "read length must be positive or -1"); + return NULL; + } + + CHECK_CLOSED(self, "read of closed file") + + if (n == -1) { + /* The number of bytes is unspecified, read until the end of stream */ + ENTER_BUFFERED(self) + res = _bufferedreader_read_all(self); + LEAVE_BUFFERED(self) + } + else { + res = _bufferedreader_read_fast(self, n); + if (res == Py_None) { + Py_DECREF(res); + ENTER_BUFFERED(self) + res = _bufferedreader_read_generic(self, n); + LEAVE_BUFFERED(self) + } + } + + return res; +} + +static PyObject * +buffered_read1(buffered *self, PyObject *args) +{ + Py_ssize_t n, have, r; + PyObject *res = NULL; + + CHECK_INITIALIZED(self) + if (!PyArg_ParseTuple(args, "n:read1", &n)) { + return NULL; + } + + if (n < 0) { + PyErr_SetString(PyExc_ValueError, + "read length must be positive"); + return NULL; + } + if (n == 0) + return PyBytes_FromStringAndSize(NULL, 0); + + ENTER_BUFFERED(self) + + if (self->writable) { + res = _bufferedwriter_flush_unlocked(self, 1); + if (res == NULL) + goto end; + Py_CLEAR(res); + } + + /* Return up to n bytes. If at least one byte is buffered, we + only return buffered bytes. Otherwise, we do one raw read. */ + + /* XXX: this mimicks the io.py implementation but is probably wrong. + If we need to read from the raw stream, then we could actually read + all `n` bytes asked by the caller (and possibly more, so as to fill + our buffer for the next reads). */ + + have = Py_SAFE_DOWNCAST(READAHEAD(self), Py_off_t, Py_ssize_t); + if (have > 0) { + if (n > have) + n = have; + res = PyBytes_FromStringAndSize(self->buffer + self->pos, n); + if (res == NULL) + goto end; + self->pos += n; + goto end; + } + + /* Fill the buffer from the raw stream, and copy it to the result. */ + _bufferedreader_reset_buf(self); + r = _bufferedreader_fill_buffer(self); + if (r == -1) + goto end; + if (r == -2) + r = 0; + if (n > r) + n = r; + res = PyBytes_FromStringAndSize(self->buffer, n); + if (res == NULL) + goto end; + self->pos = n; + +end: + LEAVE_BUFFERED(self) + return res; +} + +static PyObject * +buffered_readinto(buffered *self, PyObject *args) +{ + PyObject *res = NULL; + + CHECK_INITIALIZED(self) + + /* TODO: use raw.readinto() instead! */ + if (self->writable) { + ENTER_BUFFERED(self) + res = _bufferedwriter_flush_unlocked(self, 0); + LEAVE_BUFFERED(self) + if (res == NULL) + goto end; + Py_DECREF(res); + } + res = bufferediobase_readinto((PyObject *)self, args); + +end: + return res; +} + +static PyObject * +_buffered_readline(buffered *self, Py_ssize_t limit) +{ + PyObject *res = NULL; + PyObject *chunks = NULL; + Py_ssize_t n, written = 0; + const char *start, *s, *end; + + CHECK_CLOSED(self, "readline of closed file") + + /* First, try to find a line in the buffer. This can run unlocked because + the calls to the C API are simple enough that they can't trigger + any thread switch. */ + n = Py_SAFE_DOWNCAST(READAHEAD(self), Py_off_t, Py_ssize_t); + if (limit >= 0 && n > limit) + n = limit; + start = self->buffer + self->pos; + s = memchr(start, '\n', n); + if (s != NULL) { + res = PyBytes_FromStringAndSize(start, s - start + 1); + if (res != NULL) + self->pos += s - start + 1; + goto end_unlocked; + } + if (n == limit) { + res = PyBytes_FromStringAndSize(start, n); + if (res != NULL) + self->pos += n; + goto end_unlocked; + } + + ENTER_BUFFERED(self) + + /* Now we try to get some more from the raw stream */ + if (self->writable) { + res = _bufferedwriter_flush_unlocked(self, 1); + if (res == NULL) + goto end; + Py_CLEAR(res); + } + chunks = PyList_New(0); + if (chunks == NULL) + goto end; + if (n > 0) { + res = PyBytes_FromStringAndSize(start, n); + if (res == NULL) + goto end; + if (PyList_Append(chunks, res) < 0) { + Py_CLEAR(res); + goto end; + } + Py_CLEAR(res); + written += n; + if (limit >= 0) + limit -= n; + } + + for (;;) { + _bufferedreader_reset_buf(self); + n = _bufferedreader_fill_buffer(self); + if (n == -1) + goto end; + if (n <= 0) + break; + if (limit >= 0 && n > limit) + n = limit; + start = self->buffer; + end = start + n; + s = start; + while (s < end) { + if (*s++ == '\n') { + res = PyBytes_FromStringAndSize(start, s - start); + if (res == NULL) + goto end; + self->pos = s - start; + goto found; + } + } + res = PyBytes_FromStringAndSize(start, n); + if (res == NULL) + goto end; + if (n == limit) { + self->pos = n; + break; + } + if (PyList_Append(chunks, res) < 0) { + Py_CLEAR(res); + goto end; + } + Py_CLEAR(res); + written += n; + if (limit >= 0) + limit -= n; + } +found: + if (res != NULL && PyList_Append(chunks, res) < 0) { + Py_CLEAR(res); + goto end; + } + Py_CLEAR(res); + res = _PyBytes_Join(_PyIO_empty_bytes, chunks); + +end: + LEAVE_BUFFERED(self) +end_unlocked: + Py_XDECREF(chunks); + return res; +} + +static PyObject * +buffered_readline(buffered *self, PyObject *args) +{ + PyObject *limitobj = NULL; + Py_ssize_t limit = -1; + + CHECK_INITIALIZED(self) + + if (!PyArg_ParseTuple(args, "|O:readline", &limitobj)) { + return NULL; + } + if (limitobj) { + if (!PyNumber_Check(limitobj)) { + PyErr_Format(PyExc_TypeError, + "integer argument expected, got '%.200s'", + Py_TYPE(limitobj)->tp_name); + return NULL; + } + limit = PyNumber_AsSsize_t(limitobj, PyExc_OverflowError); + if (limit == -1 && PyErr_Occurred()) + return NULL; + } + return _buffered_readline(self, limit); +} + + +static PyObject * +buffered_tell(buffered *self, PyObject *args) +{ + Py_off_t pos; + + CHECK_INITIALIZED(self) + pos = _buffered_raw_tell(self); + if (pos == -1) + return NULL; + pos -= RAW_OFFSET(self); + /* TODO: sanity check (pos >= 0) */ + return PyLong_FromOff_t(pos); +} + +static PyObject * +buffered_seek(buffered *self, PyObject *args) +{ + Py_off_t target, n; + int whence = 0; + PyObject *targetobj, *res = NULL; + + CHECK_INITIALIZED(self) + if (!PyArg_ParseTuple(args, "O|i:seek", &targetobj, &whence)) { + return NULL; + } + if (whence < 0 || whence > 2) { + PyErr_Format(PyExc_ValueError, + "whence must be between 0 and 2, not %d", whence); + return NULL; + } + + CHECK_CLOSED(self, "seek of closed file") + + target = PyNumber_AsOff_t(targetobj, PyExc_ValueError); + if (target == -1 && PyErr_Occurred()) + return NULL; + + if (whence != 2 && self->readable) { + Py_off_t current, avail; + /* Check if seeking leaves us inside the current buffer, + so as to return quickly if possible. Also, we needn't take the + lock in this fast path. + Don't know how to do that when whence == 2, though. */ + /* NOTE: RAW_TELL() can release the GIL but the object is in a stable + state at this point. */ + current = RAW_TELL(self); + avail = READAHEAD(self); + if (avail > 0) { + Py_off_t offset; + if (whence == 0) + offset = target - (current - RAW_OFFSET(self)); + else + offset = target; + if (offset >= -self->pos && offset <= avail) { + self->pos += offset; + return PyLong_FromOff_t(current - avail + offset); + } + } + } + + ENTER_BUFFERED(self) + + /* Fallback: invoke raw seek() method and clear buffer */ + if (self->writable) { + res = _bufferedwriter_flush_unlocked(self, 0); + if (res == NULL) + goto end; + Py_CLEAR(res); + _bufferedwriter_reset_buf(self); + } + + /* TODO: align on block boundary and read buffer if needed? */ + if (whence == 1) + target -= RAW_OFFSET(self); + n = _buffered_raw_seek(self, target, whence); + if (n == -1) + goto end; + self->raw_pos = -1; + res = PyLong_FromOff_t(n); + if (res != NULL && self->readable) + _bufferedreader_reset_buf(self); + +end: + LEAVE_BUFFERED(self) + return res; +} + +static PyObject * +buffered_truncate(buffered *self, PyObject *args) +{ + PyObject *pos = Py_None; + PyObject *res = NULL; + + CHECK_INITIALIZED(self) + if (!PyArg_ParseTuple(args, "|O:truncate", &pos)) { + return NULL; + } + + ENTER_BUFFERED(self) + + if (self->writable) { + res = _bufferedwriter_flush_unlocked(self, 0); + if (res == NULL) + goto end; + Py_CLEAR(res); + } + if (self->readable) { + if (pos == Py_None) { + /* Rewind the raw stream so that its position corresponds to + the current logical position. */ + if (_buffered_raw_seek(self, -RAW_OFFSET(self), 1) == -1) + goto end; + } + _bufferedreader_reset_buf(self); + } + res = PyObject_CallMethodObjArgs(self->raw, _PyIO_str_truncate, pos, NULL); + if (res == NULL) + goto end; + /* Reset cached position */ + if (_buffered_raw_tell(self) == -1) + PyErr_Clear(); + +end: + LEAVE_BUFFERED(self) + return res; +} + +static PyObject * +buffered_iternext(buffered *self) +{ + PyObject *line; + PyTypeObject *tp; + + CHECK_INITIALIZED(self); + + tp = Py_TYPE(self); + if (tp == &PyBufferedReader_Type || + tp == &PyBufferedRandom_Type) { + /* Skip method call overhead for speed */ + line = _buffered_readline(self, -1); + } + else { + line = PyObject_CallMethodObjArgs((PyObject *)self, + _PyIO_str_readline, NULL); + if (line && !PyBytes_Check(line)) { + PyErr_Format(PyExc_IOError, + "readline() should have returned a bytes object, " + "not '%.200s'", Py_TYPE(line)->tp_name); + Py_DECREF(line); + return NULL; + } + } + + if (line == NULL) + return NULL; + + if (PyBytes_GET_SIZE(line) == 0) { + /* Reached EOF or would have blocked */ + Py_DECREF(line); + return NULL; + } + + return line; +} + +static PyObject * +buffered_repr(buffered *self) +{ + PyObject *nameobj, *res; + + nameobj = PyObject_GetAttrString((PyObject *) self, "name"); + if (nameobj == NULL) { + if (PyErr_ExceptionMatches(PyExc_AttributeError)) + PyErr_Clear(); + else + return NULL; + res = PyString_FromFormat("<%s>", Py_TYPE(self)->tp_name); + } + else { + PyObject *repr = PyObject_Repr(nameobj); + Py_DECREF(nameobj); + if (repr == NULL) + return NULL; + res = PyString_FromFormat("<%s name=%s>", + Py_TYPE(self)->tp_name, + PyString_AS_STRING(repr)); + Py_DECREF(repr); + } + return res; +} + +/* + * class BufferedReader + */ + +PyDoc_STRVAR(bufferedreader_doc, + "Create a new buffered reader using the given readable raw IO object."); + +static void _bufferedreader_reset_buf(buffered *self) +{ + self->read_end = -1; +} + +static int +bufferedreader_init(buffered *self, PyObject *args, PyObject *kwds) +{ + char *kwlist[] = {"raw", "buffer_size", NULL}; + Py_ssize_t buffer_size = DEFAULT_BUFFER_SIZE; + PyObject *raw; + + self->ok = 0; + self->detached = 0; + + if (!PyArg_ParseTupleAndKeywords(args, kwds, "O|n:BufferedReader", kwlist, + &raw, &buffer_size)) { + return -1; + } + + if (_PyIOBase_check_readable(raw, Py_True) == NULL) + return -1; + + Py_CLEAR(self->raw); + Py_INCREF(raw); + self->raw = raw; + self->buffer_size = buffer_size; + self->readable = 1; + self->writable = 0; + + if (_buffered_init(self) < 0) + return -1; + _bufferedreader_reset_buf(self); + + self->fast_closed_checks = (Py_TYPE(self) == &PyBufferedReader_Type && + Py_TYPE(raw) == &PyFileIO_Type); + + self->ok = 1; + return 0; +} + +static Py_ssize_t +_bufferedreader_raw_read(buffered *self, char *start, Py_ssize_t len) +{ + Py_buffer buf; + PyObject *memobj, *res; + Py_ssize_t n; + /* NOTE: the buffer needn't be released as its object is NULL. */ + if (PyBuffer_FillInfo(&buf, NULL, start, len, 0, PyBUF_CONTIG) == -1) + return -1; + memobj = PyMemoryView_FromBuffer(&buf); + if (memobj == NULL) + return -1; + res = PyObject_CallMethodObjArgs(self->raw, _PyIO_str_readinto, memobj, NULL); + Py_DECREF(memobj); + if (res == NULL) + return -1; + if (res == Py_None) { + /* Non-blocking stream would have blocked. Special return code! */ + Py_DECREF(res); + return -2; + } + n = PyNumber_AsSsize_t(res, PyExc_ValueError); + Py_DECREF(res); + if (n < 0 || n > len) { + PyErr_Format(PyExc_IOError, + "raw readinto() returned invalid length %zd " + "(should have been between 0 and %zd)", n, len); + return -1; + } + if (n > 0 && self->abs_pos != -1) + self->abs_pos += n; + return n; +} + +static Py_ssize_t +_bufferedreader_fill_buffer(buffered *self) +{ + Py_ssize_t start, len, n; + if (VALID_READ_BUFFER(self)) + start = Py_SAFE_DOWNCAST(self->read_end, Py_off_t, Py_ssize_t); + else + start = 0; + len = self->buffer_size - start; + n = _bufferedreader_raw_read(self, self->buffer + start, len); + if (n <= 0) + return n; + self->read_end = start + n; + self->raw_pos = start + n; + return n; +} + +static PyObject * +_bufferedreader_read_all(buffered *self) +{ + Py_ssize_t current_size; + PyObject *res, *data = NULL; + PyObject *chunks = PyList_New(0); + + if (chunks == NULL) + return NULL; + + /* First copy what we have in the current buffer. */ + current_size = Py_SAFE_DOWNCAST(READAHEAD(self), Py_off_t, Py_ssize_t); + if (current_size) { + data = PyBytes_FromStringAndSize( + self->buffer + self->pos, current_size); + if (data == NULL) { + Py_DECREF(chunks); + return NULL; + } + } + _bufferedreader_reset_buf(self); + /* We're going past the buffer's bounds, flush it */ + if (self->writable) { + res = _bufferedwriter_flush_unlocked(self, 1); + if (res == NULL) { + Py_DECREF(chunks); + return NULL; + } + Py_CLEAR(res); + } + while (1) { + if (data) { + if (PyList_Append(chunks, data) < 0) { + Py_DECREF(data); + Py_DECREF(chunks); + return NULL; + } + Py_DECREF(data); + } + + /* Read until EOF or until read() would block. */ + data = PyObject_CallMethodObjArgs(self->raw, _PyIO_str_read, NULL); + if (data == NULL) { + Py_DECREF(chunks); + return NULL; + } + if (data != Py_None && !PyBytes_Check(data)) { + Py_DECREF(data); + Py_DECREF(chunks); + PyErr_SetString(PyExc_TypeError, "read() should return bytes"); + return NULL; + } + if (data == Py_None || PyBytes_GET_SIZE(data) == 0) { + if (current_size == 0) { + Py_DECREF(chunks); + return data; + } + else { + res = _PyBytes_Join(_PyIO_empty_bytes, chunks); + Py_DECREF(data); + Py_DECREF(chunks); + return res; + } + } + current_size += PyBytes_GET_SIZE(data); + if (self->abs_pos != -1) + self->abs_pos += PyBytes_GET_SIZE(data); + } +} + +/* Read n bytes from the buffer if it can, otherwise return None. + This function is simple enough that it can run unlocked. */ +static PyObject * +_bufferedreader_read_fast(buffered *self, Py_ssize_t n) +{ + Py_ssize_t current_size; + + current_size = Py_SAFE_DOWNCAST(READAHEAD(self), Py_off_t, Py_ssize_t); + if (n <= current_size) { + /* Fast path: the data to read is fully buffered. */ + PyObject *res = PyBytes_FromStringAndSize(self->buffer + self->pos, n); + if (res != NULL) + self->pos += n; + return res; + } + Py_RETURN_NONE; +} + +/* Generic read function: read from the stream until enough bytes are read, + * or until an EOF occurs or until read() would block. + */ +static PyObject * +_bufferedreader_read_generic(buffered *self, Py_ssize_t n) +{ + PyObject *res = NULL; + Py_ssize_t current_size, remaining, written; + char *out; + + current_size = Py_SAFE_DOWNCAST(READAHEAD(self), Py_off_t, Py_ssize_t); + if (n <= current_size) + return _bufferedreader_read_fast(self, n); + + res = PyBytes_FromStringAndSize(NULL, n); + if (res == NULL) + goto error; + out = PyBytes_AS_STRING(res); + remaining = n; + written = 0; + if (current_size > 0) { + memcpy(out, self->buffer + self->pos, current_size); + remaining -= current_size; + written += current_size; + } + _bufferedreader_reset_buf(self); + while (remaining > 0) { + /* We want to read a whole block at the end into buffer. + If we had readv() we could do this in one pass. */ + Py_ssize_t r = MINUS_LAST_BLOCK(self, remaining); + if (r == 0) + break; + r = _bufferedreader_raw_read(self, out + written, r); + if (r == -1) + goto error; + if (r == 0 || r == -2) { + /* EOF occurred or read() would block. */ + if (r == 0 || written > 0) { + if (_PyBytes_Resize(&res, written)) + goto error; + return res; + } + Py_DECREF(res); + Py_INCREF(Py_None); + return Py_None; + } + remaining -= r; + written += r; + } + assert(remaining <= self->buffer_size); + self->pos = 0; + self->raw_pos = 0; + self->read_end = 0; + while (self->read_end < self->buffer_size) { + Py_ssize_t r = _bufferedreader_fill_buffer(self); + if (r == -1) + goto error; + if (r == 0 || r == -2) { + /* EOF occurred or read() would block. */ + if (r == 0 || written > 0) { + if (_PyBytes_Resize(&res, written)) + goto error; + return res; + } + Py_DECREF(res); + Py_INCREF(Py_None); + return Py_None; + } + if (remaining > r) { + memcpy(out + written, self->buffer + self->pos, r); + written += r; + self->pos += r; + remaining -= r; + } + else if (remaining > 0) { + memcpy(out + written, self->buffer + self->pos, remaining); + written += remaining; + self->pos += remaining; + remaining = 0; + } + if (remaining == 0) + break; + } + + return res; + +error: + Py_XDECREF(res); + return NULL; +} + +static PyObject * +_bufferedreader_peek_unlocked(buffered *self, Py_ssize_t n) +{ + Py_ssize_t have, r; + + have = Py_SAFE_DOWNCAST(READAHEAD(self), Py_off_t, Py_ssize_t); + /* Constraints: + 1. we don't want to advance the file position. + 2. we don't want to lose block alignment, so we can't shift the buffer + to make some place. + Therefore, we either return `have` bytes (if > 0), or a full buffer. + */ + if (have > 0) { + return PyBytes_FromStringAndSize(self->buffer + self->pos, have); + } + + /* Fill the buffer from the raw stream, and copy it to the result. */ + _bufferedreader_reset_buf(self); + r = _bufferedreader_fill_buffer(self); + if (r == -1) + return NULL; + if (r == -2) + r = 0; + self->pos = 0; + return PyBytes_FromStringAndSize(self->buffer, r); +} + +static PyMethodDef bufferedreader_methods[] = { + /* BufferedIOMixin methods */ + {"detach", (PyCFunction)buffered_detach, METH_NOARGS}, + {"flush", (PyCFunction)buffered_simple_flush, METH_NOARGS}, + {"close", (PyCFunction)buffered_close, METH_NOARGS}, + {"seekable", (PyCFunction)buffered_seekable, METH_NOARGS}, + {"readable", (PyCFunction)buffered_readable, METH_NOARGS}, + {"writable", (PyCFunction)buffered_writable, METH_NOARGS}, + {"fileno", (PyCFunction)buffered_fileno, METH_NOARGS}, + {"isatty", (PyCFunction)buffered_isatty, METH_NOARGS}, + + {"read", (PyCFunction)buffered_read, METH_VARARGS}, + {"peek", (PyCFunction)buffered_peek, METH_VARARGS}, + {"read1", (PyCFunction)buffered_read1, METH_VARARGS}, + {"readline", (PyCFunction)buffered_readline, METH_VARARGS}, + {"seek", (PyCFunction)buffered_seek, METH_VARARGS}, + {"tell", (PyCFunction)buffered_tell, METH_NOARGS}, + {"truncate", (PyCFunction)buffered_truncate, METH_VARARGS}, + {NULL, NULL} +}; + +static PyMemberDef bufferedreader_members[] = { + {"raw", T_OBJECT, offsetof(buffered, raw), 0}, + {NULL} +}; + +static PyGetSetDef bufferedreader_getset[] = { + {"closed", (getter)buffered_closed_get, NULL, NULL}, + {"name", (getter)buffered_name_get, NULL, NULL}, + {"mode", (getter)buffered_mode_get, NULL, NULL}, + {NULL} +}; + + +PyTypeObject PyBufferedReader_Type = { + PyVarObject_HEAD_INIT(NULL, 0) + "_io.BufferedReader", /*tp_name*/ + sizeof(buffered), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + (destructor)buffered_dealloc, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + 0, /*tp_compare */ + (reprfunc)buffered_repr, /*tp_repr*/ + 0, /*tp_as_number*/ + 0, /*tp_as_sequence*/ + 0, /*tp_as_mapping*/ + 0, /*tp_hash */ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + 0, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE + | Py_TPFLAGS_HAVE_GC, /*tp_flags*/ + bufferedreader_doc, /* tp_doc */ + (traverseproc)buffered_traverse, /* tp_traverse */ + (inquiry)buffered_clear, /* tp_clear */ + 0, /* tp_richcompare */ + offsetof(buffered, weakreflist), /*tp_weaklistoffset*/ + 0, /* tp_iter */ + (iternextfunc)buffered_iternext, /* tp_iternext */ + bufferedreader_methods, /* tp_methods */ + bufferedreader_members, /* tp_members */ + bufferedreader_getset, /* tp_getset */ + 0, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + offsetof(buffered, dict), /* tp_dictoffset */ + (initproc)bufferedreader_init, /* tp_init */ + 0, /* tp_alloc */ + PyType_GenericNew, /* tp_new */ +}; + + + +static int +complain_about_max_buffer_size(void) +{ + if (PyErr_WarnEx(PyExc_DeprecationWarning, + "max_buffer_size is deprecated", 1) < 0) + return 0; + return 1; +} + +/* + * class BufferedWriter + */ +PyDoc_STRVAR(bufferedwriter_doc, + "A buffer for a writeable sequential RawIO object.\n" + "\n" + "The constructor creates a BufferedWriter for the given writeable raw\n" + "stream. If the buffer_size is not given, it defaults to\n" + "DEFAULT_BUFFER_SIZE. max_buffer_size isn't used anymore.\n" + ); + +static void +_bufferedwriter_reset_buf(buffered *self) +{ + self->write_pos = 0; + self->write_end = -1; +} + +static int +bufferedwriter_init(buffered *self, PyObject *args, PyObject *kwds) +{ + /* TODO: properly deprecate max_buffer_size */ + char *kwlist[] = {"raw", "buffer_size", "max_buffer_size", NULL}; + Py_ssize_t buffer_size = DEFAULT_BUFFER_SIZE; + Py_ssize_t max_buffer_size = -234; + PyObject *raw; + + self->ok = 0; + self->detached = 0; + + if (!PyArg_ParseTupleAndKeywords(args, kwds, "O|nn:BufferedReader", kwlist, + &raw, &buffer_size, &max_buffer_size)) { + return -1; + } + + if (max_buffer_size != -234 && !complain_about_max_buffer_size()) + return -1; + + if (_PyIOBase_check_writable(raw, Py_True) == NULL) + return -1; + + Py_CLEAR(self->raw); + Py_INCREF(raw); + self->raw = raw; + self->readable = 0; + self->writable = 1; + + self->buffer_size = buffer_size; + if (_buffered_init(self) < 0) + return -1; + _bufferedwriter_reset_buf(self); + self->pos = 0; + + self->fast_closed_checks = (Py_TYPE(self) == &PyBufferedWriter_Type && + Py_TYPE(raw) == &PyFileIO_Type); + + self->ok = 1; + return 0; +} + +static Py_ssize_t +_bufferedwriter_raw_write(buffered *self, char *start, Py_ssize_t len) +{ + Py_buffer buf; + PyObject *memobj, *res; + Py_ssize_t n; + /* NOTE: the buffer needn't be released as its object is NULL. */ + if (PyBuffer_FillInfo(&buf, NULL, start, len, 1, PyBUF_CONTIG_RO) == -1) + return -1; + memobj = PyMemoryView_FromBuffer(&buf); + if (memobj == NULL) + return -1; + res = PyObject_CallMethodObjArgs(self->raw, _PyIO_str_write, memobj, NULL); + Py_DECREF(memobj); + if (res == NULL) + return -1; + n = PyNumber_AsSsize_t(res, PyExc_ValueError); + Py_DECREF(res); + if (n < 0 || n > len) { + PyErr_Format(PyExc_IOError, + "raw write() returned invalid length %zd " + "(should have been between 0 and %zd)", n, len); + return -1; + } + if (n > 0 && self->abs_pos != -1) + self->abs_pos += n; + return n; +} + +/* `restore_pos` is 1 if we need to restore the raw stream position at + the end, 0 otherwise. */ +static PyObject * +_bufferedwriter_flush_unlocked(buffered *self, int restore_pos) +{ + Py_ssize_t written = 0; + Py_off_t n, rewind; + + if (!VALID_WRITE_BUFFER(self) || self->write_pos == self->write_end) + goto end; + /* First, rewind */ + rewind = RAW_OFFSET(self) + (self->pos - self->write_pos); + if (rewind != 0) { + n = _buffered_raw_seek(self, -rewind, 1); + if (n < 0) { + goto error; + } + self->raw_pos -= rewind; + } + while (self->write_pos < self->write_end) { + n = _bufferedwriter_raw_write(self, + self->buffer + self->write_pos, + Py_SAFE_DOWNCAST(self->write_end - self->write_pos, + Py_off_t, Py_ssize_t)); + if (n == -1) { + Py_ssize_t *w = _buffered_check_blocking_error(); + if (w == NULL) + goto error; + self->write_pos += *w; + self->raw_pos = self->write_pos; + written += *w; + *w = written; + /* Already re-raised */ + goto error; + } + self->write_pos += n; + self->raw_pos = self->write_pos; + written += Py_SAFE_DOWNCAST(n, Py_off_t, Py_ssize_t); + } + + if (restore_pos) { + Py_off_t forward = rewind - written; + if (forward != 0) { + n = _buffered_raw_seek(self, forward, 1); + if (n < 0) { + goto error; + } + self->raw_pos += forward; + } + } + _bufferedwriter_reset_buf(self); + +end: + Py_RETURN_NONE; + +error: + return NULL; +} + +static PyObject * +bufferedwriter_write(buffered *self, PyObject *args) +{ + PyObject *res = NULL; + Py_buffer buf; + Py_ssize_t written, avail, remaining, n; + + CHECK_INITIALIZED(self) + if (!PyArg_ParseTuple(args, "s*:write", &buf)) { + return NULL; + } + + if (IS_CLOSED(self)) { + PyErr_SetString(PyExc_ValueError, "write to closed file"); + PyBuffer_Release(&buf); + return NULL; + } + + ENTER_BUFFERED(self) + + /* Fast path: the data to write can be fully buffered. */ + if (!VALID_READ_BUFFER(self) && !VALID_WRITE_BUFFER(self)) { + self->pos = 0; + self->raw_pos = 0; + } + avail = Py_SAFE_DOWNCAST(self->buffer_size - self->pos, Py_off_t, Py_ssize_t); + if (buf.len <= avail) { + memcpy(self->buffer + self->pos, buf.buf, buf.len); + if (!VALID_WRITE_BUFFER(self)) { + self->write_pos = self->pos; + } + ADJUST_POSITION(self, self->pos + buf.len); + if (self->pos > self->write_end) + self->write_end = self->pos; + written = buf.len; + goto end; + } + + /* First write the current buffer */ + res = _bufferedwriter_flush_unlocked(self, 0); + if (res == NULL) { + Py_ssize_t *w = _buffered_check_blocking_error(); + if (w == NULL) + goto error; + if (self->readable) + _bufferedreader_reset_buf(self); + /* Make some place by shifting the buffer. */ + assert(VALID_WRITE_BUFFER(self)); + memmove(self->buffer, self->buffer + self->write_pos, + Py_SAFE_DOWNCAST(self->write_end - self->write_pos, + Py_off_t, Py_ssize_t)); + self->write_end -= self->write_pos; + self->raw_pos -= self->write_pos; + self->pos -= self->write_pos; + self->write_pos = 0; + avail = Py_SAFE_DOWNCAST(self->buffer_size - self->write_end, + Py_off_t, Py_ssize_t); + if (buf.len <= avail) { + /* Everything can be buffered */ + PyErr_Clear(); + memcpy(self->buffer + self->write_end, buf.buf, buf.len); + self->write_end += buf.len; + written = buf.len; + goto end; + } + /* Buffer as much as possible. */ + memcpy(self->buffer + self->write_end, buf.buf, avail); + self->write_end += avail; + /* Already re-raised */ + *w = avail; + goto error; + } + Py_CLEAR(res); + + /* Then write buf itself. At this point the buffer has been emptied. */ + remaining = buf.len; + written = 0; + while (remaining > self->buffer_size) { + n = _bufferedwriter_raw_write( + self, (char *) buf.buf + written, buf.len - written); + if (n == -1) { + Py_ssize_t *w = _buffered_check_blocking_error(); + if (w == NULL) + goto error; + written += *w; + remaining -= *w; + if (remaining > self->buffer_size) { + /* Can't buffer everything, still buffer as much as possible */ + memcpy(self->buffer, + (char *) buf.buf + written, self->buffer_size); + self->raw_pos = 0; + ADJUST_POSITION(self, self->buffer_size); + self->write_end = self->buffer_size; + *w = written + self->buffer_size; + /* Already re-raised */ + goto error; + } + PyErr_Clear(); + break; + } + written += n; + remaining -= n; + } + if (self->readable) + _bufferedreader_reset_buf(self); + if (remaining > 0) { + memcpy(self->buffer, (char *) buf.buf + written, remaining); + written += remaining; + } + self->write_pos = 0; + /* TODO: sanity check (remaining >= 0) */ + self->write_end = remaining; + ADJUST_POSITION(self, remaining); + self->raw_pos = 0; + +end: + res = PyLong_FromSsize_t(written); + +error: + LEAVE_BUFFERED(self) + PyBuffer_Release(&buf); + return res; +} + +static PyMethodDef bufferedwriter_methods[] = { + /* BufferedIOMixin methods */ + {"close", (PyCFunction)buffered_close, METH_NOARGS}, + {"detach", (PyCFunction)buffered_detach, METH_NOARGS}, + {"seekable", (PyCFunction)buffered_seekable, METH_NOARGS}, + {"readable", (PyCFunction)buffered_readable, METH_NOARGS}, + {"writable", (PyCFunction)buffered_writable, METH_NOARGS}, + {"fileno", (PyCFunction)buffered_fileno, METH_NOARGS}, + {"isatty", (PyCFunction)buffered_isatty, METH_NOARGS}, + + {"write", (PyCFunction)bufferedwriter_write, METH_VARARGS}, + {"truncate", (PyCFunction)buffered_truncate, METH_VARARGS}, + {"flush", (PyCFunction)buffered_flush, METH_NOARGS}, + {"seek", (PyCFunction)buffered_seek, METH_VARARGS}, + {"tell", (PyCFunction)buffered_tell, METH_NOARGS}, + {NULL, NULL} +}; + +static PyMemberDef bufferedwriter_members[] = { + {"raw", T_OBJECT, offsetof(buffered, raw), 0}, + {NULL} +}; + +static PyGetSetDef bufferedwriter_getset[] = { + {"closed", (getter)buffered_closed_get, NULL, NULL}, + {"name", (getter)buffered_name_get, NULL, NULL}, + {"mode", (getter)buffered_mode_get, NULL, NULL}, + {NULL} +}; + + +PyTypeObject PyBufferedWriter_Type = { + PyVarObject_HEAD_INIT(NULL, 0) + "_io.BufferedWriter", /*tp_name*/ + sizeof(buffered), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + (destructor)buffered_dealloc, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + 0, /*tp_compare */ + (reprfunc)buffered_repr, /*tp_repr*/ + 0, /*tp_as_number*/ + 0, /*tp_as_sequence*/ + 0, /*tp_as_mapping*/ + 0, /*tp_hash */ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + 0, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE + | Py_TPFLAGS_HAVE_GC, /*tp_flags*/ + bufferedwriter_doc, /* tp_doc */ + (traverseproc)buffered_traverse, /* tp_traverse */ + (inquiry)buffered_clear, /* tp_clear */ + 0, /* tp_richcompare */ + offsetof(buffered, weakreflist), /*tp_weaklistoffset*/ + 0, /* tp_iter */ + 0, /* tp_iternext */ + bufferedwriter_methods, /* tp_methods */ + bufferedwriter_members, /* tp_members */ + bufferedwriter_getset, /* tp_getset */ + 0, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + offsetof(buffered, dict), /* tp_dictoffset */ + (initproc)bufferedwriter_init, /* tp_init */ + 0, /* tp_alloc */ + PyType_GenericNew, /* tp_new */ +}; + + + +/* + * BufferedRWPair + */ + +PyDoc_STRVAR(bufferedrwpair_doc, + "A buffered reader and writer object together.\n" + "\n" + "A buffered reader object and buffered writer object put together to\n" + "form a sequential IO object that can read and write. This is typically\n" + "used with a socket or two-way pipe.\n" + "\n" + "reader and writer are RawIOBase objects that are readable and\n" + "writeable respectively. If the buffer_size is omitted it defaults to\n" + "DEFAULT_BUFFER_SIZE.\n" + ); + +/* XXX The usefulness of this (compared to having two separate IO objects) is + * questionable. + */ + +typedef struct { + PyObject_HEAD + buffered *reader; + buffered *writer; + PyObject *dict; + PyObject *weakreflist; +} rwpair; + +static int +bufferedrwpair_init(rwpair *self, PyObject *args, PyObject *kwds) +{ + PyObject *reader, *writer; + Py_ssize_t buffer_size = DEFAULT_BUFFER_SIZE; + Py_ssize_t max_buffer_size = -234; + + if (!PyArg_ParseTuple(args, "OO|nn:BufferedRWPair", &reader, &writer, + &buffer_size, &max_buffer_size)) { + return -1; + } + + if (max_buffer_size != -234 && !complain_about_max_buffer_size()) + return -1; + + if (_PyIOBase_check_readable(reader, Py_True) == NULL) + return -1; + if (_PyIOBase_check_writable(writer, Py_True) == NULL) + return -1; + + self->reader = (buffered *) PyObject_CallFunction( + (PyObject *) &PyBufferedReader_Type, "On", reader, buffer_size); + if (self->reader == NULL) + return -1; + + self->writer = (buffered *) PyObject_CallFunction( + (PyObject *) &PyBufferedWriter_Type, "On", writer, buffer_size); + if (self->writer == NULL) { + Py_CLEAR(self->reader); + return -1; + } + + return 0; +} + +static int +bufferedrwpair_traverse(rwpair *self, visitproc visit, void *arg) +{ + Py_VISIT(self->dict); + return 0; +} + +static int +bufferedrwpair_clear(rwpair *self) +{ + Py_CLEAR(self->reader); + Py_CLEAR(self->writer); + Py_CLEAR(self->dict); + return 0; +} + +static void +bufferedrwpair_dealloc(rwpair *self) +{ + _PyObject_GC_UNTRACK(self); + Py_CLEAR(self->reader); + Py_CLEAR(self->writer); + Py_CLEAR(self->dict); + Py_TYPE(self)->tp_free((PyObject *) self); +} + +static PyObject * +_forward_call(buffered *self, const char *name, PyObject *args) +{ + PyObject *func = PyObject_GetAttrString((PyObject *)self, name); + PyObject *ret; + + if (func == NULL) { + PyErr_SetString(PyExc_AttributeError, name); + return NULL; + } + + ret = PyObject_CallObject(func, args); + Py_DECREF(func); + return ret; +} + +static PyObject * +bufferedrwpair_read(rwpair *self, PyObject *args) +{ + return _forward_call(self->reader, "read", args); +} + +static PyObject * +bufferedrwpair_peek(rwpair *self, PyObject *args) +{ + return _forward_call(self->reader, "peek", args); +} + +static PyObject * +bufferedrwpair_read1(rwpair *self, PyObject *args) +{ + return _forward_call(self->reader, "read1", args); +} + +static PyObject * +bufferedrwpair_readinto(rwpair *self, PyObject *args) +{ + return _forward_call(self->reader, "readinto", args); +} + +static PyObject * +bufferedrwpair_write(rwpair *self, PyObject *args) +{ + return _forward_call(self->writer, "write", args); +} + +static PyObject * +bufferedrwpair_flush(rwpair *self, PyObject *args) +{ + return _forward_call(self->writer, "flush", args); +} + +static PyObject * +bufferedrwpair_readable(rwpair *self, PyObject *args) +{ + return _forward_call(self->reader, "readable", args); +} + +static PyObject * +bufferedrwpair_writable(rwpair *self, PyObject *args) +{ + return _forward_call(self->writer, "writable", args); +} + +static PyObject * +bufferedrwpair_close(rwpair *self, PyObject *args) +{ + PyObject *ret = _forward_call(self->writer, "close", args); + if (ret == NULL) + return NULL; + Py_DECREF(ret); + + return _forward_call(self->reader, "close", args); +} + +static PyObject * +bufferedrwpair_isatty(rwpair *self, PyObject *args) +{ + PyObject *ret = _forward_call(self->writer, "isatty", args); + + if (ret != Py_False) { + /* either True or exception */ + return ret; + } + Py_DECREF(ret); + + return _forward_call(self->reader, "isatty", args); +} + +static PyObject * +bufferedrwpair_closed_get(rwpair *self, void *context) +{ + return PyObject_GetAttr((PyObject *) self->writer, _PyIO_str_closed); +} + +static PyMethodDef bufferedrwpair_methods[] = { + {"read", (PyCFunction)bufferedrwpair_read, METH_VARARGS}, + {"peek", (PyCFunction)bufferedrwpair_peek, METH_VARARGS}, + {"read1", (PyCFunction)bufferedrwpair_read1, METH_VARARGS}, + {"readinto", (PyCFunction)bufferedrwpair_readinto, METH_VARARGS}, + + {"write", (PyCFunction)bufferedrwpair_write, METH_VARARGS}, + {"flush", (PyCFunction)bufferedrwpair_flush, METH_NOARGS}, + + {"readable", (PyCFunction)bufferedrwpair_readable, METH_NOARGS}, + {"writable", (PyCFunction)bufferedrwpair_writable, METH_NOARGS}, + + {"close", (PyCFunction)bufferedrwpair_close, METH_NOARGS}, + {"isatty", (PyCFunction)bufferedrwpair_isatty, METH_NOARGS}, + + {NULL, NULL} +}; + +static PyGetSetDef bufferedrwpair_getset[] = { + {"closed", (getter)bufferedrwpair_closed_get, NULL, NULL}, + {NULL} +}; + +PyTypeObject PyBufferedRWPair_Type = { + PyVarObject_HEAD_INIT(NULL, 0) + "_io.BufferedRWPair", /*tp_name*/ + sizeof(rwpair), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + (destructor)bufferedrwpair_dealloc, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + 0, /*tp_compare */ + 0, /*tp_repr*/ + 0, /*tp_as_number*/ + 0, /*tp_as_sequence*/ + 0, /*tp_as_mapping*/ + 0, /*tp_hash */ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + 0, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE + | Py_TPFLAGS_HAVE_GC, /* tp_flags */ + bufferedrwpair_doc, /* tp_doc */ + (traverseproc)bufferedrwpair_traverse, /* tp_traverse */ + (inquiry)bufferedrwpair_clear, /* tp_clear */ + 0, /* tp_richcompare */ + offsetof(rwpair, weakreflist), /*tp_weaklistoffset*/ + 0, /* tp_iter */ + 0, /* tp_iternext */ + bufferedrwpair_methods, /* tp_methods */ + 0, /* tp_members */ + bufferedrwpair_getset, /* tp_getset */ + 0, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + offsetof(rwpair, dict), /* tp_dictoffset */ + (initproc)bufferedrwpair_init, /* tp_init */ + 0, /* tp_alloc */ + PyType_GenericNew, /* tp_new */ +}; + + + +/* + * BufferedRandom + */ + +PyDoc_STRVAR(bufferedrandom_doc, + "A buffered interface to random access streams.\n" + "\n" + "The constructor creates a reader and writer for a seekable stream,\n" + "raw, given in the first argument. If the buffer_size is omitted it\n" + "defaults to DEFAULT_BUFFER_SIZE. max_buffer_size isn't used anymore.\n" + ); + +static int +bufferedrandom_init(buffered *self, PyObject *args, PyObject *kwds) +{ + char *kwlist[] = {"raw", "buffer_size", "max_buffer_size", NULL}; + Py_ssize_t buffer_size = DEFAULT_BUFFER_SIZE; + Py_ssize_t max_buffer_size = -234; + PyObject *raw; + + self->ok = 0; + self->detached = 0; + + if (!PyArg_ParseTupleAndKeywords(args, kwds, "O|nn:BufferedReader", kwlist, + &raw, &buffer_size, &max_buffer_size)) { + return -1; + } + + if (max_buffer_size != -234 && !complain_about_max_buffer_size()) + return -1; + + if (_PyIOBase_check_seekable(raw, Py_True) == NULL) + return -1; + if (_PyIOBase_check_readable(raw, Py_True) == NULL) + return -1; + if (_PyIOBase_check_writable(raw, Py_True) == NULL) + return -1; + + Py_CLEAR(self->raw); + Py_INCREF(raw); + self->raw = raw; + self->buffer_size = buffer_size; + self->readable = 1; + self->writable = 1; + + if (_buffered_init(self) < 0) + return -1; + _bufferedreader_reset_buf(self); + _bufferedwriter_reset_buf(self); + self->pos = 0; + + self->fast_closed_checks = (Py_TYPE(self) == &PyBufferedRandom_Type && + Py_TYPE(raw) == &PyFileIO_Type); + + self->ok = 1; + return 0; +} + +static PyMethodDef bufferedrandom_methods[] = { + /* BufferedIOMixin methods */ + {"close", (PyCFunction)buffered_close, METH_NOARGS}, + {"detach", (PyCFunction)buffered_detach, METH_NOARGS}, + {"seekable", (PyCFunction)buffered_seekable, METH_NOARGS}, + {"readable", (PyCFunction)buffered_readable, METH_NOARGS}, + {"writable", (PyCFunction)buffered_writable, METH_NOARGS}, + {"fileno", (PyCFunction)buffered_fileno, METH_NOARGS}, + {"isatty", (PyCFunction)buffered_isatty, METH_NOARGS}, + + {"flush", (PyCFunction)buffered_flush, METH_NOARGS}, + + {"seek", (PyCFunction)buffered_seek, METH_VARARGS}, + {"tell", (PyCFunction)buffered_tell, METH_NOARGS}, + {"truncate", (PyCFunction)buffered_truncate, METH_VARARGS}, + {"read", (PyCFunction)buffered_read, METH_VARARGS}, + {"read1", (PyCFunction)buffered_read1, METH_VARARGS}, + {"readinto", (PyCFunction)buffered_readinto, METH_VARARGS}, + {"readline", (PyCFunction)buffered_readline, METH_VARARGS}, + {"peek", (PyCFunction)buffered_peek, METH_VARARGS}, + {"write", (PyCFunction)bufferedwriter_write, METH_VARARGS}, + {NULL, NULL} +}; + +static PyMemberDef bufferedrandom_members[] = { + {"raw", T_OBJECT, offsetof(buffered, raw), 0}, + {NULL} +}; + +static PyGetSetDef bufferedrandom_getset[] = { + {"closed", (getter)buffered_closed_get, NULL, NULL}, + {"name", (getter)buffered_name_get, NULL, NULL}, + {"mode", (getter)buffered_mode_get, NULL, NULL}, + {NULL} +}; + + +PyTypeObject PyBufferedRandom_Type = { + PyVarObject_HEAD_INIT(NULL, 0) + "_io.BufferedRandom", /*tp_name*/ + sizeof(buffered), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + (destructor)buffered_dealloc, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + 0, /*tp_compare */ + (reprfunc)buffered_repr, /*tp_repr*/ + 0, /*tp_as_number*/ + 0, /*tp_as_sequence*/ + 0, /*tp_as_mapping*/ + 0, /*tp_hash */ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + 0, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE + | Py_TPFLAGS_HAVE_GC, /*tp_flags*/ + bufferedrandom_doc, /* tp_doc */ + (traverseproc)buffered_traverse, /* tp_traverse */ + (inquiry)buffered_clear, /* tp_clear */ + 0, /* tp_richcompare */ + offsetof(buffered, weakreflist), /*tp_weaklistoffset*/ + 0, /* tp_iter */ + (iternextfunc)buffered_iternext, /* tp_iternext */ + bufferedrandom_methods, /* tp_methods */ + bufferedrandom_members, /* tp_members */ + bufferedrandom_getset, /* tp_getset */ + 0, /* tp_base */ + 0, /*tp_dict*/ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + offsetof(buffered, dict), /*tp_dictoffset*/ + (initproc)bufferedrandom_init, /* tp_init */ + 0, /* tp_alloc */ + PyType_GenericNew, /* tp_new */ +}; + Added: python/trunk/Modules/_io/bytesio.c ============================================================================== --- (empty file) +++ python/trunk/Modules/_io/bytesio.c Fri Jun 12 22:14:08 2009 @@ -0,0 +1,764 @@ +#include "Python.h" +#include "structmember.h" /* for offsetof() */ +#include "_iomodule.h" + +typedef struct { + PyObject_HEAD + char *buf; + Py_ssize_t pos; + Py_ssize_t string_size; + size_t buf_size; + PyObject *dict; + PyObject *weakreflist; +} bytesio; + +#define CHECK_CLOSED(self) \ + if ((self)->buf == NULL) { \ + PyErr_SetString(PyExc_ValueError, \ + "I/O operation on closed file."); \ + return NULL; \ + } + +/* Internal routine to get a line from the buffer of a BytesIO + object. Returns the length between the current position to the + next newline character. */ +static Py_ssize_t +get_line(bytesio *self, char **output) +{ + char *n; + const char *str_end; + Py_ssize_t len; + + assert(self->buf != NULL); + + /* Move to the end of the line, up to the end of the string, s. */ + str_end = self->buf + self->string_size; + for (n = self->buf + self->pos; + n < str_end && *n != '\n'; + n++); + + /* Skip the newline character */ + if (n < str_end) + n++; + + /* Get the length from the current position to the end of the line. */ + len = n - (self->buf + self->pos); + *output = self->buf + self->pos; + + assert(len >= 0); + assert(self->pos < PY_SSIZE_T_MAX - len); + self->pos += len; + + return len; +} + +/* Internal routine for changing the size of the buffer of BytesIO objects. + The caller should ensure that the 'size' argument is non-negative. Returns + 0 on success, -1 otherwise. */ +static int +resize_buffer(bytesio *self, size_t size) +{ + /* Here, unsigned types are used to avoid dealing with signed integer + overflow, which is undefined in C. */ + size_t alloc = self->buf_size; + char *new_buf = NULL; + + assert(self->buf != NULL); + + /* For simplicity, stay in the range of the signed type. Anyway, Python + doesn't allow strings to be longer than this. */ + if (size > PY_SSIZE_T_MAX) + goto overflow; + + if (size < alloc / 2) { + /* Major downsize; resize down to exact size. */ + alloc = size + 1; + } + else if (size < alloc) { + /* Within allocated size; quick exit */ + return 0; + } + else if (size <= alloc * 1.125) { + /* Moderate upsize; overallocate similar to list_resize() */ + alloc = size + (size >> 3) + (size < 9 ? 3 : 6); + } + else { + /* Major upsize; resize up to exact size */ + alloc = size + 1; + } + + if (alloc > ((size_t)-1) / sizeof(char)) + goto overflow; + new_buf = (char *)PyMem_Realloc(self->buf, alloc * sizeof(char)); + if (new_buf == NULL) { + PyErr_NoMemory(); + return -1; + } + self->buf_size = alloc; + self->buf = new_buf; + + return 0; + + overflow: + PyErr_SetString(PyExc_OverflowError, + "new buffer size too large"); + return -1; +} + +/* Internal routine for writing a string of bytes to the buffer of a BytesIO + object. Returns the number of bytes wrote, or -1 on error. */ +static Py_ssize_t +write_bytes(bytesio *self, const char *bytes, Py_ssize_t len) +{ + assert(self->buf != NULL); + assert(self->pos >= 0); + assert(len >= 0); + + if ((size_t)self->pos + len > self->buf_size) { + if (resize_buffer(self, (size_t)self->pos + len) < 0) + return -1; + } + + if (self->pos > self->string_size) { + /* In case of overseek, pad with null bytes the buffer region between + the end of stream and the current position. + + 0 lo string_size hi + | |<---used--->|<----------available----------->| + | | <--to pad-->|<---to write---> | + 0 buf position + */ + memset(self->buf + self->string_size, '\0', + (self->pos - self->string_size) * sizeof(char)); + } + + /* Copy the data to the internal buffer, overwriting some of the existing + data if self->pos < self->string_size. */ + memcpy(self->buf + self->pos, bytes, len); + self->pos += len; + + /* Set the new length of the internal string if it has changed. */ + if (self->string_size < self->pos) { + self->string_size = self->pos; + } + + return len; +} + +static PyObject * +bytesio_get_closed(bytesio *self) +{ + if (self->buf == NULL) { + Py_RETURN_TRUE; + } + else { + Py_RETURN_FALSE; + } +} + +/* Generic getter for the writable, readable and seekable properties */ +static PyObject * +return_true(bytesio *self) +{ + Py_RETURN_TRUE; +} + +PyDoc_STRVAR(flush_doc, +"flush() -> None. Does nothing."); + +static PyObject * +bytesio_flush(bytesio *self) +{ + Py_RETURN_NONE; +} + +PyDoc_STRVAR(getval_doc, +"getvalue() -> bytes.\n" +"\n" +"Retrieve the entire contents of the BytesIO object."); + +static PyObject * +bytesio_getvalue(bytesio *self) +{ + CHECK_CLOSED(self); + return PyBytes_FromStringAndSize(self->buf, self->string_size); +} + +PyDoc_STRVAR(isatty_doc, +"isatty() -> False.\n" +"\n" +"Always returns False since BytesIO objects are not connected\n" +"to a tty-like device."); + +static PyObject * +bytesio_isatty(bytesio *self) +{ + CHECK_CLOSED(self); + Py_RETURN_FALSE; +} + +PyDoc_STRVAR(tell_doc, +"tell() -> current file position, an integer\n"); + +static PyObject * +bytesio_tell(bytesio *self) +{ + CHECK_CLOSED(self); + return PyLong_FromSsize_t(self->pos); +} + +PyDoc_STRVAR(read_doc, +"read([size]) -> read at most size bytes, returned as a string.\n" +"\n" +"If the size argument is negative, read until EOF is reached.\n" +"Return an empty string at EOF."); + +static PyObject * +bytesio_read(bytesio *self, PyObject *args) +{ + Py_ssize_t size, n; + char *output; + PyObject *arg = Py_None; + + CHECK_CLOSED(self); + + if (!PyArg_ParseTuple(args, "|O:read", &arg)) + return NULL; + + if (PyNumber_Check(arg)) { + size = PyNumber_AsSsize_t(arg, PyExc_OverflowError); + if (size == -1 && PyErr_Occurred()) + return NULL; + } + else if (arg == Py_None) { + /* Read until EOF is reached, by default. */ + size = -1; + } + else { + PyErr_Format(PyExc_TypeError, "integer argument expected, got '%s'", + Py_TYPE(arg)->tp_name); + return NULL; + } + + /* adjust invalid sizes */ + n = self->string_size - self->pos; + if (size < 0 || size > n) { + size = n; + if (size < 0) + size = 0; + } + + assert(self->buf != NULL); + output = self->buf + self->pos; + self->pos += size; + + return PyBytes_FromStringAndSize(output, size); +} + + +PyDoc_STRVAR(read1_doc, +"read1(size) -> read at most size bytes, returned as a string.\n" +"\n" +"If the size argument is negative or omitted, read until EOF is reached.\n" +"Return an empty string at EOF."); + +static PyObject * +bytesio_read1(bytesio *self, PyObject *n) +{ + PyObject *arg, *res; + + arg = PyTuple_Pack(1, n); + if (arg == NULL) + return NULL; + res = bytesio_read(self, arg); + Py_DECREF(arg); + return res; +} + +PyDoc_STRVAR(readline_doc, +"readline([size]) -> next line from the file, as a string.\n" +"\n" +"Retain newline. A non-negative size argument limits the maximum\n" +"number of bytes to return (an incomplete line may be returned then).\n" +"Return an empty string at EOF.\n"); + +static PyObject * +bytesio_readline(bytesio *self, PyObject *args) +{ + Py_ssize_t size, n; + char *output; + PyObject *arg = Py_None; + + CHECK_CLOSED(self); + + if (!PyArg_ParseTuple(args, "|O:readline", &arg)) + return NULL; + + if (PyNumber_Check(arg)) { + size = PyNumber_AsSsize_t(arg, PyExc_OverflowError); + if (size == -1 && PyErr_Occurred()) + return NULL; + } + else if (arg == Py_None) { + /* No size limit, by default. */ + size = -1; + } + else { + PyErr_Format(PyExc_TypeError, "integer argument expected, got '%s'", + Py_TYPE(arg)->tp_name); + return NULL; + } + + n = get_line(self, &output); + + if (size >= 0 && size < n) { + size = n - size; + n -= size; + self->pos -= size; + } + + return PyBytes_FromStringAndSize(output, n); +} + +PyDoc_STRVAR(readlines_doc, +"readlines([size]) -> list of strings, each a line from the file.\n" +"\n" +"Call readline() repeatedly and return a list of the lines so read.\n" +"The optional size argument, if given, is an approximate bound on the\n" +"total number of bytes in the lines returned.\n"); + +static PyObject * +bytesio_readlines(bytesio *self, PyObject *args) +{ + Py_ssize_t maxsize, size, n; + PyObject *result, *line; + char *output; + PyObject *arg = Py_None; + + CHECK_CLOSED(self); + + if (!PyArg_ParseTuple(args, "|O:readlines", &arg)) + return NULL; + + if (PyNumber_Check(arg)) { + maxsize = PyNumber_AsSsize_t(arg, PyExc_OverflowError); + if (maxsize == -1 && PyErr_Occurred()) + return NULL; + } + else if (arg == Py_None) { + /* No size limit, by default. */ + maxsize = -1; + } + else { + PyErr_Format(PyExc_TypeError, "integer argument expected, got '%s'", + Py_TYPE(arg)->tp_name); + return NULL; + } + + size = 0; + result = PyList_New(0); + if (!result) + return NULL; + + while ((n = get_line(self, &output)) != 0) { + line = PyBytes_FromStringAndSize(output, n); + if (!line) + goto on_error; + if (PyList_Append(result, line) == -1) { + Py_DECREF(line); + goto on_error; + } + Py_DECREF(line); + size += n; + if (maxsize > 0 && size >= maxsize) + break; + } + return result; + + on_error: + Py_DECREF(result); + return NULL; +} + +PyDoc_STRVAR(readinto_doc, +"readinto(bytearray) -> int. Read up to len(b) bytes into b.\n" +"\n" +"Returns number of bytes read (0 for EOF), or None if the object\n" +"is set not to block as has no data to read."); + +static PyObject * +bytesio_readinto(bytesio *self, PyObject *args) +{ + Py_buffer buf; + Py_ssize_t len; + + CHECK_CLOSED(self); + + if (!PyArg_ParseTuple(args, "w*", &buf)) + return NULL; + + len = buf.len; + if (self->pos + len > self->string_size) + len = self->string_size - self->pos; + + memcpy(buf.buf, self->buf + self->pos, len); + assert(self->pos + len < PY_SSIZE_T_MAX); + assert(len >= 0); + self->pos += len; + + PyBuffer_Release(&buf); + return PyLong_FromSsize_t(len); +} + +PyDoc_STRVAR(truncate_doc, +"truncate([size]) -> int. Truncate the file to at most size bytes.\n" +"\n" +"Size defaults to the current file position, as returned by tell().\n" +"Returns the new size. Imply an absolute seek to the position size."); + +static PyObject * +bytesio_truncate(bytesio *self, PyObject *args) +{ + Py_ssize_t size; + PyObject *arg = Py_None; + + CHECK_CLOSED(self); + + if (!PyArg_ParseTuple(args, "|O:truncate", &arg)) + return NULL; + + if (PyNumber_Check(arg)) { + size = PyNumber_AsSsize_t(arg, PyExc_OverflowError); + if (size == -1 && PyErr_Occurred()) + return NULL; + } + else if (arg == Py_None) { + /* Truncate to current position if no argument is passed. */ + size = self->pos; + } + else { + PyErr_Format(PyExc_TypeError, "integer argument expected, got '%s'", + Py_TYPE(arg)->tp_name); + return NULL; + } + + if (size < 0) { + PyErr_Format(PyExc_ValueError, + "negative size value %zd", size); + return NULL; + } + + if (size < self->string_size) { + self->string_size = size; + if (resize_buffer(self, size) < 0) + return NULL; + } + self->pos = size; + + return PyLong_FromSsize_t(size); +} + +static PyObject * +bytesio_iternext(bytesio *self) +{ + char *next; + Py_ssize_t n; + + CHECK_CLOSED(self); + + n = get_line(self, &next); + + if (!next || n == 0) + return NULL; + + return PyBytes_FromStringAndSize(next, n); +} + +PyDoc_STRVAR(seek_doc, +"seek(pos, whence=0) -> int. Change stream position.\n" +"\n" +"Seek to byte offset pos relative to position indicated by whence:\n" +" 0 Start of stream (the default). pos should be >= 0;\n" +" 1 Current position - pos may be negative;\n" +" 2 End of stream - pos usually negative.\n" +"Returns the new absolute position."); + +static PyObject * +bytesio_seek(bytesio *self, PyObject *args) +{ + PyObject *posobj; + Py_ssize_t pos; + int mode = 0; + + CHECK_CLOSED(self); + + if (!PyArg_ParseTuple(args, "O|i:seek", &posobj, &mode)) + return NULL; + + pos = PyNumber_AsSsize_t(posobj, PyExc_OverflowError); + if (pos == -1 && PyErr_Occurred()) + return NULL; + + if (pos < 0 && mode == 0) { + PyErr_Format(PyExc_ValueError, + "negative seek value %zd", pos); + return NULL; + } + + /* mode 0: offset relative to beginning of the string. + mode 1: offset relative to current position. + mode 2: offset relative the end of the string. */ + if (mode == 1) { + if (pos > PY_SSIZE_T_MAX - self->pos) { + PyErr_SetString(PyExc_OverflowError, + "new position too large"); + return NULL; + } + pos += self->pos; + } + else if (mode == 2) { + if (pos > PY_SSIZE_T_MAX - self->string_size) { + PyErr_SetString(PyExc_OverflowError, + "new position too large"); + return NULL; + } + pos += self->string_size; + } + else if (mode != 0) { + PyErr_Format(PyExc_ValueError, + "invalid whence (%i, should be 0, 1 or 2)", mode); + return NULL; + } + + if (pos < 0) + pos = 0; + self->pos = pos; + + return PyLong_FromSsize_t(self->pos); +} + +PyDoc_STRVAR(write_doc, +"write(bytes) -> int. Write bytes to file.\n" +"\n" +"Return the number of bytes written."); + +static PyObject * +bytesio_write(bytesio *self, PyObject *obj) +{ + Py_ssize_t n = 0; + Py_buffer buf; + PyObject *result = NULL; + + CHECK_CLOSED(self); + + if (PyObject_GetBuffer(obj, &buf, PyBUF_CONTIG_RO) < 0) + return NULL; + + if (buf.len != 0) + n = write_bytes(self, buf.buf, buf.len); + if (n >= 0) + result = PyLong_FromSsize_t(n); + + PyBuffer_Release(&buf); + return result; +} + +PyDoc_STRVAR(writelines_doc, +"writelines(sequence_of_strings) -> None. Write strings to the file.\n" +"\n" +"Note that newlines are not added. The sequence can be any iterable\n" +"object producing strings. This is equivalent to calling write() for\n" +"each string."); + +static PyObject * +bytesio_writelines(bytesio *self, PyObject *v) +{ + PyObject *it, *item; + PyObject *ret; + + CHECK_CLOSED(self); + + it = PyObject_GetIter(v); + if (it == NULL) + return NULL; + + while ((item = PyIter_Next(it)) != NULL) { + ret = bytesio_write(self, item); + Py_DECREF(item); + if (ret == NULL) { + Py_DECREF(it); + return NULL; + } + Py_DECREF(ret); + } + Py_DECREF(it); + + /* See if PyIter_Next failed */ + if (PyErr_Occurred()) + return NULL; + + Py_RETURN_NONE; +} + +PyDoc_STRVAR(close_doc, +"close() -> None. Disable all I/O operations."); + +static PyObject * +bytesio_close(bytesio *self) +{ + if (self->buf != NULL) { + PyMem_Free(self->buf); + self->buf = NULL; + } + Py_RETURN_NONE; +} + +static void +bytesio_dealloc(bytesio *self) +{ + if (self->buf != NULL) { + PyMem_Free(self->buf); + self->buf = NULL; + } + Py_TYPE(self)->tp_clear((PyObject *)self); + Py_TYPE(self)->tp_free(self); +} + +static PyObject * +bytesio_new(PyTypeObject *type, PyObject *args, PyObject *kwds) +{ + bytesio *self; + + assert(type != NULL && type->tp_alloc != NULL); + self = (bytesio *)type->tp_alloc(type, 0); + if (self == NULL) + return NULL; + + self->string_size = 0; + self->pos = 0; + self->buf_size = 0; + self->buf = (char *)PyMem_Malloc(0); + if (self->buf == NULL) { + Py_DECREF(self); + return PyErr_NoMemory(); + } + + return (PyObject *)self; +} + +static int +bytesio_init(bytesio *self, PyObject *args, PyObject *kwds) +{ + PyObject *initvalue = NULL; + + if (!PyArg_ParseTuple(args, "|O:BytesIO", &initvalue)) + return -1; + + /* In case, __init__ is called multiple times. */ + self->string_size = 0; + self->pos = 0; + + if (initvalue && initvalue != Py_None) { + PyObject *res; + res = bytesio_write(self, initvalue); + if (res == NULL) + return -1; + Py_DECREF(res); + self->pos = 0; + } + + return 0; +} + +static int +bytesio_traverse(bytesio *self, visitproc visit, void *arg) +{ + Py_VISIT(self->dict); + Py_VISIT(self->weakreflist); + return 0; +} + +static int +bytesio_clear(bytesio *self) +{ + Py_CLEAR(self->dict); + if (self->weakreflist != NULL) + PyObject_ClearWeakRefs((PyObject *)self); + return 0; +} + + +static PyGetSetDef bytesio_getsetlist[] = { + {"closed", (getter)bytesio_get_closed, NULL, + "True if the file is closed."}, + {NULL}, /* sentinel */ +}; + +static struct PyMethodDef bytesio_methods[] = { + {"readable", (PyCFunction)return_true, METH_NOARGS, NULL}, + {"seekable", (PyCFunction)return_true, METH_NOARGS, NULL}, + {"writable", (PyCFunction)return_true, METH_NOARGS, NULL}, + {"close", (PyCFunction)bytesio_close, METH_NOARGS, close_doc}, + {"flush", (PyCFunction)bytesio_flush, METH_NOARGS, flush_doc}, + {"isatty", (PyCFunction)bytesio_isatty, METH_NOARGS, isatty_doc}, + {"tell", (PyCFunction)bytesio_tell, METH_NOARGS, tell_doc}, + {"write", (PyCFunction)bytesio_write, METH_O, write_doc}, + {"writelines", (PyCFunction)bytesio_writelines, METH_O, writelines_doc}, + {"read1", (PyCFunction)bytesio_read1, METH_O, read1_doc}, + {"readinto", (PyCFunction)bytesio_readinto, METH_VARARGS, readinto_doc}, + {"readline", (PyCFunction)bytesio_readline, METH_VARARGS, readline_doc}, + {"readlines", (PyCFunction)bytesio_readlines, METH_VARARGS, readlines_doc}, + {"read", (PyCFunction)bytesio_read, METH_VARARGS, read_doc}, + {"getvalue", (PyCFunction)bytesio_getvalue, METH_VARARGS, getval_doc}, + {"seek", (PyCFunction)bytesio_seek, METH_VARARGS, seek_doc}, + {"truncate", (PyCFunction)bytesio_truncate, METH_VARARGS, truncate_doc}, + {NULL, NULL} /* sentinel */ +}; + +PyDoc_STRVAR(bytesio_doc, +"BytesIO([buffer]) -> object\n" +"\n" +"Create a buffered I/O implementation using an in-memory bytes\n" +"buffer, ready for reading and writing."); + +PyTypeObject PyBytesIO_Type = { + PyVarObject_HEAD_INIT(NULL, 0) + "_io.BytesIO", /*tp_name*/ + sizeof(bytesio), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + (destructor)bytesio_dealloc, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + 0, /*tp_reserved*/ + 0, /*tp_repr*/ + 0, /*tp_as_number*/ + 0, /*tp_as_sequence*/ + 0, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + 0, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE | + Py_TPFLAGS_HAVE_GC, /*tp_flags*/ + bytesio_doc, /*tp_doc*/ + (traverseproc)bytesio_traverse, /*tp_traverse*/ + (inquiry)bytesio_clear, /*tp_clear*/ + 0, /*tp_richcompare*/ + offsetof(bytesio, weakreflist), /*tp_weaklistoffset*/ + PyObject_SelfIter, /*tp_iter*/ + (iternextfunc)bytesio_iternext, /*tp_iternext*/ + bytesio_methods, /*tp_methods*/ + 0, /*tp_members*/ + bytesio_getsetlist, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + offsetof(bytesio, dict), /*tp_dictoffset*/ + (initproc)bytesio_init, /*tp_init*/ + 0, /*tp_alloc*/ + bytesio_new, /*tp_new*/ +}; Added: python/trunk/Modules/_io/fileio.c ============================================================================== --- (empty file) +++ python/trunk/Modules/_io/fileio.c Fri Jun 12 22:14:08 2009 @@ -0,0 +1,1054 @@ +/* Author: Daniel Stutzbach */ + +#define PY_SSIZE_T_CLEAN +#include "Python.h" +#include +#include +#include +#include /* For offsetof */ +#include "_iomodule.h" + +/* + * Known likely problems: + * + * - Files larger then 2**32-1 + * - Files with unicode filenames + * - Passing numbers greater than 2**32-1 when an integer is expected + * - Making it work on Windows and other oddball platforms + * + * To Do: + * + * - autoconfify header file inclusion + */ + +#ifdef MS_WINDOWS +/* can simulate truncate with Win32 API functions; see file_truncate */ +#define HAVE_FTRUNCATE +#define WIN32_LEAN_AND_MEAN +#include +#endif + +#if BUFSIZ < (8*1024) +#define SMALLCHUNK (8*1024) +#elif (BUFSIZ >= (2 << 25)) +#error "unreasonable BUFSIZ > 64MB defined" +#else +#define SMALLCHUNK BUFSIZ +#endif + +#if SIZEOF_INT < 4 +#define BIGCHUNK (512 * 32) +#else +#define BIGCHUNK (512 * 1024) +#endif + +typedef struct { + PyObject_HEAD + int fd; + unsigned readable : 1; + unsigned writable : 1; + int seekable : 2; /* -1 means unknown */ + int closefd : 1; + PyObject *weakreflist; + PyObject *dict; +} fileio; + +PyTypeObject PyFileIO_Type; + +#define PyFileIO_Check(op) (PyObject_TypeCheck((op), &PyFileIO_Type)) + +int +_PyFileIO_closed(PyObject *self) +{ + return ((fileio *)self)->fd < 0; +} + +static PyObject * +portable_lseek(int fd, PyObject *posobj, int whence); + +static PyObject *portable_lseek(int fd, PyObject *posobj, int whence); + +/* Returns 0 on success, -1 with exception set on failure. */ +static int +internal_close(fileio *self) +{ + int err = 0; + int save_errno = 0; + if (self->fd >= 0) { + int fd = self->fd; + self->fd = -1; + /* fd is accessible and someone else may have closed it */ + if (_PyVerify_fd(fd)) { + Py_BEGIN_ALLOW_THREADS + err = close(fd); + if (err < 0) + save_errno = errno; + Py_END_ALLOW_THREADS + } else { + save_errno = errno; + err = -1; + } + } + if (err < 0) { + errno = save_errno; + PyErr_SetFromErrno(PyExc_IOError); + return -1; + } + return 0; +} + +static PyObject * +fileio_close(fileio *self) +{ + if (!self->closefd) { + self->fd = -1; + Py_RETURN_NONE; + } + errno = internal_close(self); + if (errno < 0) + return NULL; + + return PyObject_CallMethod((PyObject*)&PyRawIOBase_Type, + "close", "O", self); +} + +static PyObject * +fileio_new(PyTypeObject *type, PyObject *args, PyObject *kwds) +{ + fileio *self; + + assert(type != NULL && type->tp_alloc != NULL); + + self = (fileio *) type->tp_alloc(type, 0); + if (self != NULL) { + self->fd = -1; + self->readable = 0; + self->writable = 0; + self->seekable = -1; + self->closefd = 1; + self->weakreflist = NULL; + } + + return (PyObject *) self; +} + +/* On Unix, open will succeed for directories. + In Python, there should be no file objects referring to + directories, so we need a check. */ + +static int +dircheck(fileio* self, const char *name) +{ +#if defined(HAVE_FSTAT) && defined(S_IFDIR) && defined(EISDIR) + struct stat buf; + if (self->fd < 0) + return 0; + if (fstat(self->fd, &buf) == 0 && S_ISDIR(buf.st_mode)) { + char *msg = strerror(EISDIR); + PyObject *exc; + if (internal_close(self)) + return -1; + + exc = PyObject_CallFunction(PyExc_IOError, "(iss)", + EISDIR, msg, name); + PyErr_SetObject(PyExc_IOError, exc); + Py_XDECREF(exc); + return -1; + } +#endif + return 0; +} + +static int +check_fd(int fd) +{ +#if defined(HAVE_FSTAT) + struct stat buf; + if (!_PyVerify_fd(fd) || (fstat(fd, &buf) < 0 && errno == EBADF)) { + PyObject *exc; + char *msg = strerror(EBADF); + exc = PyObject_CallFunction(PyExc_OSError, "(is)", + EBADF, msg); + PyErr_SetObject(PyExc_OSError, exc); + Py_XDECREF(exc); + return -1; + } +#endif + return 0; +} + + +static int +fileio_init(PyObject *oself, PyObject *args, PyObject *kwds) +{ + fileio *self = (fileio *) oself; + static char *kwlist[] = {"file", "mode", "closefd", NULL}; + const char *name = NULL; + PyObject *nameobj, *stringobj = NULL; + char *mode = "r"; + char *s; +#ifdef MS_WINDOWS + Py_UNICODE *widename = NULL; +#endif + int ret = 0; + int rwa = 0, plus = 0, append = 0; + int flags = 0; + int fd = -1; + int closefd = 1; + + assert(PyFileIO_Check(oself)); + if (self->fd >= 0) { + /* Have to close the existing file first. */ + if (internal_close(self) < 0) + return -1; + } + + if (!PyArg_ParseTupleAndKeywords(args, kwds, "O|si:fileio", + kwlist, &nameobj, &mode, &closefd)) + return -1; + + if (PyFloat_Check(nameobj)) { + PyErr_SetString(PyExc_TypeError, + "integer argument expected, got float"); + return -1; + } + + fd = PyLong_AsLong(nameobj); + if (fd < 0) { + if (!PyErr_Occurred()) { + PyErr_SetString(PyExc_ValueError, + "Negative filedescriptor"); + return -1; + } + PyErr_Clear(); + } + +#ifdef MS_WINDOWS + if (GetVersion() < 0x80000000) { + /* On NT, so wide API available */ + if (PyUnicode_Check(nameobj)) + widename = PyUnicode_AS_UNICODE(nameobj); + } + if (widename == NULL) +#endif + if (fd < 0) + { + if (PyBytes_Check(nameobj) || PyByteArray_Check(nameobj)) { + Py_ssize_t namelen; + if (PyObject_AsCharBuffer(nameobj, &name, &namelen) < 0) + return -1; + } + else { + PyObject *u = PyUnicode_FromObject(nameobj); + + if (u == NULL) + return -1; + + stringobj = PyUnicode_AsEncodedString( + u, Py_FileSystemDefaultEncoding, "surrogateescape"); + Py_DECREF(u); + if (stringobj == NULL) + return -1; + if (!PyBytes_Check(stringobj)) { + PyErr_SetString(PyExc_TypeError, + "encoder failed to return bytes"); + goto error; + } + name = PyBytes_AS_STRING(stringobj); + } + } + + s = mode; + while (*s) { + switch (*s++) { + case 'r': + if (rwa) { + bad_mode: + PyErr_SetString(PyExc_ValueError, + "Must have exactly one of read/write/append mode"); + goto error; + } + rwa = 1; + self->readable = 1; + break; + case 'w': + if (rwa) + goto bad_mode; + rwa = 1; + self->writable = 1; + flags |= O_CREAT | O_TRUNC; + break; + case 'a': + if (rwa) + goto bad_mode; + rwa = 1; + self->writable = 1; + flags |= O_CREAT; + append = 1; + break; + case 'b': + break; + case '+': + if (plus) + goto bad_mode; + self->readable = self->writable = 1; + plus = 1; + break; + default: + PyErr_Format(PyExc_ValueError, + "invalid mode: %.200s", mode); + goto error; + } + } + + if (!rwa) + goto bad_mode; + + if (self->readable && self->writable) + flags |= O_RDWR; + else if (self->readable) + flags |= O_RDONLY; + else + flags |= O_WRONLY; + +#ifdef O_BINARY + flags |= O_BINARY; +#endif + +#ifdef O_APPEND + if (append) + flags |= O_APPEND; +#endif + + if (fd >= 0) { + if (check_fd(fd)) + goto error; + self->fd = fd; + self->closefd = closefd; + } + else { + self->closefd = 1; + if (!closefd) { + PyErr_SetString(PyExc_ValueError, + "Cannot use closefd=False with file name"); + goto error; + } + + Py_BEGIN_ALLOW_THREADS + errno = 0; +#ifdef MS_WINDOWS + if (widename != NULL) + self->fd = _wopen(widename, flags, 0666); + else +#endif + self->fd = open(name, flags, 0666); + Py_END_ALLOW_THREADS + if (self->fd < 0) { +#ifdef MS_WINDOWS + if (widename != NULL) + PyErr_SetFromErrnoWithUnicodeFilename(PyExc_IOError, widename); + else +#endif + PyErr_SetFromErrnoWithFilename(PyExc_IOError, name); + goto error; + } + if(dircheck(self, name) < 0) + goto error; + } + + if (PyObject_SetAttrString((PyObject *)self, "name", nameobj) < 0) + goto error; + + if (append) { + /* For consistent behaviour, we explicitly seek to the + end of file (otherwise, it might be done only on the + first write()). */ + PyObject *pos = portable_lseek(self->fd, NULL, 2); + if (pos == NULL) + goto error; + Py_DECREF(pos); + } + + goto done; + + error: + ret = -1; + + done: + Py_CLEAR(stringobj); + return ret; +} + +static int +fileio_traverse(fileio *self, visitproc visit, void *arg) +{ + Py_VISIT(self->dict); + return 0; +} + +static int +fileio_clear(fileio *self) +{ + Py_CLEAR(self->dict); + return 0; +} + +static void +fileio_dealloc(fileio *self) +{ + if (_PyIOBase_finalize((PyObject *) self) < 0) + return; + _PyObject_GC_UNTRACK(self); + if (self->weakreflist != NULL) + PyObject_ClearWeakRefs((PyObject *) self); + Py_CLEAR(self->dict); + Py_TYPE(self)->tp_free((PyObject *)self); +} + +static PyObject * +err_closed(void) +{ + PyErr_SetString(PyExc_ValueError, "I/O operation on closed file"); + return NULL; +} + +static PyObject * +err_mode(char *action) +{ + PyErr_Format(PyExc_ValueError, "File not open for %s", action); + return NULL; +} + +static PyObject * +fileio_fileno(fileio *self) +{ + if (self->fd < 0) + return err_closed(); + return PyInt_FromLong((long) self->fd); +} + +static PyObject * +fileio_readable(fileio *self) +{ + if (self->fd < 0) + return err_closed(); + return PyBool_FromLong((long) self->readable); +} + +static PyObject * +fileio_writable(fileio *self) +{ + if (self->fd < 0) + return err_closed(); + return PyBool_FromLong((long) self->writable); +} + +static PyObject * +fileio_seekable(fileio *self) +{ + if (self->fd < 0) + return err_closed(); + if (self->seekable < 0) { + PyObject *pos = portable_lseek(self->fd, NULL, SEEK_CUR); + if (pos == NULL) { + PyErr_Clear(); + self->seekable = 0; + } else { + Py_DECREF(pos); + self->seekable = 1; + } + } + return PyBool_FromLong((long) self->seekable); +} + +static PyObject * +fileio_readinto(fileio *self, PyObject *args) +{ + Py_buffer pbuf; + Py_ssize_t n; + + if (self->fd < 0) + return err_closed(); + if (!self->readable) + return err_mode("reading"); + + if (!PyArg_ParseTuple(args, "w*", &pbuf)) + return NULL; + + if (_PyVerify_fd(self->fd)) { + Py_BEGIN_ALLOW_THREADS + errno = 0; + n = read(self->fd, pbuf.buf, pbuf.len); + Py_END_ALLOW_THREADS + } else + n = -1; + PyBuffer_Release(&pbuf); + if (n < 0) { + if (errno == EAGAIN) + Py_RETURN_NONE; + PyErr_SetFromErrno(PyExc_IOError); + return NULL; + } + + return PyLong_FromSsize_t(n); +} + +static size_t +new_buffersize(fileio *self, size_t currentsize) +{ +#ifdef HAVE_FSTAT + off_t pos, end; + struct stat st; + if (fstat(self->fd, &st) == 0) { + end = st.st_size; + pos = lseek(self->fd, 0L, SEEK_CUR); + /* Files claiming a size smaller than SMALLCHUNK may + actually be streaming pseudo-files. In this case, we + apply the more aggressive algorithm below. + */ + if (end >= SMALLCHUNK && end >= pos && pos >= 0) { + /* Add 1 so if the file were to grow we'd notice. */ + return currentsize + end - pos + 1; + } + } +#endif + if (currentsize > SMALLCHUNK) { + /* Keep doubling until we reach BIGCHUNK; + then keep adding BIGCHUNK. */ + if (currentsize <= BIGCHUNK) + return currentsize + currentsize; + else + return currentsize + BIGCHUNK; + } + return currentsize + SMALLCHUNK; +} + +static PyObject * +fileio_readall(fileio *self) +{ + PyObject *result; + Py_ssize_t total = 0; + int n; + + if (!_PyVerify_fd(self->fd)) + return PyErr_SetFromErrno(PyExc_IOError); + + result = PyBytes_FromStringAndSize(NULL, SMALLCHUNK); + if (result == NULL) + return NULL; + + while (1) { + size_t newsize = new_buffersize(self, total); + if (newsize > PY_SSIZE_T_MAX || newsize <= 0) { + PyErr_SetString(PyExc_OverflowError, + "unbounded read returned more bytes " + "than a Python string can hold "); + Py_DECREF(result); + return NULL; + } + + if (PyBytes_GET_SIZE(result) < (Py_ssize_t)newsize) { + if (_PyBytes_Resize(&result, newsize) < 0) { + if (total == 0) { + Py_DECREF(result); + return NULL; + } + PyErr_Clear(); + break; + } + } + Py_BEGIN_ALLOW_THREADS + errno = 0; + n = read(self->fd, + PyBytes_AS_STRING(result) + total, + newsize - total); + Py_END_ALLOW_THREADS + if (n == 0) + break; + if (n < 0) { + if (total > 0) + break; + if (errno == EAGAIN) { + Py_DECREF(result); + Py_RETURN_NONE; + } + Py_DECREF(result); + PyErr_SetFromErrno(PyExc_IOError); + return NULL; + } + total += n; + } + + if (PyBytes_GET_SIZE(result) > total) { + if (_PyBytes_Resize(&result, total) < 0) { + /* This should never happen, but just in case */ + Py_DECREF(result); + return NULL; + } + } + return result; +} + +static PyObject * +fileio_read(fileio *self, PyObject *args) +{ + char *ptr; + Py_ssize_t n; + Py_ssize_t size = -1; + PyObject *bytes; + + if (self->fd < 0) + return err_closed(); + if (!self->readable) + return err_mode("reading"); + + if (!PyArg_ParseTuple(args, "|n", &size)) + return NULL; + + if (size < 0) { + return fileio_readall(self); + } + + bytes = PyBytes_FromStringAndSize(NULL, size); + if (bytes == NULL) + return NULL; + ptr = PyBytes_AS_STRING(bytes); + + if (_PyVerify_fd(self->fd)) { + Py_BEGIN_ALLOW_THREADS + errno = 0; + n = read(self->fd, ptr, size); + Py_END_ALLOW_THREADS + } else + n = -1; + + if (n < 0) { + Py_DECREF(bytes); + if (errno == EAGAIN) + Py_RETURN_NONE; + PyErr_SetFromErrno(PyExc_IOError); + return NULL; + } + + if (n != size) { + if (_PyBytes_Resize(&bytes, n) < 0) { + Py_DECREF(bytes); + return NULL; + } + } + + return (PyObject *) bytes; +} + +static PyObject * +fileio_write(fileio *self, PyObject *args) +{ + Py_buffer pbuf; + Py_ssize_t n; + + if (self->fd < 0) + return err_closed(); + if (!self->writable) + return err_mode("writing"); + + if (!PyArg_ParseTuple(args, "s*", &pbuf)) + return NULL; + + if (_PyVerify_fd(self->fd)) { + Py_BEGIN_ALLOW_THREADS + errno = 0; + n = write(self->fd, pbuf.buf, pbuf.len); + Py_END_ALLOW_THREADS + } else + n = -1; + + PyBuffer_Release(&pbuf); + + if (n < 0) { + if (errno == EAGAIN) + Py_RETURN_NONE; + PyErr_SetFromErrno(PyExc_IOError); + return NULL; + } + + return PyLong_FromSsize_t(n); +} + +/* XXX Windows support below is likely incomplete */ + +/* Cribbed from posix_lseek() */ +static PyObject * +portable_lseek(int fd, PyObject *posobj, int whence) +{ + Py_off_t pos, res; + +#ifdef SEEK_SET + /* Turn 0, 1, 2 into SEEK_{SET,CUR,END} */ + switch (whence) { +#if SEEK_SET != 0 + case 0: whence = SEEK_SET; break; +#endif +#if SEEK_CUR != 1 + case 1: whence = SEEK_CUR; break; +#endif +#if SEEK_END != 2 + case 2: whence = SEEK_END; break; +#endif + } +#endif /* SEEK_SET */ + + if (posobj == NULL) + pos = 0; + else { + if(PyFloat_Check(posobj)) { + PyErr_SetString(PyExc_TypeError, "an integer is required"); + return NULL; + } +#if defined(HAVE_LARGEFILE_SUPPORT) + pos = PyLong_AsLongLong(posobj); +#else + pos = PyLong_AsLong(posobj); +#endif + if (PyErr_Occurred()) + return NULL; + } + + if (_PyVerify_fd(fd)) { + Py_BEGIN_ALLOW_THREADS +#if defined(MS_WIN64) || defined(MS_WINDOWS) + res = _lseeki64(fd, pos, whence); +#else + res = lseek(fd, pos, whence); +#endif + Py_END_ALLOW_THREADS + } else + res = -1; + if (res < 0) + return PyErr_SetFromErrno(PyExc_IOError); + +#if defined(HAVE_LARGEFILE_SUPPORT) + return PyLong_FromLongLong(res); +#else + return PyLong_FromLong(res); +#endif +} + +static PyObject * +fileio_seek(fileio *self, PyObject *args) +{ + PyObject *posobj; + int whence = 0; + + if (self->fd < 0) + return err_closed(); + + if (!PyArg_ParseTuple(args, "O|i", &posobj, &whence)) + return NULL; + + return portable_lseek(self->fd, posobj, whence); +} + +static PyObject * +fileio_tell(fileio *self, PyObject *args) +{ + if (self->fd < 0) + return err_closed(); + + return portable_lseek(self->fd, NULL, 1); +} + +#ifdef HAVE_FTRUNCATE +static PyObject * +fileio_truncate(fileio *self, PyObject *args) +{ + PyObject *posobj = NULL; + Py_off_t pos; + int ret; + int fd; + + fd = self->fd; + if (fd < 0) + return err_closed(); + if (!self->writable) + return err_mode("writing"); + + if (!PyArg_ParseTuple(args, "|O", &posobj)) + return NULL; + + if (posobj == Py_None || posobj == NULL) { + /* Get the current position. */ + posobj = portable_lseek(fd, NULL, 1); + if (posobj == NULL) + return NULL; + } + else { + /* Move to the position to be truncated. */ + posobj = portable_lseek(fd, posobj, 0); + } + if (posobj == NULL) + return NULL; + +#if defined(HAVE_LARGEFILE_SUPPORT) + pos = PyLong_AsLongLong(posobj); +#else + pos = PyLong_AsLong(posobj); +#endif + if (pos == -1 && PyErr_Occurred()) + return NULL; + +#ifdef MS_WINDOWS + /* MS _chsize doesn't work if newsize doesn't fit in 32 bits, + so don't even try using it. */ + { + HANDLE hFile; + + /* Truncate. Note that this may grow the file! */ + Py_BEGIN_ALLOW_THREADS + errno = 0; + hFile = (HANDLE)_get_osfhandle(fd); + ret = hFile == (HANDLE)-1; + if (ret == 0) { + ret = SetEndOfFile(hFile) == 0; + if (ret) + errno = EACCES; + } + Py_END_ALLOW_THREADS + } +#else + Py_BEGIN_ALLOW_THREADS + errno = 0; + ret = ftruncate(fd, pos); + Py_END_ALLOW_THREADS +#endif /* !MS_WINDOWS */ + + if (ret != 0) { + PyErr_SetFromErrno(PyExc_IOError); + return NULL; + } + + return posobj; +} +#endif + +static char * +mode_string(fileio *self) +{ + if (self->readable) { + if (self->writable) + return "rb+"; + else + return "rb"; + } + else + return "wb"; +} + +static PyObject * +fileio_repr(fileio *self) +{ + PyObject *nameobj, *res; + + if (self->fd < 0) + return PyString_FromFormat("<_io.FileIO [closed]>"); + + nameobj = PyObject_GetAttrString((PyObject *) self, "name"); + if (nameobj == NULL) { + if (PyErr_ExceptionMatches(PyExc_AttributeError)) + PyErr_Clear(); + else + return NULL; + res = PyString_FromFormat("<_io.FileIO fd=%d mode='%s'>", + self->fd, mode_string(self)); + } + else { + PyObject *repr = PyObject_Repr(nameobj); + Py_DECREF(nameobj); + if (repr == NULL) + return NULL; + res = PyString_FromFormat("<_io.FileIO name=%s mode='%s'>", + PyString_AS_STRING(repr), + mode_string(self)); + Py_DECREF(repr); + } + return res; +} + +static PyObject * +fileio_isatty(fileio *self) +{ + long res; + + if (self->fd < 0) + return err_closed(); + Py_BEGIN_ALLOW_THREADS + res = isatty(self->fd); + Py_END_ALLOW_THREADS + return PyBool_FromLong(res); +} + + +PyDoc_STRVAR(fileio_doc, +"file(name: str[, mode: str]) -> file IO object\n" +"\n" +"Open a file. The mode can be 'r', 'w' or 'a' for reading (default),\n" +"writing or appending. The file will be created if it doesn't exist\n" +"when opened for writing or appending; it will be truncated when\n" +"opened for writing. Add a '+' to the mode to allow simultaneous\n" +"reading and writing."); + +PyDoc_STRVAR(read_doc, +"read(size: int) -> bytes. read at most size bytes, returned as bytes.\n" +"\n" +"Only makes one system call, so less data may be returned than requested\n" +"In non-blocking mode, returns None if no data is available.\n" +"On end-of-file, returns ''."); + +PyDoc_STRVAR(readall_doc, +"readall() -> bytes. read all data from the file, returned as bytes.\n" +"\n" +"In non-blocking mode, returns as much as is immediately available,\n" +"or None if no data is available. On end-of-file, returns ''."); + +PyDoc_STRVAR(write_doc, +"write(b: bytes) -> int. Write bytes b to file, return number written.\n" +"\n" +"Only makes one system call, so not all of the data may be written.\n" +"The number of bytes actually written is returned."); + +PyDoc_STRVAR(fileno_doc, +"fileno() -> int. \"file descriptor\".\n" +"\n" +"This is needed for lower-level file interfaces, such the fcntl module."); + +PyDoc_STRVAR(seek_doc, +"seek(offset: int[, whence: int]) -> None. Move to new file position.\n" +"\n" +"Argument offset is a byte count. Optional argument whence defaults to\n" +"0 (offset from start of file, offset should be >= 0); other values are 1\n" +"(move relative to current position, positive or negative), and 2 (move\n" +"relative to end of file, usually negative, although many platforms allow\n" +"seeking beyond the end of a file)." +"\n" +"Note that not all file objects are seekable."); + +#ifdef HAVE_FTRUNCATE +PyDoc_STRVAR(truncate_doc, +"truncate([size: int]) -> None. Truncate the file to at most size bytes.\n" +"\n" +"Size defaults to the current file position, as returned by tell()." +"The current file position is changed to the value of size."); +#endif + +PyDoc_STRVAR(tell_doc, +"tell() -> int. Current file position"); + +PyDoc_STRVAR(readinto_doc, +"readinto() -> Same as RawIOBase.readinto()."); + +PyDoc_STRVAR(close_doc, +"close() -> None. Close the file.\n" +"\n" +"A closed file cannot be used for further I/O operations. close() may be\n" +"called more than once without error. Changes the fileno to -1."); + +PyDoc_STRVAR(isatty_doc, +"isatty() -> bool. True if the file is connected to a tty device."); + +PyDoc_STRVAR(seekable_doc, +"seekable() -> bool. True if file supports random-access."); + +PyDoc_STRVAR(readable_doc, +"readable() -> bool. True if file was opened in a read mode."); + +PyDoc_STRVAR(writable_doc, +"writable() -> bool. True if file was opened in a write mode."); + +static PyMethodDef fileio_methods[] = { + {"read", (PyCFunction)fileio_read, METH_VARARGS, read_doc}, + {"readall", (PyCFunction)fileio_readall, METH_NOARGS, readall_doc}, + {"readinto", (PyCFunction)fileio_readinto, METH_VARARGS, readinto_doc}, + {"write", (PyCFunction)fileio_write, METH_VARARGS, write_doc}, + {"seek", (PyCFunction)fileio_seek, METH_VARARGS, seek_doc}, + {"tell", (PyCFunction)fileio_tell, METH_VARARGS, tell_doc}, +#ifdef HAVE_FTRUNCATE + {"truncate", (PyCFunction)fileio_truncate, METH_VARARGS, truncate_doc}, +#endif + {"close", (PyCFunction)fileio_close, METH_NOARGS, close_doc}, + {"seekable", (PyCFunction)fileio_seekable, METH_NOARGS, seekable_doc}, + {"readable", (PyCFunction)fileio_readable, METH_NOARGS, readable_doc}, + {"writable", (PyCFunction)fileio_writable, METH_NOARGS, writable_doc}, + {"fileno", (PyCFunction)fileio_fileno, METH_NOARGS, fileno_doc}, + {"isatty", (PyCFunction)fileio_isatty, METH_NOARGS, isatty_doc}, + {NULL, NULL} /* sentinel */ +}; + +/* 'closed' and 'mode' are attributes for backwards compatibility reasons. */ + +static PyObject * +get_closed(fileio *self, void *closure) +{ + return PyBool_FromLong((long)(self->fd < 0)); +} + +static PyObject * +get_closefd(fileio *self, void *closure) +{ + return PyBool_FromLong((long)(self->closefd)); +} + +static PyObject * +get_mode(fileio *self, void *closure) +{ + return PyUnicode_FromString(mode_string(self)); +} + +static PyGetSetDef fileio_getsetlist[] = { + {"closed", (getter)get_closed, NULL, "True if the file is closed"}, + {"closefd", (getter)get_closefd, NULL, + "True if the file descriptor will be closed"}, + {"mode", (getter)get_mode, NULL, "String giving the file mode"}, + {NULL}, +}; + +PyTypeObject PyFileIO_Type = { + PyVarObject_HEAD_INIT(NULL, 0) + "_io.FileIO", + sizeof(fileio), + 0, + (destructor)fileio_dealloc, /* tp_dealloc */ + 0, /* tp_print */ + 0, /* tp_getattr */ + 0, /* tp_setattr */ + 0, /* tp_reserved */ + (reprfunc)fileio_repr, /* tp_repr */ + 0, /* tp_as_number */ + 0, /* tp_as_sequence */ + 0, /* tp_as_mapping */ + 0, /* tp_hash */ + 0, /* tp_call */ + 0, /* tp_str */ + PyObject_GenericGetAttr, /* tp_getattro */ + 0, /* tp_setattro */ + 0, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE + | Py_TPFLAGS_HAVE_GC, /* tp_flags */ + fileio_doc, /* tp_doc */ + (traverseproc)fileio_traverse, /* tp_traverse */ + (inquiry)fileio_clear, /* tp_clear */ + 0, /* tp_richcompare */ + offsetof(fileio, weakreflist), /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + fileio_methods, /* tp_methods */ + 0, /* tp_members */ + fileio_getsetlist, /* tp_getset */ + 0, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + offsetof(fileio, dict), /* tp_dictoffset */ + fileio_init, /* tp_init */ + PyType_GenericAlloc, /* tp_alloc */ + fileio_new, /* tp_new */ + PyObject_GC_Del, /* tp_free */ +}; Added: python/trunk/Modules/_io/iobase.c ============================================================================== --- (empty file) +++ python/trunk/Modules/_io/iobase.c Fri Jun 12 22:14:08 2009 @@ -0,0 +1,894 @@ +/* + An implementation of the I/O abstract base classes hierarchy + as defined by PEP 3116 - "New I/O" + + Classes defined here: IOBase, RawIOBase. + + Written by Amaury Forgeot d'Arc and Antoine Pitrou +*/ + + +#define PY_SSIZE_T_CLEAN +#include "Python.h" +#include "structmember.h" +#include "_iomodule.h" + +/* + * IOBase class, an abstract class + */ + +typedef struct { + PyObject_HEAD + + PyObject *dict; + PyObject *weakreflist; +} iobase; + +PyDoc_STRVAR(iobase_doc, + "The abstract base class for all I/O classes, acting on streams of\n" + "bytes. There is no public constructor.\n" + "\n" + "This class provides dummy implementations for many methods that\n" + "derived classes can override selectively; the default implementations\n" + "represent a file that cannot be read, written or seeked.\n" + "\n" + "Even though IOBase does not declare read, readinto, or write because\n" + "their signatures will vary, implementations and clients should\n" + "consider those methods part of the interface. Also, implementations\n" + "may raise a IOError when operations they do not support are called.\n" + "\n" + "The basic type used for binary data read from or written to a file is\n" + "bytes. bytearrays are accepted too, and in some cases (such as\n" + "readinto) needed. Text I/O classes work with str data.\n" + "\n" + "Note that calling any method (even inquiries) on a closed stream is\n" + "undefined. Implementations may raise IOError in this case.\n" + "\n" + "IOBase (and its subclasses) support the iterator protocol, meaning\n" + "that an IOBase object can be iterated over yielding the lines in a\n" + "stream.\n" + "\n" + "IOBase also supports the :keyword:`with` statement. In this example,\n" + "fp is closed after the suite of the with statment is complete:\n" + "\n" + "with open('spam.txt', 'r') as fp:\n" + " fp.write('Spam and eggs!')\n"); + +/* Use this macro whenever you want to check the internal `closed` status + of the IOBase object rather than the virtual `closed` attribute as returned + by whatever subclass. */ + +#define IS_CLOSED(self) \ + PyObject_HasAttrString(self, "__IOBase_closed") + +/* Internal methods */ +static PyObject * +iobase_unsupported(const char *message) +{ + PyErr_SetString(_PyIO_unsupported_operation, message); + return NULL; +} + +/* Positionning */ + +PyDoc_STRVAR(iobase_seek_doc, + "Change stream position.\n" + "\n" + "Change the stream position to byte offset offset. offset is\n" + "interpreted relative to the position indicated by whence. Values\n" + "for whence are:\n" + "\n" + "* 0 -- start of stream (the default); offset should be zero or positive\n" + "* 1 -- current stream position; offset may be negative\n" + "* 2 -- end of stream; offset is usually negative\n" + "\n" + "Return the new absolute position."); + +static PyObject * +iobase_seek(PyObject *self, PyObject *args) +{ + return iobase_unsupported("seek"); +} + +PyDoc_STRVAR(iobase_tell_doc, + "Return current stream position."); + +static PyObject * +iobase_tell(PyObject *self, PyObject *args) +{ + return PyObject_CallMethod(self, "seek", "ii", 0, 1); +} + +PyDoc_STRVAR(iobase_truncate_doc, + "Truncate file to size bytes.\n" + "\n" + "Size defaults to the current IO position as reported by tell(). Return\n" + "the new size."); + +static PyObject * +iobase_truncate(PyObject *self, PyObject *args) +{ + return iobase_unsupported("truncate"); +} + +/* Flush and close methods */ + +PyDoc_STRVAR(iobase_flush_doc, + "Flush write buffers, if applicable.\n" + "\n" + "This is not implemented for read-only and non-blocking streams.\n"); + +static PyObject * +iobase_flush(PyObject *self, PyObject *args) +{ + /* XXX Should this return the number of bytes written??? */ + if (IS_CLOSED(self)) { + PyErr_SetString(PyExc_ValueError, "I/O operation on closed file."); + return NULL; + } + Py_RETURN_NONE; +} + +PyDoc_STRVAR(iobase_close_doc, + "Flush and close the IO object.\n" + "\n" + "This method has no effect if the file is already closed.\n"); + +static int +iobase_closed(PyObject *self) +{ + PyObject *res; + int closed; + /* This gets the derived attribute, which is *not* __IOBase_closed + in most cases! */ + res = PyObject_GetAttr(self, _PyIO_str_closed); + if (res == NULL) + return 0; + closed = PyObject_IsTrue(res); + Py_DECREF(res); + return closed; +} + +static PyObject * +iobase_closed_get(PyObject *self, void *context) +{ + return PyBool_FromLong(IS_CLOSED(self)); +} + +PyObject * +_PyIOBase_check_closed(PyObject *self, PyObject *args) +{ + if (iobase_closed(self)) { + PyErr_SetString(PyExc_ValueError, "I/O operation on closed file."); + return NULL; + } + if (args == Py_True) + return Py_None; + else + Py_RETURN_NONE; +} + +/* XXX: IOBase thinks it has to maintain its own internal state in + `__IOBase_closed` and call flush() by itself, but it is redundant with + whatever behaviour a non-trivial derived class will implement. */ + +static PyObject * +iobase_close(PyObject *self, PyObject *args) +{ + PyObject *res; + + if (IS_CLOSED(self)) + Py_RETURN_NONE; + + res = PyObject_CallMethodObjArgs(self, _PyIO_str_flush, NULL); + PyObject_SetAttrString(self, "__IOBase_closed", Py_True); + if (res == NULL) { + /* If flush() fails, just give up */ + if (PyErr_ExceptionMatches(PyExc_IOError)) + PyErr_Clear(); + else + return NULL; + } + Py_XDECREF(res); + Py_RETURN_NONE; +} + +/* Finalization and garbage collection support */ + +int +_PyIOBase_finalize(PyObject *self) +{ + PyObject *res; + PyObject *tp, *v, *tb; + int closed = 1; + int is_zombie; + + /* If _PyIOBase_finalize() is called from a destructor, we need to + resurrect the object as calling close() can invoke arbitrary code. */ + is_zombie = (Py_REFCNT(self) == 0); + if (is_zombie) { + ++Py_REFCNT(self); + } + PyErr_Fetch(&tp, &v, &tb); + /* If `closed` doesn't exist or can't be evaluated as bool, then the + object is probably in an unusable state, so ignore. */ + res = PyObject_GetAttr(self, _PyIO_str_closed); + if (res == NULL) + PyErr_Clear(); + else { + closed = PyObject_IsTrue(res); + Py_DECREF(res); + if (closed == -1) + PyErr_Clear(); + } + if (closed == 0) { + res = PyObject_CallMethodObjArgs((PyObject *) self, _PyIO_str_close, + NULL); + /* Silencing I/O errors is bad, but printing spurious tracebacks is + equally as bad, and potentially more frequent (because of + shutdown issues). */ + if (res == NULL) + PyErr_Clear(); + else + Py_DECREF(res); + } + PyErr_Restore(tp, v, tb); + if (is_zombie) { + if (--Py_REFCNT(self) != 0) { + /* The object lives again. The following code is taken from + slot_tp_del in typeobject.c. */ + Py_ssize_t refcnt = Py_REFCNT(self); + _Py_NewReference(self); + Py_REFCNT(self) = refcnt; + /* If Py_REF_DEBUG, _Py_NewReference bumped _Py_RefTotal, so + * we need to undo that. */ + _Py_DEC_REFTOTAL; + /* If Py_TRACE_REFS, _Py_NewReference re-added self to the object + * chain, so no more to do there. + * If COUNT_ALLOCS, the original decref bumped tp_frees, and + * _Py_NewReference bumped tp_allocs: both of those need to be + * undone. + */ +#ifdef COUNT_ALLOCS + --Py_TYPE(self)->tp_frees; + --Py_TYPE(self)->tp_allocs; +#endif + return -1; + } + } + return 0; +} + +static int +iobase_traverse(iobase *self, visitproc visit, void *arg) +{ + Py_VISIT(self->dict); + return 0; +} + +static int +iobase_clear(iobase *self) +{ + if (_PyIOBase_finalize((PyObject *) self) < 0) + return -1; + Py_CLEAR(self->dict); + return 0; +} + +/* Destructor */ + +static void +iobase_dealloc(iobase *self) +{ + /* NOTE: since IOBaseObject has its own dict, Python-defined attributes + are still available here for close() to use. + However, if the derived class declares a __slots__, those slots are + already gone. + */ + if (_PyIOBase_finalize((PyObject *) self) < 0) { + /* When called from a heap type's dealloc, the type will be + decref'ed on return (see e.g. subtype_dealloc in typeobject.c). */ + if (PyType_HasFeature(Py_TYPE(self), Py_TPFLAGS_HEAPTYPE)) + Py_INCREF(Py_TYPE(self)); + return; + } + _PyObject_GC_UNTRACK(self); + if (self->weakreflist != NULL) + PyObject_ClearWeakRefs((PyObject *) self); + Py_CLEAR(self->dict); + Py_TYPE(self)->tp_free((PyObject *) self); +} + +/* Inquiry methods */ + +PyDoc_STRVAR(iobase_seekable_doc, + "Return whether object supports random access.\n" + "\n" + "If False, seek(), tell() and truncate() will raise IOError.\n" + "This method may need to do a test seek()."); + +static PyObject * +iobase_seekable(PyObject *self, PyObject *args) +{ + Py_RETURN_FALSE; +} + +PyObject * +_PyIOBase_check_seekable(PyObject *self, PyObject *args) +{ + PyObject *res = PyObject_CallMethodObjArgs(self, _PyIO_str_seekable, NULL); + if (res == NULL) + return NULL; + if (res != Py_True) { + Py_CLEAR(res); + PyErr_SetString(PyExc_IOError, "File or stream is not seekable."); + return NULL; + } + if (args == Py_True) { + Py_DECREF(res); + } + return res; +} + +PyDoc_STRVAR(iobase_readable_doc, + "Return whether object was opened for reading.\n" + "\n" + "If False, read() will raise IOError."); + +static PyObject * +iobase_readable(PyObject *self, PyObject *args) +{ + Py_RETURN_FALSE; +} + +/* May be called with any object */ +PyObject * +_PyIOBase_check_readable(PyObject *self, PyObject *args) +{ + PyObject *res = PyObject_CallMethodObjArgs(self, _PyIO_str_readable, NULL); + if (res == NULL) + return NULL; + if (res != Py_True) { + Py_CLEAR(res); + PyErr_SetString(PyExc_IOError, "File or stream is not readable."); + return NULL; + } + if (args == Py_True) { + Py_DECREF(res); + } + return res; +} + +PyDoc_STRVAR(iobase_writable_doc, + "Return whether object was opened for writing.\n" + "\n" + "If False, read() will raise IOError."); + +static PyObject * +iobase_writable(PyObject *self, PyObject *args) +{ + Py_RETURN_FALSE; +} + +/* May be called with any object */ +PyObject * +_PyIOBase_check_writable(PyObject *self, PyObject *args) +{ + PyObject *res = PyObject_CallMethodObjArgs(self, _PyIO_str_writable, NULL); + if (res == NULL) + return NULL; + if (res != Py_True) { + Py_CLEAR(res); + PyErr_SetString(PyExc_IOError, "File or stream is not writable."); + return NULL; + } + if (args == Py_True) { + Py_DECREF(res); + } + return res; +} + +/* Context manager */ + +static PyObject * +iobase_enter(PyObject *self, PyObject *args) +{ + if (_PyIOBase_check_closed(self, Py_True) == NULL) + return NULL; + + Py_INCREF(self); + return self; +} + +static PyObject * +iobase_exit(PyObject *self, PyObject *args) +{ + return PyObject_CallMethodObjArgs(self, _PyIO_str_close, NULL); +} + +/* Lower-level APIs */ + +/* XXX Should these be present even if unimplemented? */ + +PyDoc_STRVAR(iobase_fileno_doc, + "Returns underlying file descriptor if one exists.\n" + "\n" + "An IOError is raised if the IO object does not use a file descriptor.\n"); + +static PyObject * +iobase_fileno(PyObject *self, PyObject *args) +{ + return iobase_unsupported("fileno"); +} + +PyDoc_STRVAR(iobase_isatty_doc, + "Return whether this is an 'interactive' stream.\n" + "\n" + "Return False if it can't be determined.\n"); + +static PyObject * +iobase_isatty(PyObject *self, PyObject *args) +{ + if (_PyIOBase_check_closed(self, Py_True) == NULL) + return NULL; + Py_RETURN_FALSE; +} + +/* Readline(s) and writelines */ + +PyDoc_STRVAR(iobase_readline_doc, + "Read and return a line from the stream.\n" + "\n" + "If limit is specified, at most limit bytes will be read.\n" + "\n" + "The line terminator is always b'\n' for binary files; for text\n" + "files, the newlines argument to open can be used to select the line\n" + "terminator(s) recognized.\n"); + +static PyObject * +iobase_readline(PyObject *self, PyObject *args) +{ + /* For backwards compatibility, a (slowish) readline(). */ + + Py_ssize_t limit = -1; + int has_peek = 0; + PyObject *buffer, *result; + Py_ssize_t old_size = -1; + + if (!PyArg_ParseTuple(args, "|n:readline", &limit)) { + return NULL; + } + + if (PyObject_HasAttrString(self, "peek")) + has_peek = 1; + + buffer = PyByteArray_FromStringAndSize(NULL, 0); + if (buffer == NULL) + return NULL; + + while (limit < 0 || Py_SIZE(buffer) < limit) { + Py_ssize_t nreadahead = 1; + PyObject *b; + + if (has_peek) { + PyObject *readahead = PyObject_CallMethod(self, "peek", "i", 1); + if (readahead == NULL) + goto fail; + if (!PyBytes_Check(readahead)) { + PyErr_Format(PyExc_IOError, + "peek() should have returned a bytes object, " + "not '%.200s'", Py_TYPE(readahead)->tp_name); + Py_DECREF(readahead); + goto fail; + } + if (PyBytes_GET_SIZE(readahead) > 0) { + Py_ssize_t n = 0; + const char *buf = PyBytes_AS_STRING(readahead); + if (limit >= 0) { + do { + if (n >= PyBytes_GET_SIZE(readahead) || n >= limit) + break; + if (buf[n++] == '\n') + break; + } while (1); + } + else { + do { + if (n >= PyBytes_GET_SIZE(readahead)) + break; + if (buf[n++] == '\n') + break; + } while (1); + } + nreadahead = n; + } + Py_DECREF(readahead); + } + + b = PyObject_CallMethod(self, "read", "n", nreadahead); + if (b == NULL) + goto fail; + if (!PyBytes_Check(b)) { + PyErr_Format(PyExc_IOError, + "read() should have returned a bytes object, " + "not '%.200s'", Py_TYPE(b)->tp_name); + Py_DECREF(b); + goto fail; + } + if (PyBytes_GET_SIZE(b) == 0) { + Py_DECREF(b); + break; + } + + old_size = PyByteArray_GET_SIZE(buffer); + PyByteArray_Resize(buffer, old_size + PyBytes_GET_SIZE(b)); + memcpy(PyByteArray_AS_STRING(buffer) + old_size, + PyBytes_AS_STRING(b), PyBytes_GET_SIZE(b)); + + Py_DECREF(b); + + if (PyByteArray_AS_STRING(buffer)[PyByteArray_GET_SIZE(buffer) - 1] == '\n') + break; + } + + result = PyBytes_FromStringAndSize(PyByteArray_AS_STRING(buffer), + PyByteArray_GET_SIZE(buffer)); + Py_DECREF(buffer); + return result; + fail: + Py_DECREF(buffer); + return NULL; +} + +static PyObject * +iobase_iter(PyObject *self) +{ + if (_PyIOBase_check_closed(self, Py_True) == NULL) + return NULL; + + Py_INCREF(self); + return self; +} + +static PyObject * +iobase_iternext(PyObject *self) +{ + PyObject *line = PyObject_CallMethodObjArgs(self, _PyIO_str_readline, NULL); + + if (line == NULL) + return NULL; + + if (PyObject_Size(line) == 0) { + Py_DECREF(line); + return NULL; + } + + return line; +} + +PyDoc_STRVAR(iobase_readlines_doc, + "Return a list of lines from the stream.\n" + "\n" + "hint can be specified to control the number of lines read: no more\n" + "lines will be read if the total size (in bytes/characters) of all\n" + "lines so far exceeds hint."); + +static PyObject * +iobase_readlines(PyObject *self, PyObject *args) +{ + Py_ssize_t hint = -1, length = 0; + PyObject *hintobj = Py_None, *result; + + if (!PyArg_ParseTuple(args, "|O:readlines", &hintobj)) { + return NULL; + } + if (hintobj != Py_None) { + hint = PyNumber_AsSsize_t(hintobj, PyExc_ValueError); + if (hint == -1 && PyErr_Occurred()) + return NULL; + } + + result = PyList_New(0); + if (result == NULL) + return NULL; + + if (hint <= 0) { + /* XXX special-casing this made sense in the Python version in order + to remove the bytecode interpretation overhead, but it could + probably be removed here. */ + PyObject *ret = PyObject_CallMethod(result, "extend", "O", self); + if (ret == NULL) { + Py_DECREF(result); + return NULL; + } + Py_DECREF(ret); + return result; + } + + while (1) { + PyObject *line = PyIter_Next(self); + if (line == NULL) { + if (PyErr_Occurred()) { + Py_DECREF(result); + return NULL; + } + else + break; /* StopIteration raised */ + } + + if (PyList_Append(result, line) < 0) { + Py_DECREF(line); + Py_DECREF(result); + return NULL; + } + length += PyObject_Size(line); + Py_DECREF(line); + + if (length > hint) + break; + } + return result; +} + +static PyObject * +iobase_writelines(PyObject *self, PyObject *args) +{ + PyObject *lines, *iter, *res; + + if (!PyArg_ParseTuple(args, "O:writelines", &lines)) { + return NULL; + } + + if (_PyIOBase_check_closed(self, Py_True) == NULL) + return NULL; + + iter = PyObject_GetIter(lines); + if (iter == NULL) + return NULL; + + while (1) { + PyObject *line = PyIter_Next(iter); + if (line == NULL) { + if (PyErr_Occurred()) { + Py_DECREF(iter); + return NULL; + } + else + break; /* Stop Iteration */ + } + + res = PyObject_CallMethodObjArgs(self, _PyIO_str_write, line, NULL); + Py_DECREF(line); + if (res == NULL) { + Py_DECREF(iter); + return NULL; + } + Py_DECREF(res); + } + Py_DECREF(iter); + Py_RETURN_NONE; +} + +static PyMethodDef iobase_methods[] = { + {"seek", iobase_seek, METH_VARARGS, iobase_seek_doc}, + {"tell", iobase_tell, METH_NOARGS, iobase_tell_doc}, + {"truncate", iobase_truncate, METH_VARARGS, iobase_truncate_doc}, + {"flush", iobase_flush, METH_NOARGS, iobase_flush_doc}, + {"close", iobase_close, METH_NOARGS, iobase_close_doc}, + + {"seekable", iobase_seekable, METH_NOARGS, iobase_seekable_doc}, + {"readable", iobase_readable, METH_NOARGS, iobase_readable_doc}, + {"writable", iobase_writable, METH_NOARGS, iobase_writable_doc}, + + {"_checkClosed", _PyIOBase_check_closed, METH_NOARGS}, + {"_checkSeekable", _PyIOBase_check_seekable, METH_NOARGS}, + {"_checkReadable", _PyIOBase_check_readable, METH_NOARGS}, + {"_checkWritable", _PyIOBase_check_writable, METH_NOARGS}, + + {"fileno", iobase_fileno, METH_NOARGS, iobase_fileno_doc}, + {"isatty", iobase_isatty, METH_NOARGS, iobase_isatty_doc}, + + {"__enter__", iobase_enter, METH_NOARGS}, + {"__exit__", iobase_exit, METH_VARARGS}, + + {"readline", iobase_readline, METH_VARARGS, iobase_readline_doc}, + {"readlines", iobase_readlines, METH_VARARGS, iobase_readlines_doc}, + {"writelines", iobase_writelines, METH_VARARGS}, + + {NULL, NULL} +}; + +static PyGetSetDef iobase_getset[] = { + {"closed", (getter)iobase_closed_get, NULL, NULL}, + {NULL} +}; + + +PyTypeObject PyIOBase_Type = { + PyVarObject_HEAD_INIT(NULL, 0) + "_io._IOBase", /*tp_name*/ + sizeof(iobase), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + (destructor)iobase_dealloc, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + 0, /*tp_compare */ + 0, /*tp_repr*/ + 0, /*tp_as_number*/ + 0, /*tp_as_sequence*/ + 0, /*tp_as_mapping*/ + 0, /*tp_hash */ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + 0, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE + | Py_TPFLAGS_HAVE_GC, /*tp_flags*/ + iobase_doc, /* tp_doc */ + (traverseproc)iobase_traverse, /* tp_traverse */ + (inquiry)iobase_clear, /* tp_clear */ + 0, /* tp_richcompare */ + offsetof(iobase, weakreflist), /* tp_weaklistoffset */ + iobase_iter, /* tp_iter */ + iobase_iternext, /* tp_iternext */ + iobase_methods, /* tp_methods */ + 0, /* tp_members */ + iobase_getset, /* tp_getset */ + 0, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + offsetof(iobase, dict), /* tp_dictoffset */ + 0, /* tp_init */ + 0, /* tp_alloc */ + PyType_GenericNew, /* tp_new */ +}; + + +/* + * RawIOBase class, Inherits from IOBase. + */ +PyDoc_STRVAR(rawiobase_doc, + "Base class for raw binary I/O."); + +/* + * The read() method is implemented by calling readinto(); derived classes + * that want to support read() only need to implement readinto() as a + * primitive operation. In general, readinto() can be more efficient than + * read(). + * + * (It would be tempting to also provide an implementation of readinto() in + * terms of read(), in case the latter is a more suitable primitive operation, + * but that would lead to nasty recursion in case a subclass doesn't implement + * either.) +*/ + +static PyObject * +rawiobase_read(PyObject *self, PyObject *args) +{ + Py_ssize_t n = -1; + PyObject *b, *res; + + if (!PyArg_ParseTuple(args, "|n:read", &n)) { + return NULL; + } + + if (n < 0) + return PyObject_CallMethod(self, "readall", NULL); + + /* TODO: allocate a bytes object directly instead and manually construct + a writable memoryview pointing to it. */ + b = PyByteArray_FromStringAndSize(NULL, n); + if (b == NULL) + return NULL; + + res = PyObject_CallMethodObjArgs(self, _PyIO_str_readinto, b, NULL); + if (res == NULL) { + Py_DECREF(b); + return NULL; + } + + n = PyNumber_AsSsize_t(res, PyExc_ValueError); + Py_DECREF(res); + if (n == -1 && PyErr_Occurred()) { + Py_DECREF(b); + return NULL; + } + + res = PyBytes_FromStringAndSize(PyByteArray_AsString(b), n); + Py_DECREF(b); + return res; +} + + +PyDoc_STRVAR(rawiobase_readall_doc, + "Read until EOF, using multiple read() call."); + +static PyObject * +rawiobase_readall(PyObject *self, PyObject *args) +{ + int r; + PyObject *chunks = PyList_New(0); + PyObject *result; + + if (chunks == NULL) + return NULL; + + while (1) { + PyObject *data = PyObject_CallMethod(self, "read", + "i", DEFAULT_BUFFER_SIZE); + if (!data) { + Py_DECREF(chunks); + return NULL; + } + if (!PyBytes_Check(data)) { + Py_DECREF(chunks); + Py_DECREF(data); + PyErr_SetString(PyExc_TypeError, "read() should return bytes"); + return NULL; + } + if (PyBytes_GET_SIZE(data) == 0) { + /* EOF */ + Py_DECREF(data); + break; + } + r = PyList_Append(chunks, data); + Py_DECREF(data); + if (r < 0) { + Py_DECREF(chunks); + return NULL; + } + } + result = _PyBytes_Join(_PyIO_empty_bytes, chunks); + Py_DECREF(chunks); + return result; +} + +static PyMethodDef rawiobase_methods[] = { + {"read", rawiobase_read, METH_VARARGS}, + {"readall", rawiobase_readall, METH_NOARGS, rawiobase_readall_doc}, + {NULL, NULL} +}; + +PyTypeObject PyRawIOBase_Type = { + PyVarObject_HEAD_INIT(NULL, 0) + "_io._RawIOBase", /*tp_name*/ + 0, /*tp_basicsize*/ + 0, /*tp_itemsize*/ + 0, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + 0, /*tp_compare */ + 0, /*tp_repr*/ + 0, /*tp_as_number*/ + 0, /*tp_as_sequence*/ + 0, /*tp_as_mapping*/ + 0, /*tp_hash */ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + 0, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /*tp_flags*/ + rawiobase_doc, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + rawiobase_methods, /* tp_methods */ + 0, /* tp_members */ + 0, /* tp_getset */ + &PyIOBase_Type, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + 0, /* tp_init */ + 0, /* tp_alloc */ + 0, /* tp_new */ +}; Added: python/trunk/Modules/_io/stringio.c ============================================================================== --- (empty file) +++ python/trunk/Modules/_io/stringio.c Fri Jun 12 22:14:08 2009 @@ -0,0 +1,756 @@ +#define PY_SSIZE_T_CLEAN +#include "Python.h" +#include "structmember.h" +#include "_iomodule.h" + +/* Implementation note: the buffer is always at least one character longer + than the enclosed string, for proper functioning of _PyIO_find_line_ending. +*/ + +typedef struct { + PyObject_HEAD + Py_UNICODE *buf; + Py_ssize_t pos; + Py_ssize_t string_size; + size_t buf_size; + + char ok; /* initialized? */ + char closed; + char readuniversal; + char readtranslate; + PyObject *decoder; + PyObject *readnl; + PyObject *writenl; + + PyObject *dict; + PyObject *weakreflist; +} stringio; + +#define CHECK_INITIALIZED(self) \ + if (self->ok <= 0) { \ + PyErr_SetString(PyExc_ValueError, \ + "I/O operation on uninitialized object"); \ + return NULL; \ + } + +#define CHECK_CLOSED(self) \ + if (self->closed) { \ + PyErr_SetString(PyExc_ValueError, \ + "I/O operation on closed file"); \ + return NULL; \ + } + +PyDoc_STRVAR(stringio_doc, + "Text I/O implementation using an in-memory buffer.\n" + "\n" + "The initial_value argument sets the value of object. The newline\n" + "argument is like the one of TextIOWrapper's constructor."); + + +/* Internal routine for changing the size, in terms of characters, of the + buffer of StringIO objects. The caller should ensure that the 'size' + argument is non-negative. Returns 0 on success, -1 otherwise. */ +static int +resize_buffer(stringio *self, size_t size) +{ + /* Here, unsigned types are used to avoid dealing with signed integer + overflow, which is undefined in C. */ + size_t alloc = self->buf_size; + Py_UNICODE *new_buf = NULL; + + assert(self->buf != NULL); + + /* Reserve one more char for line ending detection. */ + size = size + 1; + /* For simplicity, stay in the range of the signed type. Anyway, Python + doesn't allow strings to be longer than this. */ + if (size > PY_SSIZE_T_MAX) + goto overflow; + + if (size < alloc / 2) { + /* Major downsize; resize down to exact size. */ + alloc = size + 1; + } + else if (size < alloc) { + /* Within allocated size; quick exit */ + return 0; + } + else if (size <= alloc * 1.125) { + /* Moderate upsize; overallocate similar to list_resize() */ + alloc = size + (size >> 3) + (size < 9 ? 3 : 6); + } + else { + /* Major upsize; resize up to exact size */ + alloc = size + 1; + } + + if (alloc > ((size_t)-1) / sizeof(Py_UNICODE)) + goto overflow; + new_buf = (Py_UNICODE *)PyMem_Realloc(self->buf, + alloc * sizeof(Py_UNICODE)); + if (new_buf == NULL) { + PyErr_NoMemory(); + return -1; + } + self->buf_size = alloc; + self->buf = new_buf; + + return 0; + + overflow: + PyErr_SetString(PyExc_OverflowError, + "new buffer size too large"); + return -1; +} + +/* Internal routine for writing a whole PyUnicode object to the buffer of a + StringIO object. Returns 0 on success, or -1 on error. */ +static Py_ssize_t +write_str(stringio *self, PyObject *obj) +{ + Py_UNICODE *str; + Py_ssize_t len; + PyObject *decoded = NULL; + assert(self->buf != NULL); + assert(self->pos >= 0); + + if (self->decoder != NULL) { + decoded = _PyIncrementalNewlineDecoder_decode( + self->decoder, obj, 1 /* always final */); + } + else { + decoded = obj; + Py_INCREF(decoded); + } + if (self->writenl) { + PyObject *translated = PyUnicode_Replace( + decoded, _PyIO_str_nl, self->writenl, -1); + Py_DECREF(decoded); + decoded = translated; + } + if (decoded == NULL) + return -1; + + assert(PyUnicode_Check(decoded)); + str = PyUnicode_AS_UNICODE(decoded); + len = PyUnicode_GET_SIZE(decoded); + + assert(len >= 0); + + /* This overflow check is not strictly necessary. However, it avoids us to + deal with funky things like comparing an unsigned and a signed + integer. */ + if (self->pos > PY_SSIZE_T_MAX - len) { + PyErr_SetString(PyExc_OverflowError, + "new position too large"); + goto fail; + } + if (self->pos + len > self->string_size) { + if (resize_buffer(self, self->pos + len) < 0) + goto fail; + } + + if (self->pos > self->string_size) { + /* In case of overseek, pad with null bytes the buffer region between + the end of stream and the current position. + + 0 lo string_size hi + | |<---used--->|<----------available----------->| + | | <--to pad-->|<---to write---> | + 0 buf positon + + */ + memset(self->buf + self->string_size, '\0', + (self->pos - self->string_size) * sizeof(Py_UNICODE)); + } + + /* Copy the data to the internal buffer, overwriting some of the + existing data if self->pos < self->string_size. */ + memcpy(self->buf + self->pos, str, len * sizeof(Py_UNICODE)); + self->pos += len; + + /* Set the new length of the internal string if it has changed. */ + if (self->string_size < self->pos) { + self->string_size = self->pos; + } + + Py_DECREF(decoded); + return 0; + +fail: + Py_XDECREF(decoded); + return -1; +} + +PyDoc_STRVAR(stringio_getvalue_doc, + "Retrieve the entire contents of the object."); + +static PyObject * +stringio_getvalue(stringio *self) +{ + CHECK_INITIALIZED(self); + CHECK_CLOSED(self); + return PyUnicode_FromUnicode(self->buf, self->string_size); +} + +PyDoc_STRVAR(stringio_tell_doc, + "Tell the current file position."); + +static PyObject * +stringio_tell(stringio *self) +{ + CHECK_INITIALIZED(self); + CHECK_CLOSED(self); + return PyLong_FromSsize_t(self->pos); +} + +PyDoc_STRVAR(stringio_read_doc, + "Read at most n characters, returned as a string.\n" + "\n" + "If the argument is negative or omitted, read until EOF\n" + "is reached. Return an empty string at EOF.\n"); + +static PyObject * +stringio_read(stringio *self, PyObject *args) +{ + Py_ssize_t size, n; + Py_UNICODE *output; + PyObject *arg = Py_None; + + CHECK_INITIALIZED(self); + if (!PyArg_ParseTuple(args, "|O:read", &arg)) + return NULL; + CHECK_CLOSED(self); + + if (PyNumber_Check(arg)) { + size = PyNumber_AsSsize_t(arg, PyExc_OverflowError); + if (size == -1 && PyErr_Occurred()) + return NULL; + } + else if (arg == Py_None) { + /* Read until EOF is reached, by default. */ + size = -1; + } + else { + PyErr_Format(PyExc_TypeError, "integer argument expected, got '%s'", + Py_TYPE(arg)->tp_name); + return NULL; + } + + /* adjust invalid sizes */ + n = self->string_size - self->pos; + if (size < 0 || size > n) { + size = n; + if (size < 0) + size = 0; + } + + output = self->buf + self->pos; + self->pos += size; + return PyUnicode_FromUnicode(output, size); +} + +/* Internal helper, used by stringio_readline and stringio_iternext */ +static PyObject * +_stringio_readline(stringio *self, Py_ssize_t limit) +{ + Py_UNICODE *start, *end, old_char; + Py_ssize_t len, consumed; + + /* In case of overseek, return the empty string */ + if (self->pos >= self->string_size) + return PyUnicode_FromString(""); + + start = self->buf + self->pos; + if (limit < 0 || limit > self->string_size - self->pos) + limit = self->string_size - self->pos; + + end = start + limit; + old_char = *end; + *end = '\0'; + len = _PyIO_find_line_ending( + self->readtranslate, self->readuniversal, self->readnl, + start, end, &consumed); + *end = old_char; + /* If we haven't found any line ending, we just return everything + (`consumed` is ignored). */ + if (len < 0) + len = limit; + self->pos += len; + return PyUnicode_FromUnicode(start, len); +} + +PyDoc_STRVAR(stringio_readline_doc, + "Read until newline or EOF.\n" + "\n" + "Returns an empty string if EOF is hit immediately.\n"); + +static PyObject * +stringio_readline(stringio *self, PyObject *args) +{ + PyObject *arg = Py_None; + Py_ssize_t limit = -1; + + CHECK_INITIALIZED(self); + if (!PyArg_ParseTuple(args, "|O:readline", &arg)) + return NULL; + CHECK_CLOSED(self); + + if (PyNumber_Check(arg)) { + limit = PyNumber_AsSsize_t(arg, PyExc_OverflowError); + if (limit == -1 && PyErr_Occurred()) + return NULL; + } + else if (arg != Py_None) { + PyErr_Format(PyExc_TypeError, "integer argument expected, got '%s'", + Py_TYPE(arg)->tp_name); + return NULL; + } + return _stringio_readline(self, limit); +} + +static PyObject * +stringio_iternext(stringio *self) +{ + PyObject *line; + + CHECK_INITIALIZED(self); + CHECK_CLOSED(self); + + if (Py_TYPE(self) == &PyStringIO_Type) { + /* Skip method call overhead for speed */ + line = _stringio_readline(self, -1); + } + else { + /* XXX is subclassing StringIO really supported? */ + line = PyObject_CallMethodObjArgs((PyObject *)self, + _PyIO_str_readline, NULL); + if (line && !PyUnicode_Check(line)) { + PyErr_Format(PyExc_IOError, + "readline() should have returned an str object, " + "not '%.200s'", Py_TYPE(line)->tp_name); + Py_DECREF(line); + return NULL; + } + } + + if (line == NULL) + return NULL; + + if (PyUnicode_GET_SIZE(line) == 0) { + /* Reached EOF */ + Py_DECREF(line); + return NULL; + } + + return line; +} + +PyDoc_STRVAR(stringio_truncate_doc, + "Truncate size to pos.\n" + "\n" + "The pos argument defaults to the current file position, as\n" + "returned by tell(). Imply an absolute seek to pos.\n" + "Returns the new absolute position.\n"); + +static PyObject * +stringio_truncate(stringio *self, PyObject *args) +{ + Py_ssize_t size; + PyObject *arg = Py_None; + + CHECK_INITIALIZED(self); + if (!PyArg_ParseTuple(args, "|O:truncate", &arg)) + return NULL; + CHECK_CLOSED(self); + + if (PyNumber_Check(arg)) { + size = PyNumber_AsSsize_t(arg, PyExc_OverflowError); + if (size == -1 && PyErr_Occurred()) + return NULL; + } + else if (arg == Py_None) { + /* Truncate to current position if no argument is passed. */ + size = self->pos; + } + else { + PyErr_Format(PyExc_TypeError, "integer argument expected, got '%s'", + Py_TYPE(arg)->tp_name); + return NULL; + } + + if (size < 0) { + PyErr_Format(PyExc_ValueError, + "Negative size value %zd", size); + return NULL; + } + + if (size < self->string_size) { + if (resize_buffer(self, size) < 0) + return NULL; + self->string_size = size; + } + self->pos = size; + + return PyLong_FromSsize_t(size); +} + +PyDoc_STRVAR(stringio_seek_doc, + "Change stream position.\n" + "\n" + "Seek to character offset pos relative to position indicated by whence:\n" + " 0 Start of stream (the default). pos should be >= 0;\n" + " 1 Current position - pos must be 0;\n" + " 2 End of stream - pos must be 0.\n" + "Returns the new absolute position.\n"); + +static PyObject * +stringio_seek(stringio *self, PyObject *args) +{ + PyObject *posobj; + Py_ssize_t pos; + int mode = 0; + + CHECK_INITIALIZED(self); + if (!PyArg_ParseTuple(args, "O|i:seek", &posobj, &mode)) + return NULL; + + pos = PyNumber_AsSsize_t(posobj, PyExc_OverflowError); + if (pos == -1 && PyErr_Occurred()) + return NULL; + + CHECK_CLOSED(self); + + if (mode != 0 && mode != 1 && mode != 2) { + PyErr_Format(PyExc_ValueError, + "Invalid whence (%i, should be 0, 1 or 2)", mode); + return NULL; + } + else if (pos < 0 && mode == 0) { + PyErr_Format(PyExc_ValueError, + "Negative seek position %zd", pos); + return NULL; + } + else if (mode != 0 && pos != 0) { + PyErr_SetString(PyExc_IOError, + "Can't do nonzero cur-relative seeks"); + return NULL; + } + + /* mode 0: offset relative to beginning of the string. + mode 1: no change to current position. + mode 2: change position to end of file. */ + if (mode == 1) { + pos = self->pos; + } + else if (mode == 2) { + pos = self->string_size; + } + + self->pos = pos; + + return PyLong_FromSsize_t(self->pos); +} + +PyDoc_STRVAR(stringio_write_doc, + "Write string to file.\n" + "\n" + "Returns the number of characters written, which is always equal to\n" + "the length of the string.\n"); + +static PyObject * +stringio_write(stringio *self, PyObject *obj) +{ + Py_ssize_t size; + + CHECK_INITIALIZED(self); + if (!PyUnicode_Check(obj)) { + PyErr_Format(PyExc_TypeError, "string argument expected, got '%s'", + Py_TYPE(obj)->tp_name); + return NULL; + } + CHECK_CLOSED(self); + size = PyUnicode_GET_SIZE(obj); + + if (size > 0 && write_str(self, obj) < 0) + return NULL; + + return PyLong_FromSsize_t(size); +} + +PyDoc_STRVAR(stringio_close_doc, + "Close the IO object. Attempting any further operation after the\n" + "object is closed will raise a ValueError.\n" + "\n" + "This method has no effect if the file is already closed.\n"); + +static PyObject * +stringio_close(stringio *self) +{ + self->closed = 1; + /* Free up some memory */ + if (resize_buffer(self, 0) < 0) + return NULL; + Py_CLEAR(self->readnl); + Py_CLEAR(self->writenl); + Py_CLEAR(self->decoder); + Py_RETURN_NONE; +} + +static int +stringio_traverse(stringio *self, visitproc visit, void *arg) +{ + Py_VISIT(self->dict); + return 0; +} + +static int +stringio_clear(stringio *self) +{ + Py_CLEAR(self->dict); + return 0; +} + +static void +stringio_dealloc(stringio *self) +{ + _PyObject_GC_UNTRACK(self); + Py_CLEAR(self->readnl); + Py_CLEAR(self->writenl); + Py_CLEAR(self->decoder); + if (self->buf) + PyMem_Free(self->buf); + if (self->weakreflist != NULL) + PyObject_ClearWeakRefs((PyObject *) self); + Py_TYPE(self)->tp_free(self); +} + +static PyObject * +stringio_new(PyTypeObject *type, PyObject *args, PyObject *kwds) +{ + stringio *self; + + assert(type != NULL && type->tp_alloc != NULL); + self = (stringio *)type->tp_alloc(type, 0); + if (self == NULL) + return NULL; + + self->string_size = 0; + self->pos = 0; + self->buf_size = 0; + self->buf = (Py_UNICODE *)PyMem_Malloc(0); + if (self->buf == NULL) { + Py_DECREF(self); + return PyErr_NoMemory(); + } + + return (PyObject *)self; +} + +static int +stringio_init(stringio *self, PyObject *args, PyObject *kwds) +{ + char *kwlist[] = {"initial_value", "newline", NULL}; + PyObject *value = NULL; + char *newline = "\n"; + + if (!PyArg_ParseTupleAndKeywords(args, kwds, "|Oz:__init__", kwlist, + &value, &newline)) + return -1; + + if (newline && newline[0] != '\0' + && !(newline[0] == '\n' && newline[1] == '\0') + && !(newline[0] == '\r' && newline[1] == '\0') + && !(newline[0] == '\r' && newline[1] == '\n' && newline[2] == '\0')) { + PyErr_Format(PyExc_ValueError, + "illegal newline value: %s", newline); + return -1; + } + if (value && value != Py_None && !PyUnicode_Check(value)) { + PyErr_Format(PyExc_ValueError, + "initial_value must be str or None, not %.200s", + Py_TYPE(value)->tp_name); + return -1; + } + + self->ok = 0; + + Py_CLEAR(self->readnl); + Py_CLEAR(self->writenl); + Py_CLEAR(self->decoder); + + if (newline) { + self->readnl = PyString_FromString(newline); + if (self->readnl == NULL) + return -1; + } + self->readuniversal = (newline == NULL || newline[0] == '\0'); + self->readtranslate = (newline == NULL); + /* If newline == "", we don't translate anything. + If newline == "\n" or newline == None, we translate to "\n", which is + a no-op. + (for newline == None, TextIOWrapper translates to os.sepline, but it + is pointless for StringIO) + */ + if (newline != NULL && newline[0] == '\r') { + self->writenl = PyUnicode_FromString(newline); + } + + if (self->readuniversal) { + self->decoder = PyObject_CallFunction( + (PyObject *)&PyIncrementalNewlineDecoder_Type, + "Oi", Py_None, (int) self->readtranslate); + if (self->decoder == NULL) + return -1; + } + + /* Now everything is set up, resize buffer to size of initial value, + and copy it */ + self->string_size = 0; + if (value && value != Py_None) { + Py_ssize_t len = PyUnicode_GetSize(value); + /* This is a heuristic, for newline translation might change + the string length. */ + if (resize_buffer(self, len) < 0) + return -1; + self->pos = 0; + if (write_str(self, value) < 0) + return -1; + } + else { + if (resize_buffer(self, 0) < 0) + return -1; + } + self->pos = 0; + + self->closed = 0; + self->ok = 1; + return 0; +} + +/* Properties and pseudo-properties */ +static PyObject * +stringio_seekable(stringio *self, PyObject *args) +{ + CHECK_INITIALIZED(self); + Py_RETURN_TRUE; +} + +static PyObject * +stringio_readable(stringio *self, PyObject *args) +{ + CHECK_INITIALIZED(self); + Py_RETURN_TRUE; +} + +static PyObject * +stringio_writable(stringio *self, PyObject *args) +{ + CHECK_INITIALIZED(self); + Py_RETURN_TRUE; +} + +static PyObject * +stringio_buffer(stringio *self, void *context) +{ + PyErr_SetString(_PyIO_unsupported_operation, + "buffer attribute is unsupported on type StringIO"); + return NULL; +} + +static PyObject * +stringio_closed(stringio *self, void *context) +{ + CHECK_INITIALIZED(self); + return PyBool_FromLong(self->closed); +} + +static PyObject * +stringio_line_buffering(stringio *self, void *context) +{ + CHECK_INITIALIZED(self); + CHECK_CLOSED(self); + Py_RETURN_FALSE; +} + +static PyObject * +stringio_newlines(stringio *self, void *context) +{ + CHECK_INITIALIZED(self); + CHECK_CLOSED(self); + if (self->decoder == NULL) + Py_RETURN_NONE; + return PyObject_GetAttr(self->decoder, _PyIO_str_newlines); +} + +static struct PyMethodDef stringio_methods[] = { + {"close", (PyCFunction)stringio_close, METH_NOARGS, stringio_close_doc}, + {"getvalue", (PyCFunction)stringio_getvalue, METH_VARARGS, stringio_getvalue_doc}, + {"read", (PyCFunction)stringio_read, METH_VARARGS, stringio_read_doc}, + {"readline", (PyCFunction)stringio_readline, METH_VARARGS, stringio_readline_doc}, + {"tell", (PyCFunction)stringio_tell, METH_NOARGS, stringio_tell_doc}, + {"truncate", (PyCFunction)stringio_truncate, METH_VARARGS, stringio_truncate_doc}, + {"seek", (PyCFunction)stringio_seek, METH_VARARGS, stringio_seek_doc}, + {"write", (PyCFunction)stringio_write, METH_O, stringio_write_doc}, + + {"seekable", (PyCFunction)stringio_seekable, METH_NOARGS}, + {"readable", (PyCFunction)stringio_readable, METH_NOARGS}, + {"writable", (PyCFunction)stringio_writable, METH_NOARGS}, + {NULL, NULL} /* sentinel */ +}; + +static PyGetSetDef stringio_getset[] = { + {"closed", (getter)stringio_closed, NULL, NULL}, + {"newlines", (getter)stringio_newlines, NULL, NULL}, + /* (following comments straight off of the original Python wrapper:) + XXX Cruft to support the TextIOWrapper API. This would only + be meaningful if StringIO supported the buffer attribute. + Hopefully, a better solution, than adding these pseudo-attributes, + will be found. + */ + {"buffer", (getter)stringio_buffer, NULL, NULL}, + {"line_buffering", (getter)stringio_line_buffering, NULL, NULL}, + {NULL} +}; + +PyTypeObject PyStringIO_Type = { + PyVarObject_HEAD_INIT(NULL, 0) + "_io.StringIO", /*tp_name*/ + sizeof(stringio), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + (destructor)stringio_dealloc, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + 0, /*tp_reserved*/ + 0, /*tp_repr*/ + 0, /*tp_as_number*/ + 0, /*tp_as_sequence*/ + 0, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + 0, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE + | Py_TPFLAGS_HAVE_GC, /*tp_flags*/ + stringio_doc, /*tp_doc*/ + (traverseproc)stringio_traverse, /*tp_traverse*/ + (inquiry)stringio_clear, /*tp_clear*/ + 0, /*tp_richcompare*/ + offsetof(stringio, weakreflist), /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + (iternextfunc)stringio_iternext, /*tp_iternext*/ + stringio_methods, /*tp_methods*/ + 0, /*tp_members*/ + stringio_getset, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + offsetof(stringio, dict), /*tp_dictoffset*/ + (initproc)stringio_init, /*tp_init*/ + 0, /*tp_alloc*/ + stringio_new, /*tp_new*/ +}; Added: python/trunk/Modules/_io/textio.c ============================================================================== --- (empty file) +++ python/trunk/Modules/_io/textio.c Fri Jun 12 22:14:08 2009 @@ -0,0 +1,2606 @@ +/* + An implementation of Text I/O as defined by PEP 3116 - "New I/O" + + Classes defined here: TextIOBase, IncrementalNewlineDecoder, TextIOWrapper. + + Written by Amaury Forgeot d'Arc and Antoine Pitrou +*/ + +#define PY_SSIZE_T_CLEAN +#include "Python.h" +#include "structmember.h" +#include "_iomodule.h" + +/* TextIOBase */ + +PyDoc_STRVAR(textiobase_doc, + "Base class for text I/O.\n" + "\n" + "This class provides a character and line based interface to stream\n" + "I/O. There is no readinto method because Python's character strings\n" + "are immutable. There is no public constructor.\n" + ); + +static PyObject * +_unsupported(const char *message) +{ + PyErr_SetString(_PyIO_unsupported_operation, message); + return NULL; +} + +PyDoc_STRVAR(textiobase_detach_doc, + "Separate the underlying buffer from the TextIOBase and return it.\n" + "\n" + "After the underlying buffer has been detached, the TextIO is in an\n" + "unusable state.\n" + ); + +static PyObject * +textiobase_detach(PyObject *self) +{ + return _unsupported("detach"); +} + +PyDoc_STRVAR(textiobase_read_doc, + "Read at most n characters from stream.\n" + "\n" + "Read from underlying buffer until we have n characters or we hit EOF.\n" + "If n is negative or omitted, read until EOF.\n" + ); + +static PyObject * +textiobase_read(PyObject *self, PyObject *args) +{ + return _unsupported("read"); +} + +PyDoc_STRVAR(textiobase_readline_doc, + "Read until newline or EOF.\n" + "\n" + "Returns an empty string if EOF is hit immediately.\n" + ); + +static PyObject * +textiobase_readline(PyObject *self, PyObject *args) +{ + return _unsupported("readline"); +} + +PyDoc_STRVAR(textiobase_write_doc, + "Write string to stream.\n" + "Returns the number of characters written (which is always equal to\n" + "the length of the string).\n" + ); + +static PyObject * +textiobase_write(PyObject *self, PyObject *args) +{ + return _unsupported("write"); +} + +PyDoc_STRVAR(textiobase_encoding_doc, + "Encoding of the text stream.\n" + "\n" + "Subclasses should override.\n" + ); + +static PyObject * +textiobase_encoding_get(PyObject *self, void *context) +{ + Py_RETURN_NONE; +} + +PyDoc_STRVAR(textiobase_newlines_doc, + "Line endings translated so far.\n" + "\n" + "Only line endings translated during reading are considered.\n" + "\n" + "Subclasses should override.\n" + ); + +static PyObject * +textiobase_newlines_get(PyObject *self, void *context) +{ + Py_RETURN_NONE; +} + +PyDoc_STRVAR(textiobase_errors_doc, + "The error setting of the decoder or encoder.\n" + "\n" + "Subclasses should override.\n" + ); + +static PyObject * +textiobase_errors_get(PyObject *self, void *context) +{ + Py_RETURN_NONE; +} + + +static PyMethodDef textiobase_methods[] = { + {"detach", (PyCFunction)textiobase_detach, METH_NOARGS, textiobase_detach_doc}, + {"read", textiobase_read, METH_VARARGS, textiobase_read_doc}, + {"readline", textiobase_readline, METH_VARARGS, textiobase_readline_doc}, + {"write", textiobase_write, METH_VARARGS, textiobase_write_doc}, + {NULL, NULL} +}; + +static PyGetSetDef textiobase_getset[] = { + {"encoding", (getter)textiobase_encoding_get, NULL, textiobase_encoding_doc}, + {"newlines", (getter)textiobase_newlines_get, NULL, textiobase_newlines_doc}, + {"errors", (getter)textiobase_errors_get, NULL, textiobase_errors_doc}, + {NULL} +}; + +PyTypeObject PyTextIOBase_Type = { + PyVarObject_HEAD_INIT(NULL, 0) + "_io._TextIOBase", /*tp_name*/ + 0, /*tp_basicsize*/ + 0, /*tp_itemsize*/ + 0, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + 0, /*tp_compare */ + 0, /*tp_repr*/ + 0, /*tp_as_number*/ + 0, /*tp_as_sequence*/ + 0, /*tp_as_mapping*/ + 0, /*tp_hash */ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + 0, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /*tp_flags*/ + textiobase_doc, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + textiobase_methods, /* tp_methods */ + 0, /* tp_members */ + textiobase_getset, /* tp_getset */ + &PyIOBase_Type, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + 0, /* tp_init */ + 0, /* tp_alloc */ + 0, /* tp_new */ +}; + + +/* IncrementalNewlineDecoder */ + +PyDoc_STRVAR(incrementalnewlinedecoder_doc, + "Codec used when reading a file in universal newlines mode. It wraps\n" + "another incremental decoder, translating \\r\\n and \\r into \\n. It also\n" + "records the types of newlines encountered. When used with\n" + "translate=False, it ensures that the newline sequence is returned in\n" + "one piece. When used with decoder=None, it expects unicode strings as\n" + "decode input and translates newlines without first invoking an external\n" + "decoder.\n" + ); + +typedef struct { + PyObject_HEAD + PyObject *decoder; + PyObject *errors; + int pendingcr:1; + int translate:1; + unsigned int seennl:3; +} nldecoder_object; + +static int +incrementalnewlinedecoder_init(nldecoder_object *self, + PyObject *args, PyObject *kwds) +{ + PyObject *decoder; + int translate; + PyObject *errors = NULL; + char *kwlist[] = {"decoder", "translate", "errors", NULL}; + + if (!PyArg_ParseTupleAndKeywords(args, kwds, "Oi|O:IncrementalNewlineDecoder", + kwlist, &decoder, &translate, &errors)) + return -1; + + self->decoder = decoder; + Py_INCREF(decoder); + + if (errors == NULL) { + self->errors = PyUnicode_FromString("strict"); + if (self->errors == NULL) + return -1; + } + else { + Py_INCREF(errors); + self->errors = errors; + } + + self->translate = translate; + self->seennl = 0; + self->pendingcr = 0; + + return 0; +} + +static void +incrementalnewlinedecoder_dealloc(nldecoder_object *self) +{ + Py_CLEAR(self->decoder); + Py_CLEAR(self->errors); + Py_TYPE(self)->tp_free((PyObject *)self); +} + +#define SEEN_CR 1 +#define SEEN_LF 2 +#define SEEN_CRLF 4 +#define SEEN_ALL (SEEN_CR | SEEN_LF | SEEN_CRLF) + +PyObject * +_PyIncrementalNewlineDecoder_decode(PyObject *_self, + PyObject *input, int final) +{ + PyObject *output; + Py_ssize_t output_len; + nldecoder_object *self = (nldecoder_object *) _self; + + if (self->decoder == NULL) { + PyErr_SetString(PyExc_ValueError, + "IncrementalNewlineDecoder.__init__ not called"); + return NULL; + } + + /* decode input (with the eventual \r from a previous pass) */ + if (self->decoder != Py_None) { + output = PyObject_CallMethodObjArgs(self->decoder, + _PyIO_str_decode, input, final ? Py_True : Py_False, NULL); + } + else { + output = input; + Py_INCREF(output); + } + + if (output == NULL) + return NULL; + + if (!PyUnicode_Check(output)) { + PyErr_SetString(PyExc_TypeError, + "decoder should return a string result"); + goto error; + } + + output_len = PyUnicode_GET_SIZE(output); + if (self->pendingcr && (final || output_len > 0)) { + Py_UNICODE *out; + PyObject *modified = PyUnicode_FromUnicode(NULL, output_len + 1); + if (modified == NULL) + goto error; + out = PyUnicode_AS_UNICODE(modified); + out[0] = '\r'; + memcpy(out + 1, PyUnicode_AS_UNICODE(output), + output_len * sizeof(Py_UNICODE)); + Py_DECREF(output); + output = modified; + self->pendingcr = 0; + output_len++; + } + + /* retain last \r even when not translating data: + * then readline() is sure to get \r\n in one pass + */ + if (!final) { + if (output_len > 0 + && PyUnicode_AS_UNICODE(output)[output_len - 1] == '\r') { + + if (Py_REFCNT(output) == 1) { + if (PyUnicode_Resize(&output, output_len - 1) < 0) + goto error; + } + else { + PyObject *modified = PyUnicode_FromUnicode( + PyUnicode_AS_UNICODE(output), + output_len - 1); + if (modified == NULL) + goto error; + Py_DECREF(output); + output = modified; + } + self->pendingcr = 1; + } + } + + /* Record which newlines are read and do newline translation if desired, + all in one pass. */ + { + Py_UNICODE *in_str; + Py_ssize_t len; + int seennl = self->seennl; + int only_lf = 0; + + in_str = PyUnicode_AS_UNICODE(output); + len = PyUnicode_GET_SIZE(output); + + if (len == 0) + return output; + + /* If, up to now, newlines are consistently \n, do a quick check + for the \r *byte* with the libc's optimized memchr. + */ + if (seennl == SEEN_LF || seennl == 0) { + only_lf = (memchr(in_str, '\r', len * sizeof(Py_UNICODE)) == NULL); + } + + if (only_lf) { + /* If not already seen, quick scan for a possible "\n" character. + (there's nothing else to be done, even when in translation mode) + */ + if (seennl == 0 && + memchr(in_str, '\n', len * sizeof(Py_UNICODE)) != NULL) { + Py_UNICODE *s, *end; + s = in_str; + end = in_str + len; + for (;;) { + Py_UNICODE c; + /* Fast loop for non-control characters */ + while (*s > '\n') + s++; + c = *s++; + if (c == '\n') { + seennl |= SEEN_LF; + break; + } + if (s > end) + break; + } + } + /* Finished: we have scanned for newlines, and none of them + need translating */ + } + else if (!self->translate) { + Py_UNICODE *s, *end; + /* We have already seen all newline types, no need to scan again */ + if (seennl == SEEN_ALL) + goto endscan; + s = in_str; + end = in_str + len; + for (;;) { + Py_UNICODE c; + /* Fast loop for non-control characters */ + while (*s > '\r') + s++; + c = *s++; + if (c == '\n') + seennl |= SEEN_LF; + else if (c == '\r') { + if (*s == '\n') { + seennl |= SEEN_CRLF; + s++; + } + else + seennl |= SEEN_CR; + } + if (s > end) + break; + if (seennl == SEEN_ALL) + break; + } + endscan: + ; + } + else { + PyObject *translated = NULL; + Py_UNICODE *out_str; + Py_UNICODE *in, *out, *end; + if (Py_REFCNT(output) != 1) { + /* We could try to optimize this so that we only do a copy + when there is something to translate. On the other hand, + most decoders should only output non-shared strings, i.e. + translation is done in place. */ + translated = PyUnicode_FromUnicode(NULL, len); + if (translated == NULL) + goto error; + assert(Py_REFCNT(translated) == 1); + memcpy(PyUnicode_AS_UNICODE(translated), + PyUnicode_AS_UNICODE(output), + len * sizeof(Py_UNICODE)); + } + else { + translated = output; + } + out_str = PyUnicode_AS_UNICODE(translated); + in = in_str; + out = out_str; + end = in_str + len; + for (;;) { + Py_UNICODE c; + /* Fast loop for non-control characters */ + while ((c = *in++) > '\r') + *out++ = c; + if (c == '\n') { + *out++ = c; + seennl |= SEEN_LF; + continue; + } + if (c == '\r') { + if (*in == '\n') { + in++; + seennl |= SEEN_CRLF; + } + else + seennl |= SEEN_CR; + *out++ = '\n'; + continue; + } + if (in > end) + break; + *out++ = c; + } + if (translated != output) { + Py_DECREF(output); + output = translated; + } + if (out - out_str != len) { + if (PyUnicode_Resize(&output, out - out_str) < 0) + goto error; + } + } + self->seennl |= seennl; + } + + return output; + + error: + Py_DECREF(output); + return NULL; +} + +static PyObject * +incrementalnewlinedecoder_decode(nldecoder_object *self, + PyObject *args, PyObject *kwds) +{ + char *kwlist[] = {"input", "final", NULL}; + PyObject *input; + int final = 0; + + if (!PyArg_ParseTupleAndKeywords(args, kwds, "O|i:IncrementalNewlineDecoder", + kwlist, &input, &final)) + return NULL; + return _PyIncrementalNewlineDecoder_decode((PyObject *) self, input, final); +} + +static PyObject * +incrementalnewlinedecoder_getstate(nldecoder_object *self, PyObject *args) +{ + PyObject *buffer; + unsigned PY_LONG_LONG flag; + + if (self->decoder != Py_None) { + PyObject *state = PyObject_CallMethodObjArgs(self->decoder, + _PyIO_str_getstate, NULL); + if (state == NULL) + return NULL; + if (!PyArg_Parse(state, "(OK)", &buffer, &flag)) { + Py_DECREF(state); + return NULL; + } + Py_INCREF(buffer); + Py_DECREF(state); + } + else { + buffer = PyBytes_FromString(""); + flag = 0; + } + flag <<= 1; + if (self->pendingcr) + flag |= 1; + return Py_BuildValue("NK", buffer, flag); +} + +static PyObject * +incrementalnewlinedecoder_setstate(nldecoder_object *self, PyObject *state) +{ + PyObject *buffer; + unsigned PY_LONG_LONG flag; + + if (!PyArg_Parse(state, "(OK)", &buffer, &flag)) + return NULL; + + self->pendingcr = (int) flag & 1; + flag >>= 1; + + if (self->decoder != Py_None) + return PyObject_CallMethod(self->decoder, + "setstate", "((OK))", buffer, flag); + else + Py_RETURN_NONE; +} + +static PyObject * +incrementalnewlinedecoder_reset(nldecoder_object *self, PyObject *args) +{ + self->seennl = 0; + self->pendingcr = 0; + if (self->decoder != Py_None) + return PyObject_CallMethodObjArgs(self->decoder, _PyIO_str_reset, NULL); + else + Py_RETURN_NONE; +} + +static PyObject * +incrementalnewlinedecoder_newlines_get(nldecoder_object *self, void *context) +{ + switch (self->seennl) { + case SEEN_CR: + return PyUnicode_FromString("\r"); + case SEEN_LF: + return PyUnicode_FromString("\n"); + case SEEN_CRLF: + return PyUnicode_FromString("\r\n"); + case SEEN_CR | SEEN_LF: + return Py_BuildValue("ss", "\r", "\n"); + case SEEN_CR | SEEN_CRLF: + return Py_BuildValue("ss", "\r", "\r\n"); + case SEEN_LF | SEEN_CRLF: + return Py_BuildValue("ss", "\n", "\r\n"); + case SEEN_CR | SEEN_LF | SEEN_CRLF: + return Py_BuildValue("sss", "\r", "\n", "\r\n"); + default: + Py_RETURN_NONE; + } + +} + + +static PyMethodDef incrementalnewlinedecoder_methods[] = { + {"decode", (PyCFunction)incrementalnewlinedecoder_decode, METH_VARARGS|METH_KEYWORDS}, + {"getstate", (PyCFunction)incrementalnewlinedecoder_getstate, METH_NOARGS}, + {"setstate", (PyCFunction)incrementalnewlinedecoder_setstate, METH_O}, + {"reset", (PyCFunction)incrementalnewlinedecoder_reset, METH_NOARGS}, + {NULL} +}; + +static PyGetSetDef incrementalnewlinedecoder_getset[] = { + {"newlines", (getter)incrementalnewlinedecoder_newlines_get, NULL, NULL}, + {NULL} +}; + +PyTypeObject PyIncrementalNewlineDecoder_Type = { + PyVarObject_HEAD_INIT(NULL, 0) + "_io.IncrementalNewlineDecoder", /*tp_name*/ + sizeof(nldecoder_object), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + (destructor)incrementalnewlinedecoder_dealloc, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + 0, /*tp_compare */ + 0, /*tp_repr*/ + 0, /*tp_as_number*/ + 0, /*tp_as_sequence*/ + 0, /*tp_as_mapping*/ + 0, /*tp_hash */ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + 0, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /*tp_flags*/ + incrementalnewlinedecoder_doc, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /*tp_weaklistoffset*/ + 0, /* tp_iter */ + 0, /* tp_iternext */ + incrementalnewlinedecoder_methods, /* tp_methods */ + 0, /* tp_members */ + incrementalnewlinedecoder_getset, /* tp_getset */ + 0, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)incrementalnewlinedecoder_init, /* tp_init */ + 0, /* tp_alloc */ + PyType_GenericNew, /* tp_new */ +}; + + +/* TextIOWrapper */ + +PyDoc_STRVAR(textiowrapper_doc, + "Character and line based layer over a BufferedIOBase object, buffer.\n" + "\n" + "encoding gives the name of the encoding that the stream will be\n" + "decoded or encoded with. It defaults to locale.getpreferredencoding.\n" + "\n" + "errors determines the strictness of encoding and decoding (see the\n" + "codecs.register) and defaults to \"strict\".\n" + "\n" + "newline can be None, '', '\\n', '\\r', or '\\r\\n'. It controls the\n" + "handling of line endings. If it is None, universal newlines is\n" + "enabled. With this enabled, on input, the lines endings '\\n', '\\r',\n" + "or '\\r\\n' are translated to '\\n' before being returned to the\n" + "caller. Conversely, on output, '\\n' is translated to the system\n" + "default line seperator, os.linesep. If newline is any other of its\n" + "legal values, that newline becomes the newline when the file is read\n" + "and it is returned untranslated. On output, '\\n' is converted to the\n" + "newline.\n" + "\n" + "If line_buffering is True, a call to flush is implied when a call to\n" + "write contains a newline character." + ); + +typedef PyObject * + (*encodefunc_t)(PyObject *, PyObject *); + +typedef struct +{ + PyObject_HEAD + int ok; /* initialized? */ + int detached; + Py_ssize_t chunk_size; + PyObject *buffer; + PyObject *encoding; + PyObject *encoder; + PyObject *decoder; + PyObject *readnl; + PyObject *errors; + const char *writenl; /* utf-8 encoded, NULL stands for \n */ + char line_buffering; + char readuniversal; + char readtranslate; + char writetranslate; + char seekable; + char telling; + /* Specialized encoding func (see below) */ + encodefunc_t encodefunc; + /* Whether or not it's the start of the stream */ + char encoding_start_of_stream; + + /* Reads and writes are internally buffered in order to speed things up. + However, any read will first flush the write buffer if itsn't empty. + + Please also note that text to be written is first encoded before being + buffered. This is necessary so that encoding errors are immediately + reported to the caller, but it unfortunately means that the + IncrementalEncoder (whose encode() method is always written in Python) + becomes a bottleneck for small writes. + */ + PyObject *decoded_chars; /* buffer for text returned from decoder */ + Py_ssize_t decoded_chars_used; /* offset into _decoded_chars for read() */ + PyObject *pending_bytes; /* list of bytes objects waiting to be + written, or NULL */ + Py_ssize_t pending_bytes_count; + PyObject *snapshot; + /* snapshot is either None, or a tuple (dec_flags, next_input) where + * dec_flags is the second (integer) item of the decoder state and + * next_input is the chunk of input bytes that comes next after the + * snapshot point. We use this to reconstruct decoder states in tell(). + */ + + /* Cache raw object if it's a FileIO object */ + PyObject *raw; + + PyObject *weakreflist; + PyObject *dict; +} textio; + + +/* A couple of specialized cases in order to bypass the slow incremental + encoding methods for the most popular encodings. */ + +static PyObject * +ascii_encode(textio *self, PyObject *text) +{ + return PyUnicode_EncodeASCII(PyUnicode_AS_UNICODE(text), + PyUnicode_GET_SIZE(text), + PyBytes_AS_STRING(self->errors)); +} + +static PyObject * +utf16be_encode(textio *self, PyObject *text) +{ + return PyUnicode_EncodeUTF16(PyUnicode_AS_UNICODE(text), + PyUnicode_GET_SIZE(text), + PyBytes_AS_STRING(self->errors), 1); +} + +static PyObject * +utf16le_encode(textio *self, PyObject *text) +{ + return PyUnicode_EncodeUTF16(PyUnicode_AS_UNICODE(text), + PyUnicode_GET_SIZE(text), + PyBytes_AS_STRING(self->errors), -1); +} + +static PyObject * +utf16_encode(textio *self, PyObject *text) +{ + if (!self->encoding_start_of_stream) { + /* Skip the BOM and use native byte ordering */ +#if defined(WORDS_BIGENDIAN) + return utf16be_encode(self, text); +#else + return utf16le_encode(self, text); +#endif + } + return PyUnicode_EncodeUTF16(PyUnicode_AS_UNICODE(text), + PyUnicode_GET_SIZE(text), + PyBytes_AS_STRING(self->errors), 0); +} + +static PyObject * +utf32be_encode(textio *self, PyObject *text) +{ + return PyUnicode_EncodeUTF32(PyUnicode_AS_UNICODE(text), + PyUnicode_GET_SIZE(text), + PyBytes_AS_STRING(self->errors), 1); +} + +static PyObject * +utf32le_encode(textio *self, PyObject *text) +{ + return PyUnicode_EncodeUTF32(PyUnicode_AS_UNICODE(text), + PyUnicode_GET_SIZE(text), + PyBytes_AS_STRING(self->errors), -1); +} + +static PyObject * +utf32_encode(textio *self, PyObject *text) +{ + if (!self->encoding_start_of_stream) { + /* Skip the BOM and use native byte ordering */ +#if defined(WORDS_BIGENDIAN) + return utf32be_encode(self, text); +#else + return utf32le_encode(self, text); +#endif + } + return PyUnicode_EncodeUTF32(PyUnicode_AS_UNICODE(text), + PyUnicode_GET_SIZE(text), + PyBytes_AS_STRING(self->errors), 0); +} + +static PyObject * +utf8_encode(textio *self, PyObject *text) +{ + return PyUnicode_EncodeUTF8(PyUnicode_AS_UNICODE(text), + PyUnicode_GET_SIZE(text), + PyBytes_AS_STRING(self->errors)); +} + +static PyObject * +latin1_encode(textio *self, PyObject *text) +{ + return PyUnicode_EncodeLatin1(PyUnicode_AS_UNICODE(text), + PyUnicode_GET_SIZE(text), + PyBytes_AS_STRING(self->errors)); +} + +/* Map normalized encoding names onto the specialized encoding funcs */ + +typedef struct { + const char *name; + encodefunc_t encodefunc; +} encodefuncentry; + +static encodefuncentry encodefuncs[] = { + {"ascii", (encodefunc_t) ascii_encode}, + {"iso8859-1", (encodefunc_t) latin1_encode}, + {"utf-8", (encodefunc_t) utf8_encode}, + {"utf-16-be", (encodefunc_t) utf16be_encode}, + {"utf-16-le", (encodefunc_t) utf16le_encode}, + {"utf-16", (encodefunc_t) utf16_encode}, + {"utf-32-be", (encodefunc_t) utf32be_encode}, + {"utf-32-le", (encodefunc_t) utf32le_encode}, + {"utf-32", (encodefunc_t) utf32_encode}, + {NULL, NULL} +}; + + +static int +textiowrapper_init(textio *self, PyObject *args, PyObject *kwds) +{ + char *kwlist[] = {"buffer", "encoding", "errors", + "newline", "line_buffering", + NULL}; + PyObject *buffer, *raw; + char *encoding = NULL; + char *errors = NULL; + char *newline = NULL; + int line_buffering = 0; + + PyObject *res; + int r; + + self->ok = 0; + self->detached = 0; + if (!PyArg_ParseTupleAndKeywords(args, kwds, "O|zzzi:fileio", + kwlist, &buffer, &encoding, &errors, + &newline, &line_buffering)) + return -1; + + if (newline && newline[0] != '\0' + && !(newline[0] == '\n' && newline[1] == '\0') + && !(newline[0] == '\r' && newline[1] == '\0') + && !(newline[0] == '\r' && newline[1] == '\n' && newline[2] == '\0')) { + PyErr_Format(PyExc_ValueError, + "illegal newline value: %s", newline); + return -1; + } + + Py_CLEAR(self->buffer); + Py_CLEAR(self->encoding); + Py_CLEAR(self->encoder); + Py_CLEAR(self->decoder); + Py_CLEAR(self->readnl); + Py_CLEAR(self->decoded_chars); + Py_CLEAR(self->pending_bytes); + Py_CLEAR(self->snapshot); + Py_CLEAR(self->errors); + Py_CLEAR(self->raw); + self->decoded_chars_used = 0; + self->pending_bytes_count = 0; + self->encodefunc = NULL; + self->writenl = NULL; + + if (encoding == NULL && self->encoding == NULL) { + if (_PyIO_locale_module == NULL) { + _PyIO_locale_module = PyImport_ImportModule("locale"); + if (_PyIO_locale_module == NULL) + goto catch_ImportError; + else + goto use_locale; + } + else { + use_locale: + self->encoding = PyObject_CallMethod( + _PyIO_locale_module, "getpreferredencoding", NULL); + if (self->encoding == NULL) { + catch_ImportError: + /* + Importing locale can raise a ImportError because of + _functools, and locale.getpreferredencoding can raise a + ImportError if _locale is not available. These will happen + during module building. + */ + if (PyErr_ExceptionMatches(PyExc_ImportError)) { + PyErr_Clear(); + self->encoding = PyString_FromString("ascii"); + } + else + goto error; + } + else if (!PyString_Check(self->encoding)) + Py_CLEAR(self->encoding); + } + } + if (self->encoding != NULL) + encoding = PyString_AsString(self->encoding); + else if (encoding != NULL) { + self->encoding = PyString_FromString(encoding); + if (self->encoding == NULL) + goto error; + } + else { + PyErr_SetString(PyExc_IOError, + "could not determine default encoding"); + } + + if (errors == NULL) + errors = "strict"; + self->errors = PyBytes_FromString(errors); + if (self->errors == NULL) + goto error; + + self->chunk_size = 8192; + self->readuniversal = (newline == NULL || newline[0] == '\0'); + self->line_buffering = line_buffering; + self->readtranslate = (newline == NULL); + if (newline) { + self->readnl = PyString_FromString(newline); + if (self->readnl == NULL) + return -1; + } + self->writetranslate = (newline == NULL || newline[0] != '\0'); + if (!self->readuniversal && self->writetranslate) { + self->writenl = PyString_AsString(self->readnl); + if (!strcmp(self->writenl, "\n")) + self->writenl = NULL; + } +#ifdef MS_WINDOWS + else + self->writenl = "\r\n"; +#endif + + /* Build the decoder object */ + res = PyObject_CallMethod(buffer, "readable", NULL); + if (res == NULL) + goto error; + r = PyObject_IsTrue(res); + Py_DECREF(res); + if (r == -1) + goto error; + if (r == 1) { + self->decoder = PyCodec_IncrementalDecoder( + encoding, errors); + if (self->decoder == NULL) + goto error; + + if (self->readuniversal) { + PyObject *incrementalDecoder = PyObject_CallFunction( + (PyObject *)&PyIncrementalNewlineDecoder_Type, + "Oi", self->decoder, (int)self->readtranslate); + if (incrementalDecoder == NULL) + goto error; + Py_CLEAR(self->decoder); + self->decoder = incrementalDecoder; + } + } + + /* Build the encoder object */ + res = PyObject_CallMethod(buffer, "writable", NULL); + if (res == NULL) + goto error; + r = PyObject_IsTrue(res); + Py_DECREF(res); + if (r == -1) + goto error; + if (r == 1) { + PyObject *ci; + self->encoder = PyCodec_IncrementalEncoder( + encoding, errors); + if (self->encoder == NULL) + goto error; + /* Get the normalized named of the codec */ + ci = _PyCodec_Lookup(encoding); + if (ci == NULL) + goto error; + res = PyObject_GetAttrString(ci, "name"); + Py_DECREF(ci); + if (res == NULL) { + if (PyErr_ExceptionMatches(PyExc_AttributeError)) + PyErr_Clear(); + else + goto error; + } + else if (PyString_Check(res)) { + encodefuncentry *e = encodefuncs; + while (e->name != NULL) { + if (!strcmp(PyString_AS_STRING(res), e->name)) { + self->encodefunc = e->encodefunc; + break; + } + e++; + } + } + Py_XDECREF(res); + } + + self->buffer = buffer; + Py_INCREF(buffer); + + if (Py_TYPE(buffer) == &PyBufferedReader_Type || + Py_TYPE(buffer) == &PyBufferedWriter_Type || + Py_TYPE(buffer) == &PyBufferedRandom_Type) { + raw = PyObject_GetAttrString(buffer, "raw"); + /* Cache the raw FileIO object to speed up 'closed' checks */ + if (raw == NULL) { + if (PyErr_ExceptionMatches(PyExc_AttributeError)) + PyErr_Clear(); + else + goto error; + } + else if (Py_TYPE(raw) == &PyFileIO_Type) + self->raw = raw; + else + Py_DECREF(raw); + } + + res = PyObject_CallMethod(buffer, "seekable", NULL); + if (res == NULL) + goto error; + self->seekable = self->telling = PyObject_IsTrue(res); + Py_DECREF(res); + + self->encoding_start_of_stream = 0; + if (self->seekable && self->encoder) { + PyObject *cookieObj; + int cmp; + + self->encoding_start_of_stream = 1; + + cookieObj = PyObject_CallMethodObjArgs(buffer, _PyIO_str_tell, NULL); + if (cookieObj == NULL) + goto error; + + cmp = PyObject_RichCompareBool(cookieObj, _PyIO_zero, Py_EQ); + Py_DECREF(cookieObj); + if (cmp < 0) { + goto error; + } + + if (cmp == 0) { + self->encoding_start_of_stream = 0; + res = PyObject_CallMethodObjArgs(self->encoder, _PyIO_str_setstate, + _PyIO_zero, NULL); + if (res == NULL) + goto error; + Py_DECREF(res); + } + } + + self->ok = 1; + return 0; + + error: + return -1; +} + +static int +_textiowrapper_clear(textio *self) +{ + if (self->ok && _PyIOBase_finalize((PyObject *) self) < 0) + return -1; + self->ok = 0; + Py_CLEAR(self->buffer); + Py_CLEAR(self->encoding); + Py_CLEAR(self->encoder); + Py_CLEAR(self->decoder); + Py_CLEAR(self->readnl); + Py_CLEAR(self->decoded_chars); + Py_CLEAR(self->pending_bytes); + Py_CLEAR(self->snapshot); + Py_CLEAR(self->errors); + Py_CLEAR(self->raw); + return 0; +} + +static void +textiowrapper_dealloc(textio *self) +{ + if (_textiowrapper_clear(self) < 0) + return; + _PyObject_GC_UNTRACK(self); + if (self->weakreflist != NULL) + PyObject_ClearWeakRefs((PyObject *)self); + Py_CLEAR(self->dict); + Py_TYPE(self)->tp_free((PyObject *)self); +} + +static int +textiowrapper_traverse(textio *self, visitproc visit, void *arg) +{ + Py_VISIT(self->buffer); + Py_VISIT(self->encoding); + Py_VISIT(self->encoder); + Py_VISIT(self->decoder); + Py_VISIT(self->readnl); + Py_VISIT(self->decoded_chars); + Py_VISIT(self->pending_bytes); + Py_VISIT(self->snapshot); + Py_VISIT(self->errors); + Py_VISIT(self->raw); + + Py_VISIT(self->dict); + return 0; +} + +static int +textiowrapper_clear(textio *self) +{ + if (_textiowrapper_clear(self) < 0) + return -1; + Py_CLEAR(self->dict); + return 0; +} + +static PyObject * +textiowrapper_closed_get(textio *self, void *context); + +/* This macro takes some shortcuts to make the common case faster. */ +#define CHECK_CLOSED(self) \ + do { \ + int r; \ + PyObject *_res; \ + if (Py_TYPE(self) == &PyTextIOWrapper_Type) { \ + if (self->raw != NULL) \ + r = _PyFileIO_closed(self->raw); \ + else { \ + _res = textiowrapper_closed_get(self, NULL); \ + if (_res == NULL) \ + return NULL; \ + r = PyObject_IsTrue(_res); \ + Py_DECREF(_res); \ + if (r < 0) \ + return NULL; \ + } \ + if (r > 0) { \ + PyErr_SetString(PyExc_ValueError, \ + "I/O operation on closed file."); \ + return NULL; \ + } \ + } \ + else if (_PyIOBase_check_closed((PyObject *)self, Py_True) == NULL) \ + return NULL; \ + } while (0) + +#define CHECK_INITIALIZED(self) \ + if (self->ok <= 0) { \ + if (self->detached) { \ + PyErr_SetString(PyExc_ValueError, \ + "underlying buffer has been detached"); \ + } else { \ + PyErr_SetString(PyExc_ValueError, \ + "I/O operation on uninitialized object"); \ + } \ + return NULL; \ + } + +#define CHECK_INITIALIZED_INT(self) \ + if (self->ok <= 0) { \ + if (self->detached) { \ + PyErr_SetString(PyExc_ValueError, \ + "underlying buffer has been detached"); \ + } else { \ + PyErr_SetString(PyExc_ValueError, \ + "I/O operation on uninitialized object"); \ + } \ + return -1; \ + } + + +static PyObject * +textiowrapper_detach(textio *self) +{ + PyObject *buffer, *res; + CHECK_INITIALIZED(self); + res = PyObject_CallMethodObjArgs((PyObject *)self, _PyIO_str_flush, NULL); + if (res == NULL) + return NULL; + Py_DECREF(res); + buffer = self->buffer; + self->buffer = NULL; + self->detached = 1; + self->ok = 0; + return buffer; +} + +Py_LOCAL_INLINE(const Py_UNICODE *) +findchar(const Py_UNICODE *s, Py_ssize_t size, Py_UNICODE ch) +{ + /* like wcschr, but doesn't stop at NULL characters */ + while (size-- > 0) { + if (*s == ch) + return s; + s++; + } + return NULL; +} + +/* Flush the internal write buffer. This doesn't explicitly flush the + underlying buffered object, though. */ +static int +_textiowrapper_writeflush(textio *self) +{ + PyObject *b, *ret; + + if (self->pending_bytes == NULL) + return 0; + b = _PyBytes_Join(_PyIO_empty_bytes, self->pending_bytes); + if (b == NULL) + return -1; + ret = PyObject_CallMethodObjArgs(self->buffer, + _PyIO_str_write, b, NULL); + Py_DECREF(b); + if (ret == NULL) + return -1; + Py_DECREF(ret); + Py_CLEAR(self->pending_bytes); + self->pending_bytes_count = 0; + return 0; +} + +static PyObject * +textiowrapper_write(textio *self, PyObject *args) +{ + PyObject *ret; + PyObject *text; /* owned reference */ + PyObject *b; + Py_ssize_t textlen; + int haslf = 0; + int needflush = 0; + + CHECK_INITIALIZED(self); + + if (!PyArg_ParseTuple(args, "U:write", &text)) { + return NULL; + } + + CHECK_CLOSED(self); + + if (self->encoder == NULL) { + PyErr_SetString(PyExc_IOError, "not writable"); + return NULL; + } + + Py_INCREF(text); + + textlen = PyUnicode_GetSize(text); + + if ((self->writetranslate && self->writenl != NULL) || self->line_buffering) + if (findchar(PyUnicode_AS_UNICODE(text), + PyUnicode_GET_SIZE(text), '\n')) + haslf = 1; + + if (haslf && self->writetranslate && self->writenl != NULL) { + PyObject *newtext = PyObject_CallMethod( + text, "replace", "ss", "\n", self->writenl); + Py_DECREF(text); + if (newtext == NULL) + return NULL; + text = newtext; + } + + if (self->line_buffering && + (haslf || + findchar(PyUnicode_AS_UNICODE(text), + PyUnicode_GET_SIZE(text), '\r'))) + needflush = 1; + + /* XXX What if we were just reading? */ + if (self->encodefunc != NULL) { + b = (*self->encodefunc)((PyObject *) self, text); + self->encoding_start_of_stream = 0; + } + else + b = PyObject_CallMethodObjArgs(self->encoder, + _PyIO_str_encode, text, NULL); + Py_DECREF(text); + if (b == NULL) + return NULL; + + if (self->pending_bytes == NULL) { + self->pending_bytes = PyList_New(0); + if (self->pending_bytes == NULL) { + Py_DECREF(b); + return NULL; + } + self->pending_bytes_count = 0; + } + if (PyList_Append(self->pending_bytes, b) < 0) { + Py_DECREF(b); + return NULL; + } + self->pending_bytes_count += PyBytes_GET_SIZE(b); + Py_DECREF(b); + if (self->pending_bytes_count > self->chunk_size || needflush) { + if (_textiowrapper_writeflush(self) < 0) + return NULL; + } + + if (needflush) { + ret = PyObject_CallMethodObjArgs(self->buffer, _PyIO_str_flush, NULL); + if (ret == NULL) + return NULL; + Py_DECREF(ret); + } + + Py_CLEAR(self->snapshot); + + if (self->decoder) { + ret = PyObject_CallMethod(self->decoder, "reset", NULL); + if (ret == NULL) + return NULL; + Py_DECREF(ret); + } + + return PyLong_FromSsize_t(textlen); +} + +/* Steal a reference to chars and store it in the decoded_char buffer; + */ +static void +textiowrapper_set_decoded_chars(textio *self, PyObject *chars) +{ + Py_CLEAR(self->decoded_chars); + self->decoded_chars = chars; + self->decoded_chars_used = 0; +} + +static PyObject * +textiowrapper_get_decoded_chars(textio *self, Py_ssize_t n) +{ + PyObject *chars; + Py_ssize_t avail; + + if (self->decoded_chars == NULL) + return PyUnicode_FromStringAndSize(NULL, 0); + + avail = (PyUnicode_GET_SIZE(self->decoded_chars) + - self->decoded_chars_used); + + assert(avail >= 0); + + if (n < 0 || n > avail) + n = avail; + + if (self->decoded_chars_used > 0 || n < avail) { + chars = PyUnicode_FromUnicode( + PyUnicode_AS_UNICODE(self->decoded_chars) + + self->decoded_chars_used, n); + if (chars == NULL) + return NULL; + } + else { + chars = self->decoded_chars; + Py_INCREF(chars); + } + + self->decoded_chars_used += n; + return chars; +} + +/* Read and decode the next chunk of data from the BufferedReader. + */ +static int +textiowrapper_read_chunk(textio *self) +{ + PyObject *dec_buffer = NULL; + PyObject *dec_flags = NULL; + PyObject *input_chunk = NULL; + PyObject *decoded_chars, *chunk_size; + int eof; + + /* The return value is True unless EOF was reached. The decoded string is + * placed in self._decoded_chars (replacing its previous value). The + * entire input chunk is sent to the decoder, though some of it may remain + * buffered in the decoder, yet to be converted. + */ + + if (self->decoder == NULL) { + PyErr_SetString(PyExc_IOError, "not readable"); + return -1; + } + + if (self->telling) { + /* To prepare for tell(), we need to snapshot a point in the file + * where the decoder's input buffer is empty. + */ + + PyObject *state = PyObject_CallMethodObjArgs(self->decoder, + _PyIO_str_getstate, NULL); + if (state == NULL) + return -1; + /* Given this, we know there was a valid snapshot point + * len(dec_buffer) bytes ago with decoder state (b'', dec_flags). + */ + if (PyArg_Parse(state, "(OO)", &dec_buffer, &dec_flags) < 0) { + Py_DECREF(state); + return -1; + } + Py_INCREF(dec_buffer); + Py_INCREF(dec_flags); + Py_DECREF(state); + } + + /* Read a chunk, decode it, and put the result in self._decoded_chars. */ + chunk_size = PyLong_FromSsize_t(self->chunk_size); + if (chunk_size == NULL) + goto fail; + input_chunk = PyObject_CallMethodObjArgs(self->buffer, + _PyIO_str_read1, chunk_size, NULL); + Py_DECREF(chunk_size); + if (input_chunk == NULL) + goto fail; + assert(PyBytes_Check(input_chunk)); + + eof = (PyBytes_Size(input_chunk) == 0); + + if (Py_TYPE(self->decoder) == &PyIncrementalNewlineDecoder_Type) { + decoded_chars = _PyIncrementalNewlineDecoder_decode( + self->decoder, input_chunk, eof); + } + else { + decoded_chars = PyObject_CallMethodObjArgs(self->decoder, + _PyIO_str_decode, input_chunk, eof ? Py_True : Py_False, NULL); + } + + /* TODO sanity check: isinstance(decoded_chars, unicode) */ + if (decoded_chars == NULL) + goto fail; + textiowrapper_set_decoded_chars(self, decoded_chars); + if (PyUnicode_GET_SIZE(decoded_chars) > 0) + eof = 0; + + if (self->telling) { + /* At the snapshot point, len(dec_buffer) bytes before the read, the + * next input to be decoded is dec_buffer + input_chunk. + */ + PyObject *next_input = PyNumber_Add(dec_buffer, input_chunk); + if (next_input == NULL) + goto fail; + assert (PyBytes_Check(next_input)); + Py_DECREF(dec_buffer); + Py_CLEAR(self->snapshot); + self->snapshot = Py_BuildValue("NN", dec_flags, next_input); + } + Py_DECREF(input_chunk); + + return (eof == 0); + + fail: + Py_XDECREF(dec_buffer); + Py_XDECREF(dec_flags); + Py_XDECREF(input_chunk); + return -1; +} + +static PyObject * +textiowrapper_read(textio *self, PyObject *args) +{ + Py_ssize_t n = -1; + PyObject *result = NULL, *chunks = NULL; + + CHECK_INITIALIZED(self); + + if (!PyArg_ParseTuple(args, "|n:read", &n)) + return NULL; + + CHECK_CLOSED(self); + + if (self->decoder == NULL) { + PyErr_SetString(PyExc_IOError, "not readable"); + return NULL; + } + + if (_textiowrapper_writeflush(self) < 0) + return NULL; + + if (n < 0) { + /* Read everything */ + PyObject *bytes = PyObject_CallMethod(self->buffer, "read", NULL); + PyObject *decoded, *final; + if (bytes == NULL) + goto fail; + decoded = PyObject_CallMethodObjArgs(self->decoder, _PyIO_str_decode, + bytes, Py_True, NULL); + Py_DECREF(bytes); + if (decoded == NULL) + goto fail; + + result = textiowrapper_get_decoded_chars(self, -1); + + if (result == NULL) { + Py_DECREF(decoded); + return NULL; + } + + final = PyUnicode_Concat(result, decoded); + Py_DECREF(result); + Py_DECREF(decoded); + if (final == NULL) + goto fail; + + Py_CLEAR(self->snapshot); + return final; + } + else { + int res = 1; + Py_ssize_t remaining = n; + + result = textiowrapper_get_decoded_chars(self, n); + if (result == NULL) + goto fail; + remaining -= PyUnicode_GET_SIZE(result); + + /* Keep reading chunks until we have n characters to return */ + while (remaining > 0) { + res = textiowrapper_read_chunk(self); + if (res < 0) + goto fail; + if (res == 0) /* EOF */ + break; + if (chunks == NULL) { + chunks = PyList_New(0); + if (chunks == NULL) + goto fail; + } + if (PyList_Append(chunks, result) < 0) + goto fail; + Py_DECREF(result); + result = textiowrapper_get_decoded_chars(self, remaining); + if (result == NULL) + goto fail; + remaining -= PyUnicode_GET_SIZE(result); + } + if (chunks != NULL) { + if (result != NULL && PyList_Append(chunks, result) < 0) + goto fail; + Py_CLEAR(result); + result = PyUnicode_Join(_PyIO_empty_str, chunks); + if (result == NULL) + goto fail; + Py_CLEAR(chunks); + } + return result; + } + fail: + Py_XDECREF(result); + Py_XDECREF(chunks); + return NULL; +} + + +/* NOTE: `end` must point to the real end of the Py_UNICODE storage, + that is to the NUL character. Otherwise the function will produce + incorrect results. */ +static Py_UNICODE * +find_control_char(Py_UNICODE *start, Py_UNICODE *end, Py_UNICODE ch) +{ + Py_UNICODE *s = start; + for (;;) { + while (*s > ch) + s++; + if (*s == ch) + return s; + if (s == end) + return NULL; + s++; + } +} + +Py_ssize_t +_PyIO_find_line_ending( + int translated, int universal, PyObject *readnl, + Py_UNICODE *start, Py_UNICODE *end, Py_ssize_t *consumed) +{ + Py_ssize_t len = end - start; + + if (translated) { + /* Newlines are already translated, only search for \n */ + Py_UNICODE *pos = find_control_char(start, end, '\n'); + if (pos != NULL) + return pos - start + 1; + else { + *consumed = len; + return -1; + } + } + else if (universal) { + /* Universal newline search. Find any of \r, \r\n, \n + * The decoder ensures that \r\n are not split in two pieces + */ + Py_UNICODE *s = start; + for (;;) { + Py_UNICODE ch; + /* Fast path for non-control chars. The loop always ends + since the Py_UNICODE storage is NUL-terminated. */ + while (*s > '\r') + s++; + if (s >= end) { + *consumed = len; + return -1; + } + ch = *s++; + if (ch == '\n') + return s - start; + if (ch == '\r') { + if (*s == '\n') + return s - start + 1; + else + return s - start; + } + } + } + else { + /* Non-universal mode. */ + Py_ssize_t readnl_len = PyString_GET_SIZE(readnl); + unsigned char *nl = (unsigned char *) PyString_AS_STRING(readnl); + if (readnl_len == 1) { + Py_UNICODE *pos = find_control_char(start, end, nl[0]); + if (pos != NULL) + return pos - start + 1; + *consumed = len; + return -1; + } + else { + Py_UNICODE *s = start; + Py_UNICODE *e = end - readnl_len + 1; + Py_UNICODE *pos; + if (e < s) + e = s; + while (s < e) { + Py_ssize_t i; + Py_UNICODE *pos = find_control_char(s, end, nl[0]); + if (pos == NULL || pos >= e) + break; + for (i = 1; i < readnl_len; i++) { + if (pos[i] != nl[i]) + break; + } + if (i == readnl_len) + return pos - start + readnl_len; + s = pos + 1; + } + pos = find_control_char(e, end, nl[0]); + if (pos == NULL) + *consumed = len; + else + *consumed = pos - start; + return -1; + } + } +} + +static PyObject * +_textiowrapper_readline(textio *self, Py_ssize_t limit) +{ + PyObject *line = NULL, *chunks = NULL, *remaining = NULL; + Py_ssize_t start, endpos, chunked, offset_to_buffer; + int res; + + CHECK_CLOSED(self); + + if (_textiowrapper_writeflush(self) < 0) + return NULL; + + chunked = 0; + + while (1) { + Py_UNICODE *ptr; + Py_ssize_t line_len; + Py_ssize_t consumed = 0; + + /* First, get some data if necessary */ + res = 1; + while (!self->decoded_chars || + !PyUnicode_GET_SIZE(self->decoded_chars)) { + res = textiowrapper_read_chunk(self); + if (res < 0) + goto error; + if (res == 0) + break; + } + if (res == 0) { + /* end of file */ + textiowrapper_set_decoded_chars(self, NULL); + Py_CLEAR(self->snapshot); + start = endpos = offset_to_buffer = 0; + break; + } + + if (remaining == NULL) { + line = self->decoded_chars; + start = self->decoded_chars_used; + offset_to_buffer = 0; + Py_INCREF(line); + } + else { + assert(self->decoded_chars_used == 0); + line = PyUnicode_Concat(remaining, self->decoded_chars); + start = 0; + offset_to_buffer = PyUnicode_GET_SIZE(remaining); + Py_CLEAR(remaining); + if (line == NULL) + goto error; + } + + ptr = PyUnicode_AS_UNICODE(line); + line_len = PyUnicode_GET_SIZE(line); + + endpos = _PyIO_find_line_ending( + self->readtranslate, self->readuniversal, self->readnl, + ptr + start, ptr + line_len, &consumed); + if (endpos >= 0) { + endpos += start; + if (limit >= 0 && (endpos - start) + chunked >= limit) + endpos = start + limit - chunked; + break; + } + + /* We can put aside up to `endpos` */ + endpos = consumed + start; + if (limit >= 0 && (endpos - start) + chunked >= limit) { + /* Didn't find line ending, but reached length limit */ + endpos = start + limit - chunked; + break; + } + + if (endpos > start) { + /* No line ending seen yet - put aside current data */ + PyObject *s; + if (chunks == NULL) { + chunks = PyList_New(0); + if (chunks == NULL) + goto error; + } + s = PyUnicode_FromUnicode(ptr + start, endpos - start); + if (s == NULL) + goto error; + if (PyList_Append(chunks, s) < 0) { + Py_DECREF(s); + goto error; + } + chunked += PyUnicode_GET_SIZE(s); + Py_DECREF(s); + } + /* There may be some remaining bytes we'll have to prepend to the + next chunk of data */ + if (endpos < line_len) { + remaining = PyUnicode_FromUnicode( + ptr + endpos, line_len - endpos); + if (remaining == NULL) + goto error; + } + Py_CLEAR(line); + /* We have consumed the buffer */ + textiowrapper_set_decoded_chars(self, NULL); + } + + if (line != NULL) { + /* Our line ends in the current buffer */ + self->decoded_chars_used = endpos - offset_to_buffer; + if (start > 0 || endpos < PyUnicode_GET_SIZE(line)) { + if (start == 0 && Py_REFCNT(line) == 1) { + if (PyUnicode_Resize(&line, endpos) < 0) + goto error; + } + else { + PyObject *s = PyUnicode_FromUnicode( + PyUnicode_AS_UNICODE(line) + start, endpos - start); + Py_CLEAR(line); + if (s == NULL) + goto error; + line = s; + } + } + } + if (remaining != NULL) { + if (chunks == NULL) { + chunks = PyList_New(0); + if (chunks == NULL) + goto error; + } + if (PyList_Append(chunks, remaining) < 0) + goto error; + Py_CLEAR(remaining); + } + if (chunks != NULL) { + if (line != NULL && PyList_Append(chunks, line) < 0) + goto error; + Py_CLEAR(line); + line = PyUnicode_Join(_PyIO_empty_str, chunks); + if (line == NULL) + goto error; + Py_DECREF(chunks); + } + if (line == NULL) + line = PyUnicode_FromStringAndSize(NULL, 0); + + return line; + + error: + Py_XDECREF(chunks); + Py_XDECREF(remaining); + Py_XDECREF(line); + return NULL; +} + +static PyObject * +textiowrapper_readline(textio *self, PyObject *args) +{ + PyObject *limitobj = NULL; + Py_ssize_t limit = -1; + + CHECK_INITIALIZED(self); + if (!PyArg_ParseTuple(args, "|O:readline", &limitobj)) { + return NULL; + } + if (limitobj) { + if (!PyNumber_Check(limitobj)) { + PyErr_Format(PyExc_TypeError, + "integer argument expected, got '%.200s'", + Py_TYPE(limitobj)->tp_name); + return NULL; + } + limit = PyNumber_AsSsize_t(limitobj, PyExc_OverflowError); + if (limit == -1 && PyErr_Occurred()) + return NULL; + } + return _textiowrapper_readline(self, limit); +} + +/* Seek and Tell */ + +typedef struct { + Py_off_t start_pos; + int dec_flags; + int bytes_to_feed; + int chars_to_skip; + char need_eof; +} cookie_type; + +/* + To speed up cookie packing/unpacking, we store the fields in a temporary + string and call _PyLong_FromByteArray() or _PyLong_AsByteArray (resp.). + The following macros define at which offsets in the intermediary byte + string the various CookieStruct fields will be stored. + */ + +#define COOKIE_BUF_LEN (sizeof(Py_off_t) + 3 * sizeof(int) + sizeof(char)) + +#if defined(WORDS_BIGENDIAN) + +# define IS_LITTLE_ENDIAN 0 + +/* We want the least significant byte of start_pos to also be the least + significant byte of the cookie, which means that in big-endian mode we + must copy the fields in reverse order. */ + +# define OFF_START_POS (sizeof(char) + 3 * sizeof(int)) +# define OFF_DEC_FLAGS (sizeof(char) + 2 * sizeof(int)) +# define OFF_BYTES_TO_FEED (sizeof(char) + sizeof(int)) +# define OFF_CHARS_TO_SKIP (sizeof(char)) +# define OFF_NEED_EOF 0 + +#else + +# define IS_LITTLE_ENDIAN 1 + +/* Little-endian mode: the least significant byte of start_pos will + naturally end up the least significant byte of the cookie. */ + +# define OFF_START_POS 0 +# define OFF_DEC_FLAGS (sizeof(Py_off_t)) +# define OFF_BYTES_TO_FEED (sizeof(Py_off_t) + sizeof(int)) +# define OFF_CHARS_TO_SKIP (sizeof(Py_off_t) + 2 * sizeof(int)) +# define OFF_NEED_EOF (sizeof(Py_off_t) + 3 * sizeof(int)) + +#endif + +static int +textiowrapper_parse_cookie(cookie_type *cookie, PyObject *cookieObj) +{ + unsigned char buffer[COOKIE_BUF_LEN]; + PyLongObject *cookieLong = (PyLongObject *)PyNumber_Long(cookieObj); + if (cookieLong == NULL) + return -1; + + if (_PyLong_AsByteArray(cookieLong, buffer, sizeof(buffer), + IS_LITTLE_ENDIAN, 0) < 0) { + Py_DECREF(cookieLong); + return -1; + } + Py_DECREF(cookieLong); + + memcpy(&cookie->start_pos, buffer + OFF_START_POS, sizeof(cookie->start_pos)); + memcpy(&cookie->dec_flags, buffer + OFF_DEC_FLAGS, sizeof(cookie->dec_flags)); + memcpy(&cookie->bytes_to_feed, buffer + OFF_BYTES_TO_FEED, sizeof(cookie->bytes_to_feed)); + memcpy(&cookie->chars_to_skip, buffer + OFF_CHARS_TO_SKIP, sizeof(cookie->chars_to_skip)); + memcpy(&cookie->need_eof, buffer + OFF_NEED_EOF, sizeof(cookie->need_eof)); + + return 0; +} + +static PyObject * +textiowrapper_build_cookie(cookie_type *cookie) +{ + unsigned char buffer[COOKIE_BUF_LEN]; + + memcpy(buffer + OFF_START_POS, &cookie->start_pos, sizeof(cookie->start_pos)); + memcpy(buffer + OFF_DEC_FLAGS, &cookie->dec_flags, sizeof(cookie->dec_flags)); + memcpy(buffer + OFF_BYTES_TO_FEED, &cookie->bytes_to_feed, sizeof(cookie->bytes_to_feed)); + memcpy(buffer + OFF_CHARS_TO_SKIP, &cookie->chars_to_skip, sizeof(cookie->chars_to_skip)); + memcpy(buffer + OFF_NEED_EOF, &cookie->need_eof, sizeof(cookie->need_eof)); + + return _PyLong_FromByteArray(buffer, sizeof(buffer), IS_LITTLE_ENDIAN, 0); +} +#undef IS_LITTLE_ENDIAN + +static int +_textiowrapper_decoder_setstate(textio *self, cookie_type *cookie) +{ + PyObject *res; + /* When seeking to the start of the stream, we call decoder.reset() + rather than decoder.getstate(). + This is for a few decoders such as utf-16 for which the state value + at start is not (b"", 0) but e.g. (b"", 2) (meaning, in the case of + utf-16, that we are expecting a BOM). + */ + if (cookie->start_pos == 0 && cookie->dec_flags == 0) + res = PyObject_CallMethodObjArgs(self->decoder, _PyIO_str_reset, NULL); + else + res = PyObject_CallMethod(self->decoder, "setstate", + "((si))", "", cookie->dec_flags); + if (res == NULL) + return -1; + Py_DECREF(res); + return 0; +} + +static int +_textiowrapper_encoder_setstate(textio *self, cookie_type *cookie) +{ + PyObject *res; + /* Same as _textiowrapper_decoder_setstate() above. */ + if (cookie->start_pos == 0 && cookie->dec_flags == 0) { + res = PyObject_CallMethodObjArgs(self->encoder, _PyIO_str_reset, NULL); + self->encoding_start_of_stream = 1; + } + else { + res = PyObject_CallMethodObjArgs(self->encoder, _PyIO_str_setstate, + _PyIO_zero, NULL); + self->encoding_start_of_stream = 0; + } + if (res == NULL) + return -1; + Py_DECREF(res); + return 0; +} + +static PyObject * +textiowrapper_seek(textio *self, PyObject *args) +{ + PyObject *cookieObj, *posobj; + cookie_type cookie; + int whence = 0; + PyObject *res; + int cmp; + + CHECK_INITIALIZED(self); + + if (!PyArg_ParseTuple(args, "O|i:seek", &cookieObj, &whence)) + return NULL; + CHECK_CLOSED(self); + + Py_INCREF(cookieObj); + + if (!self->seekable) { + PyErr_SetString(PyExc_IOError, + "underlying stream is not seekable"); + goto fail; + } + + if (whence == 1) { + /* seek relative to current position */ + cmp = PyObject_RichCompareBool(cookieObj, _PyIO_zero, Py_EQ); + if (cmp < 0) + goto fail; + + if (cmp == 0) { + PyErr_SetString(PyExc_IOError, + "can't do nonzero cur-relative seeks"); + goto fail; + } + + /* Seeking to the current position should attempt to + * sync the underlying buffer with the current position. + */ + Py_DECREF(cookieObj); + cookieObj = PyObject_CallMethod((PyObject *)self, "tell", NULL); + if (cookieObj == NULL) + goto fail; + } + else if (whence == 2) { + /* seek relative to end of file */ + + cmp = PyObject_RichCompareBool(cookieObj, _PyIO_zero, Py_EQ); + if (cmp < 0) + goto fail; + + if (cmp == 0) { + PyErr_SetString(PyExc_IOError, + "can't do nonzero end-relative seeks"); + goto fail; + } + + res = PyObject_CallMethod((PyObject *)self, "flush", NULL); + if (res == NULL) + goto fail; + Py_DECREF(res); + + textiowrapper_set_decoded_chars(self, NULL); + Py_CLEAR(self->snapshot); + if (self->decoder) { + res = PyObject_CallMethod(self->decoder, "reset", NULL); + if (res == NULL) + goto fail; + Py_DECREF(res); + } + + res = PyObject_CallMethod(self->buffer, "seek", "ii", 0, 2); + Py_XDECREF(cookieObj); + return res; + } + else if (whence != 0) { + PyErr_Format(PyExc_ValueError, + "invalid whence (%d, should be 0, 1 or 2)", whence); + goto fail; + } + + cmp = PyObject_RichCompareBool(cookieObj, _PyIO_zero, Py_LT); + if (cmp < 0) + goto fail; + + if (cmp == 1) { + PyObject *repr = PyObject_Repr(cookieObj); + if (repr != NULL) { + PyErr_Format(PyExc_ValueError, + "negative seek position %s", + PyString_AS_STRING(repr)); + Py_DECREF(repr); + } + goto fail; + } + + res = PyObject_CallMethodObjArgs((PyObject *)self, _PyIO_str_flush, NULL); + if (res == NULL) + goto fail; + Py_DECREF(res); + + /* The strategy of seek() is to go back to the safe start point + * and replay the effect of read(chars_to_skip) from there. + */ + if (textiowrapper_parse_cookie(&cookie, cookieObj) < 0) + goto fail; + + /* Seek back to the safe start point. */ + posobj = PyLong_FromOff_t(cookie.start_pos); + if (posobj == NULL) + goto fail; + res = PyObject_CallMethodObjArgs(self->buffer, + _PyIO_str_seek, posobj, NULL); + Py_DECREF(posobj); + if (res == NULL) + goto fail; + Py_DECREF(res); + + textiowrapper_set_decoded_chars(self, NULL); + Py_CLEAR(self->snapshot); + + /* Restore the decoder to its state from the safe start point. */ + if (self->decoder) { + if (_textiowrapper_decoder_setstate(self, &cookie) < 0) + goto fail; + } + + if (cookie.chars_to_skip) { + /* Just like _read_chunk, feed the decoder and save a snapshot. */ + PyObject *input_chunk = PyObject_CallMethod( + self->buffer, "read", "i", cookie.bytes_to_feed); + PyObject *decoded; + + if (input_chunk == NULL) + goto fail; + + assert (PyBytes_Check(input_chunk)); + + self->snapshot = Py_BuildValue("iN", cookie.dec_flags, input_chunk); + if (self->snapshot == NULL) { + Py_DECREF(input_chunk); + goto fail; + } + + decoded = PyObject_CallMethod(self->decoder, "decode", + "Oi", input_chunk, (int)cookie.need_eof); + + if (decoded == NULL) + goto fail; + + textiowrapper_set_decoded_chars(self, decoded); + + /* Skip chars_to_skip of the decoded characters. */ + if (PyUnicode_GetSize(self->decoded_chars) < cookie.chars_to_skip) { + PyErr_SetString(PyExc_IOError, "can't restore logical file position"); + goto fail; + } + self->decoded_chars_used = cookie.chars_to_skip; + } + else { + self->snapshot = Py_BuildValue("is", cookie.dec_flags, ""); + if (self->snapshot == NULL) + goto fail; + } + + /* Finally, reset the encoder (merely useful for proper BOM handling) */ + if (self->encoder) { + if (_textiowrapper_encoder_setstate(self, &cookie) < 0) + goto fail; + } + return cookieObj; + fail: + Py_XDECREF(cookieObj); + return NULL; + +} + +static PyObject * +textiowrapper_tell(textio *self, PyObject *args) +{ + PyObject *res; + PyObject *posobj = NULL; + cookie_type cookie = {0,0,0,0,0}; + PyObject *next_input; + Py_ssize_t chars_to_skip, chars_decoded; + PyObject *saved_state = NULL; + char *input, *input_end; + + CHECK_INITIALIZED(self); + CHECK_CLOSED(self); + + if (!self->seekable) { + PyErr_SetString(PyExc_IOError, + "underlying stream is not seekable"); + goto fail; + } + if (!self->telling) { + PyErr_SetString(PyExc_IOError, + "telling position disabled by next() call"); + goto fail; + } + + if (_textiowrapper_writeflush(self) < 0) + return NULL; + res = PyObject_CallMethod((PyObject *)self, "flush", NULL); + if (res == NULL) + goto fail; + Py_DECREF(res); + + posobj = PyObject_CallMethod(self->buffer, "tell", NULL); + if (posobj == NULL) + goto fail; + + if (self->decoder == NULL || self->snapshot == NULL) { + assert (self->decoded_chars == NULL || PyUnicode_GetSize(self->decoded_chars) == 0); + return posobj; + } + +#if defined(HAVE_LARGEFILE_SUPPORT) + cookie.start_pos = PyLong_AsLongLong(posobj); +#else + cookie.start_pos = PyLong_AsLong(posobj); +#endif + if (PyErr_Occurred()) + goto fail; + + /* Skip backward to the snapshot point (see _read_chunk). */ + if (!PyArg_Parse(self->snapshot, "(iO)", &cookie.dec_flags, &next_input)) + goto fail; + + assert (PyBytes_Check(next_input)); + + cookie.start_pos -= PyBytes_GET_SIZE(next_input); + + /* How many decoded characters have been used up since the snapshot? */ + if (self->decoded_chars_used == 0) { + /* We haven't moved from the snapshot point. */ + Py_DECREF(posobj); + return textiowrapper_build_cookie(&cookie); + } + + chars_to_skip = self->decoded_chars_used; + + /* Starting from the snapshot position, we will walk the decoder + * forward until it gives us enough decoded characters. + */ + saved_state = PyObject_CallMethodObjArgs(self->decoder, + _PyIO_str_getstate, NULL); + if (saved_state == NULL) + goto fail; + + /* Note our initial start point. */ + if (_textiowrapper_decoder_setstate(self, &cookie) < 0) + goto fail; + + /* Feed the decoder one byte at a time. As we go, note the + * nearest "safe start point" before the current location + * (a point where the decoder has nothing buffered, so seek() + * can safely start from there and advance to this location). + */ + chars_decoded = 0; + input = PyBytes_AS_STRING(next_input); + input_end = input + PyBytes_GET_SIZE(next_input); + while (input < input_end) { + PyObject *state; + char *dec_buffer; + Py_ssize_t dec_buffer_len; + int dec_flags; + + PyObject *decoded = PyObject_CallMethod( + self->decoder, "decode", "s#", input, 1); + if (decoded == NULL) + goto fail; + assert (PyUnicode_Check(decoded)); + chars_decoded += PyUnicode_GET_SIZE(decoded); + Py_DECREF(decoded); + + cookie.bytes_to_feed += 1; + + state = PyObject_CallMethodObjArgs(self->decoder, + _PyIO_str_getstate, NULL); + if (state == NULL) + goto fail; + if (!PyArg_Parse(state, "(s#i)", &dec_buffer, &dec_buffer_len, &dec_flags)) { + Py_DECREF(state); + goto fail; + } + Py_DECREF(state); + + if (dec_buffer_len == 0 && chars_decoded <= chars_to_skip) { + /* Decoder buffer is empty, so this is a safe start point. */ + cookie.start_pos += cookie.bytes_to_feed; + chars_to_skip -= chars_decoded; + cookie.dec_flags = dec_flags; + cookie.bytes_to_feed = 0; + chars_decoded = 0; + } + if (chars_decoded >= chars_to_skip) + break; + input++; + } + if (input == input_end) { + /* We didn't get enough decoded data; signal EOF to get more. */ + PyObject *decoded = PyObject_CallMethod( + self->decoder, "decode", "si", "", /* final = */ 1); + if (decoded == NULL) + goto fail; + assert (PyUnicode_Check(decoded)); + chars_decoded += PyUnicode_GET_SIZE(decoded); + Py_DECREF(decoded); + cookie.need_eof = 1; + + if (chars_decoded < chars_to_skip) { + PyErr_SetString(PyExc_IOError, + "can't reconstruct logical file position"); + goto fail; + } + } + + /* finally */ + Py_XDECREF(posobj); + res = PyObject_CallMethod(self->decoder, "setstate", "(O)", saved_state); + Py_DECREF(saved_state); + if (res == NULL) + return NULL; + Py_DECREF(res); + + /* The returned cookie corresponds to the last safe start point. */ + cookie.chars_to_skip = Py_SAFE_DOWNCAST(chars_to_skip, Py_ssize_t, int); + return textiowrapper_build_cookie(&cookie); + + fail: + Py_XDECREF(posobj); + if (saved_state) { + PyObject *type, *value, *traceback; + PyErr_Fetch(&type, &value, &traceback); + + res = PyObject_CallMethod(self->decoder, "setstate", "(O)", saved_state); + Py_DECREF(saved_state); + if (res == NULL) + return NULL; + Py_DECREF(res); + + PyErr_Restore(type, value, traceback); + } + return NULL; +} + +static PyObject * +textiowrapper_truncate(textio *self, PyObject *args) +{ + PyObject *pos = Py_None; + PyObject *res; + + CHECK_INITIALIZED(self) + if (!PyArg_ParseTuple(args, "|O:truncate", &pos)) { + return NULL; + } + + res = PyObject_CallMethodObjArgs((PyObject *) self, _PyIO_str_flush, NULL); + if (res == NULL) + return NULL; + Py_DECREF(res); + + if (pos != Py_None) { + res = PyObject_CallMethodObjArgs((PyObject *) self, + _PyIO_str_seek, pos, NULL); + if (res == NULL) + return NULL; + Py_DECREF(res); + } + + return PyObject_CallMethodObjArgs(self->buffer, _PyIO_str_truncate, NULL); +} + +static PyObject * +textiowrapper_repr(textio *self) +{ + PyObject *nameobj, *res; + PyObject *namerepr = NULL, *encrepr = NULL; + + CHECK_INITIALIZED(self); + + nameobj = PyObject_GetAttrString((PyObject *) self, "name"); + if (nameobj == NULL) { + if (PyErr_ExceptionMatches(PyExc_AttributeError)) + PyErr_Clear(); + else + goto error; + encrepr = PyObject_Repr(self->encoding); + res = PyString_FromFormat("<_io.TextIOWrapper encoding=%s>", + PyString_AS_STRING(encrepr)); + } + else { + encrepr = PyObject_Repr(self->encoding); + namerepr = PyObject_Repr(nameobj); + res = PyString_FromFormat("<_io.TextIOWrapper name=%s encoding=%s>", + PyString_AS_STRING(namerepr), + PyString_AS_STRING(encrepr)); + Py_DECREF(nameobj); + } + Py_XDECREF(namerepr); + Py_XDECREF(encrepr); + return res; + +error: + Py_XDECREF(namerepr); + Py_XDECREF(encrepr); + return NULL; +} + + +/* Inquiries */ + +static PyObject * +textiowrapper_fileno(textio *self, PyObject *args) +{ + CHECK_INITIALIZED(self); + return PyObject_CallMethod(self->buffer, "fileno", NULL); +} + +static PyObject * +textiowrapper_seekable(textio *self, PyObject *args) +{ + CHECK_INITIALIZED(self); + return PyObject_CallMethod(self->buffer, "seekable", NULL); +} + +static PyObject * +textiowrapper_readable(textio *self, PyObject *args) +{ + CHECK_INITIALIZED(self); + return PyObject_CallMethod(self->buffer, "readable", NULL); +} + +static PyObject * +textiowrapper_writable(textio *self, PyObject *args) +{ + CHECK_INITIALIZED(self); + return PyObject_CallMethod(self->buffer, "writable", NULL); +} + +static PyObject * +textiowrapper_isatty(textio *self, PyObject *args) +{ + CHECK_INITIALIZED(self); + return PyObject_CallMethod(self->buffer, "isatty", NULL); +} + +static PyObject * +textiowrapper_flush(textio *self, PyObject *args) +{ + CHECK_INITIALIZED(self); + CHECK_CLOSED(self); + self->telling = self->seekable; + if (_textiowrapper_writeflush(self) < 0) + return NULL; + return PyObject_CallMethod(self->buffer, "flush", NULL); +} + +static PyObject * +textiowrapper_close(textio *self, PyObject *args) +{ + PyObject *res; + CHECK_INITIALIZED(self); + res = PyObject_CallMethod((PyObject *)self, "flush", NULL); + if (res == NULL) { + /* If flush() fails, just give up */ + PyErr_Clear(); + } + else + Py_DECREF(res); + + return PyObject_CallMethod(self->buffer, "close", NULL); +} + +static PyObject * +textiowrapper_iternext(textio *self) +{ + PyObject *line; + + CHECK_INITIALIZED(self); + + self->telling = 0; + if (Py_TYPE(self) == &PyTextIOWrapper_Type) { + /* Skip method call overhead for speed */ + line = _textiowrapper_readline(self, -1); + } + else { + line = PyObject_CallMethodObjArgs((PyObject *)self, + _PyIO_str_readline, NULL); + if (line && !PyUnicode_Check(line)) { + PyErr_Format(PyExc_IOError, + "readline() should have returned an str object, " + "not '%.200s'", Py_TYPE(line)->tp_name); + Py_DECREF(line); + return NULL; + } + } + + if (line == NULL) + return NULL; + + if (PyUnicode_GET_SIZE(line) == 0) { + /* Reached EOF or would have blocked */ + Py_DECREF(line); + Py_CLEAR(self->snapshot); + self->telling = self->seekable; + return NULL; + } + + return line; +} + +static PyObject * +textiowrapper_name_get(textio *self, void *context) +{ + CHECK_INITIALIZED(self); + return PyObject_GetAttrString(self->buffer, "name"); +} + +static PyObject * +textiowrapper_closed_get(textio *self, void *context) +{ + CHECK_INITIALIZED(self); + return PyObject_GetAttr(self->buffer, _PyIO_str_closed); +} + +static PyObject * +textiowrapper_newlines_get(textio *self, void *context) +{ + PyObject *res; + CHECK_INITIALIZED(self); + if (self->decoder == NULL) + Py_RETURN_NONE; + res = PyObject_GetAttr(self->decoder, _PyIO_str_newlines); + if (res == NULL) { + if (PyErr_ExceptionMatches(PyExc_AttributeError)) { + PyErr_Clear(); + Py_RETURN_NONE; + } + else { + return NULL; + } + } + return res; +} + +static PyObject * +textiowrapper_errors_get(textio *self, void *context) +{ + CHECK_INITIALIZED(self); + Py_INCREF(self->errors); + return self->errors; +} + +static PyObject * +textiowrapper_chunk_size_get(textio *self, void *context) +{ + CHECK_INITIALIZED(self); + return PyLong_FromSsize_t(self->chunk_size); +} + +static int +textiowrapper_chunk_size_set(textio *self, PyObject *arg, void *context) +{ + Py_ssize_t n; + CHECK_INITIALIZED_INT(self); + n = PyNumber_AsSsize_t(arg, PyExc_TypeError); + if (n == -1 && PyErr_Occurred()) + return -1; + if (n <= 0) { + PyErr_SetString(PyExc_ValueError, + "a strictly positive integer is required"); + return -1; + } + self->chunk_size = n; + return 0; +} + +static PyMethodDef textiowrapper_methods[] = { + {"detach", (PyCFunction)textiowrapper_detach, METH_NOARGS}, + {"write", (PyCFunction)textiowrapper_write, METH_VARARGS}, + {"read", (PyCFunction)textiowrapper_read, METH_VARARGS}, + {"readline", (PyCFunction)textiowrapper_readline, METH_VARARGS}, + {"flush", (PyCFunction)textiowrapper_flush, METH_NOARGS}, + {"close", (PyCFunction)textiowrapper_close, METH_NOARGS}, + + {"fileno", (PyCFunction)textiowrapper_fileno, METH_NOARGS}, + {"seekable", (PyCFunction)textiowrapper_seekable, METH_NOARGS}, + {"readable", (PyCFunction)textiowrapper_readable, METH_NOARGS}, + {"writable", (PyCFunction)textiowrapper_writable, METH_NOARGS}, + {"isatty", (PyCFunction)textiowrapper_isatty, METH_NOARGS}, + + {"seek", (PyCFunction)textiowrapper_seek, METH_VARARGS}, + {"tell", (PyCFunction)textiowrapper_tell, METH_NOARGS}, + {"truncate", (PyCFunction)textiowrapper_truncate, METH_VARARGS}, + {NULL, NULL} +}; + +static PyMemberDef textiowrapper_members[] = { + {"encoding", T_OBJECT, offsetof(textio, encoding), READONLY}, + {"buffer", T_OBJECT, offsetof(textio, buffer), READONLY}, + {"line_buffering", T_BOOL, offsetof(textio, line_buffering), READONLY}, + {NULL} +}; + +static PyGetSetDef textiowrapper_getset[] = { + {"name", (getter)textiowrapper_name_get, NULL, NULL}, + {"closed", (getter)textiowrapper_closed_get, NULL, NULL}, +/* {"mode", (getter)TextIOWrapper_mode_get, NULL, NULL}, +*/ + {"newlines", (getter)textiowrapper_newlines_get, NULL, NULL}, + {"errors", (getter)textiowrapper_errors_get, NULL, NULL}, + {"_CHUNK_SIZE", (getter)textiowrapper_chunk_size_get, + (setter)textiowrapper_chunk_size_set, NULL}, + {NULL} +}; + +PyTypeObject PyTextIOWrapper_Type = { + PyVarObject_HEAD_INIT(NULL, 0) + "_io.TextIOWrapper", /*tp_name*/ + sizeof(textio), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + (destructor)textiowrapper_dealloc, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tps_etattr*/ + 0, /*tp_compare */ + (reprfunc)textiowrapper_repr,/*tp_repr*/ + 0, /*tp_as_number*/ + 0, /*tp_as_sequence*/ + 0, /*tp_as_mapping*/ + 0, /*tp_hash */ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + 0, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE + | Py_TPFLAGS_HAVE_GC, /*tp_flags*/ + textiowrapper_doc, /* tp_doc */ + (traverseproc)textiowrapper_traverse, /* tp_traverse */ + (inquiry)textiowrapper_clear, /* tp_clear */ + 0, /* tp_richcompare */ + offsetof(textio, weakreflist), /*tp_weaklistoffset*/ + 0, /* tp_iter */ + (iternextfunc)textiowrapper_iternext, /* tp_iternext */ + textiowrapper_methods, /* tp_methods */ + textiowrapper_members, /* tp_members */ + textiowrapper_getset, /* tp_getset */ + 0, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + offsetof(textio, dict), /*tp_dictoffset*/ + (initproc)textiowrapper_init, /* tp_init */ + 0, /* tp_alloc */ + PyType_GenericNew, /* tp_new */ +}; Modified: python/trunk/setup.py ============================================================================== --- python/trunk/setup.py (original) +++ python/trunk/setup.py Fri Jun 12 22:14:08 2009 @@ -438,10 +438,11 @@ exts.append( Extension("_heapq", ["_heapqmodule.c"]) ) # operator.add() and similar goodies exts.append( Extension('operator', ['operator.c']) ) - # Python 3.0 _fileio module - exts.append( Extension("_fileio", ["_fileio.c"]) ) - # Python 3.0 _bytesio module - exts.append( Extension("_bytesio", ["_bytesio.c"]) ) + # Python 3.1 _io library + exts.append( Extension("_io", + ["_io/bufferedio.c", "_io/bytesio.c", "_io/fileio.c", + "_io/iobase.c", "_io/_iomodule.c", "_io/stringio.c", "_io/textio.c"], + depends=["_io/_iomodule.h"], include_dirs=["Modules/_io"])) # _functools exts.append( Extension("_functools", ["_functoolsmodule.c"]) ) # _json speedups From python-checkins at python.org Fri Jun 12 22:36:25 2009 From: python-checkins at python.org (antoine.pitrou) Date: Fri, 12 Jun 2009 22:36:25 +0200 (CEST) Subject: [Python-checkins] r73395 - python/trunk/Lib/test/test_file2k.py Message-ID: <20090612203625.AAECED47A@mail.python.org> Author: antoine.pitrou Date: Fri Jun 12 22:36:25 2009 New Revision: 73395 Log: Restore the old test_file.py (for the builtin file object) as a new file named test_file2k.py Added: python/trunk/Lib/test/test_file2k.py - copied unchanged from r73394, /python/trunk/Lib/test/test_file.py From python-checkins at python.org Fri Jun 12 22:41:52 2009 From: python-checkins at python.org (antoine.pitrou) Date: Fri, 12 Jun 2009 22:41:52 +0200 (CEST) Subject: [Python-checkins] r73396 - in python/trunk/Lib/test: test_file.py test_file2k.py test_univnewlines.py test_univnewlines2k.py Message-ID: <20090612204152.EEB4FC524@mail.python.org> Author: antoine.pitrou Date: Fri Jun 12 22:41:52 2009 New Revision: 73396 Log: Try to restore the old test_file and test_univnewlines as new, different files (with the right revisions this time, hopefully) Added: python/trunk/Lib/test/test_file2k.py - copied unchanged from r73393, /python/trunk/Lib/test/test_file.py python/trunk/Lib/test/test_univnewlines2k.py - copied unchanged from r73393, /python/trunk/Lib/test/test_univnewlines.py Modified: python/trunk/Lib/test/test_file.py python/trunk/Lib/test/test_univnewlines.py Modified: python/trunk/Lib/test/test_file.py ============================================================================== --- python/trunk/Lib/test/test_file.py (original) +++ python/trunk/Lib/test/test_file.py Fri Jun 12 22:41:52 2009 @@ -1,3 +1,6 @@ +# NOTE: this file tests the new `io` library backported from Python 3.x. +# Similar tests for the builtin file object can be found in test_file2k.py. + from __future__ import print_function import sys Modified: python/trunk/Lib/test/test_univnewlines.py ============================================================================== --- python/trunk/Lib/test/test_univnewlines.py (original) +++ python/trunk/Lib/test/test_univnewlines.py Fri Jun 12 22:41:52 2009 @@ -1,5 +1,8 @@ # Tests universal newline support for both reading and parsing files. +# NOTE: this file tests the new `io` library backported from Python 3.x. +# Similar tests for the builtin file object can be found in test_univnewlines2k.py. + from __future__ import print_function from __future__ import unicode_literals From python-checkins at python.org Fri Jun 12 22:54:21 2009 From: python-checkins at python.org (antoine.pitrou) Date: Fri, 12 Jun 2009 22:54:21 +0200 (CEST) Subject: [Python-checkins] r73397 - in python/trunk/Lib/test: test_bufio.py test_largefile.py Message-ID: <20090612205421.9228ADA0F@mail.python.org> Author: antoine.pitrou Date: Fri Jun 12 22:54:21 2009 New Revision: 73397 Log: Re-enable testing of builtin open() in test_bufio in test_largefile Modified: python/trunk/Lib/test/test_bufio.py python/trunk/Lib/test/test_largefile.py Modified: python/trunk/Lib/test/test_bufio.py ============================================================================== --- python/trunk/Lib/test/test_bufio.py (original) +++ python/trunk/Lib/test/test_bufio.py Fri Jun 12 22:54:21 2009 @@ -68,9 +68,12 @@ class PyBufferSizeTest(BufferSizeTest): open = staticmethod(pyio.open) +class BuiltinBufferSizeTest(BufferSizeTest): + open = open + def test_main(): - support.run_unittest(CBufferSizeTest, PyBufferSizeTest) + support.run_unittest(CBufferSizeTest, PyBufferSizeTest, BuiltinBufferSizeTest) if __name__ == "__main__": test_main() Modified: python/trunk/Lib/test/test_largefile.py ============================================================================== --- python/trunk/Lib/test/test_largefile.py (original) +++ python/trunk/Lib/test/test_largefile.py Fri Jun 12 22:54:21 2009 @@ -124,20 +124,24 @@ newsize -= 1 f.seek(42) f.truncate(newsize) - self.assertEqual(f.tell(), newsize) # else wasn't truncated + if self.new_io: + self.assertEqual(f.tell(), newsize) # else wasn't truncated f.seek(0, 2) self.assertEqual(f.tell(), newsize) # XXX truncate(larger than true size) is ill-defined # across platform; cut it waaaaay back f.seek(0) f.truncate(1) - self.assertEqual(f.tell(), 1) # else pointer moved + if self.new_io: + self.assertEqual(f.tell(), 1) # else pointer moved f.seek(0) self.assertEqual(len(f.read()), 1) # else wasn't truncated def test_seekable(self): # Issue #5016; seekable() can return False when the current position # is negative when truncated to an int. + if not self.new_io: + self.skipTest("builtin file doesn't have seekable()") for pos in (2**31-1, 2**31, 2**31+1): with self.open(TESTFN, 'rb') as f: f.seek(pos) @@ -171,10 +175,12 @@ else: f.close() suite = unittest.TestSuite() - for _open, prefix in [(io.open, 'C'), (pyio.open, 'Py')]: + for _open, prefix in [(io.open, 'C'), (pyio.open, 'Py'), + (open, 'Builtin')]: class TestCase(LargeFileTest): pass TestCase.open = staticmethod(_open) + TestCase.new_io = _open is not open TestCase.__name__ = prefix + LargeFileTest.__name__ suite.addTest(TestCase('test_seek')) suite.addTest(TestCase('test_osstat')) From python-checkins at python.org Fri Jun 12 22:57:12 2009 From: python-checkins at python.org (alexandre.vassalotti) Date: Fri, 12 Jun 2009 22:57:12 +0200 (CEST) Subject: [Python-checkins] r73398 - in python/trunk: Include/pyerrors.h Python/errors.c Message-ID: <20090612205712.2A1D9D7AF@mail.python.org> Author: alexandre.vassalotti Date: Fri Jun 12 22:57:12 2009 New Revision: 73398 Log: Add const qualifier to PyErr_SetFromErrnoWithFilename and to PyErr_SetFromErrnoWithUnicodeFilename. Modified: python/trunk/Include/pyerrors.h python/trunk/Python/errors.c Modified: python/trunk/Include/pyerrors.h ============================================================================== --- python/trunk/Include/pyerrors.h (original) +++ python/trunk/Include/pyerrors.h Fri Jun 12 22:57:12 2009 @@ -185,10 +185,11 @@ PyAPI_FUNC(PyObject *) PyErr_SetFromErrno(PyObject *); PyAPI_FUNC(PyObject *) PyErr_SetFromErrnoWithFilenameObject( PyObject *, PyObject *); -PyAPI_FUNC(PyObject *) PyErr_SetFromErrnoWithFilename(PyObject *, char *); +PyAPI_FUNC(PyObject *) PyErr_SetFromErrnoWithFilename( + PyObject *, const char *); #ifdef MS_WINDOWS PyAPI_FUNC(PyObject *) PyErr_SetFromErrnoWithUnicodeFilename( - PyObject *, Py_UNICODE *); + PyObject *, const Py_UNICODE *); #endif /* MS_WINDOWS */ PyAPI_FUNC(PyObject *) PyErr_Format(PyObject *, const char *, ...) Modified: python/trunk/Python/errors.c ============================================================================== --- python/trunk/Python/errors.c (original) +++ python/trunk/Python/errors.c Fri Jun 12 22:57:12 2009 @@ -371,7 +371,7 @@ PyObject * -PyErr_SetFromErrnoWithFilename(PyObject *exc, char *filename) +PyErr_SetFromErrnoWithFilename(PyObject *exc, const char *filename) { PyObject *name = filename ? PyString_FromString(filename) : NULL; PyObject *result = PyErr_SetFromErrnoWithFilenameObject(exc, name); @@ -381,7 +381,7 @@ #ifdef MS_WINDOWS PyObject * -PyErr_SetFromErrnoWithUnicodeFilename(PyObject *exc, Py_UNICODE *filename) +PyErr_SetFromErrnoWithUnicodeFilename(PyObject *exc, const Py_UNICODE *filename) { PyObject *name = filename ? PyUnicode_FromUnicode(filename, wcslen(filename)) : From buildbot at python.org Fri Jun 12 23:13:27 2009 From: buildbot at python.org (buildbot at python.org) Date: Fri, 12 Jun 2009 21:13:27 +0000 Subject: [Python-checkins] buildbot failure in OS X x86 trunk Message-ID: <20090612211327.90E94DA2C@mail.python.org> The Buildbot has detected a new failure of OS X x86 trunk. Full details are available at: http://www.python.org/dev/buildbot/all/OS%20X%20x86%20trunk/builds/682 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: noller-osx86 Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: antoine.pitrou BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_lib2to3 make: *** [buildbottest] Error 1 sincerely, -The Buildbot From python-checkins at python.org Fri Jun 12 23:20:23 2009 From: python-checkins at python.org (alexandre.vassalotti) Date: Fri, 12 Jun 2009 23:20:23 +0200 (CEST) Subject: [Python-checkins] r73399 - python/branches/release26-maint/Lib/io.py Message-ID: <20090612212023.8CB0CD7BF@mail.python.org> Author: alexandre.vassalotti Date: Fri Jun 12 23:20:23 2009 New Revision: 73399 Log: Fix issue #6127: Make universal newlines mode of io.StringIO not duplicate newlines under Windows (see also issue #5265 and #5645). Modified: python/branches/release26-maint/Lib/io.py Modified: python/branches/release26-maint/Lib/io.py ============================================================================== --- python/branches/release26-maint/Lib/io.py (original) +++ python/branches/release26-maint/Lib/io.py Fri Jun 12 23:20:23 2009 @@ -1852,6 +1852,10 @@ encoding=encoding, errors=errors, newline=newline) + # Issue #5645: make universal newlines semantics the same as in the + # C version, even under Windows. + if newline is None: + self._writetranslate = False if initial_value: if not isinstance(initial_value, unicode): initial_value = unicode(initial_value) From buildbot at python.org Fri Jun 12 23:22:55 2009 From: buildbot at python.org (buildbot at python.org) Date: Fri, 12 Jun 2009 21:22:55 +0000 Subject: [Python-checkins] buildbot failure in x86 osx.5 trunk Message-ID: <20090612212255.8F08FD9A6@mail.python.org> The Buildbot has detected a new failure of x86 osx.5 trunk. Full details are available at: http://www.python.org/dev/buildbot/all/x86%20osx.5%20trunk/builds/1181 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: heller-x86-osx5 Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: antoine.pitrou BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_bytes make: *** [buildbottest] Error 1 sincerely, -The Buildbot From python-checkins at python.org Fri Jun 12 23:43:47 2009 From: python-checkins at python.org (alexandre.vassalotti) Date: Fri, 12 Jun 2009 23:43:47 +0200 (CEST) Subject: [Python-checkins] r73400 - python/trunk/Parser/grammar.mak Message-ID: <20090612214347.89331DA8F@mail.python.org> Author: alexandre.vassalotti Date: Fri Jun 12 23:43:47 2009 New Revision: 73400 Log: Delete outdated make file for building the parser with MSVC 6. Removed: python/trunk/Parser/grammar.mak Deleted: python/trunk/Parser/grammar.mak ============================================================================== --- python/trunk/Parser/grammar.mak Fri Jun 12 23:43:47 2009 +++ (empty file) @@ -1,45 +0,0 @@ -# This manages to rebuild graminit.{h, c} under MSVC 6 (Windows), via -# -# nmake /f grammar.mak -# -# You may also need to copy python23.dll into this directory, or get -# it on your search path. -# -# The intermediate files can be nuked afterwards: -# -# nmake /f grammar.mak clean -# -# I don't understand the maze of preprocessor #define's on Windows, and -# as a result this requires linking with python23.lib, so it's of no use -# for bootstrapping (the cause appears to be a useless-- in this -# particular case --pragma in PC\pyconfig.h, which demands that -# python23.lib get linked in). - -LIBS= ..\PCbuild\python25.lib - -CFLAGS= /I ..\Include /I ..\PC /D MS_NO_COREDLL /D PGEN /MD - -GRAMMAR_H= ..\Include\graminit.h -GRAMMAR_C= ..\Python\graminit.c -GRAMMAR_INPUT= ..\Grammar\Grammar - -PGEN= pgen.exe - -POBJS= acceler.obj grammar1.obj listnode.obj node.obj parser.obj \ - parsetok.obj tokenizer.obj bitset.obj metagrammar.obj - -PARSER_OBJS= $(POBJS) myreadline.obj - -PGOBJS= firstsets.obj grammar.obj pgen.obj printgrammar.obj pgenmain.obj - -PGENOBJS= $(POBJS) $(PGOBJS) - -$(GRAMMAR_H) $(GRAMMAR_C): $(PGEN) $(GRAMMAR_INPUT) - $(PGEN) $(GRAMMAR_INPUT) $(GRAMMAR_H) $(GRAMMAR_C) - -$(PGEN): $(PGENOBJS) - $(CC) $(PGENOBJS) $(LIBS) /Fe$(PGEN) - -clean: - del *.obj - del $(PGEN) From python-checkins at python.org Fri Jun 12 23:52:14 2009 From: python-checkins at python.org (alexandre.vassalotti) Date: Fri, 12 Jun 2009 23:52:14 +0200 (CEST) Subject: [Python-checkins] r73401 - in python/trunk/Lib: collections.py test/test_collections.py Message-ID: <20090612215214.67E61D62E@mail.python.org> Author: alexandre.vassalotti Date: Fri Jun 12 23:52:14 2009 New Revision: 73401 Log: Make pickling of OrderedDict instances more efficient. Modified: python/trunk/Lib/collections.py python/trunk/Lib/test/test_collections.py Modified: python/trunk/Lib/collections.py ============================================================================== --- python/trunk/Lib/collections.py (original) +++ python/trunk/Lib/collections.py Fri Jun 12 23:52:14 2009 @@ -99,14 +99,16 @@ def __reduce__(self): 'Return state information for pickling' - items = [[k, self[k]] for k in self] + dictitems = self.iteritems() tmp = self.__map, self.__root del self.__map, self.__root inst_dict = vars(self).copy() self.__map, self.__root = tmp - if inst_dict: - return (self.__class__, (items,), inst_dict) - return self.__class__, (items,) + # Set the state item to None when the dictionary is empty. This saves + # about 2 opcodes when the object is pickled. + if not inst_dict: + inst_dict = None + return (self.__class__, (), inst_dict, None, dictitems) setdefault = MutableMapping.setdefault update = MutableMapping.update Modified: python/trunk/Lib/test/test_collections.py ============================================================================== --- python/trunk/Lib/test/test_collections.py (original) +++ python/trunk/Lib/test/test_collections.py Fri Jun 12 23:52:14 2009 @@ -795,9 +795,9 @@ # do not save instance dictionary if not needed pairs = [('c', 1), ('b', 2), ('a', 3), ('d', 4), ('e', 5), ('f', 6)] od = OrderedDict(pairs) - self.assertEqual(len(od.__reduce__()), 2) od.x = 10 - self.assertEqual(len(od.__reduce__()), 3) + self.assertGreaterEqual(len(od.__reduce__()), 2) + self.assertLessEqual(len(od.__reduce__()), 5) def test_repr(self): od = OrderedDict([('c', 1), ('b', 2), ('a', 3), ('d', 4), ('e', 5), ('f', 6)]) From buildbot at python.org Sat Jun 13 00:06:39 2009 From: buildbot at python.org (buildbot at python.org) Date: Fri, 12 Jun 2009 22:06:39 +0000 Subject: [Python-checkins] buildbot failure in x86 XP-4 3.x Message-ID: <20090612220639.76FD6D9AB@mail.python.org> The Buildbot has detected a new failure of x86 XP-4 3.x. Full details are available at: http://www.python.org/dev/buildbot/all/x86%20XP-4%203.x/builds/687 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: bolen-windows Build Reason: Build Source Stamp: [branch branches/py3k] HEAD Blamelist: martin.v.loewis BUILD FAILED: failed test Excerpt from the test logfile: Traceback (most recent call last): File "E:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\test\test_import.py", line 63, in test_with_extension self.fail("import from %s failed: %s" % (ext, err)) File "E:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\unittest.py", line 540, in fail raise self.failureException(msg) AssertionError: import from .PY failed: No module named @test Traceback (most recent call last): File "E:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\test\test_import.py", line 80, in testImport test_with_extension(ext) File "E:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\test\test_import.py", line 73, in test_with_extension del sys.modules[TESTFN] KeyError: '@test' 1 test failed: test_import ====================================================================== ERROR: testImport (test.test_import.ImportTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "E:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\test\test_import.py", line 61, in test_with_extension mod = __import__(TESTFN) ImportError: No module named @test Traceback (most recent call last): File "E:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\test\test_import.py", line 63, in test_with_extension self.fail("import from %s failed: %s" % (ext, err)) File "E:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\unittest.py", line 540, in fail raise self.failureException(msg) AssertionError: import from .PY failed: No module named @test Traceback (most recent call last): File "E:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\test\test_import.py", line 80, in testImport test_with_extension(ext) File "E:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\test\test_import.py", line 73, in test_with_extension del sys.modules[TESTFN] KeyError: '@test' Traceback (most recent call last): File "E:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\test\test_import.py", line 63, in test_with_extension self.fail("import from %s failed: %s" % (ext, err)) File "E:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\unittest.py", line 540, in fail raise self.failureException(msg) AssertionError: import from .PY failed: No module named @test Traceback (most recent call last): File "E:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\test\test_import.py", line 80, in testImport test_with_extension(ext) File "E:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\test\test_import.py", line 73, in test_with_extension del sys.modules[TESTFN] KeyError: '@test' sincerely, -The Buildbot From python-checkins at python.org Sat Jun 13 01:03:35 2009 From: python-checkins at python.org (alexandre.vassalotti) Date: Sat, 13 Jun 2009 01:03:35 +0200 (CEST) Subject: [Python-checkins] r73402 - in python/trunk/Lib: collections.py test/test_collections.py Message-ID: <20090612230335.A696CD9E1@mail.python.org> Author: alexandre.vassalotti Date: Sat Jun 13 01:03:35 2009 New Revision: 73402 Log: Revert r73401 per Raymond Hettinger's request. The rational is the change might cause imcompatiblity problems with PyYAML. In addition, Raymond wants to kept the different versions of collections synchronized across Python versions. Modified: python/trunk/Lib/collections.py python/trunk/Lib/test/test_collections.py Modified: python/trunk/Lib/collections.py ============================================================================== --- python/trunk/Lib/collections.py (original) +++ python/trunk/Lib/collections.py Sat Jun 13 01:03:35 2009 @@ -99,16 +99,14 @@ def __reduce__(self): 'Return state information for pickling' - dictitems = self.iteritems() + items = [[k, self[k]] for k in self] tmp = self.__map, self.__root del self.__map, self.__root inst_dict = vars(self).copy() self.__map, self.__root = tmp - # Set the state item to None when the dictionary is empty. This saves - # about 2 opcodes when the object is pickled. - if not inst_dict: - inst_dict = None - return (self.__class__, (), inst_dict, None, dictitems) + if inst_dict: + return (self.__class__, (items,), inst_dict) + return self.__class__, (items,) setdefault = MutableMapping.setdefault update = MutableMapping.update Modified: python/trunk/Lib/test/test_collections.py ============================================================================== --- python/trunk/Lib/test/test_collections.py (original) +++ python/trunk/Lib/test/test_collections.py Sat Jun 13 01:03:35 2009 @@ -795,9 +795,9 @@ # do not save instance dictionary if not needed pairs = [('c', 1), ('b', 2), ('a', 3), ('d', 4), ('e', 5), ('f', 6)] od = OrderedDict(pairs) + self.assertEqual(len(od.__reduce__()), 2) od.x = 10 - self.assertGreaterEqual(len(od.__reduce__()), 2) - self.assertLessEqual(len(od.__reduce__()), 5) + self.assertEqual(len(od.__reduce__()), 3) def test_repr(self): od = OrderedDict([('c', 1), ('b', 2), ('a', 3), ('d', 4), ('e', 5), ('f', 6)]) From python-checkins at python.org Sat Jun 13 03:16:02 2009 From: python-checkins at python.org (raymond.hettinger) Date: Sat, 13 Jun 2009 03:16:02 +0200 (CEST) Subject: [Python-checkins] r73403 - in python/branches/release30-maint: Lib/test/test_range.py Misc/NEWS Objects/rangeobject.c Message-ID: <20090613011602.DCEBBD579@mail.python.org> Author: raymond.hettinger Date: Sat Jun 13 03:16:02 2009 New Revision: 73403 Log: Backport 73392: Fix SystemError and ref counting issues. Modified: python/branches/release30-maint/Lib/test/test_range.py python/branches/release30-maint/Misc/NEWS python/branches/release30-maint/Objects/rangeobject.c Modified: python/branches/release30-maint/Lib/test/test_range.py ============================================================================== --- python/branches/release30-maint/Lib/test/test_range.py (original) +++ python/branches/release30-maint/Lib/test/test_range.py Sat Jun 13 03:16:02 2009 @@ -71,6 +71,12 @@ self.assertEquals(list(pickle.loads(pickle.dumps(r, proto))), list(r)) + def test_odd_bug(self): + # This used to raise a "SystemError: NULL result without error" + # because the range validation step was eating the exception + # before NULL was returned. + self.assertRaises(TypeError, range, [], 1, -1) + def test_main(): test.support.run_unittest(RangeTest) Modified: python/branches/release30-maint/Misc/NEWS ============================================================================== --- python/branches/release30-maint/Misc/NEWS (original) +++ python/branches/release30-maint/Misc/NEWS Sat Jun 13 03:16:02 2009 @@ -12,6 +12,8 @@ Core and Builtins ----------------- +- Fixed SystemError triggered by "range([], 1, -1)". + - Issue #5924: On Windows, a large PYTHONPATH environment variable (more than 255 characters) would be completely ignored. Modified: python/branches/release30-maint/Objects/rangeobject.c ============================================================================== --- python/branches/release30-maint/Objects/rangeobject.c (original) +++ python/branches/release30-maint/Objects/rangeobject.c Sat Jun 13 03:16:02 2009 @@ -59,26 +59,42 @@ if (PyTuple_Size(args) <= 1) { if (!PyArg_UnpackTuple(args, "range", 1, 1, &stop)) - goto Fail; + return NULL; stop = PyNumber_Index(stop); if (!stop) - goto Fail; + return NULL; start = PyLong_FromLong(0); + if (!start) { + Py_DECREF(stop); + return NULL; + } step = PyLong_FromLong(1); - if (!start || !step) - goto Fail; + if (!step) { + Py_DECREF(stop); + Py_DECREF(start); + return NULL; + } } else { if (!PyArg_UnpackTuple(args, "range", 2, 3, &start, &stop, &step)) - goto Fail; + return NULL; /* Convert borrowed refs to owned refs */ start = PyNumber_Index(start); + if (!start) + return NULL; stop = PyNumber_Index(stop); - step = validate_step(step); - if (!start || !stop || !step) - goto Fail; + if (!stop) { + Py_DECREF(start); + return NULL; + } + step = validate_step(step); /* Caution, this can clear exceptions */ + if (!step) { + Py_DECREF(start); + Py_DECREF(stop); + return NULL; + } } obj = PyObject_New(rangeobject, &PyRange_Type); From python-checkins at python.org Sat Jun 13 03:40:00 2009 From: python-checkins at python.org (benjamin.peterson) Date: Sat, 13 Jun 2009 03:40:00 +0200 (CEST) Subject: [Python-checkins] r73404 - in python/trunk: Lib/test/test_ast.py Misc/NEWS Python/ast.c Message-ID: <20090613014000.B970AD945@mail.python.org> Author: benjamin.peterson Date: Sat Jun 13 03:40:00 2009 New Revision: 73404 Log: keep the slice.step field as NULL if no step expression is given Modified: python/trunk/Lib/test/test_ast.py python/trunk/Misc/NEWS python/trunk/Python/ast.c Modified: python/trunk/Lib/test/test_ast.py ============================================================================== --- python/trunk/Lib/test/test_ast.py (original) +++ python/trunk/Lib/test/test_ast.py Sat Jun 13 03:40:00 2009 @@ -146,6 +146,12 @@ self.assertEquals(to_tuple(ast_tree), o) self._assert_order(ast_tree, (0, 0)) + def test_slice(self): + slc = ast.parse("x[::]").body[0].value.slice + self.assertIsNone(slc.upper) + self.assertIsNone(slc.lower) + self.assertIsNone(slc.step) + def test_nodeclasses(self): x = ast.BinOp(1, 2, 3, lineno=0) self.assertEquals(x.left, 1) Modified: python/trunk/Misc/NEWS ============================================================================== --- python/trunk/Misc/NEWS (original) +++ python/trunk/Misc/NEWS Sat Jun 13 03:40:00 2009 @@ -12,6 +12,9 @@ Core and Builtins ----------------- +- In the slice AST type, the step field will always be None if a step expression + is not specified. + - Issue #4547: When debugging a very large function, it was not always possible to update the lineno attribute of the current frame. Modified: python/trunk/Python/ast.c ============================================================================== --- python/trunk/Python/ast.c (original) +++ python/trunk/Python/ast.c Sat Jun 13 03:40:00 2009 @@ -1468,14 +1468,7 @@ ch = CHILD(n, NCH(n) - 1); if (TYPE(ch) == sliceop) { - if (NCH(ch) == 1) { - /* No expression, so step is None */ - ch = CHILD(ch, 0); - step = Name(new_identifier("None", c->c_arena), Load, - LINENO(ch), ch->n_col_offset, c->c_arena); - if (!step) - return NULL; - } else { + if (NCH(ch) != 1) { ch = CHILD(ch, 1); if (TYPE(ch) == test) { step = ast_for_expr(c, ch); From buildbot at python.org Sat Jun 13 04:11:48 2009 From: buildbot at python.org (buildbot at python.org) Date: Sat, 13 Jun 2009 02:11:48 +0000 Subject: [Python-checkins] buildbot failure in sparc solaris10 gcc 3.0 Message-ID: <20090613021148.169DADBB1@mail.python.org> The Buildbot has detected a new failure of sparc solaris10 gcc 3.0. Full details are available at: http://www.python.org/dev/buildbot/all/sparc%20solaris10%20gcc%203.0/builds/407 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: loewis-sun Build Reason: Build Source Stamp: [branch branches/release30-maint] HEAD Blamelist: raymond.hettinger BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_posix ====================================================================== ERROR: test_getcwd_long_pathnames (test.test_posix.PosixTester) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home2/buildbot/slave/3.0.loewis-sun/build/Lib/test/test_posix.py", line 252, in test_getcwd_long_pathnames support.rmtree(base_path) File "/home2/buildbot/slave/3.0.loewis-sun/build/Lib/test/support.py", line 98, in rmtree shutil.rmtree(path) File "/home2/buildbot/slave/3.0.loewis-sun/build/Lib/shutil.py", line 225, in rmtree onerror(os.rmdir, path, sys.exc_info()) File "/home2/buildbot/slave/3.0.loewis-sun/build/Lib/shutil.py", line 223, in rmtree os.rmdir(path) OSError: [Errno 22] Invalid argument: '/home2/buildbot/slave/3.0.loewis-sun/build/@test.getcwd/@test.getcwd' sincerely, -The Buildbot From python-checkins at python.org Sat Jun 13 05:46:31 2009 From: python-checkins at python.org (benjamin.peterson) Date: Sat, 13 Jun 2009 05:46:31 +0200 (CEST) Subject: [Python-checkins] r73405 - in python/trunk: Lib/test/test_compile.py Misc/NEWS Python/ast.c Message-ID: <20090613034631.1542ED945@mail.python.org> Author: benjamin.peterson Date: Sat Jun 13 05:46:30 2009 New Revision: 73405 Log: prevent import statements from assigning to None Modified: python/trunk/Lib/test/test_compile.py python/trunk/Misc/NEWS python/trunk/Python/ast.c Modified: python/trunk/Lib/test/test_compile.py ============================================================================== --- python/trunk/Lib/test/test_compile.py (original) +++ python/trunk/Lib/test/test_compile.py Sat Jun 13 05:46:30 2009 @@ -270,11 +270,17 @@ '(a, None) = 0, 0', 'for None in range(10): pass', 'def f(None): pass', + 'import None', + 'import x as None', + 'from x import None', + 'from x import y as None' ] for stmt in stmts: stmt += "\n" self.assertRaises(SyntaxError, compile, stmt, 'tmp', 'single') self.assertRaises(SyntaxError, compile, stmt, 'tmp', 'exec') + # This is ok. + compile("from None import x", "tmp", "exec") def test_import(self): succeed = [ Modified: python/trunk/Misc/NEWS ============================================================================== --- python/trunk/Misc/NEWS (original) +++ python/trunk/Misc/NEWS Sat Jun 13 05:46:30 2009 @@ -12,6 +12,8 @@ Core and Builtins ----------------- +- Assignment to None using import statements now raises a SyntaxError. + - In the slice AST type, the step field will always be None if a step expression is not specified. Modified: python/trunk/Python/ast.c ============================================================================== --- python/trunk/Python/ast.c (original) +++ python/trunk/Python/ast.c Sat Jun 13 05:46:30 2009 @@ -2294,7 +2294,7 @@ } static alias_ty -alias_for_import_name(struct compiling *c, const node *n) +alias_for_import_name(struct compiling *c, const node *n, int store) { /* import_as_name: NAME ['as' NAME] @@ -2305,28 +2305,38 @@ loop: switch (TYPE(n)) { - case import_as_name: + case import_as_name: { + node *name_node = CHILD(n, 0); str = NULL; if (NCH(n) == 3) { - str = NEW_IDENTIFIER(CHILD(n, 2)); + node *str_node = CHILD(n, 2); + if (store && !forbidden_check(c, str_node, STR(str_node))) + return NULL; + str = NEW_IDENTIFIER(str_node); if (!str) return NULL; } - name = NEW_IDENTIFIER(CHILD(n, 0)); + if (!forbidden_check(c, name_node, STR(name_node))) + return NULL; + name = NEW_IDENTIFIER(name_node); if (!name) return NULL; return alias(name, str, c->c_arena); + } case dotted_as_name: if (NCH(n) == 1) { n = CHILD(n, 0); goto loop; } else { - alias_ty a = alias_for_import_name(c, CHILD(n, 0)); + node *asname_node = CHILD(n, 2); + alias_ty a = alias_for_import_name(c, CHILD(n, 0), store); if (!a) return NULL; assert(!a->asname); - a->asname = NEW_IDENTIFIER(CHILD(n, 2)); + if (store && !forbidden_check(c, asname_node, STR(asname_node))) + return NULL; + a->asname = NEW_IDENTIFIER(asname_node); if (!a->asname) return NULL; return a; @@ -2334,7 +2344,10 @@ break; case dotted_name: if (NCH(n) == 1) { - name = NEW_IDENTIFIER(CHILD(n, 0)); + node *name_node = CHILD(n, 0); + if (store && !forbidden_check(c, name_node, STR(name_node))) + return NULL; + name = NEW_IDENTIFIER(name_node); if (!name) return NULL; return alias(name, NULL, c->c_arena); @@ -2408,7 +2421,7 @@ if (!aliases) return NULL; for (i = 0; i < NCH(n); i += 2) { - alias_ty import_alias = alias_for_import_name(c, CHILD(n, i)); + alias_ty import_alias = alias_for_import_name(c, CHILD(n, i), 1); if (!import_alias) return NULL; asdl_seq_SET(aliases, i / 2, import_alias); @@ -2425,7 +2438,9 @@ optional module name */ for (idx = 1; idx < NCH(n); idx++) { if (TYPE(CHILD(n, idx)) == dotted_name) { - mod = alias_for_import_name(c, CHILD(n, idx)); + mod = alias_for_import_name(c, CHILD(n, idx), 0); + if (!mod) + return NULL; idx++; break; } else if (TYPE(CHILD(n, idx)) != DOT) { @@ -2466,14 +2481,14 @@ /* handle "from ... import *" special b/c there's no children */ if (TYPE(n) == STAR) { - alias_ty import_alias = alias_for_import_name(c, n); + alias_ty import_alias = alias_for_import_name(c, n, 1); if (!import_alias) return NULL; asdl_seq_SET(aliases, 0, import_alias); } else { for (i = 0; i < NCH(n); i += 2) { - alias_ty import_alias = alias_for_import_name(c, CHILD(n, i)); + alias_ty import_alias = alias_for_import_name(c, CHILD(n, i), 1); if (!import_alias) return NULL; asdl_seq_SET(aliases, i / 2, import_alias); From buildbot at python.org Sat Jun 13 06:59:35 2009 From: buildbot at python.org (buildbot at python.org) Date: Sat, 13 Jun 2009 04:59:35 +0000 Subject: [Python-checkins] buildbot failure in x86 XP-4 trunk Message-ID: <20090613045935.4ED4AD954@mail.python.org> The Buildbot has detected a new failure of x86 XP-4 trunk. Full details are available at: http://www.python.org/dev/buildbot/all/x86%20XP-4%20trunk/builds/2237 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: bolen-windows Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: alexandre.vassalotti,antoine.pitrou BUILD FAILED: failed compile sincerely, -The Buildbot From python-checkins at python.org Sat Jun 13 11:07:01 2009 From: python-checkins at python.org (martin.v.loewis) Date: Sat, 13 Jun 2009 11:07:01 +0200 (CEST) Subject: [Python-checkins] r73406 - in python/branches/release26-maint: Lib/distutils/command/bdist_msi.py Lib/msilib/__init__.py Misc/NEWS Message-ID: <20090613090701.984D0D3AF@mail.python.org> Author: martin.v.loewis Date: Sat Jun 13 11:07:01 2009 New Revision: 73406 Log: Merged revisions 73390 via svnmerge from svn+ssh://pythondev at svn.python.org/python/trunk ........ r73390 | martin.v.loewis | 2009-06-12 19:28:31 +0200 (Fr, 12 Jun 2009) | 3 lines Support AMD64 in msilib. Set Win64 on reglocator. Fixes #6258. ........ Modified: python/branches/release26-maint/ (props changed) python/branches/release26-maint/Lib/distutils/command/bdist_msi.py python/branches/release26-maint/Lib/msilib/__init__.py python/branches/release26-maint/Misc/NEWS Modified: python/branches/release26-maint/Lib/distutils/command/bdist_msi.py ============================================================================== --- python/branches/release26-maint/Lib/distutils/command/bdist_msi.py (original) +++ python/branches/release26-maint/Lib/distutils/command/bdist_msi.py Sat Jun 13 11:07:01 2009 @@ -282,9 +282,14 @@ PYTHON.USER if defined, else from PYTHON.MACHINE. PYTHON is PYTHONDIR\python.exe""" install_path = r"SOFTWARE\Python\PythonCore\%s\InstallPath" % self.target_version + if msilib.Win64: + # type: msidbLocatorTypeRawValue + msidbLocatorType64bit + Type = 2+16 + else: + Type = 2 add_data(self.db, "RegLocator", - [("python.machine", 2, install_path, None, 2), - ("python.user", 1, install_path, None, 2)]) + [("python.machine", 2, install_path, None, Type), + ("python.user", 1, install_path, None, Type)]) add_data(self.db, "AppSearch", [("PYTHON.MACHINE", "python.machine"), ("PYTHON.USER", "python.user")]) Modified: python/branches/release26-maint/Lib/msilib/__init__.py ============================================================================== --- python/branches/release26-maint/Lib/msilib/__init__.py (original) +++ python/branches/release26-maint/Lib/msilib/__init__.py Sat Jun 13 11:07:01 2009 @@ -2,9 +2,11 @@ # Copyright (C) 2005 Martin v. L?wis # Licensed to PSF under a Contributor Agreement. from _msi import * -import os, string, re +import os, string, re, sys -Win64=0 +AMD64 = "AMD64" in sys.version +Itanium = "Itanium" in sys.version +Win64 = AMD64 or Itanium # Partially taken from Wine datasizemask= 0x00ff @@ -145,8 +147,10 @@ si.SetProperty(PID_TITLE, "Installation Database") si.SetProperty(PID_SUBJECT, ProductName) si.SetProperty(PID_AUTHOR, Manufacturer) - if Win64: + if Itanium: si.SetProperty(PID_TEMPLATE, "Intel64;1033") + elif AMD64: + si.SetProperty(PID_TEMPLATE, "x64;1033") else: si.SetProperty(PID_TEMPLATE, "Intel;1033") si.SetProperty(PID_REVNUMBER, gen_uuid()) Modified: python/branches/release26-maint/Misc/NEWS ============================================================================== --- python/branches/release26-maint/Misc/NEWS (original) +++ python/branches/release26-maint/Misc/NEWS Sat Jun 13 11:07:01 2009 @@ -56,6 +56,8 @@ Library ------- +- Issue #6258: Support AMD64 in bdist_msi. + - Issue #5262: Fixed bug in next rollover time computation in TimedRotatingFileHandler. From python-checkins at python.org Sat Jun 13 11:20:26 2009 From: python-checkins at python.org (martin.v.loewis) Date: Sat, 13 Jun 2009 11:20:26 +0200 (CEST) Subject: [Python-checkins] r73407 - in python/branches/release30-maint: Lib/distutils/command/bdist_msi.py Lib/msilib/__init__.py Misc/NEWS Message-ID: <20090613092026.7E568D617@mail.python.org> Author: martin.v.loewis Date: Sat Jun 13 11:20:26 2009 New Revision: 73407 Log: Merged revisions 73391 via svnmerge from svn+ssh://pythondev at svn.python.org/python/branches/py3k ................ r73391 | martin.v.loewis | 2009-06-12 19:31:41 +0200 (Fr, 12 Jun 2009) | 10 lines Merged revisions 73390 via svnmerge from svn+ssh://pythondev at svn.python.org/python/trunk ........ r73390 | martin.v.loewis | 2009-06-12 19:28:31 +0200 (Fr, 12 Jun 2009) | 3 lines Support AMD64 in msilib. Set Win64 on reglocator. Fixes #6258. ........ ................ Modified: python/branches/release30-maint/ (props changed) python/branches/release30-maint/Lib/distutils/command/bdist_msi.py python/branches/release30-maint/Lib/msilib/__init__.py python/branches/release30-maint/Misc/NEWS Modified: python/branches/release30-maint/Lib/distutils/command/bdist_msi.py ============================================================================== --- python/branches/release30-maint/Lib/distutils/command/bdist_msi.py (original) +++ python/branches/release30-maint/Lib/distutils/command/bdist_msi.py Sat Jun 13 11:20:26 2009 @@ -282,9 +282,14 @@ PYTHON.USER if defined, else from PYTHON.MACHINE. PYTHON is PYTHONDIR\python.exe""" install_path = r"SOFTWARE\Python\PythonCore\%s\InstallPath" % self.target_version + if msilib.Win64: + # type: msidbLocatorTypeRawValue + msidbLocatorType64bit + Type = 2+16 + else: + Type = 2 add_data(self.db, "RegLocator", - [("python.machine", 2, install_path, None, 2), - ("python.user", 1, install_path, None, 2)]) + [("python.machine", 2, install_path, None, Type), + ("python.user", 1, install_path, None, Type)]) add_data(self.db, "AppSearch", [("PYTHON.MACHINE", "python.machine"), ("PYTHON.USER", "python.user")]) Modified: python/branches/release30-maint/Lib/msilib/__init__.py ============================================================================== --- python/branches/release30-maint/Lib/msilib/__init__.py (original) +++ python/branches/release30-maint/Lib/msilib/__init__.py Sat Jun 13 11:20:26 2009 @@ -2,9 +2,11 @@ # Copyright (C) 2005 Martin v. L?wis # Licensed to PSF under a Contributor Agreement. from _msi import * -import os, string, re +import os, string, re, sys -Win64=0 +AMD64 = "AMD64" in sys.version +Itanium = "Itanium" in sys.version +Win64 = AMD64 or Itanium # Partially taken from Wine datasizemask= 0x00ff @@ -145,8 +147,10 @@ si.SetProperty(PID_TITLE, "Installation Database") si.SetProperty(PID_SUBJECT, ProductName) si.SetProperty(PID_AUTHOR, Manufacturer) - if Win64: + if Itanium: si.SetProperty(PID_TEMPLATE, "Intel64;1033") + elif AMD64: + si.SetProperty(PID_TEMPLATE, "x64;1033") else: si.SetProperty(PID_TEMPLATE, "Intel;1033") si.SetProperty(PID_REVNUMBER, gen_uuid()) Modified: python/branches/release30-maint/Misc/NEWS ============================================================================== --- python/branches/release30-maint/Misc/NEWS (original) +++ python/branches/release30-maint/Misc/NEWS Sat Jun 13 11:20:26 2009 @@ -73,6 +73,8 @@ Library ------- +- Issue #6258: Support AMD64 in bdist_msi. + - Fix a bug in the trace module where a bytes object from co_lnotab had its items being passed through ord(). (Fixes Issue #3821) From python-checkins at python.org Sat Jun 13 15:01:19 2009 From: python-checkins at python.org (benjamin.peterson) Date: Sat, 13 Jun 2009 15:01:19 +0200 (CEST) Subject: [Python-checkins] r73408 - python/branches/py3k/Lib/test/test_import.py Message-ID: <20090613130119.B0222C2DA@mail.python.org> Author: benjamin.peterson Date: Sat Jun 13 15:01:19 2009 New Revision: 73408 Log: make file closing more robust Modified: python/branches/py3k/Lib/test/test_import.py Modified: python/branches/py3k/Lib/test/test_import.py ============================================================================== --- python/branches/py3k/Lib/test/test_import.py (original) +++ python/branches/py3k/Lib/test/test_import.py Sat Jun 13 15:01:19 2009 @@ -46,13 +46,12 @@ else: pyc = TESTFN + ".pyc" - f = open(source, "w") - print("# This tests Python's ability to import a", ext, "file.", file=f) - a = random.randrange(1000) - b = random.randrange(1000) - print("a =", a, file=f) - print("b =", b, file=f) - f.close() + with open(source, "w") as f: + print("# This tests Python's ability to import a", ext, "file.", file=f) + a = random.randrange(1000) + b = random.randrange(1000) + print("a =", a, file=f) + print("b =", b, file=f) if TESTFN in sys.modules: del sys.modules[TESTFN] From python-checkins at python.org Sat Jun 13 15:06:21 2009 From: python-checkins at python.org (benjamin.peterson) Date: Sat, 13 Jun 2009 15:06:21 +0200 (CEST) Subject: [Python-checkins] r73409 - in python/trunk: Lib/test/test_compile.py Python/ast.c Message-ID: <20090613130621.EF00FD93D@mail.python.org> Author: benjamin.peterson Date: Sat Jun 13 15:06:21 2009 New Revision: 73409 Log: allow importing from a module named None if it has an 'as' clause Modified: python/trunk/Lib/test/test_compile.py python/trunk/Python/ast.c Modified: python/trunk/Lib/test/test_compile.py ============================================================================== --- python/trunk/Lib/test/test_compile.py (original) +++ python/trunk/Lib/test/test_compile.py Sat Jun 13 15:06:21 2009 @@ -281,6 +281,8 @@ self.assertRaises(SyntaxError, compile, stmt, 'tmp', 'exec') # This is ok. compile("from None import x", "tmp", "exec") + compile("from x import None as y", "tmp", "exec") + compile("import None as x", "tmp", "exec") def test_import(self): succeed = [ Modified: python/trunk/Python/ast.c ============================================================================== --- python/trunk/Python/ast.c (original) +++ python/trunk/Python/ast.c Sat Jun 13 15:06:21 2009 @@ -2316,8 +2316,10 @@ if (!str) return NULL; } - if (!forbidden_check(c, name_node, STR(name_node))) - return NULL; + else { + if (!forbidden_check(c, name_node, STR(name_node))) + return NULL; + } name = NEW_IDENTIFIER(name_node); if (!name) return NULL; @@ -2330,11 +2332,11 @@ } else { node *asname_node = CHILD(n, 2); - alias_ty a = alias_for_import_name(c, CHILD(n, 0), store); + alias_ty a = alias_for_import_name(c, CHILD(n, 0), 0); if (!a) return NULL; assert(!a->asname); - if (store && !forbidden_check(c, asname_node, STR(asname_node))) + if (!forbidden_check(c, asname_node, STR(asname_node))) return NULL; a->asname = NEW_IDENTIFIER(asname_node); if (!a->asname) From python-checkins at python.org Sat Jun 13 15:10:10 2009 From: python-checkins at python.org (benjamin.peterson) Date: Sat, 13 Jun 2009 15:10:10 +0200 (CEST) Subject: [Python-checkins] r73410 - python/branches/py3k/Lib/pydoc_data/topics.py Message-ID: <20090613131010.F054BDA56@mail.python.org> Author: benjamin.peterson Date: Sat Jun 13 15:10:10 2009 New Revision: 73410 Log: update pydoc topics Modified: python/branches/py3k/Lib/pydoc_data/topics.py Modified: python/branches/py3k/Lib/pydoc_data/topics.py ============================================================================== --- python/branches/py3k/Lib/pydoc_data/topics.py (original) +++ python/branches/py3k/Lib/pydoc_data/topics.py Sat Jun 13 15:10:10 2009 @@ -1,4 +1,4 @@ -# Autogenerated by Sphinx on Sat May 30 10:41:05 2009 +# Autogenerated by Sphinx on Sat Jun 13 08:08:53 2009 topics = {'assert': '\nThe ``assert`` statement\n************************\n\nAssert statements are a convenient way to insert debugging assertions\ninto a program:\n\n assert_stmt ::= "assert" expression ["," expression]\n\nThe simple form, ``assert expression``, is equivalent to\n\n if __debug__:\n if not expression: raise AssertionError\n\nThe extended form, ``assert expression1, expression2``, is equivalent\nto\n\n if __debug__:\n if not expression1: raise AssertionError(expression2)\n\nThese equivalences assume that ``__debug__`` and ``AssertionError``\nrefer to the built-in variables with those names. In the current\nimplementation, the built-in variable ``__debug__`` is ``True`` under\nnormal circumstances, ``False`` when optimization is requested\n(command line option -O). The current code generator emits no code\nfor an assert statement when optimization is requested at compile\ntime. Note that it is unnecessary to include the source code for the\nexpression that failed in the error message; it will be displayed as\npart of the stack trace.\n\nAssignments to ``__debug__`` are illegal. The value for the built-in\nvariable is determined when the interpreter starts.\n', 'assignment': '\nAssignment statements\n*********************\n\nAssignment statements are used to (re)bind names to values and to\nmodify attributes or items of mutable objects:\n\n assignment_stmt ::= (target_list "=")+ (expression_list | yield_expression)\n target_list ::= target ("," target)* [","]\n target ::= identifier\n | "(" target_list ")"\n | "[" target_list "]"\n | attributeref\n | subscription\n | slicing\n | "*" target\n\n(See section *Primaries* for the syntax definitions for the last three\nsymbols.)\n\nAn assignment statement evaluates the expression list (remember that\nthis can be a single expression or a comma-separated list, the latter\nyielding a tuple) and assigns the single resulting object to each of\nthe target lists, from left to right.\n\nAssignment is defined recursively depending on the form of the target\n(list). When a target is part of a mutable object (an attribute\nreference, subscription or slicing), the mutable object must\nultimately perform the assignment and decide about its validity, and\nmay raise an exception if the assignment is unacceptable. The rules\nobserved by various types and the exceptions raised are given with the\ndefinition of the object types (see section *The standard type\nhierarchy*).\n\nAssignment of an object to a target list, optionally enclosed in\nparentheses or square brackets, is recursively defined as follows.\n\n* If the target list is a single target: The object is assigned to\n that target.\n\n* If the target list is a comma-separated list of targets: The object\n must be an iterable with the same number of items as there are\n targets in the target list, and the items are assigned, from left to\n right, to the corresponding targets. (This rule is relaxed as of\n Python 1.5; in earlier versions, the object had to be a tuple.\n Since strings are sequences, an assignment like ``a, b = "xy"`` is\n now legal as long as the string has the right length.)\n\n * If the target list contains one target prefixed with an asterisk,\n called a "starred" target: The object must be a sequence with at\n least as many items as there are targets in the target list, minus\n one. The first items of the sequence are assigned, from left to\n right, to the targets before the starred target. The final items\n of the sequence are assigned to the targets after the starred\n target. A list of the remaining items in the sequence is then\n assigned to the starred target (the list can be empty).\n\n * Else: The object must be a sequence with the same number of items\n as there are targets in the target list, and the items are\n assigned, from left to right, to the corresponding targets.\n\nAssignment of an object to a single target is recursively defined as\nfollows.\n\n* If the target is an identifier (name):\n\n * If the name does not occur in a ``global`` or ``nonlocal``\n statement in the current code block: the name is bound to the\n object in the current local namespace.\n\n * Otherwise: the name is bound to the object in the global namespace\n or the outer namespace determined by ``nonlocal``, respectively.\n\n The name is rebound if it was already bound. This may cause the\n reference count for the object previously bound to the name to reach\n zero, causing the object to be deallocated and its destructor (if it\n has one) to be called.\n\n The name is rebound if it was already bound. This may cause the\n reference count for the object previously bound to the name to reach\n zero, causing the object to be deallocated and its destructor (if it\n has one) to be called.\n\n* If the target is a target list enclosed in parentheses or in square\n brackets: The object must be an iterable with the same number of\n items as there are targets in the target list, and its items are\n assigned, from left to right, to the corresponding targets.\n\n* If the target is an attribute reference: The primary expression in\n the reference is evaluated. It should yield an object with\n assignable attributes; if this is not the case, ``TypeError`` is\n raised. That object is then asked to assign the assigned object to\n the given attribute; if it cannot perform the assignment, it raises\n an exception (usually but not necessarily ``AttributeError``).\n\n* If the target is a subscription: The primary expression in the\n reference is evaluated. It should yield either a mutable sequence\n object (such as a list) or a mapping object (such as a dictionary).\n Next, the subscript expression is evaluated.\n\n If the primary is a mutable sequence object (such as a list), the\n subscript must yield an integer. If it is negative, the sequence\'s\n length is added to it. The resulting value must be a nonnegative\n integer less than the sequence\'s length, and the sequence is asked\n to assign the assigned object to its item with that index. If the\n index is out of range, ``IndexError`` is raised (assignment to a\n subscripted sequence cannot add new items to a list).\n\n If the primary is a mapping object (such as a dictionary), the\n subscript must have a type compatible with the mapping\'s key type,\n and the mapping is then asked to create a key/datum pair which maps\n the subscript to the assigned object. This can either replace an\n existing key/value pair with the same key value, or insert a new\n key/value pair (if no key with the same value existed).\n\n For user-defined objects, the ``__setitem__()`` method is called\n with appropriate arguments.\n\n* If the target is a slicing: The primary expression in the reference\n is evaluated. It should yield a mutable sequence object (such as a\n list). The assigned object should be a sequence object of the same\n type. Next, the lower and upper bound expressions are evaluated,\n insofar they are present; defaults are zero and the sequence\'s\n length. The bounds should evaluate to integers. If either bound is\n negative, the sequence\'s length is added to it. The resulting\n bounds are clipped to lie between zero and the sequence\'s length,\n inclusive. Finally, the sequence object is asked to replace the\n slice with the items of the assigned sequence. The length of the\n slice may be different from the length of the assigned sequence,\n thus changing the length of the target sequence, if the object\n allows it.\n\n(In the current implementation, the syntax for targets is taken to be\nthe same as for expressions, and invalid syntax is rejected during the\ncode generation phase, causing less detailed error messages.)\n\nWARNING: Although the definition of assignment implies that overlaps\nbetween the left-hand side and the right-hand side are \'safe\' (for\nexample ``a, b = b, a`` swaps two variables), overlaps *within* the\ncollection of assigned-to variables are not safe! For instance, the\nfollowing program prints ``[0, 2]``:\n\n x = [0, 1]\n i = 0\n i, x[i] = 1, 2\n print(x)\n\nSee also:\n\n **PEP 3132** - Extended Iterable Unpacking\n The specification for the ``*target`` feature.\n\n\nAugmented assignment statements\n===============================\n\nAugmented assignment is the combination, in a single statement, of a\nbinary operation and an assignment statement:\n\n augmented_assignment_stmt ::= augtarget augop (expression_list | yield_expression)\n augtarget ::= identifier | attributeref | subscription | slicing\n augop ::= "+=" | "-=" | "*=" | "/=" | "//=" | "%=" | "**="\n | ">>=" | "<<=" | "&=" | "^=" | "|="\n\n(See section *Primaries* for the syntax definitions for the last three\nsymbols.)\n\nAn augmented assignment evaluates the target (which, unlike normal\nassignment statements, cannot be an unpacking) and the expression\nlist, performs the binary operation specific to the type of assignment\non the two operands, and assigns the result to the original target.\nThe target is only evaluated once.\n\nAn augmented assignment expression like ``x += 1`` can be rewritten as\n``x = x + 1`` to achieve a similar, but not exactly equal effect. In\nthe augmented version, ``x`` is only evaluated once. Also, when\npossible, the actual operation is performed *in-place*, meaning that\nrather than creating a new object and assigning that to the target,\nthe old object is modified instead.\n\nWith the exception of assigning to tuples and multiple targets in a\nsingle statement, the assignment done by augmented assignment\nstatements is handled the same way as normal assignments. Similarly,\nwith the exception of the possible *in-place* behavior, the binary\noperation performed by augmented assignment is the same as the normal\nbinary operations.\n\nFor targets which are attribute references, the initial value is\nretrieved with a ``getattr()`` and the result is assigned with a\n``setattr()``. Notice that the two methods do not necessarily refer\nto the same variable. When ``getattr()`` refers to a class variable,\n``setattr()`` still writes to an instance variable. For example:\n\n class A:\n x = 3 # class variable\n a = A()\n a.x += 1 # writes a.x as 4 leaving A.x as 3\n', 'atom-identifiers': '\nIdentifiers (Names)\n*******************\n\nAn identifier occurring as an atom is a name. See section\n*Identifiers and keywords* for lexical definition and section *Naming\nand binding* for documentation of naming and binding.\n\nWhen the name is bound to an object, evaluation of the atom yields\nthat object. When a name is not bound, an attempt to evaluate it\nraises a ``NameError`` exception.\n\n**Private name mangling:** When an identifier that textually occurs in\na class definition begins with two or more underscore characters and\ndoes not end in two or more underscores, it is considered a *private\nname* of that class. Private names are transformed to a longer form\nbefore code is generated for them. The transformation inserts the\nclass name in front of the name, with leading underscores removed, and\na single underscore inserted in front of the class name. For example,\nthe identifier ``__spam`` occurring in a class named ``Ham`` will be\ntransformed to ``_Ham__spam``. This transformation is independent of\nthe syntactical context in which the identifier is used. If the\ntransformed name is extremely long (longer than 255 characters),\nimplementation defined truncation may happen. If the class name\nconsists only of underscores, no transformation is done.\n', @@ -19,7 +19,7 @@ 'calls': '\nCalls\n*****\n\nA call calls a callable object (e.g., a function) with a possibly\nempty series of arguments:\n\n call ::= primary "(" [argument_list [","] | comprehension] ")"\n argument_list ::= positional_arguments ["," keyword_arguments]\n ["," "*" expression] ["," keyword_arguments]\n ["," "**" expression]\n | keyword_arguments ["," "*" expression]\n ["," keyword_arguments] ["," "**" expression]\n | "*" expression ["," keyword_arguments] ["," "**" expression]\n | "**" expression\n positional_arguments ::= expression ("," expression)*\n keyword_arguments ::= keyword_item ("," keyword_item)*\n keyword_item ::= identifier "=" expression\n\nA trailing comma may be present after the positional and keyword\narguments but does not affect the semantics.\n\nThe primary must evaluate to a callable object (user-defined\nfunctions, built-in functions, methods of built-in objects, class\nobjects, methods of class instances, and all objects having a\n``__call__()`` method are callable). All argument expressions are\nevaluated before the call is attempted. Please refer to section\n*Function definitions* for the syntax of formal parameter lists.\n\nIf keyword arguments are present, they are first converted to\npositional arguments, as follows. First, a list of unfilled slots is\ncreated for the formal parameters. If there are N positional\narguments, they are placed in the first N slots. Next, for each\nkeyword argument, the identifier is used to determine the\ncorresponding slot (if the identifier is the same as the first formal\nparameter name, the first slot is used, and so on). If the slot is\nalready filled, a ``TypeError`` exception is raised. Otherwise, the\nvalue of the argument is placed in the slot, filling it (even if the\nexpression is ``None``, it fills the slot). When all arguments have\nbeen processed, the slots that are still unfilled are filled with the\ncorresponding default value from the function definition. (Default\nvalues are calculated, once, when the function is defined; thus, a\nmutable object such as a list or dictionary used as default value will\nbe shared by all calls that don\'t specify an argument value for the\ncorresponding slot; this should usually be avoided.) If there are any\nunfilled slots for which no default value is specified, a\n``TypeError`` exception is raised. Otherwise, the list of filled\nslots is used as the argument list for the call.\n\nNote: An implementation may provide builtin functions whose positional\n parameters do not have names, even if they are \'named\' for the\n purpose of documentation, and which therefore cannot be supplied by\n keyword. In CPython, this is the case for functions implemented in\n C that use ``PyArg_ParseTuple()`` to parse their arguments.\n\nIf there are more positional arguments than there are formal parameter\nslots, a ``TypeError`` exception is raised, unless a formal parameter\nusing the syntax ``*identifier`` is present; in this case, that formal\nparameter receives a tuple containing the excess positional arguments\n(or an empty tuple if there were no excess positional arguments).\n\nIf any keyword argument does not correspond to a formal parameter\nname, a ``TypeError`` exception is raised, unless a formal parameter\nusing the syntax ``**identifier`` is present; in this case, that\nformal parameter receives a dictionary containing the excess keyword\narguments (using the keywords as keys and the argument values as\ncorresponding values), or a (new) empty dictionary if there were no\nexcess keyword arguments.\n\nIf the syntax ``*expression`` appears in the function call,\n``expression`` must evaluate to a sequence. Elements from this\nsequence are treated as if they were additional positional arguments;\nif there are positional arguments *x1*,..., *xN*, and ``expression``\nevaluates to a sequence *y1*, ..., *yM*, this is equivalent to a call\nwith M+N positional arguments *x1*, ..., *xN*, *y1*, ..., *yM*.\n\nA consequence of this is that although the ``*expression`` syntax may\nappear *after* some keyword arguments, it is processed *before* the\nkeyword arguments (and the ``**expression`` argument, if any -- see\nbelow). So:\n\n >>> def f(a, b):\n ... print(a, b)\n ...\n >>> f(b=1, *(2,))\n 2 1\n >>> f(a=1, *(2,))\n Traceback (most recent call last):\n File "", line 1, in ?\n TypeError: f() got multiple values for keyword argument \'a\'\n >>> f(1, *(2,))\n 1 2\n\nIt is unusual for both keyword arguments and the ``*expression``\nsyntax to be used in the same call, so in practice this confusion does\nnot arise.\n\nIf the syntax ``**expression`` appears in the function call,\n``expression`` must evaluate to a mapping, the contents of which are\ntreated as additional keyword arguments. In the case of a keyword\nappearing in both ``expression`` and as an explicit keyword argument,\na ``TypeError`` exception is raised.\n\nFormal parameters using the syntax ``*identifier`` or ``**identifier``\ncannot be used as positional argument slots or as keyword argument\nnames.\n\nA call always returns some value, possibly ``None``, unless it raises\nan exception. How this value is computed depends on the type of the\ncallable object.\n\nIf it is---\n\na user-defined function:\n The code block for the function is executed, passing it the\n argument list. The first thing the code block will do is bind the\n formal parameters to the arguments; this is described in section\n *Function definitions*. When the code block executes a ``return``\n statement, this specifies the return value of the function call.\n\na built-in function or method:\n The result is up to the interpreter; see *Built-in Functions* for\n the descriptions of built-in functions and methods.\n\na class object:\n A new instance of that class is returned.\n\na class instance method:\n The corresponding user-defined function is called, with an argument\n list that is one longer than the argument list of the call: the\n instance becomes the first argument.\n\na class instance:\n The class must define a ``__call__()`` method; the effect is then\n the same as if that method was called.\n', 'class': '\nClass definitions\n*****************\n\nA class definition defines a class object (see section *The standard\ntype hierarchy*):\n\n classdef ::= [decorators] "class" classname [inheritance] ":" suite\n inheritance ::= "(" [expression_list] ")"\n classname ::= identifier\n\nA class definition is an executable statement. It first evaluates the\ninheritance list, if present. Each item in the inheritance list\nshould evaluate to a class object or class type which allows\nsubclassing. The class\'s suite is then executed in a new execution\nframe (see section *Naming and binding*), using a newly created local\nnamespace and the original global namespace. (Usually, the suite\ncontains only function definitions.) When the class\'s suite finishes\nexecution, its execution frame is discarded but its local namespace is\nsaved. [4] A class object is then created using the inheritance list\nfor the base classes and the saved local namespace for the attribute\ndictionary. The class name is bound to this class object in the\noriginal local namespace.\n\nClasses can also be decorated; as with functions,\n\n @f1(arg)\n @f2\n class Foo: pass\n\nis equivalent to\n\n class Foo: pass\n Foo = f1(arg)(f2(Foo))\n\n**Programmer\'s note:** Variables defined in the class definition are\nclass variables; they are shared by instances. Instance variables can\nbe set in a method with ``self.name = value``. Both class and\ninstance variables are accessible through the notation\n"``self.name``", and an instance variable hides a class variable with\nthe same name when accessed in this way. Class variables can be used\nas defaults for instance variables, but using mutable values there can\nlead to unexpected results. Descriptors can be used to create\ninstance variables with different implementation details.\n\nSee also:\n\n **PEP 3129** - Class Decorators\n\nClass definitions, like function definitions, may be wrapped by one or\nmore *decorator* expressions. The evaluation rules for the decorator\nexpressions are the same as for functions. The result must be a class\nobject, which is then bound to the class name.\n\n-[ Footnotes ]-\n\n[1] The exception is propagated to the invocation stack only if there\n is no ``finally`` clause that negates the exception.\n\n[2] Currently, control "flows off the end" except in the case of an\n exception or the execution of a ``return``, ``continue``, or\n ``break`` statement.\n\n[3] A string literal appearing as the first statement in the function\n body is transformed into the function\'s ``__doc__`` attribute and\n therefore the function\'s *docstring*.\n\n[4] A string literal appearing as the first statement in the class\n body is transformed into the namespace\'s ``__doc__`` item and\n therefore the class\'s *docstring*.\n', 'comparisons': '\nComparisons\n***********\n\nUnlike C, all comparison operations in Python have the same priority,\nwhich is lower than that of any arithmetic, shifting or bitwise\noperation. Also unlike C, expressions like ``a < b < c`` have the\ninterpretation that is conventional in mathematics:\n\n comparison ::= or_expr ( comp_operator or_expr )*\n comp_operator ::= "<" | ">" | "==" | ">=" | "<=" | "!="\n | "is" ["not"] | ["not"] "in"\n\nComparisons yield boolean values: ``True`` or ``False``.\n\nComparisons can be chained arbitrarily, e.g., ``x < y <= z`` is\nequivalent to ``x < y and y <= z``, except that ``y`` is evaluated\nonly once (but in both cases ``z`` is not evaluated at all when ``x <\ny`` is found to be false).\n\nFormally, if *a*, *b*, *c*, ..., *y*, *z* are expressions and *op1*,\n*op2*, ..., *opN* are comparison operators, then ``a op1 b op2 c ... y\nopN z`` is equivalent to ``a op1 b and b op2 c and ... y opN z``,\nexcept that each expression is evaluated at most once.\n\nNote that ``a op1 b op2 c`` doesn\'t imply any kind of comparison\nbetween *a* and *c*, so that, e.g., ``x < y > z`` is perfectly legal\n(though perhaps not pretty).\n\nThe operators ``<``, ``>``, ``==``, ``>=``, ``<=``, and ``!=`` compare\nthe values of two objects. The objects need not have the same type.\nIf both are numbers, they are converted to a common type. Otherwise,\nthe ``==`` and ``!=`` operators *always* consider objects of different\ntypes to be unequal, while the ``<``, ``>``, ``>=`` and ``<=``\noperators raise a ``TypeError`` when comparing objects of different\ntypes that do not implement these operators for the given pair of\ntypes. You can control comparison behavior of objects of non-builtin\ntypes by defining rich comparison methods like ``__gt__()``, described\nin section *Basic customization*.\n\nComparison of objects of the same type depends on the type:\n\n* Numbers are compared arithmetically.\n\n* The values ``float(\'NaN\')`` and ``Decimal(\'NaN\')`` are special. The\n are identical to themselves, ``x is x`` but are not equal to\n themselves, ``x != x``. Additionally, comparing any value to a\n not-a-number value will return ``False``. For example, both ``3 <\n float(\'NaN\')`` and ``float(\'NaN\') < 3`` will return ``False``.\n\n* Bytes objects are compared lexicographically using the numeric\n values of their elements.\n\n* Strings are compared lexicographically using the numeric equivalents\n (the result of the built-in function ``ord()``) of their characters.\n [3] String and bytes object can\'t be compared!\n\n* Tuples and lists are compared lexicographically using comparison of\n corresponding elements. This means that to compare equal, each\n element must compare equal and the two sequences must be of the same\n type and have the same length.\n\n If not equal, the sequences are ordered the same as their first\n differing elements. For example, ``[1,2,x] <= [1,2,y]`` has the\n same value as ``x <= y``. If the corresponding element does not\n exist, the shorter sequence is ordered first (for example, ``[1,2] <\n [1,2,3]``).\n\n* Mappings (dictionaries) compare equal if and only if their sorted\n ``(key, value)`` lists compare equal. [4] Outcomes other than\n equality are resolved consistently, but are not otherwise defined.\n [5]\n\n* Sets and frozensets define comparison operators to mean subset and\n superset tests. Those relations do not define total orderings (the\n two sets ``{1,2}`` and {2,3} are not equal, nor subsets of one\n another, nor supersets of one another). Accordingly, sets are not\n appropriate arguments for functions which depend on total ordering.\n For example, ``min()``, ``max()``, and ``sorted()`` produce\n undefined results given a list of sets as inputs.\n\n* Most other objects of builtin types compare unequal unless they are\n the same object; the choice whether one object is considered smaller\n or larger than another one is made arbitrarily but consistently\n within one execution of a program.\n\nComparison of objects of the differing types depends on whether either\nof the types provide explicit support for the comparison. Most\nnumeric types can be compared with one another, but comparisons of\n``float`` and ``Decimal`` are not supported to avoid the inevitable\nconfusion arising from representation issues such as ``float(\'1.1\')``\nbeing inexactly represented and therefore not exactly equal to\n``Decimal(\'1.1\')`` which is. When cross-type comparison is not\nsupported, the comparison method returns ``NotImplemented``. This can\ncreate the illusion of non-transitivity between supported cross-type\ncomparisons and unsupported comparisons. For example, ``Decimal(2) ==\n2`` and *2 == float(2)`* but ``Decimal(2) != float(2)``.\n\nThe operators ``in`` and ``not in`` test for membership. ``x in s``\nevaluates to true if *x* is a member of *s*, and false otherwise. ``x\nnot in s`` returns the negation of ``x in s``. All built-in sequences\nand set types support this as well as dictionary, for which ``in``\ntests whether a the dictionary has a given key. For container types\nsuch as list, tuple, set, frozenset, dict, or collections.deque, the\nexpression ``x in y`` is equivalent to ``any(x is e or x == e for val\ne in y)``.\n\nFor the string and bytes types, ``x in y`` is true if and only if *x*\nis a substring of *y*. An equivalent test is ``y.find(x) != -1``.\nEmpty strings are always considered to be a substring of any other\nstring, so ``"" in "abc"`` will return ``True``.\n\nFor user-defined classes which define the ``__contains__()`` method,\n``x in y`` is true if and only if ``y.__contains__(x)`` is true.\n\nFor user-defined classes which do not define ``__contains__()`` and do\ndefine ``__getitem__()``, ``x in y`` is true if and only if there is a\nnon-negative integer index *i* such that ``x == y[i]``, and all lower\ninteger indices do not raise ``IndexError`` exception. (If any other\nexception is raised, it is as if ``in`` raised that exception).\n\nThe operator ``not in`` is defined to have the inverse true value of\n``in``.\n\nThe operators ``is`` and ``is not`` test for object identity: ``x is\ny`` is true if and only if *x* and *y* are the same object. ``x is\nnot y`` yields the inverse truth value. [6]\n', - 'compound': '\nCompound statements\n*******************\n\nCompound statements contain (groups of) other statements; they affect\nor control the execution of those other statements in some way. In\ngeneral, compound statements span multiple lines, although in simple\nincarnations a whole compound statement may be contained in one line.\n\nThe ``if``, ``while`` and ``for`` statements implement traditional\ncontrol flow constructs. ``try`` specifies exception handlers and/or\ncleanup code for a group of statements, while the ``with`` statement\nallows the execution of initialization and finalization code around a\nblock of code. Function and class definitions are also syntactically\ncompound statements.\n\nCompound statements consist of one or more \'clauses.\' A clause\nconsists of a header and a \'suite.\' The clause headers of a\nparticular compound statement are all at the same indentation level.\nEach clause header begins with a uniquely identifying keyword and ends\nwith a colon. A suite is a group of statements controlled by a\nclause. A suite can be one or more semicolon-separated simple\nstatements on the same line as the header, following the header\'s\ncolon, or it can be one or more indented statements on subsequent\nlines. Only the latter form of suite can contain nested compound\nstatements; the following is illegal, mostly because it wouldn\'t be\nclear to which ``if`` clause a following ``else`` clause would belong:\n\n if test1: if test2: print(x)\n\nAlso note that the semicolon binds tighter than the colon in this\ncontext, so that in the following example, either all or none of the\n``print()`` calls are executed:\n\n if x < y < z: print(x); print(y); print(z)\n\nSummarizing:\n\n compound_stmt ::= if_stmt\n | while_stmt\n | for_stmt\n | try_stmt\n | with_stmt\n | funcdef\n | classdef\n suite ::= stmt_list NEWLINE | NEWLINE INDENT statement+ DEDENT\n statement ::= stmt_list NEWLINE | compound_stmt\n stmt_list ::= simple_stmt (";" simple_stmt)* [";"]\n\nNote that statements always end in a ``NEWLINE`` possibly followed by\na ``DEDENT``. Also note that optional continuation clauses always\nbegin with a keyword that cannot start a statement, thus there are no\nambiguities (the \'dangling ``else``\' problem is solved in Python by\nrequiring nested ``if`` statements to be indented).\n\nThe formatting of the grammar rules in the following sections places\neach clause on a separate line for clarity.\n\n\nThe ``if`` statement\n====================\n\nThe ``if`` statement is used for conditional execution:\n\n if_stmt ::= "if" expression ":" suite\n ( "elif" expression ":" suite )*\n ["else" ":" suite]\n\nIt selects exactly one of the suites by evaluating the expressions one\nby one until one is found to be true (see section *Boolean operations*\nfor the definition of true and false); then that suite is executed\n(and no other part of the ``if`` statement is executed or evaluated).\nIf all expressions are false, the suite of the ``else`` clause, if\npresent, is executed.\n\n\nThe ``while`` statement\n=======================\n\nThe ``while`` statement is used for repeated execution as long as an\nexpression is true:\n\n while_stmt ::= "while" expression ":" suite\n ["else" ":" suite]\n\nThis repeatedly tests the expression and, if it is true, executes the\nfirst suite; if the expression is false (which may be the first time\nit is tested) the suite of the ``else`` clause, if present, is\nexecuted and the loop terminates.\n\nA ``break`` statement executed in the first suite terminates the loop\nwithout executing the ``else`` clause\'s suite. A ``continue``\nstatement executed in the first suite skips the rest of the suite and\ngoes back to testing the expression.\n\n\nThe ``for`` statement\n=====================\n\nThe ``for`` statement is used to iterate over the elements of a\nsequence (such as a string, tuple or list) or other iterable object:\n\n for_stmt ::= "for" target_list "in" expression_list ":" suite\n ["else" ":" suite]\n\nThe expression list is evaluated once; it should yield an iterable\nobject. An iterator is created for the result of the\n``expression_list``. The suite is then executed once for each item\nprovided by the iterator, in the order of ascending indices. Each\nitem in turn is assigned to the target list using the standard rules\nfor assignments (see *Assignment statements*), and then the suite is\nexecuted. When the items are exhausted (which is immediately when the\nsequence is empty or an iterator raises a ``StopIteration``\nexception), the suite in the ``else`` clause, if present, is executed,\nand the loop terminates.\n\nA ``break`` statement executed in the first suite terminates the loop\nwithout executing the ``else`` clause\'s suite. A ``continue``\nstatement executed in the first suite skips the rest of the suite and\ncontinues with the next item, or with the ``else`` clause if there was\nno next item.\n\nThe suite may assign to the variable(s) in the target list; this does\nnot affect the next item assigned to it.\n\nNames in the target list are not deleted when the loop is finished,\nbut if the sequence is empty, it will not have been assigned to at all\nby the loop. Hint: the built-in function ``range()`` returns an\niterator of integers suitable to emulate the effect of Pascal\'s ``for\ni := a to b do``; e.g., ``range(3)`` returns the list ``[0, 1, 2]``.\n\nNote: There is a subtlety when the sequence is being modified by the loop\n (this can only occur for mutable sequences, i.e. lists). An\n internal counter is used to keep track of which item is used next,\n and this is incremented on each iteration. When this counter has\n reached the length of the sequence the loop terminates. This means\n that if the suite deletes the current (or a previous) item from the\n sequence, the next item will be skipped (since it gets the index of\n the current item which has already been treated). Likewise, if the\n suite inserts an item in the sequence before the current item, the\n current item will be treated again the next time through the loop.\n This can lead to nasty bugs that can be avoided by making a\n temporary copy using a slice of the whole sequence, e.g.,\n\n for x in a[:]:\n if x < 0: a.remove(x)\n\n\nThe ``try`` statement\n=====================\n\nThe ``try`` statement specifies exception handlers and/or cleanup code\nfor a group of statements:\n\n try_stmt ::= try1_stmt | try2_stmt\n try1_stmt ::= "try" ":" suite\n ("except" [expression ["as" target]] ":" suite)+\n ["else" ":" suite]\n ["finally" ":" suite]\n try2_stmt ::= "try" ":" suite\n "finally" ":" suite\n\nThe ``except`` clause(s) specify one or more exception handlers. When\nno exception occurs in the ``try`` clause, no exception handler is\nexecuted. When an exception occurs in the ``try`` suite, a search for\nan exception handler is started. This search inspects the except\nclauses in turn until one is found that matches the exception. An\nexpression-less except clause, if present, must be last; it matches\nany exception. For an except clause with an expression, that\nexpression is evaluated, and the clause matches the exception if the\nresulting object is "compatible" with the exception. An object is\ncompatible with an exception if it is the class or a base class of the\nexception object or a tuple containing an item compatible with the\nexception.\n\nIf no except clause matches the exception, the search for an exception\nhandler continues in the surrounding code and on the invocation stack.\n[1]\n\nIf the evaluation of an expression in the header of an except clause\nraises an exception, the original search for a handler is canceled and\na search starts for the new exception in the surrounding code and on\nthe call stack (it is treated as if the entire ``try`` statement\nraised the exception).\n\nWhen a matching except clause is found, the exception is assigned to\nthe target specified after the ``as`` keyword in that except clause,\nif present, and the except clause\'s suite is executed. All except\nclauses must have an executable block. When the end of this block is\nreached, execution continues normally after the entire try statement.\n(This means that if two nested handlers exist for the same exception,\nand the exception occurs in the try clause of the inner handler, the\nouter handler will not handle the exception.)\n\nWhen an exception has been assigned using ``as target``, it is cleared\nat the end of the except clause. This is as if\n\n except E as N:\n foo\n\nwas translated to\n\n except E as N:\n try:\n foo\n finally:\n N = None\n del N\n\nThat means that you have to assign the exception to a different name\nif you want to be able to refer to it after the except clause. The\nreason for this is that with the traceback attached to them,\nexceptions will form a reference cycle with the stack frame, keeping\nall locals in that frame alive until the next garbage collection\noccurs.\n\nBefore an except clause\'s suite is executed, details about the\nexception are stored in the ``sys`` module and can be access via\n``sys.exc_info()``. ``sys.exc_info()`` returns a 3-tuple consisting\nof: ``exc_type``, the exception class; ``exc_value``, the exception\ninstance; ``exc_traceback``, a traceback object (see section *The\nstandard type hierarchy*) identifying the point in the program where\nthe exception occurred. ``sys.exc_info()`` values are restored to\ntheir previous values (before the call) when returning from a function\nthat handled an exception.\n\nThe optional ``else`` clause is executed if and when control flows off\nthe end of the ``try`` clause. [2] Exceptions in the ``else`` clause\nare not handled by the preceding ``except`` clauses.\n\nIf ``finally`` is present, it specifies a \'cleanup\' handler. The\n``try`` clause is executed, including any ``except`` and ``else``\nclauses. If an exception occurs in any of the clauses and is not\nhandled, the exception is temporarily saved. The ``finally`` clause is\nexecuted. If there is a saved exception, it is re-raised at the end\nof the ``finally`` clause. If the ``finally`` clause raises another\nexception or executes a ``return`` or ``break`` statement, the saved\nexception is lost. The exception information is not available to the\nprogram during execution of the ``finally`` clause.\n\nWhen a ``return``, ``break`` or ``continue`` statement is executed in\nthe ``try`` suite of a ``try``...``finally`` statement, the\n``finally`` clause is also executed \'on the way out.\' A ``continue``\nstatement is illegal in the ``finally`` clause. (The reason is a\nproblem with the current implementation --- this restriction may be\nlifted in the future).\n\nAdditional information on exceptions can be found in section\n*Exceptions*, and information on using the ``raise`` statement to\ngenerate exceptions may be found in section *The raise statement*.\n\n\nThe ``with`` statement\n======================\n\nThe ``with`` statement is used to wrap the execution of a block with\nmethods defined by a context manager (see section *With Statement\nContext Managers*). This allows common\n``try``...``except``...``finally`` usage patterns to be encapsulated\nfor convenient reuse.\n\n with_stmt ::= "with" with_item ("," with_item)* ":" suite\n with_item ::= expression ["as" target]\n\nThe execution of the ``with`` statement with one "item" proceeds as\nfollows:\n\n1. The context expression is evaluated to obtain a context manager.\n\n2. The context manager\'s ``__enter__()`` method is invoked.\n\n3. If a target was included in the ``with`` statement, the return\n value from ``__enter__()`` is assigned to it.\n\n Note: The ``with`` statement guarantees that if the ``__enter__()``\n method returns without an error, then ``__exit__()`` will always\n be called. Thus, if an error occurs during the assignment to the\n target list, it will be treated the same as an error occurring\n within the suite would be. See step 5 below.\n\n4. The suite is executed.\n\n5. The context manager\'s ``__exit__()`` method is invoked. If an\n exception caused the suite to be exited, its type, value, and\n traceback are passed as arguments to ``__exit__()``. Otherwise,\n three ``None`` arguments are supplied.\n\n If the suite was exited due to an exception, and the return value\n from the ``__exit__()`` method was false, the exception is\n reraised. If the return value was true, the exception is\n suppressed, and execution continues with the statement following\n the ``with`` statement.\n\n If the suite was exited for any reason other than an exception, the\n return value from ``__exit__()`` is ignored, and execution proceeds\n at the normal location for the kind of exit that was taken.\n\nWith more than one item, the context managers are processed as if\nmultiple ``with`` statements were nested:\n\n with A() as a, B() as b:\n suite\n\nis equivalent to\n\n with A() as a:\n with B() as b:\n suite\n\nChanged in version 3.1: Support for multiple context expressions.\n\nSee also:\n\n **PEP 0343** - The "with" statement\n The specification, background, and examples for the Python\n ``with`` statement.\n\n\nFunction definitions\n====================\n\nA function definition defines a user-defined function object (see\nsection *The standard type hierarchy*):\n\n funcdef ::= [decorators] "def" funcname "(" [parameter_list] ")" ["->" expression] ":" suite\n decorators ::= decorator+\n decorator ::= "@" dotted_name ["(" [argument_list [","]] ")"] NEWLINE\n dotted_name ::= identifier ("." identifier)*\n parameter_list ::= (defparameter ",")*\n ( "*" [parameter] ("," defparameter)*\n [, "**" parameter]\n | "**" parameter\n | defparameter [","] )\n parameter ::= identifier [":" expression]\n defparameter ::= parameter ["=" expression]\n funcname ::= identifier\n\nA function definition is an executable statement. Its execution binds\nthe function name in the current local namespace to a function object\n(a wrapper around the executable code for the function). This\nfunction object contains a reference to the current global namespace\nas the global namespace to be used when the function is called.\n\nThe function definition does not execute the function body; this gets\nexecuted only when the function is called. [3]\n\nA function definition may be wrapped by one or more *decorator*\nexpressions. Decorator expressions are evaluated when the function is\ndefined, in the scope that contains the function definition. The\nresult must be a callable, which is invoked with the function object\nas the only argument. The returned value is bound to the function name\ninstead of the function object. Multiple decorators are applied in\nnested fashion. For example, the following code\n\n @f1(arg)\n @f2\n def func(): pass\n\nis equivalent to\n\n def func(): pass\n func = f1(arg)(f2(func))\n\nWhen one or more parameters have the form *parameter* ``=``\n*expression*, the function is said to have "default parameter values."\nFor a parameter with a default value, the corresponding argument may\nbe omitted from a call, in which case the parameter\'s default value is\nsubstituted. If a parameter has a default value, all following\nparameters up until the "``*``" must also have a default value ---\nthis is a syntactic restriction that is not expressed by the grammar.\n\n**Default parameter values are evaluated when the function definition\nis executed.** This means that the expression is evaluated once, when\nthe function is defined, and that that same "pre-computed" value is\nused for each call. This is especially important to understand when a\ndefault parameter is a mutable object, such as a list or a dictionary:\nif the function modifies the object (e.g. by appending an item to a\nlist), the default value is in effect modified. This is generally not\nwhat was intended. A way around this is to use ``None`` as the\ndefault, and explicitly test for it in the body of the function, e.g.:\n\n def whats_on_the_telly(penguin=None):\n if penguin is None:\n penguin = []\n penguin.append("property of the zoo")\n return penguin\n\nFunction call semantics are described in more detail in section\n*Calls*. A function call always assigns values to all parameters\nmentioned in the parameter list, either from position arguments, from\nkeyword arguments, or from default values. If the form\n"``*identifier``" is present, it is initialized to a tuple receiving\nany excess positional parameters, defaulting to the empty tuple. If\nthe form "``**identifier``" is present, it is initialized to a new\ndictionary receiving any excess keyword arguments, defaulting to a new\nempty dictionary. Parameters after "``*``" or "``*identifier``" are\nkeyword-only parameters and may only be passed used keyword arguments.\n\nParameters may have annotations of the form "``: expression``"\nfollowing the parameter name. Any parameter may have an annotation\neven those of the form ``*identifier`` or ``**identifier``. Functions\nmay have "return" annotation of the form "``-> expression``" after the\nparameter list. These annotations can be any valid Python expression\nand are evaluated when the function definition is executed.\nAnnotations may be evaluated in a different order than they appear in\nthe source code. The presence of annotations does not change the\nsemantics of a function. The annotation values are available as\nvalues of a dictionary keyed by the parameters\' names in the\n``__annotations__`` attribute of the function object.\n\nIt is also possible to create anonymous functions (functions not bound\nto a name), for immediate use in expressions. This uses lambda forms,\ndescribed in section *Lambdas*. Note that the lambda form is merely a\nshorthand for a simplified function definition; a function defined in\na "``def``" statement can be passed around or assigned to another name\njust like a function defined by a lambda form. The "``def``" form is\nactually more powerful since it allows the execution of multiple\nstatements and annotations.\n\n**Programmer\'s note:** Functions are first-class objects. A "``def``"\nform executed inside a function definition defines a local function\nthat can be returned or passed around. Free variables used in the\nnested function can access the local variables of the function\ncontaining the def. See section *Naming and binding* for details.\n\n\nClass definitions\n=================\n\nA class definition defines a class object (see section *The standard\ntype hierarchy*):\n\n classdef ::= [decorators] "class" classname [inheritance] ":" suite\n inheritance ::= "(" [expression_list] ")"\n classname ::= identifier\n\nA class definition is an executable statement. It first evaluates the\ninheritance list, if present. Each item in the inheritance list\nshould evaluate to a class object or class type which allows\nsubclassing. The class\'s suite is then executed in a new execution\nframe (see section *Naming and binding*), using a newly created local\nnamespace and the original global namespace. (Usually, the suite\ncontains only function definitions.) When the class\'s suite finishes\nexecution, its execution frame is discarded but its local namespace is\nsaved. [4] A class object is then created using the inheritance list\nfor the base classes and the saved local namespace for the attribute\ndictionary. The class name is bound to this class object in the\noriginal local namespace.\n\nClasses can also be decorated; as with functions,\n\n @f1(arg)\n @f2\n class Foo: pass\n\nis equivalent to\n\n class Foo: pass\n Foo = f1(arg)(f2(Foo))\n\n**Programmer\'s note:** Variables defined in the class definition are\nclass variables; they are shared by instances. Instance variables can\nbe set in a method with ``self.name = value``. Both class and\ninstance variables are accessible through the notation\n"``self.name``", and an instance variable hides a class variable with\nthe same name when accessed in this way. Class variables can be used\nas defaults for instance variables, but using mutable values there can\nlead to unexpected results. Descriptors can be used to create\ninstance variables with different implementation details.\n\nSee also:\n\n **PEP 3129** - Class Decorators\n\nClass definitions, like function definitions, may be wrapped by one or\nmore *decorator* expressions. The evaluation rules for the decorator\nexpressions are the same as for functions. The result must be a class\nobject, which is then bound to the class name.\n\n-[ Footnotes ]-\n\n[1] The exception is propagated to the invocation stack only if there\n is no ``finally`` clause that negates the exception.\n\n[2] Currently, control "flows off the end" except in the case of an\n exception or the execution of a ``return``, ``continue``, or\n ``break`` statement.\n\n[3] A string literal appearing as the first statement in the function\n body is transformed into the function\'s ``__doc__`` attribute and\n therefore the function\'s *docstring*.\n\n[4] A string literal appearing as the first statement in the class\n body is transformed into the namespace\'s ``__doc__`` item and\n therefore the class\'s *docstring*.\n', + 'compound': '\nCompound statements\n*******************\n\nCompound statements contain (groups of) other statements; they affect\nor control the execution of those other statements in some way. In\ngeneral, compound statements span multiple lines, although in simple\nincarnations a whole compound statement may be contained in one line.\n\nThe ``if``, ``while`` and ``for`` statements implement traditional\ncontrol flow constructs. ``try`` specifies exception handlers and/or\ncleanup code for a group of statements, while the ``with`` statement\nallows the execution of initialization and finalization code around a\nblock of code. Function and class definitions are also syntactically\ncompound statements.\n\nCompound statements consist of one or more \'clauses.\' A clause\nconsists of a header and a \'suite.\' The clause headers of a\nparticular compound statement are all at the same indentation level.\nEach clause header begins with a uniquely identifying keyword and ends\nwith a colon. A suite is a group of statements controlled by a\nclause. A suite can be one or more semicolon-separated simple\nstatements on the same line as the header, following the header\'s\ncolon, or it can be one or more indented statements on subsequent\nlines. Only the latter form of suite can contain nested compound\nstatements; the following is illegal, mostly because it wouldn\'t be\nclear to which ``if`` clause a following ``else`` clause would belong:\n\n if test1: if test2: print(x)\n\nAlso note that the semicolon binds tighter than the colon in this\ncontext, so that in the following example, either all or none of the\n``print()`` calls are executed:\n\n if x < y < z: print(x); print(y); print(z)\n\nSummarizing:\n\n compound_stmt ::= if_stmt\n | while_stmt\n | for_stmt\n | try_stmt\n | with_stmt\n | funcdef\n | classdef\n suite ::= stmt_list NEWLINE | NEWLINE INDENT statement+ DEDENT\n statement ::= stmt_list NEWLINE | compound_stmt\n stmt_list ::= simple_stmt (";" simple_stmt)* [";"]\n\nNote that statements always end in a ``NEWLINE`` possibly followed by\na ``DEDENT``. Also note that optional continuation clauses always\nbegin with a keyword that cannot start a statement, thus there are no\nambiguities (the \'dangling ``else``\' problem is solved in Python by\nrequiring nested ``if`` statements to be indented).\n\nThe formatting of the grammar rules in the following sections places\neach clause on a separate line for clarity.\n\n\nThe ``if`` statement\n====================\n\nThe ``if`` statement is used for conditional execution:\n\n if_stmt ::= "if" expression ":" suite\n ( "elif" expression ":" suite )*\n ["else" ":" suite]\n\nIt selects exactly one of the suites by evaluating the expressions one\nby one until one is found to be true (see section *Boolean operations*\nfor the definition of true and false); then that suite is executed\n(and no other part of the ``if`` statement is executed or evaluated).\nIf all expressions are false, the suite of the ``else`` clause, if\npresent, is executed.\n\n\nThe ``while`` statement\n=======================\n\nThe ``while`` statement is used for repeated execution as long as an\nexpression is true:\n\n while_stmt ::= "while" expression ":" suite\n ["else" ":" suite]\n\nThis repeatedly tests the expression and, if it is true, executes the\nfirst suite; if the expression is false (which may be the first time\nit is tested) the suite of the ``else`` clause, if present, is\nexecuted and the loop terminates.\n\nA ``break`` statement executed in the first suite terminates the loop\nwithout executing the ``else`` clause\'s suite. A ``continue``\nstatement executed in the first suite skips the rest of the suite and\ngoes back to testing the expression.\n\n\nThe ``for`` statement\n=====================\n\nThe ``for`` statement is used to iterate over the elements of a\nsequence (such as a string, tuple or list) or other iterable object:\n\n for_stmt ::= "for" target_list "in" expression_list ":" suite\n ["else" ":" suite]\n\nThe expression list is evaluated once; it should yield an iterable\nobject. An iterator is created for the result of the\n``expression_list``. The suite is then executed once for each item\nprovided by the iterator, in the order of ascending indices. Each\nitem in turn is assigned to the target list using the standard rules\nfor assignments (see *Assignment statements*), and then the suite is\nexecuted. When the items are exhausted (which is immediately when the\nsequence is empty or an iterator raises a ``StopIteration``\nexception), the suite in the ``else`` clause, if present, is executed,\nand the loop terminates.\n\nA ``break`` statement executed in the first suite terminates the loop\nwithout executing the ``else`` clause\'s suite. A ``continue``\nstatement executed in the first suite skips the rest of the suite and\ncontinues with the next item, or with the ``else`` clause if there was\nno next item.\n\nThe suite may assign to the variable(s) in the target list; this does\nnot affect the next item assigned to it.\n\nNames in the target list are not deleted when the loop is finished,\nbut if the sequence is empty, it will not have been assigned to at all\nby the loop. Hint: the built-in function ``range()`` returns an\niterator of integers suitable to emulate the effect of Pascal\'s ``for\ni := a to b do``; e.g., ``list(range(3))`` returns the list ``[0, 1,\n2]``.\n\nNote: There is a subtlety when the sequence is being modified by the loop\n (this can only occur for mutable sequences, i.e. lists). An\n internal counter is used to keep track of which item is used next,\n and this is incremented on each iteration. When this counter has\n reached the length of the sequence the loop terminates. This means\n that if the suite deletes the current (or a previous) item from the\n sequence, the next item will be skipped (since it gets the index of\n the current item which has already been treated). Likewise, if the\n suite inserts an item in the sequence before the current item, the\n current item will be treated again the next time through the loop.\n This can lead to nasty bugs that can be avoided by making a\n temporary copy using a slice of the whole sequence, e.g.,\n\n for x in a[:]:\n if x < 0: a.remove(x)\n\n\nThe ``try`` statement\n=====================\n\nThe ``try`` statement specifies exception handlers and/or cleanup code\nfor a group of statements:\n\n try_stmt ::= try1_stmt | try2_stmt\n try1_stmt ::= "try" ":" suite\n ("except" [expression ["as" target]] ":" suite)+\n ["else" ":" suite]\n ["finally" ":" suite]\n try2_stmt ::= "try" ":" suite\n "finally" ":" suite\n\nThe ``except`` clause(s) specify one or more exception handlers. When\nno exception occurs in the ``try`` clause, no exception handler is\nexecuted. When an exception occurs in the ``try`` suite, a search for\nan exception handler is started. This search inspects the except\nclauses in turn until one is found that matches the exception. An\nexpression-less except clause, if present, must be last; it matches\nany exception. For an except clause with an expression, that\nexpression is evaluated, and the clause matches the exception if the\nresulting object is "compatible" with the exception. An object is\ncompatible with an exception if it is the class or a base class of the\nexception object or a tuple containing an item compatible with the\nexception.\n\nIf no except clause matches the exception, the search for an exception\nhandler continues in the surrounding code and on the invocation stack.\n[1]\n\nIf the evaluation of an expression in the header of an except clause\nraises an exception, the original search for a handler is canceled and\na search starts for the new exception in the surrounding code and on\nthe call stack (it is treated as if the entire ``try`` statement\nraised the exception).\n\nWhen a matching except clause is found, the exception is assigned to\nthe target specified after the ``as`` keyword in that except clause,\nif present, and the except clause\'s suite is executed. All except\nclauses must have an executable block. When the end of this block is\nreached, execution continues normally after the entire try statement.\n(This means that if two nested handlers exist for the same exception,\nand the exception occurs in the try clause of the inner handler, the\nouter handler will not handle the exception.)\n\nWhen an exception has been assigned using ``as target``, it is cleared\nat the end of the except clause. This is as if\n\n except E as N:\n foo\n\nwas translated to\n\n except E as N:\n try:\n foo\n finally:\n N = None\n del N\n\nThat means that you have to assign the exception to a different name\nif you want to be able to refer to it after the except clause. The\nreason for this is that with the traceback attached to them,\nexceptions will form a reference cycle with the stack frame, keeping\nall locals in that frame alive until the next garbage collection\noccurs.\n\nBefore an except clause\'s suite is executed, details about the\nexception are stored in the ``sys`` module and can be access via\n``sys.exc_info()``. ``sys.exc_info()`` returns a 3-tuple consisting\nof: ``exc_type``, the exception class; ``exc_value``, the exception\ninstance; ``exc_traceback``, a traceback object (see section *The\nstandard type hierarchy*) identifying the point in the program where\nthe exception occurred. ``sys.exc_info()`` values are restored to\ntheir previous values (before the call) when returning from a function\nthat handled an exception.\n\nThe optional ``else`` clause is executed if and when control flows off\nthe end of the ``try`` clause. [2] Exceptions in the ``else`` clause\nare not handled by the preceding ``except`` clauses.\n\nIf ``finally`` is present, it specifies a \'cleanup\' handler. The\n``try`` clause is executed, including any ``except`` and ``else``\nclauses. If an exception occurs in any of the clauses and is not\nhandled, the exception is temporarily saved. The ``finally`` clause is\nexecuted. If there is a saved exception, it is re-raised at the end\nof the ``finally`` clause. If the ``finally`` clause raises another\nexception or executes a ``return`` or ``break`` statement, the saved\nexception is lost. The exception information is not available to the\nprogram during execution of the ``finally`` clause.\n\nWhen a ``return``, ``break`` or ``continue`` statement is executed in\nthe ``try`` suite of a ``try``...``finally`` statement, the\n``finally`` clause is also executed \'on the way out.\' A ``continue``\nstatement is illegal in the ``finally`` clause. (The reason is a\nproblem with the current implementation --- this restriction may be\nlifted in the future).\n\nAdditional information on exceptions can be found in section\n*Exceptions*, and information on using the ``raise`` statement to\ngenerate exceptions may be found in section *The raise statement*.\n\n\nThe ``with`` statement\n======================\n\nThe ``with`` statement is used to wrap the execution of a block with\nmethods defined by a context manager (see section *With Statement\nContext Managers*). This allows common\n``try``...``except``...``finally`` usage patterns to be encapsulated\nfor convenient reuse.\n\n with_stmt ::= "with" with_item ("," with_item)* ":" suite\n with_item ::= expression ["as" target]\n\nThe execution of the ``with`` statement with one "item" proceeds as\nfollows:\n\n1. The context expression is evaluated to obtain a context manager.\n\n2. The context manager\'s ``__enter__()`` method is invoked.\n\n3. If a target was included in the ``with`` statement, the return\n value from ``__enter__()`` is assigned to it.\n\n Note: The ``with`` statement guarantees that if the ``__enter__()``\n method returns without an error, then ``__exit__()`` will always\n be called. Thus, if an error occurs during the assignment to the\n target list, it will be treated the same as an error occurring\n within the suite would be. See step 5 below.\n\n4. The suite is executed.\n\n5. The context manager\'s ``__exit__()`` method is invoked. If an\n exception caused the suite to be exited, its type, value, and\n traceback are passed as arguments to ``__exit__()``. Otherwise,\n three ``None`` arguments are supplied.\n\n If the suite was exited due to an exception, and the return value\n from the ``__exit__()`` method was false, the exception is\n reraised. If the return value was true, the exception is\n suppressed, and execution continues with the statement following\n the ``with`` statement.\n\n If the suite was exited for any reason other than an exception, the\n return value from ``__exit__()`` is ignored, and execution proceeds\n at the normal location for the kind of exit that was taken.\n\nWith more than one item, the context managers are processed as if\nmultiple ``with`` statements were nested:\n\n with A() as a, B() as b:\n suite\n\nis equivalent to\n\n with A() as a:\n with B() as b:\n suite\n\nChanged in version 3.1: Support for multiple context expressions.\n\nSee also:\n\n **PEP 0343** - The "with" statement\n The specification, background, and examples for the Python\n ``with`` statement.\n\n\nFunction definitions\n====================\n\nA function definition defines a user-defined function object (see\nsection *The standard type hierarchy*):\n\n funcdef ::= [decorators] "def" funcname "(" [parameter_list] ")" ["->" expression] ":" suite\n decorators ::= decorator+\n decorator ::= "@" dotted_name ["(" [argument_list [","]] ")"] NEWLINE\n dotted_name ::= identifier ("." identifier)*\n parameter_list ::= (defparameter ",")*\n ( "*" [parameter] ("," defparameter)*\n [, "**" parameter]\n | "**" parameter\n | defparameter [","] )\n parameter ::= identifier [":" expression]\n defparameter ::= parameter ["=" expression]\n funcname ::= identifier\n\nA function definition is an executable statement. Its execution binds\nthe function name in the current local namespace to a function object\n(a wrapper around the executable code for the function). This\nfunction object contains a reference to the current global namespace\nas the global namespace to be used when the function is called.\n\nThe function definition does not execute the function body; this gets\nexecuted only when the function is called. [3]\n\nA function definition may be wrapped by one or more *decorator*\nexpressions. Decorator expressions are evaluated when the function is\ndefined, in the scope that contains the function definition. The\nresult must be a callable, which is invoked with the function object\nas the only argument. The returned value is bound to the function name\ninstead of the function object. Multiple decorators are applied in\nnested fashion. For example, the following code\n\n @f1(arg)\n @f2\n def func(): pass\n\nis equivalent to\n\n def func(): pass\n func = f1(arg)(f2(func))\n\nWhen one or more parameters have the form *parameter* ``=``\n*expression*, the function is said to have "default parameter values."\nFor a parameter with a default value, the corresponding argument may\nbe omitted from a call, in which case the parameter\'s default value is\nsubstituted. If a parameter has a default value, all following\nparameters up until the "``*``" must also have a default value ---\nthis is a syntactic restriction that is not expressed by the grammar.\n\n**Default parameter values are evaluated when the function definition\nis executed.** This means that the expression is evaluated once, when\nthe function is defined, and that that same "pre-computed" value is\nused for each call. This is especially important to understand when a\ndefault parameter is a mutable object, such as a list or a dictionary:\nif the function modifies the object (e.g. by appending an item to a\nlist), the default value is in effect modified. This is generally not\nwhat was intended. A way around this is to use ``None`` as the\ndefault, and explicitly test for it in the body of the function, e.g.:\n\n def whats_on_the_telly(penguin=None):\n if penguin is None:\n penguin = []\n penguin.append("property of the zoo")\n return penguin\n\nFunction call semantics are described in more detail in section\n*Calls*. A function call always assigns values to all parameters\nmentioned in the parameter list, either from position arguments, from\nkeyword arguments, or from default values. If the form\n"``*identifier``" is present, it is initialized to a tuple receiving\nany excess positional parameters, defaulting to the empty tuple. If\nthe form "``**identifier``" is present, it is initialized to a new\ndictionary receiving any excess keyword arguments, defaulting to a new\nempty dictionary. Parameters after "``*``" or "``*identifier``" are\nkeyword-only parameters and may only be passed used keyword arguments.\n\nParameters may have annotations of the form "``: expression``"\nfollowing the parameter name. Any parameter may have an annotation\neven those of the form ``*identifier`` or ``**identifier``. Functions\nmay have "return" annotation of the form "``-> expression``" after the\nparameter list. These annotations can be any valid Python expression\nand are evaluated when the function definition is executed.\nAnnotations may be evaluated in a different order than they appear in\nthe source code. The presence of annotations does not change the\nsemantics of a function. The annotation values are available as\nvalues of a dictionary keyed by the parameters\' names in the\n``__annotations__`` attribute of the function object.\n\nIt is also possible to create anonymous functions (functions not bound\nto a name), for immediate use in expressions. This uses lambda forms,\ndescribed in section *Lambdas*. Note that the lambda form is merely a\nshorthand for a simplified function definition; a function defined in\na "``def``" statement can be passed around or assigned to another name\njust like a function defined by a lambda form. The "``def``" form is\nactually more powerful since it allows the execution of multiple\nstatements and annotations.\n\n**Programmer\'s note:** Functions are first-class objects. A "``def``"\nform executed inside a function definition defines a local function\nthat can be returned or passed around. Free variables used in the\nnested function can access the local variables of the function\ncontaining the def. See section *Naming and binding* for details.\n\n\nClass definitions\n=================\n\nA class definition defines a class object (see section *The standard\ntype hierarchy*):\n\n classdef ::= [decorators] "class" classname [inheritance] ":" suite\n inheritance ::= "(" [expression_list] ")"\n classname ::= identifier\n\nA class definition is an executable statement. It first evaluates the\ninheritance list, if present. Each item in the inheritance list\nshould evaluate to a class object or class type which allows\nsubclassing. The class\'s suite is then executed in a new execution\nframe (see section *Naming and binding*), using a newly created local\nnamespace and the original global namespace. (Usually, the suite\ncontains only function definitions.) When the class\'s suite finishes\nexecution, its execution frame is discarded but its local namespace is\nsaved. [4] A class object is then created using the inheritance list\nfor the base classes and the saved local namespace for the attribute\ndictionary. The class name is bound to this class object in the\noriginal local namespace.\n\nClasses can also be decorated; as with functions,\n\n @f1(arg)\n @f2\n class Foo: pass\n\nis equivalent to\n\n class Foo: pass\n Foo = f1(arg)(f2(Foo))\n\n**Programmer\'s note:** Variables defined in the class definition are\nclass variables; they are shared by instances. Instance variables can\nbe set in a method with ``self.name = value``. Both class and\ninstance variables are accessible through the notation\n"``self.name``", and an instance variable hides a class variable with\nthe same name when accessed in this way. Class variables can be used\nas defaults for instance variables, but using mutable values there can\nlead to unexpected results. Descriptors can be used to create\ninstance variables with different implementation details.\n\nSee also:\n\n **PEP 3129** - Class Decorators\n\nClass definitions, like function definitions, may be wrapped by one or\nmore *decorator* expressions. The evaluation rules for the decorator\nexpressions are the same as for functions. The result must be a class\nobject, which is then bound to the class name.\n\n-[ Footnotes ]-\n\n[1] The exception is propagated to the invocation stack only if there\n is no ``finally`` clause that negates the exception.\n\n[2] Currently, control "flows off the end" except in the case of an\n exception or the execution of a ``return``, ``continue``, or\n ``break`` statement.\n\n[3] A string literal appearing as the first statement in the function\n body is transformed into the function\'s ``__doc__`` attribute and\n therefore the function\'s *docstring*.\n\n[4] A string literal appearing as the first statement in the class\n body is transformed into the namespace\'s ``__doc__`` item and\n therefore the class\'s *docstring*.\n', 'context-managers': '\nWith Statement Context Managers\n*******************************\n\nA *context manager* is an object that defines the runtime context to\nbe established when executing a ``with`` statement. The context\nmanager handles the entry into, and the exit from, the desired runtime\ncontext for the execution of the block of code. Context managers are\nnormally invoked using the ``with`` statement (described in section\n*The with statement*), but can also be used by directly invoking their\nmethods.\n\nTypical uses of context managers include saving and restoring various\nkinds of global state, locking and unlocking resources, closing opened\nfiles, etc.\n\nFor more information on context managers, see *Context Manager Types*.\n\nobject.__enter__(self)\n\n Enter the runtime context related to this object. The ``with``\n statement will bind this method\'s return value to the target(s)\n specified in the ``as`` clause of the statement, if any.\n\nobject.__exit__(self, exc_type, exc_value, traceback)\n\n Exit the runtime context related to this object. The parameters\n describe the exception that caused the context to be exited. If the\n context was exited without an exception, all three arguments will\n be ``None``.\n\n If an exception is supplied, and the method wishes to suppress the\n exception (i.e., prevent it from being propagated), it should\n return a true value. Otherwise, the exception will be processed\n normally upon exit from this method.\n\n Note that ``__exit__()`` methods should not reraise the passed-in\n exception; this is the caller\'s responsibility.\n\nSee also:\n\n **PEP 0343** - The "with" statement\n The specification, background, and examples for the Python\n ``with`` statement.\n', 'continue': '\nThe ``continue`` statement\n**************************\n\n continue_stmt ::= "continue"\n\n``continue`` may only occur syntactically nested in a ``for`` or\n``while`` loop, but not nested in a function or class definition or\n``finally`` clause within that loop. It continues with the next cycle\nof the nearest enclosing loop.\n\nWhen ``continue`` passes control out of a ``try`` statement with a\n``finally`` clause, that ``finally`` clause is executed before really\nstarting the next loop cycle.\n', 'conversions': '\nArithmetic conversions\n**********************\n\nWhen a description of an arithmetic operator below uses the phrase\n"the numeric arguments are converted to a common type," this means\nthat the operator implementation for built-in types works that way:\n\n* If either argument is a complex number, the other is converted to\n complex;\n\n* otherwise, if either argument is a floating point number, the other\n is converted to floating point;\n\n* otherwise, both must be integers and no conversion is necessary.\n\nSome additional rules apply for certain operators (e.g., a string left\nargument to the \'%\' operator). Extensions must define their own\nconversion behavior.\n', @@ -33,7 +33,7 @@ 'execmodel': '\nExecution model\n***************\n\n\nNaming and binding\n==================\n\n*Names* refer to objects. Names are introduced by name binding\noperations. Each occurrence of a name in the program text refers to\nthe *binding* of that name established in the innermost function block\ncontaining the use.\n\nA *block* is a piece of Python program text that is executed as a\nunit. The following are blocks: a module, a function body, and a class\ndefinition. Each command typed interactively is a block. A script\nfile (a file given as standard input to the interpreter or specified\non the interpreter command line the first argument) is a code block.\nA script command (a command specified on the interpreter command line\nwith the \'**-c**\' option) is a code block. The string argument passed\nto the built-in functions ``eval()`` and ``exec()`` is a code block.\n\nA code block is executed in an *execution frame*. A frame contains\nsome administrative information (used for debugging) and determines\nwhere and how execution continues after the code block\'s execution has\ncompleted.\n\nA *scope* defines the visibility of a name within a block. If a local\nvariable is defined in a block, its scope includes that block. If the\ndefinition occurs in a function block, the scope extends to any blocks\ncontained within the defining one, unless a contained block introduces\na different binding for the name. The scope of names defined in a\nclass block is limited to the class block; it does not extend to the\ncode blocks of methods -- this includes comprehensions and generator\nexpressions since they are implemented using a function scope. This\nmeans that the following will fail:\n\n class A:\n a = 42\n b = list(a + i for i in range(10))\n\nWhen a name is used in a code block, it is resolved using the nearest\nenclosing scope. The set of all such scopes visible to a code block\nis called the block\'s *environment*.\n\nIf a name is bound in a block, it is a local variable of that block,\nunless declared as ``nonlocal``. If a name is bound at the module\nlevel, it is a global variable. (The variables of the module code\nblock are local and global.) If a variable is used in a code block\nbut not defined there, it is a *free variable*.\n\nWhen a name is not found at all, a ``NameError`` exception is raised.\nIf the name refers to a local variable that has not been bound, a\n``UnboundLocalError`` exception is raised. ``UnboundLocalError`` is a\nsubclass of ``NameError``.\n\nThe following constructs bind names: formal parameters to functions,\n``import`` statements, class and function definitions (these bind the\nclass or function name in the defining block), and targets that are\nidentifiers if occurring in an assignment, ``for`` loop header, or\nafter ``as`` in a ``with`` statement or :keyword.`except` clause. The\n``import`` statement of the form ``from ... import *`` binds all names\ndefined in the imported module, except those beginning with an\nunderscore. This form may only be used at the module level.\n\nA target occurring in a ``del`` statement is also considered bound for\nthis purpose (though the actual semantics are to unbind the name). It\nis illegal to unbind a name that is referenced by an enclosing scope;\nthe compiler will report a ``SyntaxError``.\n\nEach assignment or import statement occurs within a block defined by a\nclass or function definition or at the module level (the top-level\ncode block).\n\nIf a name binding operation occurs anywhere within a code block, all\nuses of the name within the block are treated as references to the\ncurrent block. This can lead to errors when a name is used within a\nblock before it is bound. This rule is subtle. Python lacks\ndeclarations and allows name binding operations to occur anywhere\nwithin a code block. The local variables of a code block can be\ndetermined by scanning the entire text of the block for name binding\noperations.\n\nIf the ``global`` statement occurs within a block, all uses of the\nname specified in the statement refer to the binding of that name in\nthe top-level namespace. Names are resolved in the top-level\nnamespace by searching the global namespace, i.e. the namespace of the\nmodule containing the code block, and the builtin namespace, the\nnamespace of the module ``builtins``. The global namespace is\nsearched first. If the name is not found there, the builtin namespace\nis searched. The global statement must precede all uses of the name.\n\nThe built-in namespace associated with the execution of a code block\nis actually found by looking up the name ``__builtins__`` in its\nglobal namespace; this should be a dictionary or a module (in the\nlatter case the module\'s dictionary is used). By default, when in the\n``__main__`` module, ``__builtins__`` is the built-in module\n``builtins``; when in any other module, ``__builtins__`` is an alias\nfor the dictionary of the ``builtins`` module itself.\n``__builtins__`` can be set to a user-created dictionary to create a\nweak form of restricted execution.\n\nNote: Users should not touch ``__builtins__``; it is strictly an\n implementation detail. Users wanting to override values in the\n built-in namespace should ``import`` the ``builtins`` module and\n modify its attributes appropriately.\n\nThe namespace for a module is automatically created the first time a\nmodule is imported. The main module for a script is always called\n``__main__``.\n\nThe global statement has the same scope as a name binding operation in\nthe same block. If the nearest enclosing scope for a free variable\ncontains a global statement, the free variable is treated as a global.\n\nA class definition is an executable statement that may use and define\nnames. These references follow the normal rules for name resolution.\nThe namespace of the class definition becomes the attribute dictionary\nof the class. Names defined at the class scope are not visible in\nmethods.\n\n\nInteraction with dynamic features\n---------------------------------\n\nThere are several cases where Python statements are illegal when used\nin conjunction with nested scopes that contain free variables.\n\nIf a variable is referenced in an enclosing scope, it is illegal to\ndelete the name. An error will be reported at compile time.\n\nIf the wild card form of import --- ``import *`` --- is used in a\nfunction and the function contains or is a nested block with free\nvariables, the compiler will raise a ``SyntaxError``.\n\nThe ``eval()`` and ``exec()`` functions do not have access to the full\nenvironment for resolving names. Names may be resolved in the local\nand global namespaces of the caller. Free variables are not resolved\nin the nearest enclosing namespace, but in the global namespace. [1]\nThe ``exec()`` and ``eval()`` functions have optional arguments to\noverride the global and local namespace. If only one namespace is\nspecified, it is used for both.\n\n\nExceptions\n==========\n\nExceptions are a means of breaking out of the normal flow of control\nof a code block in order to handle errors or other exceptional\nconditions. An exception is *raised* at the point where the error is\ndetected; it may be *handled* by the surrounding code block or by any\ncode block that directly or indirectly invoked the code block where\nthe error occurred.\n\nThe Python interpreter raises an exception when it detects a run-time\nerror (such as division by zero). A Python program can also\nexplicitly raise an exception with the ``raise`` statement. Exception\nhandlers are specified with the ``try`` ... ``except`` statement. The\n``finally`` clause of such a statement can be used to specify cleanup\ncode which does not handle the exception, but is executed whether an\nexception occurred or not in the preceding code.\n\nPython uses the "termination" model of error handling: an exception\nhandler can find out what happened and continue execution at an outer\nlevel, but it cannot repair the cause of the error and retry the\nfailing operation (except by re-entering the offending piece of code\nfrom the top).\n\nWhen an exception is not handled at all, the interpreter terminates\nexecution of the program, or returns to its interactive main loop. In\neither case, it prints a stack backtrace, except when the exception is\n``SystemExit``.\n\nExceptions are identified by class instances. The ``except`` clause\nis selected depending on the class of the instance: it must reference\nthe class of the instance or a base class thereof. The instance can\nbe received by the handler and can carry additional information about\nthe exceptional condition.\n\nNote: Exception messages are not part of the Python API. Their contents\n may change from one version of Python to the next without warning\n and should not be relied on by code which will run under multiple\n versions of the interpreter.\n\nSee also the description of the ``try`` statement in section *The try\nstatement* and ``raise`` statement in section *The raise statement*.\n\n-[ Footnotes ]-\n\n[1] This limitation occurs because the code that is executed by these\n operations is not available at the time the module is compiled.\n', 'exprlists': '\nExpression lists\n****************\n\n expression_list ::= expression ( "," expression )* [","]\n\nAn expression list containing at least one comma yields a tuple. The\nlength of the tuple is the number of expressions in the list. The\nexpressions are evaluated from left to right.\n\nThe trailing comma is required only to create a single tuple (a.k.a. a\n*singleton*); it is optional in all other cases. A single expression\nwithout a trailing comma doesn\'t create a tuple, but rather yields the\nvalue of that expression. (To create an empty tuple, use an empty pair\nof parentheses: ``()``.)\n', 'floating': '\nFloating point literals\n***********************\n\nFloating point literals are described by the following lexical\ndefinitions:\n\n floatnumber ::= pointfloat | exponentfloat\n pointfloat ::= [intpart] fraction | intpart "."\n exponentfloat ::= (intpart | pointfloat) exponent\n intpart ::= digit+\n fraction ::= "." digit+\n exponent ::= ("e" | "E") ["+" | "-"] digit+\n\nNote that the integer and exponent parts are always interpreted using\nradix 10. For example, ``077e010`` is legal, and denotes the same\nnumber as ``77e10``. The allowed range of floating point literals is\nimplementation-dependent. Some examples of floating point literals:\n\n 3.14 10. .001 1e100 3.14e-10 0e0\n\nNote that numeric literals do not include a sign; a phrase like ``-1``\nis actually an expression composed of the unary operator ``-`` and the\nliteral ``1``.\n', - 'for': '\nThe ``for`` statement\n*********************\n\nThe ``for`` statement is used to iterate over the elements of a\nsequence (such as a string, tuple or list) or other iterable object:\n\n for_stmt ::= "for" target_list "in" expression_list ":" suite\n ["else" ":" suite]\n\nThe expression list is evaluated once; it should yield an iterable\nobject. An iterator is created for the result of the\n``expression_list``. The suite is then executed once for each item\nprovided by the iterator, in the order of ascending indices. Each\nitem in turn is assigned to the target list using the standard rules\nfor assignments (see *Assignment statements*), and then the suite is\nexecuted. When the items are exhausted (which is immediately when the\nsequence is empty or an iterator raises a ``StopIteration``\nexception), the suite in the ``else`` clause, if present, is executed,\nand the loop terminates.\n\nA ``break`` statement executed in the first suite terminates the loop\nwithout executing the ``else`` clause\'s suite. A ``continue``\nstatement executed in the first suite skips the rest of the suite and\ncontinues with the next item, or with the ``else`` clause if there was\nno next item.\n\nThe suite may assign to the variable(s) in the target list; this does\nnot affect the next item assigned to it.\n\nNames in the target list are not deleted when the loop is finished,\nbut if the sequence is empty, it will not have been assigned to at all\nby the loop. Hint: the built-in function ``range()`` returns an\niterator of integers suitable to emulate the effect of Pascal\'s ``for\ni := a to b do``; e.g., ``range(3)`` returns the list ``[0, 1, 2]``.\n\nNote: There is a subtlety when the sequence is being modified by the loop\n (this can only occur for mutable sequences, i.e. lists). An\n internal counter is used to keep track of which item is used next,\n and this is incremented on each iteration. When this counter has\n reached the length of the sequence the loop terminates. This means\n that if the suite deletes the current (or a previous) item from the\n sequence, the next item will be skipped (since it gets the index of\n the current item which has already been treated). Likewise, if the\n suite inserts an item in the sequence before the current item, the\n current item will be treated again the next time through the loop.\n This can lead to nasty bugs that can be avoided by making a\n temporary copy using a slice of the whole sequence, e.g.,\n\n for x in a[:]:\n if x < 0: a.remove(x)\n', + 'for': '\nThe ``for`` statement\n*********************\n\nThe ``for`` statement is used to iterate over the elements of a\nsequence (such as a string, tuple or list) or other iterable object:\n\n for_stmt ::= "for" target_list "in" expression_list ":" suite\n ["else" ":" suite]\n\nThe expression list is evaluated once; it should yield an iterable\nobject. An iterator is created for the result of the\n``expression_list``. The suite is then executed once for each item\nprovided by the iterator, in the order of ascending indices. Each\nitem in turn is assigned to the target list using the standard rules\nfor assignments (see *Assignment statements*), and then the suite is\nexecuted. When the items are exhausted (which is immediately when the\nsequence is empty or an iterator raises a ``StopIteration``\nexception), the suite in the ``else`` clause, if present, is executed,\nand the loop terminates.\n\nA ``break`` statement executed in the first suite terminates the loop\nwithout executing the ``else`` clause\'s suite. A ``continue``\nstatement executed in the first suite skips the rest of the suite and\ncontinues with the next item, or with the ``else`` clause if there was\nno next item.\n\nThe suite may assign to the variable(s) in the target list; this does\nnot affect the next item assigned to it.\n\nNames in the target list are not deleted when the loop is finished,\nbut if the sequence is empty, it will not have been assigned to at all\nby the loop. Hint: the built-in function ``range()`` returns an\niterator of integers suitable to emulate the effect of Pascal\'s ``for\ni := a to b do``; e.g., ``list(range(3))`` returns the list ``[0, 1,\n2]``.\n\nNote: There is a subtlety when the sequence is being modified by the loop\n (this can only occur for mutable sequences, i.e. lists). An\n internal counter is used to keep track of which item is used next,\n and this is incremented on each iteration. When this counter has\n reached the length of the sequence the loop terminates. This means\n that if the suite deletes the current (or a previous) item from the\n sequence, the next item will be skipped (since it gets the index of\n the current item which has already been treated). Likewise, if the\n suite inserts an item in the sequence before the current item, the\n current item will be treated again the next time through the loop.\n This can lead to nasty bugs that can be avoided by making a\n temporary copy using a slice of the whole sequence, e.g.,\n\n for x in a[:]:\n if x < 0: a.remove(x)\n', 'formatstrings': '\nFormat String Syntax\n********************\n\nThe ``str.format()`` method and the ``Formatter`` class share the same\nsyntax for format strings (although in the case of ``Formatter``,\nsubclasses can define their own format string syntax.)\n\nFormat strings contain "replacement fields" surrounded by curly braces\n``{}``. Anything that is not contained in braces is considered literal\ntext, which is copied unchanged to the output. If you need to include\na brace character in the literal text, it can be escaped by doubling:\n``{{`` and ``}}``.\n\nThe grammar for a replacement field is as follows:\n\n replacement_field ::= "{" field_name ["!" conversion] [":" format_spec] "}"\n field_name ::= arg_name ("." attribute_name | "[" element_index "]")*\n arg_name ::= (identifier | integer)?\n attribute_name ::= identifier\n element_index ::= integer\n conversion ::= "r" | "s" | "a"\n format_spec ::= \n\nIn less formal terms, the replacement field starts with a *field_name*\nthat specifies the object whose value is to be formatted and inserted\ninto the output instead of the replacement field. The *field_name* is\noptionally followed by a *conversion* field, which is preceded by an\nexclamation point ``\'!\'``, and a *format_spec*, which is preceded by a\ncolon ``\':\'``. These specify a non-default format for the replacement\nvalue.\n\nThe *field_name* itself begins with an *arg_name* that is either\neither a number or a keyword. If it\'s a number, it refers to a\npositional argument, and if it\'s a keyword, it refers to a named\nkeyword argument. If the numerical arg_names in a format string are\n0, 1, 2, ... in sequence, they can all be omitted (not just some) and\nthe numbers 0, 1, 2, ... will be automatically inserted in that order.\nThe *arg_name* can be followed by any number of index or attribute\nexpressions. An expression of the form ``\'.name\'`` selects the named\nattribute using ``getattr()``, while an expression of the form\n``\'[index]\'`` does an index lookup using ``__getitem__()``.\n\nSome simple format string examples:\n\n "First, thou shalt count to {0}" # References first positional argument\n "Bring me a {}" # Implicitly references the first positional argument\n "From {} to {}" # Same as "From {0] to {1}"\n "My quest is {name}" # References keyword argument \'name\'\n "Weight in tons {0.weight}" # \'weight\' attribute of first positional arg\n "Units destroyed: {players[0]}" # First element of keyword argument \'players\'.\n\nThe *conversion* field causes a type coercion before formatting.\nNormally, the job of formatting a value is done by the\n``__format__()`` method of the value itself. However, in some cases\nit is desirable to force a type to be formatted as a string,\noverriding its own definition of formatting. By converting the value\nto a string before calling ``__format__()``, the normal formatting\nlogic is bypassed.\n\nThree conversion flags are currently supported: ``\'!s\'`` which calls\n``str()`` on the value, ``\'!r\'`` which calls ``repr()`` and ``\'!a\'``\nwhich calls ``ascii()``.\n\nSome examples:\n\n "Harold\'s a clever {0!s}" # Calls str() on the argument first\n "Bring out the holy {name!r}" # Calls repr() on the argument first\n\nThe *format_spec* field contains a specification of how the value\nshould be presented, including such details as field width, alignment,\npadding, decimal precision and so on. Each value type can define it\'s\nown "formatting mini-language" or interpretation of the *format_spec*.\n\nMost built-in types support a common formatting mini-language, which\nis described in the next section.\n\nA *format_spec* field can also include nested replacement fields\nwithin it. These nested replacement fields can contain only a field\nname; conversion flags and format specifications are not allowed. The\nreplacement fields within the format_spec are substituted before the\n*format_spec* string is interpreted. This allows the formatting of a\nvalue to be dynamically specified.\n\nFor example, suppose you wanted to have a replacement field whose\nfield width is determined by another variable:\n\n "A man with two {0:{1}}".format("noses", 10)\n\nThis would first evaluate the inner replacement field, making the\nformat string effectively:\n\n "A man with two {0:10}"\n\nThen the outer replacement field would be evaluated, producing:\n\n "noses "\n\nWhich is substituted into the string, yielding:\n\n "A man with two noses "\n\n(The extra space is because we specified a field width of 10, and\nbecause left alignment is the default for strings.)\n\n\nFormat Specification Mini-Language\n==================================\n\n"Format specifications" are used within replacement fields contained\nwithin a format string to define how individual values are presented\n(see *Format String Syntax*.) They can also be passed directly to the\nbuiltin ``format()`` function. Each formattable type may define how\nthe format specification is to be interpreted.\n\nMost built-in types implement the following options for format\nspecifications, although some of the formatting options are only\nsupported by the numeric types.\n\nA general convention is that an empty format string (``""``) produces\nthe same result as if you had called ``str()`` on the value.\n\nThe general form of a *standard format specifier* is:\n\n format_spec ::= [[fill]align][sign][#][0][width][.precision][type]\n fill ::= \n align ::= "<" | ">" | "=" | "^"\n sign ::= "+" | "-" | " "\n width ::= integer\n precision ::= integer\n type ::= "b" | "c" | "d" | "e" | "E" | "f" | "F" | "g" | "G" | "n" | "o" | "x" | "X" | "%"\n\nThe *fill* character can be any character other than \'}\' (which\nsignifies the end of the field). The presence of a fill character is\nsignaled by the *next* character, which must be one of the alignment\noptions. If the second character of *format_spec* is not a valid\nalignment option, then it is assumed that both the fill character and\nthe alignment option are absent.\n\nThe meaning of the various alignment options is as follows:\n\n +-----------+------------------------------------------------------------+\n | Option | Meaning |\n +===========+============================================================+\n | ``\'<\'`` | Forces the field to be left-aligned within the available |\n | | space (This is the default.) |\n +-----------+------------------------------------------------------------+\n | ``\'>\'`` | Forces the field to be right-aligned within the available |\n | | space. |\n +-----------+------------------------------------------------------------+\n | ``\'=\'`` | Forces the padding to be placed after the sign (if any) |\n | | but before the digits. This is used for printing fields |\n | | in the form \'+000000120\'. This alignment option is only |\n | | valid for numeric types. |\n +-----------+------------------------------------------------------------+\n | ``\'^\'`` | Forces the field to be centered within the available |\n | | space. |\n +-----------+------------------------------------------------------------+\n\nNote that unless a minimum field width is defined, the field width\nwill always be the same size as the data to fill it, so that the\nalignment option has no meaning in this case.\n\nThe *sign* option is only valid for number types, and can be one of\nthe following:\n\n +-----------+------------------------------------------------------------+\n | Option | Meaning |\n +===========+============================================================+\n | ``\'+\'`` | indicates that a sign should be used for both positive as |\n | | well as negative numbers. |\n +-----------+------------------------------------------------------------+\n | ``\'-\'`` | indicates that a sign should be used only for negative |\n | | numbers (this is the default behavior). |\n +-----------+------------------------------------------------------------+\n | space | indicates that a leading space should be used on positive |\n | | numbers, and a minus sign on negative numbers. |\n +-----------+------------------------------------------------------------+\n\nThe ``\'#\'`` option is only valid for integers, and only for binary,\noctal, or hexadecimal output. If present, it specifies that the\noutput will be prefixed by ``\'0b\'``, ``\'0o\'``, or ``\'0x\'``,\nrespectively.\n\n*width* is a decimal integer defining the minimum field width. If not\nspecified, then the field width will be determined by the content.\n\nIf the *width* field is preceded by a zero (``\'0\'``) character, this\nenables zero-padding. This is equivalent to an *alignment* type of\n``\'=\'`` and a *fill* character of ``\'0\'``.\n\nThe *precision* is a decimal number indicating how many digits should\nbe displayed after the decimal point for a floating point value\nformatted with ``\'f\'`` and ``\'F\'``, or before and after the decimal\npoint for a floating point value formatted with ``\'g\'`` or ``\'G\'``.\nFor non-number types the field indicates the maximum field size - in\nother words, how many characters will be used from the field content.\nThe *precision* is not allowed for integer values.\n\nFinally, the *type* determines how the data should be presented.\n\nThe available integer presentation types are:\n\n +-----------+------------------------------------------------------------+\n | Type | Meaning |\n +===========+============================================================+\n | ``\'b\'`` | Binary format. Outputs the number in base 2. |\n +-----------+------------------------------------------------------------+\n | ``\'c\'`` | Character. Converts the integer to the corresponding |\n | | unicode character before printing. |\n +-----------+------------------------------------------------------------+\n | ``\'d\'`` | Decimal Integer. Outputs the number in base 10. |\n +-----------+------------------------------------------------------------+\n | ``\'o\'`` | Octal format. Outputs the number in base 8. |\n +-----------+------------------------------------------------------------+\n | ``\'x\'`` | Hex format. Outputs the number in base 16, using lower- |\n | | case letters for the digits above 9. |\n +-----------+------------------------------------------------------------+\n | ``\'X\'`` | Hex format. Outputs the number in base 16, using upper- |\n | | case letters for the digits above 9. |\n +-----------+------------------------------------------------------------+\n | ``\'n\'`` | Number. This is the same as ``\'d\'``, except that it uses |\n | | the current locale setting to insert the appropriate |\n | | number separator characters. |\n +-----------+------------------------------------------------------------+\n | None | The same as ``\'d\'``. |\n +-----------+------------------------------------------------------------+\n\nThe available presentation types for floating point and decimal values\nare:\n\n +-----------+------------------------------------------------------------+\n | Type | Meaning |\n +===========+============================================================+\n | ``\'e\'`` | Exponent notation. Prints the number in scientific |\n | | notation using the letter \'e\' to indicate the exponent. |\n +-----------+------------------------------------------------------------+\n | ``\'E\'`` | Exponent notation. Same as ``\'e\'`` except it uses an upper |\n | | case \'E\' as the separator character. |\n +-----------+------------------------------------------------------------+\n | ``\'f\'`` | Fixed point. Displays the number as a fixed-point number. |\n +-----------+------------------------------------------------------------+\n | ``\'F\'`` | Fixed point. Same as ``\'f\'``, but converts ``nan`` to |\n | | ``NAN`` and ``inf`` to ``INF``. |\n +-----------+------------------------------------------------------------+\n | ``\'g\'`` | General format. This prints the number as a fixed-point |\n | | number, unless the number is too large, in which case it |\n | | switches to ``\'e\'`` exponent notation. Infinity and NaN |\n | | values are formatted as ``inf``, ``-inf`` and ``nan``, |\n | | respectively. |\n +-----------+------------------------------------------------------------+\n | ``\'G\'`` | General format. Same as ``\'g\'`` except switches to ``\'E\'`` |\n | | if the number gets to large. The representations of |\n | | infinity and NaN are uppercased, too. |\n +-----------+------------------------------------------------------------+\n | ``\'n\'`` | Number. This is the same as ``\'g\'``, except that it uses |\n | | the current locale setting to insert the appropriate |\n | | number separator characters. |\n +-----------+------------------------------------------------------------+\n | ``\'%\'`` | Percentage. Multiplies the number by 100 and displays in |\n | | fixed (``\'f\'``) format, followed by a percent sign. |\n +-----------+------------------------------------------------------------+\n | None | Similar to ``\'g\'``, except with at least one digit past |\n | | the decimal point and a default precision of 12. This is |\n | | intended to match ``str()``, except you can add the other |\n | | format modifiers. |\n +-----------+------------------------------------------------------------+\n', 'function': '\nFunction definitions\n********************\n\nA function definition defines a user-defined function object (see\nsection *The standard type hierarchy*):\n\n funcdef ::= [decorators] "def" funcname "(" [parameter_list] ")" ["->" expression] ":" suite\n decorators ::= decorator+\n decorator ::= "@" dotted_name ["(" [argument_list [","]] ")"] NEWLINE\n dotted_name ::= identifier ("." identifier)*\n parameter_list ::= (defparameter ",")*\n ( "*" [parameter] ("," defparameter)*\n [, "**" parameter]\n | "**" parameter\n | defparameter [","] )\n parameter ::= identifier [":" expression]\n defparameter ::= parameter ["=" expression]\n funcname ::= identifier\n\nA function definition is an executable statement. Its execution binds\nthe function name in the current local namespace to a function object\n(a wrapper around the executable code for the function). This\nfunction object contains a reference to the current global namespace\nas the global namespace to be used when the function is called.\n\nThe function definition does not execute the function body; this gets\nexecuted only when the function is called. [3]\n\nA function definition may be wrapped by one or more *decorator*\nexpressions. Decorator expressions are evaluated when the function is\ndefined, in the scope that contains the function definition. The\nresult must be a callable, which is invoked with the function object\nas the only argument. The returned value is bound to the function name\ninstead of the function object. Multiple decorators are applied in\nnested fashion. For example, the following code\n\n @f1(arg)\n @f2\n def func(): pass\n\nis equivalent to\n\n def func(): pass\n func = f1(arg)(f2(func))\n\nWhen one or more parameters have the form *parameter* ``=``\n*expression*, the function is said to have "default parameter values."\nFor a parameter with a default value, the corresponding argument may\nbe omitted from a call, in which case the parameter\'s default value is\nsubstituted. If a parameter has a default value, all following\nparameters up until the "``*``" must also have a default value ---\nthis is a syntactic restriction that is not expressed by the grammar.\n\n**Default parameter values are evaluated when the function definition\nis executed.** This means that the expression is evaluated once, when\nthe function is defined, and that that same "pre-computed" value is\nused for each call. This is especially important to understand when a\ndefault parameter is a mutable object, such as a list or a dictionary:\nif the function modifies the object (e.g. by appending an item to a\nlist), the default value is in effect modified. This is generally not\nwhat was intended. A way around this is to use ``None`` as the\ndefault, and explicitly test for it in the body of the function, e.g.:\n\n def whats_on_the_telly(penguin=None):\n if penguin is None:\n penguin = []\n penguin.append("property of the zoo")\n return penguin\n\nFunction call semantics are described in more detail in section\n*Calls*. A function call always assigns values to all parameters\nmentioned in the parameter list, either from position arguments, from\nkeyword arguments, or from default values. If the form\n"``*identifier``" is present, it is initialized to a tuple receiving\nany excess positional parameters, defaulting to the empty tuple. If\nthe form "``**identifier``" is present, it is initialized to a new\ndictionary receiving any excess keyword arguments, defaulting to a new\nempty dictionary. Parameters after "``*``" or "``*identifier``" are\nkeyword-only parameters and may only be passed used keyword arguments.\n\nParameters may have annotations of the form "``: expression``"\nfollowing the parameter name. Any parameter may have an annotation\neven those of the form ``*identifier`` or ``**identifier``. Functions\nmay have "return" annotation of the form "``-> expression``" after the\nparameter list. These annotations can be any valid Python expression\nand are evaluated when the function definition is executed.\nAnnotations may be evaluated in a different order than they appear in\nthe source code. The presence of annotations does not change the\nsemantics of a function. The annotation values are available as\nvalues of a dictionary keyed by the parameters\' names in the\n``__annotations__`` attribute of the function object.\n\nIt is also possible to create anonymous functions (functions not bound\nto a name), for immediate use in expressions. This uses lambda forms,\ndescribed in section *Lambdas*. Note that the lambda form is merely a\nshorthand for a simplified function definition; a function defined in\na "``def``" statement can be passed around or assigned to another name\njust like a function defined by a lambda form. The "``def``" form is\nactually more powerful since it allows the execution of multiple\nstatements and annotations.\n\n**Programmer\'s note:** Functions are first-class objects. A "``def``"\nform executed inside a function definition defines a local function\nthat can be returned or passed around. Free variables used in the\nnested function can access the local variables of the function\ncontaining the def. See section *Naming and binding* for details.\n', 'global': '\nThe ``global`` statement\n************************\n\n global_stmt ::= "global" identifier ("," identifier)*\n\nThe ``global`` statement is a declaration which holds for the entire\ncurrent code block. It means that the listed identifiers are to be\ninterpreted as globals. It would be impossible to assign to a global\nvariable without ``global``, although free variables may refer to\nglobals without being declared global.\n\nNames listed in a ``global`` statement must not be used in the same\ncode block textually preceding that ``global`` statement.\n\nNames listed in a ``global`` statement must not be defined as formal\nparameters or in a ``for`` loop control target, ``class`` definition,\nfunction definition, or ``import`` statement.\n\n(The current implementation does not enforce the latter two\nrestrictions, but programs should not abuse this freedom, as future\nimplementations may enforce them or silently change the meaning of the\nprogram.)\n\n**Programmer\'s note:** the ``global`` is a directive to the parser.\nIt applies only to code parsed at the same time as the ``global``\nstatement. In particular, a ``global`` statement contained in a string\nor code object supplied to the builtin ``exec()`` function does not\naffect the code block *containing* the function call, and code\ncontained in such a string is unaffected by ``global`` statements in\nthe code containing the function call. The same applies to the\n``eval()`` and ``compile()`` functions.\n', @@ -41,7 +41,7 @@ 'identifiers': '\nIdentifiers and keywords\n************************\n\nIdentifiers (also referred to as *names*) are described by the\nfollowing lexical definitions.\n\nThe syntax of identifiers in Python is based on the Unicode standard\nannex UAX-31, with elaboration and changes as defined below; see also\n**PEP 3131** for further details.\n\nWithin the ASCII range (U+0001..U+007F), the valid characters for\nidentifiers are the same as in Python 2.x: the uppercase and lowercase\nletters ``A`` through ``Z``, the underscore ``_`` and, except for the\nfirst character, the digits ``0`` through ``9``.\n\nPython 3.0 introduces additional characters from outside the ASCII\nrange (see **PEP 3131**). For these characters, the classification\nuses the version of the Unicode Character Database as included in the\n``unicodedata`` module.\n\nIdentifiers are unlimited in length. Case is significant.\n\n identifier ::= id_start id_continue*\n id_start ::= \n id_continue ::= \n\nThe Unicode category codes mentioned above stand for:\n\n* *Lu* - uppercase letters\n\n* *Ll* - lowercase letters\n\n* *Lt* - titlecase letters\n\n* *Lm* - modifier letters\n\n* *Lo* - other letters\n\n* *Nl* - letter numbers\n\n* *Mn* - nonspacing marks\n\n* *Mc* - spacing combining marks\n\n* *Nd* - decimal numbers\n\n* *Pc* - connector punctuations\n\nAll identifiers are converted into the normal form NFC while parsing;\ncomparison of identifiers is based on NFC.\n\nA non-normative HTML file listing all valid identifier characters for\nUnicode 4.1 can be found at http://www.dcl.hpi.uni-\npotsdam.de/home/loewis/table-3131.html.\n\n\nKeywords\n========\n\nThe following identifiers are used as reserved words, or *keywords* of\nthe language, and cannot be used as ordinary identifiers. They must\nbe spelled exactly as written here:\n\n False class finally is return\n None continue for lambda try\n True def from nonlocal while\n and del global not with\n as elif if or yield\n assert else import pass\n break except in raise\n\n\nReserved classes of identifiers\n===============================\n\nCertain classes of identifiers (besides keywords) have special\nmeanings. These classes are identified by the patterns of leading and\ntrailing underscore characters:\n\n``_*``\n Not imported by ``from module import *``. The special identifier\n ``_`` is used in the interactive interpreter to store the result of\n the last evaluation; it is stored in the ``builtins`` module. When\n not in interactive mode, ``_`` has no special meaning and is not\n defined. See section *The import statement*.\n\n Note: The name ``_`` is often used in conjunction with\n internationalization; refer to the documentation for the\n ``gettext`` module for more information on this convention.\n\n``__*__``\n System-defined names. These names are defined by the interpreter\n and its implementation (including the standard library);\n applications should not expect to define additional names using\n this convention. The set of names of this class defined by Python\n may be extended in future versions. See section *Special method\n names*.\n\n``__*``\n Class-private names. Names in this category, when used within the\n context of a class definition, are re-written to use a mangled form\n to help avoid name clashes between "private" attributes of base and\n derived classes. See section *Identifiers (Names)*.\n', 'if': '\nThe ``if`` statement\n********************\n\nThe ``if`` statement is used for conditional execution:\n\n if_stmt ::= "if" expression ":" suite\n ( "elif" expression ":" suite )*\n ["else" ":" suite]\n\nIt selects exactly one of the suites by evaluating the expressions one\nby one until one is found to be true (see section *Boolean operations*\nfor the definition of true and false); then that suite is executed\n(and no other part of the ``if`` statement is executed or evaluated).\nIf all expressions are false, the suite of the ``else`` clause, if\npresent, is executed.\n', 'imaginary': '\nImaginary literals\n******************\n\nImaginary literals are described by the following lexical definitions:\n\n imagnumber ::= (floatnumber | intpart) ("j" | "J")\n\nAn imaginary literal yields a complex number with a real part of 0.0.\nComplex numbers are represented as a pair of floating point numbers\nand have the same restrictions on their range. To create a complex\nnumber with a nonzero real part, add a floating point number to it,\ne.g., ``(3+4j)``. Some examples of imaginary literals:\n\n 3.14j 10.j 10j .001j 1e100j 3.14e-10j\n', - 'import': '\nThe ``import`` statement\n************************\n\n import_stmt ::= "import" module ["as" name] ( "," module ["as" name] )*\n | "from" relative_module "import" identifier ["as" name]\n ( "," identifier ["as" name] )*\n | "from" relative_module "import" "(" identifier ["as" name]\n ( "," identifier ["as" name] )* [","] ")"\n | "from" module "import" "*"\n module ::= (identifier ".")* identifier\n relative_module ::= "."* module | "."+\n name ::= identifier\n\nImport statements are executed in two steps: (1) find a module, and\ninitialize it if necessary; (2) define a name or names in the local\nnamespace (of the scope where the ``import`` statement occurs). The\nstatement comes in two forms differing on whether it uses the ``from``\nkeyword. The first form (without ``from``) repeats these steps for\neach identifier in the list. The form with ``from`` performs step (1)\nonce, and then performs step (2) repeatedly. For a reference\nimplementation of step (1), see the ``importlib`` module.\n\nTo understand how step (1) occurs, one must first understand how\nPython handles hierarchical naming of modules. To help organize\nmodules and provide a hierarchy in naming, Python has a concept of\npackages. A package can contain other packages and modules while\nmodules cannot contain other modules or packages. From a file system\nperspective, packages are directories and modules are files. The\noriginal specification for packages is still available to read,\nalthough minor details have changed since the writing of that\ndocument.\n\nOnce the name of the module is known (unless otherwise specified, the\nterm "module" will refer to both packages and modules), searching for\nthe module or package can begin. The first place checked is\n``sys.modules``, the cache of all modules that have been imported\npreviously. If the module is found there then it is used in step (2)\nof import.\n\nIf the module is not found in the cache, then ``sys.meta_path`` is\nsearched (the specification for ``sys.meta_path`` can be found in\n**PEP 302**). The object is a list of *finder* objects which are\nqueried in order as to whether they know how to load the module by\ncalling their ``find_module()`` method with the name of the module. If\nthe module happens to be contained within a package (as denoted by the\nexistence of a dot in the name), then a second argument to\n``find_module()`` is given as the value of the ``__path__`` attribute\nfrom the parent package (everything up to the last dot in the name of\nthe module being imported). If a finder can find the module it returns\na *loader* (discussed later) or returns ``None``.\n\nIf none of the finders on ``sys.meta_path`` are able to find the\nmodule then some implicitly defined finders are queried.\nImplementations of Python vary in what implicit meta path finders are\ndefined. The one they all do define, though, is one that handles\n``sys.path_hooks``, ``sys.path_importer_cache``, and ``sys.path``.\n\nThe implicit finder searches for the requested module in the "paths"\nspecified in one of two places ("paths" do not have to be file system\npaths). If the module being imported is supposed to be contained\nwithin a package then the second argument passed to ``find_module()``,\n``__path__`` on the parent package, is used as the source of paths. If\nthe module is not contained in a package then ``sys.path`` is used as\nthe source of paths.\n\nOnce the source of paths is chosen it is iterated over to find a\nfinder that can handle that path. The dict at\n``sys.path_importer_cache`` caches finders for paths and is checked\nfor a finder. If the path does not have a finder cached then\n``sys.path_hooks`` is searched by calling each object in the list with\na single argument of the path, returning a finder or raises\n``ImportError``. If a finder is returned then it is cached in\n``sys.path_importer_cache`` and then used for that path entry. If no\nfinder can be found but the path exists then a value of ``None`` is\nstored in ``sys.path_importer_cache`` to signify that an implicit,\nfile-based finder that handles modules stored as individual files\nshould be used for that path. If the path does not exist then a finder\nwhich always returns ``None`` is placed in the cache for the path.\n\nIf no finder can find the module then ``ImportError`` is raised.\nOtherwise some finder returned a loader whose ``load_module()`` method\nis called with the name of the module to load (see **PEP 302** for the\noriginal definition of loaders). A loader has several responsibilities\nto perform on a module it loads. First, if the module already exists\nin ``sys.modules`` (a possibility if the loader is called outside of\nthe import machinery) then it is to use that module for initialization\nand not a new module. But if the module does not exist in\n``sys.modules`` then it is to be added to that dict before\ninitialization begins. If an error occurs during loading of the module\nand it was added to ``sys.modules`` it is to be removed from the dict.\nIf an error occurs but the module was already in ``sys.modules`` it is\nleft in the dict.\n\nThe loader must set several attributes on the module. ``__name__`` is\nto be set to the name of the module. ``__file__`` is to be the "path"\nto the file unless the module is built-in (and thus listed in\n``sys.builtin_module_names``) in which case the attribute is not set.\nIf what is being imported is a package then ``__path__`` is to be set\nto a list of paths to be searched when looking for modules and\npackages contained within the package being imported. ``__package__``\nis optional but should be set to the name of package that contains the\nmodule or package (the empty string is used for module not contained\nin a package). ``__loader__`` is also optional but should be set to\nthe loader object that is loading the module.\n\nIf an error occurs during loading then the loader raises\n``ImportError`` if some other exception is not already being\npropagated. Otherwise the loader returns the module that was loaded\nand initialized.\n\nWhen step (1) finishes without raising an exception, step (2) can\nbegin.\n\nThe first form of ``import`` statement binds the module name in the\nlocal namespace to the module object, and then goes on to import the\nnext identifier, if any. If the module name is followed by ``as``,\nthe name following ``as`` is used as the local name for the module.\n\nThe ``from`` form does not bind the module name: it goes through the\nlist of identifiers, looks each one of them up in the module found in\nstep (1), and binds the name in the local namespace to the object thus\nfound. As with the first form of ``import``, an alternate local name\ncan be supplied by specifying "``as`` localname". If a name is not\nfound, ``ImportError`` is raised. If the list of identifiers is\nreplaced by a star (``\'*\'``), all public names defined in the module\nare bound in the local namespace of the ``import`` statement..\n\nThe *public names* defined by a module are determined by checking the\nmodule\'s namespace for a variable named ``__all__``; if defined, it\nmust be a sequence of strings which are names defined or imported by\nthat module. The names given in ``__all__`` are all considered public\nand are required to exist. If ``__all__`` is not defined, the set of\npublic names includes all names found in the module\'s namespace which\ndo not begin with an underscore character (``\'_\'``). ``__all__``\nshould contain the entire public API. It is intended to avoid\naccidentally exporting items that are not part of the API (such as\nlibrary modules which were imported and used within the module).\n\nThe ``from`` form with ``*`` may only occur in a module scope. The\nwild card form of import --- ``import *`` --- is only allowed at the\nmodule level. Attempting to use it in class for function definitions\nwill raise a ``SyntaxError``.\n\nWhen specifying what module to import you do not have to specify the\nabsolute name of the module. When a module or package is contained\nwithin another package it is possible to make a relative import within\nthe same top package without having to mention the package name. By\nusing leading dots in the specified module or package after ``from``\nyou can specify how high to traverse up the current package hierarchy\nwithout specifying exact names. One leading dot means the current\npackage where the module making the import exists. Two dots means up\none package level. Three dots is up two levels, etc. So if you execute\n``from . import mod`` from a module in the ``pkg`` package then you\nwill end up importing ``pkg.mod``. If you execute ``from ..subpkg2\nimprt mod`` from within ``pkg.subpkg1`` you will import\n``pkg.subpkg2.mod``. The specification for relative imports is\ncontained within **PEP 328**.\n\nThe built-in function ``__import__()`` is provided to support\napplications that determine which modules need to be loaded\ndynamically; refer to *Built-in Functions* for additional information.\n\n\nFuture statements\n=================\n\nA *future statement* is a directive to the compiler that a particular\nmodule should be compiled using syntax or semantics that will be\navailable in a specified future release of Python. The future\nstatement is intended to ease migration to future versions of Python\nthat introduce incompatible changes to the language. It allows use of\nthe new features on a per-module basis before the release in which the\nfeature becomes standard.\n\n future_statement ::= "from" "__future__" "import" feature ["as" name]\n ("," feature ["as" name])*\n | "from" "__future__" "import" "(" feature ["as" name]\n ("," feature ["as" name])* [","] ")"\n feature ::= identifier\n name ::= identifier\n\nA future statement must appear near the top of the module. The only\nlines that can appear before a future statement are:\n\n* the module docstring (if any),\n\n* comments,\n\n* blank lines, and\n\n* other future statements.\n\nThe features recognized by Python 3.0 are ``absolute_import``,\n``division``, ``generators``, ``unicode_literals``,\n``print_function``, ``nested_scopes`` and ``with_statement``. They\nare all redundant because they are always enabled, and only kept for\nbackwards compatibility.\n\nA future statement is recognized and treated specially at compile\ntime: Changes to the semantics of core constructs are often\nimplemented by generating different code. It may even be the case\nthat a new feature introduces new incompatible syntax (such as a new\nreserved word), in which case the compiler may need to parse the\nmodule differently. Such decisions cannot be pushed off until\nruntime.\n\nFor any given release, the compiler knows which feature names have\nbeen defined, and raises a compile-time error if a future statement\ncontains a feature not known to it.\n\nThe direct runtime semantics are the same as for any import statement:\nthere is a standard module ``__future__``, described later, and it\nwill be imported in the usual way at the time the future statement is\nexecuted.\n\nThe interesting runtime semantics depend on the specific feature\nenabled by the future statement.\n\nNote that there is nothing special about the statement:\n\n import __future__ [as name]\n\nThat is not a future statement; it\'s an ordinary import statement with\nno special semantics or syntax restrictions.\n\nCode compiled by calls to the builtin functions ``exec()`` and\n``compile()`` that occur in a module ``M`` containing a future\nstatement will, by default, use the new syntax or semantics associated\nwith the future statement. This can be controlled by optional\narguments to ``compile()`` --- see the documentation of that function\nfor details.\n\nA future statement typed at an interactive interpreter prompt will\ntake effect for the rest of the interpreter session. If an\ninterpreter is started with the *-i* option, is passed a script name\nto execute, and the script includes a future statement, it will be in\neffect in the interactive session started after the script is\nexecuted.\n\nSee also:\n\n **PEP 236** - Back to the __future__\n The original proposal for the __future__ mechanism.\n', + 'import': '\nThe ``import`` statement\n************************\n\n import_stmt ::= "import" module ["as" name] ( "," module ["as" name] )*\n | "from" relative_module "import" identifier ["as" name]\n ( "," identifier ["as" name] )*\n | "from" relative_module "import" "(" identifier ["as" name]\n ( "," identifier ["as" name] )* [","] ")"\n | "from" module "import" "*"\n module ::= (identifier ".")* identifier\n relative_module ::= "."* module | "."+\n name ::= identifier\n\nImport statements are executed in two steps: (1) find a module, and\ninitialize it if necessary; (2) define a name or names in the local\nnamespace (of the scope where the ``import`` statement occurs). The\nstatement comes in two forms differing on whether it uses the ``from``\nkeyword. The first form (without ``from``) repeats these steps for\neach identifier in the list. The form with ``from`` performs step (1)\nonce, and then performs step (2) repeatedly. For a reference\nimplementation of step (1), see the ``importlib`` module.\n\nTo understand how step (1) occurs, one must first understand how\nPython handles hierarchical naming of modules. To help organize\nmodules and provide a hierarchy in naming, Python has a concept of\npackages. A package can contain other packages and modules while\nmodules cannot contain other modules or packages. From a file system\nperspective, packages are directories and modules are files. The\noriginal specification for packages is still available to read,\nalthough minor details have changed since the writing of that\ndocument.\n\nOnce the name of the module is known (unless otherwise specified, the\nterm "module" will refer to both packages and modules), searching for\nthe module or package can begin. The first place checked is\n``sys.modules``, the cache of all modules that have been imported\npreviously. If the module is found there then it is used in step (2)\nof import.\n\nIf the module is not found in the cache, then ``sys.meta_path`` is\nsearched (the specification for ``sys.meta_path`` can be found in\n**PEP 302**). The object is a list of *finder* objects which are\nqueried in order as to whether they know how to load the module by\ncalling their ``find_module()`` method with the name of the module. If\nthe module happens to be contained within a package (as denoted by the\nexistence of a dot in the name), then a second argument to\n``find_module()`` is given as the value of the ``__path__`` attribute\nfrom the parent package (everything up to the last dot in the name of\nthe module being imported). If a finder can find the module it returns\na *loader* (discussed later) or returns ``None``.\n\nIf none of the finders on ``sys.meta_path`` are able to find the\nmodule then some implicitly defined finders are queried.\nImplementations of Python vary in what implicit meta path finders are\ndefined. The one they all do define, though, is one that handles\n``sys.path_hooks``, ``sys.path_importer_cache``, and ``sys.path``.\n\nThe implicit finder searches for the requested module in the "paths"\nspecified in one of two places ("paths" do not have to be file system\npaths). If the module being imported is supposed to be contained\nwithin a package then the second argument passed to ``find_module()``,\n``__path__`` on the parent package, is used as the source of paths. If\nthe module is not contained in a package then ``sys.path`` is used as\nthe source of paths.\n\nOnce the source of paths is chosen it is iterated over to find a\nfinder that can handle that path. The dict at\n``sys.path_importer_cache`` caches finders for paths and is checked\nfor a finder. If the path does not have a finder cached then\n``sys.path_hooks`` is searched by calling each object in the list with\na single argument of the path, returning a finder or raises\n``ImportError``. If a finder is returned then it is cached in\n``sys.path_importer_cache`` and then used for that path entry. If no\nfinder can be found but the path exists then a value of ``None`` is\nstored in ``sys.path_importer_cache`` to signify that an implicit,\nfile-based finder that handles modules stored as individual files\nshould be used for that path. If the path does not exist then a finder\nwhich always returns ``None`` is placed in the cache for the path.\n\nIf no finder can find the module then ``ImportError`` is raised.\nOtherwise some finder returned a loader whose ``load_module()`` method\nis called with the name of the module to load (see **PEP 302** for the\noriginal definition of loaders). A loader has several responsibilities\nto perform on a module it loads. First, if the module already exists\nin ``sys.modules`` (a possibility if the loader is called outside of\nthe import machinery) then it is to use that module for initialization\nand not a new module. But if the module does not exist in\n``sys.modules`` then it is to be added to that dict before\ninitialization begins. If an error occurs during loading of the module\nand it was added to ``sys.modules`` it is to be removed from the dict.\nIf an error occurs but the module was already in ``sys.modules`` it is\nleft in the dict.\n\nThe loader must set several attributes on the module. ``__name__`` is\nto be set to the name of the module. ``__file__`` is to be the "path"\nto the file unless the module is built-in (and thus listed in\n``sys.builtin_module_names``) in which case the attribute is not set.\nIf what is being imported is a package then ``__path__`` is to be set\nto a list of paths to be searched when looking for modules and\npackages contained within the package being imported. ``__package__``\nis optional but should be set to the name of package that contains the\nmodule or package (the empty string is used for module not contained\nin a package). ``__loader__`` is also optional but should be set to\nthe loader object that is loading the module.\n\nIf an error occurs during loading then the loader raises\n``ImportError`` if some other exception is not already being\npropagated. Otherwise the loader returns the module that was loaded\nand initialized.\n\nWhen step (1) finishes without raising an exception, step (2) can\nbegin.\n\nThe first form of ``import`` statement binds the module name in the\nlocal namespace to the module object, and then goes on to import the\nnext identifier, if any. If the module name is followed by ``as``,\nthe name following ``as`` is used as the local name for the module.\n\nThe ``from`` form does not bind the module name: it goes through the\nlist of identifiers, looks each one of them up in the module found in\nstep (1), and binds the name in the local namespace to the object thus\nfound. As with the first form of ``import``, an alternate local name\ncan be supplied by specifying "``as`` localname". If a name is not\nfound, ``ImportError`` is raised. If the list of identifiers is\nreplaced by a star (``\'*\'``), all public names defined in the module\nare bound in the local namespace of the ``import`` statement..\n\nThe *public names* defined by a module are determined by checking the\nmodule\'s namespace for a variable named ``__all__``; if defined, it\nmust be a sequence of strings which are names defined or imported by\nthat module. The names given in ``__all__`` are all considered public\nand are required to exist. If ``__all__`` is not defined, the set of\npublic names includes all names found in the module\'s namespace which\ndo not begin with an underscore character (``\'_\'``). ``__all__``\nshould contain the entire public API. It is intended to avoid\naccidentally exporting items that are not part of the API (such as\nlibrary modules which were imported and used within the module).\n\nThe ``from`` form with ``*`` may only occur in a module scope. The\nwild card form of import --- ``import *`` --- is only allowed at the\nmodule level. Attempting to use it in class for function definitions\nwill raise a ``SyntaxError``.\n\nWhen specifying what module to import you do not have to specify the\nabsolute name of the module. When a module or package is contained\nwithin another package it is possible to make a relative import within\nthe same top package without having to mention the package name. By\nusing leading dots in the specified module or package after ``from``\nyou can specify how high to traverse up the current package hierarchy\nwithout specifying exact names. One leading dot means the current\npackage where the module making the import exists. Two dots means up\none package level. Three dots is up two levels, etc. So if you execute\n``from . import mod`` from a module in the ``pkg`` package then you\nwill end up importing ``pkg.mod``. If you execute ``from ..subpkg2\nimprt mod`` from within ``pkg.subpkg1`` you will import\n``pkg.subpkg2.mod``. The specification for relative imports is\ncontained within **PEP 328**.\n\n``importlib.import_module()`` is provided to support applications that\ndetermine which modules need to be loaded dynamically.\n\n\nFuture statements\n=================\n\nA *future statement* is a directive to the compiler that a particular\nmodule should be compiled using syntax or semantics that will be\navailable in a specified future release of Python. The future\nstatement is intended to ease migration to future versions of Python\nthat introduce incompatible changes to the language. It allows use of\nthe new features on a per-module basis before the release in which the\nfeature becomes standard.\n\n future_statement ::= "from" "__future__" "import" feature ["as" name]\n ("," feature ["as" name])*\n | "from" "__future__" "import" "(" feature ["as" name]\n ("," feature ["as" name])* [","] ")"\n feature ::= identifier\n name ::= identifier\n\nA future statement must appear near the top of the module. The only\nlines that can appear before a future statement are:\n\n* the module docstring (if any),\n\n* comments,\n\n* blank lines, and\n\n* other future statements.\n\nThe features recognized by Python 3.0 are ``absolute_import``,\n``division``, ``generators``, ``unicode_literals``,\n``print_function``, ``nested_scopes`` and ``with_statement``. They\nare all redundant because they are always enabled, and only kept for\nbackwards compatibility.\n\nA future statement is recognized and treated specially at compile\ntime: Changes to the semantics of core constructs are often\nimplemented by generating different code. It may even be the case\nthat a new feature introduces new incompatible syntax (such as a new\nreserved word), in which case the compiler may need to parse the\nmodule differently. Such decisions cannot be pushed off until\nruntime.\n\nFor any given release, the compiler knows which feature names have\nbeen defined, and raises a compile-time error if a future statement\ncontains a feature not known to it.\n\nThe direct runtime semantics are the same as for any import statement:\nthere is a standard module ``__future__``, described later, and it\nwill be imported in the usual way at the time the future statement is\nexecuted.\n\nThe interesting runtime semantics depend on the specific feature\nenabled by the future statement.\n\nNote that there is nothing special about the statement:\n\n import __future__ [as name]\n\nThat is not a future statement; it\'s an ordinary import statement with\nno special semantics or syntax restrictions.\n\nCode compiled by calls to the builtin functions ``exec()`` and\n``compile()`` that occur in a module ``M`` containing a future\nstatement will, by default, use the new syntax or semantics associated\nwith the future statement. This can be controlled by optional\narguments to ``compile()`` --- see the documentation of that function\nfor details.\n\nA future statement typed at an interactive interpreter prompt will\ntake effect for the rest of the interpreter session. If an\ninterpreter is started with the *-i* option, is passed a script name\nto execute, and the script includes a future statement, it will be in\neffect in the interactive session started after the script is\nexecuted.\n\nSee also:\n\n **PEP 236** - Back to the __future__\n The original proposal for the __future__ mechanism.\n', 'in': '\nComparisons\n***********\n\nUnlike C, all comparison operations in Python have the same priority,\nwhich is lower than that of any arithmetic, shifting or bitwise\noperation. Also unlike C, expressions like ``a < b < c`` have the\ninterpretation that is conventional in mathematics:\n\n comparison ::= or_expr ( comp_operator or_expr )*\n comp_operator ::= "<" | ">" | "==" | ">=" | "<=" | "!="\n | "is" ["not"] | ["not"] "in"\n\nComparisons yield boolean values: ``True`` or ``False``.\n\nComparisons can be chained arbitrarily, e.g., ``x < y <= z`` is\nequivalent to ``x < y and y <= z``, except that ``y`` is evaluated\nonly once (but in both cases ``z`` is not evaluated at all when ``x <\ny`` is found to be false).\n\nFormally, if *a*, *b*, *c*, ..., *y*, *z* are expressions and *op1*,\n*op2*, ..., *opN* are comparison operators, then ``a op1 b op2 c ... y\nopN z`` is equivalent to ``a op1 b and b op2 c and ... y opN z``,\nexcept that each expression is evaluated at most once.\n\nNote that ``a op1 b op2 c`` doesn\'t imply any kind of comparison\nbetween *a* and *c*, so that, e.g., ``x < y > z`` is perfectly legal\n(though perhaps not pretty).\n\nThe operators ``<``, ``>``, ``==``, ``>=``, ``<=``, and ``!=`` compare\nthe values of two objects. The objects need not have the same type.\nIf both are numbers, they are converted to a common type. Otherwise,\nthe ``==`` and ``!=`` operators *always* consider objects of different\ntypes to be unequal, while the ``<``, ``>``, ``>=`` and ``<=``\noperators raise a ``TypeError`` when comparing objects of different\ntypes that do not implement these operators for the given pair of\ntypes. You can control comparison behavior of objects of non-builtin\ntypes by defining rich comparison methods like ``__gt__()``, described\nin section *Basic customization*.\n\nComparison of objects of the same type depends on the type:\n\n* Numbers are compared arithmetically.\n\n* The values ``float(\'NaN\')`` and ``Decimal(\'NaN\')`` are special. The\n are identical to themselves, ``x is x`` but are not equal to\n themselves, ``x != x``. Additionally, comparing any value to a\n not-a-number value will return ``False``. For example, both ``3 <\n float(\'NaN\')`` and ``float(\'NaN\') < 3`` will return ``False``.\n\n* Bytes objects are compared lexicographically using the numeric\n values of their elements.\n\n* Strings are compared lexicographically using the numeric equivalents\n (the result of the built-in function ``ord()``) of their characters.\n [3] String and bytes object can\'t be compared!\n\n* Tuples and lists are compared lexicographically using comparison of\n corresponding elements. This means that to compare equal, each\n element must compare equal and the two sequences must be of the same\n type and have the same length.\n\n If not equal, the sequences are ordered the same as their first\n differing elements. For example, ``[1,2,x] <= [1,2,y]`` has the\n same value as ``x <= y``. If the corresponding element does not\n exist, the shorter sequence is ordered first (for example, ``[1,2] <\n [1,2,3]``).\n\n* Mappings (dictionaries) compare equal if and only if their sorted\n ``(key, value)`` lists compare equal. [4] Outcomes other than\n equality are resolved consistently, but are not otherwise defined.\n [5]\n\n* Sets and frozensets define comparison operators to mean subset and\n superset tests. Those relations do not define total orderings (the\n two sets ``{1,2}`` and {2,3} are not equal, nor subsets of one\n another, nor supersets of one another). Accordingly, sets are not\n appropriate arguments for functions which depend on total ordering.\n For example, ``min()``, ``max()``, and ``sorted()`` produce\n undefined results given a list of sets as inputs.\n\n* Most other objects of builtin types compare unequal unless they are\n the same object; the choice whether one object is considered smaller\n or larger than another one is made arbitrarily but consistently\n within one execution of a program.\n\nComparison of objects of the differing types depends on whether either\nof the types provide explicit support for the comparison. Most\nnumeric types can be compared with one another, but comparisons of\n``float`` and ``Decimal`` are not supported to avoid the inevitable\nconfusion arising from representation issues such as ``float(\'1.1\')``\nbeing inexactly represented and therefore not exactly equal to\n``Decimal(\'1.1\')`` which is. When cross-type comparison is not\nsupported, the comparison method returns ``NotImplemented``. This can\ncreate the illusion of non-transitivity between supported cross-type\ncomparisons and unsupported comparisons. For example, ``Decimal(2) ==\n2`` and *2 == float(2)`* but ``Decimal(2) != float(2)``.\n\nThe operators ``in`` and ``not in`` test for membership. ``x in s``\nevaluates to true if *x* is a member of *s*, and false otherwise. ``x\nnot in s`` returns the negation of ``x in s``. All built-in sequences\nand set types support this as well as dictionary, for which ``in``\ntests whether a the dictionary has a given key. For container types\nsuch as list, tuple, set, frozenset, dict, or collections.deque, the\nexpression ``x in y`` is equivalent to ``any(x is e or x == e for val\ne in y)``.\n\nFor the string and bytes types, ``x in y`` is true if and only if *x*\nis a substring of *y*. An equivalent test is ``y.find(x) != -1``.\nEmpty strings are always considered to be a substring of any other\nstring, so ``"" in "abc"`` will return ``True``.\n\nFor user-defined classes which define the ``__contains__()`` method,\n``x in y`` is true if and only if ``y.__contains__(x)`` is true.\n\nFor user-defined classes which do not define ``__contains__()`` and do\ndefine ``__getitem__()``, ``x in y`` is true if and only if there is a\nnon-negative integer index *i* such that ``x == y[i]``, and all lower\ninteger indices do not raise ``IndexError`` exception. (If any other\nexception is raised, it is as if ``in`` raised that exception).\n\nThe operator ``not in`` is defined to have the inverse true value of\n``in``.\n\nThe operators ``is`` and ``is not`` test for object identity: ``x is\ny`` is true if and only if *x* and *y* are the same object. ``x is\nnot y`` yields the inverse truth value. [6]\n', 'integers': '\nInteger literals\n****************\n\nInteger literals are described by the following lexical definitions:\n\n integer ::= decimalinteger | octinteger | hexinteger | bininteger\n decimalinteger ::= nonzerodigit digit* | "0"+\n nonzerodigit ::= "1"..."9"\n digit ::= "0"..."9"\n octinteger ::= "0" ("o" | "O") octdigit+\n hexinteger ::= "0" ("x" | "X") hexdigit+\n bininteger ::= "0" ("b" | "B") bindigit+\n octdigit ::= "0"..."7"\n hexdigit ::= digit | "a"..."f" | "A"..."F"\n bindigit ::= "0" | "1"\n\nThere is no limit for the length of integer literals apart from what\ncan be stored in available memory.\n\nNote that leading zeros in a non-zero decimal number are not allowed.\nThis is for disambiguation with C-style octal literals, which Python\nused before version 3.0.\n\nSome examples of integer literals:\n\n 7 2147483647 0o177 0b100110111\n 3 79228162514264337593543950336 0o377 0x100000000\n 79228162514264337593543950336 0xdeadbeef\n', 'lambda': '\nLambdas\n*******\n\n lambda_form ::= "lambda" [parameter_list]: expression\n lambda_form_nocond ::= "lambda" [parameter_list]: expression_nocond\n\nLambda forms (lambda expressions) have the same syntactic position as\nexpressions. They are a shorthand to create anonymous functions; the\nexpression ``lambda arguments: expression`` yields a function object.\nThe unnamed object behaves like a function object defined with\n\n def (arguments):\n return expression\n\nSee section *Function definitions* for the syntax of parameter lists.\nNote that functions created with lambda forms cannot contain\nstatements or annotations.\n', @@ -50,7 +50,7 @@ 'numbers': "\nNumeric literals\n****************\n\nThere are three types of numeric literals: integers, floating point\nnumbers, and imaginary numbers. There are no complex literals\n(complex numbers can be formed by adding a real number and an\nimaginary number).\n\nNote that numeric literals do not include a sign; a phrase like ``-1``\nis actually an expression composed of the unary operator '``-``' and\nthe literal ``1``.\n", 'numeric-types': "\nEmulating numeric types\n***********************\n\nThe following methods can be defined to emulate numeric objects.\nMethods corresponding to operations that are not supported by the\nparticular kind of number implemented (e.g., bitwise operations for\nnon-integral numbers) should be left undefined.\n\nobject.__add__(self, other)\nobject.__sub__(self, other)\nobject.__mul__(self, other)\nobject.__truediv__(self, other)\nobject.__floordiv__(self, other)\nobject.__mod__(self, other)\nobject.__divmod__(self, other)\nobject.__pow__(self, other[, modulo])\nobject.__lshift__(self, other)\nobject.__rshift__(self, other)\nobject.__and__(self, other)\nobject.__xor__(self, other)\nobject.__or__(self, other)\n\n These methods are called to implement the binary arithmetic\n operations (``+``, ``-``, ``*``, ``/``, ``//``, ``%``,\n ``divmod()``, ``pow()``, ``**``, ``<<``, ``>>``, ``&``, ``^``,\n ``|``). For instance, to evaluate the expression ``x + y``, where\n *x* is an instance of a class that has an ``__add__()`` method,\n ``x.__add__(y)`` is called. The ``__divmod__()`` method should be\n the equivalent to using ``__floordiv__()`` and ``__mod__()``; it\n should not be related to ``__truediv__()``. Note that\n ``__pow__()`` should be defined to accept an optional third\n argument if the ternary version of the built-in ``pow()`` function\n is to be supported.\n\n If one of those methods does not support the operation with the\n supplied arguments, it should return ``NotImplemented``.\n\nobject.__radd__(self, other)\nobject.__rsub__(self, other)\nobject.__rmul__(self, other)\nobject.__rtruediv__(self, other)\nobject.__rfloordiv__(self, other)\nobject.__rmod__(self, other)\nobject.__rdivmod__(self, other)\nobject.__rpow__(self, other)\nobject.__rlshift__(self, other)\nobject.__rrshift__(self, other)\nobject.__rand__(self, other)\nobject.__rxor__(self, other)\nobject.__ror__(self, other)\n\n These methods are called to implement the binary arithmetic\n operations (``+``, ``-``, ``*``, ``/``, ``//``, ``%``,\n ``divmod()``, ``pow()``, ``**``, ``<<``, ``>>``, ``&``, ``^``,\n ``|``) with reflected (swapped) operands. These functions are only\n called if the left operand does not support the corresponding\n operation and the operands are of different types. [3] For\n instance, to evaluate the expression ``x - y``, where *y* is an\n instance of a class that has an ``__rsub__()`` method,\n ``y.__rsub__(x)`` is called if ``x.__sub__(y)`` returns\n *NotImplemented*.\n\n Note that ternary ``pow()`` will not try calling ``__rpow__()``\n (the coercion rules would become too complicated).\n\n Note: If the right operand's type is a subclass of the left operand's\n type and that subclass provides the reflected method for the\n operation, this method will be called before the left operand's\n non-reflected method. This behavior allows subclasses to\n override their ancestors' operations.\n\nobject.__iadd__(self, other)\nobject.__isub__(self, other)\nobject.__imul__(self, other)\nobject.__itruediv__(self, other)\nobject.__ifloordiv__(self, other)\nobject.__imod__(self, other)\nobject.__ipow__(self, other[, modulo])\nobject.__ilshift__(self, other)\nobject.__irshift__(self, other)\nobject.__iand__(self, other)\nobject.__ixor__(self, other)\nobject.__ior__(self, other)\n\n These methods are called to implement the augmented arithmetic\n assignments (``+=``, ``-=``, ``*=``, ``/=``, ``//=``, ``%=``,\n ``**=``, ``<<=``, ``>>=``, ``&=``, ``^=``, ``|=``). These methods\n should attempt to do the operation in-place (modifying *self*) and\n return the result (which could be, but does not have to be,\n *self*). If a specific method is not defined, the augmented\n assignment falls back to the normal methods. For instance, to\n execute the statement ``x += y``, where *x* is an instance of a\n class that has an ``__iadd__()`` method, ``x.__iadd__(y)`` is\n called. If *x* is an instance of a class that does not define a\n ``__iadd__()`` method, ``x.__add__(y)`` and ``y.__radd__(x)`` are\n considered, as with the evaluation of ``x + y``.\n\nobject.__neg__(self)\nobject.__pos__(self)\nobject.__abs__(self)\nobject.__invert__(self)\n\n Called to implement the unary arithmetic operations (``-``, ``+``,\n ``abs()`` and ``~``).\n\nobject.__complex__(self)\nobject.__int__(self)\nobject.__float__(self)\nobject.__round__(self[, n])\n\n Called to implement the built-in functions ``complex()``,\n ``int()``, ``float()`` and ``round()``. Should return a value of\n the appropriate type.\n\nobject.__index__(self)\n\n Called to implement ``operator.index()``. Also called whenever\n Python needs an integer object (such as in slicing, or in the\n built-in ``bin()``, ``hex()`` and ``oct()`` functions). Must return\n an integer.\n", 'objects': '\nObjects, values and types\n*************************\n\n*Objects* are Python\'s abstraction for data. All data in a Python\nprogram is represented by objects or by relations between objects. (In\na sense, and in conformance to Von Neumann\'s model of a "stored\nprogram computer," code is also represented by objects.)\n\nEvery object has an identity, a type and a value. An object\'s\n*identity* never changes once it has been created; you may think of it\nas the object\'s address in memory. The \'``is``\' operator compares the\nidentity of two objects; the ``id()`` function returns an integer\nrepresenting its identity (currently implemented as its address). An\nobject\'s *type* is also unchangeable. [1] An object\'s type determines\nthe operations that the object supports (e.g., "does it have a\nlength?") and also defines the possible values for objects of that\ntype. The ``type()`` function returns an object\'s type (which is an\nobject itself). The *value* of some objects can change. Objects\nwhose value can change are said to be *mutable*; objects whose value\nis unchangeable once they are created are called *immutable*. (The\nvalue of an immutable container object that contains a reference to a\nmutable object can change when the latter\'s value is changed; however\nthe container is still considered immutable, because the collection of\nobjects it contains cannot be changed. So, immutability is not\nstrictly the same as having an unchangeable value, it is more subtle.)\nAn object\'s mutability is determined by its type; for instance,\nnumbers, strings and tuples are immutable, while dictionaries and\nlists are mutable.\n\nObjects are never explicitly destroyed; however, when they become\nunreachable they may be garbage-collected. An implementation is\nallowed to postpone garbage collection or omit it altogether --- it is\na matter of implementation quality how garbage collection is\nimplemented, as long as no objects are collected that are still\nreachable. (Implementation note: CPython currently uses a reference-\ncounting scheme with (optional) delayed detection of cyclically linked\ngarbage, which collects most objects as soon as they become\nunreachable, but is not guaranteed to collect garbage containing\ncircular references. See the documentation of the ``gc`` module for\ninformation on controlling the collection of cyclic garbage. Other\nimplementations act differently and CPython may change.)\n\nNote that the use of the implementation\'s tracing or debugging\nfacilities may keep objects alive that would normally be collectable.\nAlso note that catching an exception with a \'``try``...``except``\'\nstatement may keep objects alive.\n\nSome objects contain references to "external" resources such as open\nfiles or windows. It is understood that these resources are freed\nwhen the object is garbage-collected, but since garbage collection is\nnot guaranteed to happen, such objects also provide an explicit way to\nrelease the external resource, usually a ``close()`` method. Programs\nare strongly recommended to explicitly close such objects. The\n\'``try``...``finally``\' statement and the \'``with``\' statement provide\nconvenient ways to do this.\n\nSome objects contain references to other objects; these are called\n*containers*. Examples of containers are tuples, lists and\ndictionaries. The references are part of a container\'s value. In\nmost cases, when we talk about the value of a container, we imply the\nvalues, not the identities of the contained objects; however, when we\ntalk about the mutability of a container, only the identities of the\nimmediately contained objects are implied. So, if an immutable\ncontainer (like a tuple) contains a reference to a mutable object, its\nvalue changes if that mutable object is changed.\n\nTypes affect almost all aspects of object behavior. Even the\nimportance of object identity is affected in some sense: for immutable\ntypes, operations that compute new values may actually return a\nreference to any existing object with the same type and value, while\nfor mutable objects this is not allowed. E.g., after ``a = 1; b =\n1``, ``a`` and ``b`` may or may not refer to the same object with the\nvalue one, depending on the implementation, but after ``c = []; d =\n[]``, ``c`` and ``d`` are guaranteed to refer to two different,\nunique, newly created empty lists. (Note that ``c = d = []`` assigns\nthe same object to both ``c`` and ``d``.)\n', - 'operator-summary': '\nSummary\n*******\n\nThe following table summarizes the operator precedences in Python,\nfrom lowest precedence (least binding) to highest precedence (most\nbinding). Operators in the same box have the same precedence. Unless\nthe syntax is explicitly given, operators are binary. Operators in\nthe same box group left to right (except for comparisons, including\ntests, which all have the same precedence and chain from left to right\n--- see section *Comparisons* --- and exponentiation, which groups\nfrom right to left).\n\n+-------------------------------------------------+---------------------------------------+\n| Operator | Description |\n+=================================================+=======================================+\n| ``lambda`` | Lambda expression |\n+-------------------------------------------------+---------------------------------------+\n| ``or`` | Boolean OR |\n+-------------------------------------------------+---------------------------------------+\n| ``and`` | Boolean AND |\n+-------------------------------------------------+---------------------------------------+\n| ``not`` *x* | Boolean NOT |\n+-------------------------------------------------+---------------------------------------+\n| ``in``, ``not`` ``in``, ``is``, ``is not``, | Comparisons, including membership |\n| ``<``, ``<=``, ``>``, ``>=``, ``<>``, ``!=``, | tests and identity tests, |\n| ``==`` | |\n+-------------------------------------------------+---------------------------------------+\n| ``|`` | Bitwise OR |\n+-------------------------------------------------+---------------------------------------+\n| ``^`` | Bitwise XOR |\n+-------------------------------------------------+---------------------------------------+\n| ``&`` | Bitwise AND |\n+-------------------------------------------------+---------------------------------------+\n| ``<<``, ``>>`` | Shifts |\n+-------------------------------------------------+---------------------------------------+\n| ``+``, ``-`` | Addition and subtraction |\n+-------------------------------------------------+---------------------------------------+\n| ``*``, ``/``, ``//``, ``%`` | Multiplication, division, remainder |\n+-------------------------------------------------+---------------------------------------+\n| ``+x``, ``-x``, ``~x`` | Positive, negative, bitwise NOT |\n+-------------------------------------------------+---------------------------------------+\n| ``**`` | Exponentiation [7] |\n+-------------------------------------------------+---------------------------------------+\n| ``x[index]``, ``x[index:index]``, | Subscription, slicing, call, |\n| ``x(arguments...)``, ``x.attribute`` | attribute reference |\n+-------------------------------------------------+---------------------------------------+\n| ``(expressions...)``, ``[expressions...]``, | Binding or tuple display, list |\n| ``{key:datum...}``, | display, dictionary display, |\n+-------------------------------------------------+---------------------------------------+\n\n-[ Footnotes ]-\n\n[1] While ``abs(x%y) < abs(y)`` is true mathematically, for floats it\n may not be true numerically due to roundoff. For example, and\n assuming a platform on which a Python float is an IEEE 754 double-\n precision number, in order that ``-1e-100 % 1e100`` have the same\n sign as ``1e100``, the computed result is ``-1e-100 + 1e100``,\n which is numerically exactly equal to ``1e100``. Function\n ``fmod()`` in the ``math`` module returns a result whose sign\n matches the sign of the first argument instead, and so returns\n ``-1e-100`` in this case. Which approach is more appropriate\n depends on the application.\n\n[2] If x is very close to an exact integer multiple of y, it\'s\n possible for ``x//y`` to be one larger than ``(x-x%y)//y`` due to\n rounding. In such cases, Python returns the latter result, in\n order to preserve that ``divmod(x,y)[0] * y + x % y`` be very\n close to ``x``.\n\n[3] While comparisons between strings make sense at the byte level,\n they may be counter-intuitive to users. For example, the strings\n ``"\\u00C7"`` and ``"\\u0327\\u0043"`` compare differently, even\n though they both represent the same unicode character (LATIN\n CAPITAL LETTER C WITH CEDILLA). To compare strings in a human\n recognizable way, compare using ``unicodedata.normalize()``.\n\n[4] The implementation computes this efficiently, without constructing\n lists or sorting.\n\n[5] Earlier versions of Python used lexicographic comparison of the\n sorted (key, value) lists, but this was very expensive for the\n common case of comparing for equality. An even earlier version of\n Python compared dictionaries by identity only, but this caused\n surprises because people expected to be able to test a dictionary\n for emptiness by comparing it to ``{}``.\n\n[6] Due to automatic garbage-collection, free lists, and the dynamic\n nature of descriptors, you may notice seemingly unusual behaviour\n in certain uses of the ``is`` operator, like those involving\n comparisons between instance methods, or constants. Check their\n documentation for more info.\n\n[7] The power operator ``**`` binds less tightly than an arithmetic or\n bitwise unary operator on its right, that is, ``2**-1`` is\n ``0.5``.\n', + 'operator-summary': '\nSummary\n*******\n\nThe following table summarizes the operator precedences in Python,\nfrom lowest precedence (least binding) to highest precedence (most\nbinding). Operators in the same box have the same precedence. Unless\nthe syntax is explicitly given, operators are binary. Operators in\nthe same box group left to right (except for comparisons, including\ntests, which all have the same precedence and chain from left to right\n--- see section *Comparisons* --- and exponentiation, which groups\nfrom right to left).\n\n+-------------------------------------------------+---------------------------------------+\n| Operator | Description |\n+=================================================+=======================================+\n| ``lambda`` | Lambda expression |\n+-------------------------------------------------+---------------------------------------+\n| ``or`` | Boolean OR |\n+-------------------------------------------------+---------------------------------------+\n| ``and`` | Boolean AND |\n+-------------------------------------------------+---------------------------------------+\n| ``not`` *x* | Boolean NOT |\n+-------------------------------------------------+---------------------------------------+\n| ``in``, ``not`` ``in``, ``is``, ``is not``, | Comparisons, including membership |\n| ``<``, ``<=``, ``>``, ``>=``, ``!=``, ``==`` | tests and identity tests, |\n+-------------------------------------------------+---------------------------------------+\n| ``|`` | Bitwise OR |\n+-------------------------------------------------+---------------------------------------+\n| ``^`` | Bitwise XOR |\n+-------------------------------------------------+---------------------------------------+\n| ``&`` | Bitwise AND |\n+-------------------------------------------------+---------------------------------------+\n| ``<<``, ``>>`` | Shifts |\n+-------------------------------------------------+---------------------------------------+\n| ``+``, ``-`` | Addition and subtraction |\n+-------------------------------------------------+---------------------------------------+\n| ``*``, ``/``, ``//``, ``%`` | Multiplication, division, remainder |\n+-------------------------------------------------+---------------------------------------+\n| ``+x``, ``-x``, ``~x`` | Positive, negative, bitwise NOT |\n+-------------------------------------------------+---------------------------------------+\n| ``**`` | Exponentiation [7] |\n+-------------------------------------------------+---------------------------------------+\n| ``x[index]``, ``x[index:index]``, | Subscription, slicing, call, |\n| ``x(arguments...)``, ``x.attribute`` | attribute reference |\n+-------------------------------------------------+---------------------------------------+\n| ``(expressions...)``, ``[expressions...]``, | Binding or tuple display, list |\n| ``{key:datum...}``, | display, dictionary display, |\n+-------------------------------------------------+---------------------------------------+\n\n-[ Footnotes ]-\n\n[1] While ``abs(x%y) < abs(y)`` is true mathematically, for floats it\n may not be true numerically due to roundoff. For example, and\n assuming a platform on which a Python float is an IEEE 754 double-\n precision number, in order that ``-1e-100 % 1e100`` have the same\n sign as ``1e100``, the computed result is ``-1e-100 + 1e100``,\n which is numerically exactly equal to ``1e100``. Function\n ``fmod()`` in the ``math`` module returns a result whose sign\n matches the sign of the first argument instead, and so returns\n ``-1e-100`` in this case. Which approach is more appropriate\n depends on the application.\n\n[2] If x is very close to an exact integer multiple of y, it\'s\n possible for ``x//y`` to be one larger than ``(x-x%y)//y`` due to\n rounding. In such cases, Python returns the latter result, in\n order to preserve that ``divmod(x,y)[0] * y + x % y`` be very\n close to ``x``.\n\n[3] While comparisons between strings make sense at the byte level,\n they may be counter-intuitive to users. For example, the strings\n ``"\\u00C7"`` and ``"\\u0327\\u0043"`` compare differently, even\n though they both represent the same unicode character (LATIN\n CAPITAL LETTER C WITH CEDILLA). To compare strings in a human\n recognizable way, compare using ``unicodedata.normalize()``.\n\n[4] The implementation computes this efficiently, without constructing\n lists or sorting.\n\n[5] Earlier versions of Python used lexicographic comparison of the\n sorted (key, value) lists, but this was very expensive for the\n common case of comparing for equality. An even earlier version of\n Python compared dictionaries by identity only, but this caused\n surprises because people expected to be able to test a dictionary\n for emptiness by comparing it to ``{}``.\n\n[6] Due to automatic garbage-collection, free lists, and the dynamic\n nature of descriptors, you may notice seemingly unusual behaviour\n in certain uses of the ``is`` operator, like those involving\n comparisons between instance methods, or constants. Check their\n documentation for more info.\n\n[7] The power operator ``**`` binds less tightly than an arithmetic or\n bitwise unary operator on its right, that is, ``2**-1`` is\n ``0.5``.\n', 'pass': '\nThe ``pass`` statement\n**********************\n\n pass_stmt ::= "pass"\n\n``pass`` is a null operation --- when it is executed, nothing happens.\nIt is useful as a placeholder when a statement is required\nsyntactically, but no code needs to be executed, for example:\n\n def f(arg): pass # a function that does nothing (yet)\n\n class C: pass # a class with no methods (yet)\n', 'power': '\nThe power operator\n******************\n\nThe power operator binds more tightly than unary operators on its\nleft; it binds less tightly than unary operators on its right. The\nsyntax is:\n\n power ::= primary ["**" u_expr]\n\nThus, in an unparenthesized sequence of power and unary operators, the\noperators are evaluated from right to left (this does not constrain\nthe evaluation order for the operands): ``-1**2`` results in ``-1``.\n\nThe power operator has the same semantics as the built-in ``pow()``\nfunction, when called with two arguments: it yields its left argument\nraised to the power of its right argument. The numeric arguments are\nfirst converted to a common type, and the result is of that type.\n\nFor int operands, the result has the same type as the operands unless\nthe second argument is negative; in that case, all arguments are\nconverted to float and a float result is delivered. For example,\n``10**2`` returns ``100``, but ``10**-2`` returns ``0.01``.\n\nRaising ``0.0`` to a negative power results in a\n``ZeroDivisionError``. Raising a negative number to a fractional power\nresults in a ``complex`` number. (In earlier versions it raised a\n``ValueError``.)\n', 'raise': '\nThe ``raise`` statement\n***********************\n\n raise_stmt ::= "raise" [expression ["from" expression]]\n\nIf no expressions are present, ``raise`` re-raises the last exception\nthat was active in the current scope. If no exception is active in\nthe current scope, a ``TypeError`` exception is raised indicating that\nthis is an error (if running under IDLE, a ``queue.Empty`` exception\nis raised instead).\n\nOtherwise, ``raise`` evaluates the first expression as the exception\nobject. It must be either a subclass or an instance of\n``BaseException``. If it is a class, the exception instance will be\nobtained when needed by instantiating the class with no arguments.\n\nThe *type* of the exception is the exception instance\'s class, the\n*value* is the instance itself.\n\nA traceback object is normally created automatically when an exception\nis raised and attached to it as the ``__traceback__`` attribute, which\nis writable. You can create an exception and set your own traceback in\none step using the ``with_traceback()`` exception method (which\nreturns the same exception instance, with its traceback set to its\nargument), like so:\n\n raise Exception("foo occurred").with_traceback(tracebackobj)\n\nThe ``from`` clause is used for exception chaining: if given, the\nsecond *expression* must be another exception class or instance, which\nwill then be attached to the raised exception as the ``__cause__``\nattribute (which is writable). If the raised exception is not\nhandled, both exceptions will be printed:\n\n >>> try:\n ... print(1 / 0)\n ... except Exception as exc:\n ... raise RuntimeError("Something bad happened") from exc\n ...\n Traceback (most recent call last):\n File "", line 2, in \n ZeroDivisionError: int division or modulo by zero\n\n The above exception was the direct cause of the following exception:\n\n Traceback (most recent call last):\n File "", line 4, in \n RuntimeError: Something bad happened\n\nA similar mechanism works implicitly if an exception is raised inside\nan exception handler: the previous exception is then attached as the\nnew exception\'s ``__context__`` attribute:\n\n >>> try:\n ... print(1 / 0)\n ... except:\n ... raise RuntimeError("Something bad happened")\n ...\n Traceback (most recent call last):\n File "", line 2, in \n ZeroDivisionError: int division or modulo by zero\n\n During handling of the above exception, another exception occurred:\n\n Traceback (most recent call last):\n File "", line 4, in \n RuntimeError: Something bad happened\n\nAdditional information on exceptions can be found in section\n*Exceptions*, and information about handling exceptions is in section\n*The try statement*.\n', @@ -70,7 +70,7 @@ 'typesmapping': '\nMapping Types --- ``dict``\n**************************\n\nA *mapping* object maps *hashable* values to arbitrary objects.\nMappings are mutable objects. There is currently only one standard\nmapping type, the *dictionary*. (For other containers see the built\nin ``list``, ``set``, and ``tuple`` classes, and the ``collections``\nmodule.)\n\nA dictionary\'s keys are *almost* arbitrary values. Values that are\nnot *hashable*, that is, values containing lists, dictionaries or\nother mutable types (that are compared by value rather than by object\nidentity) may not be used as keys. Numeric types used for keys obey\nthe normal rules for numeric comparison: if two numbers compare equal\n(such as ``1`` and ``1.0``) then they can be used interchangeably to\nindex the same dictionary entry. (Note however, that since computers\nstore floating-point numbers as approximations it is usually unwise to\nuse them as dictionary keys.)\n\nDictionaries can be created by placing a comma-separated list of\n``key: value`` pairs within braces, for example: ``{\'jack\': 4098,\n\'sjoerd\': 4127}`` or ``{4098: \'jack\', 4127: \'sjoerd\'}``, or by the\n``dict`` constructor.\n\nclass class dict([arg])\n\n Return a new dictionary initialized from an optional positional\n argument or from a set of keyword arguments. If no arguments are\n given, return a new empty dictionary. If the positional argument\n *arg* is a mapping object, return a dictionary mapping the same\n keys to the same values as does the mapping object. Otherwise the\n positional argument must be a sequence, a container that supports\n iteration, or an iterator object. The elements of the argument\n must each also be of one of those kinds, and each must in turn\n contain exactly two objects. The first is used as a key in the new\n dictionary, and the second as the key\'s value. If a given key is\n seen more than once, the last value associated with it is retained\n in the new dictionary.\n\n If keyword arguments are given, the keywords themselves with their\n associated values are added as items to the dictionary. If a key\n is specified both in the positional argument and as a keyword\n argument, the value associated with the keyword is retained in the\n dictionary. For example, these all return a dictionary equal to\n ``{"one": 2, "two": 3}``:\n\n * ``dict(one=2, two=3)``\n\n * ``dict({\'one\': 2, \'two\': 3})``\n\n * ``dict(zip((\'one\', \'two\'), (2, 3)))``\n\n * ``dict([[\'two\', 3], [\'one\', 2]])``\n\n The first example only works for keys that are valid Python\n identifiers; the others work with any valid keys.\n\n These are the operations that dictionaries support (and therefore,\n custom mapping types should support too):\n\n len(d)\n\n Return the number of items in the dictionary *d*.\n\n d[key]\n\n Return the item of *d* with key *key*. Raises a ``KeyError`` if\n *key* is not in the map.\n\n If a subclass of dict defines a method ``__missing__()``, if the\n key *key* is not present, the ``d[key]`` operation calls that\n method with the key *key* as argument. The ``d[key]`` operation\n then returns or raises whatever is returned or raised by the\n ``__missing__(key)`` call if the key is not present. No other\n operations or methods invoke ``__missing__()``. If\n ``__missing__()`` is not defined, ``KeyError`` is raised.\n ``__missing__()`` must be a method; it cannot be an instance\n variable. For an example, see ``collections.defaultdict``.\n\n d[key] = value\n\n Set ``d[key]`` to *value*.\n\n del d[key]\n\n Remove ``d[key]`` from *d*. Raises a ``KeyError`` if *key* is\n not in the map.\n\n key in d\n\n Return ``True`` if *d* has a key *key*, else ``False``.\n\n key not in d\n\n Equivalent to ``not key in d``.\n\n iter(d)\n\n Return an iterator over the keys of the dictionary. This is a\n shortcut for ``iterkeys()``.\n\n clear()\n\n Remove all items from the dictionary.\n\n copy()\n\n Return a shallow copy of the dictionary.\n\n classmethod fromkeys(seq[, value])\n\n Create a new dictionary with keys from *seq* and values set to\n *value*.\n\n ``fromkeys()`` is a class method that returns a new dictionary.\n *value* defaults to ``None``.\n\n get(key[, default])\n\n Return the value for *key* if *key* is in the dictionary, else\n *default*. If *default* is not given, it defaults to ``None``,\n so that this method never raises a ``KeyError``.\n\n items()\n\n Return a new view of the dictionary\'s items (``(key, value)``\n pairs). See below for documentation of view objects.\n\n keys()\n\n Return a new view of the dictionary\'s keys. See below for\n documentation of view objects.\n\n pop(key[, default])\n\n If *key* is in the dictionary, remove it and return its value,\n else return *default*. If *default* is not given and *key* is\n not in the dictionary, a ``KeyError`` is raised.\n\n popitem()\n\n Remove and return an arbitrary ``(key, value)`` pair from the\n dictionary.\n\n ``popitem()`` is useful to destructively iterate over a\n dictionary, as often used in set algorithms. If the dictionary\n is empty, calling ``popitem()`` raises a ``KeyError``.\n\n setdefault(key[, default])\n\n If *key* is in the dictionary, return its value. If not, insert\n *key* with a value of *default* and return *default*. *default*\n defaults to ``None``.\n\n update([other])\n\n Update the dictionary with the key/value pairs from *other*,\n overwriting existing keys. Return ``None``.\n\n ``update()`` accepts either another dictionary object or an\n iterable of key/value pairs (as a tuple or other iterable of\n length two). If keyword arguments are specified, the\n dictionary is then is updated with those key/value pairs:\n ``d.update(red=1, blue=2)``.\n\n values()\n\n Return a new view of the dictionary\'s values. See below for\n documentation of view objects.\n\n\nDictionary view objects\n=======================\n\nThe objects returned by ``dict.keys()``, ``dict.values()`` and\n``dict.items()`` are *view objects*. They provide a dynamic view on\nthe dictionary\'s entries, which means that when the dictionary\nchanges, the view reflects these changes.\n\nDictionary views can be iterated over to yield their respective data,\nand support membership tests:\n\nlen(dictview)\n\n Return the number of entries in the dictionary.\n\niter(dictview)\n\n Return an iterator over the keys, values or items (represented as\n tuples of ``(key, value)``) in the dictionary.\n\n Keys and values are iterated over in an arbitrary order which is\n non-random, varies across Python implementations, and depends on\n the dictionary\'s history of insertions and deletions. If keys,\n values and items views are iterated over with no intervening\n modifications to the dictionary, the order of items will directly\n correspond. This allows the creation of ``(value, key)`` pairs\n using ``zip()``: ``pairs = zip(d.values(), d.keys())``. Another\n way to create the same list is ``pairs = [(v, k) for (k, v) in\n d.items()]``.\n\n Iterating views while adding or deleting entries in the dictionary\n may raise a ``RuntimeError`` or fail to iterate over all entries.\n\nx in dictview\n\n Return ``True`` if *x* is in the underlying dictionary\'s keys,\n values or items (in the latter case, *x* should be a ``(key,\n value)`` tuple).\n\nKeys views are set-like since their entries are unique and hashable.\nIf all values are hashable, so that (key, value) pairs are unique and\nhashable, then the items view is also set-like. (Values views are not\ntreated as set-like since the entries are generally not unique.) Then\nthese set operations are available ("other" refers either to another\nview or a set):\n\ndictview & other\n\n Return the intersection of the dictview and the other object as a\n new set.\n\ndictview | other\n\n Return the union of the dictview and the other object as a new set.\n\ndictview - other\n\n Return the difference between the dictview and the other object\n (all elements in *dictview* that aren\'t in *other*) as a new set.\n\ndictview ^ other\n\n Return the symmetric difference (all elements either in *dictview*\n or *other*, but not in both) of the dictview and the other object\n as a new set.\n\nAn example of dictionary view usage:\n\n >>> dishes = {\'eggs\': 2, \'sausage\': 1, \'bacon\': 1, \'spam\': 500}\n >>> keys = dishes.keys()\n >>> values = dishes.values()\n\n >>> # iteration\n >>> n = 0\n >>> for val in values:\n ... n += val\n >>> print(n)\n 504\n\n >>> # keys and values are iterated over in the same order\n >>> list(keys)\n [\'eggs\', \'bacon\', \'sausage\', \'spam\']\n >>> list(values)\n [2, 1, 1, 500]\n\n >>> # view objects are dynamic and reflect dict changes\n >>> del dishes[\'eggs\']\n >>> del dishes[\'sausage\']\n >>> list(keys)\n [\'spam\', \'bacon\']\n\n >>> # set operations\n >>> keys & {\'eggs\', \'bacon\', \'salad\'}\n {\'bacon\'}\n', 'typesmethods': "\nMethods\n*******\n\nMethods are functions that are called using the attribute notation.\nThere are two flavors: built-in methods (such as ``append()`` on\nlists) and class instance methods. Built-in methods are described\nwith the types that support them.\n\nIf you access a method (a function defined in a class namespace)\nthrough an instance, you get a special object: a *bound method* (also\ncalled *instance method*) object. When called, it will add the\n``self`` argument to the argument list. Bound methods have two\nspecial read-only attributes: ``m.__self__`` is the object on which\nthe method operates, and ``m.__func__`` is the function implementing\nthe method. Calling ``m(arg-1, arg-2, ..., arg-n)`` is completely\nequivalent to calling ``m.__func__(m.__self__, arg-1, arg-2, ...,\narg-n)``.\n\nLike function objects, bound method objects support getting arbitrary\nattributes. However, since method attributes are actually stored on\nthe underlying function object (``meth.__func__``), setting method\nattributes on bound methods is disallowed. Attempting to set a method\nattribute results in a ``TypeError`` being raised. In order to set a\nmethod attribute, you need to explicitly set it on the underlying\nfunction object:\n\n class C:\n def method(self):\n pass\n\n c = C()\n c.method.__func__.whoami = 'my name is c'\n\nSee *The standard type hierarchy* for more information.\n", 'typesmodules': "\nModules\n*******\n\nThe only special operation on a module is attribute access:\n``m.name``, where *m* is a module and *name* accesses a name defined\nin *m*'s symbol table. Module attributes can be assigned to. (Note\nthat the ``import`` statement is not, strictly speaking, an operation\non a module object; ``import foo`` does not require a module object\nnamed *foo* to exist, rather it requires an (external) *definition*\nfor a module named *foo* somewhere.)\n\nA special member of every module is ``__dict__``. This is the\ndictionary containing the module's symbol table. Modifying this\ndictionary will actually change the module's symbol table, but direct\nassignment to the ``__dict__`` attribute is not possible (you can\nwrite ``m.__dict__['a'] = 1``, which defines ``m.a`` to be ``1``, but\nyou can't write ``m.__dict__ = {}``). Modifying ``__dict__`` directly\nis not recommended.\n\nModules built into the interpreter are written like this: ````. If loaded from a file, they are written as\n````.\n", - 'typesseq': '\nSequence Types --- ``str``, ``bytes``, ``bytearray``, ``list``, ``tuple``, ``range``\n************************************************************************************\n\nThere are six sequence types: strings, byte sequences (``bytes``\nobjects), byte arrays (``bytearray`` objects), lists, tuples, and\nrange objects. For other containers see the built in ``dict`` and\n``set`` classes, and the ``collections`` module.\n\nStrings contain Unicode characters. Their literals are written in\nsingle or double quotes: ``\'xyzzy\'``, ``"frobozz"``. See *String and\nBytes literals* for more about string literals. In addition to the\nfunctionality described here, there are also string-specific methods\ndescribed in the *String Methods* section.\n\nBytes and bytearray objects contain single bytes -- the former is\nimmutable while the latter is a mutable sequence. Bytes objects can\nbe constructed the constructor, ``bytes()``, and from literals; use a\n``b`` prefix with normal string syntax: ``b\'xyzzy\'``. To construct\nbyte arrays, use the ``bytearray()`` function.\n\nWarning: While string objects are sequences of characters (represented by\n strings of length 1), bytes and bytearray objects are sequences of\n *integers* (between 0 and 255), representing the ASCII value of\n single bytes. That means that for a bytes or bytearray object *b*,\n ``b[0]`` will be an integer, while ``b[0:1]`` will be a bytes or\n bytearray object of length 1. The representation of bytes objects\n uses the literal format (``b\'...\'``) since it is generally more\n useful than e.g. ``bytes([50, 19, 100])``. You can always convert a\n bytes object into a list of integers using ``list(b)``.Also, while\n in previous Python versions, byte strings and Unicode strings could\n be exchanged for each other rather freely (barring encoding issues),\n strings and bytes are now completely separate concepts. There\'s no\n implicit en-/decoding if you pass and object of the wrong type. A\n string always compares unequal to a bytes or bytearray object.\n\nLists are constructed with square brackets, separating items with\ncommas: ``[a, b, c]``. Tuples are constructed by the comma operator\n(not within square brackets), with or without enclosing parentheses,\nbut an empty tuple must have the enclosing parentheses, such as ``a,\nb, c`` or ``()``. A single item tuple must have a trailing comma,\nsuch as ``(d,)``.\n\nObjects of type range are created using the ``range()`` function.\nThey don\'t support slicing, concatenation or repetition, and using\n``in``, ``not in``, ``min()`` or ``max()`` on them is inefficient.\n\nMost sequence types support the following operations. The ``in`` and\n``not in`` operations have the same priorities as the comparison\noperations. The ``+`` and ``*`` operations have the same priority as\nthe corresponding numeric operations. [3] Additional methods are\nprovided for *Mutable Sequence Types*.\n\nThis table lists the sequence operations sorted in ascending priority\n(operations in the same box have the same priority). In the table,\n*s* and *t* are sequences of the same type; *n*, *i* and *j* are\nintegers:\n\n+--------------------+----------------------------------+------------+\n| Operation | Result | Notes |\n+====================+==================================+============+\n| ``x in s`` | ``True`` if an item of *s* is | (1) |\n| | equal to *x*, else ``False`` | |\n+--------------------+----------------------------------+------------+\n| ``x not in s`` | ``False`` if an item of *s* is | (1) |\n| | equal to *x*, else ``True`` | |\n+--------------------+----------------------------------+------------+\n| ``s + t`` | the concatenation of *s* and *t* | (6) |\n+--------------------+----------------------------------+------------+\n| ``s * n, n * s`` | *n* shallow copies of *s* | (2) |\n| | concatenated | |\n+--------------------+----------------------------------+------------+\n| ``s[i]`` | *i*\'th item of *s*, origin 0 | (3) |\n+--------------------+----------------------------------+------------+\n| ``s[i:j]`` | slice of *s* from *i* to *j* | (3)(4) |\n+--------------------+----------------------------------+------------+\n| ``s[i:j:k]`` | slice of *s* from *i* to *j* | (3)(5) |\n| | with step *k* | |\n+--------------------+----------------------------------+------------+\n| ``len(s)`` | length of *s* | |\n+--------------------+----------------------------------+------------+\n| ``min(s)`` | smallest item of *s* | |\n+--------------------+----------------------------------+------------+\n| ``max(s)`` | largest item of *s* | |\n+--------------------+----------------------------------+------------+\n\nSequence types also support comparisons. In particular, tuples and\nlists are compared lexicographically by comparing corresponding\nelements. This means that to compare equal, every element must\ncompare equal and the two sequences must be of the same type and have\nthe same length. (For full details see *Comparisons* in the language\nreference.)\n\nNotes:\n\n1. When *s* is a string object, the ``in`` and ``not in`` operations\n act like a substring test.\n\n2. Values of *n* less than ``0`` are treated as ``0`` (which yields an\n empty sequence of the same type as *s*). Note also that the copies\n are shallow; nested structures are not copied. This often haunts\n new Python programmers; consider:\n\n >>> lists = [[]] * 3\n >>> lists\n [[], [], []]\n >>> lists[0].append(3)\n >>> lists\n [[3], [3], [3]]\n\n What has happened is that ``[[]]`` is a one-element list containing\n an empty list, so all three elements of ``[[]] * 3`` are (pointers\n to) this single empty list. Modifying any of the elements of\n ``lists`` modifies this single list. You can create a list of\n different lists this way:\n\n >>> lists = [[] for i in range(3)]\n >>> lists[0].append(3)\n >>> lists[1].append(5)\n >>> lists[2].append(7)\n >>> lists\n [[3], [5], [7]]\n\n3. If *i* or *j* is negative, the index is relative to the end of the\n string: ``len(s) + i`` or ``len(s) + j`` is substituted. But note\n that ``-0`` is still ``0``.\n\n4. The slice of *s* from *i* to *j* is defined as the sequence of\n items with index *k* such that ``i <= k < j``. If *i* or *j* is\n greater than ``len(s)``, use ``len(s)``. If *i* is omitted or\n ``None``, use ``0``. If *j* is omitted or ``None``, use\n ``len(s)``. If *i* is greater than or equal to *j*, the slice is\n empty.\n\n5. The slice of *s* from *i* to *j* with step *k* is defined as the\n sequence of items with index ``x = i + n*k`` such that ``0 <= n <\n (j-i)/k``. In other words, the indices are ``i``, ``i+k``,\n ``i+2*k``, ``i+3*k`` and so on, stopping when *j* is reached (but\n never including *j*). If *i* or *j* is greater than ``len(s)``,\n use ``len(s)``. If *i* or *j* are omitted or ``None``, they become\n "end" values (which end depends on the sign of *k*). Note, *k*\n cannot be zero. If *k* is ``None``, it is treated like ``1``.\n\n6. If *s* and *t* are both strings, some Python implementations such\n as CPython can usually perform an in-place optimization for\n assignments of the form ``s=s+t`` or ``s+=t``. When applicable,\n this optimization makes quadratic run-time much less likely. This\n optimization is both version and implementation dependent. For\n performance sensitive code, it is preferable to use the\n ``str.join()`` method which assures consistent linear concatenation\n performance across versions and implementations.\n\n\nString Methods\n==============\n\nString objects support the methods listed below. Note that none of\nthese methods take keyword arguments.\n\nIn addition, Python\'s strings support the sequence type methods\ndescribed in the *Sequence Types --- str, bytes, bytearray, list,\ntuple, range* section. To output formatted strings, see the *String\nFormatting* section. Also, see the ``re`` module for string functions\nbased on regular expressions.\n\nstr.capitalize()\n\n Return a copy of the string with only its first character\n capitalized.\n\nstr.center(width[, fillchar])\n\n Return centered in a string of length *width*. Padding is done\n using the specified *fillchar* (default is a space).\n\nstr.count(sub[, start[, end]])\n\n Return the number of non-overlapping occurrences of substring *sub*\n in the range [*start*, *end*]. Optional arguments *start* and\n *end* are interpreted as in slice notation.\n\nstr.encode([encoding[, errors]])\n\n Return an encoded version of the string as a bytes object. Default\n encoding is the current default string encoding. *errors* may be\n given to set a different error handling scheme. The default for\n *errors* is ``\'strict\'``, meaning that encoding errors raise a\n ``UnicodeError``. Other possible values are ``\'ignore\'``,\n ``\'replace\'``, ``\'xmlcharrefreplace\'``, ``\'backslashreplace\'`` and\n any other name registered via ``codecs.register_error()``, see\n section *Codec Base Classes*. For a list of possible encodings, see\n section *Standard Encodings*.\n\nstr.endswith(suffix[, start[, end]])\n\n Return ``True`` if the string ends with the specified *suffix*,\n otherwise return ``False``. *suffix* can also be a tuple of\n suffixes to look for. With optional *start*, test beginning at\n that position. With optional *end*, stop comparing at that\n position.\n\nstr.expandtabs([tabsize])\n\n Return a copy of the string where all tab characters are replaced\n by one or more spaces, depending on the current column and the\n given tab size. The column number is reset to zero after each\n newline occurring in the string. If *tabsize* is not given, a tab\n size of ``8`` characters is assumed. This doesn\'t understand other\n non-printing characters or escape sequences.\n\nstr.find(sub[, start[, end]])\n\n Return the lowest index in the string where substring *sub* is\n found, such that *sub* is contained in the range [*start*, *end*].\n Optional arguments *start* and *end* are interpreted as in slice\n notation. Return ``-1`` if *sub* is not found.\n\nstr.format(*args, **kwargs)\n\n Perform a string formatting operation. The *format_string*\n argument can contain literal text or replacement fields delimited\n by braces ``{}``. Each replacement field contains either the\n numeric index of a positional argument, or the name of a keyword\n argument. Returns a copy of *format_string* where each replacement\n field is replaced with the string value of the corresponding\n argument.\n\n >>> "The sum of 1 + 2 is {0}".format(1+2)\n \'The sum of 1 + 2 is 3\'\n\n See *Format String Syntax* for a description of the various\n formatting options that can be specified in format strings.\n\nstr.index(sub[, start[, end]])\n\n Like ``find()``, but raise ``ValueError`` when the substring is not\n found.\n\nstr.isalnum()\n\n Return true if all characters in the string are alphanumeric and\n there is at least one character, false otherwise.\n\nstr.isalpha()\n\n Return true if all characters in the string are alphabetic and\n there is at least one character, false otherwise.\n\nstr.isdecimal()\n\n Return true if all characters in the string are decimal characters\n and there is at least one character, false otherwise. Decimal\n characters include digit characters, and all characters that that\n can be used to form decimal-radix numbers, e.g. U+0660, ARABIC-\n INDIC DIGIT ZERO.\n\nstr.isdigit()\n\n Return true if all characters in the string are digits and there is\n at least one character, false otherwise.\n\nstr.isidentifier()\n\n Return true if the string is a valid identifier according to the\n language definition, section *Identifiers and keywords*.\n\nstr.islower()\n\n Return true if all cased characters in the string are lowercase and\n there is at least one cased character, false otherwise.\n\nstr.isnumeric()\n\n Return true if all characters in the string are numeric characters,\n and there is at least one character, false otherwise. Numeric\n characters include digit characters, and all characters that have\n the Unicode numeric value property, e.g. U+2155, VULGAR FRACTION\n ONE FIFTH.\n\nstr.isprintable()\n\n Return true if all characters in the string are printable or the\n string is empty, false otherwise. Nonprintable characters are\n those characters defined in the Unicode character database as\n "Other" or "Separator", excepting the ASCII space (0x20) which is\n considered printable. (Note that printable characters in this\n context are those which should not be escaped when ``repr()`` is\n invoked on a string. It has no bearing on the handling of strings\n written to ``sys.stdout`` or ``sys.stderr``.)\n\nstr.isspace()\n\n Return true if there are only whitespace characters in the string\n and there is at least one character, false otherwise.\n\nstr.istitle()\n\n Return true if the string is a titlecased string and there is at\n least one character, for example uppercase characters may only\n follow uncased characters and lowercase characters only cased ones.\n Return false otherwise.\n\nstr.isupper()\n\n Return true if all cased characters in the string are uppercase and\n there is at least one cased character, false otherwise.\n\nstr.join(seq)\n\n Return a string which is the concatenation of the strings in the\n sequence *seq*. A ``TypeError`` will be raised if there are any\n non-string values in *seq*, including ``bytes`` objects. The\n separator between elements is the string providing this method.\n\nstr.ljust(width[, fillchar])\n\n Return the string left justified in a string of length *width*.\n Padding is done using the specified *fillchar* (default is a\n space). The original string is returned if *width* is less than\n ``len(s)``.\n\nstr.lower()\n\n Return a copy of the string converted to lowercase.\n\nstr.lstrip([chars])\n\n Return a copy of the string with leading characters removed. The\n *chars* argument is a string specifying the set of characters to be\n removed. If omitted or ``None``, the *chars* argument defaults to\n removing whitespace. The *chars* argument is not a prefix; rather,\n all combinations of its values are stripped:\n\n >>> \' spacious \'.lstrip()\n \'spacious \'\n >>> \'www.example.com\'.lstrip(\'cmowz.\')\n \'example.com\'\n\nstatic str.maketrans(x[, y[, z]])\n\n This static method returns a translation table usable for\n ``str.translate()``.\n\n If there is only one argument, it must be a dictionary mapping\n Unicode ordinals (integers) or characters (strings of length 1) to\n Unicode ordinals, strings (of arbitrary lengths) or None.\n Character keys will then be converted to ordinals.\n\n If there are two arguments, they must be strings of equal length,\n and in the resulting dictionary, each character in x will be mapped\n to the character at the same position in y. If there is a third\n argument, it must be a string, whose characters will be mapped to\n None in the result.\n\nstr.partition(sep)\n\n Split the string at the first occurrence of *sep*, and return a\n 3-tuple containing the part before the separator, the separator\n itself, and the part after the separator. If the separator is not\n found, return a 3-tuple containing the string itself, followed by\n two empty strings.\n\nstr.replace(old, new[, count])\n\n Return a copy of the string with all occurrences of substring *old*\n replaced by *new*. If the optional argument *count* is given, only\n the first *count* occurrences are replaced.\n\nstr.rfind(sub[, start[, end]])\n\n Return the highest index in the string where substring *sub* is\n found, such that *sub* is contained within s[start,end]. Optional\n arguments *start* and *end* are interpreted as in slice notation.\n Return ``-1`` on failure.\n\nstr.rindex(sub[, start[, end]])\n\n Like ``rfind()`` but raises ``ValueError`` when the substring *sub*\n is not found.\n\nstr.rjust(width[, fillchar])\n\n Return the string right justified in a string of length *width*.\n Padding is done using the specified *fillchar* (default is a\n space). The original string is returned if *width* is less than\n ``len(s)``.\n\nstr.rpartition(sep)\n\n Split the string at the last occurrence of *sep*, and return a\n 3-tuple containing the part before the separator, the separator\n itself, and the part after the separator. If the separator is not\n found, return a 3-tuple containing two empty strings, followed by\n the string itself.\n\nstr.rsplit([sep[, maxsplit]])\n\n Return a list of the words in the string, using *sep* as the\n delimiter string. If *maxsplit* is given, at most *maxsplit* splits\n are done, the *rightmost* ones. If *sep* is not specified or\n ``None``, any whitespace string is a separator. Except for\n splitting from the right, ``rsplit()`` behaves like ``split()``\n which is described in detail below.\n\nstr.rstrip([chars])\n\n Return a copy of the string with trailing characters removed. The\n *chars* argument is a string specifying the set of characters to be\n removed. If omitted or ``None``, the *chars* argument defaults to\n removing whitespace. The *chars* argument is not a suffix; rather,\n all combinations of its values are stripped:\n\n >>> \' spacious \'.rstrip()\n \' spacious\'\n >>> \'mississippi\'.rstrip(\'ipz\')\n \'mississ\'\n\nstr.split([sep[, maxsplit]])\n\n Return a list of the words in the string, using *sep* as the\n delimiter string. If *maxsplit* is given, at most *maxsplit*\n splits are done (thus, the list will have at most ``maxsplit+1``\n elements). If *maxsplit* is not specified, then there is no limit\n on the number of splits (all possible splits are made).\n\n If *sep* is given, consecutive delimiters are not grouped together\n and are deemed to delimit empty strings (for example,\n ``\'1,,2\'.split(\',\')`` returns ``[\'1\', \'\', \'2\']``). The *sep*\n argument may consist of multiple characters (for example,\n ``\'1<>2<>3\'.split(\'<>\')`` returns ``[\'1\', \'2\', \'3\']``). Splitting\n an empty string with a specified separator returns ``[\'\']``.\n\n If *sep* is not specified or is ``None``, a different splitting\n algorithm is applied: runs of consecutive whitespace are regarded\n as a single separator, and the result will contain no empty strings\n at the start or end if the string has leading or trailing\n whitespace. Consequently, splitting an empty string or a string\n consisting of just whitespace with a ``None`` separator returns\n ``[]``.\n\n For example, ``\' 1 2 3 \'.split()`` returns ``[\'1\', \'2\', \'3\']``,\n and ``\' 1 2 3 \'.split(None, 1)`` returns ``[\'1\', \'2 3 \']``.\n\nstr.splitlines([keepends])\n\n Return a list of the lines in the string, breaking at line\n boundaries. Line breaks are not included in the resulting list\n unless *keepends* is given and true.\n\nstr.startswith(prefix[, start[, end]])\n\n Return ``True`` if string starts with the *prefix*, otherwise\n return ``False``. *prefix* can also be a tuple of prefixes to look\n for. With optional *start*, test string beginning at that\n position. With optional *end*, stop comparing string at that\n position.\n\nstr.strip([chars])\n\n Return a copy of the string with the leading and trailing\n characters removed. The *chars* argument is a string specifying the\n set of characters to be removed. If omitted or ``None``, the\n *chars* argument defaults to removing whitespace. The *chars*\n argument is not a prefix or suffix; rather, all combinations of its\n values are stripped:\n\n >>> \' spacious \'.strip()\n \'spacious\'\n >>> \'www.example.com\'.strip(\'cmowz.\')\n \'example\'\n\nstr.swapcase()\n\n Return a copy of the string with uppercase characters converted to\n lowercase and vice versa.\n\nstr.title()\n\n Return a titlecased version of the string: words start with\n uppercase characters, all remaining cased characters are lowercase.\n\nstr.translate(map)\n\n Return a copy of the *s* where all characters have been mapped\n through the *map* which must be a dictionary of Unicode ordinals\n (integers) to Unicode ordinals, strings or ``None``. Unmapped\n characters are left untouched. Characters mapped to ``None`` are\n deleted.\n\n You can use ``str.maketrans()`` to create a translation map from\n character-to-character mappings in different formats.\n\n Note: An even more flexible approach is to create a custom character\n mapping codec using the ``codecs`` module (see\n ``encodings.cp1251`` for an example).\n\nstr.upper()\n\n Return a copy of the string converted to uppercase.\n\nstr.zfill(width)\n\n Return the numeric string left filled with zeros in a string of\n length *width*. A sign prefix is handled correctly. The original\n string is returned if *width* is less than ``len(s)``.\n\n\nOld String Formatting Operations\n================================\n\nNote: The formatting operations described here are obsolete and may go\n away in future versions of Python. Use the new *String Formatting*\n in new code.\n\nString objects have one unique built-in operation: the ``%`` operator\n(modulo). This is also known as the string *formatting* or\n*interpolation* operator. Given ``format % values`` (where *format* is\na string), ``%`` conversion specifications in *format* are replaced\nwith zero or more elements of *values*. The effect is similar to the\nusing ``sprintf()`` in the C language.\n\nIf *format* requires a single argument, *values* may be a single non-\ntuple object. [4] Otherwise, *values* must be a tuple with exactly\nthe number of items specified by the format string, or a single\nmapping object (for example, a dictionary).\n\nA conversion specifier contains two or more characters and has the\nfollowing components, which must occur in this order:\n\n1. The ``\'%\'`` character, which marks the start of the specifier.\n\n2. Mapping key (optional), consisting of a parenthesised sequence of\n characters (for example, ``(somename)``).\n\n3. Conversion flags (optional), which affect the result of some\n conversion types.\n\n4. Minimum field width (optional). If specified as an ``\'*\'``\n (asterisk), the actual width is read from the next element of the\n tuple in *values*, and the object to convert comes after the\n minimum field width and optional precision.\n\n5. Precision (optional), given as a ``\'.\'`` (dot) followed by the\n precision. If specified as ``\'*\'`` (an asterisk), the actual width\n is read from the next element of the tuple in *values*, and the\n value to convert comes after the precision.\n\n6. Length modifier (optional).\n\n7. Conversion type.\n\nWhen the right argument is a dictionary (or other mapping type), then\nthe formats in the string *must* include a parenthesised mapping key\ninto that dictionary inserted immediately after the ``\'%\'`` character.\nThe mapping key selects the value to be formatted from the mapping.\nFor example:\n\n>>> print(\'%(language)s has %(#)03d quote types.\' % \\\n... {\'language\': "Python", "#": 2})\nPython has 002 quote types.\n\nIn this case no ``*`` specifiers may occur in a format (since they\nrequire a sequential parameter list).\n\nThe conversion flag characters are:\n\n+-----------+-----------------------------------------------------------------------+\n| Flag | Meaning |\n+===========+=======================================================================+\n| ``\'#\'`` | The value conversion will use the "alternate form" (where defined |\n| | below). |\n+-----------+-----------------------------------------------------------------------+\n| ``\'0\'`` | The conversion will be zero padded for numeric values. |\n+-----------+-----------------------------------------------------------------------+\n| ``\'-\'`` | The converted value is left adjusted (overrides the ``\'0\'`` |\n| | conversion if both are given). |\n+-----------+-----------------------------------------------------------------------+\n| ``\' \'`` | (a space) A blank should be left before a positive number (or empty |\n| | string) produced by a signed conversion. |\n+-----------+-----------------------------------------------------------------------+\n| ``\'+\'`` | A sign character (``\'+\'`` or ``\'-\'``) will precede the conversion |\n| | (overrides a "space" flag). |\n+-----------+-----------------------------------------------------------------------+\n\nA length modifier (``h``, ``l``, or ``L``) may be present, but is\nignored as it is not necessary for Python -- so e.g. ``%ld`` is\nidentical to ``%d``.\n\nThe conversion types are:\n\n+--------------+-------------------------------------------------------+---------+\n| Conversion | Meaning | Notes |\n+==============+=======================================================+=========+\n| ``\'d\'`` | Signed integer decimal. | |\n+--------------+-------------------------------------------------------+---------+\n| ``\'i\'`` | Signed integer decimal. | |\n+--------------+-------------------------------------------------------+---------+\n| ``\'o\'`` | Signed octal value. | (1) |\n+--------------+-------------------------------------------------------+---------+\n| ``\'u\'`` | Obsolete type -- it is identical to ``\'d\'``. | (7) |\n+--------------+-------------------------------------------------------+---------+\n| ``\'x\'`` | Signed hexadecimal (lowercase). | (2) |\n+--------------+-------------------------------------------------------+---------+\n| ``\'X\'`` | Signed hexadecimal (uppercase). | (2) |\n+--------------+-------------------------------------------------------+---------+\n| ``\'e\'`` | Floating point exponential format (lowercase). | (3) |\n+--------------+-------------------------------------------------------+---------+\n| ``\'E\'`` | Floating point exponential format (uppercase). | (3) |\n+--------------+-------------------------------------------------------+---------+\n| ``\'f\'`` | Floating point decimal format. | (3) |\n+--------------+-------------------------------------------------------+---------+\n| ``\'F\'`` | Floating point decimal format. | (3) |\n+--------------+-------------------------------------------------------+---------+\n| ``\'g\'`` | Floating point format. Uses lowercase exponential | (4) |\n| | format if exponent is less than -4 or not less than | |\n| | precision, decimal format otherwise. | |\n+--------------+-------------------------------------------------------+---------+\n| ``\'G\'`` | Floating point format. Uses uppercase exponential | (4) |\n| | format if exponent is less than -4 or not less than | |\n| | precision, decimal format otherwise. | |\n+--------------+-------------------------------------------------------+---------+\n| ``\'c\'`` | Single character (accepts integer or single character | |\n| | string). | |\n+--------------+-------------------------------------------------------+---------+\n| ``\'r\'`` | String (converts any python object using ``repr()``). | (5) |\n+--------------+-------------------------------------------------------+---------+\n| ``\'s\'`` | String (converts any python object using ``str()``). | |\n+--------------+-------------------------------------------------------+---------+\n| ``\'%\'`` | No argument is converted, results in a ``\'%\'`` | |\n| | character in the result. | |\n+--------------+-------------------------------------------------------+---------+\n\nNotes:\n\n1. The alternate form causes a leading zero (``\'0\'``) to be inserted\n between left-hand padding and the formatting of the number if the\n leading character of the result is not already a zero.\n\n2. The alternate form causes a leading ``\'0x\'`` or ``\'0X\'`` (depending\n on whether the ``\'x\'`` or ``\'X\'`` format was used) to be inserted\n between left-hand padding and the formatting of the number if the\n leading character of the result is not already a zero.\n\n3. The alternate form causes the result to always contain a decimal\n point, even if no digits follow it.\n\n The precision determines the number of digits after the decimal\n point and defaults to 6.\n\n4. The alternate form causes the result to always contain a decimal\n point, and trailing zeroes are not removed as they would otherwise\n be.\n\n The precision determines the number of significant digits before\n and after the decimal point and defaults to 6.\n\n5. The precision determines the maximal number of characters used.\n\n1. See **PEP 237**.\n\nSince Python strings have an explicit length, ``%s`` conversions do\nnot assume that ``\'\\0\'`` is the end of the string.\n\nChanged in version 3.1: ``%f`` conversions for numbers whose absolute\nvalue is over 1e50 are no longer replaced by ``%g`` conversions.\n\nAdditional string operations are defined in standard modules\n``string`` and ``re``.\n\n\nRange Type\n==========\n\nThe ``range`` type is an immutable sequence which is commonly used for\nlooping. The advantage of the ``range`` type is that an ``range``\nobject will always take the same amount of memory, no matter the size\nof the range it represents. There are no consistent performance\nadvantages.\n\nRange objects have very little behavior: they only support indexing,\niteration, and the ``len()`` function.\n\n\nMutable Sequence Types\n======================\n\nList and bytearray objects support additional operations that allow\nin-place modification of the object. Other mutable sequence types\n(when added to the language) should also support these operations.\nStrings and tuples are immutable sequence types: such objects cannot\nbe modified once created. The following operations are defined on\nmutable sequence types (where *x* is an arbitrary object).\n\nNote that while lists allow their items to be of any type, bytearray\nobject "items" are all integers in the range 0 <= x < 256.\n\n+--------------------------------+----------------------------------+-----------------------+\n| Operation | Result | Notes |\n+================================+==================================+=======================+\n| ``s[i] = x`` | item *i* of *s* is replaced by | |\n| | *x* | |\n+--------------------------------+----------------------------------+-----------------------+\n| ``s[i:j] = t`` | slice of *s* from *i* to *j* is | |\n| | replaced by the contents of the | |\n| | iterable *t* | |\n+--------------------------------+----------------------------------+-----------------------+\n| ``del s[i:j]`` | same as ``s[i:j] = []`` | |\n+--------------------------------+----------------------------------+-----------------------+\n| ``s[i:j:k] = t`` | the elements of ``s[i:j:k]`` are | (1) |\n| | replaced by those of *t* | |\n+--------------------------------+----------------------------------+-----------------------+\n| ``del s[i:j:k]`` | removes the elements of | |\n| | ``s[i:j:k]`` from the list | |\n+--------------------------------+----------------------------------+-----------------------+\n| ``s.append(x)`` | same as ``s[len(s):len(s)] = | |\n| | [x]`` | |\n+--------------------------------+----------------------------------+-----------------------+\n| ``s.extend(x)`` | same as ``s[len(s):len(s)] = x`` | (2) |\n+--------------------------------+----------------------------------+-----------------------+\n| ``s.count(x)`` | return number of *i*\'s for which | |\n| | ``s[i] == x`` | |\n+--------------------------------+----------------------------------+-----------------------+\n| ``s.index(x[, i[, j]])`` | return smallest *k* such that | (3) |\n| | ``s[k] == x`` and ``i <= k < j`` | |\n+--------------------------------+----------------------------------+-----------------------+\n| ``s.insert(i, x)`` | same as ``s[i:i] = [x]`` | (4) |\n+--------------------------------+----------------------------------+-----------------------+\n| ``s.pop([i])`` | same as ``x = s[i]; del s[i]; | (5) |\n| | return x`` | |\n+--------------------------------+----------------------------------+-----------------------+\n| ``s.remove(x)`` | same as ``del s[s.index(x)]`` | (3) |\n+--------------------------------+----------------------------------+-----------------------+\n| ``s.reverse()`` | reverses the items of *s* in | (6) |\n| | place | |\n+--------------------------------+----------------------------------+-----------------------+\n| ``s.sort([key[, reverse]])`` | sort the items of *s* in place | (6), (7), (8) |\n+--------------------------------+----------------------------------+-----------------------+\n\nNotes:\n\n1. *t* must have the same length as the slice it is replacing.\n\n2. *x* can be any iterable object.\n\n3. Raises ``ValueError`` when *x* is not found in *s*. When a negative\n index is passed as the second or third parameter to the ``index()``\n method, the sequence length is added, as for slice indices. If it\n is still negative, it is truncated to zero, as for slice indices.\n\n4. When a negative index is passed as the first parameter to the\n ``insert()`` method, the sequence length is added, as for slice\n indices. If it is still negative, it is truncated to zero, as for\n slice indices.\n\n5. The optional argument *i* defaults to ``-1``, so that by default\n the last item is removed and returned.\n\n6. The ``sort()`` and ``reverse()`` methods modify the sequence in\n place for economy of space when sorting or reversing a large\n sequence. To remind you that they operate by side effect, they\n don\'t return the sorted or reversed sequence.\n\n7. The ``sort()`` method takes optional arguments for controlling the\n comparisons. Each must be specified as a keyword argument.\n\n *key* specifies a function of one argument that is used to extract\n a comparison key from each list element: ``key=str.lower``. The\n default value is ``None``.\n\n *reverse* is a boolean value. If set to ``True``, then the list\n elements are sorted as if each comparison were reversed.\n\n The ``sort()`` method is guaranteed to be stable. A sort is stable\n if it guarantees not to change the relative order of elements that\n compare equal --- this is helpful for sorting in multiple passes\n (for example, sort by department, then by salary grade).\n\n While a list is being sorted, the effect of attempting to mutate,\n or even inspect, the list is undefined. The C implementation makes\n the list appear empty for the duration, and raises ``ValueError``\n if it can detect that the list has been mutated during a sort.\n\n8. ``sort()`` is not supported by ``bytearray`` objects.\n\n\nBytes and Byte Array Methods\n============================\n\nBytes and bytearray objects, being "strings of bytes", have all\nmethods found on strings, with the exception of ``encode()``,\n``format()`` and ``isidentifier()``, which do not make sense with\nthese types. For converting the objects to strings, they have a\n``decode()`` method.\n\nWherever one of these methods needs to interpret the bytes as\ncharacters (e.g. the ``is...()`` methods), the ASCII character set is\nassumed.\n\nNote: The methods on bytes and bytearray objects don\'t accept strings as\n their arguments, just as the methods on strings don\'t accept bytes\n as their arguments. For example, you have to write\n\n a = "abc"\n b = a.replace("a", "f")\n\n and\n\n a = b"abc"\n b = a.replace(b"a", b"f")\n\nbytes.decode([encoding[, errors]])\nbytearray.decode([encoding[, errors]])\n\n Return a string decoded from the given bytes. Default encoding is\n the current default string encoding. *errors* may be given to set\n a different error handling scheme. The default for *errors* is\n ``\'strict\'``, meaning that encoding errors raise a\n ``UnicodeError``. Other possible values are ``\'ignore\'``,\n ``\'replace\'`` and any other name registered via\n ``codecs.register_error()``, see section *Codec Base Classes*. For\n a list of possible encodings, see section *Standard Encodings*.\n\nThe bytes and bytearray types have an additional class method:\n\nclassmethod bytes.fromhex(string)\nclassmethod bytearray.fromhex(string)\n\n This ``bytes`` class method returns a bytes or bytearray object,\n decoding the given string object. The string must contain two\n hexadecimal digits per byte, spaces are ignored.\n\n >>> bytes.fromhex(\'f0 f1f2 \')\n b\'\\xf0\\xf1\\xf2\'\n\nThe maketrans and translate methods differ in semantics from the\nversions available on strings:\n\nbytes.translate(table[, delete])\n\n Return a copy of the bytes or bytearray object where all bytes\n occurring in the optional argument *delete* are removed, and the\n remaining bytes have been mapped through the given translation\n table, which must be a bytes object of length 256.\n\n You can use the ``bytes.maketrans()`` method to create a\n translation table.\n\n Set the *table* argument to ``None`` for translations that only\n delete characters:\n\n >>> b\'read this short text\'.translate(None, b\'aeiou\')\n b\'rd ths shrt txt\'\n\nstatic bytes.maketrans(from, to)\n\n This static method returns a translation table usable for\n ``bytes.translate()`` that will map each character in *from* into\n the character at the same position in *to*; *from* and *to* must be\n bytes objects and have the same length.\n\n New in version 3.1.\n', + 'typesseq': '\nSequence Types --- ``str``, ``bytes``, ``bytearray``, ``list``, ``tuple``, ``range``\n************************************************************************************\n\nThere are six sequence types: strings, byte sequences (``bytes``\nobjects), byte arrays (``bytearray`` objects), lists, tuples, and\nrange objects. For other containers see the built in ``dict`` and\n``set`` classes, and the ``collections`` module.\n\nStrings contain Unicode characters. Their literals are written in\nsingle or double quotes: ``\'xyzzy\'``, ``"frobozz"``. See *String and\nBytes literals* for more about string literals. In addition to the\nfunctionality described here, there are also string-specific methods\ndescribed in the *String Methods* section.\n\nBytes and bytearray objects contain single bytes -- the former is\nimmutable while the latter is a mutable sequence. Bytes objects can\nbe constructed the constructor, ``bytes()``, and from literals; use a\n``b`` prefix with normal string syntax: ``b\'xyzzy\'``. To construct\nbyte arrays, use the ``bytearray()`` function.\n\nWarning: While string objects are sequences of characters (represented by\n strings of length 1), bytes and bytearray objects are sequences of\n *integers* (between 0 and 255), representing the ASCII value of\n single bytes. That means that for a bytes or bytearray object *b*,\n ``b[0]`` will be an integer, while ``b[0:1]`` will be a bytes or\n bytearray object of length 1. The representation of bytes objects\n uses the literal format (``b\'...\'``) since it is generally more\n useful than e.g. ``bytes([50, 19, 100])``. You can always convert a\n bytes object into a list of integers using ``list(b)``.Also, while\n in previous Python versions, byte strings and Unicode strings could\n be exchanged for each other rather freely (barring encoding issues),\n strings and bytes are now completely separate concepts. There\'s no\n implicit en-/decoding if you pass and object of the wrong type. A\n string always compares unequal to a bytes or bytearray object.\n\nLists are constructed with square brackets, separating items with\ncommas: ``[a, b, c]``. Tuples are constructed by the comma operator\n(not within square brackets), with or without enclosing parentheses,\nbut an empty tuple must have the enclosing parentheses, such as ``a,\nb, c`` or ``()``. A single item tuple must have a trailing comma,\nsuch as ``(d,)``.\n\nObjects of type range are created using the ``range()`` function.\nThey don\'t support slicing, concatenation or repetition, and using\n``in``, ``not in``, ``min()`` or ``max()`` on them is inefficient.\n\nMost sequence types support the following operations. The ``in`` and\n``not in`` operations have the same priorities as the comparison\noperations. The ``+`` and ``*`` operations have the same priority as\nthe corresponding numeric operations. [3] Additional methods are\nprovided for *Mutable Sequence Types*.\n\nThis table lists the sequence operations sorted in ascending priority\n(operations in the same box have the same priority). In the table,\n*s* and *t* are sequences of the same type; *n*, *i* and *j* are\nintegers:\n\n+--------------------+----------------------------------+------------+\n| Operation | Result | Notes |\n+====================+==================================+============+\n| ``x in s`` | ``True`` if an item of *s* is | (1) |\n| | equal to *x*, else ``False`` | |\n+--------------------+----------------------------------+------------+\n| ``x not in s`` | ``False`` if an item of *s* is | (1) |\n| | equal to *x*, else ``True`` | |\n+--------------------+----------------------------------+------------+\n| ``s + t`` | the concatenation of *s* and *t* | (6) |\n+--------------------+----------------------------------+------------+\n| ``s * n, n * s`` | *n* shallow copies of *s* | (2) |\n| | concatenated | |\n+--------------------+----------------------------------+------------+\n| ``s[i]`` | *i*\'th item of *s*, origin 0 | (3) |\n+--------------------+----------------------------------+------------+\n| ``s[i:j]`` | slice of *s* from *i* to *j* | (3)(4) |\n+--------------------+----------------------------------+------------+\n| ``s[i:j:k]`` | slice of *s* from *i* to *j* | (3)(5) |\n| | with step *k* | |\n+--------------------+----------------------------------+------------+\n| ``len(s)`` | length of *s* | |\n+--------------------+----------------------------------+------------+\n| ``min(s)`` | smallest item of *s* | |\n+--------------------+----------------------------------+------------+\n| ``max(s)`` | largest item of *s* | |\n+--------------------+----------------------------------+------------+\n\nSequence types also support comparisons. In particular, tuples and\nlists are compared lexicographically by comparing corresponding\nelements. This means that to compare equal, every element must\ncompare equal and the two sequences must be of the same type and have\nthe same length. (For full details see *Comparisons* in the language\nreference.)\n\nNotes:\n\n1. When *s* is a string object, the ``in`` and ``not in`` operations\n act like a substring test.\n\n2. Values of *n* less than ``0`` are treated as ``0`` (which yields an\n empty sequence of the same type as *s*). Note also that the copies\n are shallow; nested structures are not copied. This often haunts\n new Python programmers; consider:\n\n >>> lists = [[]] * 3\n >>> lists\n [[], [], []]\n >>> lists[0].append(3)\n >>> lists\n [[3], [3], [3]]\n\n What has happened is that ``[[]]`` is a one-element list containing\n an empty list, so all three elements of ``[[]] * 3`` are (pointers\n to) this single empty list. Modifying any of the elements of\n ``lists`` modifies this single list. You can create a list of\n different lists this way:\n\n >>> lists = [[] for i in range(3)]\n >>> lists[0].append(3)\n >>> lists[1].append(5)\n >>> lists[2].append(7)\n >>> lists\n [[3], [5], [7]]\n\n3. If *i* or *j* is negative, the index is relative to the end of the\n string: ``len(s) + i`` or ``len(s) + j`` is substituted. But note\n that ``-0`` is still ``0``.\n\n4. The slice of *s* from *i* to *j* is defined as the sequence of\n items with index *k* such that ``i <= k < j``. If *i* or *j* is\n greater than ``len(s)``, use ``len(s)``. If *i* is omitted or\n ``None``, use ``0``. If *j* is omitted or ``None``, use\n ``len(s)``. If *i* is greater than or equal to *j*, the slice is\n empty.\n\n5. The slice of *s* from *i* to *j* with step *k* is defined as the\n sequence of items with index ``x = i + n*k`` such that ``0 <= n <\n (j-i)/k``. In other words, the indices are ``i``, ``i+k``,\n ``i+2*k``, ``i+3*k`` and so on, stopping when *j* is reached (but\n never including *j*). If *i* or *j* is greater than ``len(s)``,\n use ``len(s)``. If *i* or *j* are omitted or ``None``, they become\n "end" values (which end depends on the sign of *k*). Note, *k*\n cannot be zero. If *k* is ``None``, it is treated like ``1``.\n\n6. If *s* and *t* are both strings, some Python implementations such\n as CPython can usually perform an in-place optimization for\n assignments of the form ``s=s+t`` or ``s+=t``. When applicable,\n this optimization makes quadratic run-time much less likely. This\n optimization is both version and implementation dependent. For\n performance sensitive code, it is preferable to use the\n ``str.join()`` method which assures consistent linear concatenation\n performance across versions and implementations.\n\n\nString Methods\n==============\n\nString objects support the methods listed below. Note that none of\nthese methods take keyword arguments.\n\nIn addition, Python\'s strings support the sequence type methods\ndescribed in the *Sequence Types --- str, bytes, bytearray, list,\ntuple, range* section. To output formatted strings, see the *String\nFormatting* section. Also, see the ``re`` module for string functions\nbased on regular expressions.\n\nstr.capitalize()\n\n Return a copy of the string with only its first character\n capitalized.\n\nstr.center(width[, fillchar])\n\n Return centered in a string of length *width*. Padding is done\n using the specified *fillchar* (default is a space).\n\nstr.count(sub[, start[, end]])\n\n Return the number of non-overlapping occurrences of substring *sub*\n in the range [*start*, *end*]. Optional arguments *start* and\n *end* are interpreted as in slice notation.\n\nstr.encode([encoding[, errors]])\n\n Return an encoded version of the string as a bytes object. Default\n encoding is the current default string encoding. *errors* may be\n given to set a different error handling scheme. The default for\n *errors* is ``\'strict\'``, meaning that encoding errors raise a\n ``UnicodeError``. Other possible values are ``\'ignore\'``,\n ``\'replace\'``, ``\'xmlcharrefreplace\'``, ``\'backslashreplace\'`` and\n any other name registered via ``codecs.register_error()``, see\n section *Codec Base Classes*. For a list of possible encodings, see\n section *Standard Encodings*.\n\nstr.endswith(suffix[, start[, end]])\n\n Return ``True`` if the string ends with the specified *suffix*,\n otherwise return ``False``. *suffix* can also be a tuple of\n suffixes to look for. With optional *start*, test beginning at\n that position. With optional *end*, stop comparing at that\n position.\n\nstr.expandtabs([tabsize])\n\n Return a copy of the string where all tab characters are replaced\n by one or more spaces, depending on the current column and the\n given tab size. The column number is reset to zero after each\n newline occurring in the string. If *tabsize* is not given, a tab\n size of ``8`` characters is assumed. This doesn\'t understand other\n non-printing characters or escape sequences.\n\nstr.find(sub[, start[, end]])\n\n Return the lowest index in the string where substring *sub* is\n found, such that *sub* is contained in the range [*start*, *end*].\n Optional arguments *start* and *end* are interpreted as in slice\n notation. Return ``-1`` if *sub* is not found.\n\nstr.format(*args, **kwargs)\n\n Perform a string formatting operation. The *format_string*\n argument can contain literal text or replacement fields delimited\n by braces ``{}``. Each replacement field contains either the\n numeric index of a positional argument, or the name of a keyword\n argument. Returns a copy of *format_string* where each replacement\n field is replaced with the string value of the corresponding\n argument.\n\n >>> "The sum of 1 + 2 is {0}".format(1+2)\n \'The sum of 1 + 2 is 3\'\n\n See *Format String Syntax* for a description of the various\n formatting options that can be specified in format strings.\n\nstr.index(sub[, start[, end]])\n\n Like ``find()``, but raise ``ValueError`` when the substring is not\n found.\n\nstr.isalnum()\n\n Return true if all characters in the string are alphanumeric and\n there is at least one character, false otherwise.\n\nstr.isalpha()\n\n Return true if all characters in the string are alphabetic and\n there is at least one character, false otherwise.\n\nstr.isdecimal()\n\n Return true if all characters in the string are decimal characters\n and there is at least one character, false otherwise. Decimal\n characters include digit characters, and all characters that that\n can be used to form decimal-radix numbers, e.g. U+0660, ARABIC-\n INDIC DIGIT ZERO.\n\nstr.isdigit()\n\n Return true if all characters in the string are digits and there is\n at least one character, false otherwise.\n\nstr.isidentifier()\n\n Return true if the string is a valid identifier according to the\n language definition, section *Identifiers and keywords*.\n\nstr.islower()\n\n Return true if all cased characters in the string are lowercase and\n there is at least one cased character, false otherwise.\n\nstr.isnumeric()\n\n Return true if all characters in the string are numeric characters,\n and there is at least one character, false otherwise. Numeric\n characters include digit characters, and all characters that have\n the Unicode numeric value property, e.g. U+2155, VULGAR FRACTION\n ONE FIFTH.\n\nstr.isprintable()\n\n Return true if all characters in the string are printable or the\n string is empty, false otherwise. Nonprintable characters are\n those characters defined in the Unicode character database as\n "Other" or "Separator", excepting the ASCII space (0x20) which is\n considered printable. (Note that printable characters in this\n context are those which should not be escaped when ``repr()`` is\n invoked on a string. It has no bearing on the handling of strings\n written to ``sys.stdout`` or ``sys.stderr``.)\n\nstr.isspace()\n\n Return true if there are only whitespace characters in the string\n and there is at least one character, false otherwise.\n\nstr.istitle()\n\n Return true if the string is a titlecased string and there is at\n least one character, for example uppercase characters may only\n follow uncased characters and lowercase characters only cased ones.\n Return false otherwise.\n\nstr.isupper()\n\n Return true if all cased characters in the string are uppercase and\n there is at least one cased character, false otherwise.\n\nstr.join(seq)\n\n Return a string which is the concatenation of the strings in the\n sequence *seq*. A ``TypeError`` will be raised if there are any\n non-string values in *seq*, including ``bytes`` objects. The\n separator between elements is the string providing this method.\n\nstr.ljust(width[, fillchar])\n\n Return the string left justified in a string of length *width*.\n Padding is done using the specified *fillchar* (default is a\n space). The original string is returned if *width* is less than\n ``len(s)``.\n\nstr.lower()\n\n Return a copy of the string converted to lowercase.\n\nstr.lstrip([chars])\n\n Return a copy of the string with leading characters removed. The\n *chars* argument is a string specifying the set of characters to be\n removed. If omitted or ``None``, the *chars* argument defaults to\n removing whitespace. The *chars* argument is not a prefix; rather,\n all combinations of its values are stripped:\n\n >>> \' spacious \'.lstrip()\n \'spacious \'\n >>> \'www.example.com\'.lstrip(\'cmowz.\')\n \'example.com\'\n\nstatic str.maketrans(x[, y[, z]])\n\n This static method returns a translation table usable for\n ``str.translate()``.\n\n If there is only one argument, it must be a dictionary mapping\n Unicode ordinals (integers) or characters (strings of length 1) to\n Unicode ordinals, strings (of arbitrary lengths) or None.\n Character keys will then be converted to ordinals.\n\n If there are two arguments, they must be strings of equal length,\n and in the resulting dictionary, each character in x will be mapped\n to the character at the same position in y. If there is a third\n argument, it must be a string, whose characters will be mapped to\n None in the result.\n\nstr.partition(sep)\n\n Split the string at the first occurrence of *sep*, and return a\n 3-tuple containing the part before the separator, the separator\n itself, and the part after the separator. If the separator is not\n found, return a 3-tuple containing the string itself, followed by\n two empty strings.\n\nstr.replace(old, new[, count])\n\n Return a copy of the string with all occurrences of substring *old*\n replaced by *new*. If the optional argument *count* is given, only\n the first *count* occurrences are replaced.\n\nstr.rfind(sub[, start[, end]])\n\n Return the highest index in the string where substring *sub* is\n found, such that *sub* is contained within s[start,end]. Optional\n arguments *start* and *end* are interpreted as in slice notation.\n Return ``-1`` on failure.\n\nstr.rindex(sub[, start[, end]])\n\n Like ``rfind()`` but raises ``ValueError`` when the substring *sub*\n is not found.\n\nstr.rjust(width[, fillchar])\n\n Return the string right justified in a string of length *width*.\n Padding is done using the specified *fillchar* (default is a\n space). The original string is returned if *width* is less than\n ``len(s)``.\n\nstr.rpartition(sep)\n\n Split the string at the last occurrence of *sep*, and return a\n 3-tuple containing the part before the separator, the separator\n itself, and the part after the separator. If the separator is not\n found, return a 3-tuple containing two empty strings, followed by\n the string itself.\n\nstr.rsplit([sep[, maxsplit]])\n\n Return a list of the words in the string, using *sep* as the\n delimiter string. If *maxsplit* is given, at most *maxsplit* splits\n are done, the *rightmost* ones. If *sep* is not specified or\n ``None``, any whitespace string is a separator. Except for\n splitting from the right, ``rsplit()`` behaves like ``split()``\n which is described in detail below.\n\nstr.rstrip([chars])\n\n Return a copy of the string with trailing characters removed. The\n *chars* argument is a string specifying the set of characters to be\n removed. If omitted or ``None``, the *chars* argument defaults to\n removing whitespace. The *chars* argument is not a suffix; rather,\n all combinations of its values are stripped:\n\n >>> \' spacious \'.rstrip()\n \' spacious\'\n >>> \'mississippi\'.rstrip(\'ipz\')\n \'mississ\'\n\nstr.split([sep[, maxsplit]])\n\n Return a list of the words in the string, using *sep* as the\n delimiter string. If *maxsplit* is given, at most *maxsplit*\n splits are done (thus, the list will have at most ``maxsplit+1``\n elements). If *maxsplit* is not specified, then there is no limit\n on the number of splits (all possible splits are made).\n\n If *sep* is given, consecutive delimiters are not grouped together\n and are deemed to delimit empty strings (for example,\n ``\'1,,2\'.split(\',\')`` returns ``[\'1\', \'\', \'2\']``). The *sep*\n argument may consist of multiple characters (for example,\n ``\'1<>2<>3\'.split(\'<>\')`` returns ``[\'1\', \'2\', \'3\']``). Splitting\n an empty string with a specified separator returns ``[\'\']``.\n\n If *sep* is not specified or is ``None``, a different splitting\n algorithm is applied: runs of consecutive whitespace are regarded\n as a single separator, and the result will contain no empty strings\n at the start or end if the string has leading or trailing\n whitespace. Consequently, splitting an empty string or a string\n consisting of just whitespace with a ``None`` separator returns\n ``[]``.\n\n For example, ``\' 1 2 3 \'.split()`` returns ``[\'1\', \'2\', \'3\']``,\n and ``\' 1 2 3 \'.split(None, 1)`` returns ``[\'1\', \'2 3 \']``.\n\nstr.splitlines([keepends])\n\n Return a list of the lines in the string, breaking at line\n boundaries. Line breaks are not included in the resulting list\n unless *keepends* is given and true.\n\nstr.startswith(prefix[, start[, end]])\n\n Return ``True`` if string starts with the *prefix*, otherwise\n return ``False``. *prefix* can also be a tuple of prefixes to look\n for. With optional *start*, test string beginning at that\n position. With optional *end*, stop comparing string at that\n position.\n\nstr.strip([chars])\n\n Return a copy of the string with the leading and trailing\n characters removed. The *chars* argument is a string specifying the\n set of characters to be removed. If omitted or ``None``, the\n *chars* argument defaults to removing whitespace. The *chars*\n argument is not a prefix or suffix; rather, all combinations of its\n values are stripped:\n\n >>> \' spacious \'.strip()\n \'spacious\'\n >>> \'www.example.com\'.strip(\'cmowz.\')\n \'example\'\n\nstr.swapcase()\n\n Return a copy of the string with uppercase characters converted to\n lowercase and vice versa.\n\nstr.title()\n\n Return a titlecased version of the string: words start with\n uppercase characters, all remaining cased characters are lowercase.\n\nstr.translate(map)\n\n Return a copy of the *s* where all characters have been mapped\n through the *map* which must be a dictionary of Unicode ordinals\n (integers) to Unicode ordinals, strings or ``None``. Unmapped\n characters are left untouched. Characters mapped to ``None`` are\n deleted.\n\n You can use ``str.maketrans()`` to create a translation map from\n character-to-character mappings in different formats.\n\n Note: An even more flexible approach is to create a custom character\n mapping codec using the ``codecs`` module (see\n ``encodings.cp1251`` for an example).\n\nstr.upper()\n\n Return a copy of the string converted to uppercase.\n\nstr.zfill(width)\n\n Return the numeric string left filled with zeros in a string of\n length *width*. A sign prefix is handled correctly. The original\n string is returned if *width* is less than ``len(s)``.\n\n\nOld String Formatting Operations\n================================\n\nNote: The formatting operations described here are obsolete and may go\n away in future versions of Python. Use the new *String Formatting*\n in new code.\n\nString objects have one unique built-in operation: the ``%`` operator\n(modulo). This is also known as the string *formatting* or\n*interpolation* operator. Given ``format % values`` (where *format* is\na string), ``%`` conversion specifications in *format* are replaced\nwith zero or more elements of *values*. The effect is similar to the\nusing ``sprintf()`` in the C language.\n\nIf *format* requires a single argument, *values* may be a single non-\ntuple object. [4] Otherwise, *values* must be a tuple with exactly\nthe number of items specified by the format string, or a single\nmapping object (for example, a dictionary).\n\nA conversion specifier contains two or more characters and has the\nfollowing components, which must occur in this order:\n\n1. The ``\'%\'`` character, which marks the start of the specifier.\n\n2. Mapping key (optional), consisting of a parenthesised sequence of\n characters (for example, ``(somename)``).\n\n3. Conversion flags (optional), which affect the result of some\n conversion types.\n\n4. Minimum field width (optional). If specified as an ``\'*\'``\n (asterisk), the actual width is read from the next element of the\n tuple in *values*, and the object to convert comes after the\n minimum field width and optional precision.\n\n5. Precision (optional), given as a ``\'.\'`` (dot) followed by the\n precision. If specified as ``\'*\'`` (an asterisk), the actual width\n is read from the next element of the tuple in *values*, and the\n value to convert comes after the precision.\n\n6. Length modifier (optional).\n\n7. Conversion type.\n\nWhen the right argument is a dictionary (or other mapping type), then\nthe formats in the string *must* include a parenthesised mapping key\ninto that dictionary inserted immediately after the ``\'%\'`` character.\nThe mapping key selects the value to be formatted from the mapping.\nFor example:\n\n>>> print(\'%(language)s has %(#)03d quote types.\' % \\\n... {\'language\': "Python", "#": 2})\nPython has 002 quote types.\n\nIn this case no ``*`` specifiers may occur in a format (since they\nrequire a sequential parameter list).\n\nThe conversion flag characters are:\n\n+-----------+-----------------------------------------------------------------------+\n| Flag | Meaning |\n+===========+=======================================================================+\n| ``\'#\'`` | The value conversion will use the "alternate form" (where defined |\n| | below). |\n+-----------+-----------------------------------------------------------------------+\n| ``\'0\'`` | The conversion will be zero padded for numeric values. |\n+-----------+-----------------------------------------------------------------------+\n| ``\'-\'`` | The converted value is left adjusted (overrides the ``\'0\'`` |\n| | conversion if both are given). |\n+-----------+-----------------------------------------------------------------------+\n| ``\' \'`` | (a space) A blank should be left before a positive number (or empty |\n| | string) produced by a signed conversion. |\n+-----------+-----------------------------------------------------------------------+\n| ``\'+\'`` | A sign character (``\'+\'`` or ``\'-\'``) will precede the conversion |\n| | (overrides a "space" flag). |\n+-----------+-----------------------------------------------------------------------+\n\nA length modifier (``h``, ``l``, or ``L``) may be present, but is\nignored as it is not necessary for Python -- so e.g. ``%ld`` is\nidentical to ``%d``.\n\nThe conversion types are:\n\n+--------------+-------------------------------------------------------+---------+\n| Conversion | Meaning | Notes |\n+==============+=======================================================+=========+\n| ``\'d\'`` | Signed integer decimal. | |\n+--------------+-------------------------------------------------------+---------+\n| ``\'i\'`` | Signed integer decimal. | |\n+--------------+-------------------------------------------------------+---------+\n| ``\'o\'`` | Signed octal value. | (1) |\n+--------------+-------------------------------------------------------+---------+\n| ``\'u\'`` | Obsolete type -- it is identical to ``\'d\'``. | (7) |\n+--------------+-------------------------------------------------------+---------+\n| ``\'x\'`` | Signed hexadecimal (lowercase). | (2) |\n+--------------+-------------------------------------------------------+---------+\n| ``\'X\'`` | Signed hexadecimal (uppercase). | (2) |\n+--------------+-------------------------------------------------------+---------+\n| ``\'e\'`` | Floating point exponential format (lowercase). | (3) |\n+--------------+-------------------------------------------------------+---------+\n| ``\'E\'`` | Floating point exponential format (uppercase). | (3) |\n+--------------+-------------------------------------------------------+---------+\n| ``\'f\'`` | Floating point decimal format. | (3) |\n+--------------+-------------------------------------------------------+---------+\n| ``\'F\'`` | Floating point decimal format. | (3) |\n+--------------+-------------------------------------------------------+---------+\n| ``\'g\'`` | Floating point format. Uses lowercase exponential | (4) |\n| | format if exponent is less than -4 or not less than | |\n| | precision, decimal format otherwise. | |\n+--------------+-------------------------------------------------------+---------+\n| ``\'G\'`` | Floating point format. Uses uppercase exponential | (4) |\n| | format if exponent is less than -4 or not less than | |\n| | precision, decimal format otherwise. | |\n+--------------+-------------------------------------------------------+---------+\n| ``\'c\'`` | Single character (accepts integer or single character | |\n| | string). | |\n+--------------+-------------------------------------------------------+---------+\n| ``\'r\'`` | String (converts any python object using ``repr()``). | (5) |\n+--------------+-------------------------------------------------------+---------+\n| ``\'s\'`` | String (converts any python object using ``str()``). | |\n+--------------+-------------------------------------------------------+---------+\n| ``\'%\'`` | No argument is converted, results in a ``\'%\'`` | |\n| | character in the result. | |\n+--------------+-------------------------------------------------------+---------+\n\nNotes:\n\n1. The alternate form causes a leading zero (``\'0\'``) to be inserted\n between left-hand padding and the formatting of the number if the\n leading character of the result is not already a zero.\n\n2. The alternate form causes a leading ``\'0x\'`` or ``\'0X\'`` (depending\n on whether the ``\'x\'`` or ``\'X\'`` format was used) to be inserted\n between left-hand padding and the formatting of the number if the\n leading character of the result is not already a zero.\n\n3. The alternate form causes the result to always contain a decimal\n point, even if no digits follow it.\n\n The precision determines the number of digits after the decimal\n point and defaults to 6.\n\n4. The alternate form causes the result to always contain a decimal\n point, and trailing zeroes are not removed as they would otherwise\n be.\n\n The precision determines the number of significant digits before\n and after the decimal point and defaults to 6.\n\n5. The precision determines the maximal number of characters used.\n\n1. See **PEP 237**.\n\nSince Python strings have an explicit length, ``%s`` conversions do\nnot assume that ``\'\\0\'`` is the end of the string.\n\nChanged in version 3.1: ``%f`` conversions for numbers whose absolute\nvalue is over 1e50 are no longer replaced by ``%g`` conversions.\n\nAdditional string operations are defined in standard modules\n``string`` and ``re``.\n\n\nRange Type\n==========\n\nThe ``range`` type is an immutable sequence which is commonly used for\nlooping. The advantage of the ``range`` type is that an ``range``\nobject will always take the same amount of memory, no matter the size\nof the range it represents. There are no consistent performance\nadvantages.\n\nRange objects have very little behavior: they only support indexing,\niteration, and the ``len()`` function.\n\n\nMutable Sequence Types\n======================\n\nList and bytearray objects support additional operations that allow\nin-place modification of the object. Other mutable sequence types\n(when added to the language) should also support these operations.\nStrings and tuples are immutable sequence types: such objects cannot\nbe modified once created. The following operations are defined on\nmutable sequence types (where *x* is an arbitrary object).\n\nNote that while lists allow their items to be of any type, bytearray\nobject "items" are all integers in the range 0 <= x < 256.\n\n+--------------------------------+----------------------------------+-----------------------+\n| Operation | Result | Notes |\n+================================+==================================+=======================+\n| ``s[i] = x`` | item *i* of *s* is replaced by | |\n| | *x* | |\n+--------------------------------+----------------------------------+-----------------------+\n| ``s[i:j] = t`` | slice of *s* from *i* to *j* is | |\n| | replaced by the contents of the | |\n| | iterable *t* | |\n+--------------------------------+----------------------------------+-----------------------+\n| ``del s[i:j]`` | same as ``s[i:j] = []`` | |\n+--------------------------------+----------------------------------+-----------------------+\n| ``s[i:j:k] = t`` | the elements of ``s[i:j:k]`` are | (1) |\n| | replaced by those of *t* | |\n+--------------------------------+----------------------------------+-----------------------+\n| ``del s[i:j:k]`` | removes the elements of | |\n| | ``s[i:j:k]`` from the list | |\n+--------------------------------+----------------------------------+-----------------------+\n| ``s.append(x)`` | same as ``s[len(s):len(s)] = | |\n| | [x]`` | |\n+--------------------------------+----------------------------------+-----------------------+\n| ``s.extend(x)`` | same as ``s[len(s):len(s)] = x`` | (2) |\n+--------------------------------+----------------------------------+-----------------------+\n| ``s.count(x)`` | return number of *i*\'s for which | |\n| | ``s[i] == x`` | |\n+--------------------------------+----------------------------------+-----------------------+\n| ``s.index(x[, i[, j]])`` | return smallest *k* such that | (3) |\n| | ``s[k] == x`` and ``i <= k < j`` | |\n+--------------------------------+----------------------------------+-----------------------+\n| ``s.insert(i, x)`` | same as ``s[i:i] = [x]`` | (4) |\n+--------------------------------+----------------------------------+-----------------------+\n| ``s.pop([i])`` | same as ``x = s[i]; del s[i]; | (5) |\n| | return x`` | |\n+--------------------------------+----------------------------------+-----------------------+\n| ``s.remove(x)`` | same as ``del s[s.index(x)]`` | (3) |\n+--------------------------------+----------------------------------+-----------------------+\n| ``s.reverse()`` | reverses the items of *s* in | (6) |\n| | place | |\n+--------------------------------+----------------------------------+-----------------------+\n| ``s.sort([key[, reverse]])`` | sort the items of *s* in place | (6), (7), (8) |\n+--------------------------------+----------------------------------+-----------------------+\n\nNotes:\n\n1. *t* must have the same length as the slice it is replacing.\n\n2. *x* can be any iterable object.\n\n3. Raises ``ValueError`` when *x* is not found in *s*. When a negative\n index is passed as the second or third parameter to the ``index()``\n method, the sequence length is added, as for slice indices. If it\n is still negative, it is truncated to zero, as for slice indices.\n\n4. When a negative index is passed as the first parameter to the\n ``insert()`` method, the sequence length is added, as for slice\n indices. If it is still negative, it is truncated to zero, as for\n slice indices.\n\n5. The optional argument *i* defaults to ``-1``, so that by default\n the last item is removed and returned.\n\n6. The ``sort()`` and ``reverse()`` methods modify the sequence in\n place for economy of space when sorting or reversing a large\n sequence. To remind you that they operate by side effect, they\n don\'t return the sorted or reversed sequence.\n\n7. The ``sort()`` method takes optional arguments for controlling the\n comparisons. Each must be specified as a keyword argument.\n\n *key* specifies a function of one argument that is used to extract\n a comparison key from each list element: ``key=str.lower``. The\n default value is ``None``.\n\n *reverse* is a boolean value. If set to ``True``, then the list\n elements are sorted as if each comparison were reversed.\n\n The ``sort()`` method is guaranteed to be stable. A sort is stable\n if it guarantees not to change the relative order of elements that\n compare equal --- this is helpful for sorting in multiple passes\n (for example, sort by department, then by salary grade).\n\n While a list is being sorted, the effect of attempting to mutate,\n or even inspect, the list is undefined. The C implementation makes\n the list appear empty for the duration, and raises ``ValueError``\n if it can detect that the list has been mutated during a sort.\n\n8. ``sort()`` is not supported by ``bytearray`` objects.\n\n\nBytes and Byte Array Methods\n============================\n\nBytes and bytearray objects, being "strings of bytes", have all\nmethods found on strings, with the exception of ``encode()``,\n``format()`` and ``isidentifier()``, which do not make sense with\nthese types. For converting the objects to strings, they have a\n``decode()`` method.\n\nWherever one of these methods needs to interpret the bytes as\ncharacters (e.g. the ``is...()`` methods), the ASCII character set is\nassumed.\n\nNote: The methods on bytes and bytearray objects don\'t accept strings as\n their arguments, just as the methods on strings don\'t accept bytes\n as their arguments. For example, you have to write\n\n a = "abc"\n b = a.replace("a", "f")\n\n and\n\n a = b"abc"\n b = a.replace(b"a", b"f")\n\nbytes.decode([encoding[, errors]])\nbytearray.decode([encoding[, errors]])\n\n Return a string decoded from the given bytes. Default encoding is\n the current default string encoding. *errors* may be given to set\n a different error handling scheme. The default for *errors* is\n ``\'strict\'``, meaning that encoding errors raise a\n ``UnicodeError``. Other possible values are ``\'ignore\'``,\n ``\'replace\'`` and any other name registered via\n ``codecs.register_error()``, see section *Codec Base Classes*. For\n a list of possible encodings, see section *Standard Encodings*.\n\nThe bytes and bytearray types have an additional class method:\n\nclassmethod bytes.fromhex(string)\nclassmethod bytearray.fromhex(string)\n\n This ``bytes`` class method returns a bytes or bytearray object,\n decoding the given string object. The string must contain two\n hexadecimal digits per byte, spaces are ignored.\n\n >>> bytes.fromhex(\'f0 f1f2 \')\n b\'\\xf0\\xf1\\xf2\'\n\nThe maketrans and translate methods differ in semantics from the\nversions available on strings:\n\nbytes.translate(table[, delete])\nbytearray.translate(table[, delete])\n\n Return a copy of the bytes or bytearray object where all bytes\n occurring in the optional argument *delete* are removed, and the\n remaining bytes have been mapped through the given translation\n table, which must be a bytes object of length 256.\n\n You can use the ``bytes.maketrans()`` method to create a\n translation table.\n\n Set the *table* argument to ``None`` for translations that only\n delete characters:\n\n >>> b\'read this short text\'.translate(None, b\'aeiou\')\n b\'rd ths shrt txt\'\n\nstatic bytes.maketrans(from, to)\nstatic bytearray.maketrans(from, to)\n\n This static method returns a translation table usable for\n ``bytes.translate()`` that will map each character in *from* into\n the character at the same position in *to*; *from* and *to* must be\n bytes objects and have the same length.\n\n New in version 3.1.\n', 'typesseq-mutable': '\nMutable Sequence Types\n**********************\n\nList and bytearray objects support additional operations that allow\nin-place modification of the object. Other mutable sequence types\n(when added to the language) should also support these operations.\nStrings and tuples are immutable sequence types: such objects cannot\nbe modified once created. The following operations are defined on\nmutable sequence types (where *x* is an arbitrary object).\n\nNote that while lists allow their items to be of any type, bytearray\nobject "items" are all integers in the range 0 <= x < 256.\n\n+--------------------------------+----------------------------------+-----------------------+\n| Operation | Result | Notes |\n+================================+==================================+=======================+\n| ``s[i] = x`` | item *i* of *s* is replaced by | |\n| | *x* | |\n+--------------------------------+----------------------------------+-----------------------+\n| ``s[i:j] = t`` | slice of *s* from *i* to *j* is | |\n| | replaced by the contents of the | |\n| | iterable *t* | |\n+--------------------------------+----------------------------------+-----------------------+\n| ``del s[i:j]`` | same as ``s[i:j] = []`` | |\n+--------------------------------+----------------------------------+-----------------------+\n| ``s[i:j:k] = t`` | the elements of ``s[i:j:k]`` are | (1) |\n| | replaced by those of *t* | |\n+--------------------------------+----------------------------------+-----------------------+\n| ``del s[i:j:k]`` | removes the elements of | |\n| | ``s[i:j:k]`` from the list | |\n+--------------------------------+----------------------------------+-----------------------+\n| ``s.append(x)`` | same as ``s[len(s):len(s)] = | |\n| | [x]`` | |\n+--------------------------------+----------------------------------+-----------------------+\n| ``s.extend(x)`` | same as ``s[len(s):len(s)] = x`` | (2) |\n+--------------------------------+----------------------------------+-----------------------+\n| ``s.count(x)`` | return number of *i*\'s for which | |\n| | ``s[i] == x`` | |\n+--------------------------------+----------------------------------+-----------------------+\n| ``s.index(x[, i[, j]])`` | return smallest *k* such that | (3) |\n| | ``s[k] == x`` and ``i <= k < j`` | |\n+--------------------------------+----------------------------------+-----------------------+\n| ``s.insert(i, x)`` | same as ``s[i:i] = [x]`` | (4) |\n+--------------------------------+----------------------------------+-----------------------+\n| ``s.pop([i])`` | same as ``x = s[i]; del s[i]; | (5) |\n| | return x`` | |\n+--------------------------------+----------------------------------+-----------------------+\n| ``s.remove(x)`` | same as ``del s[s.index(x)]`` | (3) |\n+--------------------------------+----------------------------------+-----------------------+\n| ``s.reverse()`` | reverses the items of *s* in | (6) |\n| | place | |\n+--------------------------------+----------------------------------+-----------------------+\n| ``s.sort([key[, reverse]])`` | sort the items of *s* in place | (6), (7), (8) |\n+--------------------------------+----------------------------------+-----------------------+\n\nNotes:\n\n1. *t* must have the same length as the slice it is replacing.\n\n2. *x* can be any iterable object.\n\n3. Raises ``ValueError`` when *x* is not found in *s*. When a negative\n index is passed as the second or third parameter to the ``index()``\n method, the sequence length is added, as for slice indices. If it\n is still negative, it is truncated to zero, as for slice indices.\n\n4. When a negative index is passed as the first parameter to the\n ``insert()`` method, the sequence length is added, as for slice\n indices. If it is still negative, it is truncated to zero, as for\n slice indices.\n\n5. The optional argument *i* defaults to ``-1``, so that by default\n the last item is removed and returned.\n\n6. The ``sort()`` and ``reverse()`` methods modify the sequence in\n place for economy of space when sorting or reversing a large\n sequence. To remind you that they operate by side effect, they\n don\'t return the sorted or reversed sequence.\n\n7. The ``sort()`` method takes optional arguments for controlling the\n comparisons. Each must be specified as a keyword argument.\n\n *key* specifies a function of one argument that is used to extract\n a comparison key from each list element: ``key=str.lower``. The\n default value is ``None``.\n\n *reverse* is a boolean value. If set to ``True``, then the list\n elements are sorted as if each comparison were reversed.\n\n The ``sort()`` method is guaranteed to be stable. A sort is stable\n if it guarantees not to change the relative order of elements that\n compare equal --- this is helpful for sorting in multiple passes\n (for example, sort by department, then by salary grade).\n\n While a list is being sorted, the effect of attempting to mutate,\n or even inspect, the list is undefined. The C implementation makes\n the list appear empty for the duration, and raises ``ValueError``\n if it can detect that the list has been mutated during a sort.\n\n8. ``sort()`` is not supported by ``bytearray`` objects.\n', 'unary': '\nUnary arithmetic and bitwise operations\n***************************************\n\nAll unary arithmetic and bitwise operations have the same priority:\n\n u_expr ::= power | "-" u_expr | "+" u_expr | "~" u_expr\n\nThe unary ``-`` (minus) operator yields the negation of its numeric\nargument.\n\nThe unary ``+`` (plus) operator yields its numeric argument unchanged.\n\nThe unary ``~`` (invert) operator yields the bitwise inversion of its\ninteger argument. The bitwise inversion of ``x`` is defined as\n``-(x+1)``. It only applies to integral numbers.\n\nIn all three cases, if the argument does not have the proper type, a\n``TypeError`` exception is raised.\n', 'while': '\nThe ``while`` statement\n***********************\n\nThe ``while`` statement is used for repeated execution as long as an\nexpression is true:\n\n while_stmt ::= "while" expression ":" suite\n ["else" ":" suite]\n\nThis repeatedly tests the expression and, if it is true, executes the\nfirst suite; if the expression is false (which may be the first time\nit is tested) the suite of the ``else`` clause, if present, is\nexecuted and the loop terminates.\n\nA ``break`` statement executed in the first suite terminates the loop\nwithout executing the ``else`` clause\'s suite. A ``continue``\nstatement executed in the first suite skips the rest of the suite and\ngoes back to testing the expression.\n', From python-checkins at python.org Sat Jun 13 15:15:05 2009 From: python-checkins at python.org (benjamin.peterson) Date: Sat, 13 Jun 2009 15:15:05 +0200 (CEST) Subject: [Python-checkins] r73411 - in python/branches/py3k: Include/patchlevel.h Lib/distutils/__init__.py Lib/idlelib/idlever.py Misc/NEWS Misc/RPM/python-3.1.spec README Message-ID: <20090613131505.11899D80A@mail.python.org> Author: benjamin.peterson Date: Sat Jun 13 15:15:04 2009 New Revision: 73411 Log: bump version to 3.1rc2 Modified: python/branches/py3k/Include/patchlevel.h python/branches/py3k/Lib/distutils/__init__.py python/branches/py3k/Lib/idlelib/idlever.py python/branches/py3k/Misc/NEWS python/branches/py3k/Misc/RPM/python-3.1.spec python/branches/py3k/README Modified: python/branches/py3k/Include/patchlevel.h ============================================================================== --- python/branches/py3k/Include/patchlevel.h (original) +++ python/branches/py3k/Include/patchlevel.h Sat Jun 13 15:15:04 2009 @@ -20,10 +20,10 @@ #define PY_MINOR_VERSION 1 #define PY_MICRO_VERSION 0 #define PY_RELEASE_LEVEL PY_RELEASE_LEVEL_GAMMA -#define PY_RELEASE_SERIAL 1 +#define PY_RELEASE_SERIAL 2 /* Version as a string */ -#define PY_VERSION "3.1rc1+" +#define PY_VERSION "3.1rc2" /*--end constants--*/ /* Subversion Revision number of this file (not of the repository) */ Modified: python/branches/py3k/Lib/distutils/__init__.py ============================================================================== --- python/branches/py3k/Lib/distutils/__init__.py (original) +++ python/branches/py3k/Lib/distutils/__init__.py Sat Jun 13 15:15:04 2009 @@ -15,5 +15,5 @@ # Updated automatically by the Python release process. # #--start constants-- -__version__ = "3.1rc1" +__version__ = "3.1rc2" #--end constants-- Modified: python/branches/py3k/Lib/idlelib/idlever.py ============================================================================== --- python/branches/py3k/Lib/idlelib/idlever.py (original) +++ python/branches/py3k/Lib/idlelib/idlever.py Sat Jun 13 15:15:04 2009 @@ -1 +1 @@ -IDLE_VERSION = "3.1rc1" +IDLE_VERSION = "3.1rc2" Modified: python/branches/py3k/Misc/NEWS ============================================================================== --- python/branches/py3k/Misc/NEWS (original) +++ python/branches/py3k/Misc/NEWS Sat Jun 13 15:15:04 2009 @@ -7,7 +7,7 @@ What's New in Python 3.1 Release Candidate 2? ============================================= -*Release date: 17-June-2009* +*Release date: 13-June-2009* Core and Builtins ----------------- Modified: python/branches/py3k/Misc/RPM/python-3.1.spec ============================================================================== --- python/branches/py3k/Misc/RPM/python-3.1.spec (original) +++ python/branches/py3k/Misc/RPM/python-3.1.spec Sat Jun 13 15:15:04 2009 @@ -34,7 +34,7 @@ %define name python #--start constants-- -%define version 3.1rc1 +%define version 3.1rc2 %define libver 3.1 #--end constants-- %define release 1pydotorg Modified: python/branches/py3k/README ============================================================================== --- python/branches/py3k/README (original) +++ python/branches/py3k/README Sat Jun 13 15:15:04 2009 @@ -1,4 +1,4 @@ -This is Python version 3.1 Release Candidate 1 +This is Python version 3.1 Release Candidate 2 ============================================== Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 From python-checkins at python.org Sat Jun 13 15:16:45 2009 From: python-checkins at python.org (benjamin.peterson) Date: Sat, 13 Jun 2009 15:16:45 +0200 (CEST) Subject: [Python-checkins] r73412 - python/branches/py3k/README Message-ID: <20090613131645.5B9B4DCCE@mail.python.org> Author: benjamin.peterson Date: Sat Jun 13 15:16:45 2009 New Revision: 73412 Log: update the README to be a little more inspiring w/regards to stability Modified: python/branches/py3k/README Modified: python/branches/py3k/README ============================================================================== --- python/branches/py3k/README (original) +++ python/branches/py3k/README Sat Jun 13 15:16:45 2009 @@ -33,32 +33,19 @@ reStructuredText versions are primarily for documentation authors, translators, and people with special formatting requirements. -This is a work in progress; please help improve it! - -The design documents for Python 3 are also online. While the reference -documentation is being updated, the PEPs are often the best source of -information about new features. Start by reading PEP 3000: - - http://python.org/dev/peps/pep-3000/ - What's New ---------- -For an overview of what's new in Python 3, see Guido van Rossum's blog at -artima.com: - - http://www.artima.com/weblogs/index.jsp?blogger=guido - -We try to eventually have a comprehensive overview of the changes in -the "What's New in Python 3.1" document, found at +We try to have a comprehensive overview of the changes in the "What's New in +Python 3.1" document, found at - http://docs.python.org/dev/3.1/whatsnew/3.1 + http://docs.python.org/dev/3.1/whatsnew/3.1.html Please help write it! For a more detailed change log, read Misc/NEWS (though this file, too, -is incomplete, and also doesn't list anything merged in from the 2.6 +is incomplete, and also doesn't list anything merged in from the 2.7 release under development). If you want to install multiple versions of Python see the section below From python-checkins at python.org Sat Jun 13 15:18:15 2009 From: python-checkins at python.org (benjamin.peterson) Date: Sat, 13 Jun 2009 15:18:15 +0200 (CEST) Subject: [Python-checkins] r73413 - python/tags/r31rc2 Message-ID: <20090613131815.08654C500@mail.python.org> Author: benjamin.peterson Date: Sat Jun 13 15:18:14 2009 New Revision: 73413 Log: tag 3.1 release candidate 2 Added: python/tags/r31rc2/ - copied from r73412, /python/branches/py3k/ From python-checkins at python.org Sat Jun 13 15:21:36 2009 From: python-checkins at python.org (benjamin.peterson) Date: Sat, 13 Jun 2009 15:21:36 +0200 (CEST) Subject: [Python-checkins] r73414 - sandbox/trunk/release/release.py Message-ID: <20090613132136.D618EC500@mail.python.org> Author: benjamin.peterson Date: Sat Jun 13 15:21:36 2009 New Revision: 73414 Log: switch to lowercase filename Modified: sandbox/trunk/release/release.py Modified: sandbox/trunk/release/release.py ============================================================================== --- sandbox/trunk/release/release.py (original) +++ sandbox/trunk/release/release.py Sat Jun 13 15:21:36 2009 @@ -249,7 +249,7 @@ old_cur = os.getcwd() with changed_dir('dist'): print 'Exporting tag:', tag.text - archivename = 'Python-%s' % tag.text + archivename = 'python-%s' % tag.text run_cmd(['svn', 'export', '-q', 'http://svn.python.org/projects/python/tags/r%s' % tag.nickname, archivename]) From buildbot at python.org Sat Jun 13 15:49:09 2009 From: buildbot at python.org (buildbot at python.org) Date: Sat, 13 Jun 2009 13:49:09 +0000 Subject: [Python-checkins] buildbot failure in sparc solaris10 gcc 3.x Message-ID: <20090613134909.12203DAEC@mail.python.org> The Buildbot has detected a new failure of sparc solaris10 gcc 3.x. Full details are available at: http://www.python.org/dev/buildbot/all/sparc%20solaris10%20gcc%203.x/builds/823 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: loewis-sun Build Reason: Build Source Stamp: [branch branches/py3k] HEAD Blamelist: benjamin.peterson BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_posix ====================================================================== ERROR: test_getcwd_long_pathnames (test.test_posix.PosixTester) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home2/buildbot/slave/3.x.loewis-sun/build/Lib/test/test_posix.py", line 251, in test_getcwd_long_pathnames support.rmtree(base_path) File "/home2/buildbot/slave/3.x.loewis-sun/build/Lib/test/support.py", line 181, in rmtree shutil.rmtree(path) File "/home2/buildbot/slave/3.x.loewis-sun/build/Lib/shutil.py", line 239, in rmtree onerror(os.rmdir, path, sys.exc_info()) File "/home2/buildbot/slave/3.x.loewis-sun/build/Lib/shutil.py", line 237, in rmtree os.rmdir(path) OSError: [Errno 22] Invalid argument: '/home2/buildbot/slave/3.x.loewis-sun/build/@test.getcwd/@test.getcwd' sincerely, -The Buildbot From buildbot at python.org Sat Jun 13 16:13:50 2009 From: buildbot at python.org (buildbot at python.org) Date: Sat, 13 Jun 2009 14:13:50 +0000 Subject: [Python-checkins] buildbot failure in x86 osx.5 3.x Message-ID: <20090613141350.8827DDBDC@mail.python.org> The Buildbot has detected a new failure of x86 osx.5 3.x. Full details are available at: http://www.python.org/dev/buildbot/all/x86%20osx.5%203.x/builds/1031 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: heller-x86-osx5 Build Reason: Build Source Stamp: [branch branches/py3k] HEAD Blamelist: benjamin.peterson BUILD FAILED: failed test Excerpt from the test logfile: make: *** [buildbottest] Abort trap sincerely, -The Buildbot From python-checkins at python.org Sat Jun 13 16:25:09 2009 From: python-checkins at python.org (benjamin.peterson) Date: Sat, 13 Jun 2009 16:25:09 +0200 (CEST) Subject: [Python-checkins] r73415 - python/trunk/Doc/tools/sphinxext/patchlevel.py Message-ID: <20090613142509.219B2C521@mail.python.org> Author: benjamin.peterson Date: Sat Jun 13 16:25:08 2009 New Revision: 73415 Log: use 'rc' for release candidates for consistency Modified: python/trunk/Doc/tools/sphinxext/patchlevel.py Modified: python/trunk/Doc/tools/sphinxext/patchlevel.py ============================================================================== --- python/trunk/Doc/tools/sphinxext/patchlevel.py (original) +++ python/trunk/Doc/tools/sphinxext/patchlevel.py Sat Jun 13 16:25:08 2009 @@ -41,7 +41,7 @@ suffixes = { 'PY_RELEASE_LEVEL_ALPHA': 'a', 'PY_RELEASE_LEVEL_BETA': 'b', - 'PY_RELEASE_LEVEL_GAMMA': 'c', + 'PY_RELEASE_LEVEL_GAMMA': 'rc', } if level != 'PY_RELEASE_LEVEL_FINAL': release += suffixes[level] + str(int(d['PY_RELEASE_SERIAL'])) From python-checkins at python.org Sat Jun 13 16:50:22 2009 From: python-checkins at python.org (benjamin.peterson) Date: Sat, 13 Jun 2009 16:50:22 +0200 (CEST) Subject: [Python-checkins] r73416 - in python/branches/py3k: Include/patchlevel.h Misc/NEWS Message-ID: <20090613145022.64C9BC571@mail.python.org> Author: benjamin.peterson Date: Sat Jun 13 16:50:22 2009 New Revision: 73416 Log: post release version bumps Modified: python/branches/py3k/Include/patchlevel.h python/branches/py3k/Misc/NEWS Modified: python/branches/py3k/Include/patchlevel.h ============================================================================== --- python/branches/py3k/Include/patchlevel.h (original) +++ python/branches/py3k/Include/patchlevel.h Sat Jun 13 16:50:22 2009 @@ -23,7 +23,7 @@ #define PY_RELEASE_SERIAL 2 /* Version as a string */ -#define PY_VERSION "3.1rc2" +#define PY_VERSION "3.1rc2+" /*--end constants--*/ /* Subversion Revision number of this file (not of the repository) */ Modified: python/branches/py3k/Misc/NEWS ============================================================================== --- python/branches/py3k/Misc/NEWS (original) +++ python/branches/py3k/Misc/NEWS Sat Jun 13 16:50:22 2009 @@ -4,6 +4,18 @@ (editors: check NEWS.help for information about editing NEWS using ReST.) +What's New in Python 3.1? +========================= + +*Release date: 27-June-2009* + +Core and Builtins +----------------- + +Library +------- + + What's New in Python 3.1 Release Candidate 2? ============================================= From martin at v.loewis.de Sat Jun 13 16:51:58 2009 From: martin at v.loewis.de (martin at v.loewis.de) Date: Sat, 13 Jun 2009 16:51:58 +0200 Subject: [Python-checkins] r73415 - python/trunk/Doc/tools/sphinxext/patchlevel.p Message-ID: <20090613165158.12643jkdcu207xgk@webmail.df.eu> > use 'rc' for release candidates for consistency > - 'PY_RELEASE_LEVEL_GAMMA': 'c', > + 'PY_RELEASE_LEVEL_GAMMA': 'rc', I'm not sure this is a good idea. At a minimum, this patch is incomplete, as it has impact on a (unknown) number of other code locations, including Tools/msi and IDLE. Regards, Martin From python-checkins at python.org Sat Jun 13 17:42:23 2009 From: python-checkins at python.org (benjamin.peterson) Date: Sat, 13 Jun 2009 17:42:23 +0200 (CEST) Subject: [Python-checkins] r73417 - python/trunk/Lib/idlelib/EditorWindow.py Message-ID: <20090613154223.7FCC7D9D4@mail.python.org> Author: benjamin.peterson Date: Sat Jun 13 17:42:23 2009 New Revision: 73417 Log: special case release candidates Modified: python/trunk/Lib/idlelib/EditorWindow.py Modified: python/trunk/Lib/idlelib/EditorWindow.py ============================================================================== --- python/trunk/Lib/idlelib/EditorWindow.py (original) +++ python/trunk/Lib/idlelib/EditorWindow.py Sat Jun 13 17:42:23 2009 @@ -27,8 +27,10 @@ major, minor, micro, level, serial = sys.version_info release = '%s%s' % (major, minor) if micro: - release += '%s' % micro - if level != 'final': + release += '%s' % (micro,) + if level == 'candidate': + release += 'rc%s' % (serial,) + elif level != 'final': release += '%s%s' % (level[0], serial) return release From python-checkins at python.org Sat Jun 13 17:48:04 2009 From: python-checkins at python.org (benjamin.peterson) Date: Sat, 13 Jun 2009 17:48:04 +0200 (CEST) Subject: [Python-checkins] r73418 - python/trunk/Tools/msi/msi.py Message-ID: <20090613154804.F3EE3DA9E@mail.python.org> Author: benjamin.peterson Date: Sat Jun 13 17:48:04 2009 New Revision: 73418 Log: handle different rc format Modified: python/trunk/Tools/msi/msi.py Modified: python/trunk/Tools/msi/msi.py ============================================================================== --- python/trunk/Tools/msi/msi.py (original) +++ python/trunk/Tools/msi/msi.py Sat Jun 13 17:48:04 2009 @@ -119,7 +119,10 @@ if micro: docfile = str(micro) if level < 0xf: - docfile = '%x%s' % (level, serial) + if level == 0xC: + docfile = "rc%s" % (serial,) + else: + docfile = '%x%s' % (level, serial) docfile = 'python%s%s%s.chm' % (major, minor, docfile) # Build the mingw import library, libpythonXY.a From buildbot at python.org Sat Jun 13 18:15:23 2009 From: buildbot at python.org (buildbot at python.org) Date: Sat, 13 Jun 2009 16:15:23 +0000 Subject: [Python-checkins] buildbot failure in amd64 gentoo trunk Message-ID: <20090613161523.6BDA6D78F@mail.python.org> The Buildbot has detected a new failure of amd64 gentoo trunk. Full details are available at: http://www.python.org/dev/buildbot/all/amd64%20gentoo%20trunk/builds/169 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: norwitz-amd64 Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: benjamin.peterson BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_mailbox make: *** [buildbottest] Error 1 sincerely, -The Buildbot From buildbot at python.org Sat Jun 13 18:18:50 2009 From: buildbot at python.org (buildbot at python.org) Date: Sat, 13 Jun 2009 16:18:50 +0000 Subject: [Python-checkins] buildbot failure in sparc solaris10 gcc 3.x Message-ID: <20090613161850.1CBB4DB01@mail.python.org> The Buildbot has detected a new failure of sparc solaris10 gcc 3.x. Full details are available at: http://www.python.org/dev/buildbot/all/sparc%20solaris10%20gcc%203.x/builds/825 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: loewis-sun Build Reason: Build Source Stamp: [branch branches/py3k] HEAD Blamelist: benjamin.peterson BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_posix ====================================================================== ERROR: test_getcwd_long_pathnames (test.test_posix.PosixTester) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home2/buildbot/slave/3.x.loewis-sun/build/Lib/test/test_posix.py", line 251, in test_getcwd_long_pathnames support.rmtree(base_path) File "/home2/buildbot/slave/3.x.loewis-sun/build/Lib/test/support.py", line 181, in rmtree shutil.rmtree(path) File "/home2/buildbot/slave/3.x.loewis-sun/build/Lib/shutil.py", line 239, in rmtree onerror(os.rmdir, path, sys.exc_info()) File "/home2/buildbot/slave/3.x.loewis-sun/build/Lib/shutil.py", line 237, in rmtree os.rmdir(path) OSError: [Errno 22] Invalid argument: '/home2/buildbot/slave/3.x.loewis-sun/build/@test.getcwd/@test.getcwd' sincerely, -The Buildbot From python-checkins at python.org Sat Jun 13 18:19:19 2009 From: python-checkins at python.org (benjamin.peterson) Date: Sat, 13 Jun 2009 18:19:19 +0200 (CEST) Subject: [Python-checkins] r73419 - python/trunk/Python/ast.c Message-ID: <20090613161919.B0D93DB01@mail.python.org> Author: benjamin.peterson Date: Sat Jun 13 18:19:19 2009 New Revision: 73419 Log: set Print.values to NULL if there are no values Modified: python/trunk/Python/ast.c Modified: python/trunk/Python/ast.c ============================================================================== --- python/trunk/Python/ast.c (original) +++ python/trunk/Python/ast.c Sat Jun 13 18:19:19 2009 @@ -2144,9 +2144,9 @@ | '>>' test [ (',' test)+ [','] ] ) */ expr_ty dest = NULL, expression; - asdl_seq *seq; + asdl_seq *seq = NULL; bool nl; - int i, j, start = 1; + int i, j, values_count, start = 1; REQ(n, print_stmt); if (NCH(n) >= 2 && TYPE(CHILD(n, 1)) == RIGHTSHIFT) { @@ -2155,14 +2155,17 @@ return NULL; start = 4; } - seq = asdl_seq_new((NCH(n) + 1 - start) / 2, c->c_arena); - if (!seq) - return NULL; - for (i = start, j = 0; i < NCH(n); i += 2, ++j) { - expression = ast_for_expr(c, CHILD(n, i)); - if (!expression) + values_count = (NCH(n) + 1 - start) / 2; + if (values_count) { + seq = asdl_seq_new(values_count, c->c_arena); + if (!seq) return NULL; - asdl_seq_SET(seq, j, expression); + for (i = start, j = 0; i < NCH(n); i += 2, ++j) { + expression = ast_for_expr(c, CHILD(n, i)); + if (!expression) + return NULL; + asdl_seq_SET(seq, j, expression); + } } nl = (TYPE(CHILD(n, NCH(n) - 1)) == COMMA) ? false : true; return Print(dest, seq, nl, LINENO(n), n->n_col_offset, c->c_arena); From buildbot at python.org Sat Jun 13 18:25:23 2009 From: buildbot at python.org (buildbot at python.org) Date: Sat, 13 Jun 2009 16:25:23 +0000 Subject: [Python-checkins] buildbot failure in OS X x86 trunk Message-ID: <20090613162523.44E74DCCA@mail.python.org> The Buildbot has detected a new failure of OS X x86 trunk. Full details are available at: http://www.python.org/dev/buildbot/all/OS%20X%20x86%20trunk/builds/691 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: noller-osx86 Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: benjamin.peterson BUILD FAILED: failed test Excerpt from the test logfile: make: *** [buildbottest] Abort trap sincerely, -The Buildbot From buildbot at python.org Sat Jun 13 19:05:26 2009 From: buildbot at python.org (buildbot at python.org) Date: Sat, 13 Jun 2009 17:05:26 +0000 Subject: [Python-checkins] buildbot failure in x86 osx.5 trunk Message-ID: <20090613170526.8445FC50C@mail.python.org> The Buildbot has detected a new failure of x86 osx.5 trunk. Full details are available at: http://www.python.org/dev/buildbot/all/x86%20osx.5%20trunk/builds/1191 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: heller-x86-osx5 Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: benjamin.peterson BUILD FAILED: failed test Excerpt from the test logfile: make: *** [buildbottest] Abort trap sincerely, -The Buildbot From python-checkins at python.org Sat Jun 13 19:08:54 2009 From: python-checkins at python.org (benjamin.peterson) Date: Sat, 13 Jun 2009 19:08:54 +0200 (CEST) Subject: [Python-checkins] r73420 - in python/trunk: Lib/test/test_syntax.py Python/ast.c Message-ID: <20090613170854.0D75BD673@mail.python.org> Author: benjamin.peterson Date: Sat Jun 13 19:08:53 2009 New Revision: 73420 Log: give a better error message when deleting () Modified: python/trunk/Lib/test/test_syntax.py python/trunk/Python/ast.c Modified: python/trunk/Lib/test/test_syntax.py ============================================================================== --- python/trunk/Lib/test/test_syntax.py (original) +++ python/trunk/Lib/test/test_syntax.py Sat Jun 13 19:08:53 2009 @@ -462,6 +462,12 @@ File "", line 1 SyntaxError: keyword argument repeated +>>> del () +Traceback (most recent call last): + ... + File "", line 1 +SyntaxError: can't delete () + """ import re Modified: python/trunk/Python/ast.c ============================================================================== --- python/trunk/Python/ast.c (original) +++ python/trunk/Python/ast.c Sat Jun 13 19:08:53 2009 @@ -402,10 +402,13 @@ s = e->v.List.elts; break; case Tuple_kind: - if (asdl_seq_LEN(e->v.Tuple.elts) == 0) - return ast_error(n, "can't assign to ()"); - e->v.Tuple.ctx = ctx; - s = e->v.Tuple.elts; + if (asdl_seq_LEN(e->v.Tuple.elts)) { + e->v.Tuple.ctx = ctx; + s = e->v.Tuple.elts; + } + else { + expr_name = "()"; + } break; case Lambda_kind: expr_name = "lambda"; From python-checkins at python.org Sat Jun 13 22:23:33 2009 From: python-checkins at python.org (benjamin.peterson) Date: Sat, 13 Jun 2009 22:23:33 +0200 (CEST) Subject: [Python-checkins] r73421 - in python/trunk: Lib/test/test_ast.py Misc/NEWS Parser/Python.asdl Python/Python-ast.c Python/ast.c Python/compile.c Message-ID: <20090613202333.6DD45C2BC@mail.python.org> Author: benjamin.peterson Date: Sat Jun 13 22:23:33 2009 New Revision: 73421 Log: when no module is given in a 'from' relative import, make ImportFrom.module NULL Modified: python/trunk/Lib/test/test_ast.py python/trunk/Misc/NEWS python/trunk/Parser/Python.asdl python/trunk/Python/Python-ast.c python/trunk/Python/ast.c python/trunk/Python/compile.c Modified: python/trunk/Lib/test/test_ast.py ============================================================================== --- python/trunk/Lib/test/test_ast.py (original) +++ python/trunk/Lib/test/test_ast.py Sat Jun 13 22:23:33 2009 @@ -152,6 +152,10 @@ self.assertIsNone(slc.lower) self.assertIsNone(slc.step) + def test_from_import(self): + im = ast.parse("from . import y").body[0] + self.assertIsNone(im.module) + def test_nodeclasses(self): x = ast.BinOp(1, 2, 3, lineno=0) self.assertEquals(x.left, 1) Modified: python/trunk/Misc/NEWS ============================================================================== --- python/trunk/Misc/NEWS (original) +++ python/trunk/Misc/NEWS Sat Jun 13 22:23:33 2009 @@ -12,6 +12,9 @@ Core and Builtins ----------------- +- When no module is given in a relative import, the module field of the + ImportFrom AST node is now None instead of an empty string. + - Assignment to None using import statements now raises a SyntaxError. - In the slice AST type, the step field will always be None if a step expression Modified: python/trunk/Parser/Python.asdl ============================================================================== --- python/trunk/Parser/Python.asdl (original) +++ python/trunk/Parser/Python.asdl Sat Jun 13 22:23:33 2009 @@ -34,7 +34,7 @@ | Assert(expr test, expr? msg) | Import(alias* names) - | ImportFrom(identifier module, alias* names, int? level) + | ImportFrom(identifier? module, alias* names, int? level) -- Doesn't capture requirement that locals must be -- defined if globals is Modified: python/trunk/Python/Python-ast.c ============================================================================== --- python/trunk/Python/Python-ast.c (original) +++ python/trunk/Python/Python-ast.c Sat Jun 13 22:23:33 2009 @@ -1330,11 +1330,6 @@ col_offset, PyArena *arena) { stmt_ty p; - if (!module) { - PyErr_SetString(PyExc_ValueError, - "field module is required for ImportFrom"); - return NULL; - } p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p)); if (!p) return NULL; @@ -4273,8 +4268,7 @@ Py_XDECREF(tmp); tmp = NULL; } else { - PyErr_SetString(PyExc_TypeError, "required field \"module\" missing from ImportFrom"); - return 1; + module = NULL; } if (PyObject_HasAttrString(obj, "names")) { int res; Modified: python/trunk/Python/ast.c ============================================================================== --- python/trunk/Python/ast.c (original) +++ python/trunk/Python/ast.c Sat Jun 13 22:23:33 2009 @@ -2440,7 +2440,7 @@ int n_children; int idx, ndots = 0; alias_ty mod = NULL; - identifier modname; + identifier modname = NULL; /* Count the number of dots (for relative imports) and check for the optional module name */ @@ -2504,8 +2504,6 @@ } if (mod != NULL) modname = mod->name; - else - modname = new_identifier("", c->c_arena); return ImportFrom(modname, aliases, ndots, lineno, col_offset, c->c_arena); } Modified: python/trunk/Python/compile.c ============================================================================== --- python/trunk/Python/compile.c (original) +++ python/trunk/Python/compile.c Sat Jun 13 22:23:33 2009 @@ -1976,6 +1976,13 @@ PyObject *names = PyTuple_New(n); PyObject *level; + static PyObject *empty_string; + + if (!empty_string) { + empty_string = PyString_FromString(""); + if (!empty_string) + return 0; + } if (!names) return 0; @@ -1998,23 +2005,24 @@ PyTuple_SET_ITEM(names, i, alias->name); } - if (s->lineno > c->c_future->ff_lineno) { - if (!strcmp(PyString_AS_STRING(s->v.ImportFrom.module), - "__future__")) { - Py_DECREF(level); - Py_DECREF(names); - return compiler_error(c, - "from __future__ imports must occur " + if (s->lineno > c->c_future->ff_lineno && s->v.ImportFrom.module && + !strcmp(PyString_AS_STRING(s->v.ImportFrom.module), "__future__")) { + Py_DECREF(level); + Py_DECREF(names); + return compiler_error(c, "from __future__ imports must occur " "at the beginning of the file"); - - } } ADDOP_O(c, LOAD_CONST, level, consts); Py_DECREF(level); ADDOP_O(c, LOAD_CONST, names, consts); Py_DECREF(names); - ADDOP_NAME(c, IMPORT_NAME, s->v.ImportFrom.module, names); + if (s->v.ImportFrom.module) { + ADDOP_NAME(c, IMPORT_NAME, s->v.ImportFrom.module, names); + } + else { + ADDOP_NAME(c, IMPORT_NAME, empty_string, names); + } for (i = 0; i < n; i++) { alias_ty alias = (alias_ty)asdl_seq_GET(s->v.ImportFrom.names, i); identifier store_name; From python-checkins at python.org Sat Jun 13 22:30:48 2009 From: python-checkins at python.org (benjamin.peterson) Date: Sat, 13 Jun 2009 22:30:48 +0200 (CEST) Subject: [Python-checkins] r73422 - python/trunk/Python/Python-ast.c Message-ID: <20090613203048.C870ED887@mail.python.org> Author: benjamin.peterson Date: Sat Jun 13 22:30:48 2009 New Revision: 73422 Log: update ast version Modified: python/trunk/Python/Python-ast.c Modified: python/trunk/Python/Python-ast.c ============================================================================== --- python/trunk/Python/Python-ast.c (original) +++ python/trunk/Python/Python-ast.c Sat Jun 13 22:30:48 2009 @@ -2,7 +2,7 @@ /* - __version__ 62047. + __version__ 73421. This module must be committed separately after each AST grammar change; The __version__ number is set to the revision number of the commit @@ -5944,7 +5944,7 @@ if (PyDict_SetItemString(d, "AST", (PyObject*)&AST_type) < 0) return; if (PyModule_AddIntConstant(m, "PyCF_ONLY_AST", PyCF_ONLY_AST) < 0) return; - if (PyModule_AddStringConstant(m, "__version__", "62047") < 0) + if (PyModule_AddStringConstant(m, "__version__", "73421") < 0) return; if (PyDict_SetItemString(d, "mod", (PyObject*)mod_type) < 0) return; if (PyDict_SetItemString(d, "Module", (PyObject*)Module_type) < 0) From buildbot at python.org Sat Jun 13 23:01:25 2009 From: buildbot at python.org (buildbot at python.org) Date: Sat, 13 Jun 2009 21:01:25 +0000 Subject: [Python-checkins] buildbot failure in x86 osx.5 trunk Message-ID: <20090613210125.A8A3CD599@mail.python.org> The Buildbot has detected a new failure of x86 osx.5 trunk. Full details are available at: http://www.python.org/dev/buildbot/all/x86%20osx.5%20trunk/builds/1193 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: heller-x86-osx5 Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: benjamin.peterson BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_pickle make: *** [buildbottest] Error 1 sincerely, -The Buildbot From python-checkins at python.org Sun Jun 14 05:05:55 2009 From: python-checkins at python.org (hirokazu.yamamoto) Date: Sun, 14 Jun 2009 05:05:55 +0200 (CEST) Subject: [Python-checkins] r73423 - in python/trunk: PC/VC6/pythoncore.dsp PC/VS7.1/pythoncore.vcproj PC/VS8.0/pythoncore.vcproj PC/config.c PCbuild/pythoncore.vcproj Message-ID: <20090614030555.0BF23D7BA@mail.python.org> Author: hirokazu.yamamoto Date: Sun Jun 14 05:05:54 2009 New Revision: 73423 Log: Updated MSVC files to follow r73394. Modified: python/trunk/PC/VC6/pythoncore.dsp python/trunk/PC/VS7.1/pythoncore.vcproj python/trunk/PC/VS8.0/pythoncore.vcproj python/trunk/PC/config.c python/trunk/PCbuild/pythoncore.vcproj Modified: python/trunk/PC/VC6/pythoncore.dsp ============================================================================== --- python/trunk/PC/VC6/pythoncore.dsp (original) +++ python/trunk/PC/VC6/pythoncore.dsp Sun Jun 14 05:05:54 2009 @@ -97,10 +97,6 @@ # End Source File # Begin Source File -SOURCE=..\..\Modules\_bytesio.c -# End Source File -# Begin Source File - SOURCE=..\..\Modules\cjkcodecs\_codecs_cn.c # End Source File # Begin Source File @@ -137,10 +133,6 @@ # End Source File # Begin Source File -SOURCE=..\..\Modules\_fileio.c -# End Source File -# Begin Source File - SOURCE=..\..\Modules\_functoolsmodule.c # End Source File # Begin Source File @@ -153,6 +145,10 @@ # End Source File # Begin Source File +SOURCE=..\..\Modules\_io\_iomodule.c +# End Source File +# Begin Source File + SOURCE=..\..\Modules\_json.c # End Source File # Begin Source File @@ -237,6 +233,10 @@ # End Source File # Begin Source File +SOURCE=..\..\Modules\_io\bufferedio.c +# End Source File +# Begin Source File + SOURCE=..\..\Objects\bufferobject.c # End Source File # Begin Source File @@ -245,6 +245,10 @@ # End Source File # Begin Source File +SOURCE=..\..\Modules\_io\bytesio.c +# End Source File +# Begin Source File + SOURCE=..\..\Objects\bytes_methods.c # End Source File # Begin Source File @@ -345,6 +349,10 @@ # End Source File # Begin Source File +SOURCE=..\..\Modules\_io\fileio.c +# End Source File +# Begin Source File + SOURCE=..\..\Objects\fileobject.c # End Source File # Begin Source File @@ -442,6 +450,10 @@ # End Source File # Begin Source File +SOURCE=..\..\Modules\_io\iobase.c +# End Source File +# Begin Source File + SOURCE=..\..\Modules\imageop.c # End Source File # Begin Source File @@ -671,6 +683,10 @@ # End Source File # Begin Source File +SOURCE=..\..\Modules\_io\stringio.c +# End Source File +# Begin Source File + SOURCE=..\..\Objects\stringobject.c # End Source File # Begin Source File @@ -699,6 +715,10 @@ # End Source File # Begin Source File +SOURCE=..\..\Modules\_io\textio.c +# End Source File +# Begin Source File + SOURCE=..\..\Python\thread.c # End Source File # Begin Source File Modified: python/trunk/PC/VS7.1/pythoncore.vcproj ============================================================================== --- python/trunk/PC/VS7.1/pythoncore.vcproj (original) +++ python/trunk/PC/VS7.1/pythoncore.vcproj Sun Jun 14 05:05:54 2009 @@ -362,18 +362,12 @@ RelativePath="..\..\Modules\cjkcodecs\_codecs_tw.c"> - - - - + + + + + + + + + + + + + + - - - - @@ -1350,6 +1342,42 @@ > + + + + + + + + + + + + + + + + + + - - - - @@ -1350,6 +1342,42 @@ > + + + + + + + + + + + + + + + + + + Author: hirokazu.yamamoto Date: Sun Jun 14 05:10:40 2009 New Revision: 73424 Log: Blocked revisions 73423 via svnmerge ........ r73423 | hirokazu.yamamoto | 2009-06-14 12:05:54 +0900 | 1 line Updated MSVC files to follow r73394. ........ Modified: python/branches/py3k/ (props changed) From buildbot at python.org Sun Jun 14 05:47:33 2009 From: buildbot at python.org (buildbot at python.org) Date: Sun, 14 Jun 2009 03:47:33 +0000 Subject: [Python-checkins] buildbot failure in x86 osx.5 trunk Message-ID: <20090614034733.D0B63D8A2@mail.python.org> The Buildbot has detected a new failure of x86 osx.5 trunk. Full details are available at: http://www.python.org/dev/buildbot/all/x86%20osx.5%20trunk/builds/1195 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: heller-x86-osx5 Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: hirokazu.yamamoto BUILD FAILED: failed test Excerpt from the test logfile: sincerely, -The Buildbot From python-checkins at python.org Sun Jun 14 05:53:55 2009 From: python-checkins at python.org (hirokazu.yamamoto) Date: Sun, 14 Jun 2009 05:53:55 +0200 (CEST) Subject: [Python-checkins] r73425 - in python/trunk: Misc/NEWS Modules/mmapmodule.c Message-ID: <20090614035355.3C14AD8A2@mail.python.org> Author: hirokazu.yamamoto Date: Sun Jun 14 05:53:55 2009 New Revision: 73425 Log: Issue #6271: mmap tried to close invalid file handle (-1) when annonymous. (On Unix) Patch by STINNER Victor. Modified: python/trunk/Misc/NEWS python/trunk/Modules/mmapmodule.c Modified: python/trunk/Misc/NEWS ============================================================================== --- python/trunk/Misc/NEWS (original) +++ python/trunk/Misc/NEWS Sun Jun 14 05:53:55 2009 @@ -325,6 +325,9 @@ Library ------- +- Issue #6271: mmap tried to close invalid file handle (-1) when annonymous. + (On Unix) + - Issue #6215: All bug fixes and enhancements from the Python 3.1 io library (including the fast C implementation) have been backported to the standard ``io`` module. Modified: python/trunk/Modules/mmapmodule.c ============================================================================== --- python/trunk/Modules/mmapmodule.c (original) +++ python/trunk/Modules/mmapmodule.c Sun Jun 14 05:53:55 2009 @@ -158,7 +158,8 @@ #endif /* MS_WINDOWS */ #ifdef UNIX - (void) close(self->fd); + if (0 <= self->fd) + (void) close(self->fd); self->fd = -1; if (self->data != NULL) { munmap(self->data, self->size); From python-checkins at python.org Sun Jun 14 06:48:42 2009 From: python-checkins at python.org (hirokazu.yamamoto) Date: Sun, 14 Jun 2009 06:48:42 +0200 (CEST) Subject: [Python-checkins] r73426 - in python/branches/release26-maint: Misc/NEWS Modules/mmapmodule.c Message-ID: <20090614044842.BF92DDAA1@mail.python.org> Author: hirokazu.yamamoto Date: Sun Jun 14 06:48:42 2009 New Revision: 73426 Log: Merged revisions 73425 via svnmerge from svn+ssh://pythondev at svn.python.org/python/trunk ........ r73425 | hirokazu.yamamoto | 2009-06-14 12:53:55 +0900 | 2 lines Issue #6271: mmap tried to close invalid file handle (-1) when annonymous. (On Unix) Patch by STINNER Victor. ........ Modified: python/branches/release26-maint/ (props changed) python/branches/release26-maint/Misc/NEWS python/branches/release26-maint/Modules/mmapmodule.c Modified: python/branches/release26-maint/Misc/NEWS ============================================================================== --- python/branches/release26-maint/Misc/NEWS (original) +++ python/branches/release26-maint/Misc/NEWS Sun Jun 14 06:48:42 2009 @@ -56,6 +56,9 @@ Library ------- +- Issue #6271: mmap tried to close invalid file handle (-1) when annonymous. + (On Unix) + - Issue #6258: Support AMD64 in bdist_msi. - Issue #5262: Fixed bug in next rollover time computation in Modified: python/branches/release26-maint/Modules/mmapmodule.c ============================================================================== --- python/branches/release26-maint/Modules/mmapmodule.c (original) +++ python/branches/release26-maint/Modules/mmapmodule.c Sun Jun 14 06:48:42 2009 @@ -158,7 +158,8 @@ #endif /* MS_WINDOWS */ #ifdef UNIX - (void) close(self->fd); + if (0 <= self->fd) + (void) close(self->fd); self->fd = -1; if (self->data != NULL) { munmap(self->data, self->size); From python-checkins at python.org Sun Jun 14 06:58:16 2009 From: python-checkins at python.org (hirokazu.yamamoto) Date: Sun, 14 Jun 2009 06:58:16 +0200 (CEST) Subject: [Python-checkins] r73427 - in python/branches/py3k: Misc/NEWS Modules/mmapmodule.c Message-ID: <20090614045816.29567D992@mail.python.org> Author: hirokazu.yamamoto Date: Sun Jun 14 06:58:16 2009 New Revision: 73427 Log: Merged revisions 73425 via svnmerge from svn+ssh://pythondev at svn.python.org/python/trunk ........ r73425 | hirokazu.yamamoto | 2009-06-14 12:53:55 +0900 | 2 lines Issue #6271: mmap tried to close invalid file handle (-1) when annonymous. (On Unix) Patch by STINNER Victor. ........ Modified: python/branches/py3k/ (props changed) python/branches/py3k/Misc/NEWS python/branches/py3k/Modules/mmapmodule.c Modified: python/branches/py3k/Misc/NEWS ============================================================================== --- python/branches/py3k/Misc/NEWS (original) +++ python/branches/py3k/Misc/NEWS Sun Jun 14 06:58:16 2009 @@ -15,6 +15,9 @@ Library ------- +- Issue #6271: mmap tried to close invalid file handle (-1) when annonymous. + (On Unix) + What's New in Python 3.1 Release Candidate 2? ============================================= Modified: python/branches/py3k/Modules/mmapmodule.c ============================================================================== --- python/branches/py3k/Modules/mmapmodule.c (original) +++ python/branches/py3k/Modules/mmapmodule.c Sun Jun 14 06:58:16 2009 @@ -164,7 +164,8 @@ #endif /* MS_WINDOWS */ #ifdef UNIX - (void) close(self->fd); + if (0 <= self->fd) + (void) close(self->fd); self->fd = -1; if (self->data != NULL) { munmap(self->data, self->size); From python-checkins at python.org Sun Jun 14 07:16:36 2009 From: python-checkins at python.org (hirokazu.yamamoto) Date: Sun, 14 Jun 2009 07:16:36 +0200 (CEST) Subject: [Python-checkins] r73428 - in python/branches/release30-maint: Misc/NEWS Modules/mmapmodule.c Message-ID: <20090614051636.1380EDAAD@mail.python.org> Author: hirokazu.yamamoto Date: Sun Jun 14 07:16:35 2009 New Revision: 73428 Log: Merged revisions 73427 via svnmerge from svn+ssh://pythondev at svn.python.org/python/branches/py3k ................ r73427 | hirokazu.yamamoto | 2009-06-14 13:58:16 +0900 | 10 lines Merged revisions 73425 via svnmerge from svn+ssh://pythondev at svn.python.org/python/trunk ........ r73425 | hirokazu.yamamoto | 2009-06-14 12:53:55 +0900 | 2 lines Issue #6271: mmap tried to close invalid file handle (-1) when annonymous. (On Unix) Patch by STINNER Victor. ........ ................ Modified: python/branches/release30-maint/ (props changed) python/branches/release30-maint/Misc/NEWS python/branches/release30-maint/Modules/mmapmodule.c Modified: python/branches/release30-maint/Misc/NEWS ============================================================================== --- python/branches/release30-maint/Misc/NEWS (original) +++ python/branches/release30-maint/Misc/NEWS Sun Jun 14 07:16:35 2009 @@ -73,6 +73,9 @@ Library ------- +- Issue #6271: mmap tried to close invalid file handle (-1) when annonymous. + (On Unix) + - Issue #6258: Support AMD64 in bdist_msi. - Fix a bug in the trace module where a bytes object from co_lnotab had its Modified: python/branches/release30-maint/Modules/mmapmodule.c ============================================================================== --- python/branches/release30-maint/Modules/mmapmodule.c (original) +++ python/branches/release30-maint/Modules/mmapmodule.c Sun Jun 14 07:16:35 2009 @@ -164,7 +164,8 @@ #endif /* MS_WINDOWS */ #ifdef UNIX - (void) close(self->fd); + if (0 <= self->fd) + (void) close(self->fd); self->fd = -1; if (self->data != NULL) { munmap(self->data, self->size); From buildbot at python.org Sun Jun 14 09:37:12 2009 From: buildbot at python.org (buildbot at python.org) Date: Sun, 14 Jun 2009 07:37:12 +0000 Subject: [Python-checkins] buildbot failure in sparc solaris10 gcc 3.x Message-ID: <20090614073712.4E58BC308@mail.python.org> The Buildbot has detected a new failure of sparc solaris10 gcc 3.x. Full details are available at: http://www.python.org/dev/buildbot/all/sparc%20solaris10%20gcc%203.x/builds/827 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: loewis-sun Build Reason: Build Source Stamp: [branch branches/py3k] HEAD Blamelist: hirokazu.yamamoto BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_posix ====================================================================== ERROR: test_getcwd_long_pathnames (test.test_posix.PosixTester) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home2/buildbot/slave/3.x.loewis-sun/build/Lib/test/test_posix.py", line 251, in test_getcwd_long_pathnames support.rmtree(base_path) File "/home2/buildbot/slave/3.x.loewis-sun/build/Lib/test/support.py", line 181, in rmtree shutil.rmtree(path) File "/home2/buildbot/slave/3.x.loewis-sun/build/Lib/shutil.py", line 239, in rmtree onerror(os.rmdir, path, sys.exc_info()) File "/home2/buildbot/slave/3.x.loewis-sun/build/Lib/shutil.py", line 237, in rmtree os.rmdir(path) OSError: [Errno 22] Invalid argument: '/home2/buildbot/slave/3.x.loewis-sun/build/@test.getcwd/@test.getcwd' sincerely, -The Buildbot From buildbot at python.org Sun Jun 14 10:17:30 2009 From: buildbot at python.org (buildbot at python.org) Date: Sun, 14 Jun 2009 08:17:30 +0000 Subject: [Python-checkins] buildbot failure in x86 XP-4 3.x Message-ID: <20090614081730.6E67DD9CC@mail.python.org> The Buildbot has detected a new failure of x86 XP-4 3.x. Full details are available at: http://www.python.org/dev/buildbot/all/x86%20XP-4%203.x/builds/692 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: bolen-windows Build Reason: Build Source Stamp: [branch branches/py3k] HEAD Blamelist: hirokazu.yamamoto BUILD FAILED: failed test Excerpt from the test logfile: Traceback (most recent call last): File "E:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\test\test_import.py", line 62, in test_with_extension self.fail("import from %s failed: %s" % (ext, err)) File "E:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\unittest.py", line 540, in fail raise self.failureException(msg) AssertionError: import from .PY failed: No module named @test Traceback (most recent call last): File "E:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\test\test_import.py", line 79, in testImport test_with_extension(ext) File "E:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\test\test_import.py", line 72, in test_with_extension del sys.modules[TESTFN] KeyError: '@test' 1 test failed: test_import ====================================================================== ERROR: testImport (test.test_import.ImportTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "E:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\test\test_import.py", line 60, in test_with_extension mod = __import__(TESTFN) ImportError: No module named @test Traceback (most recent call last): File "E:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\test\test_import.py", line 62, in test_with_extension self.fail("import from %s failed: %s" % (ext, err)) File "E:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\unittest.py", line 540, in fail raise self.failureException(msg) AssertionError: import from .PY failed: No module named @test Traceback (most recent call last): File "E:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\test\test_import.py", line 79, in testImport test_with_extension(ext) File "E:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\test\test_import.py", line 72, in test_with_extension del sys.modules[TESTFN] KeyError: '@test' Traceback (most recent call last): File "E:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\test\test_import.py", line 62, in test_with_extension self.fail("import from %s failed: %s" % (ext, err)) File "E:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\unittest.py", line 540, in fail raise self.failureException(msg) AssertionError: import from .PY failed: No module named @test Traceback (most recent call last): File "E:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\test\test_import.py", line 79, in testImport test_with_extension(ext) File "E:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\test\test_import.py", line 72, in test_with_extension del sys.modules[TESTFN] KeyError: '@test' sincerely, -The Buildbot From buildbot at python.org Sun Jun 14 10:44:44 2009 From: buildbot at python.org (buildbot at python.org) Date: Sun, 14 Jun 2009 08:44:44 +0000 Subject: [Python-checkins] buildbot failure in sparc solaris10 gcc 3.0 Message-ID: <20090614084444.3D5F6D8C1@mail.python.org> The Buildbot has detected a new failure of sparc solaris10 gcc 3.0. Full details are available at: http://www.python.org/dev/buildbot/all/sparc%20solaris10%20gcc%203.0/builds/409 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: loewis-sun Build Reason: Build Source Stamp: [branch branches/release30-maint] HEAD Blamelist: hirokazu.yamamoto BUILD FAILED: failed test Excerpt from the test logfile: 3 tests failed: test_distutils test_posix test_subprocess ====================================================================== FAIL: test_get_python_inc (distutils.tests.test_sysconfig.SysconfigTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home2/buildbot/slave/3.0.loewis-sun/build/Lib/distutils/tests/test_sysconfig.py", line 54, in test_get_python_inc self.assert_(os.path.isdir(inc_dir), inc_dir) AssertionError: /home2/buildbot/slave/3.0.loewis-sun/build/@test.getcwd/Include ====================================================================== ERROR: test_getcwd_long_pathnames (test.test_posix.PosixTester) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home2/buildbot/slave/3.0.loewis-sun/build/Lib/test/test_posix.py", line 252, in test_getcwd_long_pathnames support.rmtree(base_path) File "/home2/buildbot/slave/3.0.loewis-sun/build/Lib/test/support.py", line 98, in rmtree shutil.rmtree(path) File "/home2/buildbot/slave/3.0.loewis-sun/build/Lib/shutil.py", line 225, in rmtree onerror(os.rmdir, path, sys.exc_info()) File "/home2/buildbot/slave/3.0.loewis-sun/build/Lib/shutil.py", line 223, in rmtree os.rmdir(path) OSError: [Errno 22] Invalid argument: '/home2/buildbot/slave/3.0.loewis-sun/build/@test.getcwd/@test.getcwd' ====================================================================== FAIL: test_executable (test.test_subprocess.ProcessTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home2/buildbot/slave/3.0.loewis-sun/build/Lib/test/test_subprocess.py", line 115, in test_executable self.assertEqual(p.returncode, 47) AssertionError: -6 != 47 sincerely, -The Buildbot From python-checkins at python.org Sun Jun 14 16:37:23 2009 From: python-checkins at python.org (benjamin.peterson) Date: Sun, 14 Jun 2009 16:37:23 +0200 (CEST) Subject: [Python-checkins] r73429 - python/branches/py3k/Doc/library/io.rst Message-ID: <20090614143723.D34C3DA62@mail.python.org> Author: benjamin.peterson Date: Sun Jun 14 16:37:23 2009 New Revision: 73429 Log: update peek documentation to implementation Modified: python/branches/py3k/Doc/library/io.rst Modified: python/branches/py3k/Doc/library/io.rst ============================================================================== --- python/branches/py3k/Doc/library/io.rst (original) +++ python/branches/py3k/Doc/library/io.rst Sun Jun 14 16:37:23 2009 @@ -504,11 +504,9 @@ .. method:: peek([n]) - Return 1 (or *n* if specified) bytes from a buffer without advancing the - position. Only a single read on the raw stream is done to satisfy the - call. The number of bytes returned may be less than requested since at - most all the buffer's bytes from the current position to the end are - returned. + Return bytes from the stream without advancing the position. Only a + single read on the raw stream is done to satisfy the call. The number of + bytes returned may be less or more than requested. .. method:: read([n]) From eric+python-dev at trueblade.com Sun Jun 14 16:40:48 2009 From: eric+python-dev at trueblade.com (Eric Smith) Date: Sun, 14 Jun 2009 10:40:48 -0400 Subject: [Python-checkins] r73389 - in python/branches/py3k: Lib/doctest.py Lib/test/test_doctest.py Misc/NEWS In-Reply-To: <20090612153319.D88BFC514@mail.python.org> References: <20090612153319.D88BFC514@mail.python.org> Message-ID: <4A350BF0.4090408@trueblade.com> [ I sent this earlier, but I never saw it and it's not in the archives. Apologies if you see it twice. ] > + if not file[0]+file[-2:] == '<]>': file = None > + if file is None: source_lines = None > + else: I don't see a reason to put these on a single line. > + if not source_lines: > + source_lines = None Especially when this similar line is treated differently. Eric. From python-checkins at python.org Sun Jun 14 20:32:19 2009 From: python-checkins at python.org (benjamin.peterson) Date: Sun, 14 Jun 2009 20:32:19 +0200 (CEST) Subject: [Python-checkins] r73430 - in python/branches/py3k: Misc/NEWS Modules/_io/stringio.c Message-ID: <20090614183219.8B2CCDBF7@mail.python.org> Author: benjamin.peterson Date: Sun Jun 14 20:32:19 2009 New Revision: 73430 Log: just throw a normal AttributeError for no buffer attribute Modified: python/branches/py3k/Misc/NEWS python/branches/py3k/Modules/_io/stringio.c Modified: python/branches/py3k/Misc/NEWS ============================================================================== --- python/branches/py3k/Misc/NEWS (original) +++ python/branches/py3k/Misc/NEWS Sun Jun 14 20:32:19 2009 @@ -15,6 +15,9 @@ Library ------- +- Accessing io.StringIO.buffer now raises an AttributeError instead of + io.UnsupportedOperation. + - Issue #6271: mmap tried to close invalid file handle (-1) when annonymous. (On Unix) Modified: python/branches/py3k/Modules/_io/stringio.c ============================================================================== --- python/branches/py3k/Modules/_io/stringio.c (original) +++ python/branches/py3k/Modules/_io/stringio.c Sun Jun 14 20:32:19 2009 @@ -646,14 +646,6 @@ } static PyObject * -stringio_buffer(stringio *self, void *context) -{ - PyErr_SetString(IO_STATE->unsupported_operation, - "buffer attribute is unsupported on type StringIO"); - return NULL; -} - -static PyObject * stringio_closed(stringio *self, void *context) { CHECK_INITIALIZED(self); @@ -703,7 +695,6 @@ Hopefully, a better solution, than adding these pseudo-attributes, will be found. */ - {"buffer", (getter)stringio_buffer, NULL, NULL}, {"line_buffering", (getter)stringio_line_buffering, NULL, NULL}, {NULL} }; From python-checkins at python.org Sun Jun 14 20:41:18 2009 From: python-checkins at python.org (benjamin.peterson) Date: Sun, 14 Jun 2009 20:41:18 +0200 (CEST) Subject: [Python-checkins] r73431 - python/branches/py3k/Doc/library/sys.rst Message-ID: <20090614184118.65F6BD32A@mail.python.org> Author: benjamin.peterson Date: Sun Jun 14 20:41:18 2009 New Revision: 73431 Log: rewrite binary std streams part; note that detach()/buffer will not always work Modified: python/branches/py3k/Doc/library/sys.rst Modified: python/branches/py3k/Doc/library/sys.rst ============================================================================== --- python/branches/py3k/Doc/library/sys.rst (original) +++ python/branches/py3k/Doc/library/sys.rst Sun Jun 14 20:41:18 2009 @@ -784,13 +784,18 @@ The standard streams are in text mode by default. To write or read binary data to these, use the underlying binary buffer. For example, to write bytes to :data:`stdout`, use ``sys.stdout.buffer.write(b'abc')``. Using - :meth:`io.TextIOBase.detach` streams can be made binary by default. For - example, this function sets all the standard streams to binary:: + :meth:`io.TextIOBase.detach` streams can be made binary by default. This + function sets :data:`stdin` and :data:`stdout` to binary:: def make_streams_binary(): sys.stdin = sys.stdin.detach() sys.stdout = sys.stdout.detach() - sys.stderr = sys.stderr.detach() + + Note that the streams can be replaced with objects (like + :class:`io.StringIO`) that do not support the + :attr:`~io.BufferedIOBase.buffer` attribute or the + :meth:`~io.BufferedIOBase.detach` method and can raise :exc:`AttributeError` + or :exc:`io.UnsupportedOperation`. .. data:: __stdin__ From solipsis at pitrou.net Sun Jun 14 21:48:10 2009 From: solipsis at pitrou.net (Antoine Pitrou) Date: Sun, 14 Jun 2009 19:48:10 +0000 (UTC) Subject: [Python-checkins] =?utf-8?q?r73430_-_in_python/branches/py3k=3A_M?= =?utf-8?q?isc/NEWS=09Modules/=5Fio/stringio=2Ec?= References: <20090614183219.8B2CCDBF7@mail.python.org> Message-ID: writes: > > Author: benjamin.peterson > Date: Sun Jun 14 20:32:19 2009 > New Revision: 73430 > > Log: > just throw a normal AttributeError for no buffer attribute Could you also port it to trunk? Thanks Antoine. From python-checkins at python.org Sun Jun 14 23:20:41 2009 From: python-checkins at python.org (amaury.forgeotdarc) Date: Sun, 14 Jun 2009 23:20:41 +0200 (CEST) Subject: [Python-checkins] r73432 - in python/trunk/Lib/test: doctest_aliases.py test_doctest.py Message-ID: <20090614212041.21BA9DDA5@mail.python.org> Author: amaury.forgeotdarc Date: Sun Jun 14 23:20:40 2009 New Revision: 73432 Log: #6227: Because of a wrong indentation, the test was not testing what it should. Ensure that the snippet in doctest_aliases actually contains aliases. Modified: python/trunk/Lib/test/doctest_aliases.py python/trunk/Lib/test/test_doctest.py Modified: python/trunk/Lib/test/doctest_aliases.py ============================================================================== --- python/trunk/Lib/test/doctest_aliases.py (original) +++ python/trunk/Lib/test/doctest_aliases.py Sun Jun 14 23:20:40 2009 @@ -10,4 +10,4 @@ ''' return 'f' - g = f # define an alias for f + g = f # define an alias for f Modified: python/trunk/Lib/test/test_doctest.py ============================================================================== --- python/trunk/Lib/test/test_doctest.py (original) +++ python/trunk/Lib/test/test_doctest.py Sun Jun 14 23:20:40 2009 @@ -498,6 +498,8 @@ will only be generated for it once: >>> from test import doctest_aliases + >>> assert doctest_aliases.TwoNames.f + >>> assert doctest_aliases.TwoNames.g >>> tests = excl_empty_finder.find(doctest_aliases) >>> print len(tests) 2 From python-checkins at python.org Mon Jun 15 00:36:48 2009 From: python-checkins at python.org (benjamin.peterson) Date: Mon, 15 Jun 2009 00:36:48 +0200 (CEST) Subject: [Python-checkins] r73433 - python/trunk/Modules/_io/stringio.c Message-ID: <20090614223648.E2BC2DD52@mail.python.org> Author: benjamin.peterson Date: Mon Jun 15 00:36:48 2009 New Revision: 73433 Log: backport r73430 Modified: python/trunk/Modules/_io/stringio.c Modified: python/trunk/Modules/_io/stringio.c ============================================================================== --- python/trunk/Modules/_io/stringio.c (original) +++ python/trunk/Modules/_io/stringio.c Mon Jun 15 00:36:48 2009 @@ -651,14 +651,6 @@ } static PyObject * -stringio_buffer(stringio *self, void *context) -{ - PyErr_SetString(_PyIO_unsupported_operation, - "buffer attribute is unsupported on type StringIO"); - return NULL; -} - -static PyObject * stringio_closed(stringio *self, void *context) { CHECK_INITIALIZED(self); @@ -708,7 +700,6 @@ Hopefully, a better solution, than adding these pseudo-attributes, will be found. */ - {"buffer", (getter)stringio_buffer, NULL, NULL}, {"line_buffering", (getter)stringio_line_buffering, NULL, NULL}, {NULL} }; From python-checkins at python.org Mon Jun 15 00:40:28 2009 From: python-checkins at python.org (benjamin.peterson) Date: Mon, 15 Jun 2009 00:40:28 +0200 (CEST) Subject: [Python-checkins] r73434 - python/branches/py3k Message-ID: <20090614224028.6A3E5DDBD@mail.python.org> Author: benjamin.peterson Date: Mon Jun 15 00:40:28 2009 New Revision: 73434 Log: Blocked revisions 73433 via svnmerge ........ r73433 | benjamin.peterson | 2009-06-14 17:36:48 -0500 (Sun, 14 Jun 2009) | 1 line backport r73430 ........ Modified: python/branches/py3k/ (props changed) From buildbot at python.org Mon Jun 15 01:15:06 2009 From: buildbot at python.org (buildbot at python.org) Date: Sun, 14 Jun 2009 23:15:06 +0000 Subject: [Python-checkins] buildbot failure in x86 osx.5 trunk Message-ID: <20090614231506.343F6DD75@mail.python.org> The Buildbot has detected a new failure of x86 osx.5 trunk. Full details are available at: http://www.python.org/dev/buildbot/all/x86%20osx.5%20trunk/builds/1198 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: heller-x86-osx5 Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: benjamin.peterson BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_asynchat make: *** [buildbottest] Error 1 sincerely, -The Buildbot From buildbot at python.org Mon Jun 15 02:28:09 2009 From: buildbot at python.org (buildbot at python.org) Date: Mon, 15 Jun 2009 00:28:09 +0000 Subject: [Python-checkins] buildbot failure in sparc solaris10 gcc 3.x Message-ID: <20090615002809.5798DDBE6@mail.python.org> The Buildbot has detected a new failure of sparc solaris10 gcc 3.x. Full details are available at: http://www.python.org/dev/buildbot/all/sparc%20solaris10%20gcc%203.x/builds/829 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: loewis-sun Build Reason: Build Source Stamp: [branch branches/py3k] HEAD Blamelist: benjamin.peterson BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_posix ====================================================================== ERROR: test_getcwd_long_pathnames (test.test_posix.PosixTester) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home2/buildbot/slave/3.x.loewis-sun/build/Lib/test/test_posix.py", line 251, in test_getcwd_long_pathnames support.rmtree(base_path) File "/home2/buildbot/slave/3.x.loewis-sun/build/Lib/test/support.py", line 181, in rmtree shutil.rmtree(path) File "/home2/buildbot/slave/3.x.loewis-sun/build/Lib/shutil.py", line 239, in rmtree onerror(os.rmdir, path, sys.exc_info()) File "/home2/buildbot/slave/3.x.loewis-sun/build/Lib/shutil.py", line 237, in rmtree os.rmdir(path) OSError: [Errno 22] Invalid argument: '/home2/buildbot/slave/3.x.loewis-sun/build/@test.getcwd/@test.getcwd' sincerely, -The Buildbot From nnorwitz at gmail.com Mon Jun 15 22:00:13 2009 From: nnorwitz at gmail.com (Neal Norwitz) Date: Mon, 15 Jun 2009 16:00:13 -0400 Subject: [Python-checkins] Python Regression Test Failures doc (1) Message-ID: <20090615200013.GA441@python.psfb.org> rm -rf build/* rm -rf tools/sphinx Checking out Sphinx... svn: REPORT request failed on '/projects/!svn/vcc/default' svn: Can't find a temporary directory: Internal error make: *** [checkout] Error 1 From python-checkins at python.org Tue Jun 16 01:04:29 2009 From: python-checkins at python.org (tarek.ziade) Date: Tue, 16 Jun 2009 01:04:29 +0200 (CEST) Subject: [Python-checkins] r73435 - python/trunk/Lib/distutils/command/upload.py Message-ID: <20090615230429.77CA5DEA1@mail.python.org> Author: tarek.ziade Date: Tue Jun 16 01:04:29 2009 New Revision: 73435 Log: code cleanup Modified: python/trunk/Lib/distutils/command/upload.py Modified: python/trunk/Lib/distutils/command/upload.py ============================================================================== --- python/trunk/Lib/distutils/command/upload.py (original) +++ python/trunk/Lib/distutils/command/upload.py Tue Jun 16 01:04:29 2009 @@ -1,11 +1,6 @@ """distutils.command.upload Implements the Distutils 'upload' subcommand (upload package to PyPI).""" - -from distutils.errors import * -from distutils.core import PyPIRCCommand -from distutils.spawn import spawn -from distutils import log import sys import os import socket @@ -15,12 +10,12 @@ import urlparse import cStringIO as StringIO from ConfigParser import ConfigParser +from hashlib import md5 -# this keeps compatibility for 2.3 and 2.4 -if sys.version < "2.5": - from md5 import md5 -else: - from hashlib import md5 +from distutils.errors import * +from distutils.core import PyPIRCCommand +from distutils.spawn import spawn +from distutils import log class upload(PyPIRCCommand): @@ -125,7 +120,8 @@ open(filename+".asc").read()) # set up the authentication - auth = "Basic " + base64.encodestring(self.username + ":" + self.password).strip() + auth = "Basic " + base64.encodestring(self.username + ":" + + self.password).strip() # Build up the MIME payload for the POST data boundary = '--------------GHSKFJDLGDS7543FJKLFHRE75642756743254' @@ -134,10 +130,10 @@ body = StringIO.StringIO() for key, value in data.items(): # handle multiple entries for the same name - if type(value) != type([]): + if not isinstance(value, list): value = [value] for value in value: - if type(value) is tuple: + if isinstance(value, tuple): fn = ';filename="%s"' % value[0] value = value[1] else: From python-checkins at python.org Tue Jun 16 01:30:14 2009 From: python-checkins at python.org (tarek.ziade) Date: Tue, 16 Jun 2009 01:30:14 +0200 (CEST) Subject: [Python-checkins] r73436 - in python/trunk: Lib/distutils/command/upload.py Lib/distutils/tests/test_upload.py Misc/NEWS Message-ID: <20090615233014.1F889DEA4@mail.python.org> Author: tarek.ziade Date: Tue Jun 16 01:30:13 2009 New Revision: 73436 Log: Issue #6286: distutils upload command now uses urllib2 Modified: python/trunk/Lib/distutils/command/upload.py python/trunk/Lib/distutils/tests/test_upload.py python/trunk/Misc/NEWS Modified: python/trunk/Lib/distutils/command/upload.py ============================================================================== --- python/trunk/Lib/distutils/command/upload.py (original) +++ python/trunk/Lib/distutils/command/upload.py Tue Jun 16 01:30:13 2009 @@ -5,7 +5,7 @@ import os import socket import platform -import httplib +from urllib2 import urlopen, Request, HTTPError import base64 import urlparse import cStringIO as StringIO @@ -62,6 +62,15 @@ self.upload_file(command, pyversion, filename) def upload_file(self, command, pyversion, filename): + # Makes sure the repository URL is compliant + schema, netloc, url, params, query, fragments = \ + urlparse.urlparse(self.repository) + if params or query or fragments: + raise AssertionError("Incompatible url %s" % self.repository) + + if schema not in ('http', 'https'): + raise AssertionError("unsupported schema " + schema) + # Sign if requested if self.sign: gpg_args = ["gpg", "--detach-sign", "-a", filename] @@ -153,39 +162,30 @@ self.announce("Submitting %s to %s" % (filename, self.repository), log.INFO) # build the Request - # We can't use urllib2 since we need to send the Basic - # auth right with the first request - schema, netloc, url, params, query, fragments = \ - urlparse.urlparse(self.repository) - assert not params and not query and not fragments - if schema == 'http': - http = httplib.HTTPConnection(netloc) - elif schema == 'https': - http = httplib.HTTPSConnection(netloc) - else: - raise AssertionError, "unsupported schema "+schema - - data = '' - loglevel = log.INFO + headers = {'Content-type': + 'multipart/form-data; boundary=%s' % boundary, + 'Content-length': str(len(body)), + 'Authorization': auth} + + request = Request(self.repository, data=body, + headers=headers) + # send the data try: - http.connect() - http.putrequest("POST", url) - http.putheader('Content-type', - 'multipart/form-data; boundary=%s'%boundary) - http.putheader('Content-length', str(len(body))) - http.putheader('Authorization', auth) - http.endheaders() - http.send(body) + result = urlopen(request) + status = result.getcode() + reason = result.msg except socket.error, e: self.announce(str(e), log.ERROR) return + except HTTPError, e: + status = e.code + reason = e.msg - r = http.getresponse() - if r.status == 200: - self.announce('Server response (%s): %s' % (r.status, r.reason), + if status == 200: + self.announce('Server response (%s): %s' % (status, reason), log.INFO) else: - self.announce('Upload failed (%s): %s' % (r.status, r.reason), + self.announce('Upload failed (%s): %s' % (status, reason), log.ERROR) if self.show_response: - self.announce('-'*75, r.read(), '-'*75) + self.announce('-'*75, result.read(), '-'*75) Modified: python/trunk/Lib/distutils/tests/test_upload.py ============================================================================== --- python/trunk/Lib/distutils/tests/test_upload.py (original) +++ python/trunk/Lib/distutils/tests/test_upload.py Tue Jun 16 01:30:13 2009 @@ -2,8 +2,8 @@ import sys import os import unittest -import httplib +from distutils.command import upload as upload_mod from distutils.command.upload import upload from distutils.core import Distribution @@ -19,48 +19,37 @@ [server1] username:me """ -class Response(object): - def __init__(self, status=200, reason='OK'): - self.status = status - self.reason = reason -class FakeConnection(object): +class FakeOpen(object): - def __init__(self): - self.requests = [] - self.headers = [] - self.body = '' + def __init__(self, url): + self.url = url + if not isinstance(url, str): + self.req = url + else: + self.req = None + self.msg = 'OK' - def __call__(self, netloc): - return self + def getcode(self): + return 200 - def connect(self): - pass - endheaders = connect - - def putrequest(self, method, url): - self.requests.append((method, url)) - - def putheader(self, name, value): - self.headers.append((name, value)) - - def send(self, body): - self.body = body - - def getresponse(self): - return Response() class uploadTestCase(PyPIRCCommandTestCase): def setUp(self): super(uploadTestCase, self).setUp() - self.old_class = httplib.HTTPConnection - self.conn = httplib.HTTPConnection = FakeConnection() + self.old_open = upload_mod.urlopen + upload_mod.urlopen = self._urlopen + self.last_open = None def tearDown(self): - httplib.HTTPConnection = self.old_class + upload_mod.urlopen = self.old_open super(uploadTestCase, self).tearDown() + def _urlopen(self, url): + self.last_open = FakeOpen(url) + return self.last_open + def test_finalize_options(self): # new format @@ -105,12 +94,13 @@ cmd.run() # what did we send ? - headers = dict(self.conn.headers) + headers = dict(self.last_open.req.headers) self.assertEquals(headers['Content-length'], '2086') self.assert_(headers['Content-type'].startswith('multipart/form-data')) - - self.assertEquals(self.conn.requests, [('POST', '/pypi')]) - self.assert_('xxx' in self.conn.body) + self.assertEquals(self.last_open.req.get_method(), 'POST') + self.assertEquals(self.last_open.req.get_full_url(), + 'http://pypi.python.org/pypi') + self.assert_('xxx' in self.last_open.req.data) def test_suite(): return unittest.makeSuite(uploadTestCase) Modified: python/trunk/Misc/NEWS ============================================================================== --- python/trunk/Misc/NEWS (original) +++ python/trunk/Misc/NEWS Tue Jun 16 01:30:13 2009 @@ -325,6 +325,9 @@ Library ------- +- Issue #6286: Now Distutils upload command is based on urllib2 instead of + httplib, allowing the usage of http_proxy. + - Issue #6271: mmap tried to close invalid file handle (-1) when annonymous. (On Unix) From python-checkins at python.org Tue Jun 16 01:34:00 2009 From: python-checkins at python.org (tarek.ziade) Date: Tue, 16 Jun 2009 01:34:00 +0200 (CEST) Subject: [Python-checkins] r73437 - python/branches/release26-maint Message-ID: <20090615233400.9874FDEA4@mail.python.org> Author: tarek.ziade Date: Tue Jun 16 01:34:00 2009 New Revision: 73437 Log: Blocked revisions 73435-73436 via svnmerge ........ r73435 | tarek.ziade | 2009-06-16 01:04:29 +0200 (Tue, 16 Jun 2009) | 1 line code cleanup ........ r73436 | tarek.ziade | 2009-06-16 01:30:13 +0200 (Tue, 16 Jun 2009) | 1 line Issue #6286: distutils upload command now uses urllib2 ........ Modified: python/branches/release26-maint/ (props changed) From python-checkins at python.org Tue Jun 16 02:19:11 2009 From: python-checkins at python.org (benjamin.peterson) Date: Tue, 16 Jun 2009 02:19:11 +0200 (CEST) Subject: [Python-checkins] r73438 - sandbox/trunk/release/release.py Message-ID: <20090616001911.AD7A6C583@mail.python.org> Author: benjamin.peterson Date: Tue Jun 16 02:19:11 2009 New Revision: 73438 Log: switch back to a captial "P" for source tarballs There is a long historical precedent to this I shouldn't violate. Modified: sandbox/trunk/release/release.py Modified: sandbox/trunk/release/release.py ============================================================================== --- sandbox/trunk/release/release.py (original) +++ sandbox/trunk/release/release.py Tue Jun 16 02:19:11 2009 @@ -249,7 +249,7 @@ old_cur = os.getcwd() with changed_dir('dist'): print 'Exporting tag:', tag.text - archivename = 'python-%s' % tag.text + archivename = 'Python-%s' % tag.text run_cmd(['svn', 'export', '-q', 'http://svn.python.org/projects/python/tags/r%s' % tag.nickname, archivename]) From python-checkins at python.org Tue Jun 16 02:29:31 2009 From: python-checkins at python.org (benjamin.peterson) Date: Tue, 16 Jun 2009 02:29:31 +0200 (CEST) Subject: [Python-checkins] r73439 - in python/trunk: Lib/test/test_coding.py Misc/NEWS Parser/tokenizer.c Message-ID: <20090616002931.49340C566@mail.python.org> Author: benjamin.peterson Date: Tue Jun 16 02:29:31 2009 New Revision: 73439 Log: don't mask encoding errors when decoding a string #6289 Modified: python/trunk/Lib/test/test_coding.py python/trunk/Misc/NEWS python/trunk/Parser/tokenizer.c Modified: python/trunk/Lib/test/test_coding.py ============================================================================== --- python/trunk/Lib/test/test_coding.py (original) +++ python/trunk/Lib/test/test_coding.py Tue Jun 16 02:29:31 2009 @@ -21,6 +21,18 @@ fp.close() self.assertRaises(SyntaxError, compile, text, filename, 'exec') + def test_error_from_string(self): + # See http://bugs.python.org/issue6289 + input = u"# coding: ascii\n\N{SNOWMAN}".encode('utf-8') + try: + compile(input, "", "exec") + except SyntaxError as e: + expected = "'ascii' codec can't decode byte 0xe2 in position 16: " \ + "ordinal not in range(128)" + self.assertTrue(str(e).startswith(expected)) + else: + self.fail("didn't raise") + def test_main(): test.test_support.run_unittest(CodingTest) Modified: python/trunk/Misc/NEWS ============================================================================== --- python/trunk/Misc/NEWS (original) +++ python/trunk/Misc/NEWS Tue Jun 16 02:29:31 2009 @@ -12,6 +12,8 @@ Core and Builtins ----------------- +- Issue #6289: Encoding errors from compile() were being masked. + - When no module is given in a relative import, the module field of the ImportFrom AST node is now None instead of an empty string. Modified: python/trunk/Parser/tokenizer.c ============================================================================== --- python/trunk/Parser/tokenizer.c (original) +++ python/trunk/Parser/tokenizer.c Tue Jun 16 02:29:31 2009 @@ -619,11 +619,8 @@ if (tok->enc != NULL) { assert(utf8 == NULL); utf8 = translate_into_utf8(str, tok->enc); - if (utf8 == NULL) { - PyErr_Format(PyExc_SyntaxError, - "unknown encoding: %s", tok->enc); + if (utf8 == NULL) return error_ret(tok); - } str = PyString_AsString(utf8); } #endif From python-checkins at python.org Tue Jun 16 02:59:06 2009 From: python-checkins at python.org (benjamin.peterson) Date: Tue, 16 Jun 2009 02:59:06 +0200 (CEST) Subject: [Python-checkins] r73440 - python/sandbox Message-ID: <20090616005906.E3038DF1E@mail.python.org> Author: benjamin.peterson Date: Tue Jun 16 02:59:06 2009 New Revision: 73440 Log: remove empty directory Removed: python/sandbox/ From buildbot at python.org Tue Jun 16 07:47:18 2009 From: buildbot at python.org (buildbot at python.org) Date: Tue, 16 Jun 2009 05:47:18 +0000 Subject: [Python-checkins] buildbot failure in x86 XP-4 trunk Message-ID: <20090616054718.9E1AFDE4D@mail.python.org> The Buildbot has detected a new failure of x86 XP-4 trunk. Full details are available at: http://www.python.org/dev/buildbot/all/x86%20XP-4%20trunk/builds/2249 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: bolen-windows Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: tarek.ziade BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_io ====================================================================== ERROR: test_seek_and_tell (test.test_io.CTextIOWrapperTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "E:\cygwin\home\db3l\buildarea\trunk.bolen-windows\build\lib\test\test_io.py", line 1883, in test_seek_and_tell test_seek_and_tell_with_data(input) File "E:\cygwin\home\db3l\buildarea\trunk.bolen-windows\build\lib\test\test_io.py", line 1861, in test_seek_and_tell_with_data f = self.open(support.TESTFN, encoding='test_decoder') File "E:\cygwin\home\db3l\buildarea\trunk.bolen-windows\build\lib\test\test_io.py", line 1394, in __init__ codecs.IncrementalDecoder.__init__(self, errors) AttributeError: 'NoneType' object has no attribute 'IncrementalDecoder' ====================================================================== ERROR: test_seek_and_tell (test.test_io.PyTextIOWrapperTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "E:\cygwin\home\db3l\buildarea\trunk.bolen-windows\build\lib\test\test_io.py", line 1883, in test_seek_and_tell test_seek_and_tell_with_data(input) File "E:\cygwin\home\db3l\buildarea\trunk.bolen-windows\build\lib\test\test_io.py", line 1863, in test_seek_and_tell_with_data decoded = f.read() File "E:\cygwin\home\db3l\buildarea\trunk.bolen-windows\build\lib\_pyio.py", line 1802, in read decoder = self._decoder or self._get_decoder() File "E:\cygwin\home\db3l\buildarea\trunk.bolen-windows\build\lib\_pyio.py", line 1568, in _get_decoder decoder = make_decoder(self._errors) File "E:\cygwin\home\db3l\buildarea\trunk.bolen-windows\build\lib\test\test_io.py", line 1394, in __init__ codecs.IncrementalDecoder.__init__(self, errors) AttributeError: 'NoneType' object has no attribute 'IncrementalDecoder' ====================================================================== FAIL: test_invalid_operations (test.test_io.CIOTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "E:\cygwin\home\db3l\buildarea\trunk.bolen-windows\build\lib\test\test_io.py", line 303, in test_invalid_operations self.assertRaises(IOError, fp.readline) AssertionError: IOError not raised ====================================================================== FAIL: test_invalid_operations (test.test_io.PyIOTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "E:\cygwin\home\db3l\buildarea\trunk.bolen-windows\build\lib\test\test_io.py", line 303, in test_invalid_operations self.assertRaises(IOError, fp.readline) AssertionError: IOError not raised sincerely, -The Buildbot From python-checkins at python.org Tue Jun 16 09:29:52 2009 From: python-checkins at python.org (tarek.ziade) Date: Tue, 16 Jun 2009 09:29:52 +0200 (CEST) Subject: [Python-checkins] r73441 - in python/trunk: Doc/distutils/setupscript.rst Misc/NEWS Message-ID: <20090616072952.D8945DE6C@mail.python.org> Author: tarek.ziade Date: Tue Jun 16 09:29:52 2009 New Revision: 73441 Log: Fixed #6287: documentation for the license field in distutils Modified: python/trunk/Doc/distutils/setupscript.rst python/trunk/Misc/NEWS Modified: python/trunk/Doc/distutils/setupscript.rst ============================================================================== --- python/trunk/Doc/distutils/setupscript.rst (original) +++ python/trunk/Doc/distutils/setupscript.rst Tue Jun 16 09:29:52 2009 @@ -590,6 +590,8 @@ +----------------------+---------------------------+-----------------+--------+ | ``platforms`` | a list of platforms | list of strings | | +----------------------+---------------------------+-----------------+--------+ +| ``license`` | license for the package | short string | \(6) | ++----------------------+---------------------------+-----------------+--------+ Notes: @@ -611,6 +613,13 @@ The ``long_description`` field is used by PyPI when you are registering a package, to build its home page. +(6) + The ``license`` field is a text indicating the license covering the + package where the license is not a selection from the "License" Trove + classifiers. See the ``Classifier`` field. Notice that + there's a ``licence`` distribution option which is deprecated but still + acts as an alias for ``license``. + 'short string' A single line of text, not more than 200 characters. Modified: python/trunk/Misc/NEWS ============================================================================== --- python/trunk/Misc/NEWS (original) +++ python/trunk/Misc/NEWS Tue Jun 16 09:29:52 2009 @@ -327,6 +327,8 @@ Library ------- +- Issue #6287: Added the license field in Distutils documentation. + - Issue #6286: Now Distutils upload command is based on urllib2 instead of httplib, allowing the usage of http_proxy. From python-checkins at python.org Tue Jun 16 09:41:29 2009 From: python-checkins at python.org (tarek.ziade) Date: Tue, 16 Jun 2009 09:41:29 +0200 (CEST) Subject: [Python-checkins] r73442 - in python/branches/release26-maint: Doc/distutils/setupscript.rst Misc/NEWS Message-ID: <20090616074129.EE5AFDF4E@mail.python.org> Author: tarek.ziade Date: Tue Jun 16 09:41:29 2009 New Revision: 73442 Log: Merged revisions 73441 via svnmerge from svn+ssh://pythondev at svn.python.org/python/trunk ........ r73441 | tarek.ziade | 2009-06-16 09:29:52 +0200 (Tue, 16 Jun 2009) | 1 line Fixed #6287: documentation for the license field in distutils ........ Modified: python/branches/release26-maint/ (props changed) python/branches/release26-maint/Doc/distutils/setupscript.rst python/branches/release26-maint/Misc/NEWS Modified: python/branches/release26-maint/Doc/distutils/setupscript.rst ============================================================================== --- python/branches/release26-maint/Doc/distutils/setupscript.rst (original) +++ python/branches/release26-maint/Doc/distutils/setupscript.rst Tue Jun 16 09:41:29 2009 @@ -565,6 +565,8 @@ +----------------------+---------------------------+-----------------+--------+ | ``platforms`` | a list of platforms | list of strings | | +----------------------+---------------------------+-----------------+--------+ +| ``license`` | license for the package | short string | \(6) | ++----------------------+---------------------------+-----------------+--------+ Notes: @@ -582,6 +584,13 @@ versions prior to 2.2.3 or 2.3. The list is available from the `PyPI website `_. +(6) + The ``license`` field is a text indicating the license covering the + package where the license is not a selection from the "License" Trove + classifiers. See the ``Classifier`` field. Notice that + there's a ``licence`` distribution option which is deprecated but still + acts as an alias for ``license``. + 'short string' A single line of text, not more than 200 characters. Modified: python/branches/release26-maint/Misc/NEWS ============================================================================== --- python/branches/release26-maint/Misc/NEWS (original) +++ python/branches/release26-maint/Misc/NEWS Tue Jun 16 09:41:29 2009 @@ -242,6 +242,8 @@ Library ------- +- Issue #6287: Added the license field in Distutils documentation. + - Issue #6263: Fixed syntax error in distutils.cygwincompiler. - Issue #5201: distutils.sysconfig.parse_makefile() now understands `$$` From python-checkins at python.org Tue Jun 16 09:43:42 2009 From: python-checkins at python.org (tarek.ziade) Date: Tue, 16 Jun 2009 09:43:42 +0200 (CEST) Subject: [Python-checkins] r73443 - in python/branches/py3k: Doc/distutils/setupscript.rst Misc/NEWS Message-ID: <20090616074342.702A8DF56@mail.python.org> Author: tarek.ziade Date: Tue Jun 16 09:43:42 2009 New Revision: 73443 Log: Merged revisions 73441 via svnmerge from svn+ssh://pythondev at svn.python.org/python/trunk ........ r73441 | tarek.ziade | 2009-06-16 09:29:52 +0200 (Tue, 16 Jun 2009) | 1 line Fixed #6287: documentation for the license field in distutils ........ Modified: python/branches/py3k/ (props changed) python/branches/py3k/Doc/distutils/setupscript.rst python/branches/py3k/Misc/NEWS Modified: python/branches/py3k/Doc/distutils/setupscript.rst ============================================================================== --- python/branches/py3k/Doc/distutils/setupscript.rst (original) +++ python/branches/py3k/Doc/distutils/setupscript.rst Tue Jun 16 09:43:42 2009 @@ -589,6 +589,8 @@ +----------------------+---------------------------+-----------------+--------+ | ``platforms`` | a list of platforms | list of strings | | +----------------------+---------------------------+-----------------+--------+ +| ``license`` | license for the package | short string | \(6) | ++----------------------+---------------------------+-----------------+--------+ Notes: @@ -610,6 +612,13 @@ The ``long_description`` field is used by PyPI when you are registering a package, to build its home page. +(6) + The ``license`` field is a text indicating the license covering the + package where the license is not a selection from the "License" Trove + classifiers. See the ``Classifier`` field. Notice that + there's a ``licence`` distribution option which is deprecated but still + acts as an alias for ``license``. + 'short string' A single line of text, not more than 200 characters. Modified: python/branches/py3k/Misc/NEWS ============================================================================== --- python/branches/py3k/Misc/NEWS (original) +++ python/branches/py3k/Misc/NEWS Tue Jun 16 09:43:42 2009 @@ -800,6 +800,8 @@ Library ------- +- Issue #6287: Added the license field in Distutils documentation. + - Issue #6263: Fixed syntax error in distutils.cygwincompiler. - Issue #5201: distutils.sysconfig.parse_makefile() now understands `$$` From python-checkins at python.org Tue Jun 16 09:45:40 2009 From: python-checkins at python.org (tarek.ziade) Date: Tue, 16 Jun 2009 09:45:40 +0200 (CEST) Subject: [Python-checkins] r73444 - in python/branches/release30-maint: Doc/distutils/setupscript.rst Misc/NEWS Message-ID: <20090616074540.025E9DF56@mail.python.org> Author: tarek.ziade Date: Tue Jun 16 09:45:39 2009 New Revision: 73444 Log: Merged revisions 73443 via svnmerge from svn+ssh://pythondev at svn.python.org/python/branches/py3k ................ r73443 | tarek.ziade | 2009-06-16 09:43:42 +0200 (Tue, 16 Jun 2009) | 9 lines Merged revisions 73441 via svnmerge from svn+ssh://pythondev at svn.python.org/python/trunk ........ r73441 | tarek.ziade | 2009-06-16 09:29:52 +0200 (Tue, 16 Jun 2009) | 1 line Fixed #6287: documentation for the license field in distutils ........ ................ Modified: python/branches/release30-maint/ (props changed) python/branches/release30-maint/Doc/distutils/setupscript.rst python/branches/release30-maint/Misc/NEWS Modified: python/branches/release30-maint/Doc/distutils/setupscript.rst ============================================================================== --- python/branches/release30-maint/Doc/distutils/setupscript.rst (original) +++ python/branches/release30-maint/Doc/distutils/setupscript.rst Tue Jun 16 09:45:39 2009 @@ -563,6 +563,8 @@ +----------------------+---------------------------+-----------------+--------+ | ``platforms`` | a list of platforms | list of strings | | +----------------------+---------------------------+-----------------+--------+ +| ``license`` | license for the package | short string | \(6) | ++----------------------+---------------------------+-----------------+--------+ Notes: @@ -580,6 +582,13 @@ versions prior to 2.2.3 or 2.3. The list is available from the `PyPI website `_. +(6) + The ``license`` field is a text indicating the license covering the + package where the license is not a selection from the "License" Trove + classifiers. See the ``Classifier`` field. Notice that + there's a ``licence`` distribution option which is deprecated but still + acts as an alias for ``license``. + 'short string' A single line of text, not more than 200 characters. Modified: python/branches/release30-maint/Misc/NEWS ============================================================================== --- python/branches/release30-maint/Misc/NEWS (original) +++ python/branches/release30-maint/Misc/NEWS Tue Jun 16 09:45:39 2009 @@ -330,6 +330,8 @@ Library ------- +- Issue #6287: Added the license field in Distutils documentation. + - Issue #6263: Fixed syntax error in distutils.cygwincompiler. - Issue #5201: distutils.sysconfig.parse_makefile() now understands `$$` From buildbot at python.org Tue Jun 16 10:30:36 2009 From: buildbot at python.org (buildbot at python.org) Date: Tue, 16 Jun 2009 08:30:36 +0000 Subject: [Python-checkins] buildbot failure in amd64 gentoo 3.x Message-ID: <20090616083036.48C6DE0B0@mail.python.org> The Buildbot has detected a new failure of amd64 gentoo 3.x. Full details are available at: http://www.python.org/dev/buildbot/all/amd64%20gentoo%203.x/builds/815 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: norwitz-amd64 Build Reason: Build Source Stamp: [branch branches/py3k] HEAD Blamelist: tarek.ziade BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_mailbox make: *** [buildbottest] Error 1 sincerely, -The Buildbot From python-checkins at python.org Tue Jun 16 10:31:01 2009 From: python-checkins at python.org (tarek.ziade) Date: Tue, 16 Jun 2009 10:31:01 +0200 (CEST) Subject: [Python-checkins] r73445 - in python/trunk/Lib/distutils: ccompiler.py tests/test_ccompiler.py Message-ID: <20090616083101.A3655E0B0@mail.python.org> Author: tarek.ziade Date: Tue Jun 16 10:31:01 2009 New Revision: 73445 Log: starting distutils.ccompiler test coverage and cleanup Added: python/trunk/Lib/distutils/tests/test_ccompiler.py (contents, props changed) Modified: python/trunk/Lib/distutils/ccompiler.py Modified: python/trunk/Lib/distutils/ccompiler.py ============================================================================== --- python/trunk/Lib/distutils/ccompiler.py (original) +++ python/trunk/Lib/distutils/ccompiler.py Tue Jun 16 10:31:01 2009 @@ -1217,27 +1217,27 @@ return pp_opts -# gen_preprocess_options () - -def gen_lib_options (compiler, library_dirs, runtime_library_dirs, libraries): +def gen_lib_options(compiler, library_dirs, runtime_library_dirs, libraries): """Generate linker options for searching library directories and - linking with specific libraries. 'libraries' and 'library_dirs' are, - respectively, lists of library names (not filenames!) and search - directories. Returns a list of command-line options suitable for use - with some compiler (depending on the two format strings passed in). + linking with specific libraries. + + 'libraries' and 'library_dirs' are, respectively, lists of library names + (not filenames!) and search directories. Returns a list of command-line + options suitable for use with some compiler (depending on the two format + strings passed in). """ lib_opts = [] for dir in library_dirs: - lib_opts.append (compiler.library_dir_option (dir)) + lib_opts.append(compiler.library_dir_option(dir)) for dir in runtime_library_dirs: - opt = compiler.runtime_library_dir_option (dir) - if type(opt) is ListType: - lib_opts = lib_opts + opt + opt = compiler.runtime_library_dir_option(dir) + if isinstance(opt, list): + lib_opts.extend(opt) else: - lib_opts.append (opt) + lib_opts.append(opt) # XXX it's important that we *not* remove redundant library mentions! # sometimes you really do have to say "-lfoo -lbar -lfoo" in order to @@ -1246,17 +1246,15 @@ # pretty nasty way to arrange your C code. for lib in libraries: - (lib_dir, lib_name) = os.path.split (lib) - if lib_dir: - lib_file = compiler.find_library_file ([lib_dir], lib_name) - if lib_file: - lib_opts.append (lib_file) + lib_dir, lib_name = os.path.split(lib) + if lib_dir != '': + lib_file = compiler.find_library_file([lib_dir], lib_name) + if lib_file is not None: + lib_opts.append(lib_file) else: - compiler.warn ("no library file corresponding to " - "'%s' found (skipping)" % lib) + compiler.warn("no library file corresponding to " + "'%s' found (skipping)" % lib) else: - lib_opts.append (compiler.library_option (lib)) + lib_opts.append(compiler.library_option(lib)) return lib_opts - -# gen_lib_options () Added: python/trunk/Lib/distutils/tests/test_ccompiler.py ============================================================================== --- (empty file) +++ python/trunk/Lib/distutils/tests/test_ccompiler.py Tue Jun 16 10:31:01 2009 @@ -0,0 +1,37 @@ +"""Tests for distutils.ccompiler.""" +import os +import unittest + +from distutils.ccompiler import gen_lib_options + +class FakeCompiler(object): + def library_dir_option(self, dir): + return "-L" + dir + + def runtime_library_dir_option(self, dir): + return ["-cool", "-R" + dir] + + def find_library_file(self, dirs, lib, debug=0): + return 'found' + + def library_option(self, lib): + return "-l" + lib + +class CCompilerTestCase(unittest.TestCase): + + def test_gen_lib_options(self): + compiler = FakeCompiler() + libdirs = ['lib1', 'lib2'] + runlibdirs = ['runlib1'] + libs = [os.path.join('dir', 'name'), 'name2'] + + opts = gen_lib_options(compiler, libdirs, runlibdirs, libs) + wanted = ['-Llib1', '-Llib2', '-cool', '-Rrunlib1', 'found', + '-lname2'] + self.assertEquals(opts, wanted) + +def test_suite(): + return unittest.makeSuite(CCompilerTestCase) + +if __name__ == "__main__": + unittest.main(defaultTest="test_suite") From python-checkins at python.org Tue Jun 16 10:31:31 2009 From: python-checkins at python.org (tarek.ziade) Date: Tue, 16 Jun 2009 10:31:31 +0200 (CEST) Subject: [Python-checkins] r73446 - python/branches/release26-maint Message-ID: <20090616083131.EA3F1DB6B@mail.python.org> Author: tarek.ziade Date: Tue Jun 16 10:31:31 2009 New Revision: 73446 Log: Blocked revisions 73445 via svnmerge ........ r73445 | tarek.ziade | 2009-06-16 10:31:01 +0200 (Tue, 16 Jun 2009) | 1 line starting distutils.ccompiler test coverage and cleanup ........ Modified: python/branches/release26-maint/ (props changed) From python-checkins at python.org Tue Jun 16 19:41:38 2009 From: python-checkins at python.org (georg.brandl) Date: Tue, 16 Jun 2009 17:41:38 -0000 Subject: [Python-checkins] r73447 - python/trunk/Doc/library/ttk.rst Message-ID: Author: georg.brandl Date: Tue Jun 16 19:41:33 2009 New Revision: 73447 Log: Add tabularcolumns directive for tables with bullet lists in them. Modified: python/trunk/Doc/library/ttk.rst Modified: python/trunk/Doc/library/ttk.rst ============================================================================== --- python/trunk/Doc/library/ttk.rst (original) +++ python/trunk/Doc/library/ttk.rst Tue Jun 16 19:41:33 2009 @@ -160,6 +160,9 @@ The following options are supported by labels, buttons and other button-like widgets. +.. tabularcolumns:: |p{0.2\textwidth}|p{0.7\textwidth}| +.. + +--------------+-----------------------------------------------------------+ | option | description | +==============+===========================================================+ @@ -701,6 +704,9 @@ This widget accepts the following specific options: +.. tabularcolumns:: |p{0.2\textwidth}|p{0.7\textwidth}| +.. + +----------------+--------------------------------------------------------+ | option | description | +================+========================================================+ From python-checkins at python.org Tue Jun 16 19:43:44 2009 From: python-checkins at python.org (georg.brandl) Date: Tue, 16 Jun 2009 17:43:44 -0000 Subject: [Python-checkins] r73448 - python/trunk/Objects/exceptions.c Message-ID: Author: georg.brandl Date: Tue Jun 16 19:43:44 2009 New Revision: 73448 Log: Remove unused macro. Modified: python/trunk/Objects/exceptions.c Modified: python/trunk/Objects/exceptions.c ============================================================================== --- python/trunk/Objects/exceptions.c (original) +++ python/trunk/Objects/exceptions.c Tue Jun 16 19:43:44 2009 @@ -9,7 +9,6 @@ #include "structmember.h" #include "osdefs.h" -#define MAKE_IT_NONE(x) (x) = Py_None; Py_INCREF(Py_None); #define EXC_MODULE_NAME "exceptions." /* NOTE: If the exception class hierarchy changes, don't forget to update From python-checkins at python.org Tue Jun 16 21:22:10 2009 From: python-checkins at python.org (georg.brandl) Date: Tue, 16 Jun 2009 19:22:10 -0000 Subject: [Python-checkins] r73449 - python/branches/py3k/Doc/tutorial/datastructures.rst Message-ID: Author: georg.brandl Date: Tue Jun 16 21:22:10 2009 New Revision: 73449 Log: Expand a bit on dict views. Modified: python/branches/py3k/Doc/tutorial/datastructures.rst Modified: python/branches/py3k/Doc/tutorial/datastructures.rst ============================================================================== --- python/branches/py3k/Doc/tutorial/datastructures.rst (original) +++ python/branches/py3k/Doc/tutorial/datastructures.rst Tue Jun 16 21:22:10 2009 @@ -154,6 +154,8 @@ ['Michael', 'Terry', 'Graham'] +.. _tut-listcomps: + List Comprehensions ------------------- @@ -401,7 +403,7 @@ >>> a ^ b # letters in a or b but not both {'r', 'd', 'b', 'm', 'z', 'l'} -Like for lists, there is a set comprehension syntax:: +Like :ref:`for lists `, there is a set comprehension syntax:: >>> a = {x for x in 'abracadabra' if x not in 'abc'} >>> a @@ -438,9 +440,9 @@ using a non-existent key. Performing ``list(d.keys())`` on a dictionary returns a list of all the keys -used in the dictionary, in arbitrary order (if you want it sorted, just apply -the :meth:`sorted` function instead). To check whether a single key is -in the dictionary, use the :keyword:`in` keyword. +used in the dictionary, in arbitrary order (if you want it sorted, just use +``sorted(d.keys())`` instead). [1]_ To check whether a single key is in the +dictionary, use the :keyword:`in` keyword. Here is a small example using a dictionary:: @@ -463,9 +465,8 @@ >>> 'jack' not in tel False -The :func:`dict` constructor builds dictionaries directly from lists of -key-value pairs stored as tuples. When the pairs form a pattern, list -comprehensions can compactly specify the key-value list. :: +The :func:`dict` constructor builds dictionaries directly from sequences of +key-value pairs stored as tuples. :: >>> dict([('sape', 4139), ('guido', 4127), ('jack', 4098)]) {'sape': 4139, 'jack': 4098, 'guido': 4127} @@ -483,7 +484,6 @@ {'sape': 4139, 'jack': 4098, 'guido': 4127} -.. XXX Find out the right way to do these DUBOIS .. _tut-loopidioms: Looping Techniques @@ -604,9 +604,9 @@ the same type, the lexicographical comparison is carried out recursively. If all items of two sequences compare equal, the sequences are considered equal. If one sequence is an initial sub-sequence of the other, the shorter sequence is -the smaller (lesser) one. Lexicographical ordering for strings uses the ASCII -ordering for individual characters. Some examples of comparisons between -sequences of the same type:: +the smaller (lesser) one. Lexicographical ordering for strings uses the Unicode +codepoint number to order individual characters. Some examples of comparisons +between sequences of the same type:: (1, 2, 3) < (1, 2, 4) [1, 2, 3] < [1, 2, 4] @@ -621,3 +621,10 @@ mixed numeric types are compared according to their numeric value, so 0 equals 0.0, etc. Otherwise, rather than providing an arbitrary ordering, the interpreter will raise a :exc:`TypeError` exception. + + +.. rubric:: Footnotes + +.. [1] Calling ``d.keys()`` will return a :dfn:`dictionary view` object. It + supports operations like membership test and iteration, but its contents + are not independent of the original dictionary -- it is only a *view*. From python-checkins at python.org Tue Jun 16 21:24:38 2009 From: python-checkins at python.org (georg.brandl) Date: Tue, 16 Jun 2009 19:24:38 -0000 Subject: [Python-checkins] r73450 - in python/branches/py3k: Doc/library/tkinter.ttk.rst Objects/exceptions.c Message-ID: Author: georg.brandl Date: Tue Jun 16 21:24:38 2009 New Revision: 73450 Log: Merged revisions 73447-73448 via svnmerge from svn+ssh://pythondev at svn.python.org/python/trunk ........ r73447 | georg.brandl | 2009-06-16 19:41:33 +0200 (Di, 16 Jun 2009) | 1 line Add tabularcolumns directive for tables with bullet lists in them. ........ r73448 | georg.brandl | 2009-06-16 19:43:44 +0200 (Di, 16 Jun 2009) | 1 line Remove unused macro. ........ Modified: python/branches/py3k/ (props changed) python/branches/py3k/Doc/library/tkinter.ttk.rst python/branches/py3k/Objects/exceptions.c Modified: python/branches/py3k/Doc/library/tkinter.ttk.rst ============================================================================== --- python/branches/py3k/Doc/library/tkinter.ttk.rst (original) +++ python/branches/py3k/Doc/library/tkinter.ttk.rst Tue Jun 16 21:24:38 2009 @@ -157,6 +157,9 @@ The following options are supported by labels, buttons and other button-like widgets. +.. tabularcolumns:: |p{0.2\textwidth}|p{0.7\textwidth}| +.. + +--------------+-----------------------------------------------------------+ | option | description | +==============+===========================================================+ @@ -697,6 +700,9 @@ This widget accepts the following specific options: +.. tabularcolumns:: |p{0.2\textwidth}|p{0.7\textwidth}| +.. + +----------------+--------------------------------------------------------+ | option | description | +================+========================================================+ Modified: python/branches/py3k/Objects/exceptions.c ============================================================================== --- python/branches/py3k/Objects/exceptions.c (original) +++ python/branches/py3k/Objects/exceptions.c Tue Jun 16 21:24:38 2009 @@ -9,7 +9,6 @@ #include "structmember.h" #include "osdefs.h" -#define MAKE_IT_NONE(x) (x) = Py_None; Py_INCREF(Py_None); /* NOTE: If the exception class hierarchy changes, don't forget to update * Lib/test/exception_hierarchy.txt From buildbot at python.org Tue Jun 16 21:54:02 2009 From: buildbot at python.org (buildbot at python.org) Date: Tue, 16 Jun 2009 19:54:02 +0000 Subject: [Python-checkins] buildbot failure in x86 osx.5 3.x Message-ID: The Buildbot has detected a new failure of x86 osx.5 3.x. Full details are available at: http://www.python.org/dev/buildbot/all/x86%20osx.5%203.x/builds/1038 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: heller-x86-osx5 Build Reason: Build Source Stamp: [branch branches/py3k] HEAD Blamelist: georg.brandl BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_codecencodings_hk make: *** [buildbottest] Error 1 sincerely, -The Buildbot From buildbot at python.org Tue Jun 16 22:12:42 2009 From: buildbot at python.org (buildbot at python.org) Date: Tue, 16 Jun 2009 20:12:42 +0000 Subject: [Python-checkins] buildbot failure in sparc solaris10 gcc 3.x Message-ID: The Buildbot has detected a new failure of sparc solaris10 gcc 3.x. Full details are available at: http://www.python.org/dev/buildbot/all/sparc%20solaris10%20gcc%203.x/builds/831 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: loewis-sun Build Reason: Build Source Stamp: [branch branches/py3k] HEAD Blamelist: georg.brandl BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_posix ====================================================================== ERROR: test_getcwd_long_pathnames (test.test_posix.PosixTester) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home2/buildbot/slave/3.x.loewis-sun/build/Lib/test/test_posix.py", line 251, in test_getcwd_long_pathnames support.rmtree(base_path) File "/home2/buildbot/slave/3.x.loewis-sun/build/Lib/test/support.py", line 181, in rmtree shutil.rmtree(path) File "/home2/buildbot/slave/3.x.loewis-sun/build/Lib/shutil.py", line 239, in rmtree onerror(os.rmdir, path, sys.exc_info()) File "/home2/buildbot/slave/3.x.loewis-sun/build/Lib/shutil.py", line 237, in rmtree os.rmdir(path) OSError: [Errno 22] Invalid argument: '/home2/buildbot/slave/3.x.loewis-sun/build/@test.getcwd/@test.getcwd' sincerely, -The Buildbot From python-checkins at python.org Tue Jun 16 22:31:12 2009 From: python-checkins at python.org (mark.dickinson) Date: Tue, 16 Jun 2009 20:31:12 -0000 Subject: [Python-checkins] r73451 - python/trunk/Lib/test/cmath_testcases.txt Message-ID: Author: mark.dickinson Date: Tue Jun 16 22:31:12 2009 New Revision: 73451 Log: Acknowledge the role of the MPFR library in creating cmath_testcases.txt Modified: python/trunk/Lib/test/cmath_testcases.txt Modified: python/trunk/Lib/test/cmath_testcases.txt ============================================================================== --- python/trunk/Lib/test/cmath_testcases.txt (original) +++ python/trunk/Lib/test/cmath_testcases.txt Tue Jun 16 22:31:12 2009 @@ -43,6 +43,16 @@ -- ignored. Blank lines, or lines containing only whitespace, are also -- ignored. +-- The majority of the values below were computed with the help of +-- version 2.3 of the MPFR library for multiple-precision +-- floating-point computations with correct rounding. All output +-- values in this file are (modulo yet-to-be-discovered bugs) +-- correctly rounded, provided that each input and output decimal +-- floating-point value below is interpreted as a representation of +-- the corresponding nearest IEEE 754 double-precision value. See the +-- MPFR homepage at http://www.mpfr.org for more information about the +-- MPFR project. + -------------------------- -- acos: Inverse cosine -- From python-checkins at python.org Tue Jun 16 22:42:58 2009 From: python-checkins at python.org (mark.dickinson) Date: Tue, 16 Jun 2009 20:42:58 -0000 Subject: [Python-checkins] r73452 - in python/branches/release26-maint: Lib/test/cmath_testcases.txt Message-ID: Author: mark.dickinson Date: Tue Jun 16 22:42:57 2009 New Revision: 73452 Log: Merged revisions 73451 via svnmerge from svn+ssh://pythondev at svn.python.org/python/trunk ........ r73451 | mark.dickinson | 2009-06-16 21:31:12 +0100 (Tue, 16 Jun 2009) | 1 line Acknowledge the role of the MPFR library in creating cmath_testcases.txt ........ Modified: python/branches/release26-maint/ (props changed) python/branches/release26-maint/Lib/test/cmath_testcases.txt Modified: python/branches/release26-maint/Lib/test/cmath_testcases.txt ============================================================================== --- python/branches/release26-maint/Lib/test/cmath_testcases.txt (original) +++ python/branches/release26-maint/Lib/test/cmath_testcases.txt Tue Jun 16 22:42:57 2009 @@ -43,6 +43,16 @@ -- ignored. Blank lines, or lines containing only whitespace, are also -- ignored. +-- The majority of the values below were computed with the help of +-- version 2.3 of the MPFR library for multiple-precision +-- floating-point computations with correct rounding. All output +-- values in this file are (modulo yet-to-be-discovered bugs) +-- correctly rounded, provided that each input and output decimal +-- floating-point value below is interpreted as a representation of +-- the corresponding nearest IEEE 754 double-precision value. See the +-- MPFR homepage at http://www.mpfr.org for more information about the +-- MPFR project. + -------------------------- -- acos: Inverse cosine -- From python-checkins at python.org Tue Jun 16 22:49:30 2009 From: python-checkins at python.org (raymond.hettinger) Date: Tue, 16 Jun 2009 20:49:30 -0000 Subject: [Python-checkins] r73453 - python/branches/py3k/Doc/tutorial/datastructures.rst Message-ID: Author: raymond.hettinger Date: Tue Jun 16 22:49:30 2009 New Revision: 73453 Log: The key-value pairs can be lists or tuples or any iterable. Modified: python/branches/py3k/Doc/tutorial/datastructures.rst Modified: python/branches/py3k/Doc/tutorial/datastructures.rst ============================================================================== --- python/branches/py3k/Doc/tutorial/datastructures.rst (original) +++ python/branches/py3k/Doc/tutorial/datastructures.rst Tue Jun 16 22:49:30 2009 @@ -466,7 +466,7 @@ False The :func:`dict` constructor builds dictionaries directly from sequences of -key-value pairs stored as tuples. :: +key-value pairs:: >>> dict([('sape', 4139), ('guido', 4127), ('jack', 4098)]) {'sape': 4139, 'jack': 4098, 'guido': 4127} From python-checkins at python.org Tue Jun 16 22:54:33 2009 From: python-checkins at python.org (mark.dickinson) Date: Tue, 16 Jun 2009 20:54:33 -0000 Subject: [Python-checkins] r73454 - in python/branches/py3k: Lib/test/cmath_testcases.txt Message-ID: Author: mark.dickinson Date: Tue Jun 16 22:54:33 2009 New Revision: 73454 Log: Merged revisions 73451 via svnmerge from svn+ssh://pythondev at svn.python.org/python/trunk ........ r73451 | mark.dickinson | 2009-06-16 21:31:12 +0100 (Tue, 16 Jun 2009) | 1 line Acknowledge the role of the MPFR library in creating cmath_testcases.txt ........ Modified: python/branches/py3k/ (props changed) python/branches/py3k/Lib/test/cmath_testcases.txt Modified: python/branches/py3k/Lib/test/cmath_testcases.txt ============================================================================== --- python/branches/py3k/Lib/test/cmath_testcases.txt (original) +++ python/branches/py3k/Lib/test/cmath_testcases.txt Tue Jun 16 22:54:33 2009 @@ -43,6 +43,16 @@ -- ignored. Blank lines, or lines containing only whitespace, are also -- ignored. +-- The majority of the values below were computed with the help of +-- version 2.3 of the MPFR library for multiple-precision +-- floating-point computations with correct rounding. All output +-- values in this file are (modulo yet-to-be-discovered bugs) +-- correctly rounded, provided that each input and output decimal +-- floating-point value below is interpreted as a representation of +-- the corresponding nearest IEEE 754 double-precision value. See the +-- MPFR homepage at http://www.mpfr.org for more information about the +-- MPFR project. + -------------------------- -- acos: Inverse cosine -- From python-checkins at python.org Tue Jun 16 22:56:49 2009 From: python-checkins at python.org (mark.dickinson) Date: Tue, 16 Jun 2009 20:56:49 -0000 Subject: [Python-checkins] r73455 - in python/branches/release30-maint: Lib/test/cmath_testcases.txt Message-ID: Author: mark.dickinson Date: Tue Jun 16 22:56:48 2009 New Revision: 73455 Log: Merged revisions 73454 via svnmerge from svn+ssh://pythondev at svn.python.org/python/branches/py3k ................ r73454 | mark.dickinson | 2009-06-16 21:54:33 +0100 (Tue, 16 Jun 2009) | 9 lines Merged revisions 73451 via svnmerge from svn+ssh://pythondev at svn.python.org/python/trunk ........ r73451 | mark.dickinson | 2009-06-16 21:31:12 +0100 (Tue, 16 Jun 2009) | 1 line Acknowledge the role of the MPFR library in creating cmath_testcases.txt ........ ................ Modified: python/branches/release30-maint/ (props changed) python/branches/release30-maint/Lib/test/cmath_testcases.txt Modified: python/branches/release30-maint/Lib/test/cmath_testcases.txt ============================================================================== --- python/branches/release30-maint/Lib/test/cmath_testcases.txt (original) +++ python/branches/release30-maint/Lib/test/cmath_testcases.txt Tue Jun 16 22:56:48 2009 @@ -43,6 +43,16 @@ -- ignored. Blank lines, or lines containing only whitespace, are also -- ignored. +-- The majority of the values below were computed with the help of +-- version 2.3 of the MPFR library for multiple-precision +-- floating-point computations with correct rounding. All output +-- values in this file are (modulo yet-to-be-discovered bugs) +-- correctly rounded, provided that each input and output decimal +-- floating-point value below is interpreted as a representation of +-- the corresponding nearest IEEE 754 double-precision value. See the +-- MPFR homepage at http://www.mpfr.org for more information about the +-- MPFR project. + -------------------------- -- acos: Inverse cosine -- From buildbot at python.org Tue Jun 16 22:56:56 2009 From: buildbot at python.org (buildbot at python.org) Date: Tue, 16 Jun 2009 20:56:56 +0000 Subject: [Python-checkins] buildbot failure in OS X x86 trunk Message-ID: The Buildbot has detected a new failure of OS X x86 trunk. Full details are available at: http://www.python.org/dev/buildbot/all/OS%20X%20x86%20trunk/builds/705 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: noller-osx86 Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: mark.dickinson BUILD FAILED: failed test Excerpt from the test logfile: Traceback (most recent call last): File "/Users/buildbot/buildarea/trunk.noller-osx86/build/Lib/threading.py", line 524, in __bootstrap_inner self.run() File "/Users/buildbot/buildarea/trunk.noller-osx86/build/Lib/threading.py", line 477, in run self.__target(*self.__args, **self.__kwargs) File "/Users/buildbot/buildarea/trunk.noller-osx86/build/Lib/bsddb/test/test_thread.py", line 306, in readerThread rec = dbutils.DeadlockWrap(c.next, max_retries=10) File "/Users/buildbot/buildarea/trunk.noller-osx86/build/Lib/bsddb/dbutils.py", line 68, in DeadlockWrap return function(*_args, **_kwargs) DBLockDeadlockError: (-30995, 'DB_LOCK_DEADLOCK: Locker killed to resolve a deadlock') make: *** [buildbottest] Abort trap sincerely, -The Buildbot From buildbot at python.org Tue Jun 16 23:57:18 2009 From: buildbot at python.org (buildbot at python.org) Date: Tue, 16 Jun 2009 21:57:18 +0000 Subject: [Python-checkins] buildbot failure in x86 XP-4 3.x Message-ID: The Buildbot has detected a new failure of x86 XP-4 3.x. Full details are available at: http://www.python.org/dev/buildbot/all/x86%20XP-4%203.x/builds/697 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: bolen-windows Build Reason: Build Source Stamp: [branch branches/py3k] HEAD Blamelist: georg.brandl BUILD FAILED: failed test Excerpt from the test logfile: Traceback (most recent call last): File "E:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\test\test_import.py", line 62, in test_with_extension self.fail("import from %s failed: %s" % (ext, err)) File "E:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\unittest.py", line 540, in fail raise self.failureException(msg) AssertionError: import from .PY failed: No module named @test Traceback (most recent call last): File "E:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\test\test_import.py", line 79, in testImport test_with_extension(ext) File "E:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\test\test_import.py", line 72, in test_with_extension del sys.modules[TESTFN] KeyError: '@test' 1 test failed: test_import ====================================================================== ERROR: testImport (test.test_import.ImportTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "E:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\test\test_import.py", line 60, in test_with_extension mod = __import__(TESTFN) ImportError: No module named @test Traceback (most recent call last): File "E:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\test\test_import.py", line 62, in test_with_extension self.fail("import from %s failed: %s" % (ext, err)) File "E:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\unittest.py", line 540, in fail raise self.failureException(msg) AssertionError: import from .PY failed: No module named @test Traceback (most recent call last): File "E:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\test\test_import.py", line 79, in testImport test_with_extension(ext) File "E:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\test\test_import.py", line 72, in test_with_extension del sys.modules[TESTFN] KeyError: '@test' Traceback (most recent call last): File "E:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\test\test_import.py", line 62, in test_with_extension self.fail("import from %s failed: %s" % (ext, err)) File "E:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\unittest.py", line 540, in fail raise self.failureException(msg) AssertionError: import from .PY failed: No module named @test Traceback (most recent call last): File "E:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\test\test_import.py", line 79, in testImport test_with_extension(ext) File "E:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\test\test_import.py", line 72, in test_with_extension del sys.modules[TESTFN] KeyError: '@test' sincerely, -The Buildbot From python-checkins at python.org Wed Jun 17 01:09:24 2009 From: python-checkins at python.org (benjamin.peterson) Date: Tue, 16 Jun 2009 23:09:24 -0000 Subject: [Python-checkins] r73456 - python/branches/py3k/Doc/library/io.rst Message-ID: Author: benjamin.peterson Date: Wed Jun 17 01:09:24 2009 New Revision: 73456 Log: rephrase for clarity Modified: python/branches/py3k/Doc/library/io.rst Modified: python/branches/py3k/Doc/library/io.rst ============================================================================== --- python/branches/py3k/Doc/library/io.rst (original) +++ python/branches/py3k/Doc/library/io.rst Wed Jun 17 01:09:24 2009 @@ -504,7 +504,7 @@ .. method:: peek([n]) - Return bytes from the stream without advancing the position. Only a + Return bytes from the stream without advancing the position. At most one single read on the raw stream is done to satisfy the call. The number of bytes returned may be less or more than requested. From python-checkins at python.org Wed Jun 17 01:13:09 2009 From: python-checkins at python.org (benjamin.peterson) Date: Tue, 16 Jun 2009 23:13:09 -0000 Subject: [Python-checkins] r73457 - python/trunk/Objects/floatobject.c Message-ID: Author: benjamin.peterson Date: Wed Jun 17 01:13:09 2009 New Revision: 73457 Log: add underscores Modified: python/trunk/Objects/floatobject.c Modified: python/trunk/Objects/floatobject.c ============================================================================== --- python/trunk/Objects/floatobject.c (original) +++ python/trunk/Objects/floatobject.c Wed Jun 17 01:13:09 2009 @@ -72,7 +72,7 @@ static PyTypeObject FloatInfoType = {0, 0, 0, 0, 0, 0}; PyDoc_STRVAR(floatinfo__doc__, -"sys.floatinfo\n\ +"sys.float_info\n\ \n\ A structseq holding information about the float type. It contains low level\n\ information about the precision and internal representation. Please study\n\ @@ -99,7 +99,7 @@ }; static PyStructSequence_Desc floatinfo_desc = { - "sys.floatinfo", /* name */ + "sys.float_info", /* name */ floatinfo__doc__, /* doc */ floatinfo_fields, /* fields */ 11 From buildbot at python.org Wed Jun 17 02:03:57 2009 From: buildbot at python.org (buildbot at python.org) Date: Wed, 17 Jun 2009 00:03:57 +0000 Subject: [Python-checkins] buildbot failure in sparc solaris10 gcc 3.0 Message-ID: The Buildbot has detected a new failure of sparc solaris10 gcc 3.0. Full details are available at: http://www.python.org/dev/buildbot/all/sparc%20solaris10%20gcc%203.0/builds/411 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: loewis-sun Build Reason: Build Source Stamp: [branch branches/release30-maint] HEAD Blamelist: mark.dickinson BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_posix ====================================================================== ERROR: test_getcwd_long_pathnames (test.test_posix.PosixTester) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home2/buildbot/slave/3.0.loewis-sun/build/Lib/test/test_posix.py", line 252, in test_getcwd_long_pathnames support.rmtree(base_path) File "/home2/buildbot/slave/3.0.loewis-sun/build/Lib/test/support.py", line 98, in rmtree shutil.rmtree(path) File "/home2/buildbot/slave/3.0.loewis-sun/build/Lib/shutil.py", line 225, in rmtree onerror(os.rmdir, path, sys.exc_info()) File "/home2/buildbot/slave/3.0.loewis-sun/build/Lib/shutil.py", line 223, in rmtree os.rmdir(path) OSError: [Errno 22] Invalid argument: '/home2/buildbot/slave/3.0.loewis-sun/build/@test.getcwd/@test.getcwd' sincerely, -The Buildbot From python-checkins at python.org Wed Jun 17 03:40:53 2009 From: python-checkins at python.org (raymond.hettinger) Date: Wed, 17 Jun 2009 01:40:53 -0000 Subject: [Python-checkins] r73458 - python/branches/py3k/Doc/library/itertools.rst Message-ID: Author: raymond.hettinger Date: Wed Jun 17 03:40:52 2009 New Revision: 73458 Log: Add usage note. Modified: python/branches/py3k/Doc/library/itertools.rst Modified: python/branches/py3k/Doc/library/itertools.rst ============================================================================== --- python/branches/py3k/Doc/library/itertools.rst (original) +++ python/branches/py3k/Doc/library/itertools.rst Wed Jun 17 03:40:52 2009 @@ -235,6 +235,10 @@ yield n n += step + When counting with floating point numbers, better accuracy can sometimes be + achieved by substituting multiplicative code such as: ``(start + step * i + for i in count())``. + .. versionchanged:: 3.1 added *step* argument and allowed non-integer arguments. From python-checkins at python.org Wed Jun 17 03:43:48 2009 From: python-checkins at python.org (raymond.hettinger) Date: Wed, 17 Jun 2009 01:43:48 -0000 Subject: [Python-checkins] r73459 - python/trunk/Doc/library/itertools.rst Message-ID: Author: raymond.hettinger Date: Wed Jun 17 03:43:47 2009 New Revision: 73459 Log: Add usage note. Modified: python/trunk/Doc/library/itertools.rst Modified: python/trunk/Doc/library/itertools.rst ============================================================================== --- python/trunk/Doc/library/itertools.rst (original) +++ python/trunk/Doc/library/itertools.rst Wed Jun 17 03:43:47 2009 @@ -245,6 +245,10 @@ yield n n += step + When counting with floating point numbers, better accuracy can sometimes be + achieved by substituting multiplicative code such as: ``(start + step * i + for i in count())``. + .. versionchanged:: 2.7 added *step* argument and allowed non-integer arguments. From python-checkins at python.org Wed Jun 17 05:23:05 2009 From: python-checkins at python.org (benjamin.peterson) Date: Wed, 17 Jun 2009 03:23:05 -0000 Subject: [Python-checkins] r73460 - python/trunk/Python/compile.c Message-ID: Author: benjamin.peterson Date: Wed Jun 17 05:23:04 2009 New Revision: 73460 Log: remove unused 'encoding' member from the compiler struct Modified: python/trunk/Python/compile.c Modified: python/trunk/Python/compile.c ============================================================================== --- python/trunk/Python/compile.c (original) +++ python/trunk/Python/compile.c Wed Jun 17 05:23:04 2009 @@ -140,7 +140,6 @@ struct compiler_unit *u; /* compiler state for current block */ PyObject *c_stack; /* Python list holding compiler_unit ptrs */ - char *c_encoding; /* source encoding (a borrowed reference) */ PyArena *c_arena; /* pointer to memory allocation arena */ }; @@ -282,9 +281,6 @@ goto finally; } - /* XXX initialize to NULL for now, need to handle */ - c.c_encoding = NULL; - co = compiler_mod(&c, mod); finally: From buildbot at python.org Wed Jun 17 07:12:56 2009 From: buildbot at python.org (buildbot at python.org) Date: Wed, 17 Jun 2009 05:12:56 +0000 Subject: [Python-checkins] buildbot failure in x86 XP-4 trunk Message-ID: The Buildbot has detected a new failure of x86 XP-4 trunk. Full details are available at: http://www.python.org/dev/buildbot/all/x86%20XP-4%20trunk/builds/2255 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: bolen-windows Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: benjamin.peterson,raymond.hettinger BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_io ====================================================================== ERROR: test_seek_and_tell (test.test_io.CTextIOWrapperTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "E:\cygwin\home\db3l\buildarea\trunk.bolen-windows\build\lib\test\test_io.py", line 1883, in test_seek_and_tell test_seek_and_tell_with_data(input) File "E:\cygwin\home\db3l\buildarea\trunk.bolen-windows\build\lib\test\test_io.py", line 1861, in test_seek_and_tell_with_data f = self.open(support.TESTFN, encoding='test_decoder') File "E:\cygwin\home\db3l\buildarea\trunk.bolen-windows\build\lib\test\test_io.py", line 1394, in __init__ codecs.IncrementalDecoder.__init__(self, errors) AttributeError: 'NoneType' object has no attribute 'IncrementalDecoder' ====================================================================== ERROR: test_seek_and_tell (test.test_io.PyTextIOWrapperTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "E:\cygwin\home\db3l\buildarea\trunk.bolen-windows\build\lib\test\test_io.py", line 1883, in test_seek_and_tell test_seek_and_tell_with_data(input) File "E:\cygwin\home\db3l\buildarea\trunk.bolen-windows\build\lib\test\test_io.py", line 1863, in test_seek_and_tell_with_data decoded = f.read() File "E:\cygwin\home\db3l\buildarea\trunk.bolen-windows\build\lib\_pyio.py", line 1802, in read decoder = self._decoder or self._get_decoder() File "E:\cygwin\home\db3l\buildarea\trunk.bolen-windows\build\lib\_pyio.py", line 1568, in _get_decoder decoder = make_decoder(self._errors) File "E:\cygwin\home\db3l\buildarea\trunk.bolen-windows\build\lib\test\test_io.py", line 1394, in __init__ codecs.IncrementalDecoder.__init__(self, errors) AttributeError: 'NoneType' object has no attribute 'IncrementalDecoder' ====================================================================== FAIL: test_invalid_operations (test.test_io.CIOTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "E:\cygwin\home\db3l\buildarea\trunk.bolen-windows\build\lib\test\test_io.py", line 303, in test_invalid_operations self.assertRaises(IOError, fp.readline) AssertionError: IOError not raised ====================================================================== FAIL: test_invalid_operations (test.test_io.PyIOTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "E:\cygwin\home\db3l\buildarea\trunk.bolen-windows\build\lib\test\test_io.py", line 303, in test_invalid_operations self.assertRaises(IOError, fp.readline) AssertionError: IOError not raised sincerely, -The Buildbot From python-checkins at python.org Wed Jun 17 09:05:34 2009 From: python-checkins at python.org (hirokazu.yamamoto) Date: Wed, 17 Jun 2009 07:05:34 -0000 Subject: [Python-checkins] r73461 - python/trunk/Lib/test/test_io.py Message-ID: Author: hirokazu.yamamoto Date: Wed Jun 17 09:05:33 2009 New Revision: 73461 Log: Issue #6215: Fixed to use self.open() instead of open() or io.open(). Modified: python/trunk/Lib/test/test_io.py Modified: python/trunk/Lib/test/test_io.py ============================================================================== --- python/trunk/Lib/test/test_io.py (original) +++ python/trunk/Lib/test/test_io.py Wed Jun 17 09:05:33 2009 @@ -298,13 +298,13 @@ def test_invalid_operations(self): # Try writing on a file opened in read mode and vice-versa. for mode in ("w", "wb"): - with open(support.TESTFN, mode) as fp: + with self.open(support.TESTFN, mode) as fp: self.assertRaises(IOError, fp.read) self.assertRaises(IOError, fp.readline) - with open(support.TESTFN, "rb") as fp: + with self.open(support.TESTFN, "rb") as fp: self.assertRaises(IOError, fp.write, b"blah") self.assertRaises(IOError, fp.writelines, [b"blah\n"]) - with open(support.TESTFN, "r") as fp: + with self.open(support.TESTFN, "r") as fp: self.assertRaises(IOError, fp.write, "blah") self.assertRaises(IOError, fp.writelines, ["blah\n"]) @@ -375,12 +375,12 @@ def test_with_open(self): for bufsize in (0, 1, 100): f = None - with open(support.TESTFN, "wb", bufsize) as f: + with self.open(support.TESTFN, "wb", bufsize) as f: f.write(b"xxx") self.assertEqual(f.closed, True) f = None try: - with open(support.TESTFN, "wb", bufsize) as f: + with self.open(support.TESTFN, "wb", bufsize) as f: 1/0 except ZeroDivisionError: self.assertEqual(f.closed, True) @@ -420,7 +420,7 @@ del f support.gc_collect() self.assertEqual(record, [1, 2, 3]) - with open(support.TESTFN, "rb") as f: + with self.open(support.TESTFN, "rb") as f: self.assertEqual(f.read(), b"xxx") def _check_base_destructor(self, base): @@ -515,7 +515,7 @@ del f support.gc_collect() self.assert_(wr() is None, wr) - with open(support.TESTFN, "rb") as f: + with self.open(support.TESTFN, "rb") as f: self.assertEqual(f.read(), b"abcxxx") def test_unbounded_file(self): @@ -527,11 +527,11 @@ self.skipTest("test can only run in a 32-bit address space") if support.real_max_memuse < support._2G: self.skipTest("test requires at least 2GB of memory") - with open(zero, "rb", buffering=0) as f: + with self.open(zero, "rb", buffering=0) as f: self.assertRaises(OverflowError, f.read) - with open(zero, "rb") as f: + with self.open(zero, "rb") as f: self.assertRaises(OverflowError, f.read) - with open(zero, "r") as f: + with self.open(zero, "r") as f: self.assertRaises(OverflowError, f.read) class CIOTest(IOTest): @@ -744,9 +744,9 @@ l = list(range(256)) * N random.shuffle(l) s = bytes(bytearray(l)) - with io.open(support.TESTFN, "wb") as f: + with self.open(support.TESTFN, "wb") as f: f.write(s) - with io.open(support.TESTFN, self.read_mode, buffering=0) as raw: + with self.open(support.TESTFN, self.read_mode, buffering=0) as raw: bufio = self.tp(raw, 8) errors = [] results = [] @@ -974,12 +974,12 @@ def test_truncate(self): # Truncate implicitly flushes the buffer. - with io.open(support.TESTFN, self.write_mode, buffering=0) as raw: + with self.open(support.TESTFN, self.write_mode, buffering=0) as raw: bufio = self.tp(raw, 8) bufio.write(b"abcdef") self.assertEqual(bufio.truncate(3), 3) self.assertEqual(bufio.tell(), 3) - with io.open(support.TESTFN, "rb", buffering=0) as f: + with self.open(support.TESTFN, "rb", buffering=0) as f: self.assertEqual(f.read(), b"abc") def test_threads(self): @@ -1001,7 +1001,7 @@ # writing the buffer to the raw streams. This is in addition # to concurrency issues due to switching threads in the middle # of Python code. - with io.open(support.TESTFN, self.write_mode, buffering=0) as raw: + with self.open(support.TESTFN, self.write_mode, buffering=0) as raw: bufio = self.tp(raw, 8) errors = [] def f(): @@ -1024,7 +1024,7 @@ self.assertFalse(errors, "the following exceptions were caught: %r" % errors) bufio.close() - with io.open(support.TESTFN, "rb") as f: + with self.open(support.TESTFN, "rb") as f: s = f.read() for i in range(256): self.assertEquals(s.count(bytes([i])), N) @@ -1084,7 +1084,7 @@ del f support.gc_collect() self.assert_(wr() is None, wr) - with open(support.TESTFN, "rb") as f: + with self.open(support.TESTFN, "rb") as f: self.assertEqual(f.read(), b"123xxx") @@ -2065,7 +2065,7 @@ del t support.gc_collect() self.assert_(wr() is None, wr) - with open(support.TESTFN, "rb") as f: + with self.open(support.TESTFN, "rb") as f: self.assertEqual(f.read(), b"456def") class PyTextIOWrapperTest(TextIOWrapperTest): From buildbot at python.org Wed Jun 17 09:37:43 2009 From: buildbot at python.org (buildbot at python.org) Date: Wed, 17 Jun 2009 07:37:43 +0000 Subject: [Python-checkins] buildbot failure in amd64 gentoo trunk Message-ID: The Buildbot has detected a new failure of amd64 gentoo trunk. Full details are available at: http://www.python.org/dev/buildbot/all/amd64%20gentoo%20trunk/builds/188 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: norwitz-amd64 Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: hirokazu.yamamoto BUILD FAILED: failed test Excerpt from the test logfile: Traceback (most recent call last): File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/threading.py", line 524, in __bootstrap_inner self.run() File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/threading.py", line 477, in run self.__target(*self.__args, **self.__kwargs) File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/bsddb/test/test_thread.py", line 306, in readerThread rec = dbutils.DeadlockWrap(c.next, max_retries=10) File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/bsddb/dbutils.py", line 68, in DeadlockWrap return function(*_args, **_kwargs) DBLockDeadlockError: (-30995, 'DB_LOCK_DEADLOCK: Locker killed to resolve a deadlock') 1 test failed: test_mailbox ====================================================================== FAIL: test_has_key (test.test_mailbox.TestMaildir) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/test/test_mailbox.py", line 236, in test_has_key self._test_has_key_or_contains(self._box.has_key) File "/home/buildbot/slave/py-build/trunk.norwitz-amd64/build/Lib/test/test_mailbox.py", line 253, in _test_has_key_or_contains self.assert_(not method(key0)) AssertionError: False is not True make: *** [buildbottest] Error 1 sincerely, -The Buildbot From python-checkins at python.org Wed Jun 17 11:36:22 2009 From: python-checkins at python.org (georg.brandl) Date: Wed, 17 Jun 2009 09:36:22 -0000 Subject: [Python-checkins] r73462 - python/trunk/Doc/library/curses.rst Message-ID: Author: georg.brandl Date: Wed Jun 17 11:36:21 2009 New Revision: 73462 Log: #6295: clarify blocking behavior of getch(). Modified: python/trunk/Doc/library/curses.rst Modified: python/trunk/Doc/library/curses.rst ============================================================================== --- python/trunk/Doc/library/curses.rst (original) +++ python/trunk/Doc/library/curses.rst Wed Jun 17 11:36:21 2009 @@ -796,7 +796,8 @@ Get a character. Note that the integer returned does *not* have to be in ASCII range: function keys, keypad keys and so on return numbers higher than 256. In - no-delay mode, -1 is returned if there is no input. + no-delay mode, -1 is returned if there is no input, else :func:`getch` waits + until a key is pressed. .. method:: window.getkey([y, x]) From python-checkins at python.org Wed Jun 17 11:43:31 2009 From: python-checkins at python.org (georg.brandl) Date: Wed, 17 Jun 2009 09:43:31 -0000 Subject: [Python-checkins] r73463 - python/trunk/Doc/c-api/int.rst Message-ID: Author: georg.brandl Date: Wed Jun 17 11:43:31 2009 New Revision: 73463 Log: #6255: document PyInt_FromSize_t. Modified: python/trunk/Doc/c-api/int.rst Modified: python/trunk/Doc/c-api/int.rst ============================================================================== --- python/trunk/Doc/c-api/int.rst (original) +++ python/trunk/Doc/c-api/int.rst Wed Jun 17 11:43:31 2009 @@ -68,6 +68,15 @@ .. cfunction:: PyObject* PyInt_FromSsize_t(Py_ssize_t ival) + Create a new integer object with a value of *ival*. If the value is larger + than ``LONG_MAX`` or smaller than ``LONG_MIN``, a long integer object is + returned. + + .. versionadded:: 2.5 + + +.. cfunction:: PyObject* PyInt_FromSize_t(size_t ival) + Create a new integer object with a value of *ival*. If the value exceeds ``LONG_MAX``, a long integer object is returned. From python-checkins at python.org Wed Jun 17 12:03:59 2009 From: python-checkins at python.org (georg.brandl) Date: Wed, 17 Jun 2009 10:03:59 -0000 Subject: [Python-checkins] r73464 - in python/branches/py3k: Doc/library/curses.rst Message-ID: Author: georg.brandl Date: Wed Jun 17 12:03:58 2009 New Revision: 73464 Log: Merged revisions 73462-73463 via svnmerge from svn+ssh://pythondev at svn.python.org/python/trunk ........ r73462 | georg.brandl | 2009-06-17 11:36:21 +0200 (Mi, 17 Jun 2009) | 1 line #6295: clarify blocking behavior of getch(). ........ r73463 | georg.brandl | 2009-06-17 11:43:31 +0200 (Mi, 17 Jun 2009) | 1 line #6255: document PyInt_FromSize_t. ........ Modified: python/branches/py3k/ (props changed) python/branches/py3k/Doc/library/curses.rst Modified: python/branches/py3k/Doc/library/curses.rst ============================================================================== --- python/branches/py3k/Doc/library/curses.rst (original) +++ python/branches/py3k/Doc/library/curses.rst Wed Jun 17 12:03:58 2009 @@ -793,7 +793,8 @@ Get a character. Note that the integer returned does *not* have to be in ASCII range: function keys, keypad keys and so on return numbers higher than 256. In - no-delay mode, -1 is returned if there is no input. + no-delay mode, -1 is returned if there is no input, else :func:`getch` waits + until a key is pressed. .. method:: window.getkey([y, x]) From buildbot at python.org Wed Jun 17 12:28:51 2009 From: buildbot at python.org (buildbot at python.org) Date: Wed, 17 Jun 2009 10:28:51 +0000 Subject: [Python-checkins] buildbot failure in amd64 gentoo 3.x Message-ID: The Buildbot has detected a new failure of amd64 gentoo 3.x. Full details are available at: http://www.python.org/dev/buildbot/all/amd64%20gentoo%203.x/builds/818 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: norwitz-amd64 Build Reason: Build Source Stamp: [branch branches/py3k] HEAD Blamelist: benjamin.peterson,georg.brandl,raymond.hettinger BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_mailbox make: *** [buildbottest] Error 1 sincerely, -The Buildbot From buildbot at python.org Wed Jun 17 12:33:22 2009 From: buildbot at python.org (buildbot at python.org) Date: Wed, 17 Jun 2009 10:33:22 +0000 Subject: [Python-checkins] buildbot failure in x86 osx.5 3.x Message-ID: The Buildbot has detected a new failure of x86 osx.5 3.x. Full details are available at: http://www.python.org/dev/buildbot/all/x86%20osx.5%203.x/builds/1040 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: heller-x86-osx5 Build Reason: Build Source Stamp: [branch branches/py3k] HEAD Blamelist: benjamin.peterson,georg.brandl,raymond.hettinger BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_cprofile make: *** [buildbottest] Error 1 sincerely, -The Buildbot From buildbot at python.org Wed Jun 17 12:50:19 2009 From: buildbot at python.org (buildbot at python.org) Date: Wed, 17 Jun 2009 10:50:19 +0000 Subject: [Python-checkins] buildbot failure in sparc solaris10 gcc 3.x Message-ID: The Buildbot has detected a new failure of sparc solaris10 gcc 3.x. Full details are available at: http://www.python.org/dev/buildbot/all/sparc%20solaris10%20gcc%203.x/builds/833 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: loewis-sun Build Reason: Build Source Stamp: [branch branches/py3k] HEAD Blamelist: benjamin.peterson,georg.brandl,raymond.hettinger BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_posix ====================================================================== ERROR: test_getcwd_long_pathnames (test.test_posix.PosixTester) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home2/buildbot/slave/3.x.loewis-sun/build/Lib/test/test_posix.py", line 251, in test_getcwd_long_pathnames support.rmtree(base_path) File "/home2/buildbot/slave/3.x.loewis-sun/build/Lib/test/support.py", line 181, in rmtree shutil.rmtree(path) File "/home2/buildbot/slave/3.x.loewis-sun/build/Lib/shutil.py", line 239, in rmtree onerror(os.rmdir, path, sys.exc_info()) File "/home2/buildbot/slave/3.x.loewis-sun/build/Lib/shutil.py", line 237, in rmtree os.rmdir(path) OSError: [Errno 22] Invalid argument: '/home2/buildbot/slave/3.x.loewis-sun/build/@test.getcwd/@test.getcwd' sincerely, -The Buildbot From buildbot at python.org Wed Jun 17 13:22:50 2009 From: buildbot at python.org (buildbot at python.org) Date: Wed, 17 Jun 2009 11:22:50 +0000 Subject: [Python-checkins] buildbot failure in x86 XP-4 3.x Message-ID: The Buildbot has detected a new failure of x86 XP-4 3.x. Full details are available at: http://www.python.org/dev/buildbot/all/x86%20XP-4%203.x/builds/699 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: bolen-windows Build Reason: Build Source Stamp: [branch branches/py3k] HEAD Blamelist: benjamin.peterson,georg.brandl,raymond.hettinger BUILD FAILED: failed test Excerpt from the test logfile: Traceback (most recent call last): File "E:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\test\test_import.py", line 62, in test_with_extension self.fail("import from %s failed: %s" % (ext, err)) File "E:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\unittest.py", line 540, in fail raise self.failureException(msg) AssertionError: import from .PY failed: No module named @test Traceback (most recent call last): File "E:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\test\test_import.py", line 79, in testImport test_with_extension(ext) File "E:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\test\test_import.py", line 72, in test_with_extension del sys.modules[TESTFN] KeyError: '@test' 1 test failed: test_import sincerely, -The Buildbot From python-checkins at python.org Wed Jun 17 14:12:15 2009 From: python-checkins at python.org (nick.coghlan) Date: Wed, 17 Jun 2009 12:12:15 -0000 Subject: [Python-checkins] r73465 - python/trunk/Doc/library/contextlib.rst Message-ID: Author: nick.coghlan Date: Wed Jun 17 14:12:15 2009 New Revision: 73465 Log: Issue 6288: update the contextlib.nested() docs to explain why it has been deprecated and should generally be avoided Modified: python/trunk/Doc/library/contextlib.rst Modified: python/trunk/Doc/library/contextlib.rst ============================================================================== --- python/trunk/Doc/library/contextlib.rst (original) +++ python/trunk/Doc/library/contextlib.rst Wed Jun 17 14:12:15 2009 @@ -58,21 +58,18 @@ Combine multiple context managers into a single nested context manager. - Code like this:: + This function has been deprecated in favour of the multiple manager form + of the :keyword:`with` statement. + + The one advantage of this function over the multiple manager form of the + :keyword:`with` statement is that argument unpacking allows it to be + used with a variable number of context managers as follows:: from contextlib import nested - with nested(A(), B(), C()) as (X, Y, Z): + with nested(*managers): do_something() - is equivalent to this:: - - m1, m2, m3 = A(), B(), C() - with m1 as X: - with m2 as Y: - with m3 as Z: - do_something() - Note that if the :meth:`__exit__` method of one of the nested context managers indicates an exception should be suppressed, no exception information will be passed to any remaining outer context managers. Similarly, if the @@ -82,8 +79,28 @@ :meth:`__exit__` methods should avoid raising exceptions, and in particular they should not re-raise a passed-in exception. + This function has two major quirks that have led to it being deprecated. Firstly, + as the context managers are all constructed before the function is invoked, the + :meth:`__new__` and :meth:`__init__` methods of the inner context managers are + not actually covered by the scope of the outer context managers. That means, for + example, that using :func:`nested` to open two files is a programming error as the + first file will not be closed promptly if an exception is thrown when opening + the second file. + + Secondly, if the :meth:`__enter__` method of one of the inner context managers + raises an exception that is caught and suppressed by the :meth:`__exit__` method + of one of the outer context managers, this construct will raise + :exc:`RuntimeError` rather than skipping the body of the :keyword:`with` + statement. + + Developers that need to support nesting of a variable number of context managers + can either use the :mod:`warnings` module to suppress the DeprecationWarning + raised by this function or else use this function as a model for an application + specific implementation. + .. deprecated:: 2.7 - The with-statement now supports this functionality directly. + The with-statement now supports this functionality directly (without the + confusing error prone quirks). .. function:: closing(thing) From python-checkins at python.org Wed Jun 17 14:23:43 2009 From: python-checkins at python.org (nick.coghlan) Date: Wed, 17 Jun 2009 12:23:43 -0000 Subject: [Python-checkins] r73466 - in python/branches/py3k: Doc/library/contextlib.rst Message-ID: Author: nick.coghlan Date: Wed Jun 17 14:23:43 2009 New Revision: 73466 Log: Merged revisions 73465 via svnmerge from svn+ssh://pythondev at svn.python.org/python/trunk ........ r73465 | nick.coghlan | 2009-06-17 22:12:15 +1000 (Wed, 17 Jun 2009) | 1 line Issue 6288: update the contextlib.nested() docs to explain why it has been deprecated and should generally be avoided ........ Modified: python/branches/py3k/ (props changed) python/branches/py3k/Doc/library/contextlib.rst Modified: python/branches/py3k/Doc/library/contextlib.rst ============================================================================== --- python/branches/py3k/Doc/library/contextlib.rst (original) +++ python/branches/py3k/Doc/library/contextlib.rst Wed Jun 17 14:23:43 2009 @@ -56,21 +56,18 @@ Combine multiple context managers into a single nested context manager. - Code like this:: + This function has been deprecated in favour of the multiple manager form + of the :keyword:`with` statement. + + The one advantage of this function over the multiple manager form of the + :keyword:`with` statement is that argument unpacking allows it to be + used with a variable number of context managers as follows:: from contextlib import nested - with nested(A(), B(), C()) as (X, Y, Z): + with nested(*managers): do_something() - is equivalent to this:: - - m1, m2, m3 = A(), B(), C() - with m1 as X: - with m2 as Y: - with m3 as Z: - do_something() - Note that if the :meth:`__exit__` method of one of the nested context managers indicates an exception should be suppressed, no exception information will be passed to any remaining outer context managers. Similarly, if the @@ -80,8 +77,29 @@ :meth:`__exit__` methods should avoid raising exceptions, and in particular they should not re-raise a passed-in exception. + This function has two major quirks that have led to it being deprecated. Firstly, + as the context managers are all constructed before the function is invoked, the + :meth:`__new__` and :meth:`__init__` methods of the inner context managers are + not actually covered by the scope of the outer context managers. That means, for + example, that using :func:`nested` to open two files is a programming error as the + first file will not be closed promptly if an exception is thrown when opening + the second file. + + Secondly, if the :meth:`__enter__` method of one of the inner context managers + raises an exception that is caught and suppressed by the :meth:`__exit__` method + of one of the outer context managers, this construct will raise + :exc:`RuntimeError` rather than skipping the body of the :keyword:`with` + statement. + + Developers that need to support nesting of a variable number of context managers + can either use the :mod:`warnings` module to suppress the DeprecationWarning + raised by this function or else use this function as a model for an application + specific implementation. + .. deprecated:: 3.1 - The with-statement now supports this functionality directly. + The with-statement now supports this functionality directly (without the + confusing error prone quirks). + .. function:: closing(thing) From python-checkins at python.org Wed Jun 17 14:29:38 2009 From: python-checkins at python.org (nick.coghlan) Date: Wed, 17 Jun 2009 12:29:38 -0000 Subject: [Python-checkins] r73467 - python/branches/release26-maint Message-ID: Author: nick.coghlan Date: Wed Jun 17 14:29:37 2009 New Revision: 73467 Log: Blocked revisions 73465 via svnmerge ........ r73465 | nick.coghlan | 2009-06-17 22:12:15 +1000 (Wed, 17 Jun 2009) | 1 line Issue 6288: update the contextlib.nested() docs to explain why it has been deprecated and should generally be avoided ........ Modified: python/branches/release26-maint/ (props changed) From python-checkins at python.org Wed Jun 17 14:32:12 2009 From: python-checkins at python.org (nick.coghlan) Date: Wed, 17 Jun 2009 12:32:12 -0000 Subject: [Python-checkins] r73468 - python/branches/release30-maint Message-ID: Author: nick.coghlan Date: Wed Jun 17 14:32:11 2009 New Revision: 73468 Log: Blocked revisions 73466 via svnmerge ................ r73466 | nick.coghlan | 2009-06-17 22:23:43 +1000 (Wed, 17 Jun 2009) | 9 lines Merged revisions 73465 via svnmerge from svn+ssh://pythondev at svn.python.org/python/trunk ........ r73465 | nick.coghlan | 2009-06-17 22:12:15 +1000 (Wed, 17 Jun 2009) | 1 line Issue 6288: update the contextlib.nested() docs to explain why it has been deprecated and should generally be avoided ........ ................ Modified: python/branches/release30-maint/ (props changed) From buildbot at python.org Wed Jun 17 15:35:13 2009 From: buildbot at python.org (buildbot at python.org) Date: Wed, 17 Jun 2009 13:35:13 +0000 Subject: [Python-checkins] buildbot failure in amd64 gentoo 3.0 Message-ID: The Buildbot has detected a new failure of amd64 gentoo 3.0. Full details are available at: http://www.python.org/dev/buildbot/all/amd64%20gentoo%203.0/builds/70 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: norwitz-amd64 Build Reason: Build Source Stamp: [branch branches/release30-maint] HEAD Blamelist: nick.coghlan BUILD FAILED: failed test Excerpt from the test logfile: Traceback (most recent call last): File "/home/buildbot/slave/py-build/3.0.norwitz-amd64/build/Lib/test/test_signal.py", line 161, in test_main self.run_test() File "/home/buildbot/slave/py-build/3.0.norwitz-amd64/build/Lib/test/test_signal.py", line 112, in run_test self.fail('HandlerBCalled exception not thrown') File "/home/buildbot/slave/py-build/3.0.norwitz-amd64/build/Lib/unittest.py", line 292, in fail raise self.failureException(msg) AssertionError: HandlerBCalled exception not thrown Traceback (most recent call last): File "/home/buildbot/slave/py-build/3.0.norwitz-amd64/build/Lib/test/test_signal.py", line 163, in test_main pickle.dump(traceback.format_exc(), done_w) File "/home/buildbot/slave/py-build/3.0.norwitz-amd64/build/Lib/traceback.py", line 267, in format_exc etype, value, tb = sys.exc_info() File "/home/buildbot/slave/py-build/3.0.norwitz-amd64/build/Lib/test/test_signal.py", line 65, in handlerB raise HandlerBCalled(signum, self.format_frame(frame)) test.test_signal.HandlerBCalled: (10, ' File "./Lib/test/regrtest.py", line 1200, in \n main()\n File "./Lib/test/regrtest.py", line 411, in main\n testdir, huntrleaks)\n File "./Lib/test/regrtest.py", line 570, in runtest\n testdir, huntrleaks)\n File "./Lib/test/regrtest.py", line 603, in runtest_inner\n indirect_test()\n File "/home/buildbot/slave/py-build/3.0.norwitz-amd64/build/Lib/test/test_signal.py", line 388, in test_main\n WakeupSignalTests, SiginterruptTest, ItimerTest)\n File "/home/buildbot/slave/py-build/3.0.norwitz-amd64/build/Lib/test/support.py", line 711, in run_unittest\n _run_suite(suite)\n File "/home/buildbot/slave/py-build/3.0.norwitz-amd64/build/Lib/test/support.py", line 686, in _run_suite\n result = runner.run(suite)\n File "/home/buildbot/slave/py-build/3.0.norwitz-amd64/build/Lib/test/support.py", line 675, in run\n test(result)\n File "/home/buildbot/slave/py-build/3.0.norwitz-amd64/build/Lib/unittest.py", line 434, in __call__\n return self.run(*args, **kwds)\n File "/home/buildbot/slave/py-build/3.0.norwitz-amd64/build/Lib/unittest.py", line 430, in run\n test(result)\n File "/home/buildbot/slave/py-build/3.0.norwitz-amd64/build/Lib/unittest.py", line 434, in __call__\n return self.run(*args, **kwds)\n File "/home/buildbot/slave/py-build/3.0.norwitz-amd64/build/Lib/unittest.py", line 430, in run\n test(result)\n File "/home/buildbot/slave/py-build/3.0.norwitz-amd64/build/Lib/unittest.py", line 275, in __call__\n return self.run(*args, **kwds)\n File "/home/buildbot/slave/py-build/3.0.norwitz-amd64/build/Lib/unittest.py", line 254, in run\n testMethod()\n File "/home/buildbot/slave/py-build/3.0.norwitz-amd64/build/Lib/test/test_signal.py", line 163, in test_main\n pickle.dump(traceback.format_exc(), done_w)\n File "/home/buildbot/slave/py-build/3.0.norwitz-amd64/build/Lib/traceback.py", line 267, in format_exc\n etype, value, tb = sys.exc_info()\n') 1 test failed: test_signal make: *** [buildbottest] Error 1 sincerely, -The Buildbot From buildbot at python.org Wed Jun 17 19:11:56 2009 From: buildbot at python.org (buildbot at python.org) Date: Wed, 17 Jun 2009 17:11:56 +0000 Subject: [Python-checkins] buildbot failure in x86 XP-4 3.0 Message-ID: The Buildbot has detected a new failure of x86 XP-4 3.0. Full details are available at: http://www.python.org/dev/buildbot/all/x86%20XP-4%203.0/builds/343 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: bolen-windows Build Reason: Build Source Stamp: [branch branches/release30-maint] HEAD Blamelist: nick.coghlan BUILD FAILED: failed test Excerpt from the test logfile: Traceback (most recent call last): File "E:\cygwin\home\db3l\buildarea\3.0.bolen-windows\build\lib\distutils\tests\test_build_ext.py", line 258, in test_get_outputs cmd.run() File "E:\cygwin\home\db3l\buildarea\3.0.bolen-windows\build\lib\distutils\command\build_ext.py", line 337, in run self.build_extensions() File "E:\cygwin\home\db3l\buildarea\3.0.bolen-windows\build\lib\distutils\command\build_ext.py", line 445, in build_extensions self.build_extension(ext) File "E:\cygwin\home\db3l\buildarea\3.0.bolen-windows\build\lib\distutils\command\build_ext.py", line 527, in build_extension target_lang=language) File "E:\cygwin\home\db3l\buildarea\3.0.bolen-windows\build\lib\distutils\ccompiler.py", line 792, in link_shared_object extra_preargs, extra_postargs, build_temp, target_lang) File "E:\cygwin\home\db3l\buildarea\3.0.bolen-windows\build\lib\distutils\msvc9compiler.py", line 636, in link raise LinkError(msg) distutils.errors.LinkError: command '"C:\Program Files\Microsoft Visual Studio 9.0\VC\BIN\link.exe"' failed with exit status 1120 2 tests failed: test_distutils test_memoryio ====================================================================== ERROR: test_get_outputs (distutils.tests.test_build_ext.BuildExtTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "E:\cygwin\home\db3l\buildarea\3.0.bolen-windows\build\lib\distutils\msvc9compiler.py", line 634, in link self.spawn([self.linker] + ld_args) File "E:\cygwin\home\db3l\buildarea\3.0.bolen-windows\build\lib\distutils\ccompiler.py", line 982, in spawn spawn(cmd, dry_run=self.dry_run) File "E:\cygwin\home\db3l\buildarea\3.0.bolen-windows\build\lib\distutils\spawn.py", line 33, in spawn _spawn_nt(cmd, search_path, dry_run=dry_run) File "E:\cygwin\home\db3l\buildarea\3.0.bolen-windows\build\lib\distutils\spawn.py", line 74, in _spawn_nt "command '%s' failed with exit status %d" % (cmd[0], rc)) distutils.errors.DistutilsExecError: command '"C:\Program Files\Microsoft Visual Studio 9.0\VC\BIN\link.exe"' failed with exit status 1120 Traceback (most recent call last): File "E:\cygwin\home\db3l\buildarea\3.0.bolen-windows\build\lib\distutils\tests\test_build_ext.py", line 258, in test_get_outputs cmd.run() File "E:\cygwin\home\db3l\buildarea\3.0.bolen-windows\build\lib\distutils\command\build_ext.py", line 337, in run self.build_extensions() File "E:\cygwin\home\db3l\buildarea\3.0.bolen-windows\build\lib\distutils\command\build_ext.py", line 445, in build_extensions self.build_extension(ext) File "E:\cygwin\home\db3l\buildarea\3.0.bolen-windows\build\lib\distutils\command\build_ext.py", line 527, in build_extension target_lang=language) File "E:\cygwin\home\db3l\buildarea\3.0.bolen-windows\build\lib\distutils\ccompiler.py", line 792, in link_shared_object extra_preargs, extra_postargs, build_temp, target_lang) File "E:\cygwin\home\db3l\buildarea\3.0.bolen-windows\build\lib\distutils\msvc9compiler.py", line 636, in link raise LinkError(msg) distutils.errors.LinkError: command '"C:\Program Files\Microsoft Visual Studio 9.0\VC\BIN\link.exe"' failed with exit status 1120 Traceback (most recent call last): File "E:\cygwin\home\db3l\buildarea\3.0.bolen-windows\build\lib\distutils\tests\test_build_ext.py", line 258, in test_get_outputs cmd.run() File "E:\cygwin\home\db3l\buildarea\3.0.bolen-windows\build\lib\distutils\command\build_ext.py", line 337, in run self.build_extensions() File "E:\cygwin\home\db3l\buildarea\3.0.bolen-windows\build\lib\distutils\command\build_ext.py", line 445, in build_extensions self.build_extension(ext) File "E:\cygwin\home\db3l\buildarea\3.0.bolen-windows\build\lib\distutils\command\build_ext.py", line 527, in build_extension target_lang=language) File "E:\cygwin\home\db3l\buildarea\3.0.bolen-windows\build\lib\distutils\ccompiler.py", line 792, in link_shared_object extra_preargs, extra_postargs, build_temp, target_lang) File "E:\cygwin\home\db3l\buildarea\3.0.bolen-windows\build\lib\distutils\msvc9compiler.py", line 636, in link raise LinkError(msg) distutils.errors.LinkError: command '"C:\Program Files\Microsoft Visual Studio 9.0\VC\BIN\link.exe"' failed with exit status 1120 ====================================================================== FAIL: test_newline_none (test.test_memoryio.PyStringIOTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "E:\cygwin\home\db3l\buildarea\3.0.bolen-windows\build\lib\test\test_memoryio.py", line 381, in test_newline_none self.assertEqual(memio.readlines(), ["hello\n", "hi\n"]) AssertionError: ['hello\n', '\n', 'hi\n', '\n'] != ['hello\n', 'hi\n'] ====================================================================== FAIL: test_newline_none (test.test_memoryio.CStringIOTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "E:\cygwin\home\db3l\buildarea\3.0.bolen-windows\build\lib\test\test_memoryio.py", line 381, in test_newline_none self.assertEqual(memio.readlines(), ["hello\n", "hi\n"]) AssertionError: ['hello\n', '\n', '\n', 'hi\n', '\n', '\n'] != ['hello\n', 'hi\n'] sincerely, -The Buildbot From python-checkins at python.org Thu Jun 18 02:07:14 2009 From: python-checkins at python.org (hirokazu.yamamoto) Date: Thu, 18 Jun 2009 00:07:14 -0000 Subject: [Python-checkins] r73469 - in python/branches/py3k: Lib/test/test_io.py Message-ID: Author: hirokazu.yamamoto Date: Thu Jun 18 02:07:14 2009 New Revision: 73469 Log: Merged revisions 73461 via svnmerge from svn+ssh://pythondev at svn.python.org/python/trunk ........ r73461 | hirokazu.yamamoto | 2009-06-17 16:05:33 +0900 | 1 line Issue #6215: Fixed to use self.open() instead of open() or io.open(). ........ Modified: python/branches/py3k/ (props changed) python/branches/py3k/Lib/test/test_io.py Modified: python/branches/py3k/Lib/test/test_io.py ============================================================================== --- python/branches/py3k/Lib/test/test_io.py (original) +++ python/branches/py3k/Lib/test/test_io.py Thu Jun 18 02:07:14 2009 @@ -293,13 +293,13 @@ def test_invalid_operations(self): # Try writing on a file opened in read mode and vice-versa. for mode in ("w", "wb"): - with open(support.TESTFN, mode) as fp: + with self.open(support.TESTFN, mode) as fp: self.assertRaises(IOError, fp.read) self.assertRaises(IOError, fp.readline) - with open(support.TESTFN, "rb") as fp: + with self.open(support.TESTFN, "rb") as fp: self.assertRaises(IOError, fp.write, b"blah") self.assertRaises(IOError, fp.writelines, [b"blah\n"]) - with open(support.TESTFN, "r") as fp: + with self.open(support.TESTFN, "r") as fp: self.assertRaises(IOError, fp.write, "blah") self.assertRaises(IOError, fp.writelines, ["blah\n"]) @@ -370,12 +370,12 @@ def test_with_open(self): for bufsize in (0, 1, 100): f = None - with open(support.TESTFN, "wb", bufsize) as f: + with self.open(support.TESTFN, "wb", bufsize) as f: f.write(b"xxx") self.assertEqual(f.closed, True) f = None try: - with open(support.TESTFN, "wb", bufsize) as f: + with self.open(support.TESTFN, "wb", bufsize) as f: 1/0 except ZeroDivisionError: self.assertEqual(f.closed, True) @@ -415,7 +415,7 @@ del f support.gc_collect() self.assertEqual(record, [1, 2, 3]) - with open(support.TESTFN, "rb") as f: + with self.open(support.TESTFN, "rb") as f: self.assertEqual(f.read(), b"xxx") def _check_base_destructor(self, base): @@ -510,7 +510,7 @@ del f support.gc_collect() self.assert_(wr() is None, wr) - with open(support.TESTFN, "rb") as f: + with self.open(support.TESTFN, "rb") as f: self.assertEqual(f.read(), b"abcxxx") def test_unbounded_file(self): @@ -522,11 +522,11 @@ self.skipTest("test can only run in a 32-bit address space") if support.real_max_memuse < support._2G: self.skipTest("test requires at least 2GB of memory") - with open(zero, "rb", buffering=0) as f: + with self.open(zero, "rb", buffering=0) as f: self.assertRaises(OverflowError, f.read) - with open(zero, "rb") as f: + with self.open(zero, "rb") as f: self.assertRaises(OverflowError, f.read) - with open(zero, "r") as f: + with self.open(zero, "r") as f: self.assertRaises(OverflowError, f.read) class CIOTest(IOTest): @@ -737,9 +737,9 @@ l = list(range(256)) * N random.shuffle(l) s = bytes(bytearray(l)) - with io.open(support.TESTFN, "wb") as f: + with self.open(support.TESTFN, "wb") as f: f.write(s) - with io.open(support.TESTFN, self.read_mode, buffering=0) as raw: + with self.open(support.TESTFN, self.read_mode, buffering=0) as raw: bufio = self.tp(raw, 8) errors = [] results = [] @@ -966,12 +966,12 @@ def test_truncate(self): # Truncate implicitly flushes the buffer. - with io.open(support.TESTFN, self.write_mode, buffering=0) as raw: + with self.open(support.TESTFN, self.write_mode, buffering=0) as raw: bufio = self.tp(raw, 8) bufio.write(b"abcdef") self.assertEqual(bufio.truncate(3), 3) self.assertEqual(bufio.tell(), 3) - with io.open(support.TESTFN, "rb", buffering=0) as f: + with self.open(support.TESTFN, "rb", buffering=0) as f: self.assertEqual(f.read(), b"abc") def test_threads(self): @@ -993,7 +993,7 @@ # writing the buffer to the raw streams. This is in addition # to concurrency issues due to switching threads in the middle # of Python code. - with io.open(support.TESTFN, self.write_mode, buffering=0) as raw: + with self.open(support.TESTFN, self.write_mode, buffering=0) as raw: bufio = self.tp(raw, 8) errors = [] def f(): @@ -1016,7 +1016,7 @@ self.assertFalse(errors, "the following exceptions were caught: %r" % errors) bufio.close() - with io.open(support.TESTFN, "rb") as f: + with self.open(support.TESTFN, "rb") as f: s = f.read() for i in range(256): self.assertEquals(s.count(bytes([i])), N) @@ -1076,7 +1076,7 @@ del f support.gc_collect() self.assert_(wr() is None, wr) - with open(support.TESTFN, "rb") as f: + with self.open(support.TESTFN, "rb") as f: self.assertEqual(f.read(), b"123xxx") @@ -2055,7 +2055,7 @@ del t support.gc_collect() self.assert_(wr() is None, wr) - with open(support.TESTFN, "rb") as f: + with self.open(support.TESTFN, "rb") as f: self.assertEqual(f.read(), b"456def") class PyTextIOWrapperTest(TextIOWrapperTest): From buildbot at python.org Thu Jun 18 02:54:46 2009 From: buildbot at python.org (buildbot at python.org) Date: Thu, 18 Jun 2009 00:54:46 +0000 Subject: [Python-checkins] buildbot failure in sparc solaris10 gcc 3.x Message-ID: The Buildbot has detected a new failure of sparc solaris10 gcc 3.x. Full details are available at: http://www.python.org/dev/buildbot/all/sparc%20solaris10%20gcc%203.x/builds/835 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: loewis-sun Build Reason: Build Source Stamp: [branch branches/py3k] HEAD Blamelist: hirokazu.yamamoto BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_posix ====================================================================== ERROR: test_getcwd_long_pathnames (test.test_posix.PosixTester) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home2/buildbot/slave/3.x.loewis-sun/build/Lib/test/test_posix.py", line 251, in test_getcwd_long_pathnames support.rmtree(base_path) File "/home2/buildbot/slave/3.x.loewis-sun/build/Lib/test/support.py", line 181, in rmtree shutil.rmtree(path) File "/home2/buildbot/slave/3.x.loewis-sun/build/Lib/shutil.py", line 239, in rmtree onerror(os.rmdir, path, sys.exc_info()) File "/home2/buildbot/slave/3.x.loewis-sun/build/Lib/shutil.py", line 237, in rmtree os.rmdir(path) OSError: [Errno 22] Invalid argument: '/home2/buildbot/slave/3.x.loewis-sun/build/@test.getcwd/@test.getcwd' sincerely, -The Buildbot From buildbot at python.org Thu Jun 18 03:51:12 2009 From: buildbot at python.org (buildbot at python.org) Date: Thu, 18 Jun 2009 01:51:12 +0000 Subject: [Python-checkins] buildbot failure in x86 XP-4 3.x Message-ID: The Buildbot has detected a new failure of x86 XP-4 3.x. Full details are available at: http://www.python.org/dev/buildbot/all/x86%20XP-4%203.x/builds/701 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: bolen-windows Build Reason: Build Source Stamp: [branch branches/py3k] HEAD Blamelist: hirokazu.yamamoto BUILD FAILED: failed test Excerpt from the test logfile: Traceback (most recent call last): File "E:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\test\test_import.py", line 62, in test_with_extension self.fail("import from %s failed: %s" % (ext, err)) File "E:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\unittest.py", line 540, in fail raise self.failureException(msg) AssertionError: import from .PY failed: No module named @test Traceback (most recent call last): File "E:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\test\test_import.py", line 79, in testImport test_with_extension(ext) File "E:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\test\test_import.py", line 72, in test_with_extension del sys.modules[TESTFN] KeyError: '@test' 1 test failed: test_import ====================================================================== ERROR: testImport (test.test_import.ImportTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "E:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\test\test_import.py", line 60, in test_with_extension mod = __import__(TESTFN) ImportError: No module named @test Traceback (most recent call last): File "E:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\test\test_import.py", line 62, in test_with_extension self.fail("import from %s failed: %s" % (ext, err)) File "E:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\unittest.py", line 540, in fail raise self.failureException(msg) AssertionError: import from .PY failed: No module named @test Traceback (most recent call last): File "E:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\test\test_import.py", line 79, in testImport test_with_extension(ext) File "E:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\test\test_import.py", line 72, in test_with_extension del sys.modules[TESTFN] KeyError: '@test' Traceback (most recent call last): File "E:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\test\test_import.py", line 62, in test_with_extension self.fail("import from %s failed: %s" % (ext, err)) File "E:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\unittest.py", line 540, in fail raise self.failureException(msg) AssertionError: import from .PY failed: No module named @test Traceback (most recent call last): File "E:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\test\test_import.py", line 79, in testImport test_with_extension(ext) File "E:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\test\test_import.py", line 72, in test_with_extension del sys.modules[TESTFN] KeyError: '@test' sincerely, -The Buildbot From python-checkins at python.org Fri Jun 19 00:21:03 2009 From: python-checkins at python.org (raymond.hettinger) Date: Thu, 18 Jun 2009 22:21:03 -0000 Subject: [Python-checkins] r73470 - python/branches/py3k/Lib/test/test_signal.py Message-ID: Author: raymond.hettinger Date: Fri Jun 19 00:21:03 2009 New Revision: 73470 Log: Remove unused import Modified: python/branches/py3k/Lib/test/test_signal.py Modified: python/branches/py3k/Lib/test/test_signal.py ============================================================================== --- python/branches/py3k/Lib/test/test_signal.py (original) +++ python/branches/py3k/Lib/test/test_signal.py Fri Jun 19 00:21:03 2009 @@ -1,6 +1,6 @@ import unittest from test import support -from contextlib import closing, nested +from contextlib import closing import gc import pickle import select From python-checkins at python.org Fri Jun 19 00:24:26 2009 From: python-checkins at python.org (georg.brandl) Date: Thu, 18 Jun 2009 22:24:26 -0000 Subject: [Python-checkins] r73471 - python/trunk/Lib/test/test_signal.py Message-ID: Author: georg.brandl Date: Fri Jun 19 00:24:26 2009 New Revision: 73471 Log: #6276: Remove usage of nested() in favor of new with statement with multiple managers. Modified: python/trunk/Lib/test/test_signal.py Modified: python/trunk/Lib/test/test_signal.py ============================================================================== --- python/trunk/Lib/test/test_signal.py (original) +++ python/trunk/Lib/test/test_signal.py Fri Jun 19 00:24:26 2009 @@ -1,6 +1,6 @@ import unittest from test import test_support -from contextlib import closing, nested +from contextlib import closing import gc import pickle import select @@ -146,8 +146,8 @@ # re-raises information about any exceptions the child # throws. The real work happens in self.run_test(). os_done_r, os_done_w = os.pipe() - with nested(closing(os.fdopen(os_done_r)), - closing(os.fdopen(os_done_w, 'w'))) as (done_r, done_w): + with closing(os.fdopen(os_done_r)) as done_r, \ + closing(os.fdopen(os_done_w, 'w')) as done_w: child = os.fork() if child == 0: # In the child process; run the test and report results From python-checkins at python.org Fri Jun 19 00:32:50 2009 From: python-checkins at python.org (amaury.forgeotdarc) Date: Thu, 18 Jun 2009 22:32:50 -0000 Subject: [Python-checkins] r73472 - in python/trunk: Lib/subprocess.py Misc/NEWS Message-ID: Author: amaury.forgeotdarc Date: Fri Jun 19 00:32:50 2009 New Revision: 73472 Log: #6189: The subprocess.py module should be kept compatible with python 2.2 (On windows, you still have to change one line to use pywin32 instead of the _subprocess helper module) Modified: python/trunk/Lib/subprocess.py python/trunk/Misc/NEWS Modified: python/trunk/Lib/subprocess.py ============================================================================== --- python/trunk/Lib/subprocess.py (original) +++ python/trunk/Lib/subprocess.py Fri Jun 19 00:32:50 2009 @@ -500,7 +500,7 @@ """ if 'stdout' in kwargs: raise ValueError('stdout argument not allowed, it will be overridden.') - process = Popen(*popenargs, stdout=PIPE, **kwargs) + process = Popen(stdout=PIPE, *popenargs, **kwargs) output, unused_err = process.communicate() retcode = process.poll() if retcode: @@ -1020,8 +1020,17 @@ def _close_fds(self, but): - os.closerange(3, but) - os.closerange(but + 1, MAXFD) + if hasattr(os, 'closerange'): + os.closerange(3, but) + os.closerange(but + 1, MAXFD) + else: + for i in xrange(3, MAXFD): + if i == but: + continue + try: + os.close(i) + except: + pass def _execute_child(self, args, executable, preexec_fn, close_fds, Modified: python/trunk/Misc/NEWS ============================================================================== --- python/trunk/Misc/NEWS (original) +++ python/trunk/Misc/NEWS Fri Jun 19 00:32:50 2009 @@ -327,6 +327,8 @@ Library ------- +- Issue #6189: Restored compatibility of subprocess.py with Python 2.2. + - Issue #6287: Added the license field in Distutils documentation. - Issue #6286: Now Distutils upload command is based on urllib2 instead of From python-checkins at python.org Fri Jun 19 00:42:44 2009 From: python-checkins at python.org (amaury.forgeotdarc) Date: Thu, 18 Jun 2009 22:42:44 -0000 Subject: [Python-checkins] r73473 - python/branches/py3k Message-ID: Author: amaury.forgeotdarc Date: Fri Jun 19 00:42:43 2009 New Revision: 73473 Log: Blocked revisions 73472 via svnmerge ........ r73472 | amaury.forgeotdarc | 2009-06-19 00:32:50 +0200 (ven., 19 juin 2009) | 5 lines #6189: The subprocess.py module should be kept compatible with python 2.2 (On windows, you still have to change one line to use pywin32 instead of the _subprocess helper module) ........ Modified: python/branches/py3k/ (props changed) From python-checkins at python.org Fri Jun 19 00:48:50 2009 From: python-checkins at python.org (georg.brandl) Date: Thu, 18 Jun 2009 22:48:50 -0000 Subject: [Python-checkins] r73474 - python/branches/py3k Message-ID: Author: georg.brandl Date: Fri Jun 19 00:48:50 2009 New Revision: 73474 Log: Blocked revisions 73471 via svnmerge ........ r73471 | georg.brandl | 2009-06-19 00:24:26 +0200 (Fr, 19 Jun 2009) | 1 line #6276: Remove usage of nested() in favor of new with statement with multiple managers. ........ Modified: python/branches/py3k/ (props changed) From buildbot at python.org Fri Jun 19 01:11:47 2009 From: buildbot at python.org (buildbot at python.org) Date: Thu, 18 Jun 2009 23:11:47 +0000 Subject: [Python-checkins] buildbot failure in OS X x86 trunk Message-ID: The Buildbot has detected a new failure of OS X x86 trunk. Full details are available at: http://www.python.org/dev/buildbot/all/OS%20X%20x86%20trunk/builds/709 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: noller-osx86 Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: georg.brandl,nick.coghlan BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_httpservers make: *** [buildbottest] Error 1 sincerely, -The Buildbot From buildbot at python.org Fri Jun 19 01:36:32 2009 From: buildbot at python.org (buildbot at python.org) Date: Thu, 18 Jun 2009 23:36:32 +0000 Subject: [Python-checkins] buildbot failure in amd64 gentoo 3.x Message-ID: The Buildbot has detected a new failure of amd64 gentoo 3.x. Full details are available at: http://www.python.org/dev/buildbot/all/amd64%20gentoo%203.x/builds/822 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: norwitz-amd64 Build Reason: Build Source Stamp: [branch branches/py3k] HEAD Blamelist: amaury.forgeotdarc BUILD FAILED: failed failed slave lost sincerely, -The Buildbot From buildbot at python.org Fri Jun 19 02:47:59 2009 From: buildbot at python.org (buildbot at python.org) Date: Fri, 19 Jun 2009 00:47:59 +0000 Subject: [Python-checkins] buildbot failure in x86 osx.5 3.x Message-ID: The Buildbot has detected a new failure of x86 osx.5 3.x. Full details are available at: http://www.python.org/dev/buildbot/all/x86%20osx.5%203.x/builds/1045 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: heller-x86-osx5 Build Reason: Build Source Stamp: [branch branches/py3k] HEAD Blamelist: georg.brandl BUILD FAILED: failed test Excerpt from the test logfile: 2 tests failed: test_ast test_urllib make: *** [buildbottest] Error 1 sincerely, -The Buildbot From buildbot at python.org Fri Jun 19 02:57:45 2009 From: buildbot at python.org (buildbot at python.org) Date: Fri, 19 Jun 2009 00:57:45 +0000 Subject: [Python-checkins] buildbot failure in sparc solaris10 gcc 3.x Message-ID: The Buildbot has detected a new failure of sparc solaris10 gcc 3.x. Full details are available at: http://www.python.org/dev/buildbot/all/sparc%20solaris10%20gcc%203.x/builds/837 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: loewis-sun Build Reason: Build Source Stamp: [branch branches/py3k] HEAD Blamelist: amaury.forgeotdarc,georg.brandl BUILD FAILED: failed test Excerpt from the test logfile: 2 tests failed: test_import test_posix ====================================================================== ERROR: test_getcwd_long_pathnames (test.test_posix.PosixTester) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home2/buildbot/slave/3.x.loewis-sun/build/Lib/test/test_posix.py", line 251, in test_getcwd_long_pathnames support.rmtree(base_path) File "/home2/buildbot/slave/3.x.loewis-sun/build/Lib/test/support.py", line 181, in rmtree shutil.rmtree(path) File "/home2/buildbot/slave/3.x.loewis-sun/build/Lib/shutil.py", line 239, in rmtree onerror(os.rmdir, path, sys.exc_info()) File "/home2/buildbot/slave/3.x.loewis-sun/build/Lib/shutil.py", line 237, in rmtree os.rmdir(path) OSError: [Errno 22] Invalid argument: '/home2/buildbot/slave/3.x.loewis-sun/build/@test.getcwd/@test.getcwd' sincerely, -The Buildbot From buildbot at python.org Fri Jun 19 03:33:20 2009 From: buildbot at python.org (buildbot at python.org) Date: Fri, 19 Jun 2009 01:33:20 +0000 Subject: [Python-checkins] buildbot failure in x86 XP-4 trunk Message-ID: The Buildbot has detected a new failure of x86 XP-4 trunk. Full details are available at: http://www.python.org/dev/buildbot/all/x86%20XP-4%20trunk/builds/2257 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: bolen-windows Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: georg.brandl,nick.coghlan BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_bsddb3 ====================================================================== FAIL: test01_basic_replication (bsddb.test.test_replication.DBBaseReplication) ---------------------------------------------------------------------- Traceback (most recent call last): File "E:\cygwin\home\db3l\buildarea\trunk.bolen-windows\build\lib\bsddb\test\test_replication.py", line 315, in test01_basic_replication self.assertTrue(time.time() Author: benjamin.peterson Date: Fri Jun 19 04:18:28 2009 New Revision: 73475 Log: bite the bullet: a draft backwards compat policy Added: peps/trunk/pep-0387.txt (contents, props changed) Added: peps/trunk/pep-0387.txt ============================================================================== --- (empty file) +++ peps/trunk/pep-0387.txt Fri Jun 19 04:18:28 2009 @@ -0,0 +1,101 @@ +PEP: 387 +Title: Backwards Compatibility Policy +Version: $Revision$ +Last-Modified: $Date$ +Author: Benjamin Peterson +Status: Draft +Type: Process +Content-Type: text/x-rst +Created: 18-Jun-2009 + + +Abstract +======== + +This PEP outlines Python's backwards compatibility policy. + + +Rationale +========= + +As one of the most used programming languages today [#tiobe]_, the Python core +language and its standard library play a critcal role in thousands of +applications and libraries. This is fantastic; it is probably one of a language +designer's most wishful dreams. However, it means the development team must be +very careful not to break this existing 3rd party code with new releases. + + +Backwards Compatibility Rules +============================= + +This policy applys to all public APIs. These include the C-API, the standard +library, and the core language including syntax and operation as defined by the +reference manual. + +This is the basic policy for backwards compatibility: + +* The behavior of an API *must* not change between any two consecutive releases. + +* A feature cannot be removed without notice between any two consecutive + releases. + +* Addition of a feature which breaks 3rd party libraries or applications should + have a large benefit to breakage ratio, and/or the incompatibility should be + trival to fix in broken code. + + +Making Incompatible Changes +=========================== + +It's a fact: design mistakes happen. Thus it is important to be able to change +APIs or remove misguided features. This is accomplished through a gradual +process over several releases: + +1. Discuss the change. Depending on the size of the incompatibility, this could + be on the bug tracker, python-dev, python-list, or the appropriate SIG. A + PEP or similar document may be written. Hopefully users of the affected API + will pipe up to comment. + +2. Add a warning [#warnings_]_. If behavior is changing, a the API may gain a + new function or method to perform the new behavior; old usage should raise + the warning. If an API is being removed, simply warn whenever it is entered. + DeprecationWarning is the usual warning category to use, but + PendingDeprecationWarning may be used in special cases were the old and new + versions of the API will coexist for many releases. + +3. Wait for a release. + +4. See if there's any feedback. Users not involved in the original discussions + may comment now after seeing the warning. Perhaps reconsider. + +5. The behavior change or feature removal may now be made default or permanent + in the next release. Remove the old version and warning. + + +References +========== + +.. [#tiobe] TIOBE Programming Community Index + + http://www.tiobe.com/index.php/content/paperinfo/tpci/index.html + +.. [#warnings] The warnings module + + http://docs.python.org/library/warnings.html + + +Copyright +========= + +This document has been placed in the public domain. + + + +.. + Local Variables: + mode: indented-text + indent-tabs-mode: nil + sentence-end-double-space: t + fill-column: 70 + coding: utf-8 + End: From python-checkins at python.org Fri Jun 19 04:20:54 2009 From: python-checkins at python.org (benjamin.peterson) Date: Fri, 19 Jun 2009 02:20:54 -0000 Subject: [Python-checkins] r73476 - peps/trunk/pep-0387.txt Message-ID: Author: benjamin.peterson Date: Fri Jun 19 04:20:54 2009 New Revision: 73476 Log: fix reference Modified: peps/trunk/pep-0387.txt Modified: peps/trunk/pep-0387.txt ============================================================================== --- peps/trunk/pep-0387.txt (original) +++ peps/trunk/pep-0387.txt Fri Jun 19 04:20:54 2009 @@ -56,7 +56,7 @@ PEP or similar document may be written. Hopefully users of the affected API will pipe up to comment. -2. Add a warning [#warnings_]_. If behavior is changing, a the API may gain a +2. Add a warning [#warnings]_. If behavior is changing, a the API may gain a new function or method to perform the new behavior; old usage should raise the warning. If an API is being removed, simply warn whenever it is entered. DeprecationWarning is the usual warning category to use, but From python-checkins at python.org Fri Jun 19 14:51:35 2009 From: python-checkins at python.org (benjamin.peterson) Date: Fri, 19 Jun 2009 12:51:35 -0000 Subject: [Python-checkins] r73477 - peps/trunk/pep-0387.txt Message-ID: Author: benjamin.peterson Date: Fri Jun 19 14:51:34 2009 New Revision: 73477 Log: typo Modified: peps/trunk/pep-0387.txt Modified: peps/trunk/pep-0387.txt ============================================================================== --- peps/trunk/pep-0387.txt (original) +++ peps/trunk/pep-0387.txt Fri Jun 19 14:51:34 2009 @@ -28,9 +28,9 @@ Backwards Compatibility Rules ============================= -This policy applys to all public APIs. These include the C-API, the standard -library, and the core language including syntax and operation as defined by the -reference manual. +This policy applies to all public APIs. These include the C-API, the +standard library, and the core language including syntax and operation +as defined by the reference manual. This is the basic policy for backwards compatibility: From python-checkins at python.org Fri Jun 19 15:55:12 2009 From: python-checkins at python.org (benjamin.peterson) Date: Fri, 19 Jun 2009 13:55:12 -0000 Subject: [Python-checkins] r73478 - peps/trunk/pep-0387.txt Message-ID: Author: benjamin.peterson Date: Fri Jun 19 15:55:12 2009 New Revision: 73478 Log: qualify a lot of things Modified: peps/trunk/pep-0387.txt Modified: peps/trunk/pep-0387.txt ============================================================================== --- peps/trunk/pep-0387.txt (original) +++ peps/trunk/pep-0387.txt Fri Jun 19 15:55:12 2009 @@ -34,14 +34,19 @@ This is the basic policy for backwards compatibility: -* The behavior of an API *must* not change between any two consecutive releases. - -* A feature cannot be removed without notice between any two consecutive +* Unless it is going through the deprecation process below, the + behavior of an API *must* not change between any two consecutive releases. +* Similarly a feature cannot be removed without notice between any two + consecutive releases. + * Addition of a feature which breaks 3rd party libraries or applications should have a large benefit to breakage ratio, and/or the incompatibility should be - trival to fix in broken code. + trival to fix in broken code. For example, adding an stdlib module + with the same name as a third party package is not acceptable. + Adding a method or attribute that conflicts with 3rd party code + through inheritance, however, is likely reasonable. Making Incompatible Changes From python-checkins at python.org Fri Jun 19 16:07:33 2009 From: python-checkins at python.org (benjamin.peterson) Date: Fri, 19 Jun 2009 14:07:33 -0000 Subject: [Python-checkins] r73479 - peps/trunk/pep-0387.txt Message-ID: Author: benjamin.peterson Date: Fri Jun 19 16:07:32 2009 New Revision: 73479 Log: qualify Modified: peps/trunk/pep-0387.txt Modified: peps/trunk/pep-0387.txt ============================================================================== --- peps/trunk/pep-0387.txt (original) +++ peps/trunk/pep-0387.txt Fri Jun 19 16:07:32 2009 @@ -68,7 +68,8 @@ PendingDeprecationWarning may be used in special cases were the old and new versions of the API will coexist for many releases. -3. Wait for a release. +3. Wait for a release of whichever tree (trunk or py3k) contains the + warning. 4. See if there's any feedback. Users not involved in the original discussions may comment now after seeing the warning. Perhaps reconsider. From python-checkins at python.org Fri Jun 19 20:02:29 2009 From: python-checkins at python.org (facundo.batista) Date: Fri, 19 Jun 2009 18:02:29 -0000 Subject: [Python-checkins] r73480 - in python/trunk: Lib/subprocess.py Misc/NEWS Message-ID: Author: facundo.batista Date: Fri Jun 19 20:02:28 2009 New Revision: 73480 Log: Issue #6274. Fixed a potential FD leak in subprocess.py. Modified: python/trunk/Lib/subprocess.py python/trunk/Misc/NEWS Modified: python/trunk/Lib/subprocess.py ============================================================================== --- python/trunk/Lib/subprocess.py (original) +++ python/trunk/Lib/subprocess.py Fri Jun 19 20:02:28 2009 @@ -1056,90 +1056,98 @@ # The first char specifies the exception type: 0 means # OSError, 1 means some other error. errpipe_read, errpipe_write = os.pipe() - self._set_cloexec_flag(errpipe_write) - - gc_was_enabled = gc.isenabled() - # Disable gc to avoid bug where gc -> file_dealloc -> - # write to stderr -> hang. http://bugs.python.org/issue1336 - gc.disable() try: - self.pid = os.fork() - except: - if gc_was_enabled: - gc.enable() - raise - self._child_created = True - if self.pid == 0: - # Child try: - # Close parent's pipe ends - if p2cwrite is not None: - os.close(p2cwrite) - if c2pread is not None: - os.close(c2pread) - if errread is not None: - os.close(errread) - os.close(errpipe_read) - - # Dup fds for child - if p2cread is not None: - os.dup2(p2cread, 0) - if c2pwrite is not None: - os.dup2(c2pwrite, 1) - if errwrite is not None: - os.dup2(errwrite, 2) - - # Close pipe fds. Make sure we don't close the same - # fd more than once, or standard fds. - if p2cread is not None and p2cread not in (0,): - os.close(p2cread) - if c2pwrite is not None and c2pwrite not in (p2cread, 1): - os.close(c2pwrite) - if errwrite is not None and errwrite not in (p2cread, c2pwrite, 2): - os.close(errwrite) - - # Close all other fds, if asked for - if close_fds: - self._close_fds(but=errpipe_write) - - if cwd is not None: - os.chdir(cwd) - - if preexec_fn: - preexec_fn() - - if env is None: - os.execvp(executable, args) - else: - os.execvpe(executable, args, env) - - except: - exc_type, exc_value, tb = sys.exc_info() - # Save the traceback and attach it to the exception object - exc_lines = traceback.format_exception(exc_type, - exc_value, - tb) - exc_value.child_traceback = ''.join(exc_lines) - os.write(errpipe_write, pickle.dumps(exc_value)) - - # This exitcode won't be reported to applications, so it - # really doesn't matter what we return. - os._exit(255) - - # Parent - if gc_was_enabled: - gc.enable() - os.close(errpipe_write) - if p2cread is not None and p2cwrite is not None: - os.close(p2cread) - if c2pwrite is not None and c2pread is not None: - os.close(c2pwrite) - if errwrite is not None and errread is not None: - os.close(errwrite) - - # Wait for exec to fail or succeed; possibly raising exception - data = os.read(errpipe_read, 1048576) # Exceptions limited to 1 MB - os.close(errpipe_read) + self._set_cloexec_flag(errpipe_write) + + gc_was_enabled = gc.isenabled() + # Disable gc to avoid bug where gc -> file_dealloc -> + # write to stderr -> hang. http://bugs.python.org/issue1336 + gc.disable() + try: + self.pid = os.fork() + except: + if gc_was_enabled: + gc.enable() + raise + self._child_created = True + if self.pid == 0: + # Child + try: + # Close parent's pipe ends + if p2cwrite is not None: + os.close(p2cwrite) + if c2pread is not None: + os.close(c2pread) + if errread is not None: + os.close(errread) + os.close(errpipe_read) + + # Dup fds for child + if p2cread is not None: + os.dup2(p2cread, 0) + if c2pwrite is not None: + os.dup2(c2pwrite, 1) + if errwrite is not None: + os.dup2(errwrite, 2) + + # Close pipe fds. Make sure we don't close the same + # fd more than once, or standard fds. + if p2cread is not None and p2cread not in (0,): + os.close(p2cread) + if c2pwrite is not None and c2pwrite not in (p2cread, 1): + os.close(c2pwrite) + if errwrite is not None and errwrite not in (p2cread, c2pwrite, 2): + os.close(errwrite) + + # Close all other fds, if asked for + if close_fds: + self._close_fds(but=errpipe_write) + + if cwd is not None: + os.chdir(cwd) + + if preexec_fn: + preexec_fn() + + if env is None: + os.execvp(executable, args) + else: + os.execvpe(executable, args, env) + + except: + exc_type, exc_value, tb = sys.exc_info() + # Save the traceback and attach it to the exception object + exc_lines = traceback.format_exception(exc_type, + exc_value, + tb) + exc_value.child_traceback = ''.join(exc_lines) + os.write(errpipe_write, pickle.dumps(exc_value)) + + # This exitcode won't be reported to applications, so it + # really doesn't matter what we return. + os._exit(255) + + # Parent + if gc_was_enabled: + gc.enable() + finally: + # be sure the FD is closed no matter what + os.close(errpipe_write) + + if p2cread is not None and p2cwrite is not None: + os.close(p2cread) + if c2pwrite is not None and c2pread is not None: + os.close(c2pwrite) + if errwrite is not None and errread is not None: + os.close(errwrite) + + # Wait for exec to fail or succeed; possibly raising exception + data = os.read(errpipe_read, 1048576) # Exception limited to 1M + finally: + # be sure the FD is closed no matter what + os.close(errpipe_read) + if data != "": os.waitpid(self.pid, 0) child_exception = pickle.loads(data) Modified: python/trunk/Misc/NEWS ============================================================================== --- python/trunk/Misc/NEWS (original) +++ python/trunk/Misc/NEWS Fri Jun 19 20:02:28 2009 @@ -327,6 +327,8 @@ Library ------- +- Issue #6274: Fixed possible file descriptors leak in subprocess.py + - Issue #6189: Restored compatibility of subprocess.py with Python 2.2. - Issue #6287: Added the license field in Distutils documentation. From python-checkins at python.org Fri Jun 19 21:51:26 2009 From: python-checkins at python.org (facundo.batista) Date: Fri, 19 Jun 2009 19:51:26 -0000 Subject: [Python-checkins] r73481 - in python/branches/release26-maint: Lib/subprocess.py Misc/NEWS Message-ID: Author: facundo.batista Date: Fri Jun 19 21:51:26 2009 New Revision: 73481 Log: Issue #6274. Fixed a potential FD leak in subprocess.py. Modified: python/branches/release26-maint/Lib/subprocess.py python/branches/release26-maint/Misc/NEWS Modified: python/branches/release26-maint/Lib/subprocess.py ============================================================================== --- python/branches/release26-maint/Lib/subprocess.py (original) +++ python/branches/release26-maint/Lib/subprocess.py Fri Jun 19 21:51:26 2009 @@ -999,90 +999,98 @@ # The first char specifies the exception type: 0 means # OSError, 1 means some other error. errpipe_read, errpipe_write = os.pipe() - self._set_cloexec_flag(errpipe_write) - - gc_was_enabled = gc.isenabled() - # Disable gc to avoid bug where gc -> file_dealloc -> - # write to stderr -> hang. http://bugs.python.org/issue1336 - gc.disable() try: - self.pid = os.fork() - except: - if gc_was_enabled: - gc.enable() - raise - self._child_created = True - if self.pid == 0: - # Child try: - # Close parent's pipe ends - if p2cwrite is not None: - os.close(p2cwrite) - if c2pread is not None: - os.close(c2pread) - if errread is not None: - os.close(errread) - os.close(errpipe_read) - - # Dup fds for child - if p2cread is not None: - os.dup2(p2cread, 0) - if c2pwrite is not None: - os.dup2(c2pwrite, 1) - if errwrite is not None: - os.dup2(errwrite, 2) - - # Close pipe fds. Make sure we don't close the same - # fd more than once, or standard fds. - if p2cread is not None and p2cread not in (0,): - os.close(p2cread) - if c2pwrite is not None and c2pwrite not in (p2cread, 1): - os.close(c2pwrite) - if errwrite is not None and errwrite not in (p2cread, c2pwrite, 2): - os.close(errwrite) - - # Close all other fds, if asked for - if close_fds: - self._close_fds(but=errpipe_write) - - if cwd is not None: - os.chdir(cwd) - - if preexec_fn: - preexec_fn() - - if env is None: - os.execvp(executable, args) - else: - os.execvpe(executable, args, env) - - except: - exc_type, exc_value, tb = sys.exc_info() - # Save the traceback and attach it to the exception object - exc_lines = traceback.format_exception(exc_type, - exc_value, - tb) - exc_value.child_traceback = ''.join(exc_lines) - os.write(errpipe_write, pickle.dumps(exc_value)) - - # This exitcode won't be reported to applications, so it - # really doesn't matter what we return. - os._exit(255) - - # Parent - if gc_was_enabled: - gc.enable() - os.close(errpipe_write) - if p2cread is not None and p2cwrite is not None: - os.close(p2cread) - if c2pwrite is not None and c2pread is not None: - os.close(c2pwrite) - if errwrite is not None and errread is not None: - os.close(errwrite) - - # Wait for exec to fail or succeed; possibly raising exception - data = os.read(errpipe_read, 1048576) # Exceptions limited to 1 MB - os.close(errpipe_read) + self._set_cloexec_flag(errpipe_write) + + gc_was_enabled = gc.isenabled() + # Disable gc to avoid bug where gc -> file_dealloc -> + # write to stderr -> hang. http://bugs.python.org/issue1336 + gc.disable() + try: + self.pid = os.fork() + except: + if gc_was_enabled: + gc.enable() + raise + self._child_created = True + if self.pid == 0: + # Child + try: + # Close parent's pipe ends + if p2cwrite is not None: + os.close(p2cwrite) + if c2pread is not None: + os.close(c2pread) + if errread is not None: + os.close(errread) + os.close(errpipe_read) + + # Dup fds for child + if p2cread is not None: + os.dup2(p2cread, 0) + if c2pwrite is not None: + os.dup2(c2pwrite, 1) + if errwrite is not None: + os.dup2(errwrite, 2) + + # Close pipe fds. Make sure we don't close the same + # fd more than once, or standard fds. + if p2cread is not None and p2cread not in (0,): + os.close(p2cread) + if c2pwrite is not None and c2pwrite not in (p2cread, 1): + os.close(c2pwrite) + if errwrite is not None and errwrite not in (p2cread, c2pwrite, 2): + os.close(errwrite) + + # Close all other fds, if asked for + if close_fds: + self._close_fds(but=errpipe_write) + + if cwd is not None: + os.chdir(cwd) + + if preexec_fn: + preexec_fn() + + if env is None: + os.execvp(executable, args) + else: + os.execvpe(executable, args, env) + + except: + exc_type, exc_value, tb = sys.exc_info() + # Save the traceback and attach it to the exception object + exc_lines = traceback.format_exception(exc_type, + exc_value, + tb) + exc_value.child_traceback = ''.join(exc_lines) + os.write(errpipe_write, pickle.dumps(exc_value)) + + # This exitcode won't be reported to applications, so it + # really doesn't matter what we return. + os._exit(255) + + # Parent + if gc_was_enabled: + gc.enable() + finally: + # be sure the FD is closed no matter what + os.close(errpipe_write) + + if p2cread is not None and p2cwrite is not None: + os.close(p2cread) + if c2pwrite is not None and c2pread is not None: + os.close(c2pwrite) + if errwrite is not None and errread is not None: + os.close(errwrite) + + # Wait for exec to fail or succeed; possibly raising exception + data = os.read(errpipe_read, 1048576) # Exceptions limited to 1 MB + finally: + # be sure the FD is closed no matter what + os.close(errpipe_read) + if data != "": os.waitpid(self.pid, 0) child_exception = pickle.loads(data) Modified: python/branches/release26-maint/Misc/NEWS ============================================================================== --- python/branches/release26-maint/Misc/NEWS (original) +++ python/branches/release26-maint/Misc/NEWS Fri Jun 19 21:51:26 2009 @@ -56,6 +56,8 @@ Library ------- +- Issue #6274: Fixed possible file descriptors leak in subprocess.py + - Issue #6271: mmap tried to close invalid file handle (-1) when annonymous. (On Unix) From python-checkins at python.org Fri Jun 19 22:34:31 2009 From: python-checkins at python.org (facundo.batista) Date: Fri, 19 Jun 2009 20:34:31 -0000 Subject: [Python-checkins] r73482 - in python/branches/py3k: Lib/subprocess.py Misc/NEWS Message-ID: Author: facundo.batista Date: Fri Jun 19 22:34:30 2009 New Revision: 73482 Log: Issue #6274. Fixed a potential FD leak in subprocess.py. Modified: python/branches/py3k/Lib/subprocess.py python/branches/py3k/Misc/NEWS Modified: python/branches/py3k/Lib/subprocess.py ============================================================================== --- python/branches/py3k/Lib/subprocess.py (original) +++ python/branches/py3k/Lib/subprocess.py Fri Jun 19 22:34:30 2009 @@ -1034,91 +1034,102 @@ # The first char specifies the exception type: 0 means # OSError, 1 means some other error. errpipe_read, errpipe_write = os.pipe() - self._set_cloexec_flag(errpipe_write) - - gc_was_enabled = gc.isenabled() - # Disable gc to avoid bug where gc -> file_dealloc -> - # write to stderr -> hang. http://bugs.python.org/issue1336 - gc.disable() try: - self.pid = os.fork() - except: - if gc_was_enabled: - gc.enable() - raise - self._child_created = True - if self.pid == 0: - # Child try: - # Close parent's pipe ends - if p2cwrite is not None: - os.close(p2cwrite) - if c2pread is not None: - os.close(c2pread) - if errread is not None: - os.close(errread) - os.close(errpipe_read) - - # Dup fds for child - if p2cread is not None: - os.dup2(p2cread, 0) - if c2pwrite is not None: - os.dup2(c2pwrite, 1) - if errwrite is not None: - os.dup2(errwrite, 2) - - # Close pipe fds. Make sure we don't close the same - # fd more than once, or standard fds. - if p2cread is not None and p2cread not in (0,): - os.close(p2cread) - if c2pwrite is not None and c2pwrite not in (p2cread, 1): - os.close(c2pwrite) - if (errwrite is not None and - errwrite not in (p2cread, c2pwrite, 2)): - os.close(errwrite) - - # Close all other fds, if asked for - if close_fds: - self._close_fds(but=errpipe_write) - - if cwd is not None: - os.chdir(cwd) - - if preexec_fn: - preexec_fn() - - if env is None: - os.execvp(executable, args) - else: - os.execvpe(executable, args, env) - - except: - exc_type, exc_value, tb = sys.exc_info() - # Save the traceback and attach it to the exception object - exc_lines = traceback.format_exception(exc_type, - exc_value, - tb) - exc_value.child_traceback = ''.join(exc_lines) - os.write(errpipe_write, pickle.dumps(exc_value)) - - # This exitcode won't be reported to applications, so it - # really doesn't matter what we return. - os._exit(255) - - # Parent - if gc_was_enabled: - gc.enable() - os.close(errpipe_write) - if p2cread is not None and p2cwrite is not None: - os.close(p2cread) - if c2pwrite is not None and c2pread is not None: - os.close(c2pwrite) - if errwrite is not None and errread is not None: - os.close(errwrite) - - # Wait for exec to fail or succeed; possibly raising exception - data = os.read(errpipe_read, 1048576) # Exceptions limited to 1 MB - os.close(errpipe_read) + self._set_cloexec_flag(errpipe_write) + + gc_was_enabled = gc.isenabled() + # Disable gc to avoid bug where gc -> file_dealloc -> + # write to stderr -> hang. http://bugs.python.org/issue1336 + gc.disable() + try: + self.pid = os.fork() + except: + if gc_was_enabled: + gc.enable() + raise + self._child_created = True + if self.pid == 0: + # Child + try: + # Close parent's pipe ends + if p2cwrite is not None: + os.close(p2cwrite) + if c2pread is not None: + os.close(c2pread) + if errread is not None: + os.close(errread) + os.close(errpipe_read) + + # Dup fds for child + if p2cread is not None: + os.dup2(p2cread, 0) + if c2pwrite is not None: + os.dup2(c2pwrite, 1) + if errwrite is not None: + os.dup2(errwrite, 2) + + # Close pipe fds. Make sure we don't close the + # same fd more than once, or standard fds. + if p2cread is not None and p2cread not in (0,): + os.close(p2cread) + if c2pwrite is not None and \ + c2pwrite not in (p2cread, 1): + os.close(c2pwrite) + if (errwrite is not None and + errwrite not in (p2cread, c2pwrite, 2)): + os.close(errwrite) + + # Close all other fds, if asked for + if close_fds: + self._close_fds(but=errpipe_write) + + if cwd is not None: + os.chdir(cwd) + + if preexec_fn: + preexec_fn() + + if env is None: + os.execvp(executable, args) + else: + os.execvpe(executable, args, env) + + except: + exc_type, exc_value, tb = sys.exc_info() + # Save the traceback and attach it to the exception + # object + exc_lines = traceback.format_exception(exc_type, + exc_value, + tb) + exc_value.child_traceback = ''.join(exc_lines) + os.write(errpipe_write, pickle.dumps(exc_value)) + + # This exitcode won't be reported to applications, so + # it really doesn't matter what we return. + os._exit(255) + + # Parent + if gc_was_enabled: + gc.enable() + finally: + # be sure the FD is closed no matter what + os.close(errpipe_write) + + if p2cread is not None and p2cwrite is not None: + os.close(p2cread) + if c2pwrite is not None and c2pread is not None: + os.close(c2pwrite) + if errwrite is not None and errread is not None: + os.close(errwrite) + + # Wait for exec to fail or succeed; possibly raising an + # exception (limited to 1 MB) + data = os.read(errpipe_read, 1048576) + finally: + # be sure the FD is closed no matter what + os.close(errpipe_read) + if data: os.waitpid(self.pid, 0) child_exception = pickle.loads(data) Modified: python/branches/py3k/Misc/NEWS ============================================================================== --- python/branches/py3k/Misc/NEWS (original) +++ python/branches/py3k/Misc/NEWS Fri Jun 19 22:34:30 2009 @@ -15,6 +15,8 @@ Library ------- +- Issue #6274: Fixed possible file descriptors leak in subprocess.py + - Accessing io.StringIO.buffer now raises an AttributeError instead of io.UnsupportedOperation. From buildbot at python.org Fri Jun 19 22:42:17 2009 From: buildbot at python.org (buildbot at python.org) Date: Fri, 19 Jun 2009 20:42:17 +0000 Subject: [Python-checkins] buildbot failure in x86 XP-4 trunk Message-ID: The Buildbot has detected a new failure of x86 XP-4 trunk. Full details are available at: http://www.python.org/dev/buildbot/all/x86%20XP-4%20trunk/builds/2259 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: bolen-windows Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: facundo.batista BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_bsddb3 ====================================================================== ERROR: test01_basic_replication (bsddb.test.test_replication.DBReplicationManager) ---------------------------------------------------------------------- Traceback (most recent call last): File "E:\cygwin\home\db3l\buildarea\trunk.bolen-windows\build\lib\bsddb\test\test_replication.py", line 170, in test01_basic_replication mode=0666, txn=txn) DBNoSuchFileError: (2, 'No such file or directory -- connection closed: Successful return: 0') ====================================================================== ERROR: test01_basic_replication (bsddb.test.test_replication.DBReplicationManager) ---------------------------------------------------------------------- Traceback (most recent call last): File "E:\cygwin\home\db3l\buildarea\trunk.bolen-windows\build\lib\bsddb\test\test_replication.py", line 58, in tearDown if self.dbClient : DBError: (0, 'DB object has been closed') sincerely, -The Buildbot From python-checkins at python.org Fri Jun 19 22:55:54 2009 From: python-checkins at python.org (benjamin.peterson) Date: Fri, 19 Jun 2009 20:55:54 -0000 Subject: [Python-checkins] r73483 - peps/trunk/pep-0387.txt Message-ID: Author: benjamin.peterson Date: Fri Jun 19 22:55:54 2009 New Revision: 73483 Log: expand on public api Modified: peps/trunk/pep-0387.txt Modified: peps/trunk/pep-0387.txt ============================================================================== --- peps/trunk/pep-0387.txt (original) +++ peps/trunk/pep-0387.txt Fri Jun 19 22:55:54 2009 @@ -28,9 +28,28 @@ Backwards Compatibility Rules ============================= -This policy applies to all public APIs. These include the C-API, the -standard library, and the core language including syntax and operation -as defined by the reference manual. +This policy applies to all public APIs. These include: + +- Syntax and behavior of these constructs as defined by the reference + manual + +- The C-API + +- Function, class, module, attribute, and method names and types. + +- The position and expected types of arguments and returned values. + +- Behavior of classes with regards to subclasses: the conditions under + which overridden methods are called. + +Others are explicity not part of the public API. They can change or +be removed at any time in any way. These include: + +- Function, class, module, attribute, method, and C-API names and types that + are prefixed by "_" (except special names). The contents of these + can also are not subject to the policy. + +- Inheritance patterns of internal classes. This is the basic policy for backwards compatibility: From python-checkins at python.org Fri Jun 19 23:03:44 2009 From: python-checkins at python.org (benjamin.peterson) Date: Fri, 19 Jun 2009 21:03:44 -0000 Subject: [Python-checkins] r73484 - peps/trunk/pep-0387.txt Message-ID: Author: benjamin.peterson Date: Fri Jun 19 23:03:44 2009 New Revision: 73484 Log: about behavior Modified: peps/trunk/pep-0387.txt Modified: peps/trunk/pep-0387.txt ============================================================================== --- peps/trunk/pep-0387.txt (original) +++ peps/trunk/pep-0387.txt Fri Jun 19 23:03:44 2009 @@ -37,6 +37,10 @@ - Function, class, module, attribute, and method names and types. +- Given a set of arguments, the return value, side effects, and raised + exceptions of a function. This does not preclude changes from + reasonable bug fixes. + - The position and expected types of arguments and returned values. - Behavior of classes with regards to subclasses: the conditions under From python-checkins at python.org Sat Jun 20 00:07:48 2009 From: python-checkins at python.org (benjamin.peterson) Date: Fri, 19 Jun 2009 22:07:48 -0000 Subject: [Python-checkins] r73485 - python/trunk/Lib/test/test_with.py Message-ID: Author: benjamin.peterson Date: Sat Jun 20 00:07:47 2009 New Revision: 73485 Log: remove duplicate test Modified: python/trunk/Lib/test/test_with.py Modified: python/trunk/Lib/test/test_with.py ============================================================================== --- python/trunk/Lib/test/test_with.py (original) +++ python/trunk/Lib/test/test_with.py Sat Jun 20 00:07:47 2009 @@ -283,15 +283,6 @@ with Nested(mock_contextmanager_generator()): pass - def testSingleArgUnbound(self): - mock_contextmanager = mock_contextmanager_generator() - mock_nested = MockNested(mock_contextmanager) - with mock_nested: - self.assertInWithManagerInvariants(mock_contextmanager) - self.assertInWithManagerInvariants(mock_nested) - self.assertAfterWithManagerInvariantsNoError(mock_contextmanager) - self.assertAfterWithManagerInvariantsNoError(mock_nested) - def testSingleArgBoundToNonTuple(self): m = mock_contextmanager_generator() # This will bind all the arguments to nested() into a single list From python-checkins at python.org Sat Jun 20 00:09:17 2009 From: python-checkins at python.org (benjamin.peterson) Date: Fri, 19 Jun 2009 22:09:17 -0000 Subject: [Python-checkins] r73486 - python/trunk/Lib/test/test_with.py Message-ID: Author: benjamin.peterson Date: Sat Jun 20 00:09:17 2009 New Revision: 73486 Log: add missing assertion #6313 Modified: python/trunk/Lib/test/test_with.py Modified: python/trunk/Lib/test/test_with.py ============================================================================== --- python/trunk/Lib/test/test_with.py (original) +++ python/trunk/Lib/test/test_with.py Sat Jun 20 00:09:17 2009 @@ -710,6 +710,7 @@ body_executed = True self.assertTrue(a.enter_called) self.assertTrue(a.exit_called) + self.assertTrue(body_executed) self.assertNotEqual(a.exc_info[0], None) def testEnterReturnsTuple(self): From python-checkins at python.org Sat Jun 20 00:11:18 2009 From: python-checkins at python.org (guilherme.polo) Date: Fri, 19 Jun 2009 22:11:18 -0000 Subject: [Python-checkins] r73487 - in python/branches/tk_and_idle_maintenance: Doc/c-api/int.rst Doc/distutils/setupscript.rst Doc/library/bisect.rst Doc/library/cgi.rst Doc/library/contextlib.rst Doc/library/ctypes.rst Doc/library/curses.panel.rst Doc/library/curses.rst Doc/library/fcntl.rst Doc/library/io.rst Doc/library/itertools.rst Doc/library/os.rst Doc/library/pickletools.rst Doc/library/platform.rst Doc/library/random.rst Doc/library/string.rst Doc/library/subprocess.rst Doc/library/ttk.rst Doc/tools/sphinxext/patchlevel.py Doc/whatsnew/2.7.rst Grammar/Grammar Include/pyerrors.h Lib/_pyio.py Lib/contextlib.py Lib/distutils/ccompiler.py Lib/distutils/command/bdist_msi.py Lib/distutils/command/upload.py Lib/distutils/cygwinccompiler.py Lib/distutils/sysconfig.py Lib/distutils/tests/test_ccompiler.py Lib/distutils/tests/test_cygwinccompiler.py Lib/distutils/tests/test_sysconfig.py Lib/distutils/tests/test_upload.py Lib/filecmp.py Lib/idlelib/EditorWindow.py Lib/io.py Lib/lib2to3 Lib/lib2to3/Grammar.txt Lib/lib2to3/fixer_base.py Lib/lib2to3/fixer_util.py Lib/lib2to3/fixes/fix_apply.py Lib/lib2to3/fixes/fix_basestring.py Lib/lib2to3/fixes/fix_buffer.py Lib/lib2to3/fixes/fix_callable.py Lib/lib2to3/fixes/fix_dict.py Lib/lib2to3/fixes/fix_except.py Lib/lib2to3/fixes/fix_exec.py Lib/lib2to3/fixes/fix_execfile.py Lib/lib2to3/fixes/fix_filter.py Lib/lib2to3/fixes/fix_funcattrs.py Lib/lib2to3/fixes/fix_future.py Lib/lib2to3/fixes/fix_getcwdu.py Lib/lib2to3/fixes/fix_has_key.py Lib/lib2to3/fixes/fix_idioms.py Lib/lib2to3/fixes/fix_import.py Lib/lib2to3/fixes/fix_imports.py Lib/lib2to3/fixes/fix_input.py Lib/lib2to3/fixes/fix_intern.py Lib/lib2to3/fixes/fix_isinstance.py Lib/lib2to3/fixes/fix_itertools.py Lib/lib2to3/fixes/fix_itertools_imports.py Lib/lib2to3/fixes/fix_long.py Lib/lib2to3/fixes/fix_map.py Lib/lib2to3/fixes/fix_metaclass.py Lib/lib2to3/fixes/fix_methodattrs.py Lib/lib2to3/fixes/fix_ne.py Lib/lib2to3/fixes/fix_next.py Lib/lib2to3/fixes/fix_nonzero.py Lib/lib2to3/fixes/fix_numliterals.py Lib/lib2to3/fixes/fix_paren.py Lib/lib2to3/fixes/fix_print.py Lib/lib2to3/fixes/fix_raise.py Lib/lib2to3/fixes/fix_raw_input.py Lib/lib2to3/fixes/fix_reduce.py Lib/lib2to3/fixes/fix_renames.py Lib/lib2to3/fixes/fix_repr.py Lib/lib2to3/fixes/fix_set_literal.py Lib/lib2to3/fixes/fix_standarderror.py Lib/lib2to3/fixes/fix_sys_exc.py Lib/lib2to3/fixes/fix_throw.py Lib/lib2to3/fixes/fix_tuple_params.py Lib/lib2to3/fixes/fix_types.py Lib/lib2to3/fixes/fix_unicode.py Lib/lib2to3/fixes/fix_urllib.py Lib/lib2to3/fixes/fix_ws_comma.py Lib/lib2to3/fixes/fix_xrange.py Lib/lib2to3/fixes/fix_xreadlines.py Lib/lib2to3/fixes/fix_zip.py Lib/lib2to3/patcomp.py Lib/lib2to3/pytree.py Lib/lib2to3/refactor.py Lib/lib2to3/tests/data/README Lib/lib2to3/tests/data/different_encoding.py Lib/lib2to3/tests/data/fixers/myfixes/fix_parrot.py Lib/lib2to3/tests/data/py2_test_grammar.py Lib/lib2to3/tests/data/py3_test_grammar.py Lib/lib2to3/tests/pytree_idempotency.py Lib/lib2to3/tests/support.py Lib/lib2to3/tests/test_all_fixers.py Lib/lib2to3/tests/test_fixers.py Lib/lib2to3/tests/test_parser.py Lib/lib2to3/tests/test_pytree.py Lib/lib2to3/tests/test_util.py Lib/logging/handlers.py Lib/msilib/__init__.py Lib/multiprocessing/queues.py Lib/os.py Lib/random.py Lib/subprocess.py Lib/symbol.py Lib/test/cmath_testcases.txt Lib/test/doctest_aliases.py Lib/test/formatfloat_testcases.txt Lib/test/test_ast.py Lib/test/test_bufio.py Lib/test/test_coding.py Lib/test/test_compile.py Lib/test/test_curses.py Lib/test/test_doctest.py Lib/test/test_file.py Lib/test/test_file2k.py Lib/test/test_fileio.py Lib/test/test_generators.py Lib/test/test_genexps.py Lib/test/test_io.py Lib/test/test_largefile.py Lib/test/test_memoryio.py Lib/test/test_signal.py Lib/test/test_support.py Lib/test/test_syntax.py Lib/test/test_univnewlines.py Lib/test/test_univnewlines2k.py Lib/test/test_winreg.py Makefile.pre.in Misc/NEWS Modules/_bytesio.c Modules/_fileio.c Modules/_io Modules/audioop.c Modules/mmapmodule.c Objects/exceptions.c Objects/floatobject.c PC/VC6/pythoncore.dsp PC/VS7.1/pythoncore.vcproj PC/VS8.0/pythoncore.vcproj PC/_winreg.c PC/config.c PCbuild/pythoncore.vcproj Parser/Python.asdl Parser/asdl.py Parser/asdl_c.py Parser/grammar.mak Parser/tokenizer.c Python/Python-ast.c Python/ast.c Python/compile.c Python/errors.c Tools/msi/msi.py configure configure.in setup.py Message-ID: Author: guilherme.polo Date: Sat Jun 20 00:11:15 2009 New Revision: 73487 Log: Merged revisions 73278-73282,73286,73294,73296,73299,73303,73305,73308,73312-73314,73317-73318,73321,73324-73326,73328,73331,73334-73336,73340-73341,73345,73348,73350,73353-73354,73361-73363,73367,73370,73372,73376,73382,73390,73393-73398,73400-73402,73404-73405,73409,73415,73417-73423,73425,73432-73433,73435-73436,73439,73441,73445,73447-73448,73451,73457,73459-73463,73465,73471-73472,73480 via svnmerge from svn+ssh://pythondev/python/trunk ................ r73278 | benjamin.peterson | 2009-06-07 19:33:11 -0300 (Sun, 07 Jun 2009) | 1 line inherit from object ................ r73279 | benjamin.peterson | 2009-06-07 19:35:00 -0300 (Sun, 07 Jun 2009) | 1 line always inherit from an appropiate base class ................ r73280 | benjamin.peterson | 2009-06-07 19:54:35 -0300 (Sun, 07 Jun 2009) | 1 line use booleans for flags ................ r73281 | benjamin.peterson | 2009-06-07 19:55:36 -0300 (Sun, 07 Jun 2009) | 1 line remove has_key ................ r73282 | benjamin.peterson | 2009-06-07 20:12:44 -0300 (Sun, 07 Jun 2009) | 1 line backport r73273 ................ r73286 | georg.brandl | 2009-06-08 04:57:35 -0300 (Mon, 08 Jun 2009) | 1 line Remove period from end of headings. ................ r73294 | georg.brandl | 2009-06-08 10:34:52 -0300 (Mon, 08 Jun 2009) | 1 line #6194: O_SHLOCK/O_EXLOCK are not really more platform independent than lockf(). ................ r73296 | georg.brandl | 2009-06-08 13:03:41 -0300 (Mon, 08 Jun 2009) | 1 line #6238: add fillchar to string.just function family. ................ r73299 | georg.brandl | 2009-06-08 15:41:36 -0300 (Mon, 08 Jun 2009) | 1 line Typo fix. ................ r73303 | ronald.oussoren | 2009-06-08 17:54:59 -0300 (Mon, 08 Jun 2009) | 11 lines This checkin adds a symlink to the lib directory of a framework install of Python (on OSX), and the end result of that is that the combination of ``python-config --ldflags`` and ``python-config --libs`` refers to an actually existing location. I've done this in preference to changing python-config to specify '-framework Python' for linking because that doesn't work when you have multiple versions of python installed (because '-framework Python' will always link to the 'Current' version of the framework, without a possibility to specify a specific version). ................ r73305 | ronald.oussoren | 2009-06-08 18:12:41 -0300 (Mon, 08 Jun 2009) | 4 lines This is a fix for Issue5809: you shouldn't specify both --enable-framework and --enable-shared ................ r73308 | benjamin.peterson | 2009-06-08 19:18:32 -0300 (Mon, 08 Jun 2009) | 1 line remove useless assertion ................ r73312 | benjamin.peterson | 2009-06-08 20:44:13 -0300 (Mon, 08 Jun 2009) | 1 line remove error checks already done in set_context() ................ r73313 | r.david.murray | 2009-06-08 21:44:22 -0300 (Mon, 08 Jun 2009) | 4 lines Issue 2947: document how return code handling translates from os.popen to subprocess. Also fixes reference link in the os.spawn documentation. ................ r73314 | eric.smith | 2009-06-09 09:38:08 -0300 (Tue, 09 Jun 2009) | 1 line Restored a test that was erroneously removed. See issue 6198. ................ r73317 | benjamin.peterson | 2009-06-09 14:24:26 -0300 (Tue, 09 Jun 2009) | 1 line make ast.c depend on the grammar ................ r73318 | benjamin.peterson | 2009-06-09 14:29:51 -0300 (Tue, 09 Jun 2009) | 1 line explain why keyword names are not just NAME ................ r73321 | benjamin.peterson | 2009-06-09 18:13:43 -0300 (Tue, 09 Jun 2009) | 1 line update symbol.py from with statement changes ................ r73324 | amaury.forgeotdarc | 2009-06-09 19:53:16 -0300 (Tue, 09 Jun 2009) | 2 lines Avoid invoking the parser/compiler just to test the presence of a function. ................ r73325 | amaury.forgeotdarc | 2009-06-09 20:08:13 -0300 (Tue, 09 Jun 2009) | 8 lines #6201: Fix test_winreg on Windows: since the introduction of the SETUP_WITH opcode, __enter__ and __exit__ methods must belong to the type, and are not retrieved at the instance level (__dict__ or __getattr__). Add a note in whatsnew about this incompatibility; old style classes are not affected. ................ r73326 | amaury.forgeotdarc | 2009-06-09 20:18:50 -0300 (Tue, 09 Jun 2009) | 2 lines Both kind of types are concerned. ................ r73328 | amaury.forgeotdarc | 2009-06-09 20:37:11 -0300 (Tue, 09 Jun 2009) | 3 lines Missing import in test_curses, uncovered by some buildbots. (There are still a few test files that don't use the standard layout) ................ r73331 | benjamin.peterson | 2009-06-10 10:45:31 -0300 (Wed, 10 Jun 2009) | 1 line fix spelling ................ r73334 | raymond.hettinger | 2009-06-10 13:15:02 -0300 (Wed, 10 Jun 2009) | 1 line Issue 6256: Fix stacklevel in warning message. ................ r73335 | raymond.hettinger | 2009-06-10 13:15:40 -0300 (Wed, 10 Jun 2009) | 1 line Fix signed/unsigned compiler warning. ................ r73336 | tarek.ziade | 2009-06-10 15:49:50 -0300 (Wed, 10 Jun 2009) | 1 line Distutils: started code cleanup and test coverage for cygwinccompiler ................ r73340 | amaury.forgeotdarc | 2009-06-10 17:30:19 -0300 (Wed, 10 Jun 2009) | 2 lines Fix a typo spotted by Nick Coghlan. ................ r73341 | tarek.ziade | 2009-06-11 05:12:20 -0300 (Thu, 11 Jun 2009) | 1 line Fixed #5201: now distutils.sysconfig.parse_makefile() understands '53264' in Makefiles ................ r73345 | tarek.ziade | 2009-06-11 05:43:26 -0300 (Thu, 11 Jun 2009) | 1 line removed the last string.split() call ................ r73348 | tarek.ziade | 2009-06-11 06:13:36 -0300 (Thu, 11 Jun 2009) | 1 line #6263 fixed syntax error in distutils.cygwinccompiler ................ r73350 | vinay.sajip | 2009-06-11 06:23:41 -0300 (Thu, 11 Jun 2009) | 1 line Issue #5262: Fixed bug in next roll over time computation in TimedRotatingFileHandler. ................ r73353 | vinay.sajip | 2009-06-11 06:53:35 -0300 (Thu, 11 Jun 2009) | 1 line Issue #5262: Improved fix. ................ r73354 | tarek.ziade | 2009-06-11 06:55:09 -0300 (Thu, 11 Jun 2009) | 1 line pep8-fied cygwinccompiler module ................ r73361 | benjamin.peterson | 2009-06-11 13:25:52 -0300 (Thu, 11 Jun 2009) | 1 line remove duplicate check ................ r73362 | benjamin.peterson | 2009-06-11 14:49:38 -0300 (Thu, 11 Jun 2009) | 1 line revert r73361 ................ r73363 | benjamin.peterson | 2009-06-11 14:51:17 -0300 (Thu, 11 Jun 2009) | 1 line use multi-with syntax ................ r73367 | raymond.hettinger | 2009-06-11 19:04:00 -0300 (Thu, 11 Jun 2009) | 1 line Add example of how to do key lookups with bisect(). ................ r73370 | benjamin.peterson | 2009-06-11 19:06:46 -0300 (Thu, 11 Jun 2009) | 105 lines Merged revisions 72523,72950-72951,72994,73003,73033,73036-73040,73091-73093,73096,73179-73181,73192,73231,73244,73255-73256,73365 via svnmerge from svn+ssh://pythondev at svn.python.org/sandbox/trunk/2to3/lib2to3 ........ r72523 | benjamin.peterson | 2009-05-09 14:42:26 -0500 (Sat, 09 May 2009) | 1 line remove parenthesis ........ r72950 | benjamin.peterson | 2009-05-26 18:19:45 -0500 (Tue, 26 May 2009) | 1 line remove unused imports ........ r72951 | benjamin.peterson | 2009-05-26 18:27:00 -0500 (Tue, 26 May 2009) | 1 line this is no longer executable ........ r72994 | benjamin.peterson | 2009-05-28 15:32:54 -0500 (Thu, 28 May 2009) | 1 line fix test_all_fixers on Windows #6134 ........ r73003 | benjamin.peterson | 2009-05-28 21:57:28 -0500 (Thu, 28 May 2009) | 4 lines make 2to3 test utilities easier to use with other applications (3to2) Patch by Joe Amenta ........ r73033 | benjamin.peterson | 2009-05-29 16:58:32 -0500 (Fri, 29 May 2009) | 1 line update grammar for multi with statement ........ r73036 | benjamin.peterson | 2009-05-29 17:33:20 -0500 (Fri, 29 May 2009) | 1 line simplify fix_unicode ........ r73037 | benjamin.peterson | 2009-05-29 17:53:03 -0500 (Fri, 29 May 2009) | 1 line add custom error for pattern syntax errors ........ r73038 | benjamin.peterson | 2009-05-29 17:55:00 -0500 (Fri, 29 May 2009) | 1 line complain if details are attached to a token ........ r73039 | benjamin.peterson | 2009-05-29 18:00:28 -0500 (Fri, 29 May 2009) | 1 line add a test for whitespace ........ r73040 | benjamin.peterson | 2009-05-29 18:01:17 -0500 (Fri, 29 May 2009) | 1 line a fix for emacs highlighting ........ r73091 | benjamin.peterson | 2009-05-31 20:55:25 -0500 (Sun, 31 May 2009) | 1 line deprecate set_prefix() and get_prefix() in favor of a prefix property ........ r73092 | benjamin.peterson | 2009-05-31 21:00:51 -0500 (Sun, 31 May 2009) | 1 line change hideous java naming scheme ........ r73093 | benjamin.peterson | 2009-05-31 21:01:39 -0500 (Sun, 31 May 2009) | 1 line remove dated comment ........ r73096 | benjamin.peterson | 2009-05-31 21:40:53 -0500 (Sun, 31 May 2009) | 1 line group tests ........ r73179 | benjamin.peterson | 2009-06-03 13:09:53 -0500 (Wed, 03 Jun 2009) | 1 line handle the case where there's multiple trailers #6185 ........ r73180 | benjamin.peterson | 2009-06-03 13:18:05 -0500 (Wed, 03 Jun 2009) | 1 line scrap __main__ section ........ r73181 | benjamin.peterson | 2009-06-03 13:24:48 -0500 (Wed, 03 Jun 2009) | 1 line remove shebang lines and __main__ sections ........ r73192 | benjamin.peterson | 2009-06-03 19:16:30 -0500 (Wed, 03 Jun 2009) | 4 lines actually test something here Thanks to Joe Amenta for noticing.y ........ r73231 | benjamin.peterson | 2009-06-04 13:38:50 -0500 (Thu, 04 Jun 2009) | 1 line remove unused variable ........ r73244 | benjamin.peterson | 2009-06-05 08:39:25 -0500 (Fri, 05 Jun 2009) | 1 line allow fixers to give different options in setUp ........ r73255 | benjamin.peterson | 2009-06-06 11:23:46 -0500 (Sat, 06 Jun 2009) | 1 line fix the except fixer on one line suites #6222 ........ r73256 | benjamin.peterson | 2009-06-06 11:27:40 -0500 (Sat, 06 Jun 2009) | 1 line test one-line else and finally clauses ........ r73365 | benjamin.peterson | 2009-06-11 17:01:32 -0500 (Thu, 11 Jun 2009) | 1 line normalize whitespace ........ ................ r73372 | raymond.hettinger | 2009-06-11 19:08:10 -0300 (Thu, 11 Jun 2009) | 1 line Move comment to correct line. ................ r73376 | benjamin.peterson | 2009-06-11 19:29:23 -0300 (Thu, 11 Jun 2009) | 1 line remove check for case handled in sub-function ................ r73382 | raymond.hettinger | 2009-06-11 20:14:53 -0300 (Thu, 11 Jun 2009) | 1 line Issue 6261: Clarify behavior of random.uniform(). ................ r73390 | martin.v.loewis | 2009-06-12 14:28:31 -0300 (Fri, 12 Jun 2009) | 3 lines Support AMD64 in msilib. Set Win64 on reglocator. Fixes #6258. ................ r73393 | alexandre.vassalotti | 2009-06-12 15:56:57 -0300 (Fri, 12 Jun 2009) | 2 lines Clear reference to the static PyExc_RecursionErrorInst in _PyExc_Fini. ................ r73394 | antoine.pitrou | 2009-06-12 17:14:08 -0300 (Fri, 12 Jun 2009) | 3 lines Issue #6215: backport the 3.1 io lib ................ r73395 | antoine.pitrou | 2009-06-12 17:36:25 -0300 (Fri, 12 Jun 2009) | 4 lines Restore the old test_file.py (for the builtin file object) as a new file named test_file2k.py ................ r73396 | antoine.pitrou | 2009-06-12 17:41:52 -0300 (Fri, 12 Jun 2009) | 4 lines Try to restore the old test_file and test_univnewlines as new, different files (with the right revisions this time, hopefully) ................ r73397 | antoine.pitrou | 2009-06-12 17:54:21 -0300 (Fri, 12 Jun 2009) | 3 lines Re-enable testing of builtin open() in test_bufio in test_largefile ................ r73398 | alexandre.vassalotti | 2009-06-12 17:57:12 -0300 (Fri, 12 Jun 2009) | 3 lines Add const qualifier to PyErr_SetFromErrnoWithFilename and to PyErr_SetFromErrnoWithUnicodeFilename. ................ r73400 | alexandre.vassalotti | 2009-06-12 18:43:47 -0300 (Fri, 12 Jun 2009) | 2 lines Delete outdated make file for building the parser with MSVC 6. ................ r73401 | alexandre.vassalotti | 2009-06-12 18:52:14 -0300 (Fri, 12 Jun 2009) | 2 lines Make pickling of OrderedDict instances more efficient. ................ r73402 | alexandre.vassalotti | 2009-06-12 20:03:35 -0300 (Fri, 12 Jun 2009) | 6 lines Revert r73401 per Raymond Hettinger's request. The rational is the change might cause imcompatiblity problems with PyYAML. In addition, Raymond wants to kept the different versions of collections synchronized across Python versions. ................ r73404 | benjamin.peterson | 2009-06-12 22:40:00 -0300 (Fri, 12 Jun 2009) | 1 line keep the slice.step field as NULL if no step expression is given ................ r73405 | benjamin.peterson | 2009-06-13 00:46:30 -0300 (Sat, 13 Jun 2009) | 1 line prevent import statements from assigning to None ................ r73409 | benjamin.peterson | 2009-06-13 10:06:21 -0300 (Sat, 13 Jun 2009) | 1 line allow importing from a module named None if it has an 'as' clause ................ r73415 | benjamin.peterson | 2009-06-13 11:25:08 -0300 (Sat, 13 Jun 2009) | 1 line use 'rc' for release candidates for consistency ................ r73417 | benjamin.peterson | 2009-06-13 12:42:23 -0300 (Sat, 13 Jun 2009) | 1 line special case release candidates ................ r73418 | benjamin.peterson | 2009-06-13 12:48:04 -0300 (Sat, 13 Jun 2009) | 1 line handle different rc format ................ r73419 | benjamin.peterson | 2009-06-13 13:19:19 -0300 (Sat, 13 Jun 2009) | 1 line set Print.values to NULL if there are no values ................ r73420 | benjamin.peterson | 2009-06-13 14:08:53 -0300 (Sat, 13 Jun 2009) | 1 line give a better error message when deleting () ................ r73421 | benjamin.peterson | 2009-06-13 17:23:33 -0300 (Sat, 13 Jun 2009) | 1 line when no module is given in a 'from' relative import, make ImportFrom.module NULL ................ r73422 | benjamin.peterson | 2009-06-13 17:30:48 -0300 (Sat, 13 Jun 2009) | 1 line update ast version ................ r73423 | hirokazu.yamamoto | 2009-06-14 00:05:54 -0300 (Sun, 14 Jun 2009) | 1 line Updated MSVC files to follow r73394. ................ r73425 | hirokazu.yamamoto | 2009-06-14 00:53:55 -0300 (Sun, 14 Jun 2009) | 2 lines Issue #6271: mmap tried to close invalid file handle (-1) when annonymous. (On Unix) Patch by STINNER Victor. ................ r73432 | amaury.forgeotdarc | 2009-06-14 18:20:40 -0300 (Sun, 14 Jun 2009) | 3 lines #6227: Because of a wrong indentation, the test was not testing what it should. Ensure that the snippet in doctest_aliases actually contains aliases. ................ r73433 | benjamin.peterson | 2009-06-14 19:36:48 -0300 (Sun, 14 Jun 2009) | 1 line backport r73430 ................ r73435 | tarek.ziade | 2009-06-15 20:04:29 -0300 (Mon, 15 Jun 2009) | 1 line code cleanup ................ r73436 | tarek.ziade | 2009-06-15 20:30:13 -0300 (Mon, 15 Jun 2009) | 1 line Issue #6286: distutils upload command now uses urllib2 ................ r73439 | benjamin.peterson | 2009-06-15 21:29:31 -0300 (Mon, 15 Jun 2009) | 1 line don't mask encoding errors when decoding a string #6289 ................ r73441 | tarek.ziade | 2009-06-16 04:29:52 -0300 (Tue, 16 Jun 2009) | 1 line Fixed #6287: documentation for the license field in distutils ................ r73445 | tarek.ziade | 2009-06-16 05:31:01 -0300 (Tue, 16 Jun 2009) | 1 line starting distutils.ccompiler test coverage and cleanup ................ r73447 | georg.brandl | 2009-06-16 14:41:33 -0300 (Tue, 16 Jun 2009) | 1 line Add tabularcolumns directive for tables with bullet lists in them. ................ r73448 | georg.brandl | 2009-06-16 14:43:44 -0300 (Tue, 16 Jun 2009) | 1 line Remove unused macro. ................ r73451 | mark.dickinson | 2009-06-16 17:31:12 -0300 (Tue, 16 Jun 2009) | 1 line Acknowledge the role of the MPFR library in creating cmath_testcases.txt ................ r73457 | benjamin.peterson | 2009-06-16 20:13:09 -0300 (Tue, 16 Jun 2009) | 1 line add underscores ................ r73459 | raymond.hettinger | 2009-06-16 22:43:47 -0300 (Tue, 16 Jun 2009) | 1 line Add usage note. ................ r73460 | benjamin.peterson | 2009-06-17 00:23:04 -0300 (Wed, 17 Jun 2009) | 1 line remove unused 'encoding' member from the compiler struct ................ r73461 | hirokazu.yamamoto | 2009-06-17 04:05:33 -0300 (Wed, 17 Jun 2009) | 1 line Issue #6215: Fixed to use self.open() instead of open() or io.open(). ................ r73462 | georg.brandl | 2009-06-17 06:36:21 -0300 (Wed, 17 Jun 2009) | 1 line #6295: clarify blocking behavior of getch(). ................ r73463 | georg.brandl | 2009-06-17 06:43:31 -0300 (Wed, 17 Jun 2009) | 1 line #6255: document PyInt_FromSize_t. ................ r73465 | nick.coghlan | 2009-06-17 09:12:15 -0300 (Wed, 17 Jun 2009) | 1 line Issue 6288: update the contextlib.nested() docs to explain why it has been deprecated and should generally be avoided ................ r73471 | georg.brandl | 2009-06-18 19:24:26 -0300 (Thu, 18 Jun 2009) | 1 line #6276: Remove usage of nested() in favor of new with statement with multiple managers. ................ r73472 | amaury.forgeotdarc | 2009-06-18 19:32:50 -0300 (Thu, 18 Jun 2009) | 5 lines #6189: The subprocess.py module should be kept compatible with python 2.2 (On windows, you still have to change one line to use pywin32 instead of the _subprocess helper module) ................ r73480 | facundo.batista | 2009-06-19 15:02:28 -0300 (Fri, 19 Jun 2009) | 3 lines Issue #6274. Fixed a potential FD leak in subprocess.py. ................ Added: python/branches/tk_and_idle_maintenance/Lib/_pyio.py - copied unchanged from r73480, /python/trunk/Lib/_pyio.py python/branches/tk_and_idle_maintenance/Lib/distutils/tests/test_ccompiler.py - copied unchanged from r73480, /python/trunk/Lib/distutils/tests/test_ccompiler.py python/branches/tk_and_idle_maintenance/Lib/distutils/tests/test_cygwinccompiler.py - copied unchanged from r73480, /python/trunk/Lib/distutils/tests/test_cygwinccompiler.py python/branches/tk_and_idle_maintenance/Lib/test/test_file2k.py - copied unchanged from r73480, /python/trunk/Lib/test/test_file2k.py python/branches/tk_and_idle_maintenance/Lib/test/test_univnewlines2k.py - copied unchanged from r73480, /python/trunk/Lib/test/test_univnewlines2k.py python/branches/tk_and_idle_maintenance/Modules/_io/ - copied from r73480, /python/trunk/Modules/_io/ Removed: python/branches/tk_and_idle_maintenance/Modules/_bytesio.c python/branches/tk_and_idle_maintenance/Modules/_fileio.c python/branches/tk_and_idle_maintenance/Parser/grammar.mak Modified: python/branches/tk_and_idle_maintenance/ (props changed) python/branches/tk_and_idle_maintenance/Doc/c-api/int.rst python/branches/tk_and_idle_maintenance/Doc/distutils/setupscript.rst python/branches/tk_and_idle_maintenance/Doc/library/bisect.rst python/branches/tk_and_idle_maintenance/Doc/library/cgi.rst python/branches/tk_and_idle_maintenance/Doc/library/contextlib.rst python/branches/tk_and_idle_maintenance/Doc/library/ctypes.rst python/branches/tk_and_idle_maintenance/Doc/library/curses.panel.rst python/branches/tk_and_idle_maintenance/Doc/library/curses.rst python/branches/tk_and_idle_maintenance/Doc/library/fcntl.rst python/branches/tk_and_idle_maintenance/Doc/library/io.rst python/branches/tk_and_idle_maintenance/Doc/library/itertools.rst python/branches/tk_and_idle_maintenance/Doc/library/os.rst python/branches/tk_and_idle_maintenance/Doc/library/pickletools.rst python/branches/tk_and_idle_maintenance/Doc/library/platform.rst python/branches/tk_and_idle_maintenance/Doc/library/random.rst python/branches/tk_and_idle_maintenance/Doc/library/string.rst python/branches/tk_and_idle_maintenance/Doc/library/subprocess.rst python/branches/tk_and_idle_maintenance/Doc/library/ttk.rst python/branches/tk_and_idle_maintenance/Doc/tools/sphinxext/patchlevel.py python/branches/tk_and_idle_maintenance/Doc/whatsnew/2.7.rst python/branches/tk_and_idle_maintenance/Grammar/Grammar python/branches/tk_and_idle_maintenance/Include/pyerrors.h python/branches/tk_and_idle_maintenance/Lib/contextlib.py python/branches/tk_and_idle_maintenance/Lib/distutils/ccompiler.py python/branches/tk_and_idle_maintenance/Lib/distutils/command/bdist_msi.py python/branches/tk_and_idle_maintenance/Lib/distutils/command/upload.py python/branches/tk_and_idle_maintenance/Lib/distutils/cygwinccompiler.py python/branches/tk_and_idle_maintenance/Lib/distutils/sysconfig.py python/branches/tk_and_idle_maintenance/Lib/distutils/tests/test_sysconfig.py python/branches/tk_and_idle_maintenance/Lib/distutils/tests/test_upload.py python/branches/tk_and_idle_maintenance/Lib/filecmp.py python/branches/tk_and_idle_maintenance/Lib/idlelib/EditorWindow.py python/branches/tk_and_idle_maintenance/Lib/io.py python/branches/tk_and_idle_maintenance/Lib/lib2to3/ (props changed) python/branches/tk_and_idle_maintenance/Lib/lib2to3/Grammar.txt python/branches/tk_and_idle_maintenance/Lib/lib2to3/fixer_base.py python/branches/tk_and_idle_maintenance/Lib/lib2to3/fixer_util.py python/branches/tk_and_idle_maintenance/Lib/lib2to3/fixes/fix_apply.py python/branches/tk_and_idle_maintenance/Lib/lib2to3/fixes/fix_basestring.py python/branches/tk_and_idle_maintenance/Lib/lib2to3/fixes/fix_buffer.py python/branches/tk_and_idle_maintenance/Lib/lib2to3/fixes/fix_callable.py python/branches/tk_and_idle_maintenance/Lib/lib2to3/fixes/fix_dict.py python/branches/tk_and_idle_maintenance/Lib/lib2to3/fixes/fix_except.py python/branches/tk_and_idle_maintenance/Lib/lib2to3/fixes/fix_exec.py python/branches/tk_and_idle_maintenance/Lib/lib2to3/fixes/fix_execfile.py python/branches/tk_and_idle_maintenance/Lib/lib2to3/fixes/fix_filter.py python/branches/tk_and_idle_maintenance/Lib/lib2to3/fixes/fix_funcattrs.py python/branches/tk_and_idle_maintenance/Lib/lib2to3/fixes/fix_future.py python/branches/tk_and_idle_maintenance/Lib/lib2to3/fixes/fix_getcwdu.py python/branches/tk_and_idle_maintenance/Lib/lib2to3/fixes/fix_has_key.py python/branches/tk_and_idle_maintenance/Lib/lib2to3/fixes/fix_idioms.py python/branches/tk_and_idle_maintenance/Lib/lib2to3/fixes/fix_import.py python/branches/tk_and_idle_maintenance/Lib/lib2to3/fixes/fix_imports.py python/branches/tk_and_idle_maintenance/Lib/lib2to3/fixes/fix_input.py python/branches/tk_and_idle_maintenance/Lib/lib2to3/fixes/fix_intern.py python/branches/tk_and_idle_maintenance/Lib/lib2to3/fixes/fix_isinstance.py (contents, props changed) python/branches/tk_and_idle_maintenance/Lib/lib2to3/fixes/fix_itertools.py python/branches/tk_and_idle_maintenance/Lib/lib2to3/fixes/fix_itertools_imports.py python/branches/tk_and_idle_maintenance/Lib/lib2to3/fixes/fix_long.py python/branches/tk_and_idle_maintenance/Lib/lib2to3/fixes/fix_map.py python/branches/tk_and_idle_maintenance/Lib/lib2to3/fixes/fix_metaclass.py python/branches/tk_and_idle_maintenance/Lib/lib2to3/fixes/fix_methodattrs.py python/branches/tk_and_idle_maintenance/Lib/lib2to3/fixes/fix_ne.py python/branches/tk_and_idle_maintenance/Lib/lib2to3/fixes/fix_next.py python/branches/tk_and_idle_maintenance/Lib/lib2to3/fixes/fix_nonzero.py python/branches/tk_and_idle_maintenance/Lib/lib2to3/fixes/fix_numliterals.py python/branches/tk_and_idle_maintenance/Lib/lib2to3/fixes/fix_paren.py python/branches/tk_and_idle_maintenance/Lib/lib2to3/fixes/fix_print.py python/branches/tk_and_idle_maintenance/Lib/lib2to3/fixes/fix_raise.py python/branches/tk_and_idle_maintenance/Lib/lib2to3/fixes/fix_raw_input.py python/branches/tk_and_idle_maintenance/Lib/lib2to3/fixes/fix_reduce.py (props changed) python/branches/tk_and_idle_maintenance/Lib/lib2to3/fixes/fix_renames.py python/branches/tk_and_idle_maintenance/Lib/lib2to3/fixes/fix_repr.py python/branches/tk_and_idle_maintenance/Lib/lib2to3/fixes/fix_set_literal.py python/branches/tk_and_idle_maintenance/Lib/lib2to3/fixes/fix_standarderror.py python/branches/tk_and_idle_maintenance/Lib/lib2to3/fixes/fix_sys_exc.py python/branches/tk_and_idle_maintenance/Lib/lib2to3/fixes/fix_throw.py python/branches/tk_and_idle_maintenance/Lib/lib2to3/fixes/fix_tuple_params.py python/branches/tk_and_idle_maintenance/Lib/lib2to3/fixes/fix_types.py python/branches/tk_and_idle_maintenance/Lib/lib2to3/fixes/fix_unicode.py python/branches/tk_and_idle_maintenance/Lib/lib2to3/fixes/fix_urllib.py python/branches/tk_and_idle_maintenance/Lib/lib2to3/fixes/fix_ws_comma.py python/branches/tk_and_idle_maintenance/Lib/lib2to3/fixes/fix_xrange.py python/branches/tk_and_idle_maintenance/Lib/lib2to3/fixes/fix_xreadlines.py python/branches/tk_and_idle_maintenance/Lib/lib2to3/fixes/fix_zip.py python/branches/tk_and_idle_maintenance/Lib/lib2to3/patcomp.py python/branches/tk_and_idle_maintenance/Lib/lib2to3/pytree.py python/branches/tk_and_idle_maintenance/Lib/lib2to3/refactor.py python/branches/tk_and_idle_maintenance/Lib/lib2to3/tests/data/README (props changed) python/branches/tk_and_idle_maintenance/Lib/lib2to3/tests/data/different_encoding.py python/branches/tk_and_idle_maintenance/Lib/lib2to3/tests/data/fixers/myfixes/fix_parrot.py python/branches/tk_and_idle_maintenance/Lib/lib2to3/tests/data/py2_test_grammar.py python/branches/tk_and_idle_maintenance/Lib/lib2to3/tests/data/py3_test_grammar.py python/branches/tk_and_idle_maintenance/Lib/lib2to3/tests/pytree_idempotency.py python/branches/tk_and_idle_maintenance/Lib/lib2to3/tests/support.py python/branches/tk_and_idle_maintenance/Lib/lib2to3/tests/test_all_fixers.py python/branches/tk_and_idle_maintenance/Lib/lib2to3/tests/test_fixers.py python/branches/tk_and_idle_maintenance/Lib/lib2to3/tests/test_parser.py python/branches/tk_and_idle_maintenance/Lib/lib2to3/tests/test_pytree.py python/branches/tk_and_idle_maintenance/Lib/lib2to3/tests/test_util.py python/branches/tk_and_idle_maintenance/Lib/logging/handlers.py python/branches/tk_and_idle_maintenance/Lib/msilib/__init__.py python/branches/tk_and_idle_maintenance/Lib/multiprocessing/queues.py python/branches/tk_and_idle_maintenance/Lib/os.py python/branches/tk_and_idle_maintenance/Lib/random.py python/branches/tk_and_idle_maintenance/Lib/subprocess.py python/branches/tk_and_idle_maintenance/Lib/symbol.py python/branches/tk_and_idle_maintenance/Lib/test/cmath_testcases.txt python/branches/tk_and_idle_maintenance/Lib/test/doctest_aliases.py python/branches/tk_and_idle_maintenance/Lib/test/formatfloat_testcases.txt python/branches/tk_and_idle_maintenance/Lib/test/test_ast.py python/branches/tk_and_idle_maintenance/Lib/test/test_bufio.py python/branches/tk_and_idle_maintenance/Lib/test/test_coding.py python/branches/tk_and_idle_maintenance/Lib/test/test_compile.py python/branches/tk_and_idle_maintenance/Lib/test/test_curses.py python/branches/tk_and_idle_maintenance/Lib/test/test_doctest.py python/branches/tk_and_idle_maintenance/Lib/test/test_file.py python/branches/tk_and_idle_maintenance/Lib/test/test_fileio.py python/branches/tk_and_idle_maintenance/Lib/test/test_generators.py python/branches/tk_and_idle_maintenance/Lib/test/test_genexps.py python/branches/tk_and_idle_maintenance/Lib/test/test_io.py python/branches/tk_and_idle_maintenance/Lib/test/test_largefile.py python/branches/tk_and_idle_maintenance/Lib/test/test_memoryio.py python/branches/tk_and_idle_maintenance/Lib/test/test_signal.py python/branches/tk_and_idle_maintenance/Lib/test/test_support.py python/branches/tk_and_idle_maintenance/Lib/test/test_syntax.py python/branches/tk_and_idle_maintenance/Lib/test/test_univnewlines.py python/branches/tk_and_idle_maintenance/Lib/test/test_winreg.py python/branches/tk_and_idle_maintenance/Makefile.pre.in python/branches/tk_and_idle_maintenance/Misc/NEWS python/branches/tk_and_idle_maintenance/Modules/audioop.c python/branches/tk_and_idle_maintenance/Modules/mmapmodule.c python/branches/tk_and_idle_maintenance/Objects/exceptions.c python/branches/tk_and_idle_maintenance/Objects/floatobject.c python/branches/tk_and_idle_maintenance/PC/VC6/pythoncore.dsp python/branches/tk_and_idle_maintenance/PC/VS7.1/pythoncore.vcproj python/branches/tk_and_idle_maintenance/PC/VS8.0/pythoncore.vcproj python/branches/tk_and_idle_maintenance/PC/_winreg.c python/branches/tk_and_idle_maintenance/PC/config.c python/branches/tk_and_idle_maintenance/PCbuild/pythoncore.vcproj python/branches/tk_and_idle_maintenance/Parser/Python.asdl python/branches/tk_and_idle_maintenance/Parser/asdl.py python/branches/tk_and_idle_maintenance/Parser/asdl_c.py python/branches/tk_and_idle_maintenance/Parser/tokenizer.c python/branches/tk_and_idle_maintenance/Python/Python-ast.c python/branches/tk_and_idle_maintenance/Python/ast.c python/branches/tk_and_idle_maintenance/Python/compile.c python/branches/tk_and_idle_maintenance/Python/errors.c python/branches/tk_and_idle_maintenance/Tools/msi/msi.py python/branches/tk_and_idle_maintenance/configure python/branches/tk_and_idle_maintenance/configure.in python/branches/tk_and_idle_maintenance/setup.py Modified: python/branches/tk_and_idle_maintenance/Doc/c-api/int.rst ============================================================================== --- python/branches/tk_and_idle_maintenance/Doc/c-api/int.rst (original) +++ python/branches/tk_and_idle_maintenance/Doc/c-api/int.rst Sat Jun 20 00:11:15 2009 @@ -68,6 +68,15 @@ .. cfunction:: PyObject* PyInt_FromSsize_t(Py_ssize_t ival) + Create a new integer object with a value of *ival*. If the value is larger + than ``LONG_MAX`` or smaller than ``LONG_MIN``, a long integer object is + returned. + + .. versionadded:: 2.5 + + +.. cfunction:: PyObject* PyInt_FromSize_t(size_t ival) + Create a new integer object with a value of *ival*. If the value exceeds ``LONG_MAX``, a long integer object is returned. Modified: python/branches/tk_and_idle_maintenance/Doc/distutils/setupscript.rst ============================================================================== --- python/branches/tk_and_idle_maintenance/Doc/distutils/setupscript.rst (original) +++ python/branches/tk_and_idle_maintenance/Doc/distutils/setupscript.rst Sat Jun 20 00:11:15 2009 @@ -590,6 +590,8 @@ +----------------------+---------------------------+-----------------+--------+ | ``platforms`` | a list of platforms | list of strings | | +----------------------+---------------------------+-----------------+--------+ +| ``license`` | license for the package | short string | \(6) | ++----------------------+---------------------------+-----------------+--------+ Notes: @@ -611,6 +613,13 @@ The ``long_description`` field is used by PyPI when you are registering a package, to build its home page. +(6) + The ``license`` field is a text indicating the license covering the + package where the license is not a selection from the "License" Trove + classifiers. See the ``Classifier`` field. Notice that + there's a ``licence`` distribution option which is deprecated but still + acts as an alias for ``license``. + 'short string' A single line of text, not more than 200 characters. Modified: python/branches/tk_and_idle_maintenance/Doc/library/bisect.rst ============================================================================== --- python/branches/tk_and_idle_maintenance/Doc/library/bisect.rst (original) +++ python/branches/tk_and_idle_maintenance/Doc/library/bisect.rst Sat Jun 20 00:11:15 2009 @@ -85,4 +85,22 @@ >>> map(grade, [33, 99, 77, 44, 12, 88]) ['E', 'A', 'B', 'D', 'F', 'A'] +Unlike the :func:`sorted` function, it does not make sense for the :func:`bisect` +functions to have *key* or *reversed* arguments because that would lead to an +inefficent design (successive calls to bisect functions would not "remember" +all of the previous key lookups). +Instead, it is better to search a list of precomputed keys to find the index +of the record in question:: + + >>> data = [('red', 5), ('blue', 1), ('yellow', 8), ('black', 0)] + >>> data.sort(key=lambda r: r[1]) + >>> keys = [r[1] for r in data] # precomputed list of keys + >>> data[bisect_left(keys, 0)] + ('black', 0) + >>> data[bisect_left(keys, 1)] + ('blue', 1) + >>> data[bisect_left(keys, 5)] + ('red', 5) + >>> data[bisect_left(keys, 8)] + ('yellow', 8) Modified: python/branches/tk_and_idle_maintenance/Doc/library/cgi.rst ============================================================================== --- python/branches/tk_and_idle_maintenance/Doc/library/cgi.rst (original) +++ python/branches/tk_and_idle_maintenance/Doc/library/cgi.rst Sat Jun 20 00:11:15 2009 @@ -1,6 +1,5 @@ - -:mod:`cgi` --- Common Gateway Interface support. -================================================ +:mod:`cgi` --- Common Gateway Interface support +=============================================== .. module:: cgi :synopsis: Helpers for running Python scripts via the Common Gateway Interface. Modified: python/branches/tk_and_idle_maintenance/Doc/library/contextlib.rst ============================================================================== --- python/branches/tk_and_idle_maintenance/Doc/library/contextlib.rst (original) +++ python/branches/tk_and_idle_maintenance/Doc/library/contextlib.rst Sat Jun 20 00:11:15 2009 @@ -1,6 +1,5 @@ - -:mod:`contextlib` --- Utilities for :keyword:`with`\ -statement contexts. -========================================================================= +:mod:`contextlib` --- Utilities for :keyword:`with`\ -statement contexts +======================================================================== .. module:: contextlib :synopsis: Utilities for with-statement contexts. @@ -59,21 +58,18 @@ Combine multiple context managers into a single nested context manager. - Code like this:: + This function has been deprecated in favour of the multiple manager form + of the :keyword:`with` statement. + + The one advantage of this function over the multiple manager form of the + :keyword:`with` statement is that argument unpacking allows it to be + used with a variable number of context managers as follows:: from contextlib import nested - with nested(A(), B(), C()) as (X, Y, Z): + with nested(*managers): do_something() - is equivalent to this:: - - m1, m2, m3 = A(), B(), C() - with m1 as X: - with m2 as Y: - with m3 as Z: - do_something() - Note that if the :meth:`__exit__` method of one of the nested context managers indicates an exception should be suppressed, no exception information will be passed to any remaining outer context managers. Similarly, if the @@ -83,8 +79,28 @@ :meth:`__exit__` methods should avoid raising exceptions, and in particular they should not re-raise a passed-in exception. + This function has two major quirks that have led to it being deprecated. Firstly, + as the context managers are all constructed before the function is invoked, the + :meth:`__new__` and :meth:`__init__` methods of the inner context managers are + not actually covered by the scope of the outer context managers. That means, for + example, that using :func:`nested` to open two files is a programming error as the + first file will not be closed promptly if an exception is thrown when opening + the second file. + + Secondly, if the :meth:`__enter__` method of one of the inner context managers + raises an exception that is caught and suppressed by the :meth:`__exit__` method + of one of the outer context managers, this construct will raise + :exc:`RuntimeError` rather than skipping the body of the :keyword:`with` + statement. + + Developers that need to support nesting of a variable number of context managers + can either use the :mod:`warnings` module to suppress the DeprecationWarning + raised by this function or else use this function as a model for an application + specific implementation. + .. deprecated:: 2.7 - The with-statement now supports this functionality directly. + The with-statement now supports this functionality directly (without the + confusing error prone quirks). .. function:: closing(thing) Modified: python/branches/tk_and_idle_maintenance/Doc/library/ctypes.rst ============================================================================== --- python/branches/tk_and_idle_maintenance/Doc/library/ctypes.rst (original) +++ python/branches/tk_and_idle_maintenance/Doc/library/ctypes.rst Sat Jun 20 00:11:15 2009 @@ -1,6 +1,5 @@ - -:mod:`ctypes` --- A foreign function library for Python. -======================================================== +:mod:`ctypes` --- A foreign function library for Python +======================================================= .. module:: ctypes :synopsis: A foreign function library for Python. Modified: python/branches/tk_and_idle_maintenance/Doc/library/curses.panel.rst ============================================================================== --- python/branches/tk_and_idle_maintenance/Doc/library/curses.panel.rst (original) +++ python/branches/tk_and_idle_maintenance/Doc/library/curses.panel.rst Sat Jun 20 00:11:15 2009 @@ -1,6 +1,5 @@ - -:mod:`curses.panel` --- A panel stack extension for curses. -=========================================================== +:mod:`curses.panel` --- A panel stack extension for curses +========================================================== .. module:: curses.panel :synopsis: A panel stack extension that adds depth to curses windows. Modified: python/branches/tk_and_idle_maintenance/Doc/library/curses.rst ============================================================================== --- python/branches/tk_and_idle_maintenance/Doc/library/curses.rst (original) +++ python/branches/tk_and_idle_maintenance/Doc/library/curses.rst Sat Jun 20 00:11:15 2009 @@ -796,7 +796,8 @@ Get a character. Note that the integer returned does *not* have to be in ASCII range: function keys, keypad keys and so on return numbers higher than 256. In - no-delay mode, -1 is returned if there is no input. + no-delay mode, -1 is returned if there is no input, else :func:`getch` waits + until a key is pressed. .. method:: window.getkey([y, x]) Modified: python/branches/tk_and_idle_maintenance/Doc/library/fcntl.rst ============================================================================== --- python/branches/tk_and_idle_maintenance/Doc/library/fcntl.rst (original) +++ python/branches/tk_and_idle_maintenance/Doc/library/fcntl.rst Sat Jun 20 00:11:15 2009 @@ -151,7 +151,6 @@ Module :mod:`os` If the locking flags :const:`O_SHLOCK` and :const:`O_EXLOCK` are present - in the :mod:`os` module, the :func:`os.open` function provides a more - platform-independent alternative to the :func:`lockf` and :func:`flock` - functions. + in the :mod:`os` module (on BSD only), the :func:`os.open` function + provides an alternative to the :func:`lockf` and :func:`flock` functions. Modified: python/branches/tk_and_idle_maintenance/Doc/library/io.rst ============================================================================== --- python/branches/tk_and_idle_maintenance/Doc/library/io.rst (original) +++ python/branches/tk_and_idle_maintenance/Doc/library/io.rst Sat Jun 20 00:11:15 2009 @@ -573,6 +573,10 @@ The name of the encoding used to decode the stream's bytes into strings, and to encode strings into bytes. + .. attribute:: errors + + The error setting of the decoder or encoder. + .. attribute:: newlines A string, a tuple of strings, or ``None``, indicating the newlines @@ -625,13 +629,9 @@ If *line_buffering* is ``True``, :meth:`flush` is implied when a call to write contains a newline character. - :class:`TextIOWrapper` provides these data attributes in addition to those of + :class:`TextIOWrapper` provides one attribute in addition to those of :class:`TextIOBase` and its parents: - .. attribute:: errors - - The encoding and decoding error setting. - .. attribute:: line_buffering Whether line buffering is enabled. Modified: python/branches/tk_and_idle_maintenance/Doc/library/itertools.rst ============================================================================== --- python/branches/tk_and_idle_maintenance/Doc/library/itertools.rst (original) +++ python/branches/tk_and_idle_maintenance/Doc/library/itertools.rst Sat Jun 20 00:11:15 2009 @@ -245,6 +245,10 @@ yield n n += step + When counting with floating point numbers, better accuracy can sometimes be + achieved by substituting multiplicative code such as: ``(start + step * i + for i in count())``. + .. versionchanged:: 2.7 added *step* argument and allowed non-integer arguments. Modified: python/branches/tk_and_idle_maintenance/Doc/library/os.rst ============================================================================== --- python/branches/tk_and_idle_maintenance/Doc/library/os.rst (original) +++ python/branches/tk_and_idle_maintenance/Doc/library/os.rst Sat Jun 20 00:11:15 2009 @@ -1715,8 +1715,8 @@ (Note that the :mod:`subprocess` module provides more powerful facilities for spawning new processes and retrieving their results; using that module is - preferable to using these functions. Check specially the *Replacing Older - Functions with the subprocess Module* section in that documentation page.) + preferable to using these functions. Check especially the + :ref:`subprocess-replacements` section.) If *mode* is :const:`P_NOWAIT`, this function returns the process id of the new process; if *mode* is :const:`P_WAIT`, returns the process's exit code if it Modified: python/branches/tk_and_idle_maintenance/Doc/library/pickletools.rst ============================================================================== --- python/branches/tk_and_idle_maintenance/Doc/library/pickletools.rst (original) +++ python/branches/tk_and_idle_maintenance/Doc/library/pickletools.rst Sat Jun 20 00:11:15 2009 @@ -1,6 +1,5 @@ - -:mod:`pickletools` --- Tools for pickle developers. -=================================================== +:mod:`pickletools` --- Tools for pickle developers +================================================== .. module:: pickletools :synopsis: Contains extensive comments about the pickle protocols and pickle-machine Modified: python/branches/tk_and_idle_maintenance/Doc/library/platform.rst ============================================================================== --- python/branches/tk_and_idle_maintenance/Doc/library/platform.rst (original) +++ python/branches/tk_and_idle_maintenance/Doc/library/platform.rst Sat Jun 20 00:11:15 2009 @@ -1,6 +1,5 @@ - -:mod:`platform` --- Access to underlying platform's identifying data. -====================================================================== +:mod:`platform` --- Access to underlying platform's identifying data +===================================================================== .. module:: platform :synopsis: Retrieves as much platform identifying data as possible. Modified: python/branches/tk_and_idle_maintenance/Doc/library/random.rst ============================================================================== --- python/branches/tk_and_idle_maintenance/Doc/library/random.rst (original) +++ python/branches/tk_and_idle_maintenance/Doc/library/random.rst Sat Jun 20 00:11:15 2009 @@ -191,6 +191,8 @@ Return a random floating point number *N* such that ``a <= N <= b`` for ``a <= b`` and ``b <= N <= a`` for ``b < a``. + The end-point value ``b`` may or may not be included in the range + depending on floating-point rounding in the equation ``a + (b-a) * random()``. .. function:: triangular(low, high, mode) Modified: python/branches/tk_and_idle_maintenance/Doc/library/string.rst ============================================================================== --- python/branches/tk_and_idle_maintenance/Doc/library/string.rst (original) +++ python/branches/tk_and_idle_maintenance/Doc/library/string.rst Sat Jun 20 00:11:15 2009 @@ -829,14 +829,15 @@ Return a copy of *s*, but with lower case letters converted to upper case. -.. function:: ljust(s, width) - rjust(s, width) - center(s, width) +.. function:: ljust(s, width[, fillchar]) + rjust(s, width[, fillchar]) + center(s, width[, fillchar]) These functions respectively left-justify, right-justify and center a string in a field of given width. They return a string that is at least *width* - characters wide, created by padding the string *s* with spaces until the given - width on the right, left or both sides. The string is never truncated. + characters wide, created by padding the string *s* with the character *fillchar* + (default is a space) until the given width on the right, left or both sides. + The string is never truncated. .. function:: zfill(s, width) Modified: python/branches/tk_and_idle_maintenance/Doc/library/subprocess.rst ============================================================================== --- python/branches/tk_and_idle_maintenance/Doc/library/subprocess.rst (original) +++ python/branches/tk_and_idle_maintenance/Doc/library/subprocess.rst Sat Jun 20 00:11:15 2009 @@ -392,8 +392,8 @@ output = p2.communicate()[0] -Replacing os.system() -^^^^^^^^^^^^^^^^^^^^^ +Replacing :func:`os.system` +^^^^^^^^^^^^^^^^^^^^^^^^^^^ :: @@ -420,8 +420,8 @@ print >>sys.stderr, "Execution failed:", e -Replacing the os.spawn family -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +Replacing the :func:`os.spawn ` family +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ P_NOWAIT example:: @@ -448,8 +448,8 @@ Popen(["/bin/mycmd", "myarg"], env={"PATH": "/usr/bin"}) -Replacing os.popen, os.popen2, os.popen3 -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +Replacing :func:`os.popen`, :func:`os.popen2`, :func:`os.popen3` +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ :: @@ -491,9 +491,23 @@ stdin=PIPE, stdout=PIPE, stderr=STDOUT, close_fds=True) (child_stdin, child_stdout_and_stderr) = (p.stdin, p.stdout) +Return code handling translates as follows:: -Replacing functions from the popen2 module -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + pipe = os.popen(cmd, 'w') + ... + rc = pipe.close() + if rc != None and rc % 256: + print "There were some errors" + ==> + process = Popen(cmd, 'w', stdin=PIPE) + ... + process.stdin.close() + if process.wait() != 0: + print "There were some errors" + + +Replacing functions from the :mod:`popen2` module +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ .. note:: Modified: python/branches/tk_and_idle_maintenance/Doc/library/ttk.rst ============================================================================== --- python/branches/tk_and_idle_maintenance/Doc/library/ttk.rst (original) +++ python/branches/tk_and_idle_maintenance/Doc/library/ttk.rst Sat Jun 20 00:11:15 2009 @@ -160,6 +160,9 @@ The following options are supported by labels, buttons and other button-like widgets. +.. tabularcolumns:: |p{0.2\textwidth}|p{0.7\textwidth}| +.. + +--------------+-----------------------------------------------------------+ | option | description | +==============+===========================================================+ @@ -701,6 +704,9 @@ This widget accepts the following specific options: +.. tabularcolumns:: |p{0.2\textwidth}|p{0.7\textwidth}| +.. + +----------------+--------------------------------------------------------+ | option | description | +================+========================================================+ Modified: python/branches/tk_and_idle_maintenance/Doc/tools/sphinxext/patchlevel.py ============================================================================== --- python/branches/tk_and_idle_maintenance/Doc/tools/sphinxext/patchlevel.py (original) +++ python/branches/tk_and_idle_maintenance/Doc/tools/sphinxext/patchlevel.py Sat Jun 20 00:11:15 2009 @@ -41,7 +41,7 @@ suffixes = { 'PY_RELEASE_LEVEL_ALPHA': 'a', 'PY_RELEASE_LEVEL_BETA': 'b', - 'PY_RELEASE_LEVEL_GAMMA': 'c', + 'PY_RELEASE_LEVEL_GAMMA': 'rc', } if level != 'PY_RELEASE_LEVEL_FINAL': release += suffixes[level] + str(int(d['PY_RELEASE_SERIAL'])) Modified: python/branches/tk_and_idle_maintenance/Doc/whatsnew/2.7.rst ============================================================================== --- python/branches/tk_and_idle_maintenance/Doc/whatsnew/2.7.rst (original) +++ python/branches/tk_and_idle_maintenance/Doc/whatsnew/2.7.rst Sat Jun 20 00:11:15 2009 @@ -669,7 +669,11 @@ This section lists previously described changes and other bugfixes that may require changes to your code: -To be written. +* Because of an optimization for the :keyword:`with` statement, the special + methods :meth:`__enter__` and :meth:`__exit__` must belong to the object's + type, and cannot be directly attached to the object's instance. This + affects new-style classes (derived from :class:`object`) and C extension + types. (:issue:`6101`.) .. ====================================================================== Modified: python/branches/tk_and_idle_maintenance/Grammar/Grammar ============================================================================== --- python/branches/tk_and_idle_maintenance/Grammar/Grammar (original) +++ python/branches/tk_and_idle_maintenance/Grammar/Grammar Sat Jun 20 00:11:15 2009 @@ -133,7 +133,9 @@ arglist: (argument ',')* (argument [','] |'*' test (',' argument)* [',' '**' test] |'**' test) -argument: test [gen_for] | test '=' test # Really [keyword '='] test +# The reason that keywords are test nodes instead of NAME is that using NAME +# results in an ambiguity. ast.c makes sure it's a NAME. +argument: test [gen_for] | test '=' test list_iter: list_for | list_if list_for: 'for' exprlist 'in' testlist_safe [list_iter] Modified: python/branches/tk_and_idle_maintenance/Include/pyerrors.h ============================================================================== --- python/branches/tk_and_idle_maintenance/Include/pyerrors.h (original) +++ python/branches/tk_and_idle_maintenance/Include/pyerrors.h Sat Jun 20 00:11:15 2009 @@ -185,10 +185,11 @@ PyAPI_FUNC(PyObject *) PyErr_SetFromErrno(PyObject *); PyAPI_FUNC(PyObject *) PyErr_SetFromErrnoWithFilenameObject( PyObject *, PyObject *); -PyAPI_FUNC(PyObject *) PyErr_SetFromErrnoWithFilename(PyObject *, char *); +PyAPI_FUNC(PyObject *) PyErr_SetFromErrnoWithFilename( + PyObject *, const char *); #ifdef MS_WINDOWS PyAPI_FUNC(PyObject *) PyErr_SetFromErrnoWithUnicodeFilename( - PyObject *, Py_UNICODE *); + PyObject *, const Py_UNICODE *); #endif /* MS_WINDOWS */ PyAPI_FUNC(PyObject *) PyErr_Format(PyObject *, const char *, ...) Modified: python/branches/tk_and_idle_maintenance/Lib/contextlib.py ============================================================================== --- python/branches/tk_and_idle_maintenance/Lib/contextlib.py (original) +++ python/branches/tk_and_idle_maintenance/Lib/contextlib.py Sat Jun 20 00:11:15 2009 @@ -103,7 +103,7 @@ """ warn("With-statements now directly support multiple context managers", - DeprecationWarning, 2) + DeprecationWarning, 3) exits = [] vars = [] exc = (None, None, None) Modified: python/branches/tk_and_idle_maintenance/Lib/distutils/ccompiler.py ============================================================================== --- python/branches/tk_and_idle_maintenance/Lib/distutils/ccompiler.py (original) +++ python/branches/tk_and_idle_maintenance/Lib/distutils/ccompiler.py Sat Jun 20 00:11:15 2009 @@ -1217,27 +1217,27 @@ return pp_opts -# gen_preprocess_options () - -def gen_lib_options (compiler, library_dirs, runtime_library_dirs, libraries): +def gen_lib_options(compiler, library_dirs, runtime_library_dirs, libraries): """Generate linker options for searching library directories and - linking with specific libraries. 'libraries' and 'library_dirs' are, - respectively, lists of library names (not filenames!) and search - directories. Returns a list of command-line options suitable for use - with some compiler (depending on the two format strings passed in). + linking with specific libraries. + + 'libraries' and 'library_dirs' are, respectively, lists of library names + (not filenames!) and search directories. Returns a list of command-line + options suitable for use with some compiler (depending on the two format + strings passed in). """ lib_opts = [] for dir in library_dirs: - lib_opts.append (compiler.library_dir_option (dir)) + lib_opts.append(compiler.library_dir_option(dir)) for dir in runtime_library_dirs: - opt = compiler.runtime_library_dir_option (dir) - if type(opt) is ListType: - lib_opts = lib_opts + opt + opt = compiler.runtime_library_dir_option(dir) + if isinstance(opt, list): + lib_opts.extend(opt) else: - lib_opts.append (opt) + lib_opts.append(opt) # XXX it's important that we *not* remove redundant library mentions! # sometimes you really do have to say "-lfoo -lbar -lfoo" in order to @@ -1246,17 +1246,15 @@ # pretty nasty way to arrange your C code. for lib in libraries: - (lib_dir, lib_name) = os.path.split (lib) - if lib_dir: - lib_file = compiler.find_library_file ([lib_dir], lib_name) - if lib_file: - lib_opts.append (lib_file) + lib_dir, lib_name = os.path.split(lib) + if lib_dir != '': + lib_file = compiler.find_library_file([lib_dir], lib_name) + if lib_file is not None: + lib_opts.append(lib_file) else: - compiler.warn ("no library file corresponding to " - "'%s' found (skipping)" % lib) + compiler.warn("no library file corresponding to " + "'%s' found (skipping)" % lib) else: - lib_opts.append (compiler.library_option (lib)) + lib_opts.append(compiler.library_option(lib)) return lib_opts - -# gen_lib_options () Modified: python/branches/tk_and_idle_maintenance/Lib/distutils/command/bdist_msi.py ============================================================================== --- python/branches/tk_and_idle_maintenance/Lib/distutils/command/bdist_msi.py (original) +++ python/branches/tk_and_idle_maintenance/Lib/distutils/command/bdist_msi.py Sat Jun 20 00:11:15 2009 @@ -342,9 +342,14 @@ exe_action = "PythonExe" + ver target_dir_prop = "TARGETDIR" + ver exe_prop = "PYTHON" + ver + if msilib.Win64: + # type: msidbLocatorTypeRawValue + msidbLocatorType64bit + Type = 2+16 + else: + Type = 2 add_data(self.db, "RegLocator", - [(machine_reg, 2, install_path, None, 2), - (user_reg, 1, install_path, None, 2)]) + [(machine_reg, 2, install_path, None, Type), + (user_reg, 1, install_path, None, Type)]) add_data(self.db, "AppSearch", [(machine_prop, machine_reg), (user_prop, user_reg)]) Modified: python/branches/tk_and_idle_maintenance/Lib/distutils/command/upload.py ============================================================================== --- python/branches/tk_and_idle_maintenance/Lib/distutils/command/upload.py (original) +++ python/branches/tk_and_idle_maintenance/Lib/distutils/command/upload.py Sat Jun 20 00:11:15 2009 @@ -1,26 +1,21 @@ """distutils.command.upload Implements the Distutils 'upload' subcommand (upload package to PyPI).""" - -from distutils.errors import * -from distutils.core import PyPIRCCommand -from distutils.spawn import spawn -from distutils import log import sys import os import socket import platform -import httplib +from urllib2 import urlopen, Request, HTTPError import base64 import urlparse import cStringIO as StringIO from ConfigParser import ConfigParser +from hashlib import md5 -# this keeps compatibility for 2.3 and 2.4 -if sys.version < "2.5": - from md5 import md5 -else: - from hashlib import md5 +from distutils.errors import * +from distutils.core import PyPIRCCommand +from distutils.spawn import spawn +from distutils import log class upload(PyPIRCCommand): @@ -67,6 +62,15 @@ self.upload_file(command, pyversion, filename) def upload_file(self, command, pyversion, filename): + # Makes sure the repository URL is compliant + schema, netloc, url, params, query, fragments = \ + urlparse.urlparse(self.repository) + if params or query or fragments: + raise AssertionError("Incompatible url %s" % self.repository) + + if schema not in ('http', 'https'): + raise AssertionError("unsupported schema " + schema) + # Sign if requested if self.sign: gpg_args = ["gpg", "--detach-sign", "-a", filename] @@ -125,7 +129,8 @@ open(filename+".asc").read()) # set up the authentication - auth = "Basic " + base64.encodestring(self.username + ":" + self.password).strip() + auth = "Basic " + base64.encodestring(self.username + ":" + + self.password).strip() # Build up the MIME payload for the POST data boundary = '--------------GHSKFJDLGDS7543FJKLFHRE75642756743254' @@ -134,10 +139,10 @@ body = StringIO.StringIO() for key, value in data.items(): # handle multiple entries for the same name - if type(value) != type([]): + if not isinstance(value, list): value = [value] for value in value: - if type(value) is tuple: + if isinstance(value, tuple): fn = ';filename="%s"' % value[0] value = value[1] else: @@ -157,39 +162,30 @@ self.announce("Submitting %s to %s" % (filename, self.repository), log.INFO) # build the Request - # We can't use urllib2 since we need to send the Basic - # auth right with the first request - schema, netloc, url, params, query, fragments = \ - urlparse.urlparse(self.repository) - assert not params and not query and not fragments - if schema == 'http': - http = httplib.HTTPConnection(netloc) - elif schema == 'https': - http = httplib.HTTPSConnection(netloc) - else: - raise AssertionError, "unsupported schema "+schema - - data = '' - loglevel = log.INFO + headers = {'Content-type': + 'multipart/form-data; boundary=%s' % boundary, + 'Content-length': str(len(body)), + 'Authorization': auth} + + request = Request(self.repository, data=body, + headers=headers) + # send the data try: - http.connect() - http.putrequest("POST", url) - http.putheader('Content-type', - 'multipart/form-data; boundary=%s'%boundary) - http.putheader('Content-length', str(len(body))) - http.putheader('Authorization', auth) - http.endheaders() - http.send(body) + result = urlopen(request) + status = result.getcode() + reason = result.msg except socket.error, e: self.announce(str(e), log.ERROR) return + except HTTPError, e: + status = e.code + reason = e.msg - r = http.getresponse() - if r.status == 200: - self.announce('Server response (%s): %s' % (r.status, r.reason), + if status == 200: + self.announce('Server response (%s): %s' % (status, reason), log.INFO) else: - self.announce('Upload failed (%s): %s' % (r.status, r.reason), + self.announce('Upload failed (%s): %s' % (status, reason), log.ERROR) if self.show_response: - self.announce('-'*75, r.read(), '-'*75) + self.announce('-'*75, result.read(), '-'*75) Modified: python/branches/tk_and_idle_maintenance/Lib/distutils/cygwinccompiler.py ============================================================================== --- python/branches/tk_and_idle_maintenance/Lib/distutils/cygwinccompiler.py (original) +++ python/branches/tk_and_idle_maintenance/Lib/distutils/cygwinccompiler.py Sat Jun 20 00:11:15 2009 @@ -47,12 +47,19 @@ __revision__ = "$Id$" -import os,sys,copy +import os +import sys +import copy +from subprocess import Popen, PIPE +import re + from distutils.ccompiler import gen_preprocess_options, gen_lib_options from distutils.unixccompiler import UnixCCompiler from distutils.file_util import write_file from distutils.errors import DistutilsExecError, CompileError, UnknownFileError from distutils import log +from distutils.version import LooseVersion +from distutils.spawn import find_executable def get_msvcr(): """Include the appropriate MSVC runtime library if Python was built @@ -74,11 +81,12 @@ # VS2008 / MSVC 9.0 return ['msvcr90'] else: - raise ValueError("Unknown MS Compiler version %i " % msc_Ver) - + raise ValueError("Unknown MS Compiler version %s " % msc_ver) -class CygwinCCompiler (UnixCCompiler): +class CygwinCCompiler(UnixCCompiler): + """ Handles the Cygwin port of the GNU C compiler to Windows. + """ compiler_type = 'cygwin' obj_extension = ".o" static_lib_extension = ".a" @@ -87,11 +95,11 @@ shared_lib_format = "%s%s" exe_extension = ".exe" - def __init__ (self, verbose=0, dry_run=0, force=0): + def __init__(self, verbose=0, dry_run=0, force=0): - UnixCCompiler.__init__ (self, verbose, dry_run, force) + UnixCCompiler.__init__(self, verbose, dry_run, force) - (status, details) = check_config_h() + status, details = check_config_h() self.debug_print("Python's GCC status: %s (details: %s)" % (status, details)) if status is not CONFIG_H_OK: @@ -146,10 +154,8 @@ # with MSVC 7.0 or later. self.dll_libraries = get_msvcr() - # __init__ () - - def _compile(self, obj, src, ext, cc_args, extra_postargs, pp_opts): + """Compiles the source by spawing GCC and windres if needed.""" if ext == '.rc' or ext == '.res': # gcc needs '.res' and '.rc' compiled to object files !!! try: @@ -163,21 +169,11 @@ except DistutilsExecError, msg: raise CompileError, msg - def link (self, - target_desc, - objects, - output_filename, - output_dir=None, - libraries=None, - library_dirs=None, - runtime_library_dirs=None, - export_symbols=None, - debug=0, - extra_preargs=None, - extra_postargs=None, - build_temp=None, - target_lang=None): - + def link(self, target_desc, objects, output_filename, output_dir=None, + libraries=None, library_dirs=None, runtime_library_dirs=None, + export_symbols=None, debug=0, extra_preargs=None, + extra_postargs=None, build_temp=None, target_lang=None): + """Link the objects.""" # use separate copies, so we can modify the lists extra_preargs = copy.copy(extra_preargs or []) libraries = copy.copy(libraries or []) @@ -242,64 +238,44 @@ if not debug: extra_preargs.append("-s") - UnixCCompiler.link(self, - target_desc, - objects, - output_filename, - output_dir, - libraries, - library_dirs, + UnixCCompiler.link(self, target_desc, objects, output_filename, + output_dir, libraries, library_dirs, runtime_library_dirs, None, # export_symbols, we do this in our def-file - debug, - extra_preargs, - extra_postargs, - build_temp, + debug, extra_preargs, extra_postargs, build_temp, target_lang) - # link () - # -- Miscellaneous methods ----------------------------------------- - # overwrite the one from CCompiler to support rc and res-files - def object_filenames (self, - source_filenames, - strip_dir=0, - output_dir=''): - if output_dir is None: output_dir = '' + def object_filenames(self, source_filenames, strip_dir=0, output_dir=''): + """Adds supports for rc and res files.""" + if output_dir is None: + output_dir = '' obj_names = [] for src_name in source_filenames: # use normcase to make sure '.rc' is really '.rc' and not '.RC' - (base, ext) = os.path.splitext (os.path.normcase(src_name)) + base, ext = os.path.splitext(os.path.normcase(src_name)) if ext not in (self.src_extensions + ['.rc','.res']): raise UnknownFileError, \ - "unknown file type '%s' (from '%s')" % \ - (ext, src_name) + "unknown file type '%s' (from '%s')" % (ext, src_name) if strip_dir: base = os.path.basename (base) - if ext == '.res' or ext == '.rc': + if ext in ('.res', '.rc'): # these need to be compiled to object files - obj_names.append (os.path.join (output_dir, - base + ext + self.obj_extension)) + obj_names.append (os.path.join(output_dir, + base + ext + self.obj_extension)) else: - obj_names.append (os.path.join (output_dir, - base + self.obj_extension)) + obj_names.append (os.path.join(output_dir, + base + self.obj_extension)) return obj_names - # object_filenames () - -# class CygwinCCompiler - - # the same as cygwin plus some additional parameters -class Mingw32CCompiler (CygwinCCompiler): - +class Mingw32CCompiler(CygwinCCompiler): + """ Handles the Mingw32 port of the GNU C compiler to Windows. + """ compiler_type = 'mingw32' - def __init__ (self, - verbose=0, - dry_run=0, - force=0): + def __init__(self, verbose=0, dry_run=0, force=0): CygwinCCompiler.__init__ (self, verbose, dry_run, force) @@ -335,10 +311,6 @@ # with MSVC 7.0 or later. self.dll_libraries = get_msvcr() - # __init__ () - -# class Mingw32CCompiler - # Because these compilers aren't configured in Python's pyconfig.h file by # default, we should at least warn the user if he is using a unmodified # version. @@ -348,16 +320,16 @@ CONFIG_H_UNCERTAIN = "uncertain" def check_config_h(): + """Check if the current Python installation appears amenable to building + extensions with GCC. + + Returns a tuple (status, details), where 'status' is one of the following + constants: + + - CONFIG_H_OK: all is well, go ahead and compile + - CONFIG_H_NOTOK: doesn't look good + - CONFIG_H_UNCERTAIN: not sure -- unable to read pyconfig.h - """Check if the current Python installation (specifically, pyconfig.h) - appears amenable to building extensions with GCC. Returns a tuple - (status, details), where 'status' is one of the following constants: - CONFIG_H_OK - all is well, go ahead and compile - CONFIG_H_NOTOK - doesn't look good - CONFIG_H_UNCERTAIN - not sure -- unable to read pyconfig.h 'details' is a human-readable string explaining the situation. Note there are two ways to conclude "OK": either 'sys.version' contains @@ -369,77 +341,49 @@ # "pyconfig.h" check -- should probably be renamed... from distutils import sysconfig - import string - # if sys.version contains GCC then python was compiled with - # GCC, and the pyconfig.h file should be OK - if string.find(sys.version,"GCC") >= 0: - return (CONFIG_H_OK, "sys.version mentions 'GCC'") + # if sys.version contains GCC then python was compiled with GCC, and the + # pyconfig.h file should be OK + if "GCC" in sys.version: + return CONFIG_H_OK, "sys.version mentions 'GCC'" + + # let's see if __GNUC__ is mentioned in python.h fn = sysconfig.get_config_h_filename() try: - # It would probably better to read single lines to search. - # But we do this only once, and it is fast enough - f = open(fn) - s = f.read() - f.close() - + with open(fn) as config_h: + if "__GNUC__" in config_h.read(): + return CONFIG_H_OK, "'%s' mentions '__GNUC__'" % fn + else: + return CONFIG_H_NOTOK, "'%s' does not mention '__GNUC__'" % fn except IOError, exc: - # if we can't read this file, we cannot say it is wrong - # the compiler will complain later about this file as missing return (CONFIG_H_UNCERTAIN, "couldn't read '%s': %s" % (fn, exc.strerror)) - else: - # "pyconfig.h" contains an "#ifdef __GNUC__" or something similar - if string.find(s,"__GNUC__") >= 0: - return (CONFIG_H_OK, "'%s' mentions '__GNUC__'" % fn) - else: - return (CONFIG_H_NOTOK, "'%s' does not mention '__GNUC__'" % fn) +RE_VERSION = re.compile('(\d+\.\d+(\.\d+)*)') +def _find_exe_version(cmd): + """Find the version of an executable by running `cmd` in the shell. + If the command is not found, or the output does not match + `RE_VERSION`, returns None. + """ + executable = cmd.split()[0] + if find_executable(executable) is None: + return None + out = Popen(cmd, shell=True, stdout=PIPE).stdout + try: + out_string = out.read() + finally: + out.close() + result = RE_VERSION.search(out_string) + if result is None: + return None + return LooseVersion(result.group(1)) def get_versions(): """ Try to find out the versions of gcc, ld and dllwrap. - If not possible it returns None for it. + + If not possible it returns None for it. """ - from distutils.version import LooseVersion - from distutils.spawn import find_executable - import re - - gcc_exe = find_executable('gcc') - if gcc_exe: - out = os.popen(gcc_exe + ' -dumpversion','r') - out_string = out.read() - out.close() - result = re.search('(\d+\.\d+(\.\d+)*)',out_string) - if result: - gcc_version = LooseVersion(result.group(1)) - else: - gcc_version = None - else: - gcc_version = None - ld_exe = find_executable('ld') - if ld_exe: - out = os.popen(ld_exe + ' -v','r') - out_string = out.read() - out.close() - result = re.search('(\d+\.\d+(\.\d+)*)',out_string) - if result: - ld_version = LooseVersion(result.group(1)) - else: - ld_version = None - else: - ld_version = None - dllwrap_exe = find_executable('dllwrap') - if dllwrap_exe: - out = os.popen(dllwrap_exe + ' --version','r') - out_string = out.read() - out.close() - result = re.search(' (\d+\.\d+(\.\d+)*)',out_string) - if result: - dllwrap_version = LooseVersion(result.group(1)) - else: - dllwrap_version = None - else: - dllwrap_version = None - return (gcc_version, ld_version, dllwrap_version) + commands = ['gcc -dumpversion', 'ld -v', 'dllwrap --version'] + return tuple([_find_exe_version(cmd) for cmd in commands]) Modified: python/branches/tk_and_idle_maintenance/Lib/distutils/sysconfig.py ============================================================================== --- python/branches/tk_and_idle_maintenance/Lib/distutils/sysconfig.py (original) +++ python/branches/tk_and_idle_maintenance/Lib/distutils/sysconfig.py Sat Jun 20 00:11:15 2009 @@ -13,7 +13,6 @@ import os import re -import string import sys from distutils.errors import DistutilsPlatformError @@ -285,18 +284,25 @@ while 1: line = fp.readline() - if line is None: # eof + if line is None: # eof break m = _variable_rx.match(line) if m: n, v = m.group(1, 2) - v = string.strip(v) - if "$" in v: + v = v.strip() + # `$$' is a literal `$' in make + tmpv = v.replace('$$', '') + + if "$" in tmpv: notdone[n] = v else: - try: v = int(v) - except ValueError: pass - done[n] = v + try: + v = int(v) + except ValueError: + # insert literal `$' + done[n] = v.replace('$$', '$') + else: + done[n] = v # do variable interpolation here while notdone: @@ -324,7 +330,7 @@ else: try: value = int(value) except ValueError: - done[name] = string.strip(value) + done[name] = value.strip() else: done[name] = value del notdone[name] @@ -428,7 +434,7 @@ # relative to the srcdir, which after installation no longer makes # sense. python_lib = get_python_lib(standard_lib=1) - linkerscript_path = string.split(g['LDSHARED'])[0] + linkerscript_path = g['LDSHARED'].split()[0] linkerscript_name = os.path.basename(linkerscript_path) linkerscript = os.path.join(python_lib, 'config', linkerscript_name) Modified: python/branches/tk_and_idle_maintenance/Lib/distutils/tests/test_sysconfig.py ============================================================================== --- python/branches/tk_and_idle_maintenance/Lib/distutils/tests/test_sysconfig.py (original) +++ python/branches/tk_and_idle_maintenance/Lib/distutils/tests/test_sysconfig.py Sat Jun 20 00:11:15 2009 @@ -1,5 +1,6 @@ """Tests for distutils.sysconfig.""" import os +import test import unittest from distutils import sysconfig @@ -9,6 +10,14 @@ class SysconfigTestCase(support.EnvironGuard, unittest.TestCase): + def setUp(self): + super(SysconfigTestCase, self).setUp() + self.makefile = None + + def tearDown(self): + if self.makefile is not None: + os.unlink(self.makefile) + super(SysconfigTestCase, self).tearDown() def test_get_config_h_filename(self): config_h = sysconfig.get_config_h_filename() @@ -56,8 +65,32 @@ sysconfig.customize_compiler(comp) self.assertEquals(comp.exes['archiver'], 'my_ar -arflags') + def test_parse_makefile_base(self): + self.makefile = test.test_support.TESTFN + fd = open(self.makefile, 'w') + fd.write(r"CONFIG_ARGS= '--arg1=optarg1' 'ENV=LIB'" '\n') + fd.write('VAR=$OTHER\nOTHER=foo') + fd.close() + d = sysconfig.parse_makefile(self.makefile) + self.assertEquals(d, {'CONFIG_ARGS': "'--arg1=optarg1' 'ENV=LIB'", + 'OTHER': 'foo'}) + + def test_parse_makefile_literal_dollar(self): + self.makefile = test.test_support.TESTFN + fd = open(self.makefile, 'w') + fd.write(r"CONFIG_ARGS= '--arg1=optarg1' 'ENV=\$$LIB'" '\n') + fd.write('VAR=$OTHER\nOTHER=foo') + fd.close() + d = sysconfig.parse_makefile(self.makefile) + self.assertEquals(d, {'CONFIG_ARGS': r"'--arg1=optarg1' 'ENV=\$LIB'", + 'OTHER': 'foo'}) + def test_suite(): suite = unittest.TestSuite() suite.addTest(unittest.makeSuite(SysconfigTestCase)) return suite + + +if __name__ == '__main__': + test.test_support.run_unittest(test_suite()) Modified: python/branches/tk_and_idle_maintenance/Lib/distutils/tests/test_upload.py ============================================================================== --- python/branches/tk_and_idle_maintenance/Lib/distutils/tests/test_upload.py (original) +++ python/branches/tk_and_idle_maintenance/Lib/distutils/tests/test_upload.py Sat Jun 20 00:11:15 2009 @@ -2,8 +2,8 @@ import sys import os import unittest -import httplib +from distutils.command import upload as upload_mod from distutils.command.upload import upload from distutils.core import Distribution @@ -19,48 +19,37 @@ [server1] username:me """ -class Response(object): - def __init__(self, status=200, reason='OK'): - self.status = status - self.reason = reason -class FakeConnection(object): +class FakeOpen(object): - def __init__(self): - self.requests = [] - self.headers = [] - self.body = '' + def __init__(self, url): + self.url = url + if not isinstance(url, str): + self.req = url + else: + self.req = None + self.msg = 'OK' - def __call__(self, netloc): - return self + def getcode(self): + return 200 - def connect(self): - pass - endheaders = connect - - def putrequest(self, method, url): - self.requests.append((method, url)) - - def putheader(self, name, value): - self.headers.append((name, value)) - - def send(self, body): - self.body = body - - def getresponse(self): - return Response() class uploadTestCase(PyPIRCCommandTestCase): def setUp(self): super(uploadTestCase, self).setUp() - self.old_class = httplib.HTTPConnection - self.conn = httplib.HTTPConnection = FakeConnection() + self.old_open = upload_mod.urlopen + upload_mod.urlopen = self._urlopen + self.last_open = None def tearDown(self): - httplib.HTTPConnection = self.old_class + upload_mod.urlopen = self.old_open super(uploadTestCase, self).tearDown() + def _urlopen(self, url): + self.last_open = FakeOpen(url) + return self.last_open + def test_finalize_options(self): # new format @@ -105,12 +94,13 @@ cmd.run() # what did we send ? - headers = dict(self.conn.headers) + headers = dict(self.last_open.req.headers) self.assertEquals(headers['Content-length'], '2086') self.assert_(headers['Content-type'].startswith('multipart/form-data')) - - self.assertEquals(self.conn.requests, [('POST', '/pypi')]) - self.assert_('xxx' in self.conn.body) + self.assertEquals(self.last_open.req.get_method(), 'POST') + self.assertEquals(self.last_open.req.get_full_url(), + 'http://pypi.python.org/pypi') + self.assert_('xxx' in self.last_open.req.data) def test_suite(): return unittest.makeSuite(uploadTestCase) Modified: python/branches/tk_and_idle_maintenance/Lib/filecmp.py ============================================================================== --- python/branches/tk_and_idle_maintenance/Lib/filecmp.py (original) +++ python/branches/tk_and_idle_maintenance/Lib/filecmp.py Sat Jun 20 00:11:15 2009 @@ -11,7 +11,6 @@ import os import stat -import contextlib from itertools import ifilter, ifilterfalse, imap, izip __all__ = ["cmp","dircmp","cmpfiles"] @@ -63,7 +62,7 @@ def _do_cmp(f1, f2): bufsize = BUFSIZE - with contextlib.nested(open(f1, 'rb'), open(f2, 'rb')) as (fp1, fp2): + with open(f1, 'rb') as fp1, open(f2, 'rb') as fp2: while True: b1 = fp1.read(bufsize) b2 = fp2.read(bufsize) Modified: python/branches/tk_and_idle_maintenance/Lib/idlelib/EditorWindow.py ============================================================================== --- python/branches/tk_and_idle_maintenance/Lib/idlelib/EditorWindow.py (original) +++ python/branches/tk_and_idle_maintenance/Lib/idlelib/EditorWindow.py Sat Jun 20 00:11:15 2009 @@ -27,8 +27,10 @@ major, minor, micro, level, serial = sys.version_info release = '%s%s' % (major, minor) if micro: - release += '%s' % micro - if level != 'final': + release += '%s' % (micro,) + if level == 'candidate': + release += 'rc%s' % (serial,) + elif level != 'final': release += '%s%s' % (level[0], serial) return release Modified: python/branches/tk_and_idle_maintenance/Lib/io.py ============================================================================== --- python/branches/tk_and_idle_maintenance/Lib/io.py (original) +++ python/branches/tk_and_idle_maintenance/Lib/io.py Sat Jun 20 00:11:15 2009 @@ -1,5 +1,4 @@ -""" -The io module provides the Python interfaces to stream handling. The +"""The io module provides the Python interfaces to stream handling. The builtin open function is defined in this module. At the top of the I/O hierarchy is the abstract base class IOBase. It @@ -35,9 +34,6 @@ """ # New I/O library conforming to PEP 3116. -# This is a prototype; hopefully eventually some of this will be -# reimplemented in C. - # XXX edge cases when switching between reading/writing # XXX need to support 1 meaning line-buffered # XXX whenever an argument is None, use the default value @@ -45,1825 +41,58 @@ # XXX buffered readinto should work with arbitrary buffer objects # XXX use incremental encoder for text output, at least for UTF-16 and UTF-8-SIG # XXX check writable, readable and seekable in appropriate places -from __future__ import print_function -from __future__ import unicode_literals + __author__ = ("Guido van Rossum , " "Mike Verdone , " - "Mark Russell ") + "Mark Russell , " + "Antoine Pitrou , " + "Amaury Forgeot d'Arc , " + "Benjamin Peterson ") __all__ = ["BlockingIOError", "open", "IOBase", "RawIOBase", "FileIO", "BytesIO", "StringIO", "BufferedIOBase", "BufferedReader", "BufferedWriter", "BufferedRWPair", "BufferedRandom", "TextIOBase", "TextIOWrapper", - "SEEK_SET", "SEEK_CUR", "SEEK_END"] + "UnsupportedOperation", "SEEK_SET", "SEEK_CUR", "SEEK_END"] -import os + +import _io import abc -import codecs -import _fileio -import threading -# open() uses st_blksize whenever we can -DEFAULT_BUFFER_SIZE = 8 * 1024 # bytes +from _io import (DEFAULT_BUFFER_SIZE, BlockingIOError, UnsupportedOperation, + open, FileIO, BytesIO, StringIO, BufferedReader, + BufferedWriter, BufferedRWPair, BufferedRandom, + IncrementalNewlineDecoder, TextIOWrapper) + +OpenWrapper = _io.open # for compatibility with _pyio # for seek() SEEK_SET = 0 SEEK_CUR = 1 SEEK_END = 2 -# py3k has only new style classes -__metaclass__ = type - -class BlockingIOError(IOError): - - """Exception raised when I/O would block on a non-blocking I/O stream.""" - - def __init__(self, errno, strerror, characters_written=0): - IOError.__init__(self, errno, strerror) - self.characters_written = characters_written - - -def open(file, mode="r", buffering=None, encoding=None, errors=None, - newline=None, closefd=True): - r"""Open file and return a stream. If the file cannot be opened, an IOError is - raised. - - file is either a string giving the name (and the path if the file - isn't in the current working directory) of the file to be opened or an - integer file descriptor of the file to be wrapped. (If a file - descriptor is given, it is closed when the returned I/O object is - closed, unless closefd is set to False.) - - mode is an optional string that specifies the mode in which the file - is opened. It defaults to 'r' which means open for reading in text - mode. Other common values are 'w' for writing (truncating the file if - it already exists), and 'a' for appending (which on some Unix systems, - means that all writes append to the end of the file regardless of the - current seek position). In text mode, if encoding is not specified the - encoding used is platform dependent. (For reading and writing raw - bytes use binary mode and leave encoding unspecified.) The available - modes are: - - ========= =============================================================== - Character Meaning - --------- --------------------------------------------------------------- - 'r' open for reading (default) - 'w' open for writing, truncating the file first - 'a' open for writing, appending to the end of the file if it exists - 'b' binary mode - 't' text mode (default) - '+' open a disk file for updating (reading and writing) - 'U' universal newline mode (for backwards compatibility; unneeded - for new code) - ========= =============================================================== - - The default mode is 'rt' (open for reading text). For binary random - access, the mode 'w+b' opens and truncates the file to 0 bytes, while - 'r+b' opens the file without truncation. - - Python distinguishes between files opened in binary and text modes, - even when the underlying operating system doesn't. Files opened in - binary mode (appending 'b' to the mode argument) return contents as - bytes objects without any decoding. In text mode (the default, or when - 't' is appended to the mode argument), the contents of the file are - returned as strings, the bytes having been first decoded using a - platform-dependent encoding or using the specified encoding if given. - - buffering is an optional integer used to set the buffering policy. By - default full buffering is on. Pass 0 to switch buffering off (only - allowed in binary mode), 1 to set line buffering, and an integer > 1 - for full buffering. - - encoding is the name of the encoding used to decode or encode the - file. This should only be used in text mode. The default encoding is - platform dependent, but any encoding supported by Python can be - passed. See the codecs module for the list of supported encodings. - - errors is an optional string that specifies how encoding errors are to - be handled---this argument should not be used in binary mode. Pass - 'strict' to raise a ValueError exception if there is an encoding error - (the default of None has the same effect), or pass 'ignore' to ignore - errors. (Note that ignoring encoding errors can lead to data loss.) - See the documentation for codecs.register for a list of the permitted - encoding error strings. - - newline controls how universal newlines works (it only applies to text - mode). It can be None, '', '\n', '\r', and '\r\n'. It works as - follows: - - * On input, if newline is None, universal newlines mode is - enabled. Lines in the input can end in '\n', '\r', or '\r\n', and - these are translated into '\n' before being returned to the - caller. If it is '', universal newline mode is enabled, but line - endings are returned to the caller untranslated. If it has any of - the other legal values, input lines are only terminated by the given - string, and the line ending is returned to the caller untranslated. - - * On output, if newline is None, any '\n' characters written are - translated to the system default line separator, os.linesep. If - newline is '', no translation takes place. If newline is any of the - other legal values, any '\n' characters written are translated to - the given string. - - If closefd is False, the underlying file descriptor will be kept open - when the file is closed. This does not work when a file name is given - and must be True in that case. - - open() returns a file object whose type depends on the mode, and - through which the standard file operations such as reading and writing - are performed. When open() is used to open a file in a text mode ('w', - 'r', 'wt', 'rt', etc.), it returns a TextIOWrapper. When used to open - a file in a binary mode, the returned class varies: in read binary - mode, it returns a BufferedReader; in write binary and append binary - modes, it returns a BufferedWriter, and in read/write mode, it returns - a BufferedRandom. - - It is also possible to use a string or bytearray as a file for both - reading and writing. For strings StringIO can be used like a file - opened in a text mode, and for bytes a BytesIO can be used like a file - opened in a binary mode. - """ - if not isinstance(file, (basestring, int)): - raise TypeError("invalid file: %r" % file) - if not isinstance(mode, basestring): - raise TypeError("invalid mode: %r" % mode) - if buffering is not None and not isinstance(buffering, int): - raise TypeError("invalid buffering: %r" % buffering) - if encoding is not None and not isinstance(encoding, basestring): - raise TypeError("invalid encoding: %r" % encoding) - if errors is not None and not isinstance(errors, basestring): - raise TypeError("invalid errors: %r" % errors) - modes = set(mode) - if modes - set("arwb+tU") or len(mode) > len(modes): - raise ValueError("invalid mode: %r" % mode) - reading = "r" in modes - writing = "w" in modes - appending = "a" in modes - updating = "+" in modes - text = "t" in modes - binary = "b" in modes - if "U" in modes: - if writing or appending: - raise ValueError("can't use U and writing mode at once") - reading = True - if text and binary: - raise ValueError("can't have text and binary mode at once") - if reading + writing + appending > 1: - raise ValueError("can't have read/write/append mode at once") - if not (reading or writing or appending): - raise ValueError("must have exactly one of read/write/append mode") - if binary and encoding is not None: - raise ValueError("binary mode doesn't take an encoding argument") - if binary and errors is not None: - raise ValueError("binary mode doesn't take an errors argument") - if binary and newline is not None: - raise ValueError("binary mode doesn't take a newline argument") - raw = FileIO(file, - (reading and "r" or "") + - (writing and "w" or "") + - (appending and "a" or "") + - (updating and "+" or ""), - closefd) - if buffering is None: - buffering = -1 - line_buffering = False - if buffering == 1 or buffering < 0 and raw.isatty(): - buffering = -1 - line_buffering = True - if buffering < 0: - buffering = DEFAULT_BUFFER_SIZE - try: - bs = os.fstat(raw.fileno()).st_blksize - except (os.error, AttributeError): - pass - else: - if bs > 1: - buffering = bs - if buffering < 0: - raise ValueError("invalid buffering size") - if buffering == 0: - if binary: - return raw - raise ValueError("can't have unbuffered text I/O") - if updating: - buffer = BufferedRandom(raw, buffering) - elif writing or appending: - buffer = BufferedWriter(raw, buffering) - elif reading: - buffer = BufferedReader(raw, buffering) - else: - raise ValueError("unknown mode: %r" % mode) - if binary: - return buffer - text = TextIOWrapper(buffer, encoding, errors, newline, line_buffering) - text.mode = mode - return text - -class _DocDescriptor: - """Helper for builtins.open.__doc__ - """ - def __get__(self, obj, typ): - return ( - "open(file, mode='r', buffering=None, encoding=None, " - "errors=None, newline=None, closefd=True)\n\n" + - open.__doc__) - -class OpenWrapper: - """Wrapper for builtins.open - - Trick so that open won't become a bound method when stored - as a class variable (as dumbdbm does). - - See initstdio() in Python/pythonrun.c. - """ - __doc__ = _DocDescriptor() - - def __new__(cls, *args, **kwargs): - return open(*args, **kwargs) - +# Declaring ABCs in C is tricky so we do it here. +# Method descriptions and default implementations are inherited from the C +# version however. +class IOBase(_io._IOBase): + __metaclass__ = abc.ABCMeta -class UnsupportedOperation(ValueError, IOError): +class RawIOBase(_io._RawIOBase, IOBase): pass +class BufferedIOBase(_io._BufferedIOBase, IOBase): + pass -class IOBase(object): - - """The abstract base class for all I/O classes, acting on streams of - bytes. There is no public constructor. - - This class provides dummy implementations for many methods that - derived classes can override selectively; the default implementations - represent a file that cannot be read, written or seeked. - - Even though IOBase does not declare read, readinto, or write because - their signatures will vary, implementations and clients should - consider those methods part of the interface. Also, implementations - may raise a IOError when operations they do not support are called. - - The basic type used for binary data read from or written to a file is - bytes. bytearrays are accepted too, and in some cases (such as - readinto) needed. Text I/O classes work with str data. - - Note that calling any method (even inquiries) on a closed stream is - undefined. Implementations may raise IOError in this case. - - IOBase (and its subclasses) support the iterator protocol, meaning - that an IOBase object can be iterated over yielding the lines in a - stream. - - IOBase also supports the :keyword:`with` statement. In this example, - fp is closed after the suite of the with statment is complete: - - with open('spam.txt', 'r') as fp: - fp.write('Spam and eggs!') - """ - - __metaclass__ = abc.ABCMeta +class TextIOBase(_io._TextIOBase, IOBase): + pass - ### Internal ### +RawIOBase.register(FileIO) - def _unsupported(self, name): - """Internal: raise an exception for unsupported operations.""" - raise UnsupportedOperation("%s.%s() not supported" % - (self.__class__.__name__, name)) - - ### Positioning ### - - def seek(self, pos, whence = 0): - """Change stream position. - - Change the stream position to byte offset offset. offset is - interpreted relative to the position indicated by whence. Values - for whence are: - - * 0 -- start of stream (the default); offset should be zero or positive - * 1 -- current stream position; offset may be negative - * 2 -- end of stream; offset is usually negative - - Return the new absolute position. - """ - self._unsupported("seek") - - def tell(self): - """Return current stream position.""" - return self.seek(0, 1) - - def truncate(self, pos = None): - """Truncate file to size bytes. - - Size defaults to the current IO position as reported by tell(). Return - the new size. - """ - self._unsupported("truncate") - - ### Flush and close ### - - def flush(self): - """Flush write buffers, if applicable. - - This is not implemented for read-only and non-blocking streams. - """ - # XXX Should this return the number of bytes written??? - - __closed = False - - def close(self): - """Flush and close the IO object. - - This method has no effect if the file is already closed. - """ - if not self.__closed: - try: - self.flush() - except IOError: - pass # If flush() fails, just give up - self.__closed = True - - def __del__(self): - """Destructor. Calls close().""" - # The try/except block is in case this is called at program - # exit time, when it's possible that globals have already been - # deleted, and then the close() call might fail. Since - # there's nothing we can do about such failures and they annoy - # the end users, we suppress the traceback. - try: - self.close() - except: - pass - - ### Inquiries ### - - def seekable(self): - """Return whether object supports random access. - - If False, seek(), tell() and truncate() will raise IOError. - This method may need to do a test seek(). - """ - return False - - def _checkSeekable(self, msg=None): - """Internal: raise an IOError if file is not seekable - """ - if not self.seekable(): - raise IOError("File or stream is not seekable." - if msg is None else msg) - - - def readable(self): - """Return whether object was opened for reading. - - If False, read() will raise IOError. - """ - return False - - def _checkReadable(self, msg=None): - """Internal: raise an IOError if file is not readable - """ - if not self.readable(): - raise IOError("File or stream is not readable." - if msg is None else msg) - - def writable(self): - """Return whether object was opened for writing. - - If False, write() and truncate() will raise IOError. - """ - return False - - def _checkWritable(self, msg=None): - """Internal: raise an IOError if file is not writable - """ - if not self.writable(): - raise IOError("File or stream is not writable." - if msg is None else msg) - - @property - def closed(self): - """closed: bool. True iff the file has been closed. - - For backwards compatibility, this is a property, not a predicate. - """ - return self.__closed - - def _checkClosed(self, msg=None): - """Internal: raise an ValueError if file is closed - """ - if self.closed: - raise ValueError("I/O operation on closed file." - if msg is None else msg) - - ### Context manager ### - - def __enter__(self): - """Context management protocol. Returns self.""" - self._checkClosed() - return self - - def __exit__(self, *args): - """Context management protocol. Calls close()""" - self.close() - - ### Lower-level APIs ### - - # XXX Should these be present even if unimplemented? - - def fileno(self): - """Returns underlying file descriptor if one exists. - - An IOError is raised if the IO object does not use a file descriptor. - """ - self._unsupported("fileno") - - def isatty(self): - """Return whether this is an 'interactive' stream. - - Return False if it can't be determined. - """ - self._checkClosed() - return False - - ### Readline[s] and writelines ### - - def readline(self, limit = -1): - r"""Read and return a line from the stream. - - If limit is specified, at most limit bytes will be read. - - The line terminator is always b'\n' for binary files; for text - files, the newlines argument to open can be used to select the line - terminator(s) recognized. - """ - self._checkClosed() - if hasattr(self, "peek"): - def nreadahead(): - readahead = self.peek(1) - if not readahead: - return 1 - n = (readahead.find(b"\n") + 1) or len(readahead) - if limit >= 0: - n = min(n, limit) - return n - else: - def nreadahead(): - return 1 - if limit is None: - limit = -1 - if not isinstance(limit, (int, long)): - raise TypeError("limit must be an integer") - res = bytearray() - while limit < 0 or len(res) < limit: - b = self.read(nreadahead()) - if not b: - break - res += b - if res.endswith(b"\n"): - break - return bytes(res) - - def __iter__(self): - self._checkClosed() - return self - - def next(self): - line = self.readline() - if not line: - raise StopIteration - return line - - def readlines(self, hint=None): - """Return a list of lines from the stream. - - hint can be specified to control the number of lines read: no more - lines will be read if the total size (in bytes/characters) of all - lines so far exceeds hint. - """ - if hint is None: - hint = -1 - if not isinstance(hint, (int, long)): - raise TypeError("hint must be an integer") - if hint <= 0: - return list(self) - n = 0 - lines = [] - for line in self: - lines.append(line) - n += len(line) - if n >= hint: - break - return lines - - def writelines(self, lines): - self._checkClosed() - for line in lines: - self.write(line) - - -class RawIOBase(IOBase): - - """Base class for raw binary I/O.""" - - # The read() method is implemented by calling readinto(); derived - # classes that want to support read() only need to implement - # readinto() as a primitive operation. In general, readinto() can be - # more efficient than read(). - - # (It would be tempting to also provide an implementation of - # readinto() in terms of read(), in case the latter is a more suitable - # primitive operation, but that would lead to nasty recursion in case - # a subclass doesn't implement either.) - - def read(self, n = -1): - """Read and return up to n bytes. - - Returns an empty bytes array on EOF, or None if the object is - set not to block and has no data to read. - """ - if n is None: - n = -1 - if n < 0: - return self.readall() - b = bytearray(n.__index__()) - n = self.readinto(b) - del b[n:] - return bytes(b) - - def readall(self): - """Read until EOF, using multiple read() call.""" - res = bytearray() - while True: - data = self.read(DEFAULT_BUFFER_SIZE) - if not data: - break - res += data - return bytes(res) - - def readinto(self, b): - """Read up to len(b) bytes into b. - - Returns number of bytes read (0 for EOF), or None if the object - is set not to block as has no data to read. - """ - self._unsupported("readinto") - - def write(self, b): - """Write the given buffer to the IO stream. - - Returns the number of bytes written, which may be less than len(b). - """ - self._unsupported("write") - - -class FileIO(_fileio._FileIO, RawIOBase): - - """Raw I/O implementation for OS files.""" - - # This multiply inherits from _FileIO and RawIOBase to make - # isinstance(io.FileIO(), io.RawIOBase) return True without requiring - # that _fileio._FileIO inherits from io.RawIOBase (which would be hard - # to do since _fileio.c is written in C). - - def __init__(self, name, mode="r", closefd=True): - _fileio._FileIO.__init__(self, name, mode, closefd) - self._name = name - - def close(self): - _fileio._FileIO.close(self) - RawIOBase.close(self) - - @property - def name(self): - return self._name - - -class BufferedIOBase(IOBase): - - """Base class for buffered IO objects. - - The main difference with RawIOBase is that the read() method - supports omitting the size argument, and does not have a default - implementation that defers to readinto(). - - In addition, read(), readinto() and write() may raise - BlockingIOError if the underlying raw stream is in non-blocking - mode and not ready; unlike their raw counterparts, they will never - return None. - - A typical implementation should not inherit from a RawIOBase - implementation, but wrap one. - """ - - def read(self, n = None): - """Read and return up to n bytes. - - If the argument is omitted, None, or negative, reads and - returns all data until EOF. - - If the argument is positive, and the underlying raw stream is - not 'interactive', multiple raw reads may be issued to satisfy - the byte count (unless EOF is reached first). But for - interactive raw streams (XXX and for pipes?), at most one raw - read will be issued, and a short result does not imply that - EOF is imminent. - - Returns an empty bytes array on EOF. - - Raises BlockingIOError if the underlying raw stream has no - data at the moment. - """ - self._unsupported("read") - - def readinto(self, b): - """Read up to len(b) bytes into b. - - Like read(), this may issue multiple reads to the underlying raw - stream, unless the latter is 'interactive'. - - Returns the number of bytes read (0 for EOF). - - Raises BlockingIOError if the underlying raw stream has no - data at the moment. - """ - # XXX This ought to work with anything that supports the buffer API - data = self.read(len(b)) - n = len(data) - try: - b[:n] = data - except TypeError as err: - import array - if not isinstance(b, array.array): - raise err - b[:n] = array.array(b'b', data) - return n - - def write(self, b): - """Write the given buffer to the IO stream. - - Return the number of bytes written, which is never less than - len(b). - - Raises BlockingIOError if the buffer is full and the - underlying raw stream cannot accept more data at the moment. - """ - self._unsupported("write") - - -class _BufferedIOMixin(BufferedIOBase): - - """A mixin implementation of BufferedIOBase with an underlying raw stream. - - This passes most requests on to the underlying raw stream. It - does *not* provide implementations of read(), readinto() or - write(). - """ - - def __init__(self, raw): - self.raw = raw - - ### Positioning ### - - def seek(self, pos, whence=0): - return self.raw.seek(pos, whence) - - def tell(self): - return self.raw.tell() - - def truncate(self, pos=None): - # Flush the stream. We're mixing buffered I/O with lower-level I/O, - # and a flush may be necessary to synch both views of the current - # file state. - self.flush() - - if pos is None: - pos = self.tell() - # XXX: Should seek() be used, instead of passing the position - # XXX directly to truncate? - return self.raw.truncate(pos) - - ### Flush and close ### - - def flush(self): - self.raw.flush() - - def close(self): - if not self.closed: - try: - self.flush() - except IOError: - pass # If flush() fails, just give up - self.raw.close() - - ### Inquiries ### - - def seekable(self): - return self.raw.seekable() - - def readable(self): - return self.raw.readable() - - def writable(self): - return self.raw.writable() - - @property - def closed(self): - return self.raw.closed - - @property - def name(self): - return self.raw.name - - @property - def mode(self): - return self.raw.mode - - ### Lower-level APIs ### - - def fileno(self): - return self.raw.fileno() - - def isatty(self): - return self.raw.isatty() - - -class _BytesIO(BufferedIOBase): - - """Buffered I/O implementation using an in-memory bytes buffer.""" - - # XXX More docs - - def __init__(self, initial_bytes=None): - buf = bytearray() - if initial_bytes is not None: - buf += bytearray(initial_bytes) - self._buffer = buf - self._pos = 0 - - def getvalue(self): - """Return the bytes value (contents) of the buffer - """ - if self.closed: - raise ValueError("getvalue on closed file") - return bytes(self._buffer) - - def read(self, n=None): - if self.closed: - raise ValueError("read from closed file") - if n is None: - n = -1 - if not isinstance(n, (int, long)): - raise TypeError("argument must be an integer") - if n < 0: - n = len(self._buffer) - if len(self._buffer) <= self._pos: - return b"" - newpos = min(len(self._buffer), self._pos + n) - b = self._buffer[self._pos : newpos] - self._pos = newpos - return bytes(b) - - def read1(self, n): - """this is the same as read. - """ - return self.read(n) - - def write(self, b): - if self.closed: - raise ValueError("write to closed file") - if isinstance(b, unicode): - raise TypeError("can't write unicode to binary stream") - n = len(b) - if n == 0: - return 0 - pos = self._pos - if pos > len(self._buffer): - # Inserts null bytes between the current end of the file - # and the new write position. - padding = b'\x00' * (pos - len(self._buffer)) - self._buffer += padding - self._buffer[pos:pos + n] = b - self._pos += n - return n - - def seek(self, pos, whence=0): - if self.closed: - raise ValueError("seek on closed file") - try: - pos = pos.__index__() - except AttributeError as err: - raise TypeError("an integer is required") # from err - if whence == 0: - if pos < 0: - raise ValueError("negative seek position %r" % (pos,)) - self._pos = pos - elif whence == 1: - self._pos = max(0, self._pos + pos) - elif whence == 2: - self._pos = max(0, len(self._buffer) + pos) - else: - raise ValueError("invalid whence value") - return self._pos - - def tell(self): - if self.closed: - raise ValueError("tell on closed file") - return self._pos - - def truncate(self, pos=None): - if self.closed: - raise ValueError("truncate on closed file") - if pos is None: - pos = self._pos - elif pos < 0: - raise ValueError("negative truncate position %r" % (pos,)) - del self._buffer[pos:] - return self.seek(pos) - - def readable(self): - return True - - def writable(self): - return True - - def seekable(self): - return True - -# Use the faster implementation of BytesIO if available -try: - import _bytesio - - class BytesIO(_bytesio._BytesIO, BufferedIOBase): - __doc__ = _bytesio._BytesIO.__doc__ - -except ImportError: - BytesIO = _BytesIO - - -class BufferedReader(_BufferedIOMixin): - - """BufferedReader(raw[, buffer_size]) - - A buffer for a readable, sequential BaseRawIO object. - - The constructor creates a BufferedReader for the given readable raw - stream and buffer_size. If buffer_size is omitted, DEFAULT_BUFFER_SIZE - is used. - """ - - def __init__(self, raw, buffer_size=DEFAULT_BUFFER_SIZE): - """Create a new buffered reader using the given readable raw IO object. - """ - raw._checkReadable() - _BufferedIOMixin.__init__(self, raw) - self.buffer_size = buffer_size - self._reset_read_buf() - self._read_lock = threading.Lock() - - def _reset_read_buf(self): - self._read_buf = b"" - self._read_pos = 0 - - def read(self, n=None): - """Read n bytes. - - Returns exactly n bytes of data unless the underlying raw IO - stream reaches EOF or if the call would block in non-blocking - mode. If n is negative, read until EOF or until read() would - block. - """ - with self._read_lock: - return self._read_unlocked(n) - - def _read_unlocked(self, n=None): - nodata_val = b"" - empty_values = (b"", None) - buf = self._read_buf - pos = self._read_pos - - # Special case for when the number of bytes to read is unspecified. - if n is None or n == -1: - self._reset_read_buf() - chunks = [buf[pos:]] # Strip the consumed bytes. - current_size = 0 - while True: - # Read until EOF or until read() would block. - chunk = self.raw.read() - if chunk in empty_values: - nodata_val = chunk - break - current_size += len(chunk) - chunks.append(chunk) - return b"".join(chunks) or nodata_val - - # The number of bytes to read is specified, return at most n bytes. - avail = len(buf) - pos # Length of the available buffered data. - if n <= avail: - # Fast path: the data to read is fully buffered. - self._read_pos += n - return buf[pos:pos+n] - # Slow path: read from the stream until enough bytes are read, - # or until an EOF occurs or until read() would block. - chunks = [buf[pos:]] - wanted = max(self.buffer_size, n) - while avail < n: - chunk = self.raw.read(wanted) - if chunk in empty_values: - nodata_val = chunk - break - avail += len(chunk) - chunks.append(chunk) - # n is more then avail only when an EOF occurred or when - # read() would have blocked. - n = min(n, avail) - out = b"".join(chunks) - self._read_buf = out[n:] # Save the extra data in the buffer. - self._read_pos = 0 - return out[:n] if out else nodata_val - - def peek(self, n=0): - """Returns buffered bytes without advancing the position. - - The argument indicates a desired minimal number of bytes; we - do at most one raw read to satisfy it. We never return more - than self.buffer_size. - """ - with self._read_lock: - return self._peek_unlocked(n) - - def _peek_unlocked(self, n=0): - want = min(n, self.buffer_size) - have = len(self._read_buf) - self._read_pos - if have < want: - to_read = self.buffer_size - have - current = self.raw.read(to_read) - if current: - self._read_buf = self._read_buf[self._read_pos:] + current - self._read_pos = 0 - return self._read_buf[self._read_pos:] - - def read1(self, n): - """Reads up to n bytes, with at most one read() system call.""" - # Returns up to n bytes. If at least one byte is buffered, we - # only return buffered bytes. Otherwise, we do one raw read. - if n <= 0: - return b"" - with self._read_lock: - self._peek_unlocked(1) - return self._read_unlocked( - min(n, len(self._read_buf) - self._read_pos)) - - def tell(self): - return self.raw.tell() - len(self._read_buf) + self._read_pos - - def seek(self, pos, whence=0): - with self._read_lock: - if whence == 1: - pos -= len(self._read_buf) - self._read_pos - pos = self.raw.seek(pos, whence) - self._reset_read_buf() - return pos - - -class BufferedWriter(_BufferedIOMixin): - - """A buffer for a writeable sequential RawIO object. - - The constructor creates a BufferedWriter for the given writeable raw - stream. If the buffer_size is not given, it defaults to - DEAFULT_BUFFER_SIZE. If max_buffer_size is omitted, it defaults to - twice the buffer size. - """ - - def __init__(self, raw, - buffer_size=DEFAULT_BUFFER_SIZE, max_buffer_size=None): - raw._checkWritable() - _BufferedIOMixin.__init__(self, raw) - self.buffer_size = buffer_size - self.max_buffer_size = (2*buffer_size - if max_buffer_size is None - else max_buffer_size) - self._write_buf = bytearray() - self._write_lock = threading.Lock() - - def write(self, b): - if self.closed: - raise ValueError("write to closed file") - if isinstance(b, unicode): - raise TypeError("can't write unicode to binary stream") - with self._write_lock: - # XXX we can implement some more tricks to try and avoid - # partial writes - if len(self._write_buf) > self.buffer_size: - # We're full, so let's pre-flush the buffer - try: - self._flush_unlocked() - except BlockingIOError as e: - # We can't accept anything else. - # XXX Why not just let the exception pass through? - raise BlockingIOError(e.errno, e.strerror, 0) - before = len(self._write_buf) - self._write_buf.extend(b) - written = len(self._write_buf) - before - if len(self._write_buf) > self.buffer_size: - try: - self._flush_unlocked() - except BlockingIOError as e: - if len(self._write_buf) > self.max_buffer_size: - # We've hit max_buffer_size. We have to accept a - # partial write and cut back our buffer. - overage = len(self._write_buf) - self.max_buffer_size - self._write_buf = self._write_buf[:self.max_buffer_size] - raise BlockingIOError(e.errno, e.strerror, overage) - return written - - def truncate(self, pos=None): - with self._write_lock: - self._flush_unlocked() - if pos is None: - pos = self.raw.tell() - return self.raw.truncate(pos) - - def flush(self): - with self._write_lock: - self._flush_unlocked() - - def _flush_unlocked(self): - if self.closed: - raise ValueError("flush of closed file") - written = 0 - try: - while self._write_buf: - n = self.raw.write(self._write_buf) - del self._write_buf[:n] - written += n - except BlockingIOError as e: - n = e.characters_written - del self._write_buf[:n] - written += n - raise BlockingIOError(e.errno, e.strerror, written) - - def tell(self): - return self.raw.tell() + len(self._write_buf) - - def seek(self, pos, whence=0): - with self._write_lock: - self._flush_unlocked() - return self.raw.seek(pos, whence) - - -class BufferedRWPair(BufferedIOBase): - - """A buffered reader and writer object together. - - A buffered reader object and buffered writer object put together to - form a sequential IO object that can read and write. This is typically - used with a socket or two-way pipe. - - reader and writer are RawIOBase objects that are readable and - writeable respectively. If the buffer_size is omitted it defaults to - DEFAULT_BUFFER_SIZE. The max_buffer_size (for the buffered writer) - defaults to twice the buffer size. - """ - - # XXX The usefulness of this (compared to having two separate IO - # objects) is questionable. - - def __init__(self, reader, writer, - buffer_size=DEFAULT_BUFFER_SIZE, max_buffer_size=None): - """Constructor. - - The arguments are two RawIO instances. - """ - reader._checkReadable() - writer._checkWritable() - self.reader = BufferedReader(reader, buffer_size) - self.writer = BufferedWriter(writer, buffer_size, max_buffer_size) - - def read(self, n=None): - if n is None: - n = -1 - return self.reader.read(n) - - def readinto(self, b): - return self.reader.readinto(b) - - def write(self, b): - return self.writer.write(b) - - def peek(self, n=0): - return self.reader.peek(n) - - def read1(self, n): - return self.reader.read1(n) - - def readable(self): - return self.reader.readable() - - def writable(self): - return self.writer.writable() - - def flush(self): - return self.writer.flush() - - def close(self): - self.writer.close() - self.reader.close() - - def isatty(self): - return self.reader.isatty() or self.writer.isatty() - - @property - def closed(self): - return self.writer.closed - - -class BufferedRandom(BufferedWriter, BufferedReader): - - """A buffered interface to random access streams. - - The constructor creates a reader and writer for a seekable stream, - raw, given in the first argument. If the buffer_size is omitted it - defaults to DEFAULT_BUFFER_SIZE. The max_buffer_size (for the buffered - writer) defaults to twice the buffer size. - """ - - def __init__(self, raw, - buffer_size=DEFAULT_BUFFER_SIZE, max_buffer_size=None): - raw._checkSeekable() - BufferedReader.__init__(self, raw, buffer_size) - BufferedWriter.__init__(self, raw, buffer_size, max_buffer_size) - - def seek(self, pos, whence=0): - self.flush() - # First do the raw seek, then empty the read buffer, so that - # if the raw seek fails, we don't lose buffered data forever. - pos = self.raw.seek(pos, whence) - with self._read_lock: - self._reset_read_buf() - return pos - - def tell(self): - if self._write_buf: - return self.raw.tell() + len(self._write_buf) - else: - return BufferedReader.tell(self) - - def truncate(self, pos=None): - if pos is None: - pos = self.tell() - # Use seek to flush the read buffer. - self.seek(pos) - return BufferedWriter.truncate(self) - - def read(self, n=None): - if n is None: - n = -1 - self.flush() - return BufferedReader.read(self, n) - - def readinto(self, b): - self.flush() - return BufferedReader.readinto(self, b) - - def peek(self, n=0): - self.flush() - return BufferedReader.peek(self, n) - - def read1(self, n): - self.flush() - return BufferedReader.read1(self, n) - - def write(self, b): - if self._read_buf: - # Undo readahead - with self._read_lock: - self.raw.seek(self._read_pos - len(self._read_buf), 1) - self._reset_read_buf() - return BufferedWriter.write(self, b) - - -class TextIOBase(IOBase): - - """Base class for text I/O. - - This class provides a character and line based interface to stream - I/O. There is no readinto method because Python's character strings - are immutable. There is no public constructor. - """ - - def read(self, n = -1): - """Read at most n characters from stream. - - Read from underlying buffer until we have n characters or we hit EOF. - If n is negative or omitted, read until EOF. - """ - self._unsupported("read") - - def write(self, s): - """Write string s to stream.""" - self._unsupported("write") - - def truncate(self, pos = None): - """Truncate size to pos.""" - self._unsupported("truncate") - - def readline(self): - """Read until newline or EOF. - - Returns an empty string if EOF is hit immediately. - """ - self._unsupported("readline") - - @property - def encoding(self): - """Subclasses should override.""" - return None - - @property - def newlines(self): - """Line endings translated so far. - - Only line endings translated during reading are considered. - - Subclasses should override. - """ - return None - - -class IncrementalNewlineDecoder(codecs.IncrementalDecoder): - """Codec used when reading a file in universal newlines mode. - It wraps another incremental decoder, translating \\r\\n and \\r into \\n. - It also records the types of newlines encountered. - When used with translate=False, it ensures that the newline sequence is - returned in one piece. - """ - def __init__(self, decoder, translate, errors='strict'): - codecs.IncrementalDecoder.__init__(self, errors=errors) - self.translate = translate - self.decoder = decoder - self.seennl = 0 - self.pendingcr = False - - def decode(self, input, final=False): - # decode input (with the eventual \r from a previous pass) - output = self.decoder.decode(input, final=final) - if self.pendingcr and (output or final): - output = "\r" + output - self.pendingcr = False - - # retain last \r even when not translating data: - # then readline() is sure to get \r\n in one pass - if output.endswith("\r") and not final: - output = output[:-1] - self.pendingcr = True - - # Record which newlines are read - crlf = output.count('\r\n') - cr = output.count('\r') - crlf - lf = output.count('\n') - crlf - self.seennl |= (lf and self._LF) | (cr and self._CR) \ - | (crlf and self._CRLF) - - if self.translate: - if crlf: - output = output.replace("\r\n", "\n") - if cr: - output = output.replace("\r", "\n") - - return output - - def getstate(self): - buf, flag = self.decoder.getstate() - flag <<= 1 - if self.pendingcr: - flag |= 1 - return buf, flag - - def setstate(self, state): - buf, flag = state - self.pendingcr = bool(flag & 1) - self.decoder.setstate((buf, flag >> 1)) - - def reset(self): - self.seennl = 0 - self.pendingcr = False - self.decoder.reset() - - _LF = 1 - _CR = 2 - _CRLF = 4 - - @property - def newlines(self): - return (None, - "\n", - "\r", - ("\r", "\n"), - "\r\n", - ("\n", "\r\n"), - ("\r", "\r\n"), - ("\r", "\n", "\r\n") - )[self.seennl] - - -class TextIOWrapper(TextIOBase): - - r"""Character and line based layer over a BufferedIOBase object, buffer. - - encoding gives the name of the encoding that the stream will be - decoded or encoded with. It defaults to locale.getpreferredencoding. - - errors determines the strictness of encoding and decoding (see the - codecs.register) and defaults to "strict". - - newline can be None, '', '\n', '\r', or '\r\n'. It controls the - handling of line endings. If it is None, universal newlines is - enabled. With this enabled, on input, the lines endings '\n', '\r', - or '\r\n' are translated to '\n' before being returned to the - caller. Conversely, on output, '\n' is translated to the system - default line separator, os.linesep. If newline is any other of its - legal values, that newline becomes the newline when the file is read - and it is returned untranslated. On output, '\n' is converted to the - newline. - - If line_buffering is True, a call to flush is implied when a call to - write contains a newline character. - """ - - _CHUNK_SIZE = 128 - - def __init__(self, buffer, encoding=None, errors=None, newline=None, - line_buffering=False): - if newline not in (None, "", "\n", "\r", "\r\n"): - raise ValueError("illegal newline value: %r" % (newline,)) - if encoding is None: - try: - encoding = os.device_encoding(buffer.fileno()) - except (AttributeError, UnsupportedOperation): - pass - if encoding is None: - try: - import locale - except ImportError: - # Importing locale may fail if Python is being built - encoding = "ascii" - else: - encoding = locale.getpreferredencoding() - - if not isinstance(encoding, basestring): - raise ValueError("invalid encoding: %r" % encoding) - - if errors is None: - errors = "strict" - else: - if not isinstance(errors, basestring): - raise ValueError("invalid errors: %r" % errors) - - self.buffer = buffer - self._line_buffering = line_buffering - self._encoding = encoding - self._errors = errors - self._readuniversal = not newline - self._readtranslate = newline is None - self._readnl = newline - self._writetranslate = newline != '' - self._writenl = newline or os.linesep - self._encoder = None - self._decoder = None - self._decoded_chars = '' # buffer for text returned from decoder - self._decoded_chars_used = 0 # offset into _decoded_chars for read() - self._snapshot = None # info for reconstructing decoder state - self._seekable = self._telling = self.buffer.seekable() - - # self._snapshot is either None, or a tuple (dec_flags, next_input) - # where dec_flags is the second (integer) item of the decoder state - # and next_input is the chunk of input bytes that comes next after the - # snapshot point. We use this to reconstruct decoder states in tell(). - - # Naming convention: - # - "bytes_..." for integer variables that count input bytes - # - "chars_..." for integer variables that count decoded characters - - @property - def encoding(self): - return self._encoding - - @property - def errors(self): - return self._errors - - @property - def line_buffering(self): - return self._line_buffering - - def seekable(self): - return self._seekable - - def readable(self): - return self.buffer.readable() - - def writable(self): - return self.buffer.writable() - - def flush(self): - self.buffer.flush() - self._telling = self._seekable - - def close(self): - try: - self.flush() - except: - pass # If flush() fails, just give up - self.buffer.close() - - @property - def closed(self): - return self.buffer.closed - - @property - def name(self): - return self.buffer.name - - def fileno(self): - return self.buffer.fileno() - - def isatty(self): - return self.buffer.isatty() - - def write(self, s): - if self.closed: - raise ValueError("write to closed file") - if not isinstance(s, unicode): - raise TypeError("can't write %s to text stream" % - s.__class__.__name__) - length = len(s) - haslf = (self._writetranslate or self._line_buffering) and "\n" in s - if haslf and self._writetranslate and self._writenl != "\n": - s = s.replace("\n", self._writenl) - encoder = self._encoder or self._get_encoder() - # XXX What if we were just reading? - b = encoder.encode(s) - self.buffer.write(b) - if self._line_buffering and (haslf or "\r" in s): - self.flush() - self._snapshot = None - if self._decoder: - self._decoder.reset() - return length - - def _get_encoder(self): - make_encoder = codecs.getincrementalencoder(self._encoding) - self._encoder = make_encoder(self._errors) - return self._encoder - - def _get_decoder(self): - make_decoder = codecs.getincrementaldecoder(self._encoding) - decoder = make_decoder(self._errors) - if self._readuniversal: - decoder = IncrementalNewlineDecoder(decoder, self._readtranslate) - self._decoder = decoder - return decoder - - # The following three methods implement an ADT for _decoded_chars. - # Text returned from the decoder is buffered here until the client - # requests it by calling our read() or readline() method. - def _set_decoded_chars(self, chars): - """Set the _decoded_chars buffer.""" - self._decoded_chars = chars - self._decoded_chars_used = 0 - - def _get_decoded_chars(self, n=None): - """Advance into the _decoded_chars buffer.""" - offset = self._decoded_chars_used - if n is None: - chars = self._decoded_chars[offset:] - else: - chars = self._decoded_chars[offset:offset + n] - self._decoded_chars_used += len(chars) - return chars - - def _rewind_decoded_chars(self, n): - """Rewind the _decoded_chars buffer.""" - if self._decoded_chars_used < n: - raise AssertionError("rewind decoded_chars out of bounds") - self._decoded_chars_used -= n - - def _read_chunk(self): - """ - Read and decode the next chunk of data from the BufferedReader. - - The return value is True unless EOF was reached. The decoded string - is placed in self._decoded_chars (replacing its previous value). - The entire input chunk is sent to the decoder, though some of it - may remain buffered in the decoder, yet to be converted. - """ - - if self._decoder is None: - raise ValueError("no decoder") - - if self._telling: - # To prepare for tell(), we need to snapshot a point in the - # file where the decoder's input buffer is empty. - - dec_buffer, dec_flags = self._decoder.getstate() - # Given this, we know there was a valid snapshot point - # len(dec_buffer) bytes ago with decoder state (b'', dec_flags). - - # Read a chunk, decode it, and put the result in self._decoded_chars. - input_chunk = self.buffer.read1(self._CHUNK_SIZE) - eof = not input_chunk - self._set_decoded_chars(self._decoder.decode(input_chunk, eof)) - - if self._telling: - # At the snapshot point, len(dec_buffer) bytes before the read, - # the next input to be decoded is dec_buffer + input_chunk. - self._snapshot = (dec_flags, dec_buffer + input_chunk) - - return not eof - - def _pack_cookie(self, position, dec_flags=0, - bytes_to_feed=0, need_eof=0, chars_to_skip=0): - # The meaning of a tell() cookie is: seek to position, set the - # decoder flags to dec_flags, read bytes_to_feed bytes, feed them - # into the decoder with need_eof as the EOF flag, then skip - # chars_to_skip characters of the decoded result. For most simple - # decoders, tell() will often just give a byte offset in the file. - return (position | (dec_flags<<64) | (bytes_to_feed<<128) | - (chars_to_skip<<192) | bool(need_eof)<<256) - - def _unpack_cookie(self, bigint): - rest, position = divmod(bigint, 1<<64) - rest, dec_flags = divmod(rest, 1<<64) - rest, bytes_to_feed = divmod(rest, 1<<64) - need_eof, chars_to_skip = divmod(rest, 1<<64) - return position, dec_flags, bytes_to_feed, need_eof, chars_to_skip - - def tell(self): - if not self._seekable: - raise IOError("underlying stream is not seekable") - if not self._telling: - raise IOError("telling position disabled by next() call") - self.flush() - position = self.buffer.tell() - decoder = self._decoder - if decoder is None or self._snapshot is None: - if self._decoded_chars: - # This should never happen. - raise AssertionError("pending decoded text") - return position - - # Skip backward to the snapshot point (see _read_chunk). - dec_flags, next_input = self._snapshot - position -= len(next_input) - - # How many decoded characters have been used up since the snapshot? - chars_to_skip = self._decoded_chars_used - if chars_to_skip == 0: - # We haven't moved from the snapshot point. - return self._pack_cookie(position, dec_flags) - - # Starting from the snapshot position, we will walk the decoder - # forward until it gives us enough decoded characters. - saved_state = decoder.getstate() - try: - # Note our initial start point. - decoder.setstate((b'', dec_flags)) - start_pos = position - start_flags, bytes_fed, chars_decoded = dec_flags, 0, 0 - need_eof = 0 - - # Feed the decoder one byte at a time. As we go, note the - # nearest "safe start point" before the current location - # (a point where the decoder has nothing buffered, so seek() - # can safely start from there and advance to this location). - for next_byte in next_input: - bytes_fed += 1 - chars_decoded += len(decoder.decode(next_byte)) - dec_buffer, dec_flags = decoder.getstate() - if not dec_buffer and chars_decoded <= chars_to_skip: - # Decoder buffer is empty, so this is a safe start point. - start_pos += bytes_fed - chars_to_skip -= chars_decoded - start_flags, bytes_fed, chars_decoded = dec_flags, 0, 0 - if chars_decoded >= chars_to_skip: - break - else: - # We didn't get enough decoded data; signal EOF to get more. - chars_decoded += len(decoder.decode(b'', final=True)) - need_eof = 1 - if chars_decoded < chars_to_skip: - raise IOError("can't reconstruct logical file position") - - # The returned cookie corresponds to the last safe start point. - return self._pack_cookie( - start_pos, start_flags, bytes_fed, need_eof, chars_to_skip) - finally: - decoder.setstate(saved_state) - - def truncate(self, pos=None): - self.flush() - if pos is None: - pos = self.tell() - self.seek(pos) - return self.buffer.truncate() - - def seek(self, cookie, whence=0): - if self.closed: - raise ValueError("tell on closed file") - if not self._seekable: - raise IOError("underlying stream is not seekable") - if whence == 1: # seek relative to current position - if cookie != 0: - raise IOError("can't do nonzero cur-relative seeks") - # Seeking to the current position should attempt to - # sync the underlying buffer with the current position. - whence = 0 - cookie = self.tell() - if whence == 2: # seek relative to end of file - if cookie != 0: - raise IOError("can't do nonzero end-relative seeks") - self.flush() - position = self.buffer.seek(0, 2) - self._set_decoded_chars('') - self._snapshot = None - if self._decoder: - self._decoder.reset() - return position - if whence != 0: - raise ValueError("invalid whence (%r, should be 0, 1 or 2)" % - (whence,)) - if cookie < 0: - raise ValueError("negative seek position %r" % (cookie,)) - self.flush() - - # The strategy of seek() is to go back to the safe start point - # and replay the effect of read(chars_to_skip) from there. - start_pos, dec_flags, bytes_to_feed, need_eof, chars_to_skip = \ - self._unpack_cookie(cookie) - - # Seek back to the safe start point. - self.buffer.seek(start_pos) - self._set_decoded_chars('') - self._snapshot = None - - # Restore the decoder to its state from the safe start point. - if self._decoder or dec_flags or chars_to_skip: - self._decoder = self._decoder or self._get_decoder() - self._decoder.setstate((b'', dec_flags)) - self._snapshot = (dec_flags, b'') - - if chars_to_skip: - # Just like _read_chunk, feed the decoder and save a snapshot. - input_chunk = self.buffer.read(bytes_to_feed) - self._set_decoded_chars( - self._decoder.decode(input_chunk, need_eof)) - self._snapshot = (dec_flags, input_chunk) - - # Skip chars_to_skip of the decoded characters. - if len(self._decoded_chars) < chars_to_skip: - raise IOError("can't restore logical file position") - self._decoded_chars_used = chars_to_skip - - return cookie - - def read(self, n=None): - if n is None: - n = -1 - decoder = self._decoder or self._get_decoder() - if n < 0: - # Read everything. - result = (self._get_decoded_chars() + - decoder.decode(self.buffer.read(), final=True)) - self._set_decoded_chars('') - self._snapshot = None - return result - else: - # Keep reading chunks until we have n characters to return. - eof = False - result = self._get_decoded_chars(n) - while len(result) < n and not eof: - eof = not self._read_chunk() - result += self._get_decoded_chars(n - len(result)) - return result - - def next(self): - self._telling = False - line = self.readline() - if not line: - self._snapshot = None - self._telling = self._seekable - raise StopIteration - return line - - def readline(self, limit=None): - if self.closed: - raise ValueError("read from closed file") - if limit is None: - limit = -1 - if not isinstance(limit, (int, long)): - raise TypeError("limit must be an integer") - - # Grab all the decoded text (we will rewind any extra bits later). - line = self._get_decoded_chars() - - start = 0 - decoder = self._decoder or self._get_decoder() - - pos = endpos = None - while True: - if self._readtranslate: - # Newlines are already translated, only search for \n - pos = line.find('\n', start) - if pos >= 0: - endpos = pos + 1 - break - else: - start = len(line) - - elif self._readuniversal: - # Universal newline search. Find any of \r, \r\n, \n - # The decoder ensures that \r\n are not split in two pieces - - # In C we'd look for these in parallel of course. - nlpos = line.find("\n", start) - crpos = line.find("\r", start) - if crpos == -1: - if nlpos == -1: - # Nothing found - start = len(line) - else: - # Found \n - endpos = nlpos + 1 - break - elif nlpos == -1: - # Found lone \r - endpos = crpos + 1 - break - elif nlpos < crpos: - # Found \n - endpos = nlpos + 1 - break - elif nlpos == crpos + 1: - # Found \r\n - endpos = crpos + 2 - break - else: - # Found \r - endpos = crpos + 1 - break - else: - # non-universal - pos = line.find(self._readnl) - if pos >= 0: - endpos = pos + len(self._readnl) - break - - if limit >= 0 and len(line) >= limit: - endpos = limit # reached length limit - break - - # No line ending seen yet - get more data - more_line = '' - while self._read_chunk(): - if self._decoded_chars: - break - if self._decoded_chars: - line += self._get_decoded_chars() - else: - # end of file - self._set_decoded_chars('') - self._snapshot = None - return line - - if limit >= 0 and endpos > limit: - endpos = limit # don't exceed limit - - # Rewind _decoded_chars to just after the line ending we found. - self._rewind_decoded_chars(len(line) - endpos) - return line[:endpos] - - @property - def newlines(self): - return self._decoder.newlines if self._decoder else None - -class StringIO(TextIOWrapper): - - """An in-memory stream for text. The initial_value argument sets the - value of object. The other arguments are like those of TextIOWrapper's - constructor. - """ - - def __init__(self, initial_value="", encoding="utf-8", - errors="strict", newline="\n"): - super(StringIO, self).__init__(BytesIO(), - encoding=encoding, - errors=errors, - newline=newline) - if initial_value: - if not isinstance(initial_value, unicode): - initial_value = unicode(initial_value) - self.write(initial_value) - self.seek(0) - - def getvalue(self): - self.flush() - return self.buffer.getvalue().decode(self._encoding, self._errors) +for klass in (BytesIO, BufferedReader, BufferedWriter, BufferedRandom, + BufferedRWPair): + BufferedIOBase.register(klass) + +for klass in (StringIO, TextIOWrapper): + TextIOBase.register(klass) +del klass Modified: python/branches/tk_and_idle_maintenance/Lib/lib2to3/Grammar.txt ============================================================================== --- python/branches/tk_and_idle_maintenance/Lib/lib2to3/Grammar.txt (original) +++ python/branches/tk_and_idle_maintenance/Lib/lib2to3/Grammar.txt Sat Jun 20 00:11:15 2009 @@ -90,7 +90,8 @@ ['else' ':' suite] ['finally' ':' suite] | 'finally' ':' suite)) -with_stmt: 'with' test [ with_var ] ':' suite +with_stmt: 'with' with_item (',' with_item)* ':' suite +with_item: test ['as' expr] with_var: 'as' expr # NB compile.c makes sure that the default except clause is last except_clause: 'except' [test [(',' | 'as') test]] Modified: python/branches/tk_and_idle_maintenance/Lib/lib2to3/fixer_base.py ============================================================================== --- python/branches/tk_and_idle_maintenance/Lib/lib2to3/fixer_base.py (original) +++ python/branches/tk_and_idle_maintenance/Lib/lib2to3/fixer_base.py Sat Jun 20 00:11:15 2009 @@ -120,7 +120,7 @@ """ lineno = node.get_lineno() for_output = node.clone() - for_output.set_prefix(u"") + for_output.prefix = u"" msg = "Line %d: could not convert: %s" self.log_message(msg % (lineno, for_output)) if reason: Modified: python/branches/tk_and_idle_maintenance/Lib/lib2to3/fixer_util.py ============================================================================== --- python/branches/tk_and_idle_maintenance/Lib/lib2to3/fixer_util.py (original) +++ python/branches/tk_and_idle_maintenance/Lib/lib2to3/fixer_util.py Sat Jun 20 00:11:15 2009 @@ -27,11 +27,11 @@ if not isinstance(target, list): target = [target] if not isinstance(source, list): - source.set_prefix(" ") + source.prefix = u" " source = [source] return Node(syms.atom, - target + [Leaf(token.EQUAL, "=", prefix=" ")] + source) + target + [Leaf(token.EQUAL, u"=", prefix=u" ")] + source) def Name(name, prefix=None): """Return a NAME leaf""" @@ -60,7 +60,7 @@ """A function call""" node = Node(syms.power, [func_name, ArgList(args)]) if prefix is not None: - node.set_prefix(prefix) + node.prefix = prefix return node def Newline(): @@ -89,18 +89,18 @@ If test is None, the "if test" part is omitted. """ - xp.set_prefix(u"") - fp.set_prefix(u" ") - it.set_prefix(u" ") + xp.prefix = u"" + fp.prefix = u" " + it.prefix = u" " for_leaf = Leaf(token.NAME, u"for") - for_leaf.set_prefix(u" ") + for_leaf.prefix = u" " in_leaf = Leaf(token.NAME, u"in") - in_leaf.set_prefix(u" ") + in_leaf.prefix = u" " inner_args = [for_leaf, fp, in_leaf, it] if test: - test.set_prefix(u" ") + test.prefix = u" " if_leaf = Leaf(token.NAME, u"if") - if_leaf.set_prefix(u" ") + if_leaf.prefix = u" " inner_args.append(Node(syms.comp_if, [if_leaf, test])) inner = Node(syms.listmaker, [xp, Node(syms.comp_for, inner_args)]) return Node(syms.atom, Modified: python/branches/tk_and_idle_maintenance/Lib/lib2to3/fixes/fix_apply.py ============================================================================== --- python/branches/tk_and_idle_maintenance/Lib/lib2to3/fixes/fix_apply.py (original) +++ python/branches/tk_and_idle_maintenance/Lib/lib2to3/fixes/fix_apply.py Sat Jun 20 00:11:15 2009 @@ -33,25 +33,25 @@ func = results["func"] args = results["args"] kwds = results.get("kwds") - prefix = node.get_prefix() + prefix = node.prefix func = func.clone() if (func.type not in (token.NAME, syms.atom) and (func.type != syms.power or func.children[-2].type == token.DOUBLESTAR)): # Need to parenthesize func = parenthesize(func) - func.set_prefix("") + func.prefix = "" args = args.clone() - args.set_prefix("") + args.prefix = "" if kwds is not None: kwds = kwds.clone() - kwds.set_prefix("") + kwds.prefix = "" l_newargs = [pytree.Leaf(token.STAR, u"*"), args] if kwds is not None: l_newargs.extend([Comma(), pytree.Leaf(token.DOUBLESTAR, u"**"), kwds]) - l_newargs[-2].set_prefix(u" ") # that's the ** token + l_newargs[-2].prefix = u" " # that's the ** token # XXX Sometimes we could be cleverer, e.g. apply(f, (x, y) + t) # can be translated into f(x, y, *t) instead of f(*(x, y) + t) #new = pytree.Node(syms.power, (func, ArgList(l_newargs))) Modified: python/branches/tk_and_idle_maintenance/Lib/lib2to3/fixes/fix_basestring.py ============================================================================== --- python/branches/tk_and_idle_maintenance/Lib/lib2to3/fixes/fix_basestring.py (original) +++ python/branches/tk_and_idle_maintenance/Lib/lib2to3/fixes/fix_basestring.py Sat Jun 20 00:11:15 2009 @@ -10,4 +10,4 @@ PATTERN = "'basestring'" def transform(self, node, results): - return Name(u"str", prefix=node.get_prefix()) + return Name(u"str", prefix=node.prefix) Modified: python/branches/tk_and_idle_maintenance/Lib/lib2to3/fixes/fix_buffer.py ============================================================================== --- python/branches/tk_and_idle_maintenance/Lib/lib2to3/fixes/fix_buffer.py (original) +++ python/branches/tk_and_idle_maintenance/Lib/lib2to3/fixes/fix_buffer.py Sat Jun 20 00:11:15 2009 @@ -13,9 +13,9 @@ explicit = True # The user must ask for this fixer PATTERN = """ - power< name='buffer' trailer< '(' [any] ')' > > + power< name='buffer' trailer< '(' [any] ')' > any* > """ def transform(self, node, results): name = results["name"] - name.replace(Name(u"memoryview", prefix=name.get_prefix())) + name.replace(Name(u"memoryview", prefix=name.prefix)) Modified: python/branches/tk_and_idle_maintenance/Lib/lib2to3/fixes/fix_callable.py ============================================================================== --- python/branches/tk_and_idle_maintenance/Lib/lib2to3/fixes/fix_callable.py (original) +++ python/branches/tk_and_idle_maintenance/Lib/lib2to3/fixes/fix_callable.py Sat Jun 20 00:11:15 2009 @@ -28,4 +28,4 @@ func = results["func"] args = [func.clone(), String(u', '), String(u"'__call__'")] - return Call(Name(u"hasattr"), args, prefix=node.get_prefix()) + return Call(Name(u"hasattr"), args, prefix=node.prefix) Modified: python/branches/tk_and_idle_maintenance/Lib/lib2to3/fixes/fix_dict.py ============================================================================== --- python/branches/tk_and_idle_maintenance/Lib/lib2to3/fixes/fix_dict.py (original) +++ python/branches/tk_and_idle_maintenance/Lib/lib2to3/fixes/fix_dict.py Sat Jun 20 00:11:15 2009 @@ -61,15 +61,15 @@ args = head + [pytree.Node(syms.trailer, [Dot(), Name(method_name, - prefix=method.get_prefix())]), + prefix=method.prefix)]), results["parens"].clone()] new = pytree.Node(syms.power, args) if not special: - new.set_prefix(u"") + new.prefix = u"" new = Call(Name(isiter and u"iter" or u"list"), [new]) if tail: new = pytree.Node(syms.power, [new] + tail) - new.set_prefix(node.get_prefix()) + new.prefix = node.prefix return new P1 = "power< func=NAME trailer< '(' node=any ')' > any* >" Modified: python/branches/tk_and_idle_maintenance/Lib/lib2to3/fixes/fix_except.py ============================================================================== --- python/branches/tk_and_idle_maintenance/Lib/lib2to3/fixes/fix_except.py (original) +++ python/branches/tk_and_idle_maintenance/Lib/lib2to3/fixes/fix_except.py Sat Jun 20 00:11:15 2009 @@ -36,11 +36,11 @@ class FixExcept(fixer_base.BaseFix): PATTERN = """ - try_stmt< 'try' ':' suite - cleanup=(except_clause ':' suite)+ - tail=(['except' ':' suite] - ['else' ':' suite] - ['finally' ':' suite]) > + try_stmt< 'try' ':' (simple_stmt | suite) + cleanup=(except_clause ':' (simple_stmt | suite))+ + tail=(['except' ':' (simple_stmt | suite)] + ['else' ':' (simple_stmt | suite)] + ['finally' ':' (simple_stmt | suite)]) > """ def transform(self, node, results): @@ -58,7 +58,7 @@ # Generate a new N for the except clause new_N = Name(self.new_name(), prefix=u" ") target = N.clone() - target.set_prefix(u"") + target.prefix = u"" N.replace(new_N) new_N = new_N.clone() @@ -82,10 +82,10 @@ for child in reversed(suite_stmts[:i]): e_suite.insert_child(0, child) e_suite.insert_child(i, assign) - elif N.get_prefix() == u"": + elif N.prefix == u"": # No space after a comma is legal; no space after "as", # not so much. - N.set_prefix(u" ") + N.prefix = u" " #TODO(cwinter) fix this when children becomes a smart list children = [c.clone() for c in node.children[:3]] + try_cleanup + tail Modified: python/branches/tk_and_idle_maintenance/Lib/lib2to3/fixes/fix_exec.py ============================================================================== --- python/branches/tk_and_idle_maintenance/Lib/lib2to3/fixes/fix_exec.py (original) +++ python/branches/tk_and_idle_maintenance/Lib/lib2to3/fixes/fix_exec.py Sat Jun 20 00:11:15 2009 @@ -30,10 +30,10 @@ b = results.get("b") c = results.get("c") args = [a.clone()] - args[0].set_prefix("") + args[0].prefix = "" if b is not None: args.extend([Comma(), b.clone()]) if c is not None: args.extend([Comma(), c.clone()]) - return Call(Name(u"exec"), args, prefix=node.get_prefix()) + return Call(Name(u"exec"), args, prefix=node.prefix) Modified: python/branches/tk_and_idle_maintenance/Lib/lib2to3/fixes/fix_execfile.py ============================================================================== --- python/branches/tk_and_idle_maintenance/Lib/lib2to3/fixes/fix_execfile.py (original) +++ python/branches/tk_and_idle_maintenance/Lib/lib2to3/fixes/fix_execfile.py Sat Jun 20 00:11:15 2009 @@ -38,7 +38,7 @@ # Wrap the open call in a compile call. This is so the filename will be # preserved in the execed code. filename_arg = filename.clone() - filename_arg.set_prefix(u" ") + filename_arg.prefix = u" " exec_str = String(u"'exec'", u" ") compile_args = open_expr + [Comma(), filename_arg, Comma(), exec_str] compile_call = Call(Name(u"compile"), compile_args, u"") @@ -48,4 +48,4 @@ args.extend([Comma(), globals.clone()]) if locals is not None: args.extend([Comma(), locals.clone()]) - return Call(Name(u"exec"), args, prefix=node.get_prefix()) + return Call(Name(u"exec"), args, prefix=node.prefix) Modified: python/branches/tk_and_idle_maintenance/Lib/lib2to3/fixes/fix_filter.py ============================================================================== --- python/branches/tk_and_idle_maintenance/Lib/lib2to3/fixes/fix_filter.py (original) +++ python/branches/tk_and_idle_maintenance/Lib/lib2to3/fixes/fix_filter.py Sat Jun 20 00:11:15 2009 @@ -69,7 +69,7 @@ if in_special_context(node): return None new = node.clone() - new.set_prefix(u"") + new.prefix = u"" new = Call(Name(u"list"), [new]) - new.set_prefix(node.get_prefix()) + new.prefix = node.prefix return new Modified: python/branches/tk_and_idle_maintenance/Lib/lib2to3/fixes/fix_funcattrs.py ============================================================================== --- python/branches/tk_and_idle_maintenance/Lib/lib2to3/fixes/fix_funcattrs.py (original) +++ python/branches/tk_and_idle_maintenance/Lib/lib2to3/fixes/fix_funcattrs.py Sat Jun 20 00:11:15 2009 @@ -16,4 +16,4 @@ def transform(self, node, results): attr = results["attr"][0] attr.replace(Name((u"__%s__" % attr.value[5:]), - prefix=attr.get_prefix())) + prefix=attr.prefix)) Modified: python/branches/tk_and_idle_maintenance/Lib/lib2to3/fixes/fix_future.py ============================================================================== --- python/branches/tk_and_idle_maintenance/Lib/lib2to3/fixes/fix_future.py (original) +++ python/branches/tk_and_idle_maintenance/Lib/lib2to3/fixes/fix_future.py Sat Jun 20 00:11:15 2009 @@ -16,5 +16,5 @@ def transform(self, node, results): new = BlankLine() - new.prefix = node.get_prefix() + new.prefix = node.prefix return new Modified: python/branches/tk_and_idle_maintenance/Lib/lib2to3/fixes/fix_getcwdu.py ============================================================================== --- python/branches/tk_and_idle_maintenance/Lib/lib2to3/fixes/fix_getcwdu.py (original) +++ python/branches/tk_and_idle_maintenance/Lib/lib2to3/fixes/fix_getcwdu.py Sat Jun 20 00:11:15 2009 @@ -15,4 +15,4 @@ def transform(self, node, results): name = results["name"] - name.replace(Name(u"getcwd", prefix=name.get_prefix())) + name.replace(Name(u"getcwd", prefix=name.prefix)) Modified: python/branches/tk_and_idle_maintenance/Lib/lib2to3/fixes/fix_has_key.py ============================================================================== --- python/branches/tk_and_idle_maintenance/Lib/lib2to3/fixes/fix_has_key.py (original) +++ python/branches/tk_and_idle_maintenance/Lib/lib2to3/fixes/fix_has_key.py Sat Jun 20 00:11:15 2009 @@ -78,7 +78,7 @@ return None negation = results.get("negation") anchor = results["anchor"] - prefix = node.get_prefix() + prefix = node.prefix before = [n.clone() for n in results["before"]] arg = results["arg"].clone() after = results.get("after") @@ -91,7 +91,7 @@ before = before[0] else: before = pytree.Node(syms.power, before) - before.set_prefix(u" ") + before.prefix = u" " n_op = Name(u"in", prefix=u" ") if negation: n_not = Name(u"not", prefix=u" ") @@ -105,5 +105,5 @@ syms.arith_expr, syms.term, syms.factor, syms.power): new = parenthesize(new) - new.set_prefix(prefix) + new.prefix = prefix return new Modified: python/branches/tk_and_idle_maintenance/Lib/lib2to3/fixes/fix_idioms.py ============================================================================== --- python/branches/tk_and_idle_maintenance/Lib/lib2to3/fixes/fix_idioms.py (original) +++ python/branches/tk_and_idle_maintenance/Lib/lib2to3/fixes/fix_idioms.py Sat Jun 20 00:11:15 2009 @@ -101,18 +101,18 @@ def transform_isinstance(self, node, results): x = results["x"].clone() # The thing inside of type() T = results["T"].clone() # The type being compared against - x.set_prefix("") - T.set_prefix(" ") - test = Call(Name("isinstance"), [x, Comma(), T]) + x.prefix = u"" + T.prefix = u" " + test = Call(Name(u"isinstance"), [x, Comma(), T]) if "n" in results: - test.set_prefix(u" ") + test.prefix = u" " test = Node(syms.not_test, [Name(u"not"), test]) - test.set_prefix(node.get_prefix()) + test.prefix = node.prefix return test def transform_while(self, node, results): one = results["while"] - one.replace(Name(u"True", prefix=one.get_prefix())) + one.replace(Name(u"True", prefix=one.prefix)) def transform_sort(self, node, results): sort_stmt = results["sort"] @@ -121,14 +121,14 @@ simple_expr = results.get("expr") if list_call: - list_call.replace(Name(u"sorted", prefix=list_call.get_prefix())) + list_call.replace(Name(u"sorted", prefix=list_call.prefix)) elif simple_expr: new = simple_expr.clone() - new.set_prefix(u"") + new.prefix = u"" simple_expr.replace(Call(Name(u"sorted"), [new], - prefix=simple_expr.get_prefix())) + prefix=simple_expr.prefix)) else: raise RuntimeError("should not have reached here") sort_stmt.remove() if next_stmt: - next_stmt[0].set_prefix(sort_stmt.get_prefix()) + next_stmt[0].prefix = sort_stmt.prefix Modified: python/branches/tk_and_idle_maintenance/Lib/lib2to3/fixes/fix_import.py ============================================================================== --- python/branches/tk_and_idle_maintenance/Lib/lib2to3/fixes/fix_import.py (original) +++ python/branches/tk_and_idle_maintenance/Lib/lib2to3/fixes/fix_import.py Sat Jun 20 00:11:15 2009 @@ -73,7 +73,7 @@ return new = FromImport('.', [imp]) - new.set_prefix(node.get_prefix()) + new.prefix = node.prefix return new def probably_a_local_import(self, imp_name): Modified: python/branches/tk_and_idle_maintenance/Lib/lib2to3/fixes/fix_imports.py ============================================================================== --- python/branches/tk_and_idle_maintenance/Lib/lib2to3/fixes/fix_imports.py (original) +++ python/branches/tk_and_idle_maintenance/Lib/lib2to3/fixes/fix_imports.py Sat Jun 20 00:11:15 2009 @@ -124,7 +124,7 @@ if import_mod: mod_name = import_mod.value new_name = unicode(self.mapping[mod_name]) - import_mod.replace(Name(new_name, prefix=import_mod.get_prefix())) + import_mod.replace(Name(new_name, prefix=import_mod.prefix)) if "name_import" in results: # If it's not a "from x import x, y" or "import x as y" import, # marked its usage to be replaced. @@ -142,4 +142,4 @@ bare_name = results["bare_with_attr"][0] new_name = self.replace.get(bare_name.value) if new_name: - bare_name.replace(Name(new_name, prefix=bare_name.get_prefix())) + bare_name.replace(Name(new_name, prefix=bare_name.prefix)) Modified: python/branches/tk_and_idle_maintenance/Lib/lib2to3/fixes/fix_input.py ============================================================================== --- python/branches/tk_and_idle_maintenance/Lib/lib2to3/fixes/fix_input.py (original) +++ python/branches/tk_and_idle_maintenance/Lib/lib2to3/fixes/fix_input.py Sat Jun 20 00:11:15 2009 @@ -22,5 +22,5 @@ return new = node.clone() - new.set_prefix(u"") - return Call(Name(u"eval"), [new], prefix=node.get_prefix()) + new.prefix = u"" + return Call(Name(u"eval"), [new], prefix=node.prefix) Modified: python/branches/tk_and_idle_maintenance/Lib/lib2to3/fixes/fix_intern.py ============================================================================== --- python/branches/tk_and_idle_maintenance/Lib/lib2to3/fixes/fix_intern.py (original) +++ python/branches/tk_and_idle_maintenance/Lib/lib2to3/fixes/fix_intern.py Sat Jun 20 00:11:15 2009 @@ -39,6 +39,6 @@ [results["lpar"].clone(), newarglist, results["rpar"].clone()])] + after) - new.set_prefix(node.get_prefix()) + new.prefix = node.prefix touch_import(None, u'sys', node) return new Modified: python/branches/tk_and_idle_maintenance/Lib/lib2to3/fixes/fix_isinstance.py ============================================================================== --- python/branches/tk_and_idle_maintenance/Lib/lib2to3/fixes/fix_isinstance.py (original) +++ python/branches/tk_and_idle_maintenance/Lib/lib2to3/fixes/fix_isinstance.py Sat Jun 20 00:11:15 2009 @@ -45,7 +45,7 @@ del new_args[-1] if len(new_args) == 1: atom = testlist.parent - new_args[0].set_prefix(atom.get_prefix()) + new_args[0].prefix = atom.prefix atom.replace(new_args[0]) else: args[:] = new_args Modified: python/branches/tk_and_idle_maintenance/Lib/lib2to3/fixes/fix_itertools.py ============================================================================== --- python/branches/tk_and_idle_maintenance/Lib/lib2to3/fixes/fix_itertools.py (original) +++ python/branches/tk_and_idle_maintenance/Lib/lib2to3/fixes/fix_itertools.py Sat Jun 20 00:11:15 2009 @@ -30,12 +30,12 @@ if 'it' in results and func.value != u'ifilterfalse': dot, it = (results['dot'], results['it']) # Remove the 'itertools' - prefix = it.get_prefix() + prefix = it.prefix it.remove() # Replace the node wich contains ('.', 'function') with the # function (to be consistant with the second part of the pattern) dot.remove() func.parent.replace(func) - prefix = prefix or func.get_prefix() + prefix = prefix or func.prefix func.replace(Name(func.value[1:], prefix=prefix)) Modified: python/branches/tk_and_idle_maintenance/Lib/lib2to3/fixes/fix_itertools_imports.py ============================================================================== --- python/branches/tk_and_idle_maintenance/Lib/lib2to3/fixes/fix_itertools_imports.py (original) +++ python/branches/tk_and_idle_maintenance/Lib/lib2to3/fixes/fix_itertools_imports.py Sat Jun 20 00:11:15 2009 @@ -46,7 +46,7 @@ # If there are no imports left, just get rid of the entire statement if not (imports.children or getattr(imports, 'value', None)) or \ imports.parent is None: - p = node.get_prefix() + p = node.prefix node = BlankLine() node.prefix = p return node Modified: python/branches/tk_and_idle_maintenance/Lib/lib2to3/fixes/fix_long.py ============================================================================== --- python/branches/tk_and_idle_maintenance/Lib/lib2to3/fixes/fix_long.py (original) +++ python/branches/tk_and_idle_maintenance/Lib/lib2to3/fixes/fix_long.py Sat Jun 20 00:11:15 2009 @@ -18,5 +18,5 @@ def transform(self, node, results): if is_probably_builtin(node): new = self.static_int.clone() - new.set_prefix(node.get_prefix()) + new.prefix = node.prefix return new Modified: python/branches/tk_and_idle_maintenance/Lib/lib2to3/fixes/fix_map.py ============================================================================== --- python/branches/tk_and_idle_maintenance/Lib/lib2to3/fixes/fix_map.py (original) +++ python/branches/tk_and_idle_maintenance/Lib/lib2to3/fixes/fix_map.py Sat Jun 20 00:11:15 2009 @@ -63,7 +63,7 @@ if node.parent.type == syms.simple_stmt: self.warning(node, "You should use a for loop here") new = node.clone() - new.set_prefix(u"") + new.prefix = u"" new = Call(Name(u"list"), [new]) elif "map_lambda" in results: new = ListComp(results.get("xp").clone(), @@ -76,7 +76,7 @@ if in_special_context(node): return None new = node.clone() - new.set_prefix(u"") + new.prefix = u"" new = Call(Name(u"list"), [new]) - new.set_prefix(node.get_prefix()) + new.prefix = node.prefix return new Modified: python/branches/tk_and_idle_maintenance/Lib/lib2to3/fixes/fix_metaclass.py ============================================================================== --- python/branches/tk_and_idle_maintenance/Lib/lib2to3/fixes/fix_metaclass.py (original) +++ python/branches/tk_and_idle_maintenance/Lib/lib2to3/fixes/fix_metaclass.py Sat Jun 20 00:11:15 2009 @@ -89,7 +89,7 @@ parent.insert_child(i, new_stmt) new_leaf1 = new_stmt.children[0].children[0] old_leaf1 = stmt_node.children[0].children[0] - new_leaf1.set_prefix(old_leaf1.get_prefix()) + new_leaf1.prefix = old_leaf1.prefix def remove_trailing_newline(node): @@ -136,7 +136,7 @@ node = kids.pop() if isinstance(node, Leaf) and node.type != token.DEDENT: if node.prefix: - node.set_prefix('') + node.prefix = u'' return else: kids.extend(node.children[::-1]) @@ -191,19 +191,19 @@ # now stick the metaclass in the arglist meta_txt = last_metaclass.children[0].children[0] meta_txt.value = 'metaclass' - orig_meta_prefix = meta_txt.get_prefix() + orig_meta_prefix = meta_txt.prefix if arglist.children: arglist.append_child(Leaf(token.COMMA, u',')) - meta_txt.set_prefix(u' ') + meta_txt.prefix = u' ' else: - meta_txt.set_prefix(u'') + meta_txt.prefix = u'' # compact the expression "metaclass = Meta" -> "metaclass=Meta" expr_stmt = last_metaclass.children[0] assert expr_stmt.type == syms.expr_stmt - expr_stmt.children[1].set_prefix(u'') - expr_stmt.children[2].set_prefix(u'') + expr_stmt.children[1].prefix = u'' + expr_stmt.children[2].prefix = u'' arglist.append_child(last_metaclass) @@ -214,7 +214,7 @@ # one-liner that was just __metaclass_ suite.remove() pass_leaf = Leaf(text_type, u'pass') - pass_leaf.set_prefix(orig_meta_prefix) + pass_leaf.prefix = orig_meta_prefix node.append_child(pass_leaf) node.append_child(Leaf(token.NEWLINE, u'\n')) Modified: python/branches/tk_and_idle_maintenance/Lib/lib2to3/fixes/fix_methodattrs.py ============================================================================== --- python/branches/tk_and_idle_maintenance/Lib/lib2to3/fixes/fix_methodattrs.py (original) +++ python/branches/tk_and_idle_maintenance/Lib/lib2to3/fixes/fix_methodattrs.py Sat Jun 20 00:11:15 2009 @@ -20,4 +20,4 @@ def transform(self, node, results): attr = results["attr"][0] new = unicode(MAP[attr.value]) - attr.replace(Name(new, prefix=attr.get_prefix())) + attr.replace(Name(new, prefix=attr.prefix)) Modified: python/branches/tk_and_idle_maintenance/Lib/lib2to3/fixes/fix_ne.py ============================================================================== --- python/branches/tk_and_idle_maintenance/Lib/lib2to3/fixes/fix_ne.py (original) +++ python/branches/tk_and_idle_maintenance/Lib/lib2to3/fixes/fix_ne.py Sat Jun 20 00:11:15 2009 @@ -17,6 +17,5 @@ return node.type == token.NOTEQUAL and node.value == u"<>" def transform(self, node, results): - new = pytree.Leaf(token.NOTEQUAL, u"!=") - new.set_prefix(node.get_prefix()) + new = pytree.Leaf(token.NOTEQUAL, u"!=", prefix=node.prefix) return new Modified: python/branches/tk_and_idle_maintenance/Lib/lib2to3/fixes/fix_next.py ============================================================================== --- python/branches/tk_and_idle_maintenance/Lib/lib2to3/fixes/fix_next.py (original) +++ python/branches/tk_and_idle_maintenance/Lib/lib2to3/fixes/fix_next.py Sat Jun 20 00:11:15 2009 @@ -48,17 +48,16 @@ base = results.get("base") attr = results.get("attr") name = results.get("name") - mod = results.get("mod") if base: if self.shadowed_next: - attr.replace(Name(u"__next__", prefix=attr.get_prefix())) + attr.replace(Name(u"__next__", prefix=attr.prefix)) else: base = [n.clone() for n in base] - base[0].set_prefix(u"") - node.replace(Call(Name(u"next", prefix=node.get_prefix()), base)) + base[0].prefix = u"" + node.replace(Call(Name(u"next", prefix=node.prefix), base)) elif name: - n = Name(u"__next__", prefix=name.get_prefix()) + n = Name(u"__next__", prefix=name.prefix) name.replace(n) elif attr: # We don't do this transformation if we're assigning to "x.next". Modified: python/branches/tk_and_idle_maintenance/Lib/lib2to3/fixes/fix_nonzero.py ============================================================================== --- python/branches/tk_and_idle_maintenance/Lib/lib2to3/fixes/fix_nonzero.py (original) +++ python/branches/tk_and_idle_maintenance/Lib/lib2to3/fixes/fix_nonzero.py Sat Jun 20 00:11:15 2009 @@ -16,5 +16,5 @@ def transform(self, node, results): name = results["name"] - new = Name(u"__bool__", prefix=name.get_prefix()) + new = Name(u"__bool__", prefix=name.prefix) name.replace(new) Modified: python/branches/tk_and_idle_maintenance/Lib/lib2to3/fixes/fix_numliterals.py ============================================================================== --- python/branches/tk_and_idle_maintenance/Lib/lib2to3/fixes/fix_numliterals.py (original) +++ python/branches/tk_and_idle_maintenance/Lib/lib2to3/fixes/fix_numliterals.py Sat Jun 20 00:11:15 2009 @@ -24,4 +24,4 @@ elif val.startswith(u'0') and val.isdigit() and len(set(val)) > 1: val = u"0o" + val[1:] - return Number(val, prefix=node.get_prefix()) + return Number(val, prefix=node.prefix) Modified: python/branches/tk_and_idle_maintenance/Lib/lib2to3/fixes/fix_paren.py ============================================================================== --- python/branches/tk_and_idle_maintenance/Lib/lib2to3/fixes/fix_paren.py (original) +++ python/branches/tk_and_idle_maintenance/Lib/lib2to3/fixes/fix_paren.py Sat Jun 20 00:11:15 2009 @@ -36,7 +36,7 @@ target = results["target"] lparen = LParen() - lparen.set_prefix(target.get_prefix()) - target.set_prefix(u"") # Make it hug the parentheses + lparen.prefix = target.prefix + target.prefix = u"" # Make it hug the parentheses target.insert_child(0, lparen) target.append_child(RParen()) Modified: python/branches/tk_and_idle_maintenance/Lib/lib2to3/fixes/fix_print.py ============================================================================== --- python/branches/tk_and_idle_maintenance/Lib/lib2to3/fixes/fix_print.py (original) +++ python/branches/tk_and_idle_maintenance/Lib/lib2to3/fixes/fix_print.py Sat Jun 20 00:11:15 2009 @@ -45,7 +45,7 @@ if bare_print: # Special-case print all by itself bare_print.replace(Call(Name(u"print"), [], - prefix=bare_print.get_prefix())) + prefix=bare_print.prefix)) return assert node.children[0] == Name(u"print") args = node.children[1:] @@ -65,7 +65,7 @@ # Now synthesize a print(args, sep=..., end=..., file=...) node. l_args = [arg.clone() for arg in args] if l_args: - l_args[0].set_prefix(u"") + l_args[0].prefix = u"" if sep is not None or end is not None or file is not None: if sep is not None: self.add_kwarg(l_args, u"sep", String(repr(sep))) @@ -74,17 +74,17 @@ if file is not None: self.add_kwarg(l_args, u"file", file) n_stmt = Call(Name(u"print"), l_args) - n_stmt.set_prefix(node.get_prefix()) + n_stmt.prefix = node.prefix return n_stmt def add_kwarg(self, l_nodes, s_kwd, n_expr): # XXX All this prefix-setting may lose comments (though rarely) - n_expr.set_prefix(u"") + n_expr.prefix = u"" n_argument = pytree.Node(self.syms.argument, (Name(s_kwd), pytree.Leaf(token.EQUAL, u"="), n_expr)) if l_nodes: l_nodes.append(Comma()) - n_argument.set_prefix(u" ") + n_argument.prefix = u" " l_nodes.append(n_argument) Modified: python/branches/tk_and_idle_maintenance/Lib/lib2to3/fixes/fix_raise.py ============================================================================== --- python/branches/tk_and_idle_maintenance/Lib/lib2to3/fixes/fix_raise.py (original) +++ python/branches/tk_and_idle_maintenance/Lib/lib2to3/fixes/fix_raise.py Sat Jun 20 00:11:15 2009 @@ -52,31 +52,31 @@ # exc.children[1:-1] is the unparenthesized tuple # exc.children[1].children[0] is the first element of the tuple exc = exc.children[1].children[0].clone() - exc.set_prefix(" ") + exc.prefix = " " if "val" not in results: # One-argument raise new = pytree.Node(syms.raise_stmt, [Name(u"raise"), exc]) - new.set_prefix(node.get_prefix()) + new.prefix = node.prefix return new val = results["val"].clone() if is_tuple(val): args = [c.clone() for c in val.children[1:-1]] else: - val.set_prefix(u"") + val.prefix = u"" args = [val] if "tb" in results: tb = results["tb"].clone() - tb.set_prefix(u"") + tb.prefix = u"" e = Call(exc, args) with_tb = Attr(e, Name(u'with_traceback')) + [ArgList([tb])] new = pytree.Node(syms.simple_stmt, [Name(u"raise")] + with_tb) - new.set_prefix(node.get_prefix()) + new.prefix = node.prefix return new else: return pytree.Node(syms.raise_stmt, [Name(u"raise"), Call(exc, args)], - prefix=node.get_prefix()) + prefix=node.prefix) Modified: python/branches/tk_and_idle_maintenance/Lib/lib2to3/fixes/fix_raw_input.py ============================================================================== --- python/branches/tk_and_idle_maintenance/Lib/lib2to3/fixes/fix_raw_input.py (original) +++ python/branches/tk_and_idle_maintenance/Lib/lib2to3/fixes/fix_raw_input.py Sat Jun 20 00:11:15 2009 @@ -13,4 +13,4 @@ def transform(self, node, results): name = results["name"] - name.replace(Name(u"input", prefix=name.get_prefix())) + name.replace(Name(u"input", prefix=name.prefix)) Modified: python/branches/tk_and_idle_maintenance/Lib/lib2to3/fixes/fix_renames.py ============================================================================== --- python/branches/tk_and_idle_maintenance/Lib/lib2to3/fixes/fix_renames.py (original) +++ python/branches/tk_and_idle_maintenance/Lib/lib2to3/fixes/fix_renames.py Sat Jun 20 00:11:15 2009 @@ -66,4 +66,4 @@ if mod_name and attr_name: new_attr = unicode(LOOKUP[(mod_name.value, attr_name.value)]) - attr_name.replace(Name(new_attr, prefix=attr_name.get_prefix())) + attr_name.replace(Name(new_attr, prefix=attr_name.prefix)) Modified: python/branches/tk_and_idle_maintenance/Lib/lib2to3/fixes/fix_repr.py ============================================================================== --- python/branches/tk_and_idle_maintenance/Lib/lib2to3/fixes/fix_repr.py (original) +++ python/branches/tk_and_idle_maintenance/Lib/lib2to3/fixes/fix_repr.py Sat Jun 20 00:11:15 2009 @@ -19,4 +19,4 @@ if expr.type == self.syms.testlist1: expr = parenthesize(expr) - return Call(Name(u"repr"), [expr], prefix=node.get_prefix()) + return Call(Name(u"repr"), [expr], prefix=node.prefix) Modified: python/branches/tk_and_idle_maintenance/Lib/lib2to3/fixes/fix_set_literal.py ============================================================================== --- python/branches/tk_and_idle_maintenance/Lib/lib2to3/fixes/fix_set_literal.py (original) +++ python/branches/tk_and_idle_maintenance/Lib/lib2to3/fixes/fix_set_literal.py Sat Jun 20 00:11:15 2009 @@ -38,15 +38,15 @@ literal.extend(n.clone() for n in items.children) literal.append(pytree.Leaf(token.RBRACE, u"}")) # Set the prefix of the right brace to that of the ')' or ']' - literal[-1].set_prefix(items.next_sibling.get_prefix()) + literal[-1].prefix = items.next_sibling.prefix maker = pytree.Node(syms.dictsetmaker, literal) - maker.set_prefix(node.get_prefix()) + maker.prefix = node.prefix # If the original was a one tuple, we need to remove the extra comma. if len(maker.children) == 4: n = maker.children[2] n.remove() - maker.children[-1].set_prefix(n.get_prefix()) + maker.children[-1].prefix = n.prefix # Finally, replace the set call with our shiny new literal. return maker Modified: python/branches/tk_and_idle_maintenance/Lib/lib2to3/fixes/fix_standarderror.py ============================================================================== --- python/branches/tk_and_idle_maintenance/Lib/lib2to3/fixes/fix_standarderror.py (original) +++ python/branches/tk_and_idle_maintenance/Lib/lib2to3/fixes/fix_standarderror.py Sat Jun 20 00:11:15 2009 @@ -15,4 +15,4 @@ """ def transform(self, node, results): - return Name(u"Exception", prefix=node.get_prefix()) + return Name(u"Exception", prefix=node.prefix) Modified: python/branches/tk_and_idle_maintenance/Lib/lib2to3/fixes/fix_sys_exc.py ============================================================================== --- python/branches/tk_and_idle_maintenance/Lib/lib2to3/fixes/fix_sys_exc.py (original) +++ python/branches/tk_and_idle_maintenance/Lib/lib2to3/fixes/fix_sys_exc.py Sat Jun 20 00:11:15 2009 @@ -22,8 +22,8 @@ sys_attr = results["attribute"][0] index = Number(self.exc_info.index(sys_attr.value)) - call = Call(Name(u"exc_info"), prefix=sys_attr.get_prefix()) + call = Call(Name(u"exc_info"), prefix=sys_attr.prefix) attr = Attr(Name(u"sys"), call) - attr[1].children[0].set_prefix(results["dot"].get_prefix()) + attr[1].children[0].prefix = results["dot"].prefix attr.append(Subscript(index)) - return Node(syms.power, attr, prefix=node.get_prefix()) + return Node(syms.power, attr, prefix=node.prefix) Modified: python/branches/tk_and_idle_maintenance/Lib/lib2to3/fixes/fix_throw.py ============================================================================== --- python/branches/tk_and_idle_maintenance/Lib/lib2to3/fixes/fix_throw.py (original) +++ python/branches/tk_and_idle_maintenance/Lib/lib2to3/fixes/fix_throw.py Sat Jun 20 00:11:15 2009 @@ -40,14 +40,14 @@ if is_tuple(val): args = [c.clone() for c in val.children[1:-1]] else: - val.set_prefix(u"") + val.prefix = u"" args = [val] throw_args = results["args"] if "tb" in results: tb = results["tb"].clone() - tb.set_prefix(u"") + tb.prefix = u"" e = Call(exc, args) with_tb = Attr(e, Name(u'with_traceback')) + [ArgList([tb])] Modified: python/branches/tk_and_idle_maintenance/Lib/lib2to3/fixes/fix_tuple_params.py ============================================================================== --- python/branches/tk_and_idle_maintenance/Lib/lib2to3/fixes/fix_tuple_params.py (original) +++ python/branches/tk_and_idle_maintenance/Lib/lib2to3/fixes/fix_tuple_params.py Sat Jun 20 00:11:15 2009 @@ -63,10 +63,10 @@ def handle_tuple(tuple_arg, add_prefix=False): n = Name(self.new_name()) arg = tuple_arg.clone() - arg.set_prefix(u"") + arg.prefix = u"" stmt = Assign(arg, n.clone()) if add_prefix: - n.set_prefix(u" ") + n.prefix = u" " tuple_arg.replace(n) new_lines.append(pytree.Node(syms.simple_stmt, [stmt, end.clone()])) @@ -91,14 +91,14 @@ # TODO(cwinter) suite-cleanup after = start if start == 0: - new_lines[0].set_prefix(u" ") + new_lines[0].prefix = u" " elif is_docstring(suite[0].children[start]): - new_lines[0].set_prefix(indent) + new_lines[0].prefix = indent after = start + 1 suite[0].children[after:after] = new_lines for i in range(after+1, after+len(new_lines)+1): - suite[0].children[i].set_prefix(indent) + suite[0].children[i].prefix = indent suite[0].changed() def transform_lambda(self, node, results): @@ -109,7 +109,7 @@ # Replace lambda ((((x)))): x with lambda x: x if inner.type == token.NAME: inner = inner.clone() - inner.set_prefix(u" ") + inner.prefix = u" " args.replace(inner) return @@ -124,7 +124,7 @@ subscripts = [c.clone() for c in to_index[n.value]] new = pytree.Node(syms.power, [new_param.clone()] + subscripts) - new.set_prefix(n.get_prefix()) + new.prefix = n.prefix n.replace(new) Modified: python/branches/tk_and_idle_maintenance/Lib/lib2to3/fixes/fix_types.py ============================================================================== --- python/branches/tk_and_idle_maintenance/Lib/lib2to3/fixes/fix_types.py (original) +++ python/branches/tk_and_idle_maintenance/Lib/lib2to3/fixes/fix_types.py Sat Jun 20 00:11:15 2009 @@ -58,5 +58,5 @@ def transform(self, node, results): new_value = unicode(_TYPE_MAPPING.get(results["name"].value)) if new_value: - return Name(new_value, prefix=node.get_prefix()) + return Name(new_value, prefix=node.prefix) return None Modified: python/branches/tk_and_idle_maintenance/Lib/lib2to3/fixes/fix_unicode.py ============================================================================== --- python/branches/tk_and_idle_maintenance/Lib/lib2to3/fixes/fix_unicode.py (original) +++ python/branches/tk_and_idle_maintenance/Lib/lib2to3/fixes/fix_unicode.py Sat Jun 20 00:11:15 2009 @@ -6,23 +6,20 @@ from ..pgen2 import token from .. import fixer_base +_mapping = {u"unichr" : u"chr", u"unicode" : u"str"} +_literal_re = re.compile(ur"[uU][rR]?[\'\"]") + class FixUnicode(fixer_base.BaseFix): - PATTERN = "STRING | NAME<'unicode' | 'unichr'>" + PATTERN = "STRING | 'unicode' | 'unichr'" def transform(self, node, results): if node.type == token.NAME: - if node.value == u"unicode": - new = node.clone() - new.value = u"str" - return new - if node.value == u"unichr": - new = node.clone() - new.value = u"chr" - return new - # XXX Warn when __unicode__ found? + new = node.clone() + new.value = _mapping[node.value] + return new elif node.type == token.STRING: - if re.match(ur"[uU][rR]?[\'\"]", node.value): + if _literal_re.match(node.value): new = node.clone() new.value = new.value[1:] return new Modified: python/branches/tk_and_idle_maintenance/Lib/lib2to3/fixes/fix_urllib.py ============================================================================== --- python/branches/tk_and_idle_maintenance/Lib/lib2to3/fixes/fix_urllib.py (original) +++ python/branches/tk_and_idle_maintenance/Lib/lib2to3/fixes/fix_urllib.py Sat Jun 20 00:11:15 2009 @@ -78,7 +78,7 @@ replacements. """ import_mod = results.get('module') - pref = import_mod.get_prefix() + pref = import_mod.prefix names = [] @@ -94,7 +94,7 @@ module. """ mod_member = results.get('mod_member') - pref = mod_member.get_prefix() + pref = mod_member.prefix member = results.get('member') # Simple case with only a single member being imported @@ -162,7 +162,7 @@ break if new_name: module_dot.replace(Name(new_name, - prefix=module_dot.get_prefix())) + prefix=module_dot.prefix)) else: self.cannot_convert(node, 'This is an invalid module element') Modified: python/branches/tk_and_idle_maintenance/Lib/lib2to3/fixes/fix_ws_comma.py ============================================================================== --- python/branches/tk_and_idle_maintenance/Lib/lib2to3/fixes/fix_ws_comma.py (original) +++ python/branches/tk_and_idle_maintenance/Lib/lib2to3/fixes/fix_ws_comma.py Sat Jun 20 00:11:15 2009 @@ -26,14 +26,14 @@ comma = False for child in new.children: if child in self.SEPS: - prefix = child.get_prefix() + prefix = child.prefix if prefix.isspace() and u"\n" not in prefix: - child.set_prefix(u"") + child.prefix = u"" comma = True else: if comma: - prefix = child.get_prefix() + prefix = child.prefix if not prefix: - child.set_prefix(u" ") + child.prefix = u" " comma = False return new Modified: python/branches/tk_and_idle_maintenance/Lib/lib2to3/fixes/fix_xrange.py ============================================================================== --- python/branches/tk_and_idle_maintenance/Lib/lib2to3/fixes/fix_xrange.py (original) +++ python/branches/tk_and_idle_maintenance/Lib/lib2to3/fixes/fix_xrange.py Sat Jun 20 00:11:15 2009 @@ -28,14 +28,14 @@ def transform_xrange(self, node, results): name = results["name"] - name.replace(Name(u"range", prefix=name.get_prefix())) + name.replace(Name(u"range", prefix=name.prefix)) def transform_range(self, node, results): if not self.in_special_context(node): range_call = Call(Name(u"range"), [results["args"].clone()]) # Encase the range call in list(). list_call = Call(Name(u"list"), [range_call], - prefix=node.get_prefix()) + prefix=node.prefix) # Put things that were after the range() call after the list call. for n in results["rest"]: list_call.append_child(n) Modified: python/branches/tk_and_idle_maintenance/Lib/lib2to3/fixes/fix_xreadlines.py ============================================================================== --- python/branches/tk_and_idle_maintenance/Lib/lib2to3/fixes/fix_xreadlines.py (original) +++ python/branches/tk_and_idle_maintenance/Lib/lib2to3/fixes/fix_xreadlines.py Sat Jun 20 00:11:15 2009 @@ -19,6 +19,6 @@ no_call = results.get("no_call") if no_call: - no_call.replace(Name(u"__iter__", prefix=no_call.get_prefix())) + no_call.replace(Name(u"__iter__", prefix=no_call.prefix)) else: node.replace([x.clone() for x in results["call"]]) Modified: python/branches/tk_and_idle_maintenance/Lib/lib2to3/fixes/fix_zip.py ============================================================================== --- python/branches/tk_and_idle_maintenance/Lib/lib2to3/fixes/fix_zip.py (original) +++ python/branches/tk_and_idle_maintenance/Lib/lib2to3/fixes/fix_zip.py Sat Jun 20 00:11:15 2009 @@ -28,7 +28,7 @@ return None new = node.clone() - new.set_prefix(u"") + new.prefix = u"" new = Call(Name(u"list"), [new]) - new.set_prefix(node.get_prefix()) + new.prefix = node.prefix return new Modified: python/branches/tk_and_idle_maintenance/Lib/lib2to3/patcomp.py ============================================================================== --- python/branches/tk_and_idle_maintenance/Lib/lib2to3/patcomp.py (original) +++ python/branches/tk_and_idle_maintenance/Lib/lib2to3/patcomp.py Sat Jun 20 00:11:15 2009 @@ -14,10 +14,7 @@ import os # Fairly local imports -from .pgen2 import driver -from .pgen2 import literals -from .pgen2 import token -from .pgen2 import tokenize +from .pgen2 import driver, literals, token, tokenize, parse # Really local imports from . import pytree @@ -28,6 +25,10 @@ "PatternGrammar.txt") +class PatternSyntaxError(Exception): + pass + + def tokenize_wrapper(input): """Tokenizes a string suppressing significant whitespace.""" skip = set((token.NEWLINE, token.INDENT, token.DEDENT)) @@ -54,7 +55,10 @@ def compile_pattern(self, input, debug=False): """Compiles a pattern string to a nested pytree.*Pattern object.""" tokens = tokenize_wrapper(input) - root = self.driver.parse_tokens(tokens, debug=debug) + try: + root = self.driver.parse_tokens(tokens, debug=debug) + except parse.ParseError as e: + raise PatternSyntaxError(str(e)) return self.compile_node(root) def compile_node(self, node): @@ -139,7 +143,9 @@ value = node.value if value.isupper(): if value not in TOKEN_MAP: - raise SyntaxError("Invalid token: %r" % value) + raise PatternSyntaxError("Invalid token: %r" % value) + if nodes[1:]: + raise PatternSyntaxError("Can't have details for token") return pytree.LeafPattern(TOKEN_MAP[value]) else: if value == "any": @@ -147,7 +153,7 @@ elif not value.startswith("_"): type = getattr(self.pysyms, value, None) if type is None: - raise SyntaxError("Invalid symbol: %r" % value) + raise PatternSyntaxError("Invalid symbol: %r" % value) if nodes[1:]: # Details present content = [self.compile_node(nodes[1].children[1])] else: Modified: python/branches/tk_and_idle_maintenance/Lib/lib2to3/pytree.py ============================================================================== --- python/branches/tk_and_idle_maintenance/Lib/lib2to3/pytree.py (original) +++ python/branches/tk_and_idle_maintenance/Lib/lib2to3/pytree.py Sat Jun 20 00:11:15 2009 @@ -13,6 +13,7 @@ __author__ = "Guido van Rossum " import sys +import warnings from StringIO import StringIO @@ -111,17 +112,21 @@ """ Set the prefix for the node (see Leaf class). - This must be implemented by the concrete subclass. + DEPRECATED; use the prefix property directly. """ - raise NotImplementedError + warnings.warn("set_prefix() is deprecated; use the prefix property", + DeprecationWarning, stacklevel=2) + self.prefix = prefix def get_prefix(self): """ Return the prefix for the node (see Leaf class). - This must be implemented by the concrete subclass. + DEPRECATED; use the prefix property directly. """ - raise NotImplementedError + warnings.warn("get_prefix() is deprecated; use the prefix property", + DeprecationWarning, stacklevel=2) + return self.prefix def replace(self, new): """Replace this node with a new one in the parent.""" @@ -209,12 +214,12 @@ def get_suffix(self): """ Return the string immediately following the invocant node. This is - effectively equivalent to node.next_sibling.get_prefix() + effectively equivalent to node.next_sibling.prefix """ next_sib = self.next_sibling if next_sib is None: return u"" - return next_sib.get_prefix() + return next_sib.prefix if sys.version_info < (3, 0): def __str__(self): @@ -241,7 +246,7 @@ assert ch.parent is None, repr(ch) ch.parent = self if prefix is not None: - self.set_prefix(prefix) + self.prefix = prefix def __repr__(self): """Return a canonical string representation.""" @@ -282,24 +287,19 @@ for node in child.post_order(): yield node - def set_prefix(self, prefix): - """ - Set the prefix for the node. - - This passes the responsibility on to the first child. - """ - if self.children: - self.children[0].set_prefix(prefix) - - def get_prefix(self): + @property + def prefix(self): """ - Return the prefix for the node. - - This passes the call on to the first child. + The whitespace and comments preceding this node in the input. """ if not self.children: return "" - return self.children[0].get_prefix() + return self.children[0].prefix + + @prefix.setter + def prefix(self, prefix): + if self.children: + self.children[0].prefix = prefix def set_child(self, i, child): """ @@ -335,9 +335,9 @@ """Concrete implementation for leaf nodes.""" # Default values for instance variables - prefix = "" # Whitespace and comments preceding this token in the input - lineno = 0 # Line where this token starts in the input - column = 0 # Column where this token tarts in the input + _prefix = "" # Whitespace and comments preceding this token in the input + lineno = 0 # Line where this token starts in the input + column = 0 # Column where this token tarts in the input def __init__(self, type, value, context=None, prefix=None): """ @@ -348,11 +348,11 @@ """ assert 0 <= type < 256, type if context is not None: - self.prefix, (self.lineno, self.column) = context + self._prefix, (self.lineno, self.column) = context self.type = type self.value = value if prefix is not None: - self.prefix = prefix + self._prefix = prefix def __repr__(self): """Return a canonical string representation.""" @@ -388,14 +388,17 @@ """Return a pre-order iterator for the tree.""" yield self - def set_prefix(self, prefix): - """Set the prefix for the node.""" - self.changed() - self.prefix = prefix + @property + def prefix(self): + """ + The whitespace and comments preceding this token in the input. + """ + return self._prefix - def get_prefix(self): - """Return the prefix for the node.""" - return self.prefix + @prefix.setter + def prefix(self, prefix): + self.changed() + self._prefix = prefix def convert(gr, raw_node): Modified: python/branches/tk_and_idle_maintenance/Lib/lib2to3/refactor.py ============================================================================== --- python/branches/tk_and_idle_maintenance/Lib/lib2to3/refactor.py (original) +++ python/branches/tk_and_idle_maintenance/Lib/lib2to3/refactor.py Sat Jun 20 00:11:15 2009 @@ -1,4 +1,3 @@ -#!/usr/bin/env python2.5 # Copyright 2006 Google, Inc. All Rights Reserved. # Licensed to PSF under a Contributor Agreement. @@ -23,11 +22,7 @@ # Local imports from .pgen2 import driver, tokenize - -from . import pytree -from . import patcomp -from . import fixes -from . import pygram +from . import pytree, pygram def get_all_fix_names(fixer_pkg, remove_prefix=True): Modified: python/branches/tk_and_idle_maintenance/Lib/lib2to3/tests/data/different_encoding.py ============================================================================== --- python/branches/tk_and_idle_maintenance/Lib/lib2to3/tests/data/different_encoding.py (original) +++ python/branches/tk_and_idle_maintenance/Lib/lib2to3/tests/data/different_encoding.py Sat Jun 20 00:11:15 2009 @@ -1,4 +1,3 @@ #!/usr/bin/env python # -*- coding: iso-8859-1 -*- -print(u'??????????????????????????????????????????????????????????????') - +print u'??????????????????????????????????????????????????????????????' Modified: python/branches/tk_and_idle_maintenance/Lib/lib2to3/tests/data/fixers/myfixes/fix_parrot.py ============================================================================== --- python/branches/tk_and_idle_maintenance/Lib/lib2to3/tests/data/fixers/myfixes/fix_parrot.py (original) +++ python/branches/tk_and_idle_maintenance/Lib/lib2to3/tests/data/fixers/myfixes/fix_parrot.py Sat Jun 20 00:11:15 2009 @@ -10,4 +10,4 @@ def transform(self, node, results): name = results["name"] - name.replace(Name("cheese", name.get_prefix())) + name.replace(Name("cheese", name.prefix)) Modified: python/branches/tk_and_idle_maintenance/Lib/lib2to3/tests/data/py2_test_grammar.py ============================================================================== --- python/branches/tk_and_idle_maintenance/Lib/lib2to3/tests/data/py2_test_grammar.py (original) +++ python/branches/tk_and_idle_maintenance/Lib/lib2to3/tests/data/py2_test_grammar.py Sat Jun 20 00:11:15 2009 @@ -1,5 +1,3 @@ -# Python 2's Lib/test/test_grammar.py (r66189) - # Python test set -- part 1, grammar. # This just tests whether the parser accepts them all. @@ -922,6 +920,26 @@ self.assertEqual([x for x, in [(4,), (5,), (6,)]], [4, 5, 6]) self.assertEqual(list(x for x, in [(7,), (8,), (9,)]), [7, 8, 9]) + def test_with_statement(self): + class manager(object): + def __enter__(self): + return (1, 2) + def __exit__(self, *args): + pass + + with manager(): + pass + with manager() as x: + pass + with manager() as (x, y): + pass + with manager(), manager(): + pass + with manager() as x, manager() as y: + pass + with manager() as x, manager(): + pass + def testIfElseExpr(self): # Test ifelse expressions in various cases def _checkeval(msg, ret): Modified: python/branches/tk_and_idle_maintenance/Lib/lib2to3/tests/data/py3_test_grammar.py ============================================================================== --- python/branches/tk_and_idle_maintenance/Lib/lib2to3/tests/data/py3_test_grammar.py (original) +++ python/branches/tk_and_idle_maintenance/Lib/lib2to3/tests/data/py3_test_grammar.py Sat Jun 20 00:11:15 2009 @@ -868,6 +868,26 @@ self.assertEqual([x for x, in [(4,), (5,), (6,)]], [4, 5, 6]) self.assertEqual(list(x for x, in [(7,), (8,), (9,)]), [7, 8, 9]) + def test_with_statement(self): + class manager(object): + def __enter__(self): + return (1, 2) + def __exit__(self, *args): + pass + + with manager(): + pass + with manager() as x: + pass + with manager() as (x, y): + pass + with manager(), manager(): + pass + with manager() as x, manager() as y: + pass + with manager() as x, manager(): + pass + def testIfElseExpr(self): # Test ifelse expressions in various cases def _checkeval(msg, ret): Modified: python/branches/tk_and_idle_maintenance/Lib/lib2to3/tests/pytree_idempotency.py ============================================================================== --- python/branches/tk_and_idle_maintenance/Lib/lib2to3/tests/pytree_idempotency.py (original) +++ python/branches/tk_and_idle_maintenance/Lib/lib2to3/tests/pytree_idempotency.py Sat Jun 20 00:11:15 2009 @@ -1,4 +1,4 @@ -#!/usr/bin/env python2.5 +#!/usr/bin/env python # Copyright 2006 Google, Inc. All Rights Reserved. # Licensed to PSF under a Contributor Agreement. Modified: python/branches/tk_and_idle_maintenance/Lib/lib2to3/tests/support.py ============================================================================== --- python/branches/tk_and_idle_maintenance/Lib/lib2to3/tests/support.py (original) +++ python/branches/tk_and_idle_maintenance/Lib/lib2to3/tests/support.py Sat Jun 20 00:11:15 2009 @@ -30,7 +30,7 @@ def reformat(string): return dedent(string) + u"\n\n" -def get_refactorer(fixers=None, options=None): +def get_refactorer(fixer_pkg="lib2to3", fixers=None, options=None): """ A convenience function for creating a RefactoringTool for tests. @@ -39,9 +39,9 @@ be passed to the RefactoringTool. """ if fixers is not None: - fixers = ["lib2to3.fixes.fix_" + fix for fix in fixers] + fixers = [fixer_pkg + ".fixes.fix_" + fix for fix in fixers] else: - fixers = refactor.get_fixers_from_package("lib2to3.fixes") + fixers = refactor.get_fixers_from_package(fixer_pkg + ".fixes") options = options or {} return refactor.RefactoringTool(fixers, options, explicit=True) Modified: python/branches/tk_and_idle_maintenance/Lib/lib2to3/tests/test_all_fixers.py ============================================================================== --- python/branches/tk_and_idle_maintenance/Lib/lib2to3/tests/test_all_fixers.py (original) +++ python/branches/tk_and_idle_maintenance/Lib/lib2to3/tests/test_all_fixers.py Sat Jun 20 00:11:15 2009 @@ -1,4 +1,3 @@ -#!/usr/bin/env python2.5 """Tests that run all fixer modules over an input stream. This has been broken out into its own test module because of its @@ -6,18 +5,13 @@ """ # Author: Collin Winter -# Testing imports -try: - from . import support -except ImportError: - import support - # Python imports import unittest # Local imports from .. import pytree from .. import refactor +from . import support class Test_all(support.TestCase): def setUp(self): @@ -28,8 +22,3 @@ for filepath in support.all_project_files(): print "Fixing %s..." % filepath self.refactor.refactor_file(filepath) - - -if __name__ == "__main__": - import __main__ - support.run_all_tests(__main__) Modified: python/branches/tk_and_idle_maintenance/Lib/lib2to3/tests/test_fixers.py ============================================================================== --- python/branches/tk_and_idle_maintenance/Lib/lib2to3/tests/test_fixers.py (original) +++ python/branches/tk_and_idle_maintenance/Lib/lib2to3/tests/test_fixers.py Sat Jun 20 00:11:15 2009 @@ -1,12 +1,4 @@ -#!/usr/bin/env python2.5 """ Test suite for the fixer modules """ -# Author: Collin Winter - -# Testing imports -try: - from tests import support -except ImportError: - import support # Python imports import os @@ -16,14 +8,19 @@ # Local imports from lib2to3 import pygram, pytree, refactor, fixer_util +from lib2to3.tests import support class FixerTestCase(support.TestCase): - def setUp(self, fix_list=None): + + # Other test cases can subclass this class and replace "fixer_pkg" with + # their own. + def setUp(self, fix_list=None, fixer_pkg="lib2to3", options=None): if fix_list is None: fix_list = [self.fixer] - options = {"print_function" : False} - self.refactor = support.get_refactorer(fix_list, options) + if options is None: + options = {"print_function" : False} + self.refactor = support.get_refactorer(fixer_pkg, fix_list, options) self.fixer_log = [] self.filename = u"" @@ -62,7 +59,7 @@ fixes = [self.fixer] fixes.extend(names) options = {"print_function" : False} - r = support.get_refactorer(fixes, options) + r = support.get_refactorer("lib2to3", fixes, options) (pre, post) = r.get_fixers() n = "fix_" + self.fixer if post and post[-1].__class__.__module__.endswith(n): @@ -419,6 +416,7 @@ def test_5(self): b = """print; print whatever;""" a = """print(); print(whatever);""" + self.check(b, a) def test_tuple(self): b = """print (a, b, c)""" @@ -782,6 +780,52 @@ pass""" self.check(b, a) + def test_one_line_suites(self): + b = """ + try: raise TypeError + except TypeError, e: + pass + """ + a = """ + try: raise TypeError + except TypeError as e: + pass + """ + self.check(b, a) + b = """ + try: + raise TypeError + except TypeError, e: pass + """ + a = """ + try: + raise TypeError + except TypeError as e: pass + """ + self.check(b, a) + b = """ + try: raise TypeError + except TypeError, e: pass + """ + a = """ + try: raise TypeError + except TypeError as e: pass + """ + self.check(b, a) + b = """ + try: raise TypeError + except TypeError, e: pass + else: function() + finally: done() + """ + a = """ + try: raise TypeError + except TypeError as e: pass + else: function() + finally: done() + """ + self.check(b, a) + # These should not be touched: def test_unchanged_1(self): @@ -2640,11 +2684,29 @@ class Test_unicode(FixerTestCase): fixer = "unicode" + def test_whitespace(self): + b = """unicode( x)""" + a = """str( x)""" + self.check(b, a) + + b = """ unicode(x )""" + a = """ str(x )""" + self.check(b, a) + + b = """ u'h'""" + a = """ 'h'""" + self.check(b, a) + def test_unicode_call(self): b = """unicode(x, y, z)""" a = """str(x, y, z)""" self.check(b, a) + def test_unichr(self): + b = """unichr(u'h')""" + a = """chr('h')""" + self.check(b, a) + def test_unicode_literal_1(self): b = '''u"x"''' a = '''"x"''' @@ -2656,8 +2718,8 @@ self.check(b, a) def test_unicode_literal_3(self): - b = """UR'''x'''""" - a = """R'''x'''""" + b = """UR'''x''' """ + a = """R'''x''' """ self.check(b, a) class Test_callable(FixerTestCase): @@ -3306,6 +3368,11 @@ a = """x = memoryview(y)""" self.check(b, a) + def test_slicing(self): + b = """buffer(y)[4:5]""" + a = """memoryview(y)[4:5]""" + self.check(b, a) + class Test_future(FixerTestCase): fixer = "future" @@ -4028,8 +4095,3 @@ b = """os.getcwdu ( )""" a = """os.getcwd ( )""" self.check(b, a) - - -if __name__ == "__main__": - import __main__ - support.run_all_tests(__main__) Modified: python/branches/tk_and_idle_maintenance/Lib/lib2to3/tests/test_parser.py ============================================================================== --- python/branches/tk_and_idle_maintenance/Lib/lib2to3/tests/test_parser.py (original) +++ python/branches/tk_and_idle_maintenance/Lib/lib2to3/tests/test_parser.py Sat Jun 20 00:11:15 2009 @@ -1,4 +1,3 @@ -#!/usr/bin/env python2.5 """Test suite for 2to3's parser and grammar files. This is the place to add tests for changes to 2to3's grammar, such as those @@ -6,7 +5,6 @@ parts of the grammar we've changed, we also make sure we can parse the test_grammar.py files from both Python 2 and Python 3. """ -# Author: Collin Winter # Testing imports from . import support @@ -198,7 +196,7 @@ def diff(fn, result): - f = open("@", "w") + f = open("@", "wb") try: f.write(result) finally: @@ -207,8 +205,3 @@ return os.system("diff -u %s @" % fn) finally: os.remove("@") - - -if __name__ == "__main__": - import __main__ - support.run_all_tests(__main__) Modified: python/branches/tk_and_idle_maintenance/Lib/lib2to3/tests/test_pytree.py ============================================================================== --- python/branches/tk_and_idle_maintenance/Lib/lib2to3/tests/test_pytree.py (original) +++ python/branches/tk_and_idle_maintenance/Lib/lib2to3/tests/test_pytree.py Sat Jun 20 00:11:15 2009 @@ -1,4 +1,3 @@ -#!/usr/bin/env python2.5 # Copyright 2006 Google, Inc. All Rights Reserved. # Licensed to PSF under a Contributor Agreement. @@ -10,11 +9,12 @@ especially when debugging a test. """ +import warnings + # Testing imports from . import support -# Local imports (XXX should become a package) -from .. import pytree +from lib2to3 import pytree try: sorted @@ -28,34 +28,48 @@ """Unit tests for nodes (Base, Leaf, Node).""" - def testBaseCantConstruct(self): + def test_deprecated_prefix_methods(self): + l = pytree.Leaf(100, "foo") + with warnings.catch_warnings(record=True) as w: + self.assertEqual(l.get_prefix(), "") + l.set_prefix("hi") + self.assertEqual(l.prefix, "hi") + self.assertEqual(len(w), 2) + for warning in w: + self.assertTrue(warning.category is DeprecationWarning) + self.assertEqual(str(w[0].message), "get_prefix() is deprecated; " \ + "use the prefix property") + self.assertEqual(str(w[1].message), "set_prefix() is deprecated; " \ + "use the prefix property") + + def test_instantiate_base(self): if __debug__: # Test that instantiating Base() raises an AssertionError self.assertRaises(AssertionError, pytree.Base) - def testLeaf(self): + def test_leaf(self): l1 = pytree.Leaf(100, "foo") self.assertEqual(l1.type, 100) self.assertEqual(l1.value, "foo") - def testLeafRepr(self): + def test_leaf_repr(self): l1 = pytree.Leaf(100, "foo") self.assertEqual(repr(l1), "Leaf(100, 'foo')") - def testLeafStr(self): + def test_leaf_str(self): l1 = pytree.Leaf(100, "foo") self.assertEqual(str(l1), "foo") l2 = pytree.Leaf(100, "foo", context=(" ", (10, 1))) self.assertEqual(str(l2), " foo") - def testLeafStrNumericValue(self): + def test_leaf_str_numeric_value(self): # Make sure that the Leaf's value is stringified. Failing to # do this can cause a TypeError in certain situations. l1 = pytree.Leaf(2, 5) - l1.set_prefix("foo_") + l1.prefix = "foo_" self.assertEqual(str(l1), "foo_5") - def testLeafEq(self): + def test_leaf_equality(self): l1 = pytree.Leaf(100, "foo") l2 = pytree.Leaf(100, "foo", context=(" ", (1, 0))) self.assertEqual(l1, l2) @@ -64,67 +78,67 @@ self.assertNotEqual(l1, l3) self.assertNotEqual(l1, l4) - def testLeafPrefix(self): + def test_leaf_prefix(self): l1 = pytree.Leaf(100, "foo") - self.assertEqual(l1.get_prefix(), "") + self.assertEqual(l1.prefix, "") self.failIf(l1.was_changed) - l1.set_prefix(" ##\n\n") - self.assertEqual(l1.get_prefix(), " ##\n\n") + l1.prefix = " ##\n\n" + self.assertEqual(l1.prefix, " ##\n\n") self.failUnless(l1.was_changed) - def testNode(self): + def test_node(self): l1 = pytree.Leaf(100, "foo") l2 = pytree.Leaf(200, "bar") n1 = pytree.Node(1000, [l1, l2]) self.assertEqual(n1.type, 1000) self.assertEqual(n1.children, [l1, l2]) - def testNodeRepr(self): + def test_node_repr(self): l1 = pytree.Leaf(100, "foo") l2 = pytree.Leaf(100, "bar", context=(" ", (1, 0))) n1 = pytree.Node(1000, [l1, l2]) self.assertEqual(repr(n1), "Node(1000, [%s, %s])" % (repr(l1), repr(l2))) - def testNodeStr(self): + def test_node_str(self): l1 = pytree.Leaf(100, "foo") l2 = pytree.Leaf(100, "bar", context=(" ", (1, 0))) n1 = pytree.Node(1000, [l1, l2]) self.assertEqual(str(n1), "foo bar") - def testNodePrefix(self): + def test_node_prefix(self): l1 = pytree.Leaf(100, "foo") - self.assertEqual(l1.get_prefix(), "") + self.assertEqual(l1.prefix, "") n1 = pytree.Node(1000, [l1]) - self.assertEqual(n1.get_prefix(), "") - n1.set_prefix(" ") - self.assertEqual(n1.get_prefix(), " ") - self.assertEqual(l1.get_prefix(), " ") + self.assertEqual(n1.prefix, "") + n1.prefix = " " + self.assertEqual(n1.prefix, " ") + self.assertEqual(l1.prefix, " ") - def testGetSuffix(self): + def test_get_suffix(self): l1 = pytree.Leaf(100, "foo", prefix="a") l2 = pytree.Leaf(100, "bar", prefix="b") n1 = pytree.Node(1000, [l1, l2]) - self.assertEqual(l1.get_suffix(), l2.get_prefix()) + self.assertEqual(l1.get_suffix(), l2.prefix) self.assertEqual(l2.get_suffix(), "") self.assertEqual(n1.get_suffix(), "") l3 = pytree.Leaf(100, "bar", prefix="c") n2 = pytree.Node(1000, [n1, l3]) - self.assertEqual(n1.get_suffix(), l3.get_prefix()) + self.assertEqual(n1.get_suffix(), l3.prefix) self.assertEqual(l3.get_suffix(), "") self.assertEqual(n2.get_suffix(), "") - def testNodeEq(self): + def test_node_equality(self): n1 = pytree.Node(1000, ()) n2 = pytree.Node(1000, [], context=(" ", (1, 0))) self.assertEqual(n1, n2) n3 = pytree.Node(1001, ()) self.assertNotEqual(n1, n3) - def testNodeEqRecursive(self): + def test_node_recursive_equality(self): l1 = pytree.Leaf(100, "foo") l2 = pytree.Leaf(100, "foo") n1 = pytree.Node(1000, [l1]) @@ -134,7 +148,7 @@ n3 = pytree.Node(1000, [l3]) self.assertNotEqual(n1, n3) - def testReplace(self): + def test_replace(self): l1 = pytree.Leaf(100, "foo") l2 = pytree.Leaf(100, "+") l3 = pytree.Leaf(100, "bar") @@ -148,7 +162,7 @@ self.failUnless(isinstance(n1.children, list)) self.failUnless(n1.was_changed) - def testReplaceWithList(self): + def test_replace_with_list(self): l1 = pytree.Leaf(100, "foo") l2 = pytree.Leaf(100, "+") l3 = pytree.Leaf(100, "bar") @@ -158,34 +172,30 @@ self.assertEqual(str(n1), "foo**bar") self.failUnless(isinstance(n1.children, list)) - def testPostOrder(self): + def test_post_order(self): l1 = pytree.Leaf(100, "foo") l2 = pytree.Leaf(100, "bar") n1 = pytree.Node(1000, [l1, l2]) self.assertEqual(list(n1.post_order()), [l1, l2, n1]) - def testPreOrder(self): + def test_pre_order(self): l1 = pytree.Leaf(100, "foo") l2 = pytree.Leaf(100, "bar") n1 = pytree.Node(1000, [l1, l2]) self.assertEqual(list(n1.pre_order()), [n1, l1, l2]) - def testChangedLeaf(self): + def test_changed(self): l1 = pytree.Leaf(100, "f") self.failIf(l1.was_changed) - l1.changed() self.failUnless(l1.was_changed) - def testChangedNode(self): l1 = pytree.Leaf(100, "f") n1 = pytree.Node(1000, [l1]) self.failIf(n1.was_changed) - n1.changed() self.failUnless(n1.was_changed) - def testChangedRecursive(self): l1 = pytree.Leaf(100, "foo") l2 = pytree.Leaf(100, "+") l3 = pytree.Leaf(100, "bar") @@ -200,23 +210,23 @@ self.failUnless(n2.was_changed) self.failIf(l1.was_changed) - def testLeafConstructorPrefix(self): + def test_leaf_constructor_prefix(self): for prefix in ("xyz_", ""): l1 = pytree.Leaf(100, "self", prefix=prefix) self.failUnless(str(l1), prefix + "self") - self.assertEqual(l1.get_prefix(), prefix) + self.assertEqual(l1.prefix, prefix) - def testNodeConstructorPrefix(self): + def test_node_constructor_prefix(self): for prefix in ("xyz_", ""): l1 = pytree.Leaf(100, "self") l2 = pytree.Leaf(100, "foo", prefix="_") n1 = pytree.Node(1000, [l1, l2], prefix=prefix) self.failUnless(str(n1), prefix + "self_foo") - self.assertEqual(n1.get_prefix(), prefix) - self.assertEqual(l1.get_prefix(), prefix) - self.assertEqual(l2.get_prefix(), "_") + self.assertEqual(n1.prefix, prefix) + self.assertEqual(l1.prefix, prefix) + self.assertEqual(l2.prefix, "_") - def testRemove(self): + def test_remove(self): l1 = pytree.Leaf(100, "foo") l2 = pytree.Leaf(100, "foo") n1 = pytree.Node(1000, [l1, l2]) @@ -239,7 +249,7 @@ self.failUnless(n1.was_changed) self.failUnless(n2.was_changed) - def testRemoveParentless(self): + def test_remove_parentless(self): n1 = pytree.Node(1000, []) n1.remove() self.assertEqual(n1.parent, None) @@ -248,7 +258,7 @@ l1.remove() self.assertEqual(l1.parent, None) - def testNodeSetChild(self): + def test_node_set_child(self): l1 = pytree.Leaf(100, "foo") n1 = pytree.Node(1000, [l1]) @@ -269,7 +279,7 @@ # I don't care what it raises, so long as it's an exception self.assertRaises(Exception, n1.set_child, 0, list) - def testNodeInsertChild(self): + def test_node_insert_child(self): l1 = pytree.Leaf(100, "foo") n1 = pytree.Node(1000, [l1]) @@ -285,7 +295,7 @@ # I don't care what it raises, so long as it's an exception self.assertRaises(Exception, n1.insert_child, 0, list) - def testNodeAppendChild(self): + def test_node_append_child(self): n1 = pytree.Node(1000, []) l1 = pytree.Leaf(100, "foo") @@ -301,7 +311,7 @@ # I don't care what it raises, so long as it's an exception self.assertRaises(Exception, n1.append_child, list) - def testNodeNextSibling(self): + def test_node_next_sibling(self): n1 = pytree.Node(1000, []) n2 = pytree.Node(1000, []) p1 = pytree.Node(1000, [n1, n2]) @@ -310,7 +320,7 @@ self.assertEqual(n2.next_sibling, None) self.assertEqual(p1.next_sibling, None) - def testLeafNextSibling(self): + def test_leaf_next_sibling(self): l1 = pytree.Leaf(100, "a") l2 = pytree.Leaf(100, "b") p1 = pytree.Node(1000, [l1, l2]) @@ -319,7 +329,7 @@ self.assertEqual(l2.next_sibling, None) self.assertEqual(p1.next_sibling, None) - def testNodePrevSibling(self): + def test_node_prev_sibling(self): n1 = pytree.Node(1000, []) n2 = pytree.Node(1000, []) p1 = pytree.Node(1000, [n1, n2]) @@ -328,7 +338,7 @@ self.assertEqual(n1.prev_sibling, None) self.assertEqual(p1.prev_sibling, None) - def testLeafPrevSibling(self): + def test_leaf_prev_sibling(self): l1 = pytree.Leaf(100, "a") l2 = pytree.Leaf(100, "b") p1 = pytree.Node(1000, [l1, l2]) @@ -342,7 +352,7 @@ """Unit tests for tree matching patterns.""" - def testBasicPatterns(self): + def test_basic_patterns(self): # Build a tree l1 = pytree.Leaf(100, "foo") l2 = pytree.Leaf(100, "bar") @@ -378,7 +388,7 @@ self.assertFalse(pn.match(l2, results=r)) self.assertEqual(r, {}) - def testWildcardPatterns(self): + def test_wildcard(self): # Build a tree for testing l1 = pytree.Leaf(100, "foo") l2 = pytree.Leaf(100, "bar") @@ -409,7 +419,7 @@ self.assert_(r["pl"] is l3) r = {} - def testGenerateMatches(self): + def test_generate_matches(self): la = pytree.Leaf(1, "a") lb = pytree.Leaf(1, "b") lc = pytree.Leaf(1, "c") @@ -439,7 +449,7 @@ for c in "abcdef": self.assertEqual(r["p" + c], pytree.Leaf(1, c)) - def testHasKeyExample(self): + def test_has_key_example(self): pattern = pytree.NodePattern(331, (pytree.LeafPattern(7), pytree.WildcardPattern(name="args"), @@ -451,8 +461,3 @@ r = {} self.assert_(pattern.match(node, r)) self.assertEqual(r["args"], [l2]) - - -if __name__ == "__main__": - import __main__ - support.run_all_tests(__main__) Modified: python/branches/tk_and_idle_maintenance/Lib/lib2to3/tests/test_util.py ============================================================================== --- python/branches/tk_and_idle_maintenance/Lib/lib2to3/tests/test_util.py (original) +++ python/branches/tk_and_idle_maintenance/Lib/lib2to3/tests/test_util.py Sat Jun 20 00:11:15 2009 @@ -1,6 +1,4 @@ -#!/usr/bin/env python2.5 """ Test suite for the code in fixes.util """ -# Author: Collin Winter # Testing imports from . import support @@ -552,8 +550,3 @@ node = parse('bar()') fixer_util.touch_import(None, "cgi", node) self.assertEqual(str(node), 'import cgi\nbar()\n\n') - - -if __name__ == "__main__": - import __main__ - support.run_all_tests(__main__) Modified: python/branches/tk_and_idle_maintenance/Lib/logging/handlers.py ============================================================================== --- python/branches/tk_and_idle_maintenance/Lib/logging/handlers.py (original) +++ python/branches/tk_and_idle_maintenance/Lib/logging/handlers.py Sat Jun 20 00:11:15 2009 @@ -172,7 +172,6 @@ # # Case of the 'when' specifier is not important; lower or upper case # will work. - currentTime = int(time.time()) if self.when == 'S': self.interval = 1 # one second self.suffix = "%Y-%m-%d_%H-%M-%S" @@ -203,8 +202,15 @@ self.extMatch = re.compile(self.extMatch) self.interval = self.interval * interval # multiply by units requested - self.rolloverAt = currentTime + self.interval + self.rolloverAt = self.computeRollover(int(time.time())) + + #print "Will rollover at %d, %d seconds from now" % (self.rolloverAt, self.rolloverAt - currentTime) + def computeRollover(self, currentTime): + """ + Work out the rollover time based on the specified time. + """ + result = currentTime + self.interval # If we are rolling over at midnight or weekly, then the interval is already known. # What we need to figure out is WHEN the next interval is. In other words, # if you are rolling over at midnight, then your base interval is 1 day, @@ -214,7 +220,7 @@ # the rest. Note that this code doesn't care about leap seconds. :) if self.when == 'MIDNIGHT' or self.when.startswith('W'): # This could be done with less code, but I wanted it to be clear - if utc: + if self.utc: t = time.gmtime(currentTime) else: t = time.localtime(currentTime) @@ -224,7 +230,7 @@ # r is the number of seconds left between now and midnight r = _MIDNIGHT - ((currentHour * 60 + currentMinute) * 60 + currentSecond) - self.rolloverAt = currentTime + r + result = currentTime + r # If we are rolling over on a certain day, add in the number of days until # the next rollover, but offset by 1 since we just calculated the time # until the next day starts. There are three cases: @@ -240,15 +246,15 @@ # The calculations described in 2) and 3) above need to have a day added. # This is because the above time calculation takes us to midnight on this # day, i.e. the start of the next day. - if when.startswith('W'): + if self.when.startswith('W'): day = t[6] # 0 is Monday if day != self.dayOfWeek: if day < self.dayOfWeek: daysToWait = self.dayOfWeek - day else: daysToWait = 6 - day + self.dayOfWeek + 1 - newRolloverAt = self.rolloverAt + (daysToWait * (60 * 60 * 24)) - if not utc: + newRolloverAt = result + (daysToWait * (60 * 60 * 24)) + if not self.utc: dstNow = t[-1] dstAtRollover = time.localtime(newRolloverAt)[-1] if dstNow != dstAtRollover: @@ -256,9 +262,8 @@ newRolloverAt = newRolloverAt - 3600 else: # DST bows out before next rollover, so we need to add an hour newRolloverAt = newRolloverAt + 3600 - self.rolloverAt = newRolloverAt - - #print "Will rollover at %d, %d seconds from now" % (self.rolloverAt, self.rolloverAt - currentTime) + result = newRolloverAt + return result def shouldRollover(self, record): """ @@ -327,8 +332,8 @@ #print "%s -> %s" % (self.baseFilename, dfn) self.mode = 'w' self.stream = self._open() - newRolloverAt = self.rolloverAt + self.interval currentTime = int(time.time()) + newRolloverAt = self.computeRollover(currentTime) while newRolloverAt <= currentTime: newRolloverAt = newRolloverAt + self.interval #If DST changes and midnight or weekly rollover, adjust for this. Modified: python/branches/tk_and_idle_maintenance/Lib/msilib/__init__.py ============================================================================== --- python/branches/tk_and_idle_maintenance/Lib/msilib/__init__.py (original) +++ python/branches/tk_and_idle_maintenance/Lib/msilib/__init__.py Sat Jun 20 00:11:15 2009 @@ -2,9 +2,11 @@ # Copyright (C) 2005 Martin v. L?wis # Licensed to PSF under a Contributor Agreement. from _msi import * -import os, string, re +import os, string, re, sys -Win64=0 +AMD64 = "AMD64" in sys.version +Itanium = "Itanium" in sys.version +Win64 = AMD64 or Itanium # Partially taken from Wine datasizemask= 0x00ff @@ -145,8 +147,10 @@ si.SetProperty(PID_TITLE, "Installation Database") si.SetProperty(PID_SUBJECT, ProductName) si.SetProperty(PID_AUTHOR, Manufacturer) - if Win64: + if Itanium: si.SetProperty(PID_TEMPLATE, "Intel64;1033") + elif AMD64: + si.SetProperty(PID_TEMPLATE, "x64;1033") else: si.SetProperty(PID_TEMPLATE, "Intel;1033") si.SetProperty(PID_REVNUMBER, gen_uuid()) Modified: python/branches/tk_and_idle_maintenance/Lib/multiprocessing/queues.py ============================================================================== --- python/branches/tk_and_idle_maintenance/Lib/multiprocessing/queues.py (original) +++ python/branches/tk_and_idle_maintenance/Lib/multiprocessing/queues.py Sat Jun 20 00:11:15 2009 @@ -109,7 +109,7 @@ self._rlock.release() def qsize(self): - # Raises NotImplementError on Mac OSX because of broken sem_getvalue() + # Raises NotImplementedError on Mac OSX because of broken sem_getvalue() return self._maxsize - self._sem._semlock._get_value() def empty(self): Modified: python/branches/tk_and_idle_maintenance/Lib/os.py ============================================================================== --- python/branches/tk_and_idle_maintenance/Lib/os.py (original) +++ python/branches/tk_and_idle_maintenance/Lib/os.py Sat Jun 20 00:11:15 2009 @@ -514,11 +514,7 @@ __all__.append("getenv") def _exists(name): - try: - eval(name) - return True - except NameError: - return False + return name in globals() # Supply spawn*() (probably only for Unix) if _exists("fork") and not _exists("spawnv") and _exists("execv"): Modified: python/branches/tk_and_idle_maintenance/Lib/random.py ============================================================================== --- python/branches/tk_and_idle_maintenance/Lib/random.py (original) +++ python/branches/tk_and_idle_maintenance/Lib/random.py Sat Jun 20 00:11:15 2009 @@ -349,7 +349,7 @@ ## -------------------- uniform distribution ------------------- def uniform(self, a, b): - """Get a random number in the range [a, b).""" + "Get a random number in the range [a, b) or [a, b] depending on rounding." return a + (b-a) * self.random() ## -------------------- triangular -------------------- Modified: python/branches/tk_and_idle_maintenance/Lib/subprocess.py ============================================================================== --- python/branches/tk_and_idle_maintenance/Lib/subprocess.py (original) +++ python/branches/tk_and_idle_maintenance/Lib/subprocess.py Sat Jun 20 00:11:15 2009 @@ -500,7 +500,7 @@ """ if 'stdout' in kwargs: raise ValueError('stdout argument not allowed, it will be overridden.') - process = Popen(*popenargs, stdout=PIPE, **kwargs) + process = Popen(stdout=PIPE, *popenargs, **kwargs) output, unused_err = process.communicate() retcode = process.poll() if retcode: @@ -1020,8 +1020,17 @@ def _close_fds(self, but): - os.closerange(3, but) - os.closerange(but + 1, MAXFD) + if hasattr(os, 'closerange'): + os.closerange(3, but) + os.closerange(but + 1, MAXFD) + else: + for i in xrange(3, MAXFD): + if i == but: + continue + try: + os.close(i) + except: + pass def _execute_child(self, args, executable, preexec_fn, close_fds, @@ -1047,90 +1056,98 @@ # The first char specifies the exception type: 0 means # OSError, 1 means some other error. errpipe_read, errpipe_write = os.pipe() - self._set_cloexec_flag(errpipe_write) - - gc_was_enabled = gc.isenabled() - # Disable gc to avoid bug where gc -> file_dealloc -> - # write to stderr -> hang. http://bugs.python.org/issue1336 - gc.disable() try: - self.pid = os.fork() - except: - if gc_was_enabled: - gc.enable() - raise - self._child_created = True - if self.pid == 0: - # Child try: - # Close parent's pipe ends - if p2cwrite is not None: - os.close(p2cwrite) - if c2pread is not None: - os.close(c2pread) - if errread is not None: - os.close(errread) - os.close(errpipe_read) - - # Dup fds for child - if p2cread is not None: - os.dup2(p2cread, 0) - if c2pwrite is not None: - os.dup2(c2pwrite, 1) - if errwrite is not None: - os.dup2(errwrite, 2) - - # Close pipe fds. Make sure we don't close the same - # fd more than once, or standard fds. - if p2cread is not None and p2cread not in (0,): - os.close(p2cread) - if c2pwrite is not None and c2pwrite not in (p2cread, 1): - os.close(c2pwrite) - if errwrite is not None and errwrite not in (p2cread, c2pwrite, 2): - os.close(errwrite) - - # Close all other fds, if asked for - if close_fds: - self._close_fds(but=errpipe_write) - - if cwd is not None: - os.chdir(cwd) - - if preexec_fn: - preexec_fn() - - if env is None: - os.execvp(executable, args) - else: - os.execvpe(executable, args, env) - - except: - exc_type, exc_value, tb = sys.exc_info() - # Save the traceback and attach it to the exception object - exc_lines = traceback.format_exception(exc_type, - exc_value, - tb) - exc_value.child_traceback = ''.join(exc_lines) - os.write(errpipe_write, pickle.dumps(exc_value)) - - # This exitcode won't be reported to applications, so it - # really doesn't matter what we return. - os._exit(255) - - # Parent - if gc_was_enabled: - gc.enable() - os.close(errpipe_write) - if p2cread is not None and p2cwrite is not None: - os.close(p2cread) - if c2pwrite is not None and c2pread is not None: - os.close(c2pwrite) - if errwrite is not None and errread is not None: - os.close(errwrite) - - # Wait for exec to fail or succeed; possibly raising exception - data = os.read(errpipe_read, 1048576) # Exceptions limited to 1 MB - os.close(errpipe_read) + self._set_cloexec_flag(errpipe_write) + + gc_was_enabled = gc.isenabled() + # Disable gc to avoid bug where gc -> file_dealloc -> + # write to stderr -> hang. http://bugs.python.org/issue1336 + gc.disable() + try: + self.pid = os.fork() + except: + if gc_was_enabled: + gc.enable() + raise + self._child_created = True + if self.pid == 0: + # Child + try: + # Close parent's pipe ends + if p2cwrite is not None: + os.close(p2cwrite) + if c2pread is not None: + os.close(c2pread) + if errread is not None: + os.close(errread) + os.close(errpipe_read) + + # Dup fds for child + if p2cread is not None: + os.dup2(p2cread, 0) + if c2pwrite is not None: + os.dup2(c2pwrite, 1) + if errwrite is not None: + os.dup2(errwrite, 2) + + # Close pipe fds. Make sure we don't close the same + # fd more than once, or standard fds. + if p2cread is not None and p2cread not in (0,): + os.close(p2cread) + if c2pwrite is not None and c2pwrite not in (p2cread, 1): + os.close(c2pwrite) + if errwrite is not None and errwrite not in (p2cread, c2pwrite, 2): + os.close(errwrite) + + # Close all other fds, if asked for + if close_fds: + self._close_fds(but=errpipe_write) + + if cwd is not None: + os.chdir(cwd) + + if preexec_fn: + preexec_fn() + + if env is None: + os.execvp(executable, args) + else: + os.execvpe(executable, args, env) + + except: + exc_type, exc_value, tb = sys.exc_info() + # Save the traceback and attach it to the exception object + exc_lines = traceback.format_exception(exc_type, + exc_value, + tb) + exc_value.child_traceback = ''.join(exc_lines) + os.write(errpipe_write, pickle.dumps(exc_value)) + + # This exitcode won't be reported to applications, so it + # really doesn't matter what we return. + os._exit(255) + + # Parent + if gc_was_enabled: + gc.enable() + finally: + # be sure the FD is closed no matter what + os.close(errpipe_write) + + if p2cread is not None and p2cwrite is not None: + os.close(p2cread) + if c2pwrite is not None and c2pread is not None: + os.close(c2pwrite) + if errwrite is not None and errread is not None: + os.close(errwrite) + + # Wait for exec to fail or succeed; possibly raising exception + data = os.read(errpipe_read, 1048576) # Exception limited to 1M + finally: + # be sure the FD is closed no matter what + os.close(errpipe_read) + if data != "": os.waitpid(self.pid, 0) child_exception = pickle.loads(data) Modified: python/branches/tk_and_idle_maintenance/Lib/symbol.py ============================================================================== --- python/branches/tk_and_idle_maintenance/Lib/symbol.py (original) +++ python/branches/tk_and_idle_maintenance/Lib/symbol.py Sat Jun 20 00:11:15 2009 @@ -52,7 +52,7 @@ for_stmt = 295 try_stmt = 296 with_stmt = 297 -with_var = 298 +with_item = 298 except_clause = 299 suite = 300 testlist_safe = 301 Modified: python/branches/tk_and_idle_maintenance/Lib/test/cmath_testcases.txt ============================================================================== --- python/branches/tk_and_idle_maintenance/Lib/test/cmath_testcases.txt (original) +++ python/branches/tk_and_idle_maintenance/Lib/test/cmath_testcases.txt Sat Jun 20 00:11:15 2009 @@ -43,6 +43,16 @@ -- ignored. Blank lines, or lines containing only whitespace, are also -- ignored. +-- The majority of the values below were computed with the help of +-- version 2.3 of the MPFR library for multiple-precision +-- floating-point computations with correct rounding. All output +-- values in this file are (modulo yet-to-be-discovered bugs) +-- correctly rounded, provided that each input and output decimal +-- floating-point value below is interpreted as a representation of +-- the corresponding nearest IEEE 754 double-precision value. See the +-- MPFR homepage at http://www.mpfr.org for more information about the +-- MPFR project. + -------------------------- -- acos: Inverse cosine -- Modified: python/branches/tk_and_idle_maintenance/Lib/test/doctest_aliases.py ============================================================================== --- python/branches/tk_and_idle_maintenance/Lib/test/doctest_aliases.py (original) +++ python/branches/tk_and_idle_maintenance/Lib/test/doctest_aliases.py Sat Jun 20 00:11:15 2009 @@ -10,4 +10,4 @@ ''' return 'f' - g = f # define an alias for f + g = f # define an alias for f Modified: python/branches/tk_and_idle_maintenance/Lib/test/formatfloat_testcases.txt ============================================================================== --- python/branches/tk_and_idle_maintenance/Lib/test/formatfloat_testcases.txt (original) +++ python/branches/tk_and_idle_maintenance/Lib/test/formatfloat_testcases.txt Sat Jun 20 00:11:15 2009 @@ -61,7 +61,7 @@ -- makes a difference when the precision is 0. %#.0f 0 -> 0. %#.1f 0 -> 0.0 ---%#.0f 1.5 -> 2. See issue 6198. +%#.0f 1.5 -> 2. -- %#.0f 2.5 -> 2. See issue 6198. %#.0f 10.1 -> 10. %#.0f 1234.56 -> 1235. Modified: python/branches/tk_and_idle_maintenance/Lib/test/test_ast.py ============================================================================== --- python/branches/tk_and_idle_maintenance/Lib/test/test_ast.py (original) +++ python/branches/tk_and_idle_maintenance/Lib/test/test_ast.py Sat Jun 20 00:11:15 2009 @@ -146,6 +146,16 @@ self.assertEquals(to_tuple(ast_tree), o) self._assert_order(ast_tree, (0, 0)) + def test_slice(self): + slc = ast.parse("x[::]").body[0].value.slice + self.assertIsNone(slc.upper) + self.assertIsNone(slc.lower) + self.assertIsNone(slc.step) + + def test_from_import(self): + im = ast.parse("from . import y").body[0] + self.assertIsNone(im.module) + def test_nodeclasses(self): x = ast.BinOp(1, 2, 3, lineno=0) self.assertEquals(x.left, 1) Modified: python/branches/tk_and_idle_maintenance/Lib/test/test_bufio.py ============================================================================== --- python/branches/tk_and_idle_maintenance/Lib/test/test_bufio.py (original) +++ python/branches/tk_and_idle_maintenance/Lib/test/test_bufio.py Sat Jun 20 00:11:15 2009 @@ -1,12 +1,15 @@ import unittest -from test import test_support +from test import test_support as support -# Simple test to ensure that optimizations in fileobject.c deliver -# the expected results. For best testing, run this under a debug-build -# Python too (to exercise asserts in the C code). +import io # C implementation. +import _pyio as pyio # Python implementation. -lengths = range(1, 257) + [512, 1000, 1024, 2048, 4096, 8192, 10000, - 16384, 32768, 65536, 1000000] +# Simple test to ensure that optimizations in the IO library deliver the +# expected results. For best testing, run this under a debug-build Python too +# (to exercise asserts in the C code). + +lengths = list(range(1, 257)) + [512, 1000, 1024, 2048, 4096, 8192, 10000, + 16384, 32768, 65536, 1000000] class BufferSizeTest(unittest.TestCase): def try_one(self, s): @@ -14,27 +17,27 @@ # .readline()s deliver what we wrote. # Ensure we can open TESTFN for writing. - test_support.unlink(test_support.TESTFN) + support.unlink(support.TESTFN) # Since C doesn't guarantee we can write/read arbitrary bytes in text # files, use binary mode. - f = open(test_support.TESTFN, "wb") + f = self.open(support.TESTFN, "wb") try: # write once with \n and once without f.write(s) - f.write("\n") + f.write(b"\n") f.write(s) f.close() - f = open(test_support.TESTFN, "rb") + f = open(support.TESTFN, "rb") line = f.readline() - self.assertEqual(line, s + "\n") + self.assertEqual(line, s + b"\n") line = f.readline() self.assertEqual(line, s) line = f.readline() self.assert_(not line) # Must be at EOF f.close() finally: - test_support.unlink(test_support.TESTFN) + support.unlink(support.TESTFN) def drive_one(self, pattern): for length in lengths: @@ -47,19 +50,30 @@ teststring = pattern * q + pattern[:r] self.assertEqual(len(teststring), length) self.try_one(teststring) - self.try_one(teststring + "x") + self.try_one(teststring + b"x") self.try_one(teststring[:-1]) def test_primepat(self): # A pattern with prime length, to avoid simple relationships with # stdio buffer sizes. - self.drive_one("1234567890\00\01\02\03\04\05\06") + self.drive_one(b"1234567890\00\01\02\03\04\05\06") def test_nullpat(self): - self.drive_one("\0" * 1000) + self.drive_one(bytes(1000)) + + +class CBufferSizeTest(BufferSizeTest): + open = io.open + +class PyBufferSizeTest(BufferSizeTest): + open = staticmethod(pyio.open) + +class BuiltinBufferSizeTest(BufferSizeTest): + open = open + def test_main(): - test_support.run_unittest(BufferSizeTest) + support.run_unittest(CBufferSizeTest, PyBufferSizeTest, BuiltinBufferSizeTest) if __name__ == "__main__": test_main() Modified: python/branches/tk_and_idle_maintenance/Lib/test/test_coding.py ============================================================================== --- python/branches/tk_and_idle_maintenance/Lib/test/test_coding.py (original) +++ python/branches/tk_and_idle_maintenance/Lib/test/test_coding.py Sat Jun 20 00:11:15 2009 @@ -21,6 +21,18 @@ fp.close() self.assertRaises(SyntaxError, compile, text, filename, 'exec') + def test_error_from_string(self): + # See http://bugs.python.org/issue6289 + input = u"# coding: ascii\n\N{SNOWMAN}".encode('utf-8') + try: + compile(input, "", "exec") + except SyntaxError as e: + expected = "'ascii' codec can't decode byte 0xe2 in position 16: " \ + "ordinal not in range(128)" + self.assertTrue(str(e).startswith(expected)) + else: + self.fail("didn't raise") + def test_main(): test.test_support.run_unittest(CodingTest) Modified: python/branches/tk_and_idle_maintenance/Lib/test/test_compile.py ============================================================================== --- python/branches/tk_and_idle_maintenance/Lib/test/test_compile.py (original) +++ python/branches/tk_and_idle_maintenance/Lib/test/test_compile.py Sat Jun 20 00:11:15 2009 @@ -270,11 +270,19 @@ '(a, None) = 0, 0', 'for None in range(10): pass', 'def f(None): pass', + 'import None', + 'import x as None', + 'from x import None', + 'from x import y as None' ] for stmt in stmts: stmt += "\n" self.assertRaises(SyntaxError, compile, stmt, 'tmp', 'single') self.assertRaises(SyntaxError, compile, stmt, 'tmp', 'exec') + # This is ok. + compile("from None import x", "tmp", "exec") + compile("from x import None as y", "tmp", "exec") + compile("import None as x", "tmp", "exec") def test_import(self): succeed = [ Modified: python/branches/tk_and_idle_maintenance/Lib/test/test_curses.py ============================================================================== --- python/branches/tk_and_idle_maintenance/Lib/test/test_curses.py (original) +++ python/branches/tk_and_idle_maintenance/Lib/test/test_curses.py Sat Jun 20 00:11:15 2009 @@ -15,6 +15,7 @@ # 'curses' resource be given on the regrtest command line using the -u # option. If not available, nothing after this line will be executed. +import unittest from test.test_support import requires, import_module requires('curses') curses = import_module('curses') Modified: python/branches/tk_and_idle_maintenance/Lib/test/test_doctest.py ============================================================================== --- python/branches/tk_and_idle_maintenance/Lib/test/test_doctest.py (original) +++ python/branches/tk_and_idle_maintenance/Lib/test/test_doctest.py Sat Jun 20 00:11:15 2009 @@ -498,6 +498,8 @@ will only be generated for it once: >>> from test import doctest_aliases + >>> assert doctest_aliases.TwoNames.f + >>> assert doctest_aliases.TwoNames.g >>> tests = excl_empty_finder.find(doctest_aliases) >>> print len(tests) 2 Modified: python/branches/tk_and_idle_maintenance/Lib/test/test_file.py ============================================================================== --- python/branches/tk_and_idle_maintenance/Lib/test/test_file.py (original) +++ python/branches/tk_and_idle_maintenance/Lib/test/test_file.py Sat Jun 20 00:11:15 2009 @@ -1,13 +1,17 @@ +# NOTE: this file tests the new `io` library backported from Python 3.x. +# Similar tests for the builtin file object can be found in test_file2k.py. + +from __future__ import print_function + import sys import os import unittest -import itertools -import time -import threading from array import array from weakref import proxy -from test import test_support +import io +import _pyio as pyio + from test.test_support import TESTFN, findfile, run_unittest from UserList import UserList @@ -15,7 +19,7 @@ # file tests for which a test file is automatically set up def setUp(self): - self.f = open(TESTFN, 'wb') + self.f = self.open(TESTFN, 'wb') def tearDown(self): if self.f: @@ -25,7 +29,7 @@ def testWeakRefs(self): # verify weak references p = proxy(self.f) - p.write('teststring') + p.write(b'teststring') self.assertEquals(self.f.tell(), p.tell()) self.f.close() self.f = None @@ -34,35 +38,35 @@ def testAttributes(self): # verify expected attributes exist f = self.f - softspace = f.softspace f.name # merely shouldn't blow up f.mode # ditto f.closed # ditto - # verify softspace is writable - f.softspace = softspace # merely shouldn't blow up - - # verify the others aren't - for attr in 'name', 'mode', 'closed': - self.assertRaises((AttributeError, TypeError), setattr, f, attr, 'oops') - def testReadinto(self): # verify readinto - self.f.write('12') + self.f.write(b'12') self.f.close() - a = array('c', 'x'*10) - self.f = open(TESTFN, 'rb') + a = array('b', b'x'*10) + self.f = self.open(TESTFN, 'rb') n = self.f.readinto(a) - self.assertEquals('12', a.tostring()[:n]) + self.assertEquals(b'12', a.tostring()[:n]) + + def testReadinto_text(self): + # verify readinto refuses text files + a = array('b', b'x'*10) + self.f.close() + self.f = self.open(TESTFN, 'r') + if hasattr(self.f, "readinto"): + self.assertRaises(TypeError, self.f.readinto, a) def testWritelinesUserList(self): # verify writelines with instance sequence - l = UserList(['1', '2']) + l = UserList([b'1', b'2']) self.f.writelines(l) self.f.close() - self.f = open(TESTFN, 'rb') + self.f = self.open(TESTFN, 'rb') buf = self.f.read() - self.assertEquals(buf, '12') + self.assertEquals(buf, b'12') def testWritelinesIntegers(self): # verify writelines with integers @@ -81,36 +85,43 @@ self.assertRaises(TypeError, self.f.writelines, [NonString(), NonString()]) - def testRepr(self): - # verify repr works - self.assert_(repr(self.f).startswith(">sys.__stdout__, ( + print(( ' Skipping sys.stdin.seek(-1), it may crash the interpreter.' - ' Test manually.') - self.assertRaises(IOError, sys.stdin.truncate) - - def testUnicodeOpen(self): - # verify repr works for unicode too - f = open(unicode(TESTFN), "w") - self.assert_(repr(f).startswith(" + # "file.truncate fault on windows" + os.unlink(TESTFN) + f = self.open(TESTFN, 'wb') - def bug801631(): - # SF bug - # "file.truncate fault on windows" - f = open(TESTFN, 'wb') - f.write('12345678901') # 11 bytes + try: + f.write(b'12345678901') # 11 bytes f.close() - f = open(TESTFN,'rb+') + f = self.open(TESTFN,'rb+') data = f.read(5) - if data != '12345': + if data != b'12345': self.fail("Read on file opened for update failed %r" % data) if f.tell() != 5: self.fail("File pos after read wrong %d" % f.tell()) @@ -234,56 +223,42 @@ size = os.path.getsize(TESTFN) if size != 5: self.fail("File size after ftruncate wrong %d" % size) - - try: - bug801631() finally: + f.close() os.unlink(TESTFN) def testIteration(self): # Test the complex interaction when mixing file-iteration and the - # various read* methods. Ostensibly, the mixture could just be tested - # to work when it should work according to the Python language, - # instead of fail when it should fail according to the current CPython - # implementation. People don't always program Python the way they - # should, though, and the implemenation might change in subtle ways, - # so we explicitly test for errors, too; the test will just have to - # be updated when the implementation changes. + # various read* methods. dataoffset = 16384 - filler = "ham\n" + filler = b"ham\n" assert not dataoffset % len(filler), \ "dataoffset must be multiple of len(filler)" nchunks = dataoffset // len(filler) testlines = [ - "spam, spam and eggs\n", - "eggs, spam, ham and spam\n", - "saussages, spam, spam and eggs\n", - "spam, ham, spam and eggs\n", - "spam, spam, spam, spam, spam, ham, spam\n", - "wonderful spaaaaaam.\n" + b"spam, spam and eggs\n", + b"eggs, spam, ham and spam\n", + b"saussages, spam, spam and eggs\n", + b"spam, ham, spam and eggs\n", + b"spam, spam, spam, spam, spam, ham, spam\n", + b"wonderful spaaaaaam.\n" ] methods = [("readline", ()), ("read", ()), ("readlines", ()), - ("readinto", (array("c", " "*100),))] + ("readinto", (array("b", b" "*100),))] try: # Prepare the testfile - bag = open(TESTFN, "w") + bag = self.open(TESTFN, "wb") bag.write(filler * nchunks) bag.writelines(testlines) bag.close() # Test for appropriate errors mixing read* and iteration for methodname, args in methods: - f = open(TESTFN) - if f.next() != filler: + f = self.open(TESTFN, 'rb') + if next(f) != filler: self.fail, "Broken testfile" meth = getattr(f, methodname) - try: - meth(*args) - except ValueError: - pass - else: - self.fail("%s%r after next() didn't raise ValueError" % - (methodname, args)) + meth(*args) # This simply shouldn't fail f.close() # Test to see if harmless (by accident) mixing of read* and @@ -293,9 +268,9 @@ # ("h", "a", "m", "\n"), so 4096 lines of that should get us # exactly on the buffer boundary for any power-of-2 buffersize # between 4 and 16384 (inclusive). - f = open(TESTFN) + f = self.open(TESTFN, 'rb') for i in range(nchunks): - f.next() + next(f) testline = testlines.pop(0) try: line = f.readline() @@ -306,7 +281,7 @@ self.fail("readline() after next() with empty buffer " "failed. Got %r, expected %r" % (line, testline)) testline = testlines.pop(0) - buf = array("c", "\x00" * len(testline)) + buf = array("b", b"\x00" * len(testline)) try: f.readinto(buf) except ValueError: @@ -335,7 +310,7 @@ self.fail("readlines() after next() with empty buffer " "failed. Got %r, expected %r" % (line, testline)) # Reading after iteration hit EOF shouldn't hurt either - f = open(TESTFN) + f = self.open(TESTFN, 'rb') try: for line in f: pass @@ -351,222 +326,19 @@ finally: os.unlink(TESTFN) -class FileSubclassTests(unittest.TestCase): - - def testExit(self): - # test that exiting with context calls subclass' close - class C(file): - def __init__(self, *args): - self.subclass_closed = False - file.__init__(self, *args) - def close(self): - self.subclass_closed = True - file.close(self) +class COtherFileTests(OtherFileTests): + open = io.open - with C(TESTFN, 'w') as f: - pass - self.failUnless(f.subclass_closed) - - -class FileThreadingTests(unittest.TestCase): - # These tests check the ability to call various methods of file objects - # (including close()) concurrently without crashing the Python interpreter. - # See #815646, #595601 - - def setUp(self): - self.f = None - self.filename = TESTFN - with open(self.filename, "w") as f: - f.write("\n".join("0123456789")) - self._count_lock = threading.Lock() - self.close_count = 0 - self.close_success_count = 0 - - def tearDown(self): - if self.f: - try: - self.f.close() - except (EnvironmentError, ValueError): - pass - try: - os.remove(self.filename) - except EnvironmentError: - pass - - def _create_file(self): - self.f = open(self.filename, "w+") - - def _close_file(self): - with self._count_lock: - self.close_count += 1 - self.f.close() - with self._count_lock: - self.close_success_count += 1 - - def _close_and_reopen_file(self): - self._close_file() - # if close raises an exception thats fine, self.f remains valid so - # we don't need to reopen. - self._create_file() - - def _run_workers(self, func, nb_workers, duration=0.2): - with self._count_lock: - self.close_count = 0 - self.close_success_count = 0 - self.do_continue = True - threads = [] - try: - for i in range(nb_workers): - t = threading.Thread(target=func) - t.start() - threads.append(t) - for _ in xrange(100): - time.sleep(duration/100) - with self._count_lock: - if self.close_count-self.close_success_count > nb_workers+1: - if test_support.verbose: - print 'Q', - break - time.sleep(duration) - finally: - self.do_continue = False - for t in threads: - t.join() - - def _test_close_open_io(self, io_func, nb_workers=5): - def worker(): - self._create_file() - funcs = itertools.cycle(( - lambda: io_func(), - lambda: self._close_and_reopen_file(), - )) - for f in funcs: - if not self.do_continue: - break - try: - f() - except (IOError, ValueError): - pass - self._run_workers(worker, nb_workers) - if test_support.verbose: - # Useful verbose statistics when tuning this test to take - # less time to run but still ensuring that its still useful. - # - # the percent of close calls that raised an error - percent = 100. - 100.*self.close_success_count/self.close_count - print self.close_count, ('%.4f ' % percent), - - def test_close_open(self): - def io_func(): - pass - self._test_close_open_io(io_func) - - def test_close_open_flush(self): - def io_func(): - self.f.flush() - self._test_close_open_io(io_func) - - def test_close_open_iter(self): - def io_func(): - list(iter(self.f)) - self._test_close_open_io(io_func) - - def test_close_open_isatty(self): - def io_func(): - self.f.isatty() - self._test_close_open_io(io_func) - - def test_close_open_print(self): - def io_func(): - print >> self.f, '' - self._test_close_open_io(io_func) - - def test_close_open_read(self): - def io_func(): - self.f.read(0) - self._test_close_open_io(io_func) - - def test_close_open_readinto(self): - def io_func(): - a = array('c', 'xxxxx') - self.f.readinto(a) - self._test_close_open_io(io_func) - - def test_close_open_readline(self): - def io_func(): - self.f.readline() - self._test_close_open_io(io_func) - - def test_close_open_readlines(self): - def io_func(): - self.f.readlines() - self._test_close_open_io(io_func) - - def test_close_open_seek(self): - def io_func(): - self.f.seek(0, 0) - self._test_close_open_io(io_func) - - def test_close_open_tell(self): - def io_func(): - self.f.tell() - self._test_close_open_io(io_func) - - def test_close_open_truncate(self): - def io_func(): - self.f.truncate() - self._test_close_open_io(io_func) - - def test_close_open_write(self): - def io_func(): - self.f.write('') - self._test_close_open_io(io_func) - - def test_close_open_writelines(self): - def io_func(): - self.f.writelines('') - self._test_close_open_io(io_func) - - -class StdoutTests(unittest.TestCase): - - def test_move_stdout_on_write(self): - # Issue 3242: sys.stdout can be replaced (and freed) during a - # print statement; prevent a segfault in this case - save_stdout = sys.stdout - - class File: - def write(self, data): - if '\n' in data: - sys.stdout = save_stdout - - try: - sys.stdout = File() - print "some text" - finally: - sys.stdout = save_stdout - - def test_del_stdout_before_print(self): - # Issue 4597: 'print' with no argument wasn't reporting when - # sys.stdout was deleted. - save_stdout = sys.stdout - del sys.stdout - try: - print - except RuntimeError as e: - self.assertEquals(str(e), "lost sys.stdout") - else: - self.fail("Expected RuntimeError") - finally: - sys.stdout = save_stdout +class PyOtherFileTests(OtherFileTests): + open = staticmethod(pyio.open) def test_main(): # Historically, these tests have been sloppy about removing TESTFN. # So get rid of it no matter what. try: - run_unittest(AutoFileTests, OtherFileTests, FileSubclassTests, - FileThreadingTests, StdoutTests) + run_unittest(CAutoFileTests, PyAutoFileTests, + COtherFileTests, PyOtherFileTests) finally: if os.path.exists(TESTFN): os.unlink(TESTFN) Modified: python/branches/tk_and_idle_maintenance/Lib/test/test_fileio.py ============================================================================== --- python/branches/tk_and_idle_maintenance/Lib/test/test_fileio.py (original) +++ python/branches/tk_and_idle_maintenance/Lib/test/test_fileio.py Sat Jun 20 00:11:15 2009 @@ -1,23 +1,26 @@ # Adapted from test_file.py by Daniel Stutzbach -#from __future__ import unicode_literals + +from __future__ import unicode_literals import sys import os +import errno import unittest from array import array from weakref import proxy +from functools import wraps from test.test_support import (TESTFN, findfile, check_warnings, run_unittest, make_bad_fd) -from UserList import UserList +from test.test_support import py3k_bytes as bytes -import _fileio +from _io import FileIO as _FileIO class AutoFileTests(unittest.TestCase): # file tests for which a test file is automatically set up def setUp(self): - self.f = _fileio._FileIO(TESTFN, 'w') + self.f = _FileIO(TESTFN, 'w') def tearDown(self): if self.f: @@ -34,7 +37,7 @@ self.assertRaises(ReferenceError, getattr, p, 'tell') def testSeekTell(self): - self.f.write(bytes(bytearray(range(20)))) + self.f.write(bytes(range(20))) self.assertEquals(self.f.tell(), 20) self.f.seek(0) self.assertEquals(self.f.tell(), 0) @@ -61,17 +64,21 @@ def testReadinto(self): # verify readinto - self.f.write(bytes(bytearray([1, 2]))) + self.f.write(b"\x01\x02") self.f.close() - a = array('b', b'x'*10) - self.f = _fileio._FileIO(TESTFN, 'r') + a = array(b'b', b'x'*10) + self.f = _FileIO(TESTFN, 'r') n = self.f.readinto(a) - self.assertEquals(array('b', [1, 2]), a[:n]) + self.assertEquals(array(b'b', [1, 2]), a[:n]) def testRepr(self): - self.assertEquals(repr(self.f), - "_fileio._FileIO(%d, %s)" % (self.f.fileno(), - repr(self.f.mode))) + self.assertEquals(repr(self.f), "<_io.FileIO name=%r mode='%s'>" + % (self.f.name, self.f.mode)) + del self.f.name + self.assertEquals(repr(self.f), "<_io.FileIO fd=%r mode='%s'>" + % (self.f.fileno(), self.f.mode)) + self.f.close() + self.assertEquals(repr(self.f), "<_io.FileIO [closed]>") def testErrors(self): f = self.f @@ -81,7 +88,7 @@ self.assertRaises(ValueError, f.read, 10) # Open for reading f.close() self.assert_(f.closed) - f = _fileio._FileIO(TESTFN, 'r') + f = _FileIO(TESTFN, 'r') self.assertRaises(TypeError, f.readinto, "") self.assert_(not f.closed) f.close() @@ -107,31 +114,131 @@ # Windows always returns "[Errno 13]: Permission denied # Unix calls dircheck() and returns "[Errno 21]: Is a directory" try: - _fileio._FileIO('.', 'r') + _FileIO('.', 'r') except IOError as e: self.assertNotEqual(e.errno, 0) self.assertEqual(e.filename, ".") else: self.fail("Should have raised IOError") + #A set of functions testing that we get expected behaviour if someone has + #manually closed the internal file descriptor. First, a decorator: + def ClosedFD(func): + @wraps(func) + def wrapper(self): + #forcibly close the fd before invoking the problem function + f = self.f + os.close(f.fileno()) + try: + func(self, f) + finally: + try: + self.f.close() + except IOError: + pass + return wrapper + + def ClosedFDRaises(func): + @wraps(func) + def wrapper(self): + #forcibly close the fd before invoking the problem function + f = self.f + os.close(f.fileno()) + try: + func(self, f) + except IOError as e: + self.assertEqual(e.errno, errno.EBADF) + else: + self.fail("Should have raised IOError") + finally: + try: + self.f.close() + except IOError: + pass + return wrapper + + @ClosedFDRaises + def testErrnoOnClose(self, f): + f.close() + + @ClosedFDRaises + def testErrnoOnClosedWrite(self, f): + f.write('a') + + @ClosedFDRaises + def testErrnoOnClosedSeek(self, f): + f.seek(0) + + @ClosedFDRaises + def testErrnoOnClosedTell(self, f): + f.tell() + + @ClosedFDRaises + def testErrnoOnClosedTruncate(self, f): + f.truncate(0) + + @ClosedFD + def testErrnoOnClosedSeekable(self, f): + f.seekable() + + @ClosedFD + def testErrnoOnClosedReadable(self, f): + f.readable() + + @ClosedFD + def testErrnoOnClosedWritable(self, f): + f.writable() + + @ClosedFD + def testErrnoOnClosedFileno(self, f): + f.fileno() + + @ClosedFD + def testErrnoOnClosedIsatty(self, f): + self.assertEqual(f.isatty(), False) + + def ReopenForRead(self): + try: + self.f.close() + except IOError: + pass + self.f = _FileIO(TESTFN, 'r') + os.close(self.f.fileno()) + return self.f + + @ClosedFDRaises + def testErrnoOnClosedRead(self, f): + f = self.ReopenForRead() + f.read(1) + + @ClosedFDRaises + def testErrnoOnClosedReadall(self, f): + f = self.ReopenForRead() + f.readall() + + @ClosedFDRaises + def testErrnoOnClosedReadinto(self, f): + f = self.ReopenForRead() + a = array(b'b', b'x'*10) + f.readinto(a) class OtherFileTests(unittest.TestCase): def testAbles(self): try: - f = _fileio._FileIO(TESTFN, "w") + f = _FileIO(TESTFN, "w") self.assertEquals(f.readable(), False) self.assertEquals(f.writable(), True) self.assertEquals(f.seekable(), True) f.close() - f = _fileio._FileIO(TESTFN, "r") + f = _FileIO(TESTFN, "r") self.assertEquals(f.readable(), True) self.assertEquals(f.writable(), False) self.assertEquals(f.seekable(), True) f.close() - f = _fileio._FileIO(TESTFN, "a+") + f = _FileIO(TESTFN, "a+") self.assertEquals(f.readable(), True) self.assertEquals(f.writable(), True) self.assertEquals(f.seekable(), True) @@ -140,14 +247,14 @@ if sys.platform != "win32": try: - f = _fileio._FileIO("/dev/tty", "a") + f = _FileIO("/dev/tty", "a") except EnvironmentError: # When run in a cron job there just aren't any # ttys, so skip the test. This also handles other # OS'es that don't support /dev/tty. pass else: - f = _fileio._FileIO("/dev/tty", "a") + f = _FileIO("/dev/tty", "a") self.assertEquals(f.readable(), False) self.assertEquals(f.writable(), True) if sys.platform != "darwin" and \ @@ -164,7 +271,7 @@ # check invalid mode strings for mode in ("", "aU", "wU+", "rw", "rt"): try: - f = _fileio._FileIO(TESTFN, mode) + f = _FileIO(TESTFN, mode) except ValueError: pass else: @@ -173,19 +280,35 @@ def testUnicodeOpen(self): # verify repr works for unicode too - f = _fileio._FileIO(str(TESTFN), "w") + f = _FileIO(str(TESTFN), "w") f.close() os.unlink(TESTFN) + def testBytesOpen(self): + # Opening a bytes filename + try: + fn = TESTFN.encode("ascii") + except UnicodeEncodeError: + # Skip test + return + f = _FileIO(fn, "w") + try: + f.write(b"abc") + f.close() + with open(TESTFN, "rb") as f: + self.assertEquals(f.read(), b"abc") + finally: + os.unlink(TESTFN) + def testInvalidFd(self): - self.assertRaises(ValueError, _fileio._FileIO, -10) - self.assertRaises(OSError, _fileio._FileIO, make_bad_fd()) + self.assertRaises(ValueError, _FileIO, -10) + self.assertRaises(OSError, _FileIO, make_bad_fd()) def testBadModeArgument(self): # verify that we get a sensible error message for bad mode argument bad_mode = "qwerty" try: - f = _fileio._FileIO(TESTFN, bad_mode) + f = _FileIO(TESTFN, bad_mode) except ValueError as msg: if msg.args[0] != 0: s = str(msg) @@ -201,13 +324,13 @@ def bug801631(): # SF bug # "file.truncate fault on windows" - f = _fileio._FileIO(TESTFN, 'w') - f.write(bytes(bytearray(range(11)))) + f = _FileIO(TESTFN, 'w') + f.write(bytes(range(11))) f.close() - f = _fileio._FileIO(TESTFN,'r+') + f = _FileIO(TESTFN,'r+') data = f.read(5) - if data != bytes(bytearray(range(5))): + if data != bytes(range(5)): self.fail("Read on file opened for update failed %r" % data) if f.tell() != 5: self.fail("File pos after read wrong %d" % f.tell()) @@ -245,14 +368,14 @@ pass def testInvalidInit(self): - self.assertRaises(TypeError, _fileio._FileIO, "1", 0, 0) + self.assertRaises(TypeError, _FileIO, "1", 0, 0) def testWarnings(self): with check_warnings() as w: self.assertEqual(w.warnings, []) - self.assertRaises(TypeError, _fileio._FileIO, []) + self.assertRaises(TypeError, _FileIO, []) self.assertEqual(w.warnings, []) - self.assertRaises(ValueError, _fileio._FileIO, "/some/invalid/name", "rt") + self.assertRaises(ValueError, _FileIO, "/some/invalid/name", "rt") self.assertEqual(w.warnings, []) Modified: python/branches/tk_and_idle_maintenance/Lib/test/test_generators.py ============================================================================== --- python/branches/tk_and_idle_maintenance/Lib/test/test_generators.py (original) +++ python/branches/tk_and_idle_maintenance/Lib/test/test_generators.py Sat Jun 20 00:11:15 2009 @@ -1588,7 +1588,7 @@ Traceback (most recent call last): ... File "", line 1 -SyntaxError: augmented assignment to yield expression not possible +SyntaxError: can't assign to yield expression Now check some throw() conditions: Modified: python/branches/tk_and_idle_maintenance/Lib/test/test_genexps.py ============================================================================== --- python/branches/tk_and_idle_maintenance/Lib/test/test_genexps.py (original) +++ python/branches/tk_and_idle_maintenance/Lib/test/test_genexps.py Sat Jun 20 00:11:15 2009 @@ -144,7 +144,7 @@ Traceback (most recent call last): ... File "", line 1 - SyntaxError: augmented assignment to generator expression not possible + SyntaxError: can't assign to generator expression ########### Tests borrowed from or inspired by test_generators.py ############ Modified: python/branches/tk_and_idle_maintenance/Lib/test/test_io.py ============================================================================== --- python/branches/tk_and_idle_maintenance/Lib/test/test_io.py (original) +++ python/branches/tk_and_idle_maintenance/Lib/test/test_io.py Sat Jun 20 00:11:15 2009 @@ -1,4 +1,24 @@ -"""Unit tests for io.py.""" +"""Unit tests for the io module.""" + +# Tests of io are scattered over the test suite: +# * test_bufio - tests file buffering +# * test_memoryio - tests BytesIO and StringIO +# * test_fileio - tests FileIO +# * test_file - tests the file interface +# * test_io - tests everything else in the io module +# * test_univnewlines - tests universal newline support +# * test_largefile - tests operations on a file greater than 2**32 bytes +# (only enabled with -ulargefile) + +################################################################################ +# ATTENTION TEST WRITERS!!! +################################################################################ +# When writing tests for io, it's important to test both the C and Python +# implementations. This is usually done by writing a base test that refers to +# the type it is testing as a attribute. Then it provides custom subclasses to +# test both implementations. This file has lots of examples. +################################################################################ + from __future__ import print_function from __future__ import unicode_literals @@ -9,27 +29,43 @@ import threading import random import unittest -from itertools import chain, cycle -from test import test_support +import warnings +import weakref +import gc +import abc +from itertools import chain, cycle, count +from collections import deque +from test import test_support as support import codecs -import io # The module under test +import io # C implementation of io +import _pyio as pyio # Python implementation of io + +__metaclass__ = type +bytes = support.py3k_bytes + +def _default_chunk_size(): + """Get the default TextIOWrapper chunk size""" + with io.open(__file__, "r", encoding="latin1") as f: + return f._CHUNK_SIZE -class MockRawIO(io.RawIOBase): +class MockRawIO: def __init__(self, read_stack=()): self._read_stack = list(read_stack) self._write_stack = [] + self._reads = 0 def read(self, n=None): + self._reads += 1 try: return self._read_stack.pop(0) except: return b"" def write(self, b): - self._write_stack.append(b[:]) + self._write_stack.append(bytes(b)) return len(b) def writable(self): @@ -45,46 +81,156 @@ return True def seek(self, pos, whence): - pass + return 0 # wrong but we gotta return something def tell(self): - return 42 + return 0 # same comment as above + + def readinto(self, buf): + self._reads += 1 + max_len = len(buf) + try: + data = self._read_stack[0] + except IndexError: + return 0 + if data is None: + del self._read_stack[0] + return None + n = len(data) + if len(data) <= max_len: + del self._read_stack[0] + buf[:n] = data + return n + else: + buf[:] = data[:max_len] + self._read_stack[0] = data[max_len:] + return max_len + + def truncate(self, pos=None): + return pos + +class CMockRawIO(MockRawIO, io.RawIOBase): + pass + +class PyMockRawIO(MockRawIO, pyio.RawIOBase): + pass + + +class MisbehavedRawIO(MockRawIO): + def write(self, b): + return MockRawIO.write(self, b) * 2 + def read(self, n=None): + return MockRawIO.read(self, n) * 2 + + def seek(self, pos, whence): + return -123 + + def tell(self): + return -456 + + def readinto(self, buf): + MockRawIO.readinto(self, buf) + return len(buf) * 5 + +class CMisbehavedRawIO(MisbehavedRawIO, io.RawIOBase): + pass + +class PyMisbehavedRawIO(MisbehavedRawIO, pyio.RawIOBase): + pass -class MockFileIO(io.BytesIO): + +class CloseFailureIO(MockRawIO): + closed = 0 + + def close(self): + if not self.closed: + self.closed = 1 + raise IOError + +class CCloseFailureIO(CloseFailureIO, io.RawIOBase): + pass + +class PyCloseFailureIO(CloseFailureIO, pyio.RawIOBase): + pass + + +class MockFileIO: def __init__(self, data): self.read_history = [] - io.BytesIO.__init__(self, data) + super(MockFileIO, self).__init__(data) def read(self, n=None): - res = io.BytesIO.read(self, n) + res = super(MockFileIO, self).read(n) self.read_history.append(None if res is None else len(res)) return res + def readinto(self, b): + res = super(MockFileIO, self).readinto(b) + self.read_history.append(res) + return res + +class CMockFileIO(MockFileIO, io.BytesIO): + pass -class MockNonBlockWriterIO(io.RawIOBase): +class PyMockFileIO(MockFileIO, pyio.BytesIO): + pass - def __init__(self, blocking_script): - self._blocking_script = list(blocking_script) + +class MockNonBlockWriterIO: + + def __init__(self): self._write_stack = [] + self._blocker_char = None - def write(self, b): - self._write_stack.append(b[:]) - n = self._blocking_script.pop(0) - if (n < 0): - raise io.BlockingIOError(0, "test blocking", -n) - else: - return n + def pop_written(self): + s = b"".join(self._write_stack) + self._write_stack[:] = [] + return s + + def block_on(self, char): + """Block when a given char is encountered.""" + self._blocker_char = char + + def readable(self): + return True + + def seekable(self): + return True def writable(self): return True + def write(self, b): + b = bytes(b) + n = -1 + if self._blocker_char: + try: + n = b.index(self._blocker_char) + except ValueError: + pass + else: + self._blocker_char = None + self._write_stack.append(b[:n]) + raise self.BlockingIOError(0, "test blocking", n) + self._write_stack.append(b) + return len(b) + +class CMockNonBlockWriterIO(MockNonBlockWriterIO, io.RawIOBase): + BlockingIOError = io.BlockingIOError + +class PyMockNonBlockWriterIO(MockNonBlockWriterIO, pyio.RawIOBase): + BlockingIOError = pyio.BlockingIOError + class IOTest(unittest.TestCase): + def setUp(self): + support.unlink(support.TESTFN) + def tearDown(self): - test_support.unlink(test_support.TESTFN) + support.unlink(support.TESTFN) def write_ops(self, f): self.assertEqual(f.write(b"blah."), 5) @@ -149,60 +295,71 @@ self.assertEqual(f.seek(-1, 2), self.LARGE) self.assertEqual(f.read(2), b"x") + def test_invalid_operations(self): + # Try writing on a file opened in read mode and vice-versa. + for mode in ("w", "wb"): + with self.open(support.TESTFN, mode) as fp: + self.assertRaises(IOError, fp.read) + self.assertRaises(IOError, fp.readline) + with self.open(support.TESTFN, "rb") as fp: + self.assertRaises(IOError, fp.write, b"blah") + self.assertRaises(IOError, fp.writelines, [b"blah\n"]) + with self.open(support.TESTFN, "r") as fp: + self.assertRaises(IOError, fp.write, "blah") + self.assertRaises(IOError, fp.writelines, ["blah\n"]) + def test_raw_file_io(self): - f = io.open(test_support.TESTFN, "wb", buffering=0) - self.assertEqual(f.readable(), False) - self.assertEqual(f.writable(), True) - self.assertEqual(f.seekable(), True) - self.write_ops(f) - f.close() - f = io.open(test_support.TESTFN, "rb", buffering=0) - self.assertEqual(f.readable(), True) - self.assertEqual(f.writable(), False) - self.assertEqual(f.seekable(), True) - self.read_ops(f) - f.close() + with self.open(support.TESTFN, "wb", buffering=0) as f: + self.assertEqual(f.readable(), False) + self.assertEqual(f.writable(), True) + self.assertEqual(f.seekable(), True) + self.write_ops(f) + with self.open(support.TESTFN, "rb", buffering=0) as f: + self.assertEqual(f.readable(), True) + self.assertEqual(f.writable(), False) + self.assertEqual(f.seekable(), True) + self.read_ops(f) def test_buffered_file_io(self): - f = io.open(test_support.TESTFN, "wb") - self.assertEqual(f.readable(), False) - self.assertEqual(f.writable(), True) - self.assertEqual(f.seekable(), True) - self.write_ops(f) - f.close() - f = io.open(test_support.TESTFN, "rb") - self.assertEqual(f.readable(), True) - self.assertEqual(f.writable(), False) - self.assertEqual(f.seekable(), True) - self.read_ops(f, True) - f.close() + with self.open(support.TESTFN, "wb") as f: + self.assertEqual(f.readable(), False) + self.assertEqual(f.writable(), True) + self.assertEqual(f.seekable(), True) + self.write_ops(f) + with self.open(support.TESTFN, "rb") as f: + self.assertEqual(f.readable(), True) + self.assertEqual(f.writable(), False) + self.assertEqual(f.seekable(), True) + self.read_ops(f, True) def test_readline(self): - f = io.open(test_support.TESTFN, "wb") - f.write(b"abc\ndef\nxyzzy\nfoo") - f.close() - f = io.open(test_support.TESTFN, "rb") - self.assertEqual(f.readline(), b"abc\n") - self.assertEqual(f.readline(10), b"def\n") - self.assertEqual(f.readline(2), b"xy") - self.assertEqual(f.readline(4), b"zzy\n") - self.assertEqual(f.readline(), b"foo") - f.close() + with self.open(support.TESTFN, "wb") as f: + f.write(b"abc\ndef\nxyzzy\nfoo\x00bar\nanother line") + with self.open(support.TESTFN, "rb") as f: + self.assertEqual(f.readline(), b"abc\n") + self.assertEqual(f.readline(10), b"def\n") + self.assertEqual(f.readline(2), b"xy") + self.assertEqual(f.readline(4), b"zzy\n") + self.assertEqual(f.readline(), b"foo\x00bar\n") + self.assertEqual(f.readline(), b"another line") + self.assertRaises(TypeError, f.readline, 5.3) + with self.open(support.TESTFN, "r") as f: + self.assertRaises(TypeError, f.readline, 5.3) def test_raw_bytes_io(self): - f = io.BytesIO() + f = self.BytesIO() self.write_ops(f) data = f.getvalue() self.assertEqual(data, b"hello world\n") - f = io.BytesIO(data) + f = self.BytesIO(data) self.read_ops(f, True) def test_large_file_ops(self): # On Windows and Mac OSX this test comsumes large resources; It takes # a long time to build the >2GB file and takes >2GB of disk space # therefore the resource must be enabled to run this test. - if sys.platform[:3] in ('win', 'os2') or sys.platform == 'darwin': - if not test_support.is_resource_enabled("largefile"): + if sys.platform[:3] == 'win' or sys.platform == 'darwin': + if not support.is_resource_enabled("largefile"): print("\nTesting large file ops skipped on %s." % sys.platform, file=sys.stderr) print("It requires %d bytes and a long time." % self.LARGE, @@ -210,22 +367,20 @@ print("Use 'regrtest.py -u largefile test_io' to run it.", file=sys.stderr) return - f = io.open(test_support.TESTFN, "w+b", 0) - self.large_file_ops(f) - f.close() - f = io.open(test_support.TESTFN, "w+b") - self.large_file_ops(f) - f.close() + with self.open(support.TESTFN, "w+b", 0) as f: + self.large_file_ops(f) + with self.open(support.TESTFN, "w+b") as f: + self.large_file_ops(f) def test_with_open(self): for bufsize in (0, 1, 100): f = None - with open(test_support.TESTFN, "wb", bufsize) as f: + with self.open(support.TESTFN, "wb", bufsize) as f: f.write(b"xxx") self.assertEqual(f.closed, True) f = None try: - with open(test_support.TESTFN, "wb", bufsize) as f: + with self.open(support.TESTFN, "wb", bufsize) as f: 1/0 except ZeroDivisionError: self.assertEqual(f.closed, True) @@ -234,60 +389,105 @@ # issue 5008 def test_append_mode_tell(self): - with io.open(test_support.TESTFN, "wb") as f: + with self.open(support.TESTFN, "wb") as f: f.write(b"xxx") - with io.open(test_support.TESTFN, "ab", buffering=0) as f: + with self.open(support.TESTFN, "ab", buffering=0) as f: self.assertEqual(f.tell(), 3) - with io.open(test_support.TESTFN, "ab") as f: + with self.open(support.TESTFN, "ab") as f: self.assertEqual(f.tell(), 3) - with io.open(test_support.TESTFN, "a") as f: + with self.open(support.TESTFN, "a") as f: self.assert_(f.tell() > 0) def test_destructor(self): record = [] - class MyFileIO(io.FileIO): + class MyFileIO(self.FileIO): def __del__(self): record.append(1) - io.FileIO.__del__(self) + try: + f = super(MyFileIO, self).__del__ + except AttributeError: + pass + else: + f() def close(self): record.append(2) - io.FileIO.close(self) + super(MyFileIO, self).close() def flush(self): record.append(3) - io.FileIO.flush(self) - f = MyFileIO(test_support.TESTFN, "w") - f.write("xxx") + super(MyFileIO, self).flush() + f = MyFileIO(support.TESTFN, "wb") + f.write(b"xxx") + del f + support.gc_collect() + self.assertEqual(record, [1, 2, 3]) + with self.open(support.TESTFN, "rb") as f: + self.assertEqual(f.read(), b"xxx") + + def _check_base_destructor(self, base): + record = [] + class MyIO(base): + def __init__(self): + # This exercises the availability of attributes on object + # destruction. + # (in the C version, close() is called by the tp_dealloc + # function, not by __del__) + self.on_del = 1 + self.on_close = 2 + self.on_flush = 3 + def __del__(self): + record.append(self.on_del) + try: + f = super(MyIO, self).__del__ + except AttributeError: + pass + else: + f() + def close(self): + record.append(self.on_close) + super(MyIO, self).close() + def flush(self): + record.append(self.on_flush) + super(MyIO, self).flush() + f = MyIO() del f + support.gc_collect() self.assertEqual(record, [1, 2, 3]) + def test_IOBase_destructor(self): + self._check_base_destructor(self.IOBase) + + def test_RawIOBase_destructor(self): + self._check_base_destructor(self.RawIOBase) + + def test_BufferedIOBase_destructor(self): + self._check_base_destructor(self.BufferedIOBase) + + def test_TextIOBase_destructor(self): + self._check_base_destructor(self.TextIOBase) + def test_close_flushes(self): - f = io.open(test_support.TESTFN, "wb") - f.write(b"xxx") - f.close() - f = io.open(test_support.TESTFN, "rb") - self.assertEqual(f.read(), b"xxx") - f.close() + with self.open(support.TESTFN, "wb") as f: + f.write(b"xxx") + with self.open(support.TESTFN, "rb") as f: + self.assertEqual(f.read(), b"xxx") - def XXXtest_array_writes(self): - # XXX memory view not available yet - a = array.array('i', range(10)) - n = len(memoryview(a)) - f = io.open(test_support.TESTFN, "wb", 0) - self.assertEqual(f.write(a), n) - f.close() - f = io.open(test_support.TESTFN, "wb") - self.assertEqual(f.write(a), n) - f.close() + def test_array_writes(self): + a = array.array(b'i', range(10)) + n = len(a.tostring()) + with self.open(support.TESTFN, "wb", 0) as f: + self.assertEqual(f.write(a), n) + with self.open(support.TESTFN, "wb") as f: + self.assertEqual(f.write(a), n) def test_closefd(self): - self.assertRaises(ValueError, io.open, test_support.TESTFN, 'w', + self.assertRaises(ValueError, self.open, support.TESTFN, 'w', closefd=False) - def testReadClosed(self): - with io.open(test_support.TESTFN, "w") as f: + def test_read_closed(self): + with self.open(support.TESTFN, "w") as f: f.write("egg\n") - with io.open(test_support.TESTFN, "r") as f: - file = io.open(f.fileno(), "r", closefd=False) + with self.open(support.TESTFN, "r") as f: + file = self.open(f.fileno(), "r", closefd=False) self.assertEqual(file.read(), "egg\n") file.seek(0) file.close() @@ -295,86 +495,203 @@ def test_no_closefd_with_filename(self): # can't use closefd in combination with a file name - self.assertRaises(ValueError, - io.open, test_support.TESTFN, "r", closefd=False) + self.assertRaises(ValueError, self.open, support.TESTFN, "r", closefd=False) def test_closefd_attr(self): - with io.open(test_support.TESTFN, "wb") as f: + with self.open(support.TESTFN, "wb") as f: f.write(b"egg\n") - with io.open(test_support.TESTFN, "r") as f: + with self.open(support.TESTFN, "r") as f: self.assertEqual(f.buffer.raw.closefd, True) - file = io.open(f.fileno(), "r", closefd=False) + file = self.open(f.fileno(), "r", closefd=False) self.assertEqual(file.buffer.raw.closefd, False) + def test_garbage_collection(self): + # FileIO objects are collected, and collecting them flushes + # all data to disk. + f = self.FileIO(support.TESTFN, "wb") + f.write(b"abcxxx") + f.f = f + wr = weakref.ref(f) + del f + support.gc_collect() + self.assert_(wr() is None, wr) + with self.open(support.TESTFN, "rb") as f: + self.assertEqual(f.read(), b"abcxxx") + + def test_unbounded_file(self): + # Issue #1174606: reading from an unbounded stream such as /dev/zero. + zero = "/dev/zero" + if not os.path.exists(zero): + self.skipTest("{0} does not exist".format(zero)) + if sys.maxsize > 0x7FFFFFFF: + self.skipTest("test can only run in a 32-bit address space") + if support.real_max_memuse < support._2G: + self.skipTest("test requires at least 2GB of memory") + with self.open(zero, "rb", buffering=0) as f: + self.assertRaises(OverflowError, f.read) + with self.open(zero, "rb") as f: + self.assertRaises(OverflowError, f.read) + with self.open(zero, "r") as f: + self.assertRaises(OverflowError, f.read) + +class CIOTest(IOTest): + pass + +class PyIOTest(IOTest): + test_array_writes = unittest.skip( + "len(array.array) returns number of elements rather than bytelength" + )(IOTest.test_array_writes) + + +class CommonBufferedTests: + # Tests common to BufferedReader, BufferedWriter and BufferedRandom + + def test_detach(self): + raw = self.MockRawIO() + buf = self.tp(raw) + self.assertIs(buf.detach(), raw) + self.assertRaises(ValueError, buf.detach) + + def test_fileno(self): + rawio = self.MockRawIO() + bufio = self.tp(rawio) -class MemorySeekTestMixin: - - def testInit(self): - buf = self.buftype("1234567890") - bytesIo = self.ioclass(buf) - - def testRead(self): - buf = self.buftype("1234567890") - bytesIo = self.ioclass(buf) - - self.assertEquals(buf[:1], bytesIo.read(1)) - self.assertEquals(buf[1:5], bytesIo.read(4)) - self.assertEquals(buf[5:], bytesIo.read(900)) - self.assertEquals(self.EOF, bytesIo.read()) - - def testReadNoArgs(self): - buf = self.buftype("1234567890") - bytesIo = self.ioclass(buf) - - self.assertEquals(buf, bytesIo.read()) - self.assertEquals(self.EOF, bytesIo.read()) - - def testSeek(self): - buf = self.buftype("1234567890") - bytesIo = self.ioclass(buf) - - bytesIo.read(5) - bytesIo.seek(0) - self.assertEquals(buf, bytesIo.read()) - - bytesIo.seek(3) - self.assertEquals(buf[3:], bytesIo.read()) - self.assertRaises(TypeError, bytesIo.seek, 0.0) - - def testTell(self): - buf = self.buftype("1234567890") - bytesIo = self.ioclass(buf) - - self.assertEquals(0, bytesIo.tell()) - bytesIo.seek(5) - self.assertEquals(5, bytesIo.tell()) - bytesIo.seek(10000) - self.assertEquals(10000, bytesIo.tell()) - - -class BytesIOTest(MemorySeekTestMixin, unittest.TestCase): - @staticmethod - def buftype(s): - return s.encode("utf-8") - ioclass = io.BytesIO - EOF = b"" - - -class StringIOTest(MemorySeekTestMixin, unittest.TestCase): - buftype = str - ioclass = io.StringIO - EOF = "" + self.assertEquals(42, bufio.fileno()) + def test_no_fileno(self): + # XXX will we always have fileno() function? If so, kill + # this test. Else, write it. + pass -class BufferedReaderTest(unittest.TestCase): + def test_invalid_args(self): + rawio = self.MockRawIO() + bufio = self.tp(rawio) + # Invalid whence + self.assertRaises(ValueError, bufio.seek, 0, -1) + self.assertRaises(ValueError, bufio.seek, 0, 3) - def testRead(self): - rawio = MockRawIO((b"abc", b"d", b"efg")) - bufio = io.BufferedReader(rawio) + def test_override_destructor(self): + tp = self.tp + record = [] + class MyBufferedIO(tp): + def __del__(self): + record.append(1) + try: + f = super(MyBufferedIO, self).__del__ + except AttributeError: + pass + else: + f() + def close(self): + record.append(2) + super(MyBufferedIO, self).close() + def flush(self): + record.append(3) + super(MyBufferedIO, self).flush() + rawio = self.MockRawIO() + bufio = MyBufferedIO(rawio) + writable = bufio.writable() + del bufio + support.gc_collect() + if writable: + self.assertEqual(record, [1, 2, 3]) + else: + self.assertEqual(record, [1, 2]) + def test_context_manager(self): + # Test usability as a context manager + rawio = self.MockRawIO() + bufio = self.tp(rawio) + def _with(): + with bufio: + pass + _with() + # bufio should now be closed, and using it a second time should raise + # a ValueError. + self.assertRaises(ValueError, _with) + + def test_error_through_destructor(self): + # Test that the exception state is not modified by a destructor, + # even if close() fails. + rawio = self.CloseFailureIO() + def f(): + self.tp(rawio).xyzzy + with support.captured_output("stderr") as s: + self.assertRaises(AttributeError, f) + s = s.getvalue().strip() + if s: + # The destructor *may* have printed an unraisable error, check it + self.assertEqual(len(s.splitlines()), 1) + self.assert_(s.startswith("Exception IOError: "), s) + self.assert_(s.endswith(" ignored"), s) + + def test_repr(self): + raw = self.MockRawIO() + b = self.tp(raw) + clsname = "%s.%s" % (self.tp.__module__, self.tp.__name__) + self.assertEqual(repr(b), "<%s>" % clsname) + raw.name = "dummy" + self.assertEqual(repr(b), "<%s name=u'dummy'>" % clsname) + raw.name = b"dummy" + self.assertEqual(repr(b), "<%s name='dummy'>" % clsname) + + +class BufferedReaderTest(unittest.TestCase, CommonBufferedTests): + read_mode = "rb" + + def test_constructor(self): + rawio = self.MockRawIO([b"abc"]) + bufio = self.tp(rawio) + bufio.__init__(rawio) + bufio.__init__(rawio, buffer_size=1024) + bufio.__init__(rawio, buffer_size=16) + self.assertEquals(b"abc", bufio.read()) + self.assertRaises(ValueError, bufio.__init__, rawio, buffer_size=0) + self.assertRaises(ValueError, bufio.__init__, rawio, buffer_size=-16) + self.assertRaises(ValueError, bufio.__init__, rawio, buffer_size=-1) + rawio = self.MockRawIO([b"abc"]) + bufio.__init__(rawio) + self.assertEquals(b"abc", bufio.read()) + + def test_read(self): + rawio = self.MockRawIO((b"abc", b"d", b"efg")) + bufio = self.tp(rawio) self.assertEquals(b"abcdef", bufio.read(6)) + # Invalid args + self.assertRaises(ValueError, bufio.read, -2) - def testBuffering(self): + def test_read1(self): + rawio = self.MockRawIO((b"abc", b"d", b"efg")) + bufio = self.tp(rawio) + self.assertEquals(b"a", bufio.read(1)) + self.assertEquals(b"b", bufio.read1(1)) + self.assertEquals(rawio._reads, 1) + self.assertEquals(b"c", bufio.read1(100)) + self.assertEquals(rawio._reads, 1) + self.assertEquals(b"d", bufio.read1(100)) + self.assertEquals(rawio._reads, 2) + self.assertEquals(b"efg", bufio.read1(100)) + self.assertEquals(rawio._reads, 3) + self.assertEquals(b"", bufio.read1(100)) + # Invalid args + self.assertRaises(ValueError, bufio.read1, -1) + + def test_readinto(self): + rawio = self.MockRawIO((b"abc", b"d", b"efg")) + bufio = self.tp(rawio) + b = bytearray(2) + self.assertEquals(bufio.readinto(b), 2) + self.assertEquals(b, b"ab") + self.assertEquals(bufio.readinto(b), 2) + self.assertEquals(b, b"cd") + self.assertEquals(bufio.readinto(b), 2) + self.assertEquals(b, b"ef") + self.assertEquals(bufio.readinto(b), 1) + self.assertEquals(b, b"gf") + self.assertEquals(bufio.readinto(b), 0) + self.assertEquals(b, b"gf") + + def test_buffering(self): data = b"abcdefghi" dlen = len(data) @@ -385,61 +702,52 @@ ] for bufsize, buf_read_sizes, raw_read_sizes in tests: - rawio = MockFileIO(data) - bufio = io.BufferedReader(rawio, buffer_size=bufsize) + rawio = self.MockFileIO(data) + bufio = self.tp(rawio, buffer_size=bufsize) pos = 0 for nbytes in buf_read_sizes: self.assertEquals(bufio.read(nbytes), data[pos:pos+nbytes]) pos += nbytes + # this is mildly implementation-dependent self.assertEquals(rawio.read_history, raw_read_sizes) - def testReadNonBlocking(self): + def test_read_non_blocking(self): # Inject some None's in there to simulate EWOULDBLOCK - rawio = MockRawIO((b"abc", b"d", None, b"efg", None, None)) - bufio = io.BufferedReader(rawio) + rawio = self.MockRawIO((b"abc", b"d", None, b"efg", None, None, None)) + bufio = self.tp(rawio) self.assertEquals(b"abcd", bufio.read(6)) self.assertEquals(b"e", bufio.read(1)) self.assertEquals(b"fg", bufio.read()) + self.assertEquals(b"", bufio.peek(1)) self.assert_(None is bufio.read()) self.assertEquals(b"", bufio.read()) - def testReadToEof(self): - rawio = MockRawIO((b"abc", b"d", b"efg")) - bufio = io.BufferedReader(rawio) + def test_read_past_eof(self): + rawio = self.MockRawIO((b"abc", b"d", b"efg")) + bufio = self.tp(rawio) self.assertEquals(b"abcdefg", bufio.read(9000)) - def testReadNoArgs(self): - rawio = MockRawIO((b"abc", b"d", b"efg")) - bufio = io.BufferedReader(rawio) + def test_read_all(self): + rawio = self.MockRawIO((b"abc", b"d", b"efg")) + bufio = self.tp(rawio) self.assertEquals(b"abcdefg", bufio.read()) - def testFileno(self): - rawio = MockRawIO((b"abc", b"d", b"efg")) - bufio = io.BufferedReader(rawio) - - self.assertEquals(42, bufio.fileno()) - - def testFilenoNoFileno(self): - # XXX will we always have fileno() function? If so, kill - # this test. Else, write it. - pass - - def testThreads(self): + def test_threads(self): try: # Write out many bytes with exactly the same number of 0's, # 1's... 255's. This will help us check that concurrent reading # doesn't duplicate or forget contents. N = 1000 - l = range(256) * N + l = list(range(256)) * N random.shuffle(l) s = bytes(bytearray(l)) - with io.open(test_support.TESTFN, "wb") as f: + with self.open(support.TESTFN, "wb") as f: f.write(s) - with io.open(test_support.TESTFN, "rb", buffering=0) as raw: - bufio = io.BufferedReader(raw, 8) + with self.open(support.TESTFN, self.read_mode, buffering=0) as raw: + bufio = self.tp(raw, 8) errors = [] results = [] def f(): @@ -467,82 +775,242 @@ c = bytes(bytearray([i])) self.assertEqual(s.count(c), N) finally: - test_support.unlink(test_support.TESTFN) - + support.unlink(support.TESTFN) + def test_misbehaved_io(self): + rawio = self.MisbehavedRawIO((b"abc", b"d", b"efg")) + bufio = self.tp(rawio) + self.assertRaises(IOError, bufio.seek, 0) + self.assertRaises(IOError, bufio.tell) + +class CBufferedReaderTest(BufferedReaderTest): + tp = io.BufferedReader + + def test_constructor(self): + BufferedReaderTest.test_constructor(self) + # The allocation can succeed on 32-bit builds, e.g. with more + # than 2GB RAM and a 64-bit kernel. + if sys.maxsize > 0x7FFFFFFF: + rawio = self.MockRawIO() + bufio = self.tp(rawio) + self.assertRaises((OverflowError, MemoryError, ValueError), + bufio.__init__, rawio, sys.maxsize) + + def test_initialization(self): + rawio = self.MockRawIO([b"abc"]) + bufio = self.tp(rawio) + self.assertRaises(ValueError, bufio.__init__, rawio, buffer_size=0) + self.assertRaises(ValueError, bufio.read) + self.assertRaises(ValueError, bufio.__init__, rawio, buffer_size=-16) + self.assertRaises(ValueError, bufio.read) + self.assertRaises(ValueError, bufio.__init__, rawio, buffer_size=-1) + self.assertRaises(ValueError, bufio.read) + + def test_misbehaved_io_read(self): + rawio = self.MisbehavedRawIO((b"abc", b"d", b"efg")) + bufio = self.tp(rawio) + # _pyio.BufferedReader seems to implement reading different, so that + # checking this is not so easy. + self.assertRaises(IOError, bufio.read, 10) + + def test_garbage_collection(self): + # C BufferedReader objects are collected. + # The Python version has __del__, so it ends into gc.garbage instead + rawio = self.FileIO(support.TESTFN, "w+b") + f = self.tp(rawio) + f.f = f + wr = weakref.ref(f) + del f + support.gc_collect() + self.assert_(wr() is None, wr) -class BufferedWriterTest(unittest.TestCase): +class PyBufferedReaderTest(BufferedReaderTest): + tp = pyio.BufferedReader - def testWrite(self): - # Write to the buffered IO but don't overflow the buffer. - writer = MockRawIO() - bufio = io.BufferedWriter(writer, 8) - bufio.write(b"abc") - - self.assertFalse(writer._write_stack) +class BufferedWriterTest(unittest.TestCase, CommonBufferedTests): + write_mode = "wb" + + def test_constructor(self): + rawio = self.MockRawIO() + bufio = self.tp(rawio) + bufio.__init__(rawio) + bufio.__init__(rawio, buffer_size=1024) + bufio.__init__(rawio, buffer_size=16) + self.assertEquals(3, bufio.write(b"abc")) + bufio.flush() + self.assertRaises(ValueError, bufio.__init__, rawio, buffer_size=0) + self.assertRaises(ValueError, bufio.__init__, rawio, buffer_size=-16) + self.assertRaises(ValueError, bufio.__init__, rawio, buffer_size=-1) + bufio.__init__(rawio) + self.assertEquals(3, bufio.write(b"ghi")) + bufio.flush() + self.assertEquals(b"".join(rawio._write_stack), b"abcghi") - def testWriteOverflow(self): - writer = MockRawIO() - bufio = io.BufferedWriter(writer, 8) + def test_detach_flush(self): + raw = self.MockRawIO() + buf = self.tp(raw) + buf.write(b"howdy!") + self.assertFalse(raw._write_stack) + buf.detach() + self.assertEqual(raw._write_stack, [b"howdy!"]) + def test_write(self): + # Write to the buffered IO but don't overflow the buffer. + writer = self.MockRawIO() + bufio = self.tp(writer, 8) bufio.write(b"abc") - bufio.write(b"defghijkl") - - self.assertEquals(b"abcdefghijkl", writer._write_stack[0]) - - def testWriteNonBlocking(self): - raw = MockNonBlockWriterIO((9, 2, 22, -6, 10, 12, 12)) - bufio = io.BufferedWriter(raw, 8, 16) - - bufio.write(b"asdf") - bufio.write(b"asdfa") - self.assertEquals(b"asdfasdfa", raw._write_stack[0]) - - bufio.write(b"asdfasdfasdf") - self.assertEquals(b"asdfasdfasdf", raw._write_stack[1]) - bufio.write(b"asdfasdfasdf") - self.assertEquals(b"dfasdfasdf", raw._write_stack[2]) - self.assertEquals(b"asdfasdfasdf", raw._write_stack[3]) + self.assertFalse(writer._write_stack) - bufio.write(b"asdfasdfasdf") + def test_write_overflow(self): + writer = self.MockRawIO() + bufio = self.tp(writer, 8) + contents = b"abcdefghijklmnop" + for n in range(0, len(contents), 3): + bufio.write(contents[n:n+3]) + flushed = b"".join(writer._write_stack) + # At least (total - 8) bytes were implicitly flushed, perhaps more + # depending on the implementation. + self.assert_(flushed.startswith(contents[:-8]), flushed) + + def check_writes(self, intermediate_func): + # Lots of writes, test the flushed output is as expected. + contents = bytes(range(256)) * 1000 + n = 0 + writer = self.MockRawIO() + bufio = self.tp(writer, 13) + # Generator of write sizes: repeat each N 15 times then proceed to N+1 + def gen_sizes(): + for size in count(1): + for i in range(15): + yield size + sizes = gen_sizes() + while n < len(contents): + size = min(next(sizes), len(contents) - n) + self.assertEquals(bufio.write(contents[n:n+size]), size) + intermediate_func(bufio) + n += size + bufio.flush() + self.assertEquals(contents, + b"".join(writer._write_stack)) - # XXX I don't like this test. It relies too heavily on how the - # algorithm actually works, which we might change. Refactor - # later. + def test_writes(self): + self.check_writes(lambda bufio: None) - def testFileno(self): - rawio = MockRawIO((b"abc", b"d", b"efg")) - bufio = io.BufferedWriter(rawio) + def test_writes_and_flushes(self): + self.check_writes(lambda bufio: bufio.flush()) - self.assertEquals(42, bufio.fileno()) + def test_writes_and_seeks(self): + def _seekabs(bufio): + pos = bufio.tell() + bufio.seek(pos + 1, 0) + bufio.seek(pos - 1, 0) + bufio.seek(pos, 0) + self.check_writes(_seekabs) + def _seekrel(bufio): + pos = bufio.seek(0, 1) + bufio.seek(+1, 1) + bufio.seek(-1, 1) + bufio.seek(pos, 0) + self.check_writes(_seekrel) + + def test_writes_and_truncates(self): + self.check_writes(lambda bufio: bufio.truncate(bufio.tell())) + + def test_write_non_blocking(self): + raw = self.MockNonBlockWriterIO() + bufio = self.tp(raw, 8) + + self.assertEquals(bufio.write(b"abcd"), 4) + self.assertEquals(bufio.write(b"efghi"), 5) + # 1 byte will be written, the rest will be buffered + raw.block_on(b"k") + self.assertEquals(bufio.write(b"jklmn"), 5) - def testFlush(self): - writer = MockRawIO() - bufio = io.BufferedWriter(writer, 8) + # 8 bytes will be written, 8 will be buffered and the rest will be lost + raw.block_on(b"0") + try: + bufio.write(b"opqrwxyz0123456789") + except self.BlockingIOError as e: + written = e.characters_written + else: + self.fail("BlockingIOError should have been raised") + self.assertEquals(written, 16) + self.assertEquals(raw.pop_written(), + b"abcdefghijklmnopqrwxyz") + + self.assertEquals(bufio.write(b"ABCDEFGHI"), 9) + s = raw.pop_written() + # Previously buffered bytes were flushed + self.assertTrue(s.startswith(b"01234567A"), s) + + def test_write_and_rewind(self): + raw = io.BytesIO() + bufio = self.tp(raw, 4) + self.assertEqual(bufio.write(b"abcdef"), 6) + self.assertEqual(bufio.tell(), 6) + bufio.seek(0, 0) + self.assertEqual(bufio.write(b"XY"), 2) + bufio.seek(6, 0) + self.assertEqual(raw.getvalue(), b"XYcdef") + self.assertEqual(bufio.write(b"123456"), 6) + bufio.flush() + self.assertEqual(raw.getvalue(), b"XYcdef123456") + def test_flush(self): + writer = self.MockRawIO() + bufio = self.tp(writer, 8) bufio.write(b"abc") bufio.flush() + self.assertEquals(b"abc", writer._write_stack[0]) + def test_destructor(self): + writer = self.MockRawIO() + bufio = self.tp(writer, 8) + bufio.write(b"abc") + del bufio + support.gc_collect() self.assertEquals(b"abc", writer._write_stack[0]) - def testThreads(self): - # BufferedWriter should not raise exceptions or crash - # when called from multiple threads. + def test_truncate(self): + # Truncate implicitly flushes the buffer. + with self.open(support.TESTFN, self.write_mode, buffering=0) as raw: + bufio = self.tp(raw, 8) + bufio.write(b"abcdef") + self.assertEqual(bufio.truncate(3), 3) + self.assertEqual(bufio.tell(), 3) + with self.open(support.TESTFN, "rb", buffering=0) as f: + self.assertEqual(f.read(), b"abc") + + def test_threads(self): try: + # Write out many bytes from many threads and test they were + # all flushed. + N = 1000 + contents = bytes(range(256)) * N + sizes = cycle([1, 19]) + n = 0 + queue = deque() + while n < len(contents): + size = next(sizes) + queue.append(contents[n:n+size]) + n += size + del contents # We use a real file object because it allows us to # exercise situations where the GIL is released before # writing the buffer to the raw streams. This is in addition # to concurrency issues due to switching threads in the middle # of Python code. - with io.open(test_support.TESTFN, "wb", buffering=0) as raw: - bufio = io.BufferedWriter(raw, 8) + with self.open(support.TESTFN, self.write_mode, buffering=0) as raw: + bufio = self.tp(raw, 8) errors = [] def f(): try: - # Write enough bytes to flush the buffer - s = b"a" * 19 - for i in range(50): + while True: + try: + s = queue.popleft() + except IndexError: + return bufio.write(s) except Exception as e: errors.append(e) @@ -555,37 +1023,218 @@ t.join() self.assertFalse(errors, "the following exceptions were caught: %r" % errors) + bufio.close() + with self.open(support.TESTFN, "rb") as f: + s = f.read() + for i in range(256): + self.assertEquals(s.count(bytes([i])), N) finally: - test_support.unlink(test_support.TESTFN) + support.unlink(support.TESTFN) + + def test_misbehaved_io(self): + rawio = self.MisbehavedRawIO() + bufio = self.tp(rawio, 5) + self.assertRaises(IOError, bufio.seek, 0) + self.assertRaises(IOError, bufio.tell) + self.assertRaises(IOError, bufio.write, b"abcdef") + + def test_max_buffer_size_deprecation(self): + with support.check_warnings() as w: + warnings.simplefilter("always", DeprecationWarning) + self.tp(self.MockRawIO(), 8, 12) + self.assertEqual(len(w.warnings), 1) + warning = w.warnings[0] + self.assertTrue(warning.category is DeprecationWarning) + self.assertEqual(str(warning.message), + "max_buffer_size is deprecated") + + +class CBufferedWriterTest(BufferedWriterTest): + tp = io.BufferedWriter + + def test_constructor(self): + BufferedWriterTest.test_constructor(self) + # The allocation can succeed on 32-bit builds, e.g. with more + # than 2GB RAM and a 64-bit kernel. + if sys.maxsize > 0x7FFFFFFF: + rawio = self.MockRawIO() + bufio = self.tp(rawio) + self.assertRaises((OverflowError, MemoryError, ValueError), + bufio.__init__, rawio, sys.maxsize) + + def test_initialization(self): + rawio = self.MockRawIO() + bufio = self.tp(rawio) + self.assertRaises(ValueError, bufio.__init__, rawio, buffer_size=0) + self.assertRaises(ValueError, bufio.write, b"def") + self.assertRaises(ValueError, bufio.__init__, rawio, buffer_size=-16) + self.assertRaises(ValueError, bufio.write, b"def") + self.assertRaises(ValueError, bufio.__init__, rawio, buffer_size=-1) + self.assertRaises(ValueError, bufio.write, b"def") + + def test_garbage_collection(self): + # C BufferedWriter objects are collected, and collecting them flushes + # all data to disk. + # The Python version has __del__, so it ends into gc.garbage instead + rawio = self.FileIO(support.TESTFN, "w+b") + f = self.tp(rawio) + f.write(b"123xxx") + f.x = f + wr = weakref.ref(f) + del f + support.gc_collect() + self.assert_(wr() is None, wr) + with self.open(support.TESTFN, "rb") as f: + self.assertEqual(f.read(), b"123xxx") + +class PyBufferedWriterTest(BufferedWriterTest): + tp = pyio.BufferedWriter class BufferedRWPairTest(unittest.TestCase): - def testRWPair(self): - r = MockRawIO(()) - w = MockRawIO() - pair = io.BufferedRWPair(r, w) + def test_constructor(self): + pair = self.tp(self.MockRawIO(), self.MockRawIO()) self.assertFalse(pair.closed) - # XXX More Tests + def test_detach(self): + pair = self.tp(self.MockRawIO(), self.MockRawIO()) + self.assertRaises(self.UnsupportedOperation, pair.detach) + + def test_constructor_max_buffer_size_deprecation(self): + with support.check_warnings() as w: + warnings.simplefilter("always", DeprecationWarning) + self.tp(self.MockRawIO(), self.MockRawIO(), 8, 12) + self.assertEqual(len(w.warnings), 1) + warning = w.warnings[0] + self.assertTrue(warning.category is DeprecationWarning) + self.assertEqual(str(warning.message), + "max_buffer_size is deprecated") + + def test_constructor_with_not_readable(self): + class NotReadable(MockRawIO): + def readable(self): + return False + + self.assertRaises(IOError, self.tp, NotReadable(), self.MockRawIO()) + + def test_constructor_with_not_writeable(self): + class NotWriteable(MockRawIO): + def writable(self): + return False + + self.assertRaises(IOError, self.tp, self.MockRawIO(), NotWriteable()) + + def test_read(self): + pair = self.tp(self.BytesIO(b"abcdef"), self.MockRawIO()) + + self.assertEqual(pair.read(3), b"abc") + self.assertEqual(pair.read(1), b"d") + self.assertEqual(pair.read(), b"ef") + + def test_read1(self): + # .read1() is delegated to the underlying reader object, so this test + # can be shallow. + pair = self.tp(self.BytesIO(b"abcdef"), self.MockRawIO()) + + self.assertEqual(pair.read1(3), b"abc") + + def test_readinto(self): + pair = self.tp(self.BytesIO(b"abcdef"), self.MockRawIO()) + + data = bytearray(5) + self.assertEqual(pair.readinto(data), 5) + self.assertEqual(data, b"abcde") + + def test_write(self): + w = self.MockRawIO() + pair = self.tp(self.MockRawIO(), w) + + pair.write(b"abc") + pair.flush() + pair.write(b"def") + pair.flush() + self.assertEqual(w._write_stack, [b"abc", b"def"]) + + def test_peek(self): + pair = self.tp(self.BytesIO(b"abcdef"), self.MockRawIO()) + + self.assertTrue(pair.peek(3).startswith(b"abc")) + self.assertEqual(pair.read(3), b"abc") + + def test_readable(self): + pair = self.tp(self.MockRawIO(), self.MockRawIO()) + self.assertTrue(pair.readable()) + + def test_writeable(self): + pair = self.tp(self.MockRawIO(), self.MockRawIO()) + self.assertTrue(pair.writable()) + + def test_seekable(self): + # BufferedRWPairs are never seekable, even if their readers and writers + # are. + pair = self.tp(self.MockRawIO(), self.MockRawIO()) + self.assertFalse(pair.seekable()) + + # .flush() is delegated to the underlying writer object and has been + # tested in the test_write method. + + def test_close_and_closed(self): + pair = self.tp(self.MockRawIO(), self.MockRawIO()) + self.assertFalse(pair.closed) + pair.close() + self.assertTrue(pair.closed) + + def test_isatty(self): + class SelectableIsAtty(MockRawIO): + def __init__(self, isatty): + MockRawIO.__init__(self) + self._isatty = isatty + + def isatty(self): + return self._isatty + + pair = self.tp(SelectableIsAtty(False), SelectableIsAtty(False)) + self.assertFalse(pair.isatty()) + + pair = self.tp(SelectableIsAtty(True), SelectableIsAtty(False)) + self.assertTrue(pair.isatty()) + pair = self.tp(SelectableIsAtty(False), SelectableIsAtty(True)) + self.assertTrue(pair.isatty()) -class BufferedRandomTest(unittest.TestCase): + pair = self.tp(SelectableIsAtty(True), SelectableIsAtty(True)) + self.assertTrue(pair.isatty()) - def testReadAndWrite(self): - raw = MockRawIO((b"asdf", b"ghjk")) - rw = io.BufferedRandom(raw, 8, 12) +class CBufferedRWPairTest(BufferedRWPairTest): + tp = io.BufferedRWPair + +class PyBufferedRWPairTest(BufferedRWPairTest): + tp = pyio.BufferedRWPair + + +class BufferedRandomTest(BufferedReaderTest, BufferedWriterTest): + read_mode = "rb+" + write_mode = "wb+" + + def test_constructor(self): + BufferedReaderTest.test_constructor(self) + BufferedWriterTest.test_constructor(self) + + def test_read_and_write(self): + raw = self.MockRawIO((b"asdf", b"ghjk")) + rw = self.tp(raw, 8) self.assertEqual(b"as", rw.read(2)) rw.write(b"ddd") rw.write(b"eee") self.assertFalse(raw._write_stack) # Buffer writes - self.assertEqual(b"ghjk", rw.read()) # This read forces write flush + self.assertEqual(b"ghjk", rw.read()) self.assertEquals(b"dddeee", raw._write_stack[0]) - def testSeekAndTell(self): - raw = io.BytesIO(b"asdfghjkl") - rw = io.BufferedRandom(raw) + def test_seek_and_tell(self): + raw = self.BytesIO(b"asdfghjkl") + rw = self.tp(raw) self.assertEquals(b"as", rw.read(2)) self.assertEquals(2, rw.tell()) @@ -603,6 +1252,115 @@ self.assertEquals(b"fl", rw.read(11)) self.assertRaises(TypeError, rw.seek, 0.0) + def check_flush_and_read(self, read_func): + raw = self.BytesIO(b"abcdefghi") + bufio = self.tp(raw) + + self.assertEquals(b"ab", read_func(bufio, 2)) + bufio.write(b"12") + self.assertEquals(b"ef", read_func(bufio, 2)) + self.assertEquals(6, bufio.tell()) + bufio.flush() + self.assertEquals(6, bufio.tell()) + self.assertEquals(b"ghi", read_func(bufio)) + raw.seek(0, 0) + raw.write(b"XYZ") + # flush() resets the read buffer + bufio.flush() + bufio.seek(0, 0) + self.assertEquals(b"XYZ", read_func(bufio, 3)) + + def test_flush_and_read(self): + self.check_flush_and_read(lambda bufio, *args: bufio.read(*args)) + + def test_flush_and_readinto(self): + def _readinto(bufio, n=-1): + b = bytearray(n if n >= 0 else 9999) + n = bufio.readinto(b) + return bytes(b[:n]) + self.check_flush_and_read(_readinto) + + def test_flush_and_peek(self): + def _peek(bufio, n=-1): + # This relies on the fact that the buffer can contain the whole + # raw stream, otherwise peek() can return less. + b = bufio.peek(n) + if n != -1: + b = b[:n] + bufio.seek(len(b), 1) + return b + self.check_flush_and_read(_peek) + + def test_flush_and_write(self): + raw = self.BytesIO(b"abcdefghi") + bufio = self.tp(raw) + + bufio.write(b"123") + bufio.flush() + bufio.write(b"45") + bufio.flush() + bufio.seek(0, 0) + self.assertEquals(b"12345fghi", raw.getvalue()) + self.assertEquals(b"12345fghi", bufio.read()) + + def test_threads(self): + BufferedReaderTest.test_threads(self) + BufferedWriterTest.test_threads(self) + + def test_writes_and_peek(self): + def _peek(bufio): + bufio.peek(1) + self.check_writes(_peek) + def _peek(bufio): + pos = bufio.tell() + bufio.seek(-1, 1) + bufio.peek(1) + bufio.seek(pos, 0) + self.check_writes(_peek) + + def test_writes_and_reads(self): + def _read(bufio): + bufio.seek(-1, 1) + bufio.read(1) + self.check_writes(_read) + + def test_writes_and_read1s(self): + def _read1(bufio): + bufio.seek(-1, 1) + bufio.read1(1) + self.check_writes(_read1) + + def test_writes_and_readintos(self): + def _read(bufio): + bufio.seek(-1, 1) + bufio.readinto(bytearray(1)) + self.check_writes(_read) + + def test_misbehaved_io(self): + BufferedReaderTest.test_misbehaved_io(self) + BufferedWriterTest.test_misbehaved_io(self) + +class CBufferedRandomTest(CBufferedReaderTest, CBufferedWriterTest, BufferedRandomTest): + tp = io.BufferedRandom + + def test_constructor(self): + BufferedRandomTest.test_constructor(self) + # The allocation can succeed on 32-bit builds, e.g. with more + # than 2GB RAM and a 64-bit kernel. + if sys.maxsize > 0x7FFFFFFF: + rawio = self.MockRawIO() + bufio = self.tp(rawio) + self.assertRaises((OverflowError, MemoryError, ValueError), + bufio.__init__, rawio, sys.maxsize) + + def test_garbage_collection(self): + CBufferedReaderTest.test_garbage_collection(self) + CBufferedWriterTest.test_garbage_collection(self) + +class PyBufferedRandomTest(BufferedRandomTest): + tp = pyio.BufferedRandom + + # To fully exercise seek/tell, the StatefulIncrementalDecoder has these # properties: # - A single output character can correspond to many bytes of input. @@ -736,7 +1494,7 @@ 'm--------------.') ] - def testDecoder(self): + def test_decoder(self): # Try a few one-shot test cases. for input, eof, output in self.test_cases: d = StatefulIncrementalDecoder() @@ -752,98 +1510,115 @@ def setUp(self): self.testdata = b"AAA\r\nBBB\rCCC\r\nDDD\nEEE\r\n" self.normalized = b"AAA\nBBB\nCCC\nDDD\nEEE\n".decode("ascii") + support.unlink(support.TESTFN) def tearDown(self): - test_support.unlink(test_support.TESTFN) + support.unlink(support.TESTFN) - def testLineBuffering(self): - r = io.BytesIO() - b = io.BufferedWriter(r, 1000) - t = io.TextIOWrapper(b, newline="\n", line_buffering=True) - t.write(u"X") + def test_constructor(self): + r = self.BytesIO(b"\xc3\xa9\n\n") + b = self.BufferedReader(r, 1000) + t = self.TextIOWrapper(b) + t.__init__(b, encoding="latin1", newline="\r\n") + self.assertEquals(t.encoding, "latin1") + self.assertEquals(t.line_buffering, False) + t.__init__(b, encoding="utf8", line_buffering=True) + self.assertEquals(t.encoding, "utf8") + self.assertEquals(t.line_buffering, True) + self.assertEquals("\xe9\n", t.readline()) + self.assertRaises(TypeError, t.__init__, b, newline=42) + self.assertRaises(ValueError, t.__init__, b, newline='xyzzy') + + def test_detach(self): + r = self.BytesIO() + b = self.BufferedWriter(r) + t = self.TextIOWrapper(b) + self.assertIs(t.detach(), b) + + t = self.TextIOWrapper(b, encoding="ascii") + t.write("howdy") + self.assertFalse(r.getvalue()) + t.detach() + self.assertEqual(r.getvalue(), b"howdy") + self.assertRaises(ValueError, t.detach) + + def test_repr(self): + raw = self.BytesIO("hello".encode("utf-8")) + b = self.BufferedReader(raw) + t = self.TextIOWrapper(b, encoding="utf-8") + modname = self.TextIOWrapper.__module__ + self.assertEqual(repr(t), + "<%s.TextIOWrapper encoding='utf-8'>" % modname) + raw.name = "dummy" + self.assertEqual(repr(t), + "<%s.TextIOWrapper name=u'dummy' encoding='utf-8'>" % modname) + raw.name = b"dummy" + self.assertEqual(repr(t), + "<%s.TextIOWrapper name='dummy' encoding='utf-8'>" % modname) + + def test_line_buffering(self): + r = self.BytesIO() + b = self.BufferedWriter(r, 1000) + t = self.TextIOWrapper(b, newline="\n", line_buffering=True) + t.write("X") self.assertEquals(r.getvalue(), b"") # No flush happened - t.write(u"Y\nZ") + t.write("Y\nZ") self.assertEquals(r.getvalue(), b"XY\nZ") # All got flushed - t.write(u"A\rB") + t.write("A\rB") self.assertEquals(r.getvalue(), b"XY\nZA\rB") - def testEncodingErrorsReading(self): + def test_encoding(self): + # Check the encoding attribute is always set, and valid + b = self.BytesIO() + t = self.TextIOWrapper(b, encoding="utf8") + self.assertEqual(t.encoding, "utf8") + t = self.TextIOWrapper(b) + self.assert_(t.encoding is not None) + codecs.lookup(t.encoding) + + def test_encoding_errors_reading(self): # (1) default - b = io.BytesIO(b"abc\n\xff\n") - t = io.TextIOWrapper(b, encoding="ascii") + b = self.BytesIO(b"abc\n\xff\n") + t = self.TextIOWrapper(b, encoding="ascii") self.assertRaises(UnicodeError, t.read) # (2) explicit strict - b = io.BytesIO(b"abc\n\xff\n") - t = io.TextIOWrapper(b, encoding="ascii", errors="strict") + b = self.BytesIO(b"abc\n\xff\n") + t = self.TextIOWrapper(b, encoding="ascii", errors="strict") self.assertRaises(UnicodeError, t.read) # (3) ignore - b = io.BytesIO(b"abc\n\xff\n") - t = io.TextIOWrapper(b, encoding="ascii", errors="ignore") + b = self.BytesIO(b"abc\n\xff\n") + t = self.TextIOWrapper(b, encoding="ascii", errors="ignore") self.assertEquals(t.read(), "abc\n\n") # (4) replace - b = io.BytesIO(b"abc\n\xff\n") - t = io.TextIOWrapper(b, encoding="ascii", errors="replace") - self.assertEquals(t.read(), u"abc\n\ufffd\n") + b = self.BytesIO(b"abc\n\xff\n") + t = self.TextIOWrapper(b, encoding="ascii", errors="replace") + self.assertEquals(t.read(), "abc\n\ufffd\n") - def testEncodingErrorsWriting(self): + def test_encoding_errors_writing(self): # (1) default - b = io.BytesIO() - t = io.TextIOWrapper(b, encoding="ascii") - self.assertRaises(UnicodeError, t.write, u"\xff") + b = self.BytesIO() + t = self.TextIOWrapper(b, encoding="ascii") + self.assertRaises(UnicodeError, t.write, "\xff") # (2) explicit strict - b = io.BytesIO() - t = io.TextIOWrapper(b, encoding="ascii", errors="strict") - self.assertRaises(UnicodeError, t.write, u"\xff") + b = self.BytesIO() + t = self.TextIOWrapper(b, encoding="ascii", errors="strict") + self.assertRaises(UnicodeError, t.write, "\xff") # (3) ignore - b = io.BytesIO() - t = io.TextIOWrapper(b, encoding="ascii", errors="ignore", + b = self.BytesIO() + t = self.TextIOWrapper(b, encoding="ascii", errors="ignore", newline="\n") - t.write(u"abc\xffdef\n") + t.write("abc\xffdef\n") t.flush() self.assertEquals(b.getvalue(), b"abcdef\n") # (4) replace - b = io.BytesIO() - t = io.TextIOWrapper(b, encoding="ascii", errors="replace", + b = self.BytesIO() + t = self.TextIOWrapper(b, encoding="ascii", errors="replace", newline="\n") - t.write(u"abc\xffdef\n") + t.write("abc\xffdef\n") t.flush() self.assertEquals(b.getvalue(), b"abc?def\n") - def testNewlinesInput(self): - testdata = b"AAA\nBBB\nCCC\rDDD\rEEE\r\nFFF\r\nGGG" - normalized = testdata.replace(b"\r\n", b"\n").replace(b"\r", b"\n") - for newline, expected in [ - (None, normalized.decode("ascii").splitlines(True)), - ("", testdata.decode("ascii").splitlines(True)), - ("\n", ["AAA\n", "BBB\n", "CCC\rDDD\rEEE\r\n", "FFF\r\n", "GGG"]), - ("\r\n", ["AAA\nBBB\nCCC\rDDD\rEEE\r\n", "FFF\r\n", "GGG"]), - ("\r", ["AAA\nBBB\nCCC\r", "DDD\r", "EEE\r", "\nFFF\r", "\nGGG"]), - ]: - buf = io.BytesIO(testdata) - txt = io.TextIOWrapper(buf, encoding="ascii", newline=newline) - self.assertEquals(txt.readlines(), expected) - txt.seek(0) - self.assertEquals(txt.read(), "".join(expected)) - - def testNewlinesOutput(self): - testdict = { - "": b"AAA\nBBB\nCCC\nX\rY\r\nZ", - "\n": b"AAA\nBBB\nCCC\nX\rY\r\nZ", - "\r": b"AAA\rBBB\rCCC\rX\rY\r\rZ", - "\r\n": b"AAA\r\nBBB\r\nCCC\r\nX\rY\r\r\nZ", - } - tests = [(None, testdict[os.linesep])] + sorted(testdict.items()) - for newline, expected in tests: - buf = io.BytesIO() - txt = io.TextIOWrapper(buf, encoding="ascii", newline=newline) - txt.write("AAA\nB") - txt.write("BB\nCCC\n") - txt.write("X\rY\r\nZ") - txt.flush() - self.assertEquals(buf.closed, False) - self.assertEquals(buf.getvalue(), expected) - - def testNewlines(self): + def test_newlines(self): input_lines = [ "unix\n", "windows\r\n", "os9\r", "last\n", "nonl" ] tests = [ @@ -867,8 +1642,8 @@ for do_reads in (False, True): for bufsize in range(1, 10): for newline, exp_lines in tests: - bufio = io.BufferedReader(io.BytesIO(data), bufsize) - textio = io.TextIOWrapper(bufio, newline=newline, + bufio = self.BufferedReader(self.BytesIO(data), bufsize) + textio = self.TextIOWrapper(bufio, newline=newline, encoding=encoding) if do_reads: got_lines = [] @@ -885,75 +1660,117 @@ self.assertEquals(got_line, exp_line) self.assertEquals(len(got_lines), len(exp_lines)) - def testNewlinesInput(self): - testdata = b"AAA\nBBB\nCCC\rDDD\rEEE\r\nFFF\r\nGGG" + def test_newlines_input(self): + testdata = b"AAA\nBB\x00B\nCCC\rDDD\rEEE\r\nFFF\r\nGGG" normalized = testdata.replace(b"\r\n", b"\n").replace(b"\r", b"\n") for newline, expected in [ (None, normalized.decode("ascii").splitlines(True)), ("", testdata.decode("ascii").splitlines(True)), - ("\n", ["AAA\n", "BBB\n", "CCC\rDDD\rEEE\r\n", "FFF\r\n", "GGG"]), - ("\r\n", ["AAA\nBBB\nCCC\rDDD\rEEE\r\n", "FFF\r\n", "GGG"]), - ("\r", ["AAA\nBBB\nCCC\r", "DDD\r", "EEE\r", "\nFFF\r", "\nGGG"]), + ("\n", ["AAA\n", "BB\x00B\n", "CCC\rDDD\rEEE\r\n", "FFF\r\n", "GGG"]), + ("\r\n", ["AAA\nBB\x00B\nCCC\rDDD\rEEE\r\n", "FFF\r\n", "GGG"]), + ("\r", ["AAA\nBB\x00B\nCCC\r", "DDD\r", "EEE\r", "\nFFF\r", "\nGGG"]), ]: - buf = io.BytesIO(testdata) - txt = io.TextIOWrapper(buf, encoding="ascii", newline=newline) + buf = self.BytesIO(testdata) + txt = self.TextIOWrapper(buf, encoding="ascii", newline=newline) self.assertEquals(txt.readlines(), expected) txt.seek(0) self.assertEquals(txt.read(), "".join(expected)) - def testNewlinesOutput(self): - data = u"AAA\nBBB\rCCC\n" - data_lf = b"AAA\nBBB\rCCC\n" - data_cr = b"AAA\rBBB\rCCC\r" - data_crlf = b"AAA\r\nBBB\rCCC\r\n" - save_linesep = os.linesep - try: - for os.linesep, newline, expected in [ - ("\n", None, data_lf), - ("\r\n", None, data_crlf), - ("\n", "", data_lf), - ("\r\n", "", data_lf), - ("\n", "\n", data_lf), - ("\r\n", "\n", data_lf), - ("\n", "\r", data_cr), - ("\r\n", "\r", data_cr), - ("\n", "\r\n", data_crlf), - ("\r\n", "\r\n", data_crlf), - ]: - buf = io.BytesIO() - txt = io.TextIOWrapper(buf, encoding="ascii", newline=newline) - txt.write(data) - txt.close() - self.assertEquals(buf.closed, True) - self.assertRaises(ValueError, buf.getvalue) - finally: - os.linesep = save_linesep + def test_newlines_output(self): + testdict = { + "": b"AAA\nBBB\nCCC\nX\rY\r\nZ", + "\n": b"AAA\nBBB\nCCC\nX\rY\r\nZ", + "\r": b"AAA\rBBB\rCCC\rX\rY\r\rZ", + "\r\n": b"AAA\r\nBBB\r\nCCC\r\nX\rY\r\r\nZ", + } + tests = [(None, testdict[os.linesep])] + sorted(testdict.items()) + for newline, expected in tests: + buf = self.BytesIO() + txt = self.TextIOWrapper(buf, encoding="ascii", newline=newline) + txt.write("AAA\nB") + txt.write("BB\nCCC\n") + txt.write("X\rY\r\nZ") + txt.flush() + self.assertEquals(buf.closed, False) + self.assertEquals(buf.getvalue(), expected) + + def test_destructor(self): + l = [] + base = self.BytesIO + class MyBytesIO(base): + def close(self): + l.append(self.getvalue()) + base.close(self) + b = MyBytesIO() + t = self.TextIOWrapper(b, encoding="ascii") + t.write("abc") + del t + support.gc_collect() + self.assertEquals([b"abc"], l) + + def test_override_destructor(self): + record = [] + class MyTextIO(self.TextIOWrapper): + def __del__(self): + record.append(1) + try: + f = super(MyTextIO, self).__del__ + except AttributeError: + pass + else: + f() + def close(self): + record.append(2) + super(MyTextIO, self).close() + def flush(self): + record.append(3) + super(MyTextIO, self).flush() + b = self.BytesIO() + t = MyTextIO(b, encoding="ascii") + del t + support.gc_collect() + self.assertEqual(record, [1, 2, 3]) + + def test_error_through_destructor(self): + # Test that the exception state is not modified by a destructor, + # even if close() fails. + rawio = self.CloseFailureIO() + def f(): + self.TextIOWrapper(rawio).xyzzy + with support.captured_output("stderr") as s: + self.assertRaises(AttributeError, f) + s = s.getvalue().strip() + if s: + # The destructor *may* have printed an unraisable error, check it + self.assertEqual(len(s.splitlines()), 1) + self.assert_(s.startswith("Exception IOError: "), s) + self.assert_(s.endswith(" ignored"), s) # Systematic tests of the text I/O API - def testBasicIO(self): + def test_basic_io(self): for chunksize in (1, 2, 3, 4, 5, 15, 16, 17, 31, 32, 33, 63, 64, 65): for enc in "ascii", "latin1", "utf8" :# , "utf-16-be", "utf-16-le": - f = io.open(test_support.TESTFN, "w+", encoding=enc) + f = self.open(support.TESTFN, "w+", encoding=enc) f._CHUNK_SIZE = chunksize - self.assertEquals(f.write(u"abc"), 3) + self.assertEquals(f.write("abc"), 3) f.close() - f = io.open(test_support.TESTFN, "r+", encoding=enc) + f = self.open(support.TESTFN, "r+", encoding=enc) f._CHUNK_SIZE = chunksize self.assertEquals(f.tell(), 0) - self.assertEquals(f.read(), u"abc") + self.assertEquals(f.read(), "abc") cookie = f.tell() self.assertEquals(f.seek(0), 0) - self.assertEquals(f.read(2), u"ab") - self.assertEquals(f.read(1), u"c") - self.assertEquals(f.read(1), u"") - self.assertEquals(f.read(), u"") + self.assertEquals(f.read(2), "ab") + self.assertEquals(f.read(1), "c") + self.assertEquals(f.read(1), "") + self.assertEquals(f.read(), "") self.assertEquals(f.tell(), cookie) self.assertEquals(f.seek(0), 0) self.assertEquals(f.seek(0, 2), cookie) - self.assertEquals(f.write(u"def"), 3) + self.assertEquals(f.write("def"), 3) self.assertEquals(f.seek(cookie), cookie) - self.assertEquals(f.read(), u"def") + self.assertEquals(f.read(), "def") if enc.startswith("utf"): self.multi_line_test(f, enc) f.close() @@ -961,13 +1778,13 @@ def multi_line_test(self, f, enc): f.seek(0) f.truncate() - sample = u"s\xff\u0fff\uffff" + sample = "s\xff\u0fff\uffff" wlines = [] for size in (0, 1, 2, 3, 4, 5, 30, 31, 32, 33, 62, 63, 64, 65, 1000): chars = [] for i in range(size): chars.append(sample[i % len(sample)]) - line = u"".join(chars) + u"\n" + line = "".join(chars) + "\n" wlines.append((f.tell(), line)) f.write(line) f.seek(0) @@ -980,28 +1797,28 @@ rlines.append((pos, line)) self.assertEquals(rlines, wlines) - def testTelling(self): - f = io.open(test_support.TESTFN, "w+", encoding="utf8") + def test_telling(self): + f = self.open(support.TESTFN, "w+", encoding="utf8") p0 = f.tell() - f.write(u"\xff\n") + f.write("\xff\n") p1 = f.tell() - f.write(u"\xff\n") + f.write("\xff\n") p2 = f.tell() f.seek(0) self.assertEquals(f.tell(), p0) - self.assertEquals(f.readline(), u"\xff\n") + self.assertEquals(f.readline(), "\xff\n") self.assertEquals(f.tell(), p1) - self.assertEquals(f.readline(), u"\xff\n") + self.assertEquals(f.readline(), "\xff\n") self.assertEquals(f.tell(), p2) f.seek(0) for line in f: - self.assertEquals(line, u"\xff\n") + self.assertEquals(line, "\xff\n") self.assertRaises(IOError, f.tell) self.assertEquals(f.tell(), p2) f.close() - def testSeeking(self): - chunk_size = io.TextIOWrapper._CHUNK_SIZE + def test_seeking(self): + chunk_size = _default_chunk_size() prefix_size = chunk_size - 2 u_prefix = "a" * prefix_size prefix = bytes(u_prefix.encode("utf-8")) @@ -1009,43 +1826,46 @@ u_suffix = "\u8888\n" suffix = bytes(u_suffix.encode("utf-8")) line = prefix + suffix - f = io.open(test_support.TESTFN, "wb") + f = self.open(support.TESTFN, "wb") f.write(line*2) f.close() - f = io.open(test_support.TESTFN, "r", encoding="utf-8") + f = self.open(support.TESTFN, "r", encoding="utf-8") s = f.read(prefix_size) - self.assertEquals(s, unicode(prefix, "ascii")) + self.assertEquals(s, prefix.decode("ascii")) self.assertEquals(f.tell(), prefix_size) self.assertEquals(f.readline(), u_suffix) - def testSeekingToo(self): + def test_seeking_too(self): # Regression test for a specific bug data = b'\xe0\xbf\xbf\n' - f = io.open(test_support.TESTFN, "wb") + f = self.open(support.TESTFN, "wb") f.write(data) f.close() - f = io.open(test_support.TESTFN, "r", encoding="utf-8") + f = self.open(support.TESTFN, "r", encoding="utf-8") f._CHUNK_SIZE # Just test that it exists f._CHUNK_SIZE = 2 f.readline() f.tell() - def testSeekAndTell(self): - """Test seek/tell using the StatefulIncrementalDecoder.""" + def test_seek_and_tell(self): + #Test seek/tell using the StatefulIncrementalDecoder. + # Make test faster by doing smaller seeks + CHUNK_SIZE = 128 - def testSeekAndTellWithData(data, min_pos=0): + def test_seek_and_tell_with_data(data, min_pos=0): """Tell/seek to various points within a data stream and ensure that the decoded data returned by read() is consistent.""" - f = io.open(test_support.TESTFN, 'wb') + f = self.open(support.TESTFN, 'wb') f.write(data) f.close() - f = io.open(test_support.TESTFN, encoding='test_decoder') + f = self.open(support.TESTFN, encoding='test_decoder') + f._CHUNK_SIZE = CHUNK_SIZE decoded = f.read() f.close() for i in range(min_pos, len(decoded) + 1): # seek positions for j in [1, 5, len(decoded) - i]: # read lengths - f = io.open(test_support.TESTFN, encoding='test_decoder') + f = self.open(support.TESTFN, encoding='test_decoder') self.assertEquals(f.read(i), decoded[:i]) cookie = f.tell() self.assertEquals(f.read(j), decoded[i:i + j]) @@ -1060,23 +1880,22 @@ try: # Try each test case. for input, _, _ in StatefulIncrementalDecoderTest.test_cases: - testSeekAndTellWithData(input) + test_seek_and_tell_with_data(input) # Position each test case so that it crosses a chunk boundary. - CHUNK_SIZE = io.TextIOWrapper._CHUNK_SIZE for input, _, _ in StatefulIncrementalDecoderTest.test_cases: offset = CHUNK_SIZE - len(input)//2 prefix = b'.'*offset # Don't bother seeking into the prefix (takes too long). min_pos = offset*2 - testSeekAndTellWithData(prefix + input, min_pos) + test_seek_and_tell_with_data(prefix + input, min_pos) # Ensure our test decoder won't interfere with subsequent tests. finally: StatefulIncrementalDecoder.codecEnabled = 0 - def testEncodedWrites(self): - data = u"1234567890" + def test_encoded_writes(self): + data = "1234567890" tests = ("utf-16", "utf-16-le", "utf-16-be", @@ -1084,54 +1903,26 @@ "utf-32-le", "utf-32-be") for encoding in tests: - buf = io.BytesIO() - f = io.TextIOWrapper(buf, encoding=encoding) + buf = self.BytesIO() + f = self.TextIOWrapper(buf, encoding=encoding) # Check if the BOM is written only once (see issue1753). f.write(data) f.write(data) f.seek(0) self.assertEquals(f.read(), data * 2) + f.seek(0) + self.assertEquals(f.read(), data * 2) self.assertEquals(buf.getvalue(), (data * 2).encode(encoding)) - def timingTest(self): - timer = time.time - enc = "utf8" - line = "\0\x0f\xff\u0fff\uffff\U000fffff\U0010ffff"*3 + "\n" - nlines = 10000 - nchars = len(line) - nbytes = len(line.encode(enc)) - for chunk_size in (32, 64, 128, 256): - f = io.open(test_support.TESTFN, "w+", encoding=enc) - f._CHUNK_SIZE = chunk_size - t0 = timer() - for i in range(nlines): - f.write(line) - f.flush() - t1 = timer() - f.seek(0) - for line in f: - pass - t2 = timer() - f.seek(0) - while f.readline(): - pass - t3 = timer() - f.seek(0) - while f.readline(): - f.tell() - t4 = timer() - f.close() - if test_support.verbose: - print("\nTiming test: %d lines of %d characters (%d bytes)" % - (nlines, nchars, nbytes)) - print("File chunk size: %6s" % f._CHUNK_SIZE) - print("Writing: %6.3f seconds" % (t1-t0)) - print("Reading using iteration: %6.3f seconds" % (t2-t1)) - print("Reading using readline(): %6.3f seconds" % (t3-t2)) - print("Using readline()+tell(): %6.3f seconds" % (t4-t3)) + def test_unreadable(self): + class UnReadable(self.BytesIO): + def readable(self): + return False + txt = self.TextIOWrapper(UnReadable()) + self.assertRaises(IOError, txt.read) - def testReadOneByOne(self): - txt = io.TextIOWrapper(io.BytesIO(b"AA\r\nBB")) + def test_read_one_by_one(self): + txt = self.TextIOWrapper(self.BytesIO(b"AA\r\nBB")) reads = "" while True: c = txt.read(1) @@ -1141,9 +1932,9 @@ self.assertEquals(reads, "AA\nBB") # read in amounts equal to TextIOWrapper._CHUNK_SIZE which is 128. - def testReadByChunk(self): + def test_read_by_chunk(self): # make sure "\r\n" straddles 128 char boundary. - txt = io.TextIOWrapper(io.BytesIO(b"A" * 127 + b"\r\nB")) + txt = self.TextIOWrapper(self.BytesIO(b"A" * 127 + b"\r\nB")) reads = "" while True: c = txt.read(128) @@ -1153,7 +1944,7 @@ self.assertEquals(reads, "A"*127+"\nB") def test_issue1395_1(self): - txt = io.TextIOWrapper(io.BytesIO(self.testdata), encoding="ascii") + txt = self.TextIOWrapper(self.BytesIO(self.testdata), encoding="ascii") # read one char at a time reads = "" @@ -1165,7 +1956,7 @@ self.assertEquals(reads, self.normalized) def test_issue1395_2(self): - txt = io.TextIOWrapper(io.BytesIO(self.testdata), encoding="ascii") + txt = self.TextIOWrapper(self.BytesIO(self.testdata), encoding="ascii") txt._CHUNK_SIZE = 4 reads = "" @@ -1177,7 +1968,7 @@ self.assertEquals(reads, self.normalized) def test_issue1395_3(self): - txt = io.TextIOWrapper(io.BytesIO(self.testdata), encoding="ascii") + txt = self.TextIOWrapper(self.BytesIO(self.testdata), encoding="ascii") txt._CHUNK_SIZE = 4 reads = txt.read(4) @@ -1188,7 +1979,7 @@ self.assertEquals(reads, self.normalized) def test_issue1395_4(self): - txt = io.TextIOWrapper(io.BytesIO(self.testdata), encoding="ascii") + txt = self.TextIOWrapper(self.BytesIO(self.testdata), encoding="ascii") txt._CHUNK_SIZE = 4 reads = txt.read(4) @@ -1196,7 +1987,7 @@ self.assertEquals(reads, self.normalized) def test_issue1395_5(self): - txt = io.TextIOWrapper(io.BytesIO(self.testdata), encoding="ascii") + txt = self.TextIOWrapper(self.BytesIO(self.testdata), encoding="ascii") txt._CHUNK_SIZE = 4 reads = txt.read(4) @@ -1206,12 +1997,84 @@ self.assertEquals(txt.read(4), "BBB\n") def test_issue2282(self): - buffer = io.BytesIO(self.testdata) - txt = io.TextIOWrapper(buffer, encoding="ascii") + buffer = self.BytesIO(self.testdata) + txt = self.TextIOWrapper(buffer, encoding="ascii") self.assertEqual(buffer.seekable(), txt.seekable()) - def check_newline_decoder_utf8(self, decoder): + @unittest.skip("Issue #6213 with incremental encoders") + def test_append_bom(self): + # The BOM is not written again when appending to a non-empty file + filename = support.TESTFN + for charset in ('utf-8-sig', 'utf-16', 'utf-32'): + with self.open(filename, 'w', encoding=charset) as f: + f.write('aaa') + pos = f.tell() + with self.open(filename, 'rb') as f: + self.assertEquals(f.read(), 'aaa'.encode(charset)) + + with self.open(filename, 'a', encoding=charset) as f: + f.write('xxx') + with self.open(filename, 'rb') as f: + self.assertEquals(f.read(), 'aaaxxx'.encode(charset)) + + @unittest.skip("Issue #6213 with incremental encoders") + def test_seek_bom(self): + # Same test, but when seeking manually + filename = support.TESTFN + for charset in ('utf-8-sig', 'utf-16', 'utf-32'): + with self.open(filename, 'w', encoding=charset) as f: + f.write('aaa') + pos = f.tell() + with self.open(filename, 'r+', encoding=charset) as f: + f.seek(pos) + f.write('zzz') + f.seek(0) + f.write('bbb') + with self.open(filename, 'rb') as f: + self.assertEquals(f.read(), 'bbbzzz'.encode(charset)) + + def test_errors_property(self): + with self.open(support.TESTFN, "w") as f: + self.assertEqual(f.errors, "strict") + with self.open(support.TESTFN, "w", errors="replace") as f: + self.assertEqual(f.errors, "replace") + + +class CTextIOWrapperTest(TextIOWrapperTest): + + def test_initialization(self): + r = self.BytesIO(b"\xc3\xa9\n\n") + b = self.BufferedReader(r, 1000) + t = self.TextIOWrapper(b) + self.assertRaises(TypeError, t.__init__, b, newline=42) + self.assertRaises(ValueError, t.read) + self.assertRaises(ValueError, t.__init__, b, newline='xyzzy') + self.assertRaises(ValueError, t.read) + + def test_garbage_collection(self): + # C TextIOWrapper objects are collected, and collecting them flushes + # all data to disk. + # The Python version has __del__, so it ends in gc.garbage instead. + rawio = io.FileIO(support.TESTFN, "wb") + b = self.BufferedWriter(rawio) + t = self.TextIOWrapper(b, encoding="ascii") + t.write("456def") + t.x = t + wr = weakref.ref(t) + del t + support.gc_collect() + self.assert_(wr() is None, wr) + with self.open(support.TESTFN, "rb") as f: + self.assertEqual(f.read(), b"456def") + +class PyTextIOWrapperTest(TextIOWrapperTest): + pass + + +class IncrementalNewlineDecoderTest(unittest.TestCase): + + def check_newline_decoding_utf8(self, decoder): # UTF-8 specific tests for a newline decoder def _check_decode(b, s, **kwargs): # We exercise getstate() / setstate() as well as decode() @@ -1253,12 +2116,20 @@ _check_decode(b'\xe8\xa2\x88\r', "\u8888") _check_decode(b'\n', "\n") - def check_newline_decoder(self, decoder, encoding): + def check_newline_decoding(self, decoder, encoding): result = [] - encoder = codecs.getincrementalencoder(encoding)() - def _decode_bytewise(s): - for b in encoder.encode(s): - result.append(decoder.decode(b)) + if encoding is not None: + encoder = codecs.getincrementalencoder(encoding)() + def _decode_bytewise(s): + # Decode one byte at a time + for b in encoder.encode(s): + result.append(decoder.decode(b)) + else: + encoder = None + def _decode_bytewise(s): + # Decode one char at a time + for c in s: + result.append(decoder.decode(c)) self.assertEquals(decoder.newlines, None) _decode_bytewise("abc\n\r") self.assertEquals(decoder.newlines, '\n') @@ -1271,22 +2142,47 @@ _decode_bytewise("abc\r") self.assertEquals("".join(result), "abc\n\nabcabc\nabcabc") decoder.reset() - self.assertEquals(decoder.decode("abc".encode(encoding)), "abc") + input = "abc" + if encoder is not None: + encoder.reset() + input = encoder.encode(input) + self.assertEquals(decoder.decode(input), "abc") self.assertEquals(decoder.newlines, None) def test_newline_decoder(self): encodings = ( - 'utf-8', 'latin-1', + # None meaning the IncrementalNewlineDecoder takes unicode input + # rather than bytes input + None, 'utf-8', 'latin-1', 'utf-16', 'utf-16-le', 'utf-16-be', 'utf-32', 'utf-32-le', 'utf-32-be', ) for enc in encodings: - decoder = codecs.getincrementaldecoder(enc)() - decoder = io.IncrementalNewlineDecoder(decoder, translate=True) - self.check_newline_decoder(decoder, enc) + decoder = enc and codecs.getincrementaldecoder(enc)() + decoder = self.IncrementalNewlineDecoder(decoder, translate=True) + self.check_newline_decoding(decoder, enc) decoder = codecs.getincrementaldecoder("utf-8")() - decoder = io.IncrementalNewlineDecoder(decoder, translate=True) - self.check_newline_decoder_utf8(decoder) + decoder = self.IncrementalNewlineDecoder(decoder, translate=True) + self.check_newline_decoding_utf8(decoder) + + def test_newline_bytes(self): + # Issue 5433: Excessive optimization in IncrementalNewlineDecoder + def _check(dec): + self.assertEquals(dec.newlines, None) + self.assertEquals(dec.decode("\u0D00"), "\u0D00") + self.assertEquals(dec.newlines, None) + self.assertEquals(dec.decode("\u0A00"), "\u0A00") + self.assertEquals(dec.newlines, None) + dec = self.IncrementalNewlineDecoder(None, translate=False) + _check(dec) + dec = self.IncrementalNewlineDecoder(None, translate=True) + _check(dec) + +class CIncrementalNewlineDecoderTest(IncrementalNewlineDecoderTest): + pass + +class PyIncrementalNewlineDecoderTest(IncrementalNewlineDecoderTest): + pass # XXX Tests for open() @@ -1294,40 +2190,39 @@ class MiscIOTest(unittest.TestCase): def tearDown(self): - test_support.unlink(test_support.TESTFN) + support.unlink(support.TESTFN) - def testImport__all__(self): - for name in io.__all__: - obj = getattr(io, name, None) + def test___all__(self): + for name in self.io.__all__: + obj = getattr(self.io, name, None) self.assertTrue(obj is not None, name) if name == "open": continue - elif "error" in name.lower(): + elif "error" in name.lower() or name == "UnsupportedOperation": self.assertTrue(issubclass(obj, Exception), name) elif not name.startswith("SEEK_"): - self.assertTrue(issubclass(obj, io.IOBase)) - + self.assertTrue(issubclass(obj, self.IOBase)) def test_attributes(self): - f = io.open(test_support.TESTFN, "wb", buffering=0) + f = self.open(support.TESTFN, "wb", buffering=0) self.assertEquals(f.mode, "wb") f.close() - f = io.open(test_support.TESTFN, "U") - self.assertEquals(f.name, test_support.TESTFN) - self.assertEquals(f.buffer.name, test_support.TESTFN) - self.assertEquals(f.buffer.raw.name, test_support.TESTFN) + f = self.open(support.TESTFN, "U") + self.assertEquals(f.name, support.TESTFN) + self.assertEquals(f.buffer.name, support.TESTFN) + self.assertEquals(f.buffer.raw.name, support.TESTFN) self.assertEquals(f.mode, "U") self.assertEquals(f.buffer.mode, "rb") self.assertEquals(f.buffer.raw.mode, "rb") f.close() - f = io.open(test_support.TESTFN, "w+") + f = self.open(support.TESTFN, "w+") self.assertEquals(f.mode, "w+") self.assertEquals(f.buffer.mode, "rb+") # Does it really matter? self.assertEquals(f.buffer.raw.mode, "rb+") - g = io.open(f.fileno(), "wb", closefd=False) + g = self.open(f.fileno(), "wb", closefd=False) self.assertEquals(g.mode, "wb") self.assertEquals(g.raw.mode, "wb") self.assertEquals(g.name, f.fileno()) @@ -1335,13 +2230,138 @@ f.close() g.close() + def test_io_after_close(self): + for kwargs in [ + {"mode": "w"}, + {"mode": "wb"}, + {"mode": "w", "buffering": 1}, + {"mode": "w", "buffering": 2}, + {"mode": "wb", "buffering": 0}, + {"mode": "r"}, + {"mode": "rb"}, + {"mode": "r", "buffering": 1}, + {"mode": "r", "buffering": 2}, + {"mode": "rb", "buffering": 0}, + {"mode": "w+"}, + {"mode": "w+b"}, + {"mode": "w+", "buffering": 1}, + {"mode": "w+", "buffering": 2}, + {"mode": "w+b", "buffering": 0}, + ]: + f = self.open(support.TESTFN, **kwargs) + f.close() + self.assertRaises(ValueError, f.flush) + self.assertRaises(ValueError, f.fileno) + self.assertRaises(ValueError, f.isatty) + self.assertRaises(ValueError, f.__iter__) + if hasattr(f, "peek"): + self.assertRaises(ValueError, f.peek, 1) + self.assertRaises(ValueError, f.read) + if hasattr(f, "read1"): + self.assertRaises(ValueError, f.read1, 1024) + if hasattr(f, "readinto"): + self.assertRaises(ValueError, f.readinto, bytearray(1024)) + self.assertRaises(ValueError, f.readline) + self.assertRaises(ValueError, f.readlines) + self.assertRaises(ValueError, f.seek, 0) + self.assertRaises(ValueError, f.tell) + self.assertRaises(ValueError, f.truncate) + self.assertRaises(ValueError, f.write, + b"" if "b" in kwargs['mode'] else "") + self.assertRaises(ValueError, f.writelines, []) + self.assertRaises(ValueError, next, f) + + def test_blockingioerror(self): + # Various BlockingIOError issues + self.assertRaises(TypeError, self.BlockingIOError) + self.assertRaises(TypeError, self.BlockingIOError, 1) + self.assertRaises(TypeError, self.BlockingIOError, 1, 2, 3, 4) + self.assertRaises(TypeError, self.BlockingIOError, 1, "", None) + b = self.BlockingIOError(1, "") + self.assertEqual(b.characters_written, 0) + class C(unicode): + pass + c = C("") + b = self.BlockingIOError(1, c) + c.b = b + b.c = c + wr = weakref.ref(c) + del c, b + support.gc_collect() + self.assert_(wr() is None, wr) + + def test_abcs(self): + # Test the visible base classes are ABCs. + self.assertTrue(isinstance(self.IOBase, abc.ABCMeta)) + self.assertTrue(isinstance(self.RawIOBase, abc.ABCMeta)) + self.assertTrue(isinstance(self.BufferedIOBase, abc.ABCMeta)) + self.assertTrue(isinstance(self.TextIOBase, abc.ABCMeta)) + + def _check_abc_inheritance(self, abcmodule): + with self.open(support.TESTFN, "wb", buffering=0) as f: + self.assertTrue(isinstance(f, abcmodule.IOBase)) + self.assertTrue(isinstance(f, abcmodule.RawIOBase)) + self.assertFalse(isinstance(f, abcmodule.BufferedIOBase)) + self.assertFalse(isinstance(f, abcmodule.TextIOBase)) + with self.open(support.TESTFN, "wb") as f: + self.assertTrue(isinstance(f, abcmodule.IOBase)) + self.assertFalse(isinstance(f, abcmodule.RawIOBase)) + self.assertTrue(isinstance(f, abcmodule.BufferedIOBase)) + self.assertFalse(isinstance(f, abcmodule.TextIOBase)) + with self.open(support.TESTFN, "w") as f: + self.assertTrue(isinstance(f, abcmodule.IOBase)) + self.assertFalse(isinstance(f, abcmodule.RawIOBase)) + self.assertFalse(isinstance(f, abcmodule.BufferedIOBase)) + self.assertTrue(isinstance(f, abcmodule.TextIOBase)) + + def test_abc_inheritance(self): + # Test implementations inherit from their respective ABCs + self._check_abc_inheritance(self) + + def test_abc_inheritance_official(self): + # Test implementations inherit from the official ABCs of the + # baseline "io" module. + self._check_abc_inheritance(io) + +class CMiscIOTest(MiscIOTest): + io = io + +class PyMiscIOTest(MiscIOTest): + io = pyio def test_main(): - test_support.run_unittest(IOTest, BytesIOTest, StringIOTest, - BufferedReaderTest, BufferedWriterTest, - BufferedRWPairTest, BufferedRandomTest, - StatefulIncrementalDecoderTest, - TextIOWrapperTest, MiscIOTest) + tests = (CIOTest, PyIOTest, + CBufferedReaderTest, PyBufferedReaderTest, + CBufferedWriterTest, PyBufferedWriterTest, + CBufferedRWPairTest, PyBufferedRWPairTest, + CBufferedRandomTest, PyBufferedRandomTest, + StatefulIncrementalDecoderTest, + CIncrementalNewlineDecoderTest, PyIncrementalNewlineDecoderTest, + CTextIOWrapperTest, PyTextIOWrapperTest, + CMiscIOTest, PyMiscIOTest, + ) + + # Put the namespaces of the IO module we are testing and some useful mock + # classes in the __dict__ of each test. + mocks = (MockRawIO, MisbehavedRawIO, MockFileIO, CloseFailureIO, + MockNonBlockWriterIO) + all_members = io.__all__ + ["IncrementalNewlineDecoder"] + c_io_ns = dict((name, getattr(io, name)) for name in all_members) + py_io_ns = dict((name, getattr(pyio, name)) for name in all_members) + globs = globals() + c_io_ns.update((x.__name__, globs["C" + x.__name__]) for x in mocks) + py_io_ns.update((x.__name__, globs["Py" + x.__name__]) for x in mocks) + # Avoid turning open into a bound method. + py_io_ns["open"] = pyio.OpenWrapper + for test in tests: + if test.__name__.startswith("C"): + for name, obj in c_io_ns.items(): + setattr(test, name, obj) + elif test.__name__.startswith("Py"): + for name, obj in py_io_ns.items(): + setattr(test, name, obj) + + support.run_unittest(*tests) if __name__ == "__main__": - unittest.main() + test_main() Modified: python/branches/tk_and_idle_maintenance/Lib/test/test_largefile.py ============================================================================== --- python/branches/tk_and_idle_maintenance/Lib/test/test_largefile.py (original) +++ python/branches/tk_and_idle_maintenance/Lib/test/test_largefile.py Sat Jun 20 00:11:15 2009 @@ -1,12 +1,16 @@ """Test largefile support on system where this makes sense. """ +from __future__ import print_function + import os import stat import sys import unittest from test.test_support import run_unittest, TESTFN, verbose, requires, \ unlink +import io # C implementation of io +import _pyio as pyio # Python implementation of io try: import signal @@ -18,10 +22,10 @@ pass # create >2GB file (2GB = 2147483648 bytes) -size = 2500000000L +size = 2500000000 -class TestCase(unittest.TestCase): +class LargeFileTest(unittest.TestCase): """Test that each file function works as expected for a large (i.e. > 2GB, do we have to check > 4GB) files. @@ -33,28 +37,28 @@ def test_seek(self): if verbose: - print 'create large file via seek (may be sparse file) ...' - with open(TESTFN, 'wb') as f: - f.write('z') + print('create large file via seek (may be sparse file) ...') + with self.open(TESTFN, 'wb') as f: + f.write(b'z') f.seek(0) f.seek(size) - f.write('a') + f.write(b'a') f.flush() if verbose: - print 'check file size with os.fstat' + print('check file size with os.fstat') self.assertEqual(os.fstat(f.fileno())[stat.ST_SIZE], size+1) def test_osstat(self): if verbose: - print 'check file size with os.stat' + print('check file size with os.stat') self.assertEqual(os.stat(TESTFN)[stat.ST_SIZE], size+1) def test_seek_read(self): if verbose: - print 'play around with seek() and read() with the built largefile' - with open(TESTFN, 'rb') as f: + print('play around with seek() and read() with the built largefile') + with self.open(TESTFN, 'rb') as f: self.assertEqual(f.tell(), 0) - self.assertEqual(f.read(1), 'z') + self.assertEqual(f.read(1), b'z') self.assertEqual(f.tell(), 1) f.seek(0) self.assertEqual(f.tell(), 0) @@ -77,15 +81,15 @@ f.seek(size) self.assertEqual(f.tell(), size) # the 'a' that was written at the end of file above - self.assertEqual(f.read(1), 'a') + self.assertEqual(f.read(1), b'a') f.seek(-size-1, 1) - self.assertEqual(f.read(1), 'z') + self.assertEqual(f.read(1), b'z') self.assertEqual(f.tell(), 1) def test_lseek(self): if verbose: - print 'play around with os.lseek() with the built largefile' - with open(TESTFN, 'rb') as f: + print('play around with os.lseek() with the built largefile') + with self.open(TESTFN, 'rb') as f: self.assertEqual(os.lseek(f.fileno(), 0, 0), 0) self.assertEqual(os.lseek(f.fileno(), 42, 0), 42) self.assertEqual(os.lseek(f.fileno(), 42, 1), 84) @@ -95,16 +99,16 @@ self.assertEqual(os.lseek(f.fileno(), -size-1, 2), 0) self.assertEqual(os.lseek(f.fileno(), size, 0), size) # the 'a' that was written at the end of file above - self.assertEqual(f.read(1), 'a') + self.assertEqual(f.read(1), b'a') def test_truncate(self): if verbose: - print 'try truncate' - with open(TESTFN, 'r+b') as f: + print('try truncate') + with self.open(TESTFN, 'r+b') as f: # this is already decided before start running the test suite # but we do it anyway for extra protection if not hasattr(f, 'truncate'): - raise unittest.SkipTest, "open().truncate() not available on this system" + raise unittest.SkipTest("open().truncate() not available on this system") f.seek(0, 2) # else we've lost track of the true size self.assertEqual(f.tell(), size+1) @@ -120,17 +124,29 @@ newsize -= 1 f.seek(42) f.truncate(newsize) - self.assertEqual(f.tell(), 42) # else pointer moved + if self.new_io: + self.assertEqual(f.tell(), newsize) # else wasn't truncated f.seek(0, 2) - self.assertEqual(f.tell(), newsize) # else wasn't truncated - + self.assertEqual(f.tell(), newsize) # XXX truncate(larger than true size) is ill-defined # across platform; cut it waaaaay back f.seek(0) f.truncate(1) - self.assertEqual(f.tell(), 0) # else pointer moved + if self.new_io: + self.assertEqual(f.tell(), 1) # else pointer moved + f.seek(0) self.assertEqual(len(f.read()), 1) # else wasn't truncated + def test_seekable(self): + # Issue #5016; seekable() can return False when the current position + # is negative when truncated to an int. + if not self.new_io: + self.skipTest("builtin file doesn't have seekable()") + for pos in (2**31-1, 2**31, 2**31+1): + with self.open(TESTFN, 'rb') as f: + f.seek(pos) + self.assert_(f.seekable()) + def test_main(): # On Windows and Mac OSX this test comsumes large resources; It @@ -144,34 +160,41 @@ # Only run if the current filesystem supports large files. # (Skip this test on Windows, since we now always support # large files.) - f = open(TESTFN, 'wb') + f = open(TESTFN, 'wb', buffering=0) try: # 2**31 == 2147483648 - f.seek(2147483649L) + f.seek(2147483649) # Seeking is not enough of a test: you must write and # flush, too! - f.write("x") + f.write(b'x') f.flush() except (IOError, OverflowError): f.close() unlink(TESTFN) - raise unittest.SkipTest, "filesystem does not have largefile support" + raise unittest.SkipTest("filesystem does not have largefile support") else: f.close() suite = unittest.TestSuite() - suite.addTest(TestCase('test_seek')) - suite.addTest(TestCase('test_osstat')) - suite.addTest(TestCase('test_seek_read')) - suite.addTest(TestCase('test_lseek')) - with open(TESTFN, 'w') as f: - if hasattr(f, 'truncate'): - suite.addTest(TestCase('test_truncate')) - unlink(TESTFN) + for _open, prefix in [(io.open, 'C'), (pyio.open, 'Py'), + (open, 'Builtin')]: + class TestCase(LargeFileTest): + pass + TestCase.open = staticmethod(_open) + TestCase.new_io = _open is not open + TestCase.__name__ = prefix + LargeFileTest.__name__ + suite.addTest(TestCase('test_seek')) + suite.addTest(TestCase('test_osstat')) + suite.addTest(TestCase('test_seek_read')) + suite.addTest(TestCase('test_lseek')) + with _open(TESTFN, 'wb') as f: + if hasattr(f, 'truncate'): + suite.addTest(TestCase('test_truncate')) + suite.addTest(TestCase('test_seekable')) + unlink(TESTFN) try: run_unittest(suite) finally: unlink(TESTFN) - if __name__ == '__main__': test_main() Modified: python/branches/tk_and_idle_maintenance/Lib/test/test_memoryio.py ============================================================================== --- python/branches/tk_and_idle_maintenance/Lib/test/test_memoryio.py (original) +++ python/branches/tk_and_idle_maintenance/Lib/test/test_memoryio.py Sat Jun 20 00:11:15 2009 @@ -4,23 +4,66 @@ """ from __future__ import unicode_literals +from __future__ import print_function import unittest -from test import test_support +from test import test_support as support import io +import _pyio as pyio import sys -import array -try: - import _bytesio - has_c_implementation = True -except ImportError: - has_c_implementation = False +class MemorySeekTestMixin: + + def testInit(self): + buf = self.buftype("1234567890") + bytesIo = self.ioclass(buf) + + def testRead(self): + buf = self.buftype("1234567890") + bytesIo = self.ioclass(buf) + + self.assertEquals(buf[:1], bytesIo.read(1)) + self.assertEquals(buf[1:5], bytesIo.read(4)) + self.assertEquals(buf[5:], bytesIo.read(900)) + self.assertEquals(self.EOF, bytesIo.read()) + + def testReadNoArgs(self): + buf = self.buftype("1234567890") + bytesIo = self.ioclass(buf) + + self.assertEquals(buf, bytesIo.read()) + self.assertEquals(self.EOF, bytesIo.read()) + + def testSeek(self): + buf = self.buftype("1234567890") + bytesIo = self.ioclass(buf) + + bytesIo.read(5) + bytesIo.seek(0) + self.assertEquals(buf, bytesIo.read()) + + bytesIo.seek(3) + self.assertEquals(buf[3:], bytesIo.read()) + self.assertRaises(TypeError, bytesIo.seek, 0.0) + + def testTell(self): + buf = self.buftype("1234567890") + bytesIo = self.ioclass(buf) + + self.assertEquals(0, bytesIo.tell()) + bytesIo.seek(5) + self.assertEquals(5, bytesIo.tell()) + bytesIo.seek(10000) + self.assertEquals(10000, bytesIo.tell()) class MemoryTestMixin: + def test_detach(self): + buf = self.ioclass() + self.assertRaises(self.UnsupportedOperation, buf.detach) + def write_ops(self, f, t): self.assertEqual(f.write(t("blah.")), 5) self.assertEqual(f.seek(0), 0) @@ -151,7 +194,7 @@ self.assertEqual(memio.readline(), self.EOF) memio.seek(0) self.assertEqual(type(memio.readline()), type(buf)) - self.assertEqual(memio.readline(None), buf) + self.assertEqual(memio.readline(), buf) self.assertRaises(TypeError, memio.readline, '') memio.close() self.assertRaises(ValueError, memio.readline) @@ -197,7 +240,7 @@ self.assertEqual(i, 10) memio = self.ioclass(buf * 2) memio.close() - self.assertRaises(ValueError, memio.next) + self.assertRaises(ValueError, next, memio) def test_getvalue(self): buf = self.buftype("1234567890") @@ -299,11 +342,14 @@ self.assertEqual(test2(), buf) -class PyBytesIOTest(MemoryTestMixin, unittest.TestCase): +class PyBytesIOTest(MemoryTestMixin, MemorySeekTestMixin, unittest.TestCase): + + UnsupportedOperation = pyio.UnsupportedOperation + @staticmethod def buftype(s): return s.encode("ascii") - ioclass = io._BytesIO + ioclass = pyio.BytesIO EOF = b"" def test_read1(self): @@ -333,7 +379,8 @@ self.assertEqual(memio.readinto(b), 0) self.assertEqual(b, b"") self.assertRaises(TypeError, memio.readinto, '') - a = array.array(b'b', map(ord, b"hello world")) + import array + a = array.array(b'b', b"hello world") memio = self.ioclass(buf) memio.readinto(a) self.assertEqual(a.tostring(), b"1234567890d") @@ -365,19 +412,41 @@ def test_bytes_array(self): buf = b"1234567890" - - a = array.array(b'b', map(ord, buf)) + import array + a = array.array(b'b', buf) memio = self.ioclass(a) self.assertEqual(memio.getvalue(), buf) self.assertEqual(memio.write(a), 10) self.assertEqual(memio.getvalue(), buf) -class PyStringIOTest(MemoryTestMixin, unittest.TestCase): +class PyStringIOTest(MemoryTestMixin, MemorySeekTestMixin, unittest.TestCase): buftype = unicode - ioclass = io.StringIO + ioclass = pyio.StringIO + UnsupportedOperation = pyio.UnsupportedOperation EOF = "" + # TextIO-specific behaviour. + + def test_newlines_property(self): + memio = self.ioclass(newline=None) + # The C StringIO decodes newlines in write() calls, but the Python + # implementation only does when reading. This function forces them to + # be decoded for testing. + def force_decode(): + memio.seek(0) + memio.read() + self.assertEqual(memio.newlines, None) + memio.write("a\n") + force_decode() + self.assertEqual(memio.newlines, "\n") + memio.write("b\r\n") + force_decode() + self.assertEqual(memio.newlines, ("\n", "\r\n")) + memio.write("c\rd") + force_decode() + self.assertEqual(memio.newlines, ("\r", "\n", "\r\n")) + def test_relative_seek(self): memio = self.ioclass() @@ -388,29 +457,107 @@ self.assertRaises(IOError, memio.seek, 1, 1) self.assertRaises(IOError, memio.seek, 1, 2) + def test_textio_properties(self): + memio = self.ioclass() + + # These are just dummy values but we nevertheless check them for fear + # of unexpected breakage. + self.assertIsNone(memio.encoding) + self.assertIsNone(memio.errors) + self.assertFalse(memio.line_buffering) + + def test_newline_none(self): + # newline=None + memio = self.ioclass("a\nb\r\nc\rd", newline=None) + self.assertEqual(list(memio), ["a\n", "b\n", "c\n", "d"]) + memio.seek(0) + self.assertEqual(memio.read(1), "a") + self.assertEqual(memio.read(2), "\nb") + self.assertEqual(memio.read(2), "\nc") + self.assertEqual(memio.read(1), "\n") + memio = self.ioclass(newline=None) + self.assertEqual(2, memio.write("a\n")) + self.assertEqual(3, memio.write("b\r\n")) + self.assertEqual(3, memio.write("c\rd")) + memio.seek(0) + self.assertEqual(memio.read(), "a\nb\nc\nd") + memio = self.ioclass("a\r\nb", newline=None) + self.assertEqual(memio.read(3), "a\nb") + + def test_newline_empty(self): + # newline="" + memio = self.ioclass("a\nb\r\nc\rd", newline="") + self.assertEqual(list(memio), ["a\n", "b\r\n", "c\r", "d"]) + memio.seek(0) + self.assertEqual(memio.read(4), "a\nb\r") + self.assertEqual(memio.read(2), "\nc") + self.assertEqual(memio.read(1), "\r") + memio = self.ioclass(newline="") + self.assertEqual(2, memio.write("a\n")) + self.assertEqual(2, memio.write("b\r")) + self.assertEqual(2, memio.write("\nc")) + self.assertEqual(2, memio.write("\rd")) + memio.seek(0) + self.assertEqual(list(memio), ["a\n", "b\r\n", "c\r", "d"]) + + def test_newline_lf(self): + # newline="\n" + memio = self.ioclass("a\nb\r\nc\rd") + self.assertEqual(list(memio), ["a\n", "b\r\n", "c\rd"]) + + def test_newline_cr(self): + # newline="\r" + memio = self.ioclass("a\nb\r\nc\rd", newline="\r") + memio.seek(0) + self.assertEqual(memio.read(), "a\rb\r\rc\rd") + memio.seek(0) + self.assertEqual(list(memio), ["a\r", "b\r", "\r", "c\r", "d"]) + + def test_newline_crlf(self): + # newline="\r\n" + memio = self.ioclass("a\nb\r\nc\rd", newline="\r\n") + memio.seek(0) + self.assertEqual(memio.read(), "a\r\nb\r\r\nc\rd") + memio.seek(0) + self.assertEqual(list(memio), ["a\r\n", "b\r\r\n", "c\rd"]) + + def test_issue5265(self): + # StringIO can duplicate newlines in universal newlines mode + memio = self.ioclass("a\r\nb\r\n", newline=None) + self.assertEqual(memio.read(5), "a\nb\n") + + +class CBytesIOTest(PyBytesIOTest): + ioclass = io.BytesIO + UnsupportedOperation = io.UnsupportedOperation + + test_bytes_array = unittest.skip( + "array.array() does not have the new buffer API" + )(PyBytesIOTest.test_bytes_array) + + +class CStringIOTest(PyStringIOTest): + ioclass = io.StringIO + UnsupportedOperation = io.UnsupportedOperation + # XXX: For the Python version of io.StringIO, this is highly # dependent on the encoding used for the underlying buffer. - # def test_widechar(self): - # buf = self.buftype("\U0002030a\U00020347") - # memio = self.ioclass(buf) - # - # self.assertEqual(memio.getvalue(), buf) - # self.assertEqual(memio.write(buf), len(buf)) - # self.assertEqual(memio.tell(), len(buf)) - # self.assertEqual(memio.getvalue(), buf) - # self.assertEqual(memio.write(buf), len(buf)) - # self.assertEqual(memio.tell(), len(buf) * 2) - # self.assertEqual(memio.getvalue(), buf + buf) - -if has_c_implementation: - class CBytesIOTest(PyBytesIOTest): - ioclass = io.BytesIO + def test_widechar(self): + buf = self.buftype("\U0002030a\U00020347") + memio = self.ioclass(buf) + + self.assertEqual(memio.getvalue(), buf) + self.assertEqual(memio.write(buf), len(buf)) + self.assertEqual(memio.tell(), len(buf)) + self.assertEqual(memio.getvalue(), buf) + self.assertEqual(memio.write(buf), len(buf)) + self.assertEqual(memio.tell(), len(buf) * 2) + self.assertEqual(memio.getvalue(), buf + buf) + def test_main(): - tests = [PyBytesIOTest, PyStringIOTest] - if has_c_implementation: - tests.extend([CBytesIOTest]) - test_support.run_unittest(*tests) + tests = [PyBytesIOTest, PyStringIOTest, CBytesIOTest, CStringIOTest] + support.run_unittest(*tests) if __name__ == '__main__': test_main() Modified: python/branches/tk_and_idle_maintenance/Lib/test/test_signal.py ============================================================================== --- python/branches/tk_and_idle_maintenance/Lib/test/test_signal.py (original) +++ python/branches/tk_and_idle_maintenance/Lib/test/test_signal.py Sat Jun 20 00:11:15 2009 @@ -1,6 +1,6 @@ import unittest from test import test_support -from contextlib import closing, nested +from contextlib import closing import gc import pickle import select @@ -146,8 +146,8 @@ # re-raises information about any exceptions the child # throws. The real work happens in self.run_test(). os_done_r, os_done_w = os.pipe() - with nested(closing(os.fdopen(os_done_r)), - closing(os.fdopen(os_done_w, 'w'))) as (done_r, done_w): + with closing(os.fdopen(os_done_r)) as done_r, \ + closing(os.fdopen(os_done_w, 'w')) as done_w: child = os.fork() if child == 0: # In the child process; run the test and report results Modified: python/branches/tk_and_idle_maintenance/Lib/test/test_support.py ============================================================================== --- python/branches/tk_and_idle_maintenance/Lib/test/test_support.py (original) +++ python/branches/tk_and_idle_maintenance/Lib/test/test_support.py Sat Jun 20 00:11:15 2009 @@ -29,7 +29,7 @@ "run_with_locale", "set_memlimit", "bigmemtest", "bigaddrspacetest", "BasicTestRunner", "run_unittest", "run_doctest", "threading_setup", "threading_cleanup", "reap_children", "cpython_only", - "check_impl_detail", "get_attribute"] + "check_impl_detail", "get_attribute", "py3k_bytes"] class Error(Exception): """Base class for regression test exceptions.""" @@ -968,3 +968,18 @@ break except: break + +def py3k_bytes(b): + """Emulate the py3k bytes() constructor. + + NOTE: This is only a best effort function. + """ + try: + # memoryview? + return b.tobytes() + except AttributeError: + try: + # iterable of ints? + return b"".join(chr(x) for x in b) + except TypeError: + return bytes(b) Modified: python/branches/tk_and_idle_maintenance/Lib/test/test_syntax.py ============================================================================== --- python/branches/tk_and_idle_maintenance/Lib/test/test_syntax.py (original) +++ python/branches/tk_and_idle_maintenance/Lib/test/test_syntax.py Sat Jun 20 00:11:15 2009 @@ -248,12 +248,12 @@ SyntaxError: keyword can't be an expression -From ast_for_expr_stmt(): +More set_context(): >>> (x for x in x) += 1 Traceback (most recent call last): File "", line 1 -SyntaxError: augmented assignment to generator expression not possible +SyntaxError: can't assign to generator expression >>> None += 1 Traceback (most recent call last): File "", line 1 @@ -261,7 +261,7 @@ >>> f() += 1 Traceback (most recent call last): File "", line 1 -SyntaxError: illegal expression for augmented assignment +SyntaxError: can't assign to function call Test continue in finally in weird combinations. @@ -462,6 +462,12 @@ File "", line 1 SyntaxError: keyword argument repeated +>>> del () +Traceback (most recent call last): + ... + File "", line 1 +SyntaxError: can't delete () + """ import re Modified: python/branches/tk_and_idle_maintenance/Lib/test/test_univnewlines.py ============================================================================== --- python/branches/tk_and_idle_maintenance/Lib/test/test_univnewlines.py (original) +++ python/branches/tk_and_idle_maintenance/Lib/test/test_univnewlines.py Sat Jun 20 00:11:15 2009 @@ -1,20 +1,28 @@ # Tests universal newline support for both reading and parsing files. + +# NOTE: this file tests the new `io` library backported from Python 3.x. +# Similar tests for the builtin file object can be found in test_univnewlines2k.py. + +from __future__ import print_function +from __future__ import unicode_literals + +import io +import _pyio as pyio import unittest import os import sys -from test import test_support +from test import test_support as support if not hasattr(sys.stdin, 'newlines'): - raise unittest.SkipTest, \ - "This Python does not have universal newline support" + raise unittest.SkipTest( + "This Python does not have universal newline support") FATX = 'x' * (2**14) DATA_TEMPLATE = [ "line1=1", - "line2='this is a very long line designed to go past the magic " + - "hundred character limit that is inside fileobject.c and which " + - "is meant to speed up the common case, but we also want to test " + + "line2='this is a very long line designed to go past any default " + + "buffer limits that exist in io.py but we also want to test " + "the uncommon case, naturally.'", "def line3():pass", "line4 = '%s'" % FATX, @@ -28,48 +36,50 @@ # before end-of-file. DATA_MIXED = "\n".join(DATA_TEMPLATE) + "\r" DATA_SPLIT = [x + "\n" for x in DATA_TEMPLATE] -del x class TestGenericUnivNewlines(unittest.TestCase): # use a class variable DATA to define the data to write to the file # and a class variable NEWLINE to set the expected newlines value - READMODE = 'U' + READMODE = 'r' WRITEMODE = 'wb' def setUp(self): - with open(test_support.TESTFN, self.WRITEMODE) as fp: - fp.write(self.DATA) + data = self.DATA + if "b" in self.WRITEMODE: + data = data.encode("ascii") + with self.open(support.TESTFN, self.WRITEMODE) as fp: + fp.write(data) def tearDown(self): try: - os.unlink(test_support.TESTFN) + os.unlink(support.TESTFN) except: pass def test_read(self): - with open(test_support.TESTFN, self.READMODE) as fp: + with self.open(support.TESTFN, self.READMODE) as fp: data = fp.read() self.assertEqual(data, DATA_LF) - self.assertEqual(repr(fp.newlines), repr(self.NEWLINE)) + self.assertEqual(set(fp.newlines), set(self.NEWLINE)) def test_readlines(self): - with open(test_support.TESTFN, self.READMODE) as fp: + with self.open(support.TESTFN, self.READMODE) as fp: data = fp.readlines() self.assertEqual(data, DATA_SPLIT) - self.assertEqual(repr(fp.newlines), repr(self.NEWLINE)) + self.assertEqual(set(fp.newlines), set(self.NEWLINE)) def test_readline(self): - with open(test_support.TESTFN, self.READMODE) as fp: + with self.open(support.TESTFN, self.READMODE) as fp: data = [] d = fp.readline() while d: data.append(d) d = fp.readline() self.assertEqual(data, DATA_SPLIT) - self.assertEqual(repr(fp.newlines), repr(self.NEWLINE)) + self.assertEqual(set(fp.newlines), set(self.NEWLINE)) def test_seek(self): - with open(test_support.TESTFN, self.READMODE) as fp: + with self.open(support.TESTFN, self.READMODE) as fp: fp.readline() pos = fp.tell() data = fp.readlines() @@ -78,19 +88,6 @@ data = fp.readlines() self.assertEqual(data, DATA_SPLIT[1:]) - def test_execfile(self): - namespace = {} - execfile(test_support.TESTFN, namespace) - func = namespace['line3'] - self.assertEqual(func.func_code.co_firstlineno, 3) - self.assertEqual(namespace['line4'], FATX) - - -class TestNativeNewlines(TestGenericUnivNewlines): - NEWLINE = None - DATA = DATA_LF - READMODE = 'r' - WRITEMODE = 'w' class TestCRNewlines(TestGenericUnivNewlines): NEWLINE = '\r' @@ -105,7 +102,7 @@ DATA = DATA_CRLF def test_tell(self): - with open(test_support.TESTFN, self.READMODE) as fp: + with self.open(support.TESTFN, self.READMODE) as fp: self.assertEqual(repr(fp.newlines), repr(None)) data = fp.readline() pos = fp.tell() @@ -117,13 +114,22 @@ def test_main(): - test_support.run_unittest( - TestNativeNewlines, - TestCRNewlines, - TestLFNewlines, - TestCRLFNewlines, - TestMixedNewlines - ) + base_tests = (TestCRNewlines, + TestLFNewlines, + TestCRLFNewlines, + TestMixedNewlines) + tests = [] + # Test the C and Python implementations. + for test in base_tests: + class CTest(test): + open = io.open + CTest.__name__ = str("C" + test.__name__) + class PyTest(test): + open = staticmethod(pyio.open) + PyTest.__name__ = str("Py" + test.__name__) + tests.append(CTest) + tests.append(PyTest) + support.run_unittest(*tests) if __name__ == '__main__': test_main() Modified: python/branches/tk_and_idle_maintenance/Lib/test/test_winreg.py ============================================================================== --- python/branches/tk_and_idle_maintenance/Lib/test/test_winreg.py (original) +++ python/branches/tk_and_idle_maintenance/Lib/test/test_winreg.py Sat Jun 20 00:11:15 2009 @@ -35,6 +35,27 @@ class WinregTests(unittest.TestCase): remote_name = None + def setUp(self): + # Make sure that the test key is absent when the test + # starts. + self.delete_tree(HKEY_CURRENT_USER, test_key_name) + + def delete_tree(self, root, subkey): + try: + hkey = OpenKey(root, subkey, KEY_ALL_ACCESS) + except WindowsError: + # subkey does not exist + return + while True: + try: + subsubkey = EnumKey(hkey, 0) + except WindowsError: + # no more subkeys + break + self.delete_tree(hkey, subsubkey) + CloseKey(hkey) + DeleteKey(root, subkey) + def WriteTestData(self, root_key): # Set the default value for this key. SetValue(root_key, test_key_name, REG_SZ, "Default value") Modified: python/branches/tk_and_idle_maintenance/Makefile.pre.in ============================================================================== --- python/branches/tk_and_idle_maintenance/Makefile.pre.in (original) +++ python/branches/tk_and_idle_maintenance/Makefile.pre.in Sat Jun 20 00:11:15 2009 @@ -541,7 +541,7 @@ $(AST_C): $(AST_ASDL) $(ASDLGEN_FILES) $(ASDLGEN) -c $(AST_C_DIR) $(AST_ASDL) -Python/compile.o Python/symtable.o: $(GRAMMAR_H) $(AST_H) +Python/compile.o Python/symtable.o Python/ast.o: $(GRAMMAR_H) $(AST_H) Python/getplatform.o: $(srcdir)/Python/getplatform.c $(CC) -c $(PY_CFLAGS) -DPLATFORM='"$(MACHDEP)"' -o $@ $(srcdir)/Python/getplatform.c @@ -1068,6 +1068,7 @@ # install (which includes python-config) happy. frameworkinstallmaclib: ln -fs "../../../$(PYTHONFRAMEWORK)" "$(DESTDIR)$(prefix)/lib/python$(VERSION)/config/libpython$(VERSION).a" + ln -fs "../$(PYTHONFRAMEWORK)" "$(DESTDIR)$(prefix)/lib/libpython$(VERSION).dylib" cd Mac && $(MAKE) installmacsubtree DESTDIR="$(DESTDIR)" # This installs the IDE, the Launcher and other apps into /Applications Modified: python/branches/tk_and_idle_maintenance/Misc/NEWS ============================================================================== --- python/branches/tk_and_idle_maintenance/Misc/NEWS (original) +++ python/branches/tk_and_idle_maintenance/Misc/NEWS Sat Jun 20 00:11:15 2009 @@ -12,6 +12,16 @@ Core and Builtins ----------------- +- Issue #6289: Encoding errors from compile() were being masked. + +- When no module is given in a relative import, the module field of the + ImportFrom AST node is now None instead of an empty string. + +- Assignment to None using import statements now raises a SyntaxError. + +- In the slice AST type, the step field will always be None if a step expression + is not specified. + - Issue #4547: When debugging a very large function, it was not always possible to update the lineno attribute of the current frame. @@ -317,6 +327,33 @@ Library ------- +- Issue #6274: Fixed possible file descriptors leak in subprocess.py + +- Issue #6189: Restored compatibility of subprocess.py with Python 2.2. + +- Issue #6287: Added the license field in Distutils documentation. + +- Issue #6286: Now Distutils upload command is based on urllib2 instead of + httplib, allowing the usage of http_proxy. + +- Issue #6271: mmap tried to close invalid file handle (-1) when annonymous. + (On Unix) + +- Issue #6215: All bug fixes and enhancements from the Python 3.1 io library + (including the fast C implementation) have been backported to the standard + ``io`` module. + +- Issue #6258: Support AMD64 in bdist_msi. + +- Issue #5262: Fixed bug in next rollover time computation in + TimedRotatingFileHandler. + +- Issue #6263: Fixed syntax error in distutils.cygwincompiler. + +- Issue #5201: distutils.sysconfig.parse_makefile() now understands `$$` + in Makefiles. This prevents compile errors when using syntax like: + `LDFLAGS='-rpath=\$$LIB:/some/other/path'`. Patch by Floris Bruynooghe. + - Issue #5767: Removed sgmlop support from xmlrpclib. - Issue #6131: test_modulefinder leaked when run after test_distutils. @@ -345,7 +382,7 @@ - Issue #1424152: Fix for httplib, urllib2 to support SSL while working through proxy. Original patch by Christopher Li, changes made by Senthil Kumaran. - + - Issue #1983: Fix functions taking or returning a process identifier to use the dedicated C type ``pid_t`` instead of a C ``int``. Some platforms have a process identifier type wider than the standard C integer type. @@ -353,7 +390,7 @@ - Issue #4066: smtplib.SMTP_SSL._get_socket now correctly returns the socket. Patch by Farhan Ahmad, test by Marcin Bachry. -- Issue #6062: In distutils, fixed the package option of build_ext. Feedback +- Issue #6062: In distutils, fixed the package option of build_ext. Feedback and tests on pywin32 by Tim Golden. - Issue #6053: Fixed distutils tests on win32. patch by Hirokazu Yamamoto. @@ -361,7 +398,7 @@ - Issue #6046: Fixed the library extension when distutils build_ext is used inplace. Initial patch by Roumen Petrov. -- Issue #6041: Now distutils `sdist` and `register` commands use `check` as a +- Issue #6041: Now distutils `sdist` and `register` commands use `check` as a subcommand. - Issue #2116: Weak references and weak dictionaries now support copy()ing and @@ -511,8 +548,8 @@ - unittest.assertNotEqual() now uses the inequality operator (!=) instead of the equality operator. - -- Issue #6001: Test discovery for unittest. Implemented in + +- Issue #6001: Test discovery for unittest. Implemented in unittest.TestLoader.discover and from the command line. - Issue #5679: The methods unittest.TestCase.addCleanup and doCleanups were added. @@ -522,11 +559,11 @@ - Issue #3379: unittest.main now takes an optional exit argument. If False main doesn't call sys.exit allowing it to be used from the interactive interpreter. - -- Issue #5995: unittest.main now takes an optional verbosity argument allowing + +- Issue #5995: unittest.main now takes an optional verbosity argument allowing test modules to be run with a higher than default verbosity. - -- Issue #5995: A fix to allow you to run "python -m unittest test_module" or + +- Issue #5995: A fix to allow you to run "python -m unittest test_module" or "python -m unittest test_module.TestClass" from the command line. - Issue #5728: unittest.TestResult has new startTestRun and stopTestRun methods; @@ -1005,6 +1042,9 @@ Build ----- +- Issue 5809: Specifying both --enable-framework and --enable-shared is + an error. Configure now explicity tells you about this. + - Issue #3585: Add pkg-config support. It creates a python-2.7.pc file and a python.pc symlink in the $(LIBDIR)/pkgconfig directory. Patch by Clinton Roy. Deleted: python/branches/tk_and_idle_maintenance/Modules/_bytesio.c ============================================================================== --- python/branches/tk_and_idle_maintenance/Modules/_bytesio.c Sat Jun 20 00:11:15 2009 +++ (empty file) @@ -1,763 +0,0 @@ -#include "Python.h" - -typedef struct { - PyObject_HEAD - char *buf; - Py_ssize_t pos; - Py_ssize_t string_size; - size_t buf_size; -} BytesIOObject; - -#define CHECK_CLOSED(self) \ - if ((self)->buf == NULL) { \ - PyErr_SetString(PyExc_ValueError, \ - "I/O operation on closed file."); \ - return NULL; \ - } - -/* Internal routine to get a line from the buffer of a BytesIO - object. Returns the length between the current position to the - next newline character. */ -static Py_ssize_t -get_line(BytesIOObject *self, char **output) -{ - char *n; - const char *str_end; - Py_ssize_t len; - - assert(self->buf != NULL); - - /* Move to the end of the line, up to the end of the string, s. */ - str_end = self->buf + self->string_size; - for (n = self->buf + self->pos; - n < str_end && *n != '\n'; - n++); - - /* Skip the newline character */ - if (n < str_end) - n++; - - /* Get the length from the current position to the end of the line. */ - len = n - (self->buf + self->pos); - *output = self->buf + self->pos; - - assert(len >= 0); - assert(self->pos < PY_SSIZE_T_MAX - len); - self->pos += len; - - return len; -} - -/* Internal routine for changing the size of the buffer of BytesIO objects. - The caller should ensure that the 'size' argument is non-negative. Returns - 0 on success, -1 otherwise. */ -static int -resize_buffer(BytesIOObject *self, size_t size) -{ - /* Here, unsigned types are used to avoid dealing with signed integer - overflow, which is undefined in C. */ - size_t alloc = self->buf_size; - char *new_buf = NULL; - - assert(self->buf != NULL); - - /* For simplicity, stay in the range of the signed type. Anyway, Python - doesn't allow strings to be longer than this. */ - if (size > PY_SSIZE_T_MAX) - goto overflow; - - if (size < alloc / 2) { - /* Major downsize; resize down to exact size. */ - alloc = size + 1; - } - else if (size < alloc) { - /* Within allocated size; quick exit */ - return 0; - } - else if (size <= alloc * 1.125) { - /* Moderate upsize; overallocate similar to list_resize() */ - alloc = size + (size >> 3) + (size < 9 ? 3 : 6); - } - else { - /* Major upsize; resize up to exact size */ - alloc = size + 1; - } - - if (alloc > ((size_t)-1) / sizeof(char)) - goto overflow; - new_buf = (char *)PyMem_Realloc(self->buf, alloc * sizeof(char)); - if (new_buf == NULL) { - PyErr_NoMemory(); - return -1; - } - self->buf_size = alloc; - self->buf = new_buf; - - return 0; - - overflow: - PyErr_SetString(PyExc_OverflowError, - "new buffer size too large"); - return -1; -} - -/* Internal routine for writing a string of bytes to the buffer of a BytesIO - object. Returns the number of bytes wrote, or -1 on error. */ -static Py_ssize_t -write_bytes(BytesIOObject *self, const char *bytes, Py_ssize_t len) -{ - assert(self->buf != NULL); - assert(self->pos >= 0); - assert(len >= 0); - - if ((size_t)self->pos + len > self->buf_size) { - if (resize_buffer(self, (size_t)self->pos + len) < 0) - return -1; - } - - if (self->pos > self->string_size) { - /* In case of overseek, pad with null bytes the buffer region between - the end of stream and the current position. - - 0 lo string_size hi - | |<---used--->|<----------available----------->| - | | <--to pad-->|<---to write---> | - 0 buf position - */ - memset(self->buf + self->string_size, '\0', - (self->pos - self->string_size) * sizeof(char)); - } - - /* Copy the data to the internal buffer, overwriting some of the existing - data if self->pos < self->string_size. */ - memcpy(self->buf + self->pos, bytes, len); - self->pos += len; - - /* Set the new length of the internal string if it has changed. */ - if (self->string_size < self->pos) { - self->string_size = self->pos; - } - - return len; -} - -static PyObject * -bytesio_get_closed(BytesIOObject *self) -{ - if (self->buf == NULL) - Py_RETURN_TRUE; - else - Py_RETURN_FALSE; -} - -/* Generic getter for the writable, readable and seekable properties */ -static PyObject * -return_true(BytesIOObject *self) -{ - Py_RETURN_TRUE; -} - -PyDoc_STRVAR(flush_doc, -"flush() -> None. Does nothing."); - -static PyObject * -bytesio_flush(BytesIOObject *self) -{ - Py_RETURN_NONE; -} - -PyDoc_STRVAR(getval_doc, -"getvalue() -> bytes.\n" -"\n" -"Retrieve the entire contents of the BytesIO object."); - -static PyObject * -bytesio_getvalue(BytesIOObject *self) -{ - CHECK_CLOSED(self); - return PyString_FromStringAndSize(self->buf, self->string_size); -} - -PyDoc_STRVAR(isatty_doc, -"isatty() -> False.\n" -"\n" -"Always returns False since BytesIO objects are not connected\n" -"to a tty-like device."); - -static PyObject * -bytesio_isatty(BytesIOObject *self) -{ - CHECK_CLOSED(self); - Py_RETURN_FALSE; -} - -PyDoc_STRVAR(tell_doc, -"tell() -> current file position, an integer\n"); - -static PyObject * -bytesio_tell(BytesIOObject *self) -{ - CHECK_CLOSED(self); - return PyInt_FromSsize_t(self->pos); -} - -PyDoc_STRVAR(read_doc, -"read([size]) -> read at most size bytes, returned as a string.\n" -"\n" -"If the size argument is negative, read until EOF is reached.\n" -"Return an empty string at EOF."); - -static PyObject * -bytesio_read(BytesIOObject *self, PyObject *args) -{ - Py_ssize_t size, n; - char *output; - PyObject *arg = Py_None; - - CHECK_CLOSED(self); - - if (!PyArg_ParseTuple(args, "|O:read", &arg)) - return NULL; - - if (PyInt_Check(arg)) { - size = PyInt_AsSsize_t(arg); - if (size == -1 && PyErr_Occurred()) - return NULL; - } - else if (arg == Py_None) { - /* Read until EOF is reached, by default. */ - size = -1; - } - else { - PyErr_Format(PyExc_TypeError, "integer argument expected, got '%s'", - Py_TYPE(arg)->tp_name); - return NULL; - } - - /* adjust invalid sizes */ - n = self->string_size - self->pos; - if (size < 0 || size > n) { - size = n; - if (size < 0) - size = 0; - } - - assert(self->buf != NULL); - output = self->buf + self->pos; - self->pos += size; - - return PyString_FromStringAndSize(output, size); -} - - -PyDoc_STRVAR(read1_doc, -"read1(size) -> read at most size bytes, returned as a string.\n" -"\n" -"If the size argument is negative or omitted, read until EOF is reached.\n" -"Return an empty string at EOF."); - -static PyObject * -bytesio_read1(BytesIOObject *self, PyObject *n) -{ - PyObject *arg, *res; - - arg = PyTuple_Pack(1, n); - if (arg == NULL) - return NULL; - res = bytesio_read(self, arg); - Py_DECREF(arg); - return res; -} - -PyDoc_STRVAR(readline_doc, -"readline([size]) -> next line from the file, as a string.\n" -"\n" -"Retain newline. A non-negative size argument limits the maximum\n" -"number of bytes to return (an incomplete line may be returned then).\n" -"Return an empty string at EOF.\n"); - -static PyObject * -bytesio_readline(BytesIOObject *self, PyObject *args) -{ - Py_ssize_t size, n; - char *output; - PyObject *arg = Py_None; - - CHECK_CLOSED(self); - - if (!PyArg_ParseTuple(args, "|O:readline", &arg)) - return NULL; - - if (PyInt_Check(arg)) { - size = PyInt_AsSsize_t(arg); - if (size == -1 && PyErr_Occurred()) - return NULL; - } - else if (arg == Py_None) { - /* No size limit, by default. */ - size = -1; - } - else { - PyErr_Format(PyExc_TypeError, "integer argument expected, got '%s'", - Py_TYPE(arg)->tp_name); - return NULL; - } - - n = get_line(self, &output); - - if (size >= 0 && size < n) { - size = n - size; - n -= size; - self->pos -= size; - } - - return PyString_FromStringAndSize(output, n); -} - -PyDoc_STRVAR(readlines_doc, -"readlines([size]) -> list of strings, each a line from the file.\n" -"\n" -"Call readline() repeatedly and return a list of the lines so read.\n" -"The optional size argument, if given, is an approximate bound on the\n" -"total number of bytes in the lines returned.\n"); - -static PyObject * -bytesio_readlines(BytesIOObject *self, PyObject *args) -{ - Py_ssize_t maxsize, size, n; - PyObject *result, *line; - char *output; - PyObject *arg = Py_None; - - CHECK_CLOSED(self); - - if (!PyArg_ParseTuple(args, "|O:readlines", &arg)) - return NULL; - - if (PyInt_Check(arg)) { - maxsize = PyInt_AsSsize_t(arg); - if (maxsize == -1 && PyErr_Occurred()) - return NULL; - } - else if (arg == Py_None) { - /* No size limit, by default. */ - maxsize = -1; - } - else { - PyErr_Format(PyExc_TypeError, "integer argument expected, got '%s'", - Py_TYPE(arg)->tp_name); - return NULL; - } - - size = 0; - result = PyList_New(0); - if (!result) - return NULL; - - while ((n = get_line(self, &output)) != 0) { - line = PyString_FromStringAndSize(output, n); - if (!line) - goto on_error; - if (PyList_Append(result, line) == -1) { - Py_DECREF(line); - goto on_error; - } - Py_DECREF(line); - size += n; - if (maxsize > 0 && size >= maxsize) - break; - } - return result; - - on_error: - Py_DECREF(result); - return NULL; -} - -PyDoc_STRVAR(readinto_doc, -"readinto(bytearray) -> int. Read up to len(b) bytes into b.\n" -"\n" -"Returns number of bytes read (0 for EOF), or None if the object\n" -"is set not to block as has no data to read."); - -static PyObject * -bytesio_readinto(BytesIOObject *self, PyObject *buffer) -{ - void *raw_buffer; - Py_ssize_t len; - - CHECK_CLOSED(self); - - if (PyObject_AsWriteBuffer(buffer, &raw_buffer, &len) == -1) - return NULL; - - if (self->pos + len > self->string_size) - len = self->string_size - self->pos; - - memcpy(raw_buffer, self->buf + self->pos, len); - assert(self->pos + len < PY_SSIZE_T_MAX); - assert(len >= 0); - self->pos += len; - - return PyInt_FromSsize_t(len); -} - -PyDoc_STRVAR(truncate_doc, -"truncate([size]) -> int. Truncate the file to at most size bytes.\n" -"\n" -"Size defaults to the current file position, as returned by tell().\n" -"Returns the new size. Imply an absolute seek to the position size."); - -static PyObject * -bytesio_truncate(BytesIOObject *self, PyObject *args) -{ - Py_ssize_t size; - PyObject *arg = Py_None; - - CHECK_CLOSED(self); - - if (!PyArg_ParseTuple(args, "|O:truncate", &arg)) - return NULL; - - if (PyInt_Check(arg)) { - size = PyInt_AsSsize_t(arg); - if (size == -1 && PyErr_Occurred()) - return NULL; - } - else if (arg == Py_None) { - /* Truncate to current position if no argument is passed. */ - size = self->pos; - } - else { - PyErr_Format(PyExc_TypeError, "integer argument expected, got '%s'", - Py_TYPE(arg)->tp_name); - return NULL; - } - - if (size < 0) { - PyErr_Format(PyExc_ValueError, - "negative size value %zd", size); - return NULL; - } - - if (size < self->string_size) { - self->string_size = size; - if (resize_buffer(self, size) < 0) - return NULL; - } - self->pos = size; - - return PyInt_FromSsize_t(size); -} - -static PyObject * -bytesio_iternext(BytesIOObject *self) -{ - char *next; - Py_ssize_t n; - - CHECK_CLOSED(self); - - n = get_line(self, &next); - - if (!next || n == 0) - return NULL; - - return PyString_FromStringAndSize(next, n); -} - -PyDoc_STRVAR(seek_doc, -"seek(pos, whence=0) -> int. Change stream position.\n" -"\n" -"Seek to byte offset pos relative to position indicated by whence:\n" -" 0 Start of stream (the default). pos should be >= 0;\n" -" 1 Current position - pos may be negative;\n" -" 2 End of stream - pos usually negative.\n" -"Returns the new absolute position."); - -static PyObject * -bytesio_seek(BytesIOObject *self, PyObject *args) -{ - PyObject *pos_obj, *mode_obj; - Py_ssize_t pos; - int mode = 0; - - CHECK_CLOSED(self); - - /* Special-case for 2.x to prevent floats from passing through. - This only needed to make a test in test_io succeed. */ - if (!PyArg_UnpackTuple(args, "seek", 1, 2, &pos_obj, &mode_obj)) - return NULL; - if (PyFloat_Check(pos_obj)) { - PyErr_SetString(PyExc_TypeError, - "position argument must be an integer"); - return NULL; - } - - if (!PyArg_ParseTuple(args, "n|i:seek", &pos, &mode)) - return NULL; - - if (pos < 0 && mode == 0) { - PyErr_Format(PyExc_ValueError, - "negative seek value %zd", pos); - return NULL; - } - - /* mode 0: offset relative to beginning of the string. - mode 1: offset relative to current position. - mode 2: offset relative the end of the string. */ - if (mode == 1) { - if (pos > PY_SSIZE_T_MAX - self->pos) { - PyErr_SetString(PyExc_OverflowError, - "new position too large"); - return NULL; - } - pos += self->pos; - } - else if (mode == 2) { - if (pos > PY_SSIZE_T_MAX - self->string_size) { - PyErr_SetString(PyExc_OverflowError, - "new position too large"); - return NULL; - } - pos += self->string_size; - } - else if (mode != 0) { - PyErr_Format(PyExc_ValueError, - "invalid whence (%i, should be 0, 1 or 2)", mode); - return NULL; - } - - if (pos < 0) - pos = 0; - self->pos = pos; - - return PyInt_FromSsize_t(self->pos); -} - -PyDoc_STRVAR(write_doc, -"write(bytes) -> int. Write bytes to file.\n" -"\n" -"Return the number of bytes written."); - -static PyObject * -bytesio_write(BytesIOObject *self, PyObject *obj) -{ - const char *bytes; - Py_ssize_t size; - Py_ssize_t n = 0; - - CHECK_CLOSED(self); - - /* Special-case in 2.x to prevent unicode objects to pass through. */ - if (PyUnicode_Check(obj)) { - PyErr_SetString(PyExc_TypeError, - "expecting a bytes object, got unicode"); - return NULL; - } - - if (PyObject_AsReadBuffer(obj, (void *)&bytes, &size) < 0) - return NULL; - - if (size != 0) { - n = write_bytes(self, bytes, size); - if (n < 0) - return NULL; - } - - return PyInt_FromSsize_t(n); -} - -PyDoc_STRVAR(writelines_doc, -"writelines(sequence_of_strings) -> None. Write strings to the file.\n" -"\n" -"Note that newlines are not added. The sequence can be any iterable\n" -"object producing strings. This is equivalent to calling write() for\n" -"each string."); - -static PyObject * -bytesio_writelines(BytesIOObject *self, PyObject *v) -{ - PyObject *it, *item; - PyObject *ret; - - CHECK_CLOSED(self); - - it = PyObject_GetIter(v); - if (it == NULL) - return NULL; - - while ((item = PyIter_Next(it)) != NULL) { - ret = bytesio_write(self, item); - Py_DECREF(item); - if (ret == NULL) { - Py_DECREF(it); - return NULL; - } - Py_DECREF(ret); - } - Py_DECREF(it); - - /* See if PyIter_Next failed */ - if (PyErr_Occurred()) - return NULL; - - Py_RETURN_NONE; -} - -PyDoc_STRVAR(close_doc, -"close() -> None. Disable all I/O operations."); - -static PyObject * -bytesio_close(BytesIOObject *self) -{ - if (self->buf != NULL) { - PyMem_Free(self->buf); - self->buf = NULL; - } - Py_RETURN_NONE; -} - -static void -bytesio_dealloc(BytesIOObject *self) -{ - if (self->buf != NULL) { - PyMem_Free(self->buf); - self->buf = NULL; - } - Py_TYPE(self)->tp_free(self); -} - -static PyObject * -bytesio_new(PyTypeObject *type, PyObject *args, PyObject *kwds) -{ - BytesIOObject *self; - - assert(type != NULL && type->tp_alloc != NULL); - self = (BytesIOObject *)type->tp_alloc(type, 0); - if (self == NULL) - return NULL; - - self->string_size = 0; - self->pos = 0; - self->buf_size = 0; - self->buf = (char *)PyMem_Malloc(0); - if (self->buf == NULL) { - Py_DECREF(self); - return PyErr_NoMemory(); - } - - return (PyObject *)self; -} - -static int -bytesio_init(BytesIOObject *self, PyObject *args, PyObject *kwds) -{ - PyObject *initvalue = NULL; - - if (!PyArg_ParseTuple(args, "|O:BytesIO", &initvalue)) - return -1; - - /* In case, __init__ is called multiple times. */ - self->string_size = 0; - self->pos = 0; - - if (initvalue && initvalue != Py_None) { - PyObject *res; - res = bytesio_write(self, initvalue); - if (res == NULL) - return -1; - Py_DECREF(res); - self->pos = 0; - } - - return 0; -} - -static PyGetSetDef bytesio_getsetlist[] = { - {"closed", (getter)bytesio_get_closed, NULL, - "True if the file is closed."}, - {0}, /* sentinel */ -}; - -static struct PyMethodDef bytesio_methods[] = { - {"readable", (PyCFunction)return_true, METH_NOARGS, NULL}, - {"seekable", (PyCFunction)return_true, METH_NOARGS, NULL}, - {"writable", (PyCFunction)return_true, METH_NOARGS, NULL}, - {"close", (PyCFunction)bytesio_close, METH_NOARGS, close_doc}, - {"flush", (PyCFunction)bytesio_flush, METH_NOARGS, flush_doc}, - {"isatty", (PyCFunction)bytesio_isatty, METH_NOARGS, isatty_doc}, - {"tell", (PyCFunction)bytesio_tell, METH_NOARGS, tell_doc}, - {"write", (PyCFunction)bytesio_write, METH_O, write_doc}, - {"writelines", (PyCFunction)bytesio_writelines, METH_O, writelines_doc}, - {"read1", (PyCFunction)bytesio_read1, METH_O, read1_doc}, - {"readinto", (PyCFunction)bytesio_readinto, METH_O, readinto_doc}, - {"readline", (PyCFunction)bytesio_readline, METH_VARARGS, readline_doc}, - {"readlines", (PyCFunction)bytesio_readlines, METH_VARARGS, readlines_doc}, - {"read", (PyCFunction)bytesio_read, METH_VARARGS, read_doc}, - {"getvalue", (PyCFunction)bytesio_getvalue, METH_VARARGS, getval_doc}, - {"seek", (PyCFunction)bytesio_seek, METH_VARARGS, seek_doc}, - {"truncate", (PyCFunction)bytesio_truncate, METH_VARARGS, truncate_doc}, - {NULL, NULL} /* sentinel */ -}; - -PyDoc_STRVAR(bytesio_doc, -"BytesIO([buffer]) -> object\n" -"\n" -"Create a buffered I/O implementation using an in-memory bytes\n" -"buffer, ready for reading and writing."); - -static PyTypeObject BytesIO_Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "_bytesio._BytesIO", /*tp_name*/ - sizeof(BytesIOObject), /*tp_basicsize*/ - 0, /*tp_itemsize*/ - (destructor)bytesio_dealloc, /*tp_dealloc*/ - 0, /*tp_print*/ - 0, /*tp_getattr*/ - 0, /*tp_setattr*/ - 0, /*tp_compare*/ - 0, /*tp_repr*/ - 0, /*tp_as_number*/ - 0, /*tp_as_sequence*/ - 0, /*tp_as_mapping*/ - 0, /*tp_hash*/ - 0, /*tp_call*/ - 0, /*tp_str*/ - 0, /*tp_getattro*/ - 0, /*tp_setattro*/ - 0, /*tp_as_buffer*/ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /*tp_flags*/ - bytesio_doc, /*tp_doc*/ - 0, /*tp_traverse*/ - 0, /*tp_clear*/ - 0, /*tp_richcompare*/ - 0, /*tp_weaklistoffset*/ - PyObject_SelfIter, /*tp_iter*/ - (iternextfunc)bytesio_iternext, /*tp_iternext*/ - bytesio_methods, /*tp_methods*/ - 0, /*tp_members*/ - bytesio_getsetlist, /*tp_getset*/ - 0, /*tp_base*/ - 0, /*tp_dict*/ - 0, /*tp_descr_get*/ - 0, /*tp_descr_set*/ - 0, /*tp_dictoffset*/ - (initproc)bytesio_init, /*tp_init*/ - 0, /*tp_alloc*/ - bytesio_new, /*tp_new*/ -}; - -PyMODINIT_FUNC -init_bytesio(void) -{ - PyObject *m; - - if (PyType_Ready(&BytesIO_Type) < 0) - return; - m = Py_InitModule("_bytesio", NULL); - if (m == NULL) - return; - Py_INCREF(&BytesIO_Type); - PyModule_AddObject(m, "_BytesIO", (PyObject *)&BytesIO_Type); -} Deleted: python/branches/tk_and_idle_maintenance/Modules/_fileio.c ============================================================================== --- python/branches/tk_and_idle_maintenance/Modules/_fileio.c Sat Jun 20 00:11:15 2009 +++ (empty file) @@ -1,935 +0,0 @@ -/* Author: Daniel Stutzbach */ - -#define PY_SSIZE_T_CLEAN -#include "Python.h" -#include -#include -#include -#include /* For offsetof */ - -/* - * Known likely problems: - * - * - Files larger then 2**32-1 - * - Files with unicode filenames - * - Passing numbers greater than 2**32-1 when an integer is expected - * - Making it work on Windows and other oddball platforms - * - * To Do: - * - * - autoconfify header file inclusion - */ - -#ifdef MS_WINDOWS -/* can simulate truncate with Win32 API functions; see file_truncate */ -#define HAVE_FTRUNCATE -#define WIN32_LEAN_AND_MEAN -#include -#endif - -typedef struct { - PyObject_HEAD - int fd; - unsigned readable : 1; - unsigned writable : 1; - int seekable : 2; /* -1 means unknown */ - int closefd : 1; - PyObject *weakreflist; -} PyFileIOObject; - -PyTypeObject PyFileIO_Type; - -#define PyFileIO_Check(op) (PyObject_TypeCheck((op), &PyFileIO_Type)) - -static PyObject * -portable_lseek(int fd, PyObject *posobj, int whence); - -/* Returns 0 on success, errno (which is < 0) on failure. */ -static int -internal_close(PyFileIOObject *self) -{ - int save_errno = 0; - if (self->fd >= 0) { - int fd = self->fd; - self->fd = -1; - Py_BEGIN_ALLOW_THREADS - if (close(fd) < 0) - save_errno = errno; - Py_END_ALLOW_THREADS - } - return save_errno; -} - -static PyObject * -fileio_close(PyFileIOObject *self) -{ - if (!self->closefd) { - self->fd = -1; - Py_RETURN_NONE; - } - errno = internal_close(self); - if (errno < 0) { - PyErr_SetFromErrno(PyExc_IOError); - return NULL; - } - - Py_RETURN_NONE; -} - -static PyObject * -fileio_new(PyTypeObject *type, PyObject *args, PyObject *kews) -{ - PyFileIOObject *self; - - assert(type != NULL && type->tp_alloc != NULL); - - self = (PyFileIOObject *) type->tp_alloc(type, 0); - if (self != NULL) { - self->fd = -1; - self->readable = 0; - self->writable = 0; - self->seekable = -1; - self->closefd = 1; - self->weakreflist = NULL; - } - - return (PyObject *) self; -} - -/* On Unix, open will succeed for directories. - In Python, there should be no file objects referring to - directories, so we need a check. */ - -static int -dircheck(PyFileIOObject* self, char *name) -{ -#if defined(HAVE_FSTAT) && defined(S_IFDIR) && defined(EISDIR) - struct stat buf; - if (self->fd < 0) - return 0; - if (fstat(self->fd, &buf) == 0 && S_ISDIR(buf.st_mode)) { - char *msg = strerror(EISDIR); - PyObject *exc; - internal_close(self); - - exc = PyObject_CallFunction(PyExc_IOError, "(iss)", - EISDIR, msg, name); - PyErr_SetObject(PyExc_IOError, exc); - Py_XDECREF(exc); - return -1; - } -#endif - return 0; -} - -static int -check_fd(int fd) -{ -#if defined(HAVE_FSTAT) - struct stat buf; - if (!_PyVerify_fd(fd) || (fstat(fd, &buf) < 0 && errno == EBADF)) { - PyObject *exc; - char *msg = strerror(EBADF); - exc = PyObject_CallFunction(PyExc_OSError, "(is)", - EBADF, msg); - PyErr_SetObject(PyExc_OSError, exc); - Py_XDECREF(exc); - return -1; - } -#endif - return 0; -} - - -static int -fileio_init(PyObject *oself, PyObject *args, PyObject *kwds) -{ - PyFileIOObject *self = (PyFileIOObject *) oself; - static char *kwlist[] = {"file", "mode", "closefd", NULL}; - char *name = NULL; - char *mode = "r"; - char *s; -#ifdef MS_WINDOWS - Py_UNICODE *widename = NULL; -#endif - int ret = 0; - int rwa = 0, plus = 0, append = 0; - int flags = 0; - int fd = -1; - int closefd = 1; - - assert(PyFileIO_Check(oself)); - if (self->fd >= 0) { - /* Have to close the existing file first. */ - if (internal_close(self) < 0) - return -1; - } - - if (PyArg_ParseTupleAndKeywords(args, kwds, "i|si:fileio", - kwlist, &fd, &mode, &closefd)) { - if (fd < 0) { - PyErr_SetString(PyExc_ValueError, - "Negative filedescriptor"); - return -1; - } - if (check_fd(fd)) - return -1; - } - else { - PyErr_Clear(); - -#ifdef MS_WINDOWS - if (GetVersion() < 0x80000000) { - /* On NT, so wide API available */ - PyObject *po; - if (PyArg_ParseTupleAndKeywords(args, kwds, "U|si:fileio", - kwlist, &po, &mode, &closefd) - ) { - widename = PyUnicode_AS_UNICODE(po); - } else { - /* Drop the argument parsing error as narrow - strings are also valid. */ - PyErr_Clear(); - } - } - if (widename == NULL) -#endif - { - if (!PyArg_ParseTupleAndKeywords(args, kwds, "et|si:fileio", - kwlist, - Py_FileSystemDefaultEncoding, - &name, &mode, &closefd)) - return -1; - } - } - - s = mode; - while (*s) { - switch (*s++) { - case 'r': - if (rwa) { - bad_mode: - PyErr_SetString(PyExc_ValueError, - "Must have exactly one of read/write/append mode"); - goto error; - } - rwa = 1; - self->readable = 1; - break; - case 'w': - if (rwa) - goto bad_mode; - rwa = 1; - self->writable = 1; - flags |= O_CREAT | O_TRUNC; - break; - case 'a': - if (rwa) - goto bad_mode; - rwa = 1; - self->writable = 1; - flags |= O_CREAT; - append = 1; - break; - case 'b': - break; - case '+': - if (plus) - goto bad_mode; - self->readable = self->writable = 1; - plus = 1; - break; - default: - PyErr_Format(PyExc_ValueError, - "invalid mode: %.200s", mode); - goto error; - } - } - - if (!rwa) - goto bad_mode; - - if (self->readable && self->writable) - flags |= O_RDWR; - else if (self->readable) - flags |= O_RDONLY; - else - flags |= O_WRONLY; - -#ifdef O_BINARY - flags |= O_BINARY; -#endif - -#ifdef O_APPEND - if (append) - flags |= O_APPEND; -#endif - - if (fd >= 0) { - self->fd = fd; - self->closefd = closefd; - } - else { - self->closefd = 1; - if (!closefd) { - PyErr_SetString(PyExc_ValueError, - "Cannot use closefd=False with file name"); - goto error; - } - - Py_BEGIN_ALLOW_THREADS - errno = 0; -#ifdef MS_WINDOWS - if (widename != NULL) - self->fd = _wopen(widename, flags, 0666); - else -#endif - self->fd = open(name, flags, 0666); - Py_END_ALLOW_THREADS - if (self->fd < 0) { -#ifdef MS_WINDOWS - if (widename != NULL) - PyErr_SetFromErrnoWithUnicodeFilename(PyExc_IOError, widename); - else -#endif - PyErr_SetFromErrnoWithFilename(PyExc_IOError, name); - goto error; - } - if(dircheck(self, name) < 0) - goto error; - } - - if (append) { - /* For consistent behaviour, we explicitly seek to the - end of file (otherwise, it might be done only on the - first write()). */ - PyObject *pos = portable_lseek(self->fd, NULL, 2); - if (pos == NULL) - goto error; - Py_DECREF(pos); - } - - goto done; - - error: - ret = -1; - - done: - PyMem_Free(name); - return ret; -} - -static void -fileio_dealloc(PyFileIOObject *self) -{ - if (self->weakreflist != NULL) - PyObject_ClearWeakRefs((PyObject *) self); - - if (self->fd >= 0 && self->closefd) { - errno = internal_close(self); - if (errno < 0) { - PySys_WriteStderr("close failed: [Errno %d] %s\n", - errno, strerror(errno)); - } - } - - Py_TYPE(self)->tp_free((PyObject *)self); -} - -static PyObject * -err_closed(void) -{ - PyErr_SetString(PyExc_ValueError, "I/O operation on closed file"); - return NULL; -} - -static PyObject * -err_mode(char *action) -{ - PyErr_Format(PyExc_ValueError, "File not open for %s", action); - return NULL; -} - -static PyObject * -fileio_fileno(PyFileIOObject *self) -{ - if (self->fd < 0) - return err_closed(); - return PyInt_FromLong((long) self->fd); -} - -static PyObject * -fileio_readable(PyFileIOObject *self) -{ - if (self->fd < 0) - return err_closed(); - return PyBool_FromLong((long) self->readable); -} - -static PyObject * -fileio_writable(PyFileIOObject *self) -{ - if (self->fd < 0) - return err_closed(); - return PyBool_FromLong((long) self->writable); -} - -static PyObject * -fileio_seekable(PyFileIOObject *self) -{ - if (self->fd < 0) - return err_closed(); - if (self->seekable < 0) { - int ret; - Py_BEGIN_ALLOW_THREADS - ret = lseek(self->fd, 0, SEEK_CUR); - Py_END_ALLOW_THREADS - if (ret < 0) - self->seekable = 0; - else - self->seekable = 1; - } - return PyBool_FromLong((long) self->seekable); -} - -static PyObject * -fileio_readinto(PyFileIOObject *self, PyObject *args) -{ - Py_buffer pbuf; - Py_ssize_t n; - - if (self->fd < 0) - return err_closed(); - if (!self->readable) - return err_mode("reading"); - - if (!PyArg_ParseTuple(args, "w*", &pbuf)) - return NULL; - - Py_BEGIN_ALLOW_THREADS - errno = 0; - n = read(self->fd, pbuf.buf, pbuf.len); - Py_END_ALLOW_THREADS - PyBuffer_Release(&pbuf); - if (n < 0) { - if (errno == EAGAIN) - Py_RETURN_NONE; - PyErr_SetFromErrno(PyExc_IOError); - return NULL; - } - - return PyLong_FromSsize_t(n); -} - -#define DEFAULT_BUFFER_SIZE (8*1024) - -static PyObject * -fileio_readall(PyFileIOObject *self) -{ - PyObject *result; - Py_ssize_t total = 0; - int n; - - result = PyString_FromStringAndSize(NULL, DEFAULT_BUFFER_SIZE); - if (result == NULL) - return NULL; - - while (1) { - Py_ssize_t newsize = total + DEFAULT_BUFFER_SIZE; - if (PyString_GET_SIZE(result) < newsize) { - if (_PyString_Resize(&result, newsize) < 0) { - if (total == 0) { - Py_DECREF(result); - return NULL; - } - PyErr_Clear(); - break; - } - } - Py_BEGIN_ALLOW_THREADS - errno = 0; - n = read(self->fd, - PyString_AS_STRING(result) + total, - newsize - total); - Py_END_ALLOW_THREADS - if (n == 0) - break; - if (n < 0) { - if (total > 0) - break; - if (errno == EAGAIN) { - Py_DECREF(result); - Py_RETURN_NONE; - } - Py_DECREF(result); - PyErr_SetFromErrno(PyExc_IOError); - return NULL; - } - total += n; - } - - if (PyString_GET_SIZE(result) > total) { - if (_PyString_Resize(&result, total) < 0) { - /* This should never happen, but just in case */ - Py_DECREF(result); - return NULL; - } - } - return result; -} - -static PyObject * -fileio_read(PyFileIOObject *self, PyObject *args) -{ - char *ptr; - Py_ssize_t n; - Py_ssize_t size = -1; - PyObject *bytes; - - if (self->fd < 0) - return err_closed(); - if (!self->readable) - return err_mode("reading"); - - if (!PyArg_ParseTuple(args, "|n", &size)) - return NULL; - - if (size < 0) { - return fileio_readall(self); - } - - bytes = PyString_FromStringAndSize(NULL, size); - if (bytes == NULL) - return NULL; - ptr = PyString_AS_STRING(bytes); - - Py_BEGIN_ALLOW_THREADS - errno = 0; - n = read(self->fd, ptr, size); - Py_END_ALLOW_THREADS - - if (n < 0) { - if (errno == EAGAIN) - Py_RETURN_NONE; - PyErr_SetFromErrno(PyExc_IOError); - return NULL; - } - - if (n != size) { - if (_PyString_Resize(&bytes, n) < 0) { - Py_DECREF(bytes); - return NULL; - } - } - - return (PyObject *) bytes; -} - -static PyObject * -fileio_write(PyFileIOObject *self, PyObject *args) -{ - Py_buffer pbuf; - Py_ssize_t n; - - if (self->fd < 0) - return err_closed(); - if (!self->writable) - return err_mode("writing"); - - if (!PyArg_ParseTuple(args, "s*", &pbuf)) - return NULL; - - Py_BEGIN_ALLOW_THREADS - errno = 0; - n = write(self->fd, pbuf.buf, pbuf.len); - Py_END_ALLOW_THREADS - - PyBuffer_Release(&pbuf); - - if (n < 0) { - if (errno == EAGAIN) - Py_RETURN_NONE; - PyErr_SetFromErrno(PyExc_IOError); - return NULL; - } - - return PyLong_FromSsize_t(n); -} - -/* XXX Windows support below is likely incomplete */ - -#if defined(MS_WIN64) || defined(MS_WINDOWS) -typedef PY_LONG_LONG Py_off_t; -#else -typedef off_t Py_off_t; -#endif - -/* Cribbed from posix_lseek() */ -static PyObject * -portable_lseek(int fd, PyObject *posobj, int whence) -{ - Py_off_t pos, res; - -#ifdef SEEK_SET - /* Turn 0, 1, 2 into SEEK_{SET,CUR,END} */ - switch (whence) { -#if SEEK_SET != 0 - case 0: whence = SEEK_SET; break; -#endif -#if SEEK_CUR != 1 - case 1: whence = SEEK_CUR; break; -#endif -#if SEEK_END != 2 - case 2: whence = SEEK_END; break; -#endif - } -#endif /* SEEK_SET */ - - if (posobj == NULL) - pos = 0; - else { - if(PyFloat_Check(posobj)) { - PyErr_SetString(PyExc_TypeError, "an integer is required"); - return NULL; - } -#if defined(HAVE_LARGEFILE_SUPPORT) - pos = PyLong_AsLongLong(posobj); -#else - pos = PyLong_AsLong(posobj); -#endif - if (PyErr_Occurred()) - return NULL; - } - - Py_BEGIN_ALLOW_THREADS -#if defined(MS_WIN64) || defined(MS_WINDOWS) - res = _lseeki64(fd, pos, whence); -#else - res = lseek(fd, pos, whence); -#endif - Py_END_ALLOW_THREADS - if (res < 0) - return PyErr_SetFromErrno(PyExc_IOError); - -#if defined(HAVE_LARGEFILE_SUPPORT) - return PyLong_FromLongLong(res); -#else - return PyLong_FromLong(res); -#endif -} - -static PyObject * -fileio_seek(PyFileIOObject *self, PyObject *args) -{ - PyObject *posobj; - int whence = 0; - - if (self->fd < 0) - return err_closed(); - - if (!PyArg_ParseTuple(args, "O|i", &posobj, &whence)) - return NULL; - - return portable_lseek(self->fd, posobj, whence); -} - -static PyObject * -fileio_tell(PyFileIOObject *self, PyObject *args) -{ - if (self->fd < 0) - return err_closed(); - - return portable_lseek(self->fd, NULL, 1); -} - -#ifdef HAVE_FTRUNCATE -static PyObject * -fileio_truncate(PyFileIOObject *self, PyObject *args) -{ - PyObject *posobj = NULL; - Py_off_t pos; - int ret; - int fd; - - fd = self->fd; - if (fd < 0) - return err_closed(); - if (!self->writable) - return err_mode("writing"); - - if (!PyArg_ParseTuple(args, "|O", &posobj)) - return NULL; - - if (posobj == Py_None || posobj == NULL) { - /* Get the current position. */ - posobj = portable_lseek(fd, NULL, 1); - if (posobj == NULL) - return NULL; - } - else { - /* Move to the position to be truncated. */ - posobj = portable_lseek(fd, posobj, 0); - } - -#if defined(HAVE_LARGEFILE_SUPPORT) - pos = PyLong_AsLongLong(posobj); -#else - pos = PyLong_AsLong(posobj); -#endif - if (PyErr_Occurred()) - return NULL; - -#ifdef MS_WINDOWS - /* MS _chsize doesn't work if newsize doesn't fit in 32 bits, - so don't even try using it. */ - { - HANDLE hFile; - - /* Truncate. Note that this may grow the file! */ - Py_BEGIN_ALLOW_THREADS - errno = 0; - hFile = (HANDLE)_get_osfhandle(fd); - ret = hFile == (HANDLE)-1; - if (ret == 0) { - ret = SetEndOfFile(hFile) == 0; - if (ret) - errno = EACCES; - } - Py_END_ALLOW_THREADS - } -#else - Py_BEGIN_ALLOW_THREADS - errno = 0; - ret = ftruncate(fd, pos); - Py_END_ALLOW_THREADS -#endif /* !MS_WINDOWS */ - - if (ret != 0) { - PyErr_SetFromErrno(PyExc_IOError); - return NULL; - } - - return posobj; -} -#endif - -static char * -mode_string(PyFileIOObject *self) -{ - if (self->readable) { - if (self->writable) - return "rb+"; - else - return "rb"; - } - else - return "wb"; -} - -static PyObject * -fileio_repr(PyFileIOObject *self) -{ - if (self->fd < 0) - return PyString_FromFormat("_fileio._FileIO(-1)"); - - return PyString_FromFormat("_fileio._FileIO(%d, '%s')", - self->fd, mode_string(self)); -} - -static PyObject * -fileio_isatty(PyFileIOObject *self) -{ - long res; - - if (self->fd < 0) - return err_closed(); - Py_BEGIN_ALLOW_THREADS - res = isatty(self->fd); - Py_END_ALLOW_THREADS - return PyBool_FromLong(res); -} - - -PyDoc_STRVAR(fileio_doc, -"file(name: str[, mode: str]) -> file IO object\n" -"\n" -"Open a file. The mode can be 'r', 'w' or 'a' for reading (default),\n" -"writing or appending. The file will be created if it doesn't exist\n" -"when opened for writing or appending; it will be truncated when\n" -"opened for writing. Add a '+' to the mode to allow simultaneous\n" -"reading and writing."); - -PyDoc_STRVAR(read_doc, -"read(size: int) -> bytes. read at most size bytes, returned as bytes.\n" -"\n" -"Only makes one system call, so less data may be returned than requested\n" -"In non-blocking mode, returns None if no data is available.\n" -"On end-of-file, returns ''."); - -PyDoc_STRVAR(readall_doc, -"readall() -> bytes. read all data from the file, returned as bytes.\n" -"\n" -"In non-blocking mode, returns as much as is immediately available,\n" -"or None if no data is available. On end-of-file, returns ''."); - -PyDoc_STRVAR(write_doc, -"write(b: bytes) -> int. Write bytes b to file, return number written.\n" -"\n" -"Only makes one system call, so not all of the data may be written.\n" -"The number of bytes actually written is returned."); - -PyDoc_STRVAR(fileno_doc, -"fileno() -> int. \"file descriptor\".\n" -"\n" -"This is needed for lower-level file interfaces, such the fcntl module."); - -PyDoc_STRVAR(seek_doc, -"seek(offset: int[, whence: int]) -> None. Move to new file position.\n" -"\n" -"Argument offset is a byte count. Optional argument whence defaults to\n" -"0 (offset from start of file, offset should be >= 0); other values are 1\n" -"(move relative to current position, positive or negative), and 2 (move\n" -"relative to end of file, usually negative, although many platforms allow\n" -"seeking beyond the end of a file)." -"\n" -"Note that not all file objects are seekable."); - -#ifdef HAVE_FTRUNCATE -PyDoc_STRVAR(truncate_doc, -"truncate([size: int]) -> None. Truncate the file to at most size bytes.\n" -"\n" -"Size defaults to the current file position, as returned by tell()." -"The current file position is changed to the value of size."); -#endif - -PyDoc_STRVAR(tell_doc, -"tell() -> int. Current file position"); - -PyDoc_STRVAR(readinto_doc, -"readinto() -> Undocumented. Don't use this; it may go away."); - -PyDoc_STRVAR(close_doc, -"close() -> None. Close the file.\n" -"\n" -"A closed file cannot be used for further I/O operations. close() may be\n" -"called more than once without error. Changes the fileno to -1."); - -PyDoc_STRVAR(isatty_doc, -"isatty() -> bool. True if the file is connected to a tty device."); - -PyDoc_STRVAR(seekable_doc, -"seekable() -> bool. True if file supports random-access."); - -PyDoc_STRVAR(readable_doc, -"readable() -> bool. True if file was opened in a read mode."); - -PyDoc_STRVAR(writable_doc, -"writable() -> bool. True if file was opened in a write mode."); - -static PyMethodDef fileio_methods[] = { - {"read", (PyCFunction)fileio_read, METH_VARARGS, read_doc}, - {"readall", (PyCFunction)fileio_readall, METH_NOARGS, readall_doc}, - {"readinto", (PyCFunction)fileio_readinto, METH_VARARGS, readinto_doc}, - {"write", (PyCFunction)fileio_write, METH_VARARGS, write_doc}, - {"seek", (PyCFunction)fileio_seek, METH_VARARGS, seek_doc}, - {"tell", (PyCFunction)fileio_tell, METH_VARARGS, tell_doc}, -#ifdef HAVE_FTRUNCATE - {"truncate", (PyCFunction)fileio_truncate, METH_VARARGS, truncate_doc}, -#endif - {"close", (PyCFunction)fileio_close, METH_NOARGS, close_doc}, - {"seekable", (PyCFunction)fileio_seekable, METH_NOARGS, seekable_doc}, - {"readable", (PyCFunction)fileio_readable, METH_NOARGS, readable_doc}, - {"writable", (PyCFunction)fileio_writable, METH_NOARGS, writable_doc}, - {"fileno", (PyCFunction)fileio_fileno, METH_NOARGS, fileno_doc}, - {"isatty", (PyCFunction)fileio_isatty, METH_NOARGS, isatty_doc}, - {NULL, NULL} /* sentinel */ -}; - -/* 'closed' and 'mode' are attributes for backwards compatibility reasons. */ - -static PyObject * -get_closed(PyFileIOObject *self, void *closure) -{ - return PyBool_FromLong((long)(self->fd < 0)); -} - -static PyObject * -get_closefd(PyFileIOObject *self, void *closure) -{ - return PyBool_FromLong((long)(self->closefd)); -} - -static PyObject * -get_mode(PyFileIOObject *self, void *closure) -{ - return PyString_FromString(mode_string(self)); -} - -static PyGetSetDef fileio_getsetlist[] = { - {"closed", (getter)get_closed, NULL, "True if the file is closed"}, - {"closefd", (getter)get_closefd, NULL, - "True if the file descriptor will be closed"}, - {"mode", (getter)get_mode, NULL, "String giving the file mode"}, - {0}, -}; - -PyTypeObject PyFileIO_Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "_FileIO", - sizeof(PyFileIOObject), - 0, - (destructor)fileio_dealloc, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_compare */ - (reprfunc)fileio_repr, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - PyObject_GenericGetAttr, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - fileio_doc, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - offsetof(PyFileIOObject, weakreflist), /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - fileio_methods, /* tp_methods */ - 0, /* tp_members */ - fileio_getsetlist, /* tp_getset */ - 0, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - fileio_init, /* tp_init */ - PyType_GenericAlloc, /* tp_alloc */ - fileio_new, /* tp_new */ - PyObject_Del, /* tp_free */ -}; - -static PyMethodDef module_methods[] = { - {NULL, NULL} -}; - -PyMODINIT_FUNC -init_fileio(void) -{ - PyObject *m; /* a module object */ - - m = Py_InitModule3("_fileio", module_methods, - "Fast implementation of io.FileIO."); - if (m == NULL) - return; - if (PyType_Ready(&PyFileIO_Type) < 0) - return; - Py_INCREF(&PyFileIO_Type); - PyModule_AddObject(m, "_FileIO", (PyObject *) &PyFileIO_Type); -} Modified: python/branches/tk_and_idle_maintenance/Modules/audioop.c ============================================================================== --- python/branches/tk_and_idle_maintenance/Modules/audioop.c (original) +++ python/branches/tk_and_idle_maintenance/Modules/audioop.c Sat Jun 20 00:11:15 2009 @@ -1116,7 +1116,7 @@ outrate /= d; alloc_size = sizeof(int) * (unsigned)nchannels; - if (alloc_size < nchannels) { + if (alloc_size < (unsigned)nchannels) { PyErr_SetString(PyExc_MemoryError, "not enough memory for output buffer"); return 0; Modified: python/branches/tk_and_idle_maintenance/Modules/mmapmodule.c ============================================================================== --- python/branches/tk_and_idle_maintenance/Modules/mmapmodule.c (original) +++ python/branches/tk_and_idle_maintenance/Modules/mmapmodule.c Sat Jun 20 00:11:15 2009 @@ -158,7 +158,8 @@ #endif /* MS_WINDOWS */ #ifdef UNIX - (void) close(self->fd); + if (0 <= self->fd) + (void) close(self->fd); self->fd = -1; if (self->data != NULL) { munmap(self->data, self->size); Modified: python/branches/tk_and_idle_maintenance/Objects/exceptions.c ============================================================================== --- python/branches/tk_and_idle_maintenance/Objects/exceptions.c (original) +++ python/branches/tk_and_idle_maintenance/Objects/exceptions.c Sat Jun 20 00:11:15 2009 @@ -9,7 +9,6 @@ #include "structmember.h" #include "osdefs.h" -#define MAKE_IT_NONE(x) (x) = Py_None; Py_INCREF(Py_None); #define EXC_MODULE_NAME "exceptions." /* NOTE: If the exception class hierarchy changes, don't forget to update @@ -2136,6 +2135,6 @@ void _PyExc_Fini(void) { - Py_XDECREF(PyExc_MemoryErrorInst); - PyExc_MemoryErrorInst = NULL; + Py_CLEAR(PyExc_MemoryErrorInst); + Py_CLEAR(PyExc_RecursionErrorInst); } Modified: python/branches/tk_and_idle_maintenance/Objects/floatobject.c ============================================================================== --- python/branches/tk_and_idle_maintenance/Objects/floatobject.c (original) +++ python/branches/tk_and_idle_maintenance/Objects/floatobject.c Sat Jun 20 00:11:15 2009 @@ -72,7 +72,7 @@ static PyTypeObject FloatInfoType = {0, 0, 0, 0, 0, 0}; PyDoc_STRVAR(floatinfo__doc__, -"sys.floatinfo\n\ +"sys.float_info\n\ \n\ A structseq holding information about the float type. It contains low level\n\ information about the precision and internal representation. Please study\n\ @@ -99,7 +99,7 @@ }; static PyStructSequence_Desc floatinfo_desc = { - "sys.floatinfo", /* name */ + "sys.float_info", /* name */ floatinfo__doc__, /* doc */ floatinfo_fields, /* fields */ 11 Modified: python/branches/tk_and_idle_maintenance/PC/VC6/pythoncore.dsp ============================================================================== --- python/branches/tk_and_idle_maintenance/PC/VC6/pythoncore.dsp (original) +++ python/branches/tk_and_idle_maintenance/PC/VC6/pythoncore.dsp Sat Jun 20 00:11:15 2009 @@ -97,10 +97,6 @@ # End Source File # Begin Source File -SOURCE=..\..\Modules\_bytesio.c -# End Source File -# Begin Source File - SOURCE=..\..\Modules\cjkcodecs\_codecs_cn.c # End Source File # Begin Source File @@ -137,10 +133,6 @@ # End Source File # Begin Source File -SOURCE=..\..\Modules\_fileio.c -# End Source File -# Begin Source File - SOURCE=..\..\Modules\_functoolsmodule.c # End Source File # Begin Source File @@ -153,6 +145,10 @@ # End Source File # Begin Source File +SOURCE=..\..\Modules\_io\_iomodule.c +# End Source File +# Begin Source File + SOURCE=..\..\Modules\_json.c # End Source File # Begin Source File @@ -237,6 +233,10 @@ # End Source File # Begin Source File +SOURCE=..\..\Modules\_io\bufferedio.c +# End Source File +# Begin Source File + SOURCE=..\..\Objects\bufferobject.c # End Source File # Begin Source File @@ -245,6 +245,10 @@ # End Source File # Begin Source File +SOURCE=..\..\Modules\_io\bytesio.c +# End Source File +# Begin Source File + SOURCE=..\..\Objects\bytes_methods.c # End Source File # Begin Source File @@ -345,6 +349,10 @@ # End Source File # Begin Source File +SOURCE=..\..\Modules\_io\fileio.c +# End Source File +# Begin Source File + SOURCE=..\..\Objects\fileobject.c # End Source File # Begin Source File @@ -442,6 +450,10 @@ # End Source File # Begin Source File +SOURCE=..\..\Modules\_io\iobase.c +# End Source File +# Begin Source File + SOURCE=..\..\Modules\imageop.c # End Source File # Begin Source File @@ -671,6 +683,10 @@ # End Source File # Begin Source File +SOURCE=..\..\Modules\_io\stringio.c +# End Source File +# Begin Source File + SOURCE=..\..\Objects\stringobject.c # End Source File # Begin Source File @@ -699,6 +715,10 @@ # End Source File # Begin Source File +SOURCE=..\..\Modules\_io\textio.c +# End Source File +# Begin Source File + SOURCE=..\..\Python\thread.c # End Source File # Begin Source File Modified: python/branches/tk_and_idle_maintenance/PC/VS7.1/pythoncore.vcproj ============================================================================== --- python/branches/tk_and_idle_maintenance/PC/VS7.1/pythoncore.vcproj (original) +++ python/branches/tk_and_idle_maintenance/PC/VS7.1/pythoncore.vcproj Sat Jun 20 00:11:15 2009 @@ -362,18 +362,12 @@ RelativePath="..\..\Modules\cjkcodecs\_codecs_tw.c"> - - - - + + + + + + + + + + + + + + - - - - @@ -1350,6 +1342,42 @@ > + + + + + + + + + + + + + + + + + + hkey); - return PyMember_Get((char *)self, PyHKEY_memberlist, name); -} - /************************************************************************ The public PyHKEY API (well, not public yet :-) ************************************************************************/ @@ -1634,7 +1627,8 @@ if (m == NULL) return; d = PyModule_GetDict(m); - PyHKEY_Type.ob_type = &PyType_Type; + if (PyType_Ready(&PyHKEY_Type) < 0) + return; PyHKEY_Type.tp_doc = PyHKEY_doc; Py_INCREF(&PyHKEY_Type); if (PyDict_SetItemString(d, "HKEYType", Modified: python/branches/tk_and_idle_maintenance/PC/config.c ============================================================================== --- python/branches/tk_and_idle_maintenance/PC/config.c (original) +++ python/branches/tk_and_idle_maintenance/PC/config.c Sat Jun 20 00:11:15 2009 @@ -52,8 +52,6 @@ extern void init_winreg(void); extern void init_struct(void); extern void initdatetime(void); -extern void init_fileio(void); -extern void init_bytesio(void); extern void init_functools(void); extern void init_json(void); extern void initzlib(void); @@ -68,6 +66,7 @@ extern void init_subprocess(void); extern void init_lsprof(void); extern void init_ast(void); +extern void init_io(void); extern void _PyWarnings_Init(void); /* tools/freeze/makeconfig.py marker for additional "extern" */ @@ -132,8 +131,6 @@ {"_winreg", init_winreg}, {"_struct", init_struct}, {"datetime", initdatetime}, - {"_fileio", init_fileio}, - {"_bytesio", init_bytesio}, {"_functools", init_functools}, {"_json", init_json}, @@ -166,6 +163,8 @@ {"exceptions", NULL}, {"_warnings", _PyWarnings_Init}, + {"_io", init_io}, + /* Sentinel */ {0, 0} }; Modified: python/branches/tk_and_idle_maintenance/PCbuild/pythoncore.vcproj ============================================================================== --- python/branches/tk_and_idle_maintenance/PCbuild/pythoncore.vcproj (original) +++ python/branches/tk_and_idle_maintenance/PCbuild/pythoncore.vcproj Sat Jun 20 00:11:15 2009 @@ -999,14 +999,6 @@ > - - - - @@ -1350,6 +1342,42 @@ > + + + + + + + + + + + + + + + + + + kind = %s_kind;" % name, 1) for argtype, argname, opt in args: @@ -323,7 +323,7 @@ emit("p->%s = %s;" % (argname, argname), 1) def emit_body_struct(self, name, args, attrs): - def emit(s, depth=0, reflow=1): + def emit(s, depth=0, reflow=True): self.emit(s, depth, reflow) for argtype, argname, opt in args: emit("p->%s = %s;" % (argname, argname), 1) Deleted: python/branches/tk_and_idle_maintenance/Parser/grammar.mak ============================================================================== --- python/branches/tk_and_idle_maintenance/Parser/grammar.mak Sat Jun 20 00:11:15 2009 +++ (empty file) @@ -1,45 +0,0 @@ -# This manages to rebuild graminit.{h, c} under MSVC 6 (Windows), via -# -# nmake /f grammar.mak -# -# You may also need to copy python23.dll into this directory, or get -# it on your search path. -# -# The intermediate files can be nuked afterwards: -# -# nmake /f grammar.mak clean -# -# I don't understand the maze of preprocessor #define's on Windows, and -# as a result this requires linking with python23.lib, so it's of no use -# for bootstrapping (the cause appears to be a useless-- in this -# particular case --pragma in PC\pyconfig.h, which demands that -# python23.lib get linked in). - -LIBS= ..\PCbuild\python25.lib - -CFLAGS= /I ..\Include /I ..\PC /D MS_NO_COREDLL /D PGEN /MD - -GRAMMAR_H= ..\Include\graminit.h -GRAMMAR_C= ..\Python\graminit.c -GRAMMAR_INPUT= ..\Grammar\Grammar - -PGEN= pgen.exe - -POBJS= acceler.obj grammar1.obj listnode.obj node.obj parser.obj \ - parsetok.obj tokenizer.obj bitset.obj metagrammar.obj - -PARSER_OBJS= $(POBJS) myreadline.obj - -PGOBJS= firstsets.obj grammar.obj pgen.obj printgrammar.obj pgenmain.obj - -PGENOBJS= $(POBJS) $(PGOBJS) - -$(GRAMMAR_H) $(GRAMMAR_C): $(PGEN) $(GRAMMAR_INPUT) - $(PGEN) $(GRAMMAR_INPUT) $(GRAMMAR_H) $(GRAMMAR_C) - -$(PGEN): $(PGENOBJS) - $(CC) $(PGENOBJS) $(LIBS) /Fe$(PGEN) - -clean: - del *.obj - del $(PGEN) Modified: python/branches/tk_and_idle_maintenance/Parser/tokenizer.c ============================================================================== --- python/branches/tk_and_idle_maintenance/Parser/tokenizer.c (original) +++ python/branches/tk_and_idle_maintenance/Parser/tokenizer.c Sat Jun 20 00:11:15 2009 @@ -619,11 +619,8 @@ if (tok->enc != NULL) { assert(utf8 == NULL); utf8 = translate_into_utf8(str, tok->enc); - if (utf8 == NULL) { - PyErr_Format(PyExc_SyntaxError, - "unknown encoding: %s", tok->enc); + if (utf8 == NULL) return error_ret(tok); - } str = PyString_AsString(utf8); } #endif Modified: python/branches/tk_and_idle_maintenance/Python/Python-ast.c ============================================================================== --- python/branches/tk_and_idle_maintenance/Python/Python-ast.c (original) +++ python/branches/tk_and_idle_maintenance/Python/Python-ast.c Sat Jun 20 00:11:15 2009 @@ -2,7 +2,7 @@ /* - __version__ 62047. + __version__ 73421. This module must be committed separately after each AST grammar change; The __version__ number is set to the revision number of the commit @@ -1330,11 +1330,6 @@ col_offset, PyArena *arena) { stmt_ty p; - if (!module) { - PyErr_SetString(PyExc_ValueError, - "field module is required for ImportFrom"); - return NULL; - } p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p)); if (!p) return NULL; @@ -4273,8 +4268,7 @@ Py_XDECREF(tmp); tmp = NULL; } else { - PyErr_SetString(PyExc_TypeError, "required field \"module\" missing from ImportFrom"); - return 1; + module = NULL; } if (PyObject_HasAttrString(obj, "names")) { int res; @@ -5950,7 +5944,7 @@ if (PyDict_SetItemString(d, "AST", (PyObject*)&AST_type) < 0) return; if (PyModule_AddIntConstant(m, "PyCF_ONLY_AST", PyCF_ONLY_AST) < 0) return; - if (PyModule_AddStringConstant(m, "__version__", "62047") < 0) + if (PyModule_AddStringConstant(m, "__version__", "73421") < 0) return; if (PyDict_SetItemString(d, "mod", (PyObject*)mod_type) < 0) return; if (PyDict_SetItemString(d, "Module", (PyObject*)Module_type) < 0) Modified: python/branches/tk_and_idle_maintenance/Python/ast.c ============================================================================== --- python/branches/tk_and_idle_maintenance/Python/ast.c (original) +++ python/branches/tk_and_idle_maintenance/Python/ast.c Sat Jun 20 00:11:15 2009 @@ -402,10 +402,13 @@ s = e->v.List.elts; break; case Tuple_kind: - if (asdl_seq_LEN(e->v.Tuple.elts) == 0) - return ast_error(n, "can't assign to ()"); - e->v.Tuple.ctx = ctx; - s = e->v.Tuple.elts; + if (asdl_seq_LEN(e->v.Tuple.elts)) { + e->v.Tuple.ctx = ctx; + s = e->v.Tuple.elts; + } + else { + expr_name = "()"; + } break; case Lambda_kind: expr_name = "lambda"; @@ -1347,9 +1350,6 @@ if (TYPE(ch) == yield_expr) return ast_for_expr(c, ch); - if ((NCH(ch) > 1) && (TYPE(CHILD(ch, 1)) == gen_for)) - return ast_for_genexp(c, ch); - return ast_for_testlist_gexp(c, ch); case LSQB: /* list (or list comprehension) */ ch = CHILD(n, 1); @@ -1471,14 +1471,7 @@ ch = CHILD(n, NCH(n) - 1); if (TYPE(ch) == sliceop) { - if (NCH(ch) == 1) { - /* No expression, so step is None */ - ch = CHILD(ch, 0); - step = Name(new_identifier("None", c->c_arena), Load, - LINENO(ch), ch->n_col_offset, c->c_arena); - if (!step) - return NULL; - } else { + if (NCH(ch) != 1) { ch = CHILD(ch, 1); if (TYPE(ch) == test) { step = ast_for_expr(c, ch); @@ -2088,31 +2081,6 @@ expr1 = ast_for_testlist(c, ch); if (!expr1) return NULL; - /* TODO(nas): Remove duplicated error checks (set_context does it) */ - switch (expr1->kind) { - case GeneratorExp_kind: - ast_error(ch, "augmented assignment to generator " - "expression not possible"); - return NULL; - case Yield_kind: - ast_error(ch, "augmented assignment to yield " - "expression not possible"); - return NULL; - case Name_kind: { - const char *var_name = PyBytes_AS_STRING(expr1->v.Name.id); - if ((var_name[0] == 'N' || var_name[0] == 'T' || var_name[0] == 'F') && - !forbidden_check(c, ch, var_name)) - return NULL; - break; - } - case Attribute_kind: - case Subscript_kind: - break; - default: - ast_error(ch, "illegal expression for augmented " - "assignment"); - return NULL; - } if(!set_context(c, expr1, Store, ch)) return NULL; @@ -2179,9 +2147,9 @@ | '>>' test [ (',' test)+ [','] ] ) */ expr_ty dest = NULL, expression; - asdl_seq *seq; + asdl_seq *seq = NULL; bool nl; - int i, j, start = 1; + int i, j, values_count, start = 1; REQ(n, print_stmt); if (NCH(n) >= 2 && TYPE(CHILD(n, 1)) == RIGHTSHIFT) { @@ -2190,14 +2158,17 @@ return NULL; start = 4; } - seq = asdl_seq_new((NCH(n) + 1 - start) / 2, c->c_arena); - if (!seq) - return NULL; - for (i = start, j = 0; i < NCH(n); i += 2, ++j) { - expression = ast_for_expr(c, CHILD(n, i)); - if (!expression) + values_count = (NCH(n) + 1 - start) / 2; + if (values_count) { + seq = asdl_seq_new(values_count, c->c_arena); + if (!seq) return NULL; - asdl_seq_SET(seq, j, expression); + for (i = start, j = 0; i < NCH(n); i += 2, ++j) { + expression = ast_for_expr(c, CHILD(n, i)); + if (!expression) + return NULL; + asdl_seq_SET(seq, j, expression); + } } nl = (TYPE(CHILD(n, NCH(n) - 1)) == COMMA) ? false : true; return Print(dest, seq, nl, LINENO(n), n->n_col_offset, c->c_arena); @@ -2329,7 +2300,7 @@ } static alias_ty -alias_for_import_name(struct compiling *c, const node *n) +alias_for_import_name(struct compiling *c, const node *n, int store) { /* import_as_name: NAME ['as' NAME] @@ -2340,28 +2311,40 @@ loop: switch (TYPE(n)) { - case import_as_name: + case import_as_name: { + node *name_node = CHILD(n, 0); str = NULL; if (NCH(n) == 3) { - str = NEW_IDENTIFIER(CHILD(n, 2)); + node *str_node = CHILD(n, 2); + if (store && !forbidden_check(c, str_node, STR(str_node))) + return NULL; + str = NEW_IDENTIFIER(str_node); if (!str) return NULL; } - name = NEW_IDENTIFIER(CHILD(n, 0)); + else { + if (!forbidden_check(c, name_node, STR(name_node))) + return NULL; + } + name = NEW_IDENTIFIER(name_node); if (!name) return NULL; return alias(name, str, c->c_arena); + } case dotted_as_name: if (NCH(n) == 1) { n = CHILD(n, 0); goto loop; } else { - alias_ty a = alias_for_import_name(c, CHILD(n, 0)); + node *asname_node = CHILD(n, 2); + alias_ty a = alias_for_import_name(c, CHILD(n, 0), 0); if (!a) return NULL; assert(!a->asname); - a->asname = NEW_IDENTIFIER(CHILD(n, 2)); + if (!forbidden_check(c, asname_node, STR(asname_node))) + return NULL; + a->asname = NEW_IDENTIFIER(asname_node); if (!a->asname) return NULL; return a; @@ -2369,7 +2352,10 @@ break; case dotted_name: if (NCH(n) == 1) { - name = NEW_IDENTIFIER(CHILD(n, 0)); + node *name_node = CHILD(n, 0); + if (store && !forbidden_check(c, name_node, STR(name_node))) + return NULL; + name = NEW_IDENTIFIER(name_node); if (!name) return NULL; return alias(name, NULL, c->c_arena); @@ -2443,7 +2429,7 @@ if (!aliases) return NULL; for (i = 0; i < NCH(n); i += 2) { - alias_ty import_alias = alias_for_import_name(c, CHILD(n, i)); + alias_ty import_alias = alias_for_import_name(c, CHILD(n, i), 1); if (!import_alias) return NULL; asdl_seq_SET(aliases, i / 2, import_alias); @@ -2454,13 +2440,15 @@ int n_children; int idx, ndots = 0; alias_ty mod = NULL; - identifier modname; + identifier modname = NULL; /* Count the number of dots (for relative imports) and check for the optional module name */ for (idx = 1; idx < NCH(n); idx++) { if (TYPE(CHILD(n, idx)) == dotted_name) { - mod = alias_for_import_name(c, CHILD(n, idx)); + mod = alias_for_import_name(c, CHILD(n, idx), 0); + if (!mod) + return NULL; idx++; break; } else if (TYPE(CHILD(n, idx)) != DOT) { @@ -2501,14 +2489,14 @@ /* handle "from ... import *" special b/c there's no children */ if (TYPE(n) == STAR) { - alias_ty import_alias = alias_for_import_name(c, n); + alias_ty import_alias = alias_for_import_name(c, n, 1); if (!import_alias) return NULL; asdl_seq_SET(aliases, 0, import_alias); } else { for (i = 0; i < NCH(n); i += 2) { - alias_ty import_alias = alias_for_import_name(c, CHILD(n, i)); + alias_ty import_alias = alias_for_import_name(c, CHILD(n, i), 1); if (!import_alias) return NULL; asdl_seq_SET(aliases, i / 2, import_alias); @@ -2516,8 +2504,6 @@ } if (mod != NULL) modname = mod->name; - else - modname = new_identifier("", c->c_arena); return ImportFrom(modname, aliases, ndots, lineno, col_offset, c->c_arena); } @@ -3130,7 +3116,6 @@ n = CHILD(n, 0); } if (TYPE(n) == small_stmt) { - REQ(n, small_stmt); n = CHILD(n, 0); /* small_stmt: expr_stmt | print_stmt | del_stmt | pass_stmt | flow_stmt | import_stmt | global_stmt | exec_stmt Modified: python/branches/tk_and_idle_maintenance/Python/compile.c ============================================================================== --- python/branches/tk_and_idle_maintenance/Python/compile.c (original) +++ python/branches/tk_and_idle_maintenance/Python/compile.c Sat Jun 20 00:11:15 2009 @@ -140,7 +140,6 @@ struct compiler_unit *u; /* compiler state for current block */ PyObject *c_stack; /* Python list holding compiler_unit ptrs */ - char *c_encoding; /* source encoding (a borrowed reference) */ PyArena *c_arena; /* pointer to memory allocation arena */ }; @@ -282,9 +281,6 @@ goto finally; } - /* XXX initialize to NULL for now, need to handle */ - c.c_encoding = NULL; - co = compiler_mod(&c, mod); finally: @@ -1976,6 +1972,13 @@ PyObject *names = PyTuple_New(n); PyObject *level; + static PyObject *empty_string; + + if (!empty_string) { + empty_string = PyString_FromString(""); + if (!empty_string) + return 0; + } if (!names) return 0; @@ -1998,23 +2001,24 @@ PyTuple_SET_ITEM(names, i, alias->name); } - if (s->lineno > c->c_future->ff_lineno) { - if (!strcmp(PyString_AS_STRING(s->v.ImportFrom.module), - "__future__")) { - Py_DECREF(level); - Py_DECREF(names); - return compiler_error(c, - "from __future__ imports must occur " + if (s->lineno > c->c_future->ff_lineno && s->v.ImportFrom.module && + !strcmp(PyString_AS_STRING(s->v.ImportFrom.module), "__future__")) { + Py_DECREF(level); + Py_DECREF(names); + return compiler_error(c, "from __future__ imports must occur " "at the beginning of the file"); - - } } ADDOP_O(c, LOAD_CONST, level, consts); Py_DECREF(level); ADDOP_O(c, LOAD_CONST, names, consts); Py_DECREF(names); - ADDOP_NAME(c, IMPORT_NAME, s->v.ImportFrom.module, names); + if (s->v.ImportFrom.module) { + ADDOP_NAME(c, IMPORT_NAME, s->v.ImportFrom.module, names); + } + else { + ADDOP_NAME(c, IMPORT_NAME, empty_string, names); + } for (i = 0; i < n; i++) { alias_ty alias = (alias_ty)asdl_seq_GET(s->v.ImportFrom.names, i); identifier store_name; Modified: python/branches/tk_and_idle_maintenance/Python/errors.c ============================================================================== --- python/branches/tk_and_idle_maintenance/Python/errors.c (original) +++ python/branches/tk_and_idle_maintenance/Python/errors.c Sat Jun 20 00:11:15 2009 @@ -371,7 +371,7 @@ PyObject * -PyErr_SetFromErrnoWithFilename(PyObject *exc, char *filename) +PyErr_SetFromErrnoWithFilename(PyObject *exc, const char *filename) { PyObject *name = filename ? PyString_FromString(filename) : NULL; PyObject *result = PyErr_SetFromErrnoWithFilenameObject(exc, name); @@ -381,7 +381,7 @@ #ifdef MS_WINDOWS PyObject * -PyErr_SetFromErrnoWithUnicodeFilename(PyObject *exc, Py_UNICODE *filename) +PyErr_SetFromErrnoWithUnicodeFilename(PyObject *exc, const Py_UNICODE *filename) { PyObject *name = filename ? PyUnicode_FromUnicode(filename, wcslen(filename)) : Modified: python/branches/tk_and_idle_maintenance/Tools/msi/msi.py ============================================================================== --- python/branches/tk_and_idle_maintenance/Tools/msi/msi.py (original) +++ python/branches/tk_and_idle_maintenance/Tools/msi/msi.py Sat Jun 20 00:11:15 2009 @@ -119,7 +119,10 @@ if micro: docfile = str(micro) if level < 0xf: - docfile = '%x%s' % (level, serial) + if level == 0xC: + docfile = "rc%s" % (serial,) + else: + docfile = '%x%s' % (level, serial) docfile = 'python%s%s%s.chm' % (major, minor, docfile) # Build the mingw import library, libpythonXY.a Modified: python/branches/tk_and_idle_maintenance/configure ============================================================================== --- python/branches/tk_and_idle_maintenance/configure (original) +++ python/branches/tk_and_idle_maintenance/configure Sat Jun 20 00:11:15 2009 @@ -1,12 +1,12 @@ #! /bin/sh -# From configure.in Revision: 72871 . +# From configure.in Revision: 72898 . # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.63 for python 2.7. +# Generated by GNU Autoconf 2.61 for python 2.7. # # Report bugs to . # # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, -# 2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. +# 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. # This configure script is free software; the Free Software Foundation # gives unlimited permission to copy, distribute and modify it. ## --------------------- ## @@ -18,7 +18,7 @@ if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: - # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which + # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST @@ -40,45 +40,17 @@ as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits -as_nl=' -' -export as_nl -# Printing a long string crashes Solaris 7 /usr/bin/printf. -as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' -as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo -as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo -if (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then - as_echo='printf %s\n' - as_echo_n='printf %s' -else - if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then - as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' - as_echo_n='/usr/ucb/echo -n' - else - as_echo_body='eval expr "X$1" : "X\\(.*\\)"' - as_echo_n_body='eval - arg=$1; - case $arg in - *"$as_nl"*) - expr "X$arg" : "X\\(.*\\)$as_nl"; - arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; - esac; - expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" - ' - export as_echo_n_body - as_echo_n='sh -c $as_echo_n_body as_echo' - fi - export as_echo_body - as_echo='sh -c $as_echo_body as_echo' -fi - # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then - PATH_SEPARATOR=: - (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { - (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || - PATH_SEPARATOR=';' - } + echo "#! /bin/sh" >conf$$.sh + echo "exit 0" >>conf$$.sh + chmod +x conf$$.sh + if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then + PATH_SEPARATOR=';' + else + PATH_SEPARATOR=: + fi + rm -f conf$$.sh fi # Support unset when possible. @@ -94,6 +66,8 @@ # there to prevent editors from complaining about space-tab. # (If _AS_PATH_WALK were called with IFS unset, it would disable word # splitting by setting IFS to empty value.) +as_nl=' +' IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. @@ -116,7 +90,7 @@ as_myself=$0 fi if test ! -f "$as_myself"; then - $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 + echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 { (exit 1); exit 1; } fi @@ -129,10 +103,17 @@ PS4='+ ' # NLS nuisances. -LC_ALL=C -export LC_ALL -LANGUAGE=C -export LANGUAGE +for as_var in \ + LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ + LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ + LC_TELEPHONE LC_TIME +do + if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then + eval $as_var=C; export $as_var + else + ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var + fi +done # Required to use basename. if expr a : '\(a\)' >/dev/null 2>&1 && @@ -154,7 +135,7 @@ $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X/"$0" | +echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q @@ -180,7 +161,7 @@ as_have_required=no fi - if test $as_have_required = yes && (eval ": + if test $as_have_required = yes && (eval ": (as_func_return () { (exit \$1) } @@ -262,7 +243,7 @@ if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: - # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which + # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST @@ -283,7 +264,7 @@ if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: - # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which + # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST @@ -363,10 +344,10 @@ if test "x$CONFIG_SHELL" != x; then for as_var in BASH_ENV ENV - do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var - done - export CONFIG_SHELL - exec "$CONFIG_SHELL" "$as_myself" ${1+"$@"} + do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var + done + export CONFIG_SHELL + exec "$CONFIG_SHELL" "$as_myself" ${1+"$@"} fi @@ -435,10 +416,9 @@ test \$exitcode = 0") || { echo No shell found that supports shell functions. - echo Please tell bug-autoconf at gnu.org about your system, - echo including any error possibly output before this message. - echo This can help us improve future autoconf versions. - echo Configuration will now proceed without shell functions. + echo Please tell autoconf at gnu.org about your system, + echo including any error possibly output before this + echo message } @@ -474,7 +454,7 @@ s/-\n.*// ' >$as_me.lineno && chmod +x "$as_me.lineno" || - { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2 + { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2 { (exit 1); exit 1; }; } # Don't try to exec as it changes $[0], causing all sort of problems @@ -502,6 +482,7 @@ *) ECHO_N='-n';; esac + if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr @@ -514,22 +495,19 @@ rm -f conf$$.dir/conf$$.file else rm -f conf$$.dir - mkdir conf$$.dir 2>/dev/null + mkdir conf$$.dir fi -if (echo >conf$$.file) 2>/dev/null; then - if ln -s conf$$.file conf$$ 2>/dev/null; then - as_ln_s='ln -s' - # ... but there are two gotchas: - # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. - # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. - # In both cases, we have to default to `cp -p'. - ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || - as_ln_s='cp -p' - elif ln conf$$.file conf$$ 2>/dev/null; then - as_ln_s=ln - else +echo >conf$$.file +if ln -s conf$$.file conf$$ 2>/dev/null; then + as_ln_s='ln -s' + # ... but there are two gotchas: + # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. + # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. + # In both cases, we have to default to `cp -p'. + ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || as_ln_s='cp -p' - fi +elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln else as_ln_s='cp -p' fi @@ -554,10 +532,10 @@ as_test_x=' eval sh -c '\'' if test -d "$1"; then - test -d "$1/."; + test -d "$1/."; else case $1 in - -*)set "./$1";; + -*)set "./$1";; esac; case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in ???[sx]*):;;*)false;;esac;fi @@ -638,160 +616,128 @@ # include #endif" -ac_subst_vars='LTLIBOBJS -SRCDIRS -THREADHEADERS -UNICODE_OBJS -LIBC -LIBM -HAVE_GETHOSTBYNAME -HAVE_GETHOSTBYNAME_R -HAVE_GETHOSTBYNAME_R_3_ARG -HAVE_GETHOSTBYNAME_R_5_ARG -HAVE_GETHOSTBYNAME_R_6_ARG -LIBOBJS -TRUE -MACHDEP_OBJS -DYNLOADFILE -DLINCLDIR -THREADOBJ -LDLAST -USE_THREAD_MODULE -SIGNAL_OBJS -USE_SIGNAL_MODULE -SHLIBS -CFLAGSFORSHARED -LINKFORSHARED -CCSHARED -BLDSHARED -LDSHARED -SO -LIBTOOL_CRUFT -OTHER_LIBTOOL_OPT -UNIVERSAL_ARCH_FLAGS -BASECFLAGS -OPT -LN -INSTALL_DATA -INSTALL_SCRIPT -INSTALL_PROGRAM -SVNVERSION -ARFLAGS -AR -RANLIB -GNULD -LINKCC -RUNSHARED -INSTSONAME -LDLIBRARYDIR -BLDLIBRARY -DLLLIBRARY -LDLIBRARY -LIBRARY -BUILDEXEEXT -EGREP -GREP -CPP -MAINCC -CXX -OBJEXT -EXEEXT -ac_ct_CC -CPPFLAGS -LDFLAGS -CFLAGS -CC -EXPORT_MACOSX_DEPLOYMENT_TARGET -CONFIGURE_MACOSX_DEPLOYMENT_TARGET -EXTRAMACHDEPPATH -EXTRAPLATDIR -SGI_ABI -MACHDEP -FRAMEWORKUNIXTOOLSPREFIX -FRAMEWORKALTINSTALLLAST -FRAMEWORKALTINSTALLFIRST -FRAMEWORKINSTALLLAST -FRAMEWORKINSTALLFIRST -PYTHONFRAMEWORKINSTALLDIR -PYTHONFRAMEWORKPREFIX -PYTHONFRAMEWORKDIR -PYTHONFRAMEWORKIDENTIFIER -PYTHONFRAMEWORK -ARCH_RUN_32BIT -UNIVERSALSDK -CONFIG_ARGS -SOVERSION -VERSION -target_alias -host_alias -build_alias -LIBS -ECHO_T -ECHO_N -ECHO_C -DEFS -mandir -localedir -libdir -psdir -pdfdir -dvidir -htmldir -infodir -docdir -oldincludedir -includedir -localstatedir -sharedstatedir -sysconfdir -datadir -datarootdir -libexecdir -sbindir -bindir -program_transform_name -prefix -exec_prefix -PACKAGE_BUGREPORT -PACKAGE_STRING -PACKAGE_VERSION -PACKAGE_TARNAME -PACKAGE_NAME +ac_subst_vars='SHELL PATH_SEPARATOR -SHELL' +PACKAGE_NAME +PACKAGE_TARNAME +PACKAGE_VERSION +PACKAGE_STRING +PACKAGE_BUGREPORT +exec_prefix +prefix +program_transform_name +bindir +sbindir +libexecdir +datarootdir +datadir +sysconfdir +sharedstatedir +localstatedir +includedir +oldincludedir +docdir +infodir +htmldir +dvidir +pdfdir +psdir +libdir +localedir +mandir +DEFS +ECHO_C +ECHO_N +ECHO_T +LIBS +build_alias +host_alias +target_alias +VERSION +SOVERSION +CONFIG_ARGS +UNIVERSALSDK +ARCH_RUN_32BIT +PYTHONFRAMEWORK +PYTHONFRAMEWORKIDENTIFIER +PYTHONFRAMEWORKDIR +PYTHONFRAMEWORKPREFIX +PYTHONFRAMEWORKINSTALLDIR +FRAMEWORKINSTALLFIRST +FRAMEWORKINSTALLLAST +FRAMEWORKALTINSTALLFIRST +FRAMEWORKALTINSTALLLAST +FRAMEWORKUNIXTOOLSPREFIX +MACHDEP +SGI_ABI +EXTRAPLATDIR +EXTRAMACHDEPPATH +CONFIGURE_MACOSX_DEPLOYMENT_TARGET +EXPORT_MACOSX_DEPLOYMENT_TARGET +CC +CFLAGS +LDFLAGS +CPPFLAGS +ac_ct_CC +EXEEXT +OBJEXT +CXX +MAINCC +CPP +GREP +EGREP +BUILDEXEEXT +LIBRARY +LDLIBRARY +DLLLIBRARY +BLDLIBRARY +LDLIBRARYDIR +INSTSONAME +RUNSHARED +LINKCC +GNULD +RANLIB +AR +ARFLAGS +SVNVERSION +INSTALL_PROGRAM +INSTALL_SCRIPT +INSTALL_DATA +LN +OPT +BASECFLAGS +UNIVERSAL_ARCH_FLAGS +OTHER_LIBTOOL_OPT +LIBTOOL_CRUFT +SO +LDSHARED +BLDSHARED +CCSHARED +LINKFORSHARED +CFLAGSFORSHARED +SHLIBS +USE_SIGNAL_MODULE +SIGNAL_OBJS +USE_THREAD_MODULE +LDLAST +THREADOBJ +DLINCLDIR +DYNLOADFILE +MACHDEP_OBJS +TRUE +LIBOBJS +HAVE_GETHOSTBYNAME_R_6_ARG +HAVE_GETHOSTBYNAME_R_5_ARG +HAVE_GETHOSTBYNAME_R_3_ARG +HAVE_GETHOSTBYNAME_R +HAVE_GETHOSTBYNAME +LIBM +LIBC +UNICODE_OBJS +THREADHEADERS +SRCDIRS +LTLIBOBJS' ac_subst_files='' -ac_user_opts=' -enable_option_checking -enable_universalsdk -with_universal_archs -with_framework_name -enable_framework -with_gcc -with_cxx_main -with_suffix -enable_shared -enable_profiling -with_pydebug -enable_toolbox_glue -with_libs -with_system_ffi -with_dbmliborder -with_signal_module -with_dec_threads -with_threads -with_thread -with_pth -enable_ipv6 -with_doc_strings -with_tsc -with_pymalloc -with_wctype_functions -with_fpectl -with_libm -with_libc -enable_big_digits -enable_unicode -' ac_precious_vars='build_alias host_alias target_alias @@ -806,8 +752,6 @@ # Initialize some variables set by options. ac_init_help= ac_init_version=false -ac_unrecognized_opts= -ac_unrecognized_sep= # The variables have the same names as the options, with # dashes changed to underlines. cache_file=/dev/null @@ -906,21 +850,13 @@ datarootdir=$ac_optarg ;; -disable-* | --disable-*) - ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'` + ac_feature=`expr "x$ac_option" : 'x-*disable-\(.*\)'` # Reject names that are not valid shell variable names. - expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && - { $as_echo "$as_me: error: invalid feature name: $ac_useropt" >&2 + expr "x$ac_feature" : ".*[^-._$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid feature name: $ac_feature" >&2 { (exit 1); exit 1; }; } - ac_useropt_orig=$ac_useropt - ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` - case $ac_user_opts in - *" -"enable_$ac_useropt" -"*) ;; - *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--disable-$ac_useropt_orig" - ac_unrecognized_sep=', ';; - esac - eval enable_$ac_useropt=no ;; + ac_feature=`echo $ac_feature | sed 's/[-.]/_/g'` + eval enable_$ac_feature=no ;; -docdir | --docdir | --docdi | --doc | --do) ac_prev=docdir ;; @@ -933,21 +869,13 @@ dvidir=$ac_optarg ;; -enable-* | --enable-*) - ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` + ac_feature=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` # Reject names that are not valid shell variable names. - expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && - { $as_echo "$as_me: error: invalid feature name: $ac_useropt" >&2 + expr "x$ac_feature" : ".*[^-._$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid feature name: $ac_feature" >&2 { (exit 1); exit 1; }; } - ac_useropt_orig=$ac_useropt - ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` - case $ac_user_opts in - *" -"enable_$ac_useropt" -"*) ;; - *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--enable-$ac_useropt_orig" - ac_unrecognized_sep=', ';; - esac - eval enable_$ac_useropt=\$ac_optarg ;; + ac_feature=`echo $ac_feature | sed 's/[-.]/_/g'` + eval enable_$ac_feature=\$ac_optarg ;; -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ @@ -1138,38 +1066,22 @@ ac_init_version=: ;; -with-* | --with-*) - ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` + ac_package=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` # Reject names that are not valid shell variable names. - expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && - { $as_echo "$as_me: error: invalid package name: $ac_useropt" >&2 + expr "x$ac_package" : ".*[^-._$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid package name: $ac_package" >&2 { (exit 1); exit 1; }; } - ac_useropt_orig=$ac_useropt - ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` - case $ac_user_opts in - *" -"with_$ac_useropt" -"*) ;; - *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--with-$ac_useropt_orig" - ac_unrecognized_sep=', ';; - esac - eval with_$ac_useropt=\$ac_optarg ;; + ac_package=`echo $ac_package | sed 's/[-.]/_/g'` + eval with_$ac_package=\$ac_optarg ;; -without-* | --without-*) - ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'` + ac_package=`expr "x$ac_option" : 'x-*without-\(.*\)'` # Reject names that are not valid shell variable names. - expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && - { $as_echo "$as_me: error: invalid package name: $ac_useropt" >&2 + expr "x$ac_package" : ".*[^-._$as_cr_alnum]" >/dev/null && + { echo "$as_me: error: invalid package name: $ac_package" >&2 { (exit 1); exit 1; }; } - ac_useropt_orig=$ac_useropt - ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` - case $ac_user_opts in - *" -"with_$ac_useropt" -"*) ;; - *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--without-$ac_useropt_orig" - ac_unrecognized_sep=', ';; - esac - eval with_$ac_useropt=no ;; + ac_package=`echo $ac_package | sed 's/[-.]/_/g'` + eval with_$ac_package=no ;; --x) # Obsolete; use --with-x. @@ -1189,7 +1101,7 @@ | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) x_libraries=$ac_optarg ;; - -*) { $as_echo "$as_me: error: unrecognized option: $ac_option + -*) { echo "$as_me: error: unrecognized option: $ac_option Try \`$0 --help' for more information." >&2 { (exit 1); exit 1; }; } ;; @@ -1198,16 +1110,16 @@ ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` # Reject names that are not valid shell variable names. expr "x$ac_envvar" : ".*[^_$as_cr_alnum]" >/dev/null && - { $as_echo "$as_me: error: invalid variable name: $ac_envvar" >&2 + { echo "$as_me: error: invalid variable name: $ac_envvar" >&2 { (exit 1); exit 1; }; } eval $ac_envvar=\$ac_optarg export $ac_envvar ;; *) # FIXME: should be removed in autoconf 3.0. - $as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2 + echo "$as_me: WARNING: you should use --build, --host, --target" >&2 expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && - $as_echo "$as_me: WARNING: invalid host type: $ac_option" >&2 + echo "$as_me: WARNING: invalid host type: $ac_option" >&2 : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option} ;; @@ -1216,38 +1128,22 @@ if test -n "$ac_prev"; then ac_option=--`echo $ac_prev | sed 's/_/-/g'` - { $as_echo "$as_me: error: missing argument to $ac_option" >&2 + { echo "$as_me: error: missing argument to $ac_option" >&2 { (exit 1); exit 1; }; } fi -if test -n "$ac_unrecognized_opts"; then - case $enable_option_checking in - no) ;; - fatal) { $as_echo "$as_me: error: unrecognized options: $ac_unrecognized_opts" >&2 - { (exit 1); exit 1; }; } ;; - *) $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;; - esac -fi - -# Check all directory arguments for consistency. +# Be sure to have absolute directory names. for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ datadir sysconfdir sharedstatedir localstatedir includedir \ oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ libdir localedir mandir do eval ac_val=\$$ac_var - # Remove trailing slashes. - case $ac_val in - */ ) - ac_val=`expr "X$ac_val" : 'X\(.*[^/]\)' \| "X$ac_val" : 'X\(.*\)'` - eval $ac_var=\$ac_val;; - esac - # Be sure to have absolute directory names. case $ac_val in [\\/$]* | ?:[\\/]* ) continue;; NONE | '' ) case $ac_var in *prefix ) continue;; esac;; esac - { $as_echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 + { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 { (exit 1); exit 1; }; } done @@ -1262,7 +1158,7 @@ if test "x$host_alias" != x; then if test "x$build_alias" = x; then cross_compiling=maybe - $as_echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host. + echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host. If a cross compiler is detected then cross compile mode will be used." >&2 elif test "x$build_alias" != "x$host_alias"; then cross_compiling=yes @@ -1278,10 +1174,10 @@ ac_pwd=`pwd` && test -n "$ac_pwd" && ac_ls_di=`ls -di .` && ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` || - { $as_echo "$as_me: error: working directory cannot be determined" >&2 + { echo "$as_me: error: Working directory cannot be determined" >&2 { (exit 1); exit 1; }; } test "X$ac_ls_di" = "X$ac_pwd_ls_di" || - { $as_echo "$as_me: error: pwd does not report name of working directory" >&2 + { echo "$as_me: error: pwd does not report name of working directory" >&2 { (exit 1); exit 1; }; } @@ -1289,12 +1185,12 @@ if test -z "$srcdir"; then ac_srcdir_defaulted=yes # Try the directory containing this script, then the parent directory. - ac_confdir=`$as_dirname -- "$as_myself" || -$as_expr X"$as_myself" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$as_myself" : 'X\(//\)[^/]' \| \ - X"$as_myself" : 'X\(//\)$' \| \ - X"$as_myself" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X"$as_myself" | + ac_confdir=`$as_dirname -- "$0" || +$as_expr X"$0" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$0" : 'X\(//\)[^/]' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)' \| . 2>/dev/null || +echo X"$0" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q @@ -1321,12 +1217,12 @@ fi if test ! -r "$srcdir/$ac_unique_file"; then test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .." - { $as_echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2 + { echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2 { (exit 1); exit 1; }; } fi ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work" ac_abs_confdir=`( - cd "$srcdir" && test -r "./$ac_unique_file" || { $as_echo "$as_me: error: $ac_msg" >&2 + cd "$srcdir" && test -r "./$ac_unique_file" || { echo "$as_me: error: $ac_msg" >&2 { (exit 1); exit 1; }; } pwd)` # When building in place, set srcdir=. @@ -1375,9 +1271,9 @@ Installation directories: --prefix=PREFIX install architecture-independent files in PREFIX - [$ac_default_prefix] + [$ac_default_prefix] --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX - [PREFIX] + [PREFIX] By default, \`make install' will install all the files in \`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify @@ -1387,25 +1283,25 @@ For better control, use the options below. Fine tuning of the installation directories: - --bindir=DIR user executables [EPREFIX/bin] - --sbindir=DIR system admin executables [EPREFIX/sbin] - --libexecdir=DIR program executables [EPREFIX/libexec] - --sysconfdir=DIR read-only single-machine data [PREFIX/etc] - --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] - --localstatedir=DIR modifiable single-machine data [PREFIX/var] - --libdir=DIR object code libraries [EPREFIX/lib] - --includedir=DIR C header files [PREFIX/include] - --oldincludedir=DIR C header files for non-gcc [/usr/include] - --datarootdir=DIR read-only arch.-independent data root [PREFIX/share] - --datadir=DIR read-only architecture-independent data [DATAROOTDIR] - --infodir=DIR info documentation [DATAROOTDIR/info] - --localedir=DIR locale-dependent data [DATAROOTDIR/locale] - --mandir=DIR man documentation [DATAROOTDIR/man] - --docdir=DIR documentation root [DATAROOTDIR/doc/python] - --htmldir=DIR html documentation [DOCDIR] - --dvidir=DIR dvi documentation [DOCDIR] - --pdfdir=DIR pdf documentation [DOCDIR] - --psdir=DIR ps documentation [DOCDIR] + --bindir=DIR user executables [EPREFIX/bin] + --sbindir=DIR system admin executables [EPREFIX/sbin] + --libexecdir=DIR program executables [EPREFIX/libexec] + --sysconfdir=DIR read-only single-machine data [PREFIX/etc] + --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] + --localstatedir=DIR modifiable single-machine data [PREFIX/var] + --libdir=DIR object code libraries [EPREFIX/lib] + --includedir=DIR C header files [PREFIX/include] + --oldincludedir=DIR C header files for non-gcc [/usr/include] + --datarootdir=DIR read-only arch.-independent data root [PREFIX/share] + --datadir=DIR read-only architecture-independent data [DATAROOTDIR] + --infodir=DIR info documentation [DATAROOTDIR/info] + --localedir=DIR locale-dependent data [DATAROOTDIR/locale] + --mandir=DIR man documentation [DATAROOTDIR/man] + --docdir=DIR documentation root [DATAROOTDIR/doc/python] + --htmldir=DIR html documentation [DOCDIR] + --dvidir=DIR dvi documentation [DOCDIR] + --pdfdir=DIR pdf documentation [DOCDIR] + --psdir=DIR ps documentation [DOCDIR] _ACEOF cat <<\_ACEOF @@ -1419,7 +1315,6 @@ cat <<\_ACEOF Optional Features: - --disable-option-checking ignore unrecognized --enable/--with options --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) --enable-FEATURE[=ARG] include FEATURE [ARG=yes] --enable-universalsdk[=SDKDIR] @@ -1493,17 +1388,15 @@ if test "$ac_init_help" = "recursive"; then # If there are subdirs, report their specific --help. for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue - test -d "$ac_dir" || - { cd "$srcdir" && ac_pwd=`pwd` && srcdir=. && test -d "$ac_dir"; } || - continue + test -d "$ac_dir" || continue ac_builddir=. case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) - ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` + ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` # A ".." for each directory in $ac_dir_suffix. - ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` + ac_top_builddir_sub=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,/..,g;s,/,,'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; @@ -1539,7 +1432,7 @@ echo && $SHELL "$ac_srcdir/configure" --help=recursive else - $as_echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 + echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 fi || ac_status=$? cd "$ac_pwd" || { ac_status=$?; break; } done @@ -1549,10 +1442,10 @@ if $ac_init_version; then cat <<\_ACEOF python configure 2.7 -generated by GNU Autoconf 2.63 +generated by GNU Autoconf 2.61 Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, -2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. +2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. This configure script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. _ACEOF @@ -1563,7 +1456,7 @@ running configure, to aid debugging if configure makes a mistake. It was created by python $as_me 2.7, which was -generated by GNU Autoconf 2.63. Invocation command line was +generated by GNU Autoconf 2.61. Invocation command line was $ $0 $@ @@ -1599,7 +1492,7 @@ do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. - $as_echo "PATH: $as_dir" + echo "PATH: $as_dir" done IFS=$as_save_IFS @@ -1634,7 +1527,7 @@ | -silent | --silent | --silen | --sile | --sil) continue ;; *\'*) - ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; + ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; esac case $ac_pass in 1) ac_configure_args0="$ac_configure_args0 '$ac_arg'" ;; @@ -1686,12 +1579,11 @@ case $ac_val in #( *${as_nl}*) case $ac_var in #( - *_cv_*) { $as_echo "$as_me:$LINENO: WARNING: cache variable $ac_var contains a newline" >&5 -$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; + *_cv_*) { echo "$as_me:$LINENO: WARNING: Cache variable $ac_var contains a newline." >&5 +echo "$as_me: WARNING: Cache variable $ac_var contains a newline." >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( - BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( *) $as_unset $ac_var ;; esac ;; esac @@ -1721,9 +1613,9 @@ do eval ac_val=\$$ac_var case $ac_val in - *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; + *\'\''*) ac_val=`echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac - $as_echo "$ac_var='\''$ac_val'\''" + echo "$ac_var='\''$ac_val'\''" done | sort echo @@ -1738,9 +1630,9 @@ do eval ac_val=\$$ac_var case $ac_val in - *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; + *\'\''*) ac_val=`echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac - $as_echo "$ac_var='\''$ac_val'\''" + echo "$ac_var='\''$ac_val'\''" done | sort echo fi @@ -1756,8 +1648,8 @@ echo fi test "$ac_signal" != 0 && - $as_echo "$as_me: caught signal $ac_signal" - $as_echo "$as_me: exit $exit_status" + echo "$as_me: caught signal $ac_signal" + echo "$as_me: exit $exit_status" } >&5 rm -f core *.core core.conftest.* && rm -f -r conftest* confdefs* conf$$* $ac_clean_files && @@ -1799,24 +1691,21 @@ # Let the site file select an alternate cache file if it wants to. -# Prefer an explicitly selected file to automatically selected ones. -ac_site_file1=NONE -ac_site_file2=NONE +# Prefer explicitly selected file to automatically selected ones. if test -n "$CONFIG_SITE"; then - ac_site_file1=$CONFIG_SITE + set x "$CONFIG_SITE" elif test "x$prefix" != xNONE; then - ac_site_file1=$prefix/share/config.site - ac_site_file2=$prefix/etc/config.site + set x "$prefix/share/config.site" "$prefix/etc/config.site" else - ac_site_file1=$ac_default_prefix/share/config.site - ac_site_file2=$ac_default_prefix/etc/config.site + set x "$ac_default_prefix/share/config.site" \ + "$ac_default_prefix/etc/config.site" fi -for ac_site_file in "$ac_site_file1" "$ac_site_file2" +shift +for ac_site_file do - test "x$ac_site_file" = xNONE && continue if test -r "$ac_site_file"; then - { $as_echo "$as_me:$LINENO: loading site script $ac_site_file" >&5 -$as_echo "$as_me: loading site script $ac_site_file" >&6;} + { echo "$as_me:$LINENO: loading site script $ac_site_file" >&5 +echo "$as_me: loading site script $ac_site_file" >&6;} sed 's/^/| /' "$ac_site_file" >&5 . "$ac_site_file" fi @@ -1826,16 +1715,16 @@ # Some versions of bash will fail to source /dev/null (special # files actually), so we avoid doing that. if test -f "$cache_file"; then - { $as_echo "$as_me:$LINENO: loading cache $cache_file" >&5 -$as_echo "$as_me: loading cache $cache_file" >&6;} + { echo "$as_me:$LINENO: loading cache $cache_file" >&5 +echo "$as_me: loading cache $cache_file" >&6;} case $cache_file in [\\/]* | ?:[\\/]* ) . "$cache_file";; *) . "./$cache_file";; esac fi else - { $as_echo "$as_me:$LINENO: creating cache $cache_file" >&5 -$as_echo "$as_me: creating cache $cache_file" >&6;} + { echo "$as_me:$LINENO: creating cache $cache_file" >&5 +echo "$as_me: creating cache $cache_file" >&6;} >$cache_file fi @@ -1849,38 +1738,29 @@ eval ac_new_val=\$ac_env_${ac_var}_value case $ac_old_set,$ac_new_set in set,) - { $as_echo "$as_me:$LINENO: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 -$as_echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} + { echo "$as_me:$LINENO: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 +echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} ac_cache_corrupted=: ;; ,set) - { $as_echo "$as_me:$LINENO: error: \`$ac_var' was not set in the previous run" >&5 -$as_echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} + { echo "$as_me:$LINENO: error: \`$ac_var' was not set in the previous run" >&5 +echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} ac_cache_corrupted=: ;; ,);; *) if test "x$ac_old_val" != "x$ac_new_val"; then - # differences in whitespace do not lead to failure. - ac_old_val_w=`echo x $ac_old_val` - ac_new_val_w=`echo x $ac_new_val` - if test "$ac_old_val_w" != "$ac_new_val_w"; then - { $as_echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5 -$as_echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} - ac_cache_corrupted=: - else - { $as_echo "$as_me:$LINENO: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5 -$as_echo "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;} - eval $ac_var=\$ac_old_val - fi - { $as_echo "$as_me:$LINENO: former value: \`$ac_old_val'" >&5 -$as_echo "$as_me: former value: \`$ac_old_val'" >&2;} - { $as_echo "$as_me:$LINENO: current value: \`$ac_new_val'" >&5 -$as_echo "$as_me: current value: \`$ac_new_val'" >&2;} + { echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5 +echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} + { echo "$as_me:$LINENO: former value: $ac_old_val" >&5 +echo "$as_me: former value: $ac_old_val" >&2;} + { echo "$as_me:$LINENO: current value: $ac_new_val" >&5 +echo "$as_me: current value: $ac_new_val" >&2;} + ac_cache_corrupted=: fi;; esac # Pass precious variables to config.status. if test "$ac_new_set" = set; then case $ac_new_val in - *\'*) ac_arg=$ac_var=`$as_echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; + *\'*) ac_arg=$ac_var=`echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; *) ac_arg=$ac_var=$ac_new_val ;; esac case " $ac_configure_args " in @@ -1890,12 +1770,10 @@ fi done if $ac_cache_corrupted; then - { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} - { $as_echo "$as_me:$LINENO: error: changes in the environment can compromise the build" >&5 -$as_echo "$as_me: error: changes in the environment can compromise the build" >&2;} - { { $as_echo "$as_me:$LINENO: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5 -$as_echo "$as_me: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&2;} + { echo "$as_me:$LINENO: error: changes in the environment can compromise the build" >&5 +echo "$as_me: error: changes in the environment can compromise the build" >&2;} + { { echo "$as_me:$LINENO: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5 +echo "$as_me: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&2;} { (exit 1); exit 1; }; } fi @@ -2037,20 +1915,20 @@ UNIVERSAL_ARCHS="32-bit" -{ $as_echo "$as_me:$LINENO: checking for --with-universal-archs" >&5 -$as_echo_n "checking for --with-universal-archs... " >&6; } +{ echo "$as_me:$LINENO: checking for --with-universal-archs" >&5 +echo $ECHO_N "checking for --with-universal-archs... $ECHO_C" >&6; } # Check whether --with-universal-archs was given. if test "${with_universal_archs+set}" = set; then withval=$with_universal_archs; - { $as_echo "$as_me:$LINENO: result: $withval" >&5 -$as_echo "$withval" >&6; } + { echo "$as_me:$LINENO: result: $withval" >&5 +echo "${ECHO_T}$withval" >&6; } UNIVERSAL_ARCHS="$withval" else - { $as_echo "$as_me:$LINENO: result: 32-bit" >&5 -$as_echo "32-bit" >&6; } + { echo "$as_me:$LINENO: result: 32-bit" >&5 +echo "${ECHO_T}32-bit" >&6; } fi @@ -2174,8 +2052,8 @@ ## # Set name for machine-dependent library files -{ $as_echo "$as_me:$LINENO: checking MACHDEP" >&5 -$as_echo_n "checking MACHDEP... " >&6; } +{ echo "$as_me:$LINENO: checking MACHDEP" >&5 +echo $ECHO_N "checking MACHDEP... $ECHO_C" >&6; } if test -z "$MACHDEP" then ac_sys_system=`uname -s` @@ -2338,14 +2216,14 @@ LDFLAGS="$SGI_ABI $LDFLAGS" MACHDEP=`echo "${MACHDEP}${SGI_ABI}" | sed 's/ *//g'` fi -{ $as_echo "$as_me:$LINENO: result: $MACHDEP" >&5 -$as_echo "$MACHDEP" >&6; } +{ echo "$as_me:$LINENO: result: $MACHDEP" >&5 +echo "${ECHO_T}$MACHDEP" >&6; } # And add extra plat-mac for darwin -{ $as_echo "$as_me:$LINENO: checking EXTRAPLATDIR" >&5 -$as_echo_n "checking EXTRAPLATDIR... " >&6; } +{ echo "$as_me:$LINENO: checking EXTRAPLATDIR" >&5 +echo $ECHO_N "checking EXTRAPLATDIR... $ECHO_C" >&6; } if test -z "$EXTRAPLATDIR" then case $MACHDEP in @@ -2359,8 +2237,8 @@ ;; esac fi -{ $as_echo "$as_me:$LINENO: result: $EXTRAPLATDIR" >&5 -$as_echo "$EXTRAPLATDIR" >&6; } +{ echo "$as_me:$LINENO: result: $EXTRAPLATDIR" >&5 +echo "${ECHO_T}$EXTRAPLATDIR" >&6; } # Record the configure-time value of MACOSX_DEPLOYMENT_TARGET, # it may influence the way we can build extensions, so distutils @@ -2370,11 +2248,11 @@ CONFIGURE_MACOSX_DEPLOYMENT_TARGET= EXPORT_MACOSX_DEPLOYMENT_TARGET='#' -{ $as_echo "$as_me:$LINENO: checking machine type as reported by uname -m" >&5 -$as_echo_n "checking machine type as reported by uname -m... " >&6; } +{ echo "$as_me:$LINENO: checking machine type as reported by uname -m" >&5 +echo $ECHO_N "checking machine type as reported by uname -m... $ECHO_C" >&6; } ac_sys_machine=`uname -m` -{ $as_echo "$as_me:$LINENO: result: $ac_sys_machine" >&5 -$as_echo "$ac_sys_machine" >&6; } +{ echo "$as_me:$LINENO: result: $ac_sys_machine" >&5 +echo "${ECHO_T}$ac_sys_machine" >&6; } # checks for alternative programs @@ -2386,8 +2264,8 @@ # XXX shouldn't some/most/all of this code be merged with the stuff later # on that fiddles with OPT and BASECFLAGS? -{ $as_echo "$as_me:$LINENO: checking for --without-gcc" >&5 -$as_echo_n "checking for --without-gcc... " >&6; } +{ echo "$as_me:$LINENO: checking for --without-gcc" >&5 +echo $ECHO_N "checking for --without-gcc... $ECHO_C" >&6; } # Check whether --with-gcc was given. if test "${with_gcc+set}" = set; then @@ -2420,8 +2298,8 @@ OPT="$OPT -O" ;; *) - { { $as_echo "$as_me:$LINENO: error: Unknown BeOS platform \"$BE_HOST_CPU\"" >&5 -$as_echo "$as_me: error: Unknown BeOS platform \"$BE_HOST_CPU\"" >&2;} + { { echo "$as_me:$LINENO: error: Unknown BeOS platform \"$BE_HOST_CPU\"" >&5 +echo "$as_me: error: Unknown BeOS platform \"$BE_HOST_CPU\"" >&2;} { (exit 1); exit 1; }; } ;; esac @@ -2435,15 +2313,15 @@ esac fi -{ $as_echo "$as_me:$LINENO: result: $without_gcc" >&5 -$as_echo "$without_gcc" >&6; } +{ echo "$as_me:$LINENO: result: $without_gcc" >&5 +echo "${ECHO_T}$without_gcc" >&6; } # If the user switches compilers, we can't believe the cache if test ! -z "$ac_cv_prog_CC" -a ! -z "$CC" -a "$CC" != "$ac_cv_prog_CC" then - { { $as_echo "$as_me:$LINENO: error: cached CC is different -- throw away $cache_file + { { echo "$as_me:$LINENO: error: cached CC is different -- throw away $cache_file (it is also a good idea to do 'make clean' before compiling)" >&5 -$as_echo "$as_me: error: cached CC is different -- throw away $cache_file +echo "$as_me: error: cached CC is different -- throw away $cache_file (it is also a good idea to do 'make clean' before compiling)" >&2;} { (exit 1); exit 1; }; } fi @@ -2456,10 +2334,10 @@ if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. set dummy ${ac_tool_prefix}gcc; ac_word=$2 -{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } if test "${ac_cv_prog_CC+set}" = set; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. @@ -2472,7 +2350,7 @@ for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CC="${ac_tool_prefix}gcc" - $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -2483,11 +2361,11 @@ fi CC=$ac_cv_prog_CC if test -n "$CC"; then - { $as_echo "$as_me:$LINENO: result: $CC" >&5 -$as_echo "$CC" >&6; } + { echo "$as_me:$LINENO: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6; } else - { $as_echo "$as_me:$LINENO: result: no" >&5 -$as_echo "no" >&6; } + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } fi @@ -2496,10 +2374,10 @@ ac_ct_CC=$CC # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 -{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } if test "${ac_cv_prog_ac_ct_CC+set}" = set; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. @@ -2512,7 +2390,7 @@ for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_CC="gcc" - $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -2523,11 +2401,11 @@ fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then - { $as_echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 -$as_echo "$ac_ct_CC" >&6; } + { echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 +echo "${ECHO_T}$ac_ct_CC" >&6; } else - { $as_echo "$as_me:$LINENO: result: no" >&5 -$as_echo "no" >&6; } + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } fi if test "x$ac_ct_CC" = x; then @@ -2535,8 +2413,12 @@ else case $cross_compiling:$ac_tool_warned in yes:) -{ $as_echo "$as_me:$LINENO: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools +whose name does not start with the host triplet. If you think this +configuration is useful to you, please write to autoconf at gnu.org." >&5 +echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools +whose name does not start with the host triplet. If you think this +configuration is useful to you, please write to autoconf at gnu.org." >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC @@ -2549,10 +2431,10 @@ if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. set dummy ${ac_tool_prefix}cc; ac_word=$2 -{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } if test "${ac_cv_prog_CC+set}" = set; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. @@ -2565,7 +2447,7 @@ for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CC="${ac_tool_prefix}cc" - $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -2576,11 +2458,11 @@ fi CC=$ac_cv_prog_CC if test -n "$CC"; then - { $as_echo "$as_me:$LINENO: result: $CC" >&5 -$as_echo "$CC" >&6; } + { echo "$as_me:$LINENO: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6; } else - { $as_echo "$as_me:$LINENO: result: no" >&5 -$as_echo "no" >&6; } + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } fi @@ -2589,10 +2471,10 @@ if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 -{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } if test "${ac_cv_prog_CC+set}" = set; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. @@ -2610,7 +2492,7 @@ continue fi ac_cv_prog_CC="cc" - $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -2633,11 +2515,11 @@ fi CC=$ac_cv_prog_CC if test -n "$CC"; then - { $as_echo "$as_me:$LINENO: result: $CC" >&5 -$as_echo "$CC" >&6; } + { echo "$as_me:$LINENO: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6; } else - { $as_echo "$as_me:$LINENO: result: no" >&5 -$as_echo "no" >&6; } + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } fi @@ -2648,10 +2530,10 @@ do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 -{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } if test "${ac_cv_prog_CC+set}" = set; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. @@ -2664,7 +2546,7 @@ for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CC="$ac_tool_prefix$ac_prog" - $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -2675,11 +2557,11 @@ fi CC=$ac_cv_prog_CC if test -n "$CC"; then - { $as_echo "$as_me:$LINENO: result: $CC" >&5 -$as_echo "$CC" >&6; } + { echo "$as_me:$LINENO: result: $CC" >&5 +echo "${ECHO_T}$CC" >&6; } else - { $as_echo "$as_me:$LINENO: result: no" >&5 -$as_echo "no" >&6; } + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } fi @@ -2692,10 +2574,10 @@ do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 -{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } if test "${ac_cv_prog_ac_ct_CC+set}" = set; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. @@ -2708,7 +2590,7 @@ for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_CC="$ac_prog" - $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -2719,11 +2601,11 @@ fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then - { $as_echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 -$as_echo "$ac_ct_CC" >&6; } + { echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 +echo "${ECHO_T}$ac_ct_CC" >&6; } else - { $as_echo "$as_me:$LINENO: result: no" >&5 -$as_echo "no" >&6; } + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } fi @@ -2735,8 +2617,12 @@ else case $cross_compiling:$ac_tool_warned in yes:) -{ $as_echo "$as_me:$LINENO: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools +whose name does not start with the host triplet. If you think this +configuration is useful to you, please write to autoconf at gnu.org." >&5 +echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools +whose name does not start with the host triplet. If you think this +configuration is useful to you, please write to autoconf at gnu.org." >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC @@ -2746,50 +2632,44 @@ fi -test -z "$CC" && { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -{ { $as_echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH +test -z "$CC" && { { echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH See \`config.log' for more details." >&5 -$as_echo "$as_me: error: no acceptable C compiler found in \$PATH +echo "$as_me: error: no acceptable C compiler found in \$PATH See \`config.log' for more details." >&2;} - { (exit 1); exit 1; }; }; } + { (exit 1); exit 1; }; } # Provide some information about the compiler. -$as_echo "$as_me:$LINENO: checking for C compiler version" >&5 -set X $ac_compile -ac_compiler=$2 +echo "$as_me:$LINENO: checking for C compiler version" >&5 +ac_compiler=`set X $ac_compile; echo $2` { (ac_try="$ac_compiler --version >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compiler --version >&5") 2>&5 ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } { (ac_try="$ac_compiler -v >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compiler -v >&5") 2>&5 ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } { (ac_try="$ac_compiler -V >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compiler -V >&5") 2>&5 ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } cat >conftest.$ac_ext <<_ACEOF @@ -2808,22 +2688,27 @@ } _ACEOF ac_clean_files_save=$ac_clean_files -ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out" +ac_clean_files="$ac_clean_files a.out a.exe b.out" # Try to create an executable without -o first, disregard a.out. # It will help us diagnose broken compilers, and finding out an intuition # of exeext. -{ $as_echo "$as_me:$LINENO: checking for C compiler default output file name" >&5 -$as_echo_n "checking for C compiler default output file name... " >&6; } -ac_link_default=`$as_echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` - -# The possible output files: -ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*" - +{ echo "$as_me:$LINENO: checking for C compiler default output file name" >&5 +echo $ECHO_N "checking for C compiler default output file name... $ECHO_C" >&6; } +ac_link_default=`echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` +# +# List of possible output files, starting from the most likely. +# The algorithm is not robust to junk in `.', hence go to wildcards (a.*) +# only as a last resort. b.out is created by i960 compilers. +ac_files='a_out.exe a.exe conftest.exe a.out conftest a.* conftest.* b.out' +# +# The IRIX 6 linker writes into existing files which may not be +# executable, retaining their permissions. Remove them first so a +# subsequent execution test works. ac_rmfiles= for ac_file in $ac_files do case $ac_file in - *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.o | *.obj ) ;; * ) ac_rmfiles="$ac_rmfiles $ac_file";; esac done @@ -2834,11 +2719,10 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link_default") 2>&5 ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then # Autoconf-2.13 could set the ac_cv_exeext variable to `no'. # So ignore a value of `no', otherwise this would lead to `EXEEXT = no' @@ -2849,7 +2733,7 @@ do test -f "$ac_file" || continue case $ac_file in - *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.o | *.obj ) ;; [ab].out ) # We found the default executable, but exeext='' is most @@ -2876,27 +2760,25 @@ ac_file='' fi -{ $as_echo "$as_me:$LINENO: result: $ac_file" >&5 -$as_echo "$ac_file" >&6; } +{ echo "$as_me:$LINENO: result: $ac_file" >&5 +echo "${ECHO_T}$ac_file" >&6; } if test -z "$ac_file"; then - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -{ { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -{ { $as_echo "$as_me:$LINENO: error: C compiler cannot create executables +{ { echo "$as_me:$LINENO: error: C compiler cannot create executables See \`config.log' for more details." >&5 -$as_echo "$as_me: error: C compiler cannot create executables +echo "$as_me: error: C compiler cannot create executables See \`config.log' for more details." >&2;} - { (exit 77); exit 77; }; }; } + { (exit 77); exit 77; }; } fi ac_exeext=$ac_cv_exeext # Check that the compiler produces executables we can run. If not, either # the compiler is broken, or we cross compile. -{ $as_echo "$as_me:$LINENO: checking whether the C compiler works" >&5 -$as_echo_n "checking whether the C compiler works... " >&6; } +{ echo "$as_me:$LINENO: checking whether the C compiler works" >&5 +echo $ECHO_N "checking whether the C compiler works... $ECHO_C" >&6; } # FIXME: These cross compiler hacks should be removed for Autoconf 3.0 # If not cross compiling, check that we can run a simple program. if test "$cross_compiling" != yes; then @@ -2905,53 +2787,49 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_try") 2>&5 ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then cross_compiling=no else if test "$cross_compiling" = maybe; then cross_compiling=yes else - { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -{ { $as_echo "$as_me:$LINENO: error: cannot run C compiled programs. + { { echo "$as_me:$LINENO: error: cannot run C compiled programs. If you meant to cross compile, use \`--host'. See \`config.log' for more details." >&5 -$as_echo "$as_me: error: cannot run C compiled programs. +echo "$as_me: error: cannot run C compiled programs. If you meant to cross compile, use \`--host'. See \`config.log' for more details." >&2;} - { (exit 1); exit 1; }; }; } + { (exit 1); exit 1; }; } fi fi fi -{ $as_echo "$as_me:$LINENO: result: yes" >&5 -$as_echo "yes" >&6; } +{ echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; } -rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out +rm -f a.out a.exe conftest$ac_cv_exeext b.out ac_clean_files=$ac_clean_files_save # Check that the compiler produces executables we can run. If not, either # the compiler is broken, or we cross compile. -{ $as_echo "$as_me:$LINENO: checking whether we are cross compiling" >&5 -$as_echo_n "checking whether we are cross compiling... " >&6; } -{ $as_echo "$as_me:$LINENO: result: $cross_compiling" >&5 -$as_echo "$cross_compiling" >&6; } +{ echo "$as_me:$LINENO: checking whether we are cross compiling" >&5 +echo $ECHO_N "checking whether we are cross compiling... $ECHO_C" >&6; } +{ echo "$as_me:$LINENO: result: $cross_compiling" >&5 +echo "${ECHO_T}$cross_compiling" >&6; } -{ $as_echo "$as_me:$LINENO: checking for suffix of executables" >&5 -$as_echo_n "checking for suffix of executables... " >&6; } +{ echo "$as_me:$LINENO: checking for suffix of executables" >&5 +echo $ECHO_N "checking for suffix of executables... $ECHO_C" >&6; } if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>&5 ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then # If both `conftest.exe' and `conftest' are `present' (well, observable) # catch `conftest.exe'. For instance with Cygwin, `ls conftest' will @@ -2960,33 +2838,31 @@ for ac_file in conftest.exe conftest conftest.*; do test -f "$ac_file" || continue case $ac_file in - *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.o | *.obj ) ;; *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` break;; * ) break;; esac done else - { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -{ { $as_echo "$as_me:$LINENO: error: cannot compute suffix of executables: cannot compile and link + { { echo "$as_me:$LINENO: error: cannot compute suffix of executables: cannot compile and link See \`config.log' for more details." >&5 -$as_echo "$as_me: error: cannot compute suffix of executables: cannot compile and link +echo "$as_me: error: cannot compute suffix of executables: cannot compile and link See \`config.log' for more details." >&2;} - { (exit 1); exit 1; }; }; } + { (exit 1); exit 1; }; } fi rm -f conftest$ac_cv_exeext -{ $as_echo "$as_me:$LINENO: result: $ac_cv_exeext" >&5 -$as_echo "$ac_cv_exeext" >&6; } +{ echo "$as_me:$LINENO: result: $ac_cv_exeext" >&5 +echo "${ECHO_T}$ac_cv_exeext" >&6; } rm -f conftest.$ac_ext EXEEXT=$ac_cv_exeext ac_exeext=$EXEEXT -{ $as_echo "$as_me:$LINENO: checking for suffix of object files" >&5 -$as_echo_n "checking for suffix of object files... " >&6; } +{ echo "$as_me:$LINENO: checking for suffix of object files" >&5 +echo $ECHO_N "checking for suffix of object files... $ECHO_C" >&6; } if test "${ac_cv_objext+set}" = set; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ @@ -3009,43 +2885,40 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>&5 ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then for ac_file in conftest.o conftest.obj conftest.*; do test -f "$ac_file" || continue; case $ac_file in - *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM ) ;; + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf ) ;; *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` break;; esac done else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -{ { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -{ { $as_echo "$as_me:$LINENO: error: cannot compute suffix of object files: cannot compile +{ { echo "$as_me:$LINENO: error: cannot compute suffix of object files: cannot compile See \`config.log' for more details." >&5 -$as_echo "$as_me: error: cannot compute suffix of object files: cannot compile +echo "$as_me: error: cannot compute suffix of object files: cannot compile See \`config.log' for more details." >&2;} - { (exit 1); exit 1; }; }; } + { (exit 1); exit 1; }; } fi rm -f conftest.$ac_cv_objext conftest.$ac_ext fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_objext" >&5 -$as_echo "$ac_cv_objext" >&6; } +{ echo "$as_me:$LINENO: result: $ac_cv_objext" >&5 +echo "${ECHO_T}$ac_cv_objext" >&6; } OBJEXT=$ac_cv_objext ac_objext=$OBJEXT -{ $as_echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5 -$as_echo_n "checking whether we are using the GNU C compiler... " >&6; } +{ echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5 +echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6; } if test "${ac_cv_c_compiler_gnu+set}" = set; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ @@ -3071,21 +2944,20 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_compiler_gnu=yes else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_compiler_gnu=no @@ -3095,19 +2967,15 @@ ac_cv_c_compiler_gnu=$ac_compiler_gnu fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5 -$as_echo "$ac_cv_c_compiler_gnu" >&6; } -if test $ac_compiler_gnu = yes; then - GCC=yes -else - GCC= -fi +{ echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5 +echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6; } +GCC=`test $ac_compiler_gnu = yes && echo yes` ac_test_CFLAGS=${CFLAGS+set} ac_save_CFLAGS=$CFLAGS -{ $as_echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5 -$as_echo_n "checking whether $CC accepts -g... " >&6; } +{ echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5 +echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6; } if test "${ac_cv_prog_cc_g+set}" = set; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_save_c_werror_flag=$ac_c_werror_flag ac_c_werror_flag=yes @@ -3134,21 +3002,20 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_prog_cc_g=yes else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 CFLAGS="" @@ -3173,21 +3040,20 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then : else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_c_werror_flag=$ac_save_c_werror_flag @@ -3213,21 +3079,20 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_prog_cc_g=yes else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 @@ -3242,8 +3107,8 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_c_werror_flag=$ac_save_c_werror_flag fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5 -$as_echo "$ac_cv_prog_cc_g" >&6; } +{ echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5 +echo "${ECHO_T}$ac_cv_prog_cc_g" >&6; } if test "$ac_test_CFLAGS" = set; then CFLAGS=$ac_save_CFLAGS elif test $ac_cv_prog_cc_g = yes; then @@ -3259,10 +3124,10 @@ CFLAGS= fi fi -{ $as_echo "$as_me:$LINENO: checking for $CC option to accept ISO C89" >&5 -$as_echo_n "checking for $CC option to accept ISO C89... " >&6; } +{ echo "$as_me:$LINENO: checking for $CC option to accept ISO C89" >&5 +echo $ECHO_N "checking for $CC option to accept ISO C89... $ECHO_C" >&6; } if test "${ac_cv_prog_cc_c89+set}" = set; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_cv_prog_cc_c89=no ac_save_CC=$CC @@ -3333,21 +3198,20 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_prog_cc_c89=$ac_arg else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 @@ -3363,15 +3227,15 @@ # AC_CACHE_VAL case "x$ac_cv_prog_cc_c89" in x) - { $as_echo "$as_me:$LINENO: result: none needed" >&5 -$as_echo "none needed" >&6; } ;; + { echo "$as_me:$LINENO: result: none needed" >&5 +echo "${ECHO_T}none needed" >&6; } ;; xno) - { $as_echo "$as_me:$LINENO: result: unsupported" >&5 -$as_echo "unsupported" >&6; } ;; + { echo "$as_me:$LINENO: result: unsupported" >&5 +echo "${ECHO_T}unsupported" >&6; } ;; *) CC="$CC $ac_cv_prog_cc_c89" - { $as_echo "$as_me:$LINENO: result: $ac_cv_prog_cc_c89" >&5 -$as_echo "$ac_cv_prog_cc_c89" >&6; } ;; + { echo "$as_me:$LINENO: result: $ac_cv_prog_cc_c89" >&5 +echo "${ECHO_T}$ac_cv_prog_cc_c89" >&6; } ;; esac @@ -3384,8 +3248,8 @@ -{ $as_echo "$as_me:$LINENO: checking for --with-cxx-main=" >&5 -$as_echo_n "checking for --with-cxx-main=... " >&6; } +{ echo "$as_me:$LINENO: checking for --with-cxx-main=" >&5 +echo $ECHO_N "checking for --with-cxx-main=... $ECHO_C" >&6; } # Check whether --with-cxx_main was given. if test "${with_cxx_main+set}" = set; then @@ -3410,8 +3274,8 @@ fi -{ $as_echo "$as_me:$LINENO: result: $with_cxx_main" >&5 -$as_echo "$with_cxx_main" >&6; } +{ echo "$as_me:$LINENO: result: $with_cxx_main" >&5 +echo "${ECHO_T}$with_cxx_main" >&6; } preset_cxx="$CXX" if test -z "$CXX" @@ -3419,10 +3283,10 @@ case "$CC" in gcc) # Extract the first word of "g++", so it can be a program name with args. set dummy g++; ac_word=$2 -{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } if test "${ac_cv_path_CXX+set}" = set; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else case $CXX in [\\/]* | ?:[\\/]*) @@ -3437,7 +3301,7 @@ for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_path_CXX="$as_dir/$ac_word$ac_exec_ext" - $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -3450,20 +3314,20 @@ fi CXX=$ac_cv_path_CXX if test -n "$CXX"; then - { $as_echo "$as_me:$LINENO: result: $CXX" >&5 -$as_echo "$CXX" >&6; } + { echo "$as_me:$LINENO: result: $CXX" >&5 +echo "${ECHO_T}$CXX" >&6; } else - { $as_echo "$as_me:$LINENO: result: no" >&5 -$as_echo "no" >&6; } + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } fi ;; cc) # Extract the first word of "c++", so it can be a program name with args. set dummy c++; ac_word=$2 -{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } if test "${ac_cv_path_CXX+set}" = set; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else case $CXX in [\\/]* | ?:[\\/]*) @@ -3478,7 +3342,7 @@ for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_path_CXX="$as_dir/$ac_word$ac_exec_ext" - $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -3491,11 +3355,11 @@ fi CXX=$ac_cv_path_CXX if test -n "$CXX"; then - { $as_echo "$as_me:$LINENO: result: $CXX" >&5 -$as_echo "$CXX" >&6; } + { echo "$as_me:$LINENO: result: $CXX" >&5 +echo "${ECHO_T}$CXX" >&6; } else - { $as_echo "$as_me:$LINENO: result: no" >&5 -$as_echo "no" >&6; } + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } fi ;; @@ -3511,10 +3375,10 @@ do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 -{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } if test "${ac_cv_prog_CXX+set}" = set; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CXX"; then ac_cv_prog_CXX="$CXX" # Let the user override the test. @@ -3527,7 +3391,7 @@ for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CXX="$ac_prog" - $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -3538,11 +3402,11 @@ fi CXX=$ac_cv_prog_CXX if test -n "$CXX"; then - { $as_echo "$as_me:$LINENO: result: $CXX" >&5 -$as_echo "$CXX" >&6; } + { echo "$as_me:$LINENO: result: $CXX" >&5 +echo "${ECHO_T}$CXX" >&6; } else - { $as_echo "$as_me:$LINENO: result: no" >&5 -$as_echo "no" >&6; } + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } fi @@ -3557,12 +3421,12 @@ fi if test "$preset_cxx" != "$CXX" then - { $as_echo "$as_me:$LINENO: WARNING: + { echo "$as_me:$LINENO: WARNING: By default, distutils will build C++ extension modules with \"$CXX\". If this is not intended, then set CXX on the configure command line. " >&5 -$as_echo "$as_me: WARNING: +echo "$as_me: WARNING: By default, distutils will build C++ extension modules with \"$CXX\". If this is not intended, then set CXX on the configure command line. @@ -3577,15 +3441,15 @@ ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu -{ $as_echo "$as_me:$LINENO: checking how to run the C preprocessor" >&5 -$as_echo_n "checking how to run the C preprocessor... " >&6; } +{ echo "$as_me:$LINENO: checking how to run the C preprocessor" >&5 +echo $ECHO_N "checking how to run the C preprocessor... $ECHO_C" >&6; } # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= fi if test -z "$CPP"; then if test "${ac_cv_prog_CPP+set}" = set; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else # Double quotes because CPP needs to be expanded for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" @@ -3617,21 +3481,20 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then : else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Broken: fails on valid input. @@ -3655,14 +3518,13 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err @@ -3670,7 +3532,7 @@ # Broken: success on invalid input. continue else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Passes both tests. @@ -3695,8 +3557,8 @@ else ac_cv_prog_CPP=$CPP fi -{ $as_echo "$as_me:$LINENO: result: $CPP" >&5 -$as_echo "$CPP" >&6; } +{ echo "$as_me:$LINENO: result: $CPP" >&5 +echo "${ECHO_T}$CPP" >&6; } ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do @@ -3724,21 +3586,20 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then : else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Broken: fails on valid input. @@ -3762,14 +3623,13 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err @@ -3777,7 +3637,7 @@ # Broken: success on invalid input. continue else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Passes both tests. @@ -3793,13 +3653,11 @@ if $ac_preproc_ok; then : else - { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -{ { $as_echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check + { { echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check See \`config.log' for more details." >&5 -$as_echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check +echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check See \`config.log' for more details." >&2;} - { (exit 1); exit 1; }; }; } + { (exit 1); exit 1; }; } fi ac_ext=c @@ -3809,37 +3667,42 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu -{ $as_echo "$as_me:$LINENO: checking for grep that handles long lines and -e" >&5 -$as_echo_n "checking for grep that handles long lines and -e... " >&6; } +{ echo "$as_me:$LINENO: checking for grep that handles long lines and -e" >&5 +echo $ECHO_N "checking for grep that handles long lines and -e... $ECHO_C" >&6; } +if test "${ac_cv_path_GREP+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + # Extract the first word of "grep ggrep" to use in msg output +if test -z "$GREP"; then +set dummy grep ggrep; ac_prog_name=$2 if test "${ac_cv_path_GREP+set}" = set; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else - if test -z "$GREP"; then ac_path_GREP_found=false - # Loop through the user's path and test for each of PROGNAME-LIST - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +# Loop through the user's path and test for each of PROGNAME-LIST +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in grep ggrep; do - for ac_exec_ext in '' $ac_executable_extensions; do - ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext" - { test -f "$ac_path_GREP" && $as_test_x "$ac_path_GREP"; } || continue -# Check for GNU ac_path_GREP and select it if it is found. + for ac_exec_ext in '' $ac_executable_extensions; do + ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext" + { test -f "$ac_path_GREP" && $as_test_x "$ac_path_GREP"; } || continue + # Check for GNU ac_path_GREP and select it if it is found. # Check for GNU $ac_path_GREP case `"$ac_path_GREP" --version 2>&1` in *GNU*) ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;; *) ac_count=0 - $as_echo_n 0123456789 >"conftest.in" + echo $ECHO_N "0123456789$ECHO_C" >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" - $as_echo 'GREP' >> "conftest.nl" + echo 'GREP' >> "conftest.nl" "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break ac_count=`expr $ac_count + 1` @@ -3850,582 +3713,149 @@ fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break - done - rm -f conftest.in conftest.tmp conftest.nl conftest.out;; -esac - - $ac_path_GREP_found && break 3 - done - done -done -IFS=$as_save_IFS - if test -z "$ac_cv_path_GREP"; then - { { $as_echo "$as_me:$LINENO: error: no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&5 -$as_echo "$as_me: error: no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&2;} - { (exit 1); exit 1; }; } - fi -else - ac_cv_path_GREP=$GREP -fi - -fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_path_GREP" >&5 -$as_echo "$ac_cv_path_GREP" >&6; } - GREP="$ac_cv_path_GREP" - - -{ $as_echo "$as_me:$LINENO: checking for egrep" >&5 -$as_echo_n "checking for egrep... " >&6; } -if test "${ac_cv_path_EGREP+set}" = set; then - $as_echo_n "(cached) " >&6 -else - if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 - then ac_cv_path_EGREP="$GREP -E" - else - if test -z "$EGREP"; then - ac_path_EGREP_found=false - # Loop through the user's path and test for each of PROGNAME-LIST - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_prog in egrep; do - for ac_exec_ext in '' $ac_executable_extensions; do - ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext" - { test -f "$ac_path_EGREP" && $as_test_x "$ac_path_EGREP"; } || continue -# Check for GNU ac_path_EGREP and select it if it is found. - # Check for GNU $ac_path_EGREP -case `"$ac_path_EGREP" --version 2>&1` in -*GNU*) - ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;; -*) - ac_count=0 - $as_echo_n 0123456789 >"conftest.in" - while : - do - cat "conftest.in" "conftest.in" >"conftest.tmp" - mv "conftest.tmp" "conftest.in" - cp "conftest.in" "conftest.nl" - $as_echo 'EGREP' >> "conftest.nl" - "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break - diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break - ac_count=`expr $ac_count + 1` - if test $ac_count -gt ${ac_path_EGREP_max-0}; then - # Best one so far, save it but keep looking for a better one - ac_cv_path_EGREP="$ac_path_EGREP" - ac_path_EGREP_max=$ac_count - fi - # 10*(2^10) chars as input seems more than enough - test $ac_count -gt 10 && break - done - rm -f conftest.in conftest.tmp conftest.nl conftest.out;; -esac - - $ac_path_EGREP_found && break 3 - done - done -done -IFS=$as_save_IFS - if test -z "$ac_cv_path_EGREP"; then - { { $as_echo "$as_me:$LINENO: error: no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&5 -$as_echo "$as_me: error: no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&2;} - { (exit 1); exit 1; }; } - fi -else - ac_cv_path_EGREP=$EGREP -fi - - fi -fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_path_EGREP" >&5 -$as_echo "$ac_cv_path_EGREP" >&6; } - EGREP="$ac_cv_path_EGREP" - - -{ $as_echo "$as_me:$LINENO: checking for ANSI C header files" >&5 -$as_echo_n "checking for ANSI C header files... " >&6; } -if test "${ac_cv_header_stdc+set}" = set; then - $as_echo_n "(cached) " >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include -#include -#include -#include - -int -main () -{ - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - ac_cv_header_stdc=yes -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_cv_header_stdc=no -fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - -if test $ac_cv_header_stdc = yes; then - # SunOS 4.x string.h does not declare mem*, contrary to ANSI. - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include - -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "memchr" >/dev/null 2>&1; then - : -else - ac_cv_header_stdc=no -fi -rm -f conftest* - -fi - -if test $ac_cv_header_stdc = yes; then - # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include - -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "free" >/dev/null 2>&1; then - : -else - ac_cv_header_stdc=no -fi -rm -f conftest* - -fi - -if test $ac_cv_header_stdc = yes; then - # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. - if test "$cross_compiling" = yes; then - : -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include -#include -#if ((' ' & 0x0FF) == 0x020) -# define ISLOWER(c) ('a' <= (c) && (c) <= 'z') -# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) -#else -# define ISLOWER(c) \ - (('a' <= (c) && (c) <= 'i') \ - || ('j' <= (c) && (c) <= 'r') \ - || ('s' <= (c) && (c) <= 'z')) -# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) -#endif - -#define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) -int -main () -{ - int i; - for (i = 0; i < 256; i++) - if (XOR (islower (i), ISLOWER (i)) - || toupper (i) != TOUPPER (i)) - return 2; - return 0; -} -_ACEOF -rm -f conftest$ac_exeext -if { (ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_link") 2>&5 - ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { ac_try='./conftest$ac_exeext' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - : -else - $as_echo "$as_me: program exited with status $ac_status" >&5 -$as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -( exit $ac_status ) -ac_cv_header_stdc=no -fi -rm -rf conftest.dSYM -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext -fi - - -fi -fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5 -$as_echo "$ac_cv_header_stdc" >&6; } -if test $ac_cv_header_stdc = yes; then - -cat >>confdefs.h <<\_ACEOF -#define STDC_HEADERS 1 -_ACEOF - -fi - -# On IRIX 5.3, sys/types and inttypes.h are conflicting. - - - - - - - - - -for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ - inttypes.h stdint.h unistd.h -do -as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` -{ $as_echo "$as_me:$LINENO: checking for $ac_header" >&5 -$as_echo_n "checking for $ac_header... " >&6; } -if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then - $as_echo_n "(cached) " >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_includes_default - -#include <$ac_header> -_ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - eval "$as_ac_Header=yes" -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - eval "$as_ac_Header=no" -fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -ac_res=`eval 'as_val=${'$as_ac_Header'} - $as_echo "$as_val"'` - { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } -as_val=`eval 'as_val=${'$as_ac_Header'} - $as_echo "$as_val"'` - if test "x$as_val" = x""yes; then - cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 -_ACEOF - -fi - -done - - - - if test "${ac_cv_header_minix_config_h+set}" = set; then - { $as_echo "$as_me:$LINENO: checking for minix/config.h" >&5 -$as_echo_n "checking for minix/config.h... " >&6; } -if test "${ac_cv_header_minix_config_h+set}" = set; then - $as_echo_n "(cached) " >&6 -fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_minix_config_h" >&5 -$as_echo "$ac_cv_header_minix_config_h" >&6; } -else - # Is the header compilable? -{ $as_echo "$as_me:$LINENO: checking minix/config.h usability" >&5 -$as_echo_n "checking minix/config.h usability... " >&6; } -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_includes_default -#include -_ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; + done + rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - ac_header_compiler=yes -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - ac_header_compiler=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 -$as_echo "$ac_header_compiler" >&6; } + $ac_path_GREP_found && break 3 + done +done + +done +IFS=$as_save_IFS -# Is the header present? -{ $as_echo "$as_me:$LINENO: checking minix/config.h presence" >&5 -$as_echo_n "checking minix/config.h presence... " >&6; } -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include -_ACEOF -if { (ac_try="$ac_cpp conftest.$ac_ext" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null && { - test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || - test ! -s conftest.err - }; then - ac_header_preproc=yes -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - ac_header_preproc=no fi -rm -f conftest.err conftest.$ac_ext -{ $as_echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 -$as_echo "$ac_header_preproc" >&6; } +GREP="$ac_cv_path_GREP" +if test -z "$GREP"; then + { { echo "$as_me:$LINENO: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&5 +echo "$as_me: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&2;} + { (exit 1); exit 1; }; } +fi -# So? What about this header? -case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in - yes:no: ) - { $as_echo "$as_me:$LINENO: WARNING: minix/config.h: accepted by the compiler, rejected by the preprocessor!" >&5 -$as_echo "$as_me: WARNING: minix/config.h: accepted by the compiler, rejected by the preprocessor!" >&2;} - { $as_echo "$as_me:$LINENO: WARNING: minix/config.h: proceeding with the compiler's result" >&5 -$as_echo "$as_me: WARNING: minix/config.h: proceeding with the compiler's result" >&2;} - ac_header_preproc=yes - ;; - no:yes:* ) - { $as_echo "$as_me:$LINENO: WARNING: minix/config.h: present but cannot be compiled" >&5 -$as_echo "$as_me: WARNING: minix/config.h: present but cannot be compiled" >&2;} - { $as_echo "$as_me:$LINENO: WARNING: minix/config.h: check for missing prerequisite headers?" >&5 -$as_echo "$as_me: WARNING: minix/config.h: check for missing prerequisite headers?" >&2;} - { $as_echo "$as_me:$LINENO: WARNING: minix/config.h: see the Autoconf documentation" >&5 -$as_echo "$as_me: WARNING: minix/config.h: see the Autoconf documentation" >&2;} - { $as_echo "$as_me:$LINENO: WARNING: minix/config.h: section \"Present But Cannot Be Compiled\"" >&5 -$as_echo "$as_me: WARNING: minix/config.h: section \"Present But Cannot Be Compiled\"" >&2;} - { $as_echo "$as_me:$LINENO: WARNING: minix/config.h: proceeding with the preprocessor's result" >&5 -$as_echo "$as_me: WARNING: minix/config.h: proceeding with the preprocessor's result" >&2;} - { $as_echo "$as_me:$LINENO: WARNING: minix/config.h: in the future, the compiler will take precedence" >&5 -$as_echo "$as_me: WARNING: minix/config.h: in the future, the compiler will take precedence" >&2;} - ( cat <<\_ASBOX -## -------------------------------------- ## -## Report this to http://bugs.python.org/ ## -## -------------------------------------- ## -_ASBOX - ) | sed "s/^/$as_me: WARNING: /" >&2 - ;; -esac -{ $as_echo "$as_me:$LINENO: checking for minix/config.h" >&5 -$as_echo_n "checking for minix/config.h... " >&6; } -if test "${ac_cv_header_minix_config_h+set}" = set; then - $as_echo_n "(cached) " >&6 else - ac_cv_header_minix_config_h=$ac_header_preproc + ac_cv_path_GREP=$GREP fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_minix_config_h" >&5 -$as_echo "$ac_cv_header_minix_config_h" >&6; } + fi -if test "x$ac_cv_header_minix_config_h" = x""yes; then - MINIX=yes +{ echo "$as_me:$LINENO: result: $ac_cv_path_GREP" >&5 +echo "${ECHO_T}$ac_cv_path_GREP" >&6; } + GREP="$ac_cv_path_GREP" + + +{ echo "$as_me:$LINENO: checking for egrep" >&5 +echo $ECHO_N "checking for egrep... $ECHO_C" >&6; } +if test "${ac_cv_path_EGREP+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - MINIX= -fi + if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 + then ac_cv_path_EGREP="$GREP -E" + else + # Extract the first word of "egrep" to use in msg output +if test -z "$EGREP"; then +set dummy egrep; ac_prog_name=$2 +if test "${ac_cv_path_EGREP+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_path_EGREP_found=false +# Loop through the user's path and test for each of PROGNAME-LIST +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_prog in egrep; do + for ac_exec_ext in '' $ac_executable_extensions; do + ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext" + { test -f "$ac_path_EGREP" && $as_test_x "$ac_path_EGREP"; } || continue + # Check for GNU ac_path_EGREP and select it if it is found. + # Check for GNU $ac_path_EGREP +case `"$ac_path_EGREP" --version 2>&1` in +*GNU*) + ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;; +*) + ac_count=0 + echo $ECHO_N "0123456789$ECHO_C" >"conftest.in" + while : + do + cat "conftest.in" "conftest.in" >"conftest.tmp" + mv "conftest.tmp" "conftest.in" + cp "conftest.in" "conftest.nl" + echo 'EGREP' >> "conftest.nl" + "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break + diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break + ac_count=`expr $ac_count + 1` + if test $ac_count -gt ${ac_path_EGREP_max-0}; then + # Best one so far, save it but keep looking for a better one + ac_cv_path_EGREP="$ac_path_EGREP" + ac_path_EGREP_max=$ac_count + fi + # 10*(2^10) chars as input seems more than enough + test $ac_count -gt 10 && break + done + rm -f conftest.in conftest.tmp conftest.nl conftest.out;; +esac - if test "$MINIX" = yes; then + $ac_path_EGREP_found && break 3 + done +done -cat >>confdefs.h <<\_ACEOF -#define _POSIX_SOURCE 1 -_ACEOF +done +IFS=$as_save_IFS -cat >>confdefs.h <<\_ACEOF -#define _POSIX_1_SOURCE 2 -_ACEOF +fi + +EGREP="$ac_cv_path_EGREP" +if test -z "$EGREP"; then + { { echo "$as_me:$LINENO: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&5 +echo "$as_me: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&2;} + { (exit 1); exit 1; }; } +fi +else + ac_cv_path_EGREP=$EGREP +fi -cat >>confdefs.h <<\_ACEOF -#define _MINIX 1 -_ACEOF - fi + fi +fi +{ echo "$as_me:$LINENO: result: $ac_cv_path_EGREP" >&5 +echo "${ECHO_T}$ac_cv_path_EGREP" >&6; } + EGREP="$ac_cv_path_EGREP" - { $as_echo "$as_me:$LINENO: checking whether it is safe to define __EXTENSIONS__" >&5 -$as_echo_n "checking whether it is safe to define __EXTENSIONS__... " >&6; } -if test "${ac_cv_safe_to_define___extensions__+set}" = set; then - $as_echo_n "(cached) " >&6 -else - cat >conftest.$ac_ext <<_ACEOF +{ echo "$as_me:$LINENO: checking for AIX" >&5 +echo $ECHO_N "checking for AIX... $ECHO_C" >&6; } +cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ +#ifdef _AIX + yes +#endif -# define __EXTENSIONS__ 1 - $ac_includes_default -int -main () -{ - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - ac_cv_safe_to_define___extensions__=yes -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_cv_safe_to_define___extensions__=no -fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_safe_to_define___extensions__" >&5 -$as_echo "$ac_cv_safe_to_define___extensions__" >&6; } - test $ac_cv_safe_to_define___extensions__ = yes && - cat >>confdefs.h <<\_ACEOF -#define __EXTENSIONS__ 1 _ACEOF - - cat >>confdefs.h <<\_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "yes" >/dev/null 2>&1; then + { echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; } +cat >>confdefs.h <<\_ACEOF #define _ALL_SOURCE 1 _ACEOF - cat >>confdefs.h <<\_ACEOF -#define _GNU_SOURCE 1 -_ACEOF - - cat >>confdefs.h <<\_ACEOF -#define _POSIX_PTHREAD_SEMANTICS 1 -_ACEOF - - cat >>confdefs.h <<\_ACEOF -#define _TANDEM_SOURCE 1 -_ACEOF +else + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi +rm -f conftest* @@ -4438,8 +3868,8 @@ esac -{ $as_echo "$as_me:$LINENO: checking for --with-suffix" >&5 -$as_echo_n "checking for --with-suffix... " >&6; } +{ echo "$as_me:$LINENO: checking for --with-suffix" >&5 +echo $ECHO_N "checking for --with-suffix... $ECHO_C" >&6; } # Check whether --with-suffix was given. if test "${with_suffix+set}" = set; then @@ -4451,26 +3881,26 @@ esac fi -{ $as_echo "$as_me:$LINENO: result: $EXEEXT" >&5 -$as_echo "$EXEEXT" >&6; } +{ echo "$as_me:$LINENO: result: $EXEEXT" >&5 +echo "${ECHO_T}$EXEEXT" >&6; } # Test whether we're running on a non-case-sensitive system, in which # case we give a warning if no ext is given -{ $as_echo "$as_me:$LINENO: checking for case-insensitive build directory" >&5 -$as_echo_n "checking for case-insensitive build directory... " >&6; } +{ echo "$as_me:$LINENO: checking for case-insensitive build directory" >&5 +echo $ECHO_N "checking for case-insensitive build directory... $ECHO_C" >&6; } if test ! -d CaseSensitiveTestDir; then mkdir CaseSensitiveTestDir fi if test -d casesensitivetestdir then - { $as_echo "$as_me:$LINENO: result: yes" >&5 -$as_echo "yes" >&6; } + { echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; } BUILDEXEEXT=.exe else - { $as_echo "$as_me:$LINENO: result: no" >&5 -$as_echo "no" >&6; } + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } BUILDEXEEXT=$EXEEXT fi rmdir CaseSensitiveTestDir @@ -4503,14 +3933,14 @@ -{ $as_echo "$as_me:$LINENO: checking LIBRARY" >&5 -$as_echo_n "checking LIBRARY... " >&6; } +{ echo "$as_me:$LINENO: checking LIBRARY" >&5 +echo $ECHO_N "checking LIBRARY... $ECHO_C" >&6; } if test -z "$LIBRARY" then LIBRARY='libpython$(VERSION).a' fi -{ $as_echo "$as_me:$LINENO: result: $LIBRARY" >&5 -$as_echo "$LIBRARY" >&6; } +{ echo "$as_me:$LINENO: result: $LIBRARY" >&5 +echo "${ECHO_T}$LIBRARY" >&6; } # LDLIBRARY is the name of the library to link against (as opposed to the # name of the library into which to insert object files). BLDLIBRARY is also @@ -4545,8 +3975,8 @@ # This is altered for AIX in order to build the export list before # linking. -{ $as_echo "$as_me:$LINENO: checking LINKCC" >&5 -$as_echo_n "checking LINKCC... " >&6; } +{ echo "$as_me:$LINENO: checking LINKCC" >&5 +echo $ECHO_N "checking LINKCC... $ECHO_C" >&6; } if test -z "$LINKCC" then LINKCC='$(PURIFY) $(MAINCC)' @@ -4566,8 +3996,8 @@ LINKCC=qcc;; esac fi -{ $as_echo "$as_me:$LINENO: result: $LINKCC" >&5 -$as_echo "$LINKCC" >&6; } +{ echo "$as_me:$LINENO: result: $LINKCC" >&5 +echo "${ECHO_T}$LINKCC" >&6; } # GNULD is set to "yes" if the GNU linker is used. If this goes wrong # make sure we default having it set to "no": this is used by @@ -4575,8 +4005,8 @@ # to linker command lines, and failing to detect GNU ld simply results # in the same bahaviour as before. -{ $as_echo "$as_me:$LINENO: checking for GNU ld" >&5 -$as_echo_n "checking for GNU ld... " >&6; } +{ echo "$as_me:$LINENO: checking for GNU ld" >&5 +echo $ECHO_N "checking for GNU ld... $ECHO_C" >&6; } ac_prog=ld if test "$GCC" = yes; then ac_prog=`$CC -print-prog-name=ld` @@ -4587,11 +4017,11 @@ *) GNULD=no;; esac -{ $as_echo "$as_me:$LINENO: result: $GNULD" >&5 -$as_echo "$GNULD" >&6; } +{ echo "$as_me:$LINENO: result: $GNULD" >&5 +echo "${ECHO_T}$GNULD" >&6; } -{ $as_echo "$as_me:$LINENO: checking for --enable-shared" >&5 -$as_echo_n "checking for --enable-shared... " >&6; } +{ echo "$as_me:$LINENO: checking for --enable-shared" >&5 +echo $ECHO_N "checking for --enable-shared... $ECHO_C" >&6; } # Check whether --enable-shared was given. if test "${enable_shared+set}" = set; then enableval=$enable_shared; @@ -4607,11 +4037,11 @@ enable_shared="no";; esac fi -{ $as_echo "$as_me:$LINENO: result: $enable_shared" >&5 -$as_echo "$enable_shared" >&6; } +{ echo "$as_me:$LINENO: result: $enable_shared" >&5 +echo "${ECHO_T}$enable_shared" >&6; } -{ $as_echo "$as_me:$LINENO: checking for --enable-profiling" >&5 -$as_echo_n "checking for --enable-profiling... " >&6; } +{ echo "$as_me:$LINENO: checking for --enable-profiling" >&5 +echo $ECHO_N "checking for --enable-profiling... $ECHO_C" >&6; } # Check whether --enable-profiling was given. if test "${enable_profiling+set}" = set; then enableval=$enable_profiling; ac_save_cc="$CC" @@ -4633,32 +4063,29 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>&5 ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_try") 2>&5 ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_enable_profiling="yes" else - $as_echo "$as_me: program exited with status $ac_status" >&5 -$as_echo "$as_me: failed program was:" >&5 + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) ac_enable_profiling="no" fi -rm -rf conftest.dSYM rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi @@ -4666,8 +4093,8 @@ CC="$ac_save_cc" fi -{ $as_echo "$as_me:$LINENO: result: $ac_enable_profiling" >&5 -$as_echo "$ac_enable_profiling" >&6; } +{ echo "$as_me:$LINENO: result: $ac_enable_profiling" >&5 +echo "${ECHO_T}$ac_enable_profiling" >&6; } case "$ac_enable_profiling" in "yes") @@ -4676,8 +4103,8 @@ ;; esac -{ $as_echo "$as_me:$LINENO: checking LDLIBRARY" >&5 -$as_echo_n "checking LDLIBRARY... " >&6; } +{ echo "$as_me:$LINENO: checking LDLIBRARY" >&5 +echo $ECHO_N "checking LDLIBRARY... $ECHO_C" >&6; } # MacOSX framework builds need more magic. LDLIBRARY is the dynamic # library that we build, but we do not want to link against it (we @@ -4764,16 +4191,16 @@ esac fi -{ $as_echo "$as_me:$LINENO: result: $LDLIBRARY" >&5 -$as_echo "$LDLIBRARY" >&6; } +{ echo "$as_me:$LINENO: result: $LDLIBRARY" >&5 +echo "${ECHO_T}$LDLIBRARY" >&6; } if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. set dummy ${ac_tool_prefix}ranlib; ac_word=$2 -{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } if test "${ac_cv_prog_RANLIB+set}" = set; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$RANLIB"; then ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. @@ -4786,7 +4213,7 @@ for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" - $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -4797,11 +4224,11 @@ fi RANLIB=$ac_cv_prog_RANLIB if test -n "$RANLIB"; then - { $as_echo "$as_me:$LINENO: result: $RANLIB" >&5 -$as_echo "$RANLIB" >&6; } + { echo "$as_me:$LINENO: result: $RANLIB" >&5 +echo "${ECHO_T}$RANLIB" >&6; } else - { $as_echo "$as_me:$LINENO: result: no" >&5 -$as_echo "no" >&6; } + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } fi @@ -4810,10 +4237,10 @@ ac_ct_RANLIB=$RANLIB # Extract the first word of "ranlib", so it can be a program name with args. set dummy ranlib; ac_word=$2 -{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } if test "${ac_cv_prog_ac_ct_RANLIB+set}" = set; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$ac_ct_RANLIB"; then ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test. @@ -4826,7 +4253,7 @@ for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_RANLIB="ranlib" - $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -4837,11 +4264,11 @@ fi ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB if test -n "$ac_ct_RANLIB"; then - { $as_echo "$as_me:$LINENO: result: $ac_ct_RANLIB" >&5 -$as_echo "$ac_ct_RANLIB" >&6; } + { echo "$as_me:$LINENO: result: $ac_ct_RANLIB" >&5 +echo "${ECHO_T}$ac_ct_RANLIB" >&6; } else - { $as_echo "$as_me:$LINENO: result: no" >&5 -$as_echo "no" >&6; } + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } fi if test "x$ac_ct_RANLIB" = x; then @@ -4849,8 +4276,12 @@ else case $cross_compiling:$ac_tool_warned in yes:) -{ $as_echo "$as_me:$LINENO: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools +whose name does not start with the host triplet. If you think this +configuration is useful to you, please write to autoconf at gnu.org." >&5 +echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools +whose name does not start with the host triplet. If you think this +configuration is useful to you, please write to autoconf at gnu.org." >&2;} ac_tool_warned=yes ;; esac RANLIB=$ac_ct_RANLIB @@ -4864,10 +4295,10 @@ do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 -{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } if test "${ac_cv_prog_AR+set}" = set; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$AR"; then ac_cv_prog_AR="$AR" # Let the user override the test. @@ -4880,7 +4311,7 @@ for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_AR="$ac_prog" - $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -4891,11 +4322,11 @@ fi AR=$ac_cv_prog_AR if test -n "$AR"; then - { $as_echo "$as_me:$LINENO: result: $AR" >&5 -$as_echo "$AR" >&6; } + { echo "$as_me:$LINENO: result: $AR" >&5 +echo "${ECHO_T}$AR" >&6; } else - { $as_echo "$as_me:$LINENO: result: no" >&5 -$as_echo "no" >&6; } + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } fi @@ -4914,10 +4345,10 @@ # Extract the first word of "svnversion", so it can be a program name with args. set dummy svnversion; ac_word=$2 -{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } if test "${ac_cv_prog_SVNVERSION+set}" = set; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$SVNVERSION"; then ac_cv_prog_SVNVERSION="$SVNVERSION" # Let the user override the test. @@ -4930,7 +4361,7 @@ for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_SVNVERSION="found" - $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -4942,11 +4373,11 @@ fi SVNVERSION=$ac_cv_prog_SVNVERSION if test -n "$SVNVERSION"; then - { $as_echo "$as_me:$LINENO: result: $SVNVERSION" >&5 -$as_echo "$SVNVERSION" >&6; } + { echo "$as_me:$LINENO: result: $SVNVERSION" >&5 +echo "${ECHO_T}$SVNVERSION" >&6; } else - { $as_echo "$as_me:$LINENO: result: no" >&5 -$as_echo "no" >&6; } + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } fi @@ -4982,8 +4413,8 @@ fi done if test -z "$ac_aux_dir"; then - { { $as_echo "$as_me:$LINENO: error: cannot find install-sh or install.sh in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" >&5 -$as_echo "$as_me: error: cannot find install-sh or install.sh in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" >&2;} + { { echo "$as_me:$LINENO: error: cannot find install-sh or install.sh in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" >&5 +echo "$as_me: error: cannot find install-sh or install.sh in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" >&2;} { (exit 1); exit 1; }; } fi @@ -5009,12 +4440,11 @@ # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # OS/2's system install, which has a completely different semantic # ./install, which can be erroneously created by make from ./install.sh. -# Reject install programs that cannot install multiple files. -{ $as_echo "$as_me:$LINENO: checking for a BSD-compatible install" >&5 -$as_echo_n "checking for a BSD-compatible install... " >&6; } +{ echo "$as_me:$LINENO: checking for a BSD-compatible install" >&5 +echo $ECHO_N "checking for a BSD-compatible install... $ECHO_C" >&6; } if test -z "$INSTALL"; then if test "${ac_cv_path_install+set}" = set; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH @@ -5043,29 +4473,17 @@ # program-specific install script used by HP pwplus--don't use. : else - rm -rf conftest.one conftest.two conftest.dir - echo one > conftest.one - echo two > conftest.two - mkdir conftest.dir - if "$as_dir/$ac_prog$ac_exec_ext" -c conftest.one conftest.two "`pwd`/conftest.dir" && - test -s conftest.one && test -s conftest.two && - test -s conftest.dir/conftest.one && - test -s conftest.dir/conftest.two - then - ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" - break 3 - fi + ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" + break 3 fi fi done done ;; esac - done IFS=$as_save_IFS -rm -rf conftest.one conftest.two conftest.dir fi if test "${ac_cv_path_install+set}" = set; then @@ -5078,8 +4496,8 @@ INSTALL=$ac_install_sh fi fi -{ $as_echo "$as_me:$LINENO: result: $INSTALL" >&5 -$as_echo "$INSTALL" >&6; } +{ echo "$as_me:$LINENO: result: $INSTALL" >&5 +echo "${ECHO_T}$INSTALL" >&6; } # Use test -z because SunOS4 sh mishandles braces in ${var-val}. # It thinks the first close brace ends the variable substitution. @@ -5102,8 +4520,8 @@ fi # Check for --with-pydebug -{ $as_echo "$as_me:$LINENO: checking for --with-pydebug" >&5 -$as_echo_n "checking for --with-pydebug... " >&6; } +{ echo "$as_me:$LINENO: checking for --with-pydebug" >&5 +echo $ECHO_N "checking for --with-pydebug... $ECHO_C" >&6; } # Check whether --with-pydebug was given. if test "${with_pydebug+set}" = set; then @@ -5115,15 +4533,15 @@ #define Py_DEBUG 1 _ACEOF - { $as_echo "$as_me:$LINENO: result: yes" >&5 -$as_echo "yes" >&6; }; + { echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; }; Py_DEBUG='true' -else { $as_echo "$as_me:$LINENO: result: no" >&5 -$as_echo "no" >&6; }; Py_DEBUG='false' +else { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; }; Py_DEBUG='false' fi else - { $as_echo "$as_me:$LINENO: result: no" >&5 -$as_echo "no" >&6; } + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } fi @@ -5201,8 +4619,8 @@ # Python violates C99 rules, by casting between incompatible # pointer types. GCC may generate bad code as a result of that, # so use -fno-strict-aliasing if supported. - { $as_echo "$as_me:$LINENO: checking whether $CC accepts -fno-strict-aliasing" >&5 -$as_echo_n "checking whether $CC accepts -fno-strict-aliasing... " >&6; } + { echo "$as_me:$LINENO: checking whether $CC accepts -fno-strict-aliasing" >&5 +echo $ECHO_N "checking whether $CC accepts -fno-strict-aliasing... $ECHO_C" >&6; } ac_save_cc="$CC" CC="$CC -fno-strict-aliasing" if test "$cross_compiling" = yes; then @@ -5222,39 +4640,36 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>&5 ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_try") 2>&5 ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_no_strict_aliasing_ok=yes else - $as_echo "$as_me: program exited with status $ac_status" >&5 -$as_echo "$as_me: failed program was:" >&5 + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) ac_cv_no_strict_aliasing_ok=no fi -rm -rf conftest.dSYM rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi CC="$ac_save_cc" - { $as_echo "$as_me:$LINENO: result: $ac_cv_no_strict_aliasing_ok" >&5 -$as_echo "$ac_cv_no_strict_aliasing_ok" >&6; } + { echo "$as_me:$LINENO: result: $ac_cv_no_strict_aliasing_ok" >&5 +echo "${ECHO_T}$ac_cv_no_strict_aliasing_ok" >&6; } if test $ac_cv_no_strict_aliasing_ok = yes then BASECFLAGS="$BASECFLAGS -fno-strict-aliasing" @@ -5293,8 +4708,8 @@ ARCH_RUN_32BIT="arch -i386 -ppc" else - { { $as_echo "$as_me:$LINENO: error: proper usage is --with-universalarch=32-bit|64-bit|all" >&5 -$as_echo "$as_me: error: proper usage is --with-universalarch=32-bit|64-bit|all" >&2;} + { { echo "$as_me:$LINENO: error: proper usage is --with-universalarch=32-bit|64-bit|all" >&5 +echo "$as_me: error: proper usage is --with-universalarch=32-bit|64-bit|all" >&2;} { (exit 1); exit 1; }; } fi @@ -5368,10 +4783,10 @@ ac_cv_opt_olimit_ok=no fi -{ $as_echo "$as_me:$LINENO: checking whether $CC accepts -OPT:Olimit=0" >&5 -$as_echo_n "checking whether $CC accepts -OPT:Olimit=0... " >&6; } +{ echo "$as_me:$LINENO: checking whether $CC accepts -OPT:Olimit=0" >&5 +echo $ECHO_N "checking whether $CC accepts -OPT:Olimit=0... $ECHO_C" >&6; } if test "${ac_cv_opt_olimit_ok+set}" = set; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_save_cc="$CC" CC="$CC -OPT:Olimit=0" @@ -5392,32 +4807,29 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>&5 ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_try") 2>&5 ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_opt_olimit_ok=yes else - $as_echo "$as_me: program exited with status $ac_status" >&5 -$as_echo "$as_me: failed program was:" >&5 + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) ac_cv_opt_olimit_ok=no fi -rm -rf conftest.dSYM rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi @@ -5425,8 +4837,8 @@ CC="$ac_save_cc" fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_opt_olimit_ok" >&5 -$as_echo "$ac_cv_opt_olimit_ok" >&6; } +{ echo "$as_me:$LINENO: result: $ac_cv_opt_olimit_ok" >&5 +echo "${ECHO_T}$ac_cv_opt_olimit_ok" >&6; } if test $ac_cv_opt_olimit_ok = yes; then case $ac_sys_system in # XXX is this branch needed? On MacOSX 10.2.2 the result of the @@ -5439,10 +4851,10 @@ ;; esac else - { $as_echo "$as_me:$LINENO: checking whether $CC accepts -Olimit 1500" >&5 -$as_echo_n "checking whether $CC accepts -Olimit 1500... " >&6; } + { echo "$as_me:$LINENO: checking whether $CC accepts -Olimit 1500" >&5 +echo $ECHO_N "checking whether $CC accepts -Olimit 1500... $ECHO_C" >&6; } if test "${ac_cv_olimit_ok+set}" = set; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_save_cc="$CC" CC="$CC -Olimit 1500" @@ -5463,32 +4875,29 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>&5 ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_try") 2>&5 ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_olimit_ok=yes else - $as_echo "$as_me: program exited with status $ac_status" >&5 -$as_echo "$as_me: failed program was:" >&5 + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) ac_cv_olimit_ok=no fi -rm -rf conftest.dSYM rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi @@ -5496,8 +4905,8 @@ CC="$ac_save_cc" fi - { $as_echo "$as_me:$LINENO: result: $ac_cv_olimit_ok" >&5 -$as_echo "$ac_cv_olimit_ok" >&6; } + { echo "$as_me:$LINENO: result: $ac_cv_olimit_ok" >&5 +echo "${ECHO_T}$ac_cv_olimit_ok" >&6; } if test $ac_cv_olimit_ok = yes; then BASECFLAGS="$BASECFLAGS -Olimit 1500" fi @@ -5506,8 +4915,8 @@ # Check whether GCC supports PyArg_ParseTuple format if test "$GCC" = "yes" then - { $as_echo "$as_me:$LINENO: checking whether gcc supports ParseTuple __format__" >&5 -$as_echo_n "checking whether gcc supports ParseTuple __format__... " >&6; } + { echo "$as_me:$LINENO: checking whether gcc supports ParseTuple __format__" >&5 +echo $ECHO_N "checking whether gcc supports ParseTuple __format__... $ECHO_C" >&6; } save_CFLAGS=$CFLAGS CFLAGS="$CFLAGS -Werror" cat >conftest.$ac_ext <<_ACEOF @@ -5533,14 +4942,13 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err @@ -5550,14 +4958,14 @@ #define HAVE_ATTRIBUTE_FORMAT_PARSETUPLE 1 _ACEOF - { $as_echo "$as_me:$LINENO: result: yes" >&5 -$as_echo "yes" >&6; } + { echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; } else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 - { $as_echo "$as_me:$LINENO: result: no" >&5 -$as_echo "no" >&6; } + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } fi @@ -5570,10 +4978,10 @@ # complain if unaccepted options are passed (e.g. gcc on Mac OS X). # So we have to see first whether pthreads are available without # options before we can check whether -Kpthread improves anything. -{ $as_echo "$as_me:$LINENO: checking whether pthreads are available without options" >&5 -$as_echo_n "checking whether pthreads are available without options... " >&6; } +{ echo "$as_me:$LINENO: checking whether pthreads are available without options" >&5 +echo $ECHO_N "checking whether pthreads are available without options... $ECHO_C" >&6; } if test "${ac_cv_pthread_is_default+set}" = set; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else if test "$cross_compiling" = yes; then ac_cv_pthread_is_default=no @@ -5604,21 +5012,19 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>&5 ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_try") 2>&5 ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_pthread_is_default=yes @@ -5626,14 +5032,13 @@ ac_cv_pthread=no else - $as_echo "$as_me: program exited with status $ac_status" >&5 -$as_echo "$as_me: failed program was:" >&5 + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) ac_cv_pthread_is_default=no fi -rm -rf conftest.dSYM rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi @@ -5641,8 +5046,8 @@ fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_pthread_is_default" >&5 -$as_echo "$ac_cv_pthread_is_default" >&6; } +{ echo "$as_me:$LINENO: result: $ac_cv_pthread_is_default" >&5 +echo "${ECHO_T}$ac_cv_pthread_is_default" >&6; } if test $ac_cv_pthread_is_default = yes @@ -5654,10 +5059,10 @@ # Some compilers won't report that they do not support -Kpthread, # so we need to run a program to see whether it really made the # function available. -{ $as_echo "$as_me:$LINENO: checking whether $CC accepts -Kpthread" >&5 -$as_echo_n "checking whether $CC accepts -Kpthread... " >&6; } +{ echo "$as_me:$LINENO: checking whether $CC accepts -Kpthread" >&5 +echo $ECHO_N "checking whether $CC accepts -Kpthread... $ECHO_C" >&6; } if test "${ac_cv_kpthread+set}" = set; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_save_cc="$CC" CC="$CC -Kpthread" @@ -5690,32 +5095,29 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>&5 ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_try") 2>&5 ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_kpthread=yes else - $as_echo "$as_me: program exited with status $ac_status" >&5 -$as_echo "$as_me: failed program was:" >&5 + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) ac_cv_kpthread=no fi -rm -rf conftest.dSYM rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi @@ -5723,8 +5125,8 @@ CC="$ac_save_cc" fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_kpthread" >&5 -$as_echo "$ac_cv_kpthread" >&6; } +{ echo "$as_me:$LINENO: result: $ac_cv_kpthread" >&5 +echo "${ECHO_T}$ac_cv_kpthread" >&6; } fi if test $ac_cv_kpthread = no -a $ac_cv_pthread_is_default = no @@ -5734,10 +5136,10 @@ # Some compilers won't report that they do not support -Kthread, # so we need to run a program to see whether it really made the # function available. -{ $as_echo "$as_me:$LINENO: checking whether $CC accepts -Kthread" >&5 -$as_echo_n "checking whether $CC accepts -Kthread... " >&6; } +{ echo "$as_me:$LINENO: checking whether $CC accepts -Kthread" >&5 +echo $ECHO_N "checking whether $CC accepts -Kthread... $ECHO_C" >&6; } if test "${ac_cv_kthread+set}" = set; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_save_cc="$CC" CC="$CC -Kthread" @@ -5770,32 +5172,29 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>&5 ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_try") 2>&5 ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_kthread=yes else - $as_echo "$as_me: program exited with status $ac_status" >&5 -$as_echo "$as_me: failed program was:" >&5 + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) ac_cv_kthread=no fi -rm -rf conftest.dSYM rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi @@ -5803,8 +5202,8 @@ CC="$ac_save_cc" fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_kthread" >&5 -$as_echo "$ac_cv_kthread" >&6; } +{ echo "$as_me:$LINENO: result: $ac_cv_kthread" >&5 +echo "${ECHO_T}$ac_cv_kthread" >&6; } fi if test $ac_cv_kthread = no -a $ac_cv_pthread_is_default = no @@ -5814,10 +5213,10 @@ # Some compilers won't report that they do not support -pthread, # so we need to run a program to see whether it really made the # function available. -{ $as_echo "$as_me:$LINENO: checking whether $CC accepts -pthread" >&5 -$as_echo_n "checking whether $CC accepts -pthread... " >&6; } +{ echo "$as_me:$LINENO: checking whether $CC accepts -pthread" >&5 +echo $ECHO_N "checking whether $CC accepts -pthread... $ECHO_C" >&6; } if test "${ac_cv_thread+set}" = set; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_save_cc="$CC" CC="$CC -pthread" @@ -5850,32 +5249,29 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>&5 ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_try") 2>&5 ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_pthread=yes else - $as_echo "$as_me: program exited with status $ac_status" >&5 -$as_echo "$as_me: failed program was:" >&5 + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) ac_cv_pthread=no fi -rm -rf conftest.dSYM rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi @@ -5883,8 +5279,8 @@ CC="$ac_save_cc" fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_pthread" >&5 -$as_echo "$ac_cv_pthread" >&6; } +{ echo "$as_me:$LINENO: result: $ac_cv_pthread" >&5 +echo "${ECHO_T}$ac_cv_pthread" >&6; } fi # If we have set a CC compiler flag for thread support then @@ -5892,8 +5288,8 @@ ac_cv_cxx_thread=no if test ! -z "$CXX" then -{ $as_echo "$as_me:$LINENO: checking whether $CXX also accepts flags for thread support" >&5 -$as_echo_n "checking whether $CXX also accepts flags for thread support... " >&6; } +{ echo "$as_me:$LINENO: checking whether $CXX also accepts flags for thread support" >&5 +echo $ECHO_N "checking whether $CXX also accepts flags for thread support... $ECHO_C" >&6; } ac_save_cxx="$CXX" if test "$ac_cv_kpthread" = "yes" @@ -5923,17 +5319,17 @@ fi rm -fr conftest* fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_cxx_thread" >&5 -$as_echo "$ac_cv_cxx_thread" >&6; } +{ echo "$as_me:$LINENO: result: $ac_cv_cxx_thread" >&5 +echo "${ECHO_T}$ac_cv_cxx_thread" >&6; } fi CXX="$ac_save_cxx" # checks for header files -{ $as_echo "$as_me:$LINENO: checking for ANSI C header files" >&5 -$as_echo_n "checking for ANSI C header files... " >&6; } +{ echo "$as_me:$LINENO: checking for ANSI C header files" >&5 +echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6; } if test "${ac_cv_header_stdc+set}" = set; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ @@ -5960,21 +5356,20 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_header_stdc=yes else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_header_stdc=no @@ -6048,66 +5443,132 @@ # define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) #endif -#define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) -int -main () -{ - int i; - for (i = 0; i < 256; i++) - if (XOR (islower (i), ISLOWER (i)) - || toupper (i) != TOUPPER (i)) - return 2; - return 0; -} +#define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) +int +main () +{ + int i; + for (i = 0; i < 256; i++) + if (XOR (islower (i), ISLOWER (i)) + || toupper (i) != TOUPPER (i)) + return 2; + return 0; +} +_ACEOF +rm -f conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + : +else + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +( exit $ac_status ) +ac_cv_header_stdc=no +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi + + +fi +fi +{ echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5 +echo "${ECHO_T}$ac_cv_header_stdc" >&6; } +if test $ac_cv_header_stdc = yes; then + +cat >>confdefs.h <<\_ACEOF +#define STDC_HEADERS 1 +_ACEOF + +fi + +# On IRIX 5.3, sys/types and inttypes.h are conflicting. + + + + + + + + + +for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ + inttypes.h stdint.h unistd.h +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +{ echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } +if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default + +#include <$ac_header> _ACEOF -rm -f conftest$ac_exeext -if { (ac_try="$ac_link" +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_link") 2>&5 - ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { ac_try='./conftest$ac_exeext' - { (case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_try") 2>&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - : + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + eval "$as_ac_Header=yes" else - $as_echo "$as_me: program exited with status $ac_status" >&5 -$as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -( exit $ac_status ) -ac_cv_header_stdc=no -fi -rm -rf conftest.dSYM -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext + eval "$as_ac_Header=no" fi - -fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5 -$as_echo "$ac_cv_header_stdc" >&6; } -if test $ac_cv_header_stdc = yes; then - -cat >>confdefs.h <<\_ACEOF -#define STDC_HEADERS 1 +ac_res=`eval echo '${'$as_ac_Header'}'` + { echo "$as_me:$LINENO: result: $ac_res" >&5 +echo "${ECHO_T}$ac_res" >&6; } +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi +done + + @@ -6175,21 +5636,20 @@ sys/resource.h netpacket/packet.h sysexits.h bluetooth.h \ bluetooth/bluetooth.h linux/tipc.h do -as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then - { $as_echo "$as_me:$LINENO: checking for $ac_header" >&5 -$as_echo_n "checking for $ac_header... " >&6; } + { echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 fi -ac_res=`eval 'as_val=${'$as_ac_Header'} - $as_echo "$as_val"'` - { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } +ac_res=`eval echo '${'$as_ac_Header'}'` + { echo "$as_me:$LINENO: result: $ac_res" >&5 +echo "${ECHO_T}$ac_res" >&6; } else # Is the header compilable? -{ $as_echo "$as_me:$LINENO: checking $ac_header usability" >&5 -$as_echo_n "checking $ac_header usability... " >&6; } +{ echo "$as_me:$LINENO: checking $ac_header usability" >&5 +echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF @@ -6205,33 +5665,32 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_header_compiler=yes else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_compiler=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 -$as_echo "$ac_header_compiler" >&6; } +{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6; } # Is the header present? -{ $as_echo "$as_me:$LINENO: checking $ac_header presence" >&5 -$as_echo_n "checking $ac_header presence... " >&6; } +{ echo "$as_me:$LINENO: checking $ac_header presence" >&5 +echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF @@ -6245,52 +5704,51 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then ac_header_preproc=yes else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_preproc=no fi rm -f conftest.err conftest.$ac_ext -{ $as_echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 -$as_echo "$ac_header_preproc" >&6; } +{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6; } # So? What about this header? case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in yes:no: ) - { $as_echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 -$as_echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} - { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 -$as_echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} ac_header_preproc=yes ;; no:yes:* ) - { $as_echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 -$as_echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} - { $as_echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 -$as_echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} - { $as_echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 -$as_echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} - { $as_echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 -$as_echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} - { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 -$as_echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} - { $as_echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 -$as_echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 +echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 +echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 +echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 +echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} ( cat <<\_ASBOX ## -------------------------------------- ## ## Report this to http://bugs.python.org/ ## @@ -6299,24 +5757,21 @@ ) | sed "s/^/$as_me: WARNING: /" >&2 ;; esac -{ $as_echo "$as_me:$LINENO: checking for $ac_header" >&5 -$as_echo_n "checking for $ac_header... " >&6; } +{ echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else eval "$as_ac_Header=\$ac_header_preproc" fi -ac_res=`eval 'as_val=${'$as_ac_Header'} - $as_echo "$as_val"'` - { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } +ac_res=`eval echo '${'$as_ac_Header'}'` + { echo "$as_me:$LINENO: result: $ac_res" >&5 +echo "${ECHO_T}$ac_res" >&6; } fi -as_val=`eval 'as_val=${'$as_ac_Header'} - $as_echo "$as_val"'` - if test "x$as_val" = x""yes; then +if test `eval echo '${'$as_ac_Header'}'` = yes; then cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi @@ -6330,11 +5785,11 @@ ac_header_dirent=no for ac_hdr in dirent.h sys/ndir.h sys/dir.h ndir.h; do - as_ac_Header=`$as_echo "ac_cv_header_dirent_$ac_hdr" | $as_tr_sh` -{ $as_echo "$as_me:$LINENO: checking for $ac_hdr that defines DIR" >&5 -$as_echo_n "checking for $ac_hdr that defines DIR... " >&6; } + as_ac_Header=`echo "ac_cv_header_dirent_$ac_hdr" | $as_tr_sh` +{ echo "$as_me:$LINENO: checking for $ac_hdr that defines DIR" >&5 +echo $ECHO_N "checking for $ac_hdr that defines DIR... $ECHO_C" >&6; } if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ @@ -6360,21 +5815,20 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then eval "$as_ac_Header=yes" else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 eval "$as_ac_Header=no" @@ -6382,15 +5836,12 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi -ac_res=`eval 'as_val=${'$as_ac_Header'} - $as_echo "$as_val"'` - { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } -as_val=`eval 'as_val=${'$as_ac_Header'} - $as_echo "$as_val"'` - if test "x$as_val" = x""yes; then +ac_res=`eval echo '${'$as_ac_Header'}'` + { echo "$as_me:$LINENO: result: $ac_res" >&5 +echo "${ECHO_T}$ac_res" >&6; } +if test `eval echo '${'$as_ac_Header'}'` = yes; then cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_hdr" | $as_tr_cpp` 1 +#define `echo "HAVE_$ac_hdr" | $as_tr_cpp` 1 _ACEOF ac_header_dirent=$ac_hdr; break @@ -6399,10 +5850,10 @@ done # Two versions of opendir et al. are in -ldir and -lx on SCO Xenix. if test $ac_header_dirent = dirent.h; then - { $as_echo "$as_me:$LINENO: checking for library containing opendir" >&5 -$as_echo_n "checking for library containing opendir... " >&6; } + { echo "$as_me:$LINENO: checking for library containing opendir" >&5 +echo $ECHO_N "checking for library containing opendir... $ECHO_C" >&6; } if test "${ac_cv_search_opendir+set}" = set; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_func_search_save_LIBS=$LIBS cat >conftest.$ac_ext <<_ACEOF @@ -6440,30 +5891,26 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err - } && test -s conftest$ac_exeext && { - test "$cross_compiling" = yes || - $as_test_x conftest$ac_exeext - }; then + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then ac_cv_search_opendir=$ac_res else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi -rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext if test "${ac_cv_search_opendir+set}" = set; then @@ -6478,8 +5925,8 @@ rm conftest.$ac_ext LIBS=$ac_func_search_save_LIBS fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_search_opendir" >&5 -$as_echo "$ac_cv_search_opendir" >&6; } +{ echo "$as_me:$LINENO: result: $ac_cv_search_opendir" >&5 +echo "${ECHO_T}$ac_cv_search_opendir" >&6; } ac_res=$ac_cv_search_opendir if test "$ac_res" != no; then test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" @@ -6487,10 +5934,10 @@ fi else - { $as_echo "$as_me:$LINENO: checking for library containing opendir" >&5 -$as_echo_n "checking for library containing opendir... " >&6; } + { echo "$as_me:$LINENO: checking for library containing opendir" >&5 +echo $ECHO_N "checking for library containing opendir... $ECHO_C" >&6; } if test "${ac_cv_search_opendir+set}" = set; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_func_search_save_LIBS=$LIBS cat >conftest.$ac_ext <<_ACEOF @@ -6528,30 +5975,26 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err - } && test -s conftest$ac_exeext && { - test "$cross_compiling" = yes || - $as_test_x conftest$ac_exeext - }; then + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then ac_cv_search_opendir=$ac_res else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi -rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext if test "${ac_cv_search_opendir+set}" = set; then @@ -6566,8 +6009,8 @@ rm conftest.$ac_ext LIBS=$ac_func_search_save_LIBS fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_search_opendir" >&5 -$as_echo "$ac_cv_search_opendir" >&6; } +{ echo "$as_me:$LINENO: result: $ac_cv_search_opendir" >&5 +echo "${ECHO_T}$ac_cv_search_opendir" >&6; } ac_res=$ac_cv_search_opendir if test "$ac_res" != no; then test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" @@ -6576,10 +6019,10 @@ fi -{ $as_echo "$as_me:$LINENO: checking whether sys/types.h defines makedev" >&5 -$as_echo_n "checking whether sys/types.h defines makedev... " >&6; } +{ echo "$as_me:$LINENO: checking whether sys/types.h defines makedev" >&5 +echo $ECHO_N "checking whether sys/types.h defines makedev... $ECHO_C" >&6; } if test "${ac_cv_header_sys_types_h_makedev+set}" = set; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ @@ -6602,50 +6045,46 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err - } && test -s conftest$ac_exeext && { - test "$cross_compiling" = yes || - $as_test_x conftest$ac_exeext - }; then + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then ac_cv_header_sys_types_h_makedev=yes else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_header_sys_types_h_makedev=no fi -rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_sys_types_h_makedev" >&5 -$as_echo "$ac_cv_header_sys_types_h_makedev" >&6; } +{ echo "$as_me:$LINENO: result: $ac_cv_header_sys_types_h_makedev" >&5 +echo "${ECHO_T}$ac_cv_header_sys_types_h_makedev" >&6; } if test $ac_cv_header_sys_types_h_makedev = no; then if test "${ac_cv_header_sys_mkdev_h+set}" = set; then - { $as_echo "$as_me:$LINENO: checking for sys/mkdev.h" >&5 -$as_echo_n "checking for sys/mkdev.h... " >&6; } + { echo "$as_me:$LINENO: checking for sys/mkdev.h" >&5 +echo $ECHO_N "checking for sys/mkdev.h... $ECHO_C" >&6; } if test "${ac_cv_header_sys_mkdev_h+set}" = set; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_sys_mkdev_h" >&5 -$as_echo "$ac_cv_header_sys_mkdev_h" >&6; } +{ echo "$as_me:$LINENO: result: $ac_cv_header_sys_mkdev_h" >&5 +echo "${ECHO_T}$ac_cv_header_sys_mkdev_h" >&6; } else # Is the header compilable? -{ $as_echo "$as_me:$LINENO: checking sys/mkdev.h usability" >&5 -$as_echo_n "checking sys/mkdev.h usability... " >&6; } +{ echo "$as_me:$LINENO: checking sys/mkdev.h usability" >&5 +echo $ECHO_N "checking sys/mkdev.h usability... $ECHO_C" >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF @@ -6661,33 +6100,32 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_header_compiler=yes else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_compiler=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 -$as_echo "$ac_header_compiler" >&6; } +{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6; } # Is the header present? -{ $as_echo "$as_me:$LINENO: checking sys/mkdev.h presence" >&5 -$as_echo_n "checking sys/mkdev.h presence... " >&6; } +{ echo "$as_me:$LINENO: checking sys/mkdev.h presence" >&5 +echo $ECHO_N "checking sys/mkdev.h presence... $ECHO_C" >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF @@ -6701,52 +6139,51 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then ac_header_preproc=yes else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_preproc=no fi rm -f conftest.err conftest.$ac_ext -{ $as_echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 -$as_echo "$ac_header_preproc" >&6; } +{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6; } # So? What about this header? case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in yes:no: ) - { $as_echo "$as_me:$LINENO: WARNING: sys/mkdev.h: accepted by the compiler, rejected by the preprocessor!" >&5 -$as_echo "$as_me: WARNING: sys/mkdev.h: accepted by the compiler, rejected by the preprocessor!" >&2;} - { $as_echo "$as_me:$LINENO: WARNING: sys/mkdev.h: proceeding with the compiler's result" >&5 -$as_echo "$as_me: WARNING: sys/mkdev.h: proceeding with the compiler's result" >&2;} + { echo "$as_me:$LINENO: WARNING: sys/mkdev.h: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: sys/mkdev.h: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: sys/mkdev.h: proceeding with the compiler's result" >&5 +echo "$as_me: WARNING: sys/mkdev.h: proceeding with the compiler's result" >&2;} ac_header_preproc=yes ;; no:yes:* ) - { $as_echo "$as_me:$LINENO: WARNING: sys/mkdev.h: present but cannot be compiled" >&5 -$as_echo "$as_me: WARNING: sys/mkdev.h: present but cannot be compiled" >&2;} - { $as_echo "$as_me:$LINENO: WARNING: sys/mkdev.h: check for missing prerequisite headers?" >&5 -$as_echo "$as_me: WARNING: sys/mkdev.h: check for missing prerequisite headers?" >&2;} - { $as_echo "$as_me:$LINENO: WARNING: sys/mkdev.h: see the Autoconf documentation" >&5 -$as_echo "$as_me: WARNING: sys/mkdev.h: see the Autoconf documentation" >&2;} - { $as_echo "$as_me:$LINENO: WARNING: sys/mkdev.h: section \"Present But Cannot Be Compiled\"" >&5 -$as_echo "$as_me: WARNING: sys/mkdev.h: section \"Present But Cannot Be Compiled\"" >&2;} - { $as_echo "$as_me:$LINENO: WARNING: sys/mkdev.h: proceeding with the preprocessor's result" >&5 -$as_echo "$as_me: WARNING: sys/mkdev.h: proceeding with the preprocessor's result" >&2;} - { $as_echo "$as_me:$LINENO: WARNING: sys/mkdev.h: in the future, the compiler will take precedence" >&5 -$as_echo "$as_me: WARNING: sys/mkdev.h: in the future, the compiler will take precedence" >&2;} + { echo "$as_me:$LINENO: WARNING: sys/mkdev.h: present but cannot be compiled" >&5 +echo "$as_me: WARNING: sys/mkdev.h: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: sys/mkdev.h: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: sys/mkdev.h: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: sys/mkdev.h: see the Autoconf documentation" >&5 +echo "$as_me: WARNING: sys/mkdev.h: see the Autoconf documentation" >&2;} + { echo "$as_me:$LINENO: WARNING: sys/mkdev.h: section \"Present But Cannot Be Compiled\"" >&5 +echo "$as_me: WARNING: sys/mkdev.h: section \"Present But Cannot Be Compiled\"" >&2;} + { echo "$as_me:$LINENO: WARNING: sys/mkdev.h: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: sys/mkdev.h: proceeding with the preprocessor's result" >&2;} + { echo "$as_me:$LINENO: WARNING: sys/mkdev.h: in the future, the compiler will take precedence" >&5 +echo "$as_me: WARNING: sys/mkdev.h: in the future, the compiler will take precedence" >&2;} ( cat <<\_ASBOX ## -------------------------------------- ## ## Report this to http://bugs.python.org/ ## @@ -6755,18 +6192,18 @@ ) | sed "s/^/$as_me: WARNING: /" >&2 ;; esac -{ $as_echo "$as_me:$LINENO: checking for sys/mkdev.h" >&5 -$as_echo_n "checking for sys/mkdev.h... " >&6; } +{ echo "$as_me:$LINENO: checking for sys/mkdev.h" >&5 +echo $ECHO_N "checking for sys/mkdev.h... $ECHO_C" >&6; } if test "${ac_cv_header_sys_mkdev_h+set}" = set; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_cv_header_sys_mkdev_h=$ac_header_preproc fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_sys_mkdev_h" >&5 -$as_echo "$ac_cv_header_sys_mkdev_h" >&6; } +{ echo "$as_me:$LINENO: result: $ac_cv_header_sys_mkdev_h" >&5 +echo "${ECHO_T}$ac_cv_header_sys_mkdev_h" >&6; } fi -if test "x$ac_cv_header_sys_mkdev_h" = x""yes; then +if test $ac_cv_header_sys_mkdev_h = yes; then cat >>confdefs.h <<\_ACEOF #define MAJOR_IN_MKDEV 1 @@ -6778,17 +6215,17 @@ if test $ac_cv_header_sys_mkdev_h = no; then if test "${ac_cv_header_sys_sysmacros_h+set}" = set; then - { $as_echo "$as_me:$LINENO: checking for sys/sysmacros.h" >&5 -$as_echo_n "checking for sys/sysmacros.h... " >&6; } + { echo "$as_me:$LINENO: checking for sys/sysmacros.h" >&5 +echo $ECHO_N "checking for sys/sysmacros.h... $ECHO_C" >&6; } if test "${ac_cv_header_sys_sysmacros_h+set}" = set; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_sys_sysmacros_h" >&5 -$as_echo "$ac_cv_header_sys_sysmacros_h" >&6; } +{ echo "$as_me:$LINENO: result: $ac_cv_header_sys_sysmacros_h" >&5 +echo "${ECHO_T}$ac_cv_header_sys_sysmacros_h" >&6; } else # Is the header compilable? -{ $as_echo "$as_me:$LINENO: checking sys/sysmacros.h usability" >&5 -$as_echo_n "checking sys/sysmacros.h usability... " >&6; } +{ echo "$as_me:$LINENO: checking sys/sysmacros.h usability" >&5 +echo $ECHO_N "checking sys/sysmacros.h usability... $ECHO_C" >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF @@ -6804,33 +6241,32 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_header_compiler=yes else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_compiler=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 -$as_echo "$ac_header_compiler" >&6; } +{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6; } # Is the header present? -{ $as_echo "$as_me:$LINENO: checking sys/sysmacros.h presence" >&5 -$as_echo_n "checking sys/sysmacros.h presence... " >&6; } +{ echo "$as_me:$LINENO: checking sys/sysmacros.h presence" >&5 +echo $ECHO_N "checking sys/sysmacros.h presence... $ECHO_C" >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF @@ -6844,52 +6280,51 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then ac_header_preproc=yes else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_preproc=no fi rm -f conftest.err conftest.$ac_ext -{ $as_echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 -$as_echo "$ac_header_preproc" >&6; } +{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6; } # So? What about this header? case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in yes:no: ) - { $as_echo "$as_me:$LINENO: WARNING: sys/sysmacros.h: accepted by the compiler, rejected by the preprocessor!" >&5 -$as_echo "$as_me: WARNING: sys/sysmacros.h: accepted by the compiler, rejected by the preprocessor!" >&2;} - { $as_echo "$as_me:$LINENO: WARNING: sys/sysmacros.h: proceeding with the compiler's result" >&5 -$as_echo "$as_me: WARNING: sys/sysmacros.h: proceeding with the compiler's result" >&2;} + { echo "$as_me:$LINENO: WARNING: sys/sysmacros.h: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: sys/sysmacros.h: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: sys/sysmacros.h: proceeding with the compiler's result" >&5 +echo "$as_me: WARNING: sys/sysmacros.h: proceeding with the compiler's result" >&2;} ac_header_preproc=yes ;; no:yes:* ) - { $as_echo "$as_me:$LINENO: WARNING: sys/sysmacros.h: present but cannot be compiled" >&5 -$as_echo "$as_me: WARNING: sys/sysmacros.h: present but cannot be compiled" >&2;} - { $as_echo "$as_me:$LINENO: WARNING: sys/sysmacros.h: check for missing prerequisite headers?" >&5 -$as_echo "$as_me: WARNING: sys/sysmacros.h: check for missing prerequisite headers?" >&2;} - { $as_echo "$as_me:$LINENO: WARNING: sys/sysmacros.h: see the Autoconf documentation" >&5 -$as_echo "$as_me: WARNING: sys/sysmacros.h: see the Autoconf documentation" >&2;} - { $as_echo "$as_me:$LINENO: WARNING: sys/sysmacros.h: section \"Present But Cannot Be Compiled\"" >&5 -$as_echo "$as_me: WARNING: sys/sysmacros.h: section \"Present But Cannot Be Compiled\"" >&2;} - { $as_echo "$as_me:$LINENO: WARNING: sys/sysmacros.h: proceeding with the preprocessor's result" >&5 -$as_echo "$as_me: WARNING: sys/sysmacros.h: proceeding with the preprocessor's result" >&2;} - { $as_echo "$as_me:$LINENO: WARNING: sys/sysmacros.h: in the future, the compiler will take precedence" >&5 -$as_echo "$as_me: WARNING: sys/sysmacros.h: in the future, the compiler will take precedence" >&2;} + { echo "$as_me:$LINENO: WARNING: sys/sysmacros.h: present but cannot be compiled" >&5 +echo "$as_me: WARNING: sys/sysmacros.h: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: sys/sysmacros.h: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: sys/sysmacros.h: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: sys/sysmacros.h: see the Autoconf documentation" >&5 +echo "$as_me: WARNING: sys/sysmacros.h: see the Autoconf documentation" >&2;} + { echo "$as_me:$LINENO: WARNING: sys/sysmacros.h: section \"Present But Cannot Be Compiled\"" >&5 +echo "$as_me: WARNING: sys/sysmacros.h: section \"Present But Cannot Be Compiled\"" >&2;} + { echo "$as_me:$LINENO: WARNING: sys/sysmacros.h: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: sys/sysmacros.h: proceeding with the preprocessor's result" >&2;} + { echo "$as_me:$LINENO: WARNING: sys/sysmacros.h: in the future, the compiler will take precedence" >&5 +echo "$as_me: WARNING: sys/sysmacros.h: in the future, the compiler will take precedence" >&2;} ( cat <<\_ASBOX ## -------------------------------------- ## ## Report this to http://bugs.python.org/ ## @@ -6898,18 +6333,18 @@ ) | sed "s/^/$as_me: WARNING: /" >&2 ;; esac -{ $as_echo "$as_me:$LINENO: checking for sys/sysmacros.h" >&5 -$as_echo_n "checking for sys/sysmacros.h... " >&6; } +{ echo "$as_me:$LINENO: checking for sys/sysmacros.h" >&5 +echo $ECHO_N "checking for sys/sysmacros.h... $ECHO_C" >&6; } if test "${ac_cv_header_sys_sysmacros_h+set}" = set; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_cv_header_sys_sysmacros_h=$ac_header_preproc fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_sys_sysmacros_h" >&5 -$as_echo "$ac_cv_header_sys_sysmacros_h" >&6; } +{ echo "$as_me:$LINENO: result: $ac_cv_header_sys_sysmacros_h" >&5 +echo "${ECHO_T}$ac_cv_header_sys_sysmacros_h" >&6; } fi -if test "x$ac_cv_header_sys_sysmacros_h" = x""yes; then +if test $ac_cv_header_sys_sysmacros_h = yes; then cat >>confdefs.h <<\_ACEOF #define MAJOR_IN_SYSMACROS 1 @@ -6926,11 +6361,11 @@ for ac_header in term.h do -as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` -{ $as_echo "$as_me:$LINENO: checking for $ac_header" >&5 -$as_echo_n "checking for $ac_header... " >&6; } +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +{ echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ @@ -6952,21 +6387,20 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then eval "$as_ac_Header=yes" else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 eval "$as_ac_Header=no" @@ -6974,15 +6408,12 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi -ac_res=`eval 'as_val=${'$as_ac_Header'} - $as_echo "$as_val"'` - { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } -as_val=`eval 'as_val=${'$as_ac_Header'} - $as_echo "$as_val"'` - if test "x$as_val" = x""yes; then +ac_res=`eval echo '${'$as_ac_Header'}'` + { echo "$as_me:$LINENO: result: $ac_res" >&5 +echo "${ECHO_T}$ac_res" >&6; } +if test `eval echo '${'$as_ac_Header'}'` = yes; then cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi @@ -6994,11 +6425,11 @@ for ac_header in linux/netlink.h do -as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` -{ $as_echo "$as_me:$LINENO: checking for $ac_header" >&5 -$as_echo_n "checking for $ac_header... " >&6; } +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +{ echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ @@ -7023,21 +6454,20 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then eval "$as_ac_Header=yes" else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 eval "$as_ac_Header=no" @@ -7045,15 +6475,12 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi -ac_res=`eval 'as_val=${'$as_ac_Header'} - $as_echo "$as_val"'` - { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } -as_val=`eval 'as_val=${'$as_ac_Header'} - $as_echo "$as_val"'` - if test "x$as_val" = x""yes; then +ac_res=`eval echo '${'$as_ac_Header'}'` + { echo "$as_me:$LINENO: result: $ac_res" >&5 +echo "${ECHO_T}$ac_res" >&6; } +if test `eval echo '${'$as_ac_Header'}'` = yes; then cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi @@ -7063,8 +6490,8 @@ # checks for typedefs was_it_defined=no -{ $as_echo "$as_me:$LINENO: checking for clock_t in time.h" >&5 -$as_echo_n "checking for clock_t in time.h... " >&6; } +{ echo "$as_me:$LINENO: checking for clock_t in time.h" >&5 +echo $ECHO_N "checking for clock_t in time.h... $ECHO_C" >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF @@ -7088,12 +6515,12 @@ fi rm -f conftest* -{ $as_echo "$as_me:$LINENO: result: $was_it_defined" >&5 -$as_echo "$was_it_defined" >&6; } +{ echo "$as_me:$LINENO: result: $was_it_defined" >&5 +echo "${ECHO_T}$was_it_defined" >&6; } # Check whether using makedev requires defining _OSF_SOURCE -{ $as_echo "$as_me:$LINENO: checking for makedev" >&5 -$as_echo_n "checking for makedev... " >&6; } +{ echo "$as_me:$LINENO: checking for makedev" >&5 +echo $ECHO_N "checking for makedev... $ECHO_C" >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF @@ -7115,30 +6542,26 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err - } && test -s conftest$ac_exeext && { - test "$cross_compiling" = yes || - $as_test_x conftest$ac_exeext - }; then + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then ac_cv_has_makedev=yes else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_has_makedev=no fi -rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext if test "$ac_cv_has_makedev" = "no"; then @@ -7167,30 +6590,26 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err - } && test -s conftest$ac_exeext && { - test "$cross_compiling" = yes || - $as_test_x conftest$ac_exeext - }; then + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then ac_cv_has_makedev=yes else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_has_makedev=no fi -rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext if test "$ac_cv_has_makedev" = "yes"; then @@ -7201,8 +6620,8 @@ fi fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_has_makedev" >&5 -$as_echo "$ac_cv_has_makedev" >&6; } +{ echo "$as_me:$LINENO: result: $ac_cv_has_makedev" >&5 +echo "${ECHO_T}$ac_cv_has_makedev" >&6; } if test "$ac_cv_has_makedev" = "yes"; then cat >>confdefs.h <<\_ACEOF @@ -7219,8 +6638,8 @@ # work-around, disable LFS on such configurations use_lfs=yes -{ $as_echo "$as_me:$LINENO: checking Solaris LFS bug" >&5 -$as_echo_n "checking Solaris LFS bug... " >&6; } +{ echo "$as_me:$LINENO: checking Solaris LFS bug" >&5 +echo $ECHO_N "checking Solaris LFS bug... $ECHO_C" >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF @@ -7246,29 +6665,28 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then sol_lfs_bug=no else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 sol_lfs_bug=yes fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -{ $as_echo "$as_me:$LINENO: result: $sol_lfs_bug" >&5 -$as_echo "$sol_lfs_bug" >&6; } +{ echo "$as_me:$LINENO: result: $sol_lfs_bug" >&5 +echo "${ECHO_T}$sol_lfs_bug" >&6; } if test "$sol_lfs_bug" = "yes"; then use_lfs=no fi @@ -7296,46 +6714,11 @@ EOF # Type availability checks -{ $as_echo "$as_me:$LINENO: checking for mode_t" >&5 -$as_echo_n "checking for mode_t... " >&6; } +{ echo "$as_me:$LINENO: checking for mode_t" >&5 +echo $ECHO_N "checking for mode_t... $ECHO_C" >&6; } if test "${ac_cv_type_mode_t+set}" = set; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else - ac_cv_type_mode_t=no -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_includes_default -int -main () -{ -if (sizeof (mode_t)) - return 0; - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF @@ -7343,11 +6726,14 @@ cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default +typedef mode_t ac__type_new_; int main () { -if (sizeof ((mode_t))) - return 0; +if ((ac__type_new_ *) 0) + return 0; +if (sizeof (ac__type_new_)) + return 0; ; return 0; } @@ -7358,39 +6744,30 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then - : -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_cv_type_mode_t=yes -fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + ac_cv_type_mode_t=yes else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 - + ac_cv_type_mode_t=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_type_mode_t" >&5 -$as_echo "$ac_cv_type_mode_t" >&6; } -if test "x$ac_cv_type_mode_t" = x""yes; then +{ echo "$as_me:$LINENO: result: $ac_cv_type_mode_t" >&5 +echo "${ECHO_T}$ac_cv_type_mode_t" >&6; } +if test $ac_cv_type_mode_t = yes; then : else @@ -7400,46 +6777,11 @@ fi -{ $as_echo "$as_me:$LINENO: checking for off_t" >&5 -$as_echo_n "checking for off_t... " >&6; } +{ echo "$as_me:$LINENO: checking for off_t" >&5 +echo $ECHO_N "checking for off_t... $ECHO_C" >&6; } if test "${ac_cv_type_off_t+set}" = set; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else - ac_cv_type_off_t=no -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_includes_default -int -main () -{ -if (sizeof (off_t)) - return 0; - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF @@ -7447,11 +6789,14 @@ cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default +typedef off_t ac__type_new_; int main () { -if (sizeof ((off_t))) - return 0; +if ((ac__type_new_ *) 0) + return 0; +if (sizeof (ac__type_new_)) + return 0; ; return 0; } @@ -7462,39 +6807,30 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then - : + ac_cv_type_off_t=yes else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 - ac_cv_type_off_t=yes + ac_cv_type_off_t=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_type_off_t" >&5 -$as_echo "$ac_cv_type_off_t" >&6; } -if test "x$ac_cv_type_off_t" = x""yes; then +{ echo "$as_me:$LINENO: result: $ac_cv_type_off_t" >&5 +echo "${ECHO_T}$ac_cv_type_off_t" >&6; } +if test $ac_cv_type_off_t = yes; then : else @@ -7504,46 +6840,11 @@ fi -{ $as_echo "$as_me:$LINENO: checking for pid_t" >&5 -$as_echo_n "checking for pid_t... " >&6; } +{ echo "$as_me:$LINENO: checking for pid_t" >&5 +echo $ECHO_N "checking for pid_t... $ECHO_C" >&6; } if test "${ac_cv_type_pid_t+set}" = set; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else - ac_cv_type_pid_t=no -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_includes_default -int -main () -{ -if (sizeof (pid_t)) - return 0; - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF @@ -7551,11 +6852,14 @@ cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default +typedef pid_t ac__type_new_; int main () { -if (sizeof ((pid_t))) - return 0; +if ((ac__type_new_ *) 0) + return 0; +if (sizeof (ac__type_new_)) + return 0; ; return 0; } @@ -7566,39 +6870,30 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then - : -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_cv_type_pid_t=yes -fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + ac_cv_type_pid_t=yes else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 - + ac_cv_type_pid_t=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_type_pid_t" >&5 -$as_echo "$ac_cv_type_pid_t" >&6; } -if test "x$ac_cv_type_pid_t" = x""yes; then +{ echo "$as_me:$LINENO: result: $ac_cv_type_pid_t" >&5 +echo "${ECHO_T}$ac_cv_type_pid_t" >&6; } +if test $ac_cv_type_pid_t = yes; then : else @@ -7608,10 +6903,10 @@ fi -{ $as_echo "$as_me:$LINENO: checking return type of signal handlers" >&5 -$as_echo_n "checking return type of signal handlers... " >&6; } +{ echo "$as_me:$LINENO: checking return type of signal handlers" >&5 +echo $ECHO_N "checking return type of signal handlers... $ECHO_C" >&6; } if test "${ac_cv_type_signal+set}" = set; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ @@ -7636,21 +6931,20 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_type_signal=int else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_type_signal=void @@ -7658,54 +6952,19 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_type_signal" >&5 -$as_echo "$ac_cv_type_signal" >&6; } +{ echo "$as_me:$LINENO: result: $ac_cv_type_signal" >&5 +echo "${ECHO_T}$ac_cv_type_signal" >&6; } cat >>confdefs.h <<_ACEOF #define RETSIGTYPE $ac_cv_type_signal _ACEOF -{ $as_echo "$as_me:$LINENO: checking for size_t" >&5 -$as_echo_n "checking for size_t... " >&6; } +{ echo "$as_me:$LINENO: checking for size_t" >&5 +echo $ECHO_N "checking for size_t... $ECHO_C" >&6; } if test "${ac_cv_type_size_t+set}" = set; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else - ac_cv_type_size_t=no -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_includes_default -int -main () -{ -if (sizeof (size_t)) - return 0; - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF @@ -7713,11 +6972,14 @@ cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default +typedef size_t ac__type_new_; int main () { -if (sizeof ((size_t))) - return 0; +if ((ac__type_new_ *) 0) + return 0; +if (sizeof (ac__type_new_)) + return 0; ; return 0; } @@ -7728,39 +6990,30 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then - : -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_cv_type_size_t=yes -fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + ac_cv_type_size_t=yes else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 - + ac_cv_type_size_t=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_type_size_t" >&5 -$as_echo "$ac_cv_type_size_t" >&6; } -if test "x$ac_cv_type_size_t" = x""yes; then +{ echo "$as_me:$LINENO: result: $ac_cv_type_size_t" >&5 +echo "${ECHO_T}$ac_cv_type_size_t" >&6; } +if test $ac_cv_type_size_t = yes; then : else @@ -7770,10 +7023,10 @@ fi -{ $as_echo "$as_me:$LINENO: checking for uid_t in sys/types.h" >&5 -$as_echo_n "checking for uid_t in sys/types.h... " >&6; } +{ echo "$as_me:$LINENO: checking for uid_t in sys/types.h" >&5 +echo $ECHO_N "checking for uid_t in sys/types.h... $ECHO_C" >&6; } if test "${ac_cv_type_uid_t+set}" = set; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ @@ -7793,8 +7046,8 @@ rm -f conftest* fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_type_uid_t" >&5 -$as_echo "$ac_cv_type_uid_t" >&6; } +{ echo "$as_me:$LINENO: result: $ac_cv_type_uid_t" >&5 +echo "${ECHO_T}$ac_cv_type_uid_t" >&6; } if test $ac_cv_type_uid_t = no; then cat >>confdefs.h <<\_ACEOF @@ -7809,10 +7062,10 @@ fi - { $as_echo "$as_me:$LINENO: checking for uint32_t" >&5 -$as_echo_n "checking for uint32_t... " >&6; } + { echo "$as_me:$LINENO: checking for uint32_t" >&5 +echo $ECHO_N "checking for uint32_t... $ECHO_C" >&6; } if test "${ac_cv_c_uint32_t+set}" = set; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_cv_c_uint32_t=no for ac_type in 'uint32_t' 'unsigned int' 'unsigned long int' \ @@ -7840,14 +7093,13 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err @@ -7858,7 +7110,7 @@ esac else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 @@ -7868,8 +7120,8 @@ test "$ac_cv_c_uint32_t" != no && break done fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_c_uint32_t" >&5 -$as_echo "$ac_cv_c_uint32_t" >&6; } +{ echo "$as_me:$LINENO: result: $ac_cv_c_uint32_t" >&5 +echo "${ECHO_T}$ac_cv_c_uint32_t" >&6; } case $ac_cv_c_uint32_t in #( no|yes) ;; #( *) @@ -7886,10 +7138,10 @@ esac - { $as_echo "$as_me:$LINENO: checking for uint64_t" >&5 -$as_echo_n "checking for uint64_t... " >&6; } + { echo "$as_me:$LINENO: checking for uint64_t" >&5 +echo $ECHO_N "checking for uint64_t... $ECHO_C" >&6; } if test "${ac_cv_c_uint64_t+set}" = set; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_cv_c_uint64_t=no for ac_type in 'uint64_t' 'unsigned int' 'unsigned long int' \ @@ -7917,14 +7169,13 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err @@ -7935,7 +7186,7 @@ esac else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 @@ -7945,8 +7196,8 @@ test "$ac_cv_c_uint64_t" != no && break done fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_c_uint64_t" >&5 -$as_echo "$ac_cv_c_uint64_t" >&6; } +{ echo "$as_me:$LINENO: result: $ac_cv_c_uint64_t" >&5 +echo "${ECHO_T}$ac_cv_c_uint64_t" >&6; } case $ac_cv_c_uint64_t in #( no|yes) ;; #( *) @@ -7963,10 +7214,10 @@ esac - { $as_echo "$as_me:$LINENO: checking for int32_t" >&5 -$as_echo_n "checking for int32_t... " >&6; } + { echo "$as_me:$LINENO: checking for int32_t" >&5 +echo $ECHO_N "checking for int32_t... $ECHO_C" >&6; } if test "${ac_cv_c_int32_t+set}" = set; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_cv_c_int32_t=no for ac_type in 'int32_t' 'int' 'long int' \ @@ -7994,14 +7245,13 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err @@ -8017,7 +7267,7 @@ main () { static int test_array [1 - 2 * !(($ac_type) (((($ac_type) 1 << (32 - 2)) - 1) * 2 + 1) - < ($ac_type) (((($ac_type) 1 << (32 - 2)) - 1) * 2 + 2))]; + < ($ac_type) (((($ac_type) 1 << (32 - 2)) - 1) * 2 + 2))]; test_array [0] = 0 ; @@ -8030,21 +7280,20 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then : else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 case $ac_type in @@ -8056,7 +7305,7 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 @@ -8066,8 +7315,8 @@ test "$ac_cv_c_int32_t" != no && break done fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_c_int32_t" >&5 -$as_echo "$ac_cv_c_int32_t" >&6; } +{ echo "$as_me:$LINENO: result: $ac_cv_c_int32_t" >&5 +echo "${ECHO_T}$ac_cv_c_int32_t" >&6; } case $ac_cv_c_int32_t in #( no|yes) ;; #( *) @@ -8079,10 +7328,10 @@ esac - { $as_echo "$as_me:$LINENO: checking for int64_t" >&5 -$as_echo_n "checking for int64_t... " >&6; } + { echo "$as_me:$LINENO: checking for int64_t" >&5 +echo $ECHO_N "checking for int64_t... $ECHO_C" >&6; } if test "${ac_cv_c_int64_t+set}" = set; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_cv_c_int64_t=no for ac_type in 'int64_t' 'int' 'long int' \ @@ -8110,14 +7359,13 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err @@ -8133,7 +7381,7 @@ main () { static int test_array [1 - 2 * !(($ac_type) (((($ac_type) 1 << (64 - 2)) - 1) * 2 + 1) - < ($ac_type) (((($ac_type) 1 << (64 - 2)) - 1) * 2 + 2))]; + < ($ac_type) (((($ac_type) 1 << (64 - 2)) - 1) * 2 + 2))]; test_array [0] = 0 ; @@ -8146,21 +7394,20 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then : else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 case $ac_type in @@ -8172,7 +7419,7 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 @@ -8182,8 +7429,8 @@ test "$ac_cv_c_int64_t" != no && break done fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_c_int64_t" >&5 -$as_echo "$ac_cv_c_int64_t" >&6; } +{ echo "$as_me:$LINENO: result: $ac_cv_c_int64_t" >&5 +echo "${ECHO_T}$ac_cv_c_int64_t" >&6; } case $ac_cv_c_int64_t in #( no|yes) ;; #( *) @@ -8194,24 +7441,26 @@ ;; esac -{ $as_echo "$as_me:$LINENO: checking for ssize_t" >&5 -$as_echo_n "checking for ssize_t... " >&6; } +{ echo "$as_me:$LINENO: checking for ssize_t" >&5 +echo $ECHO_N "checking for ssize_t... $ECHO_C" >&6; } if test "${ac_cv_type_ssize_t+set}" = set; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else - ac_cv_type_ssize_t=no -cat >conftest.$ac_ext <<_ACEOF + cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default +typedef ssize_t ac__type_new_; int main () { -if (sizeof (ssize_t)) - return 0; +if ((ac__type_new_ *) 0) + return 0; +if (sizeof (ac__type_new_)) + return 0; ; return 0; } @@ -8222,18 +7471,45 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then + ac_cv_type_ssize_t=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_type_ssize_t=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ echo "$as_me:$LINENO: result: $ac_cv_type_ssize_t" >&5 +echo "${ECHO_T}$ac_cv_type_ssize_t" >&6; } +if test $ac_cv_type_ssize_t = yes; then + +cat >>confdefs.h <<\_ACEOF +#define HAVE_SSIZE_T 1 +_ACEOF + +fi + + +# Sizes of various common basic types +# ANSI C requires sizeof(char) == 1, so no need to check it +{ echo "$as_me:$LINENO: checking for int" >&5 +echo $ECHO_N "checking for int... $ECHO_C" >&6; } +if test "${ac_cv_type_int+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF @@ -8241,11 +7517,14 @@ cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default +typedef int ac__type_new_; int main () { -if (sizeof ((ssize_t))) - return 0; +if ((ac__type_new_ *) 0) + return 0; +if (sizeof (ac__type_new_)) + return 0; ; return 0; } @@ -8256,57 +7535,38 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then - : -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_cv_type_ssize_t=yes -fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - -fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_type_ssize_t" >&5 -$as_echo "$ac_cv_type_ssize_t" >&6; } -if test "x$ac_cv_type_ssize_t" = x""yes; then - -cat >>confdefs.h <<\_ACEOF -#define HAVE_SSIZE_T 1 -_ACEOF + ac_cv_type_int=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + ac_cv_type_int=no fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ echo "$as_me:$LINENO: result: $ac_cv_type_int" >&5 +echo "${ECHO_T}$ac_cv_type_int" >&6; } -# Sizes of various common basic types -# ANSI C requires sizeof(char) == 1, so no need to check it # The cast to long int works around a bug in the HP C Compiler # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. # This bug is HP SR number 8606223364. -{ $as_echo "$as_me:$LINENO: checking size of int" >&5 -$as_echo_n "checking size of int... " >&6; } +{ echo "$as_me:$LINENO: checking size of int" >&5 +echo $ECHO_N "checking size of int... $ECHO_C" >&6; } if test "${ac_cv_sizeof_int+set}" = set; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else if test "$cross_compiling" = yes; then # Depending upon the size, compute the lo and hi bounds. @@ -8317,10 +7577,11 @@ cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default + typedef int ac__type_sizeof_; int main () { -static int test_array [1 - 2 * !(((long int) (sizeof (int))) >= 0)]; +static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) >= 0)]; test_array [0] = 0 ; @@ -8333,14 +7594,13 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err @@ -8354,10 +7614,11 @@ cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default + typedef int ac__type_sizeof_; int main () { -static int test_array [1 - 2 * !(((long int) (sizeof (int))) <= $ac_mid)]; +static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) <= $ac_mid)]; test_array [0] = 0 ; @@ -8370,21 +7631,20 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_hi=$ac_mid; break else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo=`expr $ac_mid + 1` @@ -8398,7 +7658,7 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 cat >conftest.$ac_ext <<_ACEOF @@ -8408,10 +7668,11 @@ cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default + typedef int ac__type_sizeof_; int main () { -static int test_array [1 - 2 * !(((long int) (sizeof (int))) < 0)]; +static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) < 0)]; test_array [0] = 0 ; @@ -8424,14 +7685,13 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err @@ -8445,10 +7705,11 @@ cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default + typedef int ac__type_sizeof_; int main () { -static int test_array [1 - 2 * !(((long int) (sizeof (int))) >= $ac_mid)]; +static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) >= $ac_mid)]; test_array [0] = 0 ; @@ -8461,21 +7722,20 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_lo=$ac_mid; break else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_hi=`expr '(' $ac_mid ')' - 1` @@ -8489,7 +7749,7 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo= ac_hi= @@ -8509,10 +7769,11 @@ cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default + typedef int ac__type_sizeof_; int main () { -static int test_array [1 - 2 * !(((long int) (sizeof (int))) <= $ac_mid)]; +static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) <= $ac_mid)]; test_array [0] = 0 ; @@ -8525,21 +7786,20 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_hi=$ac_mid else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo=`expr '(' $ac_mid ')' + 1` @@ -8550,13 +7810,11 @@ case $ac_lo in ?*) ac_cv_sizeof_int=$ac_lo;; '') if test "$ac_cv_type_int" = yes; then - { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -{ { $as_echo "$as_me:$LINENO: error: cannot compute sizeof (int) + { { echo "$as_me:$LINENO: error: cannot compute sizeof (int) See \`config.log' for more details." >&5 -$as_echo "$as_me: error: cannot compute sizeof (int) +echo "$as_me: error: cannot compute sizeof (int) See \`config.log' for more details." >&2;} - { (exit 77); exit 77; }; }; } + { (exit 77); exit 77; }; } else ac_cv_sizeof_int=0 fi ;; @@ -8569,8 +7827,9 @@ cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default -static long int longval () { return (long int) (sizeof (int)); } -static unsigned long int ulongval () { return (long int) (sizeof (int)); } + typedef int ac__type_sizeof_; +static long int longval () { return (long int) (sizeof (ac__type_sizeof_)); } +static unsigned long int ulongval () { return (long int) (sizeof (ac__type_sizeof_)); } #include #include int @@ -8580,22 +7839,20 @@ FILE *f = fopen ("conftest.val", "w"); if (! f) return 1; - if (((long int) (sizeof (int))) < 0) + if (((long int) (sizeof (ac__type_sizeof_))) < 0) { long int i = longval (); - if (i != ((long int) (sizeof (int)))) + if (i != ((long int) (sizeof (ac__type_sizeof_)))) return 1; - fprintf (f, "%ld", i); + fprintf (f, "%ld\n", i); } else { unsigned long int i = ulongval (); - if (i != ((long int) (sizeof (int)))) + if (i != ((long int) (sizeof (ac__type_sizeof_)))) return 1; - fprintf (f, "%lu", i); + fprintf (f, "%lu\n", i); } - /* Do not output a trailing newline, as this causes \r\n confusion - on some platforms. */ return ferror (f) || fclose (f) != 0; ; @@ -8608,48 +7865,43 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>&5 ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_try") 2>&5 ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_sizeof_int=`cat conftest.val` else - $as_echo "$as_me: program exited with status $ac_status" >&5 -$as_echo "$as_me: failed program was:" >&5 + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) if test "$ac_cv_type_int" = yes; then - { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -{ { $as_echo "$as_me:$LINENO: error: cannot compute sizeof (int) + { { echo "$as_me:$LINENO: error: cannot compute sizeof (int) See \`config.log' for more details." >&5 -$as_echo "$as_me: error: cannot compute sizeof (int) +echo "$as_me: error: cannot compute sizeof (int) See \`config.log' for more details." >&2;} - { (exit 77); exit 77; }; }; } + { (exit 77); exit 77; }; } else ac_cv_sizeof_int=0 fi fi -rm -rf conftest.dSYM rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi rm -f conftest.val fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_sizeof_int" >&5 -$as_echo "$ac_cv_sizeof_int" >&6; } +{ echo "$as_me:$LINENO: result: $ac_cv_sizeof_int" >&5 +echo "${ECHO_T}$ac_cv_sizeof_int" >&6; } @@ -8658,14 +7910,68 @@ _ACEOF +{ echo "$as_me:$LINENO: checking for long" >&5 +echo $ECHO_N "checking for long... $ECHO_C" >&6; } +if test "${ac_cv_type_long+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +typedef long ac__type_new_; +int +main () +{ +if ((ac__type_new_ *) 0) + return 0; +if (sizeof (ac__type_new_)) + return 0; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_cv_type_long=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_type_long=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ echo "$as_me:$LINENO: result: $ac_cv_type_long" >&5 +echo "${ECHO_T}$ac_cv_type_long" >&6; } + # The cast to long int works around a bug in the HP C Compiler # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. # This bug is HP SR number 8606223364. -{ $as_echo "$as_me:$LINENO: checking size of long" >&5 -$as_echo_n "checking size of long... " >&6; } +{ echo "$as_me:$LINENO: checking size of long" >&5 +echo $ECHO_N "checking size of long... $ECHO_C" >&6; } if test "${ac_cv_sizeof_long+set}" = set; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else if test "$cross_compiling" = yes; then # Depending upon the size, compute the lo and hi bounds. @@ -8676,10 +7982,11 @@ cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default + typedef long ac__type_sizeof_; int main () { -static int test_array [1 - 2 * !(((long int) (sizeof (long))) >= 0)]; +static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) >= 0)]; test_array [0] = 0 ; @@ -8692,14 +7999,13 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err @@ -8713,10 +8019,11 @@ cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default + typedef long ac__type_sizeof_; int main () { -static int test_array [1 - 2 * !(((long int) (sizeof (long))) <= $ac_mid)]; +static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) <= $ac_mid)]; test_array [0] = 0 ; @@ -8729,21 +8036,20 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_hi=$ac_mid; break else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo=`expr $ac_mid + 1` @@ -8757,7 +8063,7 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 cat >conftest.$ac_ext <<_ACEOF @@ -8767,10 +8073,11 @@ cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default + typedef long ac__type_sizeof_; int main () { -static int test_array [1 - 2 * !(((long int) (sizeof (long))) < 0)]; +static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) < 0)]; test_array [0] = 0 ; @@ -8783,14 +8090,13 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err @@ -8804,10 +8110,11 @@ cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default + typedef long ac__type_sizeof_; int main () { -static int test_array [1 - 2 * !(((long int) (sizeof (long))) >= $ac_mid)]; +static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) >= $ac_mid)]; test_array [0] = 0 ; @@ -8820,21 +8127,20 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_lo=$ac_mid; break else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_hi=`expr '(' $ac_mid ')' - 1` @@ -8848,7 +8154,7 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo= ac_hi= @@ -8868,10 +8174,11 @@ cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default + typedef long ac__type_sizeof_; int main () { -static int test_array [1 - 2 * !(((long int) (sizeof (long))) <= $ac_mid)]; +static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) <= $ac_mid)]; test_array [0] = 0 ; @@ -8884,21 +8191,20 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_hi=$ac_mid else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo=`expr '(' $ac_mid ')' + 1` @@ -8909,13 +8215,11 @@ case $ac_lo in ?*) ac_cv_sizeof_long=$ac_lo;; '') if test "$ac_cv_type_long" = yes; then - { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -{ { $as_echo "$as_me:$LINENO: error: cannot compute sizeof (long) + { { echo "$as_me:$LINENO: error: cannot compute sizeof (long) See \`config.log' for more details." >&5 -$as_echo "$as_me: error: cannot compute sizeof (long) +echo "$as_me: error: cannot compute sizeof (long) See \`config.log' for more details." >&2;} - { (exit 77); exit 77; }; }; } + { (exit 77); exit 77; }; } else ac_cv_sizeof_long=0 fi ;; @@ -8928,8 +8232,9 @@ cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default -static long int longval () { return (long int) (sizeof (long)); } -static unsigned long int ulongval () { return (long int) (sizeof (long)); } + typedef long ac__type_sizeof_; +static long int longval () { return (long int) (sizeof (ac__type_sizeof_)); } +static unsigned long int ulongval () { return (long int) (sizeof (ac__type_sizeof_)); } #include #include int @@ -8939,22 +8244,20 @@ FILE *f = fopen ("conftest.val", "w"); if (! f) return 1; - if (((long int) (sizeof (long))) < 0) + if (((long int) (sizeof (ac__type_sizeof_))) < 0) { long int i = longval (); - if (i != ((long int) (sizeof (long)))) + if (i != ((long int) (sizeof (ac__type_sizeof_)))) return 1; - fprintf (f, "%ld", i); + fprintf (f, "%ld\n", i); } else { unsigned long int i = ulongval (); - if (i != ((long int) (sizeof (long)))) + if (i != ((long int) (sizeof (ac__type_sizeof_)))) return 1; - fprintf (f, "%lu", i); + fprintf (f, "%lu\n", i); } - /* Do not output a trailing newline, as this causes \r\n confusion - on some platforms. */ return ferror (f) || fclose (f) != 0; ; @@ -8967,48 +8270,43 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>&5 ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_try") 2>&5 ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_sizeof_long=`cat conftest.val` else - $as_echo "$as_me: program exited with status $ac_status" >&5 -$as_echo "$as_me: failed program was:" >&5 + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) if test "$ac_cv_type_long" = yes; then - { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -{ { $as_echo "$as_me:$LINENO: error: cannot compute sizeof (long) + { { echo "$as_me:$LINENO: error: cannot compute sizeof (long) See \`config.log' for more details." >&5 -$as_echo "$as_me: error: cannot compute sizeof (long) +echo "$as_me: error: cannot compute sizeof (long) See \`config.log' for more details." >&2;} - { (exit 77); exit 77; }; }; } + { (exit 77); exit 77; }; } else ac_cv_sizeof_long=0 fi fi -rm -rf conftest.dSYM rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi rm -f conftest.val fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_sizeof_long" >&5 -$as_echo "$ac_cv_sizeof_long" >&6; } +{ echo "$as_me:$LINENO: result: $ac_cv_sizeof_long" >&5 +echo "${ECHO_T}$ac_cv_sizeof_long" >&6; } @@ -9017,14 +8315,68 @@ _ACEOF +{ echo "$as_me:$LINENO: checking for void *" >&5 +echo $ECHO_N "checking for void *... $ECHO_C" >&6; } +if test "${ac_cv_type_void_p+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +typedef void * ac__type_new_; +int +main () +{ +if ((ac__type_new_ *) 0) + return 0; +if (sizeof (ac__type_new_)) + return 0; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_cv_type_void_p=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_type_void_p=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ echo "$as_me:$LINENO: result: $ac_cv_type_void_p" >&5 +echo "${ECHO_T}$ac_cv_type_void_p" >&6; } + # The cast to long int works around a bug in the HP C Compiler # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. # This bug is HP SR number 8606223364. -{ $as_echo "$as_me:$LINENO: checking size of void *" >&5 -$as_echo_n "checking size of void *... " >&6; } +{ echo "$as_me:$LINENO: checking size of void *" >&5 +echo $ECHO_N "checking size of void *... $ECHO_C" >&6; } if test "${ac_cv_sizeof_void_p+set}" = set; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else if test "$cross_compiling" = yes; then # Depending upon the size, compute the lo and hi bounds. @@ -9035,10 +8387,11 @@ cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default + typedef void * ac__type_sizeof_; int main () { -static int test_array [1 - 2 * !(((long int) (sizeof (void *))) >= 0)]; +static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) >= 0)]; test_array [0] = 0 ; @@ -9051,14 +8404,13 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err @@ -9072,10 +8424,11 @@ cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default + typedef void * ac__type_sizeof_; int main () { -static int test_array [1 - 2 * !(((long int) (sizeof (void *))) <= $ac_mid)]; +static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) <= $ac_mid)]; test_array [0] = 0 ; @@ -9088,21 +8441,20 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_hi=$ac_mid; break else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo=`expr $ac_mid + 1` @@ -9116,7 +8468,7 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 cat >conftest.$ac_ext <<_ACEOF @@ -9126,10 +8478,11 @@ cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default + typedef void * ac__type_sizeof_; int main () { -static int test_array [1 - 2 * !(((long int) (sizeof (void *))) < 0)]; +static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) < 0)]; test_array [0] = 0 ; @@ -9142,14 +8495,13 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err @@ -9163,10 +8515,11 @@ cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default + typedef void * ac__type_sizeof_; int main () { -static int test_array [1 - 2 * !(((long int) (sizeof (void *))) >= $ac_mid)]; +static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) >= $ac_mid)]; test_array [0] = 0 ; @@ -9179,21 +8532,20 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_lo=$ac_mid; break else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_hi=`expr '(' $ac_mid ')' - 1` @@ -9207,7 +8559,7 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo= ac_hi= @@ -9227,10 +8579,11 @@ cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default + typedef void * ac__type_sizeof_; int main () { -static int test_array [1 - 2 * !(((long int) (sizeof (void *))) <= $ac_mid)]; +static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) <= $ac_mid)]; test_array [0] = 0 ; @@ -9243,21 +8596,20 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_hi=$ac_mid else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo=`expr '(' $ac_mid ')' + 1` @@ -9268,13 +8620,11 @@ case $ac_lo in ?*) ac_cv_sizeof_void_p=$ac_lo;; '') if test "$ac_cv_type_void_p" = yes; then - { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -{ { $as_echo "$as_me:$LINENO: error: cannot compute sizeof (void *) + { { echo "$as_me:$LINENO: error: cannot compute sizeof (void *) See \`config.log' for more details." >&5 -$as_echo "$as_me: error: cannot compute sizeof (void *) +echo "$as_me: error: cannot compute sizeof (void *) See \`config.log' for more details." >&2;} - { (exit 77); exit 77; }; }; } + { (exit 77); exit 77; }; } else ac_cv_sizeof_void_p=0 fi ;; @@ -9287,8 +8637,9 @@ cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default -static long int longval () { return (long int) (sizeof (void *)); } -static unsigned long int ulongval () { return (long int) (sizeof (void *)); } + typedef void * ac__type_sizeof_; +static long int longval () { return (long int) (sizeof (ac__type_sizeof_)); } +static unsigned long int ulongval () { return (long int) (sizeof (ac__type_sizeof_)); } #include #include int @@ -9298,22 +8649,20 @@ FILE *f = fopen ("conftest.val", "w"); if (! f) return 1; - if (((long int) (sizeof (void *))) < 0) + if (((long int) (sizeof (ac__type_sizeof_))) < 0) { long int i = longval (); - if (i != ((long int) (sizeof (void *)))) + if (i != ((long int) (sizeof (ac__type_sizeof_)))) return 1; - fprintf (f, "%ld", i); + fprintf (f, "%ld\n", i); } else { unsigned long int i = ulongval (); - if (i != ((long int) (sizeof (void *)))) + if (i != ((long int) (sizeof (ac__type_sizeof_)))) return 1; - fprintf (f, "%lu", i); + fprintf (f, "%lu\n", i); } - /* Do not output a trailing newline, as this causes \r\n confusion - on some platforms. */ return ferror (f) || fclose (f) != 0; ; @@ -9326,48 +8675,43 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>&5 ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_try") 2>&5 ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_sizeof_void_p=`cat conftest.val` else - $as_echo "$as_me: program exited with status $ac_status" >&5 -$as_echo "$as_me: failed program was:" >&5 + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) if test "$ac_cv_type_void_p" = yes; then - { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -{ { $as_echo "$as_me:$LINENO: error: cannot compute sizeof (void *) + { { echo "$as_me:$LINENO: error: cannot compute sizeof (void *) See \`config.log' for more details." >&5 -$as_echo "$as_me: error: cannot compute sizeof (void *) +echo "$as_me: error: cannot compute sizeof (void *) See \`config.log' for more details." >&2;} - { (exit 77); exit 77; }; }; } + { (exit 77); exit 77; }; } else ac_cv_sizeof_void_p=0 fi fi -rm -rf conftest.dSYM rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi rm -f conftest.val fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_sizeof_void_p" >&5 -$as_echo "$ac_cv_sizeof_void_p" >&6; } +{ echo "$as_me:$LINENO: result: $ac_cv_sizeof_void_p" >&5 +echo "${ECHO_T}$ac_cv_sizeof_void_p" >&6; } @@ -9376,14 +8720,68 @@ _ACEOF +{ echo "$as_me:$LINENO: checking for short" >&5 +echo $ECHO_N "checking for short... $ECHO_C" >&6; } +if test "${ac_cv_type_short+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +typedef short ac__type_new_; +int +main () +{ +if ((ac__type_new_ *) 0) + return 0; +if (sizeof (ac__type_new_)) + return 0; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_cv_type_short=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_type_short=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ echo "$as_me:$LINENO: result: $ac_cv_type_short" >&5 +echo "${ECHO_T}$ac_cv_type_short" >&6; } + # The cast to long int works around a bug in the HP C Compiler # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. # This bug is HP SR number 8606223364. -{ $as_echo "$as_me:$LINENO: checking size of short" >&5 -$as_echo_n "checking size of short... " >&6; } +{ echo "$as_me:$LINENO: checking size of short" >&5 +echo $ECHO_N "checking size of short... $ECHO_C" >&6; } if test "${ac_cv_sizeof_short+set}" = set; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else if test "$cross_compiling" = yes; then # Depending upon the size, compute the lo and hi bounds. @@ -9394,10 +8792,11 @@ cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default + typedef short ac__type_sizeof_; int main () { -static int test_array [1 - 2 * !(((long int) (sizeof (short))) >= 0)]; +static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) >= 0)]; test_array [0] = 0 ; @@ -9410,14 +8809,13 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err @@ -9431,10 +8829,11 @@ cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default + typedef short ac__type_sizeof_; int main () { -static int test_array [1 - 2 * !(((long int) (sizeof (short))) <= $ac_mid)]; +static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) <= $ac_mid)]; test_array [0] = 0 ; @@ -9447,21 +8846,20 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_hi=$ac_mid; break else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo=`expr $ac_mid + 1` @@ -9475,7 +8873,7 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 cat >conftest.$ac_ext <<_ACEOF @@ -9485,10 +8883,11 @@ cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default + typedef short ac__type_sizeof_; int main () { -static int test_array [1 - 2 * !(((long int) (sizeof (short))) < 0)]; +static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) < 0)]; test_array [0] = 0 ; @@ -9501,14 +8900,13 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err @@ -9522,10 +8920,11 @@ cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default + typedef short ac__type_sizeof_; int main () { -static int test_array [1 - 2 * !(((long int) (sizeof (short))) >= $ac_mid)]; +static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) >= $ac_mid)]; test_array [0] = 0 ; @@ -9538,21 +8937,20 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_lo=$ac_mid; break else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_hi=`expr '(' $ac_mid ')' - 1` @@ -9566,7 +8964,7 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo= ac_hi= @@ -9586,10 +8984,11 @@ cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default + typedef short ac__type_sizeof_; int main () { -static int test_array [1 - 2 * !(((long int) (sizeof (short))) <= $ac_mid)]; +static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) <= $ac_mid)]; test_array [0] = 0 ; @@ -9602,21 +9001,20 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_hi=$ac_mid else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo=`expr '(' $ac_mid ')' + 1` @@ -9627,13 +9025,11 @@ case $ac_lo in ?*) ac_cv_sizeof_short=$ac_lo;; '') if test "$ac_cv_type_short" = yes; then - { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -{ { $as_echo "$as_me:$LINENO: error: cannot compute sizeof (short) + { { echo "$as_me:$LINENO: error: cannot compute sizeof (short) See \`config.log' for more details." >&5 -$as_echo "$as_me: error: cannot compute sizeof (short) +echo "$as_me: error: cannot compute sizeof (short) See \`config.log' for more details." >&2;} - { (exit 77); exit 77; }; }; } + { (exit 77); exit 77; }; } else ac_cv_sizeof_short=0 fi ;; @@ -9646,8 +9042,9 @@ cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default -static long int longval () { return (long int) (sizeof (short)); } -static unsigned long int ulongval () { return (long int) (sizeof (short)); } + typedef short ac__type_sizeof_; +static long int longval () { return (long int) (sizeof (ac__type_sizeof_)); } +static unsigned long int ulongval () { return (long int) (sizeof (ac__type_sizeof_)); } #include #include int @@ -9657,22 +9054,20 @@ FILE *f = fopen ("conftest.val", "w"); if (! f) return 1; - if (((long int) (sizeof (short))) < 0) + if (((long int) (sizeof (ac__type_sizeof_))) < 0) { long int i = longval (); - if (i != ((long int) (sizeof (short)))) + if (i != ((long int) (sizeof (ac__type_sizeof_)))) return 1; - fprintf (f, "%ld", i); + fprintf (f, "%ld\n", i); } else { unsigned long int i = ulongval (); - if (i != ((long int) (sizeof (short)))) + if (i != ((long int) (sizeof (ac__type_sizeof_)))) return 1; - fprintf (f, "%lu", i); + fprintf (f, "%lu\n", i); } - /* Do not output a trailing newline, as this causes \r\n confusion - on some platforms. */ return ferror (f) || fclose (f) != 0; ; @@ -9685,48 +9080,43 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>&5 ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_try") 2>&5 ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_sizeof_short=`cat conftest.val` else - $as_echo "$as_me: program exited with status $ac_status" >&5 -$as_echo "$as_me: failed program was:" >&5 + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) if test "$ac_cv_type_short" = yes; then - { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -{ { $as_echo "$as_me:$LINENO: error: cannot compute sizeof (short) + { { echo "$as_me:$LINENO: error: cannot compute sizeof (short) See \`config.log' for more details." >&5 -$as_echo "$as_me: error: cannot compute sizeof (short) +echo "$as_me: error: cannot compute sizeof (short) See \`config.log' for more details." >&2;} - { (exit 77); exit 77; }; }; } + { (exit 77); exit 77; }; } else ac_cv_sizeof_short=0 fi fi -rm -rf conftest.dSYM rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi rm -f conftest.val fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_sizeof_short" >&5 -$as_echo "$ac_cv_sizeof_short" >&6; } +{ echo "$as_me:$LINENO: result: $ac_cv_sizeof_short" >&5 +echo "${ECHO_T}$ac_cv_sizeof_short" >&6; } @@ -9735,14 +9125,68 @@ _ACEOF +{ echo "$as_me:$LINENO: checking for float" >&5 +echo $ECHO_N "checking for float... $ECHO_C" >&6; } +if test "${ac_cv_type_float+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +typedef float ac__type_new_; +int +main () +{ +if ((ac__type_new_ *) 0) + return 0; +if (sizeof (ac__type_new_)) + return 0; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_cv_type_float=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_type_float=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ echo "$as_me:$LINENO: result: $ac_cv_type_float" >&5 +echo "${ECHO_T}$ac_cv_type_float" >&6; } + # The cast to long int works around a bug in the HP C Compiler # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. # This bug is HP SR number 8606223364. -{ $as_echo "$as_me:$LINENO: checking size of float" >&5 -$as_echo_n "checking size of float... " >&6; } +{ echo "$as_me:$LINENO: checking size of float" >&5 +echo $ECHO_N "checking size of float... $ECHO_C" >&6; } if test "${ac_cv_sizeof_float+set}" = set; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else if test "$cross_compiling" = yes; then # Depending upon the size, compute the lo and hi bounds. @@ -9753,10 +9197,11 @@ cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default + typedef float ac__type_sizeof_; int main () { -static int test_array [1 - 2 * !(((long int) (sizeof (float))) >= 0)]; +static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) >= 0)]; test_array [0] = 0 ; @@ -9769,14 +9214,13 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err @@ -9790,10 +9234,11 @@ cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default + typedef float ac__type_sizeof_; int main () { -static int test_array [1 - 2 * !(((long int) (sizeof (float))) <= $ac_mid)]; +static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) <= $ac_mid)]; test_array [0] = 0 ; @@ -9806,21 +9251,20 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_hi=$ac_mid; break else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo=`expr $ac_mid + 1` @@ -9834,7 +9278,7 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 cat >conftest.$ac_ext <<_ACEOF @@ -9844,10 +9288,11 @@ cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default + typedef float ac__type_sizeof_; int main () { -static int test_array [1 - 2 * !(((long int) (sizeof (float))) < 0)]; +static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) < 0)]; test_array [0] = 0 ; @@ -9860,14 +9305,13 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err @@ -9881,10 +9325,11 @@ cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default + typedef float ac__type_sizeof_; int main () { -static int test_array [1 - 2 * !(((long int) (sizeof (float))) >= $ac_mid)]; +static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) >= $ac_mid)]; test_array [0] = 0 ; @@ -9897,21 +9342,20 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_lo=$ac_mid; break else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_hi=`expr '(' $ac_mid ')' - 1` @@ -9925,7 +9369,7 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo= ac_hi= @@ -9945,10 +9389,11 @@ cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default + typedef float ac__type_sizeof_; int main () { -static int test_array [1 - 2 * !(((long int) (sizeof (float))) <= $ac_mid)]; +static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) <= $ac_mid)]; test_array [0] = 0 ; @@ -9961,21 +9406,20 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_hi=$ac_mid else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo=`expr '(' $ac_mid ')' + 1` @@ -9986,13 +9430,11 @@ case $ac_lo in ?*) ac_cv_sizeof_float=$ac_lo;; '') if test "$ac_cv_type_float" = yes; then - { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -{ { $as_echo "$as_me:$LINENO: error: cannot compute sizeof (float) + { { echo "$as_me:$LINENO: error: cannot compute sizeof (float) See \`config.log' for more details." >&5 -$as_echo "$as_me: error: cannot compute sizeof (float) +echo "$as_me: error: cannot compute sizeof (float) See \`config.log' for more details." >&2;} - { (exit 77); exit 77; }; }; } + { (exit 77); exit 77; }; } else ac_cv_sizeof_float=0 fi ;; @@ -10005,8 +9447,9 @@ cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default -static long int longval () { return (long int) (sizeof (float)); } -static unsigned long int ulongval () { return (long int) (sizeof (float)); } + typedef float ac__type_sizeof_; +static long int longval () { return (long int) (sizeof (ac__type_sizeof_)); } +static unsigned long int ulongval () { return (long int) (sizeof (ac__type_sizeof_)); } #include #include int @@ -10016,22 +9459,20 @@ FILE *f = fopen ("conftest.val", "w"); if (! f) return 1; - if (((long int) (sizeof (float))) < 0) + if (((long int) (sizeof (ac__type_sizeof_))) < 0) { long int i = longval (); - if (i != ((long int) (sizeof (float)))) + if (i != ((long int) (sizeof (ac__type_sizeof_)))) return 1; - fprintf (f, "%ld", i); + fprintf (f, "%ld\n", i); } else { unsigned long int i = ulongval (); - if (i != ((long int) (sizeof (float)))) + if (i != ((long int) (sizeof (ac__type_sizeof_)))) return 1; - fprintf (f, "%lu", i); + fprintf (f, "%lu\n", i); } - /* Do not output a trailing newline, as this causes \r\n confusion - on some platforms. */ return ferror (f) || fclose (f) != 0; ; @@ -10044,48 +9485,43 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>&5 ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_try") 2>&5 ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_sizeof_float=`cat conftest.val` else - $as_echo "$as_me: program exited with status $ac_status" >&5 -$as_echo "$as_me: failed program was:" >&5 + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) if test "$ac_cv_type_float" = yes; then - { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -{ { $as_echo "$as_me:$LINENO: error: cannot compute sizeof (float) + { { echo "$as_me:$LINENO: error: cannot compute sizeof (float) See \`config.log' for more details." >&5 -$as_echo "$as_me: error: cannot compute sizeof (float) +echo "$as_me: error: cannot compute sizeof (float) See \`config.log' for more details." >&2;} - { (exit 77); exit 77; }; }; } + { (exit 77); exit 77; }; } else ac_cv_sizeof_float=0 fi fi -rm -rf conftest.dSYM rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi rm -f conftest.val fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_sizeof_float" >&5 -$as_echo "$ac_cv_sizeof_float" >&6; } +{ echo "$as_me:$LINENO: result: $ac_cv_sizeof_float" >&5 +echo "${ECHO_T}$ac_cv_sizeof_float" >&6; } @@ -10094,14 +9530,68 @@ _ACEOF +{ echo "$as_me:$LINENO: checking for double" >&5 +echo $ECHO_N "checking for double... $ECHO_C" >&6; } +if test "${ac_cv_type_double+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +typedef double ac__type_new_; +int +main () +{ +if ((ac__type_new_ *) 0) + return 0; +if (sizeof (ac__type_new_)) + return 0; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_cv_type_double=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_type_double=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ echo "$as_me:$LINENO: result: $ac_cv_type_double" >&5 +echo "${ECHO_T}$ac_cv_type_double" >&6; } + # The cast to long int works around a bug in the HP C Compiler # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. # This bug is HP SR number 8606223364. -{ $as_echo "$as_me:$LINENO: checking size of double" >&5 -$as_echo_n "checking size of double... " >&6; } +{ echo "$as_me:$LINENO: checking size of double" >&5 +echo $ECHO_N "checking size of double... $ECHO_C" >&6; } if test "${ac_cv_sizeof_double+set}" = set; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else if test "$cross_compiling" = yes; then # Depending upon the size, compute the lo and hi bounds. @@ -10112,10 +9602,11 @@ cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default + typedef double ac__type_sizeof_; int main () { -static int test_array [1 - 2 * !(((long int) (sizeof (double))) >= 0)]; +static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) >= 0)]; test_array [0] = 0 ; @@ -10128,14 +9619,13 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err @@ -10149,10 +9639,11 @@ cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default + typedef double ac__type_sizeof_; int main () { -static int test_array [1 - 2 * !(((long int) (sizeof (double))) <= $ac_mid)]; +static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) <= $ac_mid)]; test_array [0] = 0 ; @@ -10165,21 +9656,20 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_hi=$ac_mid; break else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo=`expr $ac_mid + 1` @@ -10193,7 +9683,7 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 cat >conftest.$ac_ext <<_ACEOF @@ -10203,10 +9693,11 @@ cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default + typedef double ac__type_sizeof_; int main () { -static int test_array [1 - 2 * !(((long int) (sizeof (double))) < 0)]; +static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) < 0)]; test_array [0] = 0 ; @@ -10219,14 +9710,13 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err @@ -10240,10 +9730,11 @@ cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default + typedef double ac__type_sizeof_; int main () { -static int test_array [1 - 2 * !(((long int) (sizeof (double))) >= $ac_mid)]; +static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) >= $ac_mid)]; test_array [0] = 0 ; @@ -10256,21 +9747,20 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_lo=$ac_mid; break else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_hi=`expr '(' $ac_mid ')' - 1` @@ -10284,7 +9774,7 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo= ac_hi= @@ -10304,10 +9794,11 @@ cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default + typedef double ac__type_sizeof_; int main () { -static int test_array [1 - 2 * !(((long int) (sizeof (double))) <= $ac_mid)]; +static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) <= $ac_mid)]; test_array [0] = 0 ; @@ -10320,21 +9811,20 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_hi=$ac_mid else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo=`expr '(' $ac_mid ')' + 1` @@ -10345,13 +9835,11 @@ case $ac_lo in ?*) ac_cv_sizeof_double=$ac_lo;; '') if test "$ac_cv_type_double" = yes; then - { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -{ { $as_echo "$as_me:$LINENO: error: cannot compute sizeof (double) + { { echo "$as_me:$LINENO: error: cannot compute sizeof (double) See \`config.log' for more details." >&5 -$as_echo "$as_me: error: cannot compute sizeof (double) +echo "$as_me: error: cannot compute sizeof (double) See \`config.log' for more details." >&2;} - { (exit 77); exit 77; }; }; } + { (exit 77); exit 77; }; } else ac_cv_sizeof_double=0 fi ;; @@ -10364,8 +9852,9 @@ cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default -static long int longval () { return (long int) (sizeof (double)); } -static unsigned long int ulongval () { return (long int) (sizeof (double)); } + typedef double ac__type_sizeof_; +static long int longval () { return (long int) (sizeof (ac__type_sizeof_)); } +static unsigned long int ulongval () { return (long int) (sizeof (ac__type_sizeof_)); } #include #include int @@ -10375,22 +9864,20 @@ FILE *f = fopen ("conftest.val", "w"); if (! f) return 1; - if (((long int) (sizeof (double))) < 0) + if (((long int) (sizeof (ac__type_sizeof_))) < 0) { long int i = longval (); - if (i != ((long int) (sizeof (double)))) + if (i != ((long int) (sizeof (ac__type_sizeof_)))) return 1; - fprintf (f, "%ld", i); + fprintf (f, "%ld\n", i); } else { unsigned long int i = ulongval (); - if (i != ((long int) (sizeof (double)))) + if (i != ((long int) (sizeof (ac__type_sizeof_)))) return 1; - fprintf (f, "%lu", i); + fprintf (f, "%lu\n", i); } - /* Do not output a trailing newline, as this causes \r\n confusion - on some platforms. */ return ferror (f) || fclose (f) != 0; ; @@ -10403,64 +9890,113 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>&5 ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_try") 2>&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_sizeof_double=`cat conftest.val` +else + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +( exit $ac_status ) +if test "$ac_cv_type_double" = yes; then + { { echo "$as_me:$LINENO: error: cannot compute sizeof (double) +See \`config.log' for more details." >&5 +echo "$as_me: error: cannot compute sizeof (double) +See \`config.log' for more details." >&2;} + { (exit 77); exit 77; }; } + else + ac_cv_sizeof_double=0 + fi +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi +rm -f conftest.val +fi +{ echo "$as_me:$LINENO: result: $ac_cv_sizeof_double" >&5 +echo "${ECHO_T}$ac_cv_sizeof_double" >&6; } + + + +cat >>confdefs.h <<_ACEOF +#define SIZEOF_DOUBLE $ac_cv_sizeof_double +_ACEOF + + +{ echo "$as_me:$LINENO: checking for fpos_t" >&5 +echo $ECHO_N "checking for fpos_t... $ECHO_C" >&6; } +if test "${ac_cv_type_fpos_t+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +typedef fpos_t ac__type_new_; +int +main () +{ +if ((ac__type_new_ *) 0) + return 0; +if (sizeof (ac__type_new_)) + return 0; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_sizeof_double=`cat conftest.val` + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_cv_type_fpos_t=yes else - $as_echo "$as_me: program exited with status $ac_status" >&5 -$as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -( exit $ac_status ) -if test "$ac_cv_type_double" = yes; then - { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -{ { $as_echo "$as_me:$LINENO: error: cannot compute sizeof (double) -See \`config.log' for more details." >&5 -$as_echo "$as_me: error: cannot compute sizeof (double) -See \`config.log' for more details." >&2;} - { (exit 77); exit 77; }; }; } - else - ac_cv_sizeof_double=0 - fi -fi -rm -rf conftest.dSYM -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext + ac_cv_type_fpos_t=no fi -rm -f conftest.val -fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_sizeof_double" >&5 -$as_echo "$ac_cv_sizeof_double" >&6; } - - - -cat >>confdefs.h <<_ACEOF -#define SIZEOF_DOUBLE $ac_cv_sizeof_double -_ACEOF +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ echo "$as_me:$LINENO: result: $ac_cv_type_fpos_t" >&5 +echo "${ECHO_T}$ac_cv_type_fpos_t" >&6; } # The cast to long int works around a bug in the HP C Compiler # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. # This bug is HP SR number 8606223364. -{ $as_echo "$as_me:$LINENO: checking size of fpos_t" >&5 -$as_echo_n "checking size of fpos_t... " >&6; } +{ echo "$as_me:$LINENO: checking size of fpos_t" >&5 +echo $ECHO_N "checking size of fpos_t... $ECHO_C" >&6; } if test "${ac_cv_sizeof_fpos_t+set}" = set; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else if test "$cross_compiling" = yes; then # Depending upon the size, compute the lo and hi bounds. @@ -10471,10 +10007,11 @@ cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default + typedef fpos_t ac__type_sizeof_; int main () { -static int test_array [1 - 2 * !(((long int) (sizeof (fpos_t))) >= 0)]; +static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) >= 0)]; test_array [0] = 0 ; @@ -10487,14 +10024,13 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err @@ -10508,10 +10044,11 @@ cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default + typedef fpos_t ac__type_sizeof_; int main () { -static int test_array [1 - 2 * !(((long int) (sizeof (fpos_t))) <= $ac_mid)]; +static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) <= $ac_mid)]; test_array [0] = 0 ; @@ -10524,21 +10061,20 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_hi=$ac_mid; break else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo=`expr $ac_mid + 1` @@ -10552,7 +10088,7 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 cat >conftest.$ac_ext <<_ACEOF @@ -10562,10 +10098,11 @@ cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default + typedef fpos_t ac__type_sizeof_; int main () { -static int test_array [1 - 2 * !(((long int) (sizeof (fpos_t))) < 0)]; +static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) < 0)]; test_array [0] = 0 ; @@ -10578,14 +10115,13 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err @@ -10599,10 +10135,11 @@ cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default + typedef fpos_t ac__type_sizeof_; int main () { -static int test_array [1 - 2 * !(((long int) (sizeof (fpos_t))) >= $ac_mid)]; +static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) >= $ac_mid)]; test_array [0] = 0 ; @@ -10615,21 +10152,20 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_lo=$ac_mid; break else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_hi=`expr '(' $ac_mid ')' - 1` @@ -10643,7 +10179,7 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo= ac_hi= @@ -10663,10 +10199,11 @@ cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default + typedef fpos_t ac__type_sizeof_; int main () { -static int test_array [1 - 2 * !(((long int) (sizeof (fpos_t))) <= $ac_mid)]; +static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) <= $ac_mid)]; test_array [0] = 0 ; @@ -10679,21 +10216,20 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_hi=$ac_mid else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo=`expr '(' $ac_mid ')' + 1` @@ -10704,13 +10240,11 @@ case $ac_lo in ?*) ac_cv_sizeof_fpos_t=$ac_lo;; '') if test "$ac_cv_type_fpos_t" = yes; then - { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -{ { $as_echo "$as_me:$LINENO: error: cannot compute sizeof (fpos_t) + { { echo "$as_me:$LINENO: error: cannot compute sizeof (fpos_t) See \`config.log' for more details." >&5 -$as_echo "$as_me: error: cannot compute sizeof (fpos_t) +echo "$as_me: error: cannot compute sizeof (fpos_t) See \`config.log' for more details." >&2;} - { (exit 77); exit 77; }; }; } + { (exit 77); exit 77; }; } else ac_cv_sizeof_fpos_t=0 fi ;; @@ -10723,8 +10257,9 @@ cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default -static long int longval () { return (long int) (sizeof (fpos_t)); } -static unsigned long int ulongval () { return (long int) (sizeof (fpos_t)); } + typedef fpos_t ac__type_sizeof_; +static long int longval () { return (long int) (sizeof (ac__type_sizeof_)); } +static unsigned long int ulongval () { return (long int) (sizeof (ac__type_sizeof_)); } #include #include int @@ -10734,22 +10269,20 @@ FILE *f = fopen ("conftest.val", "w"); if (! f) return 1; - if (((long int) (sizeof (fpos_t))) < 0) + if (((long int) (sizeof (ac__type_sizeof_))) < 0) { long int i = longval (); - if (i != ((long int) (sizeof (fpos_t)))) + if (i != ((long int) (sizeof (ac__type_sizeof_)))) return 1; - fprintf (f, "%ld", i); + fprintf (f, "%ld\n", i); } else { unsigned long int i = ulongval (); - if (i != ((long int) (sizeof (fpos_t)))) + if (i != ((long int) (sizeof (ac__type_sizeof_)))) return 1; - fprintf (f, "%lu", i); + fprintf (f, "%lu\n", i); } - /* Do not output a trailing newline, as this causes \r\n confusion - on some platforms. */ return ferror (f) || fclose (f) != 0; ; @@ -10762,48 +10295,43 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>&5 ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_try") 2>&5 ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_sizeof_fpos_t=`cat conftest.val` else - $as_echo "$as_me: program exited with status $ac_status" >&5 -$as_echo "$as_me: failed program was:" >&5 + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) if test "$ac_cv_type_fpos_t" = yes; then - { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -{ { $as_echo "$as_me:$LINENO: error: cannot compute sizeof (fpos_t) + { { echo "$as_me:$LINENO: error: cannot compute sizeof (fpos_t) See \`config.log' for more details." >&5 -$as_echo "$as_me: error: cannot compute sizeof (fpos_t) +echo "$as_me: error: cannot compute sizeof (fpos_t) See \`config.log' for more details." >&2;} - { (exit 77); exit 77; }; }; } + { (exit 77); exit 77; }; } else ac_cv_sizeof_fpos_t=0 fi fi -rm -rf conftest.dSYM rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi rm -f conftest.val fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_sizeof_fpos_t" >&5 -$as_echo "$ac_cv_sizeof_fpos_t" >&6; } +{ echo "$as_me:$LINENO: result: $ac_cv_sizeof_fpos_t" >&5 +echo "${ECHO_T}$ac_cv_sizeof_fpos_t" >&6; } @@ -10812,14 +10340,68 @@ _ACEOF +{ echo "$as_me:$LINENO: checking for size_t" >&5 +echo $ECHO_N "checking for size_t... $ECHO_C" >&6; } +if test "${ac_cv_type_size_t+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +typedef size_t ac__type_new_; +int +main () +{ +if ((ac__type_new_ *) 0) + return 0; +if (sizeof (ac__type_new_)) + return 0; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_cv_type_size_t=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_type_size_t=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ echo "$as_me:$LINENO: result: $ac_cv_type_size_t" >&5 +echo "${ECHO_T}$ac_cv_type_size_t" >&6; } + # The cast to long int works around a bug in the HP C Compiler # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. # This bug is HP SR number 8606223364. -{ $as_echo "$as_me:$LINENO: checking size of size_t" >&5 -$as_echo_n "checking size of size_t... " >&6; } +{ echo "$as_me:$LINENO: checking size of size_t" >&5 +echo $ECHO_N "checking size of size_t... $ECHO_C" >&6; } if test "${ac_cv_sizeof_size_t+set}" = set; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else if test "$cross_compiling" = yes; then # Depending upon the size, compute the lo and hi bounds. @@ -10830,10 +10412,11 @@ cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default + typedef size_t ac__type_sizeof_; int main () { -static int test_array [1 - 2 * !(((long int) (sizeof (size_t))) >= 0)]; +static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) >= 0)]; test_array [0] = 0 ; @@ -10846,14 +10429,13 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err @@ -10867,10 +10449,11 @@ cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default + typedef size_t ac__type_sizeof_; int main () { -static int test_array [1 - 2 * !(((long int) (sizeof (size_t))) <= $ac_mid)]; +static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) <= $ac_mid)]; test_array [0] = 0 ; @@ -10883,21 +10466,20 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_hi=$ac_mid; break else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo=`expr $ac_mid + 1` @@ -10911,7 +10493,7 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 cat >conftest.$ac_ext <<_ACEOF @@ -10921,10 +10503,11 @@ cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default + typedef size_t ac__type_sizeof_; int main () { -static int test_array [1 - 2 * !(((long int) (sizeof (size_t))) < 0)]; +static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) < 0)]; test_array [0] = 0 ; @@ -10937,14 +10520,13 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err @@ -10958,10 +10540,11 @@ cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default + typedef size_t ac__type_sizeof_; int main () { -static int test_array [1 - 2 * !(((long int) (sizeof (size_t))) >= $ac_mid)]; +static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) >= $ac_mid)]; test_array [0] = 0 ; @@ -10974,21 +10557,20 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_lo=$ac_mid; break else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_hi=`expr '(' $ac_mid ')' - 1` @@ -11002,7 +10584,7 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo= ac_hi= @@ -11022,10 +10604,11 @@ cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default + typedef size_t ac__type_sizeof_; int main () { -static int test_array [1 - 2 * !(((long int) (sizeof (size_t))) <= $ac_mid)]; +static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) <= $ac_mid)]; test_array [0] = 0 ; @@ -11038,21 +10621,20 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_hi=$ac_mid else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo=`expr '(' $ac_mid ')' + 1` @@ -11063,13 +10645,11 @@ case $ac_lo in ?*) ac_cv_sizeof_size_t=$ac_lo;; '') if test "$ac_cv_type_size_t" = yes; then - { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -{ { $as_echo "$as_me:$LINENO: error: cannot compute sizeof (size_t) + { { echo "$as_me:$LINENO: error: cannot compute sizeof (size_t) See \`config.log' for more details." >&5 -$as_echo "$as_me: error: cannot compute sizeof (size_t) +echo "$as_me: error: cannot compute sizeof (size_t) See \`config.log' for more details." >&2;} - { (exit 77); exit 77; }; }; } + { (exit 77); exit 77; }; } else ac_cv_sizeof_size_t=0 fi ;; @@ -11082,8 +10662,9 @@ cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default -static long int longval () { return (long int) (sizeof (size_t)); } -static unsigned long int ulongval () { return (long int) (sizeof (size_t)); } + typedef size_t ac__type_sizeof_; +static long int longval () { return (long int) (sizeof (ac__type_sizeof_)); } +static unsigned long int ulongval () { return (long int) (sizeof (ac__type_sizeof_)); } #include #include int @@ -11093,22 +10674,20 @@ FILE *f = fopen ("conftest.val", "w"); if (! f) return 1; - if (((long int) (sizeof (size_t))) < 0) + if (((long int) (sizeof (ac__type_sizeof_))) < 0) { long int i = longval (); - if (i != ((long int) (sizeof (size_t)))) + if (i != ((long int) (sizeof (ac__type_sizeof_)))) return 1; - fprintf (f, "%ld", i); + fprintf (f, "%ld\n", i); } else { unsigned long int i = ulongval (); - if (i != ((long int) (sizeof (size_t)))) + if (i != ((long int) (sizeof (ac__type_sizeof_)))) return 1; - fprintf (f, "%lu", i); + fprintf (f, "%lu\n", i); } - /* Do not output a trailing newline, as this causes \r\n confusion - on some platforms. */ return ferror (f) || fclose (f) != 0; ; @@ -11121,48 +10700,43 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>&5 ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_try") 2>&5 ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_sizeof_size_t=`cat conftest.val` else - $as_echo "$as_me: program exited with status $ac_status" >&5 -$as_echo "$as_me: failed program was:" >&5 + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) if test "$ac_cv_type_size_t" = yes; then - { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -{ { $as_echo "$as_me:$LINENO: error: cannot compute sizeof (size_t) + { { echo "$as_me:$LINENO: error: cannot compute sizeof (size_t) See \`config.log' for more details." >&5 -$as_echo "$as_me: error: cannot compute sizeof (size_t) +echo "$as_me: error: cannot compute sizeof (size_t) See \`config.log' for more details." >&2;} - { (exit 77); exit 77; }; }; } + { (exit 77); exit 77; }; } else ac_cv_sizeof_size_t=0 fi fi -rm -rf conftest.dSYM rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi rm -f conftest.val fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_sizeof_size_t" >&5 -$as_echo "$ac_cv_sizeof_size_t" >&6; } +{ echo "$as_me:$LINENO: result: $ac_cv_sizeof_size_t" >&5 +echo "${ECHO_T}$ac_cv_sizeof_size_t" >&6; } @@ -11171,14 +10745,68 @@ _ACEOF +{ echo "$as_me:$LINENO: checking for pid_t" >&5 +echo $ECHO_N "checking for pid_t... $ECHO_C" >&6; } +if test "${ac_cv_type_pid_t+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +typedef pid_t ac__type_new_; +int +main () +{ +if ((ac__type_new_ *) 0) + return 0; +if (sizeof (ac__type_new_)) + return 0; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_cv_type_pid_t=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_type_pid_t=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ echo "$as_me:$LINENO: result: $ac_cv_type_pid_t" >&5 +echo "${ECHO_T}$ac_cv_type_pid_t" >&6; } + # The cast to long int works around a bug in the HP C Compiler # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. # This bug is HP SR number 8606223364. -{ $as_echo "$as_me:$LINENO: checking size of pid_t" >&5 -$as_echo_n "checking size of pid_t... " >&6; } +{ echo "$as_me:$LINENO: checking size of pid_t" >&5 +echo $ECHO_N "checking size of pid_t... $ECHO_C" >&6; } if test "${ac_cv_sizeof_pid_t+set}" = set; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else if test "$cross_compiling" = yes; then # Depending upon the size, compute the lo and hi bounds. @@ -11189,10 +10817,11 @@ cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default + typedef pid_t ac__type_sizeof_; int main () { -static int test_array [1 - 2 * !(((long int) (sizeof (pid_t))) >= 0)]; +static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) >= 0)]; test_array [0] = 0 ; @@ -11205,14 +10834,13 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err @@ -11226,10 +10854,11 @@ cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default + typedef pid_t ac__type_sizeof_; int main () { -static int test_array [1 - 2 * !(((long int) (sizeof (pid_t))) <= $ac_mid)]; +static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) <= $ac_mid)]; test_array [0] = 0 ; @@ -11242,21 +10871,20 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_hi=$ac_mid; break else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo=`expr $ac_mid + 1` @@ -11270,7 +10898,7 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 cat >conftest.$ac_ext <<_ACEOF @@ -11280,10 +10908,11 @@ cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default + typedef pid_t ac__type_sizeof_; int main () { -static int test_array [1 - 2 * !(((long int) (sizeof (pid_t))) < 0)]; +static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) < 0)]; test_array [0] = 0 ; @@ -11296,14 +10925,13 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err @@ -11317,10 +10945,11 @@ cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default + typedef pid_t ac__type_sizeof_; int main () { -static int test_array [1 - 2 * !(((long int) (sizeof (pid_t))) >= $ac_mid)]; +static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) >= $ac_mid)]; test_array [0] = 0 ; @@ -11333,21 +10962,20 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_lo=$ac_mid; break else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_hi=`expr '(' $ac_mid ')' - 1` @@ -11361,7 +10989,7 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo= ac_hi= @@ -11381,10 +11009,11 @@ cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default + typedef pid_t ac__type_sizeof_; int main () { -static int test_array [1 - 2 * !(((long int) (sizeof (pid_t))) <= $ac_mid)]; +static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) <= $ac_mid)]; test_array [0] = 0 ; @@ -11397,21 +11026,20 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_hi=$ac_mid else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo=`expr '(' $ac_mid ')' + 1` @@ -11422,13 +11050,11 @@ case $ac_lo in ?*) ac_cv_sizeof_pid_t=$ac_lo;; '') if test "$ac_cv_type_pid_t" = yes; then - { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -{ { $as_echo "$as_me:$LINENO: error: cannot compute sizeof (pid_t) + { { echo "$as_me:$LINENO: error: cannot compute sizeof (pid_t) See \`config.log' for more details." >&5 -$as_echo "$as_me: error: cannot compute sizeof (pid_t) +echo "$as_me: error: cannot compute sizeof (pid_t) See \`config.log' for more details." >&2;} - { (exit 77); exit 77; }; }; } + { (exit 77); exit 77; }; } else ac_cv_sizeof_pid_t=0 fi ;; @@ -11441,8 +11067,9 @@ cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default -static long int longval () { return (long int) (sizeof (pid_t)); } -static unsigned long int ulongval () { return (long int) (sizeof (pid_t)); } + typedef pid_t ac__type_sizeof_; +static long int longval () { return (long int) (sizeof (ac__type_sizeof_)); } +static unsigned long int ulongval () { return (long int) (sizeof (ac__type_sizeof_)); } #include #include int @@ -11452,22 +11079,20 @@ FILE *f = fopen ("conftest.val", "w"); if (! f) return 1; - if (((long int) (sizeof (pid_t))) < 0) + if (((long int) (sizeof (ac__type_sizeof_))) < 0) { long int i = longval (); - if (i != ((long int) (sizeof (pid_t)))) + if (i != ((long int) (sizeof (ac__type_sizeof_)))) return 1; - fprintf (f, "%ld", i); + fprintf (f, "%ld\n", i); } else { unsigned long int i = ulongval (); - if (i != ((long int) (sizeof (pid_t)))) + if (i != ((long int) (sizeof (ac__type_sizeof_)))) return 1; - fprintf (f, "%lu", i); + fprintf (f, "%lu\n", i); } - /* Do not output a trailing newline, as this causes \r\n confusion - on some platforms. */ return ferror (f) || fclose (f) != 0; ; @@ -11480,48 +11105,43 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>&5 ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_try") 2>&5 ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_sizeof_pid_t=`cat conftest.val` else - $as_echo "$as_me: program exited with status $ac_status" >&5 -$as_echo "$as_me: failed program was:" >&5 + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) if test "$ac_cv_type_pid_t" = yes; then - { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -{ { $as_echo "$as_me:$LINENO: error: cannot compute sizeof (pid_t) + { { echo "$as_me:$LINENO: error: cannot compute sizeof (pid_t) See \`config.log' for more details." >&5 -$as_echo "$as_me: error: cannot compute sizeof (pid_t) +echo "$as_me: error: cannot compute sizeof (pid_t) See \`config.log' for more details." >&2;} - { (exit 77); exit 77; }; }; } + { (exit 77); exit 77; }; } else ac_cv_sizeof_pid_t=0 fi fi -rm -rf conftest.dSYM rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi rm -f conftest.val fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_sizeof_pid_t" >&5 -$as_echo "$ac_cv_sizeof_pid_t" >&6; } +{ echo "$as_me:$LINENO: result: $ac_cv_sizeof_pid_t" >&5 +echo "${ECHO_T}$ac_cv_sizeof_pid_t" >&6; } @@ -11531,8 +11151,8 @@ -{ $as_echo "$as_me:$LINENO: checking for long long support" >&5 -$as_echo_n "checking for long long support... " >&6; } +{ echo "$as_me:$LINENO: checking for long long support" >&5 +echo $ECHO_N "checking for long long support... $ECHO_C" >&6; } have_long_long=no cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ @@ -11555,14 +11175,13 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err @@ -11576,24 +11195,78 @@ have_long_long=yes else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -{ $as_echo "$as_me:$LINENO: result: $have_long_long" >&5 -$as_echo "$have_long_long" >&6; } +{ echo "$as_me:$LINENO: result: $have_long_long" >&5 +echo "${ECHO_T}$have_long_long" >&6; } if test "$have_long_long" = yes ; then +{ echo "$as_me:$LINENO: checking for long long" >&5 +echo $ECHO_N "checking for long long... $ECHO_C" >&6; } +if test "${ac_cv_type_long_long+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +typedef long long ac__type_new_; +int +main () +{ +if ((ac__type_new_ *) 0) + return 0; +if (sizeof (ac__type_new_)) + return 0; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_cv_type_long_long=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_type_long_long=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ echo "$as_me:$LINENO: result: $ac_cv_type_long_long" >&5 +echo "${ECHO_T}$ac_cv_type_long_long" >&6; } + # The cast to long int works around a bug in the HP C Compiler # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. # This bug is HP SR number 8606223364. -{ $as_echo "$as_me:$LINENO: checking size of long long" >&5 -$as_echo_n "checking size of long long... " >&6; } +{ echo "$as_me:$LINENO: checking size of long long" >&5 +echo $ECHO_N "checking size of long long... $ECHO_C" >&6; } if test "${ac_cv_sizeof_long_long+set}" = set; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else if test "$cross_compiling" = yes; then # Depending upon the size, compute the lo and hi bounds. @@ -11604,10 +11277,11 @@ cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default + typedef long long ac__type_sizeof_; int main () { -static int test_array [1 - 2 * !(((long int) (sizeof (long long))) >= 0)]; +static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) >= 0)]; test_array [0] = 0 ; @@ -11620,14 +11294,13 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err @@ -11641,10 +11314,11 @@ cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default + typedef long long ac__type_sizeof_; int main () { -static int test_array [1 - 2 * !(((long int) (sizeof (long long))) <= $ac_mid)]; +static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) <= $ac_mid)]; test_array [0] = 0 ; @@ -11657,21 +11331,20 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_hi=$ac_mid; break else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo=`expr $ac_mid + 1` @@ -11685,7 +11358,7 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 cat >conftest.$ac_ext <<_ACEOF @@ -11695,10 +11368,11 @@ cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default + typedef long long ac__type_sizeof_; int main () { -static int test_array [1 - 2 * !(((long int) (sizeof (long long))) < 0)]; +static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) < 0)]; test_array [0] = 0 ; @@ -11711,14 +11385,13 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err @@ -11732,10 +11405,11 @@ cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default + typedef long long ac__type_sizeof_; int main () { -static int test_array [1 - 2 * !(((long int) (sizeof (long long))) >= $ac_mid)]; +static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) >= $ac_mid)]; test_array [0] = 0 ; @@ -11748,21 +11422,20 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_lo=$ac_mid; break else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_hi=`expr '(' $ac_mid ')' - 1` @@ -11776,7 +11449,7 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo= ac_hi= @@ -11796,10 +11469,11 @@ cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default + typedef long long ac__type_sizeof_; int main () { -static int test_array [1 - 2 * !(((long int) (sizeof (long long))) <= $ac_mid)]; +static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) <= $ac_mid)]; test_array [0] = 0 ; @@ -11812,21 +11486,20 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_hi=$ac_mid else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo=`expr '(' $ac_mid ')' + 1` @@ -11837,13 +11510,11 @@ case $ac_lo in ?*) ac_cv_sizeof_long_long=$ac_lo;; '') if test "$ac_cv_type_long_long" = yes; then - { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -{ { $as_echo "$as_me:$LINENO: error: cannot compute sizeof (long long) + { { echo "$as_me:$LINENO: error: cannot compute sizeof (long long) See \`config.log' for more details." >&5 -$as_echo "$as_me: error: cannot compute sizeof (long long) +echo "$as_me: error: cannot compute sizeof (long long) See \`config.log' for more details." >&2;} - { (exit 77); exit 77; }; }; } + { (exit 77); exit 77; }; } else ac_cv_sizeof_long_long=0 fi ;; @@ -11856,8 +11527,9 @@ cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default -static long int longval () { return (long int) (sizeof (long long)); } -static unsigned long int ulongval () { return (long int) (sizeof (long long)); } + typedef long long ac__type_sizeof_; +static long int longval () { return (long int) (sizeof (ac__type_sizeof_)); } +static unsigned long int ulongval () { return (long int) (sizeof (ac__type_sizeof_)); } #include #include int @@ -11867,22 +11539,20 @@ FILE *f = fopen ("conftest.val", "w"); if (! f) return 1; - if (((long int) (sizeof (long long))) < 0) + if (((long int) (sizeof (ac__type_sizeof_))) < 0) { long int i = longval (); - if (i != ((long int) (sizeof (long long)))) + if (i != ((long int) (sizeof (ac__type_sizeof_)))) return 1; - fprintf (f, "%ld", i); + fprintf (f, "%ld\n", i); } else { unsigned long int i = ulongval (); - if (i != ((long int) (sizeof (long long)))) + if (i != ((long int) (sizeof (ac__type_sizeof_)))) return 1; - fprintf (f, "%lu", i); + fprintf (f, "%lu\n", i); } - /* Do not output a trailing newline, as this causes \r\n confusion - on some platforms. */ return ferror (f) || fclose (f) != 0; ; @@ -11895,48 +11565,43 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>&5 ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_try") 2>&5 ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_sizeof_long_long=`cat conftest.val` else - $as_echo "$as_me: program exited with status $ac_status" >&5 -$as_echo "$as_me: failed program was:" >&5 + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) if test "$ac_cv_type_long_long" = yes; then - { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -{ { $as_echo "$as_me:$LINENO: error: cannot compute sizeof (long long) + { { echo "$as_me:$LINENO: error: cannot compute sizeof (long long) See \`config.log' for more details." >&5 -$as_echo "$as_me: error: cannot compute sizeof (long long) +echo "$as_me: error: cannot compute sizeof (long long) See \`config.log' for more details." >&2;} - { (exit 77); exit 77; }; }; } + { (exit 77); exit 77; }; } else ac_cv_sizeof_long_long=0 fi fi -rm -rf conftest.dSYM rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi rm -f conftest.val fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_sizeof_long_long" >&5 -$as_echo "$ac_cv_sizeof_long_long" >&6; } +{ echo "$as_me:$LINENO: result: $ac_cv_sizeof_long_long" >&5 +echo "${ECHO_T}$ac_cv_sizeof_long_long" >&6; } @@ -11947,8 +11612,8 @@ fi -{ $as_echo "$as_me:$LINENO: checking for long double support" >&5 -$as_echo_n "checking for long double support... " >&6; } +{ echo "$as_me:$LINENO: checking for long double support" >&5 +echo $ECHO_N "checking for long double support... $ECHO_C" >&6; } have_long_double=no cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ @@ -11971,14 +11636,13 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err @@ -11992,24 +11656,78 @@ have_long_double=yes else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -{ $as_echo "$as_me:$LINENO: result: $have_long_double" >&5 -$as_echo "$have_long_double" >&6; } +{ echo "$as_me:$LINENO: result: $have_long_double" >&5 +echo "${ECHO_T}$have_long_double" >&6; } if test "$have_long_double" = yes ; then +{ echo "$as_me:$LINENO: checking for long double" >&5 +echo $ECHO_N "checking for long double... $ECHO_C" >&6; } +if test "${ac_cv_type_long_double+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +typedef long double ac__type_new_; +int +main () +{ +if ((ac__type_new_ *) 0) + return 0; +if (sizeof (ac__type_new_)) + return 0; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_cv_type_long_double=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_type_long_double=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ echo "$as_me:$LINENO: result: $ac_cv_type_long_double" >&5 +echo "${ECHO_T}$ac_cv_type_long_double" >&6; } + # The cast to long int works around a bug in the HP C Compiler # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. # This bug is HP SR number 8606223364. -{ $as_echo "$as_me:$LINENO: checking size of long double" >&5 -$as_echo_n "checking size of long double... " >&6; } +{ echo "$as_me:$LINENO: checking size of long double" >&5 +echo $ECHO_N "checking size of long double... $ECHO_C" >&6; } if test "${ac_cv_sizeof_long_double+set}" = set; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else if test "$cross_compiling" = yes; then # Depending upon the size, compute the lo and hi bounds. @@ -12020,10 +11738,11 @@ cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default + typedef long double ac__type_sizeof_; int main () { -static int test_array [1 - 2 * !(((long int) (sizeof (long double))) >= 0)]; +static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) >= 0)]; test_array [0] = 0 ; @@ -12036,14 +11755,13 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err @@ -12057,10 +11775,11 @@ cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default + typedef long double ac__type_sizeof_; int main () { -static int test_array [1 - 2 * !(((long int) (sizeof (long double))) <= $ac_mid)]; +static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) <= $ac_mid)]; test_array [0] = 0 ; @@ -12073,21 +11792,20 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_hi=$ac_mid; break else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo=`expr $ac_mid + 1` @@ -12101,7 +11819,7 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 cat >conftest.$ac_ext <<_ACEOF @@ -12111,10 +11829,11 @@ cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default + typedef long double ac__type_sizeof_; int main () { -static int test_array [1 - 2 * !(((long int) (sizeof (long double))) < 0)]; +static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) < 0)]; test_array [0] = 0 ; @@ -12127,14 +11846,13 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err @@ -12148,10 +11866,11 @@ cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default + typedef long double ac__type_sizeof_; int main () { -static int test_array [1 - 2 * !(((long int) (sizeof (long double))) >= $ac_mid)]; +static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) >= $ac_mid)]; test_array [0] = 0 ; @@ -12164,21 +11883,20 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_lo=$ac_mid; break else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_hi=`expr '(' $ac_mid ')' - 1` @@ -12192,7 +11910,7 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo= ac_hi= @@ -12212,10 +11930,11 @@ cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default + typedef long double ac__type_sizeof_; int main () { -static int test_array [1 - 2 * !(((long int) (sizeof (long double))) <= $ac_mid)]; +static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) <= $ac_mid)]; test_array [0] = 0 ; @@ -12228,21 +11947,20 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_hi=$ac_mid else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo=`expr '(' $ac_mid ')' + 1` @@ -12253,13 +11971,11 @@ case $ac_lo in ?*) ac_cv_sizeof_long_double=$ac_lo;; '') if test "$ac_cv_type_long_double" = yes; then - { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -{ { $as_echo "$as_me:$LINENO: error: cannot compute sizeof (long double) + { { echo "$as_me:$LINENO: error: cannot compute sizeof (long double) See \`config.log' for more details." >&5 -$as_echo "$as_me: error: cannot compute sizeof (long double) +echo "$as_me: error: cannot compute sizeof (long double) See \`config.log' for more details." >&2;} - { (exit 77); exit 77; }; }; } + { (exit 77); exit 77; }; } else ac_cv_sizeof_long_double=0 fi ;; @@ -12272,8 +11988,9 @@ cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default -static long int longval () { return (long int) (sizeof (long double)); } -static unsigned long int ulongval () { return (long int) (sizeof (long double)); } + typedef long double ac__type_sizeof_; +static long int longval () { return (long int) (sizeof (ac__type_sizeof_)); } +static unsigned long int ulongval () { return (long int) (sizeof (ac__type_sizeof_)); } #include #include int @@ -12283,22 +12000,20 @@ FILE *f = fopen ("conftest.val", "w"); if (! f) return 1; - if (((long int) (sizeof (long double))) < 0) + if (((long int) (sizeof (ac__type_sizeof_))) < 0) { long int i = longval (); - if (i != ((long int) (sizeof (long double)))) + if (i != ((long int) (sizeof (ac__type_sizeof_)))) return 1; - fprintf (f, "%ld", i); + fprintf (f, "%ld\n", i); } else { unsigned long int i = ulongval (); - if (i != ((long int) (sizeof (long double)))) + if (i != ((long int) (sizeof (ac__type_sizeof_)))) return 1; - fprintf (f, "%lu", i); + fprintf (f, "%lu\n", i); } - /* Do not output a trailing newline, as this causes \r\n confusion - on some platforms. */ return ferror (f) || fclose (f) != 0; ; @@ -12311,48 +12026,43 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>&5 ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_try") 2>&5 ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_sizeof_long_double=`cat conftest.val` else - $as_echo "$as_me: program exited with status $ac_status" >&5 -$as_echo "$as_me: failed program was:" >&5 + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) if test "$ac_cv_type_long_double" = yes; then - { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -{ { $as_echo "$as_me:$LINENO: error: cannot compute sizeof (long double) + { { echo "$as_me:$LINENO: error: cannot compute sizeof (long double) See \`config.log' for more details." >&5 -$as_echo "$as_me: error: cannot compute sizeof (long double) +echo "$as_me: error: cannot compute sizeof (long double) See \`config.log' for more details." >&2;} - { (exit 77); exit 77; }; }; } + { (exit 77); exit 77; }; } else ac_cv_sizeof_long_double=0 fi fi -rm -rf conftest.dSYM rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi rm -f conftest.val fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_sizeof_long_double" >&5 -$as_echo "$ac_cv_sizeof_long_double" >&6; } +{ echo "$as_me:$LINENO: result: $ac_cv_sizeof_long_double" >&5 +echo "${ECHO_T}$ac_cv_sizeof_long_double" >&6; } @@ -12363,8 +12073,8 @@ fi -{ $as_echo "$as_me:$LINENO: checking for _Bool support" >&5 -$as_echo_n "checking for _Bool support... " >&6; } +{ echo "$as_me:$LINENO: checking for _Bool support" >&5 +echo $ECHO_N "checking for _Bool support... $ECHO_C" >&6; } have_c99_bool=no cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ @@ -12387,14 +12097,13 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err @@ -12408,24 +12117,78 @@ have_c99_bool=yes else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -{ $as_echo "$as_me:$LINENO: result: $have_c99_bool" >&5 -$as_echo "$have_c99_bool" >&6; } +{ echo "$as_me:$LINENO: result: $have_c99_bool" >&5 +echo "${ECHO_T}$have_c99_bool" >&6; } if test "$have_c99_bool" = yes ; then +{ echo "$as_me:$LINENO: checking for _Bool" >&5 +echo $ECHO_N "checking for _Bool... $ECHO_C" >&6; } +if test "${ac_cv_type__Bool+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +typedef _Bool ac__type_new_; +int +main () +{ +if ((ac__type_new_ *) 0) + return 0; +if (sizeof (ac__type_new_)) + return 0; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_cv_type__Bool=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_type__Bool=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ echo "$as_me:$LINENO: result: $ac_cv_type__Bool" >&5 +echo "${ECHO_T}$ac_cv_type__Bool" >&6; } + # The cast to long int works around a bug in the HP C Compiler # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. # This bug is HP SR number 8606223364. -{ $as_echo "$as_me:$LINENO: checking size of _Bool" >&5 -$as_echo_n "checking size of _Bool... " >&6; } +{ echo "$as_me:$LINENO: checking size of _Bool" >&5 +echo $ECHO_N "checking size of _Bool... $ECHO_C" >&6; } if test "${ac_cv_sizeof__Bool+set}" = set; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else if test "$cross_compiling" = yes; then # Depending upon the size, compute the lo and hi bounds. @@ -12436,10 +12199,11 @@ cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default + typedef _Bool ac__type_sizeof_; int main () { -static int test_array [1 - 2 * !(((long int) (sizeof (_Bool))) >= 0)]; +static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) >= 0)]; test_array [0] = 0 ; @@ -12452,14 +12216,13 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err @@ -12473,10 +12236,11 @@ cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default + typedef _Bool ac__type_sizeof_; int main () { -static int test_array [1 - 2 * !(((long int) (sizeof (_Bool))) <= $ac_mid)]; +static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) <= $ac_mid)]; test_array [0] = 0 ; @@ -12489,21 +12253,20 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_hi=$ac_mid; break else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo=`expr $ac_mid + 1` @@ -12517,7 +12280,7 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 cat >conftest.$ac_ext <<_ACEOF @@ -12527,10 +12290,11 @@ cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default + typedef _Bool ac__type_sizeof_; int main () { -static int test_array [1 - 2 * !(((long int) (sizeof (_Bool))) < 0)]; +static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) < 0)]; test_array [0] = 0 ; @@ -12543,14 +12307,13 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err @@ -12564,10 +12327,11 @@ cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default + typedef _Bool ac__type_sizeof_; int main () { -static int test_array [1 - 2 * !(((long int) (sizeof (_Bool))) >= $ac_mid)]; +static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) >= $ac_mid)]; test_array [0] = 0 ; @@ -12580,21 +12344,20 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_lo=$ac_mid; break else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_hi=`expr '(' $ac_mid ')' - 1` @@ -12608,7 +12371,7 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo= ac_hi= @@ -12628,10 +12391,11 @@ cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default + typedef _Bool ac__type_sizeof_; int main () { -static int test_array [1 - 2 * !(((long int) (sizeof (_Bool))) <= $ac_mid)]; +static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) <= $ac_mid)]; test_array [0] = 0 ; @@ -12644,21 +12408,20 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_hi=$ac_mid else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo=`expr '(' $ac_mid ')' + 1` @@ -12669,13 +12432,11 @@ case $ac_lo in ?*) ac_cv_sizeof__Bool=$ac_lo;; '') if test "$ac_cv_type__Bool" = yes; then - { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -{ { $as_echo "$as_me:$LINENO: error: cannot compute sizeof (_Bool) + { { echo "$as_me:$LINENO: error: cannot compute sizeof (_Bool) See \`config.log' for more details." >&5 -$as_echo "$as_me: error: cannot compute sizeof (_Bool) +echo "$as_me: error: cannot compute sizeof (_Bool) See \`config.log' for more details." >&2;} - { (exit 77); exit 77; }; }; } + { (exit 77); exit 77; }; } else ac_cv_sizeof__Bool=0 fi ;; @@ -12688,8 +12449,9 @@ cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default -static long int longval () { return (long int) (sizeof (_Bool)); } -static unsigned long int ulongval () { return (long int) (sizeof (_Bool)); } + typedef _Bool ac__type_sizeof_; +static long int longval () { return (long int) (sizeof (ac__type_sizeof_)); } +static unsigned long int ulongval () { return (long int) (sizeof (ac__type_sizeof_)); } #include #include int @@ -12699,22 +12461,20 @@ FILE *f = fopen ("conftest.val", "w"); if (! f) return 1; - if (((long int) (sizeof (_Bool))) < 0) + if (((long int) (sizeof (ac__type_sizeof_))) < 0) { long int i = longval (); - if (i != ((long int) (sizeof (_Bool)))) + if (i != ((long int) (sizeof (ac__type_sizeof_)))) return 1; - fprintf (f, "%ld", i); + fprintf (f, "%ld\n", i); } else { unsigned long int i = ulongval (); - if (i != ((long int) (sizeof (_Bool)))) + if (i != ((long int) (sizeof (ac__type_sizeof_)))) return 1; - fprintf (f, "%lu", i); + fprintf (f, "%lu\n", i); } - /* Do not output a trailing newline, as this causes \r\n confusion - on some platforms. */ return ferror (f) || fclose (f) != 0; ; @@ -12727,48 +12487,43 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>&5 ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_try") 2>&5 ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_sizeof__Bool=`cat conftest.val` else - $as_echo "$as_me: program exited with status $ac_status" >&5 -$as_echo "$as_me: failed program was:" >&5 + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) if test "$ac_cv_type__Bool" = yes; then - { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -{ { $as_echo "$as_me:$LINENO: error: cannot compute sizeof (_Bool) + { { echo "$as_me:$LINENO: error: cannot compute sizeof (_Bool) See \`config.log' for more details." >&5 -$as_echo "$as_me: error: cannot compute sizeof (_Bool) +echo "$as_me: error: cannot compute sizeof (_Bool) See \`config.log' for more details." >&2;} - { (exit 77); exit 77; }; }; } + { (exit 77); exit 77; }; } else ac_cv_sizeof__Bool=0 fi fi -rm -rf conftest.dSYM rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi rm -f conftest.val fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_sizeof__Bool" >&5 -$as_echo "$ac_cv_sizeof__Bool" >&6; } +{ echo "$as_me:$LINENO: result: $ac_cv_sizeof__Bool" >&5 +echo "${ECHO_T}$ac_cv_sizeof__Bool" >&6; } @@ -12779,13 +12534,12 @@ fi -{ $as_echo "$as_me:$LINENO: checking for uintptr_t" >&5 -$as_echo_n "checking for uintptr_t... " >&6; } +{ echo "$as_me:$LINENO: checking for uintptr_t" >&5 +echo $ECHO_N "checking for uintptr_t... $ECHO_C" >&6; } if test "${ac_cv_type_uintptr_t+set}" = set; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else - ac_cv_type_uintptr_t=no -cat >conftest.$ac_ext <<_ACEOF + cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext @@ -12795,11 +12549,14 @@ #include #endif +typedef uintptr_t ac__type_new_; int main () { -if (sizeof (uintptr_t)) - return 0; +if ((ac__type_new_ *) 0) + return 0; +if (sizeof (ac__type_new_)) + return 0; ; return 0; } @@ -12810,33 +12567,55 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then + ac_cv_type_uintptr_t=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_type_uintptr_t=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ echo "$as_me:$LINENO: result: $ac_cv_type_uintptr_t" >&5 +echo "${ECHO_T}$ac_cv_type_uintptr_t" >&6; } +if test $ac_cv_type_uintptr_t = yes; then + +cat >>confdefs.h <<_ACEOF +#define HAVE_UINTPTR_T 1 +_ACEOF + +{ echo "$as_me:$LINENO: checking for uintptr_t" >&5 +echo $ECHO_N "checking for uintptr_t... $ECHO_C" >&6; } +if test "${ac_cv_type_uintptr_t+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#ifdef HAVE_STDINT_H - #include - #endif - +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +typedef uintptr_t ac__type_new_; int main () { -if (sizeof ((uintptr_t))) - return 0; +if ((ac__type_new_ *) 0) + return 0; +if (sizeof (ac__type_new_)) + return 0; ; return 0; } @@ -12847,52 +12626,38 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then - : -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_cv_type_uintptr_t=yes -fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + ac_cv_type_uintptr_t=yes else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 - + ac_cv_type_uintptr_t=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_type_uintptr_t" >&5 -$as_echo "$ac_cv_type_uintptr_t" >&6; } -if test "x$ac_cv_type_uintptr_t" = x""yes; then - -cat >>confdefs.h <<_ACEOF -#define HAVE_UINTPTR_T 1 -_ACEOF +{ echo "$as_me:$LINENO: result: $ac_cv_type_uintptr_t" >&5 +echo "${ECHO_T}$ac_cv_type_uintptr_t" >&6; } # The cast to long int works around a bug in the HP C Compiler # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. # This bug is HP SR number 8606223364. -{ $as_echo "$as_me:$LINENO: checking size of uintptr_t" >&5 -$as_echo_n "checking size of uintptr_t... " >&6; } +{ echo "$as_me:$LINENO: checking size of uintptr_t" >&5 +echo $ECHO_N "checking size of uintptr_t... $ECHO_C" >&6; } if test "${ac_cv_sizeof_uintptr_t+set}" = set; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else if test "$cross_compiling" = yes; then # Depending upon the size, compute the lo and hi bounds. @@ -12903,10 +12668,11 @@ cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default + typedef uintptr_t ac__type_sizeof_; int main () { -static int test_array [1 - 2 * !(((long int) (sizeof (uintptr_t))) >= 0)]; +static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) >= 0)]; test_array [0] = 0 ; @@ -12919,14 +12685,13 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err @@ -12940,10 +12705,11 @@ cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default + typedef uintptr_t ac__type_sizeof_; int main () { -static int test_array [1 - 2 * !(((long int) (sizeof (uintptr_t))) <= $ac_mid)]; +static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) <= $ac_mid)]; test_array [0] = 0 ; @@ -12956,21 +12722,20 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_hi=$ac_mid; break else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo=`expr $ac_mid + 1` @@ -12984,7 +12749,7 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 cat >conftest.$ac_ext <<_ACEOF @@ -12994,10 +12759,11 @@ cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default + typedef uintptr_t ac__type_sizeof_; int main () { -static int test_array [1 - 2 * !(((long int) (sizeof (uintptr_t))) < 0)]; +static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) < 0)]; test_array [0] = 0 ; @@ -13010,14 +12776,13 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err @@ -13031,10 +12796,11 @@ cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default + typedef uintptr_t ac__type_sizeof_; int main () { -static int test_array [1 - 2 * !(((long int) (sizeof (uintptr_t))) >= $ac_mid)]; +static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) >= $ac_mid)]; test_array [0] = 0 ; @@ -13047,21 +12813,20 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_lo=$ac_mid; break else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_hi=`expr '(' $ac_mid ')' - 1` @@ -13075,7 +12840,7 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo= ac_hi= @@ -13095,10 +12860,11 @@ cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default + typedef uintptr_t ac__type_sizeof_; int main () { -static int test_array [1 - 2 * !(((long int) (sizeof (uintptr_t))) <= $ac_mid)]; +static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) <= $ac_mid)]; test_array [0] = 0 ; @@ -13111,21 +12877,20 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_hi=$ac_mid else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo=`expr '(' $ac_mid ')' + 1` @@ -13136,13 +12901,11 @@ case $ac_lo in ?*) ac_cv_sizeof_uintptr_t=$ac_lo;; '') if test "$ac_cv_type_uintptr_t" = yes; then - { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -{ { $as_echo "$as_me:$LINENO: error: cannot compute sizeof (uintptr_t) + { { echo "$as_me:$LINENO: error: cannot compute sizeof (uintptr_t) See \`config.log' for more details." >&5 -$as_echo "$as_me: error: cannot compute sizeof (uintptr_t) +echo "$as_me: error: cannot compute sizeof (uintptr_t) See \`config.log' for more details." >&2;} - { (exit 77); exit 77; }; }; } + { (exit 77); exit 77; }; } else ac_cv_sizeof_uintptr_t=0 fi ;; @@ -13155,8 +12918,9 @@ cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default -static long int longval () { return (long int) (sizeof (uintptr_t)); } -static unsigned long int ulongval () { return (long int) (sizeof (uintptr_t)); } + typedef uintptr_t ac__type_sizeof_; +static long int longval () { return (long int) (sizeof (ac__type_sizeof_)); } +static unsigned long int ulongval () { return (long int) (sizeof (ac__type_sizeof_)); } #include #include int @@ -13166,22 +12930,20 @@ FILE *f = fopen ("conftest.val", "w"); if (! f) return 1; - if (((long int) (sizeof (uintptr_t))) < 0) + if (((long int) (sizeof (ac__type_sizeof_))) < 0) { long int i = longval (); - if (i != ((long int) (sizeof (uintptr_t)))) + if (i != ((long int) (sizeof (ac__type_sizeof_)))) return 1; - fprintf (f, "%ld", i); + fprintf (f, "%ld\n", i); } else { unsigned long int i = ulongval (); - if (i != ((long int) (sizeof (uintptr_t)))) + if (i != ((long int) (sizeof (ac__type_sizeof_)))) return 1; - fprintf (f, "%lu", i); + fprintf (f, "%lu\n", i); } - /* Do not output a trailing newline, as this causes \r\n confusion - on some platforms. */ return ferror (f) || fclose (f) != 0; ; @@ -13194,48 +12956,43 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>&5 ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_try") 2>&5 ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_sizeof_uintptr_t=`cat conftest.val` else - $as_echo "$as_me: program exited with status $ac_status" >&5 -$as_echo "$as_me: failed program was:" >&5 + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) if test "$ac_cv_type_uintptr_t" = yes; then - { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -{ { $as_echo "$as_me:$LINENO: error: cannot compute sizeof (uintptr_t) + { { echo "$as_me:$LINENO: error: cannot compute sizeof (uintptr_t) See \`config.log' for more details." >&5 -$as_echo "$as_me: error: cannot compute sizeof (uintptr_t) +echo "$as_me: error: cannot compute sizeof (uintptr_t) See \`config.log' for more details." >&2;} - { (exit 77); exit 77; }; }; } + { (exit 77); exit 77; }; } else ac_cv_sizeof_uintptr_t=0 fi fi -rm -rf conftest.dSYM rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi rm -f conftest.val fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_sizeof_uintptr_t" >&5 -$as_echo "$ac_cv_sizeof_uintptr_t" >&6; } +{ echo "$as_me:$LINENO: result: $ac_cv_sizeof_uintptr_t" >&5 +echo "${ECHO_T}$ac_cv_sizeof_uintptr_t" >&6; } @@ -13249,10 +13006,10 @@ # Hmph. AC_CHECK_SIZEOF() doesn't include . -{ $as_echo "$as_me:$LINENO: checking size of off_t" >&5 -$as_echo_n "checking size of off_t... " >&6; } +{ echo "$as_me:$LINENO: checking size of off_t" >&5 +echo $ECHO_N "checking size of off_t... $ECHO_C" >&6; } if test "${ac_cv_sizeof_off_t+set}" = set; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else if test "$cross_compiling" = yes; then ac_cv_sizeof_off_t=4 @@ -13279,32 +13036,29 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>&5 ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_try") 2>&5 ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_sizeof_off_t=`cat conftestval` else - $as_echo "$as_me: program exited with status $ac_status" >&5 -$as_echo "$as_me: failed program was:" >&5 + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) ac_cv_sizeof_off_t=0 fi -rm -rf conftest.dSYM rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi @@ -13312,16 +13066,16 @@ fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_sizeof_off_t" >&5 -$as_echo "$ac_cv_sizeof_off_t" >&6; } +{ echo "$as_me:$LINENO: result: $ac_cv_sizeof_off_t" >&5 +echo "${ECHO_T}$ac_cv_sizeof_off_t" >&6; } cat >>confdefs.h <<_ACEOF #define SIZEOF_OFF_T $ac_cv_sizeof_off_t _ACEOF -{ $as_echo "$as_me:$LINENO: checking whether to enable large file support" >&5 -$as_echo_n "checking whether to enable large file support... " >&6; } +{ echo "$as_me:$LINENO: checking whether to enable large file support" >&5 +echo $ECHO_N "checking whether to enable large file support... $ECHO_C" >&6; } if test "$have_long_long" = yes -a \ "$ac_cv_sizeof_off_t" -gt "$ac_cv_sizeof_long" -a \ "$ac_cv_sizeof_long_long" -ge "$ac_cv_sizeof_off_t"; then @@ -13330,18 +13084,18 @@ #define HAVE_LARGEFILE_SUPPORT 1 _ACEOF - { $as_echo "$as_me:$LINENO: result: yes" >&5 -$as_echo "yes" >&6; } + { echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; } else - { $as_echo "$as_me:$LINENO: result: no" >&5 -$as_echo "no" >&6; } + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } fi # AC_CHECK_SIZEOF() doesn't include . -{ $as_echo "$as_me:$LINENO: checking size of time_t" >&5 -$as_echo_n "checking size of time_t... " >&6; } +{ echo "$as_me:$LINENO: checking size of time_t" >&5 +echo $ECHO_N "checking size of time_t... $ECHO_C" >&6; } if test "${ac_cv_sizeof_time_t+set}" = set; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else if test "$cross_compiling" = yes; then ac_cv_sizeof_time_t=4 @@ -13368,32 +13122,29 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>&5 ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_try") 2>&5 ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_sizeof_time_t=`cat conftestval` else - $as_echo "$as_me: program exited with status $ac_status" >&5 -$as_echo "$as_me: failed program was:" >&5 + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) ac_cv_sizeof_time_t=0 fi -rm -rf conftest.dSYM rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi @@ -13401,8 +13152,8 @@ fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_sizeof_time_t" >&5 -$as_echo "$ac_cv_sizeof_time_t" >&6; } +{ echo "$as_me:$LINENO: result: $ac_cv_sizeof_time_t" >&5 +echo "${ECHO_T}$ac_cv_sizeof_time_t" >&6; } cat >>confdefs.h <<_ACEOF #define SIZEOF_TIME_T $ac_cv_sizeof_time_t @@ -13419,8 +13170,8 @@ elif test "$ac_cv_pthread" = "yes" then CC="$CC -pthread" fi -{ $as_echo "$as_me:$LINENO: checking for pthread_t" >&5 -$as_echo_n "checking for pthread_t... " >&6; } +{ echo "$as_me:$LINENO: checking for pthread_t" >&5 +echo $ECHO_N "checking for pthread_t... $ECHO_C" >&6; } have_pthread_t=no cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ @@ -13443,35 +13194,34 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then have_pthread_t=yes else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -{ $as_echo "$as_me:$LINENO: result: $have_pthread_t" >&5 -$as_echo "$have_pthread_t" >&6; } +{ echo "$as_me:$LINENO: result: $have_pthread_t" >&5 +echo "${ECHO_T}$have_pthread_t" >&6; } if test "$have_pthread_t" = yes ; then # AC_CHECK_SIZEOF() doesn't include . - { $as_echo "$as_me:$LINENO: checking size of pthread_t" >&5 -$as_echo_n "checking size of pthread_t... " >&6; } + { echo "$as_me:$LINENO: checking size of pthread_t" >&5 +echo $ECHO_N "checking size of pthread_t... $ECHO_C" >&6; } if test "${ac_cv_sizeof_pthread_t+set}" = set; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else if test "$cross_compiling" = yes; then ac_cv_sizeof_pthread_t=4 @@ -13498,32 +13248,29 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>&5 ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_try") 2>&5 ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_sizeof_pthread_t=`cat conftestval` else - $as_echo "$as_me: program exited with status $ac_status" >&5 -$as_echo "$as_me: failed program was:" >&5 + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) ac_cv_sizeof_pthread_t=0 fi -rm -rf conftest.dSYM rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi @@ -13531,8 +13278,8 @@ fi - { $as_echo "$as_me:$LINENO: result: $ac_cv_sizeof_pthread_t" >&5 -$as_echo "$ac_cv_sizeof_pthread_t" >&6; } + { echo "$as_me:$LINENO: result: $ac_cv_sizeof_pthread_t" >&5 +echo "${ECHO_T}$ac_cv_sizeof_pthread_t" >&6; } cat >>confdefs.h <<_ACEOF #define SIZEOF_PTHREAD_T $ac_cv_sizeof_pthread_t @@ -13541,8 +13288,8 @@ fi CC="$ac_save_cc" -{ $as_echo "$as_me:$LINENO: checking for --enable-toolbox-glue" >&5 -$as_echo_n "checking for --enable-toolbox-glue... " >&6; } +{ echo "$as_me:$LINENO: checking for --enable-toolbox-glue" >&5 +echo $ECHO_N "checking for --enable-toolbox-glue... $ECHO_C" >&6; } # Check whether --enable-toolbox-glue was given. if test "${enable_toolbox_glue+set}" = set; then enableval=$enable_toolbox_glue; @@ -13573,8 +13320,8 @@ extra_undefs="" ;; esac -{ $as_echo "$as_me:$LINENO: result: $enable_toolbox_glue" >&5 -$as_echo "$enable_toolbox_glue" >&6; } +{ echo "$as_me:$LINENO: result: $enable_toolbox_glue" >&5 +echo "${ECHO_T}$enable_toolbox_glue" >&6; } @@ -13611,8 +13358,8 @@ LIBTOOL_CRUFT=$LIBTOOL_CRUFT' -compatibility_version $(VERSION) -current_version $(VERSION)';; esac -{ $as_echo "$as_me:$LINENO: checking for --enable-framework" >&5 -$as_echo_n "checking for --enable-framework... " >&6; } +{ echo "$as_me:$LINENO: checking for --enable-framework" >&5 +echo $ECHO_N "checking for --enable-framework... $ECHO_C" >&6; } if test "$enable_framework" then BASECFLAGS="$BASECFLAGS -fno-common -dynamic" @@ -13623,15 +13370,21 @@ #define WITH_NEXT_FRAMEWORK 1 _ACEOF - { $as_echo "$as_me:$LINENO: result: yes" >&5 -$as_echo "yes" >&6; } + { echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; } + if test $enable_shared = "yes" + then + { { echo "$as_me:$LINENO: error: Specifying both --enable-shared and --enable-framework is not supported, use only --enable-framework instead" >&5 +echo "$as_me: error: Specifying both --enable-shared and --enable-framework is not supported, use only --enable-framework instead" >&2;} + { (exit 1); exit 1; }; } + fi else - { $as_echo "$as_me:$LINENO: result: no" >&5 -$as_echo "no" >&6; } + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } fi -{ $as_echo "$as_me:$LINENO: checking for dyld" >&5 -$as_echo_n "checking for dyld... " >&6; } +{ echo "$as_me:$LINENO: checking for dyld" >&5 +echo $ECHO_N "checking for dyld... $ECHO_C" >&6; } case $ac_sys_system/$ac_sys_release in Darwin/*) @@ -13639,12 +13392,12 @@ #define WITH_DYLD 1 _ACEOF - { $as_echo "$as_me:$LINENO: result: always on for Darwin" >&5 -$as_echo "always on for Darwin" >&6; } + { echo "$as_me:$LINENO: result: always on for Darwin" >&5 +echo "${ECHO_T}always on for Darwin" >&6; } ;; *) - { $as_echo "$as_me:$LINENO: result: no" >&5 -$as_echo "no" >&6; } + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } ;; esac @@ -13656,8 +13409,8 @@ # SO is the extension of shared libraries `(including the dot!) # -- usually .so, .sl on HP-UX, .dll on Cygwin -{ $as_echo "$as_me:$LINENO: checking SO" >&5 -$as_echo_n "checking SO... " >&6; } +{ echo "$as_me:$LINENO: checking SO" >&5 +echo $ECHO_N "checking SO... $ECHO_C" >&6; } if test -z "$SO" then case $ac_sys_system in @@ -13682,8 +13435,8 @@ echo '=====================================================================' sleep 10 fi -{ $as_echo "$as_me:$LINENO: result: $SO" >&5 -$as_echo "$SO" >&6; } +{ echo "$as_me:$LINENO: result: $SO" >&5 +echo "${ECHO_T}$SO" >&6; } cat >>confdefs.h <<_ACEOF @@ -13694,8 +13447,8 @@ # -- "cc -G" on SunOS 5.x, "ld -shared" on IRIX 5 # (Shared libraries in this instance are shared modules to be loaded into # Python, as opposed to building Python itself as a shared library.) -{ $as_echo "$as_me:$LINENO: checking LDSHARED" >&5 -$as_echo_n "checking LDSHARED... " >&6; } +{ echo "$as_me:$LINENO: checking LDSHARED" >&5 +echo $ECHO_N "checking LDSHARED... $ECHO_C" >&6; } if test -z "$LDSHARED" then case $ac_sys_system/$ac_sys_release in @@ -13801,13 +13554,13 @@ *) LDSHARED="ld";; esac fi -{ $as_echo "$as_me:$LINENO: result: $LDSHARED" >&5 -$as_echo "$LDSHARED" >&6; } +{ echo "$as_me:$LINENO: result: $LDSHARED" >&5 +echo "${ECHO_T}$LDSHARED" >&6; } BLDSHARED=${BLDSHARED-$LDSHARED} # CCSHARED are the C *flags* used to create objects to go into a shared # library (module) -- this is only needed for a few systems -{ $as_echo "$as_me:$LINENO: checking CCSHARED" >&5 -$as_echo_n "checking CCSHARED... " >&6; } +{ echo "$as_me:$LINENO: checking CCSHARED" >&5 +echo $ECHO_N "checking CCSHARED... $ECHO_C" >&6; } if test -z "$CCSHARED" then case $ac_sys_system/$ac_sys_release in @@ -13842,12 +13595,12 @@ atheos*) CCSHARED="-fPIC";; esac fi -{ $as_echo "$as_me:$LINENO: result: $CCSHARED" >&5 -$as_echo "$CCSHARED" >&6; } +{ echo "$as_me:$LINENO: result: $CCSHARED" >&5 +echo "${ECHO_T}$CCSHARED" >&6; } # LINKFORSHARED are the flags passed to the $(CC) command that links # the python executable -- this is only needed for a few systems -{ $as_echo "$as_me:$LINENO: checking LINKFORSHARED" >&5 -$as_echo_n "checking LINKFORSHARED... " >&6; } +{ echo "$as_me:$LINENO: checking LINKFORSHARED" >&5 +echo $ECHO_N "checking LINKFORSHARED... $ECHO_C" >&6; } if test -z "$LINKFORSHARED" then case $ac_sys_system/$ac_sys_release in @@ -13902,13 +13655,13 @@ LINKFORSHARED='-Wl,-E -N 2048K';; esac fi -{ $as_echo "$as_me:$LINENO: result: $LINKFORSHARED" >&5 -$as_echo "$LINKFORSHARED" >&6; } +{ echo "$as_me:$LINENO: result: $LINKFORSHARED" >&5 +echo "${ECHO_T}$LINKFORSHARED" >&6; } -{ $as_echo "$as_me:$LINENO: checking CFLAGSFORSHARED" >&5 -$as_echo_n "checking CFLAGSFORSHARED... " >&6; } +{ echo "$as_me:$LINENO: checking CFLAGSFORSHARED" >&5 +echo $ECHO_N "checking CFLAGSFORSHARED... $ECHO_C" >&6; } if test ! "$LIBRARY" = "$LDLIBRARY" then case $ac_sys_system in @@ -13920,8 +13673,8 @@ CFLAGSFORSHARED='$(CCSHARED)' esac fi -{ $as_echo "$as_me:$LINENO: result: $CFLAGSFORSHARED" >&5 -$as_echo "$CFLAGSFORSHARED" >&6; } +{ echo "$as_me:$LINENO: result: $CFLAGSFORSHARED" >&5 +echo "${ECHO_T}$CFLAGSFORSHARED" >&6; } # SHLIBS are libraries (except -lc and -lm) to link to the python shared # library (with --enable-shared). @@ -13932,22 +13685,22 @@ # don't need to link LIBS explicitly. The default should be only changed # on systems where this approach causes problems. -{ $as_echo "$as_me:$LINENO: checking SHLIBS" >&5 -$as_echo_n "checking SHLIBS... " >&6; } +{ echo "$as_me:$LINENO: checking SHLIBS" >&5 +echo $ECHO_N "checking SHLIBS... $ECHO_C" >&6; } case "$ac_sys_system" in *) SHLIBS='$(LIBS)';; esac -{ $as_echo "$as_me:$LINENO: result: $SHLIBS" >&5 -$as_echo "$SHLIBS" >&6; } +{ echo "$as_me:$LINENO: result: $SHLIBS" >&5 +echo "${ECHO_T}$SHLIBS" >&6; } # checks for libraries -{ $as_echo "$as_me:$LINENO: checking for dlopen in -ldl" >&5 -$as_echo_n "checking for dlopen in -ldl... " >&6; } +{ echo "$as_me:$LINENO: checking for dlopen in -ldl" >&5 +echo $ECHO_N "checking for dlopen in -ldl... $ECHO_C" >&6; } if test "${ac_cv_lib_dl_dlopen+set}" = set; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ldl $LIBS" @@ -13979,37 +13732,33 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err - } && test -s conftest$ac_exeext && { - test "$cross_compiling" = yes || - $as_test_x conftest$ac_exeext - }; then + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then ac_cv_lib_dl_dlopen=yes else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_dl_dlopen=no fi -rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_dl_dlopen" >&5 -$as_echo "$ac_cv_lib_dl_dlopen" >&6; } -if test "x$ac_cv_lib_dl_dlopen" = x""yes; then +{ echo "$as_me:$LINENO: result: $ac_cv_lib_dl_dlopen" >&5 +echo "${ECHO_T}$ac_cv_lib_dl_dlopen" >&6; } +if test $ac_cv_lib_dl_dlopen = yes; then cat >>confdefs.h <<_ACEOF #define HAVE_LIBDL 1 _ACEOF @@ -14019,10 +13768,10 @@ fi # Dynamic linking for SunOS/Solaris and SYSV -{ $as_echo "$as_me:$LINENO: checking for shl_load in -ldld" >&5 -$as_echo_n "checking for shl_load in -ldld... " >&6; } +{ echo "$as_me:$LINENO: checking for shl_load in -ldld" >&5 +echo $ECHO_N "checking for shl_load in -ldld... $ECHO_C" >&6; } if test "${ac_cv_lib_dld_shl_load+set}" = set; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ldld $LIBS" @@ -14054,37 +13803,33 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err - } && test -s conftest$ac_exeext && { - test "$cross_compiling" = yes || - $as_test_x conftest$ac_exeext - }; then + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then ac_cv_lib_dld_shl_load=yes else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_dld_shl_load=no fi -rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_dld_shl_load" >&5 -$as_echo "$ac_cv_lib_dld_shl_load" >&6; } -if test "x$ac_cv_lib_dld_shl_load" = x""yes; then +{ echo "$as_me:$LINENO: result: $ac_cv_lib_dld_shl_load" >&5 +echo "${ECHO_T}$ac_cv_lib_dld_shl_load" >&6; } +if test $ac_cv_lib_dld_shl_load = yes; then cat >>confdefs.h <<_ACEOF #define HAVE_LIBDLD 1 _ACEOF @@ -14096,10 +13841,10 @@ # only check for sem_init if thread support is requested if test "$with_threads" = "yes" -o -z "$with_threads"; then - { $as_echo "$as_me:$LINENO: checking for library containing sem_init" >&5 -$as_echo_n "checking for library containing sem_init... " >&6; } + { echo "$as_me:$LINENO: checking for library containing sem_init" >&5 +echo $ECHO_N "checking for library containing sem_init... $ECHO_C" >&6; } if test "${ac_cv_search_sem_init+set}" = set; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_func_search_save_LIBS=$LIBS cat >conftest.$ac_ext <<_ACEOF @@ -14137,30 +13882,26 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err - } && test -s conftest$ac_exeext && { - test "$cross_compiling" = yes || - $as_test_x conftest$ac_exeext - }; then + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then ac_cv_search_sem_init=$ac_res else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi -rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext if test "${ac_cv_search_sem_init+set}" = set; then @@ -14175,8 +13916,8 @@ rm conftest.$ac_ext LIBS=$ac_func_search_save_LIBS fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_search_sem_init" >&5 -$as_echo "$ac_cv_search_sem_init" >&6; } +{ echo "$as_me:$LINENO: result: $ac_cv_search_sem_init" >&5 +echo "${ECHO_T}$ac_cv_search_sem_init" >&6; } ac_res=$ac_cv_search_sem_init if test "$ac_res" != no; then test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" @@ -14188,10 +13929,10 @@ fi # check if we need libintl for locale functions -{ $as_echo "$as_me:$LINENO: checking for textdomain in -lintl" >&5 -$as_echo_n "checking for textdomain in -lintl... " >&6; } +{ echo "$as_me:$LINENO: checking for textdomain in -lintl" >&5 +echo $ECHO_N "checking for textdomain in -lintl... $ECHO_C" >&6; } if test "${ac_cv_lib_intl_textdomain+set}" = set; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lintl $LIBS" @@ -14223,37 +13964,33 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err - } && test -s conftest$ac_exeext && { - test "$cross_compiling" = yes || - $as_test_x conftest$ac_exeext - }; then + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then ac_cv_lib_intl_textdomain=yes else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_intl_textdomain=no fi -rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_intl_textdomain" >&5 -$as_echo "$ac_cv_lib_intl_textdomain" >&6; } -if test "x$ac_cv_lib_intl_textdomain" = x""yes; then +{ echo "$as_me:$LINENO: result: $ac_cv_lib_intl_textdomain" >&5 +echo "${ECHO_T}$ac_cv_lib_intl_textdomain" >&6; } +if test $ac_cv_lib_intl_textdomain = yes; then cat >>confdefs.h <<\_ACEOF #define WITH_LIBINTL 1 @@ -14264,8 +14001,8 @@ # checks for system dependent C++ extensions support case "$ac_sys_system" in - AIX*) { $as_echo "$as_me:$LINENO: checking for genuine AIX C++ extensions support" >&5 -$as_echo_n "checking for genuine AIX C++ extensions support... " >&6; } + AIX*) { echo "$as_me:$LINENO: checking for genuine AIX C++ extensions support" >&5 +echo $ECHO_N "checking for genuine AIX C++ extensions support... $ECHO_C" >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF @@ -14287,37 +14024,33 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err - } && test -s conftest$ac_exeext && { - test "$cross_compiling" = yes || - $as_test_x conftest$ac_exeext - }; then + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then cat >>confdefs.h <<\_ACEOF #define AIX_GENUINE_CPLUSPLUS 1 _ACEOF - { $as_echo "$as_me:$LINENO: result: yes" >&5 -$as_echo "yes" >&6; } + { echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; } else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 - { $as_echo "$as_me:$LINENO: result: no" >&5 -$as_echo "no" >&6; } + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } fi -rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext;; *) ;; @@ -14325,10 +14058,10 @@ # Most SVR4 platforms (e.g. Solaris) need -lsocket and -lnsl. # BeOS' sockets are stashed in libnet. -{ $as_echo "$as_me:$LINENO: checking for t_open in -lnsl" >&5 -$as_echo_n "checking for t_open in -lnsl... " >&6; } +{ echo "$as_me:$LINENO: checking for t_open in -lnsl" >&5 +echo $ECHO_N "checking for t_open in -lnsl... $ECHO_C" >&6; } if test "${ac_cv_lib_nsl_t_open+set}" = set; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lnsl $LIBS" @@ -14360,44 +14093,40 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err - } && test -s conftest$ac_exeext && { - test "$cross_compiling" = yes || - $as_test_x conftest$ac_exeext - }; then + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then ac_cv_lib_nsl_t_open=yes else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_nsl_t_open=no fi -rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_nsl_t_open" >&5 -$as_echo "$ac_cv_lib_nsl_t_open" >&6; } -if test "x$ac_cv_lib_nsl_t_open" = x""yes; then +{ echo "$as_me:$LINENO: result: $ac_cv_lib_nsl_t_open" >&5 +echo "${ECHO_T}$ac_cv_lib_nsl_t_open" >&6; } +if test $ac_cv_lib_nsl_t_open = yes; then LIBS="-lnsl $LIBS" fi # SVR4 -{ $as_echo "$as_me:$LINENO: checking for socket in -lsocket" >&5 -$as_echo_n "checking for socket in -lsocket... " >&6; } +{ echo "$as_me:$LINENO: checking for socket in -lsocket" >&5 +echo $ECHO_N "checking for socket in -lsocket... $ECHO_C" >&6; } if test "${ac_cv_lib_socket_socket+set}" = set; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lsocket $LIBS $LIBS" @@ -14429,47 +14158,43 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err - } && test -s conftest$ac_exeext && { - test "$cross_compiling" = yes || - $as_test_x conftest$ac_exeext - }; then + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then ac_cv_lib_socket_socket=yes else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_socket_socket=no fi -rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_socket_socket" >&5 -$as_echo "$ac_cv_lib_socket_socket" >&6; } -if test "x$ac_cv_lib_socket_socket" = x""yes; then +{ echo "$as_me:$LINENO: result: $ac_cv_lib_socket_socket" >&5 +echo "${ECHO_T}$ac_cv_lib_socket_socket" >&6; } +if test $ac_cv_lib_socket_socket = yes; then LIBS="-lsocket $LIBS" fi # SVR4 sockets case "$ac_sys_system" in BeOS*) -{ $as_echo "$as_me:$LINENO: checking for socket in -lnet" >&5 -$as_echo_n "checking for socket in -lnet... " >&6; } +{ echo "$as_me:$LINENO: checking for socket in -lnet" >&5 +echo $ECHO_N "checking for socket in -lnet... $ECHO_C" >&6; } if test "${ac_cv_lib_net_socket+set}" = set; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lnet $LIBS $LIBS" @@ -14501,62 +14226,58 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err - } && test -s conftest$ac_exeext && { - test "$cross_compiling" = yes || - $as_test_x conftest$ac_exeext - }; then + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then ac_cv_lib_net_socket=yes else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_net_socket=no fi -rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_net_socket" >&5 -$as_echo "$ac_cv_lib_net_socket" >&6; } -if test "x$ac_cv_lib_net_socket" = x""yes; then +{ echo "$as_me:$LINENO: result: $ac_cv_lib_net_socket" >&5 +echo "${ECHO_T}$ac_cv_lib_net_socket" >&6; } +if test $ac_cv_lib_net_socket = yes; then LIBS="-lnet $LIBS" fi # BeOS ;; esac -{ $as_echo "$as_me:$LINENO: checking for --with-libs" >&5 -$as_echo_n "checking for --with-libs... " >&6; } +{ echo "$as_me:$LINENO: checking for --with-libs" >&5 +echo $ECHO_N "checking for --with-libs... $ECHO_C" >&6; } # Check whether --with-libs was given. if test "${with_libs+set}" = set; then withval=$with_libs; -{ $as_echo "$as_me:$LINENO: result: $withval" >&5 -$as_echo "$withval" >&6; } +{ echo "$as_me:$LINENO: result: $withval" >&5 +echo "${ECHO_T}$withval" >&6; } LIBS="$withval $LIBS" else - { $as_echo "$as_me:$LINENO: result: no" >&5 -$as_echo "no" >&6; } + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } fi # Check for use of the system libffi library -{ $as_echo "$as_me:$LINENO: checking for --with-system-ffi" >&5 -$as_echo_n "checking for --with-system-ffi... " >&6; } +{ echo "$as_me:$LINENO: checking for --with-system-ffi" >&5 +echo $ECHO_N "checking for --with-system-ffi... $ECHO_C" >&6; } # Check whether --with-system_ffi was given. if test "${with_system_ffi+set}" = set; then @@ -14564,41 +14285,41 @@ fi -{ $as_echo "$as_me:$LINENO: result: $with_system_ffi" >&5 -$as_echo "$with_system_ffi" >&6; } +{ echo "$as_me:$LINENO: result: $with_system_ffi" >&5 +echo "${ECHO_T}$with_system_ffi" >&6; } # Check for --with-dbmliborder -{ $as_echo "$as_me:$LINENO: checking for --with-dbmliborder" >&5 -$as_echo_n "checking for --with-dbmliborder... " >&6; } +{ echo "$as_me:$LINENO: checking for --with-dbmliborder" >&5 +echo $ECHO_N "checking for --with-dbmliborder... $ECHO_C" >&6; } # Check whether --with-dbmliborder was given. if test "${with_dbmliborder+set}" = set; then withval=$with_dbmliborder; if test x$with_dbmliborder = xyes then -{ { $as_echo "$as_me:$LINENO: error: proper usage is --with-dbmliborder=db1:db2:..." >&5 -$as_echo "$as_me: error: proper usage is --with-dbmliborder=db1:db2:..." >&2;} +{ { echo "$as_me:$LINENO: error: proper usage is --with-dbmliborder=db1:db2:..." >&5 +echo "$as_me: error: proper usage is --with-dbmliborder=db1:db2:..." >&2;} { (exit 1); exit 1; }; } else for db in `echo $with_dbmliborder | sed 's/:/ /g'`; do if test x$db != xndbm && test x$db != xgdbm && test x$db != xbdb then - { { $as_echo "$as_me:$LINENO: error: proper usage is --with-dbmliborder=db1:db2:..." >&5 -$as_echo "$as_me: error: proper usage is --with-dbmliborder=db1:db2:..." >&2;} + { { echo "$as_me:$LINENO: error: proper usage is --with-dbmliborder=db1:db2:..." >&5 +echo "$as_me: error: proper usage is --with-dbmliborder=db1:db2:..." >&2;} { (exit 1); exit 1; }; } fi done fi fi -{ $as_echo "$as_me:$LINENO: result: $with_dbmliborder" >&5 -$as_echo "$with_dbmliborder" >&6; } +{ echo "$as_me:$LINENO: result: $with_dbmliborder" >&5 +echo "${ECHO_T}$with_dbmliborder" >&6; } # Determine if signalmodule should be used. -{ $as_echo "$as_me:$LINENO: checking for --with-signal-module" >&5 -$as_echo_n "checking for --with-signal-module... " >&6; } +{ echo "$as_me:$LINENO: checking for --with-signal-module" >&5 +echo $ECHO_N "checking for --with-signal-module... $ECHO_C" >&6; } # Check whether --with-signal-module was given. if test "${with_signal_module+set}" = set; then @@ -14609,8 +14330,8 @@ if test -z "$with_signal_module" then with_signal_module="yes" fi -{ $as_echo "$as_me:$LINENO: result: $with_signal_module" >&5 -$as_echo "$with_signal_module" >&6; } +{ echo "$as_me:$LINENO: result: $with_signal_module" >&5 +echo "${ECHO_T}$with_signal_module" >&6; } if test "${with_signal_module}" = "yes"; then USE_SIGNAL_MODULE="" @@ -14624,22 +14345,22 @@ USE_THREAD_MODULE="" -{ $as_echo "$as_me:$LINENO: checking for --with-dec-threads" >&5 -$as_echo_n "checking for --with-dec-threads... " >&6; } +{ echo "$as_me:$LINENO: checking for --with-dec-threads" >&5 +echo $ECHO_N "checking for --with-dec-threads... $ECHO_C" >&6; } # Check whether --with-dec-threads was given. if test "${with_dec_threads+set}" = set; then withval=$with_dec_threads; -{ $as_echo "$as_me:$LINENO: result: $withval" >&5 -$as_echo "$withval" >&6; } +{ echo "$as_me:$LINENO: result: $withval" >&5 +echo "${ECHO_T}$withval" >&6; } LDLAST=-threads if test "${with_thread+set}" != set; then with_thread="$withval"; fi else - { $as_echo "$as_me:$LINENO: result: no" >&5 -$as_echo "no" >&6; } + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } fi @@ -14652,8 +14373,8 @@ -{ $as_echo "$as_me:$LINENO: checking for --with-threads" >&5 -$as_echo_n "checking for --with-threads... " >&6; } +{ echo "$as_me:$LINENO: checking for --with-threads" >&5 +echo $ECHO_N "checking for --with-threads... $ECHO_C" >&6; } # Check whether --with-threads was given. if test "${with_threads+set}" = set; then @@ -14672,8 +14393,8 @@ if test -z "$with_threads" then with_threads="yes" fi -{ $as_echo "$as_me:$LINENO: result: $with_threads" >&5 -$as_echo "$with_threads" >&6; } +{ echo "$as_me:$LINENO: result: $with_threads" >&5 +echo "${ECHO_T}$with_threads" >&6; } if test "$with_threads" = "no" @@ -14739,8 +14460,8 @@ # According to the POSIX spec, a pthreads implementation must # define _POSIX_THREADS in unistd.h. Some apparently don't # (e.g. gnu pth with pthread emulation) - { $as_echo "$as_me:$LINENO: checking for _POSIX_THREADS in unistd.h" >&5 -$as_echo_n "checking for _POSIX_THREADS in unistd.h... " >&6; } + { echo "$as_me:$LINENO: checking for _POSIX_THREADS in unistd.h" >&5 +echo $ECHO_N "checking for _POSIX_THREADS in unistd.h... $ECHO_C" >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF @@ -14762,25 +14483,25 @@ fi rm -f conftest* - { $as_echo "$as_me:$LINENO: result: $unistd_defines_pthreads" >&5 -$as_echo "$unistd_defines_pthreads" >&6; } + { echo "$as_me:$LINENO: result: $unistd_defines_pthreads" >&5 +echo "${ECHO_T}$unistd_defines_pthreads" >&6; } cat >>confdefs.h <<\_ACEOF #define _REENTRANT 1 _ACEOF if test "${ac_cv_header_cthreads_h+set}" = set; then - { $as_echo "$as_me:$LINENO: checking for cthreads.h" >&5 -$as_echo_n "checking for cthreads.h... " >&6; } + { echo "$as_me:$LINENO: checking for cthreads.h" >&5 +echo $ECHO_N "checking for cthreads.h... $ECHO_C" >&6; } if test "${ac_cv_header_cthreads_h+set}" = set; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_cthreads_h" >&5 -$as_echo "$ac_cv_header_cthreads_h" >&6; } +{ echo "$as_me:$LINENO: result: $ac_cv_header_cthreads_h" >&5 +echo "${ECHO_T}$ac_cv_header_cthreads_h" >&6; } else # Is the header compilable? -{ $as_echo "$as_me:$LINENO: checking cthreads.h usability" >&5 -$as_echo_n "checking cthreads.h usability... " >&6; } +{ echo "$as_me:$LINENO: checking cthreads.h usability" >&5 +echo $ECHO_N "checking cthreads.h usability... $ECHO_C" >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF @@ -14796,33 +14517,32 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_header_compiler=yes else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_compiler=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 -$as_echo "$ac_header_compiler" >&6; } +{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6; } # Is the header present? -{ $as_echo "$as_me:$LINENO: checking cthreads.h presence" >&5 -$as_echo_n "checking cthreads.h presence... " >&6; } +{ echo "$as_me:$LINENO: checking cthreads.h presence" >&5 +echo $ECHO_N "checking cthreads.h presence... $ECHO_C" >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF @@ -14836,52 +14556,51 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then ac_header_preproc=yes else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_preproc=no fi rm -f conftest.err conftest.$ac_ext -{ $as_echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 -$as_echo "$ac_header_preproc" >&6; } +{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6; } # So? What about this header? case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in yes:no: ) - { $as_echo "$as_me:$LINENO: WARNING: cthreads.h: accepted by the compiler, rejected by the preprocessor!" >&5 -$as_echo "$as_me: WARNING: cthreads.h: accepted by the compiler, rejected by the preprocessor!" >&2;} - { $as_echo "$as_me:$LINENO: WARNING: cthreads.h: proceeding with the compiler's result" >&5 -$as_echo "$as_me: WARNING: cthreads.h: proceeding with the compiler's result" >&2;} + { echo "$as_me:$LINENO: WARNING: cthreads.h: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: cthreads.h: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: cthreads.h: proceeding with the compiler's result" >&5 +echo "$as_me: WARNING: cthreads.h: proceeding with the compiler's result" >&2;} ac_header_preproc=yes ;; no:yes:* ) - { $as_echo "$as_me:$LINENO: WARNING: cthreads.h: present but cannot be compiled" >&5 -$as_echo "$as_me: WARNING: cthreads.h: present but cannot be compiled" >&2;} - { $as_echo "$as_me:$LINENO: WARNING: cthreads.h: check for missing prerequisite headers?" >&5 -$as_echo "$as_me: WARNING: cthreads.h: check for missing prerequisite headers?" >&2;} - { $as_echo "$as_me:$LINENO: WARNING: cthreads.h: see the Autoconf documentation" >&5 -$as_echo "$as_me: WARNING: cthreads.h: see the Autoconf documentation" >&2;} - { $as_echo "$as_me:$LINENO: WARNING: cthreads.h: section \"Present But Cannot Be Compiled\"" >&5 -$as_echo "$as_me: WARNING: cthreads.h: section \"Present But Cannot Be Compiled\"" >&2;} - { $as_echo "$as_me:$LINENO: WARNING: cthreads.h: proceeding with the preprocessor's result" >&5 -$as_echo "$as_me: WARNING: cthreads.h: proceeding with the preprocessor's result" >&2;} - { $as_echo "$as_me:$LINENO: WARNING: cthreads.h: in the future, the compiler will take precedence" >&5 -$as_echo "$as_me: WARNING: cthreads.h: in the future, the compiler will take precedence" >&2;} + { echo "$as_me:$LINENO: WARNING: cthreads.h: present but cannot be compiled" >&5 +echo "$as_me: WARNING: cthreads.h: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: cthreads.h: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: cthreads.h: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: cthreads.h: see the Autoconf documentation" >&5 +echo "$as_me: WARNING: cthreads.h: see the Autoconf documentation" >&2;} + { echo "$as_me:$LINENO: WARNING: cthreads.h: section \"Present But Cannot Be Compiled\"" >&5 +echo "$as_me: WARNING: cthreads.h: section \"Present But Cannot Be Compiled\"" >&2;} + { echo "$as_me:$LINENO: WARNING: cthreads.h: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: cthreads.h: proceeding with the preprocessor's result" >&2;} + { echo "$as_me:$LINENO: WARNING: cthreads.h: in the future, the compiler will take precedence" >&5 +echo "$as_me: WARNING: cthreads.h: in the future, the compiler will take precedence" >&2;} ( cat <<\_ASBOX ## -------------------------------------- ## ## Report this to http://bugs.python.org/ ## @@ -14890,18 +14609,18 @@ ) | sed "s/^/$as_me: WARNING: /" >&2 ;; esac -{ $as_echo "$as_me:$LINENO: checking for cthreads.h" >&5 -$as_echo_n "checking for cthreads.h... " >&6; } +{ echo "$as_me:$LINENO: checking for cthreads.h" >&5 +echo $ECHO_N "checking for cthreads.h... $ECHO_C" >&6; } if test "${ac_cv_header_cthreads_h+set}" = set; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_cv_header_cthreads_h=$ac_header_preproc fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_cthreads_h" >&5 -$as_echo "$ac_cv_header_cthreads_h" >&6; } +{ echo "$as_me:$LINENO: result: $ac_cv_header_cthreads_h" >&5 +echo "${ECHO_T}$ac_cv_header_cthreads_h" >&6; } fi -if test "x$ac_cv_header_cthreads_h" = x""yes; then +if test $ac_cv_header_cthreads_h = yes; then cat >>confdefs.h <<\_ACEOF #define WITH_THREAD 1 _ACEOF @@ -14920,17 +14639,17 @@ else if test "${ac_cv_header_mach_cthreads_h+set}" = set; then - { $as_echo "$as_me:$LINENO: checking for mach/cthreads.h" >&5 -$as_echo_n "checking for mach/cthreads.h... " >&6; } + { echo "$as_me:$LINENO: checking for mach/cthreads.h" >&5 +echo $ECHO_N "checking for mach/cthreads.h... $ECHO_C" >&6; } if test "${ac_cv_header_mach_cthreads_h+set}" = set; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_mach_cthreads_h" >&5 -$as_echo "$ac_cv_header_mach_cthreads_h" >&6; } +{ echo "$as_me:$LINENO: result: $ac_cv_header_mach_cthreads_h" >&5 +echo "${ECHO_T}$ac_cv_header_mach_cthreads_h" >&6; } else # Is the header compilable? -{ $as_echo "$as_me:$LINENO: checking mach/cthreads.h usability" >&5 -$as_echo_n "checking mach/cthreads.h usability... " >&6; } +{ echo "$as_me:$LINENO: checking mach/cthreads.h usability" >&5 +echo $ECHO_N "checking mach/cthreads.h usability... $ECHO_C" >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF @@ -14946,33 +14665,32 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_header_compiler=yes else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_compiler=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 -$as_echo "$ac_header_compiler" >&6; } +{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6; } # Is the header present? -{ $as_echo "$as_me:$LINENO: checking mach/cthreads.h presence" >&5 -$as_echo_n "checking mach/cthreads.h presence... " >&6; } +{ echo "$as_me:$LINENO: checking mach/cthreads.h presence" >&5 +echo $ECHO_N "checking mach/cthreads.h presence... $ECHO_C" >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF @@ -14986,52 +14704,51 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then ac_header_preproc=yes else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_preproc=no fi rm -f conftest.err conftest.$ac_ext -{ $as_echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 -$as_echo "$ac_header_preproc" >&6; } +{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6; } # So? What about this header? case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in yes:no: ) - { $as_echo "$as_me:$LINENO: WARNING: mach/cthreads.h: accepted by the compiler, rejected by the preprocessor!" >&5 -$as_echo "$as_me: WARNING: mach/cthreads.h: accepted by the compiler, rejected by the preprocessor!" >&2;} - { $as_echo "$as_me:$LINENO: WARNING: mach/cthreads.h: proceeding with the compiler's result" >&5 -$as_echo "$as_me: WARNING: mach/cthreads.h: proceeding with the compiler's result" >&2;} + { echo "$as_me:$LINENO: WARNING: mach/cthreads.h: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: mach/cthreads.h: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: mach/cthreads.h: proceeding with the compiler's result" >&5 +echo "$as_me: WARNING: mach/cthreads.h: proceeding with the compiler's result" >&2;} ac_header_preproc=yes ;; no:yes:* ) - { $as_echo "$as_me:$LINENO: WARNING: mach/cthreads.h: present but cannot be compiled" >&5 -$as_echo "$as_me: WARNING: mach/cthreads.h: present but cannot be compiled" >&2;} - { $as_echo "$as_me:$LINENO: WARNING: mach/cthreads.h: check for missing prerequisite headers?" >&5 -$as_echo "$as_me: WARNING: mach/cthreads.h: check for missing prerequisite headers?" >&2;} - { $as_echo "$as_me:$LINENO: WARNING: mach/cthreads.h: see the Autoconf documentation" >&5 -$as_echo "$as_me: WARNING: mach/cthreads.h: see the Autoconf documentation" >&2;} - { $as_echo "$as_me:$LINENO: WARNING: mach/cthreads.h: section \"Present But Cannot Be Compiled\"" >&5 -$as_echo "$as_me: WARNING: mach/cthreads.h: section \"Present But Cannot Be Compiled\"" >&2;} - { $as_echo "$as_me:$LINENO: WARNING: mach/cthreads.h: proceeding with the preprocessor's result" >&5 -$as_echo "$as_me: WARNING: mach/cthreads.h: proceeding with the preprocessor's result" >&2;} - { $as_echo "$as_me:$LINENO: WARNING: mach/cthreads.h: in the future, the compiler will take precedence" >&5 -$as_echo "$as_me: WARNING: mach/cthreads.h: in the future, the compiler will take precedence" >&2;} + { echo "$as_me:$LINENO: WARNING: mach/cthreads.h: present but cannot be compiled" >&5 +echo "$as_me: WARNING: mach/cthreads.h: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: mach/cthreads.h: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: mach/cthreads.h: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: mach/cthreads.h: see the Autoconf documentation" >&5 +echo "$as_me: WARNING: mach/cthreads.h: see the Autoconf documentation" >&2;} + { echo "$as_me:$LINENO: WARNING: mach/cthreads.h: section \"Present But Cannot Be Compiled\"" >&5 +echo "$as_me: WARNING: mach/cthreads.h: section \"Present But Cannot Be Compiled\"" >&2;} + { echo "$as_me:$LINENO: WARNING: mach/cthreads.h: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: mach/cthreads.h: proceeding with the preprocessor's result" >&2;} + { echo "$as_me:$LINENO: WARNING: mach/cthreads.h: in the future, the compiler will take precedence" >&5 +echo "$as_me: WARNING: mach/cthreads.h: in the future, the compiler will take precedence" >&2;} ( cat <<\_ASBOX ## -------------------------------------- ## ## Report this to http://bugs.python.org/ ## @@ -15040,18 +14757,18 @@ ) | sed "s/^/$as_me: WARNING: /" >&2 ;; esac -{ $as_echo "$as_me:$LINENO: checking for mach/cthreads.h" >&5 -$as_echo_n "checking for mach/cthreads.h... " >&6; } +{ echo "$as_me:$LINENO: checking for mach/cthreads.h" >&5 +echo $ECHO_N "checking for mach/cthreads.h... $ECHO_C" >&6; } if test "${ac_cv_header_mach_cthreads_h+set}" = set; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_cv_header_mach_cthreads_h=$ac_header_preproc fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_mach_cthreads_h" >&5 -$as_echo "$ac_cv_header_mach_cthreads_h" >&6; } +{ echo "$as_me:$LINENO: result: $ac_cv_header_mach_cthreads_h" >&5 +echo "${ECHO_T}$ac_cv_header_mach_cthreads_h" >&6; } fi -if test "x$ac_cv_header_mach_cthreads_h" = x""yes; then +if test $ac_cv_header_mach_cthreads_h = yes; then cat >>confdefs.h <<\_ACEOF #define WITH_THREAD 1 _ACEOF @@ -15068,13 +14785,13 @@ THREADOBJ="Python/thread.o" else - { $as_echo "$as_me:$LINENO: checking for --with-pth" >&5 -$as_echo_n "checking for --with-pth... " >&6; } + { echo "$as_me:$LINENO: checking for --with-pth" >&5 +echo $ECHO_N "checking for --with-pth... $ECHO_C" >&6; } # Check whether --with-pth was given. if test "${with_pth+set}" = set; then - withval=$with_pth; { $as_echo "$as_me:$LINENO: result: $withval" >&5 -$as_echo "$withval" >&6; } + withval=$with_pth; { echo "$as_me:$LINENO: result: $withval" >&5 +echo "${ECHO_T}$withval" >&6; } cat >>confdefs.h <<\_ACEOF #define WITH_THREAD 1 _ACEOF @@ -15087,16 +14804,16 @@ LIBS="-lpth $LIBS" THREADOBJ="Python/thread.o" else - { $as_echo "$as_me:$LINENO: result: no" >&5 -$as_echo "no" >&6; } + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } # Just looking for pthread_create in libpthread is not enough: # on HP/UX, pthread.h renames pthread_create to a different symbol name. # So we really have to include pthread.h, and then link. _libs=$LIBS LIBS="$LIBS -lpthread" - { $as_echo "$as_me:$LINENO: checking for pthread_create in -lpthread" >&5 -$as_echo_n "checking for pthread_create in -lpthread... " >&6; } + { echo "$as_me:$LINENO: checking for pthread_create in -lpthread" >&5 +echo $ECHO_N "checking for pthread_create in -lpthread... $ECHO_C" >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF @@ -15121,24 +14838,21 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err - } && test -s conftest$ac_exeext && { - test "$cross_compiling" = yes || - $as_test_x conftest$ac_exeext - }; then + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then - { $as_echo "$as_me:$LINENO: result: yes" >&5 -$as_echo "yes" >&6; } + { echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; } cat >>confdefs.h <<\_ACEOF #define WITH_THREAD 1 _ACEOF @@ -15146,15 +14860,15 @@ posix_threads=yes THREADOBJ="Python/thread.o" else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 LIBS=$_libs - { $as_echo "$as_me:$LINENO: checking for pthread_detach" >&5 -$as_echo_n "checking for pthread_detach... " >&6; } + { echo "$as_me:$LINENO: checking for pthread_detach" >&5 +echo $ECHO_N "checking for pthread_detach... $ECHO_C" >&6; } if test "${ac_cv_func_pthread_detach+set}" = set; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ @@ -15207,36 +14921,32 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err - } && test -s conftest$ac_exeext && { - test "$cross_compiling" = yes || - $as_test_x conftest$ac_exeext - }; then + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then ac_cv_func_pthread_detach=yes else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_func_pthread_detach=no fi -rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_func_pthread_detach" >&5 -$as_echo "$ac_cv_func_pthread_detach" >&6; } -if test "x$ac_cv_func_pthread_detach" = x""yes; then +{ echo "$as_me:$LINENO: result: $ac_cv_func_pthread_detach" >&5 +echo "${ECHO_T}$ac_cv_func_pthread_detach" >&6; } +if test $ac_cv_func_pthread_detach = yes; then cat >>confdefs.h <<\_ACEOF #define WITH_THREAD 1 _ACEOF @@ -15246,17 +14956,17 @@ else if test "${ac_cv_header_atheos_threads_h+set}" = set; then - { $as_echo "$as_me:$LINENO: checking for atheos/threads.h" >&5 -$as_echo_n "checking for atheos/threads.h... " >&6; } + { echo "$as_me:$LINENO: checking for atheos/threads.h" >&5 +echo $ECHO_N "checking for atheos/threads.h... $ECHO_C" >&6; } if test "${ac_cv_header_atheos_threads_h+set}" = set; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_atheos_threads_h" >&5 -$as_echo "$ac_cv_header_atheos_threads_h" >&6; } +{ echo "$as_me:$LINENO: result: $ac_cv_header_atheos_threads_h" >&5 +echo "${ECHO_T}$ac_cv_header_atheos_threads_h" >&6; } else # Is the header compilable? -{ $as_echo "$as_me:$LINENO: checking atheos/threads.h usability" >&5 -$as_echo_n "checking atheos/threads.h usability... " >&6; } +{ echo "$as_me:$LINENO: checking atheos/threads.h usability" >&5 +echo $ECHO_N "checking atheos/threads.h usability... $ECHO_C" >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF @@ -15272,33 +14982,32 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_header_compiler=yes else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_compiler=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 -$as_echo "$ac_header_compiler" >&6; } +{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6; } # Is the header present? -{ $as_echo "$as_me:$LINENO: checking atheos/threads.h presence" >&5 -$as_echo_n "checking atheos/threads.h presence... " >&6; } +{ echo "$as_me:$LINENO: checking atheos/threads.h presence" >&5 +echo $ECHO_N "checking atheos/threads.h presence... $ECHO_C" >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF @@ -15312,52 +15021,51 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then ac_header_preproc=yes else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_preproc=no fi rm -f conftest.err conftest.$ac_ext -{ $as_echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 -$as_echo "$ac_header_preproc" >&6; } +{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6; } # So? What about this header? case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in yes:no: ) - { $as_echo "$as_me:$LINENO: WARNING: atheos/threads.h: accepted by the compiler, rejected by the preprocessor!" >&5 -$as_echo "$as_me: WARNING: atheos/threads.h: accepted by the compiler, rejected by the preprocessor!" >&2;} - { $as_echo "$as_me:$LINENO: WARNING: atheos/threads.h: proceeding with the compiler's result" >&5 -$as_echo "$as_me: WARNING: atheos/threads.h: proceeding with the compiler's result" >&2;} + { echo "$as_me:$LINENO: WARNING: atheos/threads.h: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: atheos/threads.h: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: atheos/threads.h: proceeding with the compiler's result" >&5 +echo "$as_me: WARNING: atheos/threads.h: proceeding with the compiler's result" >&2;} ac_header_preproc=yes ;; no:yes:* ) - { $as_echo "$as_me:$LINENO: WARNING: atheos/threads.h: present but cannot be compiled" >&5 -$as_echo "$as_me: WARNING: atheos/threads.h: present but cannot be compiled" >&2;} - { $as_echo "$as_me:$LINENO: WARNING: atheos/threads.h: check for missing prerequisite headers?" >&5 -$as_echo "$as_me: WARNING: atheos/threads.h: check for missing prerequisite headers?" >&2;} - { $as_echo "$as_me:$LINENO: WARNING: atheos/threads.h: see the Autoconf documentation" >&5 -$as_echo "$as_me: WARNING: atheos/threads.h: see the Autoconf documentation" >&2;} - { $as_echo "$as_me:$LINENO: WARNING: atheos/threads.h: section \"Present But Cannot Be Compiled\"" >&5 -$as_echo "$as_me: WARNING: atheos/threads.h: section \"Present But Cannot Be Compiled\"" >&2;} - { $as_echo "$as_me:$LINENO: WARNING: atheos/threads.h: proceeding with the preprocessor's result" >&5 -$as_echo "$as_me: WARNING: atheos/threads.h: proceeding with the preprocessor's result" >&2;} - { $as_echo "$as_me:$LINENO: WARNING: atheos/threads.h: in the future, the compiler will take precedence" >&5 -$as_echo "$as_me: WARNING: atheos/threads.h: in the future, the compiler will take precedence" >&2;} + { echo "$as_me:$LINENO: WARNING: atheos/threads.h: present but cannot be compiled" >&5 +echo "$as_me: WARNING: atheos/threads.h: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: atheos/threads.h: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: atheos/threads.h: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: atheos/threads.h: see the Autoconf documentation" >&5 +echo "$as_me: WARNING: atheos/threads.h: see the Autoconf documentation" >&2;} + { echo "$as_me:$LINENO: WARNING: atheos/threads.h: section \"Present But Cannot Be Compiled\"" >&5 +echo "$as_me: WARNING: atheos/threads.h: section \"Present But Cannot Be Compiled\"" >&2;} + { echo "$as_me:$LINENO: WARNING: atheos/threads.h: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: atheos/threads.h: proceeding with the preprocessor's result" >&2;} + { echo "$as_me:$LINENO: WARNING: atheos/threads.h: in the future, the compiler will take precedence" >&5 +echo "$as_me: WARNING: atheos/threads.h: in the future, the compiler will take precedence" >&2;} ( cat <<\_ASBOX ## -------------------------------------- ## ## Report this to http://bugs.python.org/ ## @@ -15366,18 +15074,18 @@ ) | sed "s/^/$as_me: WARNING: /" >&2 ;; esac -{ $as_echo "$as_me:$LINENO: checking for atheos/threads.h" >&5 -$as_echo_n "checking for atheos/threads.h... " >&6; } +{ echo "$as_me:$LINENO: checking for atheos/threads.h" >&5 +echo $ECHO_N "checking for atheos/threads.h... $ECHO_C" >&6; } if test "${ac_cv_header_atheos_threads_h+set}" = set; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_cv_header_atheos_threads_h=$ac_header_preproc fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_atheos_threads_h" >&5 -$as_echo "$ac_cv_header_atheos_threads_h" >&6; } +{ echo "$as_me:$LINENO: result: $ac_cv_header_atheos_threads_h" >&5 +echo "${ECHO_T}$ac_cv_header_atheos_threads_h" >&6; } fi -if test "x$ac_cv_header_atheos_threads_h" = x""yes; then +if test $ac_cv_header_atheos_threads_h = yes; then cat >>confdefs.h <<\_ACEOF #define WITH_THREAD 1 _ACEOF @@ -15391,17 +15099,17 @@ else if test "${ac_cv_header_kernel_OS_h+set}" = set; then - { $as_echo "$as_me:$LINENO: checking for kernel/OS.h" >&5 -$as_echo_n "checking for kernel/OS.h... " >&6; } + { echo "$as_me:$LINENO: checking for kernel/OS.h" >&5 +echo $ECHO_N "checking for kernel/OS.h... $ECHO_C" >&6; } if test "${ac_cv_header_kernel_OS_h+set}" = set; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_kernel_OS_h" >&5 -$as_echo "$ac_cv_header_kernel_OS_h" >&6; } +{ echo "$as_me:$LINENO: result: $ac_cv_header_kernel_OS_h" >&5 +echo "${ECHO_T}$ac_cv_header_kernel_OS_h" >&6; } else # Is the header compilable? -{ $as_echo "$as_me:$LINENO: checking kernel/OS.h usability" >&5 -$as_echo_n "checking kernel/OS.h usability... " >&6; } +{ echo "$as_me:$LINENO: checking kernel/OS.h usability" >&5 +echo $ECHO_N "checking kernel/OS.h usability... $ECHO_C" >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF @@ -15417,33 +15125,32 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_header_compiler=yes else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_compiler=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 -$as_echo "$ac_header_compiler" >&6; } +{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6; } # Is the header present? -{ $as_echo "$as_me:$LINENO: checking kernel/OS.h presence" >&5 -$as_echo_n "checking kernel/OS.h presence... " >&6; } +{ echo "$as_me:$LINENO: checking kernel/OS.h presence" >&5 +echo $ECHO_N "checking kernel/OS.h presence... $ECHO_C" >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF @@ -15457,52 +15164,51 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then ac_header_preproc=yes else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_preproc=no fi rm -f conftest.err conftest.$ac_ext -{ $as_echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 -$as_echo "$ac_header_preproc" >&6; } +{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6; } # So? What about this header? case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in yes:no: ) - { $as_echo "$as_me:$LINENO: WARNING: kernel/OS.h: accepted by the compiler, rejected by the preprocessor!" >&5 -$as_echo "$as_me: WARNING: kernel/OS.h: accepted by the compiler, rejected by the preprocessor!" >&2;} - { $as_echo "$as_me:$LINENO: WARNING: kernel/OS.h: proceeding with the compiler's result" >&5 -$as_echo "$as_me: WARNING: kernel/OS.h: proceeding with the compiler's result" >&2;} + { echo "$as_me:$LINENO: WARNING: kernel/OS.h: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: kernel/OS.h: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: kernel/OS.h: proceeding with the compiler's result" >&5 +echo "$as_me: WARNING: kernel/OS.h: proceeding with the compiler's result" >&2;} ac_header_preproc=yes ;; no:yes:* ) - { $as_echo "$as_me:$LINENO: WARNING: kernel/OS.h: present but cannot be compiled" >&5 -$as_echo "$as_me: WARNING: kernel/OS.h: present but cannot be compiled" >&2;} - { $as_echo "$as_me:$LINENO: WARNING: kernel/OS.h: check for missing prerequisite headers?" >&5 -$as_echo "$as_me: WARNING: kernel/OS.h: check for missing prerequisite headers?" >&2;} - { $as_echo "$as_me:$LINENO: WARNING: kernel/OS.h: see the Autoconf documentation" >&5 -$as_echo "$as_me: WARNING: kernel/OS.h: see the Autoconf documentation" >&2;} - { $as_echo "$as_me:$LINENO: WARNING: kernel/OS.h: section \"Present But Cannot Be Compiled\"" >&5 -$as_echo "$as_me: WARNING: kernel/OS.h: section \"Present But Cannot Be Compiled\"" >&2;} - { $as_echo "$as_me:$LINENO: WARNING: kernel/OS.h: proceeding with the preprocessor's result" >&5 -$as_echo "$as_me: WARNING: kernel/OS.h: proceeding with the preprocessor's result" >&2;} - { $as_echo "$as_me:$LINENO: WARNING: kernel/OS.h: in the future, the compiler will take precedence" >&5 -$as_echo "$as_me: WARNING: kernel/OS.h: in the future, the compiler will take precedence" >&2;} + { echo "$as_me:$LINENO: WARNING: kernel/OS.h: present but cannot be compiled" >&5 +echo "$as_me: WARNING: kernel/OS.h: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: kernel/OS.h: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: kernel/OS.h: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: kernel/OS.h: see the Autoconf documentation" >&5 +echo "$as_me: WARNING: kernel/OS.h: see the Autoconf documentation" >&2;} + { echo "$as_me:$LINENO: WARNING: kernel/OS.h: section \"Present But Cannot Be Compiled\"" >&5 +echo "$as_me: WARNING: kernel/OS.h: section \"Present But Cannot Be Compiled\"" >&2;} + { echo "$as_me:$LINENO: WARNING: kernel/OS.h: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: kernel/OS.h: proceeding with the preprocessor's result" >&2;} + { echo "$as_me:$LINENO: WARNING: kernel/OS.h: in the future, the compiler will take precedence" >&5 +echo "$as_me: WARNING: kernel/OS.h: in the future, the compiler will take precedence" >&2;} ( cat <<\_ASBOX ## -------------------------------------- ## ## Report this to http://bugs.python.org/ ## @@ -15511,18 +15217,18 @@ ) | sed "s/^/$as_me: WARNING: /" >&2 ;; esac -{ $as_echo "$as_me:$LINENO: checking for kernel/OS.h" >&5 -$as_echo_n "checking for kernel/OS.h... " >&6; } +{ echo "$as_me:$LINENO: checking for kernel/OS.h" >&5 +echo $ECHO_N "checking for kernel/OS.h... $ECHO_C" >&6; } if test "${ac_cv_header_kernel_OS_h+set}" = set; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_cv_header_kernel_OS_h=$ac_header_preproc fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_kernel_OS_h" >&5 -$as_echo "$ac_cv_header_kernel_OS_h" >&6; } +{ echo "$as_me:$LINENO: result: $ac_cv_header_kernel_OS_h" >&5 +echo "${ECHO_T}$ac_cv_header_kernel_OS_h" >&6; } fi -if test "x$ac_cv_header_kernel_OS_h" = x""yes; then +if test $ac_cv_header_kernel_OS_h = yes; then cat >>confdefs.h <<\_ACEOF #define WITH_THREAD 1 _ACEOF @@ -15535,10 +15241,10 @@ THREADOBJ="Python/thread.o" else - { $as_echo "$as_me:$LINENO: checking for pthread_create in -lpthreads" >&5 -$as_echo_n "checking for pthread_create in -lpthreads... " >&6; } + { echo "$as_me:$LINENO: checking for pthread_create in -lpthreads" >&5 +echo $ECHO_N "checking for pthread_create in -lpthreads... $ECHO_C" >&6; } if test "${ac_cv_lib_pthreads_pthread_create+set}" = set; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lpthreads $LIBS" @@ -15570,37 +15276,33 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err - } && test -s conftest$ac_exeext && { - test "$cross_compiling" = yes || - $as_test_x conftest$ac_exeext - }; then + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then ac_cv_lib_pthreads_pthread_create=yes else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_pthreads_pthread_create=no fi -rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_pthreads_pthread_create" >&5 -$as_echo "$ac_cv_lib_pthreads_pthread_create" >&6; } -if test "x$ac_cv_lib_pthreads_pthread_create" = x""yes; then +{ echo "$as_me:$LINENO: result: $ac_cv_lib_pthreads_pthread_create" >&5 +echo "${ECHO_T}$ac_cv_lib_pthreads_pthread_create" >&6; } +if test $ac_cv_lib_pthreads_pthread_create = yes; then cat >>confdefs.h <<\_ACEOF #define WITH_THREAD 1 _ACEOF @@ -15610,10 +15312,10 @@ THREADOBJ="Python/thread.o" else - { $as_echo "$as_me:$LINENO: checking for pthread_create in -lc_r" >&5 -$as_echo_n "checking for pthread_create in -lc_r... " >&6; } + { echo "$as_me:$LINENO: checking for pthread_create in -lc_r" >&5 +echo $ECHO_N "checking for pthread_create in -lc_r... $ECHO_C" >&6; } if test "${ac_cv_lib_c_r_pthread_create+set}" = set; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lc_r $LIBS" @@ -15645,37 +15347,33 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err - } && test -s conftest$ac_exeext && { - test "$cross_compiling" = yes || - $as_test_x conftest$ac_exeext - }; then + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then ac_cv_lib_c_r_pthread_create=yes else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_c_r_pthread_create=no fi -rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_c_r_pthread_create" >&5 -$as_echo "$ac_cv_lib_c_r_pthread_create" >&6; } -if test "x$ac_cv_lib_c_r_pthread_create" = x""yes; then +{ echo "$as_me:$LINENO: result: $ac_cv_lib_c_r_pthread_create" >&5 +echo "${ECHO_T}$ac_cv_lib_c_r_pthread_create" >&6; } +if test $ac_cv_lib_c_r_pthread_create = yes; then cat >>confdefs.h <<\_ACEOF #define WITH_THREAD 1 _ACEOF @@ -15685,10 +15383,10 @@ THREADOBJ="Python/thread.o" else - { $as_echo "$as_me:$LINENO: checking for __pthread_create_system in -lpthread" >&5 -$as_echo_n "checking for __pthread_create_system in -lpthread... " >&6; } + { echo "$as_me:$LINENO: checking for __pthread_create_system in -lpthread" >&5 +echo $ECHO_N "checking for __pthread_create_system in -lpthread... $ECHO_C" >&6; } if test "${ac_cv_lib_pthread___pthread_create_system+set}" = set; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lpthread $LIBS" @@ -15720,37 +15418,33 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err - } && test -s conftest$ac_exeext && { - test "$cross_compiling" = yes || - $as_test_x conftest$ac_exeext - }; then + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then ac_cv_lib_pthread___pthread_create_system=yes else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_pthread___pthread_create_system=no fi -rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_pthread___pthread_create_system" >&5 -$as_echo "$ac_cv_lib_pthread___pthread_create_system" >&6; } -if test "x$ac_cv_lib_pthread___pthread_create_system" = x""yes; then +{ echo "$as_me:$LINENO: result: $ac_cv_lib_pthread___pthread_create_system" >&5 +echo "${ECHO_T}$ac_cv_lib_pthread___pthread_create_system" >&6; } +if test $ac_cv_lib_pthread___pthread_create_system = yes; then cat >>confdefs.h <<\_ACEOF #define WITH_THREAD 1 _ACEOF @@ -15760,10 +15454,10 @@ THREADOBJ="Python/thread.o" else - { $as_echo "$as_me:$LINENO: checking for pthread_create in -lcma" >&5 -$as_echo_n "checking for pthread_create in -lcma... " >&6; } + { echo "$as_me:$LINENO: checking for pthread_create in -lcma" >&5 +echo $ECHO_N "checking for pthread_create in -lcma... $ECHO_C" >&6; } if test "${ac_cv_lib_cma_pthread_create+set}" = set; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lcma $LIBS" @@ -15795,37 +15489,33 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err - } && test -s conftest$ac_exeext && { - test "$cross_compiling" = yes || - $as_test_x conftest$ac_exeext - }; then + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then ac_cv_lib_cma_pthread_create=yes else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_cma_pthread_create=no fi -rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_cma_pthread_create" >&5 -$as_echo "$ac_cv_lib_cma_pthread_create" >&6; } -if test "x$ac_cv_lib_cma_pthread_create" = x""yes; then +{ echo "$as_me:$LINENO: result: $ac_cv_lib_cma_pthread_create" >&5 +echo "${ECHO_T}$ac_cv_lib_cma_pthread_create" >&6; } +if test $ac_cv_lib_cma_pthread_create = yes; then cat >>confdefs.h <<\_ACEOF #define WITH_THREAD 1 _ACEOF @@ -15855,7 +15545,6 @@ fi -rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext fi @@ -15867,10 +15556,10 @@ - { $as_echo "$as_me:$LINENO: checking for usconfig in -lmpc" >&5 -$as_echo_n "checking for usconfig in -lmpc... " >&6; } + { echo "$as_me:$LINENO: checking for usconfig in -lmpc" >&5 +echo $ECHO_N "checking for usconfig in -lmpc... $ECHO_C" >&6; } if test "${ac_cv_lib_mpc_usconfig+set}" = set; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lmpc $LIBS" @@ -15902,37 +15591,33 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err - } && test -s conftest$ac_exeext && { - test "$cross_compiling" = yes || - $as_test_x conftest$ac_exeext - }; then + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then ac_cv_lib_mpc_usconfig=yes else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_mpc_usconfig=no fi -rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_mpc_usconfig" >&5 -$as_echo "$ac_cv_lib_mpc_usconfig" >&6; } -if test "x$ac_cv_lib_mpc_usconfig" = x""yes; then +{ echo "$as_me:$LINENO: result: $ac_cv_lib_mpc_usconfig" >&5 +echo "${ECHO_T}$ac_cv_lib_mpc_usconfig" >&6; } +if test $ac_cv_lib_mpc_usconfig = yes; then cat >>confdefs.h <<\_ACEOF #define WITH_THREAD 1 _ACEOF @@ -15944,10 +15629,10 @@ if test "$posix_threads" != "yes"; then - { $as_echo "$as_me:$LINENO: checking for thr_create in -lthread" >&5 -$as_echo_n "checking for thr_create in -lthread... " >&6; } + { echo "$as_me:$LINENO: checking for thr_create in -lthread" >&5 +echo $ECHO_N "checking for thr_create in -lthread... $ECHO_C" >&6; } if test "${ac_cv_lib_thread_thr_create+set}" = set; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lthread $LIBS" @@ -15979,37 +15664,33 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err - } && test -s conftest$ac_exeext && { - test "$cross_compiling" = yes || - $as_test_x conftest$ac_exeext - }; then + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then ac_cv_lib_thread_thr_create=yes else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_thread_thr_create=no fi -rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_thread_thr_create" >&5 -$as_echo "$ac_cv_lib_thread_thr_create" >&6; } -if test "x$ac_cv_lib_thread_thr_create" = x""yes; then +{ echo "$as_me:$LINENO: result: $ac_cv_lib_thread_thr_create" >&5 +echo "${ECHO_T}$ac_cv_lib_thread_thr_create" >&6; } +if test $ac_cv_lib_thread_thr_create = yes; then cat >>confdefs.h <<\_ACEOF #define WITH_THREAD 1 _ACEOF @@ -16062,10 +15743,10 @@ ;; esac - { $as_echo "$as_me:$LINENO: checking if PTHREAD_SCOPE_SYSTEM is supported" >&5 -$as_echo_n "checking if PTHREAD_SCOPE_SYSTEM is supported... " >&6; } + { echo "$as_me:$LINENO: checking if PTHREAD_SCOPE_SYSTEM is supported" >&5 +echo $ECHO_N "checking if PTHREAD_SCOPE_SYSTEM is supported... $ECHO_C" >&6; } if test "${ac_cv_pthread_system_supported+set}" = set; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else if test "$cross_compiling" = yes; then ac_cv_pthread_system_supported=no @@ -16095,32 +15776,29 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>&5 ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_try") 2>&5 ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_pthread_system_supported=yes else - $as_echo "$as_me: program exited with status $ac_status" >&5 -$as_echo "$as_me: failed program was:" >&5 + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) ac_cv_pthread_system_supported=no fi -rm -rf conftest.dSYM rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi @@ -16128,8 +15806,8 @@ fi - { $as_echo "$as_me:$LINENO: result: $ac_cv_pthread_system_supported" >&5 -$as_echo "$ac_cv_pthread_system_supported" >&6; } + { echo "$as_me:$LINENO: result: $ac_cv_pthread_system_supported" >&5 +echo "${ECHO_T}$ac_cv_pthread_system_supported" >&6; } if test "$ac_cv_pthread_system_supported" = "yes"; then cat >>confdefs.h <<\_ACEOF @@ -16140,11 +15818,11 @@ for ac_func in pthread_sigmask do -as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` -{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5 -$as_echo_n "checking for $ac_func... " >&6; } +as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` +{ echo "$as_me:$LINENO: checking for $ac_func" >&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6; } if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ @@ -16197,42 +15875,35 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err - } && test -s conftest$ac_exeext && { - test "$cross_compiling" = yes || - $as_test_x conftest$ac_exeext - }; then + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then eval "$as_ac_var=yes" else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 eval "$as_ac_var=no" fi -rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext fi -ac_res=`eval 'as_val=${'$as_ac_var'} - $as_echo "$as_val"'` - { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } -as_val=`eval 'as_val=${'$as_ac_var'} - $as_echo "$as_val"'` - if test "x$as_val" = x""yes; then +ac_res=`eval echo '${'$as_ac_var'}'` + { echo "$as_me:$LINENO: result: $ac_res" >&5 +echo "${ECHO_T}$ac_res" >&6; } +if test `eval echo '${'$as_ac_var'}'` = yes; then cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 +#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF case $ac_sys_system in CYGWIN*) @@ -16252,18 +15923,18 @@ # Check for enable-ipv6 -{ $as_echo "$as_me:$LINENO: checking if --enable-ipv6 is specified" >&5 -$as_echo_n "checking if --enable-ipv6 is specified... " >&6; } +{ echo "$as_me:$LINENO: checking if --enable-ipv6 is specified" >&5 +echo $ECHO_N "checking if --enable-ipv6 is specified... $ECHO_C" >&6; } # Check whether --enable-ipv6 was given. if test "${enable_ipv6+set}" = set; then enableval=$enable_ipv6; case "$enableval" in no) - { $as_echo "$as_me:$LINENO: result: no" >&5 -$as_echo "no" >&6; } + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } ipv6=no ;; - *) { $as_echo "$as_me:$LINENO: result: yes" >&5 -$as_echo "yes" >&6; } + *) { echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; } cat >>confdefs.h <<\_ACEOF #define ENABLE_IPV6 1 _ACEOF @@ -16274,8 +15945,8 @@ else if test "$cross_compiling" = yes; then - { $as_echo "$as_me:$LINENO: result: no" >&5 -$as_echo "no" >&6; } + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } ipv6=no else @@ -16303,44 +15974,41 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>&5 ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_try") 2>&5 ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - { $as_echo "$as_me:$LINENO: result: yes" >&5 -$as_echo "yes" >&6; } + { echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; } ipv6=yes else - $as_echo "$as_me: program exited with status $ac_status" >&5 -$as_echo "$as_me: failed program was:" >&5 + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) -{ $as_echo "$as_me:$LINENO: result: no" >&5 -$as_echo "no" >&6; } +{ echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } ipv6=no fi -rm -rf conftest.dSYM rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi if test "$ipv6" = "yes"; then - { $as_echo "$as_me:$LINENO: checking if RFC2553 API is available" >&5 -$as_echo_n "checking if RFC2553 API is available... " >&6; } + { echo "$as_me:$LINENO: checking if RFC2553 API is available" >&5 +echo $ECHO_N "checking if RFC2553 API is available... $ECHO_C" >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF @@ -16364,27 +16032,26 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then - { $as_echo "$as_me:$LINENO: result: yes" >&5 -$as_echo "yes" >&6; } + { echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; } ipv6=yes else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 - { $as_echo "$as_me:$LINENO: result: no" >&5 -$as_echo "no" >&6; } + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } ipv6=no fi @@ -16406,8 +16073,8 @@ ipv6trylibc=no if test "$ipv6" = "yes"; then - { $as_echo "$as_me:$LINENO: checking ipv6 stack type" >&5 -$as_echo_n "checking ipv6 stack type... " >&6; } + { echo "$as_me:$LINENO: checking ipv6 stack type" >&5 +echo $ECHO_N "checking ipv6 stack type... $ECHO_C" >&6; } for i in inria kame linux-glibc linux-inet6 solaris toshiba v6d zeta; do case $i in @@ -16563,8 +16230,8 @@ break fi done - { $as_echo "$as_me:$LINENO: result: $ipv6type" >&5 -$as_echo "$ipv6type" >&6; } + { echo "$as_me:$LINENO: result: $ipv6type" >&5 +echo "${ECHO_T}$ipv6type" >&6; } fi if test "$ipv6" = "yes" -a "$ipv6lib" != "none"; then @@ -16583,8 +16250,8 @@ fi fi -{ $as_echo "$as_me:$LINENO: checking for OSX 10.5 SDK or later" >&5 -$as_echo_n "checking for OSX 10.5 SDK or later... " >&6; } +{ echo "$as_me:$LINENO: checking for OSX 10.5 SDK or later" >&5 +echo $ECHO_N "checking for OSX 10.5 SDK or later... $ECHO_C" >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF @@ -16606,14 +16273,13 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err @@ -16623,22 +16289,22 @@ #define HAVE_OSX105_SDK 1 _ACEOF - { $as_echo "$as_me:$LINENO: result: yes" >&5 -$as_echo "yes" >&6; } + { echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; } else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 - { $as_echo "$as_me:$LINENO: result: no" >&5 -$as_echo "no" >&6; } + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext # Check for --with-doc-strings -{ $as_echo "$as_me:$LINENO: checking for --with-doc-strings" >&5 -$as_echo_n "checking for --with-doc-strings... " >&6; } +{ echo "$as_me:$LINENO: checking for --with-doc-strings" >&5 +echo $ECHO_N "checking for --with-doc-strings... $ECHO_C" >&6; } # Check whether --with-doc-strings was given. if test "${with_doc_strings+set}" = set; then @@ -16657,12 +16323,12 @@ _ACEOF fi -{ $as_echo "$as_me:$LINENO: result: $with_doc_strings" >&5 -$as_echo "$with_doc_strings" >&6; } +{ echo "$as_me:$LINENO: result: $with_doc_strings" >&5 +echo "${ECHO_T}$with_doc_strings" >&6; } # Check for Python-specific malloc support -{ $as_echo "$as_me:$LINENO: checking for --with-tsc" >&5 -$as_echo_n "checking for --with-tsc... " >&6; } +{ echo "$as_me:$LINENO: checking for --with-tsc" >&5 +echo $ECHO_N "checking for --with-tsc... $ECHO_C" >&6; } # Check whether --with-tsc was given. if test "${with_tsc+set}" = set; then @@ -16674,20 +16340,20 @@ #define WITH_TSC 1 _ACEOF - { $as_echo "$as_me:$LINENO: result: yes" >&5 -$as_echo "yes" >&6; } -else { $as_echo "$as_me:$LINENO: result: no" >&5 -$as_echo "no" >&6; } + { echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; } +else { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } fi else - { $as_echo "$as_me:$LINENO: result: no" >&5 -$as_echo "no" >&6; } + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } fi # Check for Python-specific malloc support -{ $as_echo "$as_me:$LINENO: checking for --with-pymalloc" >&5 -$as_echo_n "checking for --with-pymalloc... " >&6; } +{ echo "$as_me:$LINENO: checking for --with-pymalloc" >&5 +echo $ECHO_N "checking for --with-pymalloc... $ECHO_C" >&6; } # Check whether --with-pymalloc was given. if test "${with_pymalloc+set}" = set; then @@ -16706,12 +16372,12 @@ _ACEOF fi -{ $as_echo "$as_me:$LINENO: result: $with_pymalloc" >&5 -$as_echo "$with_pymalloc" >&6; } +{ echo "$as_me:$LINENO: result: $with_pymalloc" >&5 +echo "${ECHO_T}$with_pymalloc" >&6; } # Check for --with-wctype-functions -{ $as_echo "$as_me:$LINENO: checking for --with-wctype-functions" >&5 -$as_echo_n "checking for --with-wctype-functions... " >&6; } +{ echo "$as_me:$LINENO: checking for --with-wctype-functions" >&5 +echo $ECHO_N "checking for --with-wctype-functions... $ECHO_C" >&6; } # Check whether --with-wctype-functions was given. if test "${with_wctype_functions+set}" = set; then @@ -16723,14 +16389,14 @@ #define WANT_WCTYPE_FUNCTIONS 1 _ACEOF - { $as_echo "$as_me:$LINENO: result: yes" >&5 -$as_echo "yes" >&6; } -else { $as_echo "$as_me:$LINENO: result: no" >&5 -$as_echo "no" >&6; } + { echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; } +else { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } fi else - { $as_echo "$as_me:$LINENO: result: no" >&5 -$as_echo "no" >&6; } + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } fi @@ -16743,11 +16409,11 @@ for ac_func in dlopen do -as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` -{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5 -$as_echo_n "checking for $ac_func... " >&6; } +as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` +{ echo "$as_me:$LINENO: checking for $ac_func" >&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6; } if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ @@ -16800,42 +16466,35 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err - } && test -s conftest$ac_exeext && { - test "$cross_compiling" = yes || - $as_test_x conftest$ac_exeext - }; then + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then eval "$as_ac_var=yes" else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 eval "$as_ac_var=no" fi -rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext fi -ac_res=`eval 'as_val=${'$as_ac_var'} - $as_echo "$as_val"'` - { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } -as_val=`eval 'as_val=${'$as_ac_var'} - $as_echo "$as_val"'` - if test "x$as_val" = x""yes; then +ac_res=`eval echo '${'$as_ac_var'}'` + { echo "$as_me:$LINENO: result: $ac_res" >&5 +echo "${ECHO_T}$ac_res" >&6; } +if test `eval echo '${'$as_ac_var'}'` = yes; then cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 +#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF fi @@ -16845,8 +16504,8 @@ # DYNLOADFILE specifies which dynload_*.o file we will use for dynamic # loading of modules. -{ $as_echo "$as_me:$LINENO: checking DYNLOADFILE" >&5 -$as_echo_n "checking DYNLOADFILE... " >&6; } +{ echo "$as_me:$LINENO: checking DYNLOADFILE" >&5 +echo $ECHO_N "checking DYNLOADFILE... $ECHO_C" >&6; } if test -z "$DYNLOADFILE" then case $ac_sys_system/$ac_sys_release in @@ -16871,8 +16530,8 @@ ;; esac fi -{ $as_echo "$as_me:$LINENO: result: $DYNLOADFILE" >&5 -$as_echo "$DYNLOADFILE" >&6; } +{ echo "$as_me:$LINENO: result: $DYNLOADFILE" >&5 +echo "${ECHO_T}$DYNLOADFILE" >&6; } if test "$DYNLOADFILE" != "dynload_stub.o" then @@ -16885,16 +16544,16 @@ # MACHDEP_OBJS can be set to platform-specific object files needed by Python -{ $as_echo "$as_me:$LINENO: checking MACHDEP_OBJS" >&5 -$as_echo_n "checking MACHDEP_OBJS... " >&6; } +{ echo "$as_me:$LINENO: checking MACHDEP_OBJS" >&5 +echo $ECHO_N "checking MACHDEP_OBJS... $ECHO_C" >&6; } if test -z "$MACHDEP_OBJS" then MACHDEP_OBJS=$extra_machdep_objs else MACHDEP_OBJS="$MACHDEP_OBJS $extra_machdep_objs" fi -{ $as_echo "$as_me:$LINENO: result: MACHDEP_OBJS" >&5 -$as_echo "MACHDEP_OBJS" >&6; } +{ echo "$as_me:$LINENO: result: MACHDEP_OBJS" >&5 +echo "${ECHO_T}MACHDEP_OBJS" >&6; } # checks for library functions @@ -16996,11 +16655,11 @@ sysconf tcgetpgrp tcsetpgrp tempnam timegm times tmpfile tmpnam tmpnam_r \ truncate uname unsetenv utimes waitpid wait3 wait4 wcscoll _getpty do -as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` -{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5 -$as_echo_n "checking for $ac_func... " >&6; } +as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` +{ echo "$as_me:$LINENO: checking for $ac_func" >&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6; } if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ @@ -17053,42 +16712,35 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err - } && test -s conftest$ac_exeext && { - test "$cross_compiling" = yes || - $as_test_x conftest$ac_exeext - }; then + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then eval "$as_ac_var=yes" else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 eval "$as_ac_var=no" fi -rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext fi -ac_res=`eval 'as_val=${'$as_ac_var'} - $as_echo "$as_val"'` - { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } -as_val=`eval 'as_val=${'$as_ac_var'} - $as_echo "$as_val"'` - if test "x$as_val" = x""yes; then +ac_res=`eval echo '${'$as_ac_var'}'` + { echo "$as_me:$LINENO: result: $ac_res" >&5 +echo "${ECHO_T}$ac_res" >&6; } +if test `eval echo '${'$as_ac_var'}'` = yes; then cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 +#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF fi @@ -17097,8 +16749,8 @@ # For some functions, having a definition is not sufficient, since # we want to take their address. -{ $as_echo "$as_me:$LINENO: checking for chroot" >&5 -$as_echo_n "checking for chroot... " >&6; } +{ echo "$as_me:$LINENO: checking for chroot" >&5 +echo $ECHO_N "checking for chroot... $ECHO_C" >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF @@ -17120,14 +16772,13 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err @@ -17137,20 +16788,20 @@ #define HAVE_CHROOT 1 _ACEOF - { $as_echo "$as_me:$LINENO: result: yes" >&5 -$as_echo "yes" >&6; } + { echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; } else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 - { $as_echo "$as_me:$LINENO: result: no" >&5 -$as_echo "no" >&6; } + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -{ $as_echo "$as_me:$LINENO: checking for link" >&5 -$as_echo_n "checking for link... " >&6; } +{ echo "$as_me:$LINENO: checking for link" >&5 +echo $ECHO_N "checking for link... $ECHO_C" >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF @@ -17172,14 +16823,13 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err @@ -17189,20 +16839,20 @@ #define HAVE_LINK 1 _ACEOF - { $as_echo "$as_me:$LINENO: result: yes" >&5 -$as_echo "yes" >&6; } + { echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; } else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 - { $as_echo "$as_me:$LINENO: result: no" >&5 -$as_echo "no" >&6; } + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -{ $as_echo "$as_me:$LINENO: checking for symlink" >&5 -$as_echo_n "checking for symlink... " >&6; } +{ echo "$as_me:$LINENO: checking for symlink" >&5 +echo $ECHO_N "checking for symlink... $ECHO_C" >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF @@ -17224,14 +16874,13 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err @@ -17241,20 +16890,20 @@ #define HAVE_SYMLINK 1 _ACEOF - { $as_echo "$as_me:$LINENO: result: yes" >&5 -$as_echo "yes" >&6; } + { echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; } else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 - { $as_echo "$as_me:$LINENO: result: no" >&5 -$as_echo "no" >&6; } + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -{ $as_echo "$as_me:$LINENO: checking for fchdir" >&5 -$as_echo_n "checking for fchdir... " >&6; } +{ echo "$as_me:$LINENO: checking for fchdir" >&5 +echo $ECHO_N "checking for fchdir... $ECHO_C" >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF @@ -17276,14 +16925,13 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err @@ -17293,20 +16941,20 @@ #define HAVE_FCHDIR 1 _ACEOF - { $as_echo "$as_me:$LINENO: result: yes" >&5 -$as_echo "yes" >&6; } + { echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; } else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 - { $as_echo "$as_me:$LINENO: result: no" >&5 -$as_echo "no" >&6; } + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -{ $as_echo "$as_me:$LINENO: checking for fsync" >&5 -$as_echo_n "checking for fsync... " >&6; } +{ echo "$as_me:$LINENO: checking for fsync" >&5 +echo $ECHO_N "checking for fsync... $ECHO_C" >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF @@ -17328,14 +16976,13 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err @@ -17345,20 +16992,20 @@ #define HAVE_FSYNC 1 _ACEOF - { $as_echo "$as_me:$LINENO: result: yes" >&5 -$as_echo "yes" >&6; } + { echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; } else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 - { $as_echo "$as_me:$LINENO: result: no" >&5 -$as_echo "no" >&6; } + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -{ $as_echo "$as_me:$LINENO: checking for fdatasync" >&5 -$as_echo_n "checking for fdatasync... " >&6; } +{ echo "$as_me:$LINENO: checking for fdatasync" >&5 +echo $ECHO_N "checking for fdatasync... $ECHO_C" >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF @@ -17380,14 +17027,13 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err @@ -17397,20 +17043,20 @@ #define HAVE_FDATASYNC 1 _ACEOF - { $as_echo "$as_me:$LINENO: result: yes" >&5 -$as_echo "yes" >&6; } + { echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; } else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 - { $as_echo "$as_me:$LINENO: result: no" >&5 -$as_echo "no" >&6; } + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -{ $as_echo "$as_me:$LINENO: checking for epoll" >&5 -$as_echo_n "checking for epoll... " >&6; } +{ echo "$as_me:$LINENO: checking for epoll" >&5 +echo $ECHO_N "checking for epoll... $ECHO_C" >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF @@ -17432,14 +17078,13 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err @@ -17449,20 +17094,20 @@ #define HAVE_EPOLL 1 _ACEOF - { $as_echo "$as_me:$LINENO: result: yes" >&5 -$as_echo "yes" >&6; } + { echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; } else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 - { $as_echo "$as_me:$LINENO: result: no" >&5 -$as_echo "no" >&6; } + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -{ $as_echo "$as_me:$LINENO: checking for kqueue" >&5 -$as_echo_n "checking for kqueue... " >&6; } +{ echo "$as_me:$LINENO: checking for kqueue" >&5 +echo $ECHO_N "checking for kqueue... $ECHO_C" >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF @@ -17487,14 +17132,13 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err @@ -17504,14 +17148,14 @@ #define HAVE_KQUEUE 1 _ACEOF - { $as_echo "$as_me:$LINENO: result: yes" >&5 -$as_echo "yes" >&6; } + { echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; } else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 - { $as_echo "$as_me:$LINENO: result: no" >&5 -$as_echo "no" >&6; } + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } fi @@ -17522,8 +17166,8 @@ # address to avoid compiler warnings and potential miscompilations # because of the missing prototypes. -{ $as_echo "$as_me:$LINENO: checking for ctermid_r" >&5 -$as_echo_n "checking for ctermid_r... " >&6; } +{ echo "$as_me:$LINENO: checking for ctermid_r" >&5 +echo $ECHO_N "checking for ctermid_r... $ECHO_C" >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF @@ -17548,14 +17192,13 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err @@ -17565,21 +17208,21 @@ #define HAVE_CTERMID_R 1 _ACEOF - { $as_echo "$as_me:$LINENO: result: yes" >&5 -$as_echo "yes" >&6; } + { echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; } else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 - { $as_echo "$as_me:$LINENO: result: no" >&5 -$as_echo "no" >&6; } + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -{ $as_echo "$as_me:$LINENO: checking for flock" >&5 -$as_echo_n "checking for flock... " >&6; } +{ echo "$as_me:$LINENO: checking for flock" >&5 +echo $ECHO_N "checking for flock... $ECHO_C" >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF @@ -17604,14 +17247,13 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err @@ -17621,21 +17263,21 @@ #define HAVE_FLOCK 1 _ACEOF - { $as_echo "$as_me:$LINENO: result: yes" >&5 -$as_echo "yes" >&6; } + { echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; } else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 - { $as_echo "$as_me:$LINENO: result: no" >&5 -$as_echo "no" >&6; } + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -{ $as_echo "$as_me:$LINENO: checking for getpagesize" >&5 -$as_echo_n "checking for getpagesize... " >&6; } +{ echo "$as_me:$LINENO: checking for getpagesize" >&5 +echo $ECHO_N "checking for getpagesize... $ECHO_C" >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF @@ -17660,14 +17302,13 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err @@ -17677,14 +17318,14 @@ #define HAVE_GETPAGESIZE 1 _ACEOF - { $as_echo "$as_me:$LINENO: result: yes" >&5 -$as_echo "yes" >&6; } + { echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; } else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 - { $as_echo "$as_me:$LINENO: result: no" >&5 -$as_echo "no" >&6; } + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } fi @@ -17694,10 +17335,10 @@ do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 -{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } +{ echo "$as_me:$LINENO: checking for $ac_word" >&5 +echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } if test "${ac_cv_prog_TRUE+set}" = set; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$TRUE"; then ac_cv_prog_TRUE="$TRUE" # Let the user override the test. @@ -17710,7 +17351,7 @@ for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_TRUE="$ac_prog" - $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done @@ -17721,11 +17362,11 @@ fi TRUE=$ac_cv_prog_TRUE if test -n "$TRUE"; then - { $as_echo "$as_me:$LINENO: result: $TRUE" >&5 -$as_echo "$TRUE" >&6; } + { echo "$as_me:$LINENO: result: $TRUE" >&5 +echo "${ECHO_T}$TRUE" >&6; } else - { $as_echo "$as_me:$LINENO: result: no" >&5 -$as_echo "no" >&6; } + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } fi @@ -17734,10 +17375,10 @@ test -n "$TRUE" || TRUE="/bin/true" -{ $as_echo "$as_me:$LINENO: checking for inet_aton in -lc" >&5 -$as_echo_n "checking for inet_aton in -lc... " >&6; } +{ echo "$as_me:$LINENO: checking for inet_aton in -lc" >&5 +echo $ECHO_N "checking for inet_aton in -lc... $ECHO_C" >&6; } if test "${ac_cv_lib_c_inet_aton+set}" = set; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lc $LIBS" @@ -17769,44 +17410,40 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err - } && test -s conftest$ac_exeext && { - test "$cross_compiling" = yes || - $as_test_x conftest$ac_exeext - }; then + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then ac_cv_lib_c_inet_aton=yes else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_c_inet_aton=no fi -rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_c_inet_aton" >&5 -$as_echo "$ac_cv_lib_c_inet_aton" >&6; } -if test "x$ac_cv_lib_c_inet_aton" = x""yes; then +{ echo "$as_me:$LINENO: result: $ac_cv_lib_c_inet_aton" >&5 +echo "${ECHO_T}$ac_cv_lib_c_inet_aton" >&6; } +if test $ac_cv_lib_c_inet_aton = yes; then $ac_cv_prog_TRUE else -{ $as_echo "$as_me:$LINENO: checking for inet_aton in -lresolv" >&5 -$as_echo_n "checking for inet_aton in -lresolv... " >&6; } +{ echo "$as_me:$LINENO: checking for inet_aton in -lresolv" >&5 +echo $ECHO_N "checking for inet_aton in -lresolv... $ECHO_C" >&6; } if test "${ac_cv_lib_resolv_inet_aton+set}" = set; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lresolv $LIBS" @@ -17838,37 +17475,33 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err - } && test -s conftest$ac_exeext && { - test "$cross_compiling" = yes || - $as_test_x conftest$ac_exeext - }; then + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then ac_cv_lib_resolv_inet_aton=yes else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_resolv_inet_aton=no fi -rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_resolv_inet_aton" >&5 -$as_echo "$ac_cv_lib_resolv_inet_aton" >&6; } -if test "x$ac_cv_lib_resolv_inet_aton" = x""yes; then +{ echo "$as_me:$LINENO: result: $ac_cv_lib_resolv_inet_aton" >&5 +echo "${ECHO_T}$ac_cv_lib_resolv_inet_aton" >&6; } +if test $ac_cv_lib_resolv_inet_aton = yes; then cat >>confdefs.h <<_ACEOF #define HAVE_LIBRESOLV 1 _ACEOF @@ -17883,16 +17516,14 @@ # On Tru64, chflags seems to be present, but calling it will # exit Python -{ $as_echo "$as_me:$LINENO: checking for chflags" >&5 -$as_echo_n "checking for chflags... " >&6; } +{ echo "$as_me:$LINENO: checking for chflags" >&5 +echo $ECHO_N "checking for chflags... $ECHO_C" >&6; } if test "$cross_compiling" = yes; then - { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -{ { $as_echo "$as_me:$LINENO: error: cannot run test program while cross compiling + { { echo "$as_me:$LINENO: error: cannot run test program while cross compiling See \`config.log' for more details." >&5 -$as_echo "$as_me: error: cannot run test program while cross compiling +echo "$as_me: error: cannot run test program while cross compiling See \`config.log' for more details." >&2;} - { (exit 1); exit 1; }; }; } + { (exit 1); exit 1; }; } else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ @@ -17917,55 +17548,50 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>&5 ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_try") 2>&5 ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then cat >>confdefs.h <<\_ACEOF #define HAVE_CHFLAGS 1 _ACEOF - { $as_echo "$as_me:$LINENO: result: yes" >&5 -$as_echo "yes" >&6; } + { echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; } else - $as_echo "$as_me: program exited with status $ac_status" >&5 -$as_echo "$as_me: failed program was:" >&5 + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) -{ $as_echo "$as_me:$LINENO: result: no" >&5 -$as_echo "no" >&6; } +{ echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } fi -rm -rf conftest.dSYM rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi -{ $as_echo "$as_me:$LINENO: checking for lchflags" >&5 -$as_echo_n "checking for lchflags... " >&6; } +{ echo "$as_me:$LINENO: checking for lchflags" >&5 +echo $ECHO_N "checking for lchflags... $ECHO_C" >&6; } if test "$cross_compiling" = yes; then - { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -{ { $as_echo "$as_me:$LINENO: error: cannot run test program while cross compiling + { { echo "$as_me:$LINENO: error: cannot run test program while cross compiling See \`config.log' for more details." >&5 -$as_echo "$as_me: error: cannot run test program while cross compiling +echo "$as_me: error: cannot run test program while cross compiling See \`config.log' for more details." >&2;} - { (exit 1); exit 1; }; }; } + { (exit 1); exit 1; }; } else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ @@ -17990,40 +17616,37 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>&5 ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_try") 2>&5 ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then cat >>confdefs.h <<\_ACEOF #define HAVE_LCHFLAGS 1 _ACEOF - { $as_echo "$as_me:$LINENO: result: yes" >&5 -$as_echo "yes" >&6; } + { echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; } else - $as_echo "$as_me: program exited with status $ac_status" >&5 -$as_echo "$as_me: failed program was:" >&5 + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) -{ $as_echo "$as_me:$LINENO: result: no" >&5 -$as_echo "no" >&6; } +{ echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } fi -rm -rf conftest.dSYM rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi @@ -18038,10 +17661,10 @@ ;; esac -{ $as_echo "$as_me:$LINENO: checking for inflateCopy in -lz" >&5 -$as_echo_n "checking for inflateCopy in -lz... " >&6; } +{ echo "$as_me:$LINENO: checking for inflateCopy in -lz" >&5 +echo $ECHO_N "checking for inflateCopy in -lz... $ECHO_C" >&6; } if test "${ac_cv_lib_z_inflateCopy+set}" = set; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lz $LIBS" @@ -18073,37 +17696,33 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err - } && test -s conftest$ac_exeext && { - test "$cross_compiling" = yes || - $as_test_x conftest$ac_exeext - }; then + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then ac_cv_lib_z_inflateCopy=yes else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_z_inflateCopy=no fi -rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_z_inflateCopy" >&5 -$as_echo "$ac_cv_lib_z_inflateCopy" >&6; } -if test "x$ac_cv_lib_z_inflateCopy" = x""yes; then +{ echo "$as_me:$LINENO: result: $ac_cv_lib_z_inflateCopy" >&5 +echo "${ECHO_T}$ac_cv_lib_z_inflateCopy" >&6; } +if test $ac_cv_lib_z_inflateCopy = yes; then cat >>confdefs.h <<\_ACEOF #define HAVE_ZLIB_COPY 1 @@ -18119,8 +17738,8 @@ ;; esac -{ $as_echo "$as_me:$LINENO: checking for hstrerror" >&5 -$as_echo_n "checking for hstrerror... " >&6; } +{ echo "$as_me:$LINENO: checking for hstrerror" >&5 +echo $ECHO_N "checking for hstrerror... $ECHO_C" >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF @@ -18145,43 +17764,39 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err - } && test -s conftest$ac_exeext && { - test "$cross_compiling" = yes || - $as_test_x conftest$ac_exeext - }; then + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then cat >>confdefs.h <<\_ACEOF #define HAVE_HSTRERROR 1 _ACEOF - { $as_echo "$as_me:$LINENO: result: yes" >&5 -$as_echo "yes" >&6; } + { echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; } else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 - { $as_echo "$as_me:$LINENO: result: no" >&5 -$as_echo "no" >&6; } + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } fi -rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext -{ $as_echo "$as_me:$LINENO: checking for inet_aton" >&5 -$as_echo_n "checking for inet_aton... " >&6; } +{ echo "$as_me:$LINENO: checking for inet_aton" >&5 +echo $ECHO_N "checking for inet_aton... $ECHO_C" >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF @@ -18209,43 +17824,39 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err - } && test -s conftest$ac_exeext && { - test "$cross_compiling" = yes || - $as_test_x conftest$ac_exeext - }; then + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then cat >>confdefs.h <<\_ACEOF #define HAVE_INET_ATON 1 _ACEOF - { $as_echo "$as_me:$LINENO: result: yes" >&5 -$as_echo "yes" >&6; } + { echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; } else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 - { $as_echo "$as_me:$LINENO: result: no" >&5 -$as_echo "no" >&6; } + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } fi -rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext -{ $as_echo "$as_me:$LINENO: checking for inet_pton" >&5 -$as_echo_n "checking for inet_pton... " >&6; } +{ echo "$as_me:$LINENO: checking for inet_pton" >&5 +echo $ECHO_N "checking for inet_pton... $ECHO_C" >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF @@ -18273,14 +17884,13 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err @@ -18290,22 +17900,22 @@ #define HAVE_INET_PTON 1 _ACEOF - { $as_echo "$as_me:$LINENO: result: yes" >&5 -$as_echo "yes" >&6; } + { echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; } else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 - { $as_echo "$as_me:$LINENO: result: no" >&5 -$as_echo "no" >&6; } + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext # On some systems, setgroups is in unistd.h, on others, in grp.h -{ $as_echo "$as_me:$LINENO: checking for setgroups" >&5 -$as_echo_n "checking for setgroups... " >&6; } +{ echo "$as_me:$LINENO: checking for setgroups" >&5 +echo $ECHO_N "checking for setgroups... $ECHO_C" >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF @@ -18333,14 +17943,13 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err @@ -18350,14 +17959,14 @@ #define HAVE_SETGROUPS 1 _ACEOF - { $as_echo "$as_me:$LINENO: result: yes" >&5 -$as_echo "yes" >&6; } + { echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; } else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 - { $as_echo "$as_me:$LINENO: result: no" >&5 -$as_echo "no" >&6; } + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } fi @@ -18368,11 +17977,11 @@ for ac_func in openpty do -as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` -{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5 -$as_echo_n "checking for $ac_func... " >&6; } +as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` +{ echo "$as_me:$LINENO: checking for $ac_func" >&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6; } if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ @@ -18425,49 +18034,42 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err - } && test -s conftest$ac_exeext && { - test "$cross_compiling" = yes || - $as_test_x conftest$ac_exeext - }; then + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then eval "$as_ac_var=yes" else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 eval "$as_ac_var=no" fi -rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext fi -ac_res=`eval 'as_val=${'$as_ac_var'} - $as_echo "$as_val"'` - { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } -as_val=`eval 'as_val=${'$as_ac_var'} - $as_echo "$as_val"'` - if test "x$as_val" = x""yes; then +ac_res=`eval echo '${'$as_ac_var'}'` + { echo "$as_me:$LINENO: result: $ac_res" >&5 +echo "${ECHO_T}$ac_res" >&6; } +if test `eval echo '${'$as_ac_var'}'` = yes; then cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 +#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF else - { $as_echo "$as_me:$LINENO: checking for openpty in -lutil" >&5 -$as_echo_n "checking for openpty in -lutil... " >&6; } + { echo "$as_me:$LINENO: checking for openpty in -lutil" >&5 +echo $ECHO_N "checking for openpty in -lutil... $ECHO_C" >&6; } if test "${ac_cv_lib_util_openpty+set}" = set; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lutil $LIBS" @@ -18499,46 +18101,42 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err - } && test -s conftest$ac_exeext && { - test "$cross_compiling" = yes || - $as_test_x conftest$ac_exeext - }; then + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then ac_cv_lib_util_openpty=yes else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_util_openpty=no fi -rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_util_openpty" >&5 -$as_echo "$ac_cv_lib_util_openpty" >&6; } -if test "x$ac_cv_lib_util_openpty" = x""yes; then +{ echo "$as_me:$LINENO: result: $ac_cv_lib_util_openpty" >&5 +echo "${ECHO_T}$ac_cv_lib_util_openpty" >&6; } +if test $ac_cv_lib_util_openpty = yes; then cat >>confdefs.h <<\_ACEOF #define HAVE_OPENPTY 1 _ACEOF LIBS="$LIBS -lutil" else - { $as_echo "$as_me:$LINENO: checking for openpty in -lbsd" >&5 -$as_echo_n "checking for openpty in -lbsd... " >&6; } + { echo "$as_me:$LINENO: checking for openpty in -lbsd" >&5 +echo $ECHO_N "checking for openpty in -lbsd... $ECHO_C" >&6; } if test "${ac_cv_lib_bsd_openpty+set}" = set; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lbsd $LIBS" @@ -18570,37 +18168,33 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err - } && test -s conftest$ac_exeext && { - test "$cross_compiling" = yes || - $as_test_x conftest$ac_exeext - }; then + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then ac_cv_lib_bsd_openpty=yes else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_bsd_openpty=no fi -rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_bsd_openpty" >&5 -$as_echo "$ac_cv_lib_bsd_openpty" >&6; } -if test "x$ac_cv_lib_bsd_openpty" = x""yes; then +{ echo "$as_me:$LINENO: result: $ac_cv_lib_bsd_openpty" >&5 +echo "${ECHO_T}$ac_cv_lib_bsd_openpty" >&6; } +if test $ac_cv_lib_bsd_openpty = yes; then cat >>confdefs.h <<\_ACEOF #define HAVE_OPENPTY 1 _ACEOF @@ -18617,11 +18211,11 @@ for ac_func in forkpty do -as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` -{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5 -$as_echo_n "checking for $ac_func... " >&6; } +as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` +{ echo "$as_me:$LINENO: checking for $ac_func" >&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6; } if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ @@ -18674,49 +18268,42 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err - } && test -s conftest$ac_exeext && { - test "$cross_compiling" = yes || - $as_test_x conftest$ac_exeext - }; then + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then eval "$as_ac_var=yes" else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 eval "$as_ac_var=no" fi -rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext fi -ac_res=`eval 'as_val=${'$as_ac_var'} - $as_echo "$as_val"'` - { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } -as_val=`eval 'as_val=${'$as_ac_var'} - $as_echo "$as_val"'` - if test "x$as_val" = x""yes; then +ac_res=`eval echo '${'$as_ac_var'}'` + { echo "$as_me:$LINENO: result: $ac_res" >&5 +echo "${ECHO_T}$ac_res" >&6; } +if test `eval echo '${'$as_ac_var'}'` = yes; then cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 +#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF else - { $as_echo "$as_me:$LINENO: checking for forkpty in -lutil" >&5 -$as_echo_n "checking for forkpty in -lutil... " >&6; } + { echo "$as_me:$LINENO: checking for forkpty in -lutil" >&5 +echo $ECHO_N "checking for forkpty in -lutil... $ECHO_C" >&6; } if test "${ac_cv_lib_util_forkpty+set}" = set; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lutil $LIBS" @@ -18748,46 +18335,42 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err - } && test -s conftest$ac_exeext && { - test "$cross_compiling" = yes || - $as_test_x conftest$ac_exeext - }; then + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then ac_cv_lib_util_forkpty=yes else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_util_forkpty=no fi -rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_util_forkpty" >&5 -$as_echo "$ac_cv_lib_util_forkpty" >&6; } -if test "x$ac_cv_lib_util_forkpty" = x""yes; then +{ echo "$as_me:$LINENO: result: $ac_cv_lib_util_forkpty" >&5 +echo "${ECHO_T}$ac_cv_lib_util_forkpty" >&6; } +if test $ac_cv_lib_util_forkpty = yes; then cat >>confdefs.h <<\_ACEOF #define HAVE_FORKPTY 1 _ACEOF LIBS="$LIBS -lutil" else - { $as_echo "$as_me:$LINENO: checking for forkpty in -lbsd" >&5 -$as_echo_n "checking for forkpty in -lbsd... " >&6; } + { echo "$as_me:$LINENO: checking for forkpty in -lbsd" >&5 +echo $ECHO_N "checking for forkpty in -lbsd... $ECHO_C" >&6; } if test "${ac_cv_lib_bsd_forkpty+set}" = set; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lbsd $LIBS" @@ -18819,37 +18402,33 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err - } && test -s conftest$ac_exeext && { - test "$cross_compiling" = yes || - $as_test_x conftest$ac_exeext - }; then + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then ac_cv_lib_bsd_forkpty=yes else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_bsd_forkpty=no fi -rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_bsd_forkpty" >&5 -$as_echo "$ac_cv_lib_bsd_forkpty" >&6; } -if test "x$ac_cv_lib_bsd_forkpty" = x""yes; then +{ echo "$as_me:$LINENO: result: $ac_cv_lib_bsd_forkpty" >&5 +echo "${ECHO_T}$ac_cv_lib_bsd_forkpty" >&6; } +if test $ac_cv_lib_bsd_forkpty = yes; then cat >>confdefs.h <<\_ACEOF #define HAVE_FORKPTY 1 _ACEOF @@ -18868,11 +18447,11 @@ for ac_func in memmove do -as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` -{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5 -$as_echo_n "checking for $ac_func... " >&6; } +as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` +{ echo "$as_me:$LINENO: checking for $ac_func" >&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6; } if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ @@ -18925,42 +18504,35 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err - } && test -s conftest$ac_exeext && { - test "$cross_compiling" = yes || - $as_test_x conftest$ac_exeext - }; then + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then eval "$as_ac_var=yes" else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 eval "$as_ac_var=no" fi -rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext fi -ac_res=`eval 'as_val=${'$as_ac_var'} - $as_echo "$as_val"'` - { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } -as_val=`eval 'as_val=${'$as_ac_var'} - $as_echo "$as_val"'` - if test "x$as_val" = x""yes; then +ac_res=`eval echo '${'$as_ac_var'}'` + { echo "$as_me:$LINENO: result: $ac_res" >&5 +echo "${ECHO_T}$ac_res" >&6; } +if test `eval echo '${'$as_ac_var'}'` = yes; then cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 +#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF fi @@ -18976,11 +18548,11 @@ for ac_func in fseek64 fseeko fstatvfs ftell64 ftello statvfs do -as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` -{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5 -$as_echo_n "checking for $ac_func... " >&6; } +as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` +{ echo "$as_me:$LINENO: checking for $ac_func" >&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6; } if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ @@ -19033,42 +18605,35 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err - } && test -s conftest$ac_exeext && { - test "$cross_compiling" = yes || - $as_test_x conftest$ac_exeext - }; then + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then eval "$as_ac_var=yes" else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 eval "$as_ac_var=no" fi -rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext fi -ac_res=`eval 'as_val=${'$as_ac_var'} - $as_echo "$as_val"'` - { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } -as_val=`eval 'as_val=${'$as_ac_var'} - $as_echo "$as_val"'` - if test "x$as_val" = x""yes; then +ac_res=`eval echo '${'$as_ac_var'}'` + { echo "$as_me:$LINENO: result: $ac_res" >&5 +echo "${ECHO_T}$ac_res" >&6; } +if test `eval echo '${'$as_ac_var'}'` = yes; then cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 +#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF fi @@ -19080,11 +18645,11 @@ for ac_func in dup2 getcwd strdup do -as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` -{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5 -$as_echo_n "checking for $ac_func... " >&6; } +as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` +{ echo "$as_me:$LINENO: checking for $ac_func" >&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6; } if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ @@ -19137,42 +18702,35 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err - } && test -s conftest$ac_exeext && { - test "$cross_compiling" = yes || - $as_test_x conftest$ac_exeext - }; then + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then eval "$as_ac_var=yes" else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 eval "$as_ac_var=no" fi -rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext fi -ac_res=`eval 'as_val=${'$as_ac_var'} - $as_echo "$as_val"'` - { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } -as_val=`eval 'as_val=${'$as_ac_var'} - $as_echo "$as_val"'` - if test "x$as_val" = x""yes; then +ac_res=`eval echo '${'$as_ac_var'}'` + { echo "$as_me:$LINENO: result: $ac_res" >&5 +echo "${ECHO_T}$ac_res" >&6; } +if test `eval echo '${'$as_ac_var'}'` = yes; then cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 +#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF else @@ -19189,11 +18747,11 @@ for ac_func in getpgrp do -as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` -{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5 -$as_echo_n "checking for $ac_func... " >&6; } +as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` +{ echo "$as_me:$LINENO: checking for $ac_func" >&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6; } if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ @@ -19246,42 +18804,35 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err - } && test -s conftest$ac_exeext && { - test "$cross_compiling" = yes || - $as_test_x conftest$ac_exeext - }; then + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then eval "$as_ac_var=yes" else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 eval "$as_ac_var=no" fi -rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext fi -ac_res=`eval 'as_val=${'$as_ac_var'} - $as_echo "$as_val"'` - { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } -as_val=`eval 'as_val=${'$as_ac_var'} - $as_echo "$as_val"'` - if test "x$as_val" = x""yes; then +ac_res=`eval echo '${'$as_ac_var'}'` + { echo "$as_me:$LINENO: result: $ac_res" >&5 +echo "${ECHO_T}$ac_res" >&6; } +if test `eval echo '${'$as_ac_var'}'` = yes; then cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 +#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ @@ -19304,14 +18855,13 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err @@ -19323,7 +18873,7 @@ else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 @@ -19337,11 +18887,11 @@ for ac_func in setpgrp do -as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` -{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5 -$as_echo_n "checking for $ac_func... " >&6; } +as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` +{ echo "$as_me:$LINENO: checking for $ac_func" >&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6; } if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ @@ -19394,42 +18944,35 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err - } && test -s conftest$ac_exeext && { - test "$cross_compiling" = yes || - $as_test_x conftest$ac_exeext - }; then + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then eval "$as_ac_var=yes" else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 eval "$as_ac_var=no" fi -rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext fi -ac_res=`eval 'as_val=${'$as_ac_var'} - $as_echo "$as_val"'` - { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } -as_val=`eval 'as_val=${'$as_ac_var'} - $as_echo "$as_val"'` - if test "x$as_val" = x""yes; then +ac_res=`eval echo '${'$as_ac_var'}'` + { echo "$as_me:$LINENO: result: $ac_res" >&5 +echo "${ECHO_T}$ac_res" >&6; } +if test `eval echo '${'$as_ac_var'}'` = yes; then cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 +#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ @@ -19452,14 +18995,13 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err @@ -19471,7 +19013,7 @@ else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 @@ -19485,11 +19027,11 @@ for ac_func in gettimeofday do -as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` -{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5 -$as_echo_n "checking for $ac_func... " >&6; } +as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` +{ echo "$as_me:$LINENO: checking for $ac_func" >&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6; } if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ @@ -19542,42 +19084,35 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err - } && test -s conftest$ac_exeext && { - test "$cross_compiling" = yes || - $as_test_x conftest$ac_exeext - }; then + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then eval "$as_ac_var=yes" else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 eval "$as_ac_var=no" fi -rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext fi -ac_res=`eval 'as_val=${'$as_ac_var'} - $as_echo "$as_val"'` - { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } -as_val=`eval 'as_val=${'$as_ac_var'} - $as_echo "$as_val"'` - if test "x$as_val" = x""yes; then +ac_res=`eval echo '${'$as_ac_var'}'` + { echo "$as_me:$LINENO: result: $ac_res" >&5 +echo "${ECHO_T}$ac_res" >&6; } +if test `eval echo '${'$as_ac_var'}'` = yes; then cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 +#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ @@ -19600,21 +19135,20 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then : else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 @@ -19631,8 +19165,8 @@ done -{ $as_echo "$as_me:$LINENO: checking for major" >&5 -$as_echo_n "checking for major... " >&6; } +{ echo "$as_me:$LINENO: checking for major" >&5 +echo $ECHO_N "checking for major... $ECHO_C" >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF @@ -19664,48 +19198,44 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err - } && test -s conftest$ac_exeext && { - test "$cross_compiling" = yes || - $as_test_x conftest$ac_exeext - }; then + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then cat >>confdefs.h <<\_ACEOF #define HAVE_DEVICE_MACROS 1 _ACEOF - { $as_echo "$as_me:$LINENO: result: yes" >&5 -$as_echo "yes" >&6; } + { echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; } else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 - { $as_echo "$as_me:$LINENO: result: no" >&5 -$as_echo "no" >&6; } + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } fi -rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext # On OSF/1 V5.1, getaddrinfo is available, but a define # for [no]getaddrinfo in netdb.h. -{ $as_echo "$as_me:$LINENO: checking for getaddrinfo" >&5 -$as_echo_n "checking for getaddrinfo... " >&6; } +{ echo "$as_me:$LINENO: checking for getaddrinfo" >&5 +echo $ECHO_N "checking for getaddrinfo... $ECHO_C" >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF @@ -19734,29 +19264,26 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err - } && test -s conftest$ac_exeext && { - test "$cross_compiling" = yes || - $as_test_x conftest$ac_exeext - }; then + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then -{ $as_echo "$as_me:$LINENO: result: yes" >&5 -$as_echo "yes" >&6; } -{ $as_echo "$as_me:$LINENO: checking getaddrinfo bug" >&5 -$as_echo_n "checking getaddrinfo bug... " >&6; } +{ echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; } +{ echo "$as_me:$LINENO: checking getaddrinfo bug" >&5 +echo $ECHO_N "checking getaddrinfo bug... $ECHO_C" >&6; } if test "$cross_compiling" = yes; then - { $as_echo "$as_me:$LINENO: result: buggy" >&5 -$as_echo "buggy" >&6; } + { echo "$as_me:$LINENO: result: buggy" >&5 +echo "${ECHO_T}buggy" >&6; } buggygetaddrinfo=yes else cat >conftest.$ac_ext <<_ACEOF @@ -19859,52 +19386,48 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>&5 ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_try") 2>&5 ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - { $as_echo "$as_me:$LINENO: result: good" >&5 -$as_echo "good" >&6; } + { echo "$as_me:$LINENO: result: good" >&5 +echo "${ECHO_T}good" >&6; } buggygetaddrinfo=no else - $as_echo "$as_me: program exited with status $ac_status" >&5 -$as_echo "$as_me: failed program was:" >&5 + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) -{ $as_echo "$as_me:$LINENO: result: buggy" >&5 -$as_echo "buggy" >&6; } +{ echo "$as_me:$LINENO: result: buggy" >&5 +echo "${ECHO_T}buggy" >&6; } buggygetaddrinfo=yes fi -rm -rf conftest.dSYM rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -{ $as_echo "$as_me:$LINENO: result: no" >&5 -$as_echo "no" >&6; } +{ echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } buggygetaddrinfo=yes fi -rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext @@ -19924,11 +19447,11 @@ for ac_func in getnameinfo do -as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` -{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5 -$as_echo_n "checking for $ac_func... " >&6; } +as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` +{ echo "$as_me:$LINENO: checking for $ac_func" >&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6; } if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ @@ -19981,42 +19504,35 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err - } && test -s conftest$ac_exeext && { - test "$cross_compiling" = yes || - $as_test_x conftest$ac_exeext - }; then + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then eval "$as_ac_var=yes" else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 eval "$as_ac_var=no" fi -rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext fi -ac_res=`eval 'as_val=${'$as_ac_var'} - $as_echo "$as_val"'` - { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } -as_val=`eval 'as_val=${'$as_ac_var'} - $as_echo "$as_val"'` - if test "x$as_val" = x""yes; then +ac_res=`eval echo '${'$as_ac_var'}'` + { echo "$as_me:$LINENO: result: $ac_res" >&5 +echo "${ECHO_T}$ac_res" >&6; } +if test `eval echo '${'$as_ac_var'}'` = yes; then cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 +#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF fi @@ -20024,10 +19540,10 @@ # checks for structures -{ $as_echo "$as_me:$LINENO: checking whether time.h and sys/time.h may both be included" >&5 -$as_echo_n "checking whether time.h and sys/time.h may both be included... " >&6; } +{ echo "$as_me:$LINENO: checking whether time.h and sys/time.h may both be included" >&5 +echo $ECHO_N "checking whether time.h and sys/time.h may both be included... $ECHO_C" >&6; } if test "${ac_cv_header_time+set}" = set; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ @@ -20054,21 +19570,20 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_header_time=yes else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_header_time=no @@ -20076,8 +19591,8 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_time" >&5 -$as_echo "$ac_cv_header_time" >&6; } +{ echo "$as_me:$LINENO: result: $ac_cv_header_time" >&5 +echo "${ECHO_T}$ac_cv_header_time" >&6; } if test $ac_cv_header_time = yes; then cat >>confdefs.h <<\_ACEOF @@ -20086,10 +19601,10 @@ fi -{ $as_echo "$as_me:$LINENO: checking whether struct tm is in sys/time.h or time.h" >&5 -$as_echo_n "checking whether struct tm is in sys/time.h or time.h... " >&6; } +{ echo "$as_me:$LINENO: checking whether struct tm is in sys/time.h or time.h" >&5 +echo $ECHO_N "checking whether struct tm is in sys/time.h or time.h... $ECHO_C" >&6; } if test "${ac_cv_struct_tm+set}" = set; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ @@ -20105,7 +19620,7 @@ { struct tm tm; int *p = &tm.tm_sec; - return !p; + return !p; ; return 0; } @@ -20116,21 +19631,20 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_struct_tm=time.h else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_struct_tm=sys/time.h @@ -20138,8 +19652,8 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_struct_tm" >&5 -$as_echo "$ac_cv_struct_tm" >&6; } +{ echo "$as_me:$LINENO: result: $ac_cv_struct_tm" >&5 +echo "${ECHO_T}$ac_cv_struct_tm" >&6; } if test $ac_cv_struct_tm = sys/time.h; then cat >>confdefs.h <<\_ACEOF @@ -20148,10 +19662,10 @@ fi -{ $as_echo "$as_me:$LINENO: checking for struct tm.tm_zone" >&5 -$as_echo_n "checking for struct tm.tm_zone... " >&6; } +{ echo "$as_me:$LINENO: checking for struct tm.tm_zone" >&5 +echo $ECHO_N "checking for struct tm.tm_zone... $ECHO_C" >&6; } if test "${ac_cv_member_struct_tm_tm_zone+set}" = set; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ @@ -20179,21 +19693,20 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_member_struct_tm_tm_zone=yes else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 cat >conftest.$ac_ext <<_ACEOF @@ -20222,21 +19735,20 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_member_struct_tm_tm_zone=yes else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_member_struct_tm_tm_zone=no @@ -20247,9 +19759,9 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_member_struct_tm_tm_zone" >&5 -$as_echo "$ac_cv_member_struct_tm_tm_zone" >&6; } -if test "x$ac_cv_member_struct_tm_tm_zone" = x""yes; then +{ echo "$as_me:$LINENO: result: $ac_cv_member_struct_tm_tm_zone" >&5 +echo "${ECHO_T}$ac_cv_member_struct_tm_tm_zone" >&6; } +if test $ac_cv_member_struct_tm_tm_zone = yes; then cat >>confdefs.h <<_ACEOF #define HAVE_STRUCT_TM_TM_ZONE 1 @@ -20265,10 +19777,10 @@ _ACEOF else - { $as_echo "$as_me:$LINENO: checking whether tzname is declared" >&5 -$as_echo_n "checking whether tzname is declared... " >&6; } + { echo "$as_me:$LINENO: checking whether tzname is declared" >&5 +echo $ECHO_N "checking whether tzname is declared... $ECHO_C" >&6; } if test "${ac_cv_have_decl_tzname+set}" = set; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ @@ -20295,21 +19807,20 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_have_decl_tzname=yes else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_have_decl_tzname=no @@ -20317,9 +19828,9 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_have_decl_tzname" >&5 -$as_echo "$ac_cv_have_decl_tzname" >&6; } -if test "x$ac_cv_have_decl_tzname" = x""yes; then +{ echo "$as_me:$LINENO: result: $ac_cv_have_decl_tzname" >&5 +echo "${ECHO_T}$ac_cv_have_decl_tzname" >&6; } +if test $ac_cv_have_decl_tzname = yes; then cat >>confdefs.h <<_ACEOF #define HAVE_DECL_TZNAME 1 @@ -20335,10 +19846,10 @@ fi - { $as_echo "$as_me:$LINENO: checking for tzname" >&5 -$as_echo_n "checking for tzname... " >&6; } + { echo "$as_me:$LINENO: checking for tzname" >&5 +echo $ECHO_N "checking for tzname... $ECHO_C" >&6; } if test "${ac_cv_var_tzname+set}" = set; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ @@ -20365,35 +19876,31 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err - } && test -s conftest$ac_exeext && { - test "$cross_compiling" = yes || - $as_test_x conftest$ac_exeext - }; then + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then ac_cv_var_tzname=yes else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_var_tzname=no fi -rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_var_tzname" >&5 -$as_echo "$ac_cv_var_tzname" >&6; } +{ echo "$as_me:$LINENO: result: $ac_cv_var_tzname" >&5 +echo "${ECHO_T}$ac_cv_var_tzname" >&6; } if test $ac_cv_var_tzname = yes; then cat >>confdefs.h <<\_ACEOF @@ -20403,10 +19910,10 @@ fi fi -{ $as_echo "$as_me:$LINENO: checking for struct stat.st_rdev" >&5 -$as_echo_n "checking for struct stat.st_rdev... " >&6; } +{ echo "$as_me:$LINENO: checking for struct stat.st_rdev" >&5 +echo $ECHO_N "checking for struct stat.st_rdev... $ECHO_C" >&6; } if test "${ac_cv_member_struct_stat_st_rdev+set}" = set; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ @@ -20431,21 +19938,20 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_member_struct_stat_st_rdev=yes else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 cat >conftest.$ac_ext <<_ACEOF @@ -20471,21 +19977,20 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_member_struct_stat_st_rdev=yes else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_member_struct_stat_st_rdev=no @@ -20496,9 +20001,9 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_member_struct_stat_st_rdev" >&5 -$as_echo "$ac_cv_member_struct_stat_st_rdev" >&6; } -if test "x$ac_cv_member_struct_stat_st_rdev" = x""yes; then +{ echo "$as_me:$LINENO: result: $ac_cv_member_struct_stat_st_rdev" >&5 +echo "${ECHO_T}$ac_cv_member_struct_stat_st_rdev" >&6; } +if test $ac_cv_member_struct_stat_st_rdev = yes; then cat >>confdefs.h <<_ACEOF #define HAVE_STRUCT_STAT_ST_RDEV 1 @@ -20507,10 +20012,10 @@ fi -{ $as_echo "$as_me:$LINENO: checking for struct stat.st_blksize" >&5 -$as_echo_n "checking for struct stat.st_blksize... " >&6; } +{ echo "$as_me:$LINENO: checking for struct stat.st_blksize" >&5 +echo $ECHO_N "checking for struct stat.st_blksize... $ECHO_C" >&6; } if test "${ac_cv_member_struct_stat_st_blksize+set}" = set; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ @@ -20535,21 +20040,20 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_member_struct_stat_st_blksize=yes else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 cat >conftest.$ac_ext <<_ACEOF @@ -20575,21 +20079,20 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_member_struct_stat_st_blksize=yes else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_member_struct_stat_st_blksize=no @@ -20600,9 +20103,9 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_member_struct_stat_st_blksize" >&5 -$as_echo "$ac_cv_member_struct_stat_st_blksize" >&6; } -if test "x$ac_cv_member_struct_stat_st_blksize" = x""yes; then +{ echo "$as_me:$LINENO: result: $ac_cv_member_struct_stat_st_blksize" >&5 +echo "${ECHO_T}$ac_cv_member_struct_stat_st_blksize" >&6; } +if test $ac_cv_member_struct_stat_st_blksize = yes; then cat >>confdefs.h <<_ACEOF #define HAVE_STRUCT_STAT_ST_BLKSIZE 1 @@ -20611,10 +20114,10 @@ fi -{ $as_echo "$as_me:$LINENO: checking for struct stat.st_flags" >&5 -$as_echo_n "checking for struct stat.st_flags... " >&6; } +{ echo "$as_me:$LINENO: checking for struct stat.st_flags" >&5 +echo $ECHO_N "checking for struct stat.st_flags... $ECHO_C" >&6; } if test "${ac_cv_member_struct_stat_st_flags+set}" = set; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ @@ -20639,21 +20142,20 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_member_struct_stat_st_flags=yes else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 cat >conftest.$ac_ext <<_ACEOF @@ -20679,21 +20181,20 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_member_struct_stat_st_flags=yes else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_member_struct_stat_st_flags=no @@ -20704,9 +20205,9 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_member_struct_stat_st_flags" >&5 -$as_echo "$ac_cv_member_struct_stat_st_flags" >&6; } -if test "x$ac_cv_member_struct_stat_st_flags" = x""yes; then +{ echo "$as_me:$LINENO: result: $ac_cv_member_struct_stat_st_flags" >&5 +echo "${ECHO_T}$ac_cv_member_struct_stat_st_flags" >&6; } +if test $ac_cv_member_struct_stat_st_flags = yes; then cat >>confdefs.h <<_ACEOF #define HAVE_STRUCT_STAT_ST_FLAGS 1 @@ -20715,10 +20216,10 @@ fi -{ $as_echo "$as_me:$LINENO: checking for struct stat.st_gen" >&5 -$as_echo_n "checking for struct stat.st_gen... " >&6; } +{ echo "$as_me:$LINENO: checking for struct stat.st_gen" >&5 +echo $ECHO_N "checking for struct stat.st_gen... $ECHO_C" >&6; } if test "${ac_cv_member_struct_stat_st_gen+set}" = set; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ @@ -20743,21 +20244,20 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_member_struct_stat_st_gen=yes else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 cat >conftest.$ac_ext <<_ACEOF @@ -20783,21 +20283,20 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_member_struct_stat_st_gen=yes else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_member_struct_stat_st_gen=no @@ -20808,9 +20307,9 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_member_struct_stat_st_gen" >&5 -$as_echo "$ac_cv_member_struct_stat_st_gen" >&6; } -if test "x$ac_cv_member_struct_stat_st_gen" = x""yes; then +{ echo "$as_me:$LINENO: result: $ac_cv_member_struct_stat_st_gen" >&5 +echo "${ECHO_T}$ac_cv_member_struct_stat_st_gen" >&6; } +if test $ac_cv_member_struct_stat_st_gen = yes; then cat >>confdefs.h <<_ACEOF #define HAVE_STRUCT_STAT_ST_GEN 1 @@ -20819,10 +20318,10 @@ fi -{ $as_echo "$as_me:$LINENO: checking for struct stat.st_birthtime" >&5 -$as_echo_n "checking for struct stat.st_birthtime... " >&6; } +{ echo "$as_me:$LINENO: checking for struct stat.st_birthtime" >&5 +echo $ECHO_N "checking for struct stat.st_birthtime... $ECHO_C" >&6; } if test "${ac_cv_member_struct_stat_st_birthtime+set}" = set; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ @@ -20847,21 +20346,20 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_member_struct_stat_st_birthtime=yes else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 cat >conftest.$ac_ext <<_ACEOF @@ -20887,21 +20385,20 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_member_struct_stat_st_birthtime=yes else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_member_struct_stat_st_birthtime=no @@ -20912,9 +20409,9 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_member_struct_stat_st_birthtime" >&5 -$as_echo "$ac_cv_member_struct_stat_st_birthtime" >&6; } -if test "x$ac_cv_member_struct_stat_st_birthtime" = x""yes; then +{ echo "$as_me:$LINENO: result: $ac_cv_member_struct_stat_st_birthtime" >&5 +echo "${ECHO_T}$ac_cv_member_struct_stat_st_birthtime" >&6; } +if test $ac_cv_member_struct_stat_st_birthtime = yes; then cat >>confdefs.h <<_ACEOF #define HAVE_STRUCT_STAT_ST_BIRTHTIME 1 @@ -20923,10 +20420,10 @@ fi -{ $as_echo "$as_me:$LINENO: checking for struct stat.st_blocks" >&5 -$as_echo_n "checking for struct stat.st_blocks... " >&6; } +{ echo "$as_me:$LINENO: checking for struct stat.st_blocks" >&5 +echo $ECHO_N "checking for struct stat.st_blocks... $ECHO_C" >&6; } if test "${ac_cv_member_struct_stat_st_blocks+set}" = set; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ @@ -20951,21 +20448,20 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_member_struct_stat_st_blocks=yes else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 cat >conftest.$ac_ext <<_ACEOF @@ -20991,21 +20487,20 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_member_struct_stat_st_blocks=yes else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_member_struct_stat_st_blocks=no @@ -21016,9 +20511,9 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_member_struct_stat_st_blocks" >&5 -$as_echo "$ac_cv_member_struct_stat_st_blocks" >&6; } -if test "x$ac_cv_member_struct_stat_st_blocks" = x""yes; then +{ echo "$as_me:$LINENO: result: $ac_cv_member_struct_stat_st_blocks" >&5 +echo "${ECHO_T}$ac_cv_member_struct_stat_st_blocks" >&6; } +if test $ac_cv_member_struct_stat_st_blocks = yes; then cat >>confdefs.h <<_ACEOF #define HAVE_STRUCT_STAT_ST_BLOCKS 1 @@ -21040,10 +20535,10 @@ -{ $as_echo "$as_me:$LINENO: checking for time.h that defines altzone" >&5 -$as_echo_n "checking for time.h that defines altzone... " >&6; } +{ echo "$as_me:$LINENO: checking for time.h that defines altzone" >&5 +echo $ECHO_N "checking for time.h that defines altzone... $ECHO_C" >&6; } if test "${ac_cv_header_time_altzone+set}" = set; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ @@ -21066,21 +20561,20 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_header_time_altzone=yes else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_header_time_altzone=no @@ -21089,8 +20583,8 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_time_altzone" >&5 -$as_echo "$ac_cv_header_time_altzone" >&6; } +{ echo "$as_me:$LINENO: result: $ac_cv_header_time_altzone" >&5 +echo "${ECHO_T}$ac_cv_header_time_altzone" >&6; } if test $ac_cv_header_time_altzone = yes; then cat >>confdefs.h <<\_ACEOF @@ -21100,8 +20594,8 @@ fi was_it_defined=no -{ $as_echo "$as_me:$LINENO: checking whether sys/select.h and sys/time.h may both be included" >&5 -$as_echo_n "checking whether sys/select.h and sys/time.h may both be included... " >&6; } +{ echo "$as_me:$LINENO: checking whether sys/select.h and sys/time.h may both be included" >&5 +echo $ECHO_N "checking whether sys/select.h and sys/time.h may both be included... $ECHO_C" >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF @@ -21127,14 +20621,13 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err @@ -21148,20 +20641,20 @@ was_it_defined=yes else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -{ $as_echo "$as_me:$LINENO: result: $was_it_defined" >&5 -$as_echo "$was_it_defined" >&6; } +{ echo "$as_me:$LINENO: result: $was_it_defined" >&5 +echo "${ECHO_T}$was_it_defined" >&6; } -{ $as_echo "$as_me:$LINENO: checking for addrinfo" >&5 -$as_echo_n "checking for addrinfo... " >&6; } +{ echo "$as_me:$LINENO: checking for addrinfo" >&5 +echo $ECHO_N "checking for addrinfo... $ECHO_C" >&6; } if test "${ac_cv_struct_addrinfo+set}" = set; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ @@ -21185,21 +20678,20 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_struct_addrinfo=yes else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_struct_addrinfo=no @@ -21208,8 +20700,8 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_struct_addrinfo" >&5 -$as_echo "$ac_cv_struct_addrinfo" >&6; } +{ echo "$as_me:$LINENO: result: $ac_cv_struct_addrinfo" >&5 +echo "${ECHO_T}$ac_cv_struct_addrinfo" >&6; } if test $ac_cv_struct_addrinfo = yes; then cat >>confdefs.h <<\_ACEOF @@ -21218,10 +20710,10 @@ fi -{ $as_echo "$as_me:$LINENO: checking for sockaddr_storage" >&5 -$as_echo_n "checking for sockaddr_storage... " >&6; } +{ echo "$as_me:$LINENO: checking for sockaddr_storage" >&5 +echo $ECHO_N "checking for sockaddr_storage... $ECHO_C" >&6; } if test "${ac_cv_struct_sockaddr_storage+set}" = set; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ @@ -21246,21 +20738,20 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_struct_sockaddr_storage=yes else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_struct_sockaddr_storage=no @@ -21269,8 +20760,8 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_struct_sockaddr_storage" >&5 -$as_echo "$ac_cv_struct_sockaddr_storage" >&6; } +{ echo "$as_me:$LINENO: result: $ac_cv_struct_sockaddr_storage" >&5 +echo "${ECHO_T}$ac_cv_struct_sockaddr_storage" >&6; } if test $ac_cv_struct_sockaddr_storage = yes; then cat >>confdefs.h <<\_ACEOF @@ -21282,10 +20773,10 @@ # checks for compiler characteristics -{ $as_echo "$as_me:$LINENO: checking whether char is unsigned" >&5 -$as_echo_n "checking whether char is unsigned... " >&6; } +{ echo "$as_me:$LINENO: checking whether char is unsigned" >&5 +echo $ECHO_N "checking whether char is unsigned... $ECHO_C" >&6; } if test "${ac_cv_c_char_unsigned+set}" = set; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ @@ -21310,21 +20801,20 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_c_char_unsigned=no else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_c_char_unsigned=yes @@ -21332,8 +20822,8 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_c_char_unsigned" >&5 -$as_echo "$ac_cv_c_char_unsigned" >&6; } +{ echo "$as_me:$LINENO: result: $ac_cv_c_char_unsigned" >&5 +echo "${ECHO_T}$ac_cv_c_char_unsigned" >&6; } if test $ac_cv_c_char_unsigned = yes && test "$GCC" != yes; then cat >>confdefs.h <<\_ACEOF #define __CHAR_UNSIGNED__ 1 @@ -21341,10 +20831,10 @@ fi -{ $as_echo "$as_me:$LINENO: checking for an ANSI C-conforming const" >&5 -$as_echo_n "checking for an ANSI C-conforming const... " >&6; } +{ echo "$as_me:$LINENO: checking for an ANSI C-conforming const" >&5 +echo $ECHO_N "checking for an ANSI C-conforming const... $ECHO_C" >&6; } if test "${ac_cv_c_const+set}" = set; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ @@ -21416,21 +20906,20 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_c_const=yes else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_c_const=no @@ -21438,20 +20927,20 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_c_const" >&5 -$as_echo "$ac_cv_c_const" >&6; } +{ echo "$as_me:$LINENO: result: $ac_cv_c_const" >&5 +echo "${ECHO_T}$ac_cv_c_const" >&6; } if test $ac_cv_c_const = no; then cat >>confdefs.h <<\_ACEOF -#define const /**/ +#define const _ACEOF fi works=no -{ $as_echo "$as_me:$LINENO: checking for working volatile" >&5 -$as_echo_n "checking for working volatile... " >&6; } +{ echo "$as_me:$LINENO: checking for working volatile" >&5 +echo $ECHO_N "checking for working volatile... $ECHO_C" >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF @@ -21473,38 +20962,37 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then works=yes else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 cat >>confdefs.h <<\_ACEOF -#define volatile /**/ +#define volatile _ACEOF fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -{ $as_echo "$as_me:$LINENO: result: $works" >&5 -$as_echo "$works" >&6; } +{ echo "$as_me:$LINENO: result: $works" >&5 +echo "${ECHO_T}$works" >&6; } works=no -{ $as_echo "$as_me:$LINENO: checking for working signed char" >&5 -$as_echo_n "checking for working signed char... " >&6; } +{ echo "$as_me:$LINENO: checking for working signed char" >&5 +echo $ECHO_N "checking for working signed char... $ECHO_C" >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF @@ -21526,38 +21014,37 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then works=yes else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 cat >>confdefs.h <<\_ACEOF -#define signed /**/ +#define signed _ACEOF fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -{ $as_echo "$as_me:$LINENO: result: $works" >&5 -$as_echo "$works" >&6; } +{ echo "$as_me:$LINENO: result: $works" >&5 +echo "${ECHO_T}$works" >&6; } have_prototypes=no -{ $as_echo "$as_me:$LINENO: checking for prototypes" >&5 -$as_echo_n "checking for prototypes... " >&6; } +{ echo "$as_me:$LINENO: checking for prototypes" >&5 +echo $ECHO_N "checking for prototypes... $ECHO_C" >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF @@ -21579,14 +21066,13 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err @@ -21600,19 +21086,19 @@ have_prototypes=yes else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -{ $as_echo "$as_me:$LINENO: result: $have_prototypes" >&5 -$as_echo "$have_prototypes" >&6; } +{ echo "$as_me:$LINENO: result: $have_prototypes" >&5 +echo "${ECHO_T}$have_prototypes" >&6; } works=no -{ $as_echo "$as_me:$LINENO: checking for variable length prototypes and stdarg.h" >&5 -$as_echo_n "checking for variable length prototypes and stdarg.h... " >&6; } +{ echo "$as_me:$LINENO: checking for variable length prototypes and stdarg.h" >&5 +echo $ECHO_N "checking for variable length prototypes and stdarg.h... $ECHO_C" >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF @@ -21644,14 +21130,13 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err @@ -21665,19 +21150,19 @@ works=yes else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -{ $as_echo "$as_me:$LINENO: result: $works" >&5 -$as_echo "$works" >&6; } +{ echo "$as_me:$LINENO: result: $works" >&5 +echo "${ECHO_T}$works" >&6; } # check for socketpair -{ $as_echo "$as_me:$LINENO: checking for socketpair" >&5 -$as_echo_n "checking for socketpair... " >&6; } +{ echo "$as_me:$LINENO: checking for socketpair" >&5 +echo $ECHO_N "checking for socketpair... $ECHO_C" >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF @@ -21702,14 +21187,13 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err @@ -21719,22 +21203,22 @@ #define HAVE_SOCKETPAIR 1 _ACEOF - { $as_echo "$as_me:$LINENO: result: yes" >&5 -$as_echo "yes" >&6; } + { echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; } else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 - { $as_echo "$as_me:$LINENO: result: no" >&5 -$as_echo "no" >&6; } + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext # check if sockaddr has sa_len member -{ $as_echo "$as_me:$LINENO: checking if sockaddr has sa_len member" >&5 -$as_echo_n "checking if sockaddr has sa_len member... " >&6; } +{ echo "$as_me:$LINENO: checking if sockaddr has sa_len member" >&5 +echo $ECHO_N "checking if sockaddr has sa_len member... $ECHO_C" >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF @@ -21758,38 +21242,37 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then - { $as_echo "$as_me:$LINENO: result: yes" >&5 -$as_echo "yes" >&6; } + { echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; } cat >>confdefs.h <<\_ACEOF #define HAVE_SOCKADDR_SA_LEN 1 _ACEOF else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 - { $as_echo "$as_me:$LINENO: result: no" >&5 -$as_echo "no" >&6; } + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext va_list_is_array=no -{ $as_echo "$as_me:$LINENO: checking whether va_list is an array" >&5 -$as_echo_n "checking whether va_list is an array... " >&6; } +{ echo "$as_me:$LINENO: checking whether va_list is an array" >&5 +echo $ECHO_N "checking whether va_list is an array... $ECHO_C" >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF @@ -21817,21 +21300,20 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then : else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 @@ -21845,17 +21327,17 @@ fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -{ $as_echo "$as_me:$LINENO: result: $va_list_is_array" >&5 -$as_echo "$va_list_is_array" >&6; } +{ echo "$as_me:$LINENO: result: $va_list_is_array" >&5 +echo "${ECHO_T}$va_list_is_array" >&6; } # sigh -- gethostbyname_r is a mess; it can have 3, 5 or 6 arguments :-( -{ $as_echo "$as_me:$LINENO: checking for gethostbyname_r" >&5 -$as_echo_n "checking for gethostbyname_r... " >&6; } +{ echo "$as_me:$LINENO: checking for gethostbyname_r" >&5 +echo $ECHO_N "checking for gethostbyname_r... $ECHO_C" >&6; } if test "${ac_cv_func_gethostbyname_r+set}" = set; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ @@ -21908,43 +21390,39 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err - } && test -s conftest$ac_exeext && { - test "$cross_compiling" = yes || - $as_test_x conftest$ac_exeext - }; then + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then ac_cv_func_gethostbyname_r=yes else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_func_gethostbyname_r=no fi -rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_func_gethostbyname_r" >&5 -$as_echo "$ac_cv_func_gethostbyname_r" >&6; } -if test "x$ac_cv_func_gethostbyname_r" = x""yes; then +{ echo "$as_me:$LINENO: result: $ac_cv_func_gethostbyname_r" >&5 +echo "${ECHO_T}$ac_cv_func_gethostbyname_r" >&6; } +if test $ac_cv_func_gethostbyname_r = yes; then cat >>confdefs.h <<\_ACEOF #define HAVE_GETHOSTBYNAME_R 1 _ACEOF - { $as_echo "$as_me:$LINENO: checking gethostbyname_r with 6 args" >&5 -$as_echo_n "checking gethostbyname_r with 6 args... " >&6; } + { echo "$as_me:$LINENO: checking gethostbyname_r with 6 args" >&5 +echo $ECHO_N "checking gethostbyname_r with 6 args... $ECHO_C" >&6; } OLD_CFLAGS=$CFLAGS CFLAGS="$CFLAGS $MY_CPPFLAGS $MY_THREAD_CPPFLAGS $MY_CFLAGS" cat >conftest.$ac_ext <<_ACEOF @@ -21978,14 +21456,13 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err @@ -22000,18 +21477,18 @@ #define HAVE_GETHOSTBYNAME_R_6_ARG 1 _ACEOF - { $as_echo "$as_me:$LINENO: result: yes" >&5 -$as_echo "yes" >&6; } + { echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; } else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 - { $as_echo "$as_me:$LINENO: result: no" >&5 -$as_echo "no" >&6; } - { $as_echo "$as_me:$LINENO: checking gethostbyname_r with 5 args" >&5 -$as_echo_n "checking gethostbyname_r with 5 args... " >&6; } + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } + { echo "$as_me:$LINENO: checking gethostbyname_r with 5 args" >&5 +echo $ECHO_N "checking gethostbyname_r with 5 args... $ECHO_C" >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF @@ -22043,14 +21520,13 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err @@ -22065,18 +21541,18 @@ #define HAVE_GETHOSTBYNAME_R_5_ARG 1 _ACEOF - { $as_echo "$as_me:$LINENO: result: yes" >&5 -$as_echo "yes" >&6; } + { echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; } else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 - { $as_echo "$as_me:$LINENO: result: no" >&5 -$as_echo "no" >&6; } - { $as_echo "$as_me:$LINENO: checking gethostbyname_r with 3 args" >&5 -$as_echo_n "checking gethostbyname_r with 3 args... " >&6; } + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } + { echo "$as_me:$LINENO: checking gethostbyname_r with 3 args" >&5 +echo $ECHO_N "checking gethostbyname_r with 3 args... $ECHO_C" >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF @@ -22106,14 +21582,13 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err @@ -22128,16 +21603,16 @@ #define HAVE_GETHOSTBYNAME_R_3_ARG 1 _ACEOF - { $as_echo "$as_me:$LINENO: result: yes" >&5 -$as_echo "yes" >&6; } + { echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; } else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 - { $as_echo "$as_me:$LINENO: result: no" >&5 -$as_echo "no" >&6; } + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } fi @@ -22157,11 +21632,11 @@ for ac_func in gethostbyname do -as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` -{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5 -$as_echo_n "checking for $ac_func... " >&6; } +as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` +{ echo "$as_me:$LINENO: checking for $ac_func" >&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6; } if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ @@ -22214,42 +21689,35 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err - } && test -s conftest$ac_exeext && { - test "$cross_compiling" = yes || - $as_test_x conftest$ac_exeext - }; then + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then eval "$as_ac_var=yes" else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 eval "$as_ac_var=no" fi -rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext fi -ac_res=`eval 'as_val=${'$as_ac_var'} - $as_echo "$as_val"'` - { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } -as_val=`eval 'as_val=${'$as_ac_var'} - $as_echo "$as_val"'` - if test "x$as_val" = x""yes; then +ac_res=`eval echo '${'$as_ac_var'}'` + { echo "$as_me:$LINENO: result: $ac_res" >&5 +echo "${ECHO_T}$ac_res" >&6; } +if test `eval echo '${'$as_ac_var'}'` = yes; then cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 +#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF fi @@ -22268,10 +21736,10 @@ # (none yet) # Linux requires this for correct f.p. operations -{ $as_echo "$as_me:$LINENO: checking for __fpu_control" >&5 -$as_echo_n "checking for __fpu_control... " >&6; } +{ echo "$as_me:$LINENO: checking for __fpu_control" >&5 +echo $ECHO_N "checking for __fpu_control... $ECHO_C" >&6; } if test "${ac_cv_func___fpu_control+set}" = set; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ @@ -22324,43 +21792,39 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err - } && test -s conftest$ac_exeext && { - test "$cross_compiling" = yes || - $as_test_x conftest$ac_exeext - }; then + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then ac_cv_func___fpu_control=yes else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_func___fpu_control=no fi -rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_func___fpu_control" >&5 -$as_echo "$ac_cv_func___fpu_control" >&6; } -if test "x$ac_cv_func___fpu_control" = x""yes; then +{ echo "$as_me:$LINENO: result: $ac_cv_func___fpu_control" >&5 +echo "${ECHO_T}$ac_cv_func___fpu_control" >&6; } +if test $ac_cv_func___fpu_control = yes; then : else -{ $as_echo "$as_me:$LINENO: checking for __fpu_control in -lieee" >&5 -$as_echo_n "checking for __fpu_control in -lieee... " >&6; } +{ echo "$as_me:$LINENO: checking for __fpu_control in -lieee" >&5 +echo $ECHO_N "checking for __fpu_control in -lieee... $ECHO_C" >&6; } if test "${ac_cv_lib_ieee___fpu_control+set}" = set; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lieee $LIBS" @@ -22392,37 +21856,33 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err - } && test -s conftest$ac_exeext && { - test "$cross_compiling" = yes || - $as_test_x conftest$ac_exeext - }; then + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then ac_cv_lib_ieee___fpu_control=yes else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_ieee___fpu_control=no fi -rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_ieee___fpu_control" >&5 -$as_echo "$ac_cv_lib_ieee___fpu_control" >&6; } -if test "x$ac_cv_lib_ieee___fpu_control" = x""yes; then +{ echo "$as_me:$LINENO: result: $ac_cv_lib_ieee___fpu_control" >&5 +echo "${ECHO_T}$ac_cv_lib_ieee___fpu_control" >&6; } +if test $ac_cv_lib_ieee___fpu_control = yes; then cat >>confdefs.h <<_ACEOF #define HAVE_LIBIEEE 1 _ACEOF @@ -22436,8 +21896,8 @@ # Check for --with-fpectl -{ $as_echo "$as_me:$LINENO: checking for --with-fpectl" >&5 -$as_echo_n "checking for --with-fpectl... " >&6; } +{ echo "$as_me:$LINENO: checking for --with-fpectl" >&5 +echo $ECHO_N "checking for --with-fpectl... $ECHO_C" >&6; } # Check whether --with-fpectl was given. if test "${with_fpectl+set}" = set; then @@ -22449,14 +21909,14 @@ #define WANT_SIGFPE_HANDLER 1 _ACEOF - { $as_echo "$as_me:$LINENO: result: yes" >&5 -$as_echo "yes" >&6; } -else { $as_echo "$as_me:$LINENO: result: no" >&5 -$as_echo "no" >&6; } + { echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; } +else { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } fi else - { $as_echo "$as_me:$LINENO: result: no" >&5 -$as_echo "no" >&6; } + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } fi @@ -22467,53 +21927,53 @@ BeOS) ;; *) LIBM=-lm esac -{ $as_echo "$as_me:$LINENO: checking for --with-libm=STRING" >&5 -$as_echo_n "checking for --with-libm=STRING... " >&6; } +{ echo "$as_me:$LINENO: checking for --with-libm=STRING" >&5 +echo $ECHO_N "checking for --with-libm=STRING... $ECHO_C" >&6; } # Check whether --with-libm was given. if test "${with_libm+set}" = set; then withval=$with_libm; if test "$withval" = no then LIBM= - { $as_echo "$as_me:$LINENO: result: force LIBM empty" >&5 -$as_echo "force LIBM empty" >&6; } + { echo "$as_me:$LINENO: result: force LIBM empty" >&5 +echo "${ECHO_T}force LIBM empty" >&6; } elif test "$withval" != yes then LIBM=$withval - { $as_echo "$as_me:$LINENO: result: set LIBM=\"$withval\"" >&5 -$as_echo "set LIBM=\"$withval\"" >&6; } -else { { $as_echo "$as_me:$LINENO: error: proper usage is --with-libm=STRING" >&5 -$as_echo "$as_me: error: proper usage is --with-libm=STRING" >&2;} + { echo "$as_me:$LINENO: result: set LIBM=\"$withval\"" >&5 +echo "${ECHO_T}set LIBM=\"$withval\"" >&6; } +else { { echo "$as_me:$LINENO: error: proper usage is --with-libm=STRING" >&5 +echo "$as_me: error: proper usage is --with-libm=STRING" >&2;} { (exit 1); exit 1; }; } fi else - { $as_echo "$as_me:$LINENO: result: default LIBM=\"$LIBM\"" >&5 -$as_echo "default LIBM=\"$LIBM\"" >&6; } + { echo "$as_me:$LINENO: result: default LIBM=\"$LIBM\"" >&5 +echo "${ECHO_T}default LIBM=\"$LIBM\"" >&6; } fi # check for --with-libc=... -{ $as_echo "$as_me:$LINENO: checking for --with-libc=STRING" >&5 -$as_echo_n "checking for --with-libc=STRING... " >&6; } +{ echo "$as_me:$LINENO: checking for --with-libc=STRING" >&5 +echo $ECHO_N "checking for --with-libc=STRING... $ECHO_C" >&6; } # Check whether --with-libc was given. if test "${with_libc+set}" = set; then withval=$with_libc; if test "$withval" = no then LIBC= - { $as_echo "$as_me:$LINENO: result: force LIBC empty" >&5 -$as_echo "force LIBC empty" >&6; } + { echo "$as_me:$LINENO: result: force LIBC empty" >&5 +echo "${ECHO_T}force LIBC empty" >&6; } elif test "$withval" != yes then LIBC=$withval - { $as_echo "$as_me:$LINENO: result: set LIBC=\"$withval\"" >&5 -$as_echo "set LIBC=\"$withval\"" >&6; } -else { { $as_echo "$as_me:$LINENO: error: proper usage is --with-libc=STRING" >&5 -$as_echo "$as_me: error: proper usage is --with-libc=STRING" >&2;} + { echo "$as_me:$LINENO: result: set LIBC=\"$withval\"" >&5 +echo "${ECHO_T}set LIBC=\"$withval\"" >&6; } +else { { echo "$as_me:$LINENO: error: proper usage is --with-libc=STRING" >&5 +echo "$as_me: error: proper usage is --with-libc=STRING" >&2;} { (exit 1); exit 1; }; } fi else - { $as_echo "$as_me:$LINENO: result: default LIBC=\"$LIBC\"" >&5 -$as_echo "default LIBC=\"$LIBC\"" >&6; } + { echo "$as_me:$LINENO: result: default LIBC=\"$LIBC\"" >&5 +echo "${ECHO_T}default LIBC=\"$LIBC\"" >&6; } fi @@ -22529,10 +21989,10 @@ # IEEE 754 platforms. On IEEE 754, test should return 1 if rounding # mode is round-to-nearest and double rounding issues are present, and # 0 otherwise. See http://bugs.python.org/issue2937 for more info. -{ $as_echo "$as_me:$LINENO: checking for x87-style double rounding" >&5 -$as_echo_n "checking for x87-style double rounding... " >&6; } +{ echo "$as_me:$LINENO: checking for x87-style double rounding" >&5 +echo $ECHO_N "checking for x87-style double rounding... $ECHO_C" >&6; } if test "${ac_cv_x87_double_rounding+set}" = set; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else if test "$cross_compiling" = yes; then @@ -22571,40 +22031,37 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>&5 ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_try") 2>&5 ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_x87_double_rounding=no else - $as_echo "$as_me: program exited with status $ac_status" >&5 -$as_echo "$as_me: failed program was:" >&5 + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) ac_cv_x87_double_rounding=yes fi -rm -rf conftest.dSYM rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_x87_double_rounding" >&5 -$as_echo "$ac_cv_x87_double_rounding" >&6; } +{ echo "$as_me:$LINENO: result: $ac_cv_x87_double_rounding" >&5 +echo "${ECHO_T}$ac_cv_x87_double_rounding" >&6; } if test "$ac_cv_x87_double_rounding" = yes then @@ -22615,16 +22072,14 @@ fi # Multiprocessing check for broken sem_getvalue -{ $as_echo "$as_me:$LINENO: checking for broken sem_getvalue" >&5 -$as_echo_n "checking for broken sem_getvalue... " >&6; } +{ echo "$as_me:$LINENO: checking for broken sem_getvalue" >&5 +echo $ECHO_N "checking for broken sem_getvalue... $ECHO_C" >&6; } if test "$cross_compiling" = yes; then - { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -{ { $as_echo "$as_me:$LINENO: error: cannot run test program while cross compiling + { { echo "$as_me:$LINENO: error: cannot run test program while cross compiling See \`config.log' for more details." >&5 -$as_echo "$as_me: error: cannot run test program while cross compiling +echo "$as_me: error: cannot run test program while cross compiling See \`config.log' for more details." >&2;} - { (exit 1); exit 1; }; }; } + { (exit 1); exit 1; }; } else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ @@ -22661,32 +22116,30 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>&5 ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_try") 2>&5 ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - { $as_echo "$as_me:$LINENO: result: no" >&5 -$as_echo "no" >&6; } + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } else - $as_echo "$as_me: program exited with status $ac_status" >&5 -$as_echo "$as_me: failed program was:" >&5 + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) -{ $as_echo "$as_me:$LINENO: result: yes" >&5 -$as_echo "yes" >&6; } +{ echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; } cat >>confdefs.h <<\_ACEOF #define HAVE_BROKEN_SEM_GETVALUE 1 @@ -22694,7 +22147,6 @@ fi -rm -rf conftest.dSYM rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi @@ -22702,10 +22154,10 @@ # On FreeBSD 6.2, it appears that tanh(-0.) returns 0. instead of # -0. on some architectures. -{ $as_echo "$as_me:$LINENO: checking whether tanh preserves the sign of zero" >&5 -$as_echo_n "checking whether tanh preserves the sign of zero... " >&6; } +{ echo "$as_me:$LINENO: checking whether tanh preserves the sign of zero" >&5 +echo $ECHO_N "checking whether tanh preserves the sign of zero... $ECHO_C" >&6; } if test "${ac_cv_tanh_preserves_zero_sign+set}" = set; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else if test "$cross_compiling" = yes; then @@ -22736,40 +22188,37 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>&5 ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_try") 2>&5 ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_tanh_preserves_zero_sign=yes else - $as_echo "$as_me: program exited with status $ac_status" >&5 -$as_echo "$as_me: failed program was:" >&5 + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) ac_cv_tanh_preserves_zero_sign=no fi -rm -rf conftest.dSYM rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_tanh_preserves_zero_sign" >&5 -$as_echo "$ac_cv_tanh_preserves_zero_sign" >&6; } +{ echo "$as_me:$LINENO: result: $ac_cv_tanh_preserves_zero_sign" >&5 +echo "${ECHO_T}$ac_cv_tanh_preserves_zero_sign" >&6; } if test "$ac_cv_tanh_preserves_zero_sign" = yes then @@ -22790,11 +22239,11 @@ for ac_func in acosh asinh atanh copysign expm1 finite hypot log1p round do -as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` -{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5 -$as_echo_n "checking for $ac_func... " >&6; } +as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` +{ echo "$as_me:$LINENO: checking for $ac_func" >&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6; } if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ @@ -22847,51 +22296,44 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err - } && test -s conftest$ac_exeext && { - test "$cross_compiling" = yes || - $as_test_x conftest$ac_exeext - }; then + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then eval "$as_ac_var=yes" else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 eval "$as_ac_var=no" fi -rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext fi -ac_res=`eval 'as_val=${'$as_ac_var'} - $as_echo "$as_val"'` - { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } -as_val=`eval 'as_val=${'$as_ac_var'} - $as_echo "$as_val"'` - if test "x$as_val" = x""yes; then +ac_res=`eval echo '${'$as_ac_var'}'` + { echo "$as_me:$LINENO: result: $ac_res" >&5 +echo "${ECHO_T}$ac_res" >&6; } +if test `eval echo '${'$as_ac_var'}'` = yes; then cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 +#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF fi done -{ $as_echo "$as_me:$LINENO: checking whether isinf is declared" >&5 -$as_echo_n "checking whether isinf is declared... " >&6; } +{ echo "$as_me:$LINENO: checking whether isinf is declared" >&5 +echo $ECHO_N "checking whether isinf is declared... $ECHO_C" >&6; } if test "${ac_cv_have_decl_isinf+set}" = set; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ @@ -22918,21 +22360,20 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_have_decl_isinf=yes else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_have_decl_isinf=no @@ -22940,9 +22381,9 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_have_decl_isinf" >&5 -$as_echo "$ac_cv_have_decl_isinf" >&6; } -if test "x$ac_cv_have_decl_isinf" = x""yes; then +{ echo "$as_me:$LINENO: result: $ac_cv_have_decl_isinf" >&5 +echo "${ECHO_T}$ac_cv_have_decl_isinf" >&6; } +if test $ac_cv_have_decl_isinf = yes; then cat >>confdefs.h <<_ACEOF #define HAVE_DECL_ISINF 1 @@ -22956,10 +22397,10 @@ fi -{ $as_echo "$as_me:$LINENO: checking whether isnan is declared" >&5 -$as_echo_n "checking whether isnan is declared... " >&6; } +{ echo "$as_me:$LINENO: checking whether isnan is declared" >&5 +echo $ECHO_N "checking whether isnan is declared... $ECHO_C" >&6; } if test "${ac_cv_have_decl_isnan+set}" = set; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ @@ -22986,21 +22427,20 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_have_decl_isnan=yes else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_have_decl_isnan=no @@ -23008,9 +22448,9 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_have_decl_isnan" >&5 -$as_echo "$ac_cv_have_decl_isnan" >&6; } -if test "x$ac_cv_have_decl_isnan" = x""yes; then +{ echo "$as_me:$LINENO: result: $ac_cv_have_decl_isnan" >&5 +echo "${ECHO_T}$ac_cv_have_decl_isnan" >&6; } +if test $ac_cv_have_decl_isnan = yes; then cat >>confdefs.h <<_ACEOF #define HAVE_DECL_ISNAN 1 @@ -23024,10 +22464,10 @@ fi -{ $as_echo "$as_me:$LINENO: checking whether isfinite is declared" >&5 -$as_echo_n "checking whether isfinite is declared... " >&6; } +{ echo "$as_me:$LINENO: checking whether isfinite is declared" >&5 +echo $ECHO_N "checking whether isfinite is declared... $ECHO_C" >&6; } if test "${ac_cv_have_decl_isfinite+set}" = set; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ @@ -23054,21 +22494,20 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_have_decl_isfinite=yes else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_have_decl_isfinite=no @@ -23076,9 +22515,9 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_have_decl_isfinite" >&5 -$as_echo "$ac_cv_have_decl_isfinite" >&6; } -if test "x$ac_cv_have_decl_isfinite" = x""yes; then +{ echo "$as_me:$LINENO: result: $ac_cv_have_decl_isfinite" >&5 +echo "${ECHO_T}$ac_cv_have_decl_isfinite" >&6; } +if test $ac_cv_have_decl_isfinite = yes; then cat >>confdefs.h <<_ACEOF #define HAVE_DECL_ISFINITE 1 @@ -23098,8 +22537,8 @@ LIBS=$LIBS_SAVE # determine what size digit to use for Python's longs -{ $as_echo "$as_me:$LINENO: checking digit size for Python's longs" >&5 -$as_echo_n "checking digit size for Python's longs... " >&6; } +{ echo "$as_me:$LINENO: checking digit size for Python's longs" >&5 +echo $ECHO_N "checking digit size for Python's longs... $ECHO_C" >&6; } # Check whether --enable-big-digits was given. if test "${enable_big_digits+set}" = set; then enableval=$enable_big_digits; case $enable_big_digits in @@ -23110,12 +22549,12 @@ 15|30) ;; *) - { { $as_echo "$as_me:$LINENO: error: bad value $enable_big_digits for --enable-big-digits; value should be 15 or 30" >&5 -$as_echo "$as_me: error: bad value $enable_big_digits for --enable-big-digits; value should be 15 or 30" >&2;} + { { echo "$as_me:$LINENO: error: bad value $enable_big_digits for --enable-big-digits; value should be 15 or 30" >&5 +echo "$as_me: error: bad value $enable_big_digits for --enable-big-digits; value should be 15 or 30" >&2;} { (exit 1); exit 1; }; } ;; esac -{ $as_echo "$as_me:$LINENO: result: $enable_big_digits" >&5 -$as_echo "$enable_big_digits" >&6; } +{ echo "$as_me:$LINENO: result: $enable_big_digits" >&5 +echo "${ECHO_T}$enable_big_digits" >&6; } cat >>confdefs.h <<_ACEOF #define PYLONG_BITS_IN_DIGIT $enable_big_digits @@ -23123,24 +22562,24 @@ else - { $as_echo "$as_me:$LINENO: result: no value specified" >&5 -$as_echo "no value specified" >&6; } + { echo "$as_me:$LINENO: result: no value specified" >&5 +echo "${ECHO_T}no value specified" >&6; } fi # check for wchar.h if test "${ac_cv_header_wchar_h+set}" = set; then - { $as_echo "$as_me:$LINENO: checking for wchar.h" >&5 -$as_echo_n "checking for wchar.h... " >&6; } + { echo "$as_me:$LINENO: checking for wchar.h" >&5 +echo $ECHO_N "checking for wchar.h... $ECHO_C" >&6; } if test "${ac_cv_header_wchar_h+set}" = set; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_wchar_h" >&5 -$as_echo "$ac_cv_header_wchar_h" >&6; } +{ echo "$as_me:$LINENO: result: $ac_cv_header_wchar_h" >&5 +echo "${ECHO_T}$ac_cv_header_wchar_h" >&6; } else # Is the header compilable? -{ $as_echo "$as_me:$LINENO: checking wchar.h usability" >&5 -$as_echo_n "checking wchar.h usability... " >&6; } +{ echo "$as_me:$LINENO: checking wchar.h usability" >&5 +echo $ECHO_N "checking wchar.h usability... $ECHO_C" >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF @@ -23156,33 +22595,32 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_header_compiler=yes else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_compiler=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 -$as_echo "$ac_header_compiler" >&6; } +{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6; } # Is the header present? -{ $as_echo "$as_me:$LINENO: checking wchar.h presence" >&5 -$as_echo_n "checking wchar.h presence... " >&6; } +{ echo "$as_me:$LINENO: checking wchar.h presence" >&5 +echo $ECHO_N "checking wchar.h presence... $ECHO_C" >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF @@ -23196,52 +22634,51 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then ac_header_preproc=yes else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_preproc=no fi rm -f conftest.err conftest.$ac_ext -{ $as_echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 -$as_echo "$ac_header_preproc" >&6; } +{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6; } # So? What about this header? case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in yes:no: ) - { $as_echo "$as_me:$LINENO: WARNING: wchar.h: accepted by the compiler, rejected by the preprocessor!" >&5 -$as_echo "$as_me: WARNING: wchar.h: accepted by the compiler, rejected by the preprocessor!" >&2;} - { $as_echo "$as_me:$LINENO: WARNING: wchar.h: proceeding with the compiler's result" >&5 -$as_echo "$as_me: WARNING: wchar.h: proceeding with the compiler's result" >&2;} + { echo "$as_me:$LINENO: WARNING: wchar.h: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: wchar.h: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: wchar.h: proceeding with the compiler's result" >&5 +echo "$as_me: WARNING: wchar.h: proceeding with the compiler's result" >&2;} ac_header_preproc=yes ;; no:yes:* ) - { $as_echo "$as_me:$LINENO: WARNING: wchar.h: present but cannot be compiled" >&5 -$as_echo "$as_me: WARNING: wchar.h: present but cannot be compiled" >&2;} - { $as_echo "$as_me:$LINENO: WARNING: wchar.h: check for missing prerequisite headers?" >&5 -$as_echo "$as_me: WARNING: wchar.h: check for missing prerequisite headers?" >&2;} - { $as_echo "$as_me:$LINENO: WARNING: wchar.h: see the Autoconf documentation" >&5 -$as_echo "$as_me: WARNING: wchar.h: see the Autoconf documentation" >&2;} - { $as_echo "$as_me:$LINENO: WARNING: wchar.h: section \"Present But Cannot Be Compiled\"" >&5 -$as_echo "$as_me: WARNING: wchar.h: section \"Present But Cannot Be Compiled\"" >&2;} - { $as_echo "$as_me:$LINENO: WARNING: wchar.h: proceeding with the preprocessor's result" >&5 -$as_echo "$as_me: WARNING: wchar.h: proceeding with the preprocessor's result" >&2;} - { $as_echo "$as_me:$LINENO: WARNING: wchar.h: in the future, the compiler will take precedence" >&5 -$as_echo "$as_me: WARNING: wchar.h: in the future, the compiler will take precedence" >&2;} + { echo "$as_me:$LINENO: WARNING: wchar.h: present but cannot be compiled" >&5 +echo "$as_me: WARNING: wchar.h: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: wchar.h: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: wchar.h: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: wchar.h: see the Autoconf documentation" >&5 +echo "$as_me: WARNING: wchar.h: see the Autoconf documentation" >&2;} + { echo "$as_me:$LINENO: WARNING: wchar.h: section \"Present But Cannot Be Compiled\"" >&5 +echo "$as_me: WARNING: wchar.h: section \"Present But Cannot Be Compiled\"" >&2;} + { echo "$as_me:$LINENO: WARNING: wchar.h: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: wchar.h: proceeding with the preprocessor's result" >&2;} + { echo "$as_me:$LINENO: WARNING: wchar.h: in the future, the compiler will take precedence" >&5 +echo "$as_me: WARNING: wchar.h: in the future, the compiler will take precedence" >&2;} ( cat <<\_ASBOX ## -------------------------------------- ## ## Report this to http://bugs.python.org/ ## @@ -23250,18 +22687,18 @@ ) | sed "s/^/$as_me: WARNING: /" >&2 ;; esac -{ $as_echo "$as_me:$LINENO: checking for wchar.h" >&5 -$as_echo_n "checking for wchar.h... " >&6; } +{ echo "$as_me:$LINENO: checking for wchar.h" >&5 +echo $ECHO_N "checking for wchar.h... $ECHO_C" >&6; } if test "${ac_cv_header_wchar_h+set}" = set; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_cv_header_wchar_h=$ac_header_preproc fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_wchar_h" >&5 -$as_echo "$ac_cv_header_wchar_h" >&6; } +{ echo "$as_me:$LINENO: result: $ac_cv_header_wchar_h" >&5 +echo "${ECHO_T}$ac_cv_header_wchar_h" >&6; } fi -if test "x$ac_cv_header_wchar_h" = x""yes; then +if test $ac_cv_header_wchar_h = yes; then cat >>confdefs.h <<\_ACEOF @@ -23280,14 +22717,69 @@ # determine wchar_t size if test "$wchar_h" = yes then - # The cast to long int works around a bug in the HP C Compiler + { echo "$as_me:$LINENO: checking for wchar_t" >&5 +echo $ECHO_N "checking for wchar_t... $ECHO_C" >&6; } +if test "${ac_cv_type_wchar_t+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include + +typedef wchar_t ac__type_new_; +int +main () +{ +if ((ac__type_new_ *) 0) + return 0; +if (sizeof (ac__type_new_)) + return 0; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_cv_type_wchar_t=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_type_wchar_t=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ echo "$as_me:$LINENO: result: $ac_cv_type_wchar_t" >&5 +echo "${ECHO_T}$ac_cv_type_wchar_t" >&6; } + +# The cast to long int works around a bug in the HP C Compiler # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. # This bug is HP SR number 8606223364. -{ $as_echo "$as_me:$LINENO: checking size of wchar_t" >&5 -$as_echo_n "checking size of wchar_t... " >&6; } +{ echo "$as_me:$LINENO: checking size of wchar_t" >&5 +echo $ECHO_N "checking size of wchar_t... $ECHO_C" >&6; } if test "${ac_cv_sizeof_wchar_t+set}" = set; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else if test "$cross_compiling" = yes; then # Depending upon the size, compute the lo and hi bounds. @@ -23299,10 +22791,11 @@ /* end confdefs.h. */ #include + typedef wchar_t ac__type_sizeof_; int main () { -static int test_array [1 - 2 * !(((long int) (sizeof (wchar_t))) >= 0)]; +static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) >= 0)]; test_array [0] = 0 ; @@ -23315,14 +22808,13 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err @@ -23337,10 +22829,11 @@ /* end confdefs.h. */ #include + typedef wchar_t ac__type_sizeof_; int main () { -static int test_array [1 - 2 * !(((long int) (sizeof (wchar_t))) <= $ac_mid)]; +static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) <= $ac_mid)]; test_array [0] = 0 ; @@ -23353,21 +22846,20 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_hi=$ac_mid; break else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo=`expr $ac_mid + 1` @@ -23381,7 +22873,7 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 cat >conftest.$ac_ext <<_ACEOF @@ -23392,10 +22884,11 @@ /* end confdefs.h. */ #include + typedef wchar_t ac__type_sizeof_; int main () { -static int test_array [1 - 2 * !(((long int) (sizeof (wchar_t))) < 0)]; +static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) < 0)]; test_array [0] = 0 ; @@ -23408,14 +22901,13 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err @@ -23430,10 +22922,11 @@ /* end confdefs.h. */ #include + typedef wchar_t ac__type_sizeof_; int main () { -static int test_array [1 - 2 * !(((long int) (sizeof (wchar_t))) >= $ac_mid)]; +static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) >= $ac_mid)]; test_array [0] = 0 ; @@ -23446,21 +22939,20 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_lo=$ac_mid; break else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_hi=`expr '(' $ac_mid ')' - 1` @@ -23474,7 +22966,7 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo= ac_hi= @@ -23495,10 +22987,11 @@ /* end confdefs.h. */ #include + typedef wchar_t ac__type_sizeof_; int main () { -static int test_array [1 - 2 * !(((long int) (sizeof (wchar_t))) <= $ac_mid)]; +static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) <= $ac_mid)]; test_array [0] = 0 ; @@ -23511,21 +23004,20 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_hi=$ac_mid else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_lo=`expr '(' $ac_mid ')' + 1` @@ -23536,13 +23028,11 @@ case $ac_lo in ?*) ac_cv_sizeof_wchar_t=$ac_lo;; '') if test "$ac_cv_type_wchar_t" = yes; then - { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -{ { $as_echo "$as_me:$LINENO: error: cannot compute sizeof (wchar_t) + { { echo "$as_me:$LINENO: error: cannot compute sizeof (wchar_t) See \`config.log' for more details." >&5 -$as_echo "$as_me: error: cannot compute sizeof (wchar_t) +echo "$as_me: error: cannot compute sizeof (wchar_t) See \`config.log' for more details." >&2;} - { (exit 77); exit 77; }; }; } + { (exit 77); exit 77; }; } else ac_cv_sizeof_wchar_t=0 fi ;; @@ -23556,8 +23046,9 @@ /* end confdefs.h. */ #include -static long int longval () { return (long int) (sizeof (wchar_t)); } -static unsigned long int ulongval () { return (long int) (sizeof (wchar_t)); } + typedef wchar_t ac__type_sizeof_; +static long int longval () { return (long int) (sizeof (ac__type_sizeof_)); } +static unsigned long int ulongval () { return (long int) (sizeof (ac__type_sizeof_)); } #include #include int @@ -23567,22 +23058,20 @@ FILE *f = fopen ("conftest.val", "w"); if (! f) return 1; - if (((long int) (sizeof (wchar_t))) < 0) + if (((long int) (sizeof (ac__type_sizeof_))) < 0) { long int i = longval (); - if (i != ((long int) (sizeof (wchar_t)))) + if (i != ((long int) (sizeof (ac__type_sizeof_)))) return 1; - fprintf (f, "%ld", i); + fprintf (f, "%ld\n", i); } else { unsigned long int i = ulongval (); - if (i != ((long int) (sizeof (wchar_t)))) + if (i != ((long int) (sizeof (ac__type_sizeof_)))) return 1; - fprintf (f, "%lu", i); + fprintf (f, "%lu\n", i); } - /* Do not output a trailing newline, as this causes \r\n confusion - on some platforms. */ return ferror (f) || fclose (f) != 0; ; @@ -23595,48 +23084,43 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>&5 ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_try") 2>&5 ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_sizeof_wchar_t=`cat conftest.val` else - $as_echo "$as_me: program exited with status $ac_status" >&5 -$as_echo "$as_me: failed program was:" >&5 + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) if test "$ac_cv_type_wchar_t" = yes; then - { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -{ { $as_echo "$as_me:$LINENO: error: cannot compute sizeof (wchar_t) + { { echo "$as_me:$LINENO: error: cannot compute sizeof (wchar_t) See \`config.log' for more details." >&5 -$as_echo "$as_me: error: cannot compute sizeof (wchar_t) +echo "$as_me: error: cannot compute sizeof (wchar_t) See \`config.log' for more details." >&2;} - { (exit 77); exit 77; }; }; } + { (exit 77); exit 77; }; } else ac_cv_sizeof_wchar_t=0 fi fi -rm -rf conftest.dSYM rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi rm -f conftest.val fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_sizeof_wchar_t" >&5 -$as_echo "$ac_cv_sizeof_wchar_t" >&6; } +{ echo "$as_me:$LINENO: result: $ac_cv_sizeof_wchar_t" >&5 +echo "${ECHO_T}$ac_cv_sizeof_wchar_t" >&6; } @@ -23647,8 +23131,8 @@ fi -{ $as_echo "$as_me:$LINENO: checking for UCS-4 tcl" >&5 -$as_echo_n "checking for UCS-4 tcl... " >&6; } +{ echo "$as_me:$LINENO: checking for UCS-4 tcl" >&5 +echo $ECHO_N "checking for UCS-4 tcl... $ECHO_C" >&6; } have_ucs4_tcl=no cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ @@ -23675,14 +23159,13 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err @@ -23696,24 +23179,24 @@ have_ucs4_tcl=yes else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -{ $as_echo "$as_me:$LINENO: result: $have_ucs4_tcl" >&5 -$as_echo "$have_ucs4_tcl" >&6; } +{ echo "$as_me:$LINENO: result: $have_ucs4_tcl" >&5 +echo "${ECHO_T}$have_ucs4_tcl" >&6; } # check whether wchar_t is signed or not if test "$wchar_h" = yes then # check whether wchar_t is signed or not - { $as_echo "$as_me:$LINENO: checking whether wchar_t is signed" >&5 -$as_echo_n "checking whether wchar_t is signed... " >&6; } + { echo "$as_me:$LINENO: checking whether wchar_t is signed" >&5 +echo $ECHO_N "checking whether wchar_t is signed... $ECHO_C" >&6; } if test "${ac_cv_wchar_t_signed+set}" = set; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else if test "$cross_compiling" = yes; then @@ -23740,44 +23223,41 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>&5 ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_try") 2>&5 ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_wchar_t_signed=yes else - $as_echo "$as_me: program exited with status $ac_status" >&5 -$as_echo "$as_me: failed program was:" >&5 + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) ac_cv_wchar_t_signed=no fi -rm -rf conftest.dSYM rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi - { $as_echo "$as_me:$LINENO: result: $ac_cv_wchar_t_signed" >&5 -$as_echo "$ac_cv_wchar_t_signed" >&6; } + { echo "$as_me:$LINENO: result: $ac_cv_wchar_t_signed" >&5 +echo "${ECHO_T}$ac_cv_wchar_t_signed" >&6; } fi -{ $as_echo "$as_me:$LINENO: checking what type to use for unicode" >&5 -$as_echo_n "checking what type to use for unicode... " >&6; } +{ echo "$as_me:$LINENO: checking what type to use for unicode" >&5 +echo $ECHO_N "checking what type to use for unicode... $ECHO_C" >&6; } # Check whether --enable-unicode was given. if test "${enable_unicode+set}" = set; then enableval=$enable_unicode; @@ -23821,220 +23301,74 @@ if test "$enable_unicode" = "no" then UNICODE_OBJS="" - { $as_echo "$as_me:$LINENO: result: not used" >&5 -$as_echo "not used" >&6; } -else - UNICODE_OBJS="Objects/unicodeobject.o Objects/unicodectype.o" - -cat >>confdefs.h <<\_ACEOF -#define Py_USING_UNICODE 1 -_ACEOF - - - # wchar_t is only usable if it maps to an unsigned type - if test "$unicode_size" = "$ac_cv_sizeof_wchar_t" \ - -a "$ac_cv_wchar_t_signed" = "no" - then - PY_UNICODE_TYPE="wchar_t" - -cat >>confdefs.h <<\_ACEOF -#define HAVE_USABLE_WCHAR_T 1 -_ACEOF - - cat >>confdefs.h <<\_ACEOF -#define PY_UNICODE_TYPE wchar_t -_ACEOF - - elif test "$ac_cv_sizeof_short" = "$unicode_size" - then - PY_UNICODE_TYPE="unsigned short" - cat >>confdefs.h <<\_ACEOF -#define PY_UNICODE_TYPE unsigned short -_ACEOF - - elif test "$ac_cv_sizeof_long" = "$unicode_size" - then - PY_UNICODE_TYPE="unsigned long" - cat >>confdefs.h <<\_ACEOF -#define PY_UNICODE_TYPE unsigned long -_ACEOF - - else - PY_UNICODE_TYPE="no type found" - fi - { $as_echo "$as_me:$LINENO: result: $PY_UNICODE_TYPE" >&5 -$as_echo "$PY_UNICODE_TYPE" >&6; } -fi - -# check for endianness - - { $as_echo "$as_me:$LINENO: checking whether byte ordering is bigendian" >&5 -$as_echo_n "checking whether byte ordering is bigendian... " >&6; } -if test "${ac_cv_c_bigendian+set}" = set; then - $as_echo_n "(cached) " >&6 -else - ac_cv_c_bigendian=unknown - # See if we're dealing with a universal compiler. - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#ifndef __APPLE_CC__ - not a universal capable compiler - #endif - typedef int dummy; - -_ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - - # Check for potential -arch flags. It is not universal unless - # there are some -arch flags. Note that *ppc* also matches - # ppc64. This check is also rather less than ideal. - case "${CC} ${CFLAGS} ${CPPFLAGS} ${LDFLAGS}" in #( - *-arch*ppc*|*-arch*i386*|*-arch*x86_64*) ac_cv_c_bigendian=universal;; - esac -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - -fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - if test $ac_cv_c_bigendian = unknown; then - # See if sys/param.h defines the BYTE_ORDER macro. - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include - #include - -int -main () -{ -#if ! (defined BYTE_ORDER && defined BIG_ENDIAN \ - && defined LITTLE_ENDIAN && BYTE_ORDER && BIG_ENDIAN \ - && LITTLE_ENDIAN) - bogus endian macros - #endif - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - # It does; now see whether it defined to BIG_ENDIAN or not. - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include - #include - -int -main () -{ -#if BYTE_ORDER != BIG_ENDIAN - not big endian - #endif - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - ac_cv_c_bigendian=yes + { echo "$as_me:$LINENO: result: not used" >&5 +echo "${ECHO_T}not used" >&6; } else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 + UNICODE_OBJS="Objects/unicodeobject.o Objects/unicodectype.o" - ac_cv_c_bigendian=no -fi +cat >>confdefs.h <<\_ACEOF +#define Py_USING_UNICODE 1 +_ACEOF -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 + # wchar_t is only usable if it maps to an unsigned type + if test "$unicode_size" = "$ac_cv_sizeof_wchar_t" \ + -a "$ac_cv_wchar_t_signed" = "no" + then + PY_UNICODE_TYPE="wchar_t" + +cat >>confdefs.h <<\_ACEOF +#define HAVE_USABLE_WCHAR_T 1 +_ACEOF + + cat >>confdefs.h <<\_ACEOF +#define PY_UNICODE_TYPE wchar_t +_ACEOF + + elif test "$ac_cv_sizeof_short" = "$unicode_size" + then + PY_UNICODE_TYPE="unsigned short" + cat >>confdefs.h <<\_ACEOF +#define PY_UNICODE_TYPE unsigned short +_ACEOF + + elif test "$ac_cv_sizeof_long" = "$unicode_size" + then + PY_UNICODE_TYPE="unsigned long" + cat >>confdefs.h <<\_ACEOF +#define PY_UNICODE_TYPE unsigned long +_ACEOF + else + PY_UNICODE_TYPE="no type found" + fi + { echo "$as_me:$LINENO: result: $PY_UNICODE_TYPE" >&5 +echo "${ECHO_T}$PY_UNICODE_TYPE" >&6; } fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - fi - if test $ac_cv_c_bigendian = unknown; then - # See if defines _LITTLE_ENDIAN or _BIG_ENDIAN (e.g., Solaris). - cat >conftest.$ac_ext <<_ACEOF +# check for endianness +{ echo "$as_me:$LINENO: checking whether byte ordering is bigendian" >&5 +echo $ECHO_N "checking whether byte ordering is bigendian... $ECHO_C" >&6; } +if test "${ac_cv_c_bigendian+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + # See if sys/param.h defines the BYTE_ORDER macro. +cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -#include +#include +#include int main () { -#if ! (defined _LITTLE_ENDIAN || defined _BIG_ENDIAN) - bogus endian macros - #endif +#if ! (defined BYTE_ORDER && defined BIG_ENDIAN && defined LITTLE_ENDIAN \ + && BYTE_ORDER && BIG_ENDIAN && LITTLE_ENDIAN) + bogus endian macros +#endif ; return 0; @@ -24046,33 +23380,33 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then - # It does; now see whether it defined to _BIG_ENDIAN or not. - cat >conftest.$ac_ext <<_ACEOF + # It does; now see whether it defined to BIG_ENDIAN or not. +cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -#include +#include +#include int main () { -#ifndef _BIG_ENDIAN - not big endian - #endif +#if BYTE_ORDER != BIG_ENDIAN + not big endian +#endif ; return 0; @@ -24084,21 +23418,20 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_c_bigendian=yes else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_c_bigendian=no @@ -24106,44 +23439,29 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 - -fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - fi - if test $ac_cv_c_bigendian = unknown; then - # Compile a test program. - if test "$cross_compiling" = yes; then - # Try to guess by grepping values from an object file. - cat >conftest.$ac_ext <<_ACEOF + # It does not; compile a test program. +if test "$cross_compiling" = yes; then + # try to guess the endianness by grepping values into an object file + ac_cv_c_bigendian=unknown + cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ -short int ascii_mm[] = - { 0x4249, 0x4765, 0x6E44, 0x6961, 0x6E53, 0x7953, 0 }; - short int ascii_ii[] = - { 0x694C, 0x5454, 0x656C, 0x6E45, 0x6944, 0x6E61, 0 }; - int use_ascii (int i) { - return ascii_mm[i] + ascii_ii[i]; - } - short int ebcdic_ii[] = - { 0x89D3, 0xE3E3, 0x8593, 0x95C5, 0x89C4, 0x9581, 0 }; - short int ebcdic_mm[] = - { 0xC2C9, 0xC785, 0x95C4, 0x8981, 0x95E2, 0xA8E2, 0 }; - int use_ebcdic (int i) { - return ebcdic_mm[i] + ebcdic_ii[i]; - } - extern int foo; - +short int ascii_mm[] = { 0x4249, 0x4765, 0x6E44, 0x6961, 0x6E53, 0x7953, 0 }; +short int ascii_ii[] = { 0x694C, 0x5454, 0x656C, 0x6E45, 0x6944, 0x6E61, 0 }; +void _ascii () { char *s = (char *) ascii_mm; s = (char *) ascii_ii; } +short int ebcdic_ii[] = { 0x89D3, 0xE3E3, 0x8593, 0x95C5, 0x89C4, 0x9581, 0 }; +short int ebcdic_mm[] = { 0xC2C9, 0xC785, 0x95C4, 0x8981, 0x95E2, 0xA8E2, 0 }; +void _ebcdic () { char *s = (char *) ebcdic_mm; s = (char *) ebcdic_ii; } int main () { -return use_ascii (foo) == use_ebcdic (foo); + _ascii (); _ebcdic (); ; return 0; } @@ -24154,31 +23472,30 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then - if grep BIGenDianSyS conftest.$ac_objext >/dev/null; then - ac_cv_c_bigendian=yes - fi - if grep LiTTleEnDian conftest.$ac_objext >/dev/null ; then - if test "$ac_cv_c_bigendian" = unknown; then - ac_cv_c_bigendian=no - else - # finding both strings is unlikely to happen, but who knows? - ac_cv_c_bigendian=unknown - fi - fi + if grep BIGenDianSyS conftest.$ac_objext >/dev/null ; then + ac_cv_c_bigendian=yes +fi +if grep LiTTleEnDian conftest.$ac_objext >/dev/null ; then + if test "$ac_cv_c_bigendian" = unknown; then + ac_cv_c_bigendian=no + else + # finding both strings is unlikely to happen, but who knows? + ac_cv_c_bigendian=unknown + fi +fi else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 @@ -24197,14 +23514,14 @@ main () { - /* Are we little or big endian? From Harbison&Steele. */ - union - { - long int l; - char c[sizeof (long int)]; - } u; - u.l = 1; - return u.c[sizeof (long int) - 1] == 1; + /* Are we little or big endian? From Harbison&Steele. */ + union + { + long int l; + char c[sizeof (long int)]; + } u; + u.l = 1; + return u.c[sizeof (long int) - 1] == 1; ; return 0; @@ -24216,70 +23533,63 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>&5 ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_try") 2>&5 ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_c_bigendian=no else - $as_echo "$as_me: program exited with status $ac_status" >&5 -$as_echo "$as_me: failed program was:" >&5 + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) ac_cv_c_bigendian=yes fi -rm -rf conftest.dSYM rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi - fi fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_c_bigendian" >&5 -$as_echo "$ac_cv_c_bigendian" >&6; } - case $ac_cv_c_bigendian in #( - yes) - cat >>confdefs.h <<\_ACEOF -#define WORDS_BIGENDIAN 1 -_ACEOF -;; #( - no) - ;; #( - universal) + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ echo "$as_me:$LINENO: result: $ac_cv_c_bigendian" >&5 +echo "${ECHO_T}$ac_cv_c_bigendian" >&6; } +case $ac_cv_c_bigendian in + yes) cat >>confdefs.h <<\_ACEOF -#define AC_APPLE_UNIVERSAL_BUILD 1 +#define WORDS_BIGENDIAN 1 _ACEOF - - ;; #( - *) - { { $as_echo "$as_me:$LINENO: error: unknown endianness - presetting ac_cv_c_bigendian=no (or yes) will help" >&5 -$as_echo "$as_me: error: unknown endianness - presetting ac_cv_c_bigendian=no (or yes) will help" >&2;} + ;; + no) + ;; + *) + { { echo "$as_me:$LINENO: error: unknown endianness +presetting ac_cv_c_bigendian=no (or yes) will help" >&5 +echo "$as_me: error: unknown endianness +presetting ac_cv_c_bigendian=no (or yes) will help" >&2;} { (exit 1); exit 1; }; } ;; - esac +esac # Check whether right shifting a negative integer extends the sign bit # or fills with zeros (like the Cray J90, according to Tim Peters). -{ $as_echo "$as_me:$LINENO: checking whether right shift extends the sign bit" >&5 -$as_echo_n "checking whether right shift extends the sign bit... " >&6; } +{ echo "$as_me:$LINENO: checking whether right shift extends the sign bit" >&5 +echo $ECHO_N "checking whether right shift extends the sign bit... $ECHO_C" >&6; } if test "${ac_cv_rshift_extends_sign+set}" = set; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else if test "$cross_compiling" = yes; then @@ -24304,40 +23614,37 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>&5 ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_try") 2>&5 ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_rshift_extends_sign=yes else - $as_echo "$as_me: program exited with status $ac_status" >&5 -$as_echo "$as_me: failed program was:" >&5 + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) ac_cv_rshift_extends_sign=no fi -rm -rf conftest.dSYM rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_rshift_extends_sign" >&5 -$as_echo "$ac_cv_rshift_extends_sign" >&6; } +{ echo "$as_me:$LINENO: result: $ac_cv_rshift_extends_sign" >&5 +echo "${ECHO_T}$ac_cv_rshift_extends_sign" >&6; } if test "$ac_cv_rshift_extends_sign" = no then @@ -24348,10 +23655,10 @@ fi # check for getc_unlocked and related locking functions -{ $as_echo "$as_me:$LINENO: checking for getc_unlocked() and friends" >&5 -$as_echo_n "checking for getc_unlocked() and friends... " >&6; } +{ echo "$as_me:$LINENO: checking for getc_unlocked() and friends" >&5 +echo $ECHO_N "checking for getc_unlocked() and friends... $ECHO_C" >&6; } if test "${ac_cv_have_getc_unlocked+set}" = set; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF @@ -24380,36 +23687,32 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err - } && test -s conftest$ac_exeext && { - test "$cross_compiling" = yes || - $as_test_x conftest$ac_exeext - }; then + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then ac_cv_have_getc_unlocked=yes else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_have_getc_unlocked=no fi -rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_have_getc_unlocked" >&5 -$as_echo "$ac_cv_have_getc_unlocked" >&6; } +{ echo "$as_me:$LINENO: result: $ac_cv_have_getc_unlocked" >&5 +echo "${ECHO_T}$ac_cv_have_getc_unlocked" >&6; } if test "$ac_cv_have_getc_unlocked" = yes then @@ -24427,8 +23730,8 @@ # library. NOTE: Keep the precedence of listed libraries synchronised # with setup.py. py_cv_lib_readline=no -{ $as_echo "$as_me:$LINENO: checking how to link readline libs" >&5 -$as_echo_n "checking how to link readline libs... " >&6; } +{ echo "$as_me:$LINENO: checking how to link readline libs" >&5 +echo $ECHO_N "checking how to link readline libs... $ECHO_C" >&6; } for py_libtermcap in "" ncursesw ncurses curses termcap; do if test -z "$py_libtermcap"; then READLINE_LIBS="-lreadline" @@ -24464,30 +23767,26 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err - } && test -s conftest$ac_exeext && { - test "$cross_compiling" = yes || - $as_test_x conftest$ac_exeext - }; then + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then py_cv_lib_readline=yes else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi -rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext if test $py_cv_lib_readline = yes; then @@ -24497,11 +23796,11 @@ # Uncomment this line if you want to use READINE_LIBS in Makefile or scripts #AC_SUBST([READLINE_LIBS]) if test $py_cv_lib_readline = no; then - { $as_echo "$as_me:$LINENO: result: none" >&5 -$as_echo "none" >&6; } + { echo "$as_me:$LINENO: result: none" >&5 +echo "${ECHO_T}none" >&6; } else - { $as_echo "$as_me:$LINENO: result: $READLINE_LIBS" >&5 -$as_echo "$READLINE_LIBS" >&6; } + { echo "$as_me:$LINENO: result: $READLINE_LIBS" >&5 +echo "${ECHO_T}$READLINE_LIBS" >&6; } cat >>confdefs.h <<\_ACEOF #define HAVE_LIBREADLINE 1 @@ -24510,10 +23809,10 @@ fi # check for readline 2.1 -{ $as_echo "$as_me:$LINENO: checking for rl_callback_handler_install in -lreadline" >&5 -$as_echo_n "checking for rl_callback_handler_install in -lreadline... " >&6; } +{ echo "$as_me:$LINENO: checking for rl_callback_handler_install in -lreadline" >&5 +echo $ECHO_N "checking for rl_callback_handler_install in -lreadline... $ECHO_C" >&6; } if test "${ac_cv_lib_readline_rl_callback_handler_install+set}" = set; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lreadline $READLINE_LIBS $LIBS" @@ -24545,37 +23844,33 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err - } && test -s conftest$ac_exeext && { - test "$cross_compiling" = yes || - $as_test_x conftest$ac_exeext - }; then + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then ac_cv_lib_readline_rl_callback_handler_install=yes else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_readline_rl_callback_handler_install=no fi -rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_readline_rl_callback_handler_install" >&5 -$as_echo "$ac_cv_lib_readline_rl_callback_handler_install" >&6; } -if test "x$ac_cv_lib_readline_rl_callback_handler_install" = x""yes; then +{ echo "$as_me:$LINENO: result: $ac_cv_lib_readline_rl_callback_handler_install" >&5 +echo "${ECHO_T}$ac_cv_lib_readline_rl_callback_handler_install" >&6; } +if test $ac_cv_lib_readline_rl_callback_handler_install = yes; then cat >>confdefs.h <<\_ACEOF #define HAVE_RL_CALLBACK 1 @@ -24598,21 +23893,20 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then have_readline=yes else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 have_readline=no @@ -24643,10 +23937,10 @@ fi # check for readline 4.0 -{ $as_echo "$as_me:$LINENO: checking for rl_pre_input_hook in -lreadline" >&5 -$as_echo_n "checking for rl_pre_input_hook in -lreadline... " >&6; } +{ echo "$as_me:$LINENO: checking for rl_pre_input_hook in -lreadline" >&5 +echo $ECHO_N "checking for rl_pre_input_hook in -lreadline... $ECHO_C" >&6; } if test "${ac_cv_lib_readline_rl_pre_input_hook+set}" = set; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lreadline $READLINE_LIBS $LIBS" @@ -24678,37 +23972,33 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err - } && test -s conftest$ac_exeext && { - test "$cross_compiling" = yes || - $as_test_x conftest$ac_exeext - }; then + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then ac_cv_lib_readline_rl_pre_input_hook=yes else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_readline_rl_pre_input_hook=no fi -rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_readline_rl_pre_input_hook" >&5 -$as_echo "$ac_cv_lib_readline_rl_pre_input_hook" >&6; } -if test "x$ac_cv_lib_readline_rl_pre_input_hook" = x""yes; then +{ echo "$as_me:$LINENO: result: $ac_cv_lib_readline_rl_pre_input_hook" >&5 +echo "${ECHO_T}$ac_cv_lib_readline_rl_pre_input_hook" >&6; } +if test $ac_cv_lib_readline_rl_pre_input_hook = yes; then cat >>confdefs.h <<\_ACEOF #define HAVE_RL_PRE_INPUT_HOOK 1 @@ -24718,10 +24008,10 @@ # also in 4.0 -{ $as_echo "$as_me:$LINENO: checking for rl_completion_display_matches_hook in -lreadline" >&5 -$as_echo_n "checking for rl_completion_display_matches_hook in -lreadline... " >&6; } +{ echo "$as_me:$LINENO: checking for rl_completion_display_matches_hook in -lreadline" >&5 +echo $ECHO_N "checking for rl_completion_display_matches_hook in -lreadline... $ECHO_C" >&6; } if test "${ac_cv_lib_readline_rl_completion_display_matches_hook+set}" = set; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lreadline $READLINE_LIBS $LIBS" @@ -24753,37 +24043,33 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err - } && test -s conftest$ac_exeext && { - test "$cross_compiling" = yes || - $as_test_x conftest$ac_exeext - }; then + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then ac_cv_lib_readline_rl_completion_display_matches_hook=yes else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_readline_rl_completion_display_matches_hook=no fi -rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_readline_rl_completion_display_matches_hook" >&5 -$as_echo "$ac_cv_lib_readline_rl_completion_display_matches_hook" >&6; } -if test "x$ac_cv_lib_readline_rl_completion_display_matches_hook" = x""yes; then +{ echo "$as_me:$LINENO: result: $ac_cv_lib_readline_rl_completion_display_matches_hook" >&5 +echo "${ECHO_T}$ac_cv_lib_readline_rl_completion_display_matches_hook" >&6; } +if test $ac_cv_lib_readline_rl_completion_display_matches_hook = yes; then cat >>confdefs.h <<\_ACEOF #define HAVE_RL_COMPLETION_DISPLAY_MATCHES_HOOK 1 @@ -24793,10 +24079,10 @@ # check for readline 4.2 -{ $as_echo "$as_me:$LINENO: checking for rl_completion_matches in -lreadline" >&5 -$as_echo_n "checking for rl_completion_matches in -lreadline... " >&6; } +{ echo "$as_me:$LINENO: checking for rl_completion_matches in -lreadline" >&5 +echo $ECHO_N "checking for rl_completion_matches in -lreadline... $ECHO_C" >&6; } if test "${ac_cv_lib_readline_rl_completion_matches+set}" = set; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lreadline $READLINE_LIBS $LIBS" @@ -24828,37 +24114,33 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err - } && test -s conftest$ac_exeext && { - test "$cross_compiling" = yes || - $as_test_x conftest$ac_exeext - }; then + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then ac_cv_lib_readline_rl_completion_matches=yes else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_readline_rl_completion_matches=no fi -rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_readline_rl_completion_matches" >&5 -$as_echo "$ac_cv_lib_readline_rl_completion_matches" >&6; } -if test "x$ac_cv_lib_readline_rl_completion_matches" = x""yes; then +{ echo "$as_me:$LINENO: result: $ac_cv_lib_readline_rl_completion_matches" >&5 +echo "${ECHO_T}$ac_cv_lib_readline_rl_completion_matches" >&6; } +if test $ac_cv_lib_readline_rl_completion_matches = yes; then cat >>confdefs.h <<\_ACEOF #define HAVE_RL_COMPLETION_MATCHES 1 @@ -24881,21 +24163,20 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then have_readline=yes else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 have_readline=no @@ -24928,10 +24209,10 @@ # End of readline checks: restore LIBS LIBS=$LIBS_no_readline -{ $as_echo "$as_me:$LINENO: checking for broken nice()" >&5 -$as_echo_n "checking for broken nice()... " >&6; } +{ echo "$as_me:$LINENO: checking for broken nice()" >&5 +echo $ECHO_N "checking for broken nice()... $ECHO_C" >&6; } if test "${ac_cv_broken_nice+set}" = set; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else if test "$cross_compiling" = yes; then @@ -24959,40 +24240,37 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>&5 ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_try") 2>&5 ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_broken_nice=yes else - $as_echo "$as_me: program exited with status $ac_status" >&5 -$as_echo "$as_me: failed program was:" >&5 + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) ac_cv_broken_nice=no fi -rm -rf conftest.dSYM rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_broken_nice" >&5 -$as_echo "$ac_cv_broken_nice" >&6; } +{ echo "$as_me:$LINENO: result: $ac_cv_broken_nice" >&5 +echo "${ECHO_T}$ac_cv_broken_nice" >&6; } if test "$ac_cv_broken_nice" = yes then @@ -25002,8 +24280,8 @@ fi -{ $as_echo "$as_me:$LINENO: checking for broken poll()" >&5 -$as_echo_n "checking for broken poll()... " >&6; } +{ echo "$as_me:$LINENO: checking for broken poll()" >&5 +echo $ECHO_N "checking for broken poll()... $ECHO_C" >&6; } if test "$cross_compiling" = yes; then ac_cv_broken_poll=no else @@ -25045,38 +24323,35 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>&5 ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_try") 2>&5 ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_broken_poll=yes else - $as_echo "$as_me: program exited with status $ac_status" >&5 -$as_echo "$as_me: failed program was:" >&5 + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) ac_cv_broken_poll=no fi -rm -rf conftest.dSYM rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_broken_poll" >&5 -$as_echo "$ac_cv_broken_poll" >&6; } +{ echo "$as_me:$LINENO: result: $ac_cv_broken_poll" >&5 +echo "${ECHO_T}$ac_cv_broken_poll" >&6; } if test "$ac_cv_broken_poll" = yes then @@ -25089,10 +24364,10 @@ # Before we can test tzset, we need to check if struct tm has a tm_zone # (which is not required by ISO C or UNIX spec) and/or if we support # tzname[] -{ $as_echo "$as_me:$LINENO: checking for struct tm.tm_zone" >&5 -$as_echo_n "checking for struct tm.tm_zone... " >&6; } +{ echo "$as_me:$LINENO: checking for struct tm.tm_zone" >&5 +echo $ECHO_N "checking for struct tm.tm_zone... $ECHO_C" >&6; } if test "${ac_cv_member_struct_tm_tm_zone+set}" = set; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ @@ -25120,21 +24395,20 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_member_struct_tm_tm_zone=yes else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 cat >conftest.$ac_ext <<_ACEOF @@ -25163,21 +24437,20 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_member_struct_tm_tm_zone=yes else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_member_struct_tm_tm_zone=no @@ -25188,9 +24461,9 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_member_struct_tm_tm_zone" >&5 -$as_echo "$ac_cv_member_struct_tm_tm_zone" >&6; } -if test "x$ac_cv_member_struct_tm_tm_zone" = x""yes; then +{ echo "$as_me:$LINENO: result: $ac_cv_member_struct_tm_tm_zone" >&5 +echo "${ECHO_T}$ac_cv_member_struct_tm_tm_zone" >&6; } +if test $ac_cv_member_struct_tm_tm_zone = yes; then cat >>confdefs.h <<_ACEOF #define HAVE_STRUCT_TM_TM_ZONE 1 @@ -25206,10 +24479,10 @@ _ACEOF else - { $as_echo "$as_me:$LINENO: checking whether tzname is declared" >&5 -$as_echo_n "checking whether tzname is declared... " >&6; } + { echo "$as_me:$LINENO: checking whether tzname is declared" >&5 +echo $ECHO_N "checking whether tzname is declared... $ECHO_C" >&6; } if test "${ac_cv_have_decl_tzname+set}" = set; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ @@ -25236,21 +24509,20 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_have_decl_tzname=yes else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_have_decl_tzname=no @@ -25258,9 +24530,9 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_have_decl_tzname" >&5 -$as_echo "$ac_cv_have_decl_tzname" >&6; } -if test "x$ac_cv_have_decl_tzname" = x""yes; then +{ echo "$as_me:$LINENO: result: $ac_cv_have_decl_tzname" >&5 +echo "${ECHO_T}$ac_cv_have_decl_tzname" >&6; } +if test $ac_cv_have_decl_tzname = yes; then cat >>confdefs.h <<_ACEOF #define HAVE_DECL_TZNAME 1 @@ -25276,10 +24548,10 @@ fi - { $as_echo "$as_me:$LINENO: checking for tzname" >&5 -$as_echo_n "checking for tzname... " >&6; } + { echo "$as_me:$LINENO: checking for tzname" >&5 +echo $ECHO_N "checking for tzname... $ECHO_C" >&6; } if test "${ac_cv_var_tzname+set}" = set; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ @@ -25306,35 +24578,31 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err - } && test -s conftest$ac_exeext && { - test "$cross_compiling" = yes || - $as_test_x conftest$ac_exeext - }; then + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then ac_cv_var_tzname=yes else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_var_tzname=no fi -rm -rf conftest.dSYM rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_var_tzname" >&5 -$as_echo "$ac_cv_var_tzname" >&6; } +{ echo "$as_me:$LINENO: result: $ac_cv_var_tzname" >&5 +echo "${ECHO_T}$ac_cv_var_tzname" >&6; } if test $ac_cv_var_tzname = yes; then cat >>confdefs.h <<\_ACEOF @@ -25346,10 +24614,10 @@ # check tzset(3) exists and works like we expect it to -{ $as_echo "$as_me:$LINENO: checking for working tzset()" >&5 -$as_echo_n "checking for working tzset()... " >&6; } +{ echo "$as_me:$LINENO: checking for working tzset()" >&5 +echo $ECHO_N "checking for working tzset()... $ECHO_C" >&6; } if test "${ac_cv_working_tzset+set}" = set; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else if test "$cross_compiling" = yes; then @@ -25432,40 +24700,37 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>&5 ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_try") 2>&5 ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_working_tzset=yes else - $as_echo "$as_me: program exited with status $ac_status" >&5 -$as_echo "$as_me: failed program was:" >&5 + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) ac_cv_working_tzset=no fi -rm -rf conftest.dSYM rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_working_tzset" >&5 -$as_echo "$ac_cv_working_tzset" >&6; } +{ echo "$as_me:$LINENO: result: $ac_cv_working_tzset" >&5 +echo "${ECHO_T}$ac_cv_working_tzset" >&6; } if test "$ac_cv_working_tzset" = yes then @@ -25476,10 +24741,10 @@ fi # Look for subsecond timestamps in struct stat -{ $as_echo "$as_me:$LINENO: checking for tv_nsec in struct stat" >&5 -$as_echo_n "checking for tv_nsec in struct stat... " >&6; } +{ echo "$as_me:$LINENO: checking for tv_nsec in struct stat" >&5 +echo $ECHO_N "checking for tv_nsec in struct stat... $ECHO_C" >&6; } if test "${ac_cv_stat_tv_nsec+set}" = set; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ @@ -25505,21 +24770,20 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_stat_tv_nsec=yes else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_stat_tv_nsec=no @@ -25528,8 +24792,8 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_stat_tv_nsec" >&5 -$as_echo "$ac_cv_stat_tv_nsec" >&6; } +{ echo "$as_me:$LINENO: result: $ac_cv_stat_tv_nsec" >&5 +echo "${ECHO_T}$ac_cv_stat_tv_nsec" >&6; } if test "$ac_cv_stat_tv_nsec" = yes then @@ -25540,10 +24804,10 @@ fi # Look for BSD style subsecond timestamps in struct stat -{ $as_echo "$as_me:$LINENO: checking for tv_nsec2 in struct stat" >&5 -$as_echo_n "checking for tv_nsec2 in struct stat... " >&6; } +{ echo "$as_me:$LINENO: checking for tv_nsec2 in struct stat" >&5 +echo $ECHO_N "checking for tv_nsec2 in struct stat... $ECHO_C" >&6; } if test "${ac_cv_stat_tv_nsec2+set}" = set; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ @@ -25569,21 +24833,20 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_stat_tv_nsec2=yes else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_stat_tv_nsec2=no @@ -25592,8 +24855,8 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_stat_tv_nsec2" >&5 -$as_echo "$ac_cv_stat_tv_nsec2" >&6; } +{ echo "$as_me:$LINENO: result: $ac_cv_stat_tv_nsec2" >&5 +echo "${ECHO_T}$ac_cv_stat_tv_nsec2" >&6; } if test "$ac_cv_stat_tv_nsec2" = yes then @@ -25604,10 +24867,10 @@ fi # On HP/UX 11.0, mvwdelch is a block with a return statement -{ $as_echo "$as_me:$LINENO: checking whether mvwdelch is an expression" >&5 -$as_echo_n "checking whether mvwdelch is an expression... " >&6; } +{ echo "$as_me:$LINENO: checking whether mvwdelch is an expression" >&5 +echo $ECHO_N "checking whether mvwdelch is an expression... $ECHO_C" >&6; } if test "${ac_cv_mvwdelch_is_expression+set}" = set; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ @@ -25633,21 +24896,20 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_mvwdelch_is_expression=yes else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_mvwdelch_is_expression=no @@ -25656,8 +24918,8 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_mvwdelch_is_expression" >&5 -$as_echo "$ac_cv_mvwdelch_is_expression" >&6; } +{ echo "$as_me:$LINENO: result: $ac_cv_mvwdelch_is_expression" >&5 +echo "${ECHO_T}$ac_cv_mvwdelch_is_expression" >&6; } if test "$ac_cv_mvwdelch_is_expression" = yes then @@ -25668,10 +24930,10 @@ fi -{ $as_echo "$as_me:$LINENO: checking whether WINDOW has _flags" >&5 -$as_echo_n "checking whether WINDOW has _flags... " >&6; } +{ echo "$as_me:$LINENO: checking whether WINDOW has _flags" >&5 +echo $ECHO_N "checking whether WINDOW has _flags... $ECHO_C" >&6; } if test "${ac_cv_window_has_flags+set}" = set; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ @@ -25697,21 +24959,20 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_window_has_flags=yes else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_window_has_flags=no @@ -25720,8 +24981,8 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_window_has_flags" >&5 -$as_echo "$ac_cv_window_has_flags" >&6; } +{ echo "$as_me:$LINENO: result: $ac_cv_window_has_flags" >&5 +echo "${ECHO_T}$ac_cv_window_has_flags" >&6; } if test "$ac_cv_window_has_flags" = yes @@ -25733,8 +24994,8 @@ fi -{ $as_echo "$as_me:$LINENO: checking for is_term_resized" >&5 -$as_echo_n "checking for is_term_resized... " >&6; } +{ echo "$as_me:$LINENO: checking for is_term_resized" >&5 +echo $ECHO_N "checking for is_term_resized... $ECHO_C" >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF @@ -25756,14 +25017,13 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err @@ -25773,21 +25033,21 @@ #define HAVE_CURSES_IS_TERM_RESIZED 1 _ACEOF - { $as_echo "$as_me:$LINENO: result: yes" >&5 -$as_echo "yes" >&6; } + { echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; } else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 - { $as_echo "$as_me:$LINENO: result: no" >&5 -$as_echo "no" >&6; } + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -{ $as_echo "$as_me:$LINENO: checking for resize_term" >&5 -$as_echo_n "checking for resize_term... " >&6; } +{ echo "$as_me:$LINENO: checking for resize_term" >&5 +echo $ECHO_N "checking for resize_term... $ECHO_C" >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF @@ -25809,14 +25069,13 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err @@ -25826,21 +25085,21 @@ #define HAVE_CURSES_RESIZE_TERM 1 _ACEOF - { $as_echo "$as_me:$LINENO: result: yes" >&5 -$as_echo "yes" >&6; } + { echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; } else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 - { $as_echo "$as_me:$LINENO: result: no" >&5 -$as_echo "no" >&6; } + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -{ $as_echo "$as_me:$LINENO: checking for resizeterm" >&5 -$as_echo_n "checking for resizeterm... " >&6; } +{ echo "$as_me:$LINENO: checking for resizeterm" >&5 +echo $ECHO_N "checking for resizeterm... $ECHO_C" >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF @@ -25862,14 +25121,13 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err @@ -25879,63 +25137,61 @@ #define HAVE_CURSES_RESIZETERM 1 _ACEOF - { $as_echo "$as_me:$LINENO: result: yes" >&5 -$as_echo "yes" >&6; } + { echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; } else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 - { $as_echo "$as_me:$LINENO: result: no" >&5 -$as_echo "no" >&6; } + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -{ $as_echo "$as_me:$LINENO: checking for /dev/ptmx" >&5 -$as_echo_n "checking for /dev/ptmx... " >&6; } +{ echo "$as_me:$LINENO: checking for /dev/ptmx" >&5 +echo $ECHO_N "checking for /dev/ptmx... $ECHO_C" >&6; } if test -r /dev/ptmx then - { $as_echo "$as_me:$LINENO: result: yes" >&5 -$as_echo "yes" >&6; } + { echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; } cat >>confdefs.h <<\_ACEOF #define HAVE_DEV_PTMX 1 _ACEOF else - { $as_echo "$as_me:$LINENO: result: no" >&5 -$as_echo "no" >&6; } + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } fi -{ $as_echo "$as_me:$LINENO: checking for /dev/ptc" >&5 -$as_echo_n "checking for /dev/ptc... " >&6; } +{ echo "$as_me:$LINENO: checking for /dev/ptc" >&5 +echo $ECHO_N "checking for /dev/ptc... $ECHO_C" >&6; } if test -r /dev/ptc then - { $as_echo "$as_me:$LINENO: result: yes" >&5 -$as_echo "yes" >&6; } + { echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; } cat >>confdefs.h <<\_ACEOF #define HAVE_DEV_PTC 1 _ACEOF else - { $as_echo "$as_me:$LINENO: result: no" >&5 -$as_echo "no" >&6; } + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } fi -{ $as_echo "$as_me:$LINENO: checking for %zd printf() format support" >&5 -$as_echo_n "checking for %zd printf() format support... " >&6; } +{ echo "$as_me:$LINENO: checking for %zd printf() format support" >&5 +echo $ECHO_N "checking for %zd printf() format support... $ECHO_C" >&6; } if test "$cross_compiling" = yes; then - { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -{ { $as_echo "$as_me:$LINENO: error: cannot run test program while cross compiling + { { echo "$as_me:$LINENO: error: cannot run test program while cross compiling See \`config.log' for more details." >&5 -$as_echo "$as_me: error: cannot run test program while cross compiling +echo "$as_me: error: cannot run test program while cross compiling See \`config.log' for more details." >&2;} - { (exit 1); exit 1; }; }; } + { (exit 1); exit 1; }; } else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ @@ -25984,92 +25240,46 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>&5 ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_try") 2>&5 ac_status=$? - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - { $as_echo "$as_me:$LINENO: result: yes" >&5 -$as_echo "yes" >&6; } + { echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; } cat >>confdefs.h <<\_ACEOF #define PY_FORMAT_SIZE_T "z" _ACEOF else - $as_echo "$as_me: program exited with status $ac_status" >&5 -$as_echo "$as_me: failed program was:" >&5 + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) -{ $as_echo "$as_me:$LINENO: result: no" >&5 -$as_echo "no" >&6; } +{ echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } fi -rm -rf conftest.dSYM rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi -{ $as_echo "$as_me:$LINENO: checking for socklen_t" >&5 -$as_echo_n "checking for socklen_t... " >&6; } +{ echo "$as_me:$LINENO: checking for socklen_t" >&5 +echo $ECHO_N "checking for socklen_t... $ECHO_C" >&6; } if test "${ac_cv_type_socklen_t+set}" = set; then - $as_echo_n "(cached) " >&6 + echo $ECHO_N "(cached) $ECHO_C" >&6 else - ac_cv_type_socklen_t=no -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -#ifdef HAVE_SYS_TYPES_H -#include -#endif -#ifdef HAVE_SYS_SOCKET_H -#include -#endif - - -int -main () -{ -if (sizeof (socklen_t)) - return 0; - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF @@ -26085,11 +25295,14 @@ #endif +typedef socklen_t ac__type_new_; int main () { -if (sizeof ((socklen_t))) - return 0; +if ((ac__type_new_ *) 0) + return 0; +if (sizeof (ac__type_new_)) + return 0; ; return 0; } @@ -26100,39 +25313,30 @@ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" -$as_echo "$ac_try_echo") >&5 +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then - : -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_cv_type_socklen_t=yes -fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + ac_cv_type_socklen_t=yes else - $as_echo "$as_me: failed program was:" >&5 + echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 - + ac_cv_type_socklen_t=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi -{ $as_echo "$as_me:$LINENO: result: $ac_cv_type_socklen_t" >&5 -$as_echo "$ac_cv_type_socklen_t" >&6; } -if test "x$ac_cv_type_socklen_t" = x""yes; then +{ echo "$as_me:$LINENO: result: $ac_cv_type_socklen_t" >&5 +echo "${ECHO_T}$ac_cv_type_socklen_t" >&6; } +if test $ac_cv_type_socklen_t = yes; then : else @@ -26152,15 +25356,15 @@ SRCDIRS="Parser Grammar Objects Python Modules Mac" -{ $as_echo "$as_me:$LINENO: checking for build directories" >&5 -$as_echo_n "checking for build directories... " >&6; } +{ echo "$as_me:$LINENO: checking for build directories" >&5 +echo $ECHO_N "checking for build directories... $ECHO_C" >&6; } for dir in $SRCDIRS; do if test ! -d $dir; then mkdir $dir fi done -{ $as_echo "$as_me:$LINENO: result: done" >&5 -$as_echo "done" >&6; } +{ echo "$as_me:$LINENO: result: done" >&5 +echo "${ECHO_T}done" >&6; } # generate output files ac_config_files="$ac_config_files Makefile.pre Modules/Setup.config Misc/python.pc" @@ -26192,12 +25396,11 @@ case $ac_val in #( *${as_nl}*) case $ac_var in #( - *_cv_*) { $as_echo "$as_me:$LINENO: WARNING: cache variable $ac_var contains a newline" >&5 -$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; + *_cv_*) { echo "$as_me:$LINENO: WARNING: Cache variable $ac_var contains a newline." >&5 +echo "$as_me: WARNING: Cache variable $ac_var contains a newline." >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( - BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( *) $as_unset $ac_var ;; esac ;; esac @@ -26230,12 +25433,12 @@ if diff "$cache_file" confcache >/dev/null 2>&1; then :; else if test -w "$cache_file"; then test "x$cache_file" != "x/dev/null" && - { $as_echo "$as_me:$LINENO: updating cache $cache_file" >&5 -$as_echo "$as_me: updating cache $cache_file" >&6;} + { echo "$as_me:$LINENO: updating cache $cache_file" >&5 +echo "$as_me: updating cache $cache_file" >&6;} cat confcache >$cache_file else - { $as_echo "$as_me:$LINENO: not updating unwritable cache $cache_file" >&5 -$as_echo "$as_me: not updating unwritable cache $cache_file" >&6;} + { echo "$as_me:$LINENO: not updating unwritable cache $cache_file" >&5 +echo "$as_me: not updating unwritable cache $cache_file" >&6;} fi fi rm -f confcache @@ -26251,7 +25454,7 @@ for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue # 1. Remove the extension, and $U if already installed. ac_script='s/\$U\././;s/\.o$//;s/\.obj$//' - ac_i=`$as_echo "$ac_i" | sed "$ac_script"` + ac_i=`echo "$ac_i" | sed "$ac_script"` # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR # will be set to the directory where LIBOBJS objects are built. ac_libobjs="$ac_libobjs \${LIBOBJDIR}$ac_i\$U.$ac_objext" @@ -26263,14 +25466,12 @@ - : ${CONFIG_STATUS=./config.status} -ac_write_fail=0 ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files $CONFIG_STATUS" -{ $as_echo "$as_me:$LINENO: creating $CONFIG_STATUS" >&5 -$as_echo "$as_me: creating $CONFIG_STATUS" >&6;} -cat >$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +{ echo "$as_me:$LINENO: creating $CONFIG_STATUS" >&5 +echo "$as_me: creating $CONFIG_STATUS" >&6;} +cat >$CONFIG_STATUS <<_ACEOF #! $SHELL # Generated by $as_me. # Run this file to recreate the current configuration. @@ -26283,7 +25484,7 @@ SHELL=\${CONFIG_SHELL-$SHELL} _ACEOF -cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +cat >>$CONFIG_STATUS <<\_ACEOF ## --------------------- ## ## M4sh Initialization. ## ## --------------------- ## @@ -26293,7 +25494,7 @@ if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: - # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which + # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST @@ -26315,45 +25516,17 @@ as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits -as_nl=' -' -export as_nl -# Printing a long string crashes Solaris 7 /usr/bin/printf. -as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' -as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo -as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo -if (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then - as_echo='printf %s\n' - as_echo_n='printf %s' -else - if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then - as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' - as_echo_n='/usr/ucb/echo -n' - else - as_echo_body='eval expr "X$1" : "X\\(.*\\)"' - as_echo_n_body='eval - arg=$1; - case $arg in - *"$as_nl"*) - expr "X$arg" : "X\\(.*\\)$as_nl"; - arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; - esac; - expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" - ' - export as_echo_n_body - as_echo_n='sh -c $as_echo_n_body as_echo' - fi - export as_echo_body - as_echo='sh -c $as_echo_body as_echo' -fi - # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then - PATH_SEPARATOR=: - (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { - (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || - PATH_SEPARATOR=';' - } + echo "#! /bin/sh" >conf$$.sh + echo "exit 0" >>conf$$.sh + chmod +x conf$$.sh + if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then + PATH_SEPARATOR=';' + else + PATH_SEPARATOR=: + fi + rm -f conf$$.sh fi # Support unset when possible. @@ -26369,6 +25542,8 @@ # there to prevent editors from complaining about space-tab. # (If _AS_PATH_WALK were called with IFS unset, it would disable word # splitting by setting IFS to empty value.) +as_nl=' +' IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. @@ -26391,7 +25566,7 @@ as_myself=$0 fi if test ! -f "$as_myself"; then - $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 + echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 { (exit 1); exit 1; } fi @@ -26404,10 +25579,17 @@ PS4='+ ' # NLS nuisances. -LC_ALL=C -export LC_ALL -LANGUAGE=C -export LANGUAGE +for as_var in \ + LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ + LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ + LC_TELEPHONE LC_TIME +do + if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then + eval $as_var=C; export $as_var + else + ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var + fi +done # Required to use basename. if expr a : '\(a\)' >/dev/null 2>&1 && @@ -26429,7 +25611,7 @@ $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X/"$0" | +echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q @@ -26480,7 +25662,7 @@ s/-\n.*// ' >$as_me.lineno && chmod +x "$as_me.lineno" || - { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2 + { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2 { (exit 1); exit 1; }; } # Don't try to exec as it changes $[0], causing all sort of problems @@ -26508,6 +25690,7 @@ *) ECHO_N='-n';; esac + if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr @@ -26520,22 +25703,19 @@ rm -f conf$$.dir/conf$$.file else rm -f conf$$.dir - mkdir conf$$.dir 2>/dev/null + mkdir conf$$.dir fi -if (echo >conf$$.file) 2>/dev/null; then - if ln -s conf$$.file conf$$ 2>/dev/null; then - as_ln_s='ln -s' - # ... but there are two gotchas: - # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. - # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. - # In both cases, we have to default to `cp -p'. - ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || - as_ln_s='cp -p' - elif ln conf$$.file conf$$ 2>/dev/null; then - as_ln_s=ln - else +echo >conf$$.file +if ln -s conf$$.file conf$$ 2>/dev/null; then + as_ln_s='ln -s' + # ... but there are two gotchas: + # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. + # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. + # In both cases, we have to default to `cp -p'. + ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || as_ln_s='cp -p' - fi +elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln else as_ln_s='cp -p' fi @@ -26560,10 +25740,10 @@ as_test_x=' eval sh -c '\'' if test -d "$1"; then - test -d "$1/."; + test -d "$1/."; else case $1 in - -*)set "./$1";; + -*)set "./$1";; esac; case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in ???[sx]*):;;*)false;;esac;fi @@ -26586,7 +25766,7 @@ # values after options handling. ac_log=" This file was extended by python $as_me 2.7, which was -generated by GNU Autoconf 2.63. Invocation command line was +generated by GNU Autoconf 2.61. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS @@ -26599,39 +25779,29 @@ _ACEOF -case $ac_config_files in *" -"*) set x $ac_config_files; shift; ac_config_files=$*;; -esac - -case $ac_config_headers in *" -"*) set x $ac_config_headers; shift; ac_config_headers=$*;; -esac - - -cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +cat >>$CONFIG_STATUS <<_ACEOF # Files that config.status was made for. -config_files="`echo $ac_config_files`" -config_headers="`echo $ac_config_headers`" +config_files="$ac_config_files" +config_headers="$ac_config_headers" _ACEOF -cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +cat >>$CONFIG_STATUS <<\_ACEOF ac_cs_usage="\ \`$as_me' instantiates files from templates according to the current configuration. -Usage: $0 [OPTION]... [FILE]... +Usage: $0 [OPTIONS] [FILE]... -h, --help print this help, then exit -V, --version print version number and configuration settings, then exit - -q, --quiet, --silent - do not print progress messages + -q, --quiet do not print progress messages -d, --debug don't remove temporary files --recheck update $as_me by reconfiguring in the same conditions - --file=FILE[:TEMPLATE] - instantiate the configuration file FILE - --header=FILE[:TEMPLATE] - instantiate the configuration header FILE + --file=FILE[:TEMPLATE] + instantiate the configuration file FILE + --header=FILE[:TEMPLATE] + instantiate the configuration header FILE Configuration files: $config_files @@ -26642,24 +25812,24 @@ Report bugs to ." _ACEOF -cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +cat >>$CONFIG_STATUS <<_ACEOF ac_cs_version="\\ python config.status 2.7 -configured by $0, generated by GNU Autoconf 2.63, - with options \\"`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\" +configured by $0, generated by GNU Autoconf 2.61, + with options \\"`echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\" -Copyright (C) 2008 Free Software Foundation, Inc. +Copyright (C) 2006 Free Software Foundation, Inc. This config.status script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it." ac_pwd='$ac_pwd' srcdir='$srcdir' INSTALL='$INSTALL' -test -n "\$AWK" || AWK=awk _ACEOF -cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 -# The default lists apply if the user does not specify any file. +cat >>$CONFIG_STATUS <<\_ACEOF +# If no file are specified by the user, then we need to provide default +# value. By we need to know if files were specified by the user. ac_need_defaults=: while test $# != 0 do @@ -26681,36 +25851,30 @@ -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) ac_cs_recheck=: ;; --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) - $as_echo "$ac_cs_version"; exit ;; + echo "$ac_cs_version"; exit ;; --debug | --debu | --deb | --de | --d | -d ) debug=: ;; --file | --fil | --fi | --f ) $ac_shift - case $ac_optarg in - *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; - esac - CONFIG_FILES="$CONFIG_FILES '$ac_optarg'" + CONFIG_FILES="$CONFIG_FILES $ac_optarg" ac_need_defaults=false;; --header | --heade | --head | --hea ) $ac_shift - case $ac_optarg in - *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; - esac - CONFIG_HEADERS="$CONFIG_HEADERS '$ac_optarg'" + CONFIG_HEADERS="$CONFIG_HEADERS $ac_optarg" ac_need_defaults=false;; --he | --h) # Conflict between --help and --header - { $as_echo "$as_me: error: ambiguous option: $1 + { echo "$as_me: error: ambiguous option: $1 Try \`$0 --help' for more information." >&2 { (exit 1); exit 1; }; };; --help | --hel | -h ) - $as_echo "$ac_cs_usage"; exit ;; + echo "$ac_cs_usage"; exit ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil | --si | --s) ac_cs_silent=: ;; # This is an error. - -*) { $as_echo "$as_me: error: unrecognized option: $1 + -*) { echo "$as_me: error: unrecognized option: $1 Try \`$0 --help' for more information." >&2 { (exit 1); exit 1; }; } ;; @@ -26729,32 +25893,30 @@ fi _ACEOF -cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +cat >>$CONFIG_STATUS <<_ACEOF if \$ac_cs_recheck; then - set X '$SHELL' '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion - shift - \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6 - CONFIG_SHELL='$SHELL' + echo "running CONFIG_SHELL=$SHELL $SHELL $0 "$ac_configure_args \$ac_configure_extra_args " --no-create --no-recursion" >&6 + CONFIG_SHELL=$SHELL export CONFIG_SHELL - exec "\$@" + exec $SHELL "$0"$ac_configure_args \$ac_configure_extra_args --no-create --no-recursion fi _ACEOF -cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +cat >>$CONFIG_STATUS <<\_ACEOF exec 5>>config.log { echo sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX ## Running $as_me. ## _ASBOX - $as_echo "$ac_log" + echo "$ac_log" } >&5 _ACEOF -cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +cat >>$CONFIG_STATUS <<_ACEOF _ACEOF -cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +cat >>$CONFIG_STATUS <<\_ACEOF # Handling of arguments. for ac_config_target in $ac_config_targets @@ -26770,8 +25932,8 @@ "Modules/Setup.config") CONFIG_FILES="$CONFIG_FILES Modules/Setup.config" ;; "Misc/python.pc") CONFIG_FILES="$CONFIG_FILES Misc/python.pc" ;; - *) { { $as_echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5 -$as_echo "$as_me: error: invalid argument: $ac_config_target" >&2;} + *) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5 +echo "$as_me: error: invalid argument: $ac_config_target" >&2;} { (exit 1); exit 1; }; };; esac done @@ -26811,145 +25973,227 @@ (umask 077 && mkdir "$tmp") } || { - $as_echo "$as_me: cannot create a temporary directory in ." >&2 + echo "$me: cannot create a temporary directory in ." >&2 { (exit 1); exit 1; } } -# Set up the scripts for CONFIG_FILES section. -# No need to generate them if there are no CONFIG_FILES. -# This happens for instance with `./config.status config.h'. -if test -n "$CONFIG_FILES"; then - +# +# Set up the sed scripts for CONFIG_FILES section. +# -ac_cr=' -' -ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' /dev/null` -if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then - ac_cs_awk_cr='\\r' -else - ac_cs_awk_cr=$ac_cr -fi +# No need to generate the scripts if there are no CONFIG_FILES. +# This happens for instance when ./config.status config.h +if test -n "$CONFIG_FILES"; then -echo 'BEGIN {' >"$tmp/subs1.awk" && _ACEOF -{ - echo "cat >conf$$subs.awk <<_ACEOF" && - echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' && - echo "_ACEOF" -} >conf$$subs.sh || - { { $as_echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5 -$as_echo "$as_me: error: could not make $CONFIG_STATUS" >&2;} - { (exit 1); exit 1; }; } -ac_delim_num=`echo "$ac_subst_vars" | grep -c '$'` + ac_delim='%!_!# ' for ac_last_try in false false false false false :; do - . ./conf$$subs.sh || - { { $as_echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5 -$as_echo "$as_me: error: could not make $CONFIG_STATUS" >&2;} - { (exit 1); exit 1; }; } + cat >conf$$subs.sed <<_ACEOF +SHELL!$SHELL$ac_delim +PATH_SEPARATOR!$PATH_SEPARATOR$ac_delim +PACKAGE_NAME!$PACKAGE_NAME$ac_delim +PACKAGE_TARNAME!$PACKAGE_TARNAME$ac_delim +PACKAGE_VERSION!$PACKAGE_VERSION$ac_delim +PACKAGE_STRING!$PACKAGE_STRING$ac_delim +PACKAGE_BUGREPORT!$PACKAGE_BUGREPORT$ac_delim +exec_prefix!$exec_prefix$ac_delim +prefix!$prefix$ac_delim +program_transform_name!$program_transform_name$ac_delim +bindir!$bindir$ac_delim +sbindir!$sbindir$ac_delim +libexecdir!$libexecdir$ac_delim +datarootdir!$datarootdir$ac_delim +datadir!$datadir$ac_delim +sysconfdir!$sysconfdir$ac_delim +sharedstatedir!$sharedstatedir$ac_delim +localstatedir!$localstatedir$ac_delim +includedir!$includedir$ac_delim +oldincludedir!$oldincludedir$ac_delim +docdir!$docdir$ac_delim +infodir!$infodir$ac_delim +htmldir!$htmldir$ac_delim +dvidir!$dvidir$ac_delim +pdfdir!$pdfdir$ac_delim +psdir!$psdir$ac_delim +libdir!$libdir$ac_delim +localedir!$localedir$ac_delim +mandir!$mandir$ac_delim +DEFS!$DEFS$ac_delim +ECHO_C!$ECHO_C$ac_delim +ECHO_N!$ECHO_N$ac_delim +ECHO_T!$ECHO_T$ac_delim +LIBS!$LIBS$ac_delim +build_alias!$build_alias$ac_delim +host_alias!$host_alias$ac_delim +target_alias!$target_alias$ac_delim +VERSION!$VERSION$ac_delim +SOVERSION!$SOVERSION$ac_delim +CONFIG_ARGS!$CONFIG_ARGS$ac_delim +UNIVERSALSDK!$UNIVERSALSDK$ac_delim +ARCH_RUN_32BIT!$ARCH_RUN_32BIT$ac_delim +PYTHONFRAMEWORK!$PYTHONFRAMEWORK$ac_delim +PYTHONFRAMEWORKIDENTIFIER!$PYTHONFRAMEWORKIDENTIFIER$ac_delim +PYTHONFRAMEWORKDIR!$PYTHONFRAMEWORKDIR$ac_delim +PYTHONFRAMEWORKPREFIX!$PYTHONFRAMEWORKPREFIX$ac_delim +PYTHONFRAMEWORKINSTALLDIR!$PYTHONFRAMEWORKINSTALLDIR$ac_delim +FRAMEWORKINSTALLFIRST!$FRAMEWORKINSTALLFIRST$ac_delim +FRAMEWORKINSTALLLAST!$FRAMEWORKINSTALLLAST$ac_delim +FRAMEWORKALTINSTALLFIRST!$FRAMEWORKALTINSTALLFIRST$ac_delim +FRAMEWORKALTINSTALLLAST!$FRAMEWORKALTINSTALLLAST$ac_delim +FRAMEWORKUNIXTOOLSPREFIX!$FRAMEWORKUNIXTOOLSPREFIX$ac_delim +MACHDEP!$MACHDEP$ac_delim +SGI_ABI!$SGI_ABI$ac_delim +EXTRAPLATDIR!$EXTRAPLATDIR$ac_delim +EXTRAMACHDEPPATH!$EXTRAMACHDEPPATH$ac_delim +CONFIGURE_MACOSX_DEPLOYMENT_TARGET!$CONFIGURE_MACOSX_DEPLOYMENT_TARGET$ac_delim +EXPORT_MACOSX_DEPLOYMENT_TARGET!$EXPORT_MACOSX_DEPLOYMENT_TARGET$ac_delim +CC!$CC$ac_delim +CFLAGS!$CFLAGS$ac_delim +LDFLAGS!$LDFLAGS$ac_delim +CPPFLAGS!$CPPFLAGS$ac_delim +ac_ct_CC!$ac_ct_CC$ac_delim +EXEEXT!$EXEEXT$ac_delim +OBJEXT!$OBJEXT$ac_delim +CXX!$CXX$ac_delim +MAINCC!$MAINCC$ac_delim +CPP!$CPP$ac_delim +GREP!$GREP$ac_delim +EGREP!$EGREP$ac_delim +BUILDEXEEXT!$BUILDEXEEXT$ac_delim +LIBRARY!$LIBRARY$ac_delim +LDLIBRARY!$LDLIBRARY$ac_delim +DLLLIBRARY!$DLLLIBRARY$ac_delim +BLDLIBRARY!$BLDLIBRARY$ac_delim +LDLIBRARYDIR!$LDLIBRARYDIR$ac_delim +INSTSONAME!$INSTSONAME$ac_delim +RUNSHARED!$RUNSHARED$ac_delim +LINKCC!$LINKCC$ac_delim +GNULD!$GNULD$ac_delim +RANLIB!$RANLIB$ac_delim +AR!$AR$ac_delim +ARFLAGS!$ARFLAGS$ac_delim +SVNVERSION!$SVNVERSION$ac_delim +INSTALL_PROGRAM!$INSTALL_PROGRAM$ac_delim +INSTALL_SCRIPT!$INSTALL_SCRIPT$ac_delim +INSTALL_DATA!$INSTALL_DATA$ac_delim +LN!$LN$ac_delim +OPT!$OPT$ac_delim +BASECFLAGS!$BASECFLAGS$ac_delim +UNIVERSAL_ARCH_FLAGS!$UNIVERSAL_ARCH_FLAGS$ac_delim +OTHER_LIBTOOL_OPT!$OTHER_LIBTOOL_OPT$ac_delim +LIBTOOL_CRUFT!$LIBTOOL_CRUFT$ac_delim +SO!$SO$ac_delim +LDSHARED!$LDSHARED$ac_delim +BLDSHARED!$BLDSHARED$ac_delim +CCSHARED!$CCSHARED$ac_delim +_ACEOF - ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X` - if test $ac_delim_n = $ac_delim_num; then + if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 97; then break elif $ac_last_try; then - { { $as_echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5 -$as_echo "$as_me: error: could not make $CONFIG_STATUS" >&2;} + { { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5 +echo "$as_me: error: could not make $CONFIG_STATUS" >&2;} { (exit 1); exit 1; }; } else ac_delim="$ac_delim!$ac_delim _$ac_delim!! " fi done -rm -f conf$$subs.sh -cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 -cat >>"\$tmp/subs1.awk" <<\\_ACAWK && -_ACEOF -sed -n ' -h -s/^/S["/; s/!.*/"]=/ -p -g -s/^[^!]*!// -:repl -t repl -s/'"$ac_delim"'$// -t delim -:nl -h -s/\(.\{148\}\).*/\1/ -t more1 -s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/ -p -n -b repl -:more1 -s/["\\]/\\&/g; s/^/"/; s/$/"\\/ -p -g -s/.\{148\}// -t nl -:delim -h -s/\(.\{148\}\).*/\1/ -t more2 -s/["\\]/\\&/g; s/^/"/; s/$/"/ -p -b -:more2 -s/["\\]/\\&/g; s/^/"/; s/$/"\\/ -p -g -s/.\{148\}// -t delim -' >$CONFIG_STATUS || ac_write_fail=1 -rm -f conf$$subs.awk -cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 -_ACAWK -cat >>"\$tmp/subs1.awk" <<_ACAWK && - for (key in S) S_is_set[key] = 1 - FS = "" +ac_eof=`sed -n '/^CEOF[0-9]*$/s/CEOF/0/p' conf$$subs.sed` +if test -n "$ac_eof"; then + ac_eof=`echo "$ac_eof" | sort -nru | sed 1q` + ac_eof=`expr $ac_eof + 1` +fi -} -{ - line = $ 0 - nfields = split(line, field, "@") - substed = 0 - len = length(field[1]) - for (i = 2; i < nfields; i++) { - key = field[i] - keylen = length(key) - if (S_is_set[key]) { - value = S[key] - line = substr(line, 1, len) "" value "" substr(line, len + keylen + 3) - len += length(value) + length(field[++i]) - substed = 1 - } else - len += 1 + keylen - } +cat >>$CONFIG_STATUS <<_ACEOF +cat >"\$tmp/subs-1.sed" <<\CEOF$ac_eof +/@[a-zA-Z_][a-zA-Z_0-9]*@/!b +_ACEOF +sed ' +s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g +s/^/s,@/; s/!/@,|#_!!_#|/ +:n +t n +s/'"$ac_delim"'$/,g/; t +s/$/\\/; p +N; s/^.*\n//; s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g; b n +' >>$CONFIG_STATUS >$CONFIG_STATUS <<_ACEOF +CEOF$ac_eof +_ACEOF - print line -} -_ACAWK +ac_delim='%!_!# ' +for ac_last_try in false false false false false :; do + cat >conf$$subs.sed <<_ACEOF +LINKFORSHARED!$LINKFORSHARED$ac_delim +CFLAGSFORSHARED!$CFLAGSFORSHARED$ac_delim +SHLIBS!$SHLIBS$ac_delim +USE_SIGNAL_MODULE!$USE_SIGNAL_MODULE$ac_delim +SIGNAL_OBJS!$SIGNAL_OBJS$ac_delim +USE_THREAD_MODULE!$USE_THREAD_MODULE$ac_delim +LDLAST!$LDLAST$ac_delim +THREADOBJ!$THREADOBJ$ac_delim +DLINCLDIR!$DLINCLDIR$ac_delim +DYNLOADFILE!$DYNLOADFILE$ac_delim +MACHDEP_OBJS!$MACHDEP_OBJS$ac_delim +TRUE!$TRUE$ac_delim +LIBOBJS!$LIBOBJS$ac_delim +HAVE_GETHOSTBYNAME_R_6_ARG!$HAVE_GETHOSTBYNAME_R_6_ARG$ac_delim +HAVE_GETHOSTBYNAME_R_5_ARG!$HAVE_GETHOSTBYNAME_R_5_ARG$ac_delim +HAVE_GETHOSTBYNAME_R_3_ARG!$HAVE_GETHOSTBYNAME_R_3_ARG$ac_delim +HAVE_GETHOSTBYNAME_R!$HAVE_GETHOSTBYNAME_R$ac_delim +HAVE_GETHOSTBYNAME!$HAVE_GETHOSTBYNAME$ac_delim +LIBM!$LIBM$ac_delim +LIBC!$LIBC$ac_delim +UNICODE_OBJS!$UNICODE_OBJS$ac_delim +THREADHEADERS!$THREADHEADERS$ac_delim +SRCDIRS!$SRCDIRS$ac_delim +LTLIBOBJS!$LTLIBOBJS$ac_delim _ACEOF -cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 -if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then - sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g" -else - cat -fi < "$tmp/subs1.awk" > "$tmp/subs.awk" \ - || { { $as_echo "$as_me:$LINENO: error: could not setup config files machinery" >&5 -$as_echo "$as_me: error: could not setup config files machinery" >&2;} + + if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 24; then + break + elif $ac_last_try; then + { { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5 +echo "$as_me: error: could not make $CONFIG_STATUS" >&2;} { (exit 1); exit 1; }; } + else + ac_delim="$ac_delim!$ac_delim _$ac_delim!! " + fi +done + +ac_eof=`sed -n '/^CEOF[0-9]*$/s/CEOF/0/p' conf$$subs.sed` +if test -n "$ac_eof"; then + ac_eof=`echo "$ac_eof" | sort -nru | sed 1q` + ac_eof=`expr $ac_eof + 1` +fi + +cat >>$CONFIG_STATUS <<_ACEOF +cat >"\$tmp/subs-2.sed" <<\CEOF$ac_eof +/@[a-zA-Z_][a-zA-Z_0-9]*@/!b end +_ACEOF +sed ' +s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g +s/^/s,@/; s/!/@,|#_!!_#|/ +:n +t n +s/'"$ac_delim"'$/,g/; t +s/$/\\/; p +N; s/^.*\n//; s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g; b n +' >>$CONFIG_STATUS >$CONFIG_STATUS <<_ACEOF +:end +s/|#_!!_#|//g +CEOF$ac_eof _ACEOF + # VPATH may cause trouble with some makes, so we remove $(srcdir), # ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and # trailing colons and then remove the whole line if VPATH becomes empty @@ -26965,133 +26209,19 @@ }' fi -cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +cat >>$CONFIG_STATUS <<\_ACEOF fi # test -n "$CONFIG_FILES" -# Set up the scripts for CONFIG_HEADERS section. -# No need to generate them if there are no CONFIG_HEADERS. -# This happens for instance with `./config.status Makefile'. -if test -n "$CONFIG_HEADERS"; then -cat >"$tmp/defines.awk" <<\_ACAWK || -BEGIN { -_ACEOF - -# Transform confdefs.h into an awk script `defines.awk', embedded as -# here-document in config.status, that substitutes the proper values into -# config.h.in to produce config.h. - -# Create a delimiter string that does not exist in confdefs.h, to ease -# handling of long lines. -ac_delim='%!_!# ' -for ac_last_try in false false :; do - ac_t=`sed -n "/$ac_delim/p" confdefs.h` - if test -z "$ac_t"; then - break - elif $ac_last_try; then - { { $as_echo "$as_me:$LINENO: error: could not make $CONFIG_HEADERS" >&5 -$as_echo "$as_me: error: could not make $CONFIG_HEADERS" >&2;} - { (exit 1); exit 1; }; } - else - ac_delim="$ac_delim!$ac_delim _$ac_delim!! " - fi -done - -# For the awk script, D is an array of macro values keyed by name, -# likewise P contains macro parameters if any. Preserve backslash -# newline sequences. - -ac_word_re=[_$as_cr_Letters][_$as_cr_alnum]* -sed -n ' -s/.\{148\}/&'"$ac_delim"'/g -t rset -:rset -s/^[ ]*#[ ]*define[ ][ ]*/ / -t def -d -:def -s/\\$// -t bsnl -s/["\\]/\\&/g -s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ -D["\1"]=" \3"/p -s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2"/p -d -:bsnl -s/["\\]/\\&/g -s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ -D["\1"]=" \3\\\\\\n"\\/p -t cont -s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2\\\\\\n"\\/p -t cont -d -:cont -n -s/.\{148\}/&'"$ac_delim"'/g -t clear -:clear -s/\\$// -t bsnlc -s/["\\]/\\&/g; s/^/"/; s/$/"/p -d -:bsnlc -s/["\\]/\\&/g; s/^/"/; s/$/\\\\\\n"\\/p -b cont -' >$CONFIG_STATUS || ac_write_fail=1 - -cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 - for (key in D) D_is_set[key] = 1 - FS = "" -} -/^[\t ]*#[\t ]*(define|undef)[\t ]+$ac_word_re([\t (]|\$)/ { - line = \$ 0 - split(line, arg, " ") - if (arg[1] == "#") { - defundef = arg[2] - mac1 = arg[3] - } else { - defundef = substr(arg[1], 2) - mac1 = arg[2] - } - split(mac1, mac2, "(") #) - macro = mac2[1] - prefix = substr(line, 1, index(line, defundef) - 1) - if (D_is_set[macro]) { - # Preserve the white space surrounding the "#". - print prefix "define", macro P[macro] D[macro] - next - } else { - # Replace #undef with comments. This is necessary, for example, - # in the case of _POSIX_SOURCE, which is predefined and required - # on some systems where configure will not decide to define it. - if (defundef == "undef") { - print "/*", prefix defundef, macro, "*/" - next - } - } -} -{ print } -_ACAWK -_ACEOF -cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 - { { $as_echo "$as_me:$LINENO: error: could not setup config headers machinery" >&5 -$as_echo "$as_me: error: could not setup config headers machinery" >&2;} - { (exit 1); exit 1; }; } -fi # test -n "$CONFIG_HEADERS" - -eval set X " :F $CONFIG_FILES :H $CONFIG_HEADERS " -shift -for ac_tag +for ac_tag in :F $CONFIG_FILES :H $CONFIG_HEADERS do case $ac_tag in :[FHLC]) ac_mode=$ac_tag; continue;; esac case $ac_mode$ac_tag in :[FHL]*:*);; - :L* | :C*:*) { { $as_echo "$as_me:$LINENO: error: invalid tag $ac_tag" >&5 -$as_echo "$as_me: error: invalid tag $ac_tag" >&2;} + :L* | :C*:*) { { echo "$as_me:$LINENO: error: Invalid tag $ac_tag." >&5 +echo "$as_me: error: Invalid tag $ac_tag." >&2;} { (exit 1); exit 1; }; };; :[FH]-) ac_tag=-:-;; :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; @@ -27120,38 +26250,26 @@ [\\/$]*) false;; *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; esac || - { { $as_echo "$as_me:$LINENO: error: cannot find input file: $ac_f" >&5 -$as_echo "$as_me: error: cannot find input file: $ac_f" >&2;} + { { echo "$as_me:$LINENO: error: cannot find input file: $ac_f" >&5 +echo "$as_me: error: cannot find input file: $ac_f" >&2;} { (exit 1); exit 1; }; };; esac - case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac - ac_file_inputs="$ac_file_inputs '$ac_f'" + ac_file_inputs="$ac_file_inputs $ac_f" done # Let's still pretend it is `configure' which instantiates (i.e., don't # use $as_me), people would be surprised to read: # /* config.h. Generated by config.status. */ - configure_input='Generated from '` - $as_echo "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g' - `' by configure.' + configure_input="Generated from "`IFS=: + echo $* | sed 's|^[^:]*/||;s|:[^:]*/|, |g'`" by configure." if test x"$ac_file" != x-; then configure_input="$ac_file. $configure_input" - { $as_echo "$as_me:$LINENO: creating $ac_file" >&5 -$as_echo "$as_me: creating $ac_file" >&6;} + { echo "$as_me:$LINENO: creating $ac_file" >&5 +echo "$as_me: creating $ac_file" >&6;} fi - # Neutralize special characters interpreted by sed in replacement strings. - case $configure_input in #( - *\&* | *\|* | *\\* ) - ac_sed_conf_input=`$as_echo "$configure_input" | - sed 's/[\\\\&|]/\\\\&/g'`;; #( - *) ac_sed_conf_input=$configure_input;; - esac case $ac_tag in - *:-:* | *:-) cat >"$tmp/stdin" \ - || { { $as_echo "$as_me:$LINENO: error: could not create $ac_file" >&5 -$as_echo "$as_me: error: could not create $ac_file" >&2;} - { (exit 1); exit 1; }; } ;; + *:-:* | *:-) cat >"$tmp/stdin";; esac ;; esac @@ -27161,7 +26279,7 @@ X"$ac_file" : 'X\(//\)[^/]' \| \ X"$ac_file" : 'X\(//\)$' \| \ X"$ac_file" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X"$ac_file" | +echo X"$ac_file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q @@ -27187,7 +26305,7 @@ as_dirs= while :; do case $as_dir in #( - *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( + *\'*) as_qdir=`echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #( *) as_qdir=$as_dir;; esac as_dirs="'$as_qdir' $as_dirs" @@ -27196,7 +26314,7 @@ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X"$as_dir" | +echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q @@ -27217,17 +26335,17 @@ test -d "$as_dir" && break done test -z "$as_dirs" || eval "mkdir $as_dirs" - } || test -d "$as_dir" || { { $as_echo "$as_me:$LINENO: error: cannot create directory $as_dir" >&5 -$as_echo "$as_me: error: cannot create directory $as_dir" >&2;} + } || test -d "$as_dir" || { { echo "$as_me:$LINENO: error: cannot create directory $as_dir" >&5 +echo "$as_me: error: cannot create directory $as_dir" >&2;} { (exit 1); exit 1; }; }; } ac_builddir=. case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) - ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` + ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` # A ".." for each directory in $ac_dir_suffix. - ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` + ac_top_builddir_sub=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,/..,g;s,/,,'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; @@ -27267,13 +26385,12 @@ esac _ACEOF -cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +cat >>$CONFIG_STATUS <<\_ACEOF # If the template does not know about datarootdir, expand it. # FIXME: This hack should be removed a few years after 2.60. ac_datarootdir_hack=; ac_datarootdir_seen= -ac_sed_dataroot=' -/datarootdir/ { +case `sed -n '/datarootdir/ { p q } @@ -27282,14 +26399,13 @@ /@infodir@/p /@localedir@/p /@mandir@/p -' -case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in +' $ac_file_inputs` in *datarootdir*) ac_datarootdir_seen=yes;; *@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) - { $as_echo "$as_me:$LINENO: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 -$as_echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 +echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} _ACEOF -cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +cat >>$CONFIG_STATUS <<_ACEOF ac_datarootdir_hack=' s&@datadir@&$datadir&g s&@docdir@&$docdir&g @@ -27303,16 +26419,15 @@ # Neutralize VPATH when `$srcdir' = `.'. # Shell code in configure.ac might set extrasub. # FIXME: do we really want to maintain this feature? -cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 -ac_sed_extra="$ac_vpsub +cat >>$CONFIG_STATUS <<_ACEOF + sed "$ac_vpsub $extrasub _ACEOF -cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +cat >>$CONFIG_STATUS <<\_ACEOF :t /@[a-zA-Z_][a-zA-Z_0-9]*@/!b -s|@configure_input@|$ac_sed_conf_input|;t t +s&@configure_input@&$configure_input&;t t s&@top_builddir@&$ac_top_builddir_sub&;t t -s&@top_build_prefix@&$ac_top_build_prefix&;t t s&@srcdir@&$ac_srcdir&;t t s&@abs_srcdir@&$ac_abs_srcdir&;t t s&@top_srcdir@&$ac_top_srcdir&;t t @@ -27322,58 +26437,119 @@ s&@abs_top_builddir@&$ac_abs_top_builddir&;t t s&@INSTALL@&$ac_INSTALL&;t t $ac_datarootdir_hack -" -eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$tmp/subs.awk" >$tmp/out \ - || { { $as_echo "$as_me:$LINENO: error: could not create $ac_file" >&5 -$as_echo "$as_me: error: could not create $ac_file" >&2;} - { (exit 1); exit 1; }; } +" $ac_file_inputs | sed -f "$tmp/subs-1.sed" | sed -f "$tmp/subs-2.sed" >$tmp/out test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && { ac_out=`sed -n '/\${datarootdir}/p' "$tmp/out"`; test -n "$ac_out"; } && { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' "$tmp/out"`; test -z "$ac_out"; } && - { $as_echo "$as_me:$LINENO: WARNING: $ac_file contains a reference to the variable \`datarootdir' + { echo "$as_me:$LINENO: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined." >&5 -$as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' +echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined." >&2;} rm -f "$tmp/stdin" case $ac_file in - -) cat "$tmp/out" && rm -f "$tmp/out";; - *) rm -f "$ac_file" && mv "$tmp/out" "$ac_file";; - esac \ - || { { $as_echo "$as_me:$LINENO: error: could not create $ac_file" >&5 -$as_echo "$as_me: error: could not create $ac_file" >&2;} - { (exit 1); exit 1; }; } + -) cat "$tmp/out"; rm -f "$tmp/out";; + *) rm -f "$ac_file"; mv "$tmp/out" $ac_file;; + esac ;; :H) # # CONFIG_HEADER # +_ACEOF + +# Transform confdefs.h into a sed script `conftest.defines', that +# substitutes the proper values into config.h.in to produce config.h. +rm -f conftest.defines conftest.tail +# First, append a space to every undef/define line, to ease matching. +echo 's/$/ /' >conftest.defines +# Then, protect against being on the right side of a sed subst, or in +# an unquoted here document, in config.status. If some macros were +# called several times there might be several #defines for the same +# symbol, which is useless. But do not sort them, since the last +# AC_DEFINE must be honored. +ac_word_re=[_$as_cr_Letters][_$as_cr_alnum]* +# These sed commands are passed to sed as "A NAME B PARAMS C VALUE D", where +# NAME is the cpp macro being defined, VALUE is the value it is being given. +# PARAMS is the parameter list in the macro definition--in most cases, it's +# just an empty string. +ac_dA='s,^\\([ #]*\\)[^ ]*\\([ ]*' +ac_dB='\\)[ (].*,\\1define\\2' +ac_dC=' ' +ac_dD=' ,' + +uniq confdefs.h | + sed -n ' + t rset + :rset + s/^[ ]*#[ ]*define[ ][ ]*// + t ok + d + :ok + s/[\\&,]/\\&/g + s/^\('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/ '"$ac_dA"'\1'"$ac_dB"'\2'"${ac_dC}"'\3'"$ac_dD"'/p + s/^\('"$ac_word_re"'\)[ ]*\(.*\)/'"$ac_dA"'\1'"$ac_dB$ac_dC"'\2'"$ac_dD"'/p + ' >>conftest.defines + +# Remove the space that was appended to ease matching. +# Then replace #undef with comments. This is necessary, for +# example, in the case of _POSIX_SOURCE, which is predefined and required +# on some systems where configure will not decide to define it. +# (The regexp can be short, since the line contains either #define or #undef.) +echo 's/ $// +s,^[ #]*u.*,/* & */,' >>conftest.defines + +# Break up conftest.defines: +ac_max_sed_lines=50 + +# First sed command is: sed -f defines.sed $ac_file_inputs >"$tmp/out1" +# Second one is: sed -f defines.sed "$tmp/out1" >"$tmp/out2" +# Third one will be: sed -f defines.sed "$tmp/out2" >"$tmp/out1" +# et cetera. +ac_in='$ac_file_inputs' +ac_out='"$tmp/out1"' +ac_nxt='"$tmp/out2"' + +while : +do + # Write a here document: + cat >>$CONFIG_STATUS <<_ACEOF + # First, check the format of the line: + cat >"\$tmp/defines.sed" <<\\CEOF +/^[ ]*#[ ]*undef[ ][ ]*$ac_word_re[ ]*\$/b def +/^[ ]*#[ ]*define[ ][ ]*$ac_word_re[( ]/b def +b +:def +_ACEOF + sed ${ac_max_sed_lines}q conftest.defines >>$CONFIG_STATUS + echo 'CEOF + sed -f "$tmp/defines.sed"' "$ac_in >$ac_out" >>$CONFIG_STATUS + ac_in=$ac_out; ac_out=$ac_nxt; ac_nxt=$ac_in + sed 1,${ac_max_sed_lines}d conftest.defines >conftest.tail + grep . conftest.tail >/dev/null || break + rm -f conftest.defines + mv conftest.tail conftest.defines +done +rm -f conftest.defines conftest.tail + +echo "ac_result=$ac_in" >>$CONFIG_STATUS +cat >>$CONFIG_STATUS <<\_ACEOF if test x"$ac_file" != x-; then - { - $as_echo "/* $configure_input */" \ - && eval '$AWK -f "$tmp/defines.awk"' "$ac_file_inputs" - } >"$tmp/config.h" \ - || { { $as_echo "$as_me:$LINENO: error: could not create $ac_file" >&5 -$as_echo "$as_me: error: could not create $ac_file" >&2;} - { (exit 1); exit 1; }; } - if diff "$ac_file" "$tmp/config.h" >/dev/null 2>&1; then - { $as_echo "$as_me:$LINENO: $ac_file is unchanged" >&5 -$as_echo "$as_me: $ac_file is unchanged" >&6;} + echo "/* $configure_input */" >"$tmp/config.h" + cat "$ac_result" >>"$tmp/config.h" + if diff $ac_file "$tmp/config.h" >/dev/null 2>&1; then + { echo "$as_me:$LINENO: $ac_file is unchanged" >&5 +echo "$as_me: $ac_file is unchanged" >&6;} else - rm -f "$ac_file" - mv "$tmp/config.h" "$ac_file" \ - || { { $as_echo "$as_me:$LINENO: error: could not create $ac_file" >&5 -$as_echo "$as_me: error: could not create $ac_file" >&2;} - { (exit 1); exit 1; }; } + rm -f $ac_file + mv "$tmp/config.h" $ac_file fi else - $as_echo "/* $configure_input */" \ - && eval '$AWK -f "$tmp/defines.awk"' "$ac_file_inputs" \ - || { { $as_echo "$as_me:$LINENO: error: could not create -" >&5 -$as_echo "$as_me: error: could not create -" >&2;} - { (exit 1); exit 1; }; } + echo "/* $configure_input */" + cat "$ac_result" fi + rm -f "$tmp/out12" ;; @@ -27387,11 +26563,6 @@ chmod +x $CONFIG_STATUS ac_clean_files=$ac_clean_files_save -test $ac_write_fail = 0 || - { { $as_echo "$as_me:$LINENO: error: write failure creating $CONFIG_STATUS" >&5 -$as_echo "$as_me: error: write failure creating $CONFIG_STATUS" >&2;} - { (exit 1); exit 1; }; } - # configure is writing to config.log, and then calls config.status. # config.status does its own redirection, appending to config.log. @@ -27413,10 +26584,6 @@ # would make configure fail if this is the last instruction. $ac_cs_success || { (exit 1); exit 1; } fi -if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then - { $as_echo "$as_me:$LINENO: WARNING: unrecognized options: $ac_unrecognized_opts" >&5 -$as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} -fi echo "creating Modules/Setup" @@ -27438,12 +26605,12 @@ case $ac_sys_system in BeOS) - { $as_echo "$as_me:$LINENO: WARNING: + { echo "$as_me:$LINENO: WARNING: Support for BeOS is deprecated as of Python 2.6. See PEP 11 for the gory details. " >&5 -$as_echo "$as_me: WARNING: +echo "$as_me: WARNING: Support for BeOS is deprecated as of Python 2.6. See PEP 11 for the gory details. Modified: python/branches/tk_and_idle_maintenance/configure.in ============================================================================== --- python/branches/tk_and_idle_maintenance/configure.in (original) +++ python/branches/tk_and_idle_maintenance/configure.in Sat Jun 20 00:11:15 2009 @@ -1592,6 +1592,10 @@ [Define if you want to produce an OpenStep/Rhapsody framework (shared library plus accessory files).]) AC_MSG_RESULT(yes) + if test $enable_shared = "yes" + then + AC_MSG_ERROR([Specifying both --enable-shared and --enable-framework is not supported, use only --enable-framework instead]) + fi else AC_MSG_RESULT(no) fi Modified: python/branches/tk_and_idle_maintenance/setup.py ============================================================================== --- python/branches/tk_and_idle_maintenance/setup.py (original) +++ python/branches/tk_and_idle_maintenance/setup.py Sat Jun 20 00:11:15 2009 @@ -438,10 +438,11 @@ exts.append( Extension("_heapq", ["_heapqmodule.c"]) ) # operator.add() and similar goodies exts.append( Extension('operator', ['operator.c']) ) - # Python 3.0 _fileio module - exts.append( Extension("_fileio", ["_fileio.c"]) ) - # Python 3.0 _bytesio module - exts.append( Extension("_bytesio", ["_bytesio.c"]) ) + # Python 3.1 _io library + exts.append( Extension("_io", + ["_io/bufferedio.c", "_io/bytesio.c", "_io/fileio.c", + "_io/iobase.c", "_io/_iomodule.c", "_io/stringio.c", "_io/textio.c"], + depends=["_io/_iomodule.h"], include_dirs=["Modules/_io"])) # _functools exts.append( Extension("_functools", ["_functoolsmodule.c"]) ) # _json speedups From python-checkins at python.org Sat Jun 20 00:16:28 2009 From: python-checkins at python.org (benjamin.peterson) Date: Fri, 19 Jun 2009 22:16:28 -0000 Subject: [Python-checkins] r73488 - python/trunk/Lib/test/test_generators.py Message-ID: Author: benjamin.peterson Date: Sat Jun 20 00:16:28 2009 New Revision: 73488 Log: show that this one isn't used Modified: python/trunk/Lib/test/test_generators.py Modified: python/trunk/Lib/test/test_generators.py ============================================================================== --- python/trunk/Lib/test/test_generators.py (original) +++ python/trunk/Lib/test/test_generators.py Sat Jun 20 00:16:28 2009 @@ -960,7 +960,7 @@ # iterators have side-effects, so that which values *can* be generated at # each slot depend on the values iterated at previous slots. -def conjoin(gs): +def simple_conjoin(gs): values = [None] * len(gs) From python-checkins at python.org Sat Jun 20 00:21:12 2009 From: python-checkins at python.org (benjamin.peterson) Date: Fri, 19 Jun 2009 22:21:12 -0000 Subject: [Python-checkins] r73489 - python/trunk/Lib/test/test_generators.py Message-ID: Author: benjamin.peterson Date: Sat Jun 20 00:21:12 2009 New Revision: 73489 Log: use closures Modified: python/trunk/Lib/test/test_generators.py Modified: python/trunk/Lib/test/test_generators.py ============================================================================== --- python/trunk/Lib/test/test_generators.py (original) +++ python/trunk/Lib/test/test_generators.py Sat Jun 20 00:21:12 2009 @@ -964,7 +964,7 @@ values = [None] * len(gs) - def gen(i, values=values): + def gen(i): if i >= len(gs): yield values else: @@ -989,7 +989,7 @@ # Do one loop nest at time recursively, until the # of loop nests # remaining is divisible by 3. - def gen(i, values=values): + def gen(i): if i >= n: yield values @@ -1007,7 +1007,7 @@ # remain. Don't call directly: this is an internal optimization for # gen's use. - def _gen3(i, values=values): + def _gen3(i): assert i < n and (n-i) % 3 == 0 ip1, ip2, ip3 = i+1, i+2, i+3 g, g1, g2 = gs[i : ip3] From buildbot at python.org Sat Jun 20 01:16:39 2009 From: buildbot at python.org (buildbot at python.org) Date: Fri, 19 Jun 2009 23:16:39 +0000 Subject: [Python-checkins] buildbot failure in x86 osx.5 trunk Message-ID: The Buildbot has detected a new failure of x86 osx.5 trunk. Full details are available at: http://www.python.org/dev/buildbot/all/x86%20osx.5%20trunk/builds/1211 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: heller-x86-osx5 Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: benjamin.peterson BUILD FAILED: failed test Excerpt from the test logfile: Traceback (most recent call last): File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/threading.py", line 524, in __bootstrap_inner self.run() File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/test/test_poplib.py", line 131, in run asyncore.loop(timeout=0.1, count=1) File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/asyncore.py", line 211, in loop poll_fun(timeout, map) File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/asyncore.py", line 148, in poll read(obj) File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/asyncore.py", line 80, in read obj.handle_error() File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/asyncore.py", line 76, in read obj.handle_read_event() File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/asyncore.py", line 421, in handle_read_event self.handle_read() File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/test/test_ssl.py", line 408, in handle_read self.send(data.lower()) File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/asyncore.py", line 522, in send self.initiate_send() File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/asyncore.py", line 509, in initiate_send num_sent = dispatcher.send(self, self.out_buffer[:512]) File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/asyncore.py", line 357, in send result = self.socket.send(data) File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/socket.py", line 167, in _dummy raise error(EBADF, 'Bad file descriptor') error: [Errno 9] Bad file descriptor sincerely, -The Buildbot From python-checkins at python.org Sat Jun 20 15:57:26 2009 From: python-checkins at python.org (tarek.ziade) Date: Sat, 20 Jun 2009 13:57:26 -0000 Subject: [Python-checkins] r73490 - in python/trunk: Lib/distutils/tests/test_unixccompiler.py Lib/distutils/unixccompiler.py Misc/NEWS Message-ID: Author: tarek.ziade Date: Sat Jun 20 15:57:20 2009 New Revision: 73490 Log: Fixed #6164 AIX specific linker argument in Distutils unixcompiler Modified: python/trunk/Lib/distutils/tests/test_unixccompiler.py python/trunk/Lib/distutils/unixccompiler.py python/trunk/Misc/NEWS Modified: python/trunk/Lib/distutils/tests/test_unixccompiler.py ============================================================================== --- python/trunk/Lib/distutils/tests/test_unixccompiler.py (original) +++ python/trunk/Lib/distutils/tests/test_unixccompiler.py Sat Jun 20 15:57:20 2009 @@ -86,6 +86,14 @@ sysconfig.get_config_var = gcv self.assertEqual(self.cc.rpath_foo(), '-R/foo') + # AIX C/C++ linker + sys.platform = 'aix' + def gcv(v): + return 'xxx' + sysconfig.get_config_var = gcv + self.assertEqual(self.cc.rpath_foo(), '-blibpath:/foo') + + def test_suite(): return unittest.makeSuite(UnixCCompilerTestCase) Modified: python/trunk/Lib/distutils/unixccompiler.py ============================================================================== --- python/trunk/Lib/distutils/unixccompiler.py (original) +++ python/trunk/Lib/distutils/unixccompiler.py Sat Jun 20 15:57:20 2009 @@ -288,23 +288,24 @@ return "+s -L" + dir elif sys.platform[:7] == "irix646" or sys.platform[:6] == "osf1V5": return ["-rpath", dir] - else: - if compiler[:3] == "gcc" or compiler[:3] == "g++": - # gcc on non-GNU systems does not need -Wl, but can - # use it anyway. Since distutils has always passed in - # -Wl whenever gcc was used in the past it is probably - # safest to keep doing so. - if sysconfig.get_config_var("GNULD") == "yes": - # GNU ld needs an extra option to get a RUNPATH - # instead of just an RPATH. - return "-Wl,--enable-new-dtags,-R" + dir - else: - return "-Wl,-R" + dir + elif compiler[:3] == "gcc" or compiler[:3] == "g++": + # gcc on non-GNU systems does not need -Wl, but can + # use it anyway. Since distutils has always passed in + # -Wl whenever gcc was used in the past it is probably + # safest to keep doing so. + if sysconfig.get_config_var("GNULD") == "yes": + # GNU ld needs an extra option to get a RUNPATH + # instead of just an RPATH. + return "-Wl,--enable-new-dtags,-R" + dir else: - # No idea how --enable-new-dtags would be passed on to - # ld if this system was using GNU ld. Don't know if a - # system like this even exists. - return "-R" + dir + return "-Wl,-R" + dir + elif sys.platform[:3] == "aix": + return "-blibpath:" + dir + else: + # No idea how --enable-new-dtags would be passed on to + # ld if this system was using GNU ld. Don't know if a + # system like this even exists. + return "-R" + dir def library_option(self, lib): return "-l" + lib Modified: python/trunk/Misc/NEWS ============================================================================== --- python/trunk/Misc/NEWS (original) +++ python/trunk/Misc/NEWS Sat Jun 20 15:57:20 2009 @@ -327,6 +327,9 @@ Library ------- +- Issue #6164: Added an AIX specific linker argument in Distutils + unixcompiler. Original patch by Sridhar Ratnakumar. + - Issue #6274: Fixed possible file descriptors leak in subprocess.py - Issue #6189: Restored compatibility of subprocess.py with Python 2.2. From python-checkins at python.org Sat Jun 20 15:58:55 2009 From: python-checkins at python.org (tarek.ziade) Date: Sat, 20 Jun 2009 13:58:55 -0000 Subject: [Python-checkins] r73491 - python/branches/release26-maint Message-ID: Author: tarek.ziade Date: Sat Jun 20 15:58:55 2009 New Revision: 73491 Log: Blocked revisions 73490 via svnmerge ........ r73490 | tarek.ziade | 2009-06-20 15:57:20 +0200 (Sat, 20 Jun 2009) | 1 line Fixed #6164 AIX specific linker argument in Distutils unixcompiler ........ Modified: python/branches/release26-maint/ (props changed) From buildbot at python.org Sat Jun 20 16:32:08 2009 From: buildbot at python.org (buildbot at python.org) Date: Sat, 20 Jun 2009 14:32:08 +0000 Subject: [Python-checkins] buildbot failure in OS X x86 trunk Message-ID: The Buildbot has detected a new failure of OS X x86 trunk. Full details are available at: http://www.python.org/dev/buildbot/all/OS%20X%20x86%20trunk/builds/714 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: noller-osx86 Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: tarek.ziade BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_smtpnet make: *** [buildbottest] Error 1 sincerely, -The Buildbot From buildbot at python.org Sat Jun 20 18:18:33 2009 From: buildbot at python.org (buildbot at python.org) Date: Sat, 20 Jun 2009 16:18:33 +0000 Subject: [Python-checkins] buildbot failure in x86 XP-4 trunk Message-ID: The Buildbot has detected a new failure of x86 XP-4 trunk. Full details are available at: http://www.python.org/dev/buildbot/all/x86%20XP-4%20trunk/builds/2262 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: bolen-windows Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: tarek.ziade BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_bsddb3 sincerely, -The Buildbot From python-checkins at python.org Sun Jun 21 16:10:40 2009 From: python-checkins at python.org (guilherme.polo) Date: Sun, 21 Jun 2009 14:10:40 -0000 Subject: [Python-checkins] r73492 - python/branches/tk_and_idle_maintenance/Lib/lib-tk/test/test_tkinter/test_canvas.py Message-ID: Author: guilherme.polo Date: Sun Jun 21 16:10:35 2009 New Revision: 73492 Log: AlmostEqual. Modified: python/branches/tk_and_idle_maintenance/Lib/lib-tk/test/test_tkinter/test_canvas.py Modified: python/branches/tk_and_idle_maintenance/Lib/lib-tk/test/test_tkinter/test_canvas.py ============================================================================== --- python/branches/tk_and_idle_maintenance/Lib/lib-tk/test/test_tkinter/test_canvas.py (original) +++ python/branches/tk_and_idle_maintenance/Lib/lib-tk/test/test_tkinter/test_canvas.py Sun Jun 21 16:10:35 2009 @@ -379,8 +379,12 @@ tid = self.canvas.create_text(10, 10, tags='a') lid = self.canvas.create_line(50, 50, 70, 90, tags='a') self.canvas.move('a', -5, 5) - self.assertEqual(self.canvas.coords(tid), [5, 15]) - self.assertEqual(self.canvas.coords(lid), [45, 55, 65, 95]) + coords = self.canvas.coords(tid) + for item in zip(coords, [5, 15]): + self.assertAlmostEqual(*item) + coords = self.canvas.coords(lid) + for item in zip(coords, [45, 55, 65, 95]): + self.assertAlmostEqual(*item) def test_postscript(self): ps = self.canvas.postscript() From python-checkins at python.org Sun Jun 21 16:11:09 2009 From: python-checkins at python.org (guilherme.polo) Date: Sun, 21 Jun 2009 14:11:09 -0000 Subject: [Python-checkins] r73493 - python/branches/tk_and_idle_maintenance/Lib/lib-tk/Tkinter.py Message-ID: Author: guilherme.polo Date: Sun Jun 21 16:11:09 2009 New Revision: 73493 Log: Commiting all the changes proposed so far. Modified: python/branches/tk_and_idle_maintenance/Lib/lib-tk/Tkinter.py Modified: python/branches/tk_and_idle_maintenance/Lib/lib-tk/Tkinter.py ============================================================================== --- python/branches/tk_and_idle_maintenance/Lib/lib-tk/Tkinter.py (original) +++ python/branches/tk_and_idle_maintenance/Lib/lib-tk/Tkinter.py Sun Jun 21 16:11:09 2009 @@ -1189,7 +1189,9 @@ if type(cnf) is StringType: x = self.tk.split( self.tk.call(_flatten((self._w, cmd, '-'+cnf)))) - return (x[0][1:],) + x[1:] + if x: + return (x[0][1:],) + x[1:] + return None self.tk.call(_flatten((self._w, cmd)) + self._options(cnf)) # These used to be defined in Widget: def configure(self, cnf=None, **kw): @@ -2128,16 +2130,20 @@ to nearest multiple of GRIDSPACING units.""" return getdouble(self.tk.call( self._w, 'canvasy', screeny, gridspacing)) - def coords(self, *args): - """Return a list of coordinates for the item given in ARGS.""" + def coords(self, tagOrId, *args): + """Return or set the coordinates for an item. + + To set the coordinates for an item, either a tuple or multiple values + should be passed.""" # XXX Should use _flatten on args + # XXX why ? return map(getdouble, self.tk.splitlist( - self.tk.call((self._w, 'coords') + args))) + self.tk.call((self._w, 'coords', tagOrId) + args))) def _create(self, itemType, args, kw): # Args: (val, val, ..., cnf={}) """Internal function.""" args = _flatten(args) - cnf = args[-1] + cnf = args[-1] if len(args) else None if type(cnf) in (DictionaryType, TupleType): args = args[:-1] else: @@ -2172,17 +2178,28 @@ def create_window(self, *args, **kw): """Create window with coordinates x1,y1,x2,y2.""" return self._create('window', args, kw) - def dchars(self, *args): - """Delete characters of text items identified by tag or id in ARGS (possibly - several times) from FIRST to LAST character (including).""" - self.tk.call((self._w, 'dchars') + args) + def dchars(self, tagOrId, first, last=None): + """For each item given by tagOrId, delete the characters, or + coordinates, in the range given by first and last, inclusive. + If some of the items given by tagOrId do not support indexing + operations then they ignore dchars. Text items interpret first + and last as indices to a character, line and polygon items + interpret them as indices to a coordinate (an x, y pair). + + If last is omitted, it defaults to first. + """ + self.tk.call(self._w, 'dchars', tagOrId, first, last) def delete(self, *args): - """Delete items identified by all tag or ids contained in ARGS.""" + """Delete all items identified by the tags or ids contained in ARGS.""" self.tk.call((self._w, 'delete') + args) - def dtag(self, *args): - """Delete tag or id given as last arguments in ARGS from items - identified by first argument in ARGS.""" - self.tk.call((self._w, 'dtag') + args) + def dtag(self, tagOrId, tagToDelete=None): + """ + For each of the items given by tagOrId, delete the tag given by + tagToDelete from the list of those associated with the item. + If an item does not have the tag tagToDelete then the item is + unaffected. If tagToDelete is omitted then it defaults to tagOrId. + """ + self.tk.call(self._w, 'dtag', tagOrId, tagToDelete) def find(self, *args): """Internal function.""" return self._getints( @@ -2213,24 +2230,56 @@ def find_withtag(self, tagOrId): """Return all items with TAGORID.""" return self.find('withtag', tagOrId) - def focus(self, *args): - """Set focus to the first item specified in ARGS.""" - return self.tk.call((self._w, 'focus') + args) - def gettags(self, *args): - """Return tags associated with the first item specified in ARGS.""" - return self.tk.splitlist( - self.tk.call((self._w, 'gettags') + args)) - def icursor(self, *args): - """Set cursor at position POS in the item identified by TAGORID. - In ARGS TAGORID must be first.""" - self.tk.call((self._w, 'icursor') + args) - def index(self, *args): - """Return position of cursor as integer in item specified in ARGS.""" - return getint(self.tk.call((self._w, 'index') + args)) - def insert(self, *args): - """Insert TEXT in item TAGORID at position POS. ARGS must - be TAGORID POS TEXT.""" - self.tk.call((self._w, 'insert') + args) + def focus(self, tagOrId=None): + """Set the keyboard focus to the item given by tagOrId. + + If tagOrId refers to several items, then the focus is set to the + first such item in the display list that supports the insertion + cursor. + If tagOrId does not refer to any items, or if none of them support + the insertion cursor, then the focus is not changed. + If tagOrId is an empty string, then the focus item is reset so + that no item has the focus. + If tagOrId is not specified then the command returns the id for the + item that currently has the focus, or None if no item has the focus. + """ + ret = self.tk.call(self._w, 'focus', tagOrId) + if tagOrId is None: + return None if ret == '' else getint(ret) + def gettags(self, tagOrId): + """Return the tags associated with the item given by tagOrId. + If tagOrId refers to more than one item, then the tags are returned + from the first such item in the display list. If tagOrId does not + refer to any items, or if the item contains no tags, then an + empty tuple is returned.""" + return self.tk.splitlist(self.tk.call(self._w, 'gettags', tagOrId)) + def icursor(self, tagOrId, index): + """Set the positions of the insertion cursor for item(s) given by + tagOrId to just before the character whose position is given by + index. + + If some or all of the items given by tagOrId do not support an + insertion cursor then icursor has no effect on them. + + Note: the insertion cursor is only displayed in an item if that + item currently has the keyboard focus, but the cursor position + may be set even when the item does not have the focus. + """ + self.tk.call(self._w, 'icursor', tagOrId, index) + def index(self, tagOrId, index): + """Return an integer giving the numerical index within tagOrId + corresponding to INDEX.""" + return getint(self.tk.call(self._w, 'index', tagOrId, index)) + def insert(self, tagOrId, pos, *args): + """For each of the items given by tagOrId, if the item supports + text or coordinate, insert args into the item's text just before + the character, or coordinate, whose index is POS. + + Text items interpret POS as an index to a character, line and + polygon items interpret it as an index to a coordinate + (an x, y pair). For lines and polygons args must be a valid + coordinate sequence.""" + self.tk.call(self._w, 'insert', tagOrId, pos, *args) def itemcget(self, tagOrId, option): """Return the resource value for an OPTION for item TAGORID.""" return self.tk.call( @@ -2248,29 +2297,35 @@ # so the preferred name for them is tag_lower, tag_raise # (similar to tag_bind, and similar to the Text widget); # unfortunately can't delete the old ones yet (maybe in 1.6) - def tag_lower(self, *args): + def tag_lower(self, tagOrId, belowThis=None): """Lower an item TAGORID given in ARGS (optional below another item).""" - self.tk.call((self._w, 'lower') + args) + self.tk.call(self._w, 'lower', tagOrId, belowThis) lower = tag_lower - def move(self, *args): - """Move an item TAGORID given in ARGS.""" - self.tk.call((self._w, 'move') + args) + def move(self, tagOrId, xAmount, yAmount): + """Move each of the items given by tagOrId by adding xAmount to + the x-coordinate of each point associated with the item and yAmount + to the y-coordinate of each point associated with the item.""" + self.tk.call(self._w, 'move', tagOrId, xAmount, yAmount) def postscript(self, cnf={}, **kw): - """Print the contents of the canvas to a postscript - file. Valid options: colormap, colormode, file, fontmap, + """Generate a Postscript representation for part or all of the + canvas. If the 'file' option is specified then the Postscript is + written to a file, otherwise the Postscript is returned. + + Valid options: colormap, colormode, file, fontmap, height, pageanchor, pageheight, pagewidth, pagex, pagey, rotate, witdh, x, y.""" - return self.tk.call((self._w, 'postscript') + - self._options(cnf, kw)) - def tag_raise(self, *args): + return self.tk.call((self._w, 'postscript') + self._options(kw)) + def tag_raise(self, tagOrId, aboveThis=None): """Raise an item TAGORID given in ARGS (optional above another item).""" - self.tk.call((self._w, 'raise') + args) + self.tk.call(self._w, 'raise', tagOrId, aboveThis) lift = tkraise = tag_raise - def scale(self, *args): - """Scale item TAGORID with XORIGIN, YORIGIN, XSCALE, YSCALE.""" - self.tk.call((self._w, 'scale') + args) + def scale(self, tagOrId, xOrigin, yOrigin, xScale, yScale): + """Scale items identified by TAGORID with XORIGIN, YORIGIN, XSCALE, + YSCALE.""" + self.tk.call(self._w, 'scale', tagOrId, + xOrigin, yOrigin, xScale, yScale) def scan_mark(self, x, y): """Remember the current X, Y coordinates.""" self.tk.call(self._w, 'scan', 'mark', x, y) @@ -2402,21 +2457,26 @@ self.tk.call(self._w, 'selection', 'from', index) select_from = selection_from def selection_present(self): - """Return whether the widget has the selection.""" + """Return True if there are characters selected in the entry, False + otherwise.""" return self.tk.getboolean( - self.tk.call(self._w, 'selection', 'present')) + self.tk.call(self._w, 'selection', 'present')) select_present = selection_present def selection_range(self, start, end): - """Set the selection from START to END (not included).""" + """Set the selection from START to END (the character at END is not + selected).""" self.tk.call(self._w, 'selection', 'range', start, end) select_range = selection_range def selection_to(self, index): """Set the variable end of a selection to INDEX.""" self.tk.call(self._w, 'selection', 'to', index) select_to = selection_to - def xview(self, index): + def xview(self, index=None): """Query and change horizontal position of the view.""" - self.tk.call(self._w, 'xview', index) + if index is None: + return self._getdoubles(self.tk.call(self._w, 'xview')) + else: + self.tk.call(self._w, 'xview', index) def xview_moveto(self, fraction): """Adjust the view in the window so that FRACTION of the total width of the entry is off-screen to the left.""" @@ -2479,22 +2539,19 @@ def activate(self, index): """Activate item identified by INDEX.""" self.tk.call(self._w, 'activate', index) - def bbox(self, *args): + def bbox(self, index): """Return a tuple of X1,Y1,X2,Y2 coordinates for a rectangle - which encloses the item identified by index in ARGS.""" - return self._getints( - self.tk.call((self._w, 'bbox') + args)) or None + which encloses the item identified by the given index.""" + return self._getints(self.tk.call(self._w, 'bbox', index)) or None def curselection(self): - """Return list of indices of currently selected item.""" - # XXX Ought to apply self._getints()... - return self.tk.splitlist(self.tk.call( - self._w, 'curselection')) + """Return the indices of currently selected item.""" + return self._getints(self.tk.call(self._w, 'curselection')) or () def delete(self, first, last=None): - """Delete items from FIRST to LAST (not included).""" + """Delete items from FIRST to LAST (included).""" self.tk.call(self._w, 'delete', first, last) def get(self, first, last=None): - """Get list of items from FIRST to LAST (not included).""" - if last: + """Get list of items from FIRST to LAST (included).""" + if last is not None: return self.tk.splitlist(self.tk.call( self._w, 'get', first, last)) else: @@ -2523,13 +2580,16 @@ """Scroll such that INDEX is visible.""" self.tk.call(self._w, 'see', index) def selection_anchor(self, index): - """Set the fixed end oft the selection to INDEX.""" + """Set the selection anchor to the element given by index. + If index refers to a non-existent element, then the closest + element is used. The selection anchor is the end of the + selection that is fixed while dragging out a selection with + the mouse.""" self.tk.call(self._w, 'selection', 'anchor', index) select_anchor = selection_anchor def selection_clear(self, first, last=None): - """Clear the selection from FIRST to LAST (not included).""" - self.tk.call(self._w, - 'selection', 'clear', first, last) + """Clear the selection from FIRST to LAST (included).""" + self.tk.call(self._w, 'selection', 'clear', first, last) select_clear = selection_clear def selection_includes(self, index): """Return 1 if INDEX is part of the selection.""" @@ -2537,7 +2597,7 @@ self._w, 'selection', 'includes', index)) select_includes = selection_includes def selection_set(self, first, last=None): - """Set the selection from FIRST to LAST (not included) without + """Set the selection from FIRST to LAST (included) without changing the currently selected elements.""" self.tk.call(self._w, 'selection', 'set', first, last) select_set = selection_set @@ -2569,11 +2629,11 @@ """Shift the y-view according to NUMBER which is measured in "units" or "pages" (WHAT).""" self.tk.call(self._w, 'yview', 'scroll', number, what) def itemcget(self, index, option): - """Return the resource value for an ITEM and an OPTION.""" + """Return the resource value for an item and an OPTION.""" return self.tk.call( (self._w, 'itemcget') + (index, '-'+option)) def itemconfigure(self, index, cnf=None, **kw): - """Configure resources of an ITEM. + """Configure resources of an item. The values for resources are specified as keyword arguments. To get an overview about the allowed keyword arguments @@ -2786,10 +2846,11 @@ relief, repeatdelay, repeatinterval, takefocus, troughcolor, width.""" Widget.__init__(self, master, 'scrollbar', cnf, kw) - def activate(self, index): - """Display the element at INDEX with activebackground and activerelief. - INDEX can be "arrow1","slider" or "arrow2".""" - self.tk.call(self._w, 'activate', index) + def activate(self, element=None): + """If element is not None and is one of "arrow1", "slider" or "arrow2" + then it is marked as active. Otherwise the current active element is + returned, or None is returned in case no element is active.""" + return self.tk.call(self._w, 'activate', element) or None def delta(self, deltax, deltay): """Return the fractional change of the scrollbar setting if it would be moved by DELTAX or DELTAY pixels.""" @@ -2807,10 +2868,10 @@ """Return the current fractional values (upper and lower end) of the slider position.""" return self._getdoubles(self.tk.call(self._w, 'get')) - def set(self, *args): + def set(self, first, last): """Set the fractional values of the slider position (upper and lower ends as value between 0 and 1).""" - self.tk.call((self._w, 'set') + args) + self.tk.call(self._w, 'set', first, last) @@ -2840,11 +2901,11 @@ """ Widget.__init__(self, master, 'text', cnf, kw) - def bbox(self, *args): + def bbox(self, index): """Return a tuple of (x,y,width,height) which gives the bounding - box of the visible part of the character at the index in ARGS.""" + box of the visible part of the character at the given index.""" return self._getints( - self.tk.call((self._w, 'bbox') + args)) or None + self.tk.call(self._w, 'bbox', index)) or None def tk_textSelectTo(self, index): self.tk.call('tk_textSelectTo', self._w, index) def tk_textBackspace(self): @@ -2861,8 +2922,9 @@ def debug(self, boolean=None): """Turn on the internal consistency checks of the B-Tree inside the text widget according to BOOLEAN.""" - return self.tk.getboolean(self.tk.call( - self._w, 'debug', boolean)) + ret = self.tk.call(self._w, 'debug', boolean) + if boolean is None: + return self.tk.getboolean(ret) def delete(self, index1, index2=None): """Delete the characters between INDEX1 and INDEX2 (not included).""" self.tk.call(self._w, 'delete', index1, index2) @@ -2945,19 +3007,19 @@ then. Generates an error when the redo stack is empty. Does nothing when the undo option is false. """ - return self.edit("redo") + self.edit("redo") def edit_reset(self): """Clears the undo and redo stacks """ - return self.edit("reset") + self.edit("reset") def edit_separator(self): """Inserts a separator (boundary) on the undo stack. Does nothing when the undo option is false """ - return self.edit("separator") + self.edit("separator") def edit_undo(self): """Undoes the last edit action @@ -2968,7 +3030,7 @@ an error when the undo stack is empty. Does nothing when the undo option is false """ - return self.edit("undo") + self.edit("undo") def get(self, index1, index2=None): """Return the text from INDEX1 to INDEX2 (not included).""" @@ -3390,7 +3452,7 @@ bounding box may refer to a region outside the visible area of the window. """ - return self.tk.call(self._w, 'bbox', index) + return self._getints(self.tk.call(self._w, 'bbox', index)) def delete(self, first, last=None): """Delete one or more elements of the spinbox. @@ -3399,9 +3461,9 @@ and last is the index of the character just after the last one to delete. If last isn't specified it defaults to first+1, i.e. a single character is - deleted. This command returns an empty string. + deleted. """ - return self.tk.call(self._w, 'delete', first, last) + self.tk.call(self._w, 'delete', first, last) def get(self): """Returns the spinbox's string""" @@ -3411,9 +3473,9 @@ """Alter the position of the insertion cursor. The insertion cursor will be displayed just before - the character given by index. Returns an empty string + the character given by index. """ - return self.tk.call(self._w, 'icursor', index) + self.tk.call(self._w, 'icursor', index) def identify(self, x, y): """Returns the name of the widget at position x, y @@ -3423,16 +3485,12 @@ return self.tk.call(self._w, 'identify', x, y) def index(self, index): - """Returns the numerical index corresponding to index - """ + """Returns the numerical index corresponding to index.""" return self.tk.call(self._w, 'index', index) def insert(self, index, s): - """Insert string s at index - - Returns an empty string. - """ - return self.tk.call(self._w, 'insert', index, s) + """Insert string s at index.""" + self.tk.call(self._w, 'insert', index, s) def invoke(self, element): """Causes the specified element to be invoked @@ -3440,7 +3498,7 @@ The element could be buttondown or buttonup triggering the action associated with it. """ - return self.tk.call(self._w, 'invoke', element) + self.tk.call(self._w, 'invoke', element) def scan(self, *args): """Internal function.""" @@ -3567,11 +3625,11 @@ """Identify the panedwindow component at point x, y If the point is over a sash or a sash handle, the result - is a two element list containing the index of the sash or + is a two element tuple containing the index of the sash or handle, and a word indicating whether it is over a sash - or a handle, such as {0 sash} or {2 handle}. If the point + or a handle, such as (0, 'sash') or (2, 'handle'). If the point is over any other part of the panedwindow, the result is - an empty list. + an empty string. """ return self.tk.call(self._w, 'identify', x, y) @@ -3586,14 +3644,12 @@ return self.proxy("coord") def proxy_forget(self): - """Remove the proxy from the display. - """ - return self.proxy("forget") + """Remove the proxy from the display.""" + self.proxy("forget") def proxy_place(self, x, y): - """Place the proxy at the given x and y coordinates. - """ - return self.proxy("place", x, y) + """Place the proxy at the given x and y coordinates.""" + self.proxy("place", x, y) def sash(self, *args): """Internal function.""" @@ -3634,30 +3690,30 @@ return self.tk.call( (self._w, 'panecget') + (child, '-'+option)) - def paneconfigure(self, tagOrId, cnf=None, **kw): + def paneconfigure(self, window, cnf=None, **kw): """Query or modify the management options for window. - If no option is specified, returns a list describing all - of the available options for pathName. If option is - specified with no value, then the command returns a list - describing the one named option (this list will be identical - to the corresponding sublist of the value returned if no - option is specified). If one or more option-value pairs are - specified, then the command modifies the given widget - option(s) to have the given value(s); in this case the - command returns an empty string. The following options - are supported: + If no option is specified, a dict describing all options and + the respective values for the window is returned. If cnf is + specified as a string, then a tuple describing this one named + option is returned (this tuple will be identical to the + corresponding value in the dict returned when no option is + specified). If one or more option-value pairs are specified, + then the specified options will have their values updated. + The following options-values are supported: after window Insert the window after the window specified. window - should be the name of a window already managed by pathName. + should be the name of a window already managed by this + PanedWindow. before window Insert the window before the window specified. window - should be the name of a window already managed by pathName. + should be the name of a window already managed by this + PanedWindow. height size Specify a height for the window. The height will be the outer dimension of the window including its border, if - any. If size is an empty string, or if -height is not + any. If size is an empty string, or if this option is not specified, then the height requested internally by the window will be used initially; the height may later be adjusted by the movement of sashes in the panedwindow. @@ -3705,15 +3761,14 @@ if cnf is None and not kw: cnf = {} for x in self.tk.split( - self.tk.call(self._w, - 'paneconfigure', tagOrId)): + self.tk.call(self._w, 'paneconfigure', window)): cnf[x[0][1:]] = (x[0][1:],) + x[1:] return cnf if type(cnf) == StringType and not kw: x = self.tk.split(self.tk.call( - self._w, 'paneconfigure', tagOrId, '-'+cnf)) + self._w, 'paneconfigure', window, '-'+cnf)) return (x[0][1:],) + x[1:] - self.tk.call((self._w, 'paneconfigure', tagOrId) + + self.tk.call((self._w, 'paneconfigure', window) + self._options(cnf, kw)) paneconfig = paneconfigure From python-checkins at python.org Sun Jun 21 17:48:05 2009 From: python-checkins at python.org (tarek.ziade) Date: Sun, 21 Jun 2009 15:48:05 -0000 Subject: [Python-checkins] r73494 - peps/trunk/pep-0376.txt Message-ID: Author: tarek.ziade Date: Sun Jun 21 17:48:04 2009 New Revision: 73494 Log: added Zip support Modified: peps/trunk/pep-0376.txt Modified: peps/trunk/pep-0376.txt ============================================================================== --- peps/trunk/pep-0376.txt (original) +++ peps/trunk/pep-0376.txt Sun Jun 21 17:48:04 2009 @@ -18,7 +18,7 @@ - A new format for the .egg-info structure. - Some APIs to read the meta-data of a project -- Replace PEP 262 +- A replacement PEP 262 - An uninstall feature Definitions @@ -269,13 +269,19 @@ To use the `.egg-info` directory content, we need to add in the standard library a set of APIs. The best place to put these APIs seems to be `pkgutil`. -The API is organized in three classes: +The API is organized in five classes: - ``Distribution``: manages an `.egg-info` directory. +- ``ZippedDistribution``: manages an `.egg-info` directory contained in a zip + file. - ``DistributionDirectory``: manages a directory that contains some `.egg-info` directories. +- ``ZippedDistributionDirectory``: manages a zipped directory that contains + some `.egg.info` directory. - ``DistributionDirectories``: manages ``EggInfoDirectory`` instances. +XXX mention PEP 273 + Distribution class ------------------ @@ -326,6 +332,12 @@ If ``local`` is ``True``, each path is transformed into a local absolute path. Otherwise the raw value from `RECORD` is returned. +ZippedDistribution class +------------------------ + +A ``ZippedDistribution`` class is provided. It overrides the ``Distribution`` +class so its methods work with an `.egg.info` directory located in a zip file. + DistributionDirectory class --------------------------- @@ -349,83 +361,100 @@ If ``path`` is used by only one ``Distribution`` instance, returns it. Otherwise returns None. +ZippedDistributionDirectory class +--------------------------------- + +A ``ZippedDistributionDirectory`` is provided. It overrides the +``DistributionDirectory`` class so its methods work with a Zip file. + + DistributionDirectories class ----------------------------- A new class called ``DistributionDirectories`` is created. It's a collection of -``DistributionDirectory`` instances. The constructor takes one optional -argument ``use_cache`` set to ``True`` by default. When ``True``, -``DistributionDirectories`` will use a global cache to reduce the numbers of -I/O accesses and speed up the lookups. - -The cache is a global mapping containing ``DistributionDirectory`` instances. -When an ``DistributionDirectories`` object is created, it will use the cache to -add an entry for each path it visits, or reuse existing entries. The cache -usage can be disabled at any time with the ``use_cache`` attribute. +``DistributionDirectory`` and ``ZippedDistributionDirectory`` instances. +The constructor takes one optional argument ``use_cache`` set to ``True`` by +default. When ``True``, ``DistributionDirectories`` will use a global cache +to reduce the numbers of I/O accesses and speed up the lookups. + +The cache is a global mapping containing ``DistributionDirectory`` and +``ZippedDistributionDirectory`` instances. When an ``DistributionDirectories`` +object is created, it will use the cache to add an entry for each path it +visits, or reuse existing entries. The cache usage can be disabled at any time +with the ``use_cache`` attribute. The cache can also be emptied with the global ``purge_cache`` function. The class is a ``dict`` where the values are ``DistributionDirectory`` -instances and the keys are their path attributes. +and ``ZippedDistributionDirectory`` instances and the keys are their path +attributes. ``EggInfoDirectories`` also provides the following methods besides the ones -from ``dict``: +from ``dict``:: - ``append(path)`` - Creates an ``DistributionDirectory`` instance for ``path`` and adds it - in the mapping. + Creates an ``DistributionDirectory`` (or ``ZippedDistributionDirectory``) + instance for ``path`` and adds it in the mapping. - ``load(paths)`` - Creates and adds ``DistributionDirectory`` instances corresponding to - ``paths``. + Creates and adds ``DistributionDirectory`` (or + ``ZippedDistributionDirectory``) instances corresponding to ``paths``. - ``reload()`` Reloads existing entries. -- ``get_distributions()`` -> Iterator of ``Distribution`` instances. +- ``get_distributions()`` -> Iterator of ``Distribution`` (or + ``ZippedDistribution``) instances. - Iterates over all ``Distribution`` contained in ``DistributionDirectory`` - instances. + Iterates over all ``Distribution`` and ``ZippedDistribution`` contained + in ``DistributionDirectory`` and ``ZippedDistributionDirectory`` instances. -- ``get_distribution(project_name)`` -> ``Distribution`` or None. +- ``get_distribution(project_name)`` -> ``Distribution`` (or + ``ZippedDistribution``) or None. - Returns a ``Distribution`` instance for the given project name. - If not found, returns None. + Returns a ``Distribution`` (or ``ZippedDistribution``) instance for the + given project name. If not found, returns None. -- ``get_file_users(path)`` -> Iterator of ``Distribution`` instances. +- ``get_file_users(path)`` -> Iterator of ``Distribution`` (or + ``ZippedDistribution``) instances. Iterates over all projects to find out which project uses the file. - Returns ``Distribution`` instances. + Returns ``Distribution`` (or ``ZippedDistribution``) instances. .egg-info functions ------------------- The new functions added in the ``pkgutil`` are : -- ``get_distributions()`` -> iterator of ``Distribution`` instance. +- ``get_distributions()`` -> iterator of ``Distribution`` (or + ``ZippedDistribution``) instance. Provides an iterator that looks for ``.egg-info`` directories in ``sys.path`` - and returns ``Distribution`` instances for each one of them. + and returns ``Distribution`` (or ``ZippedDistribution``) instances for + each one of them. -- ``get_distribution(name)`` -> ``Distribution`` or None. +- ``get_distribution(name)`` -> ``Distribution`` (or ``ZippedDistribution``) + or None. Scans all elements in ``sys.path`` and looks for all directories ending with - ``.egg-info``. Returns an ``Distribution`` corresponding to the ``.egg-info`` - directory that contains a PKG-INFO that matches `name` for the `name` - metadata. + ``.egg-info``. Returns a ``Distribution`` (or ``ZippedDistribution``) + corresponding to the ``.egg-info`` directory that contains a PKG-INFO that + matches `name` for the `name` metadata. Notice that there should be at most one result. The first result founded will be returned. If the directory is not found, returns None. -- ``get_file_users(path)`` -> iterator of ``Distribution`` instances. +- ``get_file_users(path)`` -> iterator of ``Distribution`` (or + ``ZippedDistribution``) instances. Iterates over all projects to find out which project uses ``path``. ``path`` can be a local absolute path or a relative '/'-separated path. -All these functions use the same global instance of ``DistributionDirectories``to use the cache. Notice that the cache is never emptied explicitely. +All these functions use the same global instance of ``DistributionDirectories`` +to use the cache. Notice that the cache is never emptied explicitely. Example ------- From python-checkins at python.org Sun Jun 21 19:22:51 2009 From: python-checkins at python.org (guilherme.polo) Date: Sun, 21 Jun 2009 17:22:51 -0000 Subject: [Python-checkins] r73495 - in python/trunk: Lib/lib-tk/test/test_tkinter/test_loadtk.py Lib/test/test_tcl.py Misc/NEWS Message-ID: Author: guilherme.polo Date: Sun Jun 21 19:22:50 2009 New Revision: 73495 Log: Issue #5450: Moved tests involving loading tk from Lib/test/test_tcl to Lib/lib-tk/test/test_tkinter/test_loadtk in order to follow the behaviour of test_ttkguionly. Added: python/trunk/Lib/lib-tk/test/test_tkinter/test_loadtk.py (contents, props changed) Modified: python/trunk/Lib/test/test_tcl.py python/trunk/Misc/NEWS Added: python/trunk/Lib/lib-tk/test/test_tkinter/test_loadtk.py ============================================================================== --- (empty file) +++ python/trunk/Lib/lib-tk/test/test_tkinter/test_loadtk.py Sun Jun 21 19:22:50 2009 @@ -0,0 +1,45 @@ +import os +import sys +import unittest +from test import test_support +from Tkinter import Tcl, TclError + +test_support.requires('gui') + +class TkLoadTest(unittest.TestCase): + + @unittest.skipIf('DISPLAY' not in os.environ, 'No $DISPLAY set.') + def testLoadTk(self): + tcl = Tcl() + self.assertRaises(TclError,tcl.winfo_geometry) + tcl.loadtk() + self.assertEqual('1x1+0+0', tcl.winfo_geometry()) + tcl.destroy() + + def testLoadTkFailure(self): + old_display = None + if sys.platform.startswith(('win', 'darwin', 'cygwin')): + # no failure possible on windows? + + # XXX Maybe on tk older than 8.4.13 it would be possible, + # see tkinter.h. + return + with test_support.EnvironmentVarGuard() as env: + if 'DISPLAY' in os.environ: + del env['DISPLAY'] + # on some platforms, deleting environment variables + # doesn't actually carry through to the process level + # because they don't support unsetenv + # If that's the case, abort. + display = os.popen('echo $DISPLAY').read().strip() + if display: + return + + tcl = Tcl() + self.assertRaises(TclError, tcl.winfo_geometry) + self.assertRaises(TclError, tcl.loadtk) + +tests_gui = (TkLoadTest, ) + +if __name__ == "__main__": + test_support.run_unittest(*tests_gui) Modified: python/trunk/Lib/test/test_tcl.py ============================================================================== --- python/trunk/Lib/test/test_tcl.py (original) +++ python/trunk/Lib/test/test_tcl.py Sun Jun 21 19:22:50 2009 @@ -127,37 +127,6 @@ tcl = self.interp self.assertRaises(TclError,tcl.eval,'package require DNE') - def testLoadTk(self): - import os - if 'DISPLAY' not in os.environ: - # skipping test of clean upgradeability - return - tcl = Tcl() - self.assertRaises(TclError,tcl.winfo_geometry) - tcl.loadtk() - self.assertEqual('1x1+0+0', tcl.winfo_geometry()) - tcl.destroy() - - def testLoadTkFailure(self): - import os - old_display = None - import sys - if sys.platform.startswith(('win', 'darwin', 'cygwin')): - return # no failure possible on windows? - with test_support.EnvironmentVarGuard() as env: - if 'DISPLAY' in os.environ: - del env['DISPLAY'] - # on some platforms, deleting environment variables - # doesn't actually carry through to the process level - # because they don't support unsetenv - # If that's the case, abort. - display = os.popen('echo $DISPLAY').read().strip() - if display: - return - - tcl = Tcl() - self.assertRaises(TclError, tcl.winfo_geometry) - self.assertRaises(TclError, tcl.loadtk) def test_main(): test_support.run_unittest(TclTest, TkinterTest) Modified: python/trunk/Misc/NEWS ============================================================================== --- python/trunk/Misc/NEWS (original) +++ python/trunk/Misc/NEWS Sun Jun 21 19:22:50 2009 @@ -1152,6 +1152,11 @@ Tests ----- +- Issue #5450: Moved tests involving loading tk from Lib/test/test_tcl to + Lib/lib-tk/test/test_tkinter/test_loadtk. With this, these tests demonstrate + the same behaviour as test_ttkguionly (and now also test_tk) which is to + skip the tests if DISPLAY is defined but can't be used. + - Issue #6152: New option '-j'/'--multiprocess' for regrtest allows running regression tests in parallel, shortening the total runtime. From python-checkins at python.org Sun Jun 21 19:37:27 2009 From: python-checkins at python.org (vinay.sajip) Date: Sun, 21 Jun 2009 17:37:27 -0000 Subject: [Python-checkins] r73496 - in python/trunk: Lib/logging/__init__.py Misc/NEWS Message-ID: Author: vinay.sajip Date: Sun Jun 21 19:37:27 2009 New Revision: 73496 Log: Issue #6314: logging.basicConfig() performs extra checks on the "level" argument. Modified: python/trunk/Lib/logging/__init__.py python/trunk/Misc/NEWS Modified: python/trunk/Lib/logging/__init__.py ============================================================================== --- python/trunk/Lib/logging/__init__.py (original) +++ python/trunk/Lib/logging/__init__.py Sun Jun 21 19:37:27 2009 @@ -1397,6 +1397,10 @@ root.addHandler(hdlr) level = kwargs.get("level") if level is not None: + if str(level) == level: # If a string was passed, do more checks + if level not in _levelNames: + raise ValueError("Unknown level: %r" % level) + level = _levelNames[level] root.setLevel(level) #--------------------------------------------------------------------------- Modified: python/trunk/Misc/NEWS ============================================================================== --- python/trunk/Misc/NEWS (original) +++ python/trunk/Misc/NEWS Sun Jun 21 19:37:27 2009 @@ -327,7 +327,10 @@ Library ------- -- Issue #6164: Added an AIX specific linker argument in Distutils +- Issue #6314: logging.basicConfig() performs extra checks on the "level" + argument. + +- Issue #6164: Added an AIX specific linker argument in Distutils unixcompiler. Original patch by Sridhar Ratnakumar. - Issue #6274: Fixed possible file descriptors leak in subprocess.py From python-checkins at python.org Sun Jun 21 19:40:08 2009 From: python-checkins at python.org (guilherme.polo) Date: Sun, 21 Jun 2009 17:40:08 -0000 Subject: [Python-checkins] r73497 - in python/branches/py3k: Lib/test/test_tcl.py Lib/tkinter/test/test_tkinter/test_loadtk.py Misc/NEWS Message-ID: Author: guilherme.polo Date: Sun Jun 21 19:40:07 2009 New Revision: 73497 Log: Merged revisions 73495 via svnmerge from svn+ssh://pythondev/python/trunk ........ r73495 | guilherme.polo | 2009-06-21 14:22:50 -0300 (Sun, 21 Jun 2009) | 4 lines Issue #5450: Moved tests involving loading tk from Lib/test/test_tcl to Lib/lib-tk/test/test_tkinter/test_loadtk in order to follow the behaviour of test_ttkguionly. ........ Added: python/branches/py3k/Lib/tkinter/test/test_tkinter/test_loadtk.py (contents, props changed) Modified: python/branches/py3k/ (props changed) python/branches/py3k/Lib/test/test_tcl.py python/branches/py3k/Misc/NEWS Modified: python/branches/py3k/Lib/test/test_tcl.py ============================================================================== --- python/branches/py3k/Lib/test/test_tcl.py (original) +++ python/branches/py3k/Lib/test/test_tcl.py Sun Jun 21 19:40:07 2009 @@ -127,37 +127,6 @@ tcl = self.interp self.assertRaises(TclError,tcl.eval,'package require DNE') - def testLoadTk(self): - import os - if 'DISPLAY' not in os.environ: - # skipping test of clean upgradeability - return - tcl = Tcl() - self.assertRaises(TclError,tcl.winfo_geometry) - tcl.loadtk() - self.assertEqual('1x1+0+0', tcl.winfo_geometry()) - tcl.destroy() - - def testLoadTkFailure(self): - import os - old_display = None - import sys - if sys.platform.startswith(('win', 'darwin', 'cygwin')): - return # no failure possible on windows? - with support.EnvironmentVarGuard() as env: - if 'DISPLAY' in os.environ: - del env['DISPLAY'] - # on some platforms, deleting environment variables - # doesn't actually carry through to the process level - # because they don't support unsetenv - # If that's the case, abort. - display = os.popen('echo $DISPLAY').read().strip() - if display: - return - - tcl = Tcl() - self.assertRaises(TclError, tcl.winfo_geometry) - self.assertRaises(TclError, tcl.loadtk) def test_main(): support.run_unittest(TclTest, TkinterTest) Added: python/branches/py3k/Lib/tkinter/test/test_tkinter/test_loadtk.py ============================================================================== --- (empty file) +++ python/branches/py3k/Lib/tkinter/test/test_tkinter/test_loadtk.py Sun Jun 21 19:40:07 2009 @@ -0,0 +1,45 @@ +import os +import sys +import unittest +import test.support as test_support +from tkinter import Tcl, TclError + +test_support.requires('gui') + +class TkLoadTest(unittest.TestCase): + + @unittest.skipIf('DISPLAY' not in os.environ, 'No $DISPLAY set.') + def testLoadTk(self): + tcl = Tcl() + self.assertRaises(TclError,tcl.winfo_geometry) + tcl.loadtk() + self.assertEqual('1x1+0+0', tcl.winfo_geometry()) + tcl.destroy() + + def testLoadTkFailure(self): + old_display = None + if sys.platform.startswith(('win', 'darwin', 'cygwin')): + # no failure possible on windows? + + # XXX Maybe on tk older than 8.4.13 it would be possible, + # see tkinter.h. + return + with test_support.EnvironmentVarGuard() as env: + if 'DISPLAY' in os.environ: + del env['DISPLAY'] + # on some platforms, deleting environment variables + # doesn't actually carry through to the process level + # because they don't support unsetenv + # If that's the case, abort. + display = os.popen('echo $DISPLAY').read().strip() + if display: + return + + tcl = Tcl() + self.assertRaises(TclError, tcl.winfo_geometry) + self.assertRaises(TclError, tcl.loadtk) + +tests_gui = (TkLoadTest, ) + +if __name__ == "__main__": + test_support.run_unittest(*tests_gui) Modified: python/branches/py3k/Misc/NEWS ============================================================================== --- python/branches/py3k/Misc/NEWS (original) +++ python/branches/py3k/Misc/NEWS Sun Jun 21 19:40:07 2009 @@ -1337,6 +1337,11 @@ Tests ----- +- Issue #5450: Moved tests involving loading tk from Lib/test/test_tcl to + Lib/tkinter/test/test_tkinter/test_loadtk. With this, these tests demonstrate + the same behaviour as test_ttkguionly (and now also test_tk) which is to + skip the tests if DISPLAY is defined but can't be used. + - regrtest no longer treats ImportError as equivalent to SkipTest. Imports that should cause a test to be skipped are now done using import_module from test support, which does the conversion. From python-checkins at python.org Sun Jun 21 19:46:50 2009 From: python-checkins at python.org (vinay.sajip) Date: Sun, 21 Jun 2009 17:46:50 -0000 Subject: [Python-checkins] r73498 - in python/branches/py3k: Lib/logging/__init__.py Misc/NEWS Message-ID: Author: vinay.sajip Date: Sun Jun 21 19:46:49 2009 New Revision: 73498 Log: Issue #6314: logging.basicConfig() performs extra checks on the "level" argument. Modified: python/branches/py3k/Lib/logging/__init__.py python/branches/py3k/Misc/NEWS Modified: python/branches/py3k/Lib/logging/__init__.py ============================================================================== --- python/branches/py3k/Lib/logging/__init__.py (original) +++ python/branches/py3k/Lib/logging/__init__.py Sun Jun 21 19:46:49 2009 @@ -1396,6 +1396,10 @@ root.addHandler(hdlr) level = kwargs.get("level") if level is not None: + if str(level) == level: # If a string was passed, do more checks + if level not in _levelNames: + raise ValueError("Unknown level: %r" % level) + level = _levelNames[level] root.setLevel(level) #--------------------------------------------------------------------------- Modified: python/branches/py3k/Misc/NEWS ============================================================================== --- python/branches/py3k/Misc/NEWS (original) +++ python/branches/py3k/Misc/NEWS Sun Jun 21 19:46:49 2009 @@ -15,12 +15,15 @@ Library ------- +- Issue #6314: logging.basicConfig() performs extra checks on the "level" + argument. + - Issue #6274: Fixed possible file descriptors leak in subprocess.py - Accessing io.StringIO.buffer now raises an AttributeError instead of io.UnsupportedOperation. -- Issue #6271: mmap tried to close invalid file handle (-1) when annonymous. +- Issue #6271: mmap tried to close invalid file handle (-1) when anonymous. (On Unix) From buildbot at python.org Sun Jun 21 20:39:35 2009 From: buildbot at python.org (buildbot at python.org) Date: Sun, 21 Jun 2009 18:39:35 +0000 Subject: [Python-checkins] buildbot failure in OS X x86 trunk Message-ID: The Buildbot has detected a new failure of OS X x86 trunk. Full details are available at: http://www.python.org/dev/buildbot/all/OS%20X%20x86%20trunk/builds/716 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: noller-osx86 Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: vinay.sajip BUILD FAILED: failed test Excerpt from the test logfile: Traceback (most recent call last): File "/Users/buildbot/buildarea/trunk.noller-osx86/build/Lib/threading.py", line 524, in __bootstrap_inner self.run() File "/Users/buildbot/buildarea/trunk.noller-osx86/build/Lib/threading.py", line 477, in run self.__target(*self.__args, **self.__kwargs) File "/Users/buildbot/buildarea/trunk.noller-osx86/build/Lib/bsddb/test/test_thread.py", line 306, in readerThread rec = dbutils.DeadlockWrap(c.next, max_retries=10) File "/Users/buildbot/buildarea/trunk.noller-osx86/build/Lib/bsddb/dbutils.py", line 68, in DeadlockWrap return function(*_args, **_kwargs) DBLockDeadlockError: (-30995, 'DB_LOCK_DEADLOCK: Locker killed to resolve a deadlock') 1 test failed: test_poll make: *** [buildbottest] Error 1 sincerely, -The Buildbot From buildbot at python.org Sun Jun 21 21:12:21 2009 From: buildbot at python.org (buildbot at python.org) Date: Sun, 21 Jun 2009 19:12:21 +0000 Subject: [Python-checkins] buildbot failure in sparc solaris10 gcc 3.x Message-ID: The Buildbot has detected a new failure of sparc solaris10 gcc 3.x. Full details are available at: http://www.python.org/dev/buildbot/all/sparc%20solaris10%20gcc%203.x/builds/839 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: loewis-sun Build Reason: Build Source Stamp: [branch branches/py3k] HEAD Blamelist: guilherme.polo BUILD FAILED: failed test Excerpt from the test logfile: 3 tests failed: test_capi test_import test_posix ====================================================================== ERROR: test_getcwd_long_pathnames (test.test_posix.PosixTester) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home2/buildbot/slave/3.x.loewis-sun/build/Lib/test/test_posix.py", line 251, in test_getcwd_long_pathnames support.rmtree(base_path) File "/home2/buildbot/slave/3.x.loewis-sun/build/Lib/test/support.py", line 181, in rmtree shutil.rmtree(path) File "/home2/buildbot/slave/3.x.loewis-sun/build/Lib/shutil.py", line 239, in rmtree onerror(os.rmdir, path, sys.exc_info()) File "/home2/buildbot/slave/3.x.loewis-sun/build/Lib/shutil.py", line 237, in rmtree os.rmdir(path) OSError: [Errno 22] Invalid argument: '/home2/buildbot/slave/3.x.loewis-sun/build/@test.getcwd/@test.getcwd' sincerely, -The Buildbot From python-checkins at python.org Sun Jun 21 23:03:41 2009 From: python-checkins at python.org (steven.bethard) Date: Sun, 21 Jun 2009 21:03:41 -0000 Subject: [Python-checkins] r73499 - python/trunk/Lib/distutils/command/bdist_msi.py Message-ID: Author: steven.bethard Date: Sun Jun 21 23:03:41 2009 New Revision: 73499 Log: Fix memory bug in bdist_msi. (Commit okayed in issue6319.) Modified: python/trunk/Lib/distutils/command/bdist_msi.py Modified: python/trunk/Lib/distutils/command/bdist_msi.py ============================================================================== --- python/trunk/Lib/distutils/command/bdist_msi.py (original) +++ python/trunk/Lib/distutils/command/bdist_msi.py Sun Jun 21 23:03:41 2009 @@ -315,8 +315,7 @@ key = seen[afile] add_data(self.db, "DuplicateFile", [(key + version, dir.component, key, None, dir.logical)]) - - + db.Commit() cab.commit(db) def add_find_python(self): From python-checkins at python.org Sun Jun 21 23:07:41 2009 From: python-checkins at python.org (steven.bethard) Date: Sun, 21 Jun 2009 21:07:41 -0000 Subject: [Python-checkins] r73500 - in python/branches/py3k: Lib/distutils/command/bdist_msi.py Message-ID: Author: steven.bethard Date: Sun Jun 21 23:07:41 2009 New Revision: 73500 Log: Merged revisions 73499 via svnmerge from svn+ssh://pythondev at svn.python.org/python/trunk ........ r73499 | steven.bethard | 2009-06-21 17:03:41 -0400 (Sun, 21 Jun 2009) | 1 line Fix memory bug in bdist_msi. (Commit okayed in issue6319.) ........ Modified: python/branches/py3k/ (props changed) python/branches/py3k/Lib/distutils/command/bdist_msi.py Modified: python/branches/py3k/Lib/distutils/command/bdist_msi.py ============================================================================== --- python/branches/py3k/Lib/distutils/command/bdist_msi.py (original) +++ python/branches/py3k/Lib/distutils/command/bdist_msi.py Sun Jun 21 23:07:41 2009 @@ -314,8 +314,7 @@ key = seen[afile] add_data(self.db, "DuplicateFile", [(key + version, dir.component, key, None, dir.logical)]) - - + db.Commit() cab.commit(db) def add_find_python(self): From buildbot at python.org Mon Jun 22 00:07:05 2009 From: buildbot at python.org (buildbot at python.org) Date: Sun, 21 Jun 2009 22:07:05 +0000 Subject: [Python-checkins] buildbot failure in x86 osx.5 3.x Message-ID: The Buildbot has detected a new failure of x86 osx.5 3.x. Full details are available at: http://www.python.org/dev/buildbot/all/x86%20osx.5%203.x/builds/1049 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: heller-x86-osx5 Build Reason: Build Source Stamp: [branch branches/py3k] HEAD Blamelist: steven.bethard BUILD FAILED: failed test Excerpt from the test logfile: Traceback (most recent call last): File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/multiprocessing/process.py", line 232, in _bootstrap self.run() File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/multiprocessing/process.py", line 88, in run self._target(*self._args, **self._kwargs) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/multiprocessing/managers.py", line 535, in _run_server server.serve_forever() File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/multiprocessing/managers.py", line 156, in serve_forever c = self.listener.accept() File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/multiprocessing/connection.py", line 410, in accept import xmlrpc.client as xmlrpclib File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/xmlrpc/client.py", line 137, in import http.client File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/http/client.py", line 69, in import email.parser File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/email/parser.py", line 12, in from email.feedparser import FeedParser File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/email/feedparser.py", line 27, in from email import message File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/email/message.py", line 17, in from email import utils File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/email/utils.py", line 28, in import urllib.parse File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/importlib/_bootstrap.py", line 151, in decorated return fxn(self, module) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/importlib/_bootstrap.py", line 399, in load_module return self._load_module(module) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/importlib/_bootstrap.py", line 324, in _load_module code_object = self.get_code(module.__name__) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/importlib/_bootstrap.py", line 411, in get_code pyc_timestamp = marshal._r_long(data[4:8]) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/importlib/__init__.py", line 65, in _r_long x = int_bytes[0] IndexError: index out of range Traceback (most recent call last): File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/multiprocessing/process.py", line 232, in _bootstrap self.run() File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/multiprocessing/process.py", line 88, in run self._target(*self._args, **self._kwargs) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/test/test_multiprocessing.py", line 1203, in _putter manager.connect() File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/multiprocessing/managers.py", line 477, in connect conn = Client(self._address, authkey=self._authkey) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/multiprocessing/connection.py", line 417, in XmlClient return ConnectionWrapper(Client(*args, **kwds), _xml_dumps, _xml_loads) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/multiprocessing/connection.py", line 134, in Client c = SocketClient(address) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/multiprocessing/connection.py", line 253, in SocketClient s.connect(address) socket.error: [Errno 22] Invalid argument 1 test failed: test_multiprocessing make: *** [buildbottest] Error 1 sincerely, -The Buildbot From buildbot at python.org Mon Jun 22 00:54:43 2009 From: buildbot at python.org (buildbot at python.org) Date: Sun, 21 Jun 2009 22:54:43 +0000 Subject: [Python-checkins] buildbot failure in sparc solaris10 gcc 3.x Message-ID: The Buildbot has detected a new failure of sparc solaris10 gcc 3.x. Full details are available at: http://www.python.org/dev/buildbot/all/sparc%20solaris10%20gcc%203.x/builds/841 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: loewis-sun Build Reason: Build Source Stamp: [branch branches/py3k] HEAD Blamelist: steven.bethard BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_posix ====================================================================== ERROR: test_getcwd_long_pathnames (test.test_posix.PosixTester) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home2/buildbot/slave/3.x.loewis-sun/build/Lib/test/test_posix.py", line 251, in test_getcwd_long_pathnames support.rmtree(base_path) File "/home2/buildbot/slave/3.x.loewis-sun/build/Lib/test/support.py", line 181, in rmtree shutil.rmtree(path) File "/home2/buildbot/slave/3.x.loewis-sun/build/Lib/shutil.py", line 239, in rmtree onerror(os.rmdir, path, sys.exc_info()) File "/home2/buildbot/slave/3.x.loewis-sun/build/Lib/shutil.py", line 237, in rmtree os.rmdir(path) OSError: [Errno 22] Invalid argument: '/home2/buildbot/slave/3.x.loewis-sun/build/@test.getcwd/@test.getcwd' sincerely, -The Buildbot From python-checkins at python.org Mon Jun 22 01:01:07 2009 From: python-checkins at python.org (benjamin.peterson) Date: Sun, 21 Jun 2009 23:01:07 -0000 Subject: [Python-checkins] r73501 - python/trunk/Python/symtable.c Message-ID: Author: benjamin.peterson Date: Mon Jun 22 01:01:07 2009 New Revision: 73501 Log: don't need to add the name 'lombda' as assigned Modified: python/trunk/Python/symtable.c Modified: python/trunk/Python/symtable.c ============================================================================== --- python/trunk/Python/symtable.c (original) +++ python/trunk/Python/symtable.c Mon Jun 22 01:01:07 2009 @@ -1213,8 +1213,7 @@ VISIT(st, expr, e->v.UnaryOp.operand); break; case Lambda_kind: { - if (!GET_IDENTIFIER(lambda) || - !symtable_add_def(st, lambda, DEF_LOCAL)) + if (!GET_IDENTIFIER(lambda)) return 0; if (e->v.Lambda.args->defaults) VISIT_SEQ(st, expr, e->v.Lambda.args->defaults); From python-checkins at python.org Mon Jun 22 01:03:36 2009 From: python-checkins at python.org (benjamin.peterson) Date: Sun, 21 Jun 2009 23:03:36 -0000 Subject: [Python-checkins] r73502 - in python/trunk: Include/symtable.h Python/compile.c Python/symtable.c Message-ID: Author: benjamin.peterson Date: Mon Jun 22 01:03:36 2009 New Revision: 73502 Log: remove tmpname support since it's no longer used Modified: python/trunk/Include/symtable.h python/trunk/Python/compile.c python/trunk/Python/symtable.c Modified: python/trunk/Include/symtable.h ============================================================================== --- python/trunk/Include/symtable.h (original) +++ python/trunk/Include/symtable.h Mon Jun 22 01:03:36 2009 @@ -19,7 +19,6 @@ PyObject *st_global; /* borrowed ref to MODULE in st_symbols */ int st_nblocks; /* number of blocks */ PyObject *st_private; /* name of current class or NULL */ - int st_tmpname; /* temporary name counter */ PyFutureFeatures *st_future; /* module's future features */ }; @@ -43,7 +42,6 @@ an argument */ int ste_lineno; /* first line of block */ int ste_opt_lineno; /* lineno of last exec or import * */ - int ste_tmpname; /* counter for listcomp temp vars */ struct symtable *ste_table; } PySTEntryObject; Modified: python/trunk/Python/compile.c ============================================================================== --- python/trunk/Python/compile.c (original) +++ python/trunk/Python/compile.c Mon Jun 22 01:03:36 2009 @@ -111,7 +111,6 @@ members, you can reach all early allocated blocks. */ basicblock *u_blocks; basicblock *u_curblock; /* pointer to current block */ - int u_tmpname; /* temporary variables for list comps */ int u_nfblocks; struct fblockinfo u_fblock[CO_MAXBLOCKS]; @@ -468,7 +467,6 @@ } u->u_blocks = NULL; - u->u_tmpname = 0; u->u_nfblocks = 0; u->u_firstlineno = lineno; u->u_lineno = 0; Modified: python/trunk/Python/symtable.c ============================================================================== --- python/trunk/Python/symtable.c (original) +++ python/trunk/Python/symtable.c Mon Jun 22 01:03:36 2009 @@ -32,7 +32,6 @@ goto fail; ste->ste_table = st; ste->ste_id = k; - ste->ste_tmpname = 0; ste->ste_name = name; Py_INCREF(name); @@ -60,7 +59,6 @@ ste->ste_varargs = 0; ste->ste_varkeywords = 0; ste->ste_opt_lineno = 0; - ste->ste_tmpname = 0; ste->ste_lineno = lineno; if (st->st_cur != NULL && @@ -204,7 +202,6 @@ if ((st->st_symbols = PyDict_New()) == NULL) goto fail; st->st_cur = NULL; - st->st_tmpname = 0; st->st_private = NULL; return st; fail: @@ -995,23 +992,6 @@ } static int -symtable_new_tmpname(struct symtable *st) -{ - char tmpname[256]; - identifier tmp; - - PyOS_snprintf(tmpname, sizeof(tmpname), "_[%d]", - ++st->st_cur->ste_tmpname); - tmp = PyString_InternFromString(tmpname); - if (!tmp) - return 0; - if (!symtable_add_def(st, tmp, DEF_LOCAL)) - return 0; - Py_DECREF(tmp); - return 1; -} - -static int symtable_visit_stmt(struct symtable *st, stmt_ty s) { switch (s->kind) { @@ -1184,12 +1164,8 @@ /* nothing to do here */ break; case With_kind: - if (!symtable_new_tmpname(st)) - return 0; VISIT(st, expr, s->v.With.context_expr); if (s->v.With.optional_vars) { - if (!symtable_new_tmpname(st)) - return 0; VISIT(st, expr, s->v.With.optional_vars); } VISIT_SEQ(st, stmt, s->v.With.body); @@ -1237,8 +1213,6 @@ VISIT_SEQ(st, expr, e->v.Dict.values); break; case ListComp_kind: - if (!symtable_new_tmpname(st)) - return 0; VISIT(st, expr, e->v.ListComp.elt); VISIT_SEQ(st, comprehension, e->v.ListComp.generators); break; From python-checkins at python.org Mon Jun 22 01:04:18 2009 From: python-checkins at python.org (benjamin.peterson) Date: Sun, 21 Jun 2009 23:04:18 -0000 Subject: [Python-checkins] r73501 - svn:log Message-ID: Author: benjamin.peterson Revision: 73501 Property Name: svn:log Action: modified Property diff: --- old property value +++ new property value @@ -1 +1 @@ -don't need to add the name 'lombda' as assigned \ No newline at end of file +don't need to add the name 'lambda' as assigned \ No newline at end of file From python-checkins at python.org Mon Jun 22 15:05:52 2009 From: python-checkins at python.org (matthias.klose) Date: Mon, 22 Jun 2009 13:05:52 -0000 Subject: [Python-checkins] r73503 - in python/branches/py3k: Misc/NEWS Modules/pyexpat.c Message-ID: Author: matthias.klose Date: Mon Jun 22 15:05:52 2009 New Revision: 73503 Log: - Issue #5590: Remove unused global variable in pyexpat extension. Modified: python/branches/py3k/Misc/NEWS python/branches/py3k/Modules/pyexpat.c Modified: python/branches/py3k/Misc/NEWS ============================================================================== --- python/branches/py3k/Misc/NEWS (original) +++ python/branches/py3k/Misc/NEWS Mon Jun 22 15:05:52 2009 @@ -26,6 +26,11 @@ - Issue #6271: mmap tried to close invalid file handle (-1) when anonymous. (On Unix) +Extension Modules +----------------- + +- Issue #5590: Remove unused global variable in pyexpat extension. + What's New in Python 3.1 Release Candidate 2? ============================================= Modified: python/branches/py3k/Modules/pyexpat.c ============================================================================== --- python/branches/py3k/Modules/pyexpat.c (original) +++ python/branches/py3k/Modules/pyexpat.c Mon Jun 22 15:05:52 2009 @@ -1169,7 +1169,6 @@ */ static char template_buffer[257]; -PyObject *template_string = NULL; static void init_template_buffer(void) From python-checkins at python.org Mon Jun 22 15:06:56 2009 From: python-checkins at python.org (tarek.ziade) Date: Mon, 22 Jun 2009 13:06:56 -0000 Subject: [Python-checkins] r73504 - peps/trunk/pep-0376.txt Message-ID: Author: tarek.ziade Date: Mon Jun 22 15:06:55 2009 New Revision: 73504 Log: renamed project to distribution Modified: peps/trunk/pep-0376.txt Modified: peps/trunk/pep-0376.txt ============================================================================== --- peps/trunk/pep-0376.txt (original) +++ peps/trunk/pep-0376.txt Mon Jun 22 15:06:55 2009 @@ -17,22 +17,33 @@ This PEP proposes various enhancements for Distutils: - A new format for the .egg-info structure. -- Some APIs to read the meta-data of a project +- Some APIs to read the meta-data of a distribution - A replacement PEP 262 - An uninstall feature Definitions =========== -A **project** is a distribution of one or several files, which can be Python -modules, extensions or data. It is distributed using a `setup.py` script -with Distutils and/or Setuptools. The `setup.py` script indicates where each -elements should be installed. +A **distribution** is a collection of files, which can be Python modules, +extensions or data. A distribution is managed by a special module called +`setup.py` which contains a call to the `distutils.core.setup` function. +The arguments passed to that function describe the distribution, like +its `name`, its `version`, and so on. + +Disutils provides among other things **commands** that can be called +through the shell using the `setup.py` script. A `sdist` command is provided +for instance, to create a source distribution archive. An `install` command +is also provided, to perform an installation of the distribution in the Python +installation the script is invoked with:: + + $ python setup.py install + +See the Distutils [distutils]_ documentation for more information. Once installed, the elements are located in various places in the system, like: -- in Python's site-packages (Python modules, Python modules organized into packages, - Extensions, etc.) +- in Python's site-packages (Python modules, Python modules organized into + packages, Extensions, etc.) - in Python's `include` directory. - in Python's `bin` or `Script` directory. - etc. @@ -40,15 +51,16 @@ Rationale ========= -There are two problems right now in the way projects are installed in Python: +There are two problems right now in the way distributions are installed in +Python: - There are too many ways to do it. -- There is no API to get the metadata of installed projects. +- There is no API to get the metadata of installed distributions. -How projects are installed --------------------------- +How distributions are installed +------------------------------- -Right now, when a project is installed in Python, every elements its contains +Right now, when a distribution is installed in Python, every elements its contains is installed in various directories. The pure Python code for instance is installed in the `purelib` directory, @@ -60,14 +72,14 @@ The `install_egg_info` subcommand is called during this process, in order to create an `.egg-info` file in the `purelib` directory. -For example, if the `zlib` project (which contains one package) is installed, -two elements will be installed in `site-packages`:: +For example, if the `zlib` distribution (which contains one package) is +installed, two elements will be installed in `site-packages`:: - zlib - zlib-2.5.2-py2.4.egg-info Where `zlib` is a Python package, and `zlib-2.5.2-py2.4.egg-info` is -a file containing the project metadata as described in PEP 314 [#pep314]_. +a file containing the distribution metadata as described in PEP 314 [#pep314]_. This file corresponds to the file called `PKG-INFO`, built by the `sdist` command. @@ -78,12 +90,12 @@ - `easy_install` creates an `EGG-INFO` directory inside an `.egg` directory, and adds a `PKG-INFO` file inside this directory. The `.egg` directory - contains in that case all the elements of the project that are supposed to - be installed in `site-packages`, and is placed in the `site-packages` + contains in that case all the elements of the distribution that are supposed + to be installed in `site-packages`, and is placed in the `site-packages` directory. - `pip` creates an `.egg-info` directory inside the `site-packages` directory - and adds a `PKG-INFO` file inside it. Elements of the project are then + and adds a `PKG-INFO` file inside it. Elements of the distribution are then installed in various places like Distutils does. They both add other files in the `EGG-INFO` or `.egg-info` directory, and @@ -93,17 +105,18 @@ --------------------- Distutils doesn't provide any `uninstall` command. If you want to uninstall -a project, you have to be a power user and remove the various elements that -were installed. Then look over the `.pth` file to clean them if necessary. +a distribution, you have to be a power user and remove the various elements +that were installed. Then look over the `.pth` file to clean them if necessary. And the process differs, depending on the tools you have used to install the -project, and if the project's `setup.py` uses Distutils or Setuptools. +distribution, and if the distribution's `setup.py` uses Distutils or +Setuptools. Under some circumstances, you might not be able to know for sure that you -have removed everything, or that you didn't break another project by -removing a file that was shared among several projects. +have removed everything, or that you didn't break another distribution by +removing a file that was shared among several distributions. -But there's common behavior: when you install a project, files are copied +But there's common behavior: when you install a distribution, files are copied in your system. And there's a way to keep track of theses files, so to remove them. @@ -115,7 +128,7 @@ - a new `.egg-info` structure using a directory, based on one form of the `EggFormats` standard from `setuptools` [#eggformats]_. - new APIs in `pkgutil` to be able to query the information of installed - projects. + distributions. - a de-facto replacement for PEP 262 - an uninstall function in Distutils. @@ -131,7 +144,7 @@ Although, this standard proposes two ways to install files : - a self-contained directory that can be zipped or left unzipped and that - contains the project files *and* the `.egg-info` directory. + contains the distribution files *and* the `.egg-info` directory. - a distinct `.egg-info` directory located in the site-packages directory. @@ -259,9 +272,9 @@ It will default to `distutils` if not provided. -When a project is installed, the INSTALLER file is generated in the +When a distribution is installed, the INSTALLER file is generated in the `.egg-info` directory with this value, to keep track of **who** installed the -project. The file is a single-line text file. +distribution. The file is a single-line text file. New APIs in pkgutil =================== @@ -269,7 +282,9 @@ To use the `.egg-info` directory content, we need to add in the standard library a set of APIs. The best place to put these APIs seems to be `pkgutil`. -The API is organized in five classes: +The API is organized in five classes that work with directories and Zip files +(so its works with files included in Zip files, see PEP 273 for more details +[pep273]_. - ``Distribution``: manages an `.egg-info` directory. - ``ZippedDistribution``: manages an `.egg-info` directory contained in a zip @@ -280,8 +295,6 @@ some `.egg.info` directory. - ``DistributionDirectories``: manages ``EggInfoDirectory`` instances. -XXX mention PEP 273 - Distribution class ------------------ @@ -412,16 +425,16 @@ Iterates over all ``Distribution`` and ``ZippedDistribution`` contained in ``DistributionDirectory`` and ``ZippedDistributionDirectory`` instances. -- ``get_distribution(project_name)`` -> ``Distribution`` (or +- ``get_distribution(dist_name)`` -> ``Distribution`` (or ``ZippedDistribution``) or None. Returns a ``Distribution`` (or ``ZippedDistribution``) instance for the - given project name. If not found, returns None. + given distribution name. If not found, returns None. - ``get_file_users(path)`` -> Iterator of ``Distribution`` (or ``ZippedDistribution``) instances. - Iterates over all projects to find out which project uses the file. + Iterates over all distributions to find out which distributions use the file. Returns ``Distribution`` (or ``ZippedDistribution``) instances. .egg-info functions @@ -450,7 +463,7 @@ - ``get_file_users(path)`` -> iterator of ``Distribution`` (or ``ZippedDistribution``) instances. - Iterates over all projects to find out which project uses ``path``. + Iterates over all distributions to find out which distributions uses ``path``. ``path`` can be a local absolute path or a relative '/'-separated path. All these functions use the same global instance of ``DistributionDirectories`` @@ -507,12 +520,13 @@ Adding an Uninstall function ============================ -Distutils already provides a very basic way to install a project, which is running -the `install` command over the `setup.py` script of the distribution. +Distutils already provides a very basic way to install a distribution, which +is running the `install` command over the `setup.py` script of the +distribution. Distutils will provide a very basic ``uninstall`` function, that will be added -in ``distutils.util`` and will take the name of the project to uninstall as -its argument. ``uninstall`` will use the APIs desribed earlier and remove all +in ``distutils.util`` and will take the name of the distribution to uninstall +as its argument. ``uninstall`` will use the APIs desribed earlier and remove all unique files, as long as their hash didn't change. Then it will remove empty directories left behind. @@ -523,7 +537,7 @@ ['/opt/local/lib/python2.6/site-packages/zlib/file1', '/opt/local/lib/python2.6/site-packages/zlib/file2'] -If the project is not found, a ``DistutilsUninstallError`` will be raised. +If the distribution is not found, a ``DistutilsUninstallError`` will be raised. Filtering --------- @@ -556,7 +570,7 @@ As explained earlier in this PEP, the `install` command adds an `INSTALLER` file in the `.egg-info` directory with the name of the installer. -To avoid removing projects that where installed by another packaging system, +To avoid removing distributions that where installed by another packaging system, the ``uninstall`` function takes an extra argument ``installer`` which default to ``distutils``. @@ -571,7 +585,7 @@ >>> uninstall('zlib', installer='cool-pkg-manager') This allows a third-party application to use the ``uninstall`` function -and make sure it's the only program that can remove a project it has +and make sure it's the only program that can remove a distribution it has previously installed. This is useful when a third-party program that relies on Distutils APIs does extra steps on the system at installation time, it has to undo at uninstallation time. @@ -605,6 +619,12 @@ .. [#eggformats] http://peak.telecommunity.com/DevCenter/EggFormats +.. [#pep273] + http://www.python.org/dev/peps/pep-0273 + +.. [distutils] + http://docs.python.org/distutils + Aknowledgments ============== From python-checkins at python.org Mon Jun 22 16:17:05 2009 From: python-checkins at python.org (matthias.klose) Date: Mon, 22 Jun 2009 14:17:05 -0000 Subject: [Python-checkins] r73505 - in python/branches/py3k/Lib: fractions.py lib2to3/refactor.py runpy.py tkinter/tix.py Message-ID: Author: matthias.klose Date: Mon Jun 22 16:17:00 2009 New Revision: 73505 Log: - remove svn:executable property from some library files Modified: python/branches/py3k/Lib/fractions.py (props changed) python/branches/py3k/Lib/lib2to3/refactor.py (props changed) python/branches/py3k/Lib/runpy.py (props changed) python/branches/py3k/Lib/tkinter/tix.py (props changed) From buildbot at python.org Mon Jun 22 17:04:44 2009 From: buildbot at python.org (buildbot at python.org) Date: Mon, 22 Jun 2009 15:04:44 +0000 Subject: [Python-checkins] buildbot failure in sparc solaris10 gcc 3.x Message-ID: The Buildbot has detected a new failure of sparc solaris10 gcc 3.x. Full details are available at: http://www.python.org/dev/buildbot/all/sparc%20solaris10%20gcc%203.x/builds/843 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: loewis-sun Build Reason: Build Source Stamp: [branch branches/py3k] HEAD Blamelist: matthias.klose BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_posix ====================================================================== ERROR: test_getcwd_long_pathnames (test.test_posix.PosixTester) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home2/buildbot/slave/3.x.loewis-sun/build/Lib/test/test_posix.py", line 251, in test_getcwd_long_pathnames support.rmtree(base_path) File "/home2/buildbot/slave/3.x.loewis-sun/build/Lib/test/support.py", line 181, in rmtree shutil.rmtree(path) File "/home2/buildbot/slave/3.x.loewis-sun/build/Lib/shutil.py", line 239, in rmtree onerror(os.rmdir, path, sys.exc_info()) File "/home2/buildbot/slave/3.x.loewis-sun/build/Lib/shutil.py", line 237, in rmtree os.rmdir(path) OSError: [Errno 22] Invalid argument: '/home2/buildbot/slave/3.x.loewis-sun/build/@test.getcwd/@test.getcwd' sincerely, -The Buildbot From python-checkins at python.org Mon Jun 22 20:31:48 2009 From: python-checkins at python.org (benjamin.peterson) Date: Mon, 22 Jun 2009 18:31:48 -0000 Subject: [Python-checkins] r73506 - python/branches/py3k/Lib/lib2to3/refactor.py Message-ID: Author: benjamin.peterson Date: Mon Jun 22 20:31:48 2009 New Revision: 73506 Log: revert 73505 here Modified: python/branches/py3k/Lib/lib2to3/refactor.py (props changed) From python-checkins at python.org Mon Jun 22 20:32:04 2009 From: python-checkins at python.org (benjamin.peterson) Date: Mon, 22 Jun 2009 18:32:04 -0000 Subject: [Python-checkins] r73507 - sandbox/trunk/2to3/lib2to3/refactor.py Message-ID: Author: benjamin.peterson Date: Mon Jun 22 20:32:04 2009 New Revision: 73507 Log: remove svn:executable property Modified: sandbox/trunk/2to3/lib2to3/refactor.py (props changed) From python-checkins at python.org Mon Jun 22 20:33:09 2009 From: python-checkins at python.org (tarek.ziade) Date: Mon, 22 Jun 2009 18:33:09 -0000 Subject: [Python-checkins] r73508 - peps/trunk/pep-0376.txt Message-ID: Author: tarek.ziade Date: Mon Jun 22 20:33:08 2009 New Revision: 73508 Log: removed remaining old names Modified: peps/trunk/pep-0376.txt Modified: peps/trunk/pep-0376.txt ============================================================================== --- peps/trunk/pep-0376.txt (original) +++ peps/trunk/pep-0376.txt Mon Jun 22 20:33:08 2009 @@ -293,7 +293,7 @@ directories. - ``ZippedDistributionDirectory``: manages a zipped directory that contains some `.egg.info` directory. -- ``DistributionDirectories``: manages ``EggInfoDirectory`` instances. +- ``DistributionDirectories``: manages ``DistributionDirectory`` instances. Distribution class ------------------ @@ -402,7 +402,7 @@ and ``ZippedDistributionDirectory`` instances and the keys are their path attributes. -``EggInfoDirectories`` also provides the following methods besides the ones +``DistributionDirectories`` also provides the following methods besides the ones from ``dict``:: - ``append(path)`` From python-checkins at python.org Mon Jun 22 21:33:49 2009 From: python-checkins at python.org (amaury.forgeotdarc) Date: Mon, 22 Jun 2009 19:33:49 -0000 Subject: [Python-checkins] r73509 - python/trunk/Lib/xml/sax/expatreader.py Message-ID: Author: amaury.forgeotdarc Date: Mon Jun 22 21:33:48 2009 New Revision: 73509 Log: #4490 Fix sample code run by "python -m xml.sax.xmlreader" Modified: python/trunk/Lib/xml/sax/expatreader.py Modified: python/trunk/Lib/xml/sax/expatreader.py ============================================================================== --- python/trunk/Lib/xml/sax/expatreader.py (original) +++ python/trunk/Lib/xml/sax/expatreader.py Mon Jun 22 21:33:48 2009 @@ -407,8 +407,8 @@ # --- if __name__ == "__main__": - import xml.sax + import xml.sax.saxutils p = create_parser() - p.setContentHandler(xml.sax.XMLGenerator()) + p.setContentHandler(xml.sax.saxutils.XMLGenerator()) p.setErrorHandler(xml.sax.ErrorHandler()) - p.parse("../../../hamlet.xml") + p.parse("http://www.ibiblio.org/xml/examples/shakespeare/hamlet.xml") From python-checkins at python.org Mon Jun 22 21:36:32 2009 From: python-checkins at python.org (benjamin.peterson) Date: Mon, 22 Jun 2009 19:36:32 -0000 Subject: [Python-checkins] r73510 - in python/branches/py3k: Doc/tools/sphinxext/patchlevel.py Lib/idlelib/EditorWindow.py Tools/msi/msi.py Message-ID: Author: benjamin.peterson Date: Mon Jun 22 21:36:31 2009 New Revision: 73510 Log: Merged revisions 73415,73417-73418 via svnmerge from svn+ssh://pythondev at svn.python.org/python/trunk ........ r73415 | benjamin.peterson | 2009-06-13 09:25:08 -0500 (Sat, 13 Jun 2009) | 1 line use 'rc' for release candidates for consistency ........ r73417 | benjamin.peterson | 2009-06-13 10:42:23 -0500 (Sat, 13 Jun 2009) | 1 line special case release candidates ........ r73418 | benjamin.peterson | 2009-06-13 10:48:04 -0500 (Sat, 13 Jun 2009) | 1 line handle different rc format ........ Modified: python/branches/py3k/ (props changed) python/branches/py3k/Doc/tools/sphinxext/patchlevel.py python/branches/py3k/Lib/idlelib/EditorWindow.py python/branches/py3k/Tools/msi/msi.py Modified: python/branches/py3k/Doc/tools/sphinxext/patchlevel.py ============================================================================== --- python/branches/py3k/Doc/tools/sphinxext/patchlevel.py (original) +++ python/branches/py3k/Doc/tools/sphinxext/patchlevel.py Mon Jun 22 21:36:31 2009 @@ -41,7 +41,7 @@ suffixes = { 'PY_RELEASE_LEVEL_ALPHA': 'a', 'PY_RELEASE_LEVEL_BETA': 'b', - 'PY_RELEASE_LEVEL_GAMMA': 'c', + 'PY_RELEASE_LEVEL_GAMMA': 'rc', } if level != 'PY_RELEASE_LEVEL_FINAL': release += suffixes[level] + str(int(d['PY_RELEASE_SERIAL'])) Modified: python/branches/py3k/Lib/idlelib/EditorWindow.py ============================================================================== --- python/branches/py3k/Lib/idlelib/EditorWindow.py (original) +++ python/branches/py3k/Lib/idlelib/EditorWindow.py Mon Jun 22 21:36:31 2009 @@ -29,8 +29,10 @@ major, minor, micro, level, serial = sys.version_info release = '%s%s' % (major, minor) if micro: - release += '%s' % micro - if level != 'final': + release += '%s' % (micro,) + if level == 'candidate': + release += 'rc%s' % (serial,) + elif level != 'final': release += '%s%s' % (level[0], serial) return release Modified: python/branches/py3k/Tools/msi/msi.py ============================================================================== --- python/branches/py3k/Tools/msi/msi.py (original) +++ python/branches/py3k/Tools/msi/msi.py Mon Jun 22 21:36:31 2009 @@ -120,7 +120,10 @@ if micro: docfile = str(micro) if level < 0xf: - docfile = '%x%s' % (level, serial) + if level == 0xC: + docfile = "rc%s" % (serial,) + else: + docfile = '%x%s' % (level, serial) docfile = 'python%s%s%s.chm' % (major, minor, docfile) # Build the mingw import library, libpythonXY.a From buildbot at python.org Mon Jun 22 21:58:40 2009 From: buildbot at python.org (buildbot at python.org) Date: Mon, 22 Jun 2009 19:58:40 +0000 Subject: [Python-checkins] buildbot failure in OS X x86 trunk Message-ID: The Buildbot has detected a new failure of OS X x86 trunk. Full details are available at: http://www.python.org/dev/buildbot/all/OS%20X%20x86%20trunk/builds/719 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: noller-osx86 Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: amaury.forgeotdarc BUILD FAILED: failed test Excerpt from the test logfile: make: *** [buildbottest] Abort trap sincerely, -The Buildbot From buildbot at python.org Mon Jun 22 22:21:16 2009 From: buildbot at python.org (buildbot at python.org) Date: Mon, 22 Jun 2009 20:21:16 +0000 Subject: [Python-checkins] buildbot failure in amd64 gentoo 3.x Message-ID: The Buildbot has detected a new failure of amd64 gentoo 3.x. Full details are available at: http://www.python.org/dev/buildbot/all/amd64%20gentoo%203.x/builds/831 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: norwitz-amd64 Build Reason: Build Source Stamp: [branch branches/py3k] HEAD Blamelist: benjamin.peterson BUILD FAILED: failed failed slave lost sincerely, -The Buildbot From buildbot at python.org Mon Jun 22 23:25:22 2009 From: buildbot at python.org (buildbot at python.org) Date: Mon, 22 Jun 2009 21:25:22 +0000 Subject: [Python-checkins] buildbot failure in sparc solaris10 gcc 3.x Message-ID: The Buildbot has detected a new failure of sparc solaris10 gcc 3.x. Full details are available at: http://www.python.org/dev/buildbot/all/sparc%20solaris10%20gcc%203.x/builds/845 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: loewis-sun Build Reason: Build Source Stamp: [branch branches/py3k] HEAD Blamelist: benjamin.peterson BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_posix ====================================================================== ERROR: test_getcwd_long_pathnames (test.test_posix.PosixTester) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home2/buildbot/slave/3.x.loewis-sun/build/Lib/test/test_posix.py", line 251, in test_getcwd_long_pathnames support.rmtree(base_path) File "/home2/buildbot/slave/3.x.loewis-sun/build/Lib/test/support.py", line 181, in rmtree shutil.rmtree(path) File "/home2/buildbot/slave/3.x.loewis-sun/build/Lib/shutil.py", line 239, in rmtree onerror(os.rmdir, path, sys.exc_info()) File "/home2/buildbot/slave/3.x.loewis-sun/build/Lib/shutil.py", line 237, in rmtree os.rmdir(path) OSError: [Errno 22] Invalid argument: '/home2/buildbot/slave/3.x.loewis-sun/build/@test.getcwd/@test.getcwd' sincerely, -The Buildbot From python-checkins at python.org Tue Jun 23 00:11:04 2009 From: python-checkins at python.org (r.david.murray) Date: Mon, 22 Jun 2009 22:11:04 -0000 Subject: [Python-checkins] r73511 - python/trunk/Doc/library/functions.rst Message-ID: Author: r.david.murray Date: Tue Jun 23 00:11:04 2009 New Revision: 73511 Log: Improve English phrasing. Modified: python/trunk/Doc/library/functions.rst Modified: python/trunk/Doc/library/functions.rst ============================================================================== --- python/trunk/Doc/library/functions.rst (original) +++ python/trunk/Doc/library/functions.rst Tue Jun 23 00:11:04 2009 @@ -151,7 +151,7 @@ ``'exec'`` if *source* consists of a sequence of statements, ``'eval'`` if it consists of a single expression, or ``'single'`` if it consists of a single interactive statement (in the latter case, expression statements that - evaluate to something else than ``None`` will be printed). + evaluate to something other than ``None`` will be printed). The optional arguments *flags* and *dont_inherit* control which future statements (see :pep:`236`) affect the compilation of *source*. If neither From python-checkins at python.org Tue Jun 23 00:38:49 2009 From: python-checkins at python.org (benjamin.peterson) Date: Mon, 22 Jun 2009 22:38:49 -0000 Subject: [Python-checkins] r73512 - sandbox/trunk/2to3/test.py Message-ID: Author: benjamin.peterson Date: Tue Jun 23 00:38:49 2009 New Revision: 73512 Log: run with latest python Modified: sandbox/trunk/2to3/test.py Modified: sandbox/trunk/2to3/test.py ============================================================================== --- sandbox/trunk/2to3/test.py (original) +++ sandbox/trunk/2to3/test.py Tue Jun 23 00:38:49 2009 @@ -1,4 +1,4 @@ -#!/usr/bin/env python2.5 +#!/usr/bin/env python """Main test file for 2to3. From buildbot at python.org Tue Jun 23 00:53:54 2009 From: buildbot at python.org (buildbot at python.org) Date: Mon, 22 Jun 2009 22:53:54 +0000 Subject: [Python-checkins] buildbot failure in x86 XP-4 trunk Message-ID: The Buildbot has detected a new failure of x86 XP-4 trunk. Full details are available at: http://www.python.org/dev/buildbot/all/x86%20XP-4%20trunk/builds/2266 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: bolen-windows Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: amaury.forgeotdarc BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_bsddb3 ====================================================================== ERROR: test01_basic_replication (bsddb.test.test_replication.DBReplicationManager) ---------------------------------------------------------------------- Traceback (most recent call last): File "E:\cygwin\home\db3l\buildarea\trunk.bolen-windows\build\lib\bsddb\test\test_replication.py", line 170, in test01_basic_replication mode=0666, txn=txn) DBNoSuchFileError: (2, 'No such file or directory -- connection closed: Successful return: 0') ====================================================================== ERROR: test01_basic_replication (bsddb.test.test_replication.DBReplicationManager) ---------------------------------------------------------------------- Traceback (most recent call last): File "E:\cygwin\home\db3l\buildarea\trunk.bolen-windows\build\lib\bsddb\test\test_replication.py", line 58, in tearDown if self.dbClient : DBError: (0, 'DB object has been closed') ====================================================================== FAIL: test01_basic_replication (bsddb.test.test_replication.DBBaseReplication) ---------------------------------------------------------------------- Traceback (most recent call last): File "E:\cygwin\home\db3l\buildarea\trunk.bolen-windows\build\lib\bsddb\test\test_replication.py", line 315, in test01_basic_replication self.assertTrue(time.time() Author: benjamin.peterson Date: Tue Jun 23 03:18:57 2009 New Revision: 73513 Log: fix grammar Modified: python/trunk/Python/symtable.c Modified: python/trunk/Python/symtable.c ============================================================================== --- python/trunk/Python/symtable.c (original) +++ python/trunk/Python/symtable.c Tue Jun 23 03:18:57 2009 @@ -492,7 +492,7 @@ case OPT_IMPORT_STAR: PyOS_snprintf(buf, sizeof(buf), "import * is not allowed in function '%.100s' " - "because it is %s", + "because it %s", PyString_AS_STRING(ste->ste_name), trailer); break; case OPT_BARE_EXEC: From buildbot at python.org Tue Jun 23 03:46:59 2009 From: buildbot at python.org (buildbot at python.org) Date: Tue, 23 Jun 2009 01:46:59 +0000 Subject: [Python-checkins] buildbot failure in x86 osx.5 trunk Message-ID: The Buildbot has detected a new failure of x86 osx.5 trunk. Full details are available at: http://www.python.org/dev/buildbot/all/x86%20osx.5%20trunk/builds/1219 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: heller-x86-osx5 Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: benjamin.peterson,r.david.murray BUILD FAILED: failed test Excerpt from the test logfile: make: *** [buildbottest] Abort trap sincerely, -The Buildbot From python-checkins at python.org Tue Jun 23 05:01:56 2009 From: python-checkins at python.org (benjamin.peterson) Date: Tue, 23 Jun 2009 03:01:56 -0000 Subject: [Python-checkins] r73514 - in python/trunk: Include/symtable.h Modules/symtablemodule.c Message-ID: Author: benjamin.peterson Date: Tue Jun 23 05:01:56 2009 New Revision: 73514 Log: remove some unused symtable constants Modified: python/trunk/Include/symtable.h python/trunk/Modules/symtablemodule.c Modified: python/trunk/Include/symtable.h ============================================================================== --- python/trunk/Include/symtable.h (original) +++ python/trunk/Include/symtable.h Tue Jun 23 05:01:56 2009 @@ -63,13 +63,9 @@ #define DEF_LOCAL 2 /* assignment in code block */ #define DEF_PARAM 2<<1 /* formal parameter */ #define USE 2<<2 /* name is used */ -#define DEF_STAR 2<<3 /* parameter is star arg */ -#define DEF_DOUBLESTAR 2<<4 /* parameter is star-star arg */ -#define DEF_INTUPLE 2<<5 /* name defined in tuple in parameters */ -#define DEF_FREE 2<<6 /* name used but not defined in nested block */ -#define DEF_FREE_GLOBAL 2<<7 /* free variable is actually implicit global */ -#define DEF_FREE_CLASS 2<<8 /* free variable from class's method */ -#define DEF_IMPORT 2<<9 /* assignment occurred via import */ +#define DEF_FREE 2<<3 /* name used but not defined in nested block */ +#define DEF_FREE_CLASS 2<<4 /* free variable from class's method */ +#define DEF_IMPORT 2<<5 /* assignment occurred via import */ #define DEF_BOUND (DEF_LOCAL | DEF_PARAM | DEF_IMPORT) Modified: python/trunk/Modules/symtablemodule.c ============================================================================== --- python/trunk/Modules/symtablemodule.c (original) +++ python/trunk/Modules/symtablemodule.c Tue Jun 23 05:01:56 2009 @@ -59,11 +59,7 @@ PyModule_AddIntConstant(m, "DEF_GLOBAL", DEF_GLOBAL); PyModule_AddIntConstant(m, "DEF_LOCAL", DEF_LOCAL); PyModule_AddIntConstant(m, "DEF_PARAM", DEF_PARAM); - PyModule_AddIntConstant(m, "DEF_STAR", DEF_STAR); - PyModule_AddIntConstant(m, "DEF_DOUBLESTAR", DEF_DOUBLESTAR); - PyModule_AddIntConstant(m, "DEF_INTUPLE", DEF_INTUPLE); PyModule_AddIntConstant(m, "DEF_FREE", DEF_FREE); - PyModule_AddIntConstant(m, "DEF_FREE_GLOBAL", DEF_FREE_GLOBAL); PyModule_AddIntConstant(m, "DEF_FREE_CLASS", DEF_FREE_CLASS); PyModule_AddIntConstant(m, "DEF_IMPORT", DEF_IMPORT); PyModule_AddIntConstant(m, "DEF_BOUND", DEF_BOUND); From python-checkins at python.org Tue Jun 23 05:09:33 2009 From: python-checkins at python.org (benjamin.peterson) Date: Tue, 23 Jun 2009 03:09:33 -0000 Subject: [Python-checkins] r73515 - python/branches/py3k/Doc/library/stdtypes.rst Message-ID: Author: benjamin.peterson Date: Tue Jun 23 05:09:33 2009 New Revision: 73515 Log: must be bytes Modified: python/branches/py3k/Doc/library/stdtypes.rst Modified: python/branches/py3k/Doc/library/stdtypes.rst ============================================================================== --- python/branches/py3k/Doc/library/stdtypes.rst (original) +++ python/branches/py3k/Doc/library/stdtypes.rst Tue Jun 23 05:09:33 2009 @@ -2342,7 +2342,7 @@ >>> v = memoryview(data) >>> v.readonly False - >>> v[0] = 'z' + >>> v[0] = b'z' >>> data bytearray(b'zbcefg') >>> v[1:4] = b'123' From python-checkins at python.org Tue Jun 23 10:50:11 2009 From: python-checkins at python.org (tarek.ziade) Date: Tue, 23 Jun 2009 08:50:11 -0000 Subject: [Python-checkins] r73516 - peps/trunk/pep-0376.txt Message-ID: Author: tarek.ziade Date: Tue Jun 23 10:50:10 2009 New Revision: 73516 Log: Fixes from python-dev feedbacks Modified: peps/trunk/pep-0376.txt Modified: peps/trunk/pep-0376.txt ============================================================================== --- peps/trunk/pep-0376.txt (original) +++ peps/trunk/pep-0376.txt Tue Jun 23 10:50:10 2009 @@ -24,15 +24,15 @@ Definitions =========== -A **distribution** is a collection of files, which can be Python modules, -extensions or data. A distribution is managed by a special module called +A **distribution** is a collection of files, which can be Python modules, +extensions or data. A distribution is managed by a special module called `setup.py` which contains a call to the `distutils.core.setup` function. -The arguments passed to that function describe the distribution, like +The arguments passed to that function describe the distribution, like its `name`, its `version`, and so on. -Disutils provides among other things **commands** that can be called -through the shell using the `setup.py` script. A `sdist` command is provided -for instance, to create a source distribution archive. An `install` command +Disutils provides among other things **commands** that can be called +through the shell using the `setup.py` script. A `sdist` command is provided +for instance, to create a source distribution archive. An `install` command is also provided, to perform an installation of the distribution in the Python installation the script is invoked with:: @@ -42,7 +42,7 @@ Once installed, the elements are located in various places in the system, like: -- in Python's site-packages (Python modules, Python modules organized into +- in Python's site-packages (Python modules, Python modules organized into packages, Extensions, etc.) - in Python's `include` directory. - in Python's `bin` or `Script` directory. @@ -51,7 +51,7 @@ Rationale ========= -There are two problems right now in the way distributions are installed in +There are two problems right now in the way distributions are installed in Python: - There are too many ways to do it. @@ -72,17 +72,18 @@ The `install_egg_info` subcommand is called during this process, in order to create an `.egg-info` file in the `purelib` directory. -For example, if the `zlib` distribution (which contains one package) is -installed, two elements will be installed in `site-packages`:: +For example, for the `docutils` distribution, which contains one package an +extra module and executable scripts, three elements will be installed in +`site-packages`:: + + - docutils : the docutils pakage + - roman.py : an extra module used by docutils + - docutils-0.5-py2.6.egg-info : a file containing the distribution metadata + as described in PEP 314 [#pep314]_. This file corresponds to the file + called `PKG-INFO`, built by the `sdist` command. - - zlib - - zlib-2.5.2-py2.4.egg-info - -Where `zlib` is a Python package, and `zlib-2.5.2-py2.4.egg-info` is -a file containing the distribution metadata as described in PEP 314 [#pep314]_. - -This file corresponds to the file called `PKG-INFO`, built by -the `sdist` command. +Some executable scripts such as `rst2html.py` will also be added in the `bin` +directory of the Python installation. The problem is that many people use `easy_install` (setuptools [#setuptools]_) or `pip` [#pip]_ to install their packages, and these third-party tools do not @@ -90,7 +91,7 @@ - `easy_install` creates an `EGG-INFO` directory inside an `.egg` directory, and adds a `PKG-INFO` file inside this directory. The `.egg` directory - contains in that case all the elements of the distribution that are supposed + contains in that case all the elements of the distribution that are supposed to be installed in `site-packages`, and is placed in the `site-packages` directory. @@ -105,11 +106,11 @@ --------------------- Distutils doesn't provide any `uninstall` command. If you want to uninstall -a distribution, you have to be a power user and remove the various elements +a distribution, you have to be a power user and remove the various elements that were installed. Then look over the `.pth` file to clean them if necessary. And the process differs, depending on the tools you have used to install the -distribution, and if the distribution's `setup.py` uses Distutils or +distribution, and if the distribution's `setup.py` uses Distutils or Setuptools. Under some circumstances, you might not be able to know for sure that you @@ -157,11 +158,12 @@ the fact that they already work with a directory that contains a `PKG-INFO` file, the change will have no deep consequences. -For example, if the `zlib` package is installed, the elements that +For example, if the `docutils` package is installed, the elements that will be installed in `site-packages` will become:: - - zlib - - zlib-2.5.2.egg-info/ + - docutils + - roman.py + - docutils-0.5-py2.6.egg-info/ PKG-INFO The syntax of the egg-info directory name is as follows:: @@ -179,8 +181,8 @@ Examples:: - >>> egginfo_dirname('zlib', '2.5.2') - 'zlib-2.5.2.egg-info' + >>> egginfo_dirname('docutils', '0.5') + 'docutils-0.5.egg-info' >>> egginfo_dirname('python-ldap', '2.5') 'python_ldap-2.5.egg-info' @@ -213,13 +215,13 @@ - field delimiter : `,` - quoting char : `"`. -- line terminator : `\r\n` +- line terminator : ``os.linesep`` (so `\r\n` or `\r`) Each record is composed of three elements. - the file's full **path** - - if the installed file is located in the directory where the .egg-info + - if the installed file is located in the directory where the `.egg-info` directory of the package is located, it will be a '/'-separated relative path, no matter what is the target system. This makes this information cross-compatible and allows simple installation to be relocatable. @@ -228,7 +230,10 @@ '/'-separated absolute path is used. - the **MD5** hash of the file, encoded in hex. Notice that `pyc` and `pyo` - generated files will not have a hash. + generated files will not have a hash because they are automatically produced + from `py` files. So checking the hash of the corresponding `py` file is + enough to decide if the file and its associated `pyc` or `pyo` files have + changed. - the file's size in bytes @@ -236,6 +241,11 @@ so the field separator will be ",". Any "," characters found within a field will be escaped automatically by ``csv``. +When the file is read, the `U` option will be used so the universal newline +support (see PEP 278 [pep278]_) will be activated, avoiding any trouble +reading a file produced on a platform that uses a different new line +terminator. + Example ------- @@ -282,8 +292,8 @@ To use the `.egg-info` directory content, we need to add in the standard library a set of APIs. The best place to put these APIs seems to be `pkgutil`. -The API is organized in five classes that work with directories and Zip files -(so its works with files included in Zip files, see PEP 273 for more details +The API is organized in five classes that work with directories and Zip files +(so its works with files included in Zip files, see PEP 273 for more details [pep273]_. - ``Distribution``: manages an `.egg-info` directory. @@ -364,7 +374,7 @@ It also provides two methods besides the ones from ``set``: -- ``file_users(path)`` -> Iterator of ``Distribution``. +- ``get_file_users(path)`` -> Iterator of ``Distribution``. Returns all ``Distribution`` which uses ``path``, by calling ``Distribution.uses(path)`` on all ``Distribution`` instances. @@ -405,12 +415,7 @@ ``DistributionDirectories`` also provides the following methods besides the ones from ``dict``:: -- ``append(path)`` - - Creates an ``DistributionDirectory`` (or ``ZippedDistributionDirectory``) - instance for ``path`` and adds it in the mapping. - -- ``load(paths)`` +- ``load(*paths)`` Creates and adds ``DistributionDirectory`` (or ``ZippedDistributionDirectory``) instances corresponding to ``paths``. @@ -466,7 +471,7 @@ Iterates over all distributions to find out which distributions uses ``path``. ``path`` can be a local absolute path or a relative '/'-separated path. -All these functions use the same global instance of ``DistributionDirectories`` +All these functions use the same global instance of ``DistributionDirectories`` to use the cache. Notice that the cache is never emptied explicitely. Example @@ -482,7 +487,7 @@ '2.5.2' >>> for path, hash, size in dist.get_installed_files():: - ... print '%s %s %d %s' % (path, hash, size) + ... print '%s %s %d' % (path, hash, size) ... zlib/include/zconf.h b690274f621402dda63bf11ba5373bf2 9544 zlib/include/zlib.h 9c4b84aff68aa55f2e9bf70481b94333 66188 @@ -520,12 +525,12 @@ Adding an Uninstall function ============================ -Distutils already provides a very basic way to install a distribution, which -is running the `install` command over the `setup.py` script of the +Distutils already provides a very basic way to install a distribution, which +is running the `install` command over the `setup.py` script of the distribution. Distutils will provide a very basic ``uninstall`` function, that will be added -in ``distutils.util`` and will take the name of the distribution to uninstall +in ``distutils.util`` and will take the name of the distribution to uninstall as its argument. ``uninstall`` will use the APIs desribed earlier and remove all unique files, as long as their hash didn't change. Then it will remove empty directories left behind. @@ -622,6 +627,10 @@ .. [#pep273] http://www.python.org/dev/peps/pep-0273 +.. [#pep2738] + http://www.python.org/dev/peps/pep-0278 + + .. [distutils] http://docs.python.org/distutils From python-checkins at python.org Tue Jun 23 10:55:56 2009 From: python-checkins at python.org (tarek.ziade) Date: Tue, 23 Jun 2009 08:55:56 -0000 Subject: [Python-checkins] r73517 - peps/trunk/pep-0376.txt Message-ID: Author: tarek.ziade Date: Tue Jun 23 10:55:56 2009 New Revision: 73517 Log: specifying that get_egginfo_file opens in read-only mode Modified: peps/trunk/pep-0376.txt Modified: peps/trunk/pep-0376.txt ============================================================================== --- peps/trunk/pep-0376.txt (original) +++ peps/trunk/pep-0376.txt Tue Jun 23 10:55:56 2009 @@ -344,7 +344,8 @@ If ``path`` is an absolute path and doesn't start with the `.egg-info` directory path, a ``DistutilsError`` is raised. - If ``binary`` is ``True``, opens the file in binary mode. + If ``binary`` is ``True``, opens the file in read-only binary mode (`rb`), + otherwise opens it in read-only mode (`r`). - ``get_egginfo_files(local=False)`` -> iterator of paths From python-checkins at python.org Tue Jun 23 12:19:30 2009 From: python-checkins at python.org (nick.coghlan) Date: Tue, 23 Jun 2009 10:19:30 -0000 Subject: [Python-checkins] r73518 - python/trunk/Lib/contextlib.py Message-ID: Author: nick.coghlan Date: Tue Jun 23 12:19:30 2009 New Revision: 73518 Log: Issue 6288: Update contextlib.nested() docstring to reflect new documentation Modified: python/trunk/Lib/contextlib.py Modified: python/trunk/Lib/contextlib.py ============================================================================== --- python/trunk/Lib/contextlib.py (original) +++ python/trunk/Lib/contextlib.py Tue Jun 23 12:19:30 2009 @@ -87,19 +87,17 @@ @contextmanager def nested(*managers): - """Support multiple context managers in a single with-statement. + """Combine multiple context managers into a single nested context manager. - Code like this: - - with nested(A, B, C) as (X, Y, Z): - + This function has been deprecated in favour of the multiple manager form + of the :keyword:`with` statement. - is equivalent to this: + The one advantage of this function over the multiple manager form of the + :keyword:`with` statement is that argument unpacking allows it to be + used with a variable number of context managers as follows: - with A as X: - with B as Y: - with C as Z: - + with nested(*managers): + do_something() """ warn("With-statements now directly support multiple context managers", From buildbot at python.org Tue Jun 23 12:47:01 2009 From: buildbot at python.org (buildbot at python.org) Date: Tue, 23 Jun 2009 10:47:01 +0000 Subject: [Python-checkins] buildbot failure in x86 osx.5 trunk Message-ID: The Buildbot has detected a new failure of x86 osx.5 trunk. Full details are available at: http://www.python.org/dev/buildbot/all/x86%20osx.5%20trunk/builds/1221 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: heller-x86-osx5 Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: nick.coghlan BUILD FAILED: failed test Excerpt from the test logfile: Traceback (most recent call last): File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/test/test_thread.py", line 51, in task self.done_mutex.release() thread.error: release unlocked lock Traceback (most recent call last): File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/test/test_thread.py", line 51, in task self.done_mutex.release() thread.error: release unlocked lock Traceback (most recent call last): File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/test/test_thread.py", line 51, in task self.done_mutex.release() thread.error: release unlocked lock Traceback (most recent call last): File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/test/test_thread.py", line 51, in task self.done_mutex.release() thread.error: release unlocked lock Traceback (most recent call last): File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/test/test_thread.py", line 51, in task self.done_mutex.release() thread.error: release unlocked lock make: *** [buildbottest] Abort trap sincerely, -The Buildbot From python-checkins at python.org Tue Jun 23 12:51:02 2009 From: python-checkins at python.org (nick.coghlan) Date: Tue, 23 Jun 2009 10:51:02 -0000 Subject: [Python-checkins] r73519 - python/trunk/Lib/contextlib.py Message-ID: Author: nick.coghlan Date: Tue Jun 23 12:51:02 2009 New Revision: 73519 Log: Remove markup from docstring Modified: python/trunk/Lib/contextlib.py Modified: python/trunk/Lib/contextlib.py ============================================================================== --- python/trunk/Lib/contextlib.py (original) +++ python/trunk/Lib/contextlib.py Tue Jun 23 12:51:02 2009 @@ -90,10 +90,10 @@ """Combine multiple context managers into a single nested context manager. This function has been deprecated in favour of the multiple manager form - of the :keyword:`with` statement. + of the with statement. The one advantage of this function over the multiple manager form of the - :keyword:`with` statement is that argument unpacking allows it to be + with statement is that argument unpacking allows it to be used with a variable number of context managers as follows: with nested(*managers): From python-checkins at python.org Tue Jun 23 12:55:52 2009 From: python-checkins at python.org (nick.coghlan) Date: Tue, 23 Jun 2009 10:55:52 -0000 Subject: [Python-checkins] r73520 - in python/branches/py3k: Lib/contextlib.py Message-ID: Author: nick.coghlan Date: Tue Jun 23 12:55:52 2009 New Revision: 73520 Log: Merged revisions 73518-73519 via svnmerge from svn+ssh://pythondev at svn.python.org/python/trunk ........ r73518 | nick.coghlan | 2009-06-23 20:19:30 +1000 (Tue, 23 Jun 2009) | 1 line Issue 6288: Update contextlib.nested() docstring to reflect new documentation ........ r73519 | nick.coghlan | 2009-06-23 20:51:02 +1000 (Tue, 23 Jun 2009) | 1 line Remove markup from docstring ........ Modified: python/branches/py3k/ (props changed) python/branches/py3k/Lib/contextlib.py Modified: python/branches/py3k/Lib/contextlib.py ============================================================================== --- python/branches/py3k/Lib/contextlib.py (original) +++ python/branches/py3k/Lib/contextlib.py Tue Jun 23 12:55:52 2009 @@ -87,19 +87,17 @@ @contextmanager def nested(*managers): - """Support multiple context managers in a single with-statement. + """Combine multiple context managers into a single nested context manager. - Code like this: - - with nested(A, B, C) as (X, Y, Z): - + This function has been deprecated in favour of the multiple manager form + of the with statement. - is equivalent to this: + The one advantage of this function over the multiple manager form of the + with statement is that argument unpacking allows it to be + used with a variable number of context managers as follows: - with A as X: - with B as Y: - with C as Z: - + with nested(*managers): + do_something() """ warn("With-statements now directly support multiple context managers", From buildbot at python.org Tue Jun 23 14:05:45 2009 From: buildbot at python.org (buildbot at python.org) Date: Tue, 23 Jun 2009 12:05:45 +0000 Subject: [Python-checkins] buildbot failure in x86 osx.5 3.x Message-ID: The Buildbot has detected a new failure of x86 osx.5 3.x. Full details are available at: http://www.python.org/dev/buildbot/all/x86%20osx.5%203.x/builds/1054 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: heller-x86-osx5 Build Reason: Build Source Stamp: [branch branches/py3k] HEAD Blamelist: nick.coghlan BUILD FAILED: failed test Excerpt from the test logfile: sincerely, -The Buildbot From python-checkins at python.org Tue Jun 23 14:14:02 2009 From: python-checkins at python.org (tarek.ziade) Date: Tue, 23 Jun 2009 12:14:02 -0000 Subject: [Python-checkins] r73521 - peps/trunk/pep-0376.txt Message-ID: Author: tarek.ziade Date: Tue Jun 23 14:14:02 2009 New Revision: 73521 Log: using docutils in all examples + polished reST Modified: peps/trunk/pep-0376.txt Modified: peps/trunk/pep-0376.txt ============================================================================== --- peps/trunk/pep-0376.txt (original) +++ peps/trunk/pep-0376.txt Tue Jun 23 14:14:02 2009 @@ -32,13 +32,13 @@ Disutils provides among other things **commands** that can be called through the shell using the `setup.py` script. A `sdist` command is provided -for instance, to create a source distribution archive. An `install` command -is also provided, to perform an installation of the distribution in the Python +for instance to create a source distribution archive. An `install` command +is also provided to perform an installation of the distribution in the Python installation the script is invoked with:: $ python setup.py install -See the Distutils [distutils]_ documentation for more information. +See the Distutils [#distutils]_ documentation for more information. Once installed, the elements are located in various places in the system, like: @@ -64,8 +64,8 @@ is installed in various directories. The pure Python code for instance is installed in the `purelib` directory, -which is located in the Python installation in `lib\python2.6\site-packages` -for example under unix-like systems or Mac OS X, and in `Lib/site-packages` +which is located in the Python installation in ``lib\python2.6\site-packages`` +for example under unix-like systems or Mac OS X, and in ``Lib/site-packages`` under Windows. This is done with the Distutils `install` command, which calls various subcommands. @@ -74,20 +74,21 @@ For example, for the `docutils` distribution, which contains one package an extra module and executable scripts, three elements will be installed in -`site-packages`:: +`site-packages`: - - docutils : the docutils pakage - - roman.py : an extra module used by docutils - - docutils-0.5-py2.6.egg-info : a file containing the distribution metadata - as described in PEP 314 [#pep314]_. This file corresponds to the file - called `PKG-INFO`, built by the `sdist` command. +- `docutils` : the ``docutils`` pakage +- `roman.py` : an extra module used by `docutils` +- `docutils-0.5-py2.6.egg-info` : a file containing the distribution metadata + as described in PEP 314 [#pep314]_. This file corresponds to the file + called `PKG-INFO`, built by the `sdist` command. Some executable scripts such as `rst2html.py` will also be added in the `bin` directory of the Python installation. -The problem is that many people use `easy_install` (setuptools [#setuptools]_) -or `pip` [#pip]_ to install their packages, and these third-party tools do not -install packages in the same way that Distutils does: +The problem is that many people use `easy_install` (from the `setuptools` +project [#setuptools]_) or `pip` [#pip]_ to install their packages, and +these third-party tools do not install packages in the same way that Distutils +does: - `easy_install` creates an `EGG-INFO` directory inside an `.egg` directory, and adds a `PKG-INFO` file inside this directory. The `.egg` directory @@ -115,7 +116,7 @@ Under some circumstances, you might not be able to know for sure that you have removed everything, or that you didn't break another distribution by -removing a file that was shared among several distributions. +removing a file that is shared among several distributions. But there's common behavior: when you install a distribution, files are copied in your system. And there's a way to keep track of theses files, so to remove @@ -161,7 +162,7 @@ For example, if the `docutils` package is installed, the elements that will be installed in `site-packages` will become:: - - docutils + - docutils/ - roman.py - docutils-0.5-py2.6.egg-info/ PKG-INFO @@ -215,7 +216,7 @@ - field delimiter : `,` - quoting char : `"`. -- line terminator : ``os.linesep`` (so `\r\n` or `\r`) +- line terminator : ``os.linesep`` (so ``\r\n`` or ``\r``) Each record is composed of three elements. @@ -242,33 +243,34 @@ will be escaped automatically by ``csv``. When the file is read, the `U` option will be used so the universal newline -support (see PEP 278 [pep278]_) will be activated, avoiding any trouble +support (see PEP 278 [#pep278]_) will be activated, avoiding any trouble reading a file produced on a platform that uses a different new line terminator. Example ------- -Back to our `zlib` example, we will have:: +Back to our `docutils` example, we will have:: - - zlib - - zlib-2.5.2.egg-info/ + - docutils/ + - roman.py + - docutils-0.5-py2.6.egg-info/ PKG-INFO RECORD -And the RECORD file will contain:: +And the RECORD file will contain (extract):: - zlib/include/zconf.h,b690274f621402dda63bf11ba5373bf2,9544 - zlib/include/zlib.h,9c4b84aff68aa55f2e9bf70481b94333,66188 - zlib/lib/libz.a,e6d43fb94292411909404b07d0692d46,91128 - zlib/share/man/man3/zlib.3,785dc03452f0508ff0678fba2457e0ba,4486 - zlib-2.5.2.egg-info/PKG-INFO,6fe57de576d749536082d8e205b77748,195 - zlib-2.5.2.egg-info/RECORD + docutils/__init__.py,b690274f621402dda63bf11ba5373bf2,9544 + docutils/core.py,9c4b84aff68aa55f2e9bf70481b94333,66188 + roman.py,a4b84aff68aa55f2e9bf70481b943D3,234 + /usr/local/bin/rst2html.py,a4b84aff68aa55f2e9bf70481b943D3,234 + docutils-0.5-py2.6.egg-info/PKG-INFO,6fe57de576d749536082d8e205b77748,195 + docutils-0.5-py2.6.egg-info/RECORD Notice that: - the `RECORD` file can't contain a hash of itself and is just mentioned here -- `zlib` and `zlib-2.5.2.egg-info` are located in `site-packages` so the file +- `docutils` and `docutils-0.5-py2.6.egg-info` are located in `site-packages` so the file paths are relative to it. Adding an INSTALLER file in the .egg-info directory @@ -294,7 +296,7 @@ The API is organized in five classes that work with directories and Zip files (so its works with files included in Zip files, see PEP 273 for more details -[pep273]_. +[#pep273]_. - ``Distribution``: manages an `.egg-info` directory. - ``ZippedDistribution``: manages an `.egg-info` directory contained in a zip @@ -312,6 +314,10 @@ `.egg-info` directory provided to the contructor. It reads the metadata contained in `PKG-INFO` when it is instanciated. +``Distribution(path)`` -> instance + + Creates a ``Distribution`` instance for the given ``path``. + ``Distribution`` provides the following attributes: - ``name``: The name of the distribution. @@ -338,7 +344,7 @@ Returns a ``file`` instance for the file pointed by ``path``. - ``path`` has to be a '/'-separated path relative to the `.egg-info` + ``path`` has to be a '/'-separated path relative to the `.egg-info` directory or an absolute path. If ``path`` is an absolute path and doesn't start with the `.egg-info` @@ -362,6 +368,12 @@ A ``ZippedDistribution`` class is provided. It overrides the ``Distribution`` class so its methods work with an `.egg.info` directory located in a zip file. +``ZippedDistribution(zipfile, path)`` -> instance + + Creates a ``ZippedDistribution`` instance for the given relative ``path`` + located in the ``zipfile`` file. + +Other public methods and attributes are similar to ``Distribution``. DistributionDirectory class --------------------------- @@ -373,17 +385,17 @@ The class is a ``set`` of ``Distribution`` instances. ``DistributionDirectory`` provides a ``path`` attribute corresponding to the path is was created with. -It also provides two methods besides the ones from ``set``: +``DistributionDirectory(path)`` -> instance + + Creates a ``DistributionDirectory`` instance for the given ``path``. + +It also provides one extra method besides the ones from ``set``: - ``get_file_users(path)`` -> Iterator of ``Distribution``. Returns all ``Distribution`` which uses ``path``, by calling ``Distribution.uses(path)`` on all ``Distribution`` instances. -- ``owner(path)`` -> ``Distribution`` instance or None - - If ``path`` is used by only one ``Distribution`` instance, returns it. - Otherwise returns None. ZippedDistributionDirectory class --------------------------------- @@ -391,30 +403,42 @@ A ``ZippedDistributionDirectory`` is provided. It overrides the ``DistributionDirectory`` class so its methods work with a Zip file. +``ZippedDistributionDirectory(path)`` -> instance + + Creates a ``ZippedDistributionDirectory`` instance for the given ``path``. + +Other public methods and attributes are similar to ``DistributionDirectory``. + DistributionDirectories class ----------------------------- A new class called ``DistributionDirectories`` is created. It's a collection of ``DistributionDirectory`` and ``ZippedDistributionDirectory`` instances. -The constructor takes one optional argument ``use_cache`` set to ``True`` by -default. When ``True``, ``DistributionDirectories`` will use a global cache -to reduce the numbers of I/O accesses and speed up the lookups. - -The cache is a global mapping containing ``DistributionDirectory`` and -``ZippedDistributionDirectory`` instances. When an ``DistributionDirectories`` -object is created, it will use the cache to add an entry for each path it -visits, or reuse existing entries. The cache usage can be disabled at any time -with the ``use_cache`` attribute. -The cache can also be emptied with the global ``purge_cache`` function. +``DistributionDirectories(paths=None, use_cache=True)`` -> instance + + If ``paths`` is not not, it's a sequence of paths the constructor loads + in the instance. + + The constructor also takes an optional ``use_cache`` argument. + When it's ``True``, ``DistributionDirectories`` will use a global + cache to reduce the numbers of I/O accesses and speed up the lookups. + + The cache is a global mapping containing ``DistributionDirectory`` and + ``ZippedDistributionDirectory`` instances. When a + ``DistributionDirectories`` object is created, it will use the cache to + add an entry for each path it visits, or reuse existing entries. The + cache usage can be disabled at any time with the ``use_cache`` attribute. + + The cache can also be emptied with the global ``purge_cache`` function. The class is a ``dict`` where the values are ``DistributionDirectory`` and ``ZippedDistributionDirectory`` instances and the keys are their path attributes. ``DistributionDirectories`` also provides the following methods besides the ones -from ``dict``:: +from ``dict``: - ``load(*paths)`` @@ -478,26 +502,29 @@ Example ------- -Let's use some of the new APIs with our `zlib` example:: +Let's use some of the new APIs with our `docutils` example:: >>> from pkgutil import get_distribution, get_file_users - >>> dist = get_distribution('zlib') + >>> dist = get_distribution('docutils') >>> dist.name - 'zlib' + 'docutils' >>> dist.metadata.version - '2.5.2' + '0.5' >>> for path, hash, size in dist.get_installed_files():: ... print '%s %s %d' % (path, hash, size) ... - zlib/include/zconf.h b690274f621402dda63bf11ba5373bf2 9544 - zlib/include/zlib.h 9c4b84aff68aa55f2e9bf70481b94333 66188 - zlib/lib/libz.a e6d43fb94292411909404b07d0692d46 91128 - zlib/share/man/man3/zlib.3 785dc03452f0508ff0678fba2457e0ba 4486 - zlib-2.5.2.egg-info/PKG-INFO 6fe57de576d749536082d8e205b77748 195 - zlib-2.5.2.egg-info/RECORD None None + docutils/__init__.py b690274f621402dda63bf11ba5373bf2 9544 + docutils/core.py 9c4b84aff68aa55f2e9bf70481b94333 66188 + roman.py a4b84aff68aa55f2e9bf70481b943D3 234 + /usr/local/bin/rst2html.py a4b84aff68aa55f2e9bf70481b943D3 234 + docutils-0.5-py2.6.egg-info/PKG-INFO 6fe57de576d749536082d8e205b77748 195 + docutils-0.5-py2.6.egg-info/RECORD None None + + >>> dist.uses('docutils/core.py') + True - >>> dist.uses('zlib/include/zlib.h') + >>> dist.uses('/usr/local/bin/rst2html.py') True >>> dist.get_egginfo_file('PKG-INFO') @@ -539,9 +566,10 @@ ``uninstall`` will return a list of uninstalled files:: >>> from distutils.util import uninstall - >>> uninstall('zlib') - ['/opt/local/lib/python2.6/site-packages/zlib/file1', - '/opt/local/lib/python2.6/site-packages/zlib/file2'] + >>> uninstall('docutils') + ['/opt/local/lib/python2.6/site-packages/docutils/core.py', + ... + '/opt/local/lib/python2.6/site-packages/docutils/__init__.py'] If the distribution is not found, a ``DistutilsUninstallError`` will be raised. @@ -559,13 +587,13 @@ ... logging.info('Removing %s' % path) ... return True ... - >>> uninstall('zlib', _remove_and_log) + >>> uninstall('docutils', _remove_and_log) >>> def _dry_run(path): ... logging.info('Removing %s (dry run)' % path) ... return False ... - >>> uninstall('zlib', _dry_run) + >>> uninstall('docutils', _dry_run) Of course, a third-party tool can use ``pkgutil`` APIs to implement its own uninstall feature. @@ -583,12 +611,12 @@ When called, ``uninstall`` will control that the ``INSTALLER`` file matches this argument. If not, it will raise a ``DistutilsUninstallError``:: - >>> uninstall('zlib') + >>> uninstall('docutils') Traceback (most recent call last): ... - DistutilsUninstallError: zlib was installed by 'cool-pkg-manager' + DistutilsUninstallError: docutils was installed by 'cool-pkg-manager' - >>> uninstall('zlib', installer='cool-pkg-manager') + >>> uninstall('docutils', installer='cool-pkg-manager') This allows a third-party application to use the ``uninstall`` function and make sure it's the only program that can remove a distribution it has @@ -607,9 +635,13 @@ The plan is to integrate them for Python 2.7 and Python 3.2 + References ========== +.. [#distutils] + http://docs.python.org/distutils + .. [#pep262] http://www.python.org/dev/peps/pep-0262 @@ -628,13 +660,10 @@ .. [#pep273] http://www.python.org/dev/peps/pep-0273 -.. [#pep2738] +.. [#pep278] http://www.python.org/dev/peps/pep-0278 -.. [distutils] - http://docs.python.org/distutils - Aknowledgments ============== From python-checkins at python.org Tue Jun 23 15:14:47 2009 From: python-checkins at python.org (tarek.ziade) Date: Tue, 23 Jun 2009 13:14:47 -0000 Subject: [Python-checkins] r73522 - in distutils/trunk: MANIFEST.in distutils.pth setup.py Message-ID: Author: tarek.ziade Date: Tue Jun 23 15:14:47 2009 New Revision: 73522 Log: added distutils.pth to override distutils installation Added: distutils/trunk/distutils.pth (contents, props changed) Modified: distutils/trunk/MANIFEST.in distutils/trunk/setup.py Modified: distutils/trunk/MANIFEST.in ============================================================================== --- distutils/trunk/MANIFEST.in (original) +++ distutils/trunk/MANIFEST.in Tue Jun 23 15:14:47 2009 @@ -1,3 +1,4 @@ include README.txt include distutils/README recursive-include distutils *.py +include distutils.pth Added: distutils/trunk/distutils.pth ============================================================================== --- (empty file) +++ distutils/trunk/distutils.pth Tue Jun 23 15:14:47 2009 @@ -0,0 +1,4 @@ +import sys; sys.__plen = len(sys.path) +./distutils +import sys, os; new=sys.path[sys.__plen:]; new[0] = os.path.split(new[0])[0];del sys.path[sys.__plen:]; p=getattr(sys,'__egginsert',0); sys.path[p:p]=new; sys.__egginsert = p+len(new) + Modified: distutils/trunk/setup.py ============================================================================== --- distutils/trunk/setup.py (original) +++ distutils/trunk/setup.py Tue Jun 23 15:14:47 2009 @@ -11,7 +11,7 @@ TRUNK_VERSION = True # the reStructuredText contained in -# README.txt will be displayed in PyPI +# README.txt will be displayed at PyPI README_FILE = open('README.txt') try: description = README_FILE.read() @@ -71,5 +71,7 @@ url="http://www.python.org/sigs/distutils-sig", license="Python", long_description=description, - packages=['distutils']) + packages=['distutils', 'distutils.command'], + data_files=[('lib/python2.6/site-packages/', ['distutils.pth'])] + ) From buildbot at python.org Tue Jun 23 15:24:23 2009 From: buildbot at python.org (buildbot at python.org) Date: Tue, 23 Jun 2009 13:24:23 +0000 Subject: [Python-checkins] buildbot failure in x86 XP-4 trunk Message-ID: The Buildbot has detected a new failure of x86 XP-4 trunk. Full details are available at: http://www.python.org/dev/buildbot/all/x86%20XP-4%20trunk/builds/2269 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: bolen-windows Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: nick.coghlan BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_bsddb3 ====================================================================== ERROR: test01_basic_replication (bsddb.test.test_replication.DBReplicationManager) ---------------------------------------------------------------------- Traceback (most recent call last): File "E:\cygwin\home\db3l\buildarea\trunk.bolen-windows\build\lib\bsddb\test\test_replication.py", line 170, in test01_basic_replication mode=0666, txn=txn) DBNoSuchFileError: (2, 'No such file or directory -- connection closed: Successful return: 0') ====================================================================== ERROR: test01_basic_replication (bsddb.test.test_replication.DBReplicationManager) ---------------------------------------------------------------------- Traceback (most recent call last): File "E:\cygwin\home\db3l\buildarea\trunk.bolen-windows\build\lib\bsddb\test\test_replication.py", line 58, in tearDown if self.dbClient : DBError: (0, 'DB object has been closed') ====================================================================== FAIL: test01_basic_replication (bsddb.test.test_replication.DBBaseReplication) ---------------------------------------------------------------------- Traceback (most recent call last): File "E:\cygwin\home\db3l\buildarea\trunk.bolen-windows\build\lib\bsddb\test\test_replication.py", line 315, in test01_basic_replication self.assertTrue(time.time() Author: tarek.ziade Date: Tue Jun 23 15:25:32 2009 New Revision: 73523 Log: building site-package depending on the environment Modified: distutils/trunk/setup.py Modified: distutils/trunk/setup.py ============================================================================== --- distutils/trunk/setup.py (original) +++ distutils/trunk/setup.py Tue Jun 23 15:25:32 2009 @@ -61,6 +61,15 @@ else: version = sys.version.split()[0] +# finding the right site-packages depending on the platform +if sys.platform in ('os2emx', 'riscos'): + site_package = os.path.join("Lib", "site-packages") +elif os.sep == '/': + site_package = os.path.join("lib", "python" + sys.version[:3], + "site-packages") +else: + site_package = os.path.join(prefix, "lib", "site-packages") + setup (name="Distutils", version=version, description="Python Distribution Utilities", @@ -72,6 +81,6 @@ license="Python", long_description=description, packages=['distutils', 'distutils.command'], - data_files=[('lib/python2.6/site-packages/', ['distutils.pth'])] + data_files=[(site_package, ['distutils.pth'])] ) From python-checkins at python.org Tue Jun 23 15:39:10 2009 From: python-checkins at python.org (nick.coghlan) Date: Tue, 23 Jun 2009 13:39:10 -0000 Subject: [Python-checkins] r73524 - python/branches/release26-maint Message-ID: Author: nick.coghlan Date: Tue Jun 23 15:39:09 2009 New Revision: 73524 Log: Blocked revisions 73518-73519 via svnmerge ........ r73518 | nick.coghlan | 2009-06-23 20:19:30 +1000 (Tue, 23 Jun 2009) | 1 line Issue 6288: Update contextlib.nested() docstring to reflect new documentation ........ r73519 | nick.coghlan | 2009-06-23 20:51:02 +1000 (Tue, 23 Jun 2009) | 1 line Remove markup from docstring ........ Modified: python/branches/release26-maint/ (props changed) From python-checkins at python.org Tue Jun 23 15:48:23 2009 From: python-checkins at python.org (tarek.ziade) Date: Tue, 23 Jun 2009 13:48:23 -0000 Subject: [Python-checkins] r73525 - in distutils/trunk: EXTERNALS.txt MANIFEST.in distutils distutils.pth distutils/EXTERNALS.txt setup.py Message-ID: Author: tarek.ziade Date: Tue Jun 23 15:48:23 2009 New Revision: 73525 Log: using a placeholder for the distribution so we don't mess with sys.path more than required Added: distutils/trunk/distutils/ (props changed) distutils/trunk/distutils/EXTERNALS.txt - copied unchanged from r73521, /distutils/trunk/EXTERNALS.txt Removed: distutils/trunk/EXTERNALS.txt Modified: distutils/trunk/MANIFEST.in distutils/trunk/distutils.pth distutils/trunk/setup.py Deleted: distutils/trunk/EXTERNALS.txt ============================================================================== --- distutils/trunk/EXTERNALS.txt Tue Jun 23 15:48:23 2009 +++ (empty file) @@ -1 +0,0 @@ -distutils http://svn.python.org/projects/python/trunk/Lib/distutils/ Modified: distutils/trunk/MANIFEST.in ============================================================================== --- distutils/trunk/MANIFEST.in (original) +++ distutils/trunk/MANIFEST.in Tue Jun 23 15:48:23 2009 @@ -1,4 +1,4 @@ include README.txt -include distutils/README -recursive-include distutils *.py +include distutils/distutils/README +recursive-include distutils/distutils *.py include distutils.pth Modified: distutils/trunk/distutils.pth ============================================================================== --- distutils/trunk/distutils.pth (original) +++ distutils/trunk/distutils.pth Tue Jun 23 15:48:23 2009 @@ -1,4 +1,3 @@ import sys; sys.__plen = len(sys.path) ./distutils -import sys, os; new=sys.path[sys.__plen:]; new[0] = os.path.split(new[0])[0];del sys.path[sys.__plen:]; p=getattr(sys,'__egginsert',0); sys.path[p:p]=new; sys.__egginsert = p+len(new) - +import sys, os; new=sys.path[sys.__plen:]; del sys.path[sys.__plen:]; p=getattr(sys,'__egginsert',0); sys.path[p:p]=new; sys.__egginsert = p+len(new) Modified: distutils/trunk/setup.py ============================================================================== --- distutils/trunk/setup.py (original) +++ distutils/trunk/setup.py Tue Jun 23 15:48:23 2009 @@ -80,7 +80,7 @@ url="http://www.python.org/sigs/distutils-sig", license="Python", long_description=description, - packages=['distutils', 'distutils.command'], + packages=['distutils.distutils', 'distutils.distutils.command'], data_files=[(site_package, ['distutils.pth'])] ) From python-checkins at python.org Tue Jun 23 16:00:11 2009 From: python-checkins at python.org (nick.coghlan) Date: Tue, 23 Jun 2009 14:00:11 -0000 Subject: [Python-checkins] r73526 - python/branches/release30-maint Message-ID: Author: nick.coghlan Date: Tue Jun 23 16:00:11 2009 New Revision: 73526 Log: Blocked revisions 73520 via svnmerge ................ r73520 | nick.coghlan | 2009-06-23 20:55:52 +1000 (Tue, 23 Jun 2009) | 13 lines Merged revisions 73518-73519 via svnmerge from svn+ssh://pythondev at svn.python.org/python/trunk ........ r73518 | nick.coghlan | 2009-06-23 20:19:30 +1000 (Tue, 23 Jun 2009) | 1 line Issue 6288: Update contextlib.nested() docstring to reflect new documentation ........ r73519 | nick.coghlan | 2009-06-23 20:51:02 +1000 (Tue, 23 Jun 2009) | 1 line Remove markup from docstring ........ ................ Modified: python/branches/release30-maint/ (props changed) From python-checkins at python.org Tue Jun 23 17:32:06 2009 From: python-checkins at python.org (tarek.ziade) Date: Tue, 23 Jun 2009 15:32:06 -0000 Subject: [Python-checkins] r73527 - distutils/trunk/setup.py Message-ID: Author: tarek.ziade Date: Tue Jun 23 17:32:06 2009 New Revision: 73527 Log: storing the svn revision the build is done with Modified: distutils/trunk/setup.py Modified: distutils/trunk/setup.py ============================================================================== --- distutils/trunk/setup.py (original) +++ distutils/trunk/setup.py Tue Jun 23 17:32:06 2009 @@ -4,6 +4,7 @@ import sys import re import os +import ConfigParser from distutils.core import setup @@ -18,6 +19,7 @@ finally: README_FILE.close() + # taken from setuptools def get_svn_revision(): """Will get the svn revision out of .svn""" @@ -53,11 +55,32 @@ return str(revision) +SETUP_CFG = os.path.join(os.path.dirname(__file__), 'setup.cfg') + +def store_svn_revision(): + setup_cfg = ConfigParser.ConfigParser() + setup_cfg.read([SETUP_CFG]) + if not setup_cfg.has_section('egg_info'): + setup_cfg.add_section('egg_info') + setup_cfg.set('egg_info', 'tag-svn-revision', get_svn_revision()) + setup_cfg.write(open(SETUP_CFG, 'w')) + +def get_stored_svn_revision(): + setup_cfg = ConfigParser.ConfigParser() + setup_cfg.read([SETUP_CFG]) + return setup_cfg.get('egg_info', 'tag-svn-revision') + +# when launching with sdist, we want to compute the version using +# the svn info, then store it in setup.cfg otherwise we use the one stored +# in setup.cfg +if 'sdist' in sys.argv: + store_svn_revision() + if TRUNK_VERSION: # for dev releases, the version is computed # with the svn tag version = '%sdev-r%s' % (sys.version.split()[0], - get_svn_revision()) + get_stored_svn_revision()) else: version = sys.version.split()[0] From python-checkins at python.org Tue Jun 23 17:36:32 2009 From: python-checkins at python.org (tarek.ziade) Date: Tue, 23 Jun 2009 15:36:32 -0000 Subject: [Python-checkins] r73528 - distutils/trunk/setup.py Message-ID: Author: tarek.ziade Date: Tue Jun 23 17:36:32 2009 New Revision: 73528 Log: using tag-build Modified: distutils/trunk/setup.py Modified: distutils/trunk/setup.py ============================================================================== --- distutils/trunk/setup.py (original) +++ distutils/trunk/setup.py Tue Jun 23 17:36:32 2009 @@ -62,13 +62,13 @@ setup_cfg.read([SETUP_CFG]) if not setup_cfg.has_section('egg_info'): setup_cfg.add_section('egg_info') - setup_cfg.set('egg_info', 'tag-svn-revision', get_svn_revision()) + setup_cfg.set('egg_info', 'tag-build', get_svn_revision()) setup_cfg.write(open(SETUP_CFG, 'w')) def get_stored_svn_revision(): setup_cfg = ConfigParser.ConfigParser() setup_cfg.read([SETUP_CFG]) - return setup_cfg.get('egg_info', 'tag-svn-revision') + return setup_cfg.get('egg_info', 'tag-build') # when launching with sdist, we want to compute the version using # the svn info, then store it in setup.cfg otherwise we use the one stored From buildbot at python.org Tue Jun 23 17:43:16 2009 From: buildbot at python.org (buildbot at python.org) Date: Tue, 23 Jun 2009 15:43:16 +0000 Subject: [Python-checkins] buildbot failure in sparc solaris10 gcc 3.0 Message-ID: The Buildbot has detected a new failure of sparc solaris10 gcc 3.0. Full details are available at: http://www.python.org/dev/buildbot/all/sparc%20solaris10%20gcc%203.0/builds/413 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: loewis-sun Build Reason: Build Source Stamp: [branch branches/release30-maint] HEAD Blamelist: nick.coghlan BUILD FAILED: failed test Excerpt from the test logfile: 2 tests failed: test_posix test_subprocess ====================================================================== ERROR: test_getcwd_long_pathnames (test.test_posix.PosixTester) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home2/buildbot/slave/3.0.loewis-sun/build/Lib/test/test_posix.py", line 252, in test_getcwd_long_pathnames support.rmtree(base_path) File "/home2/buildbot/slave/3.0.loewis-sun/build/Lib/test/support.py", line 98, in rmtree shutil.rmtree(path) File "/home2/buildbot/slave/3.0.loewis-sun/build/Lib/shutil.py", line 225, in rmtree onerror(os.rmdir, path, sys.exc_info()) File "/home2/buildbot/slave/3.0.loewis-sun/build/Lib/shutil.py", line 223, in rmtree os.rmdir(path) OSError: [Errno 22] Invalid argument: '/home2/buildbot/slave/3.0.loewis-sun/build/@test.getcwd/@test.getcwd' ====================================================================== FAIL: test_executable (test.test_subprocess.ProcessTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home2/buildbot/slave/3.0.loewis-sun/build/Lib/test/test_subprocess.py", line 115, in test_executable self.assertEqual(p.returncode, 47) AssertionError: -6 != 47 sincerely, -The Buildbot From python-checkins at python.org Tue Jun 23 20:02:46 2009 From: python-checkins at python.org (r.david.murray) Date: Tue, 23 Jun 2009 18:02:46 -0000 Subject: [Python-checkins] r73529 - in python/trunk: Lib/pydoc.py Lib/test/test_pydoc.py Misc/ACKS Misc/NEWS Message-ID: Author: r.david.murray Date: Tue Jun 23 20:02:46 2009 New Revision: 73529 Log: Fix issue 5230 by having pydoc's safeimport check to see if the import error was thrown from itself in order to decide if the module can't be found. Thanks to Lucas Prado Melo for collaborating on the fix and tests. Modified: python/trunk/Lib/pydoc.py python/trunk/Lib/test/test_pydoc.py python/trunk/Misc/ACKS python/trunk/Misc/NEWS Modified: python/trunk/Lib/pydoc.py ============================================================================== --- python/trunk/Lib/pydoc.py (original) +++ python/trunk/Lib/pydoc.py Tue Jun 23 20:02:46 2009 @@ -55,6 +55,7 @@ import sys, imp, os, re, types, inspect, __builtin__, pkgutil from repr import Repr from string import expandtabs, find, join, lower, split, strip, rfind, rstrip +from traceback import extract_tb try: from collections import deque except ImportError: @@ -299,9 +300,9 @@ elif exc is SyntaxError: # A SyntaxError occurred before we could execute the module. raise ErrorDuringImport(value.filename, info) - elif exc is ImportError and \ - split(lower(str(value)))[:2] == ['no', 'module']: - # The module was not found. + elif exc is ImportError and extract_tb(tb)[-1][2]=='safeimport': + # The import error occurred directly in this function, + # which means there is no such module in the path. return None else: # Some other error occurred during the importing process. Modified: python/trunk/Lib/test/test_pydoc.py ============================================================================== --- python/trunk/Lib/test/test_pydoc.py (original) +++ python/trunk/Lib/test/test_pydoc.py Tue Jun 23 20:02:46 2009 @@ -1,5 +1,6 @@ import sys import os +import os.path import difflib import subprocess import re @@ -7,6 +8,8 @@ import inspect import unittest import test.test_support +from contextlib import contextmanager +from test.test_support import TESTFN, forget, rmtree, EnvironmentVarGuard from test import pydoc_mod @@ -166,6 +169,9 @@ # output pattern for missing module missing_pattern = "no Python documentation found for '%s'" +# output pattern for module with bad imports +badimport_pattern = "problem in %s - : No module named %s" + def run_pydoc(module_name, *args): """ Runs pydoc on the specified module. Returns the stripped @@ -237,6 +243,42 @@ self.assertEqual(expected, result, "documentation for missing module found") + def test_badimport(self): + # This tests the fix for issue 5230, where if pydoc found the module + # but the module had an internal import error pydoc would report no doc + # found. + modname = 'testmod_xyzzy' + testpairs = ( + ('i_am_not_here', 'i_am_not_here'), + ('test.i_am_not_here_either', 'i_am_not_here_either'), + ('test.i_am_not_here.neither_am_i', 'i_am_not_here.neither_am_i'), + ('i_am_not_here.{}'.format(modname), 'i_am_not_here.{}'.format(modname)), + ('test.{}'.format(modname), modname), + ) + + @contextmanager + def newdirinpath(dir): + os.mkdir(dir) + sys.path.insert(0, dir) + yield + sys.path.pop(0) + rmtree(dir) + + with newdirinpath(TESTFN), EnvironmentVarGuard() as env: + env['PYTHONPATH'] = TESTFN + fullmodname = os.path.join(TESTFN, modname) + sourcefn = fullmodname + os.extsep + "py" + for importstring, expectedinmsg in testpairs: + f = open(sourcefn, 'w') + f.write("import {}\n".format(importstring)) + f.close() + try: + result = run_pydoc(modname) + finally: + forget(modname) + expected = badimport_pattern % (modname, expectedinmsg) + self.assertEqual(expected, result) + def test_input_strip(self): missing_module = " test.i_am_not_here " result = run_pydoc(missing_module) Modified: python/trunk/Misc/ACKS ============================================================================== --- python/trunk/Misc/ACKS (original) +++ python/trunk/Misc/ACKS Tue Jun 23 20:02:46 2009 @@ -479,6 +479,7 @@ Craig McPheeters Lambert Meertens Bill van Melle +Lucas Prado Melo Luke Mewburn Mike Meyer Steven Miale Modified: python/trunk/Misc/NEWS ============================================================================== --- python/trunk/Misc/NEWS (original) +++ python/trunk/Misc/NEWS Tue Jun 23 20:02:46 2009 @@ -327,6 +327,10 @@ Library ------- +- Issue #5230: pydoc would report no documentation found if a module generated + a 'not found' import error when loaded; it now reports the import errors. + Thanks to Lucas Prado Melo for initial fix and collaboration on the tests. + - Issue #6314: logging.basicConfig() performs extra checks on the "level" argument. From python-checkins at python.org Tue Jun 23 22:37:27 2009 From: python-checkins at python.org (r.david.murray) Date: Tue, 23 Jun 2009 20:37:27 -0000 Subject: [Python-checkins] r73530 - in python/branches/release26-maint: Lib/pydoc.py Lib/test/test_pydoc.py Misc/ACKS Misc/NEWS Message-ID: Author: r.david.murray Date: Tue Jun 23 22:37:26 2009 New Revision: 73530 Log: Merged revisions 73529 via svnmerge from svn+ssh://pythondev at svn.python.org/python/trunk ........ r73529 | r.david.murray | 2009-06-23 14:02:46 -0400 (Tue, 23 Jun 2009) | 4 lines Fix issue 5230 by having pydoc's safeimport check to see if the import error was thrown from itself in order to decide if the module can't be found. Thanks to Lucas Prado Melo for collaborating on the fix and tests. ........ Modified: python/branches/release26-maint/ (props changed) python/branches/release26-maint/Lib/pydoc.py python/branches/release26-maint/Lib/test/test_pydoc.py python/branches/release26-maint/Misc/ACKS python/branches/release26-maint/Misc/NEWS Modified: python/branches/release26-maint/Lib/pydoc.py ============================================================================== --- python/branches/release26-maint/Lib/pydoc.py (original) +++ python/branches/release26-maint/Lib/pydoc.py Tue Jun 23 22:37:26 2009 @@ -55,6 +55,7 @@ import sys, imp, os, re, types, inspect, __builtin__, pkgutil from repr import Repr from string import expandtabs, find, join, lower, split, strip, rfind, rstrip +from traceback import extract_tb try: from collections import deque except ImportError: @@ -299,9 +300,9 @@ elif exc is SyntaxError: # A SyntaxError occurred before we could execute the module. raise ErrorDuringImport(value.filename, info) - elif exc is ImportError and \ - split(lower(str(value)))[:2] == ['no', 'module']: - # The module was not found. + elif exc is ImportError and extract_tb(tb)[-1][2]=='safeimport': + # The import error occurred directly in this function, + # which means there is no such module in the path. return None else: # Some other error occurred during the importing process. Modified: python/branches/release26-maint/Lib/test/test_pydoc.py ============================================================================== --- python/branches/release26-maint/Lib/test/test_pydoc.py (original) +++ python/branches/release26-maint/Lib/test/test_pydoc.py Tue Jun 23 22:37:26 2009 @@ -1,5 +1,6 @@ import sys import os +import os.path import difflib import subprocess import re @@ -7,6 +8,8 @@ import inspect import unittest import test.test_support +from contextlib import contextmanager +from test.test_support import TESTFN, forget, rmtree, EnvironmentVarGuard from test import pydoc_mod @@ -166,6 +169,9 @@ # output pattern for missing module missing_pattern = "no Python documentation found for '%s'" +# output pattern for module with bad imports +badimport_pattern = "problem in %s - : No module named %s" + def run_pydoc(module_name, *args): """ Runs pydoc on the specified module. Returns the stripped @@ -237,6 +243,43 @@ self.assertEqual(expected, result, "documentation for missing module found") + def test_badimport(self): + # This tests the fix for issue 5230, where if pydoc found the module + # but the module had an internal import error pydoc would report no doc + # found. + modname = 'testmod_xyzzy' + testpairs = ( + ('i_am_not_here', 'i_am_not_here'), + ('test.i_am_not_here_either', 'i_am_not_here_either'), + ('test.i_am_not_here.neither_am_i', 'i_am_not_here.neither_am_i'), + ('i_am_not_here.{0}'.format(modname), 'i_am_not_here.{0}'.format(modname)), + ('test.{0}'.format(modname), modname), + ) + + @contextmanager + def newdirinpath(dir): + os.mkdir(dir) + sys.path.insert(0, dir) + yield + sys.path.pop(0) + rmtree(dir) + + with newdirinpath(TESTFN): + with EnvironmentVarGuard() as env: + env.set('PYTHONPATH', TESTFN) + fullmodname = os.path.join(TESTFN, modname) + sourcefn = fullmodname + os.extsep + "py" + for importstring, expectedinmsg in testpairs: + f = open(sourcefn, 'w') + f.write("import {0}\n".format(importstring)) + f.close() + try: + result = run_pydoc(modname) + finally: + forget(modname) + expected = badimport_pattern % (modname, expectedinmsg) + self.assertEqual(expected, result) + def test_input_strip(self): missing_module = " test.i_am_not_here " result = run_pydoc(missing_module) Modified: python/branches/release26-maint/Misc/ACKS ============================================================================== --- python/branches/release26-maint/Misc/ACKS (original) +++ python/branches/release26-maint/Misc/ACKS Tue Jun 23 22:37:26 2009 @@ -464,6 +464,7 @@ Craig McPheeters Lambert Meertens Bill van Melle +Lucas Prado Melo Luke Mewburn Mike Meyer Steven Miale Modified: python/branches/release26-maint/Misc/NEWS ============================================================================== --- python/branches/release26-maint/Misc/NEWS (original) +++ python/branches/release26-maint/Misc/NEWS Tue Jun 23 22:37:26 2009 @@ -56,6 +56,10 @@ Library ------- +- Issue #5230: pydoc would report no documentation found if a module generated + a 'not found' import error when loaded; it now reports the import errors. + Thanks to Lucas Prado Melo for initial fix and collaboration on the tests. + - Issue #6274: Fixed possible file descriptors leak in subprocess.py - Issue #6271: mmap tried to close invalid file handle (-1) when annonymous. From python-checkins at python.org Tue Jun 23 22:38:54 2009 From: python-checkins at python.org (raymond.hettinger) Date: Tue, 23 Jun 2009 20:38:54 -0000 Subject: [Python-checkins] r73531 - in python/branches/py3k: Lib/test/test_memoryview.py Misc/NEWS Objects/memoryobject.c Message-ID: Author: raymond.hettinger Date: Tue Jun 23 22:38:54 2009 New Revision: 73531 Log: Issue 6329: Fix iteration for memoryviews. Modified: python/branches/py3k/Lib/test/test_memoryview.py python/branches/py3k/Misc/NEWS python/branches/py3k/Objects/memoryobject.c Modified: python/branches/py3k/Lib/test/test_memoryview.py ============================================================================== --- python/branches/py3k/Lib/test/test_memoryview.py (original) +++ python/branches/py3k/Lib/test/test_memoryview.py Tue Jun 23 22:38:54 2009 @@ -48,6 +48,12 @@ for tp in self._types: self.check_getitem_with_type(tp) + def test_iter(self): + for tp in self._types: + b = tp(self._source) + m = self._view(b) + self.assertEqual(list(m), [m[i] for i in range(len(m))]) + def test_setitem_readonly(self): if not self.ro_type: return Modified: python/branches/py3k/Misc/NEWS ============================================================================== --- python/branches/py3k/Misc/NEWS (original) +++ python/branches/py3k/Misc/NEWS Tue Jun 23 22:38:54 2009 @@ -12,6 +12,9 @@ Core and Builtins ----------------- +- Issue #6329: Fixed iteration for memoryview objects (it was being blocked + because it wasn't recognized as a sequence). + Library ------- Modified: python/branches/py3k/Objects/memoryobject.c ============================================================================== --- python/branches/py3k/Objects/memoryobject.c (original) +++ python/branches/py3k/Objects/memoryobject.c Tue Jun 23 22:38:54 2009 @@ -505,6 +505,49 @@ return get_shape0(&self->view); } +/* Alternate version of memory_subcript that only accepts indices. + Used by PySeqIter_New(). +*/ +static PyObject * +memory_item(PyMemoryViewObject *self, Py_ssize_t result) +{ + Py_buffer *view = &(self->view); + + if (view->ndim == 0) { + PyErr_SetString(PyExc_IndexError, + "invalid indexing of 0-dim memory"); + return NULL; + } + if (view->ndim == 1) { + /* Return a bytes object */ + char *ptr; + ptr = (char *)view->buf; + if (result < 0) { + result += get_shape0(view); + } + if ((result < 0) || (result >= get_shape0(view))) { + PyErr_SetString(PyExc_IndexError, + "index out of bounds"); + return NULL; + } + if (view->strides == NULL) + ptr += view->itemsize * result; + else + ptr += view->strides[0] * result; + if (view->suboffsets != NULL && + view->suboffsets[0] >= 0) { + ptr = *((char **)ptr) + view->suboffsets[0]; + } + return PyBytes_FromStringAndSize(ptr, view->itemsize); + } else { + /* Return a new memory-view object */ + Py_buffer newview; + memset(&newview, 0, sizeof(newview)); + /* XXX: This needs to be fixed so it actually returns a sub-view */ + return PyMemoryView_FromBuffer(&newview); + } +} + /* mem[obj] returns a bytes object holding the data for one element if obj fully indexes the memory view or another memory-view object @@ -536,37 +579,7 @@ result = PyNumber_AsSsize_t(key, NULL); if (result == -1 && PyErr_Occurred()) return NULL; - if (view->ndim == 1) { - /* Return a bytes object */ - char *ptr; - ptr = (char *)view->buf; - if (result < 0) { - result += get_shape0(view); - } - if ((result < 0) || (result >= get_shape0(view))) { - PyErr_SetString(PyExc_IndexError, - "index out of bounds"); - return NULL; - } - if (view->strides == NULL) - ptr += view->itemsize * result; - else - ptr += view->strides[0] * result; - if (view->suboffsets != NULL && - view->suboffsets[0] >= 0) { - ptr = *((char **)ptr) + view->suboffsets[0]; - } - return PyBytes_FromStringAndSize(ptr, view->itemsize); - } - else { - /* Return a new memory-view object */ - Py_buffer newview; - memset(&newview, 0, sizeof(newview)); - /* XXX: This needs to be fixed so it - actually returns a sub-view - */ - return PyMemoryView_FromBuffer(&newview); - } + return memory_item(self, result); } else if (PySlice_Check(key)) { Py_ssize_t start, stop, step, slicelength; @@ -771,6 +784,12 @@ (objobjargproc)memory_ass_sub, /* mp_ass_subscript */ }; +static PySequenceMethods memory_as_sequence = { + 0, /* sq_length */ + 0, /* sq_concat */ + 0, /* sq_repeat */ + (ssizeargfunc)memory_item, /* sq_item */ +}; /* Buffer methods */ @@ -792,7 +811,7 @@ 0, /* tp_reserved */ (reprfunc)memory_repr, /* tp_repr */ 0, /* tp_as_number */ - 0, /* tp_as_sequence */ + &memory_as_sequence, /* tp_as_sequence */ &memory_as_mapping, /* tp_as_mapping */ 0, /* tp_hash */ 0, /* tp_call */ From python-checkins at python.org Tue Jun 23 22:59:44 2009 From: python-checkins at python.org (raymond.hettinger) Date: Tue, 23 Jun 2009 20:59:44 -0000 Subject: [Python-checkins] r73532 - in python/trunk: Lib/test/test_memoryview.py Misc/NEWS Objects/memoryobject.c Message-ID: Author: raymond.hettinger Date: Tue Jun 23 22:59:43 2009 New Revision: 73532 Log: Issue 6329: Fix iteration for memoryviews. Modified: python/trunk/Lib/test/test_memoryview.py python/trunk/Misc/NEWS python/trunk/Objects/memoryobject.c Modified: python/trunk/Lib/test/test_memoryview.py ============================================================================== --- python/trunk/Lib/test/test_memoryview.py (original) +++ python/trunk/Lib/test/test_memoryview.py Tue Jun 23 22:59:43 2009 @@ -48,6 +48,12 @@ for tp in self._types: self.check_getitem_with_type(tp) + def test_iter(self): + for tp in self._types: + b = tp(self._source) + m = self._view(b) + self.assertEqual(list(m), [m[i] for i in range(len(m))]) + def test_setitem_readonly(self): if not self.ro_type: return Modified: python/trunk/Misc/NEWS ============================================================================== --- python/trunk/Misc/NEWS (original) +++ python/trunk/Misc/NEWS Tue Jun 23 22:59:43 2009 @@ -12,6 +12,9 @@ Core and Builtins ----------------- +- Issue #6329: Fixed iteration for memoryview objects (it was being blocked + because it wasn't recognized as a sequence). + - Issue #6289: Encoding errors from compile() were being masked. - When no module is given in a relative import, the module field of the Modified: python/trunk/Objects/memoryobject.c ============================================================================== --- python/trunk/Objects/memoryobject.c (original) +++ python/trunk/Objects/memoryobject.c Tue Jun 23 22:59:43 2009 @@ -513,6 +513,49 @@ return get_shape0(&self->view); } +/* Alternate version of memory_subcript that only accepts indices. + Used by PySeqIter_New(). +*/ +static PyObject * +memory_item(PyMemoryViewObject *self, Py_ssize_t result) +{ + Py_buffer *view = &(self->view); + + if (view->ndim == 0) { + PyErr_SetString(PyExc_IndexError, + "invalid indexing of 0-dim memory"); + return NULL; + } + if (view->ndim == 1) { + /* Return a bytes object */ + char *ptr; + ptr = (char *)view->buf; + if (result < 0) { + result += get_shape0(view); + } + if ((result < 0) || (result >= get_shape0(view))) { + PyErr_SetString(PyExc_IndexError, + "index out of bounds"); + return NULL; + } + if (view->strides == NULL) + ptr += view->itemsize * result; + else + ptr += view->strides[0] * result; + if (view->suboffsets != NULL && + view->suboffsets[0] >= 0) { + ptr = *((char **)ptr) + view->suboffsets[0]; + } + return PyBytes_FromStringAndSize(ptr, view->itemsize); + } else { + /* Return a new memory-view object */ + Py_buffer newview; + memset(&newview, 0, sizeof(newview)); + /* XXX: This needs to be fixed so it actually returns a sub-view */ + return PyMemoryView_FromBuffer(&newview); + } +} + /* mem[obj] returns a bytes object holding the data for one element if obj fully indexes the memory view or another memory-view object @@ -544,37 +587,7 @@ result = PyNumber_AsSsize_t(key, NULL); if (result == -1 && PyErr_Occurred()) return NULL; - if (view->ndim == 1) { - /* Return a bytes object */ - char *ptr; - ptr = (char *)view->buf; - if (result < 0) { - result += get_shape0(view); - } - if ((result < 0) || (result >= get_shape0(view))) { - PyErr_SetString(PyExc_IndexError, - "index out of bounds"); - return NULL; - } - if (view->strides == NULL) - ptr += view->itemsize * result; - else - ptr += view->strides[0] * result; - if (view->suboffsets != NULL && - view->suboffsets[0] >= 0) { - ptr = *((char **)ptr) + view->suboffsets[0]; - } - return PyBytes_FromStringAndSize(ptr, view->itemsize); - } - else { - /* Return a new memory-view object */ - Py_buffer newview; - memset(&newview, 0, sizeof(newview)); - /* XXX: This needs to be fixed so it - actually returns a sub-view - */ - return PyMemoryView_FromBuffer(&newview); - } + return memory_item(self, result); } else if (PySlice_Check(key)) { Py_ssize_t start, stop, step, slicelength; @@ -779,6 +792,12 @@ (objobjargproc)memory_ass_sub, /* mp_ass_subscript */ }; +static PySequenceMethods memory_as_sequence = { + 0, /* sq_length */ + 0, /* sq_concat */ + 0, /* sq_repeat */ + (ssizeargfunc)memory_item, /* sq_item */ +}; /* Buffer methods */ static PyBufferProcs memory_as_buffer = { @@ -803,7 +822,7 @@ 0, /* tp_compare */ (reprfunc)memory_repr, /* tp_repr */ 0, /* tp_as_number */ - 0, /* tp_as_sequence */ + &memory_as_sequence, /* tp_as_sequence */ &memory_as_mapping, /* tp_as_mapping */ 0, /* tp_hash */ 0, /* tp_call */ From python-checkins at python.org Tue Jun 23 23:05:37 2009 From: python-checkins at python.org (r.david.murray) Date: Tue, 23 Jun 2009 21:05:37 -0000 Subject: [Python-checkins] r73533 - python/branches/py3k Message-ID: Author: r.david.murray Date: Tue Jun 23 23:05:37 2009 New Revision: 73533 Log: Recorded merge of revisions 73532 via svnmerge from svn+ssh://pythondev at svn.python.org/python/trunk (applied to py3k in r73531) ........ r73532 | raymond.hettinger | 2009-06-23 16:59:43 -0400 (Tue, 23 Jun 2009) | 3 lines Issue 6329: Fix iteration for memoryviews. ........ Modified: python/branches/py3k/ (props changed) From python-checkins at python.org Tue Jun 23 23:09:09 2009 From: python-checkins at python.org (amaury.forgeotdarc) Date: Tue, 23 Jun 2009 21:09:09 -0000 Subject: [Python-checkins] r73534 - in python/trunk: Doc/library/internet.rst Doc/library/ipaddr.rst Lib/ipaddr.py Lib/test/test_ipaddr.py Misc/NEWS Message-ID: Author: amaury.forgeotdarc Date: Tue Jun 23 23:09:09 2009 New Revision: 73534 Log: Remove the ipaddr module per discussion on python-dev Removed: python/trunk/Doc/library/ipaddr.rst python/trunk/Lib/ipaddr.py python/trunk/Lib/test/test_ipaddr.py Modified: python/trunk/Doc/library/internet.rst python/trunk/Misc/NEWS Modified: python/trunk/Doc/library/internet.rst ============================================================================== --- python/trunk/Doc/library/internet.rst (original) +++ python/trunk/Doc/library/internet.rst Tue Jun 23 23:09:09 2009 @@ -35,7 +35,6 @@ smtpd.rst telnetlib.rst uuid.rst - ipaddr.rst urlparse.rst socketserver.rst basehttpserver.rst Deleted: python/trunk/Doc/library/ipaddr.rst ============================================================================== --- python/trunk/Doc/library/ipaddr.rst Tue Jun 23 23:09:09 2009 +++ (empty file) @@ -1,417 +0,0 @@ -:mod:`ipaddr` --- IP address manipulation library -================================================= - -.. module:: ipaddr - :synopsis: IPv4 and IPv6 network address manipulation classes. -.. moduleauthor:: Google, Inc. -.. sectionauthor:: Gregory P. Smith - - -.. versionadded:: 2.7 - -.. index:: - single: IP address, IPv4, IPv6, netmask - -This module implements classes for working with IP host and network addresses, -both IPv4 and IPv6. - - -.. _ipaddr_examples: - -Examples --------- - -Netmask. - - >>> ipaddr.IP('1.1.1.1/255.255.255.0') - IPv4('1.1.1.1/24') - >>> ipaddr.IP('1080::200C:417B/96') - IPv6('1080::200c:417b/96') - -Hostmask. - - >>> ipaddr.IPv4('1.1.1.1/0.0.0.255') - IPv4('1.1.1.1/24') - -Prefix length. - - >>> addr = ipaddr.IPv4('1.1.1.1/24') - >>> addr.prefixlen - 24 - -Individual addresses. - - >>> ipaddr.IP('1.1.1.1') - IPv4('1.1.1.1/32') - -Many standard Python operations are also supported. - -Comparison. - - >>> ipaddr.IPv4('1.1.1.1') == ipaddr.IPv4('1.1.1.2') - False - >>> ipaddr.IPv4('1.1.1.1') < ipaddr.IPv4('1.1.1.2') - True - -Inclusion. - - >>> ipaddr.IPv4('1.1.1.1') in ipaddr.IPv4("1.0.0.0/8") - True - -Sorting. - - >>> a = ipaddr.IPv4('1.1.1.10') - >>> b = ipaddr.IPv4('1.10.1.10') - >>> c = ipaddr.IPv4('1.1.10.10') - >>> d = ipaddr.IPv4('1.1.1.1') - >>> sorted([a, b, c, d]) - [IPv4('1.1.1.1/32'), IPv4('1.1.1.10/32'), IPv4('1.1.10.10/32'), IPv4('1.10.1.10/32')] - -Conversion to string and integer forms. - - >>> spam = ipaddr.IPv4('192.168.1.254')) - >>> str(spam) - '192.168.1.254/32' - >>> spam.ip_ext - '192.168.1.254' - >>> int(spam) - 3232236030 - >>> eggs = ipaddr.IPv6('ffff::1/120') - >>> int(eggs) - 340277174624079928635746076935438991361 - -Additionally, there are quite a few network-specific features available to -ipaddr. - - >>> ipaddr.IPv4('10.0.0.0/8').supernet() - IPv4('10.0.0.0/7') - >>> ipaddr.IPv4('10.0.0.0/8').subnet() - [IPv4('10.0.0.0/9'), IPv4('10.128.0.0/9')] - # This returns networks with a prefix length of /10 - >>> ipaddr.IPv4('10.0.0.0/8').subnet(prefixlen_diff=2) - [IPv4('10.0.0.0/10'), IPv4('10.64.0.0/10'), IPv4('10.128.0.0/10'), IPv4('10.192.0.0/10')] - # Remove an address from a superblock. - >>> ipaddr.IP('10.0.0.0/24').address_exclude(ipaddr.IP('10.0.0.0/28')) - [IPv4('10.0.0.16/28'), IPv4('10.0.0.32/27'), IPv4('10.0.0.64/26'), IPv4('10.0.0.128/25')] - - -.. _ipaddr_funcs_and_classes: - -Functions And Classes ---------------------- - -.. function:: IP(ipaddr) - - Take an IP string or int and return an object of the correct type. Returns - an :class:`IPv4` or :class:`IPv6` object. - - The *ipaddr* parameter must be a string or integer representing the IP - address. Either IPv4 or IPv6 addresses may be supplied. Integers less than - 2**32 will be considered to be IPv4. - - Raises :exc:`ValueError` if the *ipaddr* passed is not either an IPv4 or an - IPv6 address. - - -.. function:: collapse_address_list(addresses) - - Collapse a sequence of :class:`IPv4` or :class:`IPv6` objects into the most - concise representation. Returns a list of :class:`IPv4` or :class:`IPv6` - objects. - - Example usage:: - - >>> collapse_address_list([IPv4('1.1.0.0/24'), IPv4('1.1.1.0/24')]) - [IPv4('1.1.0.0/23')] - - -.. class:: BaseIP() - - A generic IP address object. This base class defines the API and contains - common code. Most authors should either use the :func:`IP` function or - create :class:`IPv4` or :class:`IPv6` objects directly rather than using this - base class. - - IP address objects support the following python operators: - ``=``, ``!=``, ``<``, ``>``, ``<=``, ``>=``, and ``in``. - - An IP address object may be used as a sequence index or as a hash key and can - be converted back to an integer representation using :func:`int`. It may - also be used as a sequence that yields the string representation of every IP - address within the object's subnet. - - The following properties are available on all IP address objects: - - .. attribute:: broadcast - - Integer representation of the broadcast address. Read only. - - .. attribute:: broadcast_ext - - Dotted decimal or colon string version of the broadcast address. Read - only. - - .. attribute:: hostmask - - Integer representation of the hostmask. Read only. - - .. attribute:: hostmask_ext - - Dotted decimal or colon string version of the hostmask. Read only. - - .. attribute:: ip - - Integer representation of the IP address. Read only. - - .. attribute:: ip_ext - - Dotted decimal or colon string version of the IP address. Read only. - - .. attribute:: ip_ext_full - - Canonical string version of the IP address. Read only. - - .. attribute:: is_loopback - - True if the address is a loopback address as defined in IPv4 :rfc:`3330` - or IPv6 :rfc:`2373` section 2.5.3. - - .. attribute:: is_link_local - - True if the address is a link-local address as defined in IPv4 :rfc:`3927` - or IPv6 :rfc:`4291`. - - .. attribute:: is_multicast - - True if the address is reserved for multicast use. See IPv4 :rfc:`3171` - or IPv6 :rfc:`2373` section 2.7 for details. - - .. attribute:: is_private - - True if the address is reserved for private networks as defined in IPv4 - :rfc:`1918` or IPv6 :rfc:`4193`. - - .. attribute:: netmask - - Integer representation of the netmask. Read only. - - .. attribute:: netmask_ext - - Dotted decimal or colon string version of the netmask. Read only. - - .. attribute:: network - - Integer representation of the network. Read only. - - .. attribute:: network_ext - - Dotted decimal or colon string version of the network. Read only. - - .. attribute:: numhosts - - Number of hosts in the current subnet. Read only. - - .. attribute:: packed - - The packed network byte order representation of this network address. - Read only. - - .. attribute:: prefixlen - - A property to get and set the prefix length. Readable and writeable. - - .. attribute:: version - - Integer IP version number. Read only. - - - The following methods are available on all IP address objects: - - .. method:: address_exclude(other) - - Remove an address from within a larger block. Returns a sorted list of IP - address objects representing networks. - - Examples:: - - >>> addr1 = IP('10.1.1.0/24') - >>> addr2 = IP('10.1.1.0/26') - >>> addr1.address_exclude(addr2) - [IP('10.1.1.64/26'), IP('10.1.1.128/25')] - - >>> addr1 = IP('::1/32') - >>> addr2 = IP('::1/128') - >>> addr1.address_exclude(addr2) - [IP('::0/128'), IP('::2/127'), IP('::4/126'), IP('::8/125'), IP('0:0:8000::/33')] - - Raises :exc:`ValueError` if *other* is not completely contained by *self*. - - - .. method:: compare_networks(other) - - Compare this IP object's network to another IP network. - Returns -1, 0 or 1. - - This compares the integer representation of the network addresses. The - host bits are not considered by this method. If you want to compare host - bits, you can use ``host_a.ip < host_b.ip``. - - If the IP versions of self and other are the same, returns: - - -1 if self < other - eg: IPv4('1.1.1.0/24') < IPv4('1.1.2.0/24') - - IPv6('1080::200C:417A') < IPv6('1080::200B:417B') - - 0 if self == other - eg: IPv4('1.1.1.1/24') == IPv4('1.1.1.2/24') - - IPv6('1080::200C:417A/96') == IPv6('1080::200C:417B/96') - - 1 if self > other - eg: IPv4('1.1.1.0/24') > IPv4('1.1.0.0/24') - - IPv6('1080::1:200C:417A/112') > IPv6('1080::0:200C:417A/112') - - If the IP versions of self and other are different, returns: - - -1 if self.version < other.version - eg: IPv4('10.0.0.1/24') < IPv6('::1/128') - - 1 if self.version > other.version - eg: IPv6('::1/128') > IPv4('255.255.255.0/24') - - - .. method:: subnet(prefixlen_diff=1) - - Returns a list of subnets which when joined make up the current subnet. - - The optional *prefixlen_diff* argument specifies how many bits the prefix - length should be increased by. Given a /24 network and - ``prefixlen_diff=3``, for example, 8 subnets of size /27 will be returned. - - If called on a host IP address rather than a network, a list containing - the host itself will be returned. - - Raises :exc:`PrefixlenDiffInvalidError` if the *prefixlen_diff* is out of - range. - - - .. method:: supernet(prefixlen_diff=1) - - Returns a single IP object representing the supernet containing the - current network. - - The optional *prefixlen_diff* argument specifies how many bits the prefix - length should be decreased by. Given a /24 network and - ``prefixlen_diff=3``, for example, a supernet with a 21 bit netmask is - returned. - - Raises :exc:`PrefixlenDiffInvalidError` if the prefixlen_diff is out of - range. - - -.. class:: IPv4() - - This class represents and manipulates 32-bit IPv4 addresses. - - Attributes:: - - # These examples for IPv4('1.2.3.4/27') - .ip: 16909060 - .ip_ext: '1.2.3.4' - .ip_ext_full: '1.2.3.4' - .network: 16909056 - .network_ext: '1.2.3.0' - .hostmask: 31 (0x1F) - .hostmask_ext: '0.0.0.31' - .broadcast: 16909087 (0x102031F) - .broadcast_ext: '1.2.3.31' - .netmask: 4294967040 (0xFFFFFFE0) - .netmask_ext: '255.255.255.224' - .prefixlen: 27 - - -.. class:: IPv6() - - This class respresents and manipulates 128-bit IPv6 addresses. - - Attributes:: - - # These examples are for IPv6('2001:658:22A:CAFE:200::1/64') - .ip: 42540616829182469433547762482097946625 - .ip_ext: '2001:658:22a:cafe:200::1' - .ip_ext_full: '2001:0658:022a:cafe:0200:0000:0000:0001' - .network: 42540616829182469433403647294022090752 - .network_ext: '2001:658:22a:cafe::' - .hostmask: 18446744073709551615 - .hostmask_ext: '::ffff:ffff:ffff:ffff' - .broadcast: 42540616829182469451850391367731642367 - .broadcast_ext: '2001:658:22a:cafe:ffff:ffff:ffff:ffff' - .netmask: 340282366920938463444927863358058659840 - .netmask_ext: 64 - .prefixlen: 64 - - .. attribute:: is_site_local - - True if the address was reserved as site-local in :rfc:`3513` section - 2.5.6. - - .. note:: - - The IPv6 site-local address space has been deprecated by :rfc:`3879`. - Use :data:`is_private` to test if this address is in the space of - unique local addresses as defined by :rfc:`4193`. - - .. attribute:: is_unspecified - - True if this is the unspecified address as defined in :rfc:`2373` section - 2.5.2. - - -.. _ipaddr_exceptions: - -Exceptions ----------- - -The following exceptions are defined by this module: - -.. exception:: Error - - Base class for all exceptions defined in this module. - -.. exception:: IPTypeError - - Tried to perform a v4 action on v6 object or vice versa. - -.. exception:: IPAddressExclusionError - - An Error we should never see occurred in address exclusion. - -.. exception:: IPv4IpValidationError - - Raised when an IPv4 address is invalid. - -.. exception:: IPv4NetmaskValidationError - - Raised when a netmask is invalid. - -.. exception:: IPv6IpValidationError - - Raised when an IPv6 address is invalid. - -.. exception:: IPv6NetmaskValidationError - - Raised when an IPv6 netmask is invalid. - -.. exception:: PrefixlenDiffInvalidError - - Raised when :meth:`BaseIP.subnet` or :meth:`BaseIP.supernet` is called with a - bad ``prefixlen_diff``. - - -.. seealso:: - - http://code.google.com/p/ipaddr-py/ - The original source of this module and a place to download it as a package - for use on earlier versions of Python. Deleted: python/trunk/Lib/ipaddr.py ============================================================================== --- python/trunk/Lib/ipaddr.py Tue Jun 23 23:09:09 2009 +++ (empty file) @@ -1,1353 +0,0 @@ -# Copyright 2007 Google Inc. -# Licensed to PSF under a Contributor Agreement. -# -# See also: http://code.google.com/p/ipaddr-py/ - -"""An IPv4/IPv6 manipulation library in Python. - -This library is used to create/poke/manipulate IPv4 and IPv6 addresses -and prefixes. - -""" - -__version__ = '1.1.1' - -import struct - - -class Error(Exception): - - """Base class for exceptions.""" - - -class IPTypeError(Error): - - """Tried to perform a v4 action on v6 object or vice versa.""" - - -class IPAddressExclusionError(Error): - - """An Error we should never see occurred in address exclusion.""" - - -class IPv4IpValidationError(Error): - - """Raised when an IPv4 address is invalid.""" - - def __init__(self, ip): - Error.__init__(self) - self.ip = ip - - def __str__(self): - return repr(self.ip) + ' is not a valid IPv4 address' - - -class IPv4NetmaskValidationError(Error): - - """Raised when a netmask is invalid.""" - - def __init__(self, netmask): - Error.__init__(self) - self.netmask = netmask - - def __str__(self): - return repr(self.netmask) + ' is not a valid IPv4 netmask' - - -class IPv6IpValidationError(Error): - - """Raised when an IPv6 address is invalid.""" - - def __init__(self, ip): - Error.__init__(self) - self.ip = ip - - def __str__(self): - return repr(self.ip) + ' is not a valid IPv6 address' - - -class IPv6NetmaskValidationError(Error): - - """Raised when an IPv6 netmask is invalid.""" - - def __init__(self, netmask): - Error.__init__(self) - self.netmask = netmask - - def __str__(self): - return repr(self.netmask) + ' is not a valid IPv6 netmask' - - -class PrefixlenDiffInvalidError(Error): - - """Raised when Sub/Supernets is called with a bad prefixlen_diff.""" - - def __init__(self, error_str): - Error.__init__(self) - self.error_str = error_str - - -def IP(ipaddr): - """Take an IP string/int and return an object of the correct type. - - Args: - ipaddr: A string or integer, the IP address. Either IPv4 or - IPv6 addresses may be supplied; integers less than 2**32 will - be considered to be IPv4. - - Returns: - An IPv4 or IPv6 object. - - Raises: - ValueError: if the string passed isn't either a v4 or a v6 - address. - - """ - - try: - return IPv4(ipaddr) - except (IPv4IpValidationError, IPv4NetmaskValidationError): - pass - - try: - return IPv6(ipaddr) - except (IPv6IpValidationError, IPv6NetmaskValidationError): - pass - - raise ValueError('%r does not appear to be an IPv4 or IPv6 address' % - ipaddr) - - -def _collapse_address_list_recursive(addresses): - """Loops through the addresses, collapsing concurrent netblocks. - - Example: - - ip1 = IPv4('1.1.0.0/24') - ip2 = IPv4('1.1.1.0/24') - ip3 = IPv4('1.1.2.0/24') - ip4 = IPv4('1.1.3.0/24') - ip5 = IPv4('1.1.4.0/24') - ip6 = IPv4('1.1.0.1/22') - - _collapse_address_list_recursive([ip1, ip2, ip3, ip4, ip5, ip6]) -> - [IPv4('1.1.0.0/22'), IPv4('1.1.4.0/24')] - - This shouldn't be called directly; it is called via - collapse_address_list([]). - - Args: - addresses: A list of IPv4 or IPv6 objects. - - Returns: - A list of IPv4 or IPv6 objects depending on what we were passed. - - """ - ret_array = [] - optimized = False - - for cur_addr in addresses: - if not ret_array: - ret_array.append(cur_addr) - continue - if cur_addr in ret_array[-1]: - optimized = True - elif cur_addr == ret_array[-1].supernet().subnet()[1]: - ret_array.append(ret_array.pop().supernet()) - optimized = True - else: - ret_array.append(cur_addr) - - if optimized: - return _collapse_address_list_recursive(ret_array) - - return ret_array - - -def collapse_address_list(addresses): - """Collapse a list of IP objects. - - Example: - collapse_address_list([IPv4('1.1.0.0/24'), IPv4('1.1.1.0/24')]) -> - [IPv4('1.1.0.0/23')] - - Args: - addresses: A list of IPv4 or IPv6 objects. - - Returns: - A list of IPv4 or IPv6 objects depending on what we were passed. - - """ - return _collapse_address_list_recursive( - sorted(addresses, key=BaseIP._get_networks_key)) - - -class BaseIP(object): - - """A generic IP object. - - This IP class contains most of the methods which are used by - the IPv4 and IPv6 classes. - - """ - - def __getitem__(self, n): - if n >= 0: - if self.network + n > self.broadcast: - raise IndexError - return self._string_from_ip_int(self.network + n) - else: - n += 1 - if self.broadcast + n < self.network: - raise IndexError - return self._string_from_ip_int(self.broadcast + n) - - def __lt__(self, other): - try: - if self.version != other.version: - return self.version < other.version - if self.ip != other.ip: - return self.ip < other.ip - if self.netmask != other.netmask: - return self.netmask < other.netmask - return False - except AttributeError: - return NotImplemented - - def __gt__(self, other): - try: - if self.version != other.version: - return self.version > other.version - if self.ip != other.ip: - return self.ip > other.ip - if self.netmask != other.netmask: - return self.netmask > other.netmask - return False - except AttributeError: - return NotImplemented - - def __eq__(self, other): - try: - return (self.version == other.version - and self.ip == other.ip - and self.netmask == other.netmask) - except AttributeError: - return NotImplemented - - def __ne__(self, other): - eq = self.__eq__(other) - if eq is NotImplemented: - return NotImplemented - return not eq - - def __le__(self, other): - gt = self.__gt__(other) - if gt is NotImplemented: - return NotImplemented - return not gt - - def __ge__(self, other): - lt = self.__lt__(other) - if lt is NotImplemented: - return NotImplemented - return not lt - - def __repr__(self): - return '%s(%r)' % (self.__class__.__name__, str(self)) - - def __index__(self): - return self.ip - - def __int__(self): - return self.ip - - def __hex__(self): - return hex(int(self)) - - def address_exclude(self, other): - """Remove an address from a larger block. - - For example: - - addr1 = IP('10.1.1.0/24') - addr2 = IP('10.1.1.0/26') - addr1.address_exclude(addr2) = - [IP('10.1.1.64/26'), IP('10.1.1.128/25')] - - or IPv6: - - addr1 = IP('::1/32') - addr2 = IP('::1/128') - addr1.address_exclude(addr2) = [IP('::0/128'), - IP('::2/127'), - IP('::4/126'), - IP('::8/125'), - ... - IP('0:0:8000::/33')] - - Args: - other: An IP object of the same type. - - Returns: - A sorted list of IP objects addresses which is self minus - other. - - Raises: - IPTypeError: If self and other are of difffering address - versions. - IPAddressExclusionError: There was some unknown error in the - address exclusion process. This likely points to a bug - elsewhere in this code. - ValueError: If other is not completely contained by self. - - """ - if not self.version == other.version: - raise IPTypeError("%s and %s aren't of the same version" % ( - str(self), str(other))) - - if other not in self: - raise ValueError('%s not contained in %s' % (str(other), - str(self))) - - ret_addrs = [] - - # Make sure we're comparing the network of other. - other = IP(other.network_ext + '/' + str(other.prefixlen)) - - s1, s2 = self.subnet() - while s1 != other and s2 != other: - if other in s1: - ret_addrs.append(s2) - s1, s2 = s1.subnet() - elif other in s2: - ret_addrs.append(s1) - s1, s2 = s2.subnet() - else: - # If we got here, there's a bug somewhere. - raise IPAddressExclusionError('Error performing exclusion: ' - 's1: %s s2: %s other: %s' % - (str(s1), str(s2), str(other))) - if s1 == other: - ret_addrs.append(s2) - elif s2 == other: - ret_addrs.append(s1) - else: - # If we got here, there's a bug somewhere. - raise IPAddressExclusionError('Error performing exclusion: ' - 's1: %s s2: %s other: %s' % - (str(s1), str(s2), str(other))) - - return sorted(ret_addrs, key=BaseIP._get_networks_key) - - def compare_networks(self, other): - """Compare two IP objects. - - This is only concerned about the comparison of the integer - representation of the network addresses. This means that the - host bits aren't considered at all in this method. If you want - to compare host bits, you can easily enough do a - 'HostA.ip < HostB.ip' - - Args: - other: An IP object. - - Returns: - If the IP versions of self and other are the same, returns: - - -1 if self < other: - eg: IPv4('1.1.1.0/24') < IPv4('1.1.2.0/24') - IPv6('1080::200C:417A') < IPv6('1080::200B:417B') - 0 if self == other - eg: IPv4('1.1.1.1/24') == IPv4('1.1.1.2/24') - IPv6('1080::200C:417A/96') == IPv6('1080::200C:417B/96') - 1 if self > other - eg: IPv4('1.1.1.0/24') > IPv4('1.1.0.0/24') - IPv6('1080::1:200C:417A/112') > - IPv6('1080::0:200C:417A/112') - - If the IP versions of self and other are different, returns: - - -1 if self.version < other.version - eg: IPv4('10.0.0.1/24') < IPv6('::1/128') - 1 if self.version > other.version - eg: IPv6('::1/128') > IPv4('255.255.255.0/24') - - """ - if self.version < other.version: - return -1 - if self.version > other.version: - return 1 - # self.version == other.version below here: - if self.network < other.network: - return -1 - if self.network > other.network: - return 1 - # self.network == other.network below here: - if self.netmask < other.netmask: - return -1 - if self.netmask > other.netmask: - return 1 - # self.network == other.network and self.netmask == other.netmask - return 0 - - def _get_networks_key(self): - """Network-only key function. - - Returns an object that identifies this address' network and - netmask. This function is a suitable "key" argument for sorted() - and list.sort(). - - """ - return (self.version, self.network, self.netmask) - - prefixlen = property( - fget=lambda self: self._prefixlen, - fset=lambda self, prefixlen: self._set_prefix(prefixlen)) - - def __str__(self): - return '%s/%s' % (self._string_from_ip_int(self.ip), - str(self.prefixlen)) - - def __hash__(self): - return hash(self.ip ^ self.netmask) - - def __contains__(self, other): - return self.network <= other.ip and self.broadcast >= other.broadcast - - @property - def ip_ext(self): - """Dotted decimal or colon string version of the IP address.""" - return self._string_from_ip_int(self.ip) - - @property - def ip_ext_full(self): - """Canonical string version of the IP address.""" - return self.ip_ext - - @property - def broadcast(self): - """Integer representation of the broadcast address.""" - return self.ip | self.hostmask - - @property - def broadcast_ext(self): - """Dotted decimal or colon string version of the broadcast.""" - return self._string_from_ip_int(self.broadcast) - - @property - def hostmask(self): - """Integer representation of the hostmask.""" - return self.netmask ^ self._ALL_ONES - - @property - def hostmask_ext(self): - """Dotted decimal or colon string version of the hostmask.""" - return self._string_from_ip_int(self.hostmask) - - @property - def network(self): - """Integer representation of the network.""" - return self.ip & self.netmask - - @property - def network_ext(self): - """Dotted decimal or colon string version of the network.""" - return self._string_from_ip_int(self.network) - - @property - def netmask_ext(self): - """Dotted decimal or colon string version of the netmask.""" - return self._string_from_ip_int(self.netmask) - - @property - def numhosts(self): - """Number of hosts in the current subnet.""" - return self.broadcast - self.network + 1 - - @property - def version(self): - raise NotImplementedError('BaseIP has no version') - - def _ip_int_from_prefix(self, prefixlen=None): - """Turn the prefix length netmask into a int for comparison. - - Args: - prefixlen: An integer, the prefix length. - - Returns: - An integer. - - """ - if not prefixlen and prefixlen != 0: - prefixlen = self.prefixlen - return self._ALL_ONES ^ (self._ALL_ONES >> prefixlen) - - def _prefix_from_ip_int(self, ip_int, mask=32): - """Return prefix length from the decimal netmask. - - Args: - ip_int: An integer, the IP address. - mask: The netmask. Defaults to 32. - - Returns: - An integer, the prefix length. - - """ - while mask: - if ip_int & 1 == 1: - break - ip_int >>= 1 - mask -= 1 - - return mask - - def _ip_string_from_prefix(self, prefixlen=None): - """Turn a prefix length into a dotted decimal string. - - Args: - prefixlen: An integer, the netmask prefix length. - - Returns: - A string, the dotted decimal netmask string. - - """ - if not prefixlen: - prefixlen = self.prefixlen - return self._string_from_ip_int(self._ip_int_from_prefix(prefixlen)) - - -class IPv4(BaseIP): - - """This class represents and manipulates 32-bit IPv4 addresses. - - Attributes: [examples for IPv4('1.2.3.4/27')] - .ip: 16909060 - .ip_ext: '1.2.3.4' - .ip_ext_full: '1.2.3.4' - .network: 16909056L - .network_ext: '1.2.3.0' - .hostmask: 31L (0x1F) - .hostmask_ext: '0.0.0.31' - .broadcast: 16909087L (0x102031F) - .broadcast_ext: '1.2.3.31' - .netmask: 4294967040L (0xFFFFFFE0) - .netmask_ext: '255.255.255.224' - .prefixlen: 27 - - """ - - # Equivalent to 255.255.255.255 or 32 bits of 1's. - _ALL_ONES = 0xffffffff - _version = 4 - - def __init__(self, ipaddr): - """Instantiate a new IPv4 object. - - Args: - ipaddr: A string or integer representing the IP [& network]. - '192.168.1.1/32' - '192.168.1.1/255.255.255.255' - '192.168.1.1/0.0.0.255' - '192.168.1.1' - are all functionally the same in IPv4. That is to say, - failing to provide a subnetmask will create an object with - a mask of /32. A netmask of '255.255.255.255' is assumed - to be /32 and '0.0.0.0' is assumed to be /0, even though - other netmasks can be expressed both as host- and - net-masks. (255.0.0.0 == 0.255.255.255) - - Additionally, an integer can be passed, so - IPv4('192.168.1.1') == IPv4(3232235777). - or, more generally - IPv4(IPv4('192.168.1.1').ip) == IPv4('192.168.1.1') - - Raises: - IPv4IpValidationError: If ipaddr isn't a valid IPv4 address. - IPv4NetmaskValidationError: If the netmask isn't valid for - an IPv4 address. - - """ - BaseIP.__init__(self) - - # Efficient constructor from integer. - if isinstance(ipaddr, int) or isinstance(ipaddr, long): - self.ip = ipaddr - self._prefixlen = 32 - self.netmask = self._ALL_ONES - if ipaddr < 0 or ipaddr > self._ALL_ONES: - raise IPv4IpValidationError(ipaddr) - return - - # Assume input argument to be string or any object representation - # which converts into a formatted IP prefix string. - addr = str(ipaddr).split('/') - - if len(addr) > 2: - raise IPv4IpValidationError(ipaddr) - - if not self._is_valid_ip(addr[0]): - raise IPv4IpValidationError(addr[0]) - - self.ip = self._ip_int_from_string(addr[0]) - - if len(addr) == 2: - mask = addr[1].split('.') - if len(mask) == 4: - # We have dotted decimal netmask. - if not self._is_valid_netmask(addr[1]): - raise IPv4NetmaskValidationError(addr[1]) - if self._is_hostmask(addr[1]): - self.netmask = ( - self._ip_int_from_string(addr[1]) ^ self._ALL_ONES) - else: - self.netmask = self._ip_int_from_string(addr[1]) - self._prefixlen = self._prefix_from_ip_int(self.netmask) - else: - # We have a netmask in prefix length form. - if not self._is_valid_netmask(addr[1]): - raise IPv4NetmaskValidationError(addr[1]) - self._prefixlen = int(addr[1]) - self.netmask = self._ip_int_from_prefix(self._prefixlen) - else: - self._prefixlen = 32 - self.netmask = self._ip_int_from_prefix(self._prefixlen) - - def _set_prefix(self, prefixlen): - """Change the prefix length. - - Args: - prefixlen: An integer, the new prefix length. - - Raises: - IPv4NetmaskValidationError: If prefixlen is out of bounds. - - """ - if not 0 <= prefixlen <= 32: - raise IPv4NetmaskValidationError(prefixlen) - self._prefixlen = prefixlen - self.netmask = self._ip_int_from_prefix(self._prefixlen) - - def subnet(self, prefixlen_diff=1): - """The subnets which join to make the current subnet. - - In the case that self contains only one IP - (self._prefixlen == 32), return a list with just ourself. - - Args: - prefixlen_diff: An integer, the amount the prefix length - should be increased by. Given a /24 network and a - prefixlen_diff of 3, for example, 8 subnets of size /27 - will be returned. The default value of 1 splits the - current network into two halves. - - Returns: - A list of IPv4 objects. - - Raises: - PrefixlenDiffInvalidError: The prefixlen_diff is too small - or too large. - - """ - if self._prefixlen == 32: - return [self] - - if prefixlen_diff < 0: - raise PrefixlenDiffInvalidError('prefix length diff must be > 0') - new_prefixlen = self.prefixlen + prefixlen_diff - - if not self._is_valid_netmask(str(new_prefixlen)): - raise PrefixlenDiffInvalidError( - 'prefix length diff %d is invalid for netblock %s' % ( - new_prefixlen, str(self))) - - first = IPv4( - self._string_from_ip_int(self.network) + '/' + - str(self._prefixlen + prefixlen_diff)) - subnets = [first] - current = first - while True: - broadcast = current.broadcast - if broadcast == self.broadcast: - break - current = IPv4(self._string_from_ip_int(broadcast + 1) + '/' + - str(new_prefixlen)) - subnets.append(current) - - return subnets - - def supernet(self, prefixlen_diff=1): - """The supernet containing the current network. - - Args: - prefixlen_diff: An integer, the amount the prefix length of - the network should be decreased by. For example, given a - /24 network and a prefixlen_diff of 3, a supernet with a - /21 netmask is returned. - - Returns: - An IPv4 object. - - Raises: - PrefixlenDiffInvalidError: If - self.prefixlen - prefixlen_diff < 0. I.e., you have a - negative prefix length. - - """ - if self.prefixlen == 0: - return self - if self.prefixlen - prefixlen_diff < 0: - raise PrefixlenDiffInvalidError( - 'current prefixlen is %d, cannot have a prefixlen_diff of %d' % - (self.prefixlen, prefixlen_diff)) - return IPv4(self.ip_ext + '/' + str(self.prefixlen - prefixlen_diff)) - - @property - def is_private(self): - """Test if this address is allocated for private networks. - - Returns: - A boolean, True if the address is reserved per RFC 1918. - - """ - for network in _IPV4_RFC1918_NETWORKS: - if self in network: - return True - return False - - @property - def is_multicast(self): - """Test if the address is reserved for multicast use. - - Returns: - A boolean, True if the address is multicast. - See RFC 3171 for details. - - """ - return self in _IPV4_RFC3171_MULTICAST - - @property - def is_loopback(self): - """Test if the address is a loopback adddress. - - Returns: - A boolean, True if the address is a loopback per RFC 3330. - - """ - return self in _IPV4_RFC3330_LOOPBACK - - @property - def is_link_local(self): - """Test if the address is reserved for link-local. - - Returns: - A boolean, True if the address is link-local per RFC 3927. - - """ - return self in _IPV4_RFC3927_LINK_LOCAL - - @property - def version(self): - return self._version - - @property - def packed(self): - """The binary representation of this address.""" - return struct.pack('!I', self.ip) - - def _is_hostmask(self, ip_str): - """Test if the IP string is a hostmask (rather than a netmask). - - Args: - ip_str: A string, the potential hostmask. - - Returns: - A boolean, True if the IP string is a hostmask. - - """ - parts = [int(x) for x in ip_str.split('.')] - if parts[0] < parts[-1]: - return True - return False - - def _ip_int_from_string(self, ip_str): - """Turn the given IP string into an integer for comparison. - - Args: - ip_str: A string, the IP address. - - Returns: - The IP address as an integer. - - """ - packed_ip = 0 - for oc in ip_str.split('.'): - packed_ip = (packed_ip << 8) | int(oc) - return packed_ip - - def _string_from_ip_int(self, ip_int): - """Turns a 32-bit integer into dotted decimal notation. - - Args: - ip_int: An integer, the IP address. - - Returns: - The IP address as a string in dotted decimal notation. - - """ - octets = [] - for _ in xrange(4): - octets.insert(0, str(ip_int & 0xFF)) - ip_int >>= 8 - return '.'.join(octets) - - def _is_valid_ip(self, ip_str): - """Validate the dotted decimal notation IP/netmask string. - - Args: - ip_str: A string, the IP address. - - Returns: - A boolean, True if the string is a valid dotted decimal IP - string. - - """ - octets = ip_str.split('.') - if len(octets) == 1: - # We have an integer rather than a dotted decimal IP. - try: - return int(ip_str) >= 0 and int(ip_str) <= self._ALL_ONES - except ValueError: - return False - - if len(octets) != 4: - return False - - for octet in octets: - try: - if not 0 <= int(octet) <= 255: - return False - except ValueError: - return False - return True - - def _is_valid_netmask(self, netmask): - """Verify that the netmask is valid. - - Args: - netmask: A string, either a prefix or dotted decimal - netmask. - - Returns: - A boolean, True if the prefix represents a valid IPv4 - netmask. - - """ - if len(netmask.split('.')) == 4: - return self._is_valid_ip(netmask) - try: - netmask = int(netmask) - except ValueError: - return False - return 0 <= netmask <= 32 - - -class IPv6(BaseIP): - - """This class respresents and manipulates 128-bit IPv6 addresses. - - Attributes: [examples for IPv6('2001:658:22A:CAFE:200::1/64')] - .ip: 42540616829182469433547762482097946625L - .ip_ext: '2001:658:22a:cafe:200::1' - .ip_ext_full: '2001:0658:022a:cafe:0200:0000:0000:0001' - .network: 42540616829182469433403647294022090752L - .network_ext: '2001:658:22a:cafe::' - .hostmask: 18446744073709551615L - .hostmask_ext: '::ffff:ffff:ffff:ffff' - .broadcast: 42540616829182469451850391367731642367L - .broadcast_ext: '2001:658:22a:cafe:ffff:ffff:ffff:ffff' - .netmask: 340282366920938463444927863358058659840L - .netmask_ext: 64 - .prefixlen: 64 - - """ - - _ALL_ONES = (2**128) - 1 - _version = 6 - - def __init__(self, ipaddr): - """Instantiate a new IPv6 object. - - Args: - ipaddr: A string or integer representing the IP or the IP - and prefix/netmask. - '2001:4860::/128' - '2001:4860:0000:0000:0000:0000:0000:0000/128' - '2001:4860::' - are all functionally the same in IPv6. That is to say, - failing to provide a subnetmask will create an object with - a mask of /128. - - Additionally, an integer can be passed, so - IPv6('2001:4860::') == - IPv6(42541956101370907050197289607612071936L). - or, more generally - IPv6(IPv6('2001:4860::').ip) == IPv6('2001:4860::') - - Raises: - IPv6IpValidationError: If ipaddr isn't a valid IPv6 address. - IPv6NetmaskValidationError: If the netmask isn't valid for - an IPv6 address. - - """ - BaseIP.__init__(self) - - # Efficient constructor from integer. - if isinstance(ipaddr, long) or isinstance(ipaddr, int): - self.ip = ipaddr - self._prefixlen = 128 - self.netmask = self._ALL_ONES - if ipaddr < 0 or ipaddr > self._ALL_ONES: - raise IPv6IpValidationError(ipaddr) - return - - # Assume input argument to be string or any object representation - # which converts into a formatted IP prefix string. - addr_str = str(ipaddr) - if not addr_str: - raise IPv6IpValidationError('') - addr = addr_str.split('/') - if len(addr) > 1: - if self._is_valid_netmask(addr[1]): - self._prefixlen = int(addr[1]) - else: - raise IPv6NetmaskValidationError(addr[1]) - else: - self._prefixlen = 128 - - self.netmask = self._ip_int_from_prefix(self._prefixlen) - - if not self._is_valid_ip(addr[0]): - raise IPv6IpValidationError(addr[0]) - - self.ip = self._ip_int_from_string(addr[0]) - - @property - def ip_ext_full(self): - """Returns the expanded version of the IPv6 string.""" - return self._explode_shorthand_ip_string(self.ip_ext) - - def _set_prefix(self, prefixlen): - """Change the prefix length. - - Args: - prefixlen: An integer, the new prefix length. - - Raises: - IPv6NetmaskValidationError: If prefixlen is out of bounds. - - """ - if not 0 <= prefixlen <= 128: - raise IPv6NetmaskValidationError(prefixlen) - self._prefixlen = prefixlen - self.netmask = self._ip_int_from_prefix(self.prefixlen) - - def subnet(self, prefixlen_diff=1): - """The subnets which join to make the current subnet. - - In the case that self contains only one IP - (self._prefixlen == 128), return a list with just ourself. - - Args: - prefixlen_diff: An integer, the amount the prefix length - should be increased by. - - Returns: - A list of IPv6 objects. - - Raises: - PrefixlenDiffInvalidError: The prefixlen_diff is too small - or too large. - - """ - # Preserve original functionality (return [self] if - # self.prefixlen == 128). - if self.prefixlen == 128: - return [self] - - if prefixlen_diff < 0: - raise PrefixlenDiffInvalidError('Prefix length diff must be > 0') - new_prefixlen = self.prefixlen + prefixlen_diff - if not self._is_valid_netmask(str(new_prefixlen)): - raise PrefixlenDiffInvalidError( - 'Prefix length diff %d is invalid for netblock %s' % ( - new_prefixlen, str(self))) - first = IPv6( - self._string_from_ip_int(self.network) + '/' + - str(self._prefixlen + prefixlen_diff)) - subnets = [first] - current = first - while True: - broadcast = current.broadcast - if current.broadcast == self.broadcast: - break - current = IPv6(self._string_from_ip_int(broadcast + 1) + '/' + - str(new_prefixlen)) - subnets.append(current) - - return subnets - - def supernet(self, prefixlen_diff=1): - """The supernet containing the current network. - - Args: - prefixlen_diff: An integer, the amount the prefix length of the - network should be decreased by. For example, given a /96 - network and a prefixlen_diff of 3, a supernet with a /93 - netmask is returned. - - Returns: - An IPv6 object. - - Raises: - PrefixlenDiffInvalidError: If - self._prefixlen - prefixlen_diff < 0. I.e., you have a - negative prefix length. - - """ - if self.prefixlen == 0: - return self - if self.prefixlen - prefixlen_diff < 0: - raise PrefixlenDiffInvalidError( - 'current prefixlen is %d, cannot have a prefixlen_diff of %d' % - (self.prefixlen, prefixlen_diff)) - return IPv6(self.ip_ext + '/' + str(self.prefixlen - prefixlen_diff)) - - @property - def is_multicast(self): - """Test if the address is reserved for multicast use. - - Returns: - A boolean, True if the address is a multicast address. - See RFC 2373 2.7 for details. - - """ - return self in _IPV6_RFC2373_MULTICAST - - @property - def is_unspecified(self): - """Test if the address is unspecified. - - Returns: - A boolean, True if this is the unspecified address as defined in - RFC 2373 2.5.2. - - """ - return self == _IPV6_RFC2373_UNSPECIFIED - - @property - def is_loopback(self): - """Test if the address is a loopback adddress. - - Returns: - A boolean, True if the address is a loopback address as defined in - RFC 2373 2.5.3. - - """ - return self == _IPV6_RFC2373_LOOPBACK - - @property - def is_link_local(self): - """Test if the address is reserved for link-local. - - Returns: - A boolean, True if the address is reserved per RFC 4291. - - """ - return self in _IPV6_RFC4291_LINK_LOCAL - - @property - def is_site_local(self): - """Test if the address is reserved for site-local. - - Note that the site-local address space has been deprecated by RFC 3879. - Use is_private to test if this address is in the space of unique local - addresses as defined by RFC 4193. - - Returns: - A boolean, True if the address is reserved per RFC 3513 2.5.6. - - """ - return self in _IPV6_RFC3513_SITE_LOCAL - - @property - def is_private(self): - """Test if this address is allocated for private networks. - - Returns: - A boolean, True if the address is reserved per RFC 4193. - - """ - return self in _IPV6_RFC4193_PRIVATE - - @property - def version(self): - return self._version - - @property - def packed(self): - """The binary representation of this address.""" - return struct.pack('!QQ', self.ip >> 64, self.ip & (2**64 - 1)) - - def _is_shorthand_ip(self, ip_str=None): - """Determine if the address is shortened. - - Args: - ip_str: A string, the IPv6 address. - - Returns: - A boolean, True if the address is shortened. - - """ - if ip_str.count('::') == 1: - return True - return False - - def _explode_shorthand_ip_string(self, ip_str): - """Expand a shortened IPv6 address. - - Args: - ip_str: A string, the IPv6 address. - - Returns: - A string, the expanded IPv6 address. - - """ - if self._is_shorthand_ip(ip_str): - new_ip = [] - hextet = ip_str.split('::') - sep = len(hextet[0].split(':')) + len(hextet[1].split(':')) - new_ip = hextet[0].split(':') - - for _ in xrange(8 - sep): - new_ip.append('0000') - new_ip += hextet[1].split(':') - - # Now need to make sure every hextet is 4 lower case characters. - # If a hextet is < 4 characters, we've got missing leading 0's. - ret_ip = [] - for hextet in new_ip: - ret_ip.append(('0' * (4 - len(hextet)) + hextet).lower()) - return ':'.join(ret_ip) - # We've already got a longhand ip_str. - return ip_str - - def _is_valid_ip(self, ip_str=None): - """Ensure we have a valid IPv6 address. - - Probably not as exhaustive as it should be. - - Args: - ip_str: A string, the IPv6 address. - - Returns: - A boolean, True if this is a valid IPv6 address. - - """ - if not ip_str: - ip_str = self.ip_ext - - # We need to have at least one ':'. - if ':' not in ip_str: - return False - - # We can only have one '::' shortener. - if ip_str.count('::') > 1: - return False - - # '::' should be encompassed by start, digits or end. - if ':::' in ip_str: - return False - - # A single colon can neither start nor end an address. - if ((ip_str.startswith(':') and not ip_str.startswith('::')) or - (ip_str.endswith(':') and not ip_str.endswith('::'))): - return False - - # If we have no concatenation, we need to have 8 fields with 7 ':'. - if '::' not in ip_str and ip_str.count(':') != 7: - # We might have an IPv4 mapped address. - if ip_str.count('.') != 3: - return False - - ip_str = self._explode_shorthand_ip_string(ip_str) - - # Now that we have that all squared away, let's check that each of the - # hextets are between 0x0 and 0xFFFF. - for hextet in ip_str.split(':'): - if hextet.count('.') == 3: - # If we have an IPv4 mapped address, the IPv4 portion has to be - # at the end of the IPv6 portion. - if not ip_str.split(':')[-1] == hextet: - return False - try: - IPv4(hextet) - except IPv4IpValidationError: - return False - elif int(hextet, 16) < 0x0 or int(hextet, 16) > 0xFFFF: - return False - return True - - def _is_valid_netmask(self, prefixlen): - """Verify that the netmask/prefixlen is valid. - - Args: - prefixlen: A string, the netmask in prefix length format. - - Returns: - A boolean, True if the prefix represents a valid IPv6 - netmask. - - """ - try: - prefixlen = int(prefixlen) - except ValueError: - return False - return 0 <= prefixlen <= 128 - - def _ip_int_from_string(self, ip_str=None): - """Turn an IPv6 address into an integer. - - Args: - ip_str: A string, the IPv6 address. - - Returns: - A long, the IPv6 address. - - """ - if not ip_str: - ip_str = self.ip_ext - - ip_int = 0 - - fields = self._explode_shorthand_ip_string(ip_str).split(':') - - # Do we have an IPv4 mapped (::ffff:a.b.c.d) or compact (::a.b.c.d) - # address? - if fields[-1].count('.') == 3: - ipv4_string = fields.pop() - ipv4_int = IPv4(ipv4_string).ip - octets = [] - for _ in xrange(2): - octets.append(hex(ipv4_int & 0xFFFF).lstrip('0x').rstrip('L')) - ipv4_int >>= 16 - fields.extend(reversed(octets)) - - for field in fields: - ip_int = (ip_int << 16) + int(field, 16) - - return ip_int - - def _compress_hextets(self, hextets): - """Compresses a list of hextets. - - Compresses a list of strings, replacing the longest continuous - sequence of "0" in the list with "" and adding empty strings at - the beginning or at the end of the string such that subsequently - calling ":".join(hextets) will produce the compressed version of - the IPv6 address. - - Args: - hextets: A list of strings, the hextets to compress. - - Returns: - A list of strings. - - """ - best_doublecolon_start = -1 - best_doublecolon_len = 0 - doublecolon_start = -1 - doublecolon_len = 0 - for index in range(len(hextets)): - if hextets[index] == '0': - doublecolon_len += 1 - if doublecolon_start == -1: - # Start of a sequence of zeros. - doublecolon_start = index - if doublecolon_len > best_doublecolon_len: - # This is the longest sequence of zeros so far. - best_doublecolon_len = doublecolon_len - best_doublecolon_start = doublecolon_start - else: - doublecolon_len = 0 - doublecolon_start = -1 - - if best_doublecolon_len > 1: - best_doublecolon_end = (best_doublecolon_start + - best_doublecolon_len) - # For zeros at the end of the address. - if best_doublecolon_end == len(hextets): - hextets += [''] - hextets[best_doublecolon_start:best_doublecolon_end] = [''] - # For zeros at the beginning of the address. - if best_doublecolon_start == 0: - hextets = [''] + hextets - - return hextets - - def _string_from_ip_int(self, ip_int=None): - """Turns a 128-bit integer into hexadecimal notation. - - Args: - ip_int: An integer, the IP address. - - Returns: - A string, the hexadecimal representation of the address. - - Raises: - ValueError: The address is bigger than 128 bits of all ones. - - """ - if not ip_int and ip_int != 0: - ip_int = self.ip - - if ip_int > self._ALL_ONES: - raise ValueError('IPv6 address is too large') - - hex_str = '%032x' % ip_int - hextets = [] - for x in range(0, 32, 4): - hextets.append('%x' % int(hex_str[x:x+4], 16)) - - hextets = self._compress_hextets(hextets) - return ':'.join(hextets) - - @property - def netmask_ext(self): - """IPv6 extended netmask. - - We don't deal with netmasks in IPv6 like we do in IPv4. This is - here strictly for IPv4 compatibility. We simply return the - prefix length. - - Returns: - An integer. - - """ - return self.prefixlen - - -# IPv4 constants. -_IPV4_RFC1918_NETWORKS = (IPv4('10.0.0.0/8'), - IPv4('172.16.0.0/12'), - IPv4('192.168.0.0/16')) -_IPV4_RFC3171_MULTICAST = IPv4('224.0.0.0/4') -_IPV4_RFC3330_LOOPBACK = IPv4('127.0.0.0/8') -_IPV4_RFC3927_LINK_LOCAL = IPv4('169.254.0.0/16') - -# IPv6 constants. -_IPV6_RFC2373_MULTICAST = IPv6('ff00::/8') -_IPV6_RFC2373_UNSPECIFIED = IPv6('::') -_IPV6_RFC2373_LOOPBACK = IPv6('::1') -_IPV6_RFC4291_LINK_LOCAL = IPv6('fe80::/10') -_IPV6_RFC3513_SITE_LOCAL = IPv6('fec0::/10') # Deprecated by RFC3879. -_IPV6_RFC4193_PRIVATE = IPv6('fc00::/7') Deleted: python/trunk/Lib/test/test_ipaddr.py ============================================================================== --- python/trunk/Lib/test/test_ipaddr.py Tue Jun 23 23:09:09 2009 +++ (empty file) @@ -1,554 +0,0 @@ -# Copyright 2007 Google Inc. -# Licensed to PSF under a Contributor Agreement. -# -# See also: http://code.google.com/p/ipaddr-py/ - -"""Unittest for ipaddr module.""" - - -import unittest - -import ipaddr - - -class IpaddrUnitTest(unittest.TestCase): - - def setUp(self): - self.ipv4 = ipaddr.IPv4('1.2.3.4/24') - self.ipv4_hostmask = ipaddr.IPv4('10.0.0.1/0.255.255.255') - self.ipv6 = ipaddr.IPv6('2001:658:22a:cafe:200:0:0:1/64') - - def test_repr(self): - self.assertEqual("IPv4('1.2.3.4/32')", repr(ipaddr.IPv4('1.2.3.4'))) - self.assertEqual("IPv6('::1/128')", repr(ipaddr.IPv6('::1'))) - - def test_invalid_strings(self): - self.assertRaises(ValueError, ipaddr.IP, '') - self.assertRaises(ValueError, ipaddr.IP, 'www.google.com') - self.assertRaises(ValueError, ipaddr.IP, '1.2.3') - self.assertRaises(ValueError, ipaddr.IP, '1.2.3.4.5') - self.assertRaises(ValueError, ipaddr.IP, '301.2.2.2') - self.assertRaises(ValueError, ipaddr.IP, '1:2:3:4:5:6:7') - self.assertRaises(ValueError, ipaddr.IP, '1:2:3:4:5:6:7:') - self.assertRaises(ValueError, ipaddr.IP, ':2:3:4:5:6:7:8') - self.assertRaises(ValueError, ipaddr.IP, '1:2:3:4:5:6:7:8:9') - self.assertRaises(ValueError, ipaddr.IP, '1:2:3:4:5:6:7:8:') - self.assertRaises(ValueError, ipaddr.IP, '1::3:4:5:6::8') - self.assertRaises(ValueError, ipaddr.IP, 'a:') - self.assertRaises(ValueError, ipaddr.IP, ':') - self.assertRaises(ValueError, ipaddr.IP, ':::') - self.assertRaises(ValueError, ipaddr.IP, '::a:') - self.assertRaises(ValueError, ipaddr.IP, '1ffff::') - self.assertRaises(ValueError, ipaddr.IP, '0xa::') - self.assertRaises(ValueError, ipaddr.IP, '1:2:3:4:5:6:1a.2.3.4') - self.assertRaises(ValueError, ipaddr.IP, '1:2:3:4:5:1.2.3.4:8') - self.assertRaises(ipaddr.IPv4IpValidationError, ipaddr.IPv4, '') - self.assertRaises(ipaddr.IPv4IpValidationError, ipaddr.IPv4, - 'google.com') - self.assertRaises(ipaddr.IPv4IpValidationError, ipaddr.IPv4, - '::1.2.3.4') - self.assertRaises(ipaddr.IPv6IpValidationError, ipaddr.IPv6, '') - self.assertRaises(ipaddr.IPv6IpValidationError, ipaddr.IPv6, - 'google.com') - self.assertRaises(ipaddr.IPv6IpValidationError, ipaddr.IPv6, - '1.2.3.4') - - def test_get_network(self): - self.assertEqual(self.ipv4.network, 16909056) - self.assertEqual(self.ipv4.network_ext, '1.2.3.0') - self.assertEqual(self.ipv4_hostmask.network_ext, '10.0.0.0') - - self.assertEqual(self.ipv6.network, - 42540616829182469433403647294022090752) - self.assertEqual(self.ipv6.network_ext, - '2001:658:22a:cafe::') - self.assertEqual(self.ipv6.hostmask_ext, - '::ffff:ffff:ffff:ffff') - - def test_ip_from_int(self): - self.assertEqual(self.ipv4.ip, ipaddr.IPv4(16909060).ip) - self.assertRaises(ipaddr.IPv4IpValidationError, - ipaddr.IPv4, 2**32) - self.assertRaises(ipaddr.IPv4IpValidationError, - ipaddr.IPv4, -1) - - self.assertEqual(self.ipv6.ip, - ipaddr.IPv6(42540616829182469433547762482097946625).ip) - self.assertRaises(ipaddr.IPv6IpValidationError, - ipaddr.IPv6, 2**128) - self.assertRaises(ipaddr.IPv6IpValidationError, - ipaddr.IPv6, -1) - - self.assertEqual(ipaddr.IP(self.ipv4.ip).version, 4) - self.assertEqual(ipaddr.IP(self.ipv6.ip).version, 6) - - def test_get_ip(self): - self.assertEqual(self.ipv4.ip, 16909060) - self.assertEqual(self.ipv4.ip_ext, '1.2.3.4') - self.assertEqual(self.ipv4.ip_ext_full, '1.2.3.4') - self.assertEqual(self.ipv4_hostmask.ip_ext, '10.0.0.1') - - self.assertEqual(self.ipv6.ip, 42540616829182469433547762482097946625) - self.assertEqual(self.ipv6.ip_ext, - '2001:658:22a:cafe:200::1') - self.assertEqual(self.ipv6.ip_ext_full, - '2001:0658:022a:cafe:0200:0000:0000:0001') - - def test_get_netmask(self): - self.assertEqual(self.ipv4.netmask, 4294967040) - self.assertEqual(self.ipv4.netmask_ext, '255.255.255.0') - self.assertEqual(self.ipv4_hostmask.netmask_ext, '255.0.0.0') - self.assertEqual(self.ipv6.netmask, - 340282366920938463444927863358058659840) - self.assertEqual(self.ipv6.netmask_ext, 64) - - def test_zero_netmask(self): - ipv4_zero_netmask = ipaddr.IPv4('1.2.3.4/0') - self.assertEqual(ipv4_zero_netmask.netmask, 0) - self.assert_(ipv4_zero_netmask._is_valid_netmask(str(0))) - - ipv6_zero_netmask = ipaddr.IPv6('::1/0') - self.assertEqual(ipv6_zero_netmask.netmask, 0) - self.assert_(ipv6_zero_netmask._is_valid_netmask(str(0))) - - def test_get_broadcast(self): - self.assertEqual(self.ipv4.broadcast, 16909311) - self.assertEqual(self.ipv4.broadcast_ext, '1.2.3.255') - - self.assertEqual(self.ipv6.broadcast, - 42540616829182469451850391367731642367) - self.assertEqual(self.ipv6.broadcast_ext, - '2001:658:22a:cafe:ffff:ffff:ffff:ffff') - - def test_get_prefixlen(self): - self.assertEqual(self.ipv4.prefixlen, 24) - - self.assertEqual(self.ipv6.prefixlen, 64) - - def test_get_supernet(self): - self.assertEqual(self.ipv4.supernet().prefixlen, 23) - self.assertEqual(self.ipv4.supernet().network_ext, '1.2.2.0') - self.assertEqual(ipaddr.IPv4('0.0.0.0/0').supernet(), - ipaddr.IPv4('0.0.0.0/0')) - - self.assertEqual(self.ipv6.supernet().prefixlen, 63) - self.assertEqual(self.ipv6.supernet().network_ext, - '2001:658:22a:cafe::') - self.assertEqual(ipaddr.IPv6('::0/0').supernet(), ipaddr.IPv6('::0/0')) - - def test_get_supernet3(self): - self.assertEqual(self.ipv4.supernet(3).prefixlen, 21) - self.assertEqual(self.ipv4.supernet(3).network_ext, '1.2.0.0') - - self.assertEqual(self.ipv6.supernet(3).prefixlen, 61) - self.assertEqual(self.ipv6.supernet(3).network_ext, - '2001:658:22a:caf8::') - - def test_get_subnet(self): - self.assertEqual(self.ipv4.subnet()[0].prefixlen, 25) - self.assertEqual(self.ipv4.subnet()[0].network_ext, '1.2.3.0') - self.assertEqual(self.ipv4.subnet()[1].network_ext, '1.2.3.128') - - self.assertEqual(self.ipv6.subnet()[0].prefixlen, 65) - - def test_get_subnet_for_single32(self): - ip = ipaddr.IPv4('1.2.3.4/32') - subnets1 = [str(x) for x in ip.subnet()] - subnets2 = [str(x) for x in ip.subnet(2)] - self.assertEqual(subnets1, ['1.2.3.4/32']) - self.assertEqual(subnets1, subnets2) - - def test_get_subnet_for_single128(self): - ip = ipaddr.IPv6('::1/128') - subnets1 = [str(x) for x in ip.subnet()] - subnets2 = [str(x) for x in ip.subnet(2)] - self.assertEqual(subnets1, ['::1/128']) - self.assertEqual(subnets1, subnets2) - - def test_subnet2(self): - ips = [str(x) for x in self.ipv4.subnet(2)] - self.assertEqual( - ips, - ['1.2.3.0/26', '1.2.3.64/26', '1.2.3.128/26', '1.2.3.192/26']) - - ipsv6 = [str(x) for x in self.ipv6.subnet(2)] - self.assertEqual( - ipsv6, - ['2001:658:22a:cafe::/66', - '2001:658:22a:cafe:4000::/66', - '2001:658:22a:cafe:8000::/66', - '2001:658:22a:cafe:c000::/66']) - - def test_subnet_fails_for_large_cidr_diff(self): - self.assertRaises(ipaddr.PrefixlenDiffInvalidError, self.ipv4.subnet, 9) - self.assertRaises(ipaddr.PrefixlenDiffInvalidError, self.ipv6.subnet, - 65) - - def test_supernet_fails_for_large_cidr_diff(self): - self.assertRaises(ipaddr.PrefixlenDiffInvalidError, self.ipv4.supernet, - 25) - self.assertRaises(ipaddr.PrefixlenDiffInvalidError, self.ipv6.supernet, - 65) - - def test_subnet_fails_for_negative_cidr_diff(self): - self.assertRaises(ipaddr.PrefixlenDiffInvalidError, self.ipv4.subnet, - -1) - self.assertRaises(ipaddr.PrefixlenDiffInvalidError, self.ipv6.subnet, - -1) - - def test_get_num_hosts(self): - self.assertEqual(self.ipv4.numhosts, 256) - self.assertEqual(self.ipv4.subnet()[0].numhosts, 128) - self.assertEqual(self.ipv4.supernet().numhosts, 512) - - self.assertEqual(self.ipv6.numhosts, 18446744073709551616) - self.assertEqual(self.ipv6.subnet()[0].numhosts, 9223372036854775808) - self.assertEqual(self.ipv6.supernet().numhosts, 36893488147419103232) - - def test_contains(self): - self.assertTrue(ipaddr.IPv4('1.2.3.128/25') in self.ipv4) - self.assertFalse(ipaddr.IPv4('1.2.4.1/24') in self.ipv4) - self.assertFalse(self.ipv4 in self.ipv6) - self.assertFalse(self.ipv6 in self.ipv4) - self.assertTrue(self.ipv4 in self.ipv4) - self.assertTrue(self.ipv6 in self.ipv6) - - def test_bad_address(self): - self.assertRaises(ipaddr.IPv4IpValidationError, ipaddr.IPv4, 'poop') - self.assertRaises(ipaddr.IPv4IpValidationError, - ipaddr.IPv4, '1.2.3.256') - - self.assertRaises(ipaddr.IPv6IpValidationError, ipaddr.IPv6, 'poopv6') - self.assertRaises(ipaddr.IPv4IpValidationError, - ipaddr.IPv4, '1.2.3.4/32/24') - - def test_bad_net_mask(self): - self.assertRaises(ipaddr.IPv4NetmaskValidationError, - ipaddr.IPv4, '1.2.3.4/') - self.assertRaises(ipaddr.IPv4NetmaskValidationError, - ipaddr.IPv4, '1.2.3.4/33') - self.assertRaises(ipaddr.IPv4NetmaskValidationError, - ipaddr.IPv4, '1.2.3.4/254.254.255.256') - - self.assertRaises(ipaddr.IPv6NetmaskValidationError, - ipaddr.IPv6, '::1/') - self.assertRaises(ipaddr.IPv6NetmaskValidationError, - ipaddr.IPv6, '::1/129') - - def test_nth(self): - self.assertEqual(self.ipv4[5], '1.2.3.5') - self.assertRaises(IndexError, self.ipv4.__getitem__, 256) - - self.assertEqual(self.ipv6[5], - '2001:658:22a:cafe::5') - - def test_getitem(self): - # http://code.google.com/p/ipaddr-py/issues/detail?id=15 - addr = ipaddr.IPv4('172.31.255.128/255.255.255.240') - self.assertEqual(28, addr.prefixlen) - addr_list = list(addr) - self.assertEqual('172.31.255.128', addr_list[0]) - self.assertEqual('172.31.255.128', addr[0]) - self.assertEqual('172.31.255.143', addr_list[-1]) - self.assertEqual('172.31.255.143', addr[-1]) - self.assertEqual(addr_list[-1], addr[-1]) - - def test_equals(self): - self.assertTrue(self.ipv4 == ipaddr.IPv4('1.2.3.4/24')) - self.assertFalse(self.ipv4 == ipaddr.IPv4('1.2.3.4/23')) - self.assertFalse(self.ipv4 == ipaddr.IPv4('1.2.3.5/24')) - self.assertFalse(self.ipv4 == ipaddr.IPv6('::1.2.3.4/24')) - self.assertFalse(self.ipv4 == '') - self.assertFalse(self.ipv4 == []) - self.assertFalse(self.ipv4 == 2) - - self.assertTrue(self.ipv6 == - ipaddr.IPv6('2001:658:22a:cafe:200::1/64')) - self.assertFalse(self.ipv6 == - ipaddr.IPv6('2001:658:22a:cafe:200::1/63')) - self.assertFalse(self.ipv6 == - ipaddr.IPv6('2001:658:22a:cafe:200::2/64')) - self.assertFalse(self.ipv6 == ipaddr.IPv4('1.2.3.4/23')) - self.assertFalse(self.ipv6 == '') - self.assertFalse(self.ipv6 == []) - self.assertFalse(self.ipv6 == 2) - - def test_not_equals(self): - self.assertFalse(self.ipv4 != ipaddr.IPv4('1.2.3.4/24')) - self.assertTrue(self.ipv4 != ipaddr.IPv4('1.2.3.4/23')) - self.assertTrue(self.ipv4 != ipaddr.IPv4('1.2.3.5/24')) - self.assertTrue(self.ipv4 != ipaddr.IPv6('::1.2.3.4/24')) - self.assertTrue(self.ipv4 != '') - self.assertTrue(self.ipv4 != []) - self.assertTrue(self.ipv4 != 2) - - self.assertFalse(self.ipv6 != - ipaddr.IPv6('2001:658:22a:cafe:200::1/64')) - self.assertTrue(self.ipv6 != - ipaddr.IPv6('2001:658:22a:cafe:200::1/63')) - self.assertTrue(self.ipv6 != - ipaddr.IPv6('2001:658:22a:cafe:200::2/64')) - self.assertTrue(self.ipv6 != ipaddr.IPv4('1.2.3.4/23')) - self.assertTrue(self.ipv6 != '') - self.assertTrue(self.ipv6 != []) - self.assertTrue(self.ipv6 != 2) - - def test_slash32_constructor(self): - self.assertEquals(str(ipaddr.IPv4('1.2.3.4/255.255.255.255')), - '1.2.3.4/32') - - def test_slash128_constructor(self): - self.assertEquals(str(ipaddr.IPv6('::1/128')), - '::1/128') - - def test_slash0_constructor(self): - self.assertEquals(str(ipaddr.IPv4('1.2.3.4/0.0.0.0')), '1.2.3.4/0') - - def test_collapsing(self): - ip1 = ipaddr.IPv4('1.1.0.0/24') - ip2 = ipaddr.IPv4('1.1.1.0/24') - ip3 = ipaddr.IPv4('1.1.2.0/24') - ip4 = ipaddr.IPv4('1.1.3.0/24') - ip5 = ipaddr.IPv4('1.1.4.0/24') - # stored in no particular order b/c we want CollapseAddr to call [].sort - ip6 = ipaddr.IPv4('1.1.0.0/22') - # check that addreses are subsumed properlly. - collapsed = ipaddr.collapse_address_list([ip1, ip2, ip3, ip4, ip5, ip6]) - self.assertEqual(collapsed, [ipaddr.IPv4('1.1.0.0/22'), - ipaddr.IPv4('1.1.4.0/24')]) - # test that two addresses are supernet'ed properlly - collapsed = ipaddr.collapse_address_list([ip1, ip2]) - self.assertEqual(collapsed, [ipaddr.IPv4('1.1.0.0/23')]) - - ip_same1 = ip_same2 = ipaddr.IPv4('1.1.1.1/32') - self.assertEqual(ipaddr.collapse_address_list([ip_same1, ip_same2]), - [ip_same1]) - ip1 = ipaddr.IPv6('::2001:1/100') - ip2 = ipaddr.IPv6('::2002:1/120') - ip3 = ipaddr.IPv6('::2001:1/96') - # test that ipv6 addresses are subsumed properly. - collapsed = ipaddr.collapse_address_list([ip1, ip2, ip3]) - self.assertEqual(collapsed, [ip3]) - - def test_network_comparison(self): - # ip1 and ip2 have the same network address - ip1 = ipaddr.IPv4('1.1.1.0/24') - ip2 = ipaddr.IPv4('1.1.1.1/24') - ip3 = ipaddr.IPv4('1.1.2.0/24') - - self.assertTrue(ip1 < ip3) - self.assertTrue(ip3 > ip2) - - self.assertEquals(ip1.compare_networks(ip2), 0) - self.assertTrue(ip1._get_networks_key() == ip2._get_networks_key()) - self.assertEquals(ip1.compare_networks(ip3), -1) - self.assertTrue(ip1._get_networks_key() < ip3._get_networks_key()) - - ip1 = ipaddr.IPv6('2001::2000/96') - ip2 = ipaddr.IPv6('2001::2001/96') - ip3 = ipaddr.IPv6('2001:ffff::2000/96') - - self.assertTrue(ip1 < ip3) - self.assertTrue(ip3 > ip2) - self.assertEquals(ip1.compare_networks(ip2), 0) - self.assertTrue(ip1._get_networks_key() == ip2._get_networks_key()) - self.assertEquals(ip1.compare_networks(ip3), -1) - self.assertTrue(ip1._get_networks_key() < ip3._get_networks_key()) - - # Test comparing different protocols - ipv6 = ipaddr.IPv6('::/0') - ipv4 = ipaddr.IPv4('0.0.0.0/0') - self.assertTrue(ipv6 > ipv4) - self.assertTrue(ipv4 < ipv6) - - # Regression test for issue6169 (ipaddr-py issue 19) - ip1 = ipaddr.IP('10.1.2.128/25') - self.assertFalse(ip1 < ip1) - self.assertFalse(ip1 > ip1) - ip2 = ipaddr.IP('10.1.3.0/24') - self.assertTrue(ip1 < ip2) - self.assertFalse(ip2 < ip1) - self.assertFalse(ip1 > ip2) - self.assertTrue(ip2 > ip1) - ip3 = ipaddr.IP('10.1.3.0/25') - self.assertTrue(ip2 < ip3) - self.assertFalse(ip3 < ip2) - self.assertFalse(ip2 > ip3) - self.assertTrue(ip3 > ip2) - - def test_embedded_ipv4(self): - ipv4_string = '192.168.0.1' - ipv4 = ipaddr.IPv4(ipv4_string) - v4compat_ipv6 = ipaddr.IPv6('::%s' % ipv4_string) - self.assertEquals(v4compat_ipv6.ip, ipv4.ip) - v4mapped_ipv6 = ipaddr.IPv6('::ffff:%s' % ipv4_string) - self.assertNotEquals(v4mapped_ipv6.ip, ipv4.ip) - self.assertRaises(ipaddr.IPv6IpValidationError, ipaddr.IPv6, - '2001:1.1.1.1:1.1.1.1') - - def test_ip_version(self): - self.assertEqual(self.ipv4.version, 4) - self.assertEqual(self.ipv6.version, 6) - - def test_packed(self): - self.assertEqual(self.ipv4.packed, '\x01\x02\x03\x04') - self.assertEqual(ipaddr.IPv4('255.254.253.252').packed, - '\xff\xfe\xfd\xfc') - self.assertEqual(self.ipv6.packed, - '\x20\x01\x06\x58\x02\x2a\xca\xfe' - + '\x02\x00\x00\x00\x00\x00\x00\x01') - self.assertEqual(ipaddr.IPv6('ffff:2:3:4:ffff::').packed, - '\xff\xff\x00\x02\x00\x03\x00\x04\xff\xff' - + '\x00' * 6) - self.assertEqual(ipaddr.IPv6('::1:0:0:0:0').packed, - '\x00' * 6 + '\x00\x01' + '\x00' * 8) - - def test_ip_str_from_prefixlen(self): - ipv4 = ipaddr.IPv4('1.2.3.4/24') - self.assertEquals(ipv4._ip_string_from_prefix(), '255.255.255.0') - self.assertEquals(ipv4._ip_string_from_prefix(28), '255.255.255.240') - - def test_ip_type(self): - ipv4 = ipaddr.IP('1.2.3.4') - ipv6 = ipaddr.IP('::1.2.3.4') - self.assertEquals(ipaddr.IPv4, type(ipv4)) - self.assertEquals(ipaddr.IPv6, type(ipv6)) - - def test_reserved_ipv4(self): - self.assertEquals(True, ipaddr.IP('224.1.1.1/31').is_multicast) - self.assertEquals(False, ipaddr.IP('240.0.0.0').is_multicast) - - self.assertEquals(True, ipaddr.IP('192.168.1.1/17').is_private) - self.assertEquals(False, ipaddr.IP('192.169.0.0').is_private) - self.assertEquals(True, ipaddr.IP('10.255.255.255').is_private) - self.assertEquals(False, ipaddr.IP('11.0.0.0').is_private) - self.assertEquals(True, ipaddr.IP('172.31.255.255').is_private) - self.assertEquals(False, ipaddr.IP('172.32.0.0').is_private) - - self.assertEquals(True, ipaddr.IP('169.254.100.200/24').is_link_local) - self.assertEquals(False, ipaddr.IP('169.255.100.200/24').is_link_local) - - self.assertEquals(True, ipaddr.IP('127.100.200.254/32').is_loopback) - self.assertEquals(True, ipaddr.IP('127.42.0.0/16').is_loopback) - self.assertEquals(False, ipaddr.IP('128.0.0.0').is_loopback) - - def test_reserved_ipv6(self): - ip = ipaddr.IP - - self.assertEquals(True, ip('ffff::').is_multicast) - self.assertEquals(True, ip(2**128-1).is_multicast) - self.assertEquals(True, ip('ff00::').is_multicast) - self.assertEquals(False, ip('fdff::').is_multicast) - - self.assertEquals(True, ip('fecf::').is_site_local) - self.assertEquals(True, ip('feff:ffff:ffff:ffff::').is_site_local) - self.assertEquals(False, ip('fbf:ffff::').is_site_local) - self.assertEquals(False, ip('ff00::').is_site_local) - - self.assertEquals(True, ip('fc00::').is_private) - self.assertEquals(True, ip('fc00:ffff:ffff:ffff::').is_private) - self.assertEquals(False, ip('fbff:ffff::').is_private) - self.assertEquals(False, ip('fe00::').is_private) - - self.assertEquals(True, ip('fea0::').is_link_local) - self.assertEquals(True, ip('febf:ffff::').is_link_local) - self.assertEquals(False, ip('fe7f:ffff::').is_link_local) - self.assertEquals(False, ip('fec0::').is_link_local) - - self.assertEquals(True, ip('0:0::0:01').is_loopback) - self.assertEquals(False, ip('::1/127').is_loopback) - self.assertEquals(False, ip('::').is_loopback) - self.assertEquals(False, ip('::2').is_loopback) - - self.assertEquals(True, ip('0::0').is_unspecified) - self.assertEquals(False, ip('::1').is_unspecified) - self.assertEquals(False, ip('::/127').is_unspecified) - - def test_addr_exclude(self): - addr1 = ipaddr.IP('10.1.1.0/24') - addr2 = ipaddr.IP('10.1.1.0/26') - addr3 = ipaddr.IP('10.2.1.0/24') - self.assertEqual(addr1.address_exclude(addr2), - [ipaddr.IP('10.1.1.64/26'), - ipaddr.IP('10.1.1.128/25')]) - self.assertRaises(ValueError, addr1.address_exclude, addr3) - - def test_hash(self): - self.assertEquals(hash(ipaddr.IP('10.1.1.0/24')), - hash(ipaddr.IP('10.1.1.0/24'))) - dummy = {} - dummy[self.ipv4] = None - dummy[self.ipv6] = None - self.assertTrue(self.ipv4 in dummy) - - def test_ipv4_prefix_from_int(self): - addr1 = ipaddr.IP('10.1.1.0/24') - addr2 = ipaddr.IPv4(addr1.ip) # clone prefix - addr2.prefixlen = addr1.prefixlen - addr3 = ipaddr.IP(123456) - - self.assertEqual(123456, addr3.ip) - self.assertRaises(ipaddr.IPv4NetmaskValidationError, - addr2._set_prefix, -1) - self.assertEqual(addr1, addr2) - self.assertEqual(str(addr1), str(addr2)) - - def test_ipv6_prefix_from_int(self): - addr1 = ipaddr.IP('2001:0658:022a:cafe:0200::1/64') - addr2 = ipaddr.IPv6(addr1.ip) # clone prefix - addr2.prefixlen = addr1.prefixlen - addr3 = ipaddr.IP(123456) - - self.assertEqual(123456, addr3.ip) - self.assertRaises(ipaddr.IPv6NetmaskValidationError, - addr2._set_prefix, -1) - self.assertEqual(addr1, addr2) - self.assertEqual(str(addr1), str(addr2)) - - def test_copy_constructor(self): - addr1 = ipaddr.IP('10.1.1.0/24') - addr2 = ipaddr.IP(addr1) - addr3 = ipaddr.IP('2001:658:22a:cafe:200::1/64') - addr4 = ipaddr.IP(addr3) - - self.assertEqual(addr1, addr2) - self.assertEqual(addr3, addr4) - - def test_compress_ipv6_address(self): - test_addresses = { - '1:2:3:4:5:6:7:8': '1:2:3:4:5:6:7:8/128', - '2001:0:0:4:0:0:0:8': '2001:0:0:4::8/128', - '2001:0:0:4:5:6:7:8': '2001::4:5:6:7:8/128', - '2001:0:3:4:5:6:7:8': '2001:0:3:4:5:6:7:8/128', - '2001:0::3:4:5:6:7:8': '2001:0:3:4:5:6:7:8/128', - '0:0:3:0:0:0:0:ffff': '0:0:3::ffff/128', - '0:0:0:4:0:0:0:ffff': '::4:0:0:0:ffff/128', - '0:0:0:0:5:0:0:ffff': '::5:0:0:ffff/128', - '1:0:0:4:0:0:7:8': '1::4:0:0:7:8/128', - '0:0:0:0:0:0:0:0': '::/128', - '0:0:0:0:0:0:0:0/0': '::/0', - '0:0:0:0:0:0:0:1': '::1/128', - '2001:0658:022a:cafe:0000:0000:0000:0000/66': - '2001:658:22a:cafe::/66', - } - for uncompressed, compressed in test_addresses.items(): - self.assertEquals(compressed, str(ipaddr.IPv6(uncompressed))) - - def test_explode_short_hand_ip_str(self): - addr1 = ipaddr.IPv6('2001::1') - self.assertEqual('2001:0000:0000:0000:0000:0000:0000:0001', - addr1._explode_shorthand_ip_string(addr1.ip_ext)) - - def test_int_representation(self): - self.assertEqual(16909060, int(self.ipv4)) - self.assertEqual(42540616829182469433547762482097946625, int(self.ipv6)) - - def test_hex_representation(self): - self.assertEqual(hex(0x1020304), hex(self.ipv4)) - - self.assertEqual(hex(0x20010658022ACAFE0200000000000001), - hex(self.ipv6)) - - -if __name__ == '__main__': - unittest.main() Modified: python/trunk/Misc/NEWS ============================================================================== --- python/trunk/Misc/NEWS (original) +++ python/trunk/Misc/NEWS Tue Jun 23 23:09:09 2009 @@ -12,6 +12,8 @@ Core and Builtins ----------------- +- Removed the ipaddr module. + - Issue #6329: Fixed iteration for memoryview objects (it was being blocked because it wasn't recognized as a sequence). From python-checkins at python.org Tue Jun 23 23:27:39 2009 From: python-checkins at python.org (raymond.hettinger) Date: Tue, 23 Jun 2009 21:27:39 -0000 Subject: [Python-checkins] r73535 - python/branches/py3k/Modules/itertoolsmodule.c Message-ID: Author: raymond.hettinger Date: Tue Jun 23 23:27:39 2009 New Revision: 73535 Log: Issue 6305: Clarify error message for large arguments to itertools.islice(). Modified: python/branches/py3k/Modules/itertoolsmodule.c Modified: python/branches/py3k/Modules/itertoolsmodule.c ============================================================================== --- python/branches/py3k/Modules/itertoolsmodule.c (original) +++ python/branches/py3k/Modules/itertoolsmodule.c Tue Jun 23 23:27:39 2009 @@ -1137,7 +1137,7 @@ if (PyErr_Occurred()) PyErr_Clear(); PyErr_SetString(PyExc_ValueError, - "Stop argument for islice() must be a non-negative integer or None."); + "Stop argument for islice() must be None or an integer: 0 <= x <= maxsize."); return NULL; } } @@ -1152,14 +1152,14 @@ if (PyErr_Occurred()) PyErr_Clear(); PyErr_SetString(PyExc_ValueError, - "Stop argument for islice() must be a non-negative integer or None."); + "Stop argument for islice() must be None or an integer: 0 <= x <= maxsize."); return NULL; } } } if (start<0 || stop<-1) { PyErr_SetString(PyExc_ValueError, - "Indices for islice() must be non-negative integers or None."); + "Indices for islice() must be None or an integer: 0 <= x <= maxsize."); return NULL; } From python-checkins at python.org Tue Jun 23 23:32:28 2009 From: python-checkins at python.org (raymond.hettinger) Date: Tue, 23 Jun 2009 21:32:28 -0000 Subject: [Python-checkins] r73536 - python/trunk/Modules/itertoolsmodule.c Message-ID: Author: raymond.hettinger Date: Tue Jun 23 23:32:28 2009 New Revision: 73536 Log: Issue 6305: Clarify error message for large arguments to itertools.islice(). Modified: python/trunk/Modules/itertoolsmodule.c Modified: python/trunk/Modules/itertoolsmodule.c ============================================================================== --- python/trunk/Modules/itertoolsmodule.c (original) +++ python/trunk/Modules/itertoolsmodule.c Tue Jun 23 23:32:28 2009 @@ -1137,7 +1137,7 @@ if (PyErr_Occurred()) PyErr_Clear(); PyErr_SetString(PyExc_ValueError, - "Stop argument for islice() must be a non-negative integer or None."); + "Stop argument for islice() must be None or an integer: 0 <= x <= maxint."); return NULL; } } @@ -1152,14 +1152,14 @@ if (PyErr_Occurred()) PyErr_Clear(); PyErr_SetString(PyExc_ValueError, - "Stop argument for islice() must be a non-negative integer or None."); + "Stop argument for islice() must be None or an integer: 0 <= x <= maxint."); return NULL; } } } if (start<0 || stop<-1) { PyErr_SetString(PyExc_ValueError, - "Indices for islice() must be non-negative integers or None."); + "Indices for islice() must be None or an integer: 0 <= x <= maxint."); return NULL; } From python-checkins at python.org Tue Jun 23 23:53:47 2009 From: python-checkins at python.org (amaury.forgeotdarc) Date: Tue, 23 Jun 2009 21:53:47 -0000 Subject: [Python-checkins] r73537 - in python/trunk: Demo/sockets/mcast.py Doc/library/socket.rst Message-ID: Author: amaury.forgeotdarc Date: Tue Jun 23 23:53:46 2009 New Revision: 73537 Log: Remove last remnants of the ipaddr package. The changes in mcast.py come from the first version of the patch for issue5379. Modified: python/trunk/Demo/sockets/mcast.py python/trunk/Doc/library/socket.rst Modified: python/trunk/Demo/sockets/mcast.py ============================================================================== --- python/trunk/Demo/sockets/mcast.py (original) +++ python/trunk/Demo/sockets/mcast.py Tue Jun 23 23:53:46 2009 @@ -14,7 +14,6 @@ MYGROUP_6 = 'ff15:7079:7468:6f6e:6465:6d6f:6d63:6173' MYTTL = 1 # Increase to reach other networks -import ipaddr import time import struct import socket @@ -28,38 +27,31 @@ else: receiver(group) -def _sockfam(ip): - """Returns the family argument of socket.socket""" - if ip.version == 4: - return socket.AF_INET - elif ip.version == 6: - return socket.AF_INET6 - else: - raise ValueError('IPv' + ip.version + ' is not supported') def sender(group): - group_ip = ipaddr.IP(group) + addrinfo = socket.getaddrinfo(group, None)[0] - s = socket.socket(_sockfam(group_ip), socket.SOCK_DGRAM) + s = socket.socket(addrinfo[0], socket.SOCK_DGRAM) # Set Time-to-live (optional) ttl_bin = struct.pack('@i', MYTTL) - if group_ip.version == 4: + if addrinfo[0] == socket.AF_INET: # IPv4 s.setsockopt(socket.IPPROTO_IP, socket.IP_MULTICAST_TTL, ttl_bin) else: s.setsockopt(socket.IPPROTO_IPV6, socket.IPV6_MULTICAST_HOPS, ttl_bin) while True: data = repr(time.time()) - s.sendto(data + '\0', (group_ip.ip_ext_full, MYPORT)) + s.sendto(data + '\0', (addrinfo[4][0], MYPORT)) time.sleep(1) def receiver(group): - group_ip = ipaddr.IP(group) + # Look up multicast group address in name server and find out IP version + addrinfo = socket.getaddrinfo(group, None)[0] # Create a socket - s = socket.socket(_sockfam(group_ip), socket.SOCK_DGRAM) + s = socket.socket(addrinfo[0], socket.SOCK_DGRAM) # Allow multiple copies of this program on one machine # (not strictly needed) @@ -68,12 +60,13 @@ # Bind it to the port s.bind(('', MYPORT)) + group_bin = socket.inet_pton(addrinfo[0], addrinfo[4][0]) # Join group - if group_ip.version == 4: # IPv4 - mreq = group_ip.packed + struct.pack('=I', socket.INADDR_ANY) + if addrinfo[0] == socket.AF_INET: # IPv4 + mreq = group_bin + struct.pack('=I', socket.INADDR_ANY) s.setsockopt(socket.IPPROTO_IP, socket.IP_ADD_MEMBERSHIP, mreq) else: - mreq = group_ip.packed + struct.pack('@I', 0) + mreq = group_bin + struct.pack('@I', 0) s.setsockopt(socket.IPPROTO_IPV6, socket.IPV6_JOIN_GROUP, mreq) # Loop, printing any data we receive Modified: python/trunk/Doc/library/socket.rst ============================================================================== --- python/trunk/Doc/library/socket.rst (original) +++ python/trunk/Doc/library/socket.rst Tue Jun 23 23:53:46 2009 @@ -440,11 +440,6 @@ Availability: Unix (maybe not all platforms). - .. seealso:: - - :func:`ipaddr.BaseIP.packed` - Platform-independent conversion to a packed, binary format. - .. versionadded:: 2.3 From python-checkins at python.org Tue Jun 23 23:59:27 2009 From: python-checkins at python.org (amaury.forgeotdarc) Date: Tue, 23 Jun 2009 21:59:27 -0000 Subject: [Python-checkins] r73538 - python/branches/py3k Message-ID: Author: amaury.forgeotdarc Date: Tue Jun 23 23:59:26 2009 New Revision: 73538 Log: Blocked revisions 73534 via svnmerge ........ r73534 | amaury.forgeotdarc | 2009-06-23 23:09:09 +0200 (mar., 23 juin 2009) | 2 lines Remove the ipaddr module per discussion on python-dev ........ Modified: python/branches/py3k/ (props changed) From python-checkins at python.org Wed Jun 24 00:01:55 2009 From: python-checkins at python.org (amaury.forgeotdarc) Date: Tue, 23 Jun 2009 22:01:55 -0000 Subject: [Python-checkins] r73539 - in python/branches/py3k: Demo/sockets/mcast.py Doc/library/socket.rst Message-ID: Author: amaury.forgeotdarc Date: Wed Jun 24 00:01:54 2009 New Revision: 73539 Log: Merged revisions 73537 via svnmerge from svn+ssh://pythondev at svn.python.org/python/trunk ........ r73537 | amaury.forgeotdarc | 2009-06-23 23:53:46 +0200 (mar., 23 juin 2009) | 3 lines Remove last remnants of the ipaddr package. The changes in mcast.py come from the first version of the patch for issue5379. ........ Modified: python/branches/py3k/ (props changed) python/branches/py3k/Demo/sockets/mcast.py python/branches/py3k/Doc/library/socket.rst Modified: python/branches/py3k/Demo/sockets/mcast.py ============================================================================== --- python/branches/py3k/Demo/sockets/mcast.py (original) +++ python/branches/py3k/Demo/sockets/mcast.py Wed Jun 24 00:01:54 2009 @@ -14,7 +14,6 @@ MYGROUP_6 = 'ff15:7079:7468:6f6e:6465:6d6f:6d63:6173' MYTTL = 1 # Increase to reach other networks -import ipaddr import time import struct import socket @@ -28,38 +27,31 @@ else: receiver(group) -def _sockfam(ip): - """Returns the family argument of socket.socket""" - if ip.version == 4: - return socket.AF_INET - elif ip.version == 6: - return socket.AF_INET6 - else: - raise ValueError('IPv' + ip.version + ' is not supported') def sender(group): - group_ip = ipaddr.IP(group) + addrinfo = socket.getaddrinfo(group, None)[0] - s = socket.socket(_sockfam(group_ip), socket.SOCK_DGRAM) + s = socket.socket(addrinfo[0], socket.SOCK_DGRAM) # Set Time-to-live (optional) ttl_bin = struct.pack('@i', MYTTL) - if group_ip.version == 4: + if addrinfo[0] == socket.AF_INET: # IPv4 s.setsockopt(socket.IPPROTO_IP, socket.IP_MULTICAST_TTL, ttl_bin) else: s.setsockopt(socket.IPPROTO_IPV6, socket.IPV6_MULTICAST_HOPS, ttl_bin) while True: data = repr(time.time()).encode('utf-8') + b'\0' - s.sendto(data, (group_ip.ip_ext_full, MYPORT)) + s.sendto(data, (addrinfo[4][0], MYPORT)) time.sleep(1) def receiver(group): - group_ip = ipaddr.IP(group) + # Look up multicast group address in name server and find out IP version + addrinfo = socket.getaddrinfo(group, None)[0] # Create a socket - s = socket.socket(_sockfam(group_ip), socket.SOCK_DGRAM) + s = socket.socket(addrinfo[0], socket.SOCK_DGRAM) # Allow multiple copies of this program on one machine # (not strictly needed) @@ -68,12 +60,13 @@ # Bind it to the port s.bind(('', MYPORT)) + group_bin = socket.inet_pton(addrinfo[0], addrinfo[4][0]) # Join group - if group_ip.version == 4: # IPv4 - mreq = group_ip.packed + struct.pack('=I', socket.INADDR_ANY) + if addrinfo[0] == socket.AF_INET: # IPv4 + mreq = group_bin + struct.pack('=I', socket.INADDR_ANY) s.setsockopt(socket.IPPROTO_IP, socket.IP_ADD_MEMBERSHIP, mreq) else: - mreq = group_ip.packed + struct.pack('@I', 0) + mreq = group_bin + struct.pack('@I', 0) s.setsockopt(socket.IPPROTO_IPV6, socket.IPV6_JOIN_GROUP, mreq) # Loop, printing any data we receive Modified: python/branches/py3k/Doc/library/socket.rst ============================================================================== --- python/branches/py3k/Doc/library/socket.rst (original) +++ python/branches/py3k/Doc/library/socket.rst Wed Jun 24 00:01:54 2009 @@ -422,11 +422,6 @@ Availability: Unix (maybe not all platforms). - .. seealso:: - - :func:`ipaddr.BaseIP.packed` - Platform-independent conversion to a packed, binary format. - .. function:: inet_ntop(address_family, packed_ip) From buildbot at python.org Wed Jun 24 00:04:07 2009 From: buildbot at python.org (buildbot at python.org) Date: Tue, 23 Jun 2009 22:04:07 +0000 Subject: [Python-checkins] buildbot failure in x86 osx.5 trunk Message-ID: The Buildbot has detected a new failure of x86 osx.5 trunk. Full details are available at: http://www.python.org/dev/buildbot/all/x86%20osx.5%20trunk/builds/1224 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: heller-x86-osx5 Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: raymond.hettinger BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_unicodedata make: *** [buildbottest] Error 1 sincerely, -The Buildbot From buildbot at python.org Wed Jun 24 00:15:11 2009 From: buildbot at python.org (buildbot at python.org) Date: Tue, 23 Jun 2009 22:15:11 +0000 Subject: [Python-checkins] buildbot failure in sparc solaris10 gcc 3.x Message-ID: The Buildbot has detected a new failure of sparc solaris10 gcc 3.x. Full details are available at: http://www.python.org/dev/buildbot/all/sparc%20solaris10%20gcc%203.x/builds/847 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: loewis-sun Build Reason: Build Source Stamp: [branch branches/py3k] HEAD Blamelist: raymond.hettinger BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_posix ====================================================================== ERROR: test_getcwd_long_pathnames (test.test_posix.PosixTester) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home2/buildbot/slave/3.x.loewis-sun/build/Lib/test/test_posix.py", line 251, in test_getcwd_long_pathnames support.rmtree(base_path) File "/home2/buildbot/slave/3.x.loewis-sun/build/Lib/test/support.py", line 181, in rmtree shutil.rmtree(path) File "/home2/buildbot/slave/3.x.loewis-sun/build/Lib/shutil.py", line 239, in rmtree onerror(os.rmdir, path, sys.exc_info()) File "/home2/buildbot/slave/3.x.loewis-sun/build/Lib/shutil.py", line 237, in rmtree os.rmdir(path) OSError: [Errno 22] Invalid argument: '/home2/buildbot/slave/3.x.loewis-sun/build/@test.getcwd/@test.getcwd' sincerely, -The Buildbot From python-checkins at python.org Wed Jun 24 00:20:04 2009 From: python-checkins at python.org (raymond.hettinger) Date: Tue, 23 Jun 2009 22:20:04 -0000 Subject: [Python-checkins] r73540 - python/trunk/Misc/developers.txt Message-ID: Author: raymond.hettinger Date: Wed Jun 24 00:20:04 2009 New Revision: 73540 Log: Add procedural note. Modified: python/trunk/Misc/developers.txt Modified: python/trunk/Misc/developers.txt ============================================================================== --- python/trunk/Misc/developers.txt (original) +++ python/trunk/Misc/developers.txt Wed Jun 24 00:20:04 2009 @@ -12,6 +12,9 @@ project admin who made the change or granted access. Feel free to revise the format to accommodate documentation needs as they arise. +Note, when giving new commit permissions, be sure to get a contributor +agreement from the committer. See http://www.python.org/psf/contrib/ +for details. When the agreement is signed, please note it in this log. Permissions History From buildbot at python.org Wed Jun 24 00:22:52 2009 From: buildbot at python.org (buildbot at python.org) Date: Tue, 23 Jun 2009 22:22:52 +0000 Subject: [Python-checkins] buildbot failure in amd64 gentoo 3.x Message-ID: The Buildbot has detected a new failure of amd64 gentoo 3.x. Full details are available at: http://www.python.org/dev/buildbot/all/amd64%20gentoo%203.x/builds/834 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: norwitz-amd64 Build Reason: Build Source Stamp: [branch branches/py3k] HEAD Blamelist: r.david.murray BUILD FAILED: failed failed slave lost sincerely, -The Buildbot From python-checkins at python.org Wed Jun 24 00:24:13 2009 From: python-checkins at python.org (raymond.hettinger) Date: Tue, 23 Jun 2009 22:24:13 -0000 Subject: [Python-checkins] r73541 - python/branches/py3k/Misc/developers.txt Message-ID: Author: raymond.hettinger Date: Wed Jun 24 00:24:13 2009 New Revision: 73541 Log: Add procedural note. Modified: python/branches/py3k/Misc/developers.txt Modified: python/branches/py3k/Misc/developers.txt ============================================================================== --- python/branches/py3k/Misc/developers.txt (original) +++ python/branches/py3k/Misc/developers.txt Wed Jun 24 00:24:13 2009 @@ -12,6 +12,9 @@ project admin who made the change or granted access. Feel free to revise the format to accommodate documentation needs as they arise. +Note, when giving new commit permissions, be sure to get a contributor +agreement from the committer. See http://www.python.org/psf/contrib/ +for details. When the agreement is signed, please note it in this log. Permissions History From buildbot at python.org Wed Jun 24 00:26:25 2009 From: buildbot at python.org (buildbot at python.org) Date: Tue, 23 Jun 2009 22:26:25 +0000 Subject: [Python-checkins] buildbot failure in x86 osx.5 3.x Message-ID: The Buildbot has detected a new failure of x86 osx.5 3.x. Full details are available at: http://www.python.org/dev/buildbot/all/x86%20osx.5%203.x/builds/1056 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: heller-x86-osx5 Build Reason: Build Source Stamp: [branch branches/py3k] HEAD Blamelist: r.david.murray BUILD FAILED: failed test Excerpt from the test logfile: make: *** [buildbottest] Abort trap sincerely, -The Buildbot From buildbot at python.org Wed Jun 24 02:49:06 2009 From: buildbot at python.org (buildbot at python.org) Date: Wed, 24 Jun 2009 00:49:06 +0000 Subject: [Python-checkins] buildbot failure in x86 XP-4 trunk Message-ID: The Buildbot has detected a new failure of x86 XP-4 trunk. Full details are available at: http://www.python.org/dev/buildbot/all/x86%20XP-4%20trunk/builds/2272 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: bolen-windows Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: amaury.forgeotdarc,raymond.hettinger BUILD FAILED: failed failed slave lost sincerely, -The Buildbot From python-checkins at python.org Wed Jun 24 04:29:58 2009 From: python-checkins at python.org (benjamin.peterson) Date: Wed, 24 Jun 2009 02:29:58 -0000 Subject: [Python-checkins] r73542 - python/branches/py3k/Modules/itertoolsmodule.c Message-ID: Author: benjamin.peterson Date: Wed Jun 24 04:29:57 2009 New Revision: 73542 Log: add sys prefix Modified: python/branches/py3k/Modules/itertoolsmodule.c Modified: python/branches/py3k/Modules/itertoolsmodule.c ============================================================================== --- python/branches/py3k/Modules/itertoolsmodule.c (original) +++ python/branches/py3k/Modules/itertoolsmodule.c Wed Jun 24 04:29:57 2009 @@ -1137,7 +1137,7 @@ if (PyErr_Occurred()) PyErr_Clear(); PyErr_SetString(PyExc_ValueError, - "Stop argument for islice() must be None or an integer: 0 <= x <= maxsize."); + "Stop argument for islice() must be None or an integer: 0 <= x <= sys.maxsize."); return NULL; } } @@ -1152,14 +1152,14 @@ if (PyErr_Occurred()) PyErr_Clear(); PyErr_SetString(PyExc_ValueError, - "Stop argument for islice() must be None or an integer: 0 <= x <= maxsize."); + "Stop argument for islice() must be None or an integer: 0 <= x <= sys.maxsize."); return NULL; } } } if (start<0 || stop<-1) { PyErr_SetString(PyExc_ValueError, - "Indices for islice() must be None or an integer: 0 <= x <= maxsize."); + "Indices for islice() must be None or an integer: 0 <= x <= sys.maxsize."); return NULL; } From buildbot at python.org Wed Jun 24 04:54:55 2009 From: buildbot at python.org (buildbot at python.org) Date: Wed, 24 Jun 2009 02:54:55 +0000 Subject: [Python-checkins] buildbot failure in amd64 gentoo 3.x Message-ID: The Buildbot has detected a new failure of amd64 gentoo 3.x. Full details are available at: http://www.python.org/dev/buildbot/all/amd64%20gentoo%203.x/builds/836 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: norwitz-amd64 Build Reason: Build Source Stamp: [branch branches/py3k] HEAD Blamelist: benjamin.peterson,raymond.hettinger BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_mailbox make: *** [buildbottest] Error 1 sincerely, -The Buildbot From buildbot at python.org Wed Jun 24 05:19:30 2009 From: buildbot at python.org (buildbot at python.org) Date: Wed, 24 Jun 2009 03:19:30 +0000 Subject: [Python-checkins] buildbot failure in sparc solaris10 gcc 3.x Message-ID: The Buildbot has detected a new failure of sparc solaris10 gcc 3.x. Full details are available at: http://www.python.org/dev/buildbot/all/sparc%20solaris10%20gcc%203.x/builds/849 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: loewis-sun Build Reason: Build Source Stamp: [branch branches/py3k] HEAD Blamelist: benjamin.peterson,raymond.hettinger BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_posix ====================================================================== ERROR: test_getcwd_long_pathnames (test.test_posix.PosixTester) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home2/buildbot/slave/3.x.loewis-sun/build/Lib/test/test_posix.py", line 251, in test_getcwd_long_pathnames support.rmtree(base_path) File "/home2/buildbot/slave/3.x.loewis-sun/build/Lib/test/support.py", line 181, in rmtree shutil.rmtree(path) File "/home2/buildbot/slave/3.x.loewis-sun/build/Lib/shutil.py", line 239, in rmtree onerror(os.rmdir, path, sys.exc_info()) File "/home2/buildbot/slave/3.x.loewis-sun/build/Lib/shutil.py", line 237, in rmtree os.rmdir(path) OSError: [Errno 22] Invalid argument: '/home2/buildbot/slave/3.x.loewis-sun/build/@test.getcwd/@test.getcwd' sincerely, -The Buildbot From buildbot at python.org Wed Jun 24 05:44:37 2009 From: buildbot at python.org (buildbot at python.org) Date: Wed, 24 Jun 2009 03:44:37 +0000 Subject: [Python-checkins] buildbot failure in x86 XP-4 3.x Message-ID: The Buildbot has detected a new failure of x86 XP-4 3.x. Full details are available at: http://www.python.org/dev/buildbot/all/x86%20XP-4%203.x/builds/703 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: bolen-windows Build Reason: Build Source Stamp: [branch branches/py3k] HEAD Blamelist: benjamin.peterson,raymond.hettinger BUILD FAILED: failed test Excerpt from the test logfile: Traceback (most recent call last): File "E:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\test\test_import.py", line 62, in test_with_extension self.fail("import from %s failed: %s" % (ext, err)) File "E:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\unittest.py", line 540, in fail raise self.failureException(msg) AssertionError: import from .PY failed: No module named @test Traceback (most recent call last): File "E:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\test\test_import.py", line 79, in testImport test_with_extension(ext) File "E:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\test\test_import.py", line 72, in test_with_extension del sys.modules[TESTFN] KeyError: '@test' 1 test failed: test_import ====================================================================== ERROR: testImport (test.test_import.ImportTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "E:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\test\test_import.py", line 60, in test_with_extension mod = __import__(TESTFN) ImportError: No module named @test Traceback (most recent call last): File "E:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\test\test_import.py", line 62, in test_with_extension self.fail("import from %s failed: %s" % (ext, err)) File "E:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\unittest.py", line 540, in fail raise self.failureException(msg) AssertionError: import from .PY failed: No module named @test Traceback (most recent call last): File "E:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\test\test_import.py", line 79, in testImport test_with_extension(ext) File "E:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\test\test_import.py", line 72, in test_with_extension del sys.modules[TESTFN] KeyError: '@test' Traceback (most recent call last): File "E:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\test\test_import.py", line 62, in test_with_extension self.fail("import from %s failed: %s" % (ext, err)) File "E:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\unittest.py", line 540, in fail raise self.failureException(msg) AssertionError: import from .PY failed: No module named @test Traceback (most recent call last): File "E:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\test\test_import.py", line 79, in testImport test_with_extension(ext) File "E:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\test\test_import.py", line 72, in test_with_extension del sys.modules[TESTFN] KeyError: '@test' sincerely, -The Buildbot From python-checkins at python.org Wed Jun 24 06:39:22 2009 From: python-checkins at python.org (martin.v.loewis) Date: Wed, 24 Jun 2009 04:39:22 -0000 Subject: [Python-checkins] r73543 - in tracker/instances/python-dev: html/issue.item.html html/user.item.html schema.py Message-ID: Author: martin.v.loewis Date: Wed Jun 24 06:39:22 2009 New Revision: 73543 Log: Issue 268: add information about contrib agreements. Modified: tracker/instances/python-dev/html/issue.item.html tracker/instances/python-dev/html/user.item.html tracker/instances/python-dev/schema.py Modified: tracker/instances/python-dev/html/issue.item.html ============================================================================== --- tracker/instances/python-dev/html/issue.item.html (original) +++ tracker/instances/python-dev/html/issue.item.html Wed Jun 24 06:39:22 2009 @@ -236,7 +236,9 @@ - (view) Author: () + i18n:name="author" /> () + * + Date: Modified: tracker/instances/python-dev/html/user.item.html ============================================================================== --- tracker/instances/python-dev/html/user.item.html (original) +++ tracker/instances/python-dev/html/user.item.html Wed Jun 24 06:39:22 2009 @@ -107,6 +107,15 @@ + + Contributor Form Received + + + on: + + + + E-mail address Author: georg.brandl Date: Wed Jun 24 08:41:19 2009 New Revision: 73544 Log: #6332: fix word dupes throughout the source. Modified: python/trunk/Doc/using/cmdline.rst python/trunk/Misc/HISTORY python/trunk/Misc/NEWS python/trunk/Misc/Porting python/trunk/Misc/cheatsheet python/trunk/Misc/developers.txt python/trunk/Misc/python.man Modified: python/trunk/Doc/using/cmdline.rst ============================================================================== --- python/trunk/Doc/using/cmdline.rst (original) +++ python/trunk/Doc/using/cmdline.rst Wed Jun 24 08:41:19 2009 @@ -328,7 +328,7 @@ warning is triggered repeatedly for the same source line, such as inside a loop). ``module`` - Print each warning only only the first time it occurs in each module. + Print each warning only the first time it occurs in each module. ``once`` Print each warning only the first time it occurs in the program. ``error`` Modified: python/trunk/Misc/HISTORY ============================================================================== --- python/trunk/Misc/HISTORY (original) +++ python/trunk/Misc/HISTORY Wed Jun 24 08:41:19 2009 @@ -16184,7 +16184,7 @@ fixes old code: demo/scripts/classfix.py. * There's a new reserved word: "access". The syntax and semantics are -still subject of of research and debate (as well as undocumented), but +still subject of research and debate (as well as undocumented), but the parser knows about the keyword so you must not use it as a variable, function, or attribute name. @@ -16434,7 +16434,7 @@ (a) define a function of one argument and call it with any number of arguments; if the actual argument count wasn't one, the function would receive a tuple containing the - arguments arguments (an empty tuple if there were none). + arguments (an empty tuple if there were none). (b) define a function of two arguments, and call it with more than two arguments; if there were more than two arguments, @@ -16756,7 +16756,7 @@ ---------------------------------------------------------- The function strdup() no longer exists (it was used only in one places -and is somewhat of a a portability problem sice some systems have the +and is somewhat of a portability problem since some systems have the same function in their C library. The functions NEW() and RENEW() allocate one spare byte to guard Modified: python/trunk/Misc/NEWS ============================================================================== --- python/trunk/Misc/NEWS (original) +++ python/trunk/Misc/NEWS Wed Jun 24 08:41:19 2009 @@ -3794,7 +3794,7 @@ - Bug #1565661: in webbrowser, split() the command for the default GNOME browser in case it is a command with args. -- Made the error message for time.strptime when the data data and +- Made the error message for time.strptime when the data and format do match be more clear. - Fix a bug in traceback.format_exception_only() that led to an error Modified: python/trunk/Misc/Porting ============================================================================== --- python/trunk/Misc/Porting (original) +++ python/trunk/Misc/Porting Wed Jun 24 08:41:19 2009 @@ -37,6 +37,6 @@ Then bang on it until it executes very simple Python statements. Now bang on it some more. At some point you'll want to use the os -module; this is the time to start thinking about what to to with the +module; this is the time to start thinking about what to do with the posix module. It's okay to simply #ifdef out those functions that cause problems; the remaining ones will be quite useful. Modified: python/trunk/Misc/cheatsheet ============================================================================== --- python/trunk/Misc/cheatsheet (original) +++ python/trunk/Misc/cheatsheet Wed Jun 24 08:41:19 2009 @@ -1145,7 +1145,7 @@ Standard methods & operators redefinition in classes Standard methods & operators map to special '__methods__' and thus may be - redefined (mostly in in user-defined classes), e.g.: + redefined (mostly in user-defined classes), e.g.: class x: def __init__(self, v): self.value = v def __add__(self, r): return self.value + r Modified: python/trunk/Misc/developers.txt ============================================================================== --- python/trunk/Misc/developers.txt (original) +++ python/trunk/Misc/developers.txt Wed Jun 24 08:41:19 2009 @@ -62,7 +62,7 @@ - Heiko Weinen was given SVN access on 29 April 2008 by MvL, for GSoC contributions. -- Jesus Cea was was given SVN access on 24 April 2008 by MvL, +- Jesus Cea was given SVN access on 24 April 2008 by MvL, for maintenance of bsddb. - Guilherme Polo was given SVN access on 24 April 2008 by MvL, Modified: python/trunk/Misc/python.man ============================================================================== --- python/trunk/Misc/python.man (original) +++ python/trunk/Misc/python.man Wed Jun 24 08:41:19 2009 @@ -204,7 +204,7 @@ messages if a warning is triggered repeatedly for the same source line, such as inside a loop); .B module -to print each warning only only the first time it occurs in each +to print each warning only the first time it occurs in each module; .B once to print each warning only the first time it occurs in the program; or From python-checkins at python.org Wed Jun 24 08:42:05 2009 From: python-checkins at python.org (georg.brandl) Date: Wed, 24 Jun 2009 06:42:05 -0000 Subject: [Python-checkins] r73545 - in python/branches/py3k: Doc/using/cmdline.rst Misc/HISTORY Misc/Porting Misc/cheatsheet Misc/developers.txt Misc/python.man Message-ID: Author: georg.brandl Date: Wed Jun 24 08:42:05 2009 New Revision: 73545 Log: Merged revisions 73544 via svnmerge from svn+ssh://pythondev at svn.python.org/python/trunk ........ r73544 | georg.brandl | 2009-06-24 06:41:19 +0000 (Mi, 24 Jun 2009) | 1 line #6332: fix word dupes throughout the source. ........ Modified: python/branches/py3k/ (props changed) python/branches/py3k/Doc/using/cmdline.rst python/branches/py3k/Misc/HISTORY python/branches/py3k/Misc/Porting python/branches/py3k/Misc/cheatsheet python/branches/py3k/Misc/developers.txt python/branches/py3k/Misc/python.man Modified: python/branches/py3k/Doc/using/cmdline.rst ============================================================================== --- python/branches/py3k/Doc/using/cmdline.rst (original) +++ python/branches/py3k/Doc/using/cmdline.rst Wed Jun 24 08:42:05 2009 @@ -286,7 +286,7 @@ warning is triggered repeatedly for the same source line, such as inside a loop). ``module`` - Print each warning only only the first time it occurs in each module. + Print each warning only the first time it occurs in each module. ``once`` Print each warning only the first time it occurs in the program. ``error`` Modified: python/branches/py3k/Misc/HISTORY ============================================================================== --- python/branches/py3k/Misc/HISTORY (original) +++ python/branches/py3k/Misc/HISTORY Wed Jun 24 08:42:05 2009 @@ -17569,7 +17569,7 @@ fixes old code: demo/scripts/classfix.py. * There's a new reserved word: "access". The syntax and semantics are -still subject of of research and debate (as well as undocumented), but +still subject of research and debate (as well as undocumented), but the parser knows about the keyword so you must not use it as a variable, function, or attribute name. @@ -17819,7 +17819,7 @@ (a) define a function of one argument and call it with any number of arguments; if the actual argument count wasn't one, the function would receive a tuple containing the - arguments arguments (an empty tuple if there were none). + arguments (an empty tuple if there were none). (b) define a function of two arguments, and call it with more than two arguments; if there were more than two arguments, @@ -18141,7 +18141,7 @@ ---------------------------------------------------------- The function strdup() no longer exists (it was used only in one places -and is somewhat of a a portability problem sice some systems have the +and is somewhat of a portability problem since some systems have the same function in their C library. The functions NEW() and RENEW() allocate one spare byte to guard Modified: python/branches/py3k/Misc/Porting ============================================================================== --- python/branches/py3k/Misc/Porting (original) +++ python/branches/py3k/Misc/Porting Wed Jun 24 08:42:05 2009 @@ -37,6 +37,6 @@ Then bang on it until it executes very simple Python statements. Now bang on it some more. At some point you'll want to use the os -module; this is the time to start thinking about what to to with the +module; this is the time to start thinking about what to do with the posix module. It's okay to simply #ifdef out those functions that cause problems; the remaining ones will be quite useful. Modified: python/branches/py3k/Misc/cheatsheet ============================================================================== --- python/branches/py3k/Misc/cheatsheet (original) +++ python/branches/py3k/Misc/cheatsheet Wed Jun 24 08:42:05 2009 @@ -1106,7 +1106,7 @@ Standard methods & operators redefinition in classes Standard methods & operators map to special '__methods__' and thus may be - redefined (mostly in in user-defined classes), e.g.: + redefined (mostly in user-defined classes), e.g.: class x: def __init__(self, v): self.value = v def __add__(self, r): return self.value + r Modified: python/branches/py3k/Misc/developers.txt ============================================================================== --- python/branches/py3k/Misc/developers.txt (original) +++ python/branches/py3k/Misc/developers.txt Wed Jun 24 08:42:05 2009 @@ -62,7 +62,7 @@ - Heiko Weinen was given SVN access on 29 April 2008 by MvL, for GSoC contributions. -- Jesus Cea was was given SVN access on 24 April 2008 by MvL, +- Jesus Cea was given SVN access on 24 April 2008 by MvL, for maintenance of bsddb. - Guilherme Polo was given SVN access on 24 April 2008 by MvL, Modified: python/branches/py3k/Misc/python.man ============================================================================== --- python/branches/py3k/Misc/python.man (original) +++ python/branches/py3k/Misc/python.man Wed Jun 24 08:42:05 2009 @@ -193,7 +193,7 @@ messages if a warning is triggered repeatedly for the same source line, such as inside a loop); .B module -to print each warning only only the first time it occurs in each +to print each warning only the first time it occurs in each module; .B once to print each warning only the first time it occurs in the program; or From buildbot at python.org Wed Jun 24 09:33:52 2009 From: buildbot at python.org (buildbot at python.org) Date: Wed, 24 Jun 2009 07:33:52 +0000 Subject: [Python-checkins] buildbot failure in x86 osx.5 3.x Message-ID: The Buildbot has detected a new failure of x86 osx.5 3.x. Full details are available at: http://www.python.org/dev/buildbot/all/x86%20osx.5%203.x/builds/1059 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: heller-x86-osx5 Build Reason: Build Source Stamp: [branch branches/py3k] HEAD Blamelist: georg.brandl BUILD FAILED: failed test Excerpt from the test logfile: sincerely, -The Buildbot From python-checkins at python.org Wed Jun 24 11:17:05 2009 From: python-checkins at python.org (kristjan.jonsson) Date: Wed, 24 Jun 2009 09:17:05 -0000 Subject: [Python-checkins] r73546 - in python/trunk: Doc/library/socketserver.rst Lib/SocketServer.py Message-ID: Author: kristjan.jonsson Date: Wed Jun 24 11:17:04 2009 New Revision: 73546 Log: http://bugs.python.org/issue6192 Move the newly introduced disable_nagle_algorithm flag into the StreamRequestHandler, where it is more appropriate. Modified: python/trunk/Doc/library/socketserver.rst python/trunk/Lib/SocketServer.py Modified: python/trunk/Doc/library/socketserver.rst ============================================================================== --- python/trunk/Doc/library/socketserver.rst (original) +++ python/trunk/Doc/library/socketserver.rst Wed Jun 24 11:17:04 2009 @@ -223,16 +223,6 @@ desired. If :meth:`handle_request` receives no incoming requests within the timeout period, the :meth:`handle_timeout` method is called. -.. attribute:: TCPServer.disable_nagle_algorithm - - If set to True, it will set the TCP_NODELAY attribute of new requests - connections. This can help alleviate problems with latency in - request-response type applications. To avoid sending many small packets, - this option should be used only when bufferning output, such as when - setting :attr:`StreamRequestHandler.wbufsize` attribute to -1. - - .. versionadded:: 2.7 - There are various server methods that can be overridden by subclasses of base server classes like :class:`TCPServer`; these methods aren't useful to external users of the server object. Modified: python/trunk/Lib/SocketServer.py ============================================================================== --- python/trunk/Lib/SocketServer.py (original) +++ python/trunk/Lib/SocketServer.py Wed Jun 24 11:17:04 2009 @@ -374,7 +374,6 @@ - socket_type - request_queue_size (only for stream sockets) - allow_reuse_address - - disable_nagle_algorithm Instance variables: @@ -392,8 +391,6 @@ allow_reuse_address = False - disable_nagle_algorithm = False - def __init__(self, server_address, RequestHandlerClass, bind_and_activate=True): """Constructor. May be extended, do not override.""" BaseServer.__init__(self, server_address, RequestHandlerClass) @@ -444,10 +441,7 @@ May be overridden. """ - request = self.socket.accept() - if self.disable_nagle_algorithm: - request[0].setsockopt(socket.IPPROTO_TCP, socket.TCP_NODELAY, True) - return request + return self.socket.accept() def close_request(self, request): """Called to clean up an individual request.""" @@ -655,8 +649,15 @@ rbufsize = -1 wbufsize = 0 + # Disable nagle algoritm for this socket, if True. + # Use only when wbufsize != 0, to avoid small packets. + disable_nagle_algorithm = False + def setup(self): self.connection = self.request + if self.disable_nagle_algorithm: + self.connection.setsockopt(socket.IPPROTO_TCP, + socket.TCP_NODELAY, True) self.rfile = self.connection.makefile('rb', self.rbufsize) self.wfile = self.connection.makefile('wb', self.wbufsize) From buildbot at python.org Wed Jun 24 20:25:46 2009 From: buildbot at python.org (buildbot at python.org) Date: Wed, 24 Jun 2009 18:25:46 +0000 Subject: [Python-checkins] buildbot failure in x86 gentoo 3.x Message-ID: The Buildbot has detected a new failure of x86 gentoo 3.x. Full details are available at: http://www.python.org/dev/buildbot/all/x86%20gentoo%203.x/builds/967 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: norwitz-x86 Build Reason: Build Source Stamp: [branch branches/py3k] HEAD Blamelist: amaury.forgeotdarc,benjamin.peterson,facundo.batista,georg.brandl,guilherme.polo,hirokazu.yamamoto,mark.dickinson,matthias.klose,nick.coghlan,r.david.murray,raymond.hettinger,steven.bethard,tarek.ziade,vinay.sajip BUILD FAILED: failed test Excerpt from the test logfile: make: *** [buildbottest] Unknown signal 32 sincerely, -The Buildbot From python-checkins at python.org Wed Jun 24 20:36:46 2009 From: python-checkins at python.org (mark.dickinson) Date: Wed, 24 Jun 2009 18:36:46 -0000 Subject: [Python-checkins] r73547 - in python/branches/py3k: Lib/test/test_builtin.py Objects/rangeobject.c Message-ID: Author: mark.dickinson Date: Wed Jun 24 20:36:46 2009 New Revision: 73547 Log: Issue #6334: Fix buggy internal length calculation in builtin range function Modified: python/branches/py3k/Lib/test/test_builtin.py python/branches/py3k/Objects/rangeobject.c Modified: python/branches/py3k/Lib/test/test_builtin.py ============================================================================== --- python/branches/py3k/Lib/test/test_builtin.py (original) +++ python/branches/py3k/Lib/test/test_builtin.py Wed Jun 24 20:36:46 2009 @@ -924,6 +924,24 @@ self.assertEqual(list(range(1, 10, 3)), [1, 4, 7]) #self.assertEqual(list(range(5, -5, -3)), [5, 2, -1, -4]) + #issue 6334: the internal stored range length was being + #computed incorrectly in some cases involving large arguments. + x = range(10**20, 10**20+10, 3) + self.assertEqual(len(x), 4) + self.assertEqual(len(list(x)), 4) + + x = range(10**20+10, 10**20, 3) + self.assertEqual(len(x), 0) + self.assertEqual(len(list(x)), 0) + + x = range(10**20, 10**20+10, -3) + self.assertEqual(len(x), 0) + self.assertEqual(len(list(x)), 0) + + x = range(10**20+10, 10**20, -3) + self.assertEqual(len(x), 4) + self.assertEqual(len(list(x)), 4) + """ XXX(nnorwitz): # Now test range() with longs self.assertEqual(list(range(-2**100)), []) Modified: python/branches/py3k/Objects/rangeobject.c ============================================================================== --- python/branches/py3k/Objects/rangeobject.c (original) +++ python/branches/py3k/Objects/rangeobject.c Wed Jun 24 20:36:46 2009 @@ -581,7 +581,6 @@ { rangeobject *r = (rangeobject *)seq; longrangeiterobject *it; - PyObject *tmp, *len; long lstart, lstop, lstep; assert(PyRange_Check(seq)); @@ -612,15 +611,9 @@ it->len = it->index = NULL; - /* Calculate length: (r->stop - r->start) / r->step */ - tmp = PyNumber_Subtract(r->stop, r->start); - if (!tmp) + it->len = range_length_obj(r); + if (!it->len) goto create_failure; - len = PyNumber_FloorDivide(tmp, r->step); - Py_DECREF(tmp); - if (!len) - goto create_failure; - it->len = len; it->index = PyLong_FromLong(0); if (!it->index) goto create_failure; From python-checkins at python.org Wed Jun 24 21:01:32 2009 From: python-checkins at python.org (mark.dickinson) Date: Wed, 24 Jun 2009 19:01:32 -0000 Subject: [Python-checkins] r73548 - python/branches/py3k/Misc/NEWS Message-ID: Author: mark.dickinson Date: Wed Jun 24 21:01:32 2009 New Revision: 73548 Log: Misc/NEWS entry for r73547 Modified: python/branches/py3k/Misc/NEWS Modified: python/branches/py3k/Misc/NEWS ============================================================================== --- python/branches/py3k/Misc/NEWS (original) +++ python/branches/py3k/Misc/NEWS Wed Jun 24 21:01:32 2009 @@ -12,6 +12,9 @@ Core and Builtins ----------------- +- Issue #6334: Fix bug in range length calculation for ranges with + large arguments. + - Issue #6329: Fixed iteration for memoryview objects (it was being blocked because it wasn't recognized as a sequence). From python-checkins at python.org Wed Jun 24 21:22:42 2009 From: python-checkins at python.org (mark.dickinson) Date: Wed, 24 Jun 2009 19:22:42 -0000 Subject: [Python-checkins] r73549 - in python/branches/release30-maint: Lib/test/test_builtin.py Misc/NEWS Objects/rangeobject.c Message-ID: Author: mark.dickinson Date: Wed Jun 24 21:22:42 2009 New Revision: 73549 Log: Merged revisions 73547-73548 via svnmerge from svn+ssh://pythondev at svn.python.org/python/branches/py3k ........ r73547 | mark.dickinson | 2009-06-24 19:36:46 +0100 (Wed, 24 Jun 2009) | 1 line Issue #6334: Fix buggy internal length calculation in builtin range function ........ r73548 | mark.dickinson | 2009-06-24 20:01:32 +0100 (Wed, 24 Jun 2009) | 1 line Misc/NEWS entry for r73547 ........ Modified: python/branches/release30-maint/ (props changed) python/branches/release30-maint/Lib/test/test_builtin.py python/branches/release30-maint/Misc/NEWS python/branches/release30-maint/Objects/rangeobject.c Modified: python/branches/release30-maint/Lib/test/test_builtin.py ============================================================================== --- python/branches/release30-maint/Lib/test/test_builtin.py (original) +++ python/branches/release30-maint/Lib/test/test_builtin.py Wed Jun 24 21:22:42 2009 @@ -924,6 +924,24 @@ self.assertEqual(list(range(1, 10, 3)), [1, 4, 7]) #self.assertEqual(list(range(5, -5, -3)), [5, 2, -1, -4]) + #issue 6334: the internal stored range length was being + #computed incorrectly in some cases involving large arguments. + x = range(10**20, 10**20+10, 3) + self.assertEqual(len(x), 4) + self.assertEqual(len(list(x)), 4) + + x = range(10**20+10, 10**20, 3) + self.assertEqual(len(x), 0) + self.assertEqual(len(list(x)), 0) + + x = range(10**20, 10**20+10, -3) + self.assertEqual(len(x), 0) + self.assertEqual(len(list(x)), 0) + + x = range(10**20+10, 10**20, -3) + self.assertEqual(len(x), 4) + self.assertEqual(len(list(x)), 4) + """ XXX(nnorwitz): # Now test range() with longs self.assertEqual(list(range(-2**100)), []) Modified: python/branches/release30-maint/Misc/NEWS ============================================================================== --- python/branches/release30-maint/Misc/NEWS (original) +++ python/branches/release30-maint/Misc/NEWS Wed Jun 24 21:22:42 2009 @@ -12,6 +12,9 @@ Core and Builtins ----------------- +- Issue #6334: Fix bug in range length calculation for ranges with + large arguments. + - Fixed SystemError triggered by "range([], 1, -1)". - Issue #5924: On Windows, a large PYTHONPATH environment variable Modified: python/branches/release30-maint/Objects/rangeobject.c ============================================================================== --- python/branches/release30-maint/Objects/rangeobject.c (original) +++ python/branches/release30-maint/Objects/rangeobject.c Wed Jun 24 21:22:42 2009 @@ -581,7 +581,6 @@ { rangeobject *r = (rangeobject *)seq; longrangeiterobject *it; - PyObject *tmp, *len; long lstart, lstop, lstep; assert(PyRange_Check(seq)); @@ -612,15 +611,9 @@ it->len = it->index = NULL; - /* Calculate length: (r->stop - r->start) / r->step */ - tmp = PyNumber_Subtract(r->stop, r->start); - if (!tmp) + it->len = range_length_obj(r); + if (!it->len) goto create_failure; - len = PyNumber_FloorDivide(tmp, r->step); - Py_DECREF(tmp); - if (!len) - goto create_failure; - it->len = len; it->index = PyLong_FromLong(0); if (!it->index) goto create_failure; From python-checkins at python.org Wed Jun 24 21:50:59 2009 From: python-checkins at python.org (tarek.ziade) Date: Wed, 24 Jun 2009 19:50:59 -0000 Subject: [Python-checkins] r73550 - peps/trunk/pep-0376.txt Message-ID: Author: tarek.ziade Date: Wed Jun 24 21:50:58 2009 New Revision: 73550 Log: renamed classes Modified: peps/trunk/pep-0376.txt Modified: peps/trunk/pep-0376.txt ============================================================================== --- peps/trunk/pep-0376.txt (original) +++ peps/trunk/pep-0376.txt Wed Jun 24 21:50:58 2009 @@ -301,11 +301,11 @@ - ``Distribution``: manages an `.egg-info` directory. - ``ZippedDistribution``: manages an `.egg-info` directory contained in a zip file. -- ``DistributionDirectory``: manages a directory that contains some `.egg-info` +- ``DistributionDir``: manages a directory that contains some `.egg-info` directories. -- ``ZippedDistributionDirectory``: manages a zipped directory that contains +- ``ZippedDistributionDir``: manages a zipped directory that contains some `.egg.info` directory. -- ``DistributionDirectories``: manages ``DistributionDirectory`` instances. +- ``DistributionDirMap``: manages ``DistributionDir`` instances. Distribution class ------------------ @@ -375,19 +375,19 @@ Other public methods and attributes are similar to ``Distribution``. -DistributionDirectory class +DistributionDir class --------------------------- -A new class called ``DistributionDirectory`` is created with a path +A new class called ``DistributionDir`` is created with a path corresponding to a directory. For each `.egg-info` directory founded in `path`, the class creates a corresponding ``Distribution``. -The class is a ``set`` of ``Distribution`` instances. ``DistributionDirectory`` +The class is a ``set`` of ``Distribution`` instances. ``DistributionDir`` provides a ``path`` attribute corresponding to the path is was created with. -``DistributionDirectory(path)`` -> instance +``DistributionDir(path)`` -> instance - Creates a ``DistributionDirectory`` instance for the given ``path``. + Creates a ``DistributionDir`` instance for the given ``path``. It also provides one extra method besides the ones from ``set``: @@ -397,53 +397,53 @@ ``Distribution.uses(path)`` on all ``Distribution`` instances. -ZippedDistributionDirectory class +ZippedDistributionDir class --------------------------------- -A ``ZippedDistributionDirectory`` is provided. It overrides the -``DistributionDirectory`` class so its methods work with a Zip file. +A ``ZippedDistributionDir`` is provided. It overrides the +``DistributionDir`` class so its methods work with a Zip file. -``ZippedDistributionDirectory(path)`` -> instance +``ZippedDistributionDir(path)`` -> instance - Creates a ``ZippedDistributionDirectory`` instance for the given ``path``. + Creates a ``ZippedDistributionDir`` instance for the given ``path``. -Other public methods and attributes are similar to ``DistributionDirectory``. +Other public methods and attributes are similar to ``DistributionDir``. -DistributionDirectories class +DistributionDirMap class ----------------------------- -A new class called ``DistributionDirectories`` is created. It's a collection of -``DistributionDirectory`` and ``ZippedDistributionDirectory`` instances. +A new class called ``DistributionDirMap`` is created. It's a collection of +``DistributionDir`` and ``ZippedDistributionDir`` instances. -``DistributionDirectories(paths=None, use_cache=True)`` -> instance +``DistributionDirMap(paths=None, use_cache=True)`` -> instance If ``paths`` is not not, it's a sequence of paths the constructor loads in the instance. The constructor also takes an optional ``use_cache`` argument. - When it's ``True``, ``DistributionDirectories`` will use a global + When it's ``True``, ``DistributionDirMap`` will use a global cache to reduce the numbers of I/O accesses and speed up the lookups. - The cache is a global mapping containing ``DistributionDirectory`` and - ``ZippedDistributionDirectory`` instances. When a - ``DistributionDirectories`` object is created, it will use the cache to + The cache is a global mapping containing ``DistributionDir`` and + ``ZippedDistributionDir`` instances. When a + ``DistributionDirMap`` object is created, it will use the cache to add an entry for each path it visits, or reuse existing entries. The cache usage can be disabled at any time with the ``use_cache`` attribute. The cache can also be emptied with the global ``purge_cache`` function. -The class is a ``dict`` where the values are ``DistributionDirectory`` -and ``ZippedDistributionDirectory`` instances and the keys are their path +The class is a ``dict`` where the values are ``DistributionDir`` +and ``ZippedDistributionDir`` instances and the keys are their path attributes. -``DistributionDirectories`` also provides the following methods besides the ones +``DistributionDirMap`` also provides the following methods besides the ones from ``dict``: - ``load(*paths)`` - Creates and adds ``DistributionDirectory`` (or - ``ZippedDistributionDirectory``) instances corresponding to ``paths``. + Creates and adds ``DistributionDir`` (or + ``ZippedDistributionDir``) instances corresponding to ``paths``. - ``reload()`` @@ -453,7 +453,7 @@ ``ZippedDistribution``) instances. Iterates over all ``Distribution`` and ``ZippedDistribution`` contained - in ``DistributionDirectory`` and ``ZippedDistributionDirectory`` instances. + in ``DistributionDir`` and ``ZippedDistributionDir`` instances. - ``get_distribution(dist_name)`` -> ``Distribution`` (or ``ZippedDistribution``) or None. @@ -496,7 +496,7 @@ Iterates over all distributions to find out which distributions uses ``path``. ``path`` can be a local absolute path or a relative '/'-separated path. -All these functions use the same global instance of ``DistributionDirectories`` +All these functions use the same global instance of ``DistributionDirMap`` to use the cache. Notice that the cache is never emptied explicitely. Example From python-checkins at python.org Wed Jun 24 23:14:38 2009 From: python-checkins at python.org (benjamin.peterson) Date: Wed, 24 Jun 2009 21:14:38 -0000 Subject: [Python-checkins] r73551 - python/branches/py3k/Objects/rangeobject.c Message-ID: Author: benjamin.peterson Date: Wed Jun 24 23:14:38 2009 New Revision: 73551 Log: fix comment Modified: python/branches/py3k/Objects/rangeobject.c Modified: python/branches/py3k/Objects/rangeobject.c ============================================================================== --- python/branches/py3k/Objects/rangeobject.c (original) +++ python/branches/py3k/Objects/rangeobject.c Wed Jun 24 23:14:38 2009 @@ -126,10 +126,9 @@ PyObject_Del(r); } -/* Return number of items in range (lo, hi, step), when arguments are - * PyInt or PyLong objects. step > 0 required. Return a value < 0 if - * & only if the true value is too large to fit in a signed long. - * Arguments MUST return 1 with either PyLong_Check() or +/* Return number of items in range (lo, hi, step), when arguments are PyLong + * objects. step > 0 required. Return a value < 0 if & only if the true + * value is too large to fit in a signed long. Arguments MUST return 1 with * PyLong_Check(). Return -1 when there is an error. */ static PyObject* @@ -137,7 +136,7 @@ { /* ------------------------------------------------------------- Algorithm is equal to that of get_len_of_range(), but it operates - on PyObjects (which are assumed to be PyLong or PyInt objects). + on PyObjects (which are assumed to be PyLong objects). ---------------------------------------------------------------*/ int cmp_result; PyObject *lo, *hi; From dickinsm at gmail.com Wed Jun 24 23:42:57 2009 From: dickinsm at gmail.com (Mark Dickinson) Date: Wed, 24 Jun 2009 22:42:57 +0100 Subject: [Python-checkins] r73551 - python/branches/py3k/Objects/rangeobject.c In-Reply-To: <4a42988c.1867f10a.3a84.6922SMTPIN_ADDED@mx.google.com> References: <4a42988c.1867f10a.3a84.6922SMTPIN_ADDED@mx.google.com> Message-ID: <5c6f2a5d0906241442o762c49v2f35b951451c160a@mail.gmail.com> On Wed, Jun 24, 2009 at 10:20 PM, benjamin.peterson wrote: > Author: benjamin.peterson > Date: Wed Jun 24 23:14:38 2009 > New Revision: 73551 > > Log: > fix comment > > Modified: > ? python/branches/py3k/Objects/rangeobject.c > > Modified: python/branches/py3k/Objects/rangeobject.c > ============================================================================== > --- python/branches/py3k/Objects/rangeobject.c ?(original) > +++ python/branches/py3k/Objects/rangeobject.c ?Wed Jun 24 23:14:38 2009 > @@ -126,10 +126,9 @@ > ? ? PyObject_Del(r); > ?} > > -/* Return number of items in range (lo, hi, step), when arguments are > - * PyInt or PyLong objects. ?step > 0 required. ?Return a value < 0 if > - * & only if the true value is too large to fit in a signed long. > - * Arguments MUST return 1 with either PyLong_Check() or > +/* Return number of items in range (lo, hi, step), when arguments are PyLong > + * objects. ?step > 0 required. ?Return a value < 0 if & only if the true > + * value is too large to fit in a signed long. ?Arguments MUST return 1 with > ?* PyLong_Check(). ?Return -1 when there is an error. > ?*/ > ?static PyObject* Thanks. I think the bit about 'step > 0 required' is wrong, too. Mark From python-checkins at python.org Thu Jun 25 00:16:42 2009 From: python-checkins at python.org (benjamin.peterson) Date: Wed, 24 Jun 2009 22:16:42 -0000 Subject: [Python-checkins] r73552 - python/branches/py3k/Objects/rangeobject.c Message-ID: Author: benjamin.peterson Date: Thu Jun 25 00:16:41 2009 New Revision: 73552 Log: this is also no longer true Modified: python/branches/py3k/Objects/rangeobject.c Modified: python/branches/py3k/Objects/rangeobject.c ============================================================================== --- python/branches/py3k/Objects/rangeobject.c (original) +++ python/branches/py3k/Objects/rangeobject.c Thu Jun 25 00:16:41 2009 @@ -127,9 +127,9 @@ } /* Return number of items in range (lo, hi, step), when arguments are PyLong - * objects. step > 0 required. Return a value < 0 if & only if the true - * value is too large to fit in a signed long. Arguments MUST return 1 with - * PyLong_Check(). Return -1 when there is an error. + * objects. Return a value < 0 if & only if the true value is too large to + * fit in a signed long. Arguments MUST return 1 with PyLong_Check(). Return + * -1 when there is an error. */ static PyObject* range_length_obj(rangeobject *r) From buildbot at python.org Thu Jun 25 01:00:26 2009 From: buildbot at python.org (buildbot at python.org) Date: Wed, 24 Jun 2009 23:00:26 +0000 Subject: [Python-checkins] buildbot failure in x86 XP-4 3.x Message-ID: The Buildbot has detected a new failure of x86 XP-4 3.x. Full details are available at: http://www.python.org/dev/buildbot/all/x86%20XP-4%203.x/builds/706 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: bolen-windows Build Reason: Build Source Stamp: [branch branches/py3k] HEAD Blamelist: benjamin.peterson,mark.dickinson BUILD FAILED: failed test Excerpt from the test logfile: Traceback (most recent call last): File "E:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\test\test_import.py", line 62, in test_with_extension self.fail("import from %s failed: %s" % (ext, err)) File "E:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\unittest.py", line 540, in fail raise self.failureException(msg) AssertionError: import from .PY failed: No module named @test Traceback (most recent call last): File "E:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\test\test_import.py", line 79, in testImport test_with_extension(ext) File "E:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\test\test_import.py", line 72, in test_with_extension del sys.modules[TESTFN] KeyError: '@test' 1 test failed: test_import ====================================================================== ERROR: testImport (test.test_import.ImportTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "E:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\test\test_import.py", line 60, in test_with_extension mod = __import__(TESTFN) ImportError: No module named @test Traceback (most recent call last): File "E:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\test\test_import.py", line 62, in test_with_extension self.fail("import from %s failed: %s" % (ext, err)) File "E:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\unittest.py", line 540, in fail raise self.failureException(msg) AssertionError: import from .PY failed: No module named @test Traceback (most recent call last): File "E:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\test\test_import.py", line 79, in testImport test_with_extension(ext) File "E:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\test\test_import.py", line 72, in test_with_extension del sys.modules[TESTFN] KeyError: '@test' Traceback (most recent call last): File "E:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\test\test_import.py", line 62, in test_with_extension self.fail("import from %s failed: %s" % (ext, err)) File "E:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\unittest.py", line 540, in fail raise self.failureException(msg) AssertionError: import from .PY failed: No module named @test Traceback (most recent call last): File "E:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\test\test_import.py", line 79, in testImport test_with_extension(ext) File "E:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\test\test_import.py", line 72, in test_with_extension del sys.modules[TESTFN] KeyError: '@test' sincerely, -The Buildbot From buildbot at python.org Thu Jun 25 01:04:29 2009 From: buildbot at python.org (buildbot at python.org) Date: Wed, 24 Jun 2009 23:04:29 +0000 Subject: [Python-checkins] buildbot failure in sparc solaris10 gcc 3.x Message-ID: The Buildbot has detected a new failure of sparc solaris10 gcc 3.x. Full details are available at: http://www.python.org/dev/buildbot/all/sparc%20solaris10%20gcc%203.x/builds/853 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: loewis-sun Build Reason: Build Source Stamp: [branch branches/py3k] HEAD Blamelist: benjamin.peterson BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_posix ====================================================================== ERROR: test_getcwd_long_pathnames (test.test_posix.PosixTester) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home2/buildbot/slave/3.x.loewis-sun/build/Lib/test/test_posix.py", line 251, in test_getcwd_long_pathnames support.rmtree(base_path) File "/home2/buildbot/slave/3.x.loewis-sun/build/Lib/test/support.py", line 181, in rmtree shutil.rmtree(path) File "/home2/buildbot/slave/3.x.loewis-sun/build/Lib/shutil.py", line 239, in rmtree onerror(os.rmdir, path, sys.exc_info()) File "/home2/buildbot/slave/3.x.loewis-sun/build/Lib/shutil.py", line 237, in rmtree os.rmdir(path) OSError: [Errno 22] Invalid argument: '/home2/buildbot/slave/3.x.loewis-sun/build/@test.getcwd/@test.getcwd' sincerely, -The Buildbot From python-checkins at python.org Thu Jun 25 11:43:46 2009 From: python-checkins at python.org (tarek.ziade) Date: Thu, 25 Jun 2009 09:43:46 -0000 Subject: [Python-checkins] r73553 - peps/trunk/pep-0376.txt Message-ID: Author: tarek.ziade Date: Thu Jun 25 11:43:46 2009 New Revision: 73553 Log: fixed english, thanks to brodie and vrialland Modified: peps/trunk/pep-0376.txt Modified: peps/trunk/pep-0376.txt ============================================================================== --- peps/trunk/pep-0376.txt (original) +++ peps/trunk/pep-0376.txt Thu Jun 25 11:43:46 2009 @@ -17,21 +17,21 @@ This PEP proposes various enhancements for Distutils: - A new format for the .egg-info structure. -- Some APIs to read the meta-data of a distribution -- A replacement PEP 262 -- An uninstall feature +- Some APIs to read the meta-data of a distribution. +- A replacement PEP 262. +- An uninstall feature. Definitions =========== A **distribution** is a collection of files, which can be Python modules, -extensions or data. A distribution is managed by a special module called +extensions, or data. A distribution is managed by a special module called `setup.py` which contains a call to the `distutils.core.setup` function. The arguments passed to that function describe the distribution, like its `name`, its `version`, and so on. -Disutils provides among other things **commands** that can be called -through the shell using the `setup.py` script. A `sdist` command is provided +Disutils provides, among other things, **commands** that can be called +through the shell using the `setup.py` script. An `sdist` command is provided for instance to create a source distribution archive. An `install` command is also provided to perform an installation of the distribution in the Python installation the script is invoked with:: @@ -42,11 +42,11 @@ Once installed, the elements are located in various places in the system, like: -- in Python's site-packages (Python modules, Python modules organized into +- In Python's site-packages (Python modules, Python modules organized into packages, Extensions, etc.) -- in Python's `include` directory. -- in Python's `bin` or `Script` directory. -- etc. +- In Python's `include` directory. +- In Python's `bin` or `Script` directory. +- Etc. Rationale ========= @@ -60,79 +60,80 @@ How distributions are installed ------------------------------- -Right now, when a distribution is installed in Python, every elements its contains -is installed in various directories. +Right now, when a distribution is installed in Python, every element it +contains is installed in various directories. -The pure Python code for instance is installed in the `purelib` directory, -which is located in the Python installation in ``lib\python2.6\site-packages`` -for example under unix-like systems or Mac OS X, and in ``Lib/site-packages`` +The pure Python code, for instance, is installed in the `purelib` directory +which is located in the Python installation at ``lib\python2.6\site-packages`` +for example under Unix-like systems or Mac OS X, and in ``Lib/site-packages`` under Windows. This is done with the Distutils `install` command, which calls various subcommands. -The `install_egg_info` subcommand is called during this process, in order to +The `install_egg_info` subcommand is called during this process in order to create an `.egg-info` file in the `purelib` directory. For example, for the `docutils` distribution, which contains one package an extra module and executable scripts, three elements will be installed in `site-packages`: -- `docutils` : the ``docutils`` pakage -- `roman.py` : an extra module used by `docutils` -- `docutils-0.5-py2.6.egg-info` : a file containing the distribution metadata +- `docutils`: The ``docutils`` package. +- `roman.py`: An extra module used by `docutils`. +- `docutils-0.5-py2.6.egg-info`: A file containing the distribution metadata as described in PEP 314 [#pep314]_. This file corresponds to the file called `PKG-INFO`, built by the `sdist` command. -Some executable scripts such as `rst2html.py` will also be added in the `bin` -directory of the Python installation. +Some executable scripts, such as `rst2html.py`, will also be added in the +`bin` directory of the Python installation. The problem is that many people use `easy_install` (from the `setuptools` project [#setuptools]_) or `pip` [#pip]_ to install their packages, and these third-party tools do not install packages in the same way that Distutils does: -- `easy_install` creates an `EGG-INFO` directory inside an `.egg` directory, +- `easy_install` creates an `EGG-INFO` directory inside an `.egg` directory and adds a `PKG-INFO` file inside this directory. The `.egg` directory - contains in that case all the elements of the distribution that are supposed - to be installed in `site-packages`, and is placed in the `site-packages` + contains all the elements of the distribution that are supposed to be + installed in `site-packages` and is placed in the `site-packages` directory. - `pip` creates an `.egg-info` directory inside the `site-packages` directory and adds a `PKG-INFO` file inside it. Elements of the distribution are then installed in various places like Distutils does. -They both add other files in the `EGG-INFO` or `.egg-info` directory, and +They both add other files in the `EGG-INFO` or `.egg-info` directory and create or modify `.pth` files. Uninstall information --------------------- -Distutils doesn't provide any `uninstall` command. If you want to uninstall +Distutils doesn't provide an `uninstall` command. If you want to uninstall a distribution, you have to be a power user and remove the various elements -that were installed. Then look over the `.pth` file to clean them if necessary. +that were installed, and then look over the `.pth` file to clean them if +necessary. -And the process differs, depending on the tools you have used to install the -distribution, and if the distribution's `setup.py` uses Distutils or +And the process differs depending on the tools you have used to install the +distribution and if the distribution's `setup.py` uses Distutils or Setuptools. Under some circumstances, you might not be able to know for sure that you have removed everything, or that you didn't break another distribution by removing a file that is shared among several distributions. -But there's common behavior: when you install a distribution, files are copied -in your system. And there's a way to keep track of theses files, so to remove -them. +But there's a common behavior: when you install a distribution, files are +copied in your system. And it's possible to keep track of these files for +later removal. What this PEP proposes ---------------------- To address those issues, this PEP proposes a few changes: -- a new `.egg-info` structure using a directory, based on one form of +- A new `.egg-info` structure using a directory, based on one form of the `EggFormats` standard from `setuptools` [#eggformats]_. -- new APIs in `pkgutil` to be able to query the information of installed +- New APIs in `pkgutil` to be able to query the information of installed distributions. -- a de-facto replacement for PEP 262 -- an uninstall function in Distutils. +- A de-facto replacement for PEP 262 +- An uninstall function in Distutils. .egg-info becomes a directory @@ -142,20 +143,20 @@ hold the `PKG-INFO` file built by the `write_pkg_file` method of the `Distribution` class in Distutils. -Notice that this change is based on the standard proposed by `EggFormats`. -Although, this standard proposes two ways to install files : +Notice that this change is based on the standard proposed by `EggFormats`, +although this standard proposes two ways to install files: -- a self-contained directory that can be zipped or left unzipped and that - contains the distribution files *and* the `.egg-info` directory. +- A self-contained directory that can be zipped or left unzipped and contains + the distribution files *and* the `.egg-info` directory. -- a distinct `.egg-info` directory located in the site-packages directory. +- A distinct `.egg-info` directory located in the site-packages directory. You may refer to the `EggFormats` documentation for more details. -This change will not impact Python itself, because `egg-info` files are not +This change will not impact Python itself because `egg-info` files are not used anywhere yet in the standard library besides Distutils. -Although it will impact the `setuptools` and `pip` projects, but given +However, it will impact the `setuptools` and `pip` projects, but given the fact that they already work with a directory that contains a `PKG-INFO` file, the change will have no deep consequences. @@ -224,7 +225,7 @@ - if the installed file is located in the directory where the `.egg-info` directory of the package is located, it will be a '/'-separated relative - path, no matter what is the target system. This makes this information + path, no matter what the target system is. This makes this information cross-compatible and allows simple installation to be relocatable. - if the installed file is located elsewhere in the system, a @@ -295,7 +296,7 @@ library a set of APIs. The best place to put these APIs seems to be `pkgutil`. The API is organized in five classes that work with directories and Zip files -(so its works with files included in Zip files, see PEP 273 for more details +(so it works with files included in Zip files, see PEP 273 for more details [#pep273]_. - ``Distribution``: manages an `.egg-info` directory. From python-checkins at python.org Thu Jun 25 16:21:06 2009 From: python-checkins at python.org (r.david.murray) Date: Thu, 25 Jun 2009 14:21:06 -0000 Subject: [Python-checkins] r73554 - python/trunk/Doc/library/turtle.rst Message-ID: Author: r.david.murray Date: Thu Jun 25 16:21:06 2009 New Revision: 73554 Log: Add a couple of missing function alias declarations to the turtle docs. Modified: python/trunk/Doc/library/turtle.rst Modified: python/trunk/Doc/library/turtle.rst ============================================================================== --- python/trunk/Doc/library/turtle.rst (original) +++ python/trunk/Doc/library/turtle.rst Thu Jun 25 16:21:06 2009 @@ -1140,6 +1140,7 @@ .. function:: shapesize(stretch_wid=None, stretch_len=None, outline=None) + turtlesize(stretch_wid=None, stretch_len=None, outline=None) :param stretch_wid: positive number :param stretch_len: positive number @@ -1332,6 +1333,7 @@ .. function:: getturtle() + getpen() Return the Turtle object itself. Only reasonable use: as a function to return the "anonymous turtle": From python-checkins at python.org Thu Jun 25 16:26:19 2009 From: python-checkins at python.org (r.david.murray) Date: Thu, 25 Jun 2009 14:26:19 -0000 Subject: [Python-checkins] r73555 - python/branches/py3k/Doc/library/turtle.rst Message-ID: Author: r.david.murray Date: Thu Jun 25 16:26:19 2009 New Revision: 73555 Log: Fix some broken/missing function:: declarations in turtle docs pointed out by Gregor Lingl in issue 6339. Modified: python/branches/py3k/Doc/library/turtle.rst Modified: python/branches/py3k/Doc/library/turtle.rst ============================================================================== --- python/branches/py3k/Doc/library/turtle.rst (original) +++ python/branches/py3k/Doc/library/turtle.rst Thu Jun 25 16:26:19 2009 @@ -1141,6 +1141,7 @@ .. function:: shapesize(stretch_wid=None, stretch_len=None, outline=None) + turtlesize(stretch_wid=None, stretch_len=None, outline=None) :param stretch_wid: positive number :param stretch_len: positive number @@ -1166,7 +1167,7 @@ (5, 5, 8) -.. function:: shearfactor(self, shear=None): +.. function:: shearfactor(shear=None) :param shear: number (optional) @@ -1274,7 +1275,7 @@ >>> (4.0, -1.0, -0.0, 2.0) -.. function:: get_shapepoly(): +.. function:: get_shapepoly() Return the current shape polygon as tuple of coordinate pairs. This can be used to define a new shape or components of a compound shape. @@ -1402,6 +1403,7 @@ .. function:: getturtle() + getpen() Return the Turtle object itself. Only reasonable use: as a function to return the "anonymous turtle": @@ -1692,7 +1694,7 @@ >>> screen.listen() -.. function:: onkeypress(fun, key=None): +.. function:: onkeypress(fun, key=None) :param fun: a function with no arguments or ``None`` :param key: a string: key (e.g. "a") or key-symbol (e.g. "space") @@ -1783,8 +1785,7 @@ >>> screen.textinput("NIM", "Name of first player:") -.. function:: numinput(self, title, prompt, - default=None, minval=None, maxval=None): +.. function:: numinput(title, prompt, default=None, minval=None, maxval=None) :param title: string :param prompt: string From python-checkins at python.org Thu Jun 25 17:03:13 2009 From: python-checkins at python.org (r.david.murray) Date: Thu, 25 Jun 2009 15:03:13 -0000 Subject: [Python-checkins] r73556 - python/branches/py3k Message-ID: Author: r.david.murray Date: Thu Jun 25 17:03:12 2009 New Revision: 73556 Log: Recorded merge of revisions 73554 via svnmerge from svn+ssh://pythondev at svn.python.org/python/trunk ........ r73554 | r.david.murray | 2009-06-25 10:21:06 -0400 (Thu, 25 Jun 2009) | 2 lines Add a couple of missing function alias declarations to the turtle docs. ........ Modified: python/branches/py3k/ (props changed) From buildbot at python.org Thu Jun 25 17:34:30 2009 From: buildbot at python.org (buildbot at python.org) Date: Thu, 25 Jun 2009 15:34:30 +0000 Subject: [Python-checkins] buildbot failure in x86 osx.5 3.x Message-ID: The Buildbot has detected a new failure of x86 osx.5 3.x. Full details are available at: http://www.python.org/dev/buildbot/all/x86%20osx.5%203.x/builds/1063 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: heller-x86-osx5 Build Reason: Build Source Stamp: [branch branches/py3k] HEAD Blamelist: r.david.murray BUILD FAILED: failed test Excerpt from the test logfile: Traceback (most recent call last): File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/test/test_robotparser.py", line 225, in testPythonOrg parser.read() File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/urllib/robotparser.py", line 56, in read f = urllib.request.urlopen(self.url) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/urllib/request.py", line 119, in urlopen return _opener.open(url, data, timeout) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/urllib/request.py", line 342, in open response = self._open(req, data) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/urllib/request.py", line 360, in _open '_open', req) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/urllib/request.py", line 320, in _call_chain result = func(*args) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/urllib/request.py", line 1063, in http_open return self.do_open(http.client.HTTPConnection, req) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/urllib/request.py", line 1048, in do_open raise URLError(err) urllib.error.URLError: 3 tests failed: test_robotparser test_urllib2net test_urllibnet ====================================================================== ERROR: testPythonOrg (test.test_robotparser.NetworkTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/urllib/request.py", line 1045, in do_open h.request(req.get_method(), req.selector, req.data, headers) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/http/client.py", line 893, in request self._send_request(method, url, body, headers) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/http/client.py", line 931, in _send_request self.endheaders(body) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/http/client.py", line 889, in endheaders self._send_output(message_body) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/http/client.py", line 743, in _send_output self.send(msg) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/http/client.py", line 691, in send self.connect() File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/http/client.py", line 675, in connect self.timeout) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/socket.py", line 292, in create_connection for res in getaddrinfo(host, port, 0, SOCK_STREAM): socket.gaierror: [Errno 8] nodename nor servname provided, or not known Traceback (most recent call last): File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/test/test_robotparser.py", line 225, in testPythonOrg parser.read() File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/urllib/robotparser.py", line 56, in read f = urllib.request.urlopen(self.url) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/urllib/request.py", line 119, in urlopen return _opener.open(url, data, timeout) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/urllib/request.py", line 342, in open response = self._open(req, data) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/urllib/request.py", line 360, in _open '_open', req) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/urllib/request.py", line 320, in _call_chain result = func(*args) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/urllib/request.py", line 1063, in http_open return self.do_open(http.client.HTTPConnection, req) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/urllib/request.py", line 1048, in do_open raise URLError(err) urllib.error.URLError: Traceback (most recent call last): File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/test/test_robotparser.py", line 225, in testPythonOrg parser.read() File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/urllib/robotparser.py", line 56, in read f = urllib.request.urlopen(self.url) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/urllib/request.py", line 119, in urlopen return _opener.open(url, data, timeout) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/urllib/request.py", line 342, in open response = self._open(req, data) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/urllib/request.py", line 360, in _open '_open', req) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/urllib/request.py", line 320, in _call_chain result = func(*args) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/urllib/request.py", line 1063, in http_open return self.do_open(http.client.HTTPConnection, req) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/urllib/request.py", line 1048, in do_open raise URLError(err) urllib.error.URLError: ====================================================================== ERROR: test_close (test.test_urllib2net.CloseSocketTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/urllib/request.py", line 1045, in do_open h.request(req.get_method(), req.selector, req.data, headers) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/http/client.py", line 893, in request self._send_request(method, url, body, headers) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/http/client.py", line 931, in _send_request self.endheaders(body) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/http/client.py", line 889, in endheaders self._send_output(message_body) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/http/client.py", line 743, in _send_output self.send(msg) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/http/client.py", line 691, in send self.connect() File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/http/client.py", line 675, in connect self.timeout) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/socket.py", line 292, in create_connection for res in getaddrinfo(host, port, 0, SOCK_STREAM): socket.gaierror: [Errno 8] nodename nor servname provided, or not known Traceback (most recent call last): File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/test/test_urllib2net.py", line 83, in test_close response = _urlopen_with_retry("http://www.python.org/") File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/test/test_urllib2net.py", line 27, in wrapped return _retry_thrice(func, exc, *args, **kwargs) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/test/test_urllib2net.py", line 23, in _retry_thrice raise last_exc File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/test/test_urllib2net.py", line 17, in _retry_thrice return func(*args, **kwargs) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/urllib/request.py", line 119, in urlopen return _opener.open(url, data, timeout) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/urllib/request.py", line 342, in open response = self._open(req, data) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/urllib/request.py", line 360, in _open '_open', req) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/urllib/request.py", line 320, in _call_chain result = func(*args) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/urllib/request.py", line 1063, in http_open return self.do_open(http.client.HTTPConnection, req) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/urllib/request.py", line 1048, in do_open raise URLError(err) urllib.error.URLError: ====================================================================== ERROR: test_ftp_basic (test.test_urllib2net.TimeoutTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/urllib/request.py", line 1227, in ftp_open host = socket.gethostbyname(host) socket.gaierror: [Errno 8] nodename nor servname provided, or not known Traceback (most recent call last): File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/test/test_urllib2net.py", line 228, in test_ftp_basic u = _urlopen_with_retry(self.FTP_HOST) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/test/test_urllib2net.py", line 27, in wrapped return _retry_thrice(func, exc, *args, **kwargs) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/test/test_urllib2net.py", line 23, in _retry_thrice raise last_exc File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/test/test_urllib2net.py", line 17, in _retry_thrice return func(*args, **kwargs) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/urllib/request.py", line 119, in urlopen return _opener.open(url, data, timeout) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/urllib/request.py", line 342, in open response = self._open(req, data) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/urllib/request.py", line 360, in _open '_open', req) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/urllib/request.py", line 320, in _call_chain result = func(*args) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/urllib/request.py", line 1229, in ftp_open raise URLError(msg) urllib.error.URLError: ====================================================================== ERROR: test_ftp_default_timeout (test.test_urllib2net.TimeoutTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/urllib/request.py", line 1227, in ftp_open host = socket.gethostbyname(host) socket.gaierror: [Errno 8] nodename nor servname provided, or not known Traceback (most recent call last): File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/test/test_urllib2net.py", line 235, in test_ftp_default_timeout u = _urlopen_with_retry(self.FTP_HOST) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/test/test_urllib2net.py", line 27, in wrapped return _retry_thrice(func, exc, *args, **kwargs) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/test/test_urllib2net.py", line 23, in _retry_thrice raise last_exc File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/test/test_urllib2net.py", line 17, in _retry_thrice return func(*args, **kwargs) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/urllib/request.py", line 119, in urlopen return _opener.open(url, data, timeout) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/urllib/request.py", line 342, in open response = self._open(req, data) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/urllib/request.py", line 360, in _open '_open', req) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/urllib/request.py", line 320, in _call_chain result = func(*args) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/urllib/request.py", line 1229, in ftp_open raise URLError(msg) urllib.error.URLError: ====================================================================== ERROR: test_ftp_no_timeout (test.test_urllib2net.TimeoutTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/urllib/request.py", line 1227, in ftp_open host = socket.gethostbyname(host) socket.gaierror: [Errno 8] nodename nor servname provided, or not known Traceback (most recent call last): File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/test/test_urllib2net.py", line 244, in test_ftp_no_timeout u = _urlopen_with_retry(self.FTP_HOST, timeout=None) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/test/test_urllib2net.py", line 27, in wrapped return _retry_thrice(func, exc, *args, **kwargs) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/test/test_urllib2net.py", line 23, in _retry_thrice raise last_exc File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/test/test_urllib2net.py", line 17, in _retry_thrice return func(*args, **kwargs) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/urllib/request.py", line 119, in urlopen return _opener.open(url, data, timeout) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/urllib/request.py", line 342, in open response = self._open(req, data) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/urllib/request.py", line 360, in _open '_open', req) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/urllib/request.py", line 320, in _call_chain result = func(*args) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/urllib/request.py", line 1229, in ftp_open raise URLError(msg) urllib.error.URLError: ====================================================================== ERROR: test_ftp_timeout (test.test_urllib2net.TimeoutTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/urllib/request.py", line 1227, in ftp_open host = socket.gethostbyname(host) socket.gaierror: [Errno 8] nodename nor servname provided, or not known Traceback (most recent call last): File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/test/test_urllib2net.py", line 250, in test_ftp_timeout u = _urlopen_with_retry(self.FTP_HOST, timeout=60) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/test/test_urllib2net.py", line 27, in wrapped return _retry_thrice(func, exc, *args, **kwargs) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/test/test_urllib2net.py", line 23, in _retry_thrice raise last_exc File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/test/test_urllib2net.py", line 17, in _retry_thrice return func(*args, **kwargs) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/urllib/request.py", line 119, in urlopen return _opener.open(url, data, timeout) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/urllib/request.py", line 342, in open response = self._open(req, data) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/urllib/request.py", line 360, in _open '_open', req) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/urllib/request.py", line 320, in _call_chain result = func(*args) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/urllib/request.py", line 1229, in ftp_open raise URLError(msg) urllib.error.URLError: ====================================================================== ERROR: test_http_basic (test.test_urllib2net.TimeoutTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/urllib/request.py", line 1045, in do_open h.request(req.get_method(), req.selector, req.data, headers) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/http/client.py", line 893, in request self._send_request(method, url, body, headers) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/http/client.py", line 931, in _send_request self.endheaders(body) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/http/client.py", line 889, in endheaders self._send_output(message_body) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/http/client.py", line 743, in _send_output self.send(msg) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/http/client.py", line 691, in send self.connect() File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/http/client.py", line 675, in connect self.timeout) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/socket.py", line 292, in create_connection for res in getaddrinfo(host, port, 0, SOCK_STREAM): socket.gaierror: [Errno 8] nodename nor servname provided, or not known Traceback (most recent call last): File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/test/test_urllib2net.py", line 199, in test_http_basic u = _urlopen_with_retry("http://www.python.org") File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/test/test_urllib2net.py", line 27, in wrapped return _retry_thrice(func, exc, *args, **kwargs) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/test/test_urllib2net.py", line 23, in _retry_thrice raise last_exc File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/test/test_urllib2net.py", line 17, in _retry_thrice return func(*args, **kwargs) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/urllib/request.py", line 119, in urlopen return _opener.open(url, data, timeout) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/urllib/request.py", line 342, in open response = self._open(req, data) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/urllib/request.py", line 360, in _open '_open', req) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/urllib/request.py", line 320, in _call_chain result = func(*args) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/urllib/request.py", line 1063, in http_open return self.do_open(http.client.HTTPConnection, req) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/urllib/request.py", line 1048, in do_open raise URLError(err) urllib.error.URLError: ====================================================================== ERROR: test_http_default_timeout (test.test_urllib2net.TimeoutTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/urllib/request.py", line 1045, in do_open h.request(req.get_method(), req.selector, req.data, headers) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/http/client.py", line 893, in request self._send_request(method, url, body, headers) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/http/client.py", line 931, in _send_request self.endheaders(body) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/http/client.py", line 889, in endheaders self._send_output(message_body) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/http/client.py", line 743, in _send_output self.send(msg) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/http/client.py", line 691, in send self.connect() File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/http/client.py", line 675, in connect self.timeout) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/socket.py", line 292, in create_connection for res in getaddrinfo(host, port, 0, SOCK_STREAM): socket.gaierror: [Errno 8] nodename nor servname provided, or not known Traceback (most recent call last): File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/test/test_urllib2net.py", line 206, in test_http_default_timeout u = _urlopen_with_retry("http://www.python.org") File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/test/test_urllib2net.py", line 27, in wrapped return _retry_thrice(func, exc, *args, **kwargs) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/test/test_urllib2net.py", line 23, in _retry_thrice raise last_exc File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/test/test_urllib2net.py", line 17, in _retry_thrice return func(*args, **kwargs) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/urllib/request.py", line 119, in urlopen return _opener.open(url, data, timeout) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/urllib/request.py", line 342, in open response = self._open(req, data) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/urllib/request.py", line 360, in _open '_open', req) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/urllib/request.py", line 320, in _call_chain result = func(*args) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/urllib/request.py", line 1063, in http_open return self.do_open(http.client.HTTPConnection, req) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/urllib/request.py", line 1048, in do_open raise URLError(err) urllib.error.URLError: ====================================================================== ERROR: test_http_no_timeout (test.test_urllib2net.TimeoutTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/urllib/request.py", line 1045, in do_open h.request(req.get_method(), req.selector, req.data, headers) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/http/client.py", line 893, in request self._send_request(method, url, body, headers) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/http/client.py", line 931, in _send_request self.endheaders(body) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/http/client.py", line 889, in endheaders self._send_output(message_body) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/http/client.py", line 743, in _send_output self.send(msg) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/http/client.py", line 691, in send self.connect() File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/http/client.py", line 675, in connect self.timeout) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/socket.py", line 292, in create_connection for res in getaddrinfo(host, port, 0, SOCK_STREAM): socket.gaierror: [Errno 8] nodename nor servname provided, or not known Traceback (most recent call last): File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/test/test_urllib2net.py", line 215, in test_http_no_timeout u = _urlopen_with_retry("http://www.python.org", timeout=None) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/test/test_urllib2net.py", line 27, in wrapped return _retry_thrice(func, exc, *args, **kwargs) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/test/test_urllib2net.py", line 23, in _retry_thrice raise last_exc File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/test/test_urllib2net.py", line 17, in _retry_thrice return func(*args, **kwargs) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/urllib/request.py", line 119, in urlopen return _opener.open(url, data, timeout) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/urllib/request.py", line 342, in open response = self._open(req, data) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/urllib/request.py", line 360, in _open '_open', req) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/urllib/request.py", line 320, in _call_chain result = func(*args) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/urllib/request.py", line 1063, in http_open return self.do_open(http.client.HTTPConnection, req) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/urllib/request.py", line 1048, in do_open raise URLError(err) urllib.error.URLError: ====================================================================== ERROR: test_http_timeout (test.test_urllib2net.TimeoutTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/urllib/request.py", line 1045, in do_open h.request(req.get_method(), req.selector, req.data, headers) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/http/client.py", line 893, in request self._send_request(method, url, body, headers) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/http/client.py", line 931, in _send_request self.endheaders(body) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/http/client.py", line 889, in endheaders self._send_output(message_body) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/http/client.py", line 743, in _send_output self.send(msg) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/http/client.py", line 691, in send self.connect() File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/http/client.py", line 675, in connect self.timeout) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/socket.py", line 292, in create_connection for res in getaddrinfo(host, port, 0, SOCK_STREAM): socket.gaierror: [Errno 8] nodename nor servname provided, or not known Traceback (most recent call last): File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/test/test_urllib2net.py", line 221, in test_http_timeout u = _urlopen_with_retry("http://www.python.org", timeout=120) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/test/test_urllib2net.py", line 27, in wrapped return _retry_thrice(func, exc, *args, **kwargs) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/test/test_urllib2net.py", line 23, in _retry_thrice raise last_exc File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/test/test_urllib2net.py", line 17, in _retry_thrice return func(*args, **kwargs) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/urllib/request.py", line 119, in urlopen return _opener.open(url, data, timeout) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/urllib/request.py", line 342, in open response = self._open(req, data) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/urllib/request.py", line 360, in _open '_open', req) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/urllib/request.py", line 320, in _call_chain result = func(*args) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/urllib/request.py", line 1063, in http_open return self.do_open(http.client.HTTPConnection, req) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/urllib/request.py", line 1048, in do_open raise URLError(err) urllib.error.URLError: ====================================================================== ERROR: testURLread (test.test_urllibnet.URLTimeoutTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/urllib/request.py", line 1045, in do_open h.request(req.get_method(), req.selector, req.data, headers) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/http/client.py", line 893, in request self._send_request(method, url, body, headers) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/http/client.py", line 931, in _send_request self.endheaders(body) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/http/client.py", line 889, in endheaders self._send_output(message_body) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/http/client.py", line 743, in _send_output self.send(msg) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/http/client.py", line 691, in send self.connect() File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/http/client.py", line 675, in connect self.timeout) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/socket.py", line 292, in create_connection for res in getaddrinfo(host, port, 0, SOCK_STREAM): socket.gaierror: [Errno 8] nodename nor servname provided, or not known Traceback (most recent call last): File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/test/test_urllibnet.py", line 39, in testURLread f = _open_with_retry(urllib.request.urlopen, "http://www.python.org/") File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/test/test_urllibnet.py", line 25, in _open_with_retry raise last_exc File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/test/test_urllibnet.py", line 19, in _open_with_retry return func(host, *args, **kwargs) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/urllib/request.py", line 119, in urlopen return _opener.open(url, data, timeout) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/urllib/request.py", line 342, in open response = self._open(req, data) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/urllib/request.py", line 360, in _open '_open', req) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/urllib/request.py", line 320, in _call_chain result = func(*args) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/urllib/request.py", line 1063, in http_open return self.do_open(http.client.HTTPConnection, req) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/urllib/request.py", line 1048, in do_open raise URLError(err) urllib.error.URLError: ====================================================================== ERROR: test_basic (test.test_urllibnet.urlopenNetworkTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/urllib/request.py", line 1045, in do_open h.request(req.get_method(), req.selector, req.data, headers) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/http/client.py", line 893, in request self._send_request(method, url, body, headers) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/http/client.py", line 931, in _send_request self.endheaders(body) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/http/client.py", line 889, in endheaders self._send_output(message_body) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/http/client.py", line 743, in _send_output self.send(msg) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/http/client.py", line 691, in send self.connect() File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/http/client.py", line 675, in connect self.timeout) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/socket.py", line 292, in create_connection for res in getaddrinfo(host, port, 0, SOCK_STREAM): socket.gaierror: [Errno 8] nodename nor servname provided, or not known Traceback (most recent call last): File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/test/test_urllibnet.py", line 62, in test_basic open_url = self.urlopen("http://www.python.org/") File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/test/test_urllibnet.py", line 58, in urlopen return _open_with_retry(urllib.request.urlopen, *args) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/test/test_urllibnet.py", line 25, in _open_with_retry raise last_exc File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/test/test_urllibnet.py", line 19, in _open_with_retry return func(host, *args, **kwargs) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/urllib/request.py", line 119, in urlopen return _opener.open(url, data, timeout) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/urllib/request.py", line 342, in open response = self._open(req, data) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/urllib/request.py", line 360, in _open '_open', req) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/urllib/request.py", line 320, in _call_chain result = func(*args) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/urllib/request.py", line 1063, in http_open return self.do_open(http.client.HTTPConnection, req) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/urllib/request.py", line 1048, in do_open raise URLError(err) urllib.error.URLError: ====================================================================== ERROR: test_fileno (test.test_urllibnet.urlopenNetworkTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/urllib/request.py", line 1045, in do_open h.request(req.get_method(), req.selector, req.data, headers) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/http/client.py", line 893, in request self._send_request(method, url, body, headers) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/http/client.py", line 931, in _send_request self.endheaders(body) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/http/client.py", line 889, in endheaders self._send_output(message_body) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/http/client.py", line 743, in _send_output self.send(msg) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/http/client.py", line 691, in send self.connect() File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/http/client.py", line 675, in connect self.timeout) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/socket.py", line 292, in create_connection for res in getaddrinfo(host, port, 0, SOCK_STREAM): socket.gaierror: [Errno 8] nodename nor servname provided, or not known Traceback (most recent call last): File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/test/test_urllibnet.py", line 121, in test_fileno open_url = self.urlopen("http://www.python.org/") File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/test/test_urllibnet.py", line 58, in urlopen return _open_with_retry(urllib.request.urlopen, *args) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/test/test_urllibnet.py", line 25, in _open_with_retry raise last_exc File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/test/test_urllibnet.py", line 19, in _open_with_retry return func(host, *args, **kwargs) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/urllib/request.py", line 119, in urlopen return _opener.open(url, data, timeout) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/urllib/request.py", line 342, in open response = self._open(req, data) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/urllib/request.py", line 360, in _open '_open', req) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/urllib/request.py", line 320, in _call_chain result = func(*args) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/urllib/request.py", line 1063, in http_open return self.do_open(http.client.HTTPConnection, req) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/urllib/request.py", line 1048, in do_open raise URLError(err) urllib.error.URLError: ====================================================================== ERROR: test_getcode (test.test_urllibnet.urlopenNetworkTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/urllib/request.py", line 1426, in open return getattr(self, name)(url) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/urllib/request.py", line 1600, in open_http return self._open_generic_http(http.client.HTTPConnection, url, data) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/urllib/request.py", line 1580, in _open_generic_http http_conn.request("GET", selector, headers=headers) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/http/client.py", line 893, in request self._send_request(method, url, body, headers) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/http/client.py", line 931, in _send_request self.endheaders(body) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/http/client.py", line 889, in endheaders self._send_output(message_body) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/http/client.py", line 743, in _send_output self.send(msg) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/http/client.py", line 691, in send self.connect() File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/http/client.py", line 675, in connect self.timeout) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/socket.py", line 292, in create_connection for res in getaddrinfo(host, port, 0, SOCK_STREAM): socket.gaierror: [Errno 8] nodename nor servname provided, or not known Traceback (most recent call last): File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/test/test_urllibnet.py", line 108, in test_getcode open_url = urllib.request.FancyURLopener().open(URL) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/urllib/request.py", line 1430, in open raise IOError('socket error', msg).with_traceback(sys.exc_info()[2]) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/urllib/request.py", line 1426, in open return getattr(self, name)(url) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/urllib/request.py", line 1600, in open_http return self._open_generic_http(http.client.HTTPConnection, url, data) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/urllib/request.py", line 1580, in _open_generic_http http_conn.request("GET", selector, headers=headers) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/http/client.py", line 893, in request self._send_request(method, url, body, headers) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/http/client.py", line 931, in _send_request self.endheaders(body) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/http/client.py", line 889, in endheaders self._send_output(message_body) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/http/client.py", line 743, in _send_output self.send(msg) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/http/client.py", line 691, in send self.connect() File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/http/client.py", line 675, in connect self.timeout) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/socket.py", line 292, in create_connection for res in getaddrinfo(host, port, 0, SOCK_STREAM): IOError: [Errno socket error] [Errno 8] nodename nor servname provided, or not known ====================================================================== ERROR: test_geturl (test.test_urllibnet.urlopenNetworkTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/urllib/request.py", line 1045, in do_open h.request(req.get_method(), req.selector, req.data, headers) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/http/client.py", line 893, in request self._send_request(method, url, body, headers) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/http/client.py", line 931, in _send_request self.endheaders(body) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/http/client.py", line 889, in endheaders self._send_output(message_body) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/http/client.py", line 743, in _send_output self.send(msg) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/http/client.py", line 691, in send self.connect() File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/http/client.py", line 675, in connect self.timeout) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/socket.py", line 292, in create_connection for res in getaddrinfo(host, port, 0, SOCK_STREAM): socket.gaierror: [Errno 8] nodename nor servname provided, or not known Traceback (most recent call last): File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/test/test_urllibnet.py", line 98, in test_geturl open_url = self.urlopen(URL) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/test/test_urllibnet.py", line 58, in urlopen return _open_with_retry(urllib.request.urlopen, *args) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/test/test_urllibnet.py", line 25, in _open_with_retry raise last_exc File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/test/test_urllibnet.py", line 19, in _open_with_retry return func(host, *args, **kwargs) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/urllib/request.py", line 119, in urlopen return _opener.open(url, data, timeout) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/urllib/request.py", line 342, in open response = self._open(req, data) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/urllib/request.py", line 360, in _open '_open', req) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/urllib/request.py", line 320, in _call_chain result = func(*args) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/urllib/request.py", line 1063, in http_open return self.do_open(http.client.HTTPConnection, req) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/urllib/request.py", line 1048, in do_open raise URLError(err) urllib.error.URLError: ====================================================================== ERROR: test_info (test.test_urllibnet.urlopenNetworkTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/urllib/request.py", line 1045, in do_open h.request(req.get_method(), req.selector, req.data, headers) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/http/client.py", line 893, in request self._send_request(method, url, body, headers) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/http/client.py", line 931, in _send_request self.endheaders(body) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/http/client.py", line 889, in endheaders self._send_output(message_body) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/http/client.py", line 743, in _send_output self.send(msg) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/http/client.py", line 691, in send self.connect() File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/http/client.py", line 675, in connect self.timeout) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/socket.py", line 292, in create_connection for res in getaddrinfo(host, port, 0, SOCK_STREAM): socket.gaierror: [Errno 8] nodename nor servname provided, or not known Traceback (most recent call last): File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/test/test_urllibnet.py", line 85, in test_info open_url = self.urlopen("http://www.python.org/") File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/test/test_urllibnet.py", line 58, in urlopen return _open_with_retry(urllib.request.urlopen, *args) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/test/test_urllibnet.py", line 25, in _open_with_retry raise last_exc File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/test/test_urllibnet.py", line 19, in _open_with_retry return func(host, *args, **kwargs) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/urllib/request.py", line 119, in urlopen return _opener.open(url, data, timeout) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/urllib/request.py", line 342, in open response = self._open(req, data) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/urllib/request.py", line 360, in _open '_open', req) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/urllib/request.py", line 320, in _call_chain result = func(*args) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/urllib/request.py", line 1063, in http_open return self.do_open(http.client.HTTPConnection, req) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/urllib/request.py", line 1048, in do_open raise URLError(err) urllib.error.URLError: ====================================================================== ERROR: test_readlines (test.test_urllibnet.urlopenNetworkTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/urllib/request.py", line 1045, in do_open h.request(req.get_method(), req.selector, req.data, headers) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/http/client.py", line 893, in request self._send_request(method, url, body, headers) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/http/client.py", line 931, in _send_request self.endheaders(body) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/http/client.py", line 889, in endheaders self._send_output(message_body) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/http/client.py", line 743, in _send_output self.send(msg) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/http/client.py", line 691, in send self.connect() File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/http/client.py", line 675, in connect self.timeout) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/socket.py", line 292, in create_connection for res in getaddrinfo(host, port, 0, SOCK_STREAM): socket.gaierror: [Errno 8] nodename nor servname provided, or not known Traceback (most recent call last): File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/test/test_urllibnet.py", line 74, in test_readlines open_url = self.urlopen("http://www.python.org/") File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/test/test_urllibnet.py", line 58, in urlopen return _open_with_retry(urllib.request.urlopen, *args) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/test/test_urllibnet.py", line 25, in _open_with_retry raise last_exc File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/test/test_urllibnet.py", line 19, in _open_with_retry return func(host, *args, **kwargs) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/urllib/request.py", line 119, in urlopen return _opener.open(url, data, timeout) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/urllib/request.py", line 342, in open response = self._open(req, data) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/urllib/request.py", line 360, in _open '_open', req) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/urllib/request.py", line 320, in _call_chain result = func(*args) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/urllib/request.py", line 1063, in http_open return self.do_open(http.client.HTTPConnection, req) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/urllib/request.py", line 1048, in do_open raise URLError(err) urllib.error.URLError: ====================================================================== ERROR: test_basic (test.test_urllibnet.urlretrieveNetworkTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/urllib/request.py", line 1426, in open return getattr(self, name)(url) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/urllib/request.py", line 1600, in open_http return self._open_generic_http(http.client.HTTPConnection, url, data) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/urllib/request.py", line 1580, in _open_generic_http http_conn.request("GET", selector, headers=headers) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/http/client.py", line 893, in request self._send_request(method, url, body, headers) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/http/client.py", line 931, in _send_request self.endheaders(body) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/http/client.py", line 889, in endheaders self._send_output(message_body) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/http/client.py", line 743, in _send_output self.send(msg) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/http/client.py", line 691, in send self.connect() File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/http/client.py", line 675, in connect self.timeout) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/socket.py", line 292, in create_connection for res in getaddrinfo(host, port, 0, SOCK_STREAM): socket.gaierror: [Errno 8] nodename nor servname provided, or not known Traceback (most recent call last): File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/test/test_urllibnet.py", line 152, in test_basic file_location,info = self.urlretrieve("http://www.python.org/") File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/test/test_urllibnet.py", line 148, in urlretrieve return _open_with_retry(urllib.request.urlretrieve, *args) ====================================================================== ERROR: test_header (test.test_urllibnet.urlretrieveNetworkTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/urllib/request.py", line 1426, in open return getattr(self, name)(url) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/urllib/request.py", line 1600, in open_http return self._open_generic_http(http.client.HTTPConnection, url, data) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/urllib/request.py", line 1580, in _open_generic_http http_conn.request("GET", selector, headers=headers) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/http/client.py", line 893, in request self._send_request(method, url, body, headers) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/http/client.py", line 931, in _send_request self.endheaders(body) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/http/client.py", line 889, in endheaders self._send_output(message_body) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/http/client.py", line 743, in _send_output self.send(msg) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/http/client.py", line 691, in send self.connect() File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/http/client.py", line 675, in connect self.timeout) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/socket.py", line 292, in create_connection for res in getaddrinfo(host, port, 0, SOCK_STREAM): socket.gaierror: [Errno 8] nodename nor servname provided, or not known Traceback (most recent call last): File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/test/test_urllibnet.py", line 178, in test_header file_location, header = self.urlretrieve("http://www.python.org/") File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/test/test_urllibnet.py", line 148, in urlretrieve return _open_with_retry(urllib.request.urlretrieve, *args) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/test/test_urllibnet.py", line 25, in _open_with_retry raise last_exc File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/test/test_urllibnet.py", line 19, in _open_with_retry return func(host, *args, **kwargs) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/urllib/request.py", line 131, in urlretrieve return _urlopener.retrieve(url, filename, reporthook, data) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/urllib/request.py", line 1458, in retrieve fp = self.open(url, data) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/urllib/request.py", line 1430, in open raise IOError('socket error', msg).with_traceback(sys.exc_info()[2]) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/urllib/request.py", line 1426, in open return getattr(self, name)(url) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/urllib/request.py", line 1600, in open_http return self._open_generic_http(http.client.HTTPConnection, url, data) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/urllib/request.py", line 1580, in _open_generic_http http_conn.request("GET", selector, headers=headers) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/http/client.py", line 893, in request self._send_request(method, url, body, headers) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/http/client.py", line 931, in _send_request self.endheaders(body) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/http/client.py", line 889, in endheaders self._send_output(message_body) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/http/client.py", line 743, in _send_output self.send(msg) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/http/client.py", line 691, in send self.connect() File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/http/client.py", line 675, in connect self.timeout) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/socket.py", line 292, in create_connection for res in getaddrinfo(host, port, 0, SOCK_STREAM): IOError: [Errno socket error] [Errno 8] nodename nor servname provided, or not known ====================================================================== ERROR: test_specified_path (test.test_urllibnet.urlretrieveNetworkTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/urllib/request.py", line 1426, in open return getattr(self, name)(url) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/urllib/request.py", line 1600, in open_http return self._open_generic_http(http.client.HTTPConnection, url, data) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/urllib/request.py", line 1580, in _open_generic_http http_conn.request("GET", selector, headers=headers) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/http/client.py", line 893, in request self._send_request(method, url, body, headers) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/http/client.py", line 931, in _send_request self.endheaders(body) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/http/client.py", line 889, in endheaders self._send_output(message_body) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/http/client.py", line 743, in _send_output self.send(msg) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/http/client.py", line 691, in send self.connect() File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/http/client.py", line 675, in connect self.timeout) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/socket.py", line 292, in create_connection for res in getaddrinfo(host, port, 0, SOCK_STREAM): socket.gaierror: [Errno 8] nodename nor servname provided, or not known Traceback (most recent call last): File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/test/test_urllibnet.py", line 166, in test_specified_path support.TESTFN) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/test/test_urllibnet.py", line 148, in urlretrieve return _open_with_retry(urllib.request.urlretrieve, *args) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/test/test_urllibnet.py", line 25, in _open_with_retry raise last_exc File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/test/test_urllibnet.py", line 19, in _open_with_retry return func(host, *args, **kwargs) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/urllib/request.py", line 131, in urlretrieve return _urlopener.retrieve(url, filename, reporthook, data) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/urllib/request.py", line 1458, in retrieve fp = self.open(url, data) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/urllib/request.py", line 1430, in open raise IOError('socket error', msg).with_traceback(sys.exc_info()[2]) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/urllib/request.py", line 1426, in open return getattr(self, name)(url) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/urllib/request.py", line 1600, in open_http return self._open_generic_http(http.client.HTTPConnection, url, data) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/urllib/request.py", line 1580, in _open_generic_http http_conn.request("GET", selector, headers=headers) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/http/client.py", line 893, in request self._send_request(method, url, body, headers) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/http/client.py", line 931, in _send_request self.endheaders(body) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/http/client.py", line 889, in endheaders self._send_output(message_body) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/http/client.py", line 743, in _send_output self.send(msg) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/http/client.py", line 691, in send self.connect() File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/http/client.py", line 675, in connect self.timeout) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/socket.py", line 292, in create_connection for res in getaddrinfo(host, port, 0, SOCK_STREAM): IOError: [Errno socket error] [Errno 8] nodename nor servname provided, or not known make: *** [buildbottest] Error 1 sincerely, -The Buildbot From python-checkins at python.org Thu Jun 25 19:29:39 2009 From: python-checkins at python.org (r.david.murray) Date: Thu, 25 Jun 2009 17:29:39 -0000 Subject: [Python-checkins] r73557 - python/trunk/Demo/turtle/tdemo_chaos.py Message-ID: Author: r.david.murray Date: Thu Jun 25 19:29:39 2009 New Revision: 73557 Log: Issue 6340: update by Gregor Lingl of his tdemo_chaos demo program. Functionally equivalent, clearer code, English comments. Modified: python/trunk/Demo/turtle/tdemo_chaos.py Modified: python/trunk/Demo/turtle/tdemo_chaos.py ============================================================================== --- python/trunk/Demo/turtle/tdemo_chaos.py (original) +++ python/trunk/Demo/turtle/tdemo_chaos.py Thu Jun 25 19:29:39 2009 @@ -1,11 +1,13 @@ -# Datei: chaosplotter.py -# Autor: Gregor Lingl -# Datum: 31. 5. 2008 +# File: tdemo_chaos.py +# Author: Gregor Lingl +# Date: 2009-06-24 -# Ein einfaches Programm zur Demonstration von "chaotischem Verhalten". +# A demonstration of chaos from turtle import * +N = 80 + def f(x): return 3.9*x*(1-x) @@ -15,47 +17,41 @@ def h(x): return 3.9*x-3.9*x*x -def coosys(): - penup() - goto(-1,0) - pendown() - goto(n+1,0) - penup() - goto(0, -0.1) +def jumpto(x, y): + penup(); goto(x,y) + +def line(x1, y1, x2, y2): + jumpto(x1, y1) pendown() - goto(-0.1, 1.1) + goto(x2, y2) -def plot(fun, start, farbe): +def coosys(): + line(-1, 0, N+1, 0) + line(0, -0.1, 0, 1.1) + +def plot(fun, start, colour): + pencolor(colour) x = start - pencolor(farbe) - penup() - goto(0, x) + jumpto(0, x) pendown() dot(5) - for i in range(n): + for i in range(N): x=fun(x) goto(i+1,x) dot(5) def main(): - global n - n = 80 - ox=-250.0 - oy=-150.0 - ex= -2.0*ox / n - ey=300.0 - reset() - setworldcoordinates(-1.0,-0.1, n+1, 1.1) + setworldcoordinates(-1.0,-0.1, N+1, 1.1) speed(0) hideturtle() coosys() plot(f, 0.35, "blue") plot(g, 0.35, "green") plot(h, 0.35, "red") + # Now zoom in: for s in range(100): - setworldcoordinates(0.5*s,-0.1, n+1, 1.1) - + setworldcoordinates(0.5*s,-0.1, N+1, 1.1) return "Done!" if __name__ == "__main__": From python-checkins at python.org Thu Jun 25 19:32:06 2009 From: python-checkins at python.org (r.david.murray) Date: Thu, 25 Jun 2009 17:32:06 -0000 Subject: [Python-checkins] r73558 - in python/branches/py3k: Demo/turtle/tdemo_chaos.py Message-ID: Author: r.david.murray Date: Thu Jun 25 19:32:06 2009 New Revision: 73558 Log: Merged revisions 73557 via svnmerge from svn+ssh://pythondev at svn.python.org/python/trunk ........ r73557 | r.david.murray | 2009-06-25 13:29:39 -0400 (Thu, 25 Jun 2009) | 3 lines Issue 6340: update by Gregor Lingl of his tdemo_chaos demo program. Functionally equivalent, clearer code, English comments. ........ Modified: python/branches/py3k/ (props changed) python/branches/py3k/Demo/turtle/tdemo_chaos.py Modified: python/branches/py3k/Demo/turtle/tdemo_chaos.py ============================================================================== --- python/branches/py3k/Demo/turtle/tdemo_chaos.py (original) +++ python/branches/py3k/Demo/turtle/tdemo_chaos.py Thu Jun 25 19:32:06 2009 @@ -1,11 +1,13 @@ -# Datei: chaosplotter.py -# Autor: Gregor Lingl -# Datum: 31. 5. 2008 +# File: tdemo_chaos.py +# Author: Gregor Lingl +# Date: 2009-06-24 -# Ein einfaches Programm zur Demonstration von "chaotischem Verhalten". +# A demonstration of chaos from turtle import * +N = 80 + def f(x): return 3.9*x*(1-x) @@ -15,47 +17,41 @@ def h(x): return 3.9*x-3.9*x*x -def coosys(): - penup() - goto(-1,0) - pendown() - goto(n+1,0) - penup() - goto(0, -0.1) +def jumpto(x, y): + penup(); goto(x,y) + +def line(x1, y1, x2, y2): + jumpto(x1, y1) pendown() - goto(-0.1, 1.1) + goto(x2, y2) -def plot(fun, start, farbe): +def coosys(): + line(-1, 0, N+1, 0) + line(0, -0.1, 0, 1.1) + +def plot(fun, start, colour): + pencolor(colour) x = start - pencolor(farbe) - penup() - goto(0, x) + jumpto(0, x) pendown() dot(5) - for i in range(n): + for i in range(N): x=fun(x) goto(i+1,x) dot(5) def main(): - global n - n = 80 - ox=-250.0 - oy=-150.0 - ex= -2.0*ox / n - ey=300.0 - reset() - setworldcoordinates(-1.0,-0.1, n+1, 1.1) + setworldcoordinates(-1.0,-0.1, N+1, 1.1) speed(0) hideturtle() coosys() plot(f, 0.35, "blue") plot(g, 0.35, "green") plot(h, 0.35, "red") + # Now zoom in: for s in range(100): - setworldcoordinates(0.5*s,-0.1, n+1, 1.1) - + setworldcoordinates(0.5*s,-0.1, N+1, 1.1) return "Done!" if __name__ == "__main__": From python-checkins at python.org Thu Jun 25 19:36:05 2009 From: python-checkins at python.org (r.david.murray) Date: Thu, 25 Jun 2009 17:36:05 -0000 Subject: [Python-checkins] r73559 - in python/branches/release26-maint: Demo/turtle/tdemo_chaos.py Message-ID: Author: r.david.murray Date: Thu Jun 25 19:36:04 2009 New Revision: 73559 Log: Merged revisions 73557 via svnmerge from svn+ssh://pythondev at svn.python.org/python/trunk ........ r73557 | r.david.murray | 2009-06-25 13:29:39 -0400 (Thu, 25 Jun 2009) | 3 lines Issue 6340: update by Gregor Lingl of his tdemo_chaos demo program. Functionally equivalent, clearer code, English comments. ........ Modified: python/branches/release26-maint/ (props changed) python/branches/release26-maint/Demo/turtle/tdemo_chaos.py Modified: python/branches/release26-maint/Demo/turtle/tdemo_chaos.py ============================================================================== --- python/branches/release26-maint/Demo/turtle/tdemo_chaos.py (original) +++ python/branches/release26-maint/Demo/turtle/tdemo_chaos.py Thu Jun 25 19:36:04 2009 @@ -1,11 +1,13 @@ -# Datei: chaosplotter.py -# Autor: Gregor Lingl -# Datum: 31. 5. 2008 +# File: tdemo_chaos.py +# Author: Gregor Lingl +# Date: 2009-06-24 -# Ein einfaches Programm zur Demonstration von "chaotischem Verhalten". +# A demonstration of chaos from turtle import * +N = 80 + def f(x): return 3.9*x*(1-x) @@ -15,47 +17,41 @@ def h(x): return 3.9*x-3.9*x*x -def coosys(): - penup() - goto(-1,0) - pendown() - goto(n+1,0) - penup() - goto(0, -0.1) +def jumpto(x, y): + penup(); goto(x,y) + +def line(x1, y1, x2, y2): + jumpto(x1, y1) pendown() - goto(-0.1, 1.1) + goto(x2, y2) -def plot(fun, start, farbe): +def coosys(): + line(-1, 0, N+1, 0) + line(0, -0.1, 0, 1.1) + +def plot(fun, start, colour): + pencolor(colour) x = start - pencolor(farbe) - penup() - goto(0, x) + jumpto(0, x) pendown() dot(5) - for i in range(n): + for i in range(N): x=fun(x) goto(i+1,x) dot(5) def main(): - global n - n = 80 - ox=-250.0 - oy=-150.0 - ex= -2.0*ox / n - ey=300.0 - reset() - setworldcoordinates(-1.0,-0.1, n+1, 1.1) + setworldcoordinates(-1.0,-0.1, N+1, 1.1) speed(0) hideturtle() coosys() plot(f, 0.35, "blue") plot(g, 0.35, "green") plot(h, 0.35, "red") + # Now zoom in: for s in range(100): - setworldcoordinates(0.5*s,-0.1, n+1, 1.1) - + setworldcoordinates(0.5*s,-0.1, N+1, 1.1) return "Done!" if __name__ == "__main__": From python-checkins at python.org Thu Jun 25 19:37:57 2009 From: python-checkins at python.org (r.david.murray) Date: Thu, 25 Jun 2009 17:37:57 -0000 Subject: [Python-checkins] r73560 - in python/branches/py3k: Doc/library/functions.rst Message-ID: Author: r.david.murray Date: Thu Jun 25 19:37:57 2009 New Revision: 73560 Log: Merged revisions 73511 via svnmerge from svn+ssh://pythondev at svn.python.org/python/trunk ........ r73511 | r.david.murray | 2009-06-22 18:11:04 -0400 (Mon, 22 Jun 2009) | 2 lines Improve English phrasing. ........ Modified: python/branches/py3k/ (props changed) python/branches/py3k/Doc/library/functions.rst Modified: python/branches/py3k/Doc/library/functions.rst ============================================================================== --- python/branches/py3k/Doc/library/functions.rst (original) +++ python/branches/py3k/Doc/library/functions.rst Thu Jun 25 19:37:57 2009 @@ -154,7 +154,7 @@ ``'exec'`` if *source* consists of a sequence of statements, ``'eval'`` if it consists of a single expression, or ``'single'`` if it consists of a single interactive statement (in the latter case, expression statements that - evaluate to something else than ``None`` will be printed). + evaluate to something other than ``None`` will be printed). The optional arguments *flags* and *dont_inherit* control which future statements (see :pep:`236`) affect the compilation of *source*. If neither From python-checkins at python.org Thu Jun 25 19:40:52 2009 From: python-checkins at python.org (r.david.murray) Date: Thu, 25 Jun 2009 17:40:52 -0000 Subject: [Python-checkins] r73561 - in python/branches/release26-maint: Doc/library/functions.rst Doc/library/os.rst Doc/library/subprocess.rst Doc/library/turtle.rst Message-ID: Author: r.david.murray Date: Thu Jun 25 19:40:52 2009 New Revision: 73561 Log: Merged revisions 73026,73313,73511,73554 via svnmerge from svn+ssh://pythondev at svn.python.org/python/trunk ........ r73026 | r.david.murray | 2009-05-29 15:30:27 -0400 (Fri, 29 May 2009) | 3 lines Issue 6141: document that the first item of args is still the command name even when executable is specified. ........ r73313 | r.david.murray | 2009-06-08 20:44:22 -0400 (Mon, 08 Jun 2009) | 4 lines Issue 2947: document how return code handling translates from os.popen to subprocess. Also fixes reference link in the os.spawn documentation. ........ r73511 | r.david.murray | 2009-06-22 18:11:04 -0400 (Mon, 22 Jun 2009) | 2 lines Improve English phrasing. ........ r73554 | r.david.murray | 2009-06-25 10:21:06 -0400 (Thu, 25 Jun 2009) | 2 lines Add a couple of missing function alias declarations to the turtle docs. ........ Modified: python/branches/release26-maint/ (props changed) python/branches/release26-maint/Doc/library/functions.rst python/branches/release26-maint/Doc/library/os.rst python/branches/release26-maint/Doc/library/subprocess.rst python/branches/release26-maint/Doc/library/turtle.rst Modified: python/branches/release26-maint/Doc/library/functions.rst ============================================================================== --- python/branches/release26-maint/Doc/library/functions.rst (original) +++ python/branches/release26-maint/Doc/library/functions.rst Thu Jun 25 19:40:52 2009 @@ -151,7 +151,7 @@ ``'exec'`` if *source* consists of a sequence of statements, ``'eval'`` if it consists of a single expression, or ``'single'`` if it consists of a single interactive statement (in the latter case, expression statements that - evaluate to something else than ``None`` will be printed). + evaluate to something other than ``None`` will be printed). The optional arguments *flags* and *dont_inherit* control which future statements (see :pep:`236`) affect the compilation of *source*. If neither Modified: python/branches/release26-maint/Doc/library/os.rst ============================================================================== --- python/branches/release26-maint/Doc/library/os.rst (original) +++ python/branches/release26-maint/Doc/library/os.rst Thu Jun 25 19:40:52 2009 @@ -1710,8 +1710,8 @@ (Note that the :mod:`subprocess` module provides more powerful facilities for spawning new processes and retrieving their results; using that module is - preferable to using these functions. Check specially the *Replacing Older - Functions with the subprocess Module* section in that documentation page.) + preferable to using these functions. Check especially the + :ref:`subprocess-replacements` section.) If *mode* is :const:`P_NOWAIT`, this function returns the process id of the new process; if *mode* is :const:`P_WAIT`, returns the process's exit code if it Modified: python/branches/release26-maint/Doc/library/subprocess.rst ============================================================================== --- python/branches/release26-maint/Doc/library/subprocess.rst (original) +++ python/branches/release26-maint/Doc/library/subprocess.rst Thu Jun 25 19:40:52 2009 @@ -39,9 +39,12 @@ Arguments are: *args* should be a string, or a sequence of program arguments. The program - to execute is normally the first item in the args sequence or the string if a - string is given, but can be explicitly set by using the *executable* - argument. + to execute is normally the first item in the args sequence or the string if + a string is given, but can be explicitly set by using the *executable* + argument. When *executable* is given, the first item in the args sequence + is still treated by most programs as the command name, which can then be + different from the actual executable name. On Unix, it becomes the display + name for the executing program in utilities such as :program:`ps`. On Unix, with *shell=False* (default): In this case, the Popen class uses :meth:`os.execvp` to execute the child program. *args* should normally be a @@ -354,8 +357,8 @@ output = p2.communicate()[0] -Replacing os.system() -^^^^^^^^^^^^^^^^^^^^^ +Replacing :func:`os.system` +^^^^^^^^^^^^^^^^^^^^^^^^^^^ :: @@ -382,8 +385,8 @@ print >>sys.stderr, "Execution failed:", e -Replacing the os.spawn family -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +Replacing the :func:`os.spawn ` family +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ P_NOWAIT example:: @@ -410,8 +413,8 @@ Popen(["/bin/mycmd", "myarg"], env={"PATH": "/usr/bin"}) -Replacing os.popen, os.popen2, os.popen3 -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +Replacing :func:`os.popen`, :func:`os.popen2`, :func:`os.popen3` +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ :: @@ -453,9 +456,23 @@ stdin=PIPE, stdout=PIPE, stderr=STDOUT, close_fds=True) (child_stdin, child_stdout_and_stderr) = (p.stdin, p.stdout) +Return code handling translates as follows:: + + pipe = os.popen(cmd, 'w') + ... + rc = pipe.close() + if rc != None and rc % 256: + print "There were some errors" + ==> + process = Popen(cmd, 'w', stdin=PIPE) + ... + process.stdin.close() + if process.wait() != 0: + print "There were some errors" + -Replacing functions from the popen2 module -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +Replacing functions from the :mod:`popen2` module +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ .. note:: Modified: python/branches/release26-maint/Doc/library/turtle.rst ============================================================================== --- python/branches/release26-maint/Doc/library/turtle.rst (original) +++ python/branches/release26-maint/Doc/library/turtle.rst Thu Jun 25 19:40:52 2009 @@ -1140,6 +1140,7 @@ .. function:: shapesize(stretch_wid=None, stretch_len=None, outline=None) + turtlesize(stretch_wid=None, stretch_len=None, outline=None) :param stretch_wid: positive number :param stretch_len: positive number @@ -1332,6 +1333,7 @@ .. function:: getturtle() + getpen() Return the Turtle object itself. Only reasonable use: as a function to return the "anonymous turtle": From buildbot at python.org Thu Jun 25 20:17:53 2009 From: buildbot at python.org (buildbot at python.org) Date: Thu, 25 Jun 2009 18:17:53 +0000 Subject: [Python-checkins] buildbot failure in sparc solaris10 gcc 3.x Message-ID: The Buildbot has detected a new failure of sparc solaris10 gcc 3.x. Full details are available at: http://www.python.org/dev/buildbot/all/sparc%20solaris10%20gcc%203.x/builds/855 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: loewis-sun Build Reason: Build Source Stamp: [branch branches/py3k] HEAD Blamelist: r.david.murray BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_posix ====================================================================== ERROR: test_getcwd_long_pathnames (test.test_posix.PosixTester) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home2/buildbot/slave/3.x.loewis-sun/build/Lib/test/test_posix.py", line 251, in test_getcwd_long_pathnames support.rmtree(base_path) File "/home2/buildbot/slave/3.x.loewis-sun/build/Lib/test/support.py", line 181, in rmtree shutil.rmtree(path) File "/home2/buildbot/slave/3.x.loewis-sun/build/Lib/shutil.py", line 239, in rmtree onerror(os.rmdir, path, sys.exc_info()) File "/home2/buildbot/slave/3.x.loewis-sun/build/Lib/shutil.py", line 237, in rmtree os.rmdir(path) OSError: [Errno 22] Invalid argument: '/home2/buildbot/slave/3.x.loewis-sun/build/@test.getcwd/@test.getcwd' sincerely, -The Buildbot From python-checkins at python.org Thu Jun 25 20:39:36 2009 From: python-checkins at python.org (ezio.melotti) Date: Thu, 25 Jun 2009 18:39:36 -0000 Subject: [Python-checkins] r73562 - python/branches/py3k/Doc/glossary.rst Message-ID: Author: ezio.melotti Date: Thu Jun 25 20:39:31 2009 New Revision: 73562 Log: fixed double dict.items in glossary->view Modified: python/branches/py3k/Doc/glossary.rst Modified: python/branches/py3k/Doc/glossary.rst ============================================================================== --- python/branches/py3k/Doc/glossary.rst (original) +++ python/branches/py3k/Doc/glossary.rst Thu Jun 25 20:39:31 2009 @@ -523,7 +523,7 @@ :attr:`__class__` attribute or can be retrieved with ``type(obj)``. view - The objects returned from :meth:`dict.keys`, :meth:`dict.items`, and + The objects returned from :meth:`dict.keys`, :meth:`dict.values`, and :meth:`dict.items` are called dictionary views. They are lazy sequences that will see changes in the underlying dictionary. To force the dictionary view to become a full list use ``list(dictview)``. See From python-checkins at python.org Thu Jun 25 23:29:32 2009 From: python-checkins at python.org (amaury.forgeotdarc) Date: Thu, 25 Jun 2009 21:29:32 -0000 Subject: [Python-checkins] r73563 - python/trunk/Modules/md5.c Message-ID: Author: amaury.forgeotdarc Date: Thu Jun 25 23:29:32 2009 New Revision: 73563 Log: Fix a compilation warning on Windows Modified: python/trunk/Modules/md5.c Modified: python/trunk/Modules/md5.c ============================================================================== --- python/trunk/Modules/md5.c (original) +++ python/trunk/Modules/md5.c Thu Jun 25 23:29:32 2009 @@ -325,7 +325,7 @@ { const md5_byte_t *p = data; unsigned int left = nbytes; - int offset = (pms->count[0] >> 3) & 63; + unsigned int offset = (pms->count[0] >> 3) & 63; md5_word_t nbits = (md5_word_t)(nbytes << 3); if (nbytes <= 0) From buildbot at python.org Fri Jun 26 00:23:40 2009 From: buildbot at python.org (buildbot at python.org) Date: Thu, 25 Jun 2009 22:23:40 +0000 Subject: [Python-checkins] buildbot failure in x86 XP-4 3.x Message-ID: The Buildbot has detected a new failure of x86 XP-4 3.x. Full details are available at: http://www.python.org/dev/buildbot/all/x86%20XP-4%203.x/builds/710 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: bolen-windows Build Reason: Build Source Stamp: [branch branches/py3k] HEAD Blamelist: r.david.murray BUILD FAILED: failed test Excerpt from the test logfile: Traceback (most recent call last): File "E:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\test\test_import.py", line 62, in test_with_extension self.fail("import from %s failed: %s" % (ext, err)) File "E:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\unittest.py", line 540, in fail raise self.failureException(msg) AssertionError: import from .PY failed: No module named @test Traceback (most recent call last): File "E:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\test\test_import.py", line 79, in testImport test_with_extension(ext) File "E:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\test\test_import.py", line 72, in test_with_extension del sys.modules[TESTFN] KeyError: '@test' 1 test failed: test_import ====================================================================== ERROR: testImport (test.test_import.ImportTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "E:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\test\test_import.py", line 60, in test_with_extension mod = __import__(TESTFN) ImportError: No module named @test Traceback (most recent call last): File "E:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\test\test_import.py", line 62, in test_with_extension self.fail("import from %s failed: %s" % (ext, err)) File "E:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\unittest.py", line 540, in fail raise self.failureException(msg) AssertionError: import from .PY failed: No module named @test Traceback (most recent call last): File "E:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\test\test_import.py", line 79, in testImport test_with_extension(ext) File "E:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\test\test_import.py", line 72, in test_with_extension del sys.modules[TESTFN] KeyError: '@test' Traceback (most recent call last): File "E:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\test\test_import.py", line 62, in test_with_extension self.fail("import from %s failed: %s" % (ext, err)) File "E:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\unittest.py", line 540, in fail raise self.failureException(msg) AssertionError: import from .PY failed: No module named @test Traceback (most recent call last): File "E:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\test\test_import.py", line 79, in testImport test_with_extension(ext) File "E:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\test\test_import.py", line 72, in test_with_extension del sys.modules[TESTFN] KeyError: '@test' sincerely, -The Buildbot From python-checkins at python.org Fri Jun 26 00:29:29 2009 From: python-checkins at python.org (amaury.forgeotdarc) Date: Thu, 25 Jun 2009 22:29:29 -0000 Subject: [Python-checkins] r73564 - in python/trunk: Lib/test/test_extcall.py Misc/NEWS Objects/funcobject.c Message-ID: Author: amaury.forgeotdarc Date: Fri Jun 26 00:29:29 2009 New Revision: 73564 Log: #2016 Fix a crash in function call when the **kwargs dictionary is mutated during the function call setup. This even gives a slight speedup, probably because tuple allocation is faster than PyMem_NEW. Modified: python/trunk/Lib/test/test_extcall.py python/trunk/Misc/NEWS python/trunk/Objects/funcobject.c Modified: python/trunk/Lib/test/test_extcall.py ============================================================================== --- python/trunk/Lib/test/test_extcall.py (original) +++ python/trunk/Lib/test/test_extcall.py Fri Jun 26 00:29:29 2009 @@ -251,6 +251,24 @@ ... TypeError: id() takes no keyword arguments +A corner case of keyword dictionary items being deleted during +the function call setup. See . + + >>> class Name(str): + ... def __eq__(self, other): + ... try: + ... del x[self] + ... except KeyError: + ... pass + ... return str.__eq__(self, other) + ... def __hash__(self): + ... return str.__hash__(self) + + >>> x = {Name("a"):1, Name("b"):2} + >>> def f(a, b): + ... print a,b + >>> f(**x) + 1 2 """ import unittest Modified: python/trunk/Misc/NEWS ============================================================================== --- python/trunk/Misc/NEWS (original) +++ python/trunk/Misc/NEWS Fri Jun 26 00:29:29 2009 @@ -12,6 +12,9 @@ Core and Builtins ----------------- +- Issue #2016: Fixed a crash in a corner case where the dictionary of keyword + arguments could be modified during the function call setup. + - Removed the ipaddr module. - Issue #6329: Fixed iteration for memoryview objects (it was being blocked Modified: python/trunk/Objects/funcobject.c ============================================================================== --- python/trunk/Objects/funcobject.c (original) +++ python/trunk/Objects/funcobject.c Fri Jun 26 00:29:29 2009 @@ -489,13 +489,14 @@ { PyObject *result; PyObject *argdefs; + PyObject *kwtuple = NULL; PyObject **d, **k; Py_ssize_t nk, nd; argdefs = PyFunction_GET_DEFAULTS(func); if (argdefs != NULL && PyTuple_Check(argdefs)) { d = &PyTuple_GET_ITEM((PyTupleObject *)argdefs, 0); - nd = PyTuple_Size(argdefs); + nd = PyTuple_GET_SIZE(argdefs); } else { d = NULL; @@ -505,16 +506,17 @@ if (kw != NULL && PyDict_Check(kw)) { Py_ssize_t pos, i; nk = PyDict_Size(kw); - k = PyMem_NEW(PyObject *, 2*nk); - if (k == NULL) { - PyErr_NoMemory(); + kwtuple = PyTuple_New(2*nk); + if (kwtuple == NULL) return NULL; - } + k = &PyTuple_GET_ITEM(kwtuple, 0); pos = i = 0; - while (PyDict_Next(kw, &pos, &k[i], &k[i+1])) + while (PyDict_Next(kw, &pos, &k[i], &k[i+1])) { + Py_INCREF(k[i]); + Py_INCREF(k[i+1]); i += 2; + } nk = i/2; - /* XXX This is broken if the caller deletes dict items! */ } else { k = NULL; @@ -524,12 +526,11 @@ result = PyEval_EvalCodeEx( (PyCodeObject *)PyFunction_GET_CODE(func), PyFunction_GET_GLOBALS(func), (PyObject *)NULL, - &PyTuple_GET_ITEM(arg, 0), PyTuple_Size(arg), + &PyTuple_GET_ITEM(arg, 0), PyTuple_GET_SIZE(arg), k, nk, d, nd, PyFunction_GET_CLOSURE(func)); - if (k != NULL) - PyMem_DEL(k); + Py_XDECREF(kwtuple); return result; } From python-checkins at python.org Fri Jun 26 09:50:21 2009 From: python-checkins at python.org (gregory.p.smith) Date: Fri, 26 Jun 2009 07:50:21 -0000 Subject: [Python-checkins] r73565 - python/trunk/Lib/zipfile.py Message-ID: Author: gregory.p.smith Date: Fri Jun 26 09:50:21 2009 New Revision: 73565 Log: Fixes the last problem mentioned in issue1202. Modified: python/trunk/Lib/zipfile.py Modified: python/trunk/Lib/zipfile.py ============================================================================== --- python/trunk/Lib/zipfile.py (original) +++ python/trunk/Lib/zipfile.py Fri Jun 26 09:50:21 2009 @@ -1121,7 +1121,7 @@ self.fp.flush() if zinfo.flag_bits & 0x08: # Write CRC and file sizes after the file data - self.fp.write(struct.pack(" Author: gregory.p.smith Date: Fri Jun 26 10:05:13 2009 New Revision: 73566 Log: Merged revisions 73565 via svnmerge from svn+ssh://pythondev at svn.python.org/python/trunk ........ r73565 | gregory.p.smith | 2009-06-26 00:50:21 -0700 (Fri, 26 Jun 2009) | 2 lines Fixes the last problem mentioned in issue1202. ........ Issue #1202: zipfile module would cause a struct.error when attempting to store files with a CRC32 > 2**31-1. (on trunk this was merely a warning, in the py3k branch this caused an exception so I'm treating this as a release blocker and merging it now) Modified: python/branches/py3k/ (props changed) python/branches/py3k/Lib/zipfile.py python/branches/py3k/Misc/NEWS Modified: python/branches/py3k/Lib/zipfile.py ============================================================================== --- python/branches/py3k/Lib/zipfile.py (original) +++ python/branches/py3k/Lib/zipfile.py Fri Jun 26 10:05:13 2009 @@ -1132,7 +1132,7 @@ self.fp.flush() if zinfo.flag_bits & 0x08: # Write CRC and file sizes after the file data - self.fp.write(struct.pack(" 2**31-1. + Extension Modules ----------------- From python-checkins at python.org Fri Jun 26 10:13:29 2009 From: python-checkins at python.org (gregory.p.smith) Date: Fri, 26 Jun 2009 08:13:29 -0000 Subject: [Python-checkins] r73567 - in python/branches/release30-maint: Lib/zipfile.py Misc/NEWS Message-ID: Author: gregory.p.smith Date: Fri Jun 26 10:13:29 2009 New Revision: 73567 Log: Merged revisions 73566 via svnmerge from svn+ssh://pythondev at svn.python.org/python/branches/py3k ................ r73566 | gregory.p.smith | 2009-06-26 01:05:13 -0700 (Fri, 26 Jun 2009) | 14 lines Merged revisions 73565 via svnmerge from svn+ssh://pythondev at svn.python.org/python/trunk ........ r73565 | gregory.p.smith | 2009-06-26 00:50:21 -0700 (Fri, 26 Jun 2009) | 2 lines Fixes the last problem mentioned in issue1202. ........ ................ Modified: python/branches/release30-maint/ (props changed) python/branches/release30-maint/Lib/zipfile.py python/branches/release30-maint/Misc/NEWS Modified: python/branches/release30-maint/Lib/zipfile.py ============================================================================== --- python/branches/release30-maint/Lib/zipfile.py (original) +++ python/branches/release30-maint/Lib/zipfile.py Fri Jun 26 10:13:29 2009 @@ -1119,7 +1119,7 @@ self.fp.flush() if zinfo.flag_bits & 0x08: # Write CRC and file sizes after the file data - self.fp.write(struct.pack(" 2**31-1. Extension Modules ----------------- From python-checkins at python.org Fri Jun 26 10:19:19 2009 From: python-checkins at python.org (gregory.p.smith) Date: Fri, 26 Jun 2009 08:19:19 -0000 Subject: [Python-checkins] r73568 - in python/branches/release26-maint: Lib/zipfile.py Misc/NEWS Message-ID: Author: gregory.p.smith Date: Fri Jun 26 10:19:19 2009 New Revision: 73568 Log: Merged revisions 73565 via svnmerge from svn+ssh://pythondev at svn.python.org/python/trunk ........ r73565 | gregory.p.smith | 2009-06-26 00:50:21 -0700 (Fri, 26 Jun 2009) | 2 lines Fixes the last problem mentioned in issue1202. ........ Modified: python/branches/release26-maint/ (props changed) python/branches/release26-maint/Lib/zipfile.py python/branches/release26-maint/Misc/NEWS Modified: python/branches/release26-maint/Lib/zipfile.py ============================================================================== --- python/branches/release26-maint/Lib/zipfile.py (original) +++ python/branches/release26-maint/Lib/zipfile.py Fri Jun 26 10:19:19 2009 @@ -1110,7 +1110,7 @@ self.fp.flush() if zinfo.flag_bits & 0x08: # Write CRC and file sizes after the file data - self.fp.write(struct.pack(" 2**31-1. + Extension Modules ----------------- From buildbot at python.org Fri Jun 26 10:53:52 2009 From: buildbot at python.org (buildbot at python.org) Date: Fri, 26 Jun 2009 08:53:52 +0000 Subject: [Python-checkins] buildbot failure in x86 osx.5 3.x Message-ID: The Buildbot has detected a new failure of x86 osx.5 3.x. Full details are available at: http://www.python.org/dev/buildbot/all/x86%20osx.5%203.x/builds/1066 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: heller-x86-osx5 Build Reason: Build Source Stamp: [branch branches/py3k] HEAD Blamelist: ezio.melotti,gregory.p.smith BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_signal make: *** [buildbottest] Error 1 sincerely, -The Buildbot From buildbot at python.org Fri Jun 26 11:43:42 2009 From: buildbot at python.org (buildbot at python.org) Date: Fri, 26 Jun 2009 09:43:42 +0000 Subject: [Python-checkins] buildbot failure in sparc solaris10 gcc 3.x Message-ID: The Buildbot has detected a new failure of sparc solaris10 gcc 3.x. Full details are available at: http://www.python.org/dev/buildbot/all/sparc%20solaris10%20gcc%203.x/builds/857 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: loewis-sun Build Reason: Build Source Stamp: [branch branches/py3k] HEAD Blamelist: ezio.melotti,gregory.p.smith BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_posix ====================================================================== ERROR: test_getcwd_long_pathnames (test.test_posix.PosixTester) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home2/buildbot/slave/3.x.loewis-sun/build/Lib/test/test_posix.py", line 251, in test_getcwd_long_pathnames support.rmtree(base_path) File "/home2/buildbot/slave/3.x.loewis-sun/build/Lib/test/support.py", line 181, in rmtree shutil.rmtree(path) File "/home2/buildbot/slave/3.x.loewis-sun/build/Lib/shutil.py", line 239, in rmtree onerror(os.rmdir, path, sys.exc_info()) File "/home2/buildbot/slave/3.x.loewis-sun/build/Lib/shutil.py", line 237, in rmtree os.rmdir(path) OSError: [Errno 22] Invalid argument: '/home2/buildbot/slave/3.x.loewis-sun/build/@test.getcwd/@test.getcwd' sincerely, -The Buildbot From buildbot at python.org Fri Jun 26 12:52:50 2009 From: buildbot at python.org (buildbot at python.org) Date: Fri, 26 Jun 2009 10:52:50 +0000 Subject: [Python-checkins] buildbot failure in sparc solaris10 gcc 3.0 Message-ID: The Buildbot has detected a new failure of sparc solaris10 gcc 3.0. Full details are available at: http://www.python.org/dev/buildbot/all/sparc%20solaris10%20gcc%203.0/builds/415 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: loewis-sun Build Reason: Build Source Stamp: [branch branches/release30-maint] HEAD Blamelist: gregory.p.smith BUILD FAILED: failed test Excerpt from the test logfile: 2 tests failed: test_posix test_subprocess ====================================================================== ERROR: test_getcwd_long_pathnames (test.test_posix.PosixTester) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home2/buildbot/slave/3.0.loewis-sun/build/Lib/test/test_posix.py", line 252, in test_getcwd_long_pathnames support.rmtree(base_path) File "/home2/buildbot/slave/3.0.loewis-sun/build/Lib/test/support.py", line 98, in rmtree shutil.rmtree(path) File "/home2/buildbot/slave/3.0.loewis-sun/build/Lib/shutil.py", line 225, in rmtree onerror(os.rmdir, path, sys.exc_info()) File "/home2/buildbot/slave/3.0.loewis-sun/build/Lib/shutil.py", line 223, in rmtree os.rmdir(path) OSError: [Errno 22] Invalid argument: '/home2/buildbot/slave/3.0.loewis-sun/build/@test.getcwd/@test.getcwd' ====================================================================== FAIL: test_executable (test.test_subprocess.ProcessTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home2/buildbot/slave/3.0.loewis-sun/build/Lib/test/test_subprocess.py", line 115, in test_executable self.assertEqual(p.returncode, 47) AssertionError: -6 != 47 sincerely, -The Buildbot From buildbot at python.org Fri Jun 26 12:59:41 2009 From: buildbot at python.org (buildbot at python.org) Date: Fri, 26 Jun 2009 10:59:41 +0000 Subject: [Python-checkins] buildbot failure in x86 XP-4 trunk Message-ID: The Buildbot has detected a new failure of x86 XP-4 trunk. Full details are available at: http://www.python.org/dev/buildbot/all/x86%20XP-4%20trunk/builds/2276 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: bolen-windows Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: gregory.p.smith BUILD FAILED: failed test Excerpt from the test logfile: Traceback (most recent call last): File "E:\cygwin\home\db3l\buildarea\trunk.bolen-windows\build\lib\threading.py", line 524, in __bootstrap_inner File "E:\cygwin\home\db3l\buildarea\trunk.bolen-windows\build\lib\threading.py", line 477, in run File "", line 7, in killer : 'NoneType' object is not callable 1 test failed: test_bsddb3 ====================================================================== ERROR: test01_basic_replication (bsddb.test.test_replication.DBReplicationManager) ---------------------------------------------------------------------- Traceback (most recent call last): File "E:\cygwin\home\db3l\buildarea\trunk.bolen-windows\build\lib\bsddb\test\test_replication.py", line 170, in test01_basic_replication mode=0666, txn=txn) DBNoSuchFileError: (2, 'No such file or directory -- connection closed: Successful return: 0') ====================================================================== ERROR: test01_basic_replication (bsddb.test.test_replication.DBReplicationManager) ---------------------------------------------------------------------- Traceback (most recent call last): File "E:\cygwin\home\db3l\buildarea\trunk.bolen-windows\build\lib\bsddb\test\test_replication.py", line 58, in tearDown if self.dbClient : DBError: (0, 'DB object has been closed') ====================================================================== FAIL: test01_basic_replication (bsddb.test.test_replication.DBBaseReplication) ---------------------------------------------------------------------- Traceback (most recent call last): File "E:\cygwin\home\db3l\buildarea\trunk.bolen-windows\build\lib\bsddb\test\test_replication.py", line 315, in test01_basic_replication self.assertTrue(time.time() Author: benjamin.peterson Date: Fri Jun 26 14:48:55 2009 New Revision: 73569 Log: update release candidate shorthand Modified: peps/trunk/pep-0101.txt Modified: peps/trunk/pep-0101.txt ============================================================================== --- peps/trunk/pep-0101.txt (original) +++ peps/trunk/pep-0101.txt Fri Jun 26 14:48:55 2009 @@ -66,7 +66,7 @@ We use the following conventions in the examples below. Where a release number is given, it is of the form X.YaZ, e.g. 2.6a3 for Python 2.6 alpha - 3, where "a" == alpha, "b" == beta, "c" == release candidate. + 3, where "a" == alpha, "b" == beta, "rc" == release candidate. Final releases are named "releaseXY". The branch tag is "releaseXY-maint" because this will point to the long lived maintenance branch. The fork From python-checkins at python.org Fri Jun 26 14:54:46 2009 From: python-checkins at python.org (benjamin.peterson) Date: Fri, 26 Jun 2009 12:54:46 -0000 Subject: [Python-checkins] r73570 - peps/trunk/pep-0101.txt Message-ID: Author: benjamin.peterson Date: Fri Jun 26 14:54:46 2009 New Revision: 73570 Log: rearrange Modified: peps/trunk/pep-0101.txt Modified: peps/trunk/pep-0101.txt ============================================================================== --- peps/trunk/pep-0101.txt (original) +++ peps/trunk/pep-0101.txt Fri Jun 26 14:54:46 2009 @@ -127,52 +127,6 @@ use your judgement, taking into account whether you are making an alpha, beta, or final release. - ___ If this is a final major release, branch the tree for X.Y - - When making a major release (e.g., for 2.6), you must create the - long-lived maintenance branch. To create a _branch_ (e.g., - release26-maint), do the following: - - .../sandbox/release/release.py --branch X.Y - - ___ If you just made the release branch, check out a clean version - into a new directory. You'll be doing the release from this new - branch. - - % svn co \ - svn+ssh://pythondev at svn.python.org/python/branches/release26-maint - - ___ Set the original trunk up to be the next release. - - % .../sandbox/release/release.py --bump 2.7a0 - - ___ Edit all version references in the README - - ___ Move any historical "what's new" entries from Misc/NEWS to - Misc/HISTORY. - - ___ The LICENSE file. Add the pending version to the list of - releases, and be sure to check the release dates. - - ___ There's a copy of the license in Doc/license.rst - - ___ Doc/tutorial/interpreter.rst (2 references to '[Pp]ython26', one - to 'Python 2.6'). - - ___ Doc/tutorial/stdlib.rst and Doc/tutorial/stdlib2.rst, which have - each one reference to '[Pp]ython26'. - - ___ Update the version number in configure.in and re-run autoconf. - - ___ Update the version numbers for the Windows builds in PC/ and - PCbuild/, which have references to python26. - - % find PC/ PCbuild/ \( -type f -and -not -wholename '*/.svn/*' \) | xargs sed -i 's/python26/python27/g' - % svn mv PC/os2emx/python26.def PC/os2emx/python27.def - - ___ cd release26-maint # cd into the branch directory. - - ___ Regenerate Lib/pydoc-topics.py cd to the Doc directory and type ``make pydoc-topics``. Then copy @@ -219,6 +173,51 @@ alpha or beta releases. Note that Andrew Kuchling often takes care of this. + ___ If this is a final major release, branch the tree for X.Y + + When making a major release (e.g., for 2.6), you must create the + long-lived maintenance branch. To create a _branch_ (e.g., + release26-maint), do the following: + + .../sandbox/release/release.py --branch X.Y + + ___ If you just made the release branch, check out a clean version + into a new directory. You'll be doing the release from this new + branch. + + % svn co \ + svn+ssh://pythondev at svn.python.org/python/branches/release26-maint + + ___ Set the original trunk up to be the next release. + + % .../sandbox/release/release.py --bump 2.7a0 + + ___ Edit all version references in the README + + ___ Move any historical "what's new" entries from Misc/NEWS to + Misc/HISTORY. + + ___ The LICENSE file. Add the pending version to the list of + releases, and be sure to check the release dates. + + ___ There's a copy of the license in Doc/license.rst + + ___ Doc/tutorial/interpreter.rst (2 references to '[Pp]ython26', one + to 'Python 2.6'). + + ___ Doc/tutorial/stdlib.rst and Doc/tutorial/stdlib2.rst, which have + each one reference to '[Pp]ython26'. + + ___ Update the version number in configure.in and re-run autoconf. + + ___ Update the version numbers for the Windows builds in PC/ and + PCbuild/, which have references to python26. + + % find PC/ PCbuild/ \( -type f -and -not -wholename '*/.svn/*' \) | xargs sed -i 's/python26/python27/g' + % svn mv PC/os2emx/python26.def PC/os2emx/python27.def + + ___ cd release26-maint # cd into the branch directory. + ___ Tag the release for X.YaZ .../sandbox/release/release.py --tag X.YaZ From python-checkins at python.org Fri Jun 26 15:05:03 2009 From: python-checkins at python.org (benjamin.peterson) Date: Fri, 26 Jun 2009 13:05:03 -0000 Subject: [Python-checkins] r73571 - python/branches/py3k/Lib/pydoc_data/topics.py Message-ID: Author: benjamin.peterson Date: Fri Jun 26 15:05:03 2009 New Revision: 73571 Log: update pydoc-topics Modified: python/branches/py3k/Lib/pydoc_data/topics.py Modified: python/branches/py3k/Lib/pydoc_data/topics.py ============================================================================== --- python/branches/py3k/Lib/pydoc_data/topics.py (original) +++ python/branches/py3k/Lib/pydoc_data/topics.py Fri Jun 26 15:05:03 2009 @@ -1,4 +1,4 @@ -# Autogenerated by Sphinx on Sat Jun 13 08:08:53 2009 +# Autogenerated by Sphinx on Fri Jun 26 08:03:32 2009 topics = {'assert': '\nThe ``assert`` statement\n************************\n\nAssert statements are a convenient way to insert debugging assertions\ninto a program:\n\n assert_stmt ::= "assert" expression ["," expression]\n\nThe simple form, ``assert expression``, is equivalent to\n\n if __debug__:\n if not expression: raise AssertionError\n\nThe extended form, ``assert expression1, expression2``, is equivalent\nto\n\n if __debug__:\n if not expression1: raise AssertionError(expression2)\n\nThese equivalences assume that ``__debug__`` and ``AssertionError``\nrefer to the built-in variables with those names. In the current\nimplementation, the built-in variable ``__debug__`` is ``True`` under\nnormal circumstances, ``False`` when optimization is requested\n(command line option -O). The current code generator emits no code\nfor an assert statement when optimization is requested at compile\ntime. Note that it is unnecessary to include the source code for the\nexpression that failed in the error message; it will be displayed as\npart of the stack trace.\n\nAssignments to ``__debug__`` are illegal. The value for the built-in\nvariable is determined when the interpreter starts.\n', 'assignment': '\nAssignment statements\n*********************\n\nAssignment statements are used to (re)bind names to values and to\nmodify attributes or items of mutable objects:\n\n assignment_stmt ::= (target_list "=")+ (expression_list | yield_expression)\n target_list ::= target ("," target)* [","]\n target ::= identifier\n | "(" target_list ")"\n | "[" target_list "]"\n | attributeref\n | subscription\n | slicing\n | "*" target\n\n(See section *Primaries* for the syntax definitions for the last three\nsymbols.)\n\nAn assignment statement evaluates the expression list (remember that\nthis can be a single expression or a comma-separated list, the latter\nyielding a tuple) and assigns the single resulting object to each of\nthe target lists, from left to right.\n\nAssignment is defined recursively depending on the form of the target\n(list). When a target is part of a mutable object (an attribute\nreference, subscription or slicing), the mutable object must\nultimately perform the assignment and decide about its validity, and\nmay raise an exception if the assignment is unacceptable. The rules\nobserved by various types and the exceptions raised are given with the\ndefinition of the object types (see section *The standard type\nhierarchy*).\n\nAssignment of an object to a target list, optionally enclosed in\nparentheses or square brackets, is recursively defined as follows.\n\n* If the target list is a single target: The object is assigned to\n that target.\n\n* If the target list is a comma-separated list of targets: The object\n must be an iterable with the same number of items as there are\n targets in the target list, and the items are assigned, from left to\n right, to the corresponding targets. (This rule is relaxed as of\n Python 1.5; in earlier versions, the object had to be a tuple.\n Since strings are sequences, an assignment like ``a, b = "xy"`` is\n now legal as long as the string has the right length.)\n\n * If the target list contains one target prefixed with an asterisk,\n called a "starred" target: The object must be a sequence with at\n least as many items as there are targets in the target list, minus\n one. The first items of the sequence are assigned, from left to\n right, to the targets before the starred target. The final items\n of the sequence are assigned to the targets after the starred\n target. A list of the remaining items in the sequence is then\n assigned to the starred target (the list can be empty).\n\n * Else: The object must be a sequence with the same number of items\n as there are targets in the target list, and the items are\n assigned, from left to right, to the corresponding targets.\n\nAssignment of an object to a single target is recursively defined as\nfollows.\n\n* If the target is an identifier (name):\n\n * If the name does not occur in a ``global`` or ``nonlocal``\n statement in the current code block: the name is bound to the\n object in the current local namespace.\n\n * Otherwise: the name is bound to the object in the global namespace\n or the outer namespace determined by ``nonlocal``, respectively.\n\n The name is rebound if it was already bound. This may cause the\n reference count for the object previously bound to the name to reach\n zero, causing the object to be deallocated and its destructor (if it\n has one) to be called.\n\n The name is rebound if it was already bound. This may cause the\n reference count for the object previously bound to the name to reach\n zero, causing the object to be deallocated and its destructor (if it\n has one) to be called.\n\n* If the target is a target list enclosed in parentheses or in square\n brackets: The object must be an iterable with the same number of\n items as there are targets in the target list, and its items are\n assigned, from left to right, to the corresponding targets.\n\n* If the target is an attribute reference: The primary expression in\n the reference is evaluated. It should yield an object with\n assignable attributes; if this is not the case, ``TypeError`` is\n raised. That object is then asked to assign the assigned object to\n the given attribute; if it cannot perform the assignment, it raises\n an exception (usually but not necessarily ``AttributeError``).\n\n* If the target is a subscription: The primary expression in the\n reference is evaluated. It should yield either a mutable sequence\n object (such as a list) or a mapping object (such as a dictionary).\n Next, the subscript expression is evaluated.\n\n If the primary is a mutable sequence object (such as a list), the\n subscript must yield an integer. If it is negative, the sequence\'s\n length is added to it. The resulting value must be a nonnegative\n integer less than the sequence\'s length, and the sequence is asked\n to assign the assigned object to its item with that index. If the\n index is out of range, ``IndexError`` is raised (assignment to a\n subscripted sequence cannot add new items to a list).\n\n If the primary is a mapping object (such as a dictionary), the\n subscript must have a type compatible with the mapping\'s key type,\n and the mapping is then asked to create a key/datum pair which maps\n the subscript to the assigned object. This can either replace an\n existing key/value pair with the same key value, or insert a new\n key/value pair (if no key with the same value existed).\n\n For user-defined objects, the ``__setitem__()`` method is called\n with appropriate arguments.\n\n* If the target is a slicing: The primary expression in the reference\n is evaluated. It should yield a mutable sequence object (such as a\n list). The assigned object should be a sequence object of the same\n type. Next, the lower and upper bound expressions are evaluated,\n insofar they are present; defaults are zero and the sequence\'s\n length. The bounds should evaluate to integers. If either bound is\n negative, the sequence\'s length is added to it. The resulting\n bounds are clipped to lie between zero and the sequence\'s length,\n inclusive. Finally, the sequence object is asked to replace the\n slice with the items of the assigned sequence. The length of the\n slice may be different from the length of the assigned sequence,\n thus changing the length of the target sequence, if the object\n allows it.\n\n(In the current implementation, the syntax for targets is taken to be\nthe same as for expressions, and invalid syntax is rejected during the\ncode generation phase, causing less detailed error messages.)\n\nWARNING: Although the definition of assignment implies that overlaps\nbetween the left-hand side and the right-hand side are \'safe\' (for\nexample ``a, b = b, a`` swaps two variables), overlaps *within* the\ncollection of assigned-to variables are not safe! For instance, the\nfollowing program prints ``[0, 2]``:\n\n x = [0, 1]\n i = 0\n i, x[i] = 1, 2\n print(x)\n\nSee also:\n\n **PEP 3132** - Extended Iterable Unpacking\n The specification for the ``*target`` feature.\n\n\nAugmented assignment statements\n===============================\n\nAugmented assignment is the combination, in a single statement, of a\nbinary operation and an assignment statement:\n\n augmented_assignment_stmt ::= augtarget augop (expression_list | yield_expression)\n augtarget ::= identifier | attributeref | subscription | slicing\n augop ::= "+=" | "-=" | "*=" | "/=" | "//=" | "%=" | "**="\n | ">>=" | "<<=" | "&=" | "^=" | "|="\n\n(See section *Primaries* for the syntax definitions for the last three\nsymbols.)\n\nAn augmented assignment evaluates the target (which, unlike normal\nassignment statements, cannot be an unpacking) and the expression\nlist, performs the binary operation specific to the type of assignment\non the two operands, and assigns the result to the original target.\nThe target is only evaluated once.\n\nAn augmented assignment expression like ``x += 1`` can be rewritten as\n``x = x + 1`` to achieve a similar, but not exactly equal effect. In\nthe augmented version, ``x`` is only evaluated once. Also, when\npossible, the actual operation is performed *in-place*, meaning that\nrather than creating a new object and assigning that to the target,\nthe old object is modified instead.\n\nWith the exception of assigning to tuples and multiple targets in a\nsingle statement, the assignment done by augmented assignment\nstatements is handled the same way as normal assignments. Similarly,\nwith the exception of the possible *in-place* behavior, the binary\noperation performed by augmented assignment is the same as the normal\nbinary operations.\n\nFor targets which are attribute references, the initial value is\nretrieved with a ``getattr()`` and the result is assigned with a\n``setattr()``. Notice that the two methods do not necessarily refer\nto the same variable. When ``getattr()`` refers to a class variable,\n``setattr()`` still writes to an instance variable. For example:\n\n class A:\n x = 3 # class variable\n a = A()\n a.x += 1 # writes a.x as 4 leaving A.x as 3\n', 'atom-identifiers': '\nIdentifiers (Names)\n*******************\n\nAn identifier occurring as an atom is a name. See section\n*Identifiers and keywords* for lexical definition and section *Naming\nand binding* for documentation of naming and binding.\n\nWhen the name is bound to an object, evaluation of the atom yields\nthat object. When a name is not bound, an attempt to evaluate it\nraises a ``NameError`` exception.\n\n**Private name mangling:** When an identifier that textually occurs in\na class definition begins with two or more underscore characters and\ndoes not end in two or more underscores, it is considered a *private\nname* of that class. Private names are transformed to a longer form\nbefore code is generated for them. The transformation inserts the\nclass name in front of the name, with leading underscores removed, and\na single underscore inserted in front of the class name. For example,\nthe identifier ``__spam`` occurring in a class named ``Ham`` will be\ntransformed to ``_Ham__spam``. This transformation is independent of\nthe syntactical context in which the identifier is used. If the\ntransformed name is extremely long (longer than 255 characters),\nimplementation defined truncation may happen. If the class name\nconsists only of underscores, no transformation is done.\n', From python-checkins at python.org Fri Jun 26 15:11:29 2009 From: python-checkins at python.org (benjamin.peterson) Date: Fri, 26 Jun 2009 13:11:29 -0000 Subject: [Python-checkins] r73572 - in python/branches/py3k: Include/patchlevel.h Lib/distutils/__init__.py Lib/idlelib/idlever.py Misc/RPM/python-3.1.spec README Message-ID: Author: benjamin.peterson Date: Fri Jun 26 15:11:28 2009 New Revision: 73572 Log: bump version to 3.1 final :) Modified: python/branches/py3k/Include/patchlevel.h python/branches/py3k/Lib/distutils/__init__.py python/branches/py3k/Lib/idlelib/idlever.py python/branches/py3k/Misc/RPM/python-3.1.spec python/branches/py3k/README Modified: python/branches/py3k/Include/patchlevel.h ============================================================================== --- python/branches/py3k/Include/patchlevel.h (original) +++ python/branches/py3k/Include/patchlevel.h Fri Jun 26 15:11:28 2009 @@ -19,11 +19,11 @@ #define PY_MAJOR_VERSION 3 #define PY_MINOR_VERSION 1 #define PY_MICRO_VERSION 0 -#define PY_RELEASE_LEVEL PY_RELEASE_LEVEL_GAMMA -#define PY_RELEASE_SERIAL 2 +#define PY_RELEASE_LEVEL PY_RELEASE_LEVEL_FINAL +#define PY_RELEASE_SERIAL 0 /* Version as a string */ -#define PY_VERSION "3.1rc2+" +#define PY_VERSION "3.1" /*--end constants--*/ /* Subversion Revision number of this file (not of the repository) */ Modified: python/branches/py3k/Lib/distutils/__init__.py ============================================================================== --- python/branches/py3k/Lib/distutils/__init__.py (original) +++ python/branches/py3k/Lib/distutils/__init__.py Fri Jun 26 15:11:28 2009 @@ -15,5 +15,5 @@ # Updated automatically by the Python release process. # #--start constants-- -__version__ = "3.1rc2" +__version__ = "3.1" #--end constants-- Modified: python/branches/py3k/Lib/idlelib/idlever.py ============================================================================== --- python/branches/py3k/Lib/idlelib/idlever.py (original) +++ python/branches/py3k/Lib/idlelib/idlever.py Fri Jun 26 15:11:28 2009 @@ -1 +1 @@ -IDLE_VERSION = "3.1rc2" +IDLE_VERSION = "3.1" Modified: python/branches/py3k/Misc/RPM/python-3.1.spec ============================================================================== --- python/branches/py3k/Misc/RPM/python-3.1.spec (original) +++ python/branches/py3k/Misc/RPM/python-3.1.spec Fri Jun 26 15:11:28 2009 @@ -34,7 +34,7 @@ %define name python #--start constants-- -%define version 3.1rc2 +%define version 3.1 %define libver 3.1 #--end constants-- %define release 1pydotorg Modified: python/branches/py3k/README ============================================================================== --- python/branches/py3k/README (original) +++ python/branches/py3k/README Fri Jun 26 15:11:28 2009 @@ -1,5 +1,5 @@ -This is Python version 3.1 Release Candidate 2 -============================================== +This is Python version 3.1 +========================== Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 Python Software Foundation. From python-checkins at python.org Fri Jun 26 15:21:52 2009 From: python-checkins at python.org (benjamin.peterson) Date: Fri, 26 Jun 2009 13:21:52 -0000 Subject: [Python-checkins] r73573 - python/branches/py3k/README Message-ID: Author: benjamin.peterson Date: Fri Jun 26 15:21:52 2009 New Revision: 73573 Log: rearrange the sections of the README, so they'll hopefully be more in the order people will interested in Modified: python/branches/py3k/README Modified: python/branches/py3k/README ============================================================================== --- python/branches/py3k/README (original) +++ python/branches/py3k/README Fri Jun 26 15:21:52 2009 @@ -12,26 +12,41 @@ removed. -Release Schedule ----------------- +Build Instructions +------------------ -See PEP 375 for release details: http://www.python.org/dev/peps/pep-0375/ +On Unix, Linux, BSD, OSX, and Cygwin: + ./configure + make + make test + sudo make install -Documentation -------------- +This will install Python as python3. -Documentation for Python 3.1 is online, updated twice a day: +You can pass many options to the configure script; run "./configure +--help" to find out more. On OSX and Cygwin, the executable is called +python.exe; elsewhere it's just python. - http://docs.python.org/dev/3.1/ +On Mac OS X, if you have configured Python with --enable-framework, +you should use "make frameworkinstall" to do the installation. Note +that this installs the Python executable in a place that is not +normally on your PATH, you may want to set up a symlink in +/usr/local/bin. -All documentation is also available online at the Python web site -(http://docs.python.org/, see below). It is available online for -occasional reference, or can be downloaded in many formats for faster -access. The documentation is downloadable in HTML, PostScript, PDF, -LaTeX (through 2.5), and reStructuredText (2.6+) formats; the LaTeX and -reStructuredText versions are primarily for documentation authors, -translators, and people with special formatting requirements. +On Windows, see PCbuild/readme.txt. + +If you wish, you can create a subdirectory and invoke configure from +there. For example: + + mkdir debug + cd debug + ../configure --with-pydebug + make + make test + +(This will fail if you *also* built at the top-level directory. You +should do a "make clean" at the toplevel first.) What's New @@ -42,8 +57,6 @@ http://docs.python.org/dev/3.1/whatsnew/3.1.html -Please help write it! - For a more detailed change log, read Misc/NEWS (though this file, too, is incomplete, and also doesn't list anything merged in from the 2.7 release under development). @@ -52,14 +65,20 @@ entitled "Installing multiple versions". -Proposals for enhancement -------------------------- +Documentation +------------- -If you have a proposal to change Python, you may want to send an email to the -comp.lang.python or python-ideas mailing lists for inital feedback. A Python -Enhancement Proposal (PEP) may be submitted if your idea gains ground. All -current PEPs, as well as guidelines for submitting a new PEP, are listed at -http://www.python.org/dev/peps/. +Documentation for Python 3.1 is online, updated twice a day: + + http://docs.python.org/dev/3.1/ + +All documentation is also available online at the Python web site +(http://docs.python.org/, see below). It is available online for +occasional reference, or can be downloaded in many formats for faster +access. The documentation is downloadable in HTML, PostScript, PDF, +LaTeX (through 2.5), and reStructuredText (2.6+) formats; the LaTeX and +reStructuredText versions are primarily for documentation authors, +translators, and people with special formatting requirements. Converting From Python 2.x to 3.x @@ -69,6 +88,11 @@ needs to be changed, such as optional warnings when deprecated features are used, and backported versions of certain key Python 3.x features. +A source-to-source translation tool, "2to3", can take care of the mundane task +of converting large amounts of source code. It is not a complete solution but +is complemented by the deprecation warnings in 2.6. See +http://docs.python.org/dev/py3k/library/2to3.html for more information. + Testing ------- @@ -116,17 +140,6 @@ directory and "make altinstall" in the others. -Configuration options and variables ------------------------------------ - -A source-to-source translation tool, "2to3", can take care of the -mundane task of converting large amounts of source code. It is not a -complete solution but is complemented by the deprecation warnings in -2.6. This tool is currently available via the Subversion sandbox: - - http://svn.python.org/view/sandbox/trunk/2to3/ - - Issue Tracker and Mailing List ------------------------------ @@ -146,39 +159,20 @@ http://mail.python.org/mailman/listinfo/python-dev/ -Build Instructions ------------------- - -On Unix, Linux, BSD, OSX, and Cygwin: - - ./configure - make - make test - sudo make install - -You can pass many options to the configure script; run "./configure ---help" to find out more. On OSX and Cygwin, the executable is called -python.exe; elsewhere it's just python. - -On Mac OS X, if you have configured Python with --enable-framework, -you should use "make frameworkinstall" to do the installation. Note -that this installs the Python executable in a place that is not -normally on your PATH, you may want to set up a symlink in -/usr/local/bin. +Proposals for enhancement +------------------------- -On Windows, see PCbuild/readme.txt. +If you have a proposal to change Python, you may want to send an email to the +comp.lang.python or python-ideas mailing lists for inital feedback. A Python +Enhancement Proposal (PEP) may be submitted if your idea gains ground. All +current PEPs, as well as guidelines for submitting a new PEP, are listed at +http://www.python.org/dev/peps/. -If you wish, you can create a subdirectory and invoke configure from -there. For example: - mkdir debug - cd debug - ../configure --with-pydebug - make - make test +Release Schedule +---------------- -(This will fail if you *also* built at the top-level directory. You -should do a "make clean" at the toplevel first.) +See PEP 375 for release details: http://www.python.org/dev/peps/pep-0375/ Copyright and License Information From python-checkins at python.org Fri Jun 26 15:27:08 2009 From: python-checkins at python.org (benjamin.peterson) Date: Fri, 26 Jun 2009 13:27:08 -0000 Subject: [Python-checkins] r73574 - python/tags/r31 Message-ID: Author: benjamin.peterson Date: Fri Jun 26 15:27:07 2009 New Revision: 73574 Log: tag Python version 3.1! Added: python/tags/r31/ - copied from r73573, /python/branches/py3k/ From buildbot at python.org Fri Jun 26 15:27:52 2009 From: buildbot at python.org (buildbot at python.org) Date: Fri, 26 Jun 2009 13:27:52 +0000 Subject: [Python-checkins] buildbot failure in x86 gentoo 3.x Message-ID: The Buildbot has detected a new failure of x86 gentoo 3.x. Full details are available at: http://www.python.org/dev/buildbot/all/x86%20gentoo%203.x/builds/975 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: norwitz-x86 Build Reason: Build Source Stamp: [branch branches/py3k] HEAD Blamelist: benjamin.peterson BUILD FAILED: failed test Excerpt from the test logfile: make: *** [buildbottest] Unknown signal 32 sincerely, -The Buildbot From buildbot at python.org Fri Jun 26 16:39:17 2009 From: buildbot at python.org (buildbot at python.org) Date: Fri, 26 Jun 2009 14:39:17 +0000 Subject: [Python-checkins] buildbot failure in sparc solaris10 gcc 3.x Message-ID: The Buildbot has detected a new failure of sparc solaris10 gcc 3.x. Full details are available at: http://www.python.org/dev/buildbot/all/sparc%20solaris10%20gcc%203.x/builds/859 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: loewis-sun Build Reason: Build Source Stamp: [branch branches/py3k] HEAD Blamelist: benjamin.peterson BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_posix ====================================================================== ERROR: test_getcwd_long_pathnames (test.test_posix.PosixTester) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home2/buildbot/slave/3.x.loewis-sun/build/Lib/test/test_posix.py", line 251, in test_getcwd_long_pathnames support.rmtree(base_path) File "/home2/buildbot/slave/3.x.loewis-sun/build/Lib/test/support.py", line 181, in rmtree shutil.rmtree(path) File "/home2/buildbot/slave/3.x.loewis-sun/build/Lib/shutil.py", line 239, in rmtree onerror(os.rmdir, path, sys.exc_info()) File "/home2/buildbot/slave/3.x.loewis-sun/build/Lib/shutil.py", line 237, in rmtree os.rmdir(path) OSError: [Errno 22] Invalid argument: '/home2/buildbot/slave/3.x.loewis-sun/build/@test.getcwd/@test.getcwd' sincerely, -The Buildbot From buildbot at python.org Fri Jun 26 18:48:19 2009 From: buildbot at python.org (buildbot at python.org) Date: Fri, 26 Jun 2009 16:48:19 +0000 Subject: [Python-checkins] buildbot failure in x86 XP-4 3.x Message-ID: The Buildbot has detected a new failure of x86 XP-4 3.x. Full details are available at: http://www.python.org/dev/buildbot/all/x86%20XP-4%203.x/builds/713 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: bolen-windows Build Reason: Build Source Stamp: [branch branches/py3k] HEAD Blamelist: benjamin.peterson BUILD FAILED: failed test Excerpt from the test logfile: Traceback (most recent call last): File "E:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\test\test_import.py", line 62, in test_with_extension self.fail("import from %s failed: %s" % (ext, err)) File "E:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\unittest.py", line 540, in fail raise self.failureException(msg) AssertionError: import from .PY failed: No module named @test Traceback (most recent call last): File "E:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\test\test_import.py", line 79, in testImport test_with_extension(ext) File "E:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\test\test_import.py", line 72, in test_with_extension del sys.modules[TESTFN] KeyError: '@test' 1 test failed: test_import sincerely, -The Buildbot From python-checkins at python.org Fri Jun 26 18:49:07 2009 From: python-checkins at python.org (benjamin.peterson) Date: Fri, 26 Jun 2009 16:49:07 -0000 Subject: [Python-checkins] r73575 - python/trunk/Doc/tools/sphinxext/indexsidebar.html Message-ID: Author: benjamin.peterson Date: Fri Jun 26 18:49:06 2009 New Revision: 73575 Log: mark 3.1 as stable docs Modified: python/trunk/Doc/tools/sphinxext/indexsidebar.html Modified: python/trunk/Doc/tools/sphinxext/indexsidebar.html ============================================================================== --- python/trunk/Doc/tools/sphinxext/indexsidebar.html (original) +++ python/trunk/Doc/tools/sphinxext/indexsidebar.html Fri Jun 26 18:49:06 2009 @@ -3,8 +3,8 @@

Docs for other versions

From python-checkins at python.org Sat Jun 27 01:37:06 2009 From: python-checkins at python.org (benjamin.peterson) Date: Fri, 26 Jun 2009 23:37:06 -0000 Subject: [Python-checkins] r73576 - python/trunk/Doc/library/symtable.rst Message-ID: Author: benjamin.peterson Date: Sat Jun 27 01:37:06 2009 New Revision: 73576 Log: document is_declared_global() Modified: python/trunk/Doc/library/symtable.rst Modified: python/trunk/Doc/library/symtable.rst ============================================================================== --- python/trunk/Doc/library/symtable.rst (original) +++ python/trunk/Doc/library/symtable.rst Sat Jun 27 01:37:06 2009 @@ -144,6 +144,10 @@ Return ``True`` if the symbol is global. + .. method:: is_declared_global() + + Return ``True`` if the symbol is declared global with a global statement. + .. method:: is_local() Return ``True`` if the symbol is local to its block. From python-checkins at python.org Sat Jun 27 16:16:23 2009 From: python-checkins at python.org (benjamin.peterson) Date: Sat, 27 Jun 2009 14:16:23 -0000 Subject: [Python-checkins] r73577 - python/trunk/Doc/library/stdtypes.rst Message-ID: Author: benjamin.peterson Date: Sat Jun 27 16:16:23 2009 New Revision: 73577 Log: link to extensive generator docs in the reference manual Modified: python/trunk/Doc/library/stdtypes.rst Modified: python/trunk/Doc/library/stdtypes.rst ============================================================================== --- python/trunk/Doc/library/stdtypes.rst (original) +++ python/trunk/Doc/library/stdtypes.rst Sat Jun 27 16:16:23 2009 @@ -619,10 +619,18 @@ constraint was added in Python 2.3; in Python 2.2, various iterators are broken according to this rule.) + +.. _generator-types: + +Generator Types +--------------- + Python's :term:`generator`\s provide a convenient way to implement the iterator protocol. If a container object's :meth:`__iter__` method is implemented as a generator, it will automatically return an iterator object (technically, a -generator object) supplying the :meth:`__iter__` and :meth:`next` methods. +generator object) supplying the :meth:`__iter__` and :meth:`next` methods. More +information about generators can be found in :ref:`the documentation for the +yield expression `. .. _typesseq: From python-checkins at python.org Sat Jun 27 16:22:59 2009 From: python-checkins at python.org (benjamin.peterson) Date: Sat, 27 Jun 2009 14:22:59 -0000 Subject: [Python-checkins] r73578 - in python/branches/release26-maint: Doc/tools/sphinxext/indexsidebar.html Message-ID: Author: benjamin.peterson Date: Sat Jun 27 16:22:59 2009 New Revision: 73578 Log: Merged revisions 73575 via svnmerge from svn+ssh://pythondev at svn.python.org/python/trunk ........ r73575 | benjamin.peterson | 2009-06-26 11:49:06 -0500 (Fri, 26 Jun 2009) | 1 line mark 3.1 as stable docs ........ Modified: python/branches/release26-maint/ (props changed) python/branches/release26-maint/Doc/tools/sphinxext/indexsidebar.html Modified: python/branches/release26-maint/Doc/tools/sphinxext/indexsidebar.html ============================================================================== --- python/branches/release26-maint/Doc/tools/sphinxext/indexsidebar.html (original) +++ python/branches/release26-maint/Doc/tools/sphinxext/indexsidebar.html Sat Jun 27 16:22:59 2009 @@ -2,9 +2,9 @@

Download these documents

Docs for other versions

From buildbot at python.org Sat Jun 27 16:41:15 2009 From: buildbot at python.org (buildbot at python.org) Date: Sat, 27 Jun 2009 14:41:15 +0000 Subject: [Python-checkins] buildbot failure in x86 gentoo 2.6 Message-ID: The Buildbot has detected a new failure of x86 gentoo 2.6. Full details are available at: http://www.python.org/dev/buildbot/all/x86%20gentoo%202.6/builds/382 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: norwitz-x86 Build Reason: Build Source Stamp: [branch branches/release26-maint] HEAD Blamelist: benjamin.peterson BUILD FAILED: failed test Excerpt from the test logfile: make: *** [buildbottest] Killed sincerely, -The Buildbot From python-checkins at python.org Sat Jun 27 23:18:08 2009 From: python-checkins at python.org (benjamin.peterson) Date: Sat, 27 Jun 2009 21:18:08 -0000 Subject: [Python-checkins] r73579 - python/branches/release31-maint Message-ID: Author: benjamin.peterson Date: Sat Jun 27 23:18:07 2009 New Revision: 73579 Log: make 3.1 maintenance branch Added: python/branches/release31-maint/ - copied from r73578, /python/branches/py3k/ From python-checkins at python.org Sat Jun 27 23:40:28 2009 From: python-checkins at python.org (benjamin.peterson) Date: Sat, 27 Jun 2009 21:40:28 -0000 Subject: [Python-checkins] r73580 - in python/branches/py3k: Doc/license.rst Doc/tutorial/interpreter.rst Include/patchlevel.h LICENSE Lib/distutils/__init__.py Lib/idlelib/idlever.py Misc/NEWS Misc/RPM/python-3.1.spec Misc/RPM/python-3.2.spec README configure configure.in Message-ID: Author: benjamin.peterson Date: Sat Jun 27 23:40:27 2009 New Revision: 73580 Log: bump to 3.1a0 Added: python/branches/py3k/Misc/RPM/python-3.2.spec - copied, changed from r73572, /python/branches/py3k/Misc/RPM/python-3.1.spec Removed: python/branches/py3k/Misc/RPM/python-3.1.spec Modified: python/branches/py3k/Doc/license.rst python/branches/py3k/Doc/tutorial/interpreter.rst python/branches/py3k/Include/patchlevel.h python/branches/py3k/LICENSE python/branches/py3k/Lib/distutils/__init__.py python/branches/py3k/Lib/idlelib/idlever.py python/branches/py3k/Misc/NEWS python/branches/py3k/README python/branches/py3k/configure python/branches/py3k/configure.in Modified: python/branches/py3k/Doc/license.rst ============================================================================== --- python/branches/py3k/Doc/license.rst (original) +++ python/branches/py3k/Doc/license.rst Sat Jun 27 23:40:27 2009 @@ -94,7 +94,10 @@ +----------------+--------------+------------+------------+-----------------+ | 3.0 | 2.6 | 2008 | PSF | yes | +----------------+--------------+------------+------------+-----------------+ - +| 3.1 | 3.0 | 2009 | PSF | yes | ++----------------+--------------+------------+------------+-----------------+ +| 3.2 | 3.1 | 2009 | PSF | yes | ++----------------+--------------+------------+------------+-----------------+ .. note:: Modified: python/branches/py3k/Doc/tutorial/interpreter.rst ============================================================================== --- python/branches/py3k/Doc/tutorial/interpreter.rst (original) +++ python/branches/py3k/Doc/tutorial/interpreter.rst Sat Jun 27 23:40:27 2009 @@ -10,11 +10,11 @@ Invoking the Interpreter ======================== -The Python interpreter is usually installed as :file:`/usr/local/bin/python3.1` +The Python interpreter is usually installed as :file:`/usr/local/bin/python3.2` on those machines where it is available; putting :file:`/usr/local/bin` in your Unix shell's search path makes it possible to start it by typing the command :: - python3.1 + python3.2 to the shell. [#]_ Since the choice of the directory where the interpreter lives is an installation option, other places are possible; check with your local @@ -22,11 +22,11 @@ popular alternative location.) On Windows machines, the Python installation is usually placed in -:file:`C:\\Python31`, though you can change this when you're running the +:file:`C:\\Python32`, though you can change this when you're running the installer. To add this directory to your path, you can type the following command into the command prompt in a DOS box:: - set path=%path%;C:\python31 + set path=%path%;C:\python32 Typing an end-of-file character (:kbd:`Control-D` on Unix, :kbd:`Control-Z` on Windows) at the primary prompt causes the interpreter to exit with a zero exit Modified: python/branches/py3k/Include/patchlevel.h ============================================================================== --- python/branches/py3k/Include/patchlevel.h (original) +++ python/branches/py3k/Include/patchlevel.h Sat Jun 27 23:40:27 2009 @@ -19,11 +19,11 @@ #define PY_MAJOR_VERSION 3 #define PY_MINOR_VERSION 1 #define PY_MICRO_VERSION 0 -#define PY_RELEASE_LEVEL PY_RELEASE_LEVEL_FINAL +#define PY_RELEASE_LEVEL PY_RELEASE_LEVEL_ALPHA #define PY_RELEASE_SERIAL 0 /* Version as a string */ -#define PY_VERSION "3.1" +#define PY_VERSION "3.1a0+" /*--end constants--*/ /* Subversion Revision number of this file (not of the repository) */ Modified: python/branches/py3k/LICENSE ============================================================================== --- python/branches/py3k/LICENSE (original) +++ python/branches/py3k/LICENSE Sat Jun 27 23:40:27 2009 @@ -60,6 +60,8 @@ 2.6 2.5 2008 PSF yes 2.6.1 2.6 2008 PSF yes 3.0 2.6 2008 PSF yes + 3.1 3.0 2009 PSF yes + 3.2 3.1 2009 PSF yes Footnotes: Modified: python/branches/py3k/Lib/distutils/__init__.py ============================================================================== --- python/branches/py3k/Lib/distutils/__init__.py (original) +++ python/branches/py3k/Lib/distutils/__init__.py Sat Jun 27 23:40:27 2009 @@ -15,5 +15,5 @@ # Updated automatically by the Python release process. # #--start constants-- -__version__ = "3.1" +__version__ = "3.2a0" #--end constants-- Modified: python/branches/py3k/Lib/idlelib/idlever.py ============================================================================== --- python/branches/py3k/Lib/idlelib/idlever.py (original) +++ python/branches/py3k/Lib/idlelib/idlever.py Sat Jun 27 23:40:27 2009 @@ -1 +1 @@ -IDLE_VERSION = "3.1" +IDLE_VERSION = "3.2a0" Modified: python/branches/py3k/Misc/NEWS ============================================================================== --- python/branches/py3k/Misc/NEWS (original) +++ python/branches/py3k/Misc/NEWS Sat Jun 27 23:40:27 2009 @@ -4,6 +4,18 @@ (editors: check NEWS.help for information about editing NEWS using ReST.) +What's New in Python 3.2 Alpha 1? +================================= + +*Release date: XX-XXX-XXX* + +Core and Builtins +----------------- + +Library +------- + + What's New in Python 3.1? ========================= Deleted: python/branches/py3k/Misc/RPM/python-3.1.spec ============================================================================== --- python/branches/py3k/Misc/RPM/python-3.1.spec Sat Jun 27 23:40:27 2009 +++ (empty file) @@ -1,386 +0,0 @@ -########################## -# User-modifiable configs -########################## - -# Is the resulting package and the installed binary named "python" or -# "python2"? -#WARNING: Commenting out doesn't work. Last line is what's used. -%define config_binsuffix none -%define config_binsuffix 2.6 - -# Build tkinter? "auto" enables it if /usr/bin/wish exists. -#WARNING: Commenting out doesn't work. Last line is what's used. -%define config_tkinter no -%define config_tkinter yes -%define config_tkinter auto - -# Use pymalloc? The last line (commented or not) determines wether -# pymalloc is used. -#WARNING: Commenting out doesn't work. Last line is what's used. -%define config_pymalloc no -%define config_pymalloc yes - -# Enable IPV6? -#WARNING: Commenting out doesn't work. Last line is what's used. -%define config_ipv6 yes -%define config_ipv6 no - -# Location of the HTML directory. -%define config_htmldir /var/www/html/python - -################################# -# End of user-modifiable configs -################################# - -%define name python -#--start constants-- -%define version 3.1 -%define libver 3.1 -#--end constants-- -%define release 1pydotorg -%define __prefix /usr - -# kludge to get around rpm define weirdness -%define ipv6 %(if [ "%{config_ipv6}" = yes ]; then echo --enable-ipv6; else echo --disable-ipv6; fi) -%define pymalloc %(if [ "%{config_pymalloc}" = yes ]; then echo --with-pymalloc; else echo --without-pymalloc; fi) -%define binsuffix %(if [ "%{config_binsuffix}" = none ]; then echo ; else echo "%{config_binsuffix}"; fi) -%define include_tkinter %(if [ \\( "%{config_tkinter}" = auto -a -f /usr/bin/wish \\) -o "%{config_tkinter}" = yes ]; then echo 1; else echo 0; fi) -%define libdirname %(( uname -m | egrep -q '_64$' && [ -d /usr/lib64 ] && echo lib64 ) || echo lib) - -# detect if documentation is available -%define include_docs %(if [ -f "%{_sourcedir}/html-%{version}.tar.bz2" ]; then echo 1; else echo 0; fi) - -Summary: An interpreted, interactive, object-oriented programming language. -Name: %{name}%{binsuffix} -Version: %{version} -Release: %{release} -Copyright: Modified CNRI Open Source License -Group: Development/Languages -Source: Python-%{version}.tar.bz2 -%if %{include_docs} -Source1: html-%{version}.tar.bz2 -%endif -BuildRoot: %{_tmppath}/%{name}-%{version}-root -BuildPrereq: expat-devel -BuildPrereq: db4-devel -BuildPrereq: gdbm-devel -BuildPrereq: sqlite-devel -Prefix: %{__prefix} -Packager: Sean Reifschneider - -%description -Python is an interpreted, interactive, object-oriented programming -language. It incorporates modules, exceptions, dynamic typing, very high -level dynamic data types, and classes. Python combines remarkable power -with very clear syntax. It has interfaces to many system calls and -libraries, as well as to various window systems, and is extensible in C or -C++. It is also usable as an extension language for applications that need -a programmable interface. Finally, Python is portable: it runs on many -brands of UNIX, on PCs under Windows, MS-DOS, and OS/2, and on the -Mac. - -%package devel -Summary: The libraries and header files needed for Python extension development. -Prereq: python%{binsuffix} = %{PACKAGE_VERSION} -Group: Development/Libraries - -%description devel -The Python programming language's interpreter can be extended with -dynamically loaded extensions and can be embedded in other programs. -This package contains the header files and libraries needed to do -these types of tasks. - -Install python-devel if you want to develop Python extensions. The -python package will also need to be installed. You'll probably also -want to install the python-docs package, which contains Python -documentation. - -%if %{include_tkinter} -%package tkinter -Summary: A graphical user interface for the Python scripting language. -Group: Development/Languages -Prereq: python%{binsuffix} = %{PACKAGE_VERSION}-%{release} - -%description tkinter -The Tkinter (Tk interface) program is an graphical user interface for -the Python scripting language. - -You should install the tkinter package if you'd like to use a graphical -user interface for Python programming. -%endif - -%package tools -Summary: A collection of development tools included with Python. -Group: Development/Tools -Prereq: python%{binsuffix} = %{PACKAGE_VERSION}-%{release} - -%description tools -The Python package includes several development tools that are used -to build python programs. This package contains a selection of those -tools, including the IDLE Python IDE. - -Install python-tools if you want to use these tools to develop -Python programs. You will also need to install the python and -tkinter packages. - -%if %{include_docs} -%package docs -Summary: Python-related documentation. -Group: Development/Documentation - -%description docs -Documentation relating to the Python programming language in HTML and info -formats. -%endif - -%changelog -* Mon Dec 20 2004 Sean Reifschneider [2.4-2pydotorg] -- Changing the idle wrapper so that it passes arguments to idle. - -* Tue Oct 19 2004 Sean Reifschneider [2.4b1-1pydotorg] -- Updating to 2.4. - -* Thu Jul 22 2004 Sean Reifschneider [2.3.4-3pydotorg] -- Paul Tiemann fixes for %{prefix}. -- Adding permission changes for directory as suggested by reimeika.ca -- Adding code to detect when it should be using lib64. -- Adding a define for the location of /var/www/html for docs. - -* Thu May 27 2004 Sean Reifschneider [2.3.4-2pydotorg] -- Including changes from Ian Holsman to build under Red Hat 7.3. -- Fixing some problems with the /usr/local path change. - -* Sat Mar 27 2004 Sean Reifschneider [2.3.2-3pydotorg] -- Being more agressive about finding the paths to fix for - #!/usr/local/bin/python. - -* Sat Feb 07 2004 Sean Reifschneider [2.3.3-2pydotorg] -- Adding code to remove "#!/usr/local/bin/python" from particular files and - causing the RPM build to terminate if there are any unexpected files - which have that line in them. - -* Mon Oct 13 2003 Sean Reifschneider [2.3.2-1pydotorg] -- Adding code to detect wether documentation is available to build. - -* Fri Sep 19 2003 Sean Reifschneider [2.3.1-1pydotorg] -- Updating to the 2.3.1 release. - -* Mon Feb 24 2003 Sean Reifschneider [2.3b1-1pydotorg] -- Updating to 2.3b1 release. - -* Mon Feb 17 2003 Sean Reifschneider [2.3a1-1] -- Updating to 2.3 release. - -* Sun Dec 23 2001 Sean Reifschneider -[Release 2.2-2] -- Added -docs package. -- Added "auto" config_tkinter setting which only enables tk if - /usr/bin/wish exists. - -* Sat Dec 22 2001 Sean Reifschneider -[Release 2.2-1] -- Updated to 2.2. -- Changed the extension to "2" from "2.2". - -* Tue Nov 18 2001 Sean Reifschneider -[Release 2.2c1-1] -- Updated to 2.2c1. - -* Thu Nov 1 2001 Sean Reifschneider -[Release 2.2b1-3] -- Changed the way the sed for fixing the #! in pydoc works. - -* Wed Oct 24 2001 Sean Reifschneider -[Release 2.2b1-2] -- Fixed missing "email" package, thanks to anonymous report on sourceforge. -- Fixed missing "compiler" package. - -* Mon Oct 22 2001 Sean Reifschneider -[Release 2.2b1-1] -- Updated to 2.2b1. - -* Mon Oct 9 2001 Sean Reifschneider -[Release 2.2a4-4] -- otto at balinor.mat.unimi.it mentioned that the license file is missing. - -* Sun Sep 30 2001 Sean Reifschneider -[Release 2.2a4-3] -- Ignacio Vazquez-Abrams pointed out that I had a spruious double-quote in - the spec files. Thanks. - -* Wed Jul 25 2001 Sean Reifschneider -[Release 2.2a1-1] -- Updated to 2.2a1 release. -- Changed idle and pydoc to use binsuffix macro - -####### -# PREP -####### -%prep -%setup -n Python-%{version} - -######## -# BUILD -######## -%build -./configure --enable-unicode=ucs4 %{ipv6} %{pymalloc} --prefix=%{__prefix} -make - -########## -# INSTALL -########## -%install -# set the install path -echo '[install_scripts]' >setup.cfg -echo 'install_dir='"${RPM_BUILD_ROOT}%{__prefix}/bin" >>setup.cfg - -[ -d "$RPM_BUILD_ROOT" -a "$RPM_BUILD_ROOT" != "/" ] && rm -rf $RPM_BUILD_ROOT -mkdir -p $RPM_BUILD_ROOT%{__prefix}/%{libdirname}/python%{libvers}/lib-dynload -make prefix=$RPM_BUILD_ROOT%{__prefix} install - -# REPLACE PATH IN PYDOC -if [ ! -z "%{binsuffix}" ] -then - ( - cd $RPM_BUILD_ROOT%{__prefix}/bin - mv pydoc pydoc.old - sed 's|#!.*|#!%{__prefix}/bin/env python'%{binsuffix}'|' \ - pydoc.old >pydoc - chmod 755 pydoc - rm -f pydoc.old - ) -fi - -# add the binsuffix -if [ ! -z "%{binsuffix}" ] -then - ( cd $RPM_BUILD_ROOT%{__prefix}/bin; rm -f python[0-9a-zA-Z]*; - mv -f python python"%{binsuffix}" ) - ( cd $RPM_BUILD_ROOT%{__prefix}/man/man1; mv python.1 python%{binsuffix}.1 ) - ( cd $RPM_BUILD_ROOT%{__prefix}/bin; mv -f pydoc pydoc"%{binsuffix}" ) - ( cd $RPM_BUILD_ROOT%{__prefix}/bin; mv -f idle idle"%{binsuffix}" ) -fi - -######## -# Tools -echo '#!%{__prefix}/bin/env python%{binsuffix}' >${RPM_BUILD_ROOT}%{__prefix}/bin/idle%{binsuffix} -echo 'import os, sys' >>${RPM_BUILD_ROOT}%{__prefix}/bin/idle%{binsuffix} -echo 'os.execvp("%{__prefix}/bin/python%{binsuffix}", ["%{__prefix}/bin/python%{binsuffix}", "%{__prefix}/lib/python%{libvers}/idlelib/idle.py"] + sys.argv[1:])' >>${RPM_BUILD_ROOT}%{__prefix}/bin/idle%{binsuffix} -echo 'print "Failed to exec Idle"' >>${RPM_BUILD_ROOT}%{__prefix}/bin/idle%{binsuffix} -echo 'sys.exit(1)' >>${RPM_BUILD_ROOT}%{__prefix}/bin/idle%{binsuffix} -chmod 755 $RPM_BUILD_ROOT%{__prefix}/bin/idle%{binsuffix} -cp -a Tools $RPM_BUILD_ROOT%{__prefix}/%{libdirname}/python%{libvers} - -# MAKE FILE LISTS -rm -f mainpkg.files -find "$RPM_BUILD_ROOT""%{__prefix}"/%{libdirname}/python%{libvers}/lib-dynload -type f | - sed "s|^${RPM_BUILD_ROOT}|/|" | - grep -v -e '_tkinter.so$' >mainpkg.files -find "$RPM_BUILD_ROOT""%{__prefix}"/bin -type f | - sed "s|^${RPM_BUILD_ROOT}|/|" | - grep -v -e '/bin/idle%{binsuffix}$' >>mainpkg.files - -rm -f tools.files -find "$RPM_BUILD_ROOT""%{__prefix}"/%{libdirname}/python%{libvers}/idlelib \ - "$RPM_BUILD_ROOT""%{__prefix}"/%{libdirname}/python%{libvers}/Tools -type f | - sed "s|^${RPM_BUILD_ROOT}|/|" >tools.files -echo "%{__prefix}"/bin/idle%{binsuffix} >>tools.files - -###### -# Docs -%if %{include_docs} -mkdir -p "$RPM_BUILD_ROOT"%{config_htmldir} -( - cd "$RPM_BUILD_ROOT"%{config_htmldir} - bunzip2 < %{SOURCE1} | tar x -) -%endif - -# fix the #! line in installed files -find "$RPM_BUILD_ROOT" -type f -print0 | - xargs -0 grep -l /usr/local/bin/python | while read file -do - FIXFILE="$file" - sed 's|^#!.*python|#!%{__prefix}/bin/env python'"%{binsuffix}"'|' \ - "$FIXFILE" >/tmp/fix-python-path.$$ - cat /tmp/fix-python-path.$$ >"$FIXFILE" - rm -f /tmp/fix-python-path.$$ -done - -# check to see if there are any straggling #! lines -find "$RPM_BUILD_ROOT" -type f | xargs egrep -n '^#! */usr/local/bin/python' \ - | grep ':1:#!' >/tmp/python-rpm-files.$$ || true -if [ -s /tmp/python-rpm-files.$$ ] -then - echo '*****************************************************' - cat /tmp/python-rpm-files.$$ - cat <<@EOF - ***************************************************** - There are still files referencing /usr/local/bin/python in the - install directory. They are listed above. Please fix the .spec - file and try again. If you are an end-user, you probably want - to report this to jafo-rpms at tummy.com as well. - ***************************************************** - at EOF - rm -f /tmp/python-rpm-files.$$ - exit 1 -fi -rm -f /tmp/python-rpm-files.$$ - -######## -# CLEAN -######## -%clean -[ -n "$RPM_BUILD_ROOT" -a "$RPM_BUILD_ROOT" != / ] && rm -rf $RPM_BUILD_ROOT -rm -f mainpkg.files tools.files - -######## -# FILES -######## -%files -f mainpkg.files -%defattr(-,root,root) -%doc Misc/README Misc/cheatsheet Misc/Porting -%doc LICENSE Misc/ACKS Misc/HISTORY Misc/NEWS -%{__prefix}/man/man1/python%{binsuffix}.1* - -%attr(755,root,root) %dir %{__prefix}/include/python%{libvers} -%attr(755,root,root) %dir %{__prefix}/%{libdirname}/python%{libvers}/ -%{__prefix}/%{libdirname}/python%{libvers}/*.txt -%{__prefix}/%{libdirname}/python%{libvers}/*.py* -%{__prefix}/%{libdirname}/python%{libvers}/pdb.doc -%{__prefix}/%{libdirname}/python%{libvers}/profile.doc -%{__prefix}/%{libdirname}/python%{libvers}/curses -%{__prefix}/%{libdirname}/python%{libvers}/distutils -%{__prefix}/%{libdirname}/python%{libvers}/encodings -%{__prefix}/%{libdirname}/python%{libvers}/plat-linux2 -%{__prefix}/%{libdirname}/python%{libvers}/site-packages -%{__prefix}/%{libdirname}/python%{libvers}/test -%{__prefix}/%{libdirname}/python%{libvers}/xml -%{__prefix}/%{libdirname}/python%{libvers}/email -%{__prefix}/%{libdirname}/python%{libvers}/email/mime -%{__prefix}/%{libdirname}/python%{libvers}/sqlite3 -%{__prefix}/%{libdirname}/python%{libvers}/compiler -%{__prefix}/%{libdirname}/python%{libvers}/hotshot -%{__prefix}/%{libdirname}/python%{libvers}/logging -%{__prefix}/%{libdirname}/python%{libvers}/lib-old - -%files devel -%defattr(-,root,root) -%{__prefix}/include/python%{libvers}/*.h -%{__prefix}/%{libdirname}/python%{libvers}/config - -%files -f tools.files tools -%defattr(-,root,root) - -%if %{include_tkinter} -%files tkinter -%defattr(-,root,root) -%{__prefix}/%{libdirname}/python%{libvers}/tkinter -%{__prefix}/%{libdirname}/python%{libvers}/lib-dynload/_tkinter.so* -%endif - -%if %{include_docs} -%files docs -%defattr(-,root,root) -%{config_htmldir}/* -%endif Copied: python/branches/py3k/Misc/RPM/python-3.2.spec (from r73572, /python/branches/py3k/Misc/RPM/python-3.1.spec) ============================================================================== --- /python/branches/py3k/Misc/RPM/python-3.1.spec (original) +++ python/branches/py3k/Misc/RPM/python-3.2.spec Sat Jun 27 23:40:27 2009 @@ -34,8 +34,8 @@ %define name python #--start constants-- -%define version 3.1 -%define libver 3.1 +%define version 3.2a0 +%define libver 3.2 #--end constants-- %define release 1pydotorg %define __prefix /usr Modified: python/branches/py3k/README ============================================================================== --- python/branches/py3k/README (original) +++ python/branches/py3k/README Sat Jun 27 23:40:27 2009 @@ -1,4 +1,4 @@ -This is Python version 3.1 +This is Python version 3.2 ========================== Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 Modified: python/branches/py3k/configure ============================================================================== --- python/branches/py3k/configure (original) +++ python/branches/py3k/configure Sat Jun 27 23:40:27 2009 @@ -1,7 +1,7 @@ #! /bin/sh -# From configure.in Revision: 73274 . +# From configure.in Revision: 73307 . # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.61 for python 3.1. +# Generated by GNU Autoconf 2.61 for python 3.2. # # Report bugs to . # @@ -575,8 +575,8 @@ # Identity of this package. PACKAGE_NAME='python' PACKAGE_TARNAME='python' -PACKAGE_VERSION='3.1' -PACKAGE_STRING='python 3.1' +PACKAGE_VERSION='3.2' +PACKAGE_STRING='python 3.2' PACKAGE_BUGREPORT='http://bugs.python.org/' ac_unique_file="Include/object.h" @@ -1246,7 +1246,7 @@ # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures python 3.1 to adapt to many kinds of systems. +\`configure' configures python 3.2 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1307,7 +1307,7 @@ if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of python 3.1:";; + short | recursive ) echo "Configuration of python 3.2:";; esac cat <<\_ACEOF @@ -1438,7 +1438,7 @@ test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -python configure 3.1 +python configure 3.2 generated by GNU Autoconf 2.61 Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, @@ -1452,7 +1452,7 @@ This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by python $as_me 3.1, which was +It was created by python $as_me 3.2, which was generated by GNU Autoconf 2.61. Invocation command line was $ $0 $@ @@ -1826,7 +1826,7 @@ mv confdefs.h.new confdefs.h -VERSION=3.1 +VERSION=3.2 SOVERSION=1.0 @@ -25817,7 +25817,7 @@ # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by python $as_me 3.1, which was +This file was extended by python $as_me 3.2, which was generated by GNU Autoconf 2.61. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -25866,7 +25866,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF ac_cs_version="\\ -python config.status 3.1 +python config.status 3.2 configured by $0, generated by GNU Autoconf 2.61, with options \\"`echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\" Modified: python/branches/py3k/configure.in ============================================================================== --- python/branches/py3k/configure.in (original) +++ python/branches/py3k/configure.in Sat Jun 27 23:40:27 2009 @@ -4,7 +4,7 @@ dnl NOTE: autoconf 2.64 doesn't seem to work (use 2.61). # Set VERSION so we only need to edit in one place (i.e., here) -m4_define(PYTHON_VERSION, 3.1) +m4_define(PYTHON_VERSION, 3.2) AC_REVISION($Revision$) AC_PREREQ(2.61) From python-checkins at python.org Sat Jun 27 23:57:07 2009 From: python-checkins at python.org (benjamin.peterson) Date: Sat, 27 Jun 2009 21:57:07 -0000 Subject: [Python-checkins] r73580 - svn:log Message-ID: Author: benjamin.peterson Revision: 73580 Property Name: svn:log Action: modified Property diff: --- old property value +++ new property value @@ -1 +1 @@ -bump to 3.1a0 \ No newline at end of file +bump to 3.2a0 \ No newline at end of file From python-checkins at python.org Sun Jun 28 00:00:01 2009 From: python-checkins at python.org (benjamin.peterson) Date: Sat, 27 Jun 2009 22:00:01 -0000 Subject: [Python-checkins] r73581 - python/branches/py3k/Include/patchlevel.h Message-ID: Author: benjamin.peterson Date: Sun Jun 28 00:00:01 2009 New Revision: 73581 Log: fix mistake in version bump Modified: python/branches/py3k/Include/patchlevel.h Modified: python/branches/py3k/Include/patchlevel.h ============================================================================== --- python/branches/py3k/Include/patchlevel.h (original) +++ python/branches/py3k/Include/patchlevel.h Sun Jun 28 00:00:01 2009 @@ -17,13 +17,13 @@ /* Version parsed out into numeric values */ /*--start constants--*/ #define PY_MAJOR_VERSION 3 -#define PY_MINOR_VERSION 1 +#define PY_MINOR_VERSION 2 #define PY_MICRO_VERSION 0 #define PY_RELEASE_LEVEL PY_RELEASE_LEVEL_ALPHA #define PY_RELEASE_SERIAL 0 /* Version as a string */ -#define PY_VERSION "3.1a0+" +#define PY_VERSION "3.2a0" /*--end constants--*/ /* Subversion Revision number of this file (not of the repository) */ From python-checkins at python.org Sun Jun 28 00:00:30 2009 From: python-checkins at python.org (benjamin.peterson) Date: Sat, 27 Jun 2009 22:00:30 -0000 Subject: [Python-checkins] r73582 - python/branches/py3k/Misc/build.sh Message-ID: Author: benjamin.peterson Date: Sun Jun 28 00:00:30 2009 New Revision: 73582 Log: update install dir version Modified: python/branches/py3k/Misc/build.sh Modified: python/branches/py3k/Misc/build.sh ============================================================================== --- python/branches/py3k/Misc/build.sh (original) +++ python/branches/py3k/Misc/build.sh Sun Jun 28 00:00:30 2009 @@ -52,7 +52,7 @@ REMOTE_SYSTEM="neal at dinsdale.python.org" REMOTE_DIR="/data/ftp.python.org/pub/docs.python.org/dev/py3k" RESULT_FILE="$DIR/build/index.html" -INSTALL_DIR="/tmp/python-test-3.0/local" +INSTALL_DIR="/tmp/python-test-3.2/local" RSYNC_OPTS="-aC -e ssh" # Always run the installed version of Python. From python-checkins at python.org Sun Jun 28 00:03:19 2009 From: python-checkins at python.org (benjamin.peterson) Date: Sat, 27 Jun 2009 22:03:19 -0000 Subject: [Python-checkins] r73583 - in python/branches/release31-maint: Include/patchlevel.h Lib/distutils/__init__.py Lib/idlelib/idlever.py Misc/NEWS Misc/RPM/python-3.1.spec Message-ID: Author: benjamin.peterson Date: Sun Jun 28 00:03:18 2009 New Revision: 73583 Log: version to 3.1.1a0 Modified: python/branches/release31-maint/Include/patchlevel.h python/branches/release31-maint/Lib/distutils/__init__.py python/branches/release31-maint/Lib/idlelib/idlever.py python/branches/release31-maint/Misc/NEWS python/branches/release31-maint/Misc/RPM/python-3.1.spec Modified: python/branches/release31-maint/Include/patchlevel.h ============================================================================== --- python/branches/release31-maint/Include/patchlevel.h (original) +++ python/branches/release31-maint/Include/patchlevel.h Sun Jun 28 00:03:18 2009 @@ -18,12 +18,12 @@ /*--start constants--*/ #define PY_MAJOR_VERSION 3 #define PY_MINOR_VERSION 1 -#define PY_MICRO_VERSION 0 -#define PY_RELEASE_LEVEL PY_RELEASE_LEVEL_FINAL +#define PY_MICRO_VERSION 1 +#define PY_RELEASE_LEVEL PY_RELEASE_LEVEL_ALPHA #define PY_RELEASE_SERIAL 0 /* Version as a string */ -#define PY_VERSION "3.1" +#define PY_VERSION "3.1.1a0" /*--end constants--*/ /* Subversion Revision number of this file (not of the repository) */ Modified: python/branches/release31-maint/Lib/distutils/__init__.py ============================================================================== --- python/branches/release31-maint/Lib/distutils/__init__.py (original) +++ python/branches/release31-maint/Lib/distutils/__init__.py Sun Jun 28 00:03:18 2009 @@ -15,5 +15,5 @@ # Updated automatically by the Python release process. # #--start constants-- -__version__ = "3.1" +__version__ = "3.1.1a0" #--end constants-- Modified: python/branches/release31-maint/Lib/idlelib/idlever.py ============================================================================== --- python/branches/release31-maint/Lib/idlelib/idlever.py (original) +++ python/branches/release31-maint/Lib/idlelib/idlever.py Sun Jun 28 00:03:18 2009 @@ -1 +1 @@ -IDLE_VERSION = "3.1" +IDLE_VERSION = "3.1.1a0" Modified: python/branches/release31-maint/Misc/NEWS ============================================================================== --- python/branches/release31-maint/Misc/NEWS (original) +++ python/branches/release31-maint/Misc/NEWS Sun Jun 28 00:03:18 2009 @@ -4,6 +4,18 @@ (editors: check NEWS.help for information about editing NEWS using ReST.) +What's New in Python 3.1.1? +=========================== + +*Release date: XX-XX-XXXX" + +Core and Builtins +----------------- + +Library +------- + + What's New in Python 3.1? ========================= Modified: python/branches/release31-maint/Misc/RPM/python-3.1.spec ============================================================================== --- python/branches/release31-maint/Misc/RPM/python-3.1.spec (original) +++ python/branches/release31-maint/Misc/RPM/python-3.1.spec Sun Jun 28 00:03:18 2009 @@ -34,7 +34,7 @@ %define name python #--start constants-- -%define version 3.1 +%define version 3.1.1a0 %define libver 3.1 #--end constants-- %define release 1pydotorg From python-checkins at python.org Sun Jun 28 00:06:56 2009 From: python-checkins at python.org (benjamin.peterson) Date: Sat, 27 Jun 2009 22:06:56 -0000 Subject: [Python-checkins] r73584 - python/branches/release31-maint/Misc/build.sh Message-ID: Author: benjamin.peterson Date: Sun Jun 28 00:06:56 2009 New Revision: 73584 Log: update doc upload URL Modified: python/branches/release31-maint/Misc/build.sh Modified: python/branches/release31-maint/Misc/build.sh ============================================================================== --- python/branches/release31-maint/Misc/build.sh (original) +++ python/branches/release31-maint/Misc/build.sh Sun Jun 28 00:06:56 2009 @@ -50,9 +50,9 @@ #FAILURE_CC="optional--uncomment and set to desired address" REMOTE_SYSTEM="neal at dinsdale.python.org" -REMOTE_DIR="/data/ftp.python.org/pub/docs.python.org/dev/py3k" +REMOTE_DIR="/data/ftp.python.org/pub/www.python.org/doc/3.1" RESULT_FILE="$DIR/build/index.html" -INSTALL_DIR="/tmp/python-test-3.0/local" +INSTALL_DIR="/tmp/python-test-3.1/local" RSYNC_OPTS="-aC -e ssh" # Always run the installed version of Python. From buildbot at python.org Sun Jun 28 00:14:36 2009 From: buildbot at python.org (buildbot at python.org) Date: Sat, 27 Jun 2009 22:14:36 +0000 Subject: [Python-checkins] buildbot failure in amd64 gentoo 3.x Message-ID: The Buildbot has detected a new failure of amd64 gentoo 3.x. Full details are available at: http://www.python.org/dev/buildbot/all/amd64%20gentoo%203.x/builds/847 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: norwitz-amd64 Build Reason: Build Source Stamp: [branch branches/py3k] HEAD Blamelist: benjamin.peterson BUILD FAILED: failed failed slave lost sincerely, -The Buildbot From python-checkins at python.org Sun Jun 28 00:15:41 2009 From: python-checkins at python.org (benjamin.peterson) Date: Sat, 27 Jun 2009 22:15:41 -0000 Subject: [Python-checkins] r73585 - in python/branches/py3k: Doc/tools/sphinxext/indexsidebar.html Message-ID: Author: benjamin.peterson Date: Sun Jun 28 00:15:41 2009 New Revision: 73585 Log: Merged revisions 73575 via svnmerge from svn+ssh://pythondev at svn.python.org/python/trunk ........ r73575 | benjamin.peterson | 2009-06-26 11:49:06 -0500 (Fri, 26 Jun 2009) | 1 line mark 3.1 as stable docs ........ Modified: python/branches/py3k/ (props changed) python/branches/py3k/Doc/tools/sphinxext/indexsidebar.html Modified: python/branches/py3k/Doc/tools/sphinxext/indexsidebar.html ============================================================================== --- python/branches/py3k/Doc/tools/sphinxext/indexsidebar.html (original) +++ python/branches/py3k/Doc/tools/sphinxext/indexsidebar.html Sun Jun 28 00:15:41 2009 @@ -3,8 +3,9 @@

Docs for other versions

From python-checkins at python.org Sun Jun 28 00:18:44 2009 From: python-checkins at python.org (benjamin.peterson) Date: Sat, 27 Jun 2009 22:18:44 -0000 Subject: [Python-checkins] r73586 - in python/branches/release31-maint: Lib/lib2to3 Message-ID: Author: benjamin.peterson Date: Sun Jun 28 00:18:44 2009 New Revision: 73586 Log: remove svnmerge properties Modified: python/branches/release31-maint/ (props changed) python/branches/release31-maint/Lib/lib2to3/ (props changed) From python-checkins at python.org Sun Jun 28 00:37:45 2009 From: python-checkins at python.org (benjamin.peterson) Date: Sat, 27 Jun 2009 22:37:45 -0000 Subject: [Python-checkins] r73587 - python/branches/release31-maint Message-ID: Author: benjamin.peterson Date: Sun Jun 28 00:37:40 2009 New Revision: 73587 Log: Initialized merge tracking via "svnmerge" with revisions "1-73579" from svn+ssh://pythondev at svn.python.org/python/branches/py3k Modified: python/branches/release31-maint/ (props changed) From python-checkins at python.org Sun Jun 28 00:42:55 2009 From: python-checkins at python.org (benjamin.peterson) Date: Sat, 27 Jun 2009 22:42:55 -0000 Subject: [Python-checkins] r73588 - python/branches/release31-maint Message-ID: Author: benjamin.peterson Date: Sun Jun 28 00:42:54 2009 New Revision: 73588 Log: Blocked revisions 73580-73582 via svnmerge ........ r73580 | benjamin.peterson | 2009-06-27 16:40:27 -0500 (Sat, 27 Jun 2009) | 1 line bump to 3.2a0 ........ r73581 | benjamin.peterson | 2009-06-27 17:00:01 -0500 (Sat, 27 Jun 2009) | 1 line fix mistake in version bump ........ r73582 | benjamin.peterson | 2009-06-27 17:00:30 -0500 (Sat, 27 Jun 2009) | 1 line update install dir version ........ Modified: python/branches/release31-maint/ (props changed) From python-checkins at python.org Sun Jun 28 00:44:09 2009 From: python-checkins at python.org (benjamin.peterson) Date: Sat, 27 Jun 2009 22:44:09 -0000 Subject: [Python-checkins] r73589 - in python/branches/release31-maint: Doc/tools/sphinxext/indexsidebar.html Message-ID: Author: benjamin.peterson Date: Sun Jun 28 00:44:09 2009 New Revision: 73589 Log: Merged revisions 73585 via svnmerge from svn+ssh://pythondev at svn.python.org/python/branches/py3k ................ r73585 | benjamin.peterson | 2009-06-27 17:15:41 -0500 (Sat, 27 Jun 2009) | 9 lines Merged revisions 73575 via svnmerge from svn+ssh://pythondev at svn.python.org/python/trunk ........ r73575 | benjamin.peterson | 2009-06-26 11:49:06 -0500 (Fri, 26 Jun 2009) | 1 line mark 3.1 as stable docs ........ ................ Modified: python/branches/release31-maint/ (props changed) python/branches/release31-maint/Doc/tools/sphinxext/indexsidebar.html Modified: python/branches/release31-maint/Doc/tools/sphinxext/indexsidebar.html ============================================================================== --- python/branches/release31-maint/Doc/tools/sphinxext/indexsidebar.html (original) +++ python/branches/release31-maint/Doc/tools/sphinxext/indexsidebar.html Sun Jun 28 00:44:09 2009 @@ -3,8 +3,9 @@

Docs for other versions

From python-checkins at python.org Sun Jun 28 00:51:58 2009 From: python-checkins at python.org (martin.v.loewis) Date: Sat, 27 Jun 2009 22:51:58 -0000 Subject: [Python-checkins] r73590 - python/branches/py3k/Tools/msi/uuids.py Message-ID: Author: martin.v.loewis Date: Sun Jun 28 00:51:58 2009 New Revision: 73590 Log: Add uuids for 3.1.[12](rc1|final). Modified: python/branches/py3k/Tools/msi/uuids.py Modified: python/branches/py3k/Tools/msi/uuids.py ============================================================================== --- python/branches/py3k/Tools/msi/uuids.py (original) +++ python/branches/py3k/Tools/msi/uuids.py Sun Jun 28 00:51:58 2009 @@ -73,4 +73,8 @@ '3.1.121': '{da2b5170-12f3-4d99-8a1f-54926cca7acd}', # 3.1c1 '3.1.122': '{bceb5133-e2ee-4109-951f-ac7e941a1692}', # 3.1c2 '3.1.150': '{3ad61ee5-81d2-4d7e-adef-da1dd37277d1}', # 3.1.0 + '3.1.1121':'{5782f957-6d49-41d4-bad0-668715dfd638}', # 3.1.1c1 + '3.1.1150':'{7ff90460-89b7-435b-b583-b37b2815ccc7}', # 3.1.1 + '3.1.2121':'{ec45624a-378c-43be-91f3-3f7a59b0d90c}', # 3.1.2c1 + '3.1.2150':'{d40af016-506c-43fb-a738-bd54fa8c1e85}', # 3.1.2 } From python-checkins at python.org Sun Jun 28 00:54:20 2009 From: python-checkins at python.org (martin.v.loewis) Date: Sat, 27 Jun 2009 22:54:20 -0000 Subject: [Python-checkins] r73591 - in python/branches/release31-maint: Tools/msi/uuids.py Message-ID: Author: martin.v.loewis Date: Sun Jun 28 00:54:20 2009 New Revision: 73591 Log: Merged revisions 73590 via svnmerge from svn+ssh://pythondev at svn.python.org/python/branches/py3k ........ r73590 | martin.v.loewis | 2009-06-28 00:51:58 +0200 (So, 28 Jun 2009) | 2 lines Add uuids for 3.1.[12](rc1|final). ........ Modified: python/branches/release31-maint/ (props changed) python/branches/release31-maint/Tools/msi/uuids.py Modified: python/branches/release31-maint/Tools/msi/uuids.py ============================================================================== --- python/branches/release31-maint/Tools/msi/uuids.py (original) +++ python/branches/release31-maint/Tools/msi/uuids.py Sun Jun 28 00:54:20 2009 @@ -73,4 +73,8 @@ '3.1.121': '{da2b5170-12f3-4d99-8a1f-54926cca7acd}', # 3.1c1 '3.1.122': '{bceb5133-e2ee-4109-951f-ac7e941a1692}', # 3.1c2 '3.1.150': '{3ad61ee5-81d2-4d7e-adef-da1dd37277d1}', # 3.1.0 + '3.1.1121':'{5782f957-6d49-41d4-bad0-668715dfd638}', # 3.1.1c1 + '3.1.1150':'{7ff90460-89b7-435b-b583-b37b2815ccc7}', # 3.1.1 + '3.1.2121':'{ec45624a-378c-43be-91f3-3f7a59b0d90c}', # 3.1.2c1 + '3.1.2150':'{d40af016-506c-43fb-a738-bd54fa8c1e85}', # 3.1.2 } From python-checkins at python.org Sun Jun 28 00:58:15 2009 From: python-checkins at python.org (ezio.melotti) Date: Sat, 27 Jun 2009 22:58:15 -0000 Subject: [Python-checkins] r73592 - python/branches/py3k/Doc/library/html.parser.rst Message-ID: Author: ezio.melotti Date: Sun Jun 28 00:58:15 2009 New Revision: 73592 Log: Updated the last example as requested in #6350 Modified: python/branches/py3k/Doc/library/html.parser.rst Modified: python/branches/py3k/Doc/library/html.parser.rst ============================================================================== --- python/branches/py3k/Doc/library/html.parser.rst (original) +++ python/branches/py3k/Doc/library/html.parser.rst Sun Jun 28 00:58:15 2009 @@ -163,13 +163,23 @@ As a basic example, below is a very basic HTML parser that uses the :class:`HTMLParser` class to print out tags as they are encountered:: - from html.parser import HTMLParser + >>> from html.parser import HTMLParser + >>> + >>> class MyHTMLParser(HTMLParser): + ... def handle_starttag(self, tag, attrs): + ... print("Encountered a {} start tag".format(tag)) + ... def handle_endtag(self, tag): + ... print("Encountered a {} end tag".format(tag)) + ... + >>> page = """

Title

I'm a paragraph!

""" + >>> + >>> myparser = MyHTMLParser() + >>> myparser.feed(page) + Encountered a html start tag + Encountered a h1 start tag + Encountered a h1 end tag + Encountered a p start tag + Encountered a p end tag + Encountered a html end tag - class MyHTMLParser(HTMLParser): - - def handle_starttag(self, tag, attrs): - print "Encountered the beginning of a %s tag" % tag - - def handle_endtag(self, tag): - print "Encountered the end of a %s tag" % tag From python-checkins at python.org Sun Jun 28 01:00:59 2009 From: python-checkins at python.org (martin.v.loewis) Date: Sat, 27 Jun 2009 23:00:59 -0000 Subject: [Python-checkins] r73593 - in python/branches/py3k: PC/VC6/pythoncore.dsp PC/VC6/readme.txt PC/VS7.1/pythoncore.vcproj PC/VS8.0/build_ssl.bat PC/VS8.0/kill_python.c PC/VS8.0/pyproject.vsprops PC/pyconfig.h PCbuild/kill_python.c PCbuild/pyproject.vsprops PCbuild/readme.txt Message-ID: Author: martin.v.loewis Date: Sun Jun 28 01:00:59 2009 New Revision: 73593 Log: Bump Windows versions to 3.2. Modified: python/branches/py3k/PC/VC6/pythoncore.dsp python/branches/py3k/PC/VC6/readme.txt python/branches/py3k/PC/VS7.1/pythoncore.vcproj python/branches/py3k/PC/VS8.0/build_ssl.bat python/branches/py3k/PC/VS8.0/kill_python.c python/branches/py3k/PC/VS8.0/pyproject.vsprops python/branches/py3k/PC/pyconfig.h python/branches/py3k/PCbuild/kill_python.c python/branches/py3k/PCbuild/pyproject.vsprops python/branches/py3k/PCbuild/readme.txt Modified: python/branches/py3k/PC/VC6/pythoncore.dsp ============================================================================== --- python/branches/py3k/PC/VC6/pythoncore.dsp (original) +++ python/branches/py3k/PC/VC6/pythoncore.dsp Sun Jun 28 01:00:59 2009 @@ -54,7 +54,7 @@ # ADD BSC32 /nologo LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386 -# ADD LINK32 largeint.lib kernel32.lib user32.lib advapi32.lib shell32.lib /nologo /base:"0x1e000000" /subsystem:windows /dll /debug /machine:I386 /nodefaultlib:"libc" /out:"./python31.dll" +# ADD LINK32 largeint.lib kernel32.lib user32.lib advapi32.lib shell32.lib /nologo /base:"0x1e000000" /subsystem:windows /dll /debug /machine:I386 /nodefaultlib:"libc" /out:"./python32.dll" # SUBTRACT LINK32 /pdb:none !ELSEIF "$(CFG)" == "pythoncore - Win32 Debug" @@ -82,7 +82,7 @@ # ADD BSC32 /nologo LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /debug /machine:I386 /pdbtype:sept -# ADD LINK32 largeint.lib kernel32.lib user32.lib advapi32.lib shell32.lib /nologo /base:"0x1e000000" /subsystem:windows /dll /debug /machine:I386 /nodefaultlib:"libc" /out:"./python31_d.dll" /pdbtype:sept +# ADD LINK32 largeint.lib kernel32.lib user32.lib advapi32.lib shell32.lib /nologo /base:"0x1e000000" /subsystem:windows /dll /debug /machine:I386 /nodefaultlib:"libc" /out:"./python32_d.dll" /pdbtype:sept # SUBTRACT LINK32 /pdb:none !ENDIF Modified: python/branches/py3k/PC/VC6/readme.txt ============================================================================== --- python/branches/py3k/PC/VC6/readme.txt (original) +++ python/branches/py3k/PC/VC6/readme.txt Sun Jun 28 01:00:59 2009 @@ -13,7 +13,7 @@ The proper order to build subprojects: 1) pythoncore (this builds the main Python DLL and library files, - python31.{dll, lib} in Release mode) + python32.{dll, lib} in Release mode) 2) python (this builds the main Python executable, python.exe in Release mode) @@ -24,7 +24,7 @@ to the subsystems they implement; see SUBPROJECTS below) When using the Debug setting, the output files have a _d added to -their name: python31_d.dll, python_d.exe, pyexpat_d.pyd, and so on. +their name: python32_d.dll, python_d.exe, pyexpat_d.pyd, and so on. SUBPROJECTS ----------- Modified: python/branches/py3k/PC/VS7.1/pythoncore.vcproj ============================================================================== --- python/branches/py3k/PC/VS7.1/pythoncore.vcproj (original) +++ python/branches/py3k/PC/VS7.1/pythoncore.vcproj Sun Jun 28 01:00:59 2009 @@ -39,15 +39,15 @@ @@ -99,15 +99,15 @@ @@ -166,15 +166,15 @@ Name="VCLinkerTool" AdditionalOptions=" /MACHINE:IA64 /USELINK:MS_SDK" AdditionalDependencies="getbuildinfo.o" - OutputFile="./python31.dll" + OutputFile="./python32.dll" LinkIncremental="1" SuppressStartupBanner="FALSE" IgnoreDefaultLibraryNames="libc" GenerateDebugInformation="TRUE" - ProgramDatabaseFile=".\./python31.pdb" + ProgramDatabaseFile=".\./python32.pdb" SubSystem="2" BaseAddress="0x1e000000" - ImportLibrary=".\./python31.lib" + ImportLibrary=".\./python32.lib" TargetMachine="0"/> @@ -233,15 +233,15 @@ Name="VCLinkerTool" AdditionalOptions=" /MACHINE:AMD64 /USELINK:MS_SDK" AdditionalDependencies="getbuildinfo.o" - OutputFile="./python31.dll" + OutputFile="./python32.dll" LinkIncremental="1" SuppressStartupBanner="TRUE" IgnoreDefaultLibraryNames="libc" GenerateDebugInformation="TRUE" - ProgramDatabaseFile=".\./python31.pdb" + ProgramDatabaseFile=".\./python32.pdb" SubSystem="2" BaseAddress="0x1e000000" - ImportLibrary=".\./python31.lib" + ImportLibrary=".\./python32.lib" TargetMachine="0"/> Modified: python/branches/py3k/PC/VS8.0/build_ssl.bat ============================================================================== --- python/branches/py3k/PC/VS8.0/build_ssl.bat (original) +++ python/branches/py3k/PC/VS8.0/build_ssl.bat Sun Jun 28 01:00:59 2009 @@ -2,10 +2,10 @@ if not defined HOST_PYTHON ( if %1 EQU Debug ( set HOST_PYTHON=python_d.exe - if not exist python31_d.dll exit 1 + if not exist python32_d.dll exit 1 ) ELSE ( set HOST_PYTHON=python.exe - if not exist python31.dll exit 1 + if not exist python32.dll exit 1 ) ) %HOST_PYTHON% build_ssl.py %1 %2 %3 Modified: python/branches/py3k/PC/VS8.0/kill_python.c ============================================================================== --- python/branches/py3k/PC/VS8.0/kill_python.c (original) +++ python/branches/py3k/PC/VS8.0/kill_python.c Sun Jun 28 01:00:59 2009 @@ -106,7 +106,7 @@ /* * XXX TODO: if we really wanted to be fancy, we could check the * modules for all processes (not just the python[_d].exe ones) - * and see if any of our DLLs are loaded (i.e. python31[_d].dll), + * and see if any of our DLLs are loaded (i.e. python32[_d].dll), * as that would also inhibit our ability to rebuild the solution. * Not worth loosing sleep over though; for now, a simple check * for just the python executable should be sufficient. Modified: python/branches/py3k/PC/VS8.0/pyproject.vsprops ============================================================================== --- python/branches/py3k/PC/VS8.0/pyproject.vsprops (original) +++ python/branches/py3k/PC/VS8.0/pyproject.vsprops Sun Jun 28 01:00:59 2009 @@ -38,7 +38,7 @@ /> Author: benjamin.peterson Date: Sun Jun 28 01:45:02 2009 New Revision: 73594 Log: Merged revisions 72570,72582-72583,73027,73049,73071,73151,73247 via svnmerge from svn+ssh://pythondev at svn.python.org/python/trunk ........ r72570 | michael.foord | 2009-05-11 12:59:43 -0500 (Mon, 11 May 2009) | 7 lines Adds a verbosity keyword argument to unittest.main plus a minor fix allowing you to specify test modules / classes from the command line. Closes issue 5995. Michael Foord ........ r72582 | michael.foord | 2009-05-12 05:46:23 -0500 (Tue, 12 May 2009) | 1 line Fix to restore command line behaviour for test modules using unittest.main(). Regression caused by issue 5995. Michael ........ r72583 | michael.foord | 2009-05-12 05:49:13 -0500 (Tue, 12 May 2009) | 1 line Better fix for modules using unittest.main(). Fixes regression caused by commit for issue 5995. Michael Foord ........ r73027 | michael.foord | 2009-05-29 15:33:46 -0500 (Fri, 29 May 2009) | 1 line Add test discovery to unittest. Issue 6001. ........ r73049 | georg.brandl | 2009-05-30 05:45:40 -0500 (Sat, 30 May 2009) | 1 line Rewrap a few long lines. ........ r73071 | georg.brandl | 2009-05-31 09:15:25 -0500 (Sun, 31 May 2009) | 1 line Fix markup. ........ r73151 | michael.foord | 2009-06-02 13:08:27 -0500 (Tue, 02 Jun 2009) | 1 line Restore default testRunner argument in unittest.main to None. Issue 6177 ........ r73247 | michael.foord | 2009-06-05 09:14:34 -0500 (Fri, 05 Jun 2009) | 1 line Fix unittest discovery tests for Windows. Issue 6199 ........ Modified: python/branches/py3k/ (props changed) python/branches/py3k/Doc/library/unittest.rst python/branches/py3k/Lib/test/test_unittest.py python/branches/py3k/Lib/unittest.py Modified: python/branches/py3k/Doc/library/unittest.rst ============================================================================== --- python/branches/py3k/Doc/library/unittest.rst (original) +++ python/branches/py3k/Doc/library/unittest.rst Sun Jun 28 01:45:02 2009 @@ -78,15 +78,82 @@ Another test-support module with a very different flavor. `Simple Smalltalk Testing: With Patterns `_ - Kent Beck's original paper on testing frameworks using the pattern shared by - :mod:`unittest`. + Kent Beck's original paper on testing frameworks using the pattern shared + by :mod:`unittest`. `Nose `_ and `py.test `_ - Third-party unittest frameworks with a lighter-weight syntax - for writing tests. For example, ``assert func(10) == 42``. + Third-party unittest frameworks with a lighter-weight syntax for writing + tests. For example, ``assert func(10) == 42``. `python-mock `_ and `minimock `_ - Tools for creating mock test objects (objects simulating external resources). + Tools for creating mock test objects (objects simulating external + resources). + + +.. _unittest-command-line-interface: + +Command Line Interface +---------------------- + +The unittest module can be used from the command line to run tests from +modules, classes or even individual test methods:: + + python -m unittest test_module1 test_module2 + python -m unittest test_module.TestClass + python -m unittest test_module.TestClass.test_method + +You can pass in a list with any combination of module names, and fully +qualified class or method names. + +You can run tests with more detail (higher verbosity) by passing in the -v flag:: + + python-m unittest -v test_module + +For a list of all the command line options:: + + python -m unittest -h + +.. versionchanged:: 2.7 + In earlier versions it was only possible to run individual test methods and + not modules or classes. + +The command line can also be used for test discovery, for running all of the +tests in a project or just a subset. + + +.. _unittest-test-discovery: + +Test Discovery +-------------- + +.. versionadded:: 2.7 + +unittest supports simple test discovery. For a project's tests to be +compatible with test discovery they must all be importable from the top level +directory of the project; i.e. they must all be in Python packages. + +Test discovery is implemented in :meth:`TestLoader.discover`, but can also be +used from the command line. The basic command line usage is:: + + cd project_directory + python -m unittest discover + +The ``discover`` sub-command has the following options: + + -v, --verbose Verbose output + -s directory Directory to start discovery ('.' default) + -p pattern Pattern to match test files ('test*.py' default) + -t directory Top level directory of project (default to + start directory) + +The -s, -p, & -t options can be passsed in as positional arguments. The +following two command lines are equivalent:: + + python -m unittest -s project_directory -p '*_test.py' + python -m unittest project_directory '*_test.py' + +Test modules and packages can customize test loading and discovery by through +the `load_tests protocol`_. .. _unittest-minimal-example: @@ -175,7 +242,6 @@ are sufficient to meet many everyday testing needs. The remainder of the documentation explores the full feature set from first principles. - .. _organizing-tests: Organizing test code @@ -206,13 +272,12 @@ self.assertEqual(widget.size(), (50, 50), 'incorrect default size') Note that in order to test something, we use the one of the :meth:`assert\*` -methods provided by the :class:`TestCase` base class. If the -test fails, an exception will be raised, and :mod:`unittest` will identify the -test case as a :dfn:`failure`. Any other exceptions will be treated as -:dfn:`errors`. This helps you identify where the problem is: :dfn:`failures` are -caused by incorrect results - a 5 where you expected a 6. :dfn:`Errors` are -caused by incorrect code - e.g., a :exc:`TypeError` caused by an incorrect -function call. +methods provided by the :class:`TestCase` base class. If the test fails, an +exception will be raised, and :mod:`unittest` will identify the test case as a +:dfn:`failure`. Any other exceptions will be treated as :dfn:`errors`. This +helps you identify where the problem is: :dfn:`failures` are caused by incorrect +results - a 5 where you expected a 6. :dfn:`Errors` are caused by incorrect +code - e.g., a :exc:`TypeError` caused by an incorrect function call. The way to run a test case will be described later. For now, note that to construct an instance of such a test case, we call its constructor without @@ -412,10 +477,10 @@ .. note:: - Even though :class:`FunctionTestCase` can be used to quickly convert an existing - test base over to a :mod:`unittest`\ -based system, this approach is not - recommended. Taking the time to set up proper :class:`TestCase` subclasses will - make future test refactorings infinitely easier. + Even though :class:`FunctionTestCase` can be used to quickly convert an + existing test base over to a :mod:`unittest`\ -based system, this approach is + not recommended. Taking the time to set up proper :class:`TestCase` + subclasses will make future test refactorings infinitely easier. In some cases, the existing tests may have been written using the :mod:`doctest` module. If so, :mod:`doctest` provides a :class:`DocTestSuite` class that can @@ -444,7 +509,8 @@ def test_nothing(self): self.fail("shouldn't happen") - @unittest.skipIf(mylib.__version__ < (1, 3), "not supported in this library version") + @unittest.skipIf(mylib.__version__ < (1, 3), + "not supported in this library version") def test_format(self): # Tests that work for only a certain version of the library. pass @@ -1009,10 +1075,10 @@ .. class:: FunctionTestCase(testFunc[, setUp[, tearDown[, description]]]) This class implements the portion of the :class:`TestCase` interface which - allows the test runner to drive the test, but does not provide the methods which - test code can use to check and report errors. This is used to create test cases - using legacy test code, allowing it to be integrated into a :mod:`unittest`\ - -based test framework. + allows the test runner to drive the test, but does not provide the methods + which test code can use to check and report errors. This is used to create + test cases using legacy test code, allowing it to be integrated into a + :mod:`unittest`-based test framework. .. _testsuite-objects: @@ -1047,8 +1113,8 @@ Add all the tests from an iterable of :class:`TestCase` and :class:`TestSuite` instances to this test suite. - This is equivalent to iterating over *tests*, calling :meth:`addTest` for each - element. + This is equivalent to iterating over *tests*, calling :meth:`addTest` for + each element. :class:`TestSuite` shares the following methods with :class:`TestCase`: @@ -1126,6 +1192,13 @@ directly does not play well with this method. Doing so, however, can be useful when the fixtures are different and defined in subclasses. + If a module provides a ``load_tests`` function it will be called to + load the tests. This allows modules to customize test loading. + This is the `load_tests protocol`_. + + .. versionchanged:: 2.7 + Support for ``load_tests`` added. + .. method:: loadTestsFromName(name[, module]) @@ -1142,12 +1215,12 @@ For example, if you have a module :mod:`SampleTests` containing a :class:`TestCase`\ -derived class :class:`SampleTestCase` with three test methods (:meth:`test_one`, :meth:`test_two`, and :meth:`test_three`), the - specifier ``'SampleTests.SampleTestCase'`` would cause this method to return a - suite which will run all three test methods. Using the specifier - ``'SampleTests.SampleTestCase.test_two'`` would cause it to return a test suite - which will run only the :meth:`test_two` test method. The specifier can refer - to modules and packages which have not been imported; they will be imported as a - side-effect. + specifier ``'SampleTests.SampleTestCase'`` would cause this method to + return a suite which will run all three test methods. Using the specifier + ``'SampleTests.SampleTestCase.test_two'`` would cause it to return a test + suite which will run only the :meth:`test_two` test method. The specifier + can refer to modules and packages which have not been imported; they will + be imported as a side-effect. The method optionally resolves *name* relative to the given *module*. @@ -1164,6 +1237,31 @@ Return a sorted sequence of method names found within *testCaseClass*; this should be a subclass of :class:`TestCase`. + + .. method:: discover(start_dir, pattern='test*.py', top_level_dir=None) + + Find and return all test modules from the specified start directory, + recursing into subdirectories to find them. Only test files that match + *pattern* will be loaded. (Using shell style pattern matching.) + + All test modules must be importable from the top level of the project. If + the start directory is not the top level directory then the top level + directory must be specified separately. + + If a test package name (directory with :file:`__init__.py`) matches the + pattern then the package will be checked for a ``load_tests`` + function. If this exists then it will be called with *loader*, *tests*, + *pattern*. + + If load_tests exists then discovery does *not* recurse into the package, + ``load_tests`` is responsible for loading all tests in the package. + + The pattern is deliberately not stored as a loader attribute so that + packages can continue discovery themselves. *top_level_dir* is stored so + ``load_tests`` does not need to pass this argument in to + ``loader.discover()``. + + The following attributes of a :class:`TestLoader` can be configured either by subclassing or assignment on an instance: @@ -1319,8 +1417,8 @@ .. method:: addFailure(test, err) - Called when the test case *test* signals a failure. *err* is a tuple of the form - returned by :func:`sys.exc_info`: ``(type, value, traceback)``. + Called when the test case *test* signals a failure. *err* is a tuple of + the form returned by :func:`sys.exc_info`: ``(type, value, traceback)``. The default implementation appends a tuple ``(test, formatted_err)`` to the instance's :attr:`failures` attribute, where *formatted_err* is a @@ -1382,7 +1480,7 @@ subclasses to provide a custom ``TestResult``. -.. function:: main([module[, defaultTest[, argv[, testRunner[, testLoader[, exit]]]]]]) +.. function:: main([module[, defaultTest[, argv[, testRunner[, testLoader[, exit, [verbosity]]]]]]]) A command-line program that runs a set of tests; this is primarily for making test modules conveniently executable. The simplest use for this function is to @@ -1391,6 +1489,12 @@ if __name__ == '__main__': unittest.main() + You can run tests with more detailed information by passing in the verbosity + argument:: + + if __name__ == '__main__': + unittest.main(verbosity=2) + The *testRunner* argument can either be a test runner class or an already created instance of it. By default ``main`` calls :func:`sys.exit` with an exit code indicating success or failure of the tests run. @@ -1406,4 +1510,69 @@ This stores the result of the tests run as the ``result`` attribute. .. versionchanged:: 2.7 - The ``exit`` parameter was added. + The ``exit`` and ``verbosity`` parameters were added. + + +load_tests Protocol +################### + +Modules or packages can customize how tests are loaded from them during normal +test runs or test discovery by implementing a function called ``load_tests``. + +If a test module defines ``load_tests`` it will be called by +:meth:`TestLoader.loadTestsFromModule` with the following arguments:: + + load_tests(loader, standard_tests, None) + +It should return a :class:`TestSuite`. + +*loader* is the instance of :class:`TestLoader` doing the loading. +*standard_tests* are the tests that would be loaded by default from the +module. It is common for test modules to only want to add or remove tests +from the standard set of tests. +The third argument is used when loading packages as part of test discovery. + +A typical ``load_tests`` function that loads tests from a specific set of +:class:`TestCase` classes may look like:: + + test_cases = (TestCase1, TestCase2, TestCase3) + + def load_tests(loader, tests, pattern): + suite = TestSuite() + for test_class in test_cases: + tests = loader.loadTestsFromTestCase(test_class) + suite.addTests(tests) + return suite + +If discovery is started, either from the command line or by calling +:meth:`TestLoader.discover`, with a pattern that matches a package +name then the package :file:`__init__.py` will be checked for ``load_tests``. + +.. note:: + + The default pattern is 'test*.py'. This matches all python files + that start with 'test' but *won't* match any test directories. + + A pattern like 'test*' will match test packages as well as + modules. + +If the package :file:`__init__.py` defines ``load_tests`` then it will be +called and discovery not continued into the package. ``load_tests`` +is called with the following arguments:: + + load_tests(loader, standard_tests, pattern) + +This should return a :class:`TestSuite` representing all the tests +from the package. (``standard_tests`` will only contain tests +collected from :file:`__init__.py`.) + +Because the pattern is passed into ``load_tests`` the package is free to +continue (and potentially modify) test discovery. A 'do nothing' +``load_tests`` function for a test package would look like:: + + def load_tests(loader, standard_tests, pattern): + # top level directory cached on loader instance + this_dir = os.path.dirname(__file__) + package_tests = loader.discover(start_dir=this_dir, pattern=pattern) + standard_tests.addTests(package_tests) + return standard_tests Modified: python/branches/py3k/Lib/test/test_unittest.py ============================================================================== --- python/branches/py3k/Lib/test/test_unittest.py (original) +++ python/branches/py3k/Lib/test/test_unittest.py Sun Jun 28 01:45:02 2009 @@ -6,7 +6,9 @@ TestCase.{assert,fail}* methods (some are tested implicitly) """ +import os import re +import sys from test import support import unittest from unittest import TestCase, TestProgram @@ -255,6 +257,30 @@ reference = [unittest.TestSuite([MyTestCase('test')])] self.assertEqual(list(suite), reference) + + # Check that loadTestsFromModule honors (or not) a module + # with a load_tests function. + def test_loadTestsFromModule__load_tests(self): + m = types.ModuleType('m') + class MyTestCase(unittest.TestCase): + def test(self): + pass + m.testcase_1 = MyTestCase + + load_tests_args = [] + def load_tests(loader, tests, pattern): + load_tests_args.extend((loader, tests, pattern)) + return tests + m.load_tests = load_tests + + loader = unittest.TestLoader() + suite = loader.loadTestsFromModule(m) + self.assertEquals(load_tests_args, [loader, suite, None]) + + load_tests_args = [] + suite = loader.loadTestsFromModule(m, use_load_tests=False) + self.assertEquals(load_tests_args, []) + ################################################################ ### /Tests for TestLoader.loadTestsFromModule() @@ -3252,19 +3278,30 @@ runner = FakeRunner() - try: - oldParseArgs = TestProgram.parseArgs - TestProgram.parseArgs = lambda *args: None - TestProgram.test = test + oldParseArgs = TestProgram.parseArgs + def restoreParseArgs(): + TestProgram.parseArgs = oldParseArgs + TestProgram.parseArgs = lambda *args: None + self.addCleanup(restoreParseArgs) - program = TestProgram(testRunner=runner, exit=False) + def removeTest(): + del TestProgram.test + TestProgram.test = test + self.addCleanup(removeTest) - self.assertEqual(program.result, result) - self.assertEqual(runner.test, test) + program = TestProgram(testRunner=runner, exit=False, verbosity=2) - finally: - TestProgram.parseArgs = oldParseArgs - del TestProgram.test + self.assertEqual(program.result, result) + self.assertEqual(runner.test, test) + self.assertEqual(program.verbosity, 2) + + + def testTestProgram_testRunnerArgument(self): + program = object.__new__(TestProgram) + program.parseArgs = lambda _: None + program.runTests = lambda: None + program.__init__(testRunner=None) + self.assertEqual(program.testRunner, unittest.TextTestRunner) class FooBar(unittest.TestCase): @@ -3347,6 +3384,277 @@ self.assertEqual(events, expected) +class TestDiscovery(TestCase): + + # Heavily mocked tests so I can avoid hitting the filesystem + def test_get_module_from_path(self): + loader = unittest.TestLoader() + + def restore_import(): + unittest.__import__ = __import__ + unittest.__import__ = lambda *_: None + self.addCleanup(restore_import) + + expected_module = object() + def del_module(): + del sys.modules['bar.baz'] + sys.modules['bar.baz'] = expected_module + self.addCleanup(del_module) + + loader._top_level_dir = '/foo' + module = loader._get_module_from_path('/foo/bar/baz.py') + self.assertEqual(module, expected_module) + + if not __debug__: + # asserts are off + return + + with self.assertRaises(AssertionError): + loader._get_module_from_path('/bar/baz.py') + + def test_find_tests(self): + loader = unittest.TestLoader() + + original_listdir = os.listdir + def restore_listdir(): + os.listdir = original_listdir + original_isfile = os.path.isfile + def restore_isfile(): + os.path.isfile = original_isfile + original_isdir = os.path.isdir + def restore_isdir(): + os.path.isdir = original_isdir + + path_lists = [['test1.py', 'test2.py', 'not_a_test.py', 'test_dir', + 'test.foo', 'another_dir'], + ['test3.py', 'test4.py', ]] + os.listdir = lambda path: path_lists.pop(0) + self.addCleanup(restore_listdir) + + def isdir(path): + return path.endswith('dir') + os.path.isdir = isdir + self.addCleanup(restore_isdir) + + def isfile(path): + # another_dir is not a package and so shouldn't be recursed into + return not path.endswith('dir') and not 'another_dir' in path + os.path.isfile = isfile + self.addCleanup(restore_isfile) + + loader._get_module_from_path = lambda path: path + ' module' + loader.loadTestsFromModule = lambda module: module + ' tests' + + loader._top_level_dir = '/foo' + suite = list(loader._find_tests('/foo', 'test*.py')) + + expected = [os.path.join('/foo', name) + ' module tests' for name in + ('test1.py', 'test2.py')] + expected.extend([os.path.join('/foo', 'test_dir', name) + ' module tests' for name in + ('test3.py', 'test4.py')]) + self.assertEqual(suite, expected) + + def test_find_tests_with_package(self): + loader = unittest.TestLoader() + + original_listdir = os.listdir + def restore_listdir(): + os.listdir = original_listdir + original_isfile = os.path.isfile + def restore_isfile(): + os.path.isfile = original_isfile + original_isdir = os.path.isdir + def restore_isdir(): + os.path.isdir = original_isdir + + directories = ['a_directory', 'test_directory', 'test_directory2'] + path_lists = [directories, [], [], []] + os.listdir = lambda path: path_lists.pop(0) + self.addCleanup(restore_listdir) + + os.path.isdir = lambda path: True + self.addCleanup(restore_isdir) + + os.path.isfile = lambda path: os.path.basename(path) not in directories + self.addCleanup(restore_isfile) + + class Module(object): + paths = [] + load_tests_args = [] + + def __init__(self, path): + self.path = path + self.paths.append(path) + if os.path.basename(path) == 'test_directory': + def load_tests(loader, tests, pattern): + self.load_tests_args.append((loader, tests, pattern)) + return 'load_tests' + self.load_tests = load_tests + + def __eq__(self, other): + return self.path == other.path + + loader._get_module_from_path = lambda path: Module(path) + def loadTestsFromModule(module, use_load_tests): + if use_load_tests: + raise self.failureException('use_load_tests should be False for packages') + return module.path + ' module tests' + loader.loadTestsFromModule = loadTestsFromModule + + loader._top_level_dir = '/foo' + # this time no '.py' on the pattern so that it can match + # a test package + suite = list(loader._find_tests('/foo', 'test*')) + + # We should have loaded tests from the test_directory package by calling load_tests + # and directly from the test_directory2 package + self.assertEqual(suite, + ['load_tests', + os.path.join('/foo', 'test_directory2') + ' module tests']) + self.assertEqual(Module.paths, [os.path.join('/foo', 'test_directory'), + os.path.join('/foo', 'test_directory2')]) + + # load_tests should have been called once with loader, tests and pattern + self.assertEqual(Module.load_tests_args, + [(loader, os.path.join('/foo', 'test_directory') + ' module tests', + 'test*')]) + + def test_discover(self): + loader = unittest.TestLoader() + + original_isfile = os.path.isfile + def restore_isfile(): + os.path.isfile = original_isfile + + os.path.isfile = lambda path: False + self.addCleanup(restore_isfile) + + full_path = os.path.abspath(os.path.normpath('/foo')) + def clean_path(): + if sys.path[-1] == full_path: + sys.path.pop(-1) + self.addCleanup(clean_path) + + with self.assertRaises(ImportError): + loader.discover('/foo/bar', top_level_dir='/foo') + + self.assertEqual(loader._top_level_dir, full_path) + self.assertIn(full_path, sys.path) + + os.path.isfile = lambda path: True + _find_tests_args = [] + def _find_tests(start_dir, pattern): + _find_tests_args.append((start_dir, pattern)) + return ['tests'] + loader._find_tests = _find_tests + loader.suiteClass = str + + suite = loader.discover('/foo/bar/baz', 'pattern', '/foo/bar') + + top_level_dir = os.path.abspath(os.path.normpath('/foo/bar')) + start_dir = os.path.abspath(os.path.normpath('/foo/bar/baz')) + self.assertEqual(suite, "['tests']") + self.assertEqual(loader._top_level_dir, top_level_dir) + self.assertEqual(_find_tests_args, [(start_dir, 'pattern')]) + + def test_command_line_handling_parseArgs(self): + # Haha - take that uninstantiable class + program = object.__new__(TestProgram) + + args = [] + def do_discovery(argv): + args.extend(argv) + program._do_discovery = do_discovery + program.parseArgs(['something', 'discover']) + self.assertEqual(args, []) + + program.parseArgs(['something', 'discover', 'foo', 'bar']) + self.assertEqual(args, ['foo', 'bar']) + + def test_command_line_handling_do_discovery_too_many_arguments(self): + class Stop(Exception): + pass + def usageExit(): + raise Stop + + program = object.__new__(TestProgram) + program.usageExit = usageExit + + with self.assertRaises(Stop): + # too many args + program._do_discovery(['one', 'two', 'three', 'four']) + + + def test_command_line_handling_do_discovery_calls_loader(self): + program = object.__new__(TestProgram) + + class Loader(object): + args = [] + def discover(self, start_dir, pattern, top_level_dir): + self.args.append((start_dir, pattern, top_level_dir)) + return 'tests' + + program._do_discovery(['-v'], Loader=Loader) + self.assertEqual(program.verbosity, 2) + self.assertEqual(program.test, 'tests') + self.assertEqual(Loader.args, [('.', 'test*.py', None)]) + + Loader.args = [] + program = object.__new__(TestProgram) + program._do_discovery(['--verbose'], Loader=Loader) + self.assertEqual(program.test, 'tests') + self.assertEqual(Loader.args, [('.', 'test*.py', None)]) + + Loader.args = [] + program = object.__new__(TestProgram) + program._do_discovery([], Loader=Loader) + self.assertEqual(program.test, 'tests') + self.assertEqual(Loader.args, [('.', 'test*.py', None)]) + + Loader.args = [] + program = object.__new__(TestProgram) + program._do_discovery(['fish'], Loader=Loader) + self.assertEqual(program.test, 'tests') + self.assertEqual(Loader.args, [('fish', 'test*.py', None)]) + + Loader.args = [] + program = object.__new__(TestProgram) + program._do_discovery(['fish', 'eggs'], Loader=Loader) + self.assertEqual(program.test, 'tests') + self.assertEqual(Loader.args, [('fish', 'eggs', None)]) + + Loader.args = [] + program = object.__new__(TestProgram) + program._do_discovery(['fish', 'eggs', 'ham'], Loader=Loader) + self.assertEqual(program.test, 'tests') + self.assertEqual(Loader.args, [('fish', 'eggs', 'ham')]) + + Loader.args = [] + program = object.__new__(TestProgram) + program._do_discovery(['-s', 'fish'], Loader=Loader) + self.assertEqual(program.test, 'tests') + self.assertEqual(Loader.args, [('fish', 'test*.py', None)]) + + Loader.args = [] + program = object.__new__(TestProgram) + program._do_discovery(['-t', 'fish'], Loader=Loader) + self.assertEqual(program.test, 'tests') + self.assertEqual(Loader.args, [('.', 'test*.py', 'fish')]) + + Loader.args = [] + program = object.__new__(TestProgram) + program._do_discovery(['-p', 'fish'], Loader=Loader) + self.assertEqual(program.test, 'tests') + self.assertEqual(Loader.args, [('.', 'fish', None)]) + + Loader.args = [] + program = object.__new__(TestProgram) + program._do_discovery(['-p', 'eggs', '-s', 'fish', '-v'], Loader=Loader) + self.assertEqual(program.test, 'tests') + self.assertEqual(Loader.args, [('fish', 'eggs', None)]) + self.assertEqual(program.verbosity, 2) + + ###################################################################### ## Main ###################################################################### @@ -3355,7 +3663,7 @@ support.run_unittest(Test_TestCase, Test_TestLoader, Test_TestSuite, Test_TestResult, Test_FunctionTestCase, Test_TestSkipping, Test_Assertions, TestLongMessage, - Test_TestProgram, TestCleanUp) + Test_TestProgram, TestCleanUp, TestDiscovery) if __name__ == "__main__": test_main() Modified: python/branches/py3k/Lib/unittest.py ============================================================================== --- python/branches/py3k/Lib/unittest.py (original) +++ python/branches/py3k/Lib/unittest.py Sun Jun 28 01:45:02 2009 @@ -56,6 +56,9 @@ import types import warnings +from fnmatch import fnmatch + + ############################################################################## # Exported classes and functions ############################################################################## @@ -1228,6 +1231,7 @@ testMethodPrefix = 'test' sortTestMethodsUsing = staticmethod(three_way_cmp) suiteClass = TestSuite + _top_level_dir = None def loadTestsFromTestCase(self, testCaseClass): """Return a suite of all tests cases contained in testCaseClass""" @@ -1240,13 +1244,17 @@ suite = self.suiteClass(map(testCaseClass, testCaseNames)) return suite - def loadTestsFromModule(self, module): + def loadTestsFromModule(self, module, use_load_tests=True): """Return a suite of all tests cases contained in the given module""" tests = [] for name in dir(module): obj = getattr(module, name) if isinstance(obj, type) and issubclass(obj, TestCase): tests.append(self.loadTestsFromTestCase(obj)) + + load_tests = getattr(module, 'load_tests', None) + if use_load_tests and load_tests is not None: + return load_tests(self, tests, None) return self.suiteClass(tests) def loadTestsFromName(self, name, module=None): @@ -1320,7 +1328,97 @@ testFnNames.sort(key=CmpToKey(self.sortTestMethodsUsing)) return testFnNames + def discover(self, start_dir, pattern='test*.py', top_level_dir=None): + """Find and return all test modules from the specified start + directory, recursing into subdirectories to find them. Only test files + that match the pattern will be loaded. (Using shell style pattern + matching.) + + All test modules must be importable from the top level of the project. + If the start directory is not the top level directory then the top + level directory must be specified separately. + + If a test package name (directory with '__init__.py') matches the + pattern then the package will be checked for a 'load_tests' function. If + this exists then it will be called with loader, tests, pattern. + + If load_tests exists then discovery does *not* recurse into the package, + load_tests is responsible for loading all tests in the package. + + The pattern is deliberately not stored as a loader attribute so that + packages can continue discovery themselves. top_level_dir is stored so + load_tests does not need to pass this argument in to loader.discover(). + """ + if top_level_dir is None and self._top_level_dir is not None: + # make top_level_dir optional if called from load_tests in a package + top_level_dir = self._top_level_dir + elif top_level_dir is None: + top_level_dir = start_dir + + top_level_dir = os.path.abspath(os.path.normpath(top_level_dir)) + start_dir = os.path.abspath(os.path.normpath(start_dir)) + + if not top_level_dir in sys.path: + # all test modules must be importable from the top level directory + sys.path.append(top_level_dir) + self._top_level_dir = top_level_dir + + if start_dir != top_level_dir and not os.path.isfile(os.path.join(start_dir, '__init__.py')): + # what about __init__.pyc or pyo (etc) + raise ImportError('Start directory is not importable: %r' % start_dir) + + tests = list(self._find_tests(start_dir, pattern)) + return self.suiteClass(tests) + + def _get_module_from_path(self, path): + """Load a module from a path relative to the top-level directory + of a project. Used by discovery.""" + path = os.path.splitext(os.path.normpath(path))[0] + + relpath = os.path.relpath(path, self._top_level_dir) + assert not os.path.isabs(relpath), "Path must be within the project" + assert not relpath.startswith('..'), "Path must be within the project" + + name = relpath.replace(os.path.sep, '.') + __import__(name) + return sys.modules[name] + + def _find_tests(self, start_dir, pattern): + """Used by discovery. Yields test suites it loads.""" + paths = os.listdir(start_dir) + + for path in paths: + full_path = os.path.join(start_dir, path) + # what about __init__.pyc or pyo (etc) + # we would need to avoid loading the same tests multiple times + # from '.py', '.pyc' *and* '.pyo' + if os.path.isfile(full_path) and path.lower().endswith('.py'): + if fnmatch(path, pattern): + # if the test file matches, load it + module = self._get_module_from_path(full_path) + yield self.loadTestsFromModule(module) + elif os.path.isdir(full_path): + if not os.path.isfile(os.path.join(full_path, '__init__.py')): + continue + + load_tests = None + tests = None + if fnmatch(path, pattern): + # only check load_tests if the package directory itself matches the filter + package = self._get_module_from_path(full_path) + load_tests = getattr(package, 'load_tests', None) + tests = self.loadTestsFromModule(package, use_load_tests=False) + + if load_tests is None: + if tests is not None: + # tests loaded from package file + yield tests + # recurse into the package + for test in self._find_tests(full_path, pattern): + yield test + else: + yield load_tests(self, tests, pattern) defaultTestLoader = TestLoader() @@ -1525,11 +1623,37 @@ # Facilities for running tests from the command line ############################################################################## -class TestProgram(object): - """A command-line program that runs a set of tests; this is primarily - for making test modules conveniently executable. - """ - USAGE = """\ +USAGE_AS_MAIN = """\ +Usage: %(progName)s [options] [tests] + +Options: + -h, --help Show this message + -v, --verbose Verbose output + -q, --quiet Minimal output + +Examples: + %(progName)s test_module - run tests from test_module + %(progName)s test_module.TestClass - run tests from + test_module.TestClass + %(progName)s test_module.TestClass.test_method - run specified test method + +[tests] can be a list of any number of test modules, classes and test +methods. + +Alternative Usage: %(progName)s discover [options] + +Options: + -v, --verbose Verbose output + -s directory Directory to start discovery ('.' default) + -p pattern Pattern to match test files ('test*.py' default) + -t directory Top level directory of project (default to + start directory) + +For test discovery all test modules must be importable from the top +level directory of the project. +""" + +USAGE_FROM_MODULE = """\ Usage: %(progName)s [options] [test] [...] Options: @@ -1544,9 +1668,24 @@ %(progName)s MyTestCase - run all 'test*' test methods in MyTestCase """ + +if __name__ == '__main__': + USAGE = USAGE_AS_MAIN +else: + USAGE = USAGE_FROM_MODULE + + +class TestProgram(object): + """A command-line program that runs a set of tests; this is primarily + for making test modules conveniently executable. + """ + USAGE = USAGE def __init__(self, module='__main__', defaultTest=None, - argv=None, testRunner=TextTestRunner, - testLoader=defaultTestLoader, exit=True): + argv=None, testRunner=None, + testLoader=defaultTestLoader, exit=True, + verbosity=1): + if testRunner is None: + testRunner = TextTestRunner if isinstance(module, str): self.module = __import__(module) for part in module.split('.')[1:]: @@ -1557,7 +1696,7 @@ argv = sys.argv self.exit = exit - self.verbosity = 1 + self.verbosity = verbosity self.defaultTest = defaultTest self.testRunner = testRunner self.testLoader = testLoader @@ -1572,6 +1711,10 @@ sys.exit(2) def parseArgs(self, argv): + if len(argv) > 1 and argv[1].lower() == 'discover': + self._do_discovery(argv[2:]) + return + import getopt long_opts = ['help','verbose','quiet'] try: @@ -1588,6 +1731,9 @@ return if len(args) > 0: self.testNames = args + if __name__ == '__main__': + # to support python -m unittest ... + self.module = None else: self.testNames = (self.defaultTest,) self.createTests() @@ -1598,6 +1744,36 @@ self.test = self.testLoader.loadTestsFromNames(self.testNames, self.module) + def _do_discovery(self, argv, Loader=TestLoader): + # handle command line args for test discovery + import optparse + parser = optparse.OptionParser() + parser.add_option('-v', '--verbose', dest='verbose', default=False, + help='Verbose output', action='store_true') + parser.add_option('-s', '--start-directory', dest='start', default='.', + help="Directory to start discovery ('.' default)") + parser.add_option('-p', '--pattern', dest='pattern', default='test*.py', + help="Pattern to match tests ('test*.py' default)") + parser.add_option('-t', '--top-level-directory', dest='top', default=None, + help='Top level directory of project (defaults to start directory)') + + options, args = parser.parse_args(argv) + if len(args) > 3: + self.usageExit() + + for name, value in zip(('start', 'pattern', 'top'), args): + setattr(options, name, value) + + if options.verbose: + self.verbosity = 2 + + start_dir = options.start + pattern = options.pattern + top_level_dir = options.top + + loader = Loader() + self.test = loader.discover(start_dir, pattern, top_level_dir) + def runTests(self): if isinstance(self.testRunner, type): try: @@ -1620,4 +1796,5 @@ ############################################################################## if __name__ == "__main__": + sys.modules['unittest'] = sys.modules['__main__'] main(module=None) From python-checkins at python.org Sun Jun 28 01:45:39 2009 From: python-checkins at python.org (ezio.melotti) Date: Sat, 27 Jun 2009 23:45:39 -0000 Subject: [Python-checkins] r73595 - python/trunk/Doc/library/timeit.rst Message-ID: Author: ezio.melotti Date: Sun Jun 28 01:45:39 2009 New Revision: 73595 Log: stmt and setup can contain multiple statements, see #5896 Modified: python/trunk/Doc/library/timeit.rst Modified: python/trunk/Doc/library/timeit.rst ============================================================================== --- python/trunk/Doc/library/timeit.rst (original) +++ python/trunk/Doc/library/timeit.rst Sun Jun 28 01:45:39 2009 @@ -26,8 +26,9 @@ The constructor takes a statement to be timed, an additional statement used for setup, and a timer function. Both statements default to ``'pass'``; the timer - function is platform-dependent (see the module doc string). The statements may - contain newlines, as long as they don't contain multi-line string literals. + function is platform-dependent (see the module doc string). *stmt* and *setup* + may also contain multiple statements separated by ``;`` or newlines, as long as + they don?t contain multi-line string literals. To measure the execution time of the first statement, use the :meth:`timeit` method. The :meth:`repeat` method is a convenience to call :meth:`timeit` From python-checkins at python.org Sun Jun 28 02:07:45 2009 From: python-checkins at python.org (ezio.melotti) Date: Sun, 28 Jun 2009 00:07:45 -0000 Subject: [Python-checkins] r73596 - python/trunk/Doc/library/timeit.rst Message-ID: Author: ezio.melotti Date: Sun Jun 28 02:07:45 2009 New Revision: 73596 Log: Fixed a wrong apostrophe Modified: python/trunk/Doc/library/timeit.rst Modified: python/trunk/Doc/library/timeit.rst ============================================================================== --- python/trunk/Doc/library/timeit.rst (original) +++ python/trunk/Doc/library/timeit.rst Sun Jun 28 02:07:45 2009 @@ -28,7 +28,7 @@ setup, and a timer function. Both statements default to ``'pass'``; the timer function is platform-dependent (see the module doc string). *stmt* and *setup* may also contain multiple statements separated by ``;`` or newlines, as long as - they don?t contain multi-line string literals. + they don't contain multi-line string literals. To measure the execution time of the first statement, use the :meth:`timeit` method. The :meth:`repeat` method is a convenience to call :meth:`timeit` From buildbot at python.org Sun Jun 28 02:41:11 2009 From: buildbot at python.org (buildbot at python.org) Date: Sun, 28 Jun 2009 00:41:11 +0000 Subject: [Python-checkins] buildbot failure in sparc solaris10 gcc 3.x Message-ID: The Buildbot has detected a new failure of sparc solaris10 gcc 3.x. Full details are available at: http://www.python.org/dev/buildbot/all/sparc%20solaris10%20gcc%203.x/builds/863 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: loewis-sun Build Reason: Build Source Stamp: [branch branches/py3k] HEAD Blamelist: benjamin.peterson BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_posix ====================================================================== ERROR: test_getcwd_long_pathnames (test.test_posix.PosixTester) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home2/buildbot/slave/3.x.loewis-sun/build/Lib/test/test_posix.py", line 251, in test_getcwd_long_pathnames support.rmtree(base_path) File "/home2/buildbot/slave/3.x.loewis-sun/build/Lib/test/support.py", line 181, in rmtree shutil.rmtree(path) File "/home2/buildbot/slave/3.x.loewis-sun/build/Lib/shutil.py", line 239, in rmtree onerror(os.rmdir, path, sys.exc_info()) File "/home2/buildbot/slave/3.x.loewis-sun/build/Lib/shutil.py", line 237, in rmtree os.rmdir(path) OSError: [Errno 22] Invalid argument: '/home2/buildbot/slave/3.x.loewis-sun/build/@test.getcwd/@test.getcwd' sincerely, -The Buildbot From buildbot at python.org Sun Jun 28 03:03:20 2009 From: buildbot at python.org (buildbot at python.org) Date: Sun, 28 Jun 2009 01:03:20 +0000 Subject: [Python-checkins] buildbot failure in x86 XP-4 3.x Message-ID: The Buildbot has detected a new failure of x86 XP-4 3.x. Full details are available at: http://www.python.org/dev/buildbot/all/x86%20XP-4%203.x/builds/715 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: bolen-windows Build Reason: Build Source Stamp: [branch branches/py3k] HEAD Blamelist: benjamin.peterson,ezio.melotti,martin.v.loewis BUILD FAILED: failed test Excerpt from the test logfile: Traceback (most recent call last): File "E:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\test\test_import.py", line 62, in test_with_extension self.fail("import from %s failed: %s" % (ext, err)) File "E:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\unittest.py", line 540, in fail raise self.failureException(msg) AssertionError: import from .PY failed: No module named @test Traceback (most recent call last): File "E:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\test\test_import.py", line 79, in testImport test_with_extension(ext) File "E:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\test\test_import.py", line 72, in test_with_extension del sys.modules[TESTFN] KeyError: '@test' 1 test failed: test_import ====================================================================== ERROR: testImport (test.test_import.ImportTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "E:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\test\test_import.py", line 60, in test_with_extension mod = __import__(TESTFN) ImportError: No module named @test Traceback (most recent call last): File "E:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\test\test_import.py", line 62, in test_with_extension self.fail("import from %s failed: %s" % (ext, err)) File "E:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\unittest.py", line 540, in fail raise self.failureException(msg) AssertionError: import from .PY failed: No module named @test Traceback (most recent call last): File "E:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\test\test_import.py", line 79, in testImport test_with_extension(ext) File "E:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\test\test_import.py", line 72, in test_with_extension del sys.modules[TESTFN] KeyError: '@test' Traceback (most recent call last): File "E:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\test\test_import.py", line 62, in test_with_extension self.fail("import from %s failed: %s" % (ext, err)) File "E:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\unittest.py", line 540, in fail raise self.failureException(msg) AssertionError: import from .PY failed: No module named @test Traceback (most recent call last): File "E:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\test\test_import.py", line 79, in testImport test_with_extension(ext) File "E:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\test\test_import.py", line 72, in test_with_extension del sys.modules[TESTFN] KeyError: '@test' sincerely, -The Buildbot From python-checkins at python.org Sun Jun 28 05:18:59 2009 From: python-checkins at python.org (benjamin.peterson) Date: Sun, 28 Jun 2009 03:18:59 -0000 Subject: [Python-checkins] r73597 - in python/branches/py3k: Doc/library/dis.rst Doc/reference/compound_stmts.rst Include/opcode.h Lib/opcode.py Lib/test/test_descr.py Python/ceval.c Python/compile.c Python/import.c Python/opcode_targets.h Python/peephole.c Message-ID: Author: benjamin.peterson Date: Sun Jun 28 05:18:59 2009 New Revision: 73597 Log: Merged revisions 72912,72920,72940 via svnmerge from svn+ssh://pythondev at svn.python.org/python/trunk ........ r72912 | benjamin.peterson | 2009-05-25 08:13:44 -0500 (Mon, 25 May 2009) | 5 lines add a SETUP_WITH opcode It speeds up the with statement and correctly looks up the special methods involved. ........ r72920 | benjamin.peterson | 2009-05-25 15:12:57 -0500 (Mon, 25 May 2009) | 1 line take into account the fact that SETUP_WITH pushes a finally block ........ r72940 | benjamin.peterson | 2009-05-26 07:49:59 -0500 (Tue, 26 May 2009) | 1 line teach the peepholer about SETUP_WITH ........ Modified: python/branches/py3k/ (props changed) python/branches/py3k/Doc/library/dis.rst python/branches/py3k/Doc/reference/compound_stmts.rst python/branches/py3k/Include/opcode.h python/branches/py3k/Lib/opcode.py python/branches/py3k/Lib/test/test_descr.py python/branches/py3k/Python/ceval.c python/branches/py3k/Python/compile.c python/branches/py3k/Python/import.c python/branches/py3k/Python/opcode_targets.h python/branches/py3k/Python/peephole.c Modified: python/branches/py3k/Doc/library/dis.rst ============================================================================== --- python/branches/py3k/Doc/library/dis.rst (original) +++ python/branches/py3k/Doc/library/dis.rst Sun Jun 28 05:18:59 2009 @@ -436,6 +436,18 @@ by ``CALL_FUNCTION`` to construct a class. +.. opcode:: SETUP_WITH (delta) + + This opcode performs several operations before a with block starts. First, + it loads :meth:`~object.__exit__` from the context manager and pushes it onto + the stack for later use by :opcode:`WITH_CLEANUP`. Then, + :meth:`~object.__enter__` is called, and a finally block pointing to *delta* + is pushed. Finally, the result of calling the enter method is pushed onto + the stack. The next opcode will either ignore it (:opcode:`POP_TOP`), or + store it in (a) variable(s) (:opcode:`STORE_FAST`, :opcode:`STORE_NAME`, or + :opcode:`UNPACK_SEQUENCE`). + + .. opcode:: WITH_CLEANUP () Cleans up the stack when a :keyword:`with` statement block exits. TOS is Modified: python/branches/py3k/Doc/reference/compound_stmts.rst ============================================================================== --- python/branches/py3k/Doc/reference/compound_stmts.rst (original) +++ python/branches/py3k/Doc/reference/compound_stmts.rst Sun Jun 28 05:18:59 2009 @@ -354,6 +354,8 @@ #. The context expression is evaluated to obtain a context manager. +#. The context manager's :meth:`__exit__` is loaded for later use. + #. The context manager's :meth:`__enter__` method is invoked. #. If a target was included in the :keyword:`with` statement, the return value @@ -363,9 +365,9 @@ The :keyword:`with` statement guarantees that if the :meth:`__enter__` method returns without an error, then :meth:`__exit__` will always be - called. Thus, if an error occurs during the assignment to the target - list, it will be treated the same as an error occurring within the suite - would be. See step 5 below. + called. Thus, if an error occurs during the assignment to the target list, + it will be treated the same as an error occurring within the suite would + be. See step 6 below. #. The suite is executed. Modified: python/branches/py3k/Include/opcode.h ============================================================================== --- python/branches/py3k/Include/opcode.h (original) +++ python/branches/py3k/Include/opcode.h Sun Jun 28 05:18:59 2009 @@ -130,8 +130,10 @@ #define CALL_FUNCTION_KW 141 /* #args + (#kwargs<<8) */ #define CALL_FUNCTION_VAR_KW 142 /* #args + (#kwargs<<8) */ +#define SETUP_WITH 143 + /* Support for opargs more than 16 bits long */ -#define EXTENDED_ARG 143 +#define EXTENDED_ARG 144 #define LIST_APPEND 145 #define SET_ADD 146 Modified: python/branches/py3k/Lib/opcode.py ============================================================================== --- python/branches/py3k/Lib/opcode.py (original) +++ python/branches/py3k/Lib/opcode.py Sun Jun 28 05:18:59 2009 @@ -166,12 +166,14 @@ def_op('CALL_FUNCTION_VAR', 140) # #args + (#kwargs << 8) def_op('CALL_FUNCTION_KW', 141) # #args + (#kwargs << 8) def_op('CALL_FUNCTION_VAR_KW', 142) # #args + (#kwargs << 8) -def_op('EXTENDED_ARG', 143) -EXTENDED_ARG = 143 + +jrel_op('SETUP_WITH', 143) def_op('LIST_APPEND', 145) def_op('SET_ADD', 146) def_op('MAP_ADD', 147) +def_op('EXTENDED_ARG', 144) +EXTENDED_ARG = 144 del def_op, name_op, jrel_op, jabs_op Modified: python/branches/py3k/Lib/test/test_descr.py ============================================================================== --- python/branches/py3k/Lib/test/test_descr.py (original) +++ python/branches/py3k/Lib/test/test_descr.py Sun Jun 28 05:18:59 2009 @@ -1569,6 +1569,7 @@ def some_number(self_, key): self.assertEqual(key, "hi") return 4 + def swallow(*args): pass # It would be nice to have every special method tested here, but I'm # only listing the ones I can remember outside of typeobject.c, since it @@ -1584,11 +1585,8 @@ set(("__class__",)), {}), ("__subclasscheck__", do_issubclass, return_true, set(("__bases__",)), {}), - # These two fail because the compiler generates LOAD_ATTR to look - # them up. We'd have to add a new opcode to fix this, and it's - # probably not worth it. - # ("__enter__", run_context, iden), - # ("__exit__", run_context, iden), + ("__enter__", run_context, iden, set(), {"__exit__" : swallow}), + ("__exit__", run_context, swallow, set(), {"__enter__" : iden}), ] class Checker(object): Modified: python/branches/py3k/Python/ceval.c ============================================================================== --- python/branches/py3k/Python/ceval.c (original) +++ python/branches/py3k/Python/ceval.c Sun Jun 28 05:18:59 2009 @@ -119,6 +119,7 @@ static void format_exc_check_arg(PyObject *, const char *, PyObject *); static PyObject * unicode_concatenate(PyObject *, PyObject *, PyFrameObject *, unsigned char *); +static PyObject * special_lookup(PyObject *, char *, PyObject **); #define NAME_ERROR_MSG \ "name '%.200s' is not defined" @@ -2455,6 +2456,33 @@ STACK_LEVEL()); DISPATCH(); + TARGET(SETUP_WITH) + { + static PyObject *exit, *enter; + w = TOP(); + x = special_lookup(w, "__exit__", &exit); + if (!x) + break; + SET_TOP(x); + u = special_lookup(w, "__enter__", &enter); + Py_DECREF(w); + if (!u) { + x = NULL; + break; + } + x = PyObject_CallFunctionObjArgs(u, NULL); + Py_DECREF(u); + if (!x) + break; + /* Setup the finally block before pushing the result + of __enter__ on the stack. */ + PyFrame_BlockSetup(f, SETUP_FINALLY, INSTR_OFFSET() + oparg, + STACK_LEVEL()); + + PUSH(x); + DISPATCH(); + } + TARGET(WITH_CLEANUP) { /* At the top of the stack are 1-3 values indicating @@ -2479,17 +2507,36 @@ should still be resumed.) */ - PyObject *exit_func = POP(); + PyObject *exit_func; u = TOP(); if (u == Py_None) { + POP(); + exit_func = TOP(); + SET_TOP(u); v = w = Py_None; } else if (PyLong_Check(u)) { + POP(); + switch(PyLong_AsLong(u)) { + case WHY_RETURN: + case WHY_CONTINUE: + /* Retval in TOP. */ + exit_func = SECOND(); + SET_SECOND(TOP()); + SET_TOP(u); + break; + default: + exit_func = TOP(); + SET_TOP(u); + break; + } u = v = w = Py_None; } else { - v = SECOND(); + v = SECOND(); w = THIRD(); + exit_func = stack_pointer[-7]; + stack_pointer[-7] = NULL; } /* XXX Not the fastest way to call it... */ x = PyObject_CallFunctionObjArgs(exit_func, u, v, w, @@ -2509,11 +2556,7 @@ else if (err > 0) { err = 0; /* There was an exception and a True return */ - STACKADJ(-2); - SET_TOP(PyLong_FromLong((long) WHY_SILENCED)); - Py_DECREF(u); - Py_DECREF(v); - Py_DECREF(w); + PUSH(PyLong_FromLong((long) WHY_SILENCED)); } PREDICT(END_FINALLY); break; @@ -3194,6 +3237,19 @@ } +static PyObject * +special_lookup(PyObject *o, char *meth, PyObject **cache) +{ + PyObject *res; + res = _PyObject_LookupSpecial(o, meth, cache); + if (res == NULL && !PyErr_Occurred()) { + PyErr_SetObject(PyExc_AttributeError, *cache); + return NULL; + } + return res; +} + + /* Logic for the raise statement (too complicated for inlining). This *consumes* a reference count to each of its arguments. */ static enum why_code Modified: python/branches/py3k/Python/compile.c ============================================================================== --- python/branches/py3k/Python/compile.c (original) +++ python/branches/py3k/Python/compile.c Sun Jun 28 05:18:59 2009 @@ -761,6 +761,8 @@ return -1; case BREAK_LOOP: return 0; + case SETUP_WITH: + return 7; case WITH_CLEANUP: return -1; /* XXX Sometimes more */ case STORE_LOCALS: @@ -3085,85 +3087,31 @@ static int compiler_with(struct compiler *c, stmt_ty s) { - static identifier enter_attr, exit_attr; basicblock *block, *finally; - identifier tmpvalue = NULL, tmpexit = NULL; assert(s->kind == With_kind); - if (!enter_attr) { - enter_attr = PyUnicode_InternFromString("__enter__"); - if (!enter_attr) - return 0; - } - if (!exit_attr) { - exit_attr = PyUnicode_InternFromString("__exit__"); - if (!exit_attr) - return 0; - } - block = compiler_new_block(c); finally = compiler_new_block(c); if (!block || !finally) return 0; - if (s->v.With.optional_vars) { - /* Create a temporary variable to hold context.__enter__(). - We need to do this rather than preserving it on the stack - because SETUP_FINALLY remembers the stack level. - We need to do the assignment *inside* the try/finally - so that context.__exit__() is called when the assignment - fails. But we need to call context.__enter__() *before* - the try/finally so that if it fails we won't call - context.__exit__(). - */ - tmpvalue = compiler_new_tmpname(c); - if (tmpvalue == NULL) - return 0; - PyArena_AddPyObject(c->c_arena, tmpvalue); - } - tmpexit = compiler_new_tmpname(c); - if (tmpexit == NULL) - return 0; - PyArena_AddPyObject(c->c_arena, tmpexit); - /* Evaluate EXPR */ VISIT(c, expr, s->v.With.context_expr); + ADDOP_JREL(c, SETUP_WITH, finally); - /* Squirrel away context.__exit__ by stuffing it under context */ - ADDOP(c, DUP_TOP); - ADDOP_O(c, LOAD_ATTR, exit_attr, names); - if (!compiler_nameop(c, tmpexit, Store)) - return 0; - - /* Call context.__enter__() */ - ADDOP_O(c, LOAD_ATTR, enter_attr, names); - ADDOP_I(c, CALL_FUNCTION, 0); - - if (s->v.With.optional_vars) { - /* Store it in tmpvalue */ - if (!compiler_nameop(c, tmpvalue, Store)) - return 0; - } - else { - /* Discard result from context.__enter__() */ - ADDOP(c, POP_TOP); - } - - /* Start the try block */ - ADDOP_JREL(c, SETUP_FINALLY, finally); - + /* SETUP_WITH pushes a finally block. */ compiler_use_next_block(c, block); if (!compiler_push_fblock(c, FINALLY_TRY, block)) { return 0; } if (s->v.With.optional_vars) { - /* Bind saved result of context.__enter__() to VAR */ - if (!compiler_nameop(c, tmpvalue, Load) || - !compiler_nameop(c, tmpvalue, Del)) - return 0; - VISIT(c, expr, s->v.With.optional_vars); + VISIT(c, expr, s->v.With.optional_vars); + } + else { + /* Discard result from context.__enter__() */ + ADDOP(c, POP_TOP); } /* BLOCK code */ @@ -3181,9 +3129,6 @@ /* Finally block starts; context.__exit__ is on the stack under the exception or return information. Just issue our magic opcode. */ - if (!compiler_nameop(c, tmpexit, Load) || - !compiler_nameop(c, tmpexit, Del)) - return 0; ADDOP(c, WITH_CLEANUP); /* Finally block ends. */ Modified: python/branches/py3k/Python/import.c ============================================================================== --- python/branches/py3k/Python/import.c (original) +++ python/branches/py3k/Python/import.c Sun Jun 28 05:18:59 2009 @@ -89,9 +89,10 @@ change LIST_APPEND and SET_ADD, add MAP_ADD) Python 3.1a0: 3150 (optimize conditional branches: introduce POP_JUMP_IF_FALSE and POP_JUMP_IF_TRUE) + Python 3.2a0: 3160 (add SETUP_WITH) */ -#define MAGIC (3150 | ((long)'\r'<<16) | ((long)'\n'<<24)) +#define MAGIC (3160 | ((long)'\r'<<16) | ((long)'\n'<<24)) /* Magic word as global; note that _PyImport_Init() can change the value of this global to accommodate for alterations of how the compiler works which are enabled by command line switches. */ Modified: python/branches/py3k/Python/opcode_targets.h ============================================================================== --- python/branches/py3k/Python/opcode_targets.h (original) +++ python/branches/py3k/Python/opcode_targets.h Sun Jun 28 05:18:59 2009 @@ -142,8 +142,8 @@ &&TARGET_CALL_FUNCTION_VAR, &&TARGET_CALL_FUNCTION_KW, &&TARGET_CALL_FUNCTION_VAR_KW, + &&TARGET_SETUP_WITH, &&TARGET_EXTENDED_ARG, - &&_unknown_opcode, &&TARGET_LIST_APPEND, &&TARGET_SET_ADD, &&TARGET_MAP_ADD, Modified: python/branches/py3k/Python/peephole.c ============================================================================== --- python/branches/py3k/Python/peephole.c (original) +++ python/branches/py3k/Python/peephole.c Sun Jun 28 05:18:59 2009 @@ -251,6 +251,7 @@ case SETUP_LOOP: case SETUP_EXCEPT: case SETUP_FINALLY: + case SETUP_WITH: j = GETJUMPTGT(code, i); blocks[j] = 1; break; @@ -566,6 +567,7 @@ case SETUP_LOOP: case SETUP_EXCEPT: case SETUP_FINALLY: + case SETUP_WITH: tgt = GETJUMPTGT(codestr, i); /* Replace JUMP_* to a RETURN into just a RETURN */ if (UNCONDITIONAL_JUMP(opcode) && @@ -648,6 +650,7 @@ case SETUP_LOOP: case SETUP_EXCEPT: case SETUP_FINALLY: + case SETUP_WITH: j = addrmap[GETARG(codestr, i) + i + 3] - addrmap[i] - 3; SETARG(codestr, i, j); break; From buildbot at python.org Sun Jun 28 05:33:34 2009 From: buildbot at python.org (buildbot at python.org) Date: Sun, 28 Jun 2009 03:33:34 +0000 Subject: [Python-checkins] buildbot failure in amd64 gentoo 3.x Message-ID: The Buildbot has detected a new failure of amd64 gentoo 3.x. Full details are available at: http://www.python.org/dev/buildbot/all/amd64%20gentoo%203.x/builds/853 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: norwitz-amd64 Build Reason: Build Source Stamp: [branch branches/py3k] HEAD Blamelist: benjamin.peterson BUILD FAILED: failed test Excerpt from the test logfile: make: *** [buildbottest] Segmentation fault (core dumped) sincerely, -The Buildbot From buildbot at python.org Sun Jun 28 05:40:17 2009 From: buildbot at python.org (buildbot at python.org) Date: Sun, 28 Jun 2009 03:40:17 +0000 Subject: [Python-checkins] buildbot failure in x86 osx.5 3.x Message-ID: The Buildbot has detected a new failure of x86 osx.5 3.x. Full details are available at: http://www.python.org/dev/buildbot/all/x86%20osx.5%203.x/builds/1075 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: heller-x86-osx5 Build Reason: Build Source Stamp: [branch branches/py3k] HEAD Blamelist: benjamin.peterson BUILD FAILED: failed test Excerpt from the test logfile: make: *** [buildbottest] Bus error sincerely, -The Buildbot From buildbot at python.org Sun Jun 28 05:53:44 2009 From: buildbot at python.org (buildbot at python.org) Date: Sun, 28 Jun 2009 03:53:44 +0000 Subject: [Python-checkins] buildbot failure in x86 XP-4 3.x Message-ID: The Buildbot has detected a new failure of x86 XP-4 3.x. Full details are available at: http://www.python.org/dev/buildbot/all/x86%20XP-4%203.x/builds/717 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: bolen-windows Build Reason: Build Source Stamp: [branch branches/py3k] HEAD Blamelist: benjamin.peterson BUILD FAILED: failed test Excerpt from the test logfile: sincerely, -The Buildbot From python-checkins at python.org Sun Jun 28 11:32:39 2009 From: python-checkins at python.org (martin.v.loewis) Date: Sun, 28 Jun 2009 09:32:39 -0000 Subject: [Python-checkins] r73598 - in python/trunk: Misc/NEWS Tools/msi/msi.py Message-ID: Author: martin.v.loewis Date: Sun Jun 28 11:32:39 2009 New Revision: 73598 Log: Issue 5390: Add uninstall icon independent of whether file extensions are installed. Modified: python/trunk/Misc/NEWS python/trunk/Tools/msi/msi.py Modified: python/trunk/Misc/NEWS ============================================================================== --- python/trunk/Misc/NEWS (original) +++ python/trunk/Misc/NEWS Sun Jun 28 11:32:39 2009 @@ -1060,6 +1060,9 @@ Build ----- +- Issue 5390: Add uninstall icon independent of whether file + extensions are installed. + - Issue 5809: Specifying both --enable-framework and --enable-shared is an error. Configure now explicity tells you about this. Modified: python/trunk/Tools/msi/msi.py ============================================================================== --- python/trunk/Tools/msi/msi.py (original) +++ python/trunk/Tools/msi/msi.py Sun Jun 28 11:32:39 2009 @@ -1257,7 +1257,7 @@ "", r"[TARGETDIR]Python.exe", "REGISTRY.def"), ("DisplayIcon", -1, r"Software\Microsoft\Windows\CurrentVersion\Uninstall\%s" % product_code, - "DisplayIcon", "[TARGETDIR]python.exe", "REGISTRY.def") + "DisplayIcon", "[TARGETDIR]python.exe", "REGISTRY") ]) # Shortcuts, see "Shortcut Table" add_data(db, "Directory", From python-checkins at python.org Sun Jun 28 11:35:11 2009 From: python-checkins at python.org (martin.v.loewis) Date: Sun, 28 Jun 2009 09:35:11 -0000 Subject: [Python-checkins] r73599 - in python/branches/release26-maint: Misc/NEWS Tools/msi/msi.py Message-ID: Author: martin.v.loewis Date: Sun Jun 28 11:35:10 2009 New Revision: 73599 Log: Merged revisions 73598 via svnmerge from svn+ssh://pythondev at svn.python.org/python/trunk ........ r73598 | martin.v.loewis | 2009-06-28 11:32:39 +0200 (So, 28 Jun 2009) | 3 lines Issue 5390: Add uninstall icon independent of whether file extensions are installed. ........ Modified: python/branches/release26-maint/ (props changed) python/branches/release26-maint/Misc/NEWS python/branches/release26-maint/Tools/msi/msi.py Modified: python/branches/release26-maint/Misc/NEWS ============================================================================== --- python/branches/release26-maint/Misc/NEWS (original) +++ python/branches/release26-maint/Misc/NEWS Sun Jun 28 11:35:10 2009 @@ -139,6 +139,9 @@ Build ----- +- Issue 5390: Add uninstall icon independent of whether file + extensions are installed. + - Issue #6094: Build correctly with Subversion 1.7. - Issue #5726: Make Modules/ld_so_aix return the actual exit code of the Modified: python/branches/release26-maint/Tools/msi/msi.py ============================================================================== --- python/branches/release26-maint/Tools/msi/msi.py (original) +++ python/branches/release26-maint/Tools/msi/msi.py Sun Jun 28 11:35:10 2009 @@ -1254,7 +1254,7 @@ "", r"[TARGETDIR]Python.exe", "REGISTRY.def"), ("DisplayIcon", -1, r"Software\Microsoft\Windows\CurrentVersion\Uninstall\%s" % product_code, - "DisplayIcon", "[TARGETDIR]python.exe", "REGISTRY.def") + "DisplayIcon", "[TARGETDIR]python.exe", "REGISTRY") ]) # Shortcuts, see "Shortcut Table" add_data(db, "Directory", From python-checkins at python.org Sun Jun 28 11:36:14 2009 From: python-checkins at python.org (martin.v.loewis) Date: Sun, 28 Jun 2009 09:36:14 -0000 Subject: [Python-checkins] r73600 - in python/branches/py3k: Misc/NEWS Tools/msi/msi.py Message-ID: Author: martin.v.loewis Date: Sun Jun 28 11:36:14 2009 New Revision: 73600 Log: Merged revisions 73598 via svnmerge from svn+ssh://pythondev at svn.python.org/python/trunk ........ r73598 | martin.v.loewis | 2009-06-28 11:32:39 +0200 (So, 28 Jun 2009) | 3 lines Issue 5390: Add uninstall icon independent of whether file extensions are installed. ........ Modified: python/branches/py3k/ (props changed) python/branches/py3k/Misc/NEWS python/branches/py3k/Tools/msi/msi.py Modified: python/branches/py3k/Misc/NEWS ============================================================================== --- python/branches/py3k/Misc/NEWS (original) +++ python/branches/py3k/Misc/NEWS Sun Jun 28 11:36:14 2009 @@ -15,6 +15,12 @@ Library ------- +Build +----- + +- Issue 5390: Add uninstall icon independent of whether file + extensions are installed. + What's New in Python 3.1? ========================= Modified: python/branches/py3k/Tools/msi/msi.py ============================================================================== --- python/branches/py3k/Tools/msi/msi.py (original) +++ python/branches/py3k/Tools/msi/msi.py Sun Jun 28 11:36:14 2009 @@ -1258,7 +1258,7 @@ "", r"[TARGETDIR]Python.exe", "REGISTRY.def"), ("DisplayIcon", -1, r"Software\Microsoft\Windows\CurrentVersion\Uninstall\%s" % product_code, - "DisplayIcon", "[TARGETDIR]python.exe", "REGISTRY.def") + "DisplayIcon", "[TARGETDIR]python.exe", "REGISTRY") ]) # Shortcuts, see "Shortcut Table" add_data(db, "Directory", From python-checkins at python.org Sun Jun 28 11:39:23 2009 From: python-checkins at python.org (martin.v.loewis) Date: Sun, 28 Jun 2009 09:39:23 -0000 Subject: [Python-checkins] r73601 - in python/branches/release30-maint: Misc/NEWS Tools/msi/msi.py Message-ID: Author: martin.v.loewis Date: Sun Jun 28 11:39:22 2009 New Revision: 73601 Log: Merged revisions 73600 via svnmerge from svn+ssh://pythondev at svn.python.org/python/branches/py3k ................ r73600 | martin.v.loewis | 2009-06-28 11:36:14 +0200 (So, 28 Jun 2009) | 10 lines Merged revisions 73598 via svnmerge from svn+ssh://pythondev at svn.python.org/python/trunk ........ r73598 | martin.v.loewis | 2009-06-28 11:32:39 +0200 (So, 28 Jun 2009) | 3 lines Issue 5390: Add uninstall icon independent of whether file extensions are installed. ........ ................ Modified: python/branches/release30-maint/ (props changed) python/branches/release30-maint/Misc/NEWS python/branches/release30-maint/Tools/msi/msi.py Modified: python/branches/release30-maint/Misc/NEWS ============================================================================== --- python/branches/release30-maint/Misc/NEWS (original) +++ python/branches/release30-maint/Misc/NEWS Sun Jun 28 11:39:22 2009 @@ -209,6 +209,9 @@ Build ----- +- Issue 5390: Add uninstall icon independent of whether file + extensions are installed. + - Issue #6094: Build correctly with Subversion 1.7. - Link the shared python library with $(MODLIBS). Modified: python/branches/release30-maint/Tools/msi/msi.py ============================================================================== --- python/branches/release30-maint/Tools/msi/msi.py (original) +++ python/branches/release30-maint/Tools/msi/msi.py Sun Jun 28 11:39:22 2009 @@ -1256,7 +1256,7 @@ "", r"[TARGETDIR]Python.exe", "REGISTRY.def"), ("DisplayIcon", -1, r"Software\Microsoft\Windows\CurrentVersion\Uninstall\%s" % product_code, - "DisplayIcon", "[TARGETDIR]python.exe", "REGISTRY.def") + "DisplayIcon", "[TARGETDIR]python.exe", "REGISTRY") ]) # Shortcuts, see "Shortcut Table" add_data(db, "Directory", From python-checkins at python.org Sun Jun 28 11:40:34 2009 From: python-checkins at python.org (martin.v.loewis) Date: Sun, 28 Jun 2009 09:40:34 -0000 Subject: [Python-checkins] r73602 - in python/branches/release31-maint: Misc/NEWS Tools/msi/msi.py Message-ID: Author: martin.v.loewis Date: Sun Jun 28 11:40:34 2009 New Revision: 73602 Log: Merged revisions 73600 via svnmerge from svn+ssh://pythondev at svn.python.org/python/branches/py3k ................ r73600 | martin.v.loewis | 2009-06-28 11:36:14 +0200 (So, 28 Jun 2009) | 10 lines Merged revisions 73598 via svnmerge from svn+ssh://pythondev at svn.python.org/python/trunk ........ r73598 | martin.v.loewis | 2009-06-28 11:32:39 +0200 (So, 28 Jun 2009) | 3 lines Issue 5390: Add uninstall icon independent of whether file extensions are installed. ........ ................ Modified: python/branches/release31-maint/ (props changed) python/branches/release31-maint/Misc/NEWS python/branches/release31-maint/Tools/msi/msi.py Modified: python/branches/release31-maint/Misc/NEWS ============================================================================== --- python/branches/release31-maint/Misc/NEWS (original) +++ python/branches/release31-maint/Misc/NEWS Sun Jun 28 11:40:34 2009 @@ -15,6 +15,12 @@ Library ------- +Build +----- + +- Issue 5390: Add uninstall icon independent of whether file + extensions are installed. + What's New in Python 3.1? ========================= Modified: python/branches/release31-maint/Tools/msi/msi.py ============================================================================== --- python/branches/release31-maint/Tools/msi/msi.py (original) +++ python/branches/release31-maint/Tools/msi/msi.py Sun Jun 28 11:40:34 2009 @@ -1258,7 +1258,7 @@ "", r"[TARGETDIR]Python.exe", "REGISTRY.def"), ("DisplayIcon", -1, r"Software\Microsoft\Windows\CurrentVersion\Uninstall\%s" % product_code, - "DisplayIcon", "[TARGETDIR]python.exe", "REGISTRY.def") + "DisplayIcon", "[TARGETDIR]python.exe", "REGISTRY") ]) # Shortcuts, see "Shortcut Table" add_data(db, "Directory", From buildbot at python.org Sun Jun 28 12:11:56 2009 From: buildbot at python.org (buildbot at python.org) Date: Sun, 28 Jun 2009 10:11:56 +0000 Subject: [Python-checkins] buildbot failure in x86 osx.5 trunk Message-ID: The Buildbot has detected a new failure of x86 osx.5 trunk. Full details are available at: http://www.python.org/dev/buildbot/all/x86%20osx.5%20trunk/builds/1230 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: heller-x86-osx5 Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: benjamin.peterson,ezio.melotti,martin.v.loewis BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_pickle make: *** [buildbottest] Error 1 sincerely, -The Buildbot From python-checkins at python.org Sun Jun 28 12:23:00 2009 From: python-checkins at python.org (hirokazu.yamamoto) Date: Sun, 28 Jun 2009 10:23:00 -0000 Subject: [Python-checkins] r73603 - in python/trunk: Misc/NEWS Modules/_io/fileio.c Modules/posixmodule.c Objects/fileobject.c PC/pyconfig.h Message-ID: Author: hirokazu.yamamoto Date: Sun Jun 28 12:23:00 2009 New Revision: 73603 Log: Issue #4856: Remove checks for win NT. Modified: python/trunk/Misc/NEWS python/trunk/Modules/_io/fileio.c python/trunk/Modules/posixmodule.c python/trunk/Objects/fileobject.c python/trunk/PC/pyconfig.h Modified: python/trunk/Misc/NEWS ============================================================================== --- python/trunk/Misc/NEWS (original) +++ python/trunk/Misc/NEWS Sun Jun 28 12:23:00 2009 @@ -12,6 +12,8 @@ Core and Builtins ----------------- +- Issue #4856: Remove checks for win NT. + - Issue #2016: Fixed a crash in a corner case where the dictionary of keyword arguments could be modified during the function call setup. Modified: python/trunk/Modules/_io/fileio.c ============================================================================== --- python/trunk/Modules/_io/fileio.c (original) +++ python/trunk/Modules/_io/fileio.c Sun Jun 28 12:23:00 2009 @@ -224,11 +224,8 @@ } #ifdef MS_WINDOWS - if (GetVersion() < 0x80000000) { - /* On NT, so wide API available */ - if (PyUnicode_Check(nameobj)) - widename = PyUnicode_AS_UNICODE(nameobj); - } + if (PyUnicode_Check(nameobj)) + widename = PyUnicode_AS_UNICODE(nameobj); if (widename == NULL) #endif if (fd < 0) Modified: python/trunk/Modules/posixmodule.c ============================================================================== --- python/trunk/Modules/posixmodule.c (original) +++ python/trunk/Modules/posixmodule.c Sun Jun 28 12:23:00 2009 @@ -700,20 +700,6 @@ return Py_None; } -#ifdef MS_WINDOWS -static int -unicode_file_names(void) -{ - static int canusewide = -1; - if (canusewide == -1) { - /* As per doc for ::GetVersion(), this is the correct test for - the Windows NT family. */ - canusewide = (GetVersion() < 0x80000000) ? 1 : 0; - } - return canusewide; -} -#endif - static PyObject * posix_1str(PyObject *args, char *format, int (*func)(const char*)) { @@ -764,18 +750,17 @@ PyObject *uni; char *ansi; BOOL result; - if (unicode_file_names()) { - if (!PyArg_ParseTuple(args, wformat, &uni)) - PyErr_Clear(); - else { - Py_BEGIN_ALLOW_THREADS - result = funcW(PyUnicode_AsUnicode(uni)); - Py_END_ALLOW_THREADS - if (!result) - return win32_error_unicode(func, PyUnicode_AsUnicode(uni)); - Py_INCREF(Py_None); - return Py_None; - } + + if (!PyArg_ParseTuple(args, wformat, &uni)) + PyErr_Clear(); + else { + Py_BEGIN_ALLOW_THREADS + result = funcW(PyUnicode_AsUnicode(uni)); + Py_END_ALLOW_THREADS + if (!result) + return win32_error_unicode(func, PyUnicode_AsUnicode(uni)); + Py_INCREF(Py_None); + return Py_None; } if (!PyArg_ParseTuple(args, format, &ansi)) return NULL; @@ -938,22 +923,6 @@ return 0; } -/* Emulate GetFileAttributesEx[AW] on Windows 95 */ -static int checked = 0; -static BOOL (CALLBACK *gfaxa)(LPCSTR, GET_FILEEX_INFO_LEVELS, LPVOID); -static BOOL (CALLBACK *gfaxw)(LPCWSTR, GET_FILEEX_INFO_LEVELS, LPVOID); -static void -check_gfax() -{ - HINSTANCE hKernel32; - if (checked) - return; - checked = 1; - hKernel32 = GetModuleHandle("KERNEL32"); - *(FARPROC*)&gfaxa = GetProcAddress(hKernel32, "GetFileAttributesExA"); - *(FARPROC*)&gfaxw = GetProcAddress(hKernel32, "GetFileAttributesExW"); -} - static BOOL attributes_from_dir(LPCSTR pszFile, LPWIN32_FILE_ATTRIBUTE_DATA pfad) { @@ -1000,12 +969,9 @@ /* First try to use the system's implementation, if that is available and either succeeds to gives an error other than that it isn't implemented. */ - check_gfax(); - if (gfaxa) { - result = gfaxa(pszFile, level, pv); - if (result || GetLastError() != ERROR_CALL_NOT_IMPLEMENTED) - return result; - } + result = GetFileAttributesExA(pszFile, level, pv); + if (result || GetLastError() != ERROR_CALL_NOT_IMPLEMENTED) + return result; /* It's either not present, or not implemented. Emulate using FindFirstFile. */ if (level != GetFileExInfoStandard) { @@ -1030,12 +996,9 @@ /* First try to use the system's implementation, if that is available and either succeeds to gives an error other than that it isn't implemented. */ - check_gfax(); - if (gfaxa) { - result = gfaxw(pszFile, level, pv); - if (result || GetLastError() != ERROR_CALL_NOT_IMPLEMENTED) - return result; - } + result = GetFileAttributesExW(pszFile, level, pv); + if (result || GetLastError() != ERROR_CALL_NOT_IMPLEMENTED) + return result; /* It's either not present, or not implemented. Emulate using FindFirstFile. */ if (level != GetFileExInfoStandard) { @@ -1553,27 +1516,23 @@ PyObject *result; #ifdef MS_WINDOWS - /* If on wide-character-capable OS see if argument - is Unicode and if so use wide API. */ - if (unicode_file_names()) { - PyUnicodeObject *po; - if (PyArg_ParseTuple(args, wformat, &po)) { - Py_UNICODE *wpath = PyUnicode_AS_UNICODE(po); + PyUnicodeObject *po; + if (PyArg_ParseTuple(args, wformat, &po)) { + Py_UNICODE *wpath = PyUnicode_AS_UNICODE(po); - Py_BEGIN_ALLOW_THREADS - /* PyUnicode_AS_UNICODE result OK without - thread lock as it is a simple dereference. */ - res = wstatfunc(wpath, &st); - Py_END_ALLOW_THREADS + Py_BEGIN_ALLOW_THREADS + /* PyUnicode_AS_UNICODE result OK without + thread lock as it is a simple dereference. */ + res = wstatfunc(wpath, &st); + Py_END_ALLOW_THREADS - if (res != 0) - return win32_error_unicode("stat", wpath); - return _pystat_fromstructstat(&st); - } - /* Drop the argument parsing error as narrow strings - are also valid. */ - PyErr_Clear(); - } + if (res != 0) + return win32_error_unicode("stat", wpath); + return _pystat_fromstructstat(&st); + } + /* Drop the argument parsing error as narrow strings + are also valid. */ + PyErr_Clear(); #endif if (!PyArg_ParseTuple(args, format, @@ -1617,23 +1576,21 @@ #ifdef MS_WINDOWS DWORD attr; - if (unicode_file_names()) { - PyUnicodeObject *po; - if (PyArg_ParseTuple(args, "Ui:access", &po, &mode)) { - Py_BEGIN_ALLOW_THREADS - /* PyUnicode_AS_UNICODE OK without thread lock as - it is a simple dereference. */ - attr = GetFileAttributesW(PyUnicode_AS_UNICODE(po)); - Py_END_ALLOW_THREADS - goto finish; - } - /* Drop the argument parsing error as narrow strings - are also valid. */ - PyErr_Clear(); + PyUnicodeObject *po; + if (PyArg_ParseTuple(args, "Ui:access", &po, &mode)) { + Py_BEGIN_ALLOW_THREADS + /* PyUnicode_AS_UNICODE OK without thread lock as + it is a simple dereference. */ + attr = GetFileAttributesW(PyUnicode_AS_UNICODE(po)); + Py_END_ALLOW_THREADS + goto finish; } + /* Drop the argument parsing error as narrow strings + are also valid. */ + PyErr_Clear(); if (!PyArg_ParseTuple(args, "eti:access", Py_FileSystemDefaultEncoding, &path, &mode)) - return 0; + return NULL; Py_BEGIN_ALLOW_THREADS attr = GetFileAttributesA(path); Py_END_ALLOW_THREADS @@ -1771,31 +1728,30 @@ int res; #ifdef MS_WINDOWS DWORD attr; - if (unicode_file_names()) { - PyUnicodeObject *po; - if (PyArg_ParseTuple(args, "Ui|:chmod", &po, &i)) { - Py_BEGIN_ALLOW_THREADS - attr = GetFileAttributesW(PyUnicode_AS_UNICODE(po)); - if (attr != 0xFFFFFFFF) { - if (i & _S_IWRITE) - attr &= ~FILE_ATTRIBUTE_READONLY; - else - attr |= FILE_ATTRIBUTE_READONLY; - res = SetFileAttributesW(PyUnicode_AS_UNICODE(po), attr); - } + PyUnicodeObject *po; + if (PyArg_ParseTuple(args, "Ui|:chmod", &po, &i)) { + Py_BEGIN_ALLOW_THREADS + attr = GetFileAttributesW(PyUnicode_AS_UNICODE(po)); + if (attr != 0xFFFFFFFF) { + if (i & _S_IWRITE) + attr &= ~FILE_ATTRIBUTE_READONLY; else - res = 0; - Py_END_ALLOW_THREADS - if (!res) - return win32_error_unicode("chmod", - PyUnicode_AS_UNICODE(po)); - Py_INCREF(Py_None); - return Py_None; + attr |= FILE_ATTRIBUTE_READONLY; + res = SetFileAttributesW(PyUnicode_AS_UNICODE(po), attr); } - /* Drop the argument parsing error as narrow strings - are also valid. */ - PyErr_Clear(); + else + res = 0; + Py_END_ALLOW_THREADS + if (!res) + return win32_error_unicode("chmod", + PyUnicode_AS_UNICODE(po)); + Py_INCREF(Py_None); + return Py_None; } + /* Drop the argument parsing error as narrow strings + are also valid. */ + PyErr_Clear(); + if (!PyArg_ParseTuple(args, "eti:chmod", Py_FileSystemDefaultEncoding, &path, &i)) return NULL; @@ -2106,33 +2062,31 @@ #ifdef MS_WINDOWS DWORD len; - if (unicode_file_names()) { - wchar_t wbuf[1026]; - wchar_t *wbuf2 = wbuf; - PyObject *resobj; - Py_BEGIN_ALLOW_THREADS - len = GetCurrentDirectoryW(sizeof wbuf/ sizeof wbuf[0], wbuf); - /* If the buffer is large enough, len does not include the - terminating \0. If the buffer is too small, len includes - the space needed for the terminator. */ - if (len >= sizeof wbuf/ sizeof wbuf[0]) { - wbuf2 = malloc(len * sizeof(wchar_t)); - if (wbuf2) - len = GetCurrentDirectoryW(len, wbuf2); - } - Py_END_ALLOW_THREADS - if (!wbuf2) { - PyErr_NoMemory(); - return NULL; - } - if (!len) { - if (wbuf2 != wbuf) free(wbuf2); - return win32_error("getcwdu", NULL); - } - resobj = PyUnicode_FromWideChar(wbuf2, len); + wchar_t wbuf[1026]; + wchar_t *wbuf2 = wbuf; + PyObject *resobj; + Py_BEGIN_ALLOW_THREADS + len = GetCurrentDirectoryW(sizeof wbuf/ sizeof wbuf[0], wbuf); + /* If the buffer is large enough, len does not include the + terminating \0. If the buffer is too small, len includes + the space needed for the terminator. */ + if (len >= sizeof wbuf/ sizeof wbuf[0]) { + wbuf2 = malloc(len * sizeof(wchar_t)); + if (wbuf2) + len = GetCurrentDirectoryW(len, wbuf2); + } + Py_END_ALLOW_THREADS + if (!wbuf2) { + PyErr_NoMemory(); + return NULL; + } + if (!len) { if (wbuf2 != wbuf) free(wbuf2); - return resobj; + return win32_error("getcwdu", NULL); } + resobj = PyUnicode_FromWideChar(wbuf2, len); + if (wbuf2 != wbuf) free(wbuf2); + return resobj; #endif /* MS_WINDOWS */ Py_BEGIN_ALLOW_THREADS @@ -2187,88 +2141,84 @@ char *bufptr = namebuf; Py_ssize_t len = sizeof(namebuf)-5; /* only claim to have space for MAX_PATH */ - /* If on wide-character-capable OS see if argument - is Unicode and if so use wide API. */ - if (unicode_file_names()) { - PyObject *po; - if (PyArg_ParseTuple(args, "U:listdir", &po)) { - WIN32_FIND_DATAW wFileData; - Py_UNICODE *wnamebuf; - /* Overallocate for \\*.*\0 */ - len = PyUnicode_GET_SIZE(po); - wnamebuf = malloc((len + 5) * sizeof(wchar_t)); - if (!wnamebuf) { - PyErr_NoMemory(); - return NULL; - } - wcscpy(wnamebuf, PyUnicode_AS_UNICODE(po)); - if (len > 0) { - Py_UNICODE wch = wnamebuf[len-1]; - if (wch != L'/' && wch != L'\\' && wch != L':') - wnamebuf[len++] = L'\\'; - wcscpy(wnamebuf + len, L"*.*"); - } - if ((d = PyList_New(0)) == NULL) { + PyObject *po; + if (PyArg_ParseTuple(args, "U:listdir", &po)) { + WIN32_FIND_DATAW wFileData; + Py_UNICODE *wnamebuf; + /* Overallocate for \\*.*\0 */ + len = PyUnicode_GET_SIZE(po); + wnamebuf = malloc((len + 5) * sizeof(wchar_t)); + if (!wnamebuf) { + PyErr_NoMemory(); + return NULL; + } + wcscpy(wnamebuf, PyUnicode_AS_UNICODE(po)); + if (len > 0) { + Py_UNICODE wch = wnamebuf[len-1]; + if (wch != L'/' && wch != L'\\' && wch != L':') + wnamebuf[len++] = L'\\'; + wcscpy(wnamebuf + len, L"*.*"); + } + if ((d = PyList_New(0)) == NULL) { + free(wnamebuf); + return NULL; + } + hFindFile = FindFirstFileW(wnamebuf, &wFileData); + if (hFindFile == INVALID_HANDLE_VALUE) { + int error = GetLastError(); + if (error == ERROR_FILE_NOT_FOUND) { free(wnamebuf); - return NULL; + return d; } - hFindFile = FindFirstFileW(wnamebuf, &wFileData); - if (hFindFile == INVALID_HANDLE_VALUE) { - int error = GetLastError(); - if (error == ERROR_FILE_NOT_FOUND) { - free(wnamebuf); - return d; + Py_DECREF(d); + win32_error_unicode("FindFirstFileW", wnamebuf); + free(wnamebuf); + return NULL; + } + do { + /* Skip over . and .. */ + if (wcscmp(wFileData.cFileName, L".") != 0 && + wcscmp(wFileData.cFileName, L"..") != 0) { + v = PyUnicode_FromUnicode(wFileData.cFileName, wcslen(wFileData.cFileName)); + if (v == NULL) { + Py_DECREF(d); + d = NULL; + break; } - Py_DECREF(d); - win32_error_unicode("FindFirstFileW", wnamebuf); - free(wnamebuf); - return NULL; - } - do { - /* Skip over . and .. */ - if (wcscmp(wFileData.cFileName, L".") != 0 && - wcscmp(wFileData.cFileName, L"..") != 0) { - v = PyUnicode_FromUnicode(wFileData.cFileName, wcslen(wFileData.cFileName)); - if (v == NULL) { - Py_DECREF(d); - d = NULL; - break; - } - if (PyList_Append(d, v) != 0) { - Py_DECREF(v); - Py_DECREF(d); - d = NULL; - break; - } + if (PyList_Append(d, v) != 0) { Py_DECREF(v); + Py_DECREF(d); + d = NULL; + break; } - Py_BEGIN_ALLOW_THREADS - result = FindNextFileW(hFindFile, &wFileData); - Py_END_ALLOW_THREADS - /* FindNextFile sets error to ERROR_NO_MORE_FILES if - it got to the end of the directory. */ - if (!result && GetLastError() != ERROR_NO_MORE_FILES) { - Py_DECREF(d); - win32_error_unicode("FindNextFileW", wnamebuf); - FindClose(hFindFile); - free(wnamebuf); - return NULL; - } - } while (result == TRUE); - - if (FindClose(hFindFile) == FALSE) { - Py_DECREF(d); - win32_error_unicode("FindClose", wnamebuf); - free(wnamebuf); - return NULL; + Py_DECREF(v); + } + Py_BEGIN_ALLOW_THREADS + result = FindNextFileW(hFindFile, &wFileData); + Py_END_ALLOW_THREADS + /* FindNextFile sets error to ERROR_NO_MORE_FILES if + it got to the end of the directory. */ + if (!result && GetLastError() != ERROR_NO_MORE_FILES) { + Py_DECREF(d); + win32_error_unicode("FindNextFileW", wnamebuf); + FindClose(hFindFile); + free(wnamebuf); + return NULL; } + } while (result == TRUE); + + if (FindClose(hFindFile) == FALSE) { + Py_DECREF(d); + win32_error_unicode("FindClose", wnamebuf); free(wnamebuf); - return d; + return NULL; } - /* Drop the argument parsing error as narrow strings - are also valid. */ - PyErr_Clear(); + free(wnamebuf); + return d; } + /* Drop the argument parsing error as narrow strings + are also valid. */ + PyErr_Clear(); if (!PyArg_ParseTuple(args, "et#:listdir", Py_FileSystemDefaultEncoding, &bufptr, &len)) @@ -2493,35 +2443,33 @@ char outbuf[MAX_PATH*2]; char *temp; - if (unicode_file_names()) { - PyUnicodeObject *po; - if (PyArg_ParseTuple(args, "U|:_getfullpathname", &po)) { - Py_UNICODE *wpath = PyUnicode_AS_UNICODE(po); - Py_UNICODE woutbuf[MAX_PATH*2], *woutbufp = woutbuf; - Py_UNICODE *wtemp; - DWORD result; - PyObject *v; - result = GetFullPathNameW(wpath, - sizeof(woutbuf)/sizeof(woutbuf[0]), - woutbuf, &wtemp); - if (result > sizeof(woutbuf)/sizeof(woutbuf[0])) { - woutbufp = malloc(result * sizeof(Py_UNICODE)); - if (!woutbufp) - return PyErr_NoMemory(); - result = GetFullPathNameW(wpath, result, woutbufp, &wtemp); - } - if (result) - v = PyUnicode_FromUnicode(woutbufp, wcslen(woutbufp)); - else - v = win32_error_unicode("GetFullPathNameW", wpath); - if (woutbufp != woutbuf) - free(woutbufp); - return v; + PyUnicodeObject *po; + if (PyArg_ParseTuple(args, "U|:_getfullpathname", &po)) { + Py_UNICODE *wpath = PyUnicode_AS_UNICODE(po); + Py_UNICODE woutbuf[MAX_PATH*2], *woutbufp = woutbuf; + Py_UNICODE *wtemp; + DWORD result; + PyObject *v; + result = GetFullPathNameW(wpath, + sizeof(woutbuf)/sizeof(woutbuf[0]), + woutbuf, &wtemp); + if (result > sizeof(woutbuf)/sizeof(woutbuf[0])) { + woutbufp = malloc(result * sizeof(Py_UNICODE)); + if (!woutbufp) + return PyErr_NoMemory(); + result = GetFullPathNameW(wpath, result, woutbufp, &wtemp); } - /* Drop the argument parsing error as narrow strings - are also valid. */ - PyErr_Clear(); - } + if (result) + v = PyUnicode_FromUnicode(woutbufp, wcslen(woutbufp)); + else + v = win32_error_unicode("GetFullPathNameW", wpath); + if (woutbufp != woutbuf) + free(woutbufp); + return v; + } + /* Drop the argument parsing error as narrow strings + are also valid. */ + PyErr_Clear(); if (!PyArg_ParseTuple (args, "et#:_getfullpathname", Py_FileSystemDefaultEncoding, &inbufp, @@ -2550,23 +2498,21 @@ int mode = 0777; #ifdef MS_WINDOWS - if (unicode_file_names()) { - PyUnicodeObject *po; - if (PyArg_ParseTuple(args, "U|i:mkdir", &po, &mode)) { - Py_BEGIN_ALLOW_THREADS - /* PyUnicode_AS_UNICODE OK without thread lock as - it is a simple dereference. */ - res = CreateDirectoryW(PyUnicode_AS_UNICODE(po), NULL); - Py_END_ALLOW_THREADS - if (!res) - return win32_error_unicode("mkdir", PyUnicode_AS_UNICODE(po)); - Py_INCREF(Py_None); - return Py_None; - } - /* Drop the argument parsing error as narrow strings - are also valid. */ - PyErr_Clear(); + PyUnicodeObject *po; + if (PyArg_ParseTuple(args, "U|i:mkdir", &po, &mode)) { + Py_BEGIN_ALLOW_THREADS + /* PyUnicode_AS_UNICODE OK without thread lock as + it is a simple dereference. */ + res = CreateDirectoryW(PyUnicode_AS_UNICODE(po), NULL); + Py_END_ALLOW_THREADS + if (!res) + return win32_error_unicode("mkdir", PyUnicode_AS_UNICODE(po)); + Py_INCREF(Py_None); + return Py_None; } + /* Drop the argument parsing error as narrow strings + are also valid. */ + PyErr_Clear(); if (!PyArg_ParseTuple(args, "et|i:mkdir", Py_FileSystemDefaultEncoding, &path, &mode)) return NULL; @@ -2657,28 +2603,26 @@ PyObject *o1, *o2; char *p1, *p2; BOOL result; - if (unicode_file_names()) { - if (!PyArg_ParseTuple(args, "OO:rename", &o1, &o2)) + if (!PyArg_ParseTuple(args, "OO:rename", &o1, &o2)) goto error; - if (!convert_to_unicode(&o1)) + if (!convert_to_unicode(&o1)) goto error; - if (!convert_to_unicode(&o2)) { + if (!convert_to_unicode(&o2)) { Py_DECREF(o1); goto error; - } - Py_BEGIN_ALLOW_THREADS - result = MoveFileW(PyUnicode_AsUnicode(o1), - PyUnicode_AsUnicode(o2)); - Py_END_ALLOW_THREADS - Py_DECREF(o1); - Py_DECREF(o2); - if (!result) - return win32_error("rename", NULL); - Py_INCREF(Py_None); - return Py_None; -error: - PyErr_Clear(); } + Py_BEGIN_ALLOW_THREADS + result = MoveFileW(PyUnicode_AsUnicode(o1), + PyUnicode_AsUnicode(o2)); + Py_END_ALLOW_THREADS + Py_DECREF(o1); + Py_DECREF(o2); + if (!result) + return win32_error("rename", NULL); + Py_INCREF(Py_None); + return Py_None; +error: + PyErr_Clear(); if (!PyArg_ParseTuple(args, "ss:rename", &p1, &p2)) return NULL; Py_BEGIN_ALLOW_THREADS @@ -2853,21 +2797,20 @@ FILETIME atime, mtime; PyObject *result = NULL; - if (unicode_file_names()) { - if (PyArg_ParseTuple(args, "UO|:utime", &obwpath, &arg)) { - wpath = PyUnicode_AS_UNICODE(obwpath); - Py_BEGIN_ALLOW_THREADS - hFile = CreateFileW(wpath, FILE_WRITE_ATTRIBUTES, 0, - NULL, OPEN_EXISTING, - FILE_FLAG_BACKUP_SEMANTICS, NULL); - Py_END_ALLOW_THREADS - if (hFile == INVALID_HANDLE_VALUE) - return win32_error_unicode("utime", wpath); - } else - /* Drop the argument parsing error as narrow strings - are also valid. */ - PyErr_Clear(); - } + if (PyArg_ParseTuple(args, "UO|:utime", &obwpath, &arg)) { + wpath = PyUnicode_AS_UNICODE(obwpath); + Py_BEGIN_ALLOW_THREADS + hFile = CreateFileW(wpath, FILE_WRITE_ATTRIBUTES, 0, + NULL, OPEN_EXISTING, + FILE_FLAG_BACKUP_SEMANTICS, NULL); + Py_END_ALLOW_THREADS + if (hFile == INVALID_HANDLE_VALUE) + return win32_error_unicode("utime", wpath); + } else + /* Drop the argument parsing error as narrow strings + are also valid. */ + PyErr_Clear(); + if (!wpath) { if (!PyArg_ParseTuple(args, "etO:utime", Py_FileSystemDefaultEncoding, &apath, &arg)) @@ -6296,22 +6239,20 @@ int fd; #ifdef MS_WINDOWS - if (unicode_file_names()) { - PyUnicodeObject *po; - if (PyArg_ParseTuple(args, "Ui|i:mkdir", &po, &flag, &mode)) { - Py_BEGIN_ALLOW_THREADS - /* PyUnicode_AS_UNICODE OK without thread - lock as it is a simple dereference. */ - fd = _wopen(PyUnicode_AS_UNICODE(po), flag, mode); - Py_END_ALLOW_THREADS - if (fd < 0) - return posix_error(); - return PyInt_FromLong((long)fd); - } - /* Drop the argument parsing error as narrow strings - are also valid. */ - PyErr_Clear(); + PyUnicodeObject *po; + if (PyArg_ParseTuple(args, "Ui|i:mkdir", &po, &flag, &mode)) { + Py_BEGIN_ALLOW_THREADS + /* PyUnicode_AS_UNICODE OK without thread + lock as it is a simple dereference. */ + fd = _wopen(PyUnicode_AS_UNICODE(po), flag, mode); + Py_END_ALLOW_THREADS + if (fd < 0) + return posix_error(); + return PyInt_FromLong((long)fd); } + /* Drop the argument parsing error as narrow strings + are also valid. */ + PyErr_Clear(); #endif if (!PyArg_ParseTuple(args, "eti|i", @@ -8290,40 +8231,37 @@ char *operation = NULL; HINSTANCE rc; - if (unicode_file_names()) { - PyObject *unipath, *woperation = NULL; - if (!PyArg_ParseTuple(args, "U|s:startfile", - &unipath, &operation)) { + PyObject *unipath, *woperation = NULL; + if (!PyArg_ParseTuple(args, "U|s:startfile", + &unipath, &operation)) { + PyErr_Clear(); + goto normal; + } + + if (operation) { + woperation = PyUnicode_DecodeASCII(operation, + strlen(operation), NULL); + if (!woperation) { PyErr_Clear(); + operation = NULL; goto normal; } + } + Py_BEGIN_ALLOW_THREADS + rc = ShellExecuteW((HWND)0, woperation ? PyUnicode_AS_UNICODE(woperation) : 0, + PyUnicode_AS_UNICODE(unipath), + NULL, NULL, SW_SHOWNORMAL); + Py_END_ALLOW_THREADS - if (operation) { - woperation = PyUnicode_DecodeASCII(operation, - strlen(operation), NULL); - if (!woperation) { - PyErr_Clear(); - operation = NULL; - goto normal; - } - } - - Py_BEGIN_ALLOW_THREADS - rc = ShellExecuteW((HWND)0, woperation ? PyUnicode_AS_UNICODE(woperation) : 0, - PyUnicode_AS_UNICODE(unipath), - NULL, NULL, SW_SHOWNORMAL); - Py_END_ALLOW_THREADS - - Py_XDECREF(woperation); - if (rc <= (HINSTANCE)32) { - PyObject *errval = win32_error_unicode("startfile", - PyUnicode_AS_UNICODE(unipath)); - return errval; - } - Py_INCREF(Py_None); - return Py_None; + Py_XDECREF(woperation); + if (rc <= (HINSTANCE)32) { + PyObject *errval = win32_error_unicode("startfile", + PyUnicode_AS_UNICODE(unipath)); + return errval; } + Py_INCREF(Py_None); + return Py_None; normal: if (!PyArg_ParseTuple(args, "et|s:startfile", Modified: python/trunk/Objects/fileobject.c ============================================================================== --- python/trunk/Objects/fileobject.c (original) +++ python/trunk/Objects/fileobject.c Sun Jun 28 12:23:00 2009 @@ -16,12 +16,6 @@ #include #endif -#ifdef _MSC_VER -/* Need GetVersion to see if on NT so safe to use _wfopen */ -#define WIN32_LEAN_AND_MEAN -#include -#endif /* _MSC_VER */ - #if defined(PYOS_OS2) && defined(PYCC_GCC) #include #endif @@ -2244,6 +2238,7 @@ char *mode = "r"; int bufsize = -1; int wideargument = 0; + PyObject *po; assert(PyFile_Check(self)); if (foself->f_fp != NULL) { @@ -2255,19 +2250,16 @@ } #ifdef MS_WINDOWS - if (GetVersion() < 0x80000000) { /* On NT, so wide API available */ - PyObject *po; - if (PyArg_ParseTupleAndKeywords(args, kwds, "U|si:file", - kwlist, &po, &mode, &bufsize)) { - wideargument = 1; - if (fill_file_fields(foself, NULL, po, mode, - fclose) == NULL) - goto Error; - } else { - /* Drop the argument parsing error as narrow - strings are also valid. */ - PyErr_Clear(); - } + if (PyArg_ParseTupleAndKeywords(args, kwds, "U|si:file", + kwlist, &po, &mode, &bufsize)) { + wideargument = 1; + if (fill_file_fields(foself, NULL, po, mode, + fclose) == NULL) + goto Error; + } else { + /* Drop the argument parsing error as narrow + strings are also valid. */ + PyErr_Clear(); } #endif Modified: python/trunk/PC/pyconfig.h ============================================================================== --- python/trunk/PC/pyconfig.h (original) +++ python/trunk/PC/pyconfig.h Sun Jun 28 12:23:00 2009 @@ -95,12 +95,6 @@ #endif #ifdef MS_WINCE -/* Python uses GetVersion() to distinguish between - * Windows NT and 9x/ME where OS Unicode support is concerned. - * Windows CE supports Unicode in the same way as NT so we - * define the missing GetVersion() accordingly. - */ -#define GetVersion() (4) /* Windows CE does not support environment variables */ #define getenv(v) (NULL) #define environ (NULL) From python-checkins at python.org Sun Jun 28 13:07:03 2009 From: python-checkins at python.org (hirokazu.yamamoto) Date: Sun, 28 Jun 2009 11:07:03 -0000 Subject: [Python-checkins] r73604 - in python/branches/py3k: Misc/NEWS Modules/_io/fileio.c Modules/posixmodule.c PC/pyconfig.h Message-ID: Author: hirokazu.yamamoto Date: Sun Jun 28 13:07:03 2009 New Revision: 73604 Log: Merged revisions 73603 via svnmerge from svn+ssh://pythondev at svn.python.org/python/trunk ........ r73603 | hirokazu.yamamoto | 2009-06-28 19:23:00 +0900 | 1 line Issue #4856: Remove checks for win NT. ........ Modified: python/branches/py3k/ (props changed) python/branches/py3k/Misc/NEWS python/branches/py3k/Modules/_io/fileio.c python/branches/py3k/Modules/posixmodule.c python/branches/py3k/PC/pyconfig.h Modified: python/branches/py3k/Misc/NEWS ============================================================================== --- python/branches/py3k/Misc/NEWS (original) +++ python/branches/py3k/Misc/NEWS Sun Jun 28 13:07:03 2009 @@ -12,6 +12,8 @@ Core and Builtins ----------------- +- Issue #4856: Remove checks for win NT. + Library ------- Modified: python/branches/py3k/Modules/_io/fileio.c ============================================================================== --- python/branches/py3k/Modules/_io/fileio.c (original) +++ python/branches/py3k/Modules/_io/fileio.c Sun Jun 28 13:07:03 2009 @@ -224,11 +224,8 @@ } #ifdef MS_WINDOWS - if (GetVersion() < 0x80000000) { - /* On NT, so wide API available */ - if (PyUnicode_Check(nameobj)) - widename = PyUnicode_AS_UNICODE(nameobj); - } + if (PyUnicode_Check(nameobj)) + widename = PyUnicode_AS_UNICODE(nameobj); if (widename == NULL) #endif if (fd < 0) Modified: python/branches/py3k/Modules/posixmodule.c ============================================================================== --- python/branches/py3k/Modules/posixmodule.c (original) +++ python/branches/py3k/Modules/posixmodule.c Sun Jun 28 13:07:03 2009 @@ -759,20 +759,6 @@ return Py_None; } -#ifdef MS_WINDOWS -static int -unicode_file_names(void) -{ - static int canusewide = -1; - if (canusewide == -1) { - /* As per doc for ::GetVersion(), this is the correct test for - the Windows NT family. */ - canusewide = (GetVersion() < 0x80000000) ? 1 : 0; - } - return canusewide; -} -#endif - static PyObject * posix_1str(PyObject *args, char *format, int (*func)(const char*)) { @@ -829,18 +815,17 @@ PyObject *uni; char *ansi; BOOL result; - if (unicode_file_names()) { - if (!PyArg_ParseTuple(args, wformat, &uni)) - PyErr_Clear(); - else { - Py_BEGIN_ALLOW_THREADS - result = funcW(PyUnicode_AsUnicode(uni)); - Py_END_ALLOW_THREADS - if (!result) - return win32_error_unicode(func, PyUnicode_AsUnicode(uni)); - Py_INCREF(Py_None); - return Py_None; - } + + if (!PyArg_ParseTuple(args, wformat, &uni)) + PyErr_Clear(); + else { + Py_BEGIN_ALLOW_THREADS + result = funcW(PyUnicode_AsUnicode(uni)); + Py_END_ALLOW_THREADS + if (!result) + return win32_error_unicode(func, PyUnicode_AsUnicode(uni)); + Py_INCREF(Py_None); + return Py_None; } if (!PyArg_ParseTuple(args, format, &ansi)) return NULL; @@ -1003,22 +988,6 @@ return 0; } -/* Emulate GetFileAttributesEx[AW] on Windows 95 */ -static int checked = 0; -static BOOL (CALLBACK *gfaxa)(LPCSTR, GET_FILEEX_INFO_LEVELS, LPVOID); -static BOOL (CALLBACK *gfaxw)(LPCWSTR, GET_FILEEX_INFO_LEVELS, LPVOID); -static void -check_gfax() -{ - HINSTANCE hKernel32; - if (checked) - return; - checked = 1; - hKernel32 = GetModuleHandle("KERNEL32"); - *(FARPROC*)&gfaxa = GetProcAddress(hKernel32, "GetFileAttributesExA"); - *(FARPROC*)&gfaxw = GetProcAddress(hKernel32, "GetFileAttributesExW"); -} - static BOOL attributes_from_dir(LPCSTR pszFile, LPWIN32_FILE_ATTRIBUTE_DATA pfad) { @@ -1065,12 +1034,9 @@ /* First try to use the system's implementation, if that is available and either succeeds to gives an error other than that it isn't implemented. */ - check_gfax(); - if (gfaxa) { - result = gfaxa(pszFile, level, pv); - if (result || GetLastError() != ERROR_CALL_NOT_IMPLEMENTED) - return result; - } + result = GetFileAttributesExA(pszFile, level, pv); + if (result || GetLastError() != ERROR_CALL_NOT_IMPLEMENTED) + return result; /* It's either not present, or not implemented. Emulate using FindFirstFile. */ if (level != GetFileExInfoStandard) { @@ -1095,12 +1061,9 @@ /* First try to use the system's implementation, if that is available and either succeeds to gives an error other than that it isn't implemented. */ - check_gfax(); - if (gfaxa) { - result = gfaxw(pszFile, level, pv); - if (result || GetLastError() != ERROR_CALL_NOT_IMPLEMENTED) - return result; - } + result = GetFileAttributesExW(pszFile, level, pv); + if (result || GetLastError() != ERROR_CALL_NOT_IMPLEMENTED) + return result; /* It's either not present, or not implemented. Emulate using FindFirstFile. */ if (level != GetFileExInfoStandard) { @@ -1618,27 +1581,23 @@ PyObject *result; #ifdef MS_WINDOWS - /* If on wide-character-capable OS see if argument - is Unicode and if so use wide API. */ - if (unicode_file_names()) { - PyUnicodeObject *po; - if (PyArg_ParseTuple(args, wformat, &po)) { - Py_UNICODE *wpath = PyUnicode_AS_UNICODE(po); + PyUnicodeObject *po; + if (PyArg_ParseTuple(args, wformat, &po)) { + Py_UNICODE *wpath = PyUnicode_AS_UNICODE(po); - Py_BEGIN_ALLOW_THREADS - /* PyUnicode_AS_UNICODE result OK without - thread lock as it is a simple dereference. */ - res = wstatfunc(wpath, &st); - Py_END_ALLOW_THREADS + Py_BEGIN_ALLOW_THREADS + /* PyUnicode_AS_UNICODE result OK without + thread lock as it is a simple dereference. */ + res = wstatfunc(wpath, &st); + Py_END_ALLOW_THREADS - if (res != 0) - return win32_error_unicode("stat", wpath); - return _pystat_fromstructstat(&st); - } - /* Drop the argument parsing error as narrow strings - are also valid. */ - PyErr_Clear(); - } + if (res != 0) + return win32_error_unicode("stat", wpath); + return _pystat_fromstructstat(&st); + } + /* Drop the argument parsing error as narrow strings + are also valid. */ + PyErr_Clear(); #endif if (!PyArg_ParseTuple(args, format, @@ -1682,23 +1641,21 @@ #ifdef MS_WINDOWS DWORD attr; - if (unicode_file_names()) { - PyUnicodeObject *po; - if (PyArg_ParseTuple(args, "Ui:access", &po, &mode)) { - Py_BEGIN_ALLOW_THREADS - /* PyUnicode_AS_UNICODE OK without thread lock as - it is a simple dereference. */ - attr = GetFileAttributesW(PyUnicode_AS_UNICODE(po)); - Py_END_ALLOW_THREADS - goto finish; - } - /* Drop the argument parsing error as narrow strings - are also valid. */ - PyErr_Clear(); + PyUnicodeObject *po; + if (PyArg_ParseTuple(args, "Ui:access", &po, &mode)) { + Py_BEGIN_ALLOW_THREADS + /* PyUnicode_AS_UNICODE OK without thread lock as + it is a simple dereference. */ + attr = GetFileAttributesW(PyUnicode_AS_UNICODE(po)); + Py_END_ALLOW_THREADS + goto finish; } + /* Drop the argument parsing error as narrow strings + are also valid. */ + PyErr_Clear(); if (!PyArg_ParseTuple(args, "O&i:access", PyUnicode_FSConverter, &opath, &mode)) - return 0; + return NULL; path = bytes2str(opath, 1); Py_BEGIN_ALLOW_THREADS attr = GetFileAttributesA(path); @@ -1839,31 +1796,30 @@ int res; #ifdef MS_WINDOWS DWORD attr; - if (unicode_file_names()) { - PyUnicodeObject *po; - if (PyArg_ParseTuple(args, "Ui|:chmod", &po, &i)) { - Py_BEGIN_ALLOW_THREADS - attr = GetFileAttributesW(PyUnicode_AS_UNICODE(po)); - if (attr != 0xFFFFFFFF) { - if (i & _S_IWRITE) - attr &= ~FILE_ATTRIBUTE_READONLY; - else - attr |= FILE_ATTRIBUTE_READONLY; - res = SetFileAttributesW(PyUnicode_AS_UNICODE(po), attr); - } + PyUnicodeObject *po; + if (PyArg_ParseTuple(args, "Ui|:chmod", &po, &i)) { + Py_BEGIN_ALLOW_THREADS + attr = GetFileAttributesW(PyUnicode_AS_UNICODE(po)); + if (attr != 0xFFFFFFFF) { + if (i & _S_IWRITE) + attr &= ~FILE_ATTRIBUTE_READONLY; else - res = 0; - Py_END_ALLOW_THREADS - if (!res) - return win32_error_unicode("chmod", - PyUnicode_AS_UNICODE(po)); - Py_INCREF(Py_None); - return Py_None; + attr |= FILE_ATTRIBUTE_READONLY; + res = SetFileAttributesW(PyUnicode_AS_UNICODE(po), attr); } - /* Drop the argument parsing error as narrow strings - are also valid. */ - PyErr_Clear(); + else + res = 0; + Py_END_ALLOW_THREADS + if (!res) + return win32_error_unicode("chmod", + PyUnicode_AS_UNICODE(po)); + Py_INCREF(Py_None); + return Py_None; } + /* Drop the argument parsing error as narrow strings + are also valid. */ + PyErr_Clear(); + if (!PyArg_ParseTuple(args, "O&i:chmod", PyUnicode_FSConverter, &opath, &i)) return NULL; @@ -2139,7 +2095,7 @@ char *res; #ifdef MS_WINDOWS - if (!use_bytes && unicode_file_names()) { + if (!use_bytes) { wchar_t wbuf[1026]; wchar_t *wbuf2 = wbuf; PyObject *resobj; @@ -2243,88 +2199,84 @@ char *bufptr = namebuf; Py_ssize_t len = sizeof(namebuf)-5; /* only claim to have space for MAX_PATH */ - /* If on wide-character-capable OS see if argument - is Unicode and if so use wide API. */ - if (unicode_file_names()) { - PyObject *po; - if (PyArg_ParseTuple(args, "U:listdir", &po)) { - WIN32_FIND_DATAW wFileData; - Py_UNICODE *wnamebuf; - /* Overallocate for \\*.*\0 */ - len = PyUnicode_GET_SIZE(po); - wnamebuf = malloc((len + 5) * sizeof(wchar_t)); - if (!wnamebuf) { - PyErr_NoMemory(); - return NULL; - } - wcscpy(wnamebuf, PyUnicode_AS_UNICODE(po)); - if (len > 0) { - Py_UNICODE wch = wnamebuf[len-1]; - if (wch != L'/' && wch != L'\\' && wch != L':') - wnamebuf[len++] = L'\\'; - wcscpy(wnamebuf + len, L"*.*"); - } - if ((d = PyList_New(0)) == NULL) { + PyObject *po; + if (PyArg_ParseTuple(args, "U:listdir", &po)) { + WIN32_FIND_DATAW wFileData; + Py_UNICODE *wnamebuf; + /* Overallocate for \\*.*\0 */ + len = PyUnicode_GET_SIZE(po); + wnamebuf = malloc((len + 5) * sizeof(wchar_t)); + if (!wnamebuf) { + PyErr_NoMemory(); + return NULL; + } + wcscpy(wnamebuf, PyUnicode_AS_UNICODE(po)); + if (len > 0) { + Py_UNICODE wch = wnamebuf[len-1]; + if (wch != L'/' && wch != L'\\' && wch != L':') + wnamebuf[len++] = L'\\'; + wcscpy(wnamebuf + len, L"*.*"); + } + if ((d = PyList_New(0)) == NULL) { + free(wnamebuf); + return NULL; + } + hFindFile = FindFirstFileW(wnamebuf, &wFileData); + if (hFindFile == INVALID_HANDLE_VALUE) { + int error = GetLastError(); + if (error == ERROR_FILE_NOT_FOUND) { free(wnamebuf); - return NULL; + return d; } - hFindFile = FindFirstFileW(wnamebuf, &wFileData); - if (hFindFile == INVALID_HANDLE_VALUE) { - int error = GetLastError(); - if (error == ERROR_FILE_NOT_FOUND) { - free(wnamebuf); - return d; + Py_DECREF(d); + win32_error_unicode("FindFirstFileW", wnamebuf); + free(wnamebuf); + return NULL; + } + do { + /* Skip over . and .. */ + if (wcscmp(wFileData.cFileName, L".") != 0 && + wcscmp(wFileData.cFileName, L"..") != 0) { + v = PyUnicode_FromUnicode(wFileData.cFileName, wcslen(wFileData.cFileName)); + if (v == NULL) { + Py_DECREF(d); + d = NULL; + break; } - Py_DECREF(d); - win32_error_unicode("FindFirstFileW", wnamebuf); - free(wnamebuf); - return NULL; - } - do { - /* Skip over . and .. */ - if (wcscmp(wFileData.cFileName, L".") != 0 && - wcscmp(wFileData.cFileName, L"..") != 0) { - v = PyUnicode_FromUnicode(wFileData.cFileName, wcslen(wFileData.cFileName)); - if (v == NULL) { - Py_DECREF(d); - d = NULL; - break; - } - if (PyList_Append(d, v) != 0) { - Py_DECREF(v); - Py_DECREF(d); - d = NULL; - break; - } + if (PyList_Append(d, v) != 0) { Py_DECREF(v); + Py_DECREF(d); + d = NULL; + break; } - Py_BEGIN_ALLOW_THREADS - result = FindNextFileW(hFindFile, &wFileData); - Py_END_ALLOW_THREADS - /* FindNextFile sets error to ERROR_NO_MORE_FILES if - it got to the end of the directory. */ - if (!result && GetLastError() != ERROR_NO_MORE_FILES) { - Py_DECREF(d); - win32_error_unicode("FindNextFileW", wnamebuf); - FindClose(hFindFile); - free(wnamebuf); - return NULL; - } - } while (result == TRUE); - - if (FindClose(hFindFile) == FALSE) { - Py_DECREF(d); - win32_error_unicode("FindClose", wnamebuf); - free(wnamebuf); - return NULL; + Py_DECREF(v); + } + Py_BEGIN_ALLOW_THREADS + result = FindNextFileW(hFindFile, &wFileData); + Py_END_ALLOW_THREADS + /* FindNextFile sets error to ERROR_NO_MORE_FILES if + it got to the end of the directory. */ + if (!result && GetLastError() != ERROR_NO_MORE_FILES) { + Py_DECREF(d); + win32_error_unicode("FindNextFileW", wnamebuf); + FindClose(hFindFile); + free(wnamebuf); + return NULL; } + } while (result == TRUE); + + if (FindClose(hFindFile) == FALSE) { + Py_DECREF(d); + win32_error_unicode("FindClose", wnamebuf); free(wnamebuf); - return d; + return NULL; } - /* Drop the argument parsing error as narrow strings - are also valid. */ - PyErr_Clear(); + free(wnamebuf); + return d; } + /* Drop the argument parsing error as narrow strings + are also valid. */ + PyErr_Clear(); if (!PyArg_ParseTuple(args, "O&:listdir", PyUnicode_FSConverter, &opath)) @@ -2562,35 +2514,34 @@ char outbuf[MAX_PATH*2]; char *temp; #ifdef MS_WINDOWS - if (unicode_file_names()) { - PyUnicodeObject *po; - if (PyArg_ParseTuple(args, "U|:_getfullpathname", &po)) { - Py_UNICODE *wpath = PyUnicode_AS_UNICODE(po); - Py_UNICODE woutbuf[MAX_PATH*2], *woutbufp = woutbuf; - Py_UNICODE *wtemp; - DWORD result; - PyObject *v; - result = GetFullPathNameW(wpath, - sizeof(woutbuf)/sizeof(woutbuf[0]), - woutbuf, &wtemp); - if (result > sizeof(woutbuf)/sizeof(woutbuf[0])) { - woutbufp = malloc(result * sizeof(Py_UNICODE)); - if (!woutbufp) - return PyErr_NoMemory(); - result = GetFullPathNameW(wpath, result, woutbufp, &wtemp); - } - if (result) - v = PyUnicode_FromUnicode(woutbufp, wcslen(woutbufp)); - else - v = win32_error_unicode("GetFullPathNameW", wpath); - if (woutbufp != woutbuf) - free(woutbufp); - return v; + PyUnicodeObject *po; + if (PyArg_ParseTuple(args, "U|:_getfullpathname", &po)) { + Py_UNICODE *wpath = PyUnicode_AS_UNICODE(po); + Py_UNICODE woutbuf[MAX_PATH*2], *woutbufp = woutbuf; + Py_UNICODE *wtemp; + DWORD result; + PyObject *v; + result = GetFullPathNameW(wpath, + sizeof(woutbuf)/sizeof(woutbuf[0]), + woutbuf, &wtemp); + if (result > sizeof(woutbuf)/sizeof(woutbuf[0])) { + woutbufp = malloc(result * sizeof(Py_UNICODE)); + if (!woutbufp) + return PyErr_NoMemory(); + result = GetFullPathNameW(wpath, result, woutbufp, &wtemp); } - /* Drop the argument parsing error as narrow strings - are also valid. */ - PyErr_Clear(); - } + if (result) + v = PyUnicode_FromUnicode(woutbufp, wcslen(woutbufp)); + else + v = win32_error_unicode("GetFullPathNameW", wpath); + if (woutbufp != woutbuf) + free(woutbufp); + return v; + } + /* Drop the argument parsing error as narrow strings + are also valid. */ + PyErr_Clear(); + #endif if (!PyArg_ParseTuple (args, "O&:_getfullpathname", PyUnicode_FSConverter, &opath)) @@ -2624,23 +2575,21 @@ int mode = 0777; #ifdef MS_WINDOWS - if (unicode_file_names()) { - PyUnicodeObject *po; - if (PyArg_ParseTuple(args, "U|i:mkdir", &po, &mode)) { - Py_BEGIN_ALLOW_THREADS - /* PyUnicode_AS_UNICODE OK without thread lock as - it is a simple dereference. */ - res = CreateDirectoryW(PyUnicode_AS_UNICODE(po), NULL); - Py_END_ALLOW_THREADS - if (!res) - return win32_error_unicode("mkdir", PyUnicode_AS_UNICODE(po)); - Py_INCREF(Py_None); - return Py_None; - } - /* Drop the argument parsing error as narrow strings - are also valid. */ - PyErr_Clear(); + PyUnicodeObject *po; + if (PyArg_ParseTuple(args, "U|i:mkdir", &po, &mode)) { + Py_BEGIN_ALLOW_THREADS + /* PyUnicode_AS_UNICODE OK without thread lock as + it is a simple dereference. */ + res = CreateDirectoryW(PyUnicode_AS_UNICODE(po), NULL); + Py_END_ALLOW_THREADS + if (!res) + return win32_error_unicode("mkdir", PyUnicode_AS_UNICODE(po)); + Py_INCREF(Py_None); + return Py_None; } + /* Drop the argument parsing error as narrow strings + are also valid. */ + PyErr_Clear(); if (!PyArg_ParseTuple(args, "O&|i:mkdir", PyUnicode_FSConverter, &opath, &mode)) return NULL; @@ -2733,28 +2682,26 @@ PyObject *o1, *o2; char *p1, *p2; BOOL result; - if (unicode_file_names()) { - if (!PyArg_ParseTuple(args, "OO:rename", &o1, &o2)) + if (!PyArg_ParseTuple(args, "OO:rename", &o1, &o2)) goto error; - if (!convert_to_unicode(&o1)) + if (!convert_to_unicode(&o1)) goto error; - if (!convert_to_unicode(&o2)) { + if (!convert_to_unicode(&o2)) { Py_DECREF(o1); goto error; - } - Py_BEGIN_ALLOW_THREADS - result = MoveFileW(PyUnicode_AsUnicode(o1), - PyUnicode_AsUnicode(o2)); - Py_END_ALLOW_THREADS - Py_DECREF(o1); - Py_DECREF(o2); - if (!result) - return win32_error("rename", NULL); - Py_INCREF(Py_None); - return Py_None; -error: - PyErr_Clear(); } + Py_BEGIN_ALLOW_THREADS + result = MoveFileW(PyUnicode_AsUnicode(o1), + PyUnicode_AsUnicode(o2)); + Py_END_ALLOW_THREADS + Py_DECREF(o1); + Py_DECREF(o2); + if (!result) + return win32_error("rename", NULL); + Py_INCREF(Py_None); + return Py_None; +error: + PyErr_Clear(); if (!PyArg_ParseTuple(args, "ss:rename", &p1, &p2)) return NULL; Py_BEGIN_ALLOW_THREADS @@ -2940,21 +2887,20 @@ FILETIME atime, mtime; PyObject *result = NULL; - if (unicode_file_names()) { - if (PyArg_ParseTuple(args, "UO|:utime", &obwpath, &arg)) { - wpath = PyUnicode_AS_UNICODE(obwpath); - Py_BEGIN_ALLOW_THREADS - hFile = CreateFileW(wpath, FILE_WRITE_ATTRIBUTES, 0, - NULL, OPEN_EXISTING, - FILE_FLAG_BACKUP_SEMANTICS, NULL); - Py_END_ALLOW_THREADS - if (hFile == INVALID_HANDLE_VALUE) - return win32_error_unicode("utime", wpath); - } else - /* Drop the argument parsing error as narrow strings - are also valid. */ - PyErr_Clear(); - } + if (PyArg_ParseTuple(args, "UO|:utime", &obwpath, &arg)) { + wpath = PyUnicode_AS_UNICODE(obwpath); + Py_BEGIN_ALLOW_THREADS + hFile = CreateFileW(wpath, FILE_WRITE_ATTRIBUTES, 0, + NULL, OPEN_EXISTING, + FILE_FLAG_BACKUP_SEMANTICS, NULL); + Py_END_ALLOW_THREADS + if (hFile == INVALID_HANDLE_VALUE) + return win32_error_unicode("utime", wpath); + } else + /* Drop the argument parsing error as narrow strings + are also valid. */ + PyErr_Clear(); + if (!wpath) { if (!PyArg_ParseTuple(args, "O&O:utime", PyUnicode_FSConverter, &oapath, &arg)) @@ -4927,22 +4873,20 @@ int fd; #ifdef MS_WINDOWS - if (unicode_file_names()) { - PyUnicodeObject *po; - if (PyArg_ParseTuple(args, "Ui|i:mkdir", &po, &flag, &mode)) { - Py_BEGIN_ALLOW_THREADS - /* PyUnicode_AS_UNICODE OK without thread - lock as it is a simple dereference. */ - fd = _wopen(PyUnicode_AS_UNICODE(po), flag, mode); - Py_END_ALLOW_THREADS - if (fd < 0) - return posix_error(); - return PyLong_FromLong((long)fd); - } - /* Drop the argument parsing error as narrow strings - are also valid. */ - PyErr_Clear(); - } + PyUnicodeObject *po; + if (PyArg_ParseTuple(args, "Ui|i:mkdir", &po, &flag, &mode)) { + Py_BEGIN_ALLOW_THREADS + /* PyUnicode_AS_UNICODE OK without thread + lock as it is a simple dereference. */ + fd = _wopen(PyUnicode_AS_UNICODE(po), flag, mode); + Py_END_ALLOW_THREADS + if (fd < 0) + return posix_error(); + return PyLong_FromLong((long)fd); + } + /* Drop the argument parsing error as narrow strings + are also valid. */ + PyErr_Clear(); #endif if (!PyArg_ParseTuple(args, "O&i|i", @@ -6816,40 +6760,37 @@ char *operation = NULL; HINSTANCE rc; - if (unicode_file_names()) { - PyObject *unipath, *woperation = NULL; - if (!PyArg_ParseTuple(args, "U|s:startfile", - &unipath, &operation)) { + PyObject *unipath, *woperation = NULL; + if (!PyArg_ParseTuple(args, "U|s:startfile", + &unipath, &operation)) { + PyErr_Clear(); + goto normal; + } + + if (operation) { + woperation = PyUnicode_DecodeASCII(operation, + strlen(operation), NULL); + if (!woperation) { PyErr_Clear(); + operation = NULL; goto normal; } + } + Py_BEGIN_ALLOW_THREADS + rc = ShellExecuteW((HWND)0, woperation ? PyUnicode_AS_UNICODE(woperation) : 0, + PyUnicode_AS_UNICODE(unipath), + NULL, NULL, SW_SHOWNORMAL); + Py_END_ALLOW_THREADS - if (operation) { - woperation = PyUnicode_DecodeASCII(operation, - strlen(operation), NULL); - if (!woperation) { - PyErr_Clear(); - operation = NULL; - goto normal; - } - } - - Py_BEGIN_ALLOW_THREADS - rc = ShellExecuteW((HWND)0, woperation ? PyUnicode_AS_UNICODE(woperation) : 0, - PyUnicode_AS_UNICODE(unipath), - NULL, NULL, SW_SHOWNORMAL); - Py_END_ALLOW_THREADS - - Py_XDECREF(woperation); - if (rc <= (HINSTANCE)32) { - PyObject *errval = win32_error_unicode("startfile", - PyUnicode_AS_UNICODE(unipath)); - return errval; - } - Py_INCREF(Py_None); - return Py_None; + Py_XDECREF(woperation); + if (rc <= (HINSTANCE)32) { + PyObject *errval = win32_error_unicode("startfile", + PyUnicode_AS_UNICODE(unipath)); + return errval; } + Py_INCREF(Py_None); + return Py_None; normal: if (!PyArg_ParseTuple(args, "O&|s:startfile", Modified: python/branches/py3k/PC/pyconfig.h ============================================================================== --- python/branches/py3k/PC/pyconfig.h (original) +++ python/branches/py3k/PC/pyconfig.h Sun Jun 28 13:07:03 2009 @@ -95,12 +95,6 @@ #endif #ifdef MS_WINCE -/* Python uses GetVersion() to distinguish between - * Windows NT and 9x/ME where OS Unicode support is concerned. - * Windows CE supports Unicode in the same way as NT so we - * define the missing GetVersion() accordingly. - */ -#define GetVersion() (4) /* Windows CE does not support environment variables */ #define getenv(v) (NULL) #define environ (NULL) From python-checkins at python.org Sun Jun 28 14:10:19 2009 From: python-checkins at python.org (georg.brandl) Date: Sun, 28 Jun 2009 12:10:19 -0000 Subject: [Python-checkins] r73605 - python/trunk/Lib/email/mime/nonmultipart.py Message-ID: Author: georg.brandl Date: Sun Jun 28 14:10:18 2009 New Revision: 73605 Log: Remove stray pychecker directive. Modified: python/trunk/Lib/email/mime/nonmultipart.py Modified: python/trunk/Lib/email/mime/nonmultipart.py ============================================================================== --- python/trunk/Lib/email/mime/nonmultipart.py (original) +++ python/trunk/Lib/email/mime/nonmultipart.py Sun Jun 28 14:10:18 2009 @@ -14,13 +14,9 @@ class MIMENonMultipart(MIMEBase): """Base class for MIME multipart/* type messages.""" - __pychecker__ = 'unusednames=payload' - def attach(self, payload): # The public API prohibits attaching multiple subparts to MIMEBase # derived subtypes since none of them are, by definition, of content # type multipart/* raise errors.MultipartConversionError( 'Cannot attach additional subparts to non-multipart/*') - - del __pychecker__ From python-checkins at python.org Sun Jun 28 14:24:23 2009 From: python-checkins at python.org (martin.v.loewis) Date: Sun, 28 Jun 2009 12:24:23 -0000 Subject: [Python-checkins] r73606 - python/trunk/Tools/msi/msi.py Message-ID: Author: martin.v.loewis Date: Sun Jun 28 14:24:23 2009 New Revision: 73606 Log: Fix types in logic to compute help file name. Modified: python/trunk/Tools/msi/msi.py Modified: python/trunk/Tools/msi/msi.py ============================================================================== --- python/trunk/Tools/msi/msi.py (original) +++ python/trunk/Tools/msi/msi.py Sun Jun 28 14:24:23 2009 @@ -116,13 +116,13 @@ # Compute the name that Sphinx gives to the docfile docfile = "" -if micro: - docfile = str(micro) +if int(micro): + docfile = micro if level < 0xf: if level == 0xC: - docfile = "rc%s" % (serial,) + docfile += "rc%s" % (serial,) else: - docfile = '%x%s' % (level, serial) + docfile += '%x%s' % (level, serial) docfile = 'python%s%s%s.chm' % (major, minor, docfile) # Build the mingw import library, libpythonXY.a From python-checkins at python.org Sun Jun 28 14:28:30 2009 From: python-checkins at python.org (martin.v.loewis) Date: Sun, 28 Jun 2009 12:28:30 -0000 Subject: [Python-checkins] r73607 - in python/branches/py3k: Tools/msi/msi.py Message-ID: Author: martin.v.loewis Date: Sun Jun 28 14:28:29 2009 New Revision: 73607 Log: Merged revisions 73606 via svnmerge from svn+ssh://pythondev at svn.python.org/python/trunk ........ r73606 | martin.v.loewis | 2009-06-28 14:24:23 +0200 (So, 28 Jun 2009) | 2 lines Fix types in logic to compute help file name. ........ Modified: python/branches/py3k/ (props changed) python/branches/py3k/Tools/msi/msi.py Modified: python/branches/py3k/Tools/msi/msi.py ============================================================================== --- python/branches/py3k/Tools/msi/msi.py (original) +++ python/branches/py3k/Tools/msi/msi.py Sun Jun 28 14:28:29 2009 @@ -117,13 +117,13 @@ # Compute the name that Sphinx gives to the docfile docfile = "" -if micro: - docfile = str(micro) +if int(micro): + docfile = micro if level < 0xf: if level == 0xC: - docfile = "rc%s" % (serial,) + docfile += "rc%s" % (serial,) else: - docfile = '%x%s' % (level, serial) + docfile += '%x%s' % (level, serial) docfile = 'python%s%s%s.chm' % (major, minor, docfile) # Build the mingw import library, libpythonXY.a From python-checkins at python.org Sun Jun 28 14:29:41 2009 From: python-checkins at python.org (martin.v.loewis) Date: Sun, 28 Jun 2009 12:29:41 -0000 Subject: [Python-checkins] r73608 - in python/branches/release31-maint: Tools/msi/msi.py Message-ID: Author: martin.v.loewis Date: Sun Jun 28 14:29:40 2009 New Revision: 73608 Log: Merged revisions 73607 via svnmerge from svn+ssh://pythondev at svn.python.org/python/branches/py3k ................ r73607 | martin.v.loewis | 2009-06-28 14:28:29 +0200 (So, 28 Jun 2009) | 9 lines Merged revisions 73606 via svnmerge from svn+ssh://pythondev at svn.python.org/python/trunk ........ r73606 | martin.v.loewis | 2009-06-28 14:24:23 +0200 (So, 28 Jun 2009) | 2 lines Fix types in logic to compute help file name. ........ ................ Modified: python/branches/release31-maint/ (props changed) python/branches/release31-maint/Tools/msi/msi.py Modified: python/branches/release31-maint/Tools/msi/msi.py ============================================================================== --- python/branches/release31-maint/Tools/msi/msi.py (original) +++ python/branches/release31-maint/Tools/msi/msi.py Sun Jun 28 14:29:40 2009 @@ -117,13 +117,13 @@ # Compute the name that Sphinx gives to the docfile docfile = "" -if micro: - docfile = str(micro) +if int(micro): + docfile = micro if level < 0xf: if level == 0xC: - docfile = "rc%s" % (serial,) + docfile += "rc%s" % (serial,) else: - docfile = '%x%s' % (level, serial) + docfile += '%x%s' % (level, serial) docfile = 'python%s%s%s.chm' % (major, minor, docfile) # Build the mingw import library, libpythonXY.a From buildbot at python.org Sun Jun 28 14:49:04 2009 From: buildbot at python.org (buildbot at python.org) Date: Sun, 28 Jun 2009 12:49:04 +0000 Subject: [Python-checkins] buildbot failure in x86 osx.5 trunk Message-ID: The Buildbot has detected a new failure of x86 osx.5 trunk. Full details are available at: http://www.python.org/dev/buildbot/all/x86%20osx.5%20trunk/builds/1232 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: heller-x86-osx5 Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: georg.brandl BUILD FAILED: failed test Excerpt from the test logfile: Traceback (most recent call last): File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/test/test_thread.py", line 51, in task self.done_mutex.release() thread.error: release unlocked lock 1 test failed: test_asynchat make: *** [buildbottest] Error 1 sincerely, -The Buildbot From buildbot at python.org Sun Jun 28 15:21:37 2009 From: buildbot at python.org (buildbot at python.org) Date: Sun, 28 Jun 2009 13:21:37 +0000 Subject: [Python-checkins] buildbot failure in amd64 gentoo trunk Message-ID: The Buildbot has detected a new failure of amd64 gentoo trunk. Full details are available at: http://www.python.org/dev/buildbot/all/amd64%20gentoo%20trunk/builds/214 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: norwitz-amd64 Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: martin.v.loewis BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_mailbox make: *** [buildbottest] Error 1 sincerely, -The Buildbot From python-checkins at python.org Sun Jun 28 15:21:42 2009 From: python-checkins at python.org (hirokazu.yamamoto) Date: Sun, 28 Jun 2009 13:21:42 -0000 Subject: [Python-checkins] r73609 - python/branches/py3k/PC/VC6/pythoncore.dsp Message-ID: Author: hirokazu.yamamoto Date: Sun Jun 28 15:21:41 2009 New Revision: 73609 Log: Sorted file names. Modified: python/branches/py3k/PC/VC6/pythoncore.dsp Modified: python/branches/py3k/PC/VC6/pythoncore.dsp ============================================================================== --- python/branches/py3k/PC/VC6/pythoncore.dsp (original) +++ python/branches/py3k/PC/VC6/pythoncore.dsp Sun Jun 28 15:21:41 2009 @@ -141,30 +141,6 @@ # End Source File # Begin Source File -SOURCE=..\..\Modules\_io\bytesio.c -# End Source File -# Begin Source File - -SOURCE=..\..\Modules\_io\stringio.c -# End Source File -# Begin Source File - -SOURCE=..\..\Modules\_io\fileio.c -# End Source File -# Begin Source File - -SOURCE="..\..\Modules\_io\bufferedio.c" -# End Source File -# Begin Source File - -SOURCE=..\..\Modules\_io\iobase.c -# End Source File -# Begin Source File - -SOURCE=..\..\Modules\_io\textio.c -# End Source File -# Begin Source File - SOURCE=..\..\Modules\_io\_iomodule.c # End Source File # Begin Source File @@ -261,6 +237,10 @@ # End Source File # Begin Source File +SOURCE=..\..\Modules\_io\bufferedio.c +# End Source File +# Begin Source File + SOURCE=..\..\Objects\bytearrayobject.c # End Source File # Begin Source File @@ -269,6 +249,10 @@ # End Source File # Begin Source File +SOURCE=..\..\Modules\_io\bytesio.c +# End Source File +# Begin Source File + SOURCE=..\..\Objects\bytesobject.c # End Source File # Begin Source File @@ -369,6 +353,10 @@ # End Source File # Begin Source File +SOURCE=..\..\Modules\_io\fileio.c +# End Source File +# Begin Source File + SOURCE=..\..\Objects\fileobject.c # End Source File # Begin Source File @@ -487,6 +475,10 @@ # End Source File # Begin Source File +SOURCE=..\..\Modules\_io\iobase.c +# End Source File +# Begin Source File + SOURCE=..\..\Objects\iterobject.c # End Source File # Begin Source File @@ -675,6 +667,10 @@ # End Source File # Begin Source File +SOURCE=..\..\Modules\_io\stringio.c +# End Source File +# Begin Source File + SOURCE=..\..\Python\structmember.c # End Source File # Begin Source File @@ -695,6 +691,10 @@ # End Source File # Begin Source File +SOURCE=..\..\Modules\_io\textio.c +# End Source File +# Begin Source File + SOURCE=..\..\Python\thread.c # End Source File # Begin Source File From python-checkins at python.org Sun Jun 28 15:32:30 2009 From: python-checkins at python.org (hirokazu.yamamoto) Date: Sun, 28 Jun 2009 13:32:30 -0000 Subject: [Python-checkins] r73610 - in python/branches/release31-maint: PC/VC6/pythoncore.dsp Message-ID: Author: hirokazu.yamamoto Date: Sun Jun 28 15:32:29 2009 New Revision: 73610 Log: Merged revisions 73609 via svnmerge from svn+ssh://pythondev at svn.python.org/python/branches/py3k ........ r73609 | hirokazu.yamamoto | 2009-06-28 22:21:41 +0900 | 1 line Sorted file names. ........ Modified: python/branches/release31-maint/ (props changed) python/branches/release31-maint/PC/VC6/pythoncore.dsp Modified: python/branches/release31-maint/PC/VC6/pythoncore.dsp ============================================================================== --- python/branches/release31-maint/PC/VC6/pythoncore.dsp (original) +++ python/branches/release31-maint/PC/VC6/pythoncore.dsp Sun Jun 28 15:32:29 2009 @@ -141,30 +141,6 @@ # End Source File # Begin Source File -SOURCE=..\..\Modules\_io\bytesio.c -# End Source File -# Begin Source File - -SOURCE=..\..\Modules\_io\stringio.c -# End Source File -# Begin Source File - -SOURCE=..\..\Modules\_io\fileio.c -# End Source File -# Begin Source File - -SOURCE="..\..\Modules\_io\bufferedio.c" -# End Source File -# Begin Source File - -SOURCE=..\..\Modules\_io\iobase.c -# End Source File -# Begin Source File - -SOURCE=..\..\Modules\_io\textio.c -# End Source File -# Begin Source File - SOURCE=..\..\Modules\_io\_iomodule.c # End Source File # Begin Source File @@ -261,6 +237,10 @@ # End Source File # Begin Source File +SOURCE=..\..\Modules\_io\bufferedio.c +# End Source File +# Begin Source File + SOURCE=..\..\Objects\bytearrayobject.c # End Source File # Begin Source File @@ -269,6 +249,10 @@ # End Source File # Begin Source File +SOURCE=..\..\Modules\_io\bytesio.c +# End Source File +# Begin Source File + SOURCE=..\..\Objects\bytesobject.c # End Source File # Begin Source File @@ -369,6 +353,10 @@ # End Source File # Begin Source File +SOURCE=..\..\Modules\_io\fileio.c +# End Source File +# Begin Source File + SOURCE=..\..\Objects\fileobject.c # End Source File # Begin Source File @@ -487,6 +475,10 @@ # End Source File # Begin Source File +SOURCE=..\..\Modules\_io\iobase.c +# End Source File +# Begin Source File + SOURCE=..\..\Objects\iterobject.c # End Source File # Begin Source File @@ -675,6 +667,10 @@ # End Source File # Begin Source File +SOURCE=..\..\Modules\_io\stringio.c +# End Source File +# Begin Source File + SOURCE=..\..\Python\structmember.c # End Source File # Begin Source File @@ -695,6 +691,10 @@ # End Source File # Begin Source File +SOURCE=..\..\Modules\_io\textio.c +# End Source File +# Begin Source File + SOURCE=..\..\Python\thread.c # End Source File # Begin Source File From buildbot at python.org Sun Jun 28 15:34:50 2009 From: buildbot at python.org (buildbot at python.org) Date: Sun, 28 Jun 2009 13:34:50 +0000 Subject: [Python-checkins] buildbot failure in x86 gentoo trunk Message-ID: The Buildbot has detected a new failure of x86 gentoo trunk. Full details are available at: http://www.python.org/dev/buildbot/all/x86%20gentoo%20trunk/builds/5084 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: norwitz-x86 Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: martin.v.loewis BUILD FAILED: failed test Excerpt from the test logfile: sincerely, -The Buildbot From python-checkins at python.org Sun Jun 28 17:40:51 2009 From: python-checkins at python.org (benjamin.peterson) Date: Sun, 28 Jun 2009 15:40:51 -0000 Subject: [Python-checkins] r73611 - python/branches/py3k/Python/ceval.c Message-ID: Author: benjamin.peterson Date: Sun Jun 28 17:40:50 2009 New Revision: 73611 Log: correctly rearrange the stack in the exception case of WITH_CLEANUP Modified: python/branches/py3k/Python/ceval.c Modified: python/branches/py3k/Python/ceval.c ============================================================================== --- python/branches/py3k/Python/ceval.c (original) +++ python/branches/py3k/Python/ceval.c Sun Jun 28 17:40:50 2009 @@ -2533,10 +2533,21 @@ u = v = w = Py_None; } else { + PyObject *tp, *exc, *tb; + PyTryBlock *block; v = SECOND(); w = THIRD(); + tp = FOURTH(); + exc = stack_pointer[-5]; + tb = stack_pointer[-6]; exit_func = stack_pointer[-7]; - stack_pointer[-7] = NULL; + stack_pointer[-7] = tb; + stack_pointer[-6] = exc; + stack_pointer[-5] = tp; + FOURTH() = NULL; + block = &f->f_blockstack[f->f_iblock - 1]; + assert(block->b_type == EXCEPT_HANDLER); + block->b_level--; } /* XXX Not the fastest way to call it... */ x = PyObject_CallFunctionObjArgs(exit_func, u, v, w, From python-checkins at python.org Sun Jun 28 17:55:46 2009 From: python-checkins at python.org (benjamin.peterson) Date: Sun, 28 Jun 2009 15:55:46 -0000 Subject: [Python-checkins] r73612 - python/branches/py3k/Python/ceval.c Message-ID: Author: benjamin.peterson Date: Sun Jun 28 17:55:46 2009 New Revision: 73612 Log: update comments Modified: python/branches/py3k/Python/ceval.c Modified: python/branches/py3k/Python/ceval.c ============================================================================== --- python/branches/py3k/Python/ceval.c (original) +++ python/branches/py3k/Python/ceval.c Sun Jun 28 17:55:46 2009 @@ -2491,20 +2491,23 @@ - (TOP, SECOND) = (WHY_{RETURN,CONTINUE}), retval - TOP = WHY_*; no retval below it - (TOP, SECOND, THIRD) = exc_info() + (FOURTH, FITH, SIXTH) = previous exception for EXCEPT_HANDLER Below them is EXIT, the context.__exit__ bound method. In the last case, we must call EXIT(TOP, SECOND, THIRD) otherwise we must call EXIT(None, None, None) - In all cases, we remove EXIT from the stack, leaving - the rest in the same order. + In the first two cases, we remove EXIT from the + stack, leaving the rest in the same order. In the + third case, we shift the bottom 3 values of the + stack down, and replace the empty spot with NULL. In addition, if the stack represents an exception, *and* the function call returns a 'true' value, we - "zap" this information, to prevent END_FINALLY from - re-raising the exception. (But non-local gotos - should still be resumed.) + push WHY_SILENCED onto the stack. END_FINALLY will + then not re-raise the exception. (But non-local + gotos should still be resumed.) */ PyObject *exit_func; @@ -2544,7 +2547,11 @@ stack_pointer[-7] = tb; stack_pointer[-6] = exc; stack_pointer[-5] = tp; + /* UNWIND_EXCEPT_BLOCK will pop this off. */ FOURTH() = NULL; + /* We just shifted the stack down, so we have + to tell the except handler block that the + values are lower than it expects. */ block = &f->f_blockstack[f->f_iblock - 1]; assert(block->b_type == EXCEPT_HANDLER); block->b_level--; From python-checkins at python.org Sun Jun 28 18:03:15 2009 From: python-checkins at python.org (benjamin.peterson) Date: Sun, 28 Jun 2009 16:03:15 -0000 Subject: [Python-checkins] r73613 - python/branches/py3k/Python/ceval.c Message-ID: Author: benjamin.peterson Date: Sun Jun 28 18:03:15 2009 New Revision: 73613 Log: this is better written as an assertion Modified: python/branches/py3k/Python/ceval.c Modified: python/branches/py3k/Python/ceval.c ============================================================================== --- python/branches/py3k/Python/ceval.c (original) +++ python/branches/py3k/Python/ceval.c Sun Jun 28 18:03:15 2009 @@ -1823,15 +1823,9 @@ created when the exception was caught, otherwise the stack will be in an inconsistent state. */ PyTryBlock *b = PyFrame_BlockPop(f); - if (b->b_type != EXCEPT_HANDLER) { - PyErr_SetString(PyExc_SystemError, - "popped block is not an except handler"); - why = WHY_EXCEPTION; - } - else { - UNWIND_EXCEPT_HANDLER(b); - why = WHY_NOT; - } + assert(b->b_type == EXCEPT_HANDLER); + UNWIND_EXCEPT_HANDLER(b); + why = WHY_NOT; } } else if (PyExceptionClass_Check(v)) { From python-checkins at python.org Sun Jun 28 18:08:02 2009 From: python-checkins at python.org (benjamin.peterson) Date: Sun, 28 Jun 2009 16:08:02 -0000 Subject: [Python-checkins] r73614 - python/trunk/Python/ceval.c Message-ID: Author: benjamin.peterson Date: Sun Jun 28 18:08:02 2009 New Revision: 73614 Log: add two generic macros for peeking and setting in the stack Modified: python/trunk/Python/ceval.c Modified: python/trunk/Python/ceval.c ============================================================================== --- python/trunk/Python/ceval.c (original) +++ python/trunk/Python/ceval.c Sun Jun 28 18:08:02 2009 @@ -803,10 +803,12 @@ #define SECOND() (stack_pointer[-2]) #define THIRD() (stack_pointer[-3]) #define FOURTH() (stack_pointer[-4]) +#define PEEK(n) (stack_pointer[-(n)]) #define SET_TOP(v) (stack_pointer[-1] = (v)) #define SET_SECOND(v) (stack_pointer[-2] = (v)) #define SET_THIRD(v) (stack_pointer[-3] = (v)) #define SET_FOURTH(v) (stack_pointer[-4] = (v)) +#define SET_VALUE(n, v) (stack_pointer[-(n)] = (v)) #define BASIC_STACKADJ(n) (stack_pointer += n) #define BASIC_PUSH(v) (*stack_pointer++ = (v)) #define BASIC_POP() (*--stack_pointer) From python-checkins at python.org Sun Jun 28 18:14:08 2009 From: python-checkins at python.org (benjamin.peterson) Date: Sun, 28 Jun 2009 16:14:08 -0000 Subject: [Python-checkins] r73615 - python/trunk/Python/ceval.c Message-ID: Author: benjamin.peterson Date: Sun Jun 28 18:14:07 2009 New Revision: 73615 Log: use stack macros Modified: python/trunk/Python/ceval.c Modified: python/trunk/Python/ceval.c ============================================================================== --- python/trunk/Python/ceval.c (original) +++ python/trunk/Python/ceval.c Sun Jun 28 18:14:07 2009 @@ -1424,7 +1424,7 @@ case LIST_APPEND: w = POP(); - v = stack_pointer[-oparg]; + v = PEEK(oparg); err = PyList_Append(v, w); Py_DECREF(w); if (err == 0) { @@ -1954,7 +1954,7 @@ } } else if (unpack_iterable(v, oparg, stack_pointer + oparg)) { - stack_pointer += oparg; + STACKADJ(oparg); } else { /* unpack_iterable() raised an exception */ why = WHY_EXCEPTION; From python-checkins at python.org Sun Jun 28 18:17:35 2009 From: python-checkins at python.org (benjamin.peterson) Date: Sun, 28 Jun 2009 16:17:35 -0000 Subject: [Python-checkins] r73616 - in python/branches/py3k: Python/ceval.c Message-ID: Author: benjamin.peterson Date: Sun Jun 28 18:17:34 2009 New Revision: 73616 Log: Merged revisions 73614-73615 via svnmerge from svn+ssh://pythondev at svn.python.org/python/trunk ........ r73614 | benjamin.peterson | 2009-06-28 11:08:02 -0500 (Sun, 28 Jun 2009) | 1 line add two generic macros for peeking and setting in the stack ........ r73615 | benjamin.peterson | 2009-06-28 11:14:07 -0500 (Sun, 28 Jun 2009) | 1 line use stack macros ........ Modified: python/branches/py3k/ (props changed) python/branches/py3k/Python/ceval.c Modified: python/branches/py3k/Python/ceval.c ============================================================================== --- python/branches/py3k/Python/ceval.c (original) +++ python/branches/py3k/Python/ceval.c Sun Jun 28 18:17:34 2009 @@ -919,10 +919,12 @@ #define SECOND() (stack_pointer[-2]) #define THIRD() (stack_pointer[-3]) #define FOURTH() (stack_pointer[-4]) +#define PEEK(n) (stack_pointer[-(n)]) #define SET_TOP(v) (stack_pointer[-1] = (v)) #define SET_SECOND(v) (stack_pointer[-2] = (v)) #define SET_THIRD(v) (stack_pointer[-3] = (v)) #define SET_FOURTH(v) (stack_pointer[-4] = (v)) +#define SET_VALUE(n, v) (stack_pointer[-(n)] = (v)) #define BASIC_STACKADJ(n) (stack_pointer += n) #define BASIC_PUSH(v) (*stack_pointer++ = (v)) #define BASIC_POP() (*--stack_pointer) @@ -1548,7 +1550,7 @@ TARGET(LIST_APPEND) w = POP(); - v = stack_pointer[-oparg]; + v = PEEK(oparg); err = PyList_Append(v, w); Py_DECREF(w); if (err == 0) { @@ -1909,7 +1911,7 @@ } } else if (unpack_iterable(v, oparg, -1, stack_pointer + oparg)) { - stack_pointer += oparg; + STACKADJ(oparg); } else { /* unpack_iterable() raised an exception */ why = WHY_EXCEPTION; From python-checkins at python.org Sun Jun 28 18:21:53 2009 From: python-checkins at python.org (benjamin.peterson) Date: Sun, 28 Jun 2009 16:21:53 -0000 Subject: [Python-checkins] r73617 - python/branches/py3k/Python/ceval.c Message-ID: Author: benjamin.peterson Date: Sun Jun 28 18:21:52 2009 New Revision: 73617 Log: use stack altering macros here Modified: python/branches/py3k/Python/ceval.c Modified: python/branches/py3k/Python/ceval.c ============================================================================== --- python/branches/py3k/Python/ceval.c (original) +++ python/branches/py3k/Python/ceval.c Sun Jun 28 18:21:52 2009 @@ -2537,14 +2537,14 @@ v = SECOND(); w = THIRD(); tp = FOURTH(); - exc = stack_pointer[-5]; - tb = stack_pointer[-6]; - exit_func = stack_pointer[-7]; - stack_pointer[-7] = tb; - stack_pointer[-6] = exc; - stack_pointer[-5] = tp; + exc = PEEK(5); + tb = PEEK(6); + exit_func = PEEK(7); + SET_VALUE(7, tb); + SET_VALUE(6, exc); + SET_VALUE(5, tp); /* UNWIND_EXCEPT_BLOCK will pop this off. */ - FOURTH() = NULL; + SET_FOURTH(NULL); /* We just shifted the stack down, so we have to tell the except handler block that the values are lower than it expects. */ From python-checkins at python.org Sun Jun 28 18:23:56 2009 From: python-checkins at python.org (benjamin.peterson) Date: Sun, 28 Jun 2009 16:23:56 -0000 Subject: [Python-checkins] r73618 - python/branches/py3k/Objects/capsule.c Message-ID: Author: benjamin.peterson Date: Sun Jun 28 18:23:55 2009 New Revision: 73618 Log: fix useless comparison #6355 Modified: python/branches/py3k/Objects/capsule.c Modified: python/branches/py3k/Objects/capsule.c ============================================================================== --- python/branches/py3k/Objects/capsule.c (original) +++ python/branches/py3k/Objects/capsule.c Sun Jun 28 18:23:55 2009 @@ -33,7 +33,7 @@ /* if either is NULL, */ if (!name1 || !name2) { /* they're only the same if they're both NULL. */ - return name2 == name2; + return name1 == name2; } return !strcmp(name1, name2); } From python-checkins at python.org Sun Jun 28 18:26:14 2009 From: python-checkins at python.org (benjamin.peterson) Date: Sun, 28 Jun 2009 16:26:14 -0000 Subject: [Python-checkins] r73619 - in python/branches/release31-maint: Objects/capsule.c Message-ID: Author: benjamin.peterson Date: Sun Jun 28 18:26:13 2009 New Revision: 73619 Log: Merged revisions 73618 via svnmerge from svn+ssh://pythondev at svn.python.org/python/branches/py3k ........ r73618 | benjamin.peterson | 2009-06-28 11:23:55 -0500 (Sun, 28 Jun 2009) | 1 line fix useless comparison #6355 ........ Modified: python/branches/release31-maint/ (props changed) python/branches/release31-maint/Objects/capsule.c Modified: python/branches/release31-maint/Objects/capsule.c ============================================================================== --- python/branches/release31-maint/Objects/capsule.c (original) +++ python/branches/release31-maint/Objects/capsule.c Sun Jun 28 18:26:13 2009 @@ -33,7 +33,7 @@ /* if either is NULL, */ if (!name1 || !name2) { /* they're only the same if they're both NULL. */ - return name2 == name2; + return name1 == name2; } return !strcmp(name1, name2); } From python-checkins at python.org Sun Jun 28 18:27:27 2009 From: python-checkins at python.org (benjamin.peterson) Date: Sun, 28 Jun 2009 16:27:27 -0000 Subject: [Python-checkins] r73620 - python/branches/py3k Message-ID: Author: benjamin.peterson Date: Sun Jun 28 18:27:27 2009 New Revision: 73620 Log: delete unused properties Modified: python/branches/py3k/ (props changed) From buildbot at python.org Sun Jun 28 18:29:19 2009 From: buildbot at python.org (buildbot at python.org) Date: Sun, 28 Jun 2009 16:29:19 +0000 Subject: [Python-checkins] buildbot failure in amd64 gentoo 3.x Message-ID: The Buildbot has detected a new failure of amd64 gentoo 3.x. Full details are available at: http://www.python.org/dev/buildbot/all/amd64%20gentoo%203.x/builds/859 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: norwitz-amd64 Build Reason: Build Source Stamp: [branch branches/py3k] HEAD Blamelist: benjamin.peterson BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_queue make: *** [buildbottest] Error 1 sincerely, -The Buildbot From python-checkins at python.org Sun Jun 28 18:39:56 2009 From: python-checkins at python.org (benjamin.peterson) Date: Sun, 28 Jun 2009 16:39:56 -0000 Subject: [Python-checkins] r73621 - python/branches/py3k Message-ID: Author: benjamin.peterson Date: Sun Jun 28 18:39:56 2009 New Revision: 73621 Log: Blocked revisions 73382,73394-73397,73401-73402,73422,73480,73536,73540 via svnmerge ........ r73382 | raymond.hettinger | 2009-06-11 18:14:53 -0500 (Thu, 11 Jun 2009) | 1 line Issue 6261: Clarify behavior of random.uniform(). ........ r73394 | antoine.pitrou | 2009-06-12 15:14:08 -0500 (Fri, 12 Jun 2009) | 3 lines Issue #6215: backport the 3.1 io lib ........ r73395 | antoine.pitrou | 2009-06-12 15:36:25 -0500 (Fri, 12 Jun 2009) | 4 lines Restore the old test_file.py (for the builtin file object) as a new file named test_file2k.py ........ r73396 | antoine.pitrou | 2009-06-12 15:41:52 -0500 (Fri, 12 Jun 2009) | 4 lines Try to restore the old test_file and test_univnewlines as new, different files (with the right revisions this time, hopefully) ........ r73397 | antoine.pitrou | 2009-06-12 15:54:21 -0500 (Fri, 12 Jun 2009) | 3 lines Re-enable testing of builtin open() in test_bufio in test_largefile ........ r73401 | alexandre.vassalotti | 2009-06-12 16:52:14 -0500 (Fri, 12 Jun 2009) | 2 lines Make pickling of OrderedDict instances more efficient. ........ r73402 | alexandre.vassalotti | 2009-06-12 18:03:35 -0500 (Fri, 12 Jun 2009) | 6 lines Revert r73401 per Raymond Hettinger's request. The rational is the change might cause imcompatiblity problems with PyYAML. In addition, Raymond wants to kept the different versions of collections synchronized across Python versions. ........ r73422 | benjamin.peterson | 2009-06-13 15:30:48 -0500 (Sat, 13 Jun 2009) | 1 line update ast version ........ r73480 | facundo.batista | 2009-06-19 13:02:28 -0500 (Fri, 19 Jun 2009) | 3 lines Issue #6274. Fixed a potential FD leak in subprocess.py. ........ r73536 | raymond.hettinger | 2009-06-23 16:32:28 -0500 (Tue, 23 Jun 2009) | 1 line Issue 6305: Clarify error message for large arguments to itertools.islice(). ........ r73540 | raymond.hettinger | 2009-06-23 17:20:04 -0500 (Tue, 23 Jun 2009) | 1 line Add procedural note. ........ Modified: python/branches/py3k/ (props changed) From python-checkins at python.org Sun Jun 28 18:51:58 2009 From: python-checkins at python.org (benjamin.peterson) Date: Sun, 28 Jun 2009 16:51:58 -0000 Subject: [Python-checkins] r73622 - python/branches/py3k Message-ID: Author: benjamin.peterson Date: Sun Jun 28 18:51:58 2009 New Revision: 73622 Log: Blocked revisions 73459,73563 via svnmerge ........ r73459 | raymond.hettinger | 2009-06-16 20:43:47 -0500 (Tue, 16 Jun 2009) | 1 line Add usage note. ........ r73563 | amaury.forgeotdarc | 2009-06-25 16:29:32 -0500 (Thu, 25 Jun 2009) | 2 lines Fix a compilation warning on Windows ........ Modified: python/branches/py3k/ (props changed) From python-checkins at python.org Sun Jun 28 19:22:03 2009 From: python-checkins at python.org (benjamin.peterson) Date: Sun, 28 Jun 2009 17:22:03 -0000 Subject: [Python-checkins] r73623 - in python/branches/py3k: Doc/library/stdtypes.rst Doc/library/symtable.rst Doc/library/timeit.rst Lib/email/mime/nonmultipart.py Lib/pydoc.py Lib/test/test_coding.py Lib/test/test_extcall.py Lib/test/test_pydoc.py Lib/xml/sax/expatreader.py Misc/ACKS Modules/_ssl.c Modules/_struct.c Objects/funcobject.c Parser/tokenizer.c Python/compile.c Message-ID: Author: benjamin.peterson Date: Sun Jun 28 19:22:03 2009 New Revision: 73623 Log: Merged revisions 73004,73439,73496,73509,73529,73564,73576-73577,73595-73596,73605 via svnmerge from svn+ssh://pythondev at svn.python.org/python/trunk ........ r73004 | jeffrey.yasskin | 2009-05-28 22:44:31 -0500 (Thu, 28 May 2009) | 5 lines Fix nearly all compilation warnings under Apple gcc-4.0. Tested with OPT="-g -Wall -Wstrict-prototypes -Werror" in both --with-pydebug mode and --without. There's still a batch of non-prototype warnings in Xlib.h that I don't know how to fix. ........ r73439 | benjamin.peterson | 2009-06-15 19:29:31 -0500 (Mon, 15 Jun 2009) | 1 line don't mask encoding errors when decoding a string #6289 ........ r73496 | vinay.sajip | 2009-06-21 12:37:27 -0500 (Sun, 21 Jun 2009) | 1 line Issue #6314: logging.basicConfig() performs extra checks on the "level" argument. ........ r73509 | amaury.forgeotdarc | 2009-06-22 14:33:48 -0500 (Mon, 22 Jun 2009) | 2 lines #4490 Fix sample code run by "python -m xml.sax.xmlreader" ........ r73529 | r.david.murray | 2009-06-23 13:02:46 -0500 (Tue, 23 Jun 2009) | 4 lines Fix issue 5230 by having pydoc's safeimport check to see if the import error was thrown from itself in order to decide if the module can't be found. Thanks to Lucas Prado Melo for collaborating on the fix and tests. ........ r73564 | amaury.forgeotdarc | 2009-06-25 17:29:29 -0500 (Thu, 25 Jun 2009) | 6 lines #2016 Fix a crash in function call when the **kwargs dictionary is mutated during the function call setup. This even gives a slight speedup, probably because tuple allocation is faster than PyMem_NEW. ........ r73576 | benjamin.peterson | 2009-06-26 18:37:06 -0500 (Fri, 26 Jun 2009) | 1 line document is_declared_global() ........ r73577 | benjamin.peterson | 2009-06-27 09:16:23 -0500 (Sat, 27 Jun 2009) | 1 line link to extensive generator docs in the reference manual ........ r73595 | ezio.melotti | 2009-06-27 18:45:39 -0500 (Sat, 27 Jun 2009) | 1 line stmt and setup can contain multiple statements, see #5896 ........ r73596 | ezio.melotti | 2009-06-27 19:07:45 -0500 (Sat, 27 Jun 2009) | 1 line Fixed a wrong apostrophe ........ r73605 | georg.brandl | 2009-06-28 07:10:18 -0500 (Sun, 28 Jun 2009) | 1 line Remove stray pychecker directive. ........ Modified: python/branches/py3k/ (props changed) python/branches/py3k/Doc/library/stdtypes.rst python/branches/py3k/Doc/library/symtable.rst python/branches/py3k/Doc/library/timeit.rst python/branches/py3k/Lib/email/mime/nonmultipart.py python/branches/py3k/Lib/pydoc.py python/branches/py3k/Lib/test/test_coding.py python/branches/py3k/Lib/test/test_extcall.py python/branches/py3k/Lib/test/test_pydoc.py python/branches/py3k/Lib/xml/sax/expatreader.py python/branches/py3k/Misc/ACKS python/branches/py3k/Modules/_ssl.c python/branches/py3k/Modules/_struct.c python/branches/py3k/Objects/funcobject.c python/branches/py3k/Parser/tokenizer.c python/branches/py3k/Python/compile.c Modified: python/branches/py3k/Doc/library/stdtypes.rst ============================================================================== --- python/branches/py3k/Doc/library/stdtypes.rst (original) +++ python/branches/py3k/Doc/library/stdtypes.rst Sun Jun 28 19:22:03 2009 @@ -583,10 +583,18 @@ continue to do so on subsequent calls. Implementations that do not obey this property are deemed broken. + +.. _generator-types: + +Generator Types +--------------- + Python's :term:`generator`\s provide a convenient way to implement the iterator protocol. If a container object's :meth:`__iter__` method is implemented as a generator, it will automatically return an iterator object (technically, a generator object) supplying the :meth:`__iter__` and :meth:`__next__` methods. +More information about generators can be found in :ref:`the documentation for +the yield expression `. .. _typesseq: Modified: python/branches/py3k/Doc/library/symtable.rst ============================================================================== --- python/branches/py3k/Doc/library/symtable.rst (original) +++ python/branches/py3k/Doc/library/symtable.rst Sun Jun 28 19:22:03 2009 @@ -144,6 +144,10 @@ Return ``True`` if the symbol is global. + .. method:: is_declared_global() + + Return ``True`` if the symbol is declared global with a global statement. + .. method:: is_local() Return ``True`` if the symbol is local to its block. Modified: python/branches/py3k/Doc/library/timeit.rst ============================================================================== --- python/branches/py3k/Doc/library/timeit.rst (original) +++ python/branches/py3k/Doc/library/timeit.rst Sun Jun 28 19:22:03 2009 @@ -24,8 +24,9 @@ The constructor takes a statement to be timed, an additional statement used for setup, and a timer function. Both statements default to ``'pass'``; the timer - function is platform-dependent (see the module doc string). The statements may - contain newlines, as long as they don't contain multi-line string literals. + function is platform-dependent (see the module doc string). *stmt* and *setup* + may also contain multiple statements separated by ``;`` or newlines, as long as + they don't contain multi-line string literals. To measure the execution time of the first statement, use the :meth:`timeit` method. The :meth:`repeat` method is a convenience to call :meth:`timeit` Modified: python/branches/py3k/Lib/email/mime/nonmultipart.py ============================================================================== --- python/branches/py3k/Lib/email/mime/nonmultipart.py (original) +++ python/branches/py3k/Lib/email/mime/nonmultipart.py Sun Jun 28 19:22:03 2009 @@ -14,13 +14,9 @@ class MIMENonMultipart(MIMEBase): """Base class for MIME multipart/* type messages.""" - __pychecker__ = 'unusednames=payload' - def attach(self, payload): # The public API prohibits attaching multiple subparts to MIMEBase # derived subtypes since none of them are, by definition, of content # type multipart/* raise errors.MultipartConversionError( 'Cannot attach additional subparts to non-multipart/*') - - del __pychecker__ Modified: python/branches/py3k/Lib/pydoc.py ============================================================================== --- python/branches/py3k/Lib/pydoc.py (original) +++ python/branches/py3k/Lib/pydoc.py Sun Jun 28 19:22:03 2009 @@ -54,6 +54,7 @@ import sys, imp, os, re, inspect, builtins, pkgutil from reprlib import Repr +from traceback import extract_tb as _extract_tb try: from collections import deque except ImportError: @@ -292,9 +293,9 @@ elif exc is SyntaxError: # A SyntaxError occurred before we could execute the module. raise ErrorDuringImport(value.filename, info) - elif exc is ImportError and \ - str(value).lower().split()[:2] == ['no', 'module']: - # The module was not found. + elif exc is ImportError and _extract_tb(tb)[-1][2]=='safeimport': + # The import error occurred directly in this function, + # which means there is no such module in the path. return None else: # Some other error occurred during the importing process. Modified: python/branches/py3k/Lib/test/test_coding.py ============================================================================== --- python/branches/py3k/Lib/test/test_coding.py (original) +++ python/branches/py3k/Lib/test/test_coding.py Sun Jun 28 19:22:03 2009 @@ -49,6 +49,18 @@ unlink(TESTFN+".pyc") sys.path.pop(0) + def test_error_from_string(self): + # See http://bugs.python.org/issue6289 + input = "# coding: ascii\n\N{SNOWMAN}".encode('utf-8') + try: + compile(input, "", "exec") + except SyntaxError as e: + expected = "'ascii' codec can't decode byte 0xe2 in position 16: " \ + "ordinal not in range(128)" + self.assertTrue(str(e).startswith(expected)) + else: + self.fail("didn't raise") + def test_main(): test.support.run_unittest(CodingTest) Modified: python/branches/py3k/Lib/test/test_extcall.py ============================================================================== --- python/branches/py3k/Lib/test/test_extcall.py (original) +++ python/branches/py3k/Lib/test/test_extcall.py Sun Jun 28 19:22:03 2009 @@ -243,6 +243,24 @@ ... TypeError: id() takes no keyword arguments +A corner case of keyword dictionary items being deleted during +the function call setup. See . + + >>> class Name(str): + ... def __eq__(self, other): + ... try: + ... del x[self] + ... except KeyError: + ... pass + ... return str.__eq__(self, other) + ... def __hash__(self): + ... return str.__hash__(self) + + >>> x = {Name("a"):1, Name("b"):2} + >>> def f(a, b): + ... print(a,b) + >>> f(**x) + 1 2 """ from test import support Modified: python/branches/py3k/Lib/test/test_pydoc.py ============================================================================== --- python/branches/py3k/Lib/test/test_pydoc.py (original) +++ python/branches/py3k/Lib/test/test_pydoc.py Sun Jun 28 19:22:03 2009 @@ -1,5 +1,6 @@ import sys import os +import os.path import difflib import subprocess import re @@ -7,6 +8,8 @@ import inspect import unittest import test.support +from contextlib import contextmanager +from test.support import TESTFN, forget, rmtree, EnvironmentVarGuard from test import pydoc_mod @@ -183,6 +186,9 @@ # output pattern for missing module missing_pattern = "no Python documentation found for '%s'" +# output pattern for module with bad imports +badimport_pattern = "problem in %s - ImportError: No module named %s" + def run_pydoc(module_name, *args): """ Runs pydoc on the specified module. Returns the stripped @@ -254,6 +260,42 @@ self.assertEqual(expected, result, "documentation for missing module found") + def test_badimport(self): + # This tests the fix for issue 5230, where if pydoc found the module + # but the module had an internal import error pydoc would report no doc + # found. + modname = 'testmod_xyzzy' + testpairs = ( + ('i_am_not_here', 'i_am_not_here'), + ('test.i_am_not_here_either', 'i_am_not_here_either'), + ('test.i_am_not_here.neither_am_i', 'i_am_not_here.neither_am_i'), + ('i_am_not_here.{}'.format(modname), 'i_am_not_here.{}'.format(modname)), + ('test.{}'.format(modname), modname), + ) + + @contextmanager + def newdirinpath(dir): + os.mkdir(dir) + sys.path.insert(0, dir) + yield + sys.path.pop(0) + rmtree(dir) + + with newdirinpath(TESTFN), EnvironmentVarGuard() as env: + env['PYTHONPATH'] = TESTFN + fullmodname = os.path.join(TESTFN, modname) + sourcefn = fullmodname + os.extsep + "py" + for importstring, expectedinmsg in testpairs: + f = open(sourcefn, 'w') + f.write("import {}\n".format(importstring)) + f.close() + try: + result = run_pydoc(modname).decode("ascii") + finally: + forget(modname) + expected = badimport_pattern % (modname, expectedinmsg) + self.assertEqual(expected, result) + def test_input_strip(self): missing_module = " test.i_am_not_here " result = str(run_pydoc(missing_module), 'ascii') Modified: python/branches/py3k/Lib/xml/sax/expatreader.py ============================================================================== --- python/branches/py3k/Lib/xml/sax/expatreader.py (original) +++ python/branches/py3k/Lib/xml/sax/expatreader.py Sun Jun 28 19:22:03 2009 @@ -407,8 +407,8 @@ # --- if __name__ == "__main__": - import xml.sax + import xml.sax.saxutils p = create_parser() - p.setContentHandler(xml.sax.XMLGenerator()) + p.setContentHandler(xml.sax.saxutils.XMLGenerator()) p.setErrorHandler(xml.sax.ErrorHandler()) - p.parse("../../../hamlet.xml") + p.parse("http://www.ibiblio.org/xml/examples/shakespeare/hamlet.xml") Modified: python/branches/py3k/Misc/ACKS ============================================================================== --- python/branches/py3k/Misc/ACKS (original) +++ python/branches/py3k/Misc/ACKS Sun Jun 28 19:22:03 2009 @@ -482,6 +482,7 @@ Craig McPheeters Lambert Meertens Bill van Melle +Lucas Prado Melo Luke Mewburn Mike Meyer Steven Miale Modified: python/branches/py3k/Modules/_ssl.c ============================================================================== --- python/branches/py3k/Modules/_ssl.c (original) +++ python/branches/py3k/Modules/_ssl.c Sun Jun 28 19:22:03 2009 @@ -658,7 +658,7 @@ char buf[2048]; char *vptr; int len; - const unsigned char *p; + unsigned char *p; if (certificate == NULL) return peer_alt_names; Modified: python/branches/py3k/Modules/_struct.c ============================================================================== --- python/branches/py3k/Modules/_struct.c (original) +++ python/branches/py3k/Modules/_struct.c Sun Jun 28 19:22:03 2009 @@ -132,6 +132,7 @@ /* Same, but handling unsigned long */ +#ifndef PY_STRUCT_OVERFLOW_MASKING static int get_ulong(PyObject *v, unsigned long *p) { @@ -152,6 +153,7 @@ *p = x; return 0; } +#endif /* PY_STRUCT_OVERFLOW_MASKING */ #ifdef HAVE_LONG_LONG Modified: python/branches/py3k/Objects/funcobject.c ============================================================================== --- python/branches/py3k/Objects/funcobject.c (original) +++ python/branches/py3k/Objects/funcobject.c Sun Jun 28 19:22:03 2009 @@ -593,13 +593,14 @@ { PyObject *result; PyObject *argdefs; + PyObject *kwtuple = NULL; PyObject **d, **k; Py_ssize_t nk, nd; argdefs = PyFunction_GET_DEFAULTS(func); if (argdefs != NULL && PyTuple_Check(argdefs)) { d = &PyTuple_GET_ITEM((PyTupleObject *)argdefs, 0); - nd = PyTuple_Size(argdefs); + nd = PyTuple_GET_SIZE(argdefs); } else { d = NULL; @@ -609,16 +610,17 @@ if (kw != NULL && PyDict_Check(kw)) { Py_ssize_t pos, i; nk = PyDict_Size(kw); - k = PyMem_NEW(PyObject *, 2*nk); - if (k == NULL) { - PyErr_NoMemory(); + kwtuple = PyTuple_New(2*nk); + if (kwtuple == NULL) return NULL; - } + k = &PyTuple_GET_ITEM(kwtuple, 0); pos = i = 0; - while (PyDict_Next(kw, &pos, &k[i], &k[i+1])) + while (PyDict_Next(kw, &pos, &k[i], &k[i+1])) { + Py_INCREF(k[i]); + Py_INCREF(k[i+1]); i += 2; + } nk = i/2; - /* XXX This is broken if the caller deletes dict items! */ } else { k = NULL; @@ -628,13 +630,12 @@ result = PyEval_EvalCodeEx( (PyCodeObject *)PyFunction_GET_CODE(func), PyFunction_GET_GLOBALS(func), (PyObject *)NULL, - &PyTuple_GET_ITEM(arg, 0), PyTuple_Size(arg), + &PyTuple_GET_ITEM(arg, 0), PyTuple_GET_SIZE(arg), k, nk, d, nd, PyFunction_GET_KW_DEFAULTS(func), PyFunction_GET_CLOSURE(func)); - if (k != NULL) - PyMem_DEL(k); + Py_XDECREF(kwtuple); return result; } Modified: python/branches/py3k/Parser/tokenizer.c ============================================================================== --- python/branches/py3k/Parser/tokenizer.c (original) +++ python/branches/py3k/Parser/tokenizer.c Sun Jun 28 19:22:03 2009 @@ -682,11 +682,8 @@ if (tok->enc != NULL) { assert(utf8 == NULL); utf8 = translate_into_utf8(str, tok->enc); - if (utf8 == NULL) { - PyErr_Format(PyExc_SyntaxError, - "unknown encoding: %s", tok->enc); + if (utf8 == NULL) return error_ret(tok); - } str = PyBytes_AS_STRING(utf8); } assert(tok->decoding_buffer == NULL); Modified: python/branches/py3k/Python/compile.c ============================================================================== --- python/branches/py3k/Python/compile.c (original) +++ python/branches/py3k/Python/compile.c Sun Jun 28 19:22:03 2009 @@ -551,18 +551,6 @@ } -/* Allocate a new "anonymous" local variable. - Used by list comprehensions and with statements. -*/ - -static PyObject * -compiler_new_tmpname(struct compiler *c) -{ - char tmpname[256]; - PyOS_snprintf(tmpname, sizeof(tmpname), "_[%d]", ++c->u->u_tmpname); - return PyUnicode_FromString(tmpname); -} - /* Allocate a new block and return a pointer to it. Returns NULL on error. */ From python-checkins at python.org Sun Jun 28 19:32:20 2009 From: python-checkins at python.org (benjamin.peterson) Date: Sun, 28 Jun 2009 17:32:20 -0000 Subject: [Python-checkins] r73624 - python/branches/py3k/Doc/library/io.rst Message-ID: Author: benjamin.peterson Date: Sun Jun 28 19:32:20 2009 New Revision: 73624 Log: document BufferedIOBase.raw and TextIOBase.buffer Modified: python/branches/py3k/Doc/library/io.rst Modified: python/branches/py3k/Doc/library/io.rst ============================================================================== --- python/branches/py3k/Doc/library/io.rst (original) +++ python/branches/py3k/Doc/library/io.rst Sun Jun 28 19:32:20 2009 @@ -359,9 +359,15 @@ implementation, but wrap one like :class:`BufferedWriter` and :class:`BufferedReader`. - :class:`BufferedIOBase` provides or overrides these methods in addition to + :class:`BufferedIOBase` provides or overrides these members in addition to those from :class:`IOBase`: + .. attribute:: raw + + The underlying raw stream (a :class:`RawIOBase` instance) that + :class:`BufferedIOBase` deals with. This is not part of the + :class:`BufferedIOBase` API and may not exist on some implementations. + .. method:: detach() Separate the underlying raw stream from the buffer and return it. @@ -607,6 +613,12 @@ A string, a tuple of strings, or ``None``, indicating the newlines translated so far. + .. attribute:: buffer + + The underlying binary buffer (a :class:`BufferedIOBase` instance) that + :class:`TextIOBase` deals with. This is not part of the + :class:`TextIOBase` API and may not exist on some implementations. + .. method:: detach() Separate the underlying buffer from the :class:`TextIOBase` and return it. From python-checkins at python.org Sun Jun 28 19:35:49 2009 From: python-checkins at python.org (benjamin.peterson) Date: Sun, 28 Jun 2009 17:35:49 -0000 Subject: [Python-checkins] r73625 - in python/branches/release31-maint: Doc/library/io.rst Doc/library/stdtypes.rst Doc/library/symtable.rst Doc/library/timeit.rst Lib/email/mime/nonmultipart.py Lib/pydoc.py Lib/test/test_coding.py Lib/test/test_extcall.py Lib/test/test_pydoc.py Lib/xml/sax/expatreader.py Misc/ACKS Modules/_ssl.c Modules/_struct.c Objects/funcobject.c Parser/tokenizer.c Python/compile.c Message-ID: Author: benjamin.peterson Date: Sun Jun 28 19:35:48 2009 New Revision: 73625 Log: Merged revisions 73623-73624 via svnmerge from svn+ssh://pythondev at svn.python.org/python/branches/py3k ................ r73623 | benjamin.peterson | 2009-06-28 12:22:03 -0500 (Sun, 28 Jun 2009) | 58 lines Merged revisions 73004,73439,73496,73509,73529,73564,73576-73577,73595-73596,73605 via svnmerge from svn+ssh://pythondev at svn.python.org/python/trunk ........ r73004 | jeffrey.yasskin | 2009-05-28 22:44:31 -0500 (Thu, 28 May 2009) | 5 lines Fix nearly all compilation warnings under Apple gcc-4.0. Tested with OPT="-g -Wall -Wstrict-prototypes -Werror" in both --with-pydebug mode and --without. There's still a batch of non-prototype warnings in Xlib.h that I don't know how to fix. ........ r73439 | benjamin.peterson | 2009-06-15 19:29:31 -0500 (Mon, 15 Jun 2009) | 1 line don't mask encoding errors when decoding a string #6289 ........ r73496 | vinay.sajip | 2009-06-21 12:37:27 -0500 (Sun, 21 Jun 2009) | 1 line Issue #6314: logging.basicConfig() performs extra checks on the "level" argument. ........ r73509 | amaury.forgeotdarc | 2009-06-22 14:33:48 -0500 (Mon, 22 Jun 2009) | 2 lines #4490 Fix sample code run by "python -m xml.sax.xmlreader" ........ r73529 | r.david.murray | 2009-06-23 13:02:46 -0500 (Tue, 23 Jun 2009) | 4 lines Fix issue 5230 by having pydoc's safeimport check to see if the import error was thrown from itself in order to decide if the module can't be found. Thanks to Lucas Prado Melo for collaborating on the fix and tests. ........ r73564 | amaury.forgeotdarc | 2009-06-25 17:29:29 -0500 (Thu, 25 Jun 2009) | 6 lines #2016 Fix a crash in function call when the **kwargs dictionary is mutated during the function call setup. This even gives a slight speedup, probably because tuple allocation is faster than PyMem_NEW. ........ r73576 | benjamin.peterson | 2009-06-26 18:37:06 -0500 (Fri, 26 Jun 2009) | 1 line document is_declared_global() ........ r73577 | benjamin.peterson | 2009-06-27 09:16:23 -0500 (Sat, 27 Jun 2009) | 1 line link to extensive generator docs in the reference manual ........ r73595 | ezio.melotti | 2009-06-27 18:45:39 -0500 (Sat, 27 Jun 2009) | 1 line stmt and setup can contain multiple statements, see #5896 ........ r73596 | ezio.melotti | 2009-06-27 19:07:45 -0500 (Sat, 27 Jun 2009) | 1 line Fixed a wrong apostrophe ........ r73605 | georg.brandl | 2009-06-28 07:10:18 -0500 (Sun, 28 Jun 2009) | 1 line Remove stray pychecker directive. ........ ................ r73624 | benjamin.peterson | 2009-06-28 12:32:20 -0500 (Sun, 28 Jun 2009) | 1 line document BufferedIOBase.raw and TextIOBase.buffer ................ Modified: python/branches/release31-maint/ (props changed) python/branches/release31-maint/Doc/library/io.rst python/branches/release31-maint/Doc/library/stdtypes.rst python/branches/release31-maint/Doc/library/symtable.rst python/branches/release31-maint/Doc/library/timeit.rst python/branches/release31-maint/Lib/email/mime/nonmultipart.py python/branches/release31-maint/Lib/pydoc.py python/branches/release31-maint/Lib/test/test_coding.py python/branches/release31-maint/Lib/test/test_extcall.py python/branches/release31-maint/Lib/test/test_pydoc.py python/branches/release31-maint/Lib/xml/sax/expatreader.py python/branches/release31-maint/Misc/ACKS python/branches/release31-maint/Modules/_ssl.c python/branches/release31-maint/Modules/_struct.c python/branches/release31-maint/Objects/funcobject.c python/branches/release31-maint/Parser/tokenizer.c python/branches/release31-maint/Python/compile.c Modified: python/branches/release31-maint/Doc/library/io.rst ============================================================================== --- python/branches/release31-maint/Doc/library/io.rst (original) +++ python/branches/release31-maint/Doc/library/io.rst Sun Jun 28 19:35:48 2009 @@ -359,9 +359,15 @@ implementation, but wrap one like :class:`BufferedWriter` and :class:`BufferedReader`. - :class:`BufferedIOBase` provides or overrides these methods in addition to + :class:`BufferedIOBase` provides or overrides these members in addition to those from :class:`IOBase`: + .. attribute:: raw + + The underlying raw stream (a :class:`RawIOBase` instance) that + :class:`BufferedIOBase` deals with. This is not part of the + :class:`BufferedIOBase` API and may not exist on some implementations. + .. method:: detach() Separate the underlying raw stream from the buffer and return it. @@ -607,6 +613,12 @@ A string, a tuple of strings, or ``None``, indicating the newlines translated so far. + .. attribute:: buffer + + The underlying binary buffer (a :class:`BufferedIOBase` instance) that + :class:`TextIOBase` deals with. This is not part of the + :class:`TextIOBase` API and may not exist on some implementations. + .. method:: detach() Separate the underlying buffer from the :class:`TextIOBase` and return it. Modified: python/branches/release31-maint/Doc/library/stdtypes.rst ============================================================================== --- python/branches/release31-maint/Doc/library/stdtypes.rst (original) +++ python/branches/release31-maint/Doc/library/stdtypes.rst Sun Jun 28 19:35:48 2009 @@ -583,10 +583,18 @@ continue to do so on subsequent calls. Implementations that do not obey this property are deemed broken. + +.. _generator-types: + +Generator Types +--------------- + Python's :term:`generator`\s provide a convenient way to implement the iterator protocol. If a container object's :meth:`__iter__` method is implemented as a generator, it will automatically return an iterator object (technically, a generator object) supplying the :meth:`__iter__` and :meth:`__next__` methods. +More information about generators can be found in :ref:`the documentation for +the yield expression `. .. _typesseq: Modified: python/branches/release31-maint/Doc/library/symtable.rst ============================================================================== --- python/branches/release31-maint/Doc/library/symtable.rst (original) +++ python/branches/release31-maint/Doc/library/symtable.rst Sun Jun 28 19:35:48 2009 @@ -144,6 +144,10 @@ Return ``True`` if the symbol is global. + .. method:: is_declared_global() + + Return ``True`` if the symbol is declared global with a global statement. + .. method:: is_local() Return ``True`` if the symbol is local to its block. Modified: python/branches/release31-maint/Doc/library/timeit.rst ============================================================================== --- python/branches/release31-maint/Doc/library/timeit.rst (original) +++ python/branches/release31-maint/Doc/library/timeit.rst Sun Jun 28 19:35:48 2009 @@ -24,8 +24,9 @@ The constructor takes a statement to be timed, an additional statement used for setup, and a timer function. Both statements default to ``'pass'``; the timer - function is platform-dependent (see the module doc string). The statements may - contain newlines, as long as they don't contain multi-line string literals. + function is platform-dependent (see the module doc string). *stmt* and *setup* + may also contain multiple statements separated by ``;`` or newlines, as long as + they don't contain multi-line string literals. To measure the execution time of the first statement, use the :meth:`timeit` method. The :meth:`repeat` method is a convenience to call :meth:`timeit` Modified: python/branches/release31-maint/Lib/email/mime/nonmultipart.py ============================================================================== --- python/branches/release31-maint/Lib/email/mime/nonmultipart.py (original) +++ python/branches/release31-maint/Lib/email/mime/nonmultipart.py Sun Jun 28 19:35:48 2009 @@ -14,13 +14,9 @@ class MIMENonMultipart(MIMEBase): """Base class for MIME multipart/* type messages.""" - __pychecker__ = 'unusednames=payload' - def attach(self, payload): # The public API prohibits attaching multiple subparts to MIMEBase # derived subtypes since none of them are, by definition, of content # type multipart/* raise errors.MultipartConversionError( 'Cannot attach additional subparts to non-multipart/*') - - del __pychecker__ Modified: python/branches/release31-maint/Lib/pydoc.py ============================================================================== --- python/branches/release31-maint/Lib/pydoc.py (original) +++ python/branches/release31-maint/Lib/pydoc.py Sun Jun 28 19:35:48 2009 @@ -54,6 +54,7 @@ import sys, imp, os, re, inspect, builtins, pkgutil from reprlib import Repr +from traceback import extract_tb as _extract_tb try: from collections import deque except ImportError: @@ -292,9 +293,9 @@ elif exc is SyntaxError: # A SyntaxError occurred before we could execute the module. raise ErrorDuringImport(value.filename, info) - elif exc is ImportError and \ - str(value).lower().split()[:2] == ['no', 'module']: - # The module was not found. + elif exc is ImportError and _extract_tb(tb)[-1][2]=='safeimport': + # The import error occurred directly in this function, + # which means there is no such module in the path. return None else: # Some other error occurred during the importing process. Modified: python/branches/release31-maint/Lib/test/test_coding.py ============================================================================== --- python/branches/release31-maint/Lib/test/test_coding.py (original) +++ python/branches/release31-maint/Lib/test/test_coding.py Sun Jun 28 19:35:48 2009 @@ -49,6 +49,18 @@ unlink(TESTFN+".pyc") sys.path.pop(0) + def test_error_from_string(self): + # See http://bugs.python.org/issue6289 + input = "# coding: ascii\n\N{SNOWMAN}".encode('utf-8') + try: + compile(input, "", "exec") + except SyntaxError as e: + expected = "'ascii' codec can't decode byte 0xe2 in position 16: " \ + "ordinal not in range(128)" + self.assertTrue(str(e).startswith(expected)) + else: + self.fail("didn't raise") + def test_main(): test.support.run_unittest(CodingTest) Modified: python/branches/release31-maint/Lib/test/test_extcall.py ============================================================================== --- python/branches/release31-maint/Lib/test/test_extcall.py (original) +++ python/branches/release31-maint/Lib/test/test_extcall.py Sun Jun 28 19:35:48 2009 @@ -243,6 +243,24 @@ ... TypeError: id() takes no keyword arguments +A corner case of keyword dictionary items being deleted during +the function call setup. See . + + >>> class Name(str): + ... def __eq__(self, other): + ... try: + ... del x[self] + ... except KeyError: + ... pass + ... return str.__eq__(self, other) + ... def __hash__(self): + ... return str.__hash__(self) + + >>> x = {Name("a"):1, Name("b"):2} + >>> def f(a, b): + ... print(a,b) + >>> f(**x) + 1 2 """ from test import support Modified: python/branches/release31-maint/Lib/test/test_pydoc.py ============================================================================== --- python/branches/release31-maint/Lib/test/test_pydoc.py (original) +++ python/branches/release31-maint/Lib/test/test_pydoc.py Sun Jun 28 19:35:48 2009 @@ -1,5 +1,6 @@ import sys import os +import os.path import difflib import subprocess import re @@ -7,6 +8,8 @@ import inspect import unittest import test.support +from contextlib import contextmanager +from test.support import TESTFN, forget, rmtree, EnvironmentVarGuard from test import pydoc_mod @@ -183,6 +186,9 @@ # output pattern for missing module missing_pattern = "no Python documentation found for '%s'" +# output pattern for module with bad imports +badimport_pattern = "problem in %s - ImportError: No module named %s" + def run_pydoc(module_name, *args): """ Runs pydoc on the specified module. Returns the stripped @@ -254,6 +260,42 @@ self.assertEqual(expected, result, "documentation for missing module found") + def test_badimport(self): + # This tests the fix for issue 5230, where if pydoc found the module + # but the module had an internal import error pydoc would report no doc + # found. + modname = 'testmod_xyzzy' + testpairs = ( + ('i_am_not_here', 'i_am_not_here'), + ('test.i_am_not_here_either', 'i_am_not_here_either'), + ('test.i_am_not_here.neither_am_i', 'i_am_not_here.neither_am_i'), + ('i_am_not_here.{}'.format(modname), 'i_am_not_here.{}'.format(modname)), + ('test.{}'.format(modname), modname), + ) + + @contextmanager + def newdirinpath(dir): + os.mkdir(dir) + sys.path.insert(0, dir) + yield + sys.path.pop(0) + rmtree(dir) + + with newdirinpath(TESTFN), EnvironmentVarGuard() as env: + env['PYTHONPATH'] = TESTFN + fullmodname = os.path.join(TESTFN, modname) + sourcefn = fullmodname + os.extsep + "py" + for importstring, expectedinmsg in testpairs: + f = open(sourcefn, 'w') + f.write("import {}\n".format(importstring)) + f.close() + try: + result = run_pydoc(modname).decode("ascii") + finally: + forget(modname) + expected = badimport_pattern % (modname, expectedinmsg) + self.assertEqual(expected, result) + def test_input_strip(self): missing_module = " test.i_am_not_here " result = str(run_pydoc(missing_module), 'ascii') Modified: python/branches/release31-maint/Lib/xml/sax/expatreader.py ============================================================================== --- python/branches/release31-maint/Lib/xml/sax/expatreader.py (original) +++ python/branches/release31-maint/Lib/xml/sax/expatreader.py Sun Jun 28 19:35:48 2009 @@ -407,8 +407,8 @@ # --- if __name__ == "__main__": - import xml.sax + import xml.sax.saxutils p = create_parser() - p.setContentHandler(xml.sax.XMLGenerator()) + p.setContentHandler(xml.sax.saxutils.XMLGenerator()) p.setErrorHandler(xml.sax.ErrorHandler()) - p.parse("../../../hamlet.xml") + p.parse("http://www.ibiblio.org/xml/examples/shakespeare/hamlet.xml") Modified: python/branches/release31-maint/Misc/ACKS ============================================================================== --- python/branches/release31-maint/Misc/ACKS (original) +++ python/branches/release31-maint/Misc/ACKS Sun Jun 28 19:35:48 2009 @@ -482,6 +482,7 @@ Craig McPheeters Lambert Meertens Bill van Melle +Lucas Prado Melo Luke Mewburn Mike Meyer Steven Miale Modified: python/branches/release31-maint/Modules/_ssl.c ============================================================================== --- python/branches/release31-maint/Modules/_ssl.c (original) +++ python/branches/release31-maint/Modules/_ssl.c Sun Jun 28 19:35:48 2009 @@ -658,7 +658,7 @@ char buf[2048]; char *vptr; int len; - const unsigned char *p; + unsigned char *p; if (certificate == NULL) return peer_alt_names; Modified: python/branches/release31-maint/Modules/_struct.c ============================================================================== --- python/branches/release31-maint/Modules/_struct.c (original) +++ python/branches/release31-maint/Modules/_struct.c Sun Jun 28 19:35:48 2009 @@ -132,6 +132,7 @@ /* Same, but handling unsigned long */ +#ifndef PY_STRUCT_OVERFLOW_MASKING static int get_ulong(PyObject *v, unsigned long *p) { @@ -152,6 +153,7 @@ *p = x; return 0; } +#endif /* PY_STRUCT_OVERFLOW_MASKING */ #ifdef HAVE_LONG_LONG Modified: python/branches/release31-maint/Objects/funcobject.c ============================================================================== --- python/branches/release31-maint/Objects/funcobject.c (original) +++ python/branches/release31-maint/Objects/funcobject.c Sun Jun 28 19:35:48 2009 @@ -593,13 +593,14 @@ { PyObject *result; PyObject *argdefs; + PyObject *kwtuple = NULL; PyObject **d, **k; Py_ssize_t nk, nd; argdefs = PyFunction_GET_DEFAULTS(func); if (argdefs != NULL && PyTuple_Check(argdefs)) { d = &PyTuple_GET_ITEM((PyTupleObject *)argdefs, 0); - nd = PyTuple_Size(argdefs); + nd = PyTuple_GET_SIZE(argdefs); } else { d = NULL; @@ -609,16 +610,17 @@ if (kw != NULL && PyDict_Check(kw)) { Py_ssize_t pos, i; nk = PyDict_Size(kw); - k = PyMem_NEW(PyObject *, 2*nk); - if (k == NULL) { - PyErr_NoMemory(); + kwtuple = PyTuple_New(2*nk); + if (kwtuple == NULL) return NULL; - } + k = &PyTuple_GET_ITEM(kwtuple, 0); pos = i = 0; - while (PyDict_Next(kw, &pos, &k[i], &k[i+1])) + while (PyDict_Next(kw, &pos, &k[i], &k[i+1])) { + Py_INCREF(k[i]); + Py_INCREF(k[i+1]); i += 2; + } nk = i/2; - /* XXX This is broken if the caller deletes dict items! */ } else { k = NULL; @@ -628,13 +630,12 @@ result = PyEval_EvalCodeEx( (PyCodeObject *)PyFunction_GET_CODE(func), PyFunction_GET_GLOBALS(func), (PyObject *)NULL, - &PyTuple_GET_ITEM(arg, 0), PyTuple_Size(arg), + &PyTuple_GET_ITEM(arg, 0), PyTuple_GET_SIZE(arg), k, nk, d, nd, PyFunction_GET_KW_DEFAULTS(func), PyFunction_GET_CLOSURE(func)); - if (k != NULL) - PyMem_DEL(k); + Py_XDECREF(kwtuple); return result; } Modified: python/branches/release31-maint/Parser/tokenizer.c ============================================================================== --- python/branches/release31-maint/Parser/tokenizer.c (original) +++ python/branches/release31-maint/Parser/tokenizer.c Sun Jun 28 19:35:48 2009 @@ -682,11 +682,8 @@ if (tok->enc != NULL) { assert(utf8 == NULL); utf8 = translate_into_utf8(str, tok->enc); - if (utf8 == NULL) { - PyErr_Format(PyExc_SyntaxError, - "unknown encoding: %s", tok->enc); + if (utf8 == NULL) return error_ret(tok); - } str = PyBytes_AS_STRING(utf8); } assert(tok->decoding_buffer == NULL); Modified: python/branches/release31-maint/Python/compile.c ============================================================================== --- python/branches/release31-maint/Python/compile.c (original) +++ python/branches/release31-maint/Python/compile.c Sun Jun 28 19:35:48 2009 @@ -551,18 +551,6 @@ } -/* Allocate a new "anonymous" local variable. - Used by list comprehensions and with statements. -*/ - -static PyObject * -compiler_new_tmpname(struct compiler *c) -{ - char tmpname[256]; - PyOS_snprintf(tmpname, sizeof(tmpname), "_[%d]", ++c->u->u_tmpname); - return PyUnicode_FromString(tmpname); -} - /* Allocate a new block and return a pointer to it. Returns NULL on error. */ From buildbot at python.org Sun Jun 28 20:20:56 2009 From: buildbot at python.org (buildbot at python.org) Date: Sun, 28 Jun 2009 18:20:56 +0000 Subject: [Python-checkins] buildbot failure in sparc solaris10 gcc 3.x Message-ID: The Buildbot has detected a new failure of sparc solaris10 gcc 3.x. Full details are available at: http://www.python.org/dev/buildbot/all/sparc%20solaris10%20gcc%203.x/builds/870 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: loewis-sun Build Reason: Build Source Stamp: [branch branches/py3k] HEAD Blamelist: benjamin.peterson BUILD FAILED: failed test Excerpt from the test logfile: sincerely, -The Buildbot From python-checkins at python.org Sun Jun 28 21:19:52 2009 From: python-checkins at python.org (benjamin.peterson) Date: Sun, 28 Jun 2009 19:19:52 -0000 Subject: [Python-checkins] r73626 - in python/branches/py3k: Include/pyerrors.h Include/symtable.h Lib/symtable.py Lib/test/doctest_aliases.py Lib/test/test_ast.py Lib/test/test_compile.py Lib/test/test_doctest.py Lib/test/test_generators.py Lib/test/test_symtable.py Lib/test/test_syntax.py Lib/test/test_with.py Modules/symtablemodule.c Objects/exceptions.c Objects/floatobject.c Parser/Python.asdl Parser/grammar.mak Python/Python-ast.c Python/ast.c Python/compile.c Python/symtable.c Message-ID: Author: benjamin.peterson Date: Sun Jun 28 21:19:51 2009 New Revision: 73626 Log: Merged revisions 73376,73393,73398,73400,73404-73405,73409,73419-73421,73432,73457,73460,73485-73486,73488-73489,73501-73502,73513-73514 via svnmerge from svn+ssh://pythondev at svn.python.org/python/trunk ........ r73376 | benjamin.peterson | 2009-06-11 17:29:23 -0500 (Thu, 11 Jun 2009) | 1 line remove check for case handled in sub-function ........ r73393 | alexandre.vassalotti | 2009-06-12 13:56:57 -0500 (Fri, 12 Jun 2009) | 2 lines Clear reference to the static PyExc_RecursionErrorInst in _PyExc_Fini. ........ r73398 | alexandre.vassalotti | 2009-06-12 15:57:12 -0500 (Fri, 12 Jun 2009) | 3 lines Add const qualifier to PyErr_SetFromErrnoWithFilename and to PyErr_SetFromErrnoWithUnicodeFilename. ........ r73400 | alexandre.vassalotti | 2009-06-12 16:43:47 -0500 (Fri, 12 Jun 2009) | 2 lines Delete outdated make file for building the parser with MSVC 6. ........ r73404 | benjamin.peterson | 2009-06-12 20:40:00 -0500 (Fri, 12 Jun 2009) | 1 line keep the slice.step field as NULL if no step expression is given ........ r73405 | benjamin.peterson | 2009-06-12 22:46:30 -0500 (Fri, 12 Jun 2009) | 1 line prevent import statements from assigning to None ........ r73409 | benjamin.peterson | 2009-06-13 08:06:21 -0500 (Sat, 13 Jun 2009) | 1 line allow importing from a module named None if it has an 'as' clause ........ r73419 | benjamin.peterson | 2009-06-13 11:19:19 -0500 (Sat, 13 Jun 2009) | 1 line set Print.values to NULL if there are no values ........ r73420 | benjamin.peterson | 2009-06-13 12:08:53 -0500 (Sat, 13 Jun 2009) | 1 line give a better error message when deleting () ........ r73421 | benjamin.peterson | 2009-06-13 15:23:33 -0500 (Sat, 13 Jun 2009) | 1 line when no module is given in a 'from' relative import, make ImportFrom.module NULL ........ r73432 | amaury.forgeotdarc | 2009-06-14 16:20:40 -0500 (Sun, 14 Jun 2009) | 3 lines #6227: Because of a wrong indentation, the test was not testing what it should. Ensure that the snippet in doctest_aliases actually contains aliases. ........ r73457 | benjamin.peterson | 2009-06-16 18:13:09 -0500 (Tue, 16 Jun 2009) | 1 line add underscores ........ r73460 | benjamin.peterson | 2009-06-16 22:23:04 -0500 (Tue, 16 Jun 2009) | 1 line remove unused 'encoding' member from the compiler struct ........ r73485 | benjamin.peterson | 2009-06-19 17:07:47 -0500 (Fri, 19 Jun 2009) | 1 line remove duplicate test ........ r73486 | benjamin.peterson | 2009-06-19 17:09:17 -0500 (Fri, 19 Jun 2009) | 1 line add missing assertion #6313 ........ r73488 | benjamin.peterson | 2009-06-19 17:16:28 -0500 (Fri, 19 Jun 2009) | 1 line show that this one isn't used ........ r73489 | benjamin.peterson | 2009-06-19 17:21:12 -0500 (Fri, 19 Jun 2009) | 1 line use closures ........ r73501 | benjamin.peterson | 2009-06-21 18:01:07 -0500 (Sun, 21 Jun 2009) | 1 line don't need to add the name 'lambda' as assigned ........ r73502 | benjamin.peterson | 2009-06-21 18:03:36 -0500 (Sun, 21 Jun 2009) | 1 line remove tmpname support since it's no longer used ........ r73513 | benjamin.peterson | 2009-06-22 20:18:57 -0500 (Mon, 22 Jun 2009) | 1 line fix grammar ........ r73514 | benjamin.peterson | 2009-06-22 22:01:56 -0500 (Mon, 22 Jun 2009) | 1 line remove some unused symtable constants ........ Removed: python/branches/py3k/Parser/grammar.mak Modified: python/branches/py3k/ (props changed) python/branches/py3k/Include/pyerrors.h python/branches/py3k/Include/symtable.h python/branches/py3k/Lib/symtable.py python/branches/py3k/Lib/test/doctest_aliases.py python/branches/py3k/Lib/test/test_ast.py python/branches/py3k/Lib/test/test_compile.py python/branches/py3k/Lib/test/test_doctest.py python/branches/py3k/Lib/test/test_generators.py python/branches/py3k/Lib/test/test_symtable.py python/branches/py3k/Lib/test/test_syntax.py python/branches/py3k/Lib/test/test_with.py python/branches/py3k/Modules/symtablemodule.c python/branches/py3k/Objects/exceptions.c python/branches/py3k/Objects/floatobject.c python/branches/py3k/Parser/Python.asdl python/branches/py3k/Python/Python-ast.c python/branches/py3k/Python/ast.c python/branches/py3k/Python/compile.c python/branches/py3k/Python/symtable.c Modified: python/branches/py3k/Include/pyerrors.h ============================================================================== --- python/branches/py3k/Include/pyerrors.h (original) +++ python/branches/py3k/Include/pyerrors.h Sun Jun 28 21:19:51 2009 @@ -176,7 +176,8 @@ PyAPI_FUNC(PyObject *) PyErr_SetFromErrno(PyObject *); PyAPI_FUNC(PyObject *) PyErr_SetFromErrnoWithFilenameObject( PyObject *, PyObject *); -PyAPI_FUNC(PyObject *) PyErr_SetFromErrnoWithFilename(PyObject *, const char *); +PyAPI_FUNC(PyObject *) PyErr_SetFromErrnoWithFilename( + PyObject *, const char *); #ifdef MS_WINDOWS PyAPI_FUNC(PyObject *) PyErr_SetFromErrnoWithUnicodeFilename( PyObject *, const Py_UNICODE *); Modified: python/branches/py3k/Include/symtable.h ============================================================================== --- python/branches/py3k/Include/symtable.h (original) +++ python/branches/py3k/Include/symtable.h Sun Jun 28 21:19:51 2009 @@ -70,13 +70,9 @@ #define DEF_PARAM 2<<1 /* formal parameter */ #define DEF_NONLOCAL 2<<2 /* nonlocal stmt */ #define USE 2<<3 /* name is used */ -#define DEF_STAR 2<<4 /* parameter is star arg */ -#define DEF_DOUBLESTAR 2<<5 /* parameter is star-star arg */ -#define DEF_INTUPLE 2<<6 /* name defined in tuple in parameters */ -#define DEF_FREE 2<<7 /* name used but not defined in nested block */ -#define DEF_FREE_GLOBAL 2<<8 /* free variable is actually implicit global */ -#define DEF_FREE_CLASS 2<<9 /* free variable from class's method */ -#define DEF_IMPORT 2<<10 /* assignment occurred via import */ +#define DEF_FREE 2<<4 /* name used but not defined in nested block */ +#define DEF_FREE_CLASS 2<<5 /* free variable from class's method */ +#define DEF_IMPORT 2<<6 /* assignment occurred via import */ #define DEF_BOUND (DEF_LOCAL | DEF_PARAM | DEF_IMPORT) Modified: python/branches/py3k/Lib/symtable.py ============================================================================== --- python/branches/py3k/Lib/symtable.py (original) +++ python/branches/py3k/Lib/symtable.py Sun Jun 28 21:19:51 2009 @@ -2,9 +2,8 @@ import _symtable from _symtable import (USE, DEF_GLOBAL, DEF_LOCAL, DEF_PARAM, - DEF_FREE_GLOBAL, DEF_FREE_CLASS, DEF_IMPORT, DEF_BOUND, - OPT_IMPORT_STAR, SCOPE_OFF, SCOPE_MASK, FREE, - GLOBAL_IMPLICIT, GLOBAL_EXPLICIT) + DEF_IMPORT, DEF_BOUND, OPT_IMPORT_STAR, SCOPE_OFF, SCOPE_MASK, FREE, + LOCAL, GLOBAL_IMPLICIT, GLOBAL_EXPLICIT) import weakref @@ -138,7 +137,9 @@ def get_locals(self): if self.__locals is None: - self.__locals = self.__idents_matching(lambda x:x & DEF_BOUND) + test = lambda x: (((x >> SCOPE_OFF) & SCOPE_MASK) == LOCAL or + (x & DEF_BOUND and not x & DEF_GLOBAL)) + self.__locals = self.__idents_matching(test) return self.__locals def get_globals(self): Modified: python/branches/py3k/Lib/test/doctest_aliases.py ============================================================================== --- python/branches/py3k/Lib/test/doctest_aliases.py (original) +++ python/branches/py3k/Lib/test/doctest_aliases.py Sun Jun 28 21:19:51 2009 @@ -10,4 +10,4 @@ ''' return 'f' - g = f # define an alias for f + g = f # define an alias for f Modified: python/branches/py3k/Lib/test/test_ast.py ============================================================================== --- python/branches/py3k/Lib/test/test_ast.py (original) +++ python/branches/py3k/Lib/test/test_ast.py Sun Jun 28 21:19:51 2009 @@ -140,6 +140,16 @@ self.assertEquals(to_tuple(ast_tree), o) self._assert_order(ast_tree, (0, 0)) + def test_slice(self): + slc = ast.parse("x[::]").body[0].value.slice + self.assertIsNone(slc.upper) + self.assertIsNone(slc.lower) + self.assertIsNone(slc.step) + + def test_from_import(self): + im = ast.parse("from . import y").body[0] + self.assertIsNone(im.module) + def test_nodeclasses(self): x = ast.BinOp(1, 2, 3, lineno=0) self.assertEquals(x.left, 1) Modified: python/branches/py3k/Lib/test/test_compile.py ============================================================================== --- python/branches/py3k/Lib/test/test_compile.py (original) +++ python/branches/py3k/Lib/test/test_compile.py Sun Jun 28 21:19:51 2009 @@ -213,6 +213,10 @@ '(a, None) = 0, 0', 'for None in range(10): pass', 'def f(None): pass', + 'import None', + 'import x as None', + 'from x import None', + 'from x import y as None' ] for stmt in stmts: stmt += "\n" Modified: python/branches/py3k/Lib/test/test_doctest.py ============================================================================== --- python/branches/py3k/Lib/test/test_doctest.py (original) +++ python/branches/py3k/Lib/test/test_doctest.py Sun Jun 28 21:19:51 2009 @@ -498,6 +498,8 @@ will only be generated for it once: >>> from test import doctest_aliases + >>> assert doctest_aliases.TwoNames.f + >>> assert doctest_aliases.TwoNames.g >>> tests = excl_empty_finder.find(doctest_aliases) >>> print(len(tests)) 2 Modified: python/branches/py3k/Lib/test/test_generators.py ============================================================================== --- python/branches/py3k/Lib/test/test_generators.py (original) +++ python/branches/py3k/Lib/test/test_generators.py Sun Jun 28 21:19:51 2009 @@ -960,11 +960,11 @@ # iterators have side-effects, so that which values *can* be generated at # each slot depend on the values iterated at previous slots. -def conjoin(gs): +def simple_conjoin(gs): values = [None] * len(gs) - def gen(i, values=values): + def gen(i): if i >= len(gs): yield values else: @@ -989,7 +989,7 @@ # Do one loop nest at time recursively, until the # of loop nests # remaining is divisible by 3. - def gen(i, values=values): + def gen(i): if i >= n: yield values @@ -1007,7 +1007,7 @@ # remain. Don't call directly: this is an internal optimization for # gen's use. - def _gen3(i, values=values): + def _gen3(i): assert i < n and (n-i) % 3 == 0 ip1, ip2, ip3 = i+1, i+2, i+3 g, g1, g2 = gs[i : ip3] Modified: python/branches/py3k/Lib/test/test_symtable.py ============================================================================== --- python/branches/py3k/Lib/test/test_symtable.py (original) +++ python/branches/py3k/Lib/test/test_symtable.py Sun Jun 28 21:19:51 2009 @@ -82,7 +82,7 @@ func = self.spam self.assertEqual(func.get_parameters(), ("a", "b", "kw", "var")) self.assertEqual(func.get_locals(), - ("a", "b", "bar", "glob", "internal", "kw", "var", "x")) + ("a", "b", "internal", "kw", "var", "x")) self.assertEqual(func.get_globals(), ("bar", "glob")) self.assertEqual(self.internal.get_frees(), ("x",)) Modified: python/branches/py3k/Lib/test/test_syntax.py ============================================================================== --- python/branches/py3k/Lib/test/test_syntax.py (original) +++ python/branches/py3k/Lib/test/test_syntax.py Sun Jun 28 21:19:51 2009 @@ -476,6 +476,12 @@ ... SyntaxError: keyword argument repeated +>>> del () +Traceback (most recent call last): + ... + File "", line 1 +SyntaxError: can't delete () + """ import re Modified: python/branches/py3k/Lib/test/test_with.py ============================================================================== --- python/branches/py3k/Lib/test/test_with.py (original) +++ python/branches/py3k/Lib/test/test_with.py Sun Jun 28 21:19:51 2009 @@ -285,15 +285,6 @@ with Nested(mock_contextmanager_generator()): pass - def testSingleArgUnbound(self): - mock_contextmanager = mock_contextmanager_generator() - mock_nested = MockNested(mock_contextmanager) - with mock_nested: - self.assertInWithManagerInvariants(mock_contextmanager) - self.assertInWithManagerInvariants(mock_nested) - self.assertAfterWithManagerInvariantsNoError(mock_contextmanager) - self.assertAfterWithManagerInvariantsNoError(mock_nested) - def testSingleArgBoundToNonTuple(self): m = mock_contextmanager_generator() # This will bind all the arguments to nested() into a single list @@ -721,6 +712,7 @@ body_executed = True self.assertTrue(a.enter_called) self.assertTrue(a.exit_called) + self.assertTrue(body_executed) self.assertNotEqual(a.exc_info[0], None) def testEnterReturnsTuple(self): Modified: python/branches/py3k/Modules/symtablemodule.c ============================================================================== --- python/branches/py3k/Modules/symtablemodule.c (original) +++ python/branches/py3k/Modules/symtablemodule.c Sun Jun 28 21:19:51 2009 @@ -71,11 +71,7 @@ PyModule_AddIntConstant(m, "DEF_GLOBAL", DEF_GLOBAL); PyModule_AddIntConstant(m, "DEF_LOCAL", DEF_LOCAL); PyModule_AddIntConstant(m, "DEF_PARAM", DEF_PARAM); - PyModule_AddIntConstant(m, "DEF_STAR", DEF_STAR); - PyModule_AddIntConstant(m, "DEF_DOUBLESTAR", DEF_DOUBLESTAR); - PyModule_AddIntConstant(m, "DEF_INTUPLE", DEF_INTUPLE); PyModule_AddIntConstant(m, "DEF_FREE", DEF_FREE); - PyModule_AddIntConstant(m, "DEF_FREE_GLOBAL", DEF_FREE_GLOBAL); PyModule_AddIntConstant(m, "DEF_FREE_CLASS", DEF_FREE_CLASS); PyModule_AddIntConstant(m, "DEF_IMPORT", DEF_IMPORT); PyModule_AddIntConstant(m, "DEF_BOUND", DEF_BOUND); Modified: python/branches/py3k/Objects/exceptions.c ============================================================================== --- python/branches/py3k/Objects/exceptions.c (original) +++ python/branches/py3k/Objects/exceptions.c Sun Jun 28 21:19:51 2009 @@ -1979,6 +1979,6 @@ void _PyExc_Fini(void) { - Py_XDECREF(PyExc_MemoryErrorInst); - PyExc_MemoryErrorInst = NULL; + Py_CLEAR(PyExc_MemoryErrorInst); + Py_CLEAR(PyExc_RecursionErrorInst); } Modified: python/branches/py3k/Objects/floatobject.c ============================================================================== --- python/branches/py3k/Objects/floatobject.c (original) +++ python/branches/py3k/Objects/floatobject.c Sun Jun 28 21:19:51 2009 @@ -73,7 +73,7 @@ static PyTypeObject FloatInfoType; PyDoc_STRVAR(floatinfo__doc__, -"sys.floatinfo\n\ +"sys.float_info\n\ \n\ A structseq holding information about the float type. It contains low level\n\ information about the precision and internal representation. Please study\n\ @@ -100,7 +100,7 @@ }; static PyStructSequence_Desc floatinfo_desc = { - "sys.floatinfo", /* name */ + "sys.float_info", /* name */ floatinfo__doc__, /* doc */ floatinfo_fields, /* fields */ 11 Modified: python/branches/py3k/Parser/Python.asdl ============================================================================== --- python/branches/py3k/Parser/Python.asdl (original) +++ python/branches/py3k/Parser/Python.asdl Sun Jun 28 21:19:51 2009 @@ -36,7 +36,7 @@ | Assert(expr test, expr? msg) | Import(alias* names) - | ImportFrom(identifier module, alias* names, int? level) + | ImportFrom(identifier? module, alias* names, int? level) | Global(identifier* names) | Nonlocal(identifier* names) Deleted: python/branches/py3k/Parser/grammar.mak ============================================================================== --- python/branches/py3k/Parser/grammar.mak Sun Jun 28 21:19:51 2009 +++ (empty file) @@ -1,45 +0,0 @@ -# This manages to rebuild graminit.{h, c} under MSVC 6 (Windows), via -# -# nmake /f grammar.mak -# -# You may also need to copy python23.dll into this directory, or get -# it on your search path. -# -# The intermediate files can be nuked afterwards: -# -# nmake /f grammar.mak clean -# -# I don't understand the maze of preprocessor #define's on Windows, and -# as a result this requires linking with python23.lib, so it's of no use -# for bootstrapping (the cause appears to be a useless-- in this -# particular case --pragma in PC\pyconfig.h, which demands that -# python23.lib get linked in). - -LIBS= ..\PCbuild\python25.lib - -CFLAGS= /I ..\Include /I ..\PC /D MS_NO_COREDLL /D PGEN /MD - -GRAMMAR_H= ..\Include\graminit.h -GRAMMAR_C= ..\Python\graminit.c -GRAMMAR_INPUT= ..\Grammar\Grammar - -PGEN= pgen.exe - -POBJS= acceler.obj grammar1.obj listnode.obj node.obj parser.obj \ - parsetok.obj tokenizer.obj bitset.obj metagrammar.obj - -PARSER_OBJS= $(POBJS) myreadline.obj - -PGOBJS= firstsets.obj grammar.obj pgen.obj printgrammar.obj pgenmain.obj - -PGENOBJS= $(POBJS) $(PGOBJS) - -$(GRAMMAR_H) $(GRAMMAR_C): $(PGEN) $(GRAMMAR_INPUT) - $(PGEN) $(GRAMMAR_INPUT) $(GRAMMAR_H) $(GRAMMAR_C) - -$(PGEN): $(PGENOBJS) - $(CC) $(PGENOBJS) $(LIBS) /Fe$(PGEN) - -clean: - del *.obj - del $(PGEN) Modified: python/branches/py3k/Python/Python-ast.c ============================================================================== --- python/branches/py3k/Python/Python-ast.c (original) +++ python/branches/py3k/Python/Python-ast.c Sun Jun 28 21:19:51 2009 @@ -1332,11 +1332,6 @@ col_offset, PyArena *arena) { stmt_ty p; - if (!module) { - PyErr_SetString(PyExc_ValueError, - "field module is required for ImportFrom"); - return NULL; - } p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p)); if (!p) return NULL; @@ -4465,8 +4460,7 @@ Py_XDECREF(tmp); tmp = NULL; } else { - PyErr_SetString(PyExc_TypeError, "required field \"module\" missing from ImportFrom"); - return 1; + module = NULL; } if (PyObject_HasAttrString(obj, "names")) { int res; Modified: python/branches/py3k/Python/ast.c ============================================================================== --- python/branches/py3k/Python/ast.c (original) +++ python/branches/py3k/Python/ast.c Sun Jun 28 21:19:51 2009 @@ -362,12 +362,12 @@ }; static int -forbidden_name(expr_ty e, const node *n) +forbidden_name(identifier name, const node *n) { const char **p; - assert(PyUnicode_Check(e->v.Name.id)); + assert(PyUnicode_Check(name)); for (p = FORBIDDEN; *p; p++) { - if (PyUnicode_CompareWithASCIIString(e->v.Name.id, *p) == 0) { + if (PyUnicode_CompareWithASCIIString(name, *p) == 0) { ast_error(n, "assignment to keyword"); return 1; } @@ -414,7 +414,7 @@ break; case Name_kind: if (ctx == Store) { - if (forbidden_name(e, n)) + if (forbidden_name(e->v.Name.id, n)) return 0; /* forbidden_name() calls ast_error() */ } e->v.Name.ctx = ctx; @@ -424,10 +424,13 @@ s = e->v.List.elts; break; case Tuple_kind: - if (asdl_seq_LEN(e->v.Tuple.elts) == 0) - return ast_error(n, "can't assign to ()"); - e->v.Tuple.ctx = ctx; - s = e->v.Tuple.elts; + if (asdl_seq_LEN(e->v.Tuple.elts)) { + e->v.Tuple.ctx = ctx; + s = e->v.Tuple.elts; + } + else { + expr_name = "()"; + } break; case Lambda_kind: expr_name = "lambda"; @@ -1378,7 +1381,7 @@ /* testlist_comp: test ( comp_for | (',' test)* [','] ) */ if ((NCH(ch) > 1) && (TYPE(CHILD(ch, 1)) == comp_for)) return ast_for_genexp(c, ch); - + return ast_for_testlist(c, ch); case LSQB: /* list (or list comprehension) */ ch = CHILD(n, 1); @@ -1513,14 +1516,7 @@ ch = CHILD(n, NCH(n) - 1); if (TYPE(ch) == sliceop) { - if (NCH(ch) == 1) { - /* No expression, so step is None */ - ch = CHILD(ch, 0); - step = Name(new_identifier("None", c->c_arena), Load, - LINENO(ch), ch->n_col_offset, c->c_arena); - if (!step) - return NULL; - } else { + if (NCH(ch) != 1) { ch = CHILD(ch, 1); if (TYPE(ch) == test) { step = ast_for_expr(c, ch); @@ -2014,7 +2010,7 @@ } else if (e->kind != Name_kind) { ast_error(CHILD(ch, 0), "keyword can't be an expression"); return NULL; - } else if (forbidden_name(e, ch)) { + } else if (forbidden_name(e->v.Name.id, ch)) { return NULL; } key = e->v.Name.id; @@ -2160,6 +2156,7 @@ } } + static asdl_seq * ast_for_exprlist(struct compiling *c, const node *n, expr_context_ty context) { @@ -2260,49 +2257,64 @@ } static alias_ty -alias_for_import_name(struct compiling *c, const node *n) +alias_for_import_name(struct compiling *c, const node *n, int store) { /* import_as_name: NAME ['as' NAME] dotted_as_name: dotted_name ['as' NAME] dotted_name: NAME ('.' NAME)* */ - PyObject *str, *name; + identifier str, name; loop: switch (TYPE(n)) { - case import_as_name: + case import_as_name: { + node *name_node = CHILD(n, 0); str = NULL; + name = NEW_IDENTIFIER(name_node); + if (!name) + return NULL; if (NCH(n) == 3) { - str = NEW_IDENTIFIER(CHILD(n, 2)); + node *str_node = CHILD(n, 2); + str = NEW_IDENTIFIER(str_node); if (!str) return NULL; + if (store && forbidden_name(str, str_node)) + return NULL; + } + else { + if (forbidden_name(name, name_node)) + return NULL; } - name = NEW_IDENTIFIER(CHILD(n, 0)); - if (!name) - return NULL; return alias(name, str, c->c_arena); + } case dotted_as_name: if (NCH(n) == 1) { n = CHILD(n, 0); goto loop; } else { - alias_ty a = alias_for_import_name(c, CHILD(n, 0)); + node *asname_node = CHILD(n, 2); + alias_ty a = alias_for_import_name(c, CHILD(n, 0), 0); if (!a) return NULL; assert(!a->asname); - a->asname = NEW_IDENTIFIER(CHILD(n, 2)); + a->asname = NEW_IDENTIFIER(asname_node); if (!a->asname) return NULL; + if (forbidden_name(a->asname, asname_node)) + return NULL; return a; } break; case dotted_name: if (NCH(n) == 1) { - name = NEW_IDENTIFIER(CHILD(n, 0)); + node *name_node = CHILD(n, 0); + name = NEW_IDENTIFIER(name_node); if (!name) return NULL; + if (store && forbidden_name(name, name_node)) + return NULL; return alias(name, NULL, c->c_arena); } else { @@ -2382,7 +2394,7 @@ if (!aliases) return NULL; for (i = 0; i < NCH(n); i += 2) { - alias_ty import_alias = alias_for_import_name(c, CHILD(n, i)); + alias_ty import_alias = alias_for_import_name(c, CHILD(n, i), 1); if (!import_alias) return NULL; asdl_seq_SET(aliases, i / 2, import_alias); @@ -2393,13 +2405,15 @@ int n_children; int idx, ndots = 0; alias_ty mod = NULL; - identifier modname; + identifier modname = NULL; /* Count the number of dots (for relative imports) and check for the optional module name */ for (idx = 1; idx < NCH(n); idx++) { if (TYPE(CHILD(n, idx)) == dotted_name) { - mod = alias_for_import_name(c, CHILD(n, idx)); + mod = alias_for_import_name(c, CHILD(n, idx), 0); + if (!mod) + return NULL; idx++; break; } else if (TYPE(CHILD(n, idx)) == ELLIPSIS) { @@ -2444,14 +2458,14 @@ /* handle "from ... import *" special b/c there's no children */ if (TYPE(n) == STAR) { - alias_ty import_alias = alias_for_import_name(c, n); + alias_ty import_alias = alias_for_import_name(c, n, 1); if (!import_alias) return NULL; asdl_seq_SET(aliases, 0, import_alias); } else { for (i = 0; i < NCH(n); i += 2) { - alias_ty import_alias = alias_for_import_name(c, CHILD(n, i)); + alias_ty import_alias = alias_for_import_name(c, CHILD(n, i), 1); if (!import_alias) return NULL; asdl_seq_SET(aliases, i / 2, import_alias); @@ -2459,8 +2473,6 @@ } if (mod != NULL) modname = mod->name; - else - modname = new_identifier("", c->c_arena); return ImportFrom(modname, aliases, ndots, lineno, col_offset, c->c_arena); } Modified: python/branches/py3k/Python/compile.c ============================================================================== --- python/branches/py3k/Python/compile.c (original) +++ python/branches/py3k/Python/compile.c Sun Jun 28 21:19:51 2009 @@ -117,7 +117,6 @@ members, you can reach all early allocated blocks. */ basicblock *u_blocks; basicblock *u_curblock; /* pointer to current block */ - int u_tmpname; /* temporary variables for list comps */ int u_nfblocks; struct fblockinfo u_fblock[CO_MAXBLOCKS]; @@ -146,7 +145,6 @@ struct compiler_unit *u; /* compiler state for current block */ PyObject *c_stack; /* Python list holding compiler_unit ptrs */ - char *c_encoding; /* source encoding (a borrowed reference) */ PyArena *c_arena; /* pointer to memory allocation arena */ }; @@ -295,9 +293,6 @@ goto finally; } - /* XXX initialize to NULL for now, need to handle */ - c.c_encoding = NULL; - co = compiler_mod(&c, mod); finally: @@ -488,7 +483,6 @@ } u->u_blocks = NULL; - u->u_tmpname = 0; u->u_nfblocks = 0; u->u_firstlineno = lineno; u->u_lineno = 0; @@ -2154,6 +2148,13 @@ PyObject *names = PyTuple_New(n); PyObject *level; + static PyObject *empty_string; + + if (!empty_string) { + empty_string = PyUnicode_FromString(""); + if (!empty_string) + return 0; + } if (!names) return 0; @@ -2171,23 +2172,24 @@ PyTuple_SET_ITEM(names, i, alias->name); } - if (s->lineno > c->c_future->ff_lineno) { - if (!PyUnicode_CompareWithASCIIString(s->v.ImportFrom.module, - "__future__")) { - Py_DECREF(level); - Py_DECREF(names); - return compiler_error(c, - "from __future__ imports must occur " + if (s->lineno > c->c_future->ff_lineno && s->v.ImportFrom.module && + !PyUnicode_CompareWithASCIIString(s->v.ImportFrom.module, "__future__")) { + Py_DECREF(level); + Py_DECREF(names); + return compiler_error(c, "from __future__ imports must occur " "at the beginning of the file"); - - } } ADDOP_O(c, LOAD_CONST, level, consts); Py_DECREF(level); ADDOP_O(c, LOAD_CONST, names, consts); Py_DECREF(names); - ADDOP_NAME(c, IMPORT_NAME, s->v.ImportFrom.module, names); + if (s->v.ImportFrom.module) { + ADDOP_NAME(c, IMPORT_NAME, s->v.ImportFrom.module, names); + } + else { + ADDOP_NAME(c, IMPORT_NAME, empty_string, names); + } for (i = 0; i < n; i++) { alias_ty alias = (alias_ty)asdl_seq_GET(s->v.ImportFrom.names, i); identifier store_name; Modified: python/branches/py3k/Python/symtable.c ============================================================================== --- python/branches/py3k/Python/symtable.c (original) +++ python/branches/py3k/Python/symtable.c Sun Jun 28 21:19:51 2009 @@ -38,7 +38,6 @@ goto fail; ste->ste_table = st; ste->ste_id = k; - ste->ste_tmpname = 0; ste->ste_name = name; Py_INCREF(name); @@ -66,7 +65,6 @@ ste->ste_varargs = 0; ste->ste_varkeywords = 0; ste->ste_opt_lineno = 0; - ste->ste_tmpname = 0; ste->ste_lineno = lineno; if (st->st_cur != NULL && @@ -1099,7 +1097,6 @@ } - static int symtable_visit_stmt(struct symtable *st, stmt_ty s) { @@ -1297,12 +1294,8 @@ /* nothing to do here */ break; case With_kind: - if (!symtable_new_tmpname(st)) - return 0; VISIT(st, expr, s->v.With.context_expr); if (s->v.With.optional_vars) { - if (!symtable_new_tmpname(st)) - return 0; VISIT(st, expr, s->v.With.optional_vars); } VISIT_SEQ(st, stmt, s->v.With.body); @@ -1326,8 +1319,7 @@ VISIT(st, expr, e->v.UnaryOp.operand); break; case Lambda_kind: { - if (!GET_IDENTIFIER(lambda) || - !symtable_add_def(st, lambda, DEF_LOCAL)) + if (!GET_IDENTIFIER(lambda)) return 0; if (e->v.Lambda.args->defaults) VISIT_SEQ(st, expr, e->v.Lambda.args->defaults); From python-checkins at python.org Sun Jun 28 21:27:55 2009 From: python-checkins at python.org (benjamin.peterson) Date: Sun, 28 Jun 2009 19:27:55 -0000 Subject: [Python-checkins] r73627 - in python/trunk/Lib: symtable.py test/test_symtable.py Message-ID: Author: benjamin.peterson Date: Sun Jun 28 21:27:55 2009 New Revision: 73627 Log: return locals and cells in get_locals() not bound globals, though Modified: python/trunk/Lib/symtable.py python/trunk/Lib/test/test_symtable.py Modified: python/trunk/Lib/symtable.py ============================================================================== --- python/trunk/Lib/symtable.py (original) +++ python/trunk/Lib/symtable.py Sun Jun 28 21:27:55 2009 @@ -3,7 +3,7 @@ import _symtable from _symtable import (USE, DEF_GLOBAL, DEF_LOCAL, DEF_PARAM, DEF_IMPORT, DEF_BOUND, OPT_IMPORT_STAR, OPT_EXEC, OPT_BARE_EXEC, - SCOPE_OFF, SCOPE_MASK, FREE, GLOBAL_IMPLICIT, GLOBAL_EXPLICIT) + SCOPE_OFF, SCOPE_MASK, FREE, GLOBAL_IMPLICIT, GLOBAL_EXPLICIT, CELL, LOCAL) import weakref @@ -137,7 +137,9 @@ def get_locals(self): if self.__locals is None: - self.__locals = self.__idents_matching(lambda x:x & DEF_BOUND) + locs = (LOCAL, CELL) + test = lambda x: ((x >> SCOPE_OFF) & SCOPE_MASK) in locs + self.__locals = self.__idents_matching(test) return self.__locals def get_globals(self): Modified: python/trunk/Lib/test/test_symtable.py ============================================================================== --- python/trunk/Lib/test/test_symtable.py (original) +++ python/trunk/Lib/test/test_symtable.py Sun Jun 28 21:27:55 2009 @@ -92,7 +92,7 @@ func = self.spam self.assertEqual(func.get_parameters(), ("a", "b", "kw", "var")) self.assertEqual(func.get_locals(), - ("a", "b", "bar", "internal", "kw", "var", "x")) + ("a", "b", "internal", "kw", "var", "x")) self.assertEqual(func.get_globals(), ("bar", "glob")) self.assertEqual(self.internal.get_frees(), ("x",)) From python-checkins at python.org Sun Jun 28 21:29:09 2009 From: python-checkins at python.org (benjamin.peterson) Date: Sun, 28 Jun 2009 19:29:09 -0000 Subject: [Python-checkins] r73628 - python/branches/py3k Message-ID: Author: benjamin.peterson Date: Sun Jun 28 21:29:09 2009 New Revision: 73628 Log: Blocked revisions 73627 via svnmerge ........ r73627 | benjamin.peterson | 2009-06-28 14:27:55 -0500 (Sun, 28 Jun 2009) | 1 line return locals and cells in get_locals() not bound globals, though ........ Modified: python/branches/py3k/ (props changed) From python-checkins at python.org Sun Jun 28 21:30:36 2009 From: python-checkins at python.org (benjamin.peterson) Date: Sun, 28 Jun 2009 19:30:36 -0000 Subject: [Python-checkins] r73629 - python/branches/py3k/Lib/symtable.py Message-ID: Author: benjamin.peterson Date: Sun Jun 28 21:30:36 2009 New Revision: 73629 Log: simplify this expression Modified: python/branches/py3k/Lib/symtable.py Modified: python/branches/py3k/Lib/symtable.py ============================================================================== --- python/branches/py3k/Lib/symtable.py (original) +++ python/branches/py3k/Lib/symtable.py Sun Jun 28 21:30:36 2009 @@ -3,7 +3,7 @@ import _symtable from _symtable import (USE, DEF_GLOBAL, DEF_LOCAL, DEF_PARAM, DEF_IMPORT, DEF_BOUND, OPT_IMPORT_STAR, SCOPE_OFF, SCOPE_MASK, FREE, - LOCAL, GLOBAL_IMPLICIT, GLOBAL_EXPLICIT) + LOCAL, GLOBAL_IMPLICIT, GLOBAL_EXPLICIT, CELL) import weakref @@ -137,8 +137,8 @@ def get_locals(self): if self.__locals is None: - test = lambda x: (((x >> SCOPE_OFF) & SCOPE_MASK) == LOCAL or - (x & DEF_BOUND and not x & DEF_GLOBAL)) + locs = (LOCAL, CELL) + test = lambda x: ((x >> SCOPE_OFF) & SCOPE_MASK) in locs self.__locals = self.__idents_matching(test) return self.__locals From python-checkins at python.org Sun Jun 28 22:27:40 2009 From: python-checkins at python.org (benjamin.peterson) Date: Sun, 28 Jun 2009 20:27:40 -0000 Subject: [Python-checkins] r73630 - sandbox/trunk/release/release.py Message-ID: Author: benjamin.peterson Date: Sun Jun 28 22:27:39 2009 New Revision: 73630 Log: eat my own dog food; convert this to Python 3 Modified: sandbox/trunk/release/release.py Modified: sandbox/trunk/release/release.py ============================================================================== --- sandbox/trunk/release/release.py (original) +++ sandbox/trunk/release/release.py Sun Jun 28 22:27:39 2009 @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 """An assistant for making Python releases. @@ -6,8 +6,6 @@ Additions by Barry Warsaw and Benjamin Peterson """ -from __future__ import with_statement - import sys import os import hashlib @@ -18,9 +16,9 @@ import tempfile import time -from contextlib import nested, contextmanager +from contextlib import contextmanager from string import Template -from urlparse import urlsplit, urlunsplit +from urllib.parse import urlsplit, urlunsplit COMMASPACE = ', ' SPACE = ' ' @@ -30,16 +28,16 @@ # Ideas stolen from Mailman's release script, Lib/tokens.py and welease def error(*msgs): - print >> sys.stderr, '**ERROR**' + print('**ERROR**', file=sys.stderr) for msg in msgs: - print >> sys.stderr, msg + print(msg, file=sys.stderr) sys.exit(1) def run_cmd(args, silent=False): cmd = SPACE.join(args) if not silent: - print 'Executing %s' % cmd + print('Executing %s' % cmd) try: if silent: code = subprocess.call(cmd, shell=True, stdout=PIPE) @@ -86,14 +84,14 @@ """ start_tag = comment_start + '--start constants--' + comment_end end_tag = comment_start + '--end constants--' + comment_end - with nested(open(fn), open(fn + '.new', 'w')) as (infile, outfile): + with open(fn) as infile, open(fn + '.new', 'w') as outfile: found_constants = False waiting_for_end = False for line in infile: if line[:-1] == start_tag: - print >> outfile, start_tag - print >> outfile, updated_constants - print >> outfile, end_tag + print(start_tag, file=outfile) + print(updated_constants, file=outfile) + print(end_tag, file=outfile) waiting_for_end = True found_constants = True elif line[:-1] == end_tag: @@ -108,7 +106,7 @@ def tweak_patchlevel(tag, done=False): - print 'Updating Include/patchlevel.h...', + print('Updating Include/patchlevel.h...', end=' ') template = Template("""\ #define PY_MAJOR_VERSION\t$major #define PY_MINOR_VERSION\t$minor @@ -131,41 +129,41 @@ substitutions['text'] += '+' new_constants = template.substitute(substitutions) constant_replace('Include/patchlevel.h', new_constants) - print 'done' + print('done') def bump(tag): - print 'Bumping version to %s' % tag + print('Bumping version to %s' % tag) wanted_file = 'Misc/RPM/python-%s.spec' % tag.basic_version - print 'Updating %s' % wanted_file, + print('Updating %s' % wanted_file, end=' ') if not os.path.exists(wanted_file): specs = os.listdir('Misc/RPM/') for file in specs: if file.startswith('python-'): break full_path = os.path.join('Misc/RPM/', file) - print '\nrenaming %s to %s' % (full_path, wanted_file) + print('\nrenaming %s to %s' % (full_path, wanted_file)) run_cmd(['svn', 'rename', '--force', full_path, wanted_file]) - print 'File was renamed; please commit' + print('File was renamed; please commit') run_cmd(['svn', 'commit']) new = '%define version ' + tag.text + \ '\n%define libver ' + tag.basic_version constant_replace(wanted_file, new, '#', '') - print 'done' + print('done') tweak_patchlevel(tag) - print 'Updating Lib/idlelib/idlever.py...', + print('Updating Lib/idlelib/idlever.py...', end=' ') with open('Lib/idlelib/idlever.py', 'w') as fp: new = 'IDLE_VERSION = "%s"\n' % tag.next_text fp.write(new) - print 'done' + print('done') - print 'Updating Lib/distutils/__init__.py...', + print('Updating Lib/distutils/__init__.py...', end=' ') new = '__version__ = "%s"' % tag.text constant_replace('Lib/distutils/__init__.py', new, '#', '') - print 'done' + print('done') extra_work = False other_files = ['README', 'Misc/NEWS'] @@ -179,15 +177,15 @@ 'LICENSE', 'Doc/license.rst', ] - print '\nManual editing time...' + print('\nManual editing time...') for fn in other_files: - print 'Edit %s' % fn + print('Edit %s' % fn) manual_edit(fn) - print 'Bumped revision' + print('Bumped revision') if extra_work: - print 'configure.in has change; re-run autotools !' - print 'Please commit and use --tag' + print('configure.in has change; re-run autotools !') + print('Please commit and use --tag') def manual_edit(fn): @@ -196,7 +194,7 @@ @contextmanager def changed_dir(new): - print 'chdir\'ing to %s' % new + print('chdir\'ing to %s' % new) old = os.getcwd() os.chdir(new) try: @@ -211,35 +209,35 @@ if not os.path.isdir('dist'): error('dist/ is not a directory') else: - print 'created dist directory' + print('created dist directory') def tarball(source): """Build tarballs for a directory.""" - print 'Making .tgz' + print('Making .tgz') base = os.path.basename(source) tgz = base + '.tgz' bz = base + '.tar.bz2' run_cmd(['tar cf - %s | gzip -9 > %s' % (source, tgz)]) - print "Making .tar.bz2" + print("Making .tar.bz2") run_cmd(['tar cf - %s | bzip2 -9 > %s' % (source, bz)]) - print 'Calculating sha1 sums' + print('Calculating sha1 sums') checksum_tgz = hashlib.sha1() with open(tgz, 'rb') as data: checksum_tgz.update(data.read()) checksum_bz2 = hashlib.sha1() with open(bz, 'rb') as data: checksum_bz2.update(data.read()) - print ' %s %8s %s' % ( - checksum_tgz.hexdigest(), int(os.path.getsize(tgz)), tgz) - print ' %s %8s %s' % ( - checksum_bz2.hexdigest(), int(os.path.getsize(bz)), bz) + print(' %s %8s %s' % ( + checksum_tgz.hexdigest(), int(os.path.getsize(tgz)), tgz)) + print(' %s %8s %s' % ( + checksum_bz2.hexdigest(), int(os.path.getsize(bz)), bz)) with open(tgz + '.sha1', 'w') as fp: fp.write(checksum_tgz.hexdigest()) with open(bz + '.sha1', 'w') as fp: fp.write(checksum_bz2.hexdigest()) - print 'Signing tarballs' + print('Signing tarballs') os.system('gpg -bas ' + tgz) os.system('gpg -bas ' + bz) @@ -248,13 +246,13 @@ make_dist() old_cur = os.getcwd() with changed_dir('dist'): - print 'Exporting tag:', tag.text + print('Exporting tag:', tag.text) archivename = 'Python-%s' % tag.text run_cmd(['svn', 'export', '-q', 'http://svn.python.org/projects/python/tags/r%s' % tag.nickname, archivename]) with changed_dir(archivename): - print 'Removing .hgignore and .bzrignore' + print('Removing .hgignore and .bzrignore') for name in ('.hgignore', '.bzrignore'): try: os.unlink(name) @@ -266,8 +264,8 @@ if os.path.exists('Python/opcode_targets.h'): # This file isn't in Python < 3.1 touchables.append('Python/opcode_targets.h') - print 'Touching:', COMMASPACE.join(name.rsplit('/', 1)[-1] - for name in touchables) + print('Touching:', COMMASPACE.join(name.rsplit('/', 1)[-1] + for name in touchables)) for name in touchables: os.utime(name, None) @@ -275,7 +273,7 @@ shutil.copytree(docdist, 'docs') with changed_dir(os.path.join(archivename, 'Doc')): - print 'Removing doc build artifacts' + print('Removing doc build artifacts') shutil.rmtree('build') shutil.rmtree('dist') shutil.rmtree('tools/docutils') @@ -290,13 +288,13 @@ os.mkdir('src') with changed_dir('src'): tarball(os.path.join("..", archivename)) - print '\n**Now extract the archives in dist/src and run the tests**' - print '**You may also want to run make install and re-test**' + print('\n**Now extract the archives in dist/src and run the tests**') + print('**You may also want to run make install and re-test**') def build_docs(): """Build and tarball the documentation""" - print "Building docs" + print("Building docs") with changed_dir('Doc'): run_cmd(['make', 'dist']) return os.path.abspath('dist') @@ -307,12 +305,12 @@ def scp(from_loc, to_loc): run_cmd(['scp %s %s' % (from_loc, to_loc)]) with changed_dir('dist'): - print "Uploading source tarballs" + print("Uploading source tarballs") scp('src', '/data/python-releases/%s' % tag.nickname) - print "Upload doc tarballs" + print("Upload doc tarballs") scp('docs', '/data/python-releases/doc/%s' % tag.nickname) - print "* Now change the permissions on the tarballs so they are " \ - "writable by the webmaster group. *" + print("* Now change the permissions on the tarballs so they are " \ + "writable by the webmaster group. *") class Tag(object): @@ -348,8 +346,8 @@ def branch(tag): if tag.patch > 0 or tag.level != "f": - print 'It doesn\'t look like you\'re making a final release.' - if raw_input('Are you sure you want to branch?') != "y": + print('It doesn\'t look like you\'re making a final release.') + if input('Are you sure you want to branch?') != "y": return url = urlsplit(get_current_location()) new_path = 'python/branches/release%s%s-maint' % (tag.major, tag.minor) @@ -389,7 +387,7 @@ """ def update_news(): - print "Updating Misc/NEWS" + print("Updating Misc/NEWS") with open('Misc/NEWS') as fp: lines = fp.readlines() for i, line in enumerate(lines): @@ -404,7 +402,7 @@ fp.writelines(lines[:start+1]) fp.write(insert) fp.writelines(lines[end-1:]) - print "Please fill in the the name of the next version." + print("Please fill in the the name of the next version.") manual_edit('Misc/NEWS') From python-checkins at python.org Sun Jun 28 22:34:43 2009 From: python-checkins at python.org (benjamin.peterson) Date: Sun, 28 Jun 2009 20:34:43 -0000 Subject: [Python-checkins] r73631 - sandbox/trunk/release/release.py Message-ID: Author: benjamin.peterson Date: Sun Jun 28 22:34:42 2009 New Revision: 73631 Log: switch back to md5 checksums Modified: sandbox/trunk/release/release.py Modified: sandbox/trunk/release/release.py ============================================================================== --- sandbox/trunk/release/release.py (original) +++ sandbox/trunk/release/release.py Sun Jun 28 22:34:42 2009 @@ -221,20 +221,20 @@ print("Making .tar.bz2") run_cmd(['tar cf - %s | bzip2 -9 > %s' % (source, bz)]) - print('Calculating sha1 sums') - checksum_tgz = hashlib.sha1() + print('Calculating md5 sums') + checksum_tgz = hashlib.md5() with open(tgz, 'rb') as data: checksum_tgz.update(data.read()) - checksum_bz2 = hashlib.sha1() + checksum_bz2 = hashlib.md5() with open(bz, 'rb') as data: checksum_bz2.update(data.read()) print(' %s %8s %s' % ( checksum_tgz.hexdigest(), int(os.path.getsize(tgz)), tgz)) print(' %s %8s %s' % ( checksum_bz2.hexdigest(), int(os.path.getsize(bz)), bz)) - with open(tgz + '.sha1', 'w') as fp: + with open(tgz + '.md5', 'w') as fp: fp.write(checksum_tgz.hexdigest()) - with open(bz + '.sha1', 'w') as fp: + with open(bz + '.md5', 'w') as fp: fp.write(checksum_bz2.hexdigest()) print('Signing tarballs') From python-checkins at python.org Sun Jun 28 22:36:55 2009 From: python-checkins at python.org (mark.dickinson) Date: Sun, 28 Jun 2009 20:36:55 -0000 Subject: [Python-checkins] r73632 - python/branches/py3k/Doc/library/decimal.rst Message-ID: Author: mark.dickinson Date: Sun Jun 28 22:36:54 2009 New Revision: 73632 Log: Corrections to decimal flying circus: round returns a Decimal; float should have a short repr. Modified: python/branches/py3k/Doc/library/decimal.rst Modified: python/branches/py3k/Doc/library/decimal.rst ============================================================================== --- python/branches/py3k/Doc/library/decimal.rst (original) +++ python/branches/py3k/Doc/library/decimal.rst Sun Jun 28 22:36:54 2009 @@ -187,9 +187,9 @@ >>> str(a) '1.34' >>> float(a) - 1.3400000000000001 - >>> round(a, 1) # round() first converts to binary floating point - 1.3 + 1.34 + >>> round(a, 1) + Decimal('1.3') >>> int(a) 1 >>> a * 5 From python-checkins at python.org Sun Jun 28 22:38:24 2009 From: python-checkins at python.org (mark.dickinson) Date: Sun, 28 Jun 2009 20:38:24 -0000 Subject: [Python-checkins] r73633 - in python/branches/release31-maint: Doc/library/decimal.rst Message-ID: Author: mark.dickinson Date: Sun Jun 28 22:38:24 2009 New Revision: 73633 Log: Merged revisions 73632 via svnmerge from svn+ssh://pythondev at www.python.org/python/branches/py3k ........ r73632 | mark.dickinson | 2009-06-28 21:36:54 +0100 (Sun, 28 Jun 2009) | 3 lines Corrections to decimal flying circus: round returns a Decimal; float should have a short repr. ........ Modified: python/branches/release31-maint/ (props changed) python/branches/release31-maint/Doc/library/decimal.rst Modified: python/branches/release31-maint/Doc/library/decimal.rst ============================================================================== --- python/branches/release31-maint/Doc/library/decimal.rst (original) +++ python/branches/release31-maint/Doc/library/decimal.rst Sun Jun 28 22:38:24 2009 @@ -187,9 +187,9 @@ >>> str(a) '1.34' >>> float(a) - 1.3400000000000001 - >>> round(a, 1) # round() first converts to binary floating point - 1.3 + 1.34 + >>> round(a, 1) + Decimal('1.3') >>> int(a) 1 >>> a * 5 From python-checkins at python.org Sun Jun 28 22:40:04 2009 From: python-checkins at python.org (mark.dickinson) Date: Sun, 28 Jun 2009 20:40:04 -0000 Subject: [Python-checkins] r73634 - in python/branches/release30-maint: Doc/library/decimal.rst Message-ID: Author: mark.dickinson Date: Sun Jun 28 22:40:04 2009 New Revision: 73634 Log: Merged revisions 73632 via svnmerge from svn+ssh://pythondev at svn.python.org/python/branches/py3k ........ r73632 | mark.dickinson | 2009-06-28 21:36:54 +0100 (Sun, 28 Jun 2009) | 3 lines Corrections to decimal flying circus: round returns a Decimal; float should have a short repr. ........ Modified: python/branches/release30-maint/ (props changed) python/branches/release30-maint/Doc/library/decimal.rst Modified: python/branches/release30-maint/Doc/library/decimal.rst ============================================================================== --- python/branches/release30-maint/Doc/library/decimal.rst (original) +++ python/branches/release30-maint/Doc/library/decimal.rst Sun Jun 28 22:40:04 2009 @@ -189,8 +189,8 @@ '1.34' >>> float(a) 1.3400000000000001 - >>> round(a, 1) # round() first converts to binary floating point - 1.3 + >>> round(a, 1) + Decimal('1.3') >>> int(a) 1 >>> a * 5 From buildbot at python.org Sun Jun 28 22:49:18 2009 From: buildbot at python.org (buildbot at python.org) Date: Sun, 28 Jun 2009 20:49:18 +0000 Subject: [Python-checkins] buildbot failure in x86 osx.5 3.x Message-ID: The Buildbot has detected a new failure of x86 osx.5 3.x. Full details are available at: http://www.python.org/dev/buildbot/all/x86%20osx.5%203.x/builds/1085 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: heller-x86-osx5 Build Reason: Build Source Stamp: [branch branches/py3k] HEAD Blamelist: benjamin.peterson BUILD FAILED: failed test Excerpt from the test logfile: make: *** [buildbottest] Abort trap sincerely, -The Buildbot From python-checkins at python.org Sun Jun 28 22:56:12 2009 From: python-checkins at python.org (raymond.hettinger) Date: Sun, 28 Jun 2009 20:56:12 -0000 Subject: [Python-checkins] r73635 - python/branches/py3k/Doc/whatsnew/3.2.rst Message-ID: Author: raymond.hettinger Date: Sun Jun 28 22:56:11 2009 New Revision: 73635 Log: Whatsnew begins afresh Added: python/branches/py3k/Doc/whatsnew/3.2.rst (contents, props changed) Added: python/branches/py3k/Doc/whatsnew/3.2.rst ============================================================================== --- (empty file) +++ python/branches/py3k/Doc/whatsnew/3.2.rst Sun Jun 28 22:56:11 2009 @@ -0,0 +1,99 @@ +**************************** + What's New In Python 3.1 +**************************** + +:Author: Raymond Hettinger +:Release: |release| +:Date: |today| + +.. $Id$ + Rules for maintenance: + + * Anyone can add text to this document. Do not spend very much time + on the wording of your changes, because your text will probably + get rewritten to some degree. + + * The maintainer will go through Misc/NEWS periodically and add + changes; it's therefore more important to add your changes to + Misc/NEWS than to this file. + + * This is not a complete list of every single change; completeness + is the purpose of Misc/NEWS. Some changes I consider too small + or esoteric to include. If such a change is added to the text, + I'll just remove it. (This is another reason you shouldn't spend + too much time on writing your addition.) + + * If you want to draw your new text to the attention of the + maintainer, add 'XXX' to the beginning of the paragraph or + section. + + * It's OK to just add a fragmentary note about a change. For + example: "XXX Describe the transmogrify() function added to the + socket module." The maintainer will research the change and + write the necessary text. + + * You can comment out your additions if you like, but it's not + necessary (especially when a final release is some months away). + + * Credit the author of a patch or bugfix. Just the name is + sufficient; the e-mail address isn't necessary. + + * It's helpful to add the bug/patch number as a comment: + + % Patch 12345 + XXX Describe the transmogrify() function added to the socket + module. + (Contributed by P.Y. Developer.) + + This saves the maintainer the effort of going through the SVN log + when researching a change. + +This article explains the new features in Python 3.2, compared to 3.1. + + +PEP XXX: Stub +============= + + +Other Language Changes +====================== + +Some smaller changes made to the core Python language are: + +* Stub + + +New, Improved, and Deprecated Modules +===================================== + +* Stub + + +Optimizations +============= + +Major performance enhancements have been added: + +* Stub + +IDLE +==== + +* Stub + + +Build and C API Changes +======================= + +Changes to Python's build process and to the C API include: + +* Stub + + +Porting to Python 3.1 +===================== + +This section lists previously described changes and other bugfixes +that may require changes to your code: + +* Stub From python-checkins at python.org Sun Jun 28 22:59:43 2009 From: python-checkins at python.org (mark.dickinson) Date: Sun, 28 Jun 2009 20:59:43 -0000 Subject: [Python-checkins] r73636 - in python/branches/py3k/Doc: library/math.rst library/sqlite3.rst library/turtle.rst tutorial/inputoutput.rst tutorial/introduction.rst tutorial/stdlib2.rst Message-ID: Author: mark.dickinson Date: Sun Jun 28 22:59:42 2009 New Revision: 73636 Log: Issue #6354: More fixes for code examples involving the repr of a float. Modified: python/branches/py3k/Doc/library/math.rst python/branches/py3k/Doc/library/sqlite3.rst python/branches/py3k/Doc/library/turtle.rst python/branches/py3k/Doc/tutorial/inputoutput.rst python/branches/py3k/Doc/tutorial/introduction.rst python/branches/py3k/Doc/tutorial/stdlib2.rst Modified: python/branches/py3k/Doc/library/math.rst ============================================================================== --- python/branches/py3k/Doc/library/math.rst (original) +++ python/branches/py3k/Doc/library/math.rst Sun Jun 28 22:59:42 2009 @@ -82,7 +82,7 @@ loss of precision by tracking multiple intermediate partial sums:: >>> sum([.1, .1, .1, .1, .1, .1, .1, .1, .1, .1]) - 0.99999999999999989 + 0.9999999999999999 >>> fsum([.1, .1, .1, .1, .1, .1, .1, .1, .1, .1]) 1.0 Modified: python/branches/py3k/Doc/library/sqlite3.rst ============================================================================== --- python/branches/py3k/Doc/library/sqlite3.rst (original) +++ python/branches/py3k/Doc/library/sqlite3.rst Sun Jun 28 22:59:42 2009 @@ -81,7 +81,7 @@ >>> for row in c: ... print(row) ... - (u'2006-01-05', u'BUY', u'RHAT', 100, 35.140000000000001) + (u'2006-01-05', u'BUY', u'RHAT', 100, 35.14) (u'2006-03-28', u'BUY', u'IBM', 1000, 45.0) (u'2006-04-06', u'SELL', u'IBM', 500, 53.0) (u'2006-04-05', u'BUY', u'MSOFT', 1000, 72.0) @@ -591,7 +591,7 @@ >>> type(r) >>> r - (u'2006-01-05', u'BUY', u'RHAT', 100.0, 35.140000000000001) + (u'2006-01-05', u'BUY', u'RHAT', 100.0, 35.14) >>> len(r) 5 >>> r[2] Modified: python/branches/py3k/Doc/library/turtle.rst ============================================================================== --- python/branches/py3k/Doc/library/turtle.rst (original) +++ python/branches/py3k/Doc/library/turtle.rst Sun Jun 28 22:59:42 2009 @@ -881,7 +881,7 @@ >>> tup = (0.2, 0.8, 0.55) >>> turtle.pencolor(tup) >>> turtle.pencolor() - (0.20000000000000001, 0.80000000000000004, 0.5490196078431373) + (0.2, 0.8, 0.5490196078431373) >>> colormode(255) >>> turtle.pencolor() (51, 204, 140) Modified: python/branches/py3k/Doc/tutorial/inputoutput.rst ============================================================================== --- python/branches/py3k/Doc/tutorial/inputoutput.rst (original) +++ python/branches/py3k/Doc/tutorial/inputoutput.rst Sun Jun 28 22:59:42 2009 @@ -52,10 +52,10 @@ 'Hello, world.' >>> repr(s) "'Hello, world.'" - >>> str(0.1) - '0.1' - >>> repr(0.1) - '0.10000000000000001' + >>> str(1.0/7.0) + '0.142857142857' + >>> repr(1.0/7.0) + '0.14285714285714285' >>> x = 10 * 3.25 >>> y = 200 * 200 >>> s = 'The value of x is ' + repr(x) + ', and y is ' + repr(y) + '...' Modified: python/branches/py3k/Doc/tutorial/introduction.rst ============================================================================== --- python/branches/py3k/Doc/tutorial/introduction.rst (original) +++ python/branches/py3k/Doc/tutorial/introduction.rst Sun Jun 28 22:59:42 2009 @@ -56,7 +56,7 @@ >>> (50-5*6)/4 5.0 >>> 8/5 # Fractions aren't lost when dividing integers - 1.6000000000000001 + 1.6 Note: You might not see exactly the same result; floating point results can differ from one machine to another. We will say more later about controlling Modified: python/branches/py3k/Doc/tutorial/stdlib2.rst ============================================================================== --- python/branches/py3k/Doc/tutorial/stdlib2.rst (original) +++ python/branches/py3k/Doc/tutorial/stdlib2.rst Sun Jun 28 22:59:42 2009 @@ -359,10 +359,10 @@ becomes significant if the results are rounded to the nearest cent:: >>> from decimal import * - >>> Decimal('0.70') * Decimal('1.05') - Decimal("0.7350") - >>> .70 * 1.05 - 0.73499999999999999 + >>> round(Decimal('0.70') * Decimal('1.05'), 2) + Decimal('0.74') + >>> round(.70 * 1.05, 2) + 0.73 The :class:`Decimal` result keeps a trailing zero, automatically inferring four place significance from multiplicands with two place significance. Decimal From buildbot at python.org Sun Jun 28 22:59:54 2009 From: buildbot at python.org (buildbot at python.org) Date: Sun, 28 Jun 2009 20:59:54 +0000 Subject: [Python-checkins] buildbot failure in amd64 gentoo 3.x Message-ID: The Buildbot has detected a new failure of amd64 gentoo 3.x. Full details are available at: http://www.python.org/dev/buildbot/all/amd64%20gentoo%203.x/builds/864 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: norwitz-amd64 Build Reason: Build Source Stamp: [branch branches/py3k] HEAD Blamelist: benjamin.peterson BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_mailbox make: *** [buildbottest] Error 1 sincerely, -The Buildbot From python-checkins at python.org Sun Jun 28 23:00:42 2009 From: python-checkins at python.org (mark.dickinson) Date: Sun, 28 Jun 2009 21:00:42 -0000 Subject: [Python-checkins] r73637 - in python/branches/release31-maint: Doc/library/math.rst Doc/library/sqlite3.rst Doc/library/turtle.rst Doc/tutorial/inputoutput.rst Doc/tutorial/introduction.rst Doc/tutorial/stdlib2.rst Message-ID: Author: mark.dickinson Date: Sun Jun 28 23:00:42 2009 New Revision: 73637 Log: Merged revisions 73636 via svnmerge from svn+ssh://pythondev at www.python.org/python/branches/py3k ........ r73636 | mark.dickinson | 2009-06-28 21:59:42 +0100 (Sun, 28 Jun 2009) | 2 lines Issue #6354: More fixes for code examples involving the repr of a float. ........ Modified: python/branches/release31-maint/ (props changed) python/branches/release31-maint/Doc/library/math.rst python/branches/release31-maint/Doc/library/sqlite3.rst python/branches/release31-maint/Doc/library/turtle.rst python/branches/release31-maint/Doc/tutorial/inputoutput.rst python/branches/release31-maint/Doc/tutorial/introduction.rst python/branches/release31-maint/Doc/tutorial/stdlib2.rst Modified: python/branches/release31-maint/Doc/library/math.rst ============================================================================== --- python/branches/release31-maint/Doc/library/math.rst (original) +++ python/branches/release31-maint/Doc/library/math.rst Sun Jun 28 23:00:42 2009 @@ -82,7 +82,7 @@ loss of precision by tracking multiple intermediate partial sums:: >>> sum([.1, .1, .1, .1, .1, .1, .1, .1, .1, .1]) - 0.99999999999999989 + 0.9999999999999999 >>> fsum([.1, .1, .1, .1, .1, .1, .1, .1, .1, .1]) 1.0 Modified: python/branches/release31-maint/Doc/library/sqlite3.rst ============================================================================== --- python/branches/release31-maint/Doc/library/sqlite3.rst (original) +++ python/branches/release31-maint/Doc/library/sqlite3.rst Sun Jun 28 23:00:42 2009 @@ -81,7 +81,7 @@ >>> for row in c: ... print(row) ... - (u'2006-01-05', u'BUY', u'RHAT', 100, 35.140000000000001) + (u'2006-01-05', u'BUY', u'RHAT', 100, 35.14) (u'2006-03-28', u'BUY', u'IBM', 1000, 45.0) (u'2006-04-06', u'SELL', u'IBM', 500, 53.0) (u'2006-04-05', u'BUY', u'MSOFT', 1000, 72.0) @@ -591,7 +591,7 @@ >>> type(r) >>> r - (u'2006-01-05', u'BUY', u'RHAT', 100.0, 35.140000000000001) + (u'2006-01-05', u'BUY', u'RHAT', 100.0, 35.14) >>> len(r) 5 >>> r[2] Modified: python/branches/release31-maint/Doc/library/turtle.rst ============================================================================== --- python/branches/release31-maint/Doc/library/turtle.rst (original) +++ python/branches/release31-maint/Doc/library/turtle.rst Sun Jun 28 23:00:42 2009 @@ -881,7 +881,7 @@ >>> tup = (0.2, 0.8, 0.55) >>> turtle.pencolor(tup) >>> turtle.pencolor() - (0.20000000000000001, 0.80000000000000004, 0.5490196078431373) + (0.2, 0.8, 0.5490196078431373) >>> colormode(255) >>> turtle.pencolor() (51, 204, 140) Modified: python/branches/release31-maint/Doc/tutorial/inputoutput.rst ============================================================================== --- python/branches/release31-maint/Doc/tutorial/inputoutput.rst (original) +++ python/branches/release31-maint/Doc/tutorial/inputoutput.rst Sun Jun 28 23:00:42 2009 @@ -52,10 +52,10 @@ 'Hello, world.' >>> repr(s) "'Hello, world.'" - >>> str(0.1) - '0.1' - >>> repr(0.1) - '0.10000000000000001' + >>> str(1.0/7.0) + '0.142857142857' + >>> repr(1.0/7.0) + '0.14285714285714285' >>> x = 10 * 3.25 >>> y = 200 * 200 >>> s = 'The value of x is ' + repr(x) + ', and y is ' + repr(y) + '...' Modified: python/branches/release31-maint/Doc/tutorial/introduction.rst ============================================================================== --- python/branches/release31-maint/Doc/tutorial/introduction.rst (original) +++ python/branches/release31-maint/Doc/tutorial/introduction.rst Sun Jun 28 23:00:42 2009 @@ -56,7 +56,7 @@ >>> (50-5*6)/4 5.0 >>> 8/5 # Fractions aren't lost when dividing integers - 1.6000000000000001 + 1.6 Note: You might not see exactly the same result; floating point results can differ from one machine to another. We will say more later about controlling Modified: python/branches/release31-maint/Doc/tutorial/stdlib2.rst ============================================================================== --- python/branches/release31-maint/Doc/tutorial/stdlib2.rst (original) +++ python/branches/release31-maint/Doc/tutorial/stdlib2.rst Sun Jun 28 23:00:42 2009 @@ -359,10 +359,10 @@ becomes significant if the results are rounded to the nearest cent:: >>> from decimal import * - >>> Decimal('0.70') * Decimal('1.05') - Decimal("0.7350") - >>> .70 * 1.05 - 0.73499999999999999 + >>> round(Decimal('0.70') * Decimal('1.05'), 2) + Decimal('0.74') + >>> round(.70 * 1.05, 2) + 0.73 The :class:`Decimal` result keeps a trailing zero, automatically inferring four place significance from multiplicands with two place significance. Decimal From python-checkins at python.org Sun Jun 28 23:04:17 2009 From: python-checkins at python.org (kristjan.jonsson) Date: Sun, 28 Jun 2009 21:04:17 -0000 Subject: [Python-checkins] r73638 - in python/trunk: Doc/library/simplexmlrpcserver.rst Lib/BaseHTTPServer.py Lib/DocXMLRPCServer.py Lib/SimpleXMLRPCServer.py Lib/SocketServer.py Lib/test/test_xmlrpc.py Lib/xmlrpclib.py Message-ID: Author: kristjan.jonsson Date: Sun Jun 28 23:04:17 2009 New Revision: 73638 Log: http://bugs.python.org/issue6267 Cumulative patch to http and xmlrpc Modified: python/trunk/Doc/library/simplexmlrpcserver.rst python/trunk/Lib/BaseHTTPServer.py python/trunk/Lib/DocXMLRPCServer.py python/trunk/Lib/SimpleXMLRPCServer.py python/trunk/Lib/SocketServer.py python/trunk/Lib/test/test_xmlrpc.py python/trunk/Lib/xmlrpclib.py Modified: python/trunk/Doc/library/simplexmlrpcserver.rst ============================================================================== --- python/trunk/Doc/library/simplexmlrpcserver.rst (original) +++ python/trunk/Doc/library/simplexmlrpcserver.rst Sun Jun 28 23:04:17 2009 @@ -133,6 +133,15 @@ .. versionadded:: 2.5 +.. attribute:: SimpleXMLRPCRequestHandler.encode_threshold + + If this attribute is not ``None``, responses larger than this value + will be encoded using the *gzip* transfer encoding, if permitted by + the client. The default is ``1400`` which corresponds roughly + to a single TCP packet. + + .. versionadded:: 2.7 + .. _simplexmlrpcserver-example: SimpleXMLRPCServer Example Modified: python/trunk/Lib/BaseHTTPServer.py ============================================================================== --- python/trunk/Lib/BaseHTTPServer.py (original) +++ python/trunk/Lib/BaseHTTPServer.py Sun Jun 28 23:04:17 2009 @@ -309,18 +309,26 @@ commands such as GET and POST. """ - self.raw_requestline = self.rfile.readline() - if not self.raw_requestline: + try: + self.raw_requestline = self.rfile.readline() + if not self.raw_requestline: + self.close_connection = 1 + return + if not self.parse_request(): + # An error code has been sent, just exit + return + mname = 'do_' + self.command + if not hasattr(self, mname): + self.send_error(501, "Unsupported method (%r)" % self.command) + return + method = getattr(self, mname) + method() + self.wfile.flush() #actually send the response if not already done. + except socket.timeout, e: + #a read or a write timed out. Discard this connection + self.log_error("Request timed out: %r", e) self.close_connection = 1 return - if not self.parse_request(): # An error code has been sent, just exit - return - mname = 'do_' + self.command - if not hasattr(self, mname): - self.send_error(501, "Unsupported method (%r)" % self.command) - return - method = getattr(self, mname) - method() def handle(self): """Handle multiple requests if necessary.""" Modified: python/trunk/Lib/DocXMLRPCServer.py ============================================================================== --- python/trunk/Lib/DocXMLRPCServer.py (original) +++ python/trunk/Lib/DocXMLRPCServer.py Sun Jun 28 23:04:17 2009 @@ -240,10 +240,6 @@ self.end_headers() self.wfile.write(response) - # shut down the connection - self.wfile.flush() - self.connection.shutdown(1) - class DocXMLRPCServer( SimpleXMLRPCServer, XMLRPCDocGenerator): """XML-RPC and HTML documentation server. Modified: python/trunk/Lib/SimpleXMLRPCServer.py ============================================================================== --- python/trunk/Lib/SimpleXMLRPCServer.py (original) +++ python/trunk/Lib/SimpleXMLRPCServer.py Sun Jun 28 23:04:17 2009 @@ -106,6 +106,7 @@ import sys import os import traceback +import re try: import fcntl except ImportError: @@ -430,6 +431,31 @@ # paths not on this list will result in a 404 error. rpc_paths = ('/', '/RPC2') + #if not None, encode responses larger than this, if possible + encode_threshold = 1400 #a common MTU + + #Override form StreamRequestHandler: full buffering of output + #and no Nagle. + wbufsize = -1 + disable_nagle_algorithm = True + + # a re to match a gzip Accept-Encoding + aepattern = re.compile(r""" + \s* ([^\s;]+) \s* #content-coding + (;\s* q \s*=\s* ([0-9\.]+))? #q + """, re.VERBOSE | re.IGNORECASE) + + def accept_encodings(self): + r = {} + ae = self.headers.get("Accept-Encoding", "") + for e in ae.split(","): + match = self.aepattern.match(e) + if match: + v = match.group(3) + v = float(v) if v else 1.0 + r[match.group(1)] = v + return r + def is_rpc_path_valid(self): if self.rpc_paths: return self.path in self.rpc_paths @@ -463,6 +489,10 @@ size_remaining -= len(L[-1]) data = ''.join(L) + data = self.decode_request_content(data) + if data is None: + return #response has been sent + # In previous versions of SimpleXMLRPCServer, _dispatch # could be overridden in this class, instead of in # SimpleXMLRPCDispatcher. To maintain backwards compatibility, @@ -481,18 +511,36 @@ self.send_header("X-exception", str(e)) self.send_header("X-traceback", traceback.format_exc()) + self.send_header("Content-length", "0") self.end_headers() else: # got a valid XML RPC response self.send_response(200) self.send_header("Content-type", "text/xml") + if self.encode_threshold is not None: + if len(response) > self.encode_threshold: + q = self.accept_encodings().get("gzip", 0) + if q: + response = xmlrpclib.gzip_encode(response) + self.send_header("Content-Encoding", "gzip") self.send_header("Content-length", str(len(response))) self.end_headers() self.wfile.write(response) - # shut down the connection - self.wfile.flush() - self.connection.shutdown(1) + def decode_request_content(self, data): + #support gzip encoding of request + encoding = self.headers.get("content-encoding", "identity").lower() + if encoding == "identity": + return data + if encoding == "gzip": + try: + return xmlrpclib.gzip_decode(data) + except ValueError: + self.send_response(400, "error decoding gzip content") + else: + self.send_response(501, "encoding %r not supported" % encoding) + self.send_header("Content-length", "0") + self.end_headers() def report_404 (self): # Report a 404 error @@ -502,9 +550,6 @@ self.send_header("Content-length", str(len(response))) self.end_headers() self.wfile.write(response) - # shut down the connection - self.wfile.flush() - self.connection.shutdown(1) def log_request(self, code='-', size='-'): """Selectively log an accepted request.""" Modified: python/trunk/Lib/SocketServer.py ============================================================================== --- python/trunk/Lib/SocketServer.py (original) +++ python/trunk/Lib/SocketServer.py Sun Jun 28 23:04:17 2009 @@ -445,6 +445,7 @@ def close_request(self, request): """Called to clean up an individual request.""" + request.shutdown(socket.SHUT_WR) request.close() @@ -610,12 +611,11 @@ self.request = request self.client_address = client_address self.server = server + self.setup() try: - self.setup() self.handle() - self.finish() finally: - sys.exc_traceback = None # Help garbage collection + self.finish() def setup(self): pass @@ -649,12 +649,17 @@ rbufsize = -1 wbufsize = 0 + # A timeout to apply to the request socket, if not None. + timeout = None + # Disable nagle algoritm for this socket, if True. # Use only when wbufsize != 0, to avoid small packets. disable_nagle_algorithm = False def setup(self): self.connection = self.request + if self.timeout is not None: + self.connection.settimeout(self.timeout) if self.disable_nagle_algorithm: self.connection.setsockopt(socket.IPPROTO_TCP, socket.TCP_NODELAY, True) Modified: python/trunk/Lib/test/test_xmlrpc.py ============================================================================== --- python/trunk/Lib/test/test_xmlrpc.py (original) +++ python/trunk/Lib/test/test_xmlrpc.py Sun Jun 28 23:04:17 2009 @@ -273,7 +273,7 @@ # The evt is set twice. First when the server is ready to serve. # Second when the server has been shutdown. The user must clear # the event after it has been set the first time to catch the second set. -def http_server(evt, numrequests): +def http_server(evt, numrequests, requestHandler=None): class TestInstanceClass: def div(self, x, y): return x // y @@ -294,7 +294,9 @@ s.setblocking(True) return s, port - serv = MyXMLRPCServer(("localhost", 0), + if not requestHandler: + requestHandler = SimpleXMLRPCServer.SimpleXMLRPCRequestHandler + serv = MyXMLRPCServer(("localhost", 0), requestHandler, logRequests=False, bind_and_activate=False) try: serv.socket.settimeout(3) @@ -348,34 +350,36 @@ return False -# NOTE: The tests in SimpleServerTestCase will ignore failures caused by -# "temporarily unavailable" exceptions raised in SimpleXMLRPCServer. This -# condition occurs infrequently on some platforms, frequently on others, and -# is apparently caused by using SimpleXMLRPCServer with a non-blocking socket. -# If the server class is updated at some point in the future to handle this -# situation more gracefully, these tests should be modified appropriately. - -class SimpleServerTestCase(unittest.TestCase): +class BaseServerTestCase(unittest.TestCase): + requestHandler = None def setUp(self): # enable traceback reporting SimpleXMLRPCServer.SimpleXMLRPCServer._send_traceback_header = True self.evt = threading.Event() # start server thread to handle requests - serv_args = (self.evt, 1) + serv_args = (self.evt, 1, self.requestHandler) threading.Thread(target=http_server, args=serv_args).start() # wait for the server to be ready - self.evt.wait() + self.evt.wait(10) self.evt.clear() def tearDown(self): # wait on the server thread to terminate - self.evt.wait() + self.evt.wait(10) # disable traceback reporting SimpleXMLRPCServer.SimpleXMLRPCServer._send_traceback_header = False +# NOTE: The tests in SimpleServerTestCase will ignore failures caused by +# "temporarily unavailable" exceptions raised in SimpleXMLRPCServer. This +# condition occurs infrequently on some platforms, frequently on others, and +# is apparently caused by using SimpleXMLRPCServer with a non-blocking socket +# If the server class is updated at some point in the future to handle this +# situation more gracefully, these tests should be modified appropriately. + +class SimpleServerTestCase(BaseServerTestCase): def test_simple1(self): try: p = xmlrpclib.ServerProxy(URL) @@ -512,6 +516,110 @@ # This avoids waiting for the socket timeout. self.test_simple1() +#A test case that verifies that a server using the HTTP/1.1 keep-alive mechanism +#does indeed serve subsequent requests on the same connection +class KeepaliveServerTestCase(BaseServerTestCase): + #a request handler that supports keep-alive and logs requests into a + #class variable + class RequestHandler(SimpleXMLRPCServer.SimpleXMLRPCRequestHandler): + parentClass = SimpleXMLRPCServer.SimpleXMLRPCRequestHandler + protocol_version = 'HTTP/1.1' + myRequests = [] + def handle(self): + self.myRequests.append([]) + return self.parentClass.handle(self) + def handle_one_request(self): + result = self.parentClass.handle_one_request(self) + self.myRequests[-1].append(self.raw_requestline) + return result + + requestHandler = RequestHandler + def setUp(self): + #clear request log + self.RequestHandler.myRequests = [] + return BaseServerTestCase.setUp(self) + + def test_two(self): + p = xmlrpclib.ServerProxy(URL) + self.assertEqual(p.pow(6,8), 6**8) + self.assertEqual(p.pow(6,8), 6**8) + self.assertEqual(len(self.RequestHandler.myRequests), 1) + #we may or may not catch the final "append" with the empty line + self.assertTrue(len(self.RequestHandler.myRequests[-1]) >= 2) + +#A test case that verifies that gzip encoding works in both directions +#(for a request and the response) +class GzipServerTestCase(BaseServerTestCase): + #a request handler that supports keep-alive and logs requests into a + #class variable + class RequestHandler(SimpleXMLRPCServer.SimpleXMLRPCRequestHandler): + parentClass = SimpleXMLRPCServer.SimpleXMLRPCRequestHandler + protocol_version = 'HTTP/1.1' + + def do_POST(self): + #store content of last request in class + self.__class__.content_length = int(self.headers["content-length"]) + return self.parentClass.do_POST(self) + requestHandler = RequestHandler + + class Transport(xmlrpclib.Transport): + #custom transport, stores the response length for our perusal + fake_gzip = False + def parse_response(self, response): + self.response_length=int(response.getheader("content-length", 0)) + return xmlrpclib.Transport.parse_response(self, response) + + def send_content(self, connection, body): + if self.fake_gzip: + #add a lone gzip header to induce decode error remotely + connection.putheader("Content-Encoding", "gzip") + return xmlrpclib.Transport.send_content(self, connection, body) + + def test_gzip_request(self): + t = self.Transport() + t.encode_threshold = None + p = xmlrpclib.ServerProxy(URL, transport=t) + self.assertEqual(p.pow(6,8), 6**8) + a = self.RequestHandler.content_length + t.encode_threshold = 0 #turn on request encoding + self.assertEqual(p.pow(6,8), 6**8) + b = self.RequestHandler.content_length + self.assertTrue(a>b) + + def test_bad_gzip_request(self): + t = self.Transport() + t.encode_threshold = None + t.fake_gzip = True + p = xmlrpclib.ServerProxy(URL, transport=t) + cm = self.assertRaisesRegexp(xmlrpclib.ProtocolError, + re.compile(r"\b400\b")) + with cm: + p.pow(6, 8) + + def test_gsip_response(self): + t = self.Transport() + p = xmlrpclib.ServerProxy(URL, transport=t) + old = self.requestHandler.encode_threshold + self.requestHandler.encode_threshold = None #no encoding + self.assertEqual(p.pow(6,8), 6**8) + a = t.response_length + self.requestHandler.encode_threshold = 0 #always encode + self.assertEqual(p.pow(6,8), 6**8) + b = t.response_length + self.requestHandler.encode_threshold = old + self.assertTrue(a>b) + +#Test special attributes of the ServerProxy object +class ServerProxyTestCase(unittest.TestCase): + def test_close(self): + p = xmlrpclib.ServerProxy(URL) + self.assertEqual(p('close')(), None) + + def test_transport(self): + t = xmlrpclib.Transport() + p = xmlrpclib.ServerProxy(URL, transport=t) + self.assertEqual(p('transport'), t) + # This is a contrived way to make a failure occur on the server side # in order to test the _send_traceback_header flag on the server class FailingMessageClass(mimetools.Message): @@ -693,6 +801,9 @@ def makefile(self, x='r', y=-1): raise RuntimeError + def close(self): + pass + class FakeTransport(xmlrpclib.Transport): """A Transport instance that records instead of sending a request. @@ -703,7 +814,7 @@ def make_connection(self, host): conn = xmlrpclib.Transport.make_connection(self, host) - conn._conn.sock = self.fake_socket = FakeSocket() + conn.sock = self.fake_socket = FakeSocket() return conn class TransportSubclassTestCase(unittest.TestCase): @@ -763,6 +874,9 @@ xmlrpc_tests = [XMLRPCTestCase, HelperTestCase, DateTimeTestCase, BinaryTestCase, FaultTestCase, TransportSubclassTestCase] xmlrpc_tests.append(SimpleServerTestCase) + xmlrpc_tests.append(KeepaliveServerTestCase) + xmlrpc_tests.append(GzipServerTestCase) + xmlrpc_tests.append(ServerProxyTestCase) xmlrpc_tests.append(FailingServerTestCase) xmlrpc_tests.append(CGIHandlerTestCase) Modified: python/trunk/Lib/xmlrpclib.py ============================================================================== --- python/trunk/Lib/xmlrpclib.py (original) +++ python/trunk/Lib/xmlrpclib.py Sun Jun 28 23:04:17 2009 @@ -139,6 +139,10 @@ import re, string, time, operator from types import * +import gzip +import socket +import errno +import httplib # -------------------------------------------------------------------- # Internal stuff @@ -1129,6 +1133,72 @@ p.close() return u.close(), u.getmethodname() +## +# Encode a string using the gzip content encoding such as specified by the +# Content-Encoding: gzip +# in the HTTP header, as described in RFC 1952 +# +# @param data the unencoded data +# @return the encoded data + +def gzip_encode(data): + """data -> gzip encoded data + + Encode data using the gzip content encoding as described in RFC 1952 + """ + f = StringIO.StringIO() + gzf = gzip.GzipFile(mode="wb", fileobj=f, compresslevel=1) + gzf.write(data) + gzf.close() + encoded = f.getvalue() + f.close() + return encoded + +## +# Decode a string using the gzip content encoding such as specified by the +# Content-Encoding: gzip +# in the HTTP header, as described in RFC 1952 +# +# @param data The encoded data +# @return the unencoded data +# @raises ValueError if data is not correctly coded. + +def gzip_decode(data): + """gzip encoded data -> unencoded data + + Decode data using the gzip content encoding as described in RFC 1952 + """ + f = StringIO.StringIO(data) + gzf = gzip.GzipFile(mode="rb", fileobj=f) + try: + decoded = gzf.read() + except IOError: + raise ValueError("invalid data") + f.close() + gzf.close() + return decoded + +## +# Return a decoded file-like object for the gzip encoding +# as described in RFC 1952. +# +# @param response A stream supporting a read() method +# @return a file-like object that the decoded data can be read() from + +class GzipDecodedResponse(gzip.GzipFile): + """a file-like object to decode a response encoded with the gzip + method, as described in RFC 1952. + """ + def __init__(self, response): + #response doesn't support tell() and read(), required by + #GzipFile + self.stringio = StringIO.StringIO(response.read()) + gzip.GzipFile.__init__(self, mode="rb", fileobj=self.stringio) + + def close(self): + gzip.GzipFile.close(self) + self.stringio.close() + # -------------------------------------------------------------------- # request dispatcher @@ -1156,11 +1226,21 @@ # client identifier (may be overridden) user_agent = "xmlrpclib.py/%s (by www.pythonware.com)" % __version__ + #if true, we'll request gzip encoding + accept_gzip_encoding = True + + # if positive, encode request using gzip if it exceeds this threshold + # note that many server will get confused, so only use it if you know + # that they can decode such a request + encode_threshold = None #None = don't encode + def __init__(self, use_datetime=0): self._use_datetime = use_datetime - + self._connection = (None, None) + self._extra_headers = [] ## # Send a complete request, and parse the response. + # Retry request if a cached connection has disconnected. # # @param host Target host. # @param handler Target PRC handler. @@ -1169,29 +1249,59 @@ # @return Parsed response. def request(self, host, handler, request_body, verbose=0): + #retry request once if cached connection has gone cold + for i in (0, 1): + try: + return self.single_request(host, handler, request_body, verbose) + except (socket.error, httplib.HTTPException), e: + retry = (errno.ECONNRESET, + errno.ECONNABORTED, + httplib.BadStatusLine) #close after we sent request + if i or e[0] not in retry: + raise + + ## + # Send a complete request, and parse the response. + # + # @param host Target host. + # @param handler Target PRC handler. + # @param request_body XML-RPC request body. + # @param verbose Debugging flag. + # @return Parsed response. + + def single_request(self, host, handler, request_body, verbose=0): # issue XML-RPC request h = self.make_connection(host) if verbose: h.set_debuglevel(1) - self.send_request(h, handler, request_body) - self.send_host(h, host) - self.send_user_agent(h) - self.send_content(h, request_body) - - errcode, errmsg, headers = h.getreply(buffering=True) - - if errcode != 200: - raise ProtocolError( - host + handler, - errcode, errmsg, - headers - ) - - self.verbose = verbose - - return self.parse_response(h.getfile()) + try: + self.send_request(h, handler, request_body) + self.send_host(h, host) + self.send_user_agent(h) + self.send_content(h, request_body) + + response = h.getresponse(buffering=True) + if response.status == 200: + self.verbose = verbose + return self.parse_response(response) + except Fault: + raise + except Exception: + # All unexpected errors leave connection in + # a strange state, so we clear it. + self.close() + raise + + #discard any response data and raise exception + if (response.getheader("content-length", 0)): + response.read() + raise ProtocolError( + host + handler, + response.status, response.reason, + response.msg, + ) ## # Create parser. @@ -1240,10 +1350,25 @@ # @return A connection handle. def make_connection(self, host): + #return an existing connection if possible. This allows + #HTTP/1.1 keep-alive. + if self._connection and host == self._connection[0]: + return self._connection[1] + # create a HTTP connection object from a host descriptor - import httplib - host, extra_headers, x509 = self.get_host_info(host) - return httplib.HTTP(host) + chost, self._extra_headers, x509 = self.get_host_info(host) + #store the host argument along with the connection object + self._connection = host, httplib.HTTPConnection(chost) + return self._connection[1] + + ## + # Clear any cached connection object. + # Used in the event of socket errors. + # + def close(self): + if self._connection[1]: + self._connection[1].close() + self._connection = (None, None) ## # Send request header. @@ -1253,17 +1378,24 @@ # @param request_body XML-RPC body. def send_request(self, connection, handler, request_body): - connection.putrequest("POST", handler) + if (self.accept_gzip_encoding): + connection.putrequest("POST", handler, skip_accept_encoding=True) + connection.putheader("Accept-Encoding", "gzip") + else: + connection.putrequest("POST", handler) ## # Send host name. # # @param connection Connection handle. # @param host Host name. + # + # Note: This function doesn't actually add the "Host" + # header anymore, it is done as part of the connection.putrequest() in + # send_request() above. def send_host(self, connection, host): - host, extra_headers, x509 = self.get_host_info(host) - connection.putheader("Host", host) + extra_headers = self._extra_headers if extra_headers: if isinstance(extra_headers, DictType): extra_headers = extra_headers.items() @@ -1286,6 +1418,13 @@ def send_content(self, connection, request_body): connection.putheader("Content-Type", "text/xml") + + #optionally encode the request + if (self.encode_threshold is not None and + self.encode_threshold < len(request_body)): + connection.putheader("Content-Encoding", "gzip") + request_body = gzip_encode(request_body) + connection.putheader("Content-Length", str(len(request_body))) connection.endheaders(request_body) @@ -1295,20 +1434,25 @@ # @param file Stream. # @return Response tuple and target method. - def parse_response(self, file): - # read response from input file/socket, and parse it + def parse_response(self, response): + # read response data from httpresponse, and parse it + if response.getheader("Content-Encoding", "") == "gzip": + stream = GzipDecodedResponse(response) + else: + stream = response p, u = self.getparser() while 1: - response = file.read(1024) - if not response: + data = stream.read(1024) + if not data: break if self.verbose: - print "body:", repr(response) - p.feed(response) + print "body:", repr(data) + p.feed(data) - file.close() + if stream is not response: + stream.close() p.close() return u.close() @@ -1322,18 +1466,20 @@ # FIXME: mostly untested def make_connection(self, host): + if self._connection and host == self._connection[0]: + return self._connection[1] # create a HTTPS connection object from a host descriptor # host may be a string, or a (host, x509-dict) tuple - import httplib - host, extra_headers, x509 = self.get_host_info(host) try: - HTTPS = httplib.HTTPS + HTTPS = httplib.HTTPSConnection except AttributeError: raise NotImplementedError( "your version of httplib doesn't support HTTPS" ) else: - return HTTPS(host, None, **(x509 or {})) + chost, self._extra_headers, x509 = self.get_host_info(host) + self._connection = host, HTTPSConnection(chost, None, **(x509 or {})) + return self._connection[1] ## # Standard server proxy. This class establishes a virtual connection @@ -1398,6 +1544,9 @@ self.__verbose = verbose self.__allow_none = allow_none + def __close(self): + self.__transport.close() + def __request(self, methodname, params): # call a method on the remote server @@ -1431,6 +1580,16 @@ # note: to call a remote object with an non-standard name, use # result getattr(server, "strange-python-name")(args) + def __call__(self, attr): + """A workaround to get special attributes on the ServerProxy + without interfering with the magic __getattr__ + """ + if attr == "close": + return self.__close + elif attr == "transport": + return self.__transport + raise AttributeError("Attribute %r not found" % (attr,)) + # compatibility Server = ServerProxy From python-checkins at python.org Sun Jun 28 23:10:50 2009 From: python-checkins at python.org (tarek.ziade) Date: Sun, 28 Jun 2009 21:10:50 -0000 Subject: [Python-checkins] r73639 - in python/branches/py3k: Lib/distutils/command/upload.py Message-ID: Author: tarek.ziade Date: Sun Jun 28 23:10:49 2009 New Revision: 73639 Log: Merged revisions 73435 via svnmerge from svn+ssh://pythondev at svn.python.org/python/trunk ........ r73435 | tarek.ziade | 2009-06-16 01:04:29 +0200 (Tue, 16 Jun 2009) | 1 line code cleanup ........ Modified: python/branches/py3k/ (props changed) python/branches/py3k/Lib/distutils/command/upload.py Modified: python/branches/py3k/Lib/distutils/command/upload.py ============================================================================== --- python/branches/py3k/Lib/distutils/command/upload.py (original) +++ python/branches/py3k/Lib/distutils/command/upload.py Sun Jun 28 23:10:49 2009 @@ -1,11 +1,6 @@ """distutils.command.upload Implements the Distutils 'upload' subcommand (upload package to PyPI).""" - -from distutils.errors import * -from distutils.core import PyPIRCCommand -from distutils.spawn import spawn -from distutils import log import sys import os, io import socket @@ -14,12 +9,12 @@ import http.client as httpclient import base64 import urllib.parse +from hashlib import md5 -# this keeps compatibility for 2.3 and 2.4 -if sys.version < "2.5": - from md5 import md5 -else: - from hashlib import md5 +from distutils.errors import * +from distutils.core import PyPIRCCommand +from distutils.spawn import spawn +from distutils import log class upload(PyPIRCCommand): @@ -137,10 +132,10 @@ for key, value in data.items(): title = '\nContent-Disposition: form-data; name="%s"' % key # handle multiple entries for the same name - if type(value) != type([]): + if not isinstance(value, list): value = [value] for value in value: - if type(value) is tuple: + if isinstance(value, tuple): title += '; filename="%s"' % value[0] value = value[1] else: From python-checkins at python.org Sun Jun 28 23:19:18 2009 From: python-checkins at python.org (mark.dickinson) Date: Sun, 28 Jun 2009 21:19:18 -0000 Subject: [Python-checkins] r73640 - python/branches/py3k/Doc/tutorial/introduction.rst Message-ID: Author: mark.dickinson Date: Sun Jun 28 23:19:18 2009 New Revision: 73640 Log: Issue #6354 continued: reword confusing tutorial note on the (no-longer existing) difference between str(8/5) and repr(8/5). Modified: python/branches/py3k/Doc/tutorial/introduction.rst Modified: python/branches/py3k/Doc/tutorial/introduction.rst ============================================================================== --- python/branches/py3k/Doc/tutorial/introduction.rst (original) +++ python/branches/py3k/Doc/tutorial/introduction.rst Sun Jun 28 23:19:18 2009 @@ -60,16 +60,9 @@ Note: You might not see exactly the same result; floating point results can differ from one machine to another. We will say more later about controlling -the appearance of floating point output; what we see here is the most -informative display but not as easy to read as we would get with:: - - >>> print(8/5) - 1.6 - -For clarity in this tutorial we will show the simpler floating point output -unless we are specifically discussing output formatting, and explain later -why these two ways of displaying floating point data come to be different. -See :ref:`tut-fp-issues` for a full discussion. +the appearance of floating point output. See also :ref:`tut-fp-issues` for a +full discussion of some of the subtleties of floating point numbers and their +representations. To do integer division and get an integer result, discarding any fractional result, there is another operator, ``//``:: From python-checkins at python.org Sun Jun 28 23:20:22 2009 From: python-checkins at python.org (mark.dickinson) Date: Sun, 28 Jun 2009 21:20:22 -0000 Subject: [Python-checkins] r73641 - in python/branches/release31-maint: Doc/tutorial/introduction.rst Message-ID: Author: mark.dickinson Date: Sun Jun 28 23:20:21 2009 New Revision: 73641 Log: Merged revisions 73640 via svnmerge from svn+ssh://pythondev at www.python.org/python/branches/py3k ........ r73640 | mark.dickinson | 2009-06-28 22:19:18 +0100 (Sun, 28 Jun 2009) | 3 lines Issue #6354 continued: reword confusing tutorial note on the (no-longer existing) difference between str(8/5) and repr(8/5). ........ Modified: python/branches/release31-maint/ (props changed) python/branches/release31-maint/Doc/tutorial/introduction.rst Modified: python/branches/release31-maint/Doc/tutorial/introduction.rst ============================================================================== --- python/branches/release31-maint/Doc/tutorial/introduction.rst (original) +++ python/branches/release31-maint/Doc/tutorial/introduction.rst Sun Jun 28 23:20:21 2009 @@ -60,16 +60,9 @@ Note: You might not see exactly the same result; floating point results can differ from one machine to another. We will say more later about controlling -the appearance of floating point output; what we see here is the most -informative display but not as easy to read as we would get with:: - - >>> print(8/5) - 1.6 - -For clarity in this tutorial we will show the simpler floating point output -unless we are specifically discussing output formatting, and explain later -why these two ways of displaying floating point data come to be different. -See :ref:`tut-fp-issues` for a full discussion. +the appearance of floating point output. See also :ref:`tut-fp-issues` for a +full discussion of some of the subtleties of floating point numbers and their +representations. To do integer division and get an integer result, discarding any fractional result, there is another operator, ``//``:: From python-checkins at python.org Sun Jun 28 23:24:43 2009 From: python-checkins at python.org (mark.dickinson) Date: Sun, 28 Jun 2009 21:24:43 -0000 Subject: [Python-checkins] r73642 - python/branches/py3k/Doc/tutorial/stdlib2.rst Message-ID: Author: mark.dickinson Date: Sun Jun 28 23:24:42 2009 New Revision: 73642 Log: Fix incorrect quote type on Decimal examples Modified: python/branches/py3k/Doc/tutorial/stdlib2.rst Modified: python/branches/py3k/Doc/tutorial/stdlib2.rst ============================================================================== --- python/branches/py3k/Doc/tutorial/stdlib2.rst (original) +++ python/branches/py3k/Doc/tutorial/stdlib2.rst Sun Jun 28 23:24:42 2009 @@ -373,7 +373,7 @@ calculations and equality tests that are unsuitable for binary floating point:: >>> Decimal('1.00') % Decimal('.10') - Decimal("0.00") + Decimal('0.00') >>> 1.00 % 0.10 0.09999999999999995 @@ -386,6 +386,6 @@ >>> getcontext().prec = 36 >>> Decimal(1) / Decimal(7) - Decimal("0.142857142857142857142857142857142857") + Decimal('0.142857142857142857142857142857142857') From python-checkins at python.org Sun Jun 28 23:25:42 2009 From: python-checkins at python.org (mark.dickinson) Date: Sun, 28 Jun 2009 21:25:42 -0000 Subject: [Python-checkins] r73643 - in python/branches/release31-maint: Doc/tutorial/stdlib2.rst Message-ID: Author: mark.dickinson Date: Sun Jun 28 23:25:41 2009 New Revision: 73643 Log: Merged revisions 73642 via svnmerge from svn+ssh://pythondev at www.python.org/python/branches/py3k ........ r73642 | mark.dickinson | 2009-06-28 22:24:42 +0100 (Sun, 28 Jun 2009) | 1 line Fix incorrect quote type on Decimal examples ........ Modified: python/branches/release31-maint/ (props changed) python/branches/release31-maint/Doc/tutorial/stdlib2.rst Modified: python/branches/release31-maint/Doc/tutorial/stdlib2.rst ============================================================================== --- python/branches/release31-maint/Doc/tutorial/stdlib2.rst (original) +++ python/branches/release31-maint/Doc/tutorial/stdlib2.rst Sun Jun 28 23:25:41 2009 @@ -373,7 +373,7 @@ calculations and equality tests that are unsuitable for binary floating point:: >>> Decimal('1.00') % Decimal('.10') - Decimal("0.00") + Decimal('0.00') >>> 1.00 % 0.10 0.09999999999999995 @@ -386,6 +386,6 @@ >>> getcontext().prec = 36 >>> Decimal(1) / Decimal(7) - Decimal("0.142857142857142857142857142857142857") + Decimal('0.142857142857142857142857142857142857') From python-checkins at python.org Sun Jun 28 23:26:22 2009 From: python-checkins at python.org (mark.dickinson) Date: Sun, 28 Jun 2009 21:26:22 -0000 Subject: [Python-checkins] r73644 - in python/branches/release30-maint: Doc/tutorial/stdlib2.rst Message-ID: Author: mark.dickinson Date: Sun Jun 28 23:26:22 2009 New Revision: 73644 Log: Merged revisions 73642 via svnmerge from svn+ssh://pythondev at svn.python.org/python/branches/py3k ........ r73642 | mark.dickinson | 2009-06-28 22:24:42 +0100 (Sun, 28 Jun 2009) | 1 line Fix incorrect quote type on Decimal examples ........ Modified: python/branches/release30-maint/ (props changed) python/branches/release30-maint/Doc/tutorial/stdlib2.rst Modified: python/branches/release30-maint/Doc/tutorial/stdlib2.rst ============================================================================== --- python/branches/release30-maint/Doc/tutorial/stdlib2.rst (original) +++ python/branches/release30-maint/Doc/tutorial/stdlib2.rst Sun Jun 28 23:26:22 2009 @@ -373,7 +373,7 @@ calculations and equality tests that are unsuitable for binary floating point:: >>> Decimal('1.00') % Decimal('.10') - Decimal("0.00") + Decimal('0.00') >>> 1.00 % 0.10 0.09999999999999995 @@ -386,6 +386,6 @@ >>> getcontext().prec = 36 >>> Decimal(1) / Decimal(7) - Decimal("0.142857142857142857142857142857142857") + Decimal('0.142857142857142857142857142857142857') From python-checkins at python.org Sun Jun 28 23:26:27 2009 From: python-checkins at python.org (tarek.ziade) Date: Sun, 28 Jun 2009 21:26:27 -0000 Subject: [Python-checkins] r73645 - in python/branches/py3k: Lib/distutils/command/upload.py Lib/distutils/tests/test_upload.py Misc/NEWS Message-ID: Author: tarek.ziade Date: Sun Jun 28 23:26:27 2009 New Revision: 73645 Log: Merged revisions 73436 via svnmerge from svn+ssh://pythondev at svn.python.org/python/trunk ........ r73436 | tarek.ziade | 2009-06-16 01:30:13 +0200 (Tue, 16 Jun 2009) | 1 line Issue #6286: distutils upload command now uses urllib2 ........ Modified: python/branches/py3k/ (props changed) python/branches/py3k/Lib/distutils/command/upload.py python/branches/py3k/Lib/distutils/tests/test_upload.py python/branches/py3k/Misc/NEWS Modified: python/branches/py3k/Lib/distutils/command/upload.py ============================================================================== --- python/branches/py3k/Lib/distutils/command/upload.py (original) +++ python/branches/py3k/Lib/distutils/command/upload.py Sun Jun 28 23:26:27 2009 @@ -5,10 +5,9 @@ import os, io import socket import platform -import configparser -import http.client as httpclient +from urllib.request import urlopen, Request, HTTPError import base64 -import urllib.parse +from urllib.parse import urlparse from hashlib import md5 from distutils.errors import * @@ -61,6 +60,15 @@ self.upload_file(command, pyversion, filename) def upload_file(self, command, pyversion, filename): + # Makes sure the repository URL is compliant + schema, netloc, url, params, query, fragments = \ + urlparse(self.repository) + if params or query or fragments: + raise AssertionError("Incompatible url %s" % self.repository) + + if schema not in ('http', 'https'): + raise AssertionError("unsupported schema " + schema) + # Sign if requested if self.sign: gpg_args = ["gpg", "--detach-sign", "-a", filename] @@ -153,40 +161,30 @@ self.announce("Submitting %s to %s" % (filename, self.repository), log.INFO) # build the Request - # We can't use urllib since we need to send the Basic - # auth right with the first request - # TODO(jhylton): Can we fix urllib? - schema, netloc, url, params, query, fragments = \ - urllib.parse.urlparse(self.repository) - assert not params and not query and not fragments - if schema == 'http': - http = httpclient.HTTPConnection(netloc) - elif schema == 'https': - http = httpclient.HTTPSConnection(netloc) - else: - raise AssertionError("unsupported schema "+schema) - - data = '' - loglevel = log.INFO + headers = {'Content-type': + 'multipart/form-data; boundary=%s' % boundary, + 'Content-length': str(len(body)), + 'Authorization': auth} + + request = Request(self.repository, data=body, + headers=headers) + # send the data try: - http.connect() - http.putrequest("POST", url) - http.putheader('Content-type', - 'multipart/form-data; boundary=%s'%boundary) - http.putheader('Content-length', str(len(body))) - http.putheader('Authorization', auth) - http.endheaders() - http.send(body) + result = urlopen(request) + status = result.getcode() + reason = result.msg except socket.error as e: self.announce(str(e), log.ERROR) return + except HTTPError as e: + status = e.code + reason = e.msg - r = http.getresponse() - if r.status == 200: - self.announce('Server response (%s): %s' % (r.status, r.reason), + if status == 200: + self.announce('Server response (%s): %s' % (status, reason), log.INFO) else: - self.announce('Upload failed (%s): %s' % (r.status, r.reason), + self.announce('Upload failed (%s): %s' % (status, reason), log.ERROR) if self.show_response: - self.announce('-'*75, r.read(), '-'*75) + self.announce('-'*75, result.read(), '-'*75) Modified: python/branches/py3k/Lib/distutils/tests/test_upload.py ============================================================================== --- python/branches/py3k/Lib/distutils/tests/test_upload.py (original) +++ python/branches/py3k/Lib/distutils/tests/test_upload.py Sun Jun 28 23:26:27 2009 @@ -2,8 +2,8 @@ import sys import os import unittest -import http.client as httpclient +from distutils.command import upload as upload_mod from distutils.command.upload import upload from distutils.core import Distribution @@ -19,48 +19,37 @@ [server1] username:me """ -class Response(object): - def __init__(self, status=200, reason='OK'): - self.status = status - self.reason = reason -class FakeConnection(object): +class FakeOpen(object): - def __init__(self): - self.requests = [] - self.headers = [] - self.body = '' + def __init__(self, url): + self.url = url + if not isinstance(url, str): + self.req = url + else: + self.req = None + self.msg = 'OK' - def __call__(self, netloc): - return self + def getcode(self): + return 200 - def connect(self): - pass - endheaders = connect - - def putrequest(self, method, url): - self.requests.append((method, url)) - - def putheader(self, name, value): - self.headers.append((name, value)) - - def send(self, body): - self.body = body - - def getresponse(self): - return Response() class uploadTestCase(PyPIRCCommandTestCase): def setUp(self): super(uploadTestCase, self).setUp() - self.old_class = httpclient.HTTPConnection - self.conn = httpclient.HTTPConnection = FakeConnection() + self.old_open = upload_mod.urlopen + upload_mod.urlopen = self._urlopen + self.last_open = None def tearDown(self): - httpclient.HTTPConnection = self.old_class + upload_mod.urlopen = self.old_open super(uploadTestCase, self).tearDown() + def _urlopen(self, url): + self.last_open = FakeOpen(url) + return self.last_open + def test_finalize_options(self): # new format @@ -105,12 +94,13 @@ cmd.run() # what did we send ? - headers = dict(self.conn.headers) + headers = dict(self.last_open.req.headers) self.assertEquals(headers['Content-length'], '2087') self.assert_(headers['Content-type'].startswith('multipart/form-data')) - - self.assertEquals(self.conn.requests, [('POST', '/pypi')]) - self.assert_((b'xxx') in self.conn.body) + self.assertEquals(self.last_open.req.get_method(), 'POST') + self.assertEquals(self.last_open.req.get_full_url(), + 'http://pypi.python.org/pypi') + self.assert_(b'xxx' in self.last_open.req.data) def test_suite(): return unittest.makeSuite(uploadTestCase) Modified: python/branches/py3k/Misc/NEWS ============================================================================== --- python/branches/py3k/Misc/NEWS (original) +++ python/branches/py3k/Misc/NEWS Sun Jun 28 23:26:27 2009 @@ -839,6 +839,9 @@ Library ------- +- Issue #6286: Now Distutils upload command is based on urllib2 instead of + httplib, allowing the usage of http_proxy. + - Issue #6287: Added the license field in Distutils documentation. - Issue #6263: Fixed syntax error in distutils.cygwincompiler. From python-checkins at python.org Sun Jun 28 23:29:24 2009 From: python-checkins at python.org (tarek.ziade) Date: Sun, 28 Jun 2009 21:29:24 -0000 Subject: [Python-checkins] r73646 - in python/branches/py3k: Lib/distutils/ccompiler.py Lib/distutils/tests/test_ccompiler.py Message-ID: Author: tarek.ziade Date: Sun Jun 28 23:29:24 2009 New Revision: 73646 Log: Merged revisions 73445 via svnmerge from svn+ssh://pythondev at svn.python.org/python/trunk ........ r73445 | tarek.ziade | 2009-06-16 10:31:01 +0200 (Tue, 16 Jun 2009) | 1 line starting distutils.ccompiler test coverage and cleanup ........ Added: python/branches/py3k/Lib/distutils/tests/test_ccompiler.py - copied unchanged from r73445, /python/trunk/Lib/distutils/tests/test_ccompiler.py Modified: python/branches/py3k/ (props changed) python/branches/py3k/Lib/distutils/ccompiler.py Modified: python/branches/py3k/Lib/distutils/ccompiler.py ============================================================================== --- python/branches/py3k/Lib/distutils/ccompiler.py (original) +++ python/branches/py3k/Lib/distutils/ccompiler.py Sun Jun 28 23:29:24 2009 @@ -1151,12 +1151,14 @@ return pp_opts -def gen_lib_options (compiler, library_dirs, runtime_library_dirs, libraries): +def gen_lib_options(compiler, library_dirs, runtime_library_dirs, libraries): """Generate linker options for searching library directories and - linking with specific libraries. 'libraries' and 'library_dirs' are, - respectively, lists of library names (not filenames!) and search - directories. Returns a list of command-line options suitable for use - with some compiler (depending on the two format strings passed in). + linking with specific libraries. + + 'libraries' and 'library_dirs' are, respectively, lists of library names + (not filenames!) and search directories. Returns a list of command-line + options suitable for use with some compiler (depending on the two format + strings passed in). """ lib_opts = [] @@ -1166,7 +1168,7 @@ for dir in runtime_library_dirs: opt = compiler.runtime_library_dir_option(dir) if isinstance(opt, list): - lib_opts = lib_opts + opt + lib_opts.extend(opt) else: lib_opts.append(opt) @@ -1177,14 +1179,14 @@ # pretty nasty way to arrange your C code. for lib in libraries: - (lib_dir, lib_name) = os.path.split(lib) - if lib_dir: + lib_dir, lib_name = os.path.split(lib) + if lib_dir != '': lib_file = compiler.find_library_file([lib_dir], lib_name) - if lib_file: + if lib_file is not None: lib_opts.append(lib_file) else: compiler.warn("no library file corresponding to " "'%s' found (skipping)" % lib) else: - lib_opts.append(compiler.library_option (lib)) + lib_opts.append(compiler.library_option(lib)) return lib_opts From python-checkins at python.org Sun Jun 28 23:30:53 2009 From: python-checkins at python.org (tarek.ziade) Date: Sun, 28 Jun 2009 21:30:53 -0000 Subject: [Python-checkins] r73647 - in python/branches/py3k: Lib/distutils/tests/test_unixccompiler.py Lib/distutils/unixccompiler.py Misc/NEWS Message-ID: Author: tarek.ziade Date: Sun Jun 28 23:30:52 2009 New Revision: 73647 Log: Merged revisions 73490 via svnmerge from svn+ssh://pythondev at svn.python.org/python/trunk ........ r73490 | tarek.ziade | 2009-06-20 15:57:20 +0200 (Sat, 20 Jun 2009) | 1 line Fixed #6164 AIX specific linker argument in Distutils unixcompiler ........ Modified: python/branches/py3k/ (props changed) python/branches/py3k/Lib/distutils/tests/test_unixccompiler.py python/branches/py3k/Lib/distutils/unixccompiler.py python/branches/py3k/Misc/NEWS Modified: python/branches/py3k/Lib/distutils/tests/test_unixccompiler.py ============================================================================== --- python/branches/py3k/Lib/distutils/tests/test_unixccompiler.py (original) +++ python/branches/py3k/Lib/distutils/tests/test_unixccompiler.py Sun Jun 28 23:30:52 2009 @@ -86,6 +86,14 @@ sysconfig.get_config_var = gcv self.assertEqual(self.cc.rpath_foo(), '-R/foo') + # AIX C/C++ linker + sys.platform = 'aix' + def gcv(v): + return 'xxx' + sysconfig.get_config_var = gcv + self.assertEqual(self.cc.rpath_foo(), '-blibpath:/foo') + + def test_suite(): return unittest.makeSuite(UnixCCompilerTestCase) Modified: python/branches/py3k/Lib/distutils/unixccompiler.py ============================================================================== --- python/branches/py3k/Lib/distutils/unixccompiler.py (original) +++ python/branches/py3k/Lib/distutils/unixccompiler.py Sun Jun 28 23:30:52 2009 @@ -286,23 +286,24 @@ return "+s -L" + dir elif sys.platform[:7] == "irix646" or sys.platform[:6] == "osf1V5": return ["-rpath", dir] - else: - if compiler[:3] == "gcc" or compiler[:3] == "g++": - # gcc on non-GNU systems does not need -Wl, but can - # use it anyway. Since distutils has always passed in - # -Wl whenever gcc was used in the past it is probably - # safest to keep doing so. - if sysconfig.get_config_var("GNULD") == "yes": - # GNU ld needs an extra option to get a RUNPATH - # instead of just an RPATH. - return "-Wl,--enable-new-dtags,-R" + dir - else: - return "-Wl,-R" + dir + elif compiler[:3] == "gcc" or compiler[:3] == "g++": + # gcc on non-GNU systems does not need -Wl, but can + # use it anyway. Since distutils has always passed in + # -Wl whenever gcc was used in the past it is probably + # safest to keep doing so. + if sysconfig.get_config_var("GNULD") == "yes": + # GNU ld needs an extra option to get a RUNPATH + # instead of just an RPATH. + return "-Wl,--enable-new-dtags,-R" + dir else: - # No idea how --enable-new-dtags would be passed on to - # ld if this system was using GNU ld. Don't know if a - # system like this even exists. - return "-R" + dir + return "-Wl,-R" + dir + elif sys.platform[:3] == "aix": + return "-blibpath:" + dir + else: + # No idea how --enable-new-dtags would be passed on to + # ld if this system was using GNU ld. Don't know if a + # system like this even exists. + return "-R" + dir def library_option(self, lib): return "-l" + lib Modified: python/branches/py3k/Misc/NEWS ============================================================================== --- python/branches/py3k/Misc/NEWS (original) +++ python/branches/py3k/Misc/NEWS Sun Jun 28 23:30:52 2009 @@ -839,6 +839,9 @@ Library ------- +- Issue #6164: Added an AIX specific linker argument in Distutils + unixcompiler. Original patch by Sridhar Ratnakumar. + - Issue #6286: Now Distutils upload command is based on urllib2 instead of httplib, allowing the usage of http_proxy. From python-checkins at python.org Sun Jun 28 23:34:23 2009 From: python-checkins at python.org (kristjan.jonsson) Date: Sun, 28 Jun 2009 21:34:23 -0000 Subject: [Python-checkins] r73648 - python/branches/py3k/Lib/socketserver.py Message-ID: Author: kristjan.jonsson Date: Sun Jun 28 23:34:22 2009 New Revision: 73648 Log: http://bugs.python.org/issue6192 Mergin revisions 73272 and 73546 to py3k Modified: python/branches/py3k/Lib/socketserver.py Modified: python/branches/py3k/Lib/socketserver.py ============================================================================== --- python/branches/py3k/Lib/socketserver.py (original) +++ python/branches/py3k/Lib/socketserver.py Sun Jun 28 23:34:22 2009 @@ -646,8 +646,15 @@ rbufsize = -1 wbufsize = 0 + # Disable nagle algoritm for this socket, if True. + # Use only when wbufsize != 0, to avoid small packets. + disable_nagle_algorithm = False + def setup(self): self.connection = self.request + if self.disable_nagle_algorithm: + self.connection.setsockopt(socket.IPPROTO_TCP, + socket.TCP_NODELAY, True) self.rfile = self.connection.makefile('rb', self.rbufsize) self.wfile = self.connection.makefile('wb', self.wbufsize) From python-checkins at python.org Sun Jun 28 23:35:31 2009 From: python-checkins at python.org (benjamin.peterson) Date: Sun, 28 Jun 2009 21:35:31 -0000 Subject: [Python-checkins] r73649 - in python/branches/py3k: Lib/string.py Misc/NEWS Message-ID: Author: benjamin.peterson Date: Sun Jun 28 23:35:31 2009 New Revision: 73649 Log: remove string.maketrans Modified: python/branches/py3k/Lib/string.py python/branches/py3k/Misc/NEWS Modified: python/branches/py3k/Lib/string.py ============================================================================== --- python/branches/py3k/Lib/string.py (original) +++ python/branches/py3k/Lib/string.py Sun Jun 28 23:35:31 2009 @@ -40,28 +40,6 @@ return (sep or ' ').join([x.capitalize() for x in s.split(sep)]) -# Construct a translation map for bytes.translate -def maketrans(frm: bytes, to: bytes) -> bytes: - """maketrans(frm, to) -> bytes - - Return a translation table (a bytes object of length 256) - suitable for use in bytes.translate where each byte in frm is - mapped to the byte at the same position in to. - The strings frm and to must be of the same length. - """ - import warnings - warnings.warn("string.maketrans is deprecated, use bytes.maketrans instead", - DeprecationWarning, 2) - if len(frm) != len(to): - raise ValueError("maketrans arguments must have same length") - if not (isinstance(frm, bytes) and isinstance(to, bytes)): - raise TypeError("maketrans arguments must be bytes objects") - L = bytearray(range(256)) - for i, c in enumerate(frm): - L[c] = to[i] - return bytes(L) - - #################################################################### import re as _re Modified: python/branches/py3k/Misc/NEWS ============================================================================== --- python/branches/py3k/Misc/NEWS (original) +++ python/branches/py3k/Misc/NEWS Sun Jun 28 23:35:31 2009 @@ -17,6 +17,8 @@ Library ------- +- The deprecated function string.maketrans has been removed. + Build ----- From python-checkins at python.org Sun Jun 28 23:37:09 2009 From: python-checkins at python.org (raymond.hettinger) Date: Sun, 28 Jun 2009 21:37:09 -0000 Subject: [Python-checkins] r73650 - in python/branches/py3k/Doc/whatsnew: 3.2.rst index.rst Message-ID: Author: raymond.hettinger Date: Sun Jun 28 23:37:08 2009 New Revision: 73650 Log: Fill-in some new news. Modified: python/branches/py3k/Doc/whatsnew/3.2.rst python/branches/py3k/Doc/whatsnew/index.rst Modified: python/branches/py3k/Doc/whatsnew/3.2.rst ============================================================================== --- python/branches/py3k/Doc/whatsnew/3.2.rst (original) +++ python/branches/py3k/Doc/whatsnew/3.2.rst Sun Jun 28 23:37:08 2009 @@ -1,5 +1,5 @@ **************************** - What's New In Python 3.1 + What's New In Python 3.2 **************************** :Author: Raymond Hettinger @@ -66,8 +66,24 @@ New, Improved, and Deprecated Modules ===================================== -* Stub +* The previously deprecated :func:`string.maketrans` function has been + removed in favor of the static methods, :meth:`bytes.maketrans` and + :meth:`bytearray.maketrans`. This change solves the confusion around which + types were supported by the :mod:`string` module. Now, :class:`str`, + :class:`bytes`, and :class:`bytearray` each have their own **maketrans** and + **translate** methods with intermediate translation tables of the + appropriate type. + + (Contributed by Georg Brandl; :issue:`5675`.) + +* The previously deprecated :func:`contextlib.nested` function has been + removed in favor of a plain :keyword:`with` statement which can + accept multiple context managers. The latter technique is faster + (because it is built-in), and it does a better job finalizing multiple + context managers when one of them raises an exception. + (Contributed by Georg Brandl and Mattias Br?ndstr?m; + `appspot issue 53094 `_.) Optimizations ============= @@ -90,7 +106,7 @@ * Stub -Porting to Python 3.1 +Porting to Python 3.2 ===================== This section lists previously described changes and other bugfixes Modified: python/branches/py3k/Doc/whatsnew/index.rst ============================================================================== --- python/branches/py3k/Doc/whatsnew/index.rst (original) +++ python/branches/py3k/Doc/whatsnew/index.rst Sun Jun 28 23:37:08 2009 @@ -11,6 +11,7 @@ .. toctree:: :maxdepth: 2 + 3.2 rst 3.1.rst 3.0.rst 2.7.rst From python-checkins at python.org Sun Jun 28 23:41:24 2009 From: python-checkins at python.org (benjamin.peterson) Date: Sun, 28 Jun 2009 21:41:24 -0000 Subject: [Python-checkins] r73651 - python/branches/py3k/Doc/whatsnew/index.rst Message-ID: Author: benjamin.peterson Date: Sun Jun 28 23:41:24 2009 New Revision: 73651 Log: include 3.2 in toctree Modified: python/branches/py3k/Doc/whatsnew/index.rst Modified: python/branches/py3k/Doc/whatsnew/index.rst ============================================================================== --- python/branches/py3k/Doc/whatsnew/index.rst (original) +++ python/branches/py3k/Doc/whatsnew/index.rst Sun Jun 28 23:41:24 2009 @@ -11,7 +11,7 @@ .. toctree:: :maxdepth: 2 - 3.2 rst + 3.2.rst 3.1.rst 3.0.rst 2.7.rst From python-checkins at python.org Sun Jun 28 23:46:33 2009 From: python-checkins at python.org (mark.dickinson) Date: Sun, 28 Jun 2009 21:46:33 -0000 Subject: [Python-checkins] r73652 - python/branches/release30-maint/Doc/tutorial/stdlib2.rst Message-ID: Author: mark.dickinson Date: Sun Jun 28 23:46:33 2009 New Revision: 73652 Log: Missed one case of incorrect Decimal quoting Modified: python/branches/release30-maint/Doc/tutorial/stdlib2.rst Modified: python/branches/release30-maint/Doc/tutorial/stdlib2.rst ============================================================================== --- python/branches/release30-maint/Doc/tutorial/stdlib2.rst (original) +++ python/branches/release30-maint/Doc/tutorial/stdlib2.rst Sun Jun 28 23:46:33 2009 @@ -360,7 +360,7 @@ >>> from decimal import * >>> Decimal('0.70') * Decimal('1.05') - Decimal("0.7350") + Decimal('0.7350') >>> .70 * 1.05 0.73499999999999999 From buildbot at python.org Sun Jun 28 23:48:08 2009 From: buildbot at python.org (buildbot at python.org) Date: Sun, 28 Jun 2009 21:48:08 +0000 Subject: [Python-checkins] buildbot failure in x86 gentoo trunk Message-ID: The Buildbot has detected a new failure of x86 gentoo trunk. Full details are available at: http://www.python.org/dev/buildbot/all/x86%20gentoo%20trunk/builds/5088 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: norwitz-x86 Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: kristjan.jonsson BUILD FAILED: failed test Excerpt from the test logfile: Traceback (most recent call last): File "/home/buildslave/python-trunk/trunk.norwitz-x86/build/Lib/SocketServer.py", line 281, in _handle_request_noblock self.process_request(request, client_address) File "/home/buildslave/python-trunk/trunk.norwitz-x86/build/Lib/SocketServer.py", line 308, in process_request self.close_request(request) File "/home/buildslave/python-trunk/trunk.norwitz-x86/build/Lib/SocketServer.py", line 448, in close_request request.shutdown(socket.SHUT_WR) File "/home/buildslave/python-trunk/trunk.norwitz-x86/build/Lib/socket.py", line 219, in meth return getattr(self._sock,name)(*args) error: [Errno 107] Transport endpoint is not connected Traceback (most recent call last): File "/home/buildslave/python-trunk/trunk.norwitz-x86/build/Lib/threading.py", line 524, in __bootstrap_inner self.run() File "/home/buildslave/python-trunk/trunk.norwitz-x86/build/Lib/test/test_urllib2_localnet.py", line 65, in run self.httpd.handle_request() File "/home/buildslave/python-trunk/trunk.norwitz-x86/build/Lib/SocketServer.py", line 266, in handle_request self._handle_request_noblock() File "/home/buildslave/python-trunk/trunk.norwitz-x86/build/Lib/SocketServer.py", line 284, in _handle_request_noblock self.close_request(request) File "/home/buildslave/python-trunk/trunk.norwitz-x86/build/Lib/SocketServer.py", line 448, in close_request request.shutdown(socket.SHUT_WR) File "/home/buildslave/python-trunk/trunk.norwitz-x86/build/Lib/socket.py", line 219, in meth return getattr(self._sock,name)(*args) error: [Errno 107] Transport endpoint is not connected Traceback (most recent call last): File "/home/buildslave/python-trunk/trunk.norwitz-x86/build/Lib/SocketServer.py", line 281, in _handle_request_noblock self.process_request(request, client_address) File "/home/buildslave/python-trunk/trunk.norwitz-x86/build/Lib/SocketServer.py", line 308, in process_request self.close_request(request) File "/home/buildslave/python-trunk/trunk.norwitz-x86/build/Lib/SocketServer.py", line 448, in close_request request.shutdown(socket.SHUT_WR) File "/home/buildslave/python-trunk/trunk.norwitz-x86/build/Lib/socket.py", line 219, in meth return getattr(self._sock,name)(*args) error: [Errno 107] Transport endpoint is not connected Traceback (most recent call last): File "/home/buildslave/python-trunk/trunk.norwitz-x86/build/Lib/threading.py", line 524, in __bootstrap_inner self.run() File "/home/buildslave/python-trunk/trunk.norwitz-x86/build/Lib/test/test_urllib2_localnet.py", line 65, in run self.httpd.handle_request() File "/home/buildslave/python-trunk/trunk.norwitz-x86/build/Lib/SocketServer.py", line 266, in handle_request self._handle_request_noblock() File "/home/buildslave/python-trunk/trunk.norwitz-x86/build/Lib/SocketServer.py", line 284, in _handle_request_noblock self.close_request(request) File "/home/buildslave/python-trunk/trunk.norwitz-x86/build/Lib/SocketServer.py", line 448, in close_request request.shutdown(socket.SHUT_WR) File "/home/buildslave/python-trunk/trunk.norwitz-x86/build/Lib/socket.py", line 219, in meth return getattr(self._sock,name)(*args) error: [Errno 107] Transport endpoint is not connected Traceback (most recent call last): File "/home/buildslave/python-trunk/trunk.norwitz-x86/build/Lib/SocketServer.py", line 281, in _handle_request_noblock self.process_request(request, client_address) File "/home/buildslave/python-trunk/trunk.norwitz-x86/build/Lib/SocketServer.py", line 308, in process_request self.close_request(request) File "/home/buildslave/python-trunk/trunk.norwitz-x86/build/Lib/SocketServer.py", line 448, in close_request request.shutdown(socket.SHUT_WR) File "/home/buildslave/python-trunk/trunk.norwitz-x86/build/Lib/socket.py", line 219, in meth return getattr(self._sock,name)(*args) error: [Errno 107] Transport endpoint is not connected Traceback (most recent call last): File "/home/buildslave/python-trunk/trunk.norwitz-x86/build/Lib/threading.py", line 524, in __bootstrap_inner self.run() File "/home/buildslave/python-trunk/trunk.norwitz-x86/build/Lib/test/test_urllib2_localnet.py", line 65, in run self.httpd.handle_request() File "/home/buildslave/python-trunk/trunk.norwitz-x86/build/Lib/SocketServer.py", line 266, in handle_request self._handle_request_noblock() File "/home/buildslave/python-trunk/trunk.norwitz-x86/build/Lib/SocketServer.py", line 284, in _handle_request_noblock self.close_request(request) File "/home/buildslave/python-trunk/trunk.norwitz-x86/build/Lib/SocketServer.py", line 448, in close_request request.shutdown(socket.SHUT_WR) File "/home/buildslave/python-trunk/trunk.norwitz-x86/build/Lib/socket.py", line 219, in meth return getattr(self._sock,name)(*args) error: [Errno 107] Transport endpoint is not connected Traceback (most recent call last): File "/home/buildslave/python-trunk/trunk.norwitz-x86/build/Lib/SocketServer.py", line 281, in _handle_request_noblock self.process_request(request, client_address) File "/home/buildslave/python-trunk/trunk.norwitz-x86/build/Lib/SocketServer.py", line 308, in process_request self.close_request(request) File "/home/buildslave/python-trunk/trunk.norwitz-x86/build/Lib/SocketServer.py", line 448, in close_request request.shutdown(socket.SHUT_WR) File "/home/buildslave/python-trunk/trunk.norwitz-x86/build/Lib/socket.py", line 219, in meth return getattr(self._sock,name)(*args) error: [Errno 107] Transport endpoint is not connected Traceback (most recent call last): File "/home/buildslave/python-trunk/trunk.norwitz-x86/build/Lib/threading.py", line 524, in __bootstrap_inner self.run() File "/home/buildslave/python-trunk/trunk.norwitz-x86/build/Lib/test/test_urllib2_localnet.py", line 65, in run self.httpd.handle_request() File "/home/buildslave/python-trunk/trunk.norwitz-x86/build/Lib/SocketServer.py", line 266, in handle_request self._handle_request_noblock() File "/home/buildslave/python-trunk/trunk.norwitz-x86/build/Lib/SocketServer.py", line 284, in _handle_request_noblock self.close_request(request) File "/home/buildslave/python-trunk/trunk.norwitz-x86/build/Lib/SocketServer.py", line 448, in close_request request.shutdown(socket.SHUT_WR) File "/home/buildslave/python-trunk/trunk.norwitz-x86/build/Lib/socket.py", line 219, in meth return getattr(self._sock,name)(*args) error: [Errno 107] Transport endpoint is not connected Traceback (most recent call last): File "/home/buildslave/python-trunk/trunk.norwitz-x86/build/Lib/SocketServer.py", line 281, in _handle_request_noblock self.process_request(request, client_address) File "/home/buildslave/python-trunk/trunk.norwitz-x86/build/Lib/SocketServer.py", line 308, in process_request self.close_request(request) File "/home/buildslave/python-trunk/trunk.norwitz-x86/build/Lib/SocketServer.py", line 448, in close_request request.shutdown(socket.SHUT_WR) File "/home/buildslave/python-trunk/trunk.norwitz-x86/build/Lib/socket.py", line 219, in meth return getattr(self._sock,name)(*args) error: [Errno 107] Transport endpoint is not connected Traceback (most recent call last): File "/home/buildslave/python-trunk/trunk.norwitz-x86/build/Lib/threading.py", line 524, in __bootstrap_inner self.run() File "/home/buildslave/python-trunk/trunk.norwitz-x86/build/Lib/test/test_httpservers.py", line 43, in run self.server.serve_forever() File "/home/buildslave/python-trunk/trunk.norwitz-x86/build/Lib/SocketServer.py", line 226, in serve_forever self._handle_request_noblock() File "/home/buildslave/python-trunk/trunk.norwitz-x86/build/Lib/SocketServer.py", line 284, in _handle_request_noblock self.close_request(request) File "/home/buildslave/python-trunk/trunk.norwitz-x86/build/Lib/SocketServer.py", line 448, in close_request request.shutdown(socket.SHUT_WR) File "/home/buildslave/python-trunk/trunk.norwitz-x86/build/Lib/socket.py", line 219, in meth return getattr(self._sock,name)(*args) error: [Errno 107] Transport endpoint is not connected sincerely, -The Buildbot From python-checkins at python.org Sun Jun 28 23:48:16 2009 From: python-checkins at python.org (mark.dickinson) Date: Sun, 28 Jun 2009 21:48:16 -0000 Subject: [Python-checkins] r73653 - python/trunk/Doc/tutorial/stdlib2.rst Message-ID: Author: mark.dickinson Date: Sun Jun 28 23:48:15 2009 New Revision: 73653 Log: More Decimal quote fixing; backport of r73642 Modified: python/trunk/Doc/tutorial/stdlib2.rst Modified: python/trunk/Doc/tutorial/stdlib2.rst ============================================================================== --- python/trunk/Doc/tutorial/stdlib2.rst (original) +++ python/trunk/Doc/tutorial/stdlib2.rst Sun Jun 28 23:48:15 2009 @@ -360,7 +360,7 @@ >>> from decimal import * >>> Decimal('0.70') * Decimal('1.05') - Decimal("0.7350") + Decimal('0.7350') >>> .70 * 1.05 0.73499999999999999 @@ -373,7 +373,7 @@ calculations and equality tests that are unsuitable for binary floating point:: >>> Decimal('1.00') % Decimal('.10') - Decimal("0.00") + Decimal('0.00') >>> 1.00 % 0.10 0.09999999999999995 @@ -386,6 +386,6 @@ >>> getcontext().prec = 36 >>> Decimal(1) / Decimal(7) - Decimal("0.142857142857142857142857142857142857") + Decimal('0.142857142857142857142857142857142857') From buildbot at python.org Sun Jun 28 23:51:11 2009 From: buildbot at python.org (buildbot at python.org) Date: Sun, 28 Jun 2009 21:51:11 +0000 Subject: [Python-checkins] buildbot failure in amd64 gentoo trunk Message-ID: The Buildbot has detected a new failure of amd64 gentoo trunk. Full details are available at: http://www.python.org/dev/buildbot/all/amd64%20gentoo%20trunk/builds/218 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: norwitz-amd64 Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: kristjan.jonsson BUILD FAILED: failed failed slave lost sincerely, -The Buildbot From buildbot at python.org Sun Jun 28 23:54:57 2009 From: buildbot at python.org (buildbot at python.org) Date: Sun, 28 Jun 2009 21:54:57 +0000 Subject: [Python-checkins] buildbot failure in x86 osx.5 trunk Message-ID: The Buildbot has detected a new failure of x86 osx.5 trunk. Full details are available at: http://www.python.org/dev/buildbot/all/x86%20osx.5%20trunk/builds/1237 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: heller-x86-osx5 Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: kristjan.jonsson BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_socketserver Traceback (most recent call last): File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/threading.py", line 524, in __bootstrap_inner self.run() File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/threading.py", line 477, in run self.__target(*self.__args, **self.__kwargs) File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/SocketServer.py", line 562, in process_request_thread self.handle_error(request, client_address) File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/test/test_socketserver.py", line 111, in handle_error self.close_request(request) File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/SocketServer.py", line 448, in close_request request.shutdown(socket.SHUT_WR) File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/socket.py", line 219, in meth return getattr(self._sock,name)(*args) error: [Errno 57] Socket is not connected ====================================================================== FAIL: test_ForkingTCPServer (test.test_socketserver.SocketServerTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/test/test_socketserver.py", line 189, in test_ForkingTCPServer self.stream_examine) File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/test/test_socketserver.py", line 147, in run_server testfunc(svrcls.address_family, addr) File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/test/test_socketserver.py", line 161, in stream_examine self.assertEquals(buf, TEST_STR) AssertionError: '' != 'hello world\n' ====================================================================== FAIL: test_ForkingUnixStreamServer (test.test_socketserver.SocketServerTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/test/test_socketserver.py", line 207, in test_ForkingUnixStreamServer self.stream_examine) File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/test/test_socketserver.py", line 147, in run_server testfunc(svrcls.address_family, addr) File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/test/test_socketserver.py", line 161, in stream_examine self.assertEquals(buf, TEST_STR) AssertionError: '' != 'hello world\n' Traceback (most recent call last): File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/threading.py", line 524, in __bootstrap_inner File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/threading.py", line 477, in run File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/SocketServer.py", line 224, in serve_forever : 'NoneType' object has no attribute 'select' Traceback (most recent call last): File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/threading.py", line 524, in __bootstrap_inner File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/threading.py", line 477, in run File "/Users/buildbot/buildarea/trunk.heller-x86-osx5/build/Lib/SocketServer.py", line 224, in serve_forever : 'NoneType' object has no attribute 'select' Traceback (most recent call last):[805196 refs] make: *** [buildbottest] Error 1 sincerely, -The Buildbot From python-checkins at python.org Sun Jun 28 23:56:07 2009 From: python-checkins at python.org (mark.dickinson) Date: Sun, 28 Jun 2009 21:56:07 -0000 Subject: [Python-checkins] r73654 - in python/branches/release26-maint: Doc/tutorial/stdlib2.rst Message-ID: Author: mark.dickinson Date: Sun Jun 28 23:56:07 2009 New Revision: 73654 Log: Merged revisions 73653 via svnmerge from svn+ssh://pythondev at svn.python.org/python/trunk ........ r73653 | mark.dickinson | 2009-06-28 22:48:15 +0100 (Sun, 28 Jun 2009) | 1 line More Decimal quote fixing; backport of r73642 ........ Modified: python/branches/release26-maint/ (props changed) python/branches/release26-maint/Doc/tutorial/stdlib2.rst Modified: python/branches/release26-maint/Doc/tutorial/stdlib2.rst ============================================================================== --- python/branches/release26-maint/Doc/tutorial/stdlib2.rst (original) +++ python/branches/release26-maint/Doc/tutorial/stdlib2.rst Sun Jun 28 23:56:07 2009 @@ -360,7 +360,7 @@ >>> from decimal import * >>> Decimal('0.70') * Decimal('1.05') - Decimal("0.7350") + Decimal('0.7350') >>> .70 * 1.05 0.73499999999999999 @@ -373,7 +373,7 @@ calculations and equality tests that are unsuitable for binary floating point:: >>> Decimal('1.00') % Decimal('.10') - Decimal("0.00") + Decimal('0.00') >>> 1.00 % 0.10 0.09999999999999995 @@ -386,6 +386,6 @@ >>> getcontext().prec = 36 >>> Decimal(1) / Decimal(7) - Decimal("0.142857142857142857142857142857142857") + Decimal('0.142857142857142857142857142857142857') From python-checkins at python.org Sun Jun 28 23:59:53 2009 From: python-checkins at python.org (mark.dickinson) Date: Sun, 28 Jun 2009 21:59:53 -0000 Subject: [Python-checkins] r73655 - python/branches/py3k Message-ID: Author: mark.dickinson Date: Sun Jun 28 23:59:52 2009 New Revision: 73655 Log: Blocked revisions 73653 via svnmerge ........ r73653 | mark.dickinson | 2009-06-28 22:48:15 +0100 (Sun, 28 Jun 2009) | 1 line More Decimal quote fixing; backport of r73642 ........ Modified: python/branches/py3k/ (props changed) From python-checkins at python.org Mon Jun 29 00:08:40 2009 From: python-checkins at python.org (mark.dickinson) Date: Sun, 28 Jun 2009 22:08:40 -0000 Subject: [Python-checkins] r73656 - python/branches/py3k/Objects/rangeobject.c Message-ID: Author: mark.dickinson Date: Mon Jun 29 00:08:40 2009 New Revision: 73656 Log: Fix description of range_length_obj Modified: python/branches/py3k/Objects/rangeobject.c Modified: python/branches/py3k/Objects/rangeobject.c ============================================================================== --- python/branches/py3k/Objects/rangeobject.c (original) +++ python/branches/py3k/Objects/rangeobject.c Mon Jun 29 00:08:40 2009 @@ -126,10 +126,9 @@ PyObject_Del(r); } -/* Return number of items in range (lo, hi, step), when arguments are PyLong - * objects. Return a value < 0 if & only if the true value is too large to - * fit in a signed long. Arguments MUST return 1 with PyLong_Check(). Return - * -1 when there is an error. +/* Return number of items in range (lo, hi, step) as a PyLong object, + * when arguments are PyLong objects. Arguments MUST return 1 with + * PyLong_Check(). Return NULL when there is an error. */ static PyObject* range_length_obj(rangeobject *r) From python-checkins at python.org Mon Jun 29 00:24:31 2009 From: python-checkins at python.org (benjamin.peterson) Date: Sun, 28 Jun 2009 22:24:31 -0000 Subject: [Python-checkins] r73657 - python/branches/py3k Message-ID: Author: benjamin.peterson Date: Mon Jun 29 00:24:31 2009 New Revision: 73657 Log: Blocked revisions 73272,73546 via svnmerge ........ r73272 | kristjan.jonsson | 2009-06-07 11:43:23 -0500 (Sun, 07 Jun 2009) | 2 lines http://bugs.python.org/issue6192 Add a feature to disable the Nagle algorithm on sockets in TCPServer ........ r73546 | kristjan.jonsson | 2009-06-24 04:17:04 -0500 (Wed, 24 Jun 2009) | 2 lines http://bugs.python.org/issue6192 Move the newly introduced disable_nagle_algorithm flag into the StreamRequestHandler, where it is more appropriate. ........ Modified: python/branches/py3k/ (props changed) From buildbot at python.org Mon Jun 29 00:25:25 2009 From: buildbot at python.org (buildbot at python.org) Date: Sun, 28 Jun 2009 22:25:25 +0000 Subject: [Python-checkins] buildbot failure in sparc solaris10 gcc 3.x Message-ID: The Buildbot has detected a new failure of sparc solaris10 gcc 3.x. Full details are available at: http://www.python.org/dev/buildbot/all/sparc%20solaris10%20gcc%203.x/builds/872 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: loewis-sun Build Reason: Build Source Stamp: [branch branches/py3k] HEAD Blamelist: benjamin.peterson BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_posix ====================================================================== ERROR: test_getcwd_long_pathnames (test.test_posix.PosixTester) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home2/buildbot/slave/3.x.loewis-sun/build/Lib/test/test_posix.py", line 251, in test_getcwd_long_pathnames support.rmtree(base_path) File "/home2/buildbot/slave/3.x.loewis-sun/build/Lib/test/support.py", line 181, in rmtree shutil.rmtree(path) File "/home2/buildbot/slave/3.x.loewis-sun/build/Lib/shutil.py", line 239, in rmtree onerror(os.rmdir, path, sys.exc_info()) File "/home2/buildbot/slave/3.x.loewis-sun/build/Lib/shutil.py", line 237, in rmtree os.rmdir(path) OSError: [Errno 22] Invalid argument: '/home2/buildbot/slave/3.x.loewis-sun/build/@test.getcwd/@test.getcwd' sincerely, -The Buildbot From python-checkins at python.org Mon Jun 29 00:30:13 2009 From: python-checkins at python.org (raymond.hettinger) Date: Sun, 28 Jun 2009 22:30:13 -0000 Subject: [Python-checkins] r73658 - python/branches/py3k/Doc/tutorial/floatingpoint.rst Message-ID: Author: raymond.hettinger Date: Mon Jun 29 00:30:13 2009 New Revision: 73658 Log: Small doc fix-ups to floatingpoint.rst. More are forthcoming. Modified: python/branches/py3k/Doc/tutorial/floatingpoint.rst Modified: python/branches/py3k/Doc/tutorial/floatingpoint.rst ============================================================================== --- python/branches/py3k/Doc/tutorial/floatingpoint.rst (original) +++ python/branches/py3k/Doc/tutorial/floatingpoint.rst Mon Jun 29 00:30:13 2009 @@ -82,7 +82,7 @@ while still preserving the invariant ``eval(repr(x)) == x``. Historically, the Python prompt and built-in :func:`repr` function would chose -the one with 17 significant digits, ``0.10000000000000001``, Starting with +the one with 17 significant digits, ``0.10000000000000001``. Starting with Python 3.1, Python (on most systems) is now able to choose the shortest of these and simply display ``0.1``. @@ -123,9 +123,9 @@ Though the numbers cannot be made closer to their intended exact values, the :func:`round` function can be useful for post-rounding so that results -have inexact values that are comparable to one another:: +with inexact values become comparable to one another:: - >>> round(.1 + .1 + .1, 1) == round(.3, 1) + >>> round(.1 + .1 + .1, 10) == round(.3, 10) True Binary floating-point arithmetic holds many surprises like this. The problem @@ -137,7 +137,7 @@ wary of floating-point! The errors in Python float operations are inherited from the floating-point hardware, and on most machines are on the order of no more than 1 part in 2\*\*53 per operation. That's more than adequate for most -tasks, but you do need to keep in mind that it's not decimal arithmetic, and +tasks, but you do need to keep in mind that it's not decimal arithmetic and that every float operation can suffer a new rounding error. While pathological cases do exist, for most casual use of floating-point @@ -165,7 +165,7 @@ >>> x = 3.14159 >>> x.as_integer_ratio() - (3537115888337719L, 1125899906842624L) + (3537115888337719, 1125899906842624) Since the ratio is exact, it can be used to losslessly recreate the original value:: From python-checkins at python.org Mon Jun 29 00:36:18 2009 From: python-checkins at python.org (benjamin.peterson) Date: Sun, 28 Jun 2009 22:36:18 -0000 Subject: [Python-checkins] r73659 - python/branches/release31-maint/Python/compile.c Message-ID: Author: benjamin.peterson Date: Mon Jun 29 00:36:18 2009 New Revision: 73659 Log: unfortunately we can't kill compiler_new_tmpname here Modified: python/branches/release31-maint/Python/compile.c Modified: python/branches/release31-maint/Python/compile.c ============================================================================== --- python/branches/release31-maint/Python/compile.c (original) +++ python/branches/release31-maint/Python/compile.c Mon Jun 29 00:36:18 2009 @@ -551,6 +551,16 @@ } +/* Allocate a new "anonymous" local variable. Used by with statements. */ + +static PyObject * +compiler_new_tmpname(struct compiler *c) +{ + char tmpname[256]; + PyOS_snprintf(tmpname, sizeof(tmpname), "_[%d]", ++c->u->u_tmpname); + return PyUnicode_FromString(tmpname); +} + /* Allocate a new block and return a pointer to it. Returns NULL on error. */ From python-checkins at python.org Mon Jun 29 00:37:13 2009 From: python-checkins at python.org (mark.dickinson) Date: Sun, 28 Jun 2009 22:37:13 -0000 Subject: [Python-checkins] r73660 - in python/trunk/Include: longintrepr.h pymath.h Message-ID: Author: mark.dickinson Date: Mon Jun 29 00:37:13 2009 New Revision: 73660 Log: Remove unused stdint.h includes Modified: python/trunk/Include/longintrepr.h python/trunk/Include/pymath.h Modified: python/trunk/Include/longintrepr.h ============================================================================== --- python/trunk/Include/longintrepr.h (original) +++ python/trunk/Include/longintrepr.h Mon Jun 29 00:37:13 2009 @@ -37,10 +37,6 @@ platform. */ -#if HAVE_STDINT_H -#include -#endif - #if PYLONG_BITS_IN_DIGIT == 30 #if !(defined HAVE_UINT64_T && defined HAVE_UINT32_T && \ defined HAVE_INT64_T && defined HAVE_INT32_T) Modified: python/trunk/Include/pymath.h ============================================================================== --- python/trunk/Include/pymath.h (original) +++ python/trunk/Include/pymath.h Mon Jun 29 00:37:13 2009 @@ -3,10 +3,6 @@ #include "pyconfig.h" /* include for defines */ -#ifdef HAVE_STDINT_H -#include -#endif - /************************************************************************** Symbols and macros to supply platform-independent interfaces to mathematical functions and constants From python-checkins at python.org Mon Jun 29 00:40:53 2009 From: python-checkins at python.org (mark.dickinson) Date: Sun, 28 Jun 2009 22:40:53 -0000 Subject: [Python-checkins] r73661 - in python/branches/py3k: Include/longintrepr.h Include/pymath.h Message-ID: Author: mark.dickinson Date: Mon Jun 29 00:40:48 2009 New Revision: 73661 Log: Merged revisions 73660 via svnmerge from svn+ssh://pythondev at svn.python.org/python/trunk ........ r73660 | mark.dickinson | 2009-06-28 23:37:13 +0100 (Sun, 28 Jun 2009) | 1 line Remove unused stdint.h includes ........ Modified: python/branches/py3k/ (props changed) python/branches/py3k/Include/longintrepr.h python/branches/py3k/Include/pymath.h Modified: python/branches/py3k/Include/longintrepr.h ============================================================================== --- python/branches/py3k/Include/longintrepr.h (original) +++ python/branches/py3k/Include/longintrepr.h Mon Jun 29 00:40:48 2009 @@ -40,10 +40,6 @@ platform. */ -#if HAVE_STDINT_H -#include -#endif - #if PYLONG_BITS_IN_DIGIT == 30 #if !(defined HAVE_UINT64_T && defined HAVE_UINT32_T && \ defined HAVE_INT64_T && defined HAVE_INT32_T) Modified: python/branches/py3k/Include/pymath.h ============================================================================== --- python/branches/py3k/Include/pymath.h (original) +++ python/branches/py3k/Include/pymath.h Mon Jun 29 00:40:48 2009 @@ -3,10 +3,6 @@ #include "pyconfig.h" /* include for defines */ -#ifdef HAVE_STDINT_H -#include -#endif - /************************************************************************** Symbols and macros to supply platform-independent interfaces to mathematical functions and constants From python-checkins at python.org Mon Jun 29 00:52:18 2009 From: python-checkins at python.org (mark.dickinson) Date: Sun, 28 Jun 2009 22:52:18 -0000 Subject: [Python-checkins] r73662 - in python/branches/release31-maint: Include/longintrepr.h Include/pymath.h Message-ID: Author: mark.dickinson Date: Mon Jun 29 00:52:18 2009 New Revision: 73662 Log: Merged revisions 73661 via svnmerge from svn+ssh://pythondev at www.python.org/python/branches/py3k ................ r73661 | mark.dickinson | 2009-06-28 23:40:48 +0100 (Sun, 28 Jun 2009) | 9 lines Merged revisions 73660 via svnmerge from svn+ssh://pythondev at svn.python.org/python/trunk ........ r73660 | mark.dickinson | 2009-06-28 23:37:13 +0100 (Sun, 28 Jun 2009) | 1 line Remove unused stdint.h includes ........ ................ Modified: python/branches/release31-maint/ (props changed) python/branches/release31-maint/Include/longintrepr.h python/branches/release31-maint/Include/pymath.h Modified: python/branches/release31-maint/Include/longintrepr.h ============================================================================== --- python/branches/release31-maint/Include/longintrepr.h (original) +++ python/branches/release31-maint/Include/longintrepr.h Mon Jun 29 00:52:18 2009 @@ -40,10 +40,6 @@ platform. */ -#if HAVE_STDINT_H -#include -#endif - #if PYLONG_BITS_IN_DIGIT == 30 #if !(defined HAVE_UINT64_T && defined HAVE_UINT32_T && \ defined HAVE_INT64_T && defined HAVE_INT32_T) Modified: python/branches/release31-maint/Include/pymath.h ============================================================================== --- python/branches/release31-maint/Include/pymath.h (original) +++ python/branches/release31-maint/Include/pymath.h Mon Jun 29 00:52:18 2009 @@ -3,10 +3,6 @@ #include "pyconfig.h" /* include for defines */ -#ifdef HAVE_STDINT_H -#include -#endif - /************************************************************************** Symbols and macros to supply platform-independent interfaces to mathematical functions and constants From buildbot at python.org Mon Jun 29 00:54:25 2009 From: buildbot at python.org (buildbot at python.org) Date: Sun, 28 Jun 2009 22:54:25 +0000 Subject: [Python-checkins] buildbot failure in amd64 gentoo 3.x Message-ID: The Buildbot has detected a new failure of amd64 gentoo 3.x. Full details are available at: http://www.python.org/dev/buildbot/all/amd64%20gentoo%203.x/builds/867 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: norwitz-amd64 Build Reason: Build Source Stamp: [branch branches/py3k] HEAD Blamelist: benjamin.peterson,mark.dickinson BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_mailbox make: *** [buildbottest] Error 1 sincerely, -The Buildbot From buildbot at python.org Mon Jun 29 01:16:43 2009 From: buildbot at python.org (buildbot at python.org) Date: Sun, 28 Jun 2009 23:16:43 +0000 Subject: [Python-checkins] buildbot failure in sparc solaris10 gcc 3.0 Message-ID: The Buildbot has detected a new failure of sparc solaris10 gcc 3.0. Full details are available at: http://www.python.org/dev/buildbot/all/sparc%20solaris10%20gcc%203.0/builds/417 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: loewis-sun Build Reason: Build Source Stamp: [branch branches/release30-maint] HEAD Blamelist: mark.dickinson BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_posix ====================================================================== ERROR: test_getcwd_long_pathnames (test.test_posix.PosixTester) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home2/buildbot/slave/3.0.loewis-sun/build/Lib/test/test_posix.py", line 252, in test_getcwd_long_pathnames support.rmtree(base_path) File "/home2/buildbot/slave/3.0.loewis-sun/build/Lib/test/support.py", line 98, in rmtree shutil.rmtree(path) File "/home2/buildbot/slave/3.0.loewis-sun/build/Lib/shutil.py", line 225, in rmtree onerror(os.rmdir, path, sys.exc_info()) File "/home2/buildbot/slave/3.0.loewis-sun/build/Lib/shutil.py", line 223, in rmtree os.rmdir(path) OSError: [Errno 22] Invalid argument: '/home2/buildbot/slave/3.0.loewis-sun/build/@test.getcwd/@test.getcwd' sincerely, -The Buildbot From python-checkins at python.org Mon Jun 29 01:21:38 2009 From: python-checkins at python.org (raymond.hettinger) Date: Sun, 28 Jun 2009 23:21:38 -0000 Subject: [Python-checkins] r73663 - python/branches/py3k/Doc/tutorial/floatingpoint.rst Message-ID: Author: raymond.hettinger Date: Mon Jun 29 01:21:38 2009 New Revision: 73663 Log: Clean-up floating point tutorial. Modified: python/branches/py3k/Doc/tutorial/floatingpoint.rst Modified: python/branches/py3k/Doc/tutorial/floatingpoint.rst ============================================================================== --- python/branches/py3k/Doc/tutorial/floatingpoint.rst (original) +++ python/branches/py3k/Doc/tutorial/floatingpoint.rst Mon Jun 29 01:21:38 2009 @@ -50,7 +50,7 @@ Stop at any finite number of bits, and you get an approximation. On most machines today, floats are approximated using a binary fraction with -the numerator using the first 53 bits following the most significant bit and +the numerator using the first 53 bits starting with the most significant bit and with the denominator as a power of two. In the case of 1/10, the binary fraction is ``3602879701896397 / 2 ** 55`` which is close to but not exactly equal to the true value of 1/10. @@ -230,12 +230,8 @@ and recalling that *J* has exactly 53 bits (is ``>= 2**52`` but ``< 2**53``), the best value for *N* is 56:: - >>> 2**52 - 4503599627370496 - >>> 2**53 - 9007199254740992 - >>> 2**56/10 - 7205759403792794.0 + >>> 2**52 <= 2**56 // 10 < 2**53 + True That is, 56 is the only value for *N* that leaves *J* with exactly 53 bits. The best possible value for *J* is then that quotient rounded:: @@ -250,14 +246,13 @@ >>> q+1 7205759403792794 -Therefore the best possible approximation to 1/10 in 754 double precision is -that over 2\*\*56, or :: +Therefore the best possible approximation to 1/10 in 754 double precision is:: - 7205759403792794 / 72057594037927936 + 7205759403792794 / 2 ** 56 Dividing both the numerator and denominator by two reduces the fraction to:: - 3602879701896397 / 36028797018963968 + 3602879701896397 / 2 ** 55 Note that since we rounded up, this is actually a little bit larger than 1/10; if we had not rounded up, the quotient would have been a little bit smaller than @@ -269,24 +264,34 @@ >>> 0.1 * 2 ** 55 3602879701896397.0 -If we multiply that fraction by 10\*\*60, we can see the value of out to -60 decimal digits:: +If we multiply that fraction by 10\*\*55, we can see the value out to +55 decimal digits:: - >>> 3602879701896397 * 10 ** 60 // 2 ** 55 + >>> 3602879701896397 * 10 ** 55 // 2 ** 55 1000000000000000055511151231257827021181583404541015625 -meaning that the exact number stored in the computer is approximately equal to -the decimal value 0.100000000000000005551115123125. Rounding that to 17 -significant digits gives the 0.10000000000000001 that Python displays (well, -will display on any 754-conforming platform that does best-possible input and -output conversions in its C library --- yours may not!). +meaning that the exact number stored in the computer is equal to +the decimal value 0.1000000000000000055511151231257827021181583404541015625. +Instead of displaying the full decimal value, many languages (including +older versions of Python), round the result to 17 significant digits:: + + >>> format(0.1, '.17f') + '0.10000000000000001' The :mod:`fractions` and :mod:`decimal` modules make these calculations easy:: >>> from decimal import Decimal >>> from fractions import Fraction - >>> print(Fraction.from_float(0.1)) - 3602879701896397/36028797018963968 - >>> print(Decimal.from_float(0.1)) - 0.1000000000000000055511151231257827021181583404541015625 + + >>> Fraction.from_float(0.1) + Fraction(3602879701896397, 36028797018963968) + + >>> (0.1).as_integer_ratio() + (3602879701896397, 36028797018963968) + + >>> Decimal.from_float(0.1) + Decimal('0.1000000000000000055511151231257827021181583404541015625') + + >>> format(Decimal.from_float(0.1), '.17') + '0.10000000000000001' From python-checkins at python.org Mon Jun 29 01:32:45 2009 From: python-checkins at python.org (benjamin.peterson) Date: Sun, 28 Jun 2009 23:32:45 -0000 Subject: [Python-checkins] r73664 - python/branches/py3k/Python/ast.c Message-ID: Author: benjamin.peterson Date: Mon Jun 29 01:32:44 2009 New Revision: 73664 Log: In most cases, the parser will protect True, False, and None from being assign to. We must check for __debug__ in all cases. Modified: python/branches/py3k/Python/ast.c Modified: python/branches/py3k/Python/ast.c ============================================================================== --- python/branches/py3k/Python/ast.c (original) +++ python/branches/py3k/Python/ast.c Mon Jun 29 01:32:44 2009 @@ -357,19 +357,24 @@ "None", "True", "False", - "__debug__", NULL, }; static int -forbidden_name(identifier name, const node *n) +forbidden_name(identifier name, const node *n, int full_checks) { - const char **p; assert(PyUnicode_Check(name)); - for (p = FORBIDDEN; *p; p++) { - if (PyUnicode_CompareWithASCIIString(name, *p) == 0) { - ast_error(n, "assignment to keyword"); - return 1; + if (PyUnicode_CompareWithASCIIString(name, "__debug__") == 0) { + ast_error(n, "assignment to keyword"); + return 1; + } + if (full_checks) { + const char **p; + for (p = FORBIDDEN; *p; p++) { + if (PyUnicode_CompareWithASCIIString(name, *p) == 0) { + ast_error(n, "assignment to keyword"); + return 1; + } } } return 0; @@ -403,6 +408,8 @@ switch (e->kind) { case Attribute_kind: e->v.Attribute.ctx = ctx; + if (ctx == Store && forbidden_name(e->v.Attribute.attr, n, 1)) + return 0; break; case Subscript_kind: e->v.Subscript.ctx = ctx; @@ -414,7 +421,7 @@ break; case Name_kind: if (ctx == Store) { - if (forbidden_name(e->v.Name.id, n)) + if (forbidden_name(e->v.Name.id, n, 1)) return 0; /* forbidden_name() calls ast_error() */ } e->v.Name.ctx = ctx; @@ -631,6 +638,8 @@ name = NEW_IDENTIFIER(ch); if (!name) return NULL; + if (forbidden_name(name, ch, 0)) + return NULL; if (NCH(n) == 3 && TYPE(CHILD(n, 1)) == COLON) { annotation = ast_for_expr(c, CHILD(n, 2)); @@ -697,6 +706,8 @@ argname = NEW_IDENTIFIER(ch); if (!argname) goto error; + if (forbidden_name(argname, ch, 0)) + goto error; arg = arg(argname, annotation, c->c_arena); if (!arg) goto error; @@ -855,6 +866,8 @@ vararg = NEW_IDENTIFIER(CHILD(ch, 0)); if (!vararg) return NULL; + if (forbidden_name(vararg, CHILD(ch, 0), 0)) + return NULL; if (NCH(ch) > 1) { /* there is an annotation on the vararg */ varargannotation = ast_for_expr(c, CHILD(ch, 2)); @@ -880,6 +893,8 @@ } if (!kwarg) goto error; + if (forbidden_name(kwarg, CHILD(ch, 0), 0)) + goto error; i += 3; break; default: @@ -1001,6 +1016,8 @@ name = NEW_IDENTIFIER(CHILD(n, name_i)); if (!name) return NULL; + if (forbidden_name(name, CHILD(n, name_i), 0)) + return NULL; args = ast_for_arguments(c, CHILD(n, name_i + 1)); if (!args) return NULL; @@ -2010,7 +2027,7 @@ } else if (e->kind != Name_kind) { ast_error(CHILD(ch, 0), "keyword can't be an expression"); return NULL; - } else if (forbidden_name(e->v.Name.id, ch)) { + } else if (forbidden_name(e->v.Name.id, ch, 1)) { return NULL; } key = e->v.Name.id; @@ -2279,11 +2296,11 @@ str = NEW_IDENTIFIER(str_node); if (!str) return NULL; - if (store && forbidden_name(str, str_node)) + if (store && forbidden_name(str, str_node, 0)) return NULL; } else { - if (forbidden_name(name, name_node)) + if (forbidden_name(name, name_node, 0)) return NULL; } return alias(name, str, c->c_arena); @@ -2302,7 +2319,7 @@ a->asname = NEW_IDENTIFIER(asname_node); if (!a->asname) return NULL; - if (forbidden_name(a->asname, asname_node)) + if (forbidden_name(a->asname, asname_node, 0)) return NULL; return a; } @@ -2313,7 +2330,7 @@ name = NEW_IDENTIFIER(name_node); if (!name) return NULL; - if (store && forbidden_name(name, name_node)) + if (store && forbidden_name(name, name_node, 0)) return NULL; return alias(name, NULL, c->c_arena); } @@ -2853,6 +2870,8 @@ identifier e = NEW_IDENTIFIER(CHILD(exc, 3)); if (!e) return NULL; + if (forbidden_name(e, CHILD(exc, 3), 0)) + return NULL; expression = ast_for_expr(c, CHILD(exc, 1)); if (!expression) return NULL; @@ -3023,6 +3042,8 @@ classname = NEW_IDENTIFIER(CHILD(n, 1)); if (!classname) return NULL; + if (forbidden_name(classname, CHILD(n, 3), 0)) + return NULL; return ClassDef(classname, NULL, NULL, NULL, NULL, s, decorator_seq, LINENO(n), n->n_col_offset, c->c_arena); } @@ -3034,6 +3055,8 @@ classname = NEW_IDENTIFIER(CHILD(n, 1)); if (!classname) return NULL; + if (forbidden_name(classname, CHILD(n, 3), 0)) + return NULL; return ClassDef(classname, NULL, NULL, NULL, NULL, s, decorator_seq, LINENO(n), n->n_col_offset, c->c_arena); } @@ -3057,6 +3080,8 @@ classname = NEW_IDENTIFIER(CHILD(n, 1)); if (!classname) return NULL; + if (forbidden_name(classname, CHILD(n, 1), 0)) + return NULL; return ClassDef(classname, call->v.Call.args, call->v.Call.keywords, call->v.Call.starargs, call->v.Call.kwargs, s, From buildbot at python.org Mon Jun 29 02:08:14 2009 From: buildbot at python.org (buildbot at python.org) Date: Mon, 29 Jun 2009 00:08:14 +0000 Subject: [Python-checkins] buildbot failure in x86 osx.5 3.x Message-ID: The Buildbot has detected a new failure of x86 osx.5 3.x. Full details are available at: http://www.python.org/dev/buildbot/all/x86%20osx.5%203.x/builds/1088 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: heller-x86-osx5 Build Reason: Build Source Stamp: [branch branches/py3k] HEAD Blamelist: benjamin.peterson,mark.dickinson,raymond.hettinger BUILD FAILED: failed test Excerpt from the test logfile: make: *** [buildbottest] Abort trap sincerely, -The Buildbot From python-checkins at python.org Mon Jun 29 03:01:51 2009 From: python-checkins at python.org (alexandre.vassalotti) Date: Mon, 29 Jun 2009 01:01:51 -0000 Subject: [Python-checkins] r73665 - python/trunk/Python/sysmodule.c Message-ID: Author: alexandre.vassalotti Date: Mon Jun 29 03:01:51 2009 New Revision: 73665 Log: Update docstrings for sys.getdlopenflags() and sys.setdlopenflags(). Modified: python/trunk/Python/sysmodule.c Modified: python/trunk/Python/sysmodule.c ============================================================================== --- python/trunk/Python/sysmodule.c (original) +++ python/trunk/Python/sysmodule.c Mon Jun 29 03:01:51 2009 @@ -599,12 +599,14 @@ PyDoc_STRVAR(setdlopenflags_doc, "setdlopenflags(n) -> None\n\ \n\ -Set the flags that will be used for dlopen() calls. Among other\n\ -things, this will enable a lazy resolving of symbols when importing\n\ -a module, if called as sys.setdlopenflags(0)\n\ -To share symbols across extension modules, call as\n\ -sys.setdlopenflags(dl.RTLD_NOW|dl.RTLD_GLOBAL)" -); +Set the flags used by the interpreter for dlopen calls, such as when the\n\ +interpreter loads extension modules. Among other things, this will enable\n\ +a lazy resolving of symbols when importing a module, if called as\n\ +sys.setdlopenflags(0). To share symbols across extension modules, call as\n\ +sys.setdlopenflags(ctypes.RTLD_GLOBAL). Symbolic names for the flag modules\n\ +can be either found in the ctypes module, or in the DLFCN module. If DLFCN\n\ +is not available, it can be generated from /usr/include/dlfcn.h using the\n\ +h2py script."); static PyObject * sys_getdlopenflags(PyObject *self, PyObject *args) @@ -618,10 +620,10 @@ PyDoc_STRVAR(getdlopenflags_doc, "getdlopenflags() -> int\n\ \n\ -Return the current value of the flags that are used for dlopen()\n\ -calls. The flag constants are defined in the dl module." -); -#endif +Return the current value of the flags that are used for dlopen calls.\n\ +The flag constants are defined in the ctypes and DLFCN modules."); + +#endif /* HAVE_DLOPEN */ #ifdef USE_MALLOPT /* Link with -lmalloc (or -lmpc) on an SGI */ From python-checkins at python.org Mon Jun 29 03:13:42 2009 From: python-checkins at python.org (alexandre.vassalotti) Date: Mon, 29 Jun 2009 01:13:42 -0000 Subject: [Python-checkins] r73666 - python/branches/py3k/Lib/base64.py Message-ID: Author: alexandre.vassalotti Date: Mon Jun 29 03:13:41 2009 New Revision: 73666 Log: Make b64encode raises properly a TypeError when altchars is not bytes. Modified: python/branches/py3k/Lib/base64.py Modified: python/branches/py3k/Lib/base64.py ============================================================================== --- python/branches/py3k/Lib/base64.py (original) +++ python/branches/py3k/Lib/base64.py Mon Jun 29 03:13:41 2009 @@ -58,8 +58,8 @@ encoded = binascii.b2a_base64(s)[:-1] if altchars is not None: if not isinstance(altchars, bytes_types): - altchars = TypeError("expected bytes, not %s" - % altchars.__class__.__name__) + raise TypeError("expected bytes, not %s" + % altchars.__class__.__name__) assert len(altchars) == 2, repr(altchars) return _translate(encoded, {'+': altchars[0:1], '/': altchars[1:2]}) return encoded From buildbot at python.org Mon Jun 29 03:38:08 2009 From: buildbot at python.org (buildbot at python.org) Date: Mon, 29 Jun 2009 01:38:08 +0000 Subject: [Python-checkins] buildbot failure in amd64 gentoo 3.x Message-ID: The Buildbot has detected a new failure of amd64 gentoo 3.x. Full details are available at: http://www.python.org/dev/buildbot/all/amd64%20gentoo%203.x/builds/870 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: norwitz-amd64 Build Reason: Build Source Stamp: [branch branches/py3k] HEAD Blamelist: alexandre.vassalotti BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_sax make: *** [buildbottest] Error 1 sincerely, -The Buildbot From python-checkins at python.org Mon Jun 29 03:50:52 2009 From: python-checkins at python.org (raymond.hettinger) Date: Mon, 29 Jun 2009 01:50:52 -0000 Subject: [Python-checkins] r73667 - python/branches/release31-maint/Doc/tutorial/floatingpoint.rst Message-ID: Author: raymond.hettinger Date: Mon Jun 29 03:50:51 2009 New Revision: 73667 Log: Clean-up floating point tutorial Modified: python/branches/release31-maint/Doc/tutorial/floatingpoint.rst Modified: python/branches/release31-maint/Doc/tutorial/floatingpoint.rst ============================================================================== --- python/branches/release31-maint/Doc/tutorial/floatingpoint.rst (original) +++ python/branches/release31-maint/Doc/tutorial/floatingpoint.rst Mon Jun 29 03:50:51 2009 @@ -50,7 +50,7 @@ Stop at any finite number of bits, and you get an approximation. On most machines today, floats are approximated using a binary fraction with -the numerator using the first 53 bits following the most significant bit and +the numerator using the first 53 bits starting with the most significant bit and with the denominator as a power of two. In the case of 1/10, the binary fraction is ``3602879701896397 / 2 ** 55`` which is close to but not exactly equal to the true value of 1/10. @@ -230,12 +230,8 @@ and recalling that *J* has exactly 53 bits (is ``>= 2**52`` but ``< 2**53``), the best value for *N* is 56:: - >>> 2**52 - 4503599627370496 - >>> 2**53 - 9007199254740992 - >>> 2**56/10 - 7205759403792794.0 + >>> 2**52 <= 2**56 // 10 < 2**53 + True That is, 56 is the only value for *N* that leaves *J* with exactly 53 bits. The best possible value for *J* is then that quotient rounded:: @@ -250,14 +246,13 @@ >>> q+1 7205759403792794 -Therefore the best possible approximation to 1/10 in 754 double precision is -that over 2\*\*56, or :: +Therefore the best possible approximation to 1/10 in 754 double precision is:: - 7205759403792794 / 72057594037927936 + 7205759403792794 / 2 ** 56 Dividing both the numerator and denominator by two reduces the fraction to:: - 3602879701896397 / 36028797018963968 + 3602879701896397 / 2 ** 55 Note that since we rounded up, this is actually a little bit larger than 1/10; if we had not rounded up, the quotient would have been a little bit smaller than @@ -269,24 +264,34 @@ >>> 0.1 * 2 ** 55 3602879701896397.0 -If we multiply that fraction by 10\*\*60, we can see the value of out to -60 decimal digits:: +If we multiply that fraction by 10\*\*55, we can see the value out to +55 decimal digits:: - >>> 3602879701896397 * 10 ** 60 // 2 ** 55 + >>> 3602879701896397 * 10 ** 55 // 2 ** 55 1000000000000000055511151231257827021181583404541015625 -meaning that the exact number stored in the computer is approximately equal to -the decimal value 0.100000000000000005551115123125. Rounding that to 17 -significant digits gives the 0.10000000000000001 that Python displays (well, -will display on any 754-conforming platform that does best-possible input and -output conversions in its C library --- yours may not!). +meaning that the exact number stored in the computer is equal to +the decimal value 0.1000000000000000055511151231257827021181583404541015625. +Instead of displaying the full decimal value, many languages (including +older versions of Python), round the result to 17 significant digits:: + + >>> format(0.1, '.17f') + '0.10000000000000001' The :mod:`fractions` and :mod:`decimal` modules make these calculations easy:: >>> from decimal import Decimal >>> from fractions import Fraction - >>> print(Fraction.from_float(0.1)) - 3602879701896397/36028797018963968 - >>> print(Decimal.from_float(0.1)) - 0.1000000000000000055511151231257827021181583404541015625 + + >>> Fraction.from_float(0.1) + Fraction(3602879701896397, 36028797018963968) + + >>> (0.1).as_integer_ratio() + (3602879701896397, 36028797018963968) + + >>> Decimal.from_float(0.1) + Decimal('0.1000000000000000055511151231257827021181583404541015625') + + >>> format(Decimal.from_float(0.1), '.17') + '0.10000000000000001' From python-checkins at python.org Mon Jun 29 05:30:56 2009 From: python-checkins at python.org (benjamin.peterson) Date: Mon, 29 Jun 2009 03:30:56 -0000 Subject: [Python-checkins] r73669 - in python/trunk/Doc: Makefile make.bat Message-ID: Author: benjamin.peterson Date: Mon Jun 29 05:30:55 2009 New Revision: 73669 Log: update to sphinx 0.6.2 Modified: python/trunk/Doc/Makefile python/trunk/Doc/make.bat Modified: python/trunk/Doc/Makefile ============================================================================== --- python/trunk/Doc/Makefile (original) +++ python/trunk/Doc/Makefile Mon Jun 29 05:30:55 2009 @@ -32,7 +32,7 @@ checkout: @if [ ! -d tools/sphinx ]; then \ echo "Checking out Sphinx..."; \ - svn checkout $(SVNROOT)/external/Sphinx-0.6.1/sphinx tools/sphinx; \ + svn checkout $(SVNROOT)/external/Sphinx-0.6.2/sphinx tools/sphinx; \ fi @if [ ! -d tools/docutils ]; then \ echo "Checking out Docutils..."; \ Modified: python/trunk/Doc/make.bat ============================================================================== --- python/trunk/Doc/make.bat (original) +++ python/trunk/Doc/make.bat Mon Jun 29 05:30:55 2009 @@ -34,7 +34,7 @@ goto end :checkout -svn co %SVNROOT%/external/Sphinx-0.6.1/sphinx tools/sphinx +svn co %SVNROOT%/external/Sphinx-0.6.2/sphinx tools/sphinx svn co %SVNROOT%/external/docutils-0.5/docutils tools/docutils svn co %SVNROOT%/external/Jinja-2.1.1/jinja2 tools/jinja2 svn co %SVNROOT%/external/Pygments-0.11.1/pygments tools/pygments From python-checkins at python.org Mon Jun 29 05:33:11 2009 From: python-checkins at python.org (benjamin.peterson) Date: Mon, 29 Jun 2009 03:33:11 -0000 Subject: [Python-checkins] r73670 - in python/branches/release26-maint: Doc/Makefile Doc/make.bat Message-ID: Author: benjamin.peterson Date: Mon Jun 29 05:33:11 2009 New Revision: 73670 Log: Merged revisions 73669 via svnmerge from svn+ssh://pythondev at svn.python.org/python/trunk ........ r73669 | benjamin.peterson | 2009-06-28 22:30:55 -0500 (Sun, 28 Jun 2009) | 1 line update to sphinx 0.6.2 ........ Modified: python/branches/release26-maint/ (props changed) python/branches/release26-maint/Doc/Makefile python/branches/release26-maint/Doc/make.bat Modified: python/branches/release26-maint/Doc/Makefile ============================================================================== --- python/branches/release26-maint/Doc/Makefile (original) +++ python/branches/release26-maint/Doc/Makefile Mon Jun 29 05:33:11 2009 @@ -32,7 +32,7 @@ checkout: @if [ ! -d tools/sphinx ]; then \ echo "Checking out Sphinx..."; \ - svn checkout $(SVNROOT)/external/Sphinx-0.6.1/sphinx tools/sphinx; \ + svn checkout $(SVNROOT)/external/Sphinx-0.6.2/sphinx tools/sphinx; \ fi @if [ ! -d tools/docutils ]; then \ echo "Checking out Docutils..."; \ Modified: python/branches/release26-maint/Doc/make.bat ============================================================================== --- python/branches/release26-maint/Doc/make.bat (original) +++ python/branches/release26-maint/Doc/make.bat Mon Jun 29 05:33:11 2009 @@ -34,7 +34,7 @@ goto end :checkout -svn co %SVNROOT%/external/Sphinx-0.6.1/sphinx tools/sphinx +svn co %SVNROOT%/external/Sphinx-0.6.2/sphinx tools/sphinx svn co %SVNROOT%/external/docutils-0.5/docutils tools/docutils svn co %SVNROOT%/external/Jinja-2.1.1/jinja2 tools/jinja2 svn co %SVNROOT%/external/Pygments-0.11.1/pygments tools/pygments From buildbot at python.org Mon Jun 29 05:33:58 2009 From: buildbot at python.org (buildbot at python.org) Date: Mon, 29 Jun 2009 03:33:58 +0000 Subject: [Python-checkins] buildbot failure in x86 XP-4 trunk Message-ID: The Buildbot has detected a new failure of x86 XP-4 trunk. Full details are available at: http://www.python.org/dev/buildbot/all/x86%20XP-4%20trunk/builds/2279 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: bolen-windows Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: benjamin.peterson BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_bsddb3 ====================================================================== FAIL: test01_basic_replication (bsddb.test.test_replication.DBBaseReplication) ---------------------------------------------------------------------- Traceback (most recent call last): File "E:\cygwin\home\db3l\buildarea\trunk.bolen-windows\build\lib\bsddb\test\test_replication.py", line 315, in test01_basic_replication self.assertTrue(time.time() Author: benjamin.peterson Date: Mon Jun 29 05:37:21 2009 New Revision: 73671 Log: Merged revisions 73669 via svnmerge from svn+ssh://pythondev at svn.python.org/python/trunk ........ r73669 | benjamin.peterson | 2009-06-28 22:30:55 -0500 (Sun, 28 Jun 2009) | 1 line update to sphinx 0.6.2 ........ Modified: python/branches/py3k/ (props changed) python/branches/py3k/Doc/Makefile python/branches/py3k/Doc/make.bat Modified: python/branches/py3k/Doc/Makefile ============================================================================== --- python/branches/py3k/Doc/Makefile (original) +++ python/branches/py3k/Doc/Makefile Mon Jun 29 05:37:21 2009 @@ -32,7 +32,7 @@ checkout: @if [ ! -d tools/sphinx ]; then \ echo "Checking out Sphinx..."; \ - svn checkout $(SVNROOT)/external/Sphinx-0.6.1/sphinx tools/sphinx; \ + svn checkout $(SVNROOT)/external/Sphinx-0.6.2/sphinx tools/sphinx; \ fi @if [ ! -d tools/docutils ]; then \ echo "Checking out Docutils..."; \ Modified: python/branches/py3k/Doc/make.bat ============================================================================== --- python/branches/py3k/Doc/make.bat (original) +++ python/branches/py3k/Doc/make.bat Mon Jun 29 05:37:21 2009 @@ -34,7 +34,7 @@ goto end :checkout -svn co %SVNROOT%/external/Sphinx-0.6.1/sphinx tools/sphinx +svn co %SVNROOT%/external/Sphinx-0.6.2/sphinx tools/sphinx svn co %SVNROOT%/external/docutils-0.5/docutils tools/docutils svn co %SVNROOT%/external/Jinja-2.1.1/jinja2 tools/jinja2 svn co %SVNROOT%/external/Pygments-0.11.1/pygments tools/pygments From buildbot at python.org Mon Jun 29 05:37:39 2009 From: buildbot at python.org (buildbot at python.org) Date: Mon, 29 Jun 2009 03:37:39 +0000 Subject: [Python-checkins] buildbot failure in sparc solaris10 gcc 3.x Message-ID: The Buildbot has detected a new failure of sparc solaris10 gcc 3.x. Full details are available at: http://www.python.org/dev/buildbot/all/sparc%20solaris10%20gcc%203.x/builds/874 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: loewis-sun Build Reason: Build Source Stamp: [branch branches/py3k] HEAD Blamelist: benjamin.peterson,mark.dickinson,raymond.hettinger BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_posix ====================================================================== ERROR: test_getcwd_long_pathnames (test.test_posix.PosixTester) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home2/buildbot/slave/3.x.loewis-sun/build/Lib/test/test_posix.py", line 251, in test_getcwd_long_pathnames support.rmtree(base_path) File "/home2/buildbot/slave/3.x.loewis-sun/build/Lib/test/support.py", line 181, in rmtree shutil.rmtree(path) File "/home2/buildbot/slave/3.x.loewis-sun/build/Lib/shutil.py", line 239, in rmtree onerror(os.rmdir, path, sys.exc_info()) File "/home2/buildbot/slave/3.x.loewis-sun/build/Lib/shutil.py", line 237, in rmtree os.rmdir(path) OSError: [Errno 22] Invalid argument: '/home2/buildbot/slave/3.x.loewis-sun/build/@test.getcwd/@test.getcwd' sincerely, -The Buildbot From python-checkins at python.org Mon Jun 29 05:46:43 2009 From: python-checkins at python.org (benjamin.peterson) Date: Mon, 29 Jun 2009 03:46:43 -0000 Subject: [Python-checkins] r73672 - in python/branches/release31-maint: Doc/Makefile Doc/make.bat Message-ID: Author: benjamin.peterson Date: Mon Jun 29 05:46:42 2009 New Revision: 73672 Log: Merged revisions 73671 via svnmerge from svn+ssh://pythondev at svn.python.org/python/branches/py3k ................ r73671 | benjamin.peterson | 2009-06-28 22:37:21 -0500 (Sun, 28 Jun 2009) | 9 lines Merged revisions 73669 via svnmerge from svn+ssh://pythondev at svn.python.org/python/trunk ........ r73669 | benjamin.peterson | 2009-06-28 22:30:55 -0500 (Sun, 28 Jun 2009) | 1 line update to sphinx 0.6.2 ........ ................ Modified: python/branches/release31-maint/ (props changed) python/branches/release31-maint/Doc/Makefile python/branches/release31-maint/Doc/make.bat Modified: python/branches/release31-maint/Doc/Makefile ============================================================================== --- python/branches/release31-maint/Doc/Makefile (original) +++ python/branches/release31-maint/Doc/Makefile Mon Jun 29 05:46:42 2009 @@ -32,7 +32,7 @@ checkout: @if [ ! -d tools/sphinx ]; then \ echo "Checking out Sphinx..."; \ - svn checkout $(SVNROOT)/external/Sphinx-0.6.1/sphinx tools/sphinx; \ + svn checkout $(SVNROOT)/external/Sphinx-0.6.2/sphinx tools/sphinx; \ fi @if [ ! -d tools/docutils ]; then \ echo "Checking out Docutils..."; \ Modified: python/branches/release31-maint/Doc/make.bat ============================================================================== --- python/branches/release31-maint/Doc/make.bat (original) +++ python/branches/release31-maint/Doc/make.bat Mon Jun 29 05:46:42 2009 @@ -34,7 +34,7 @@ goto end :checkout -svn co %SVNROOT%/external/Sphinx-0.6.1/sphinx tools/sphinx +svn co %SVNROOT%/external/Sphinx-0.6.2/sphinx tools/sphinx svn co %SVNROOT%/external/docutils-0.5/docutils tools/docutils svn co %SVNROOT%/external/Jinja-2.1.1/jinja2 tools/jinja2 svn co %SVNROOT%/external/Pygments-0.11.1/pygments tools/pygments From python-checkins at python.org Mon Jun 29 08:35:26 2009 From: python-checkins at python.org (martin.v.loewis) Date: Mon, 29 Jun 2009 06:35:26 -0000 Subject: [Python-checkins] r73673 - python/branches/py3k/Doc/library/codecs.rst Message-ID: Author: martin.v.loewis Date: Mon Jun 29 08:35:26 2009 New Revision: 73673 Log: Link to PEP 383. Modified: python/branches/py3k/Doc/library/codecs.rst Modified: python/branches/py3k/Doc/library/codecs.rst ============================================================================== --- python/branches/py3k/Doc/library/codecs.rst (original) +++ python/branches/py3k/Doc/library/codecs.rst Mon Jun 29 08:35:26 2009 @@ -322,7 +322,8 @@ | ``'backslashreplace'`` | Replace with backslashed escape sequences | | | (only for encoding). | +-------------------------+-----------------------------------------------+ -| ``'surrogateescape'`` | Replace byte with surrogate U+DCxx. | +| ``'surrogateescape'`` | Replace byte with surrogate U+DCxx, as defined| +| | in :pep:`383`. | +-------------------------+-----------------------------------------------+ In addition, the following error handlers are specific to a single codec: From python-checkins at python.org Mon Jun 29 08:36:33 2009 From: python-checkins at python.org (martin.v.loewis) Date: Mon, 29 Jun 2009 06:36:33 -0000 Subject: [Python-checkins] r73674 - in python/branches/release31-maint: Doc/library/codecs.rst Message-ID: Author: martin.v.loewis Date: Mon Jun 29 08:36:33 2009 New Revision: 73674 Log: Merged revisions 73673 via svnmerge from svn+ssh://pythondev at svn.python.org/python/branches/py3k ........ r73673 | martin.v.loewis | 2009-06-29 08:35:26 +0200 (Mo, 29 Jun 2009) | 2 lines Link to PEP 383. ........ Modified: python/branches/release31-maint/ (props changed) python/branches/release31-maint/Doc/library/codecs.rst Modified: python/branches/release31-maint/Doc/library/codecs.rst ============================================================================== --- python/branches/release31-maint/Doc/library/codecs.rst (original) +++ python/branches/release31-maint/Doc/library/codecs.rst Mon Jun 29 08:36:33 2009 @@ -322,7 +322,8 @@ | ``'backslashreplace'`` | Replace with backslashed escape sequences | | | (only for encoding). | +-------------------------+-----------------------------------------------+ -| ``'surrogateescape'`` | Replace byte with surrogate U+DCxx. | +| ``'surrogateescape'`` | Replace byte with surrogate U+DCxx, as defined| +| | in :pep:`383`. | +-------------------------+-----------------------------------------------+ In addition, the following error handlers are specific to a single codec: From buildbot at python.org Mon Jun 29 08:39:03 2009 From: buildbot at python.org (buildbot at python.org) Date: Mon, 29 Jun 2009 06:39:03 +0000 Subject: [Python-checkins] buildbot failure in sparc solaris10 gcc 3.x Message-ID: The Buildbot has detected a new failure of sparc solaris10 gcc 3.x. Full details are available at: http://www.python.org/dev/buildbot/all/sparc%20solaris10%20gcc%203.x/builds/876 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: loewis-sun Build Reason: Build Source Stamp: [branch branches/py3k] HEAD Blamelist: benjamin.peterson BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_posix ====================================================================== ERROR: test_getcwd_long_pathnames (test.test_posix.PosixTester) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home2/buildbot/slave/3.x.loewis-sun/build/Lib/test/test_posix.py", line 251, in test_getcwd_long_pathnames support.rmtree(base_path) File "/home2/buildbot/slave/3.x.loewis-sun/build/Lib/test/support.py", line 181, in rmtree shutil.rmtree(path) File "/home2/buildbot/slave/3.x.loewis-sun/build/Lib/shutil.py", line 239, in rmtree onerror(os.rmdir, path, sys.exc_info()) File "/home2/buildbot/slave/3.x.loewis-sun/build/Lib/shutil.py", line 237, in rmtree os.rmdir(path) OSError: [Errno 22] Invalid argument: '/home2/buildbot/slave/3.x.loewis-sun/build/@test.getcwd/@test.getcwd' sincerely, -The Buildbot From python-checkins at python.org Mon Jun 29 13:27:03 2009 From: python-checkins at python.org (hirokazu.yamamoto) Date: Mon, 29 Jun 2009 11:27:03 -0000 Subject: [Python-checkins] r73675 - python/trunk/Modules/posixmodule.c Message-ID: Author: hirokazu.yamamoto Date: Mon Jun 29 13:27:03 2009 New Revision: 73675 Log: Issue #4856: Py_GetFileAttributesEx[AW] are not needed because GetFileAttributesEx[AW] won't fail with ERROR_CALL_NOT_IMPLEMENTED on win NT. Reviewed by Amaury Forgeot d'Arc. Modified: python/trunk/Modules/posixmodule.c Modified: python/trunk/Modules/posixmodule.c ============================================================================== --- python/trunk/Modules/posixmodule.c (original) +++ python/trunk/Modules/posixmodule.c Mon Jun 29 13:27:03 2009 @@ -959,68 +959,13 @@ return TRUE; } -static BOOL WINAPI -Py_GetFileAttributesExA(LPCSTR pszFile, - GET_FILEEX_INFO_LEVELS level, - LPVOID pv) -{ - BOOL result; - LPWIN32_FILE_ATTRIBUTE_DATA pfad = pv; - /* First try to use the system's implementation, if that is - available and either succeeds to gives an error other than - that it isn't implemented. */ - result = GetFileAttributesExA(pszFile, level, pv); - if (result || GetLastError() != ERROR_CALL_NOT_IMPLEMENTED) - return result; - /* It's either not present, or not implemented. - Emulate using FindFirstFile. */ - if (level != GetFileExInfoStandard) { - SetLastError(ERROR_INVALID_PARAMETER); - return FALSE; - } - /* Use GetFileAttributes to validate that the file name - does not contain wildcards (which FindFirstFile would - accept). */ - if (GetFileAttributesA(pszFile) == 0xFFFFFFFF) - return FALSE; - return attributes_from_dir(pszFile, pfad); -} - -static BOOL WINAPI -Py_GetFileAttributesExW(LPCWSTR pszFile, - GET_FILEEX_INFO_LEVELS level, - LPVOID pv) -{ - BOOL result; - LPWIN32_FILE_ATTRIBUTE_DATA pfad = pv; - /* First try to use the system's implementation, if that is - available and either succeeds to gives an error other than - that it isn't implemented. */ - result = GetFileAttributesExW(pszFile, level, pv); - if (result || GetLastError() != ERROR_CALL_NOT_IMPLEMENTED) - return result; - /* It's either not present, or not implemented. - Emulate using FindFirstFile. */ - if (level != GetFileExInfoStandard) { - SetLastError(ERROR_INVALID_PARAMETER); - return FALSE; - } - /* Use GetFileAttributes to validate that the file name - does not contain wildcards (which FindFirstFile would - accept). */ - if (GetFileAttributesW(pszFile) == 0xFFFFFFFF) - return FALSE; - return attributes_from_dir_w(pszFile, pfad); -} - static int win32_stat(const char* path, struct win32_stat *result) { WIN32_FILE_ATTRIBUTE_DATA info; int code; char *dot; - /* XXX not supported on Win95 and NT 3.x */ - if (!Py_GetFileAttributesExA(path, GetFileExInfoStandard, &info)) { + if (!GetFileAttributesExA(path, GetFileExInfoStandard, &info)) { if (GetLastError() != ERROR_SHARING_VIOLATION) { /* Protocol violation: we explicitly clear errno, instead of setting it to a POSIX error. Callers should use GetLastError. */ @@ -1057,8 +1002,7 @@ int code; const wchar_t *dot; WIN32_FILE_ATTRIBUTE_DATA info; - /* XXX not supported on Win95 and NT 3.x */ - if (!Py_GetFileAttributesExW(path, GetFileExInfoStandard, &info)) { + if (!GetFileAttributesExW(path, GetFileExInfoStandard, &info)) { if (GetLastError() != ERROR_SHARING_VIOLATION) { /* Protocol violation: we explicitly clear errno, instead of setting it to a POSIX error. Callers should use GetLastError. */ From python-checkins at python.org Mon Jun 29 13:37:19 2009 From: python-checkins at python.org (hirokazu.yamamoto) Date: Mon, 29 Jun 2009 11:37:19 -0000 Subject: [Python-checkins] r73676 - in python/branches/py3k: Modules/posixmodule.c Message-ID: Author: hirokazu.yamamoto Date: Mon Jun 29 13:37:19 2009 New Revision: 73676 Log: Merged revisions 73675 via svnmerge from svn+ssh://pythondev at svn.python.org/python/trunk ........ r73675 | hirokazu.yamamoto | 2009-06-29 20:27:03 +0900 | 3 lines Issue #4856: Py_GetFileAttributesEx[AW] are not needed because GetFileAttributesEx[AW] won't fail with ERROR_CALL_NOT_IMPLEMENTED on win NT. Reviewed by Amaury Forgeot d'Arc. ........ Modified: python/branches/py3k/ (props changed) python/branches/py3k/Modules/posixmodule.c Modified: python/branches/py3k/Modules/posixmodule.c ============================================================================== --- python/branches/py3k/Modules/posixmodule.c (original) +++ python/branches/py3k/Modules/posixmodule.c Mon Jun 29 13:37:19 2009 @@ -1024,68 +1024,13 @@ return TRUE; } -static BOOL WINAPI -Py_GetFileAttributesExA(LPCSTR pszFile, - GET_FILEEX_INFO_LEVELS level, - LPVOID pv) -{ - BOOL result; - LPWIN32_FILE_ATTRIBUTE_DATA pfad = pv; - /* First try to use the system's implementation, if that is - available and either succeeds to gives an error other than - that it isn't implemented. */ - result = GetFileAttributesExA(pszFile, level, pv); - if (result || GetLastError() != ERROR_CALL_NOT_IMPLEMENTED) - return result; - /* It's either not present, or not implemented. - Emulate using FindFirstFile. */ - if (level != GetFileExInfoStandard) { - SetLastError(ERROR_INVALID_PARAMETER); - return FALSE; - } - /* Use GetFileAttributes to validate that the file name - does not contain wildcards (which FindFirstFile would - accept). */ - if (GetFileAttributesA(pszFile) == 0xFFFFFFFF) - return FALSE; - return attributes_from_dir(pszFile, pfad); -} - -static BOOL WINAPI -Py_GetFileAttributesExW(LPCWSTR pszFile, - GET_FILEEX_INFO_LEVELS level, - LPVOID pv) -{ - BOOL result; - LPWIN32_FILE_ATTRIBUTE_DATA pfad = pv; - /* First try to use the system's implementation, if that is - available and either succeeds to gives an error other than - that it isn't implemented. */ - result = GetFileAttributesExW(pszFile, level, pv); - if (result || GetLastError() != ERROR_CALL_NOT_IMPLEMENTED) - return result; - /* It's either not present, or not implemented. - Emulate using FindFirstFile. */ - if (level != GetFileExInfoStandard) { - SetLastError(ERROR_INVALID_PARAMETER); - return FALSE; - } - /* Use GetFileAttributes to validate that the file name - does not contain wildcards (which FindFirstFile would - accept). */ - if (GetFileAttributesW(pszFile) == 0xFFFFFFFF) - return FALSE; - return attributes_from_dir_w(pszFile, pfad); -} - static int win32_stat(const char* path, struct win32_stat *result) { WIN32_FILE_ATTRIBUTE_DATA info; int code; char *dot; - /* XXX not supported on Win95 and NT 3.x */ - if (!Py_GetFileAttributesExA(path, GetFileExInfoStandard, &info)) { + if (!GetFileAttributesExA(path, GetFileExInfoStandard, &info)) { if (GetLastError() != ERROR_SHARING_VIOLATION) { /* Protocol violation: we explicitly clear errno, instead of setting it to a POSIX error. Callers should use GetLastError. */ @@ -1122,8 +1067,7 @@ int code; const wchar_t *dot; WIN32_FILE_ATTRIBUTE_DATA info; - /* XXX not supported on Win95 and NT 3.x */ - if (!Py_GetFileAttributesExW(path, GetFileExInfoStandard, &info)) { + if (!GetFileAttributesExW(path, GetFileExInfoStandard, &info)) { if (GetLastError() != ERROR_SHARING_VIOLATION) { /* Protocol violation: we explicitly clear errno, instead of setting it to a POSIX error. Callers should use GetLastError. */ From python-checkins at python.org Mon Jun 29 15:25:17 2009 From: python-checkins at python.org (hirokazu.yamamoto) Date: Mon, 29 Jun 2009 13:25:17 -0000 Subject: [Python-checkins] r73677 - in python/trunk: Misc/NEWS Modules/mmapmodule.c Message-ID: Author: hirokazu.yamamoto Date: Mon Jun 29 15:25:16 2009 New Revision: 73677 Log: Issue #6344: Fixed a crash of mmap.read() when passed a negative argument. Reviewed by Amaury Forgeot d'Arc. Modified: python/trunk/Misc/NEWS python/trunk/Modules/mmapmodule.c Modified: python/trunk/Misc/NEWS ============================================================================== --- python/trunk/Misc/NEWS (original) +++ python/trunk/Misc/NEWS Mon Jun 29 15:25:16 2009 @@ -12,6 +12,8 @@ Core and Builtins ----------------- +- Issue #6344: Fixed a crash of mmap.read() when passed a negative argument. + - Issue #4856: Remove checks for win NT. - Issue #2016: Fixed a crash in a corner case where the dictionary of keyword Modified: python/trunk/Modules/mmapmodule.c ============================================================================== --- python/trunk/Modules/mmapmodule.c (original) +++ python/trunk/Modules/mmapmodule.c Mon Jun 29 15:25:16 2009 @@ -232,7 +232,7 @@ mmap_read_method(mmap_object *self, PyObject *args) { - Py_ssize_t num_bytes; + Py_ssize_t num_bytes, n; PyObject *result; CHECK_VALID(NULL); @@ -240,8 +240,18 @@ return(NULL); /* silently 'adjust' out-of-range requests */ - if (num_bytes > self->size - self->pos) { - num_bytes -= (self->pos+num_bytes) - self->size; + assert(self->size >= self->pos); + n = self->size - self->pos; + /* The difference can overflow, only if self->size is greater than + * PY_SSIZE_T_MAX. But then the operation cannot possibly succeed, + * because the mapped area and the returned string each need more + * than half of the addressable memory. So we clip the size, and let + * the code below raise MemoryError. + */ + if (n < 0) + n = PY_SSIZE_T_MAX; + if (num_bytes < 0 || num_bytes > n) { + num_bytes = n; } result = Py_BuildValue("s#", self->data+self->pos, num_bytes); self->pos += num_bytes; From python-checkins at python.org Mon Jun 29 15:54:43 2009 From: python-checkins at python.org (antoine.pitrou) Date: Mon, 29 Jun 2009 13:54:43 -0000 Subject: [Python-checkins] r73678 - in python/branches/py3k: Doc/whatsnew/2.7.rst Lib/test/regrtest.py Lib/test/support.py Lib/test/test_parser.py Misc/NEWS Message-ID: Author: antoine.pitrou Date: Mon Jun 29 15:54:42 2009 New Revision: 73678 Log: Merged revisions 73072 via svnmerge from svn+ssh://pythondev at svn.python.org/python/trunk ........ r73072 | antoine.pitrou | 2009-05-31 16:20:14 +0200 (dim., 31 mai 2009) | 4 lines Issue #6152: New option '-j'/'--multiprocess' for regrtest allows running regression tests in parallel, shortening the total runtime. ........ Modified: python/branches/py3k/ (props changed) python/branches/py3k/Doc/whatsnew/2.7.rst python/branches/py3k/Lib/test/regrtest.py python/branches/py3k/Lib/test/support.py python/branches/py3k/Lib/test/test_parser.py python/branches/py3k/Misc/NEWS Modified: python/branches/py3k/Doc/whatsnew/2.7.rst ============================================================================== --- python/branches/py3k/Doc/whatsnew/2.7.rst (original) +++ python/branches/py3k/Doc/whatsnew/2.7.rst Mon Jun 29 15:54:42 2009 @@ -654,6 +654,12 @@ The :option:`-r` option also now reports the seed that was used (Added by Collin Winter.) +* The :file:`regrtest.py` script now takes a :option:`-j` switch + that takes an integer specifying how many tests run in parallel. This + allows to shorten the total runtime on multi-core machines. + This option is compatible with several other options, including the + :option:`-R` switch which is known to produce long runtimes. + (Added by Antoine Pitrou, :issue:`6152`.) .. ====================================================================== Modified: python/branches/py3k/Lib/test/regrtest.py ============================================================================== --- python/branches/py3k/Lib/test/regrtest.py (original) +++ python/branches/py3k/Lib/test/regrtest.py Mon Jun 29 15:54:42 2009 @@ -28,13 +28,12 @@ -R: huntrleaks -- search for reference leaks (needs debug build, v. slow) -M: memlimit -- run very large memory-consuming tests -n: nowindows -- suppress error message boxes on Windows +-j: multiprocess -- run several processes at once If non-option arguments are present, they are names for tests to run, unless -x is given, in which case they are names for tests not to run. If no test names are given, all tests are run. --v is incompatible with -g and does not compare test output files. - -r randomizes test execution order. You can use --randseed=int to provide a int seed value for the randomizer; this is useful for reproducing troublesome test orders. @@ -132,6 +131,7 @@ """ import getopt +import json import os import random import re @@ -189,11 +189,11 @@ sys.exit(2) -def main(tests=None, testdir=None, verbose=0, quiet=False, generate=False, +def main(tests=None, testdir=None, verbose=0, quiet=False, exclude=False, single=False, randomize=False, fromfile=None, findleaks=False, use_resources=None, trace=False, coverdir='coverage', runleaks=False, huntrleaks=False, verbose2=False, print_slow=False, - random_seed=None): + random_seed=None, use_mp=None): """Execute a test suite. This also parses command-line options and modifies its behavior @@ -210,7 +210,7 @@ command-line will be used. If that's empty, too, then all *.py files beginning with test_ will be used. - The other default arguments (verbose, quiet, generate, exclude, + The other default arguments (verbose, quiet, exclude, single, randomize, findleaks, use_resources, trace, coverdir, print_slow, and random_seed) allow programmers calling main() directly to set the values that would normally be set by flags @@ -219,14 +219,14 @@ support.record_original_stdout(sys.stdout) try: - opts, args = getopt.getopt(sys.argv[1:], 'hvgqxsSrf:lu:t:TD:NLR:wM:n', + opts, args = getopt.getopt(sys.argv[1:], 'hvqxsSrf:lu:t:TD:NLR:wM:nj:', ['help', 'verbose', 'quiet', 'exclude', 'single', 'slow', 'random', 'fromfile', 'findleaks', 'use=', 'threshold=', 'trace', 'coverdir=', 'nocoverdir', 'runleaks', 'huntrleaks=', 'verbose2', 'memlimit=', 'debug', 'start=', 'nowindows', - 'randseed=', + 'randseed=', 'multiprocess=', 'slaveargs=', ]) except getopt.error as msg: usage(msg) @@ -330,10 +330,24 @@ for m in [msvcrt.CRT_WARN, msvcrt.CRT_ERROR, msvcrt.CRT_ASSERT]: msvcrt.CrtSetReportMode(m, msvcrt.CRTDBG_MODE_FILE) msvcrt.CrtSetReportFile(m, msvcrt.CRTDBG_FILE_STDERR) - if generate and verbose: - usage("-g and -v don't go together!") + elif o in ('-j', '--multiprocess'): + use_mp = int(a) + elif o == '--slaveargs': + args, kwargs = json.loads(a) + try: + result = runtest(*args, **kwargs) + except BaseException as e: + result = -3, e.__class__.__name__ + sys.stdout.flush() + print() # Force a newline (just in case) + print(json.dumps(result)) + sys.exit(0) if single and fromfile: usage("-s and -f don't go together!") + if use_mp and trace: + usage(2, "-T and -j don't go together!") + if use_mp and findleaks: + usage(2, "-l and -j don't go together!") good = [] bad = [] @@ -409,47 +423,117 @@ support.verbose = verbose # Tell tests to be moderately quiet support.use_resources = use_resources save_modules = sys.modules.keys() - for test in tests: - if not quiet: - print(test) - sys.stdout.flush() - if trace: - # If we're tracing code coverage, then we don't exit with status - # if on a false return value from main. - tracer.runctx('runtest(test, generate, verbose, quiet,' - ' test_times, testdir)', - globals=globals(), locals=vars()) + + def accumulate_result(test, result): + ok, test_time = result + test_times.append((test_time, test)) + if ok > 0: + good.append(test) + elif ok == 0: + bad.append(test) else: + skipped.append(test) + if ok == -2: + resource_denieds.append(test) + + if use_mp: + from threading import Thread, Lock + from queue import Queue, Empty + from subprocess import Popen, PIPE, STDOUT + from collections import deque + # TextIOWrapper is not entirely thread-safe now, + # it can produce duplicate output when printing from several threads. + print_lock = Lock() + debug_output_pat = re.compile(r"\[\d+ refs\]$") + pending = deque() + output = Queue() + for test in tests: + args_tuple = ( + (test, verbose, quiet, testdir), + dict(huntrleaks=huntrleaks, use_resources=use_resources, + debug=debug) + ) + pending.append((test, args_tuple)) + def work(): + # A worker thread. try: - ok = runtest(test, generate, verbose, quiet, test_times, - testdir, huntrleaks) - except KeyboardInterrupt: - # print a newline separate from the ^C - print() - break - except: + while True: + try: + test, args_tuple = pending.popleft() + except IndexError: + output.put((None, None, None)) + return + if not quiet: + with print_lock: + print(test) + sys.stdout.flush() + # -E is needed by some tests, e.g. test_import + popen = Popen([sys.executable, '-E', '-m', 'test.regrtest', + '--slaveargs', json.dumps(args_tuple)], + stdout=PIPE, stderr=STDOUT, + universal_newlines=True, close_fds=True) + out = popen.communicate()[0].strip() + out = debug_output_pat.sub("", out) + out, _, result = out.strip().rpartition("\n") + result = json.loads(result) + output.put((test, out.strip(), result)) + except BaseException: + output.put((None, None, None)) raise - if ok > 0: - good.append(test) - elif ok == 0: - bad.append(test) + workers = [Thread(target=work) for i in range(use_mp)] + for worker in workers: + worker.start() + finished = 0 + while finished < use_mp: + test, out, result = output.get() + if out: + with print_lock: + print(out) + sys.stdout.flush() + if test is None: + finished += 1 + continue + if result[0] == -3: + assert result[1] == 'KeyboardInterrupt' + pending.clear() + raise KeyboardInterrupt # What else? + accumulate_result(test, result) + for worker in workers: + worker.join() + else: + for test in tests: + if not quiet: + print(test) + sys.stdout.flush() + if trace: + # If we're tracing code coverage, then we don't exit with status + # if on a false return value from main. + tracer.runctx('runtest(test, verbose, quiet, testdir)', + globals=globals(), locals=vars()) else: - skipped.append(test) - if ok == -2: - resource_denieds.append(test) - if findleaks: - gc.collect() - if gc.garbage: - print("Warning: test created", len(gc.garbage), end=' ') - print("uncollectable object(s).") - # move the uncollectable objects somewhere so we don't see - # them again - found_garbage.extend(gc.garbage) - del gc.garbage[:] - # Unload the newly imported modules (best effort finalization) - for module in sys.modules.keys(): - if module not in save_modules and module.startswith("test."): - support.unload(module) + try: + result = runtest(test, verbose, quiet, + testdir, huntrleaks, debug) + accumulate_result(test, result) + except KeyboardInterrupt: + # print a newline separate from the ^C + print() + break + except: + raise + if findleaks: + gc.collect() + if gc.garbage: + print("Warning: test created", len(gc.garbage), end=' ') + print("uncollectable object(s).") + # move the uncollectable objects somewhere so we don't see + # them again + found_garbage.extend(gc.garbage) + del gc.garbage[:] + # Unload the newly imported modules (best effort finalization) + for module in sys.modules.keys(): + if module not in save_modules and module.startswith("test."): + support.unload(module) # The lists won't be sorted if running with -r good.sort() @@ -495,8 +579,8 @@ print("Re-running test %r in verbose mode" % test) sys.stdout.flush() try: - support.verbose = True - ok = runtest(test, generate, True, quiet, test_times, testdir, + verbose = True + ok = runtest(test, True, quiet, testdir, huntrleaks, debug) except KeyboardInterrupt: # print a newline separate from the ^C @@ -559,8 +643,8 @@ tests.sort() return stdtests + tests -def runtest(test, generate, verbose, quiet, test_times, - testdir=None, huntrleaks=False, debug=False): +def runtest(test, verbose, quiet, + testdir=None, huntrleaks=False, debug=False, use_resources=None): """Run a single test. test -- the name of the test @@ -579,29 +663,26 @@ 1 test passed """ + support.verbose = verbose # Tell tests to be moderately quiet + if use_resources is not None: + support.use_resources = use_resources try: - return runtest_inner(test, generate, verbose, quiet, test_times, - testdir, huntrleaks) + return runtest_inner(test, verbose, quiet, + testdir, huntrleaks, debug) finally: cleanup_test_droppings(test, verbose) -def runtest_inner(test, generate, verbose, quiet, test_times, +def runtest_inner(test, verbose, quiet, testdir=None, huntrleaks=False, debug=False): support.unload(test) if not testdir: testdir = findtestdir() - if verbose: - cfp = None - else: - cfp = io.StringIO() # XXX Should use io.StringIO() + test_time = 0.0 refleak = False # True if the test leaked references. try: save_stdout = sys.stdout try: - if cfp: - sys.stdout = cfp - print(test) # Output file starts with test name if test.startswith('test.'): abstest = test else: @@ -619,25 +700,24 @@ if huntrleaks: refleak = dash_R(the_module, test, indirect_test, huntrleaks) test_time = time.time() - start_time - test_times.append((test_time, test)) finally: sys.stdout = save_stdout except support.ResourceDenied as msg: if not quiet: print(test, "skipped --", msg) sys.stdout.flush() - return -2 + return -2, test_time except unittest.SkipTest as msg: if not quiet: print(test, "skipped --", msg) sys.stdout.flush() - return -1 + return -1, test_time except KeyboardInterrupt: raise except support.TestFailed as msg: print("test", test, "failed --", msg) sys.stdout.flush() - return 0 + return 0, test_time except: type, value = sys.exc_info()[:2] print("test", test, "crashed --", str(type) + ":", value) @@ -645,21 +725,11 @@ if verbose or debug: traceback.print_exc(file=sys.stdout) sys.stdout.flush() - return 0 + return 0, test_time else: if refleak: - return 0 - if not cfp: - return 1 - output = cfp.getvalue() - expected = test + "\n" - if output == expected or huntrleaks: - return 1 - print("test", test, "produced unexpected output:") - sys.stdout.flush() - reportdiff(expected, output) - sys.stdout.flush() - return 0 + return 0, test_time + return 1, test_time def cleanup_test_droppings(testname, verbose): import shutil @@ -734,6 +804,7 @@ repcount = nwarmup + ntracked print("beginning", repcount, "repetitions", file=sys.stderr) print(("1234567890"*(repcount//10 + 1))[:repcount], file=sys.stderr) + sys.stderr.flush() dash_R_cleanup(fs, ps, pic, abcs) for i in range(repcount): rc = sys.gettotalrefcount() @@ -747,9 +818,10 @@ if any(deltas): msg = '%s leaked %s references, sum=%s' % (test, deltas, sum(deltas)) print(msg, file=sys.stderr) - refrep = open(fname, "a") - print(msg, file=refrep) - refrep.close() + sys.stderr.flush() + with open(fname, "a") as refrep: + print(msg, file=refrep) + refrep.flush() return True return False @@ -805,48 +877,6 @@ for i in range(256): s[i:i+1] -def reportdiff(expected, output): - import difflib - print("*" * 70) - a = expected.splitlines(1) - b = output.splitlines(1) - sm = difflib.SequenceMatcher(a=a, b=b) - tuples = sm.get_opcodes() - - def pair(x0, x1): - # x0:x1 are 0-based slice indices; convert to 1-based line indices. - x0 += 1 - if x0 >= x1: - return "line " + str(x0) - else: - return "lines %d-%d" % (x0, x1) - - for op, a0, a1, b0, b1 in tuples: - if op == 'equal': - pass - - elif op == 'delete': - print("***", pair(a0, a1), "of expected output missing:") - for line in a[a0:a1]: - print("-", line, end='') - - elif op == 'replace': - print("*** mismatch between", pair(a0, a1), "of expected", \ - "output and", pair(b0, b1), "of actual output:") - for line in difflib.ndiff(a[a0:a1], b[b0:b1]): - print(line, end='') - - elif op == 'insert': - print("***", pair(b0, b1), "of actual output doesn't appear", \ - "in expected output after line", str(a1)+":") - for line in b[b0:b1]: - print("+", line, end='') - - else: - print("get_opcodes() returned bad tuple?!?!", (op, a0, a1, b0, b1)) - - print("*" * 70) - def findtestdir(): if __name__ == '__main__': file = sys.argv[0] @@ -1217,6 +1247,6 @@ i -= 1 if os.path.abspath(os.path.normpath(sys.path[i])) == mydir: del sys.path[i] - if len(sys.path) == pathlen: + if '--slaveargs' not in sys.argv and len(sys.path) == pathlen: print('Could not find %r in sys.path to remove it' % mydir) main() Modified: python/branches/py3k/Lib/test/support.py ============================================================================== --- python/branches/py3k/Lib/test/support.py (original) +++ python/branches/py3k/Lib/test/support.py Mon Jun 29 15:54:42 2009 @@ -336,34 +336,38 @@ else: TESTFN = '@test' - # Assuming sys.getfilesystemencoding()!=sys.getdefaultencoding() - # TESTFN_UNICODE is a filename that can be encoded using the - # file system encoding, but *not* with the default (ascii) encoding - TESTFN_UNICODE = "@test-\xe0\xf2" - TESTFN_ENCODING = sys.getfilesystemencoding() - # TESTFN_UNICODE_UNENCODEABLE is a filename that should *not* be - # able to be encoded by *either* the default or filesystem encoding. - # This test really only makes sense on Windows NT platforms - # which have special Unicode support in posixmodule. - if (not hasattr(sys, "getwindowsversion") or - sys.getwindowsversion()[3] < 2): # 0=win32s or 1=9x/ME - TESTFN_UNICODE_UNENCODEABLE = None +# Disambiguate TESTFN for parallel testing, while letting it remain a valid +# module name. +TESTFN = "{0}_{1}_tmp".format(TESTFN, os.getpid()) + +# Assuming sys.getfilesystemencoding()!=sys.getdefaultencoding() +# TESTFN_UNICODE is a filename that can be encoded using the +# file system encoding, but *not* with the default (ascii) encoding +TESTFN_UNICODE = TESTFN + "-\xe0\xf2" +TESTFN_ENCODING = sys.getfilesystemencoding() +# TESTFN_UNICODE_UNENCODEABLE is a filename that should *not* be +# able to be encoded by *either* the default or filesystem encoding. +# This test really only makes sense on Windows NT platforms +# which have special Unicode support in posixmodule. +if (not hasattr(sys, "getwindowsversion") or + sys.getwindowsversion()[3] < 2): # 0=win32s or 1=9x/ME + TESTFN_UNICODE_UNENCODEABLE = None +else: + # Japanese characters (I think - from bug 846133) + TESTFN_UNICODE_UNENCODEABLE = TESTFN + "-\u5171\u6709\u3055\u308c\u308b" + try: + # XXX - Note - should be using TESTFN_ENCODING here - but for + # Windows, "mbcs" currently always operates as if in + # errors=ignore' mode - hence we get '?' characters rather than + # the exception. 'Latin1' operates as we expect - ie, fails. + # See [ 850997 ] mbcs encoding ignores errors + TESTFN_UNICODE_UNENCODEABLE.encode("Latin1") + except UnicodeEncodeError: + pass else: - # Japanese characters (I think - from bug 846133) - TESTFN_UNICODE_UNENCODEABLE = "@test-\u5171\u6709\u3055\u308c\u308b" - try: - # XXX - Note - should be using TESTFN_ENCODING here - but for - # Windows, "mbcs" currently always operates as if in - # errors=ignore' mode - hence we get '?' characters rather than - # the exception. 'Latin1' operates as we expect - ie, fails. - # See [ 850997 ] mbcs encoding ignores errors - TESTFN_UNICODE_UNENCODEABLE.encode("Latin1") - except UnicodeEncodeError: - pass - else: - print('WARNING: The filename %r CAN be encoded by the filesystem. ' - 'Unicode filename tests may not be effective' - % TESTFN_UNICODE_UNENCODEABLE) + print('WARNING: The filename %r CAN be encoded by the filesystem. ' + 'Unicode filename tests may not be effective' + % TESTFN_UNICODE_UNENCODEABLE) # Make sure we can write to TESTFN, try in /tmp if we can't fp = None Modified: python/branches/py3k/Lib/test/test_parser.py ============================================================================== --- python/branches/py3k/Lib/test/test_parser.py (original) +++ python/branches/py3k/Lib/test/test_parser.py Mon Jun 29 15:54:42 2009 @@ -496,6 +496,7 @@ e = self._nested_expression(100) print("Expecting 's_push: parser stack overflow' in next line", file=sys.stderr) + sys.stderr.flush() self.assertRaises(MemoryError, parser.expr, e) class STObjectTestCase(unittest.TestCase): Modified: python/branches/py3k/Misc/NEWS ============================================================================== --- python/branches/py3k/Misc/NEWS (original) +++ python/branches/py3k/Misc/NEWS Mon Jun 29 15:54:42 2009 @@ -1382,6 +1382,9 @@ Tests ----- +- Issue #6152: New option '-j'/'--multiprocess' for regrtest allows running + regression tests in parallel, shortening the total runtime. + - Issue #5450: Moved tests involving loading tk from Lib/test/test_tcl to Lib/tkinter/test/test_tkinter/test_loadtk. With this, these tests demonstrate the same behaviour as test_ttkguionly (and now also test_tk) which is to From python-checkins at python.org Mon Jun 29 16:14:56 2009 From: python-checkins at python.org (antoine.pitrou) Date: Mon, 29 Jun 2009 14:14:56 -0000 Subject: [Python-checkins] r73679 - python/trunk/Lib/test/regrtest.py Message-ID: Author: antoine.pitrou Date: Mon Jun 29 16:14:56 2009 New Revision: 73679 Log: Backport fix for buglet from py3k Modified: python/trunk/Lib/test/regrtest.py Modified: python/trunk/Lib/test/regrtest.py ============================================================================== --- python/trunk/Lib/test/regrtest.py (original) +++ python/trunk/Lib/test/regrtest.py Mon Jun 29 16:14:56 2009 @@ -428,7 +428,8 @@ if not quiet: print test sys.stdout.flush() - popen = Popen([sys.executable, '-m', 'test.regrtest', + # -E is needed by some tests, e.g. test_import + popen = Popen([sys.executable, '-E', '-m', 'test.regrtest', '--slaveargs', json.dumps(args_tuple)], stdout=PIPE, stderr=STDOUT, universal_newlines=True, close_fds=True) From python-checkins at python.org Mon Jun 29 16:17:23 2009 From: python-checkins at python.org (antoine.pitrou) Date: Mon, 29 Jun 2009 14:17:23 -0000 Subject: [Python-checkins] r73680 - python/branches/py3k Message-ID: Author: antoine.pitrou Date: Mon Jun 29 16:17:23 2009 New Revision: 73680 Log: Blocked revisions 73679 via svnmerge ........ r73679 | antoine.pitrou | 2009-06-29 16:14:56 +0200 (lun., 29 juin 2009) | 3 lines Backport fix for buglet from py3k ........ Modified: python/branches/py3k/ (props changed) From buildbot at python.org Mon Jun 29 16:28:21 2009 From: buildbot at python.org (buildbot at python.org) Date: Mon, 29 Jun 2009 14:28:21 +0000 Subject: [Python-checkins] buildbot failure in x86 osx.5 3.x Message-ID: The Buildbot has detected a new failure of x86 osx.5 3.x. Full details are available at: http://www.python.org/dev/buildbot/all/x86%20osx.5%203.x/builds/1093 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: heller-x86-osx5 Build Reason: Build Source Stamp: [branch branches/py3k] HEAD Blamelist: antoine.pitrou BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_binhex ====================================================================== ERROR: test_binhex (test.test_binhex.BinHexTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/test/test_binhex.py", line 32, in test_binhex binhex.hexbin(self.fname2, self.fname1) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/binhex.py", line 445, in hexbin ifp = HexBin(inp) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/binhex.py", line 364, in __init__ self._readheader() File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/binhex.py", line 384, in _readheader rest = self._read(1 + 4 + 4 + 2 + 4 + 4) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/binhex.py", line 367, in _read data = self.ifp.read(len) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/binhex.py", line 300, in read self._fill(wtd - len(self.post_buffer)) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/binhex.py", line 337, in _fill binascii.rledecode_hqx(self.pre_buffer[:mark]) binascii.Error: Orphaned RLE code at start make: *** [buildbottest] Error 1 sincerely, -The Buildbot From python-checkins at python.org Mon Jun 29 16:29:32 2009 From: python-checkins at python.org (hirokazu.yamamoto) Date: Mon, 29 Jun 2009 14:29:32 -0000 Subject: [Python-checkins] r73681 - python/trunk/Misc/NEWS Message-ID: Author: hirokazu.yamamoto Date: Mon Jun 29 16:29:31 2009 New Revision: 73681 Log: Fixed NEWS. Modified: python/trunk/Misc/NEWS Modified: python/trunk/Misc/NEWS ============================================================================== --- python/trunk/Misc/NEWS (original) +++ python/trunk/Misc/NEWS Mon Jun 29 16:29:31 2009 @@ -12,8 +12,6 @@ Core and Builtins ----------------- -- Issue #6344: Fixed a crash of mmap.read() when passed a negative argument. - - Issue #4856: Remove checks for win NT. - Issue #2016: Fixed a crash in a corner case where the dictionary of keyword @@ -339,6 +337,8 @@ Library ------- +- Issue #6344: Fixed a crash of mmap.read() when passed a negative argument. + - Issue #5230: pydoc would report no documentation found if a module generated a 'not found' import error when loaded; it now reports the import errors. Thanks to Lucas Prado Melo for initial fix and collaboration on the tests. From python-checkins at python.org Mon Jun 29 16:37:28 2009 From: python-checkins at python.org (hirokazu.yamamoto) Date: Mon, 29 Jun 2009 14:37:28 -0000 Subject: [Python-checkins] r73682 - in python/branches/release26-maint: Misc/NEWS Modules/mmapmodule.c Message-ID: Author: hirokazu.yamamoto Date: Mon Jun 29 16:37:28 2009 New Revision: 73682 Log: Merged revisions 73677,73681 via svnmerge from svn+ssh://pythondev at svn.python.org/python/trunk ........ r73677 | hirokazu.yamamoto | 2009-06-29 22:25:16 +0900 | 2 lines Issue #6344: Fixed a crash of mmap.read() when passed a negative argument. Reviewed by Amaury Forgeot d'Arc. ........ r73681 | hirokazu.yamamoto | 2009-06-29 23:29:31 +0900 | 1 line Fixed NEWS. ........ Modified: python/branches/release26-maint/ (props changed) python/branches/release26-maint/Misc/NEWS python/branches/release26-maint/Modules/mmapmodule.c Modified: python/branches/release26-maint/Misc/NEWS ============================================================================== --- python/branches/release26-maint/Misc/NEWS (original) +++ python/branches/release26-maint/Misc/NEWS Mon Jun 29 16:37:28 2009 @@ -56,6 +56,8 @@ Library ------- +- Issue #6344: Fixed a crash of mmap.read() when passed a negative argument. + - Issue #5230: pydoc would report no documentation found if a module generated a 'not found' import error when loaded; it now reports the import errors. Thanks to Lucas Prado Melo for initial fix and collaboration on the tests. Modified: python/branches/release26-maint/Modules/mmapmodule.c ============================================================================== --- python/branches/release26-maint/Modules/mmapmodule.c (original) +++ python/branches/release26-maint/Modules/mmapmodule.c Mon Jun 29 16:37:28 2009 @@ -232,7 +232,7 @@ mmap_read_method(mmap_object *self, PyObject *args) { - Py_ssize_t num_bytes; + Py_ssize_t num_bytes, n; PyObject *result; CHECK_VALID(NULL); @@ -240,8 +240,18 @@ return(NULL); /* silently 'adjust' out-of-range requests */ - if (num_bytes > self->size - self->pos) { - num_bytes -= (self->pos+num_bytes) - self->size; + assert(self->size >= self->pos); + n = self->size - self->pos; + /* The difference can overflow, only if self->size is greater than + * PY_SSIZE_T_MAX. But then the operation cannot possibly succeed, + * because the mapped area and the returned string each need more + * than half of the addressable memory. So we clip the size, and let + * the code below raise MemoryError. + */ + if (n < 0) + n = PY_SSIZE_T_MAX; + if (num_bytes < 0 || num_bytes > n) { + num_bytes = n; } result = Py_BuildValue("s#", self->data+self->pos, num_bytes); self->pos += num_bytes; From python-checkins at python.org Mon Jun 29 16:44:49 2009 From: python-checkins at python.org (georg.brandl) Date: Mon, 29 Jun 2009 14:44:49 -0000 Subject: [Python-checkins] r73683 - python/trunk/Python/peephole.c Message-ID: Author: georg.brandl Date: Mon Jun 29 16:44:49 2009 New Revision: 73683 Log: Fix error handling in PyCode_Optimize, by Alexander Schremmer at EuroPython sprint. Modified: python/trunk/Python/peephole.c Modified: python/trunk/Python/peephole.c ============================================================================== --- python/trunk/Python/peephole.c (original) +++ python/trunk/Python/peephole.c Mon Jun 29 16:44:49 2009 @@ -305,7 +305,7 @@ /* Bail out if an exception is set */ if (PyErr_Occurred()) - goto exitUnchanged; + goto exitError; /* Bypass optimization when the lineno table is too complex */ assert(PyString_Check(lineno_obj)); @@ -323,7 +323,7 @@ /* Make a modifiable copy of the code string */ codestr = (unsigned char *)PyMem_Malloc(codelen); if (codestr == NULL) - goto exitUnchanged; + goto exitError; codestr = (unsigned char *)memcpy(codestr, PyString_AS_STRING(code), codelen); @@ -338,11 +338,11 @@ /* Mapping to new jump targets after NOPs are removed */ addrmap = (int *)PyMem_Malloc(codelen * sizeof(int)); if (addrmap == NULL) - goto exitUnchanged; + goto exitError; blocks = markblocks(codestr, codelen); if (blocks == NULL) - goto exitUnchanged; + goto exitError; assert(PyList_Check(consts)); for (i=0 ; i Author: hirokazu.yamamoto Date: Mon Jun 29 16:54:12 2009 New Revision: 73684 Log: Merged revisions 73677,73681 via svnmerge from svn+ssh://pythondev at svn.python.org/python/trunk ........ r73677 | hirokazu.yamamoto | 2009-06-29 22:25:16 +0900 | 2 lines Issue #6344: Fixed a crash of mmap.read() when passed a negative argument. Reviewed by Amaury Forgeot d'Arc. ........ r73681 | hirokazu.yamamoto | 2009-06-29 23:29:31 +0900 | 1 line Fixed NEWS. ........ Modified: python/branches/py3k/ (props changed) python/branches/py3k/Misc/NEWS python/branches/py3k/Modules/mmapmodule.c Modified: python/branches/py3k/Misc/NEWS ============================================================================== --- python/branches/py3k/Misc/NEWS (original) +++ python/branches/py3k/Misc/NEWS Mon Jun 29 16:54:12 2009 @@ -17,6 +17,8 @@ Library ------- +- Issue #6344: Fixed a crash of mmap.read() when passed a negative argument. + - The deprecated function string.maketrans has been removed. Build Modified: python/branches/py3k/Modules/mmapmodule.c ============================================================================== --- python/branches/py3k/Modules/mmapmodule.c (original) +++ python/branches/py3k/Modules/mmapmodule.c Mon Jun 29 16:54:12 2009 @@ -238,7 +238,7 @@ mmap_read_method(mmap_object *self, PyObject *args) { - Py_ssize_t num_bytes; + Py_ssize_t num_bytes, n; PyObject *result; CHECK_VALID(NULL); @@ -246,8 +246,18 @@ return(NULL); /* silently 'adjust' out-of-range requests */ - if (num_bytes > self->size - self->pos) { - num_bytes -= (self->pos+num_bytes) - self->size; + assert(self->size >= self->pos); + n = self->size - self->pos; + /* The difference can overflow, only if self->size is greater than + * PY_SSIZE_T_MAX. But then the operation cannot possibly succeed, + * because the mapped area and the returned string each need more + * than half of the addressable memory. So we clip the size, and let + * the code below raise MemoryError. + */ + if (n < 0) + n = PY_SSIZE_T_MAX; + if (num_bytes < 0 || num_bytes > n) { + num_bytes = n; } result = PyBytes_FromStringAndSize(self->data+self->pos, num_bytes); self->pos += num_bytes; From python-checkins at python.org Mon Jun 29 17:02:36 2009 From: python-checkins at python.org (hirokazu.yamamoto) Date: Mon, 29 Jun 2009 15:02:36 -0000 Subject: [Python-checkins] r73685 - in python/branches/release31-maint: Misc/NEWS Modules/mmapmodule.c Message-ID: Author: hirokazu.yamamoto Date: Mon Jun 29 17:02:36 2009 New Revision: 73685 Log: Merged revisions 73684 via svnmerge from svn+ssh://pythondev at svn.python.org/python/branches/py3k ................ r73684 | hirokazu.yamamoto | 2009-06-29 23:54:12 +0900 | 14 lines Merged revisions 73677,73681 via svnmerge from svn+ssh://pythondev at svn.python.org/python/trunk ........ r73677 | hirokazu.yamamoto | 2009-06-29 22:25:16 +0900 | 2 lines Issue #6344: Fixed a crash of mmap.read() when passed a negative argument. Reviewed by Amaury Forgeot d'Arc. ........ r73681 | hirokazu.yamamoto | 2009-06-29 23:29:31 +0900 | 1 line Fixed NEWS. ........ ................ Modified: python/branches/release31-maint/ (props changed) python/branches/release31-maint/Misc/NEWS python/branches/release31-maint/Modules/mmapmodule.c Modified: python/branches/release31-maint/Misc/NEWS ============================================================================== --- python/branches/release31-maint/Misc/NEWS (original) +++ python/branches/release31-maint/Misc/NEWS Mon Jun 29 17:02:36 2009 @@ -15,6 +15,8 @@ Library ------- +- Issue #6344: Fixed a crash of mmap.read() when passed a negative argument. + Build ----- Modified: python/branches/release31-maint/Modules/mmapmodule.c ============================================================================== --- python/branches/release31-maint/Modules/mmapmodule.c (original) +++ python/branches/release31-maint/Modules/mmapmodule.c Mon Jun 29 17:02:36 2009 @@ -238,7 +238,7 @@ mmap_read_method(mmap_object *self, PyObject *args) { - Py_ssize_t num_bytes; + Py_ssize_t num_bytes, n; PyObject *result; CHECK_VALID(NULL); @@ -246,8 +246,18 @@ return(NULL); /* silently 'adjust' out-of-range requests */ - if (num_bytes > self->size - self->pos) { - num_bytes -= (self->pos+num_bytes) - self->size; + assert(self->size >= self->pos); + n = self->size - self->pos; + /* The difference can overflow, only if self->size is greater than + * PY_SSIZE_T_MAX. But then the operation cannot possibly succeed, + * because the mapped area and the returned string each need more + * than half of the addressable memory. So we clip the size, and let + * the code below raise MemoryError. + */ + if (n < 0) + n = PY_SSIZE_T_MAX; + if (num_bytes < 0 || num_bytes > n) { + num_bytes = n; } result = PyBytes_FromStringAndSize(self->data+self->pos, num_bytes); self->pos += num_bytes; From buildbot at python.org Mon Jun 29 17:16:03 2009 From: buildbot at python.org (buildbot at python.org) Date: Mon, 29 Jun 2009 15:16:03 +0000 Subject: [Python-checkins] buildbot failure in sparc solaris10 gcc 3.x Message-ID: The Buildbot has detected a new failure of sparc solaris10 gcc 3.x. Full details are available at: http://www.python.org/dev/buildbot/all/sparc%20solaris10%20gcc%203.x/builds/878 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: loewis-sun Build Reason: Build Source Stamp: [branch branches/py3k] HEAD Blamelist: antoine.pitrou BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_posix ====================================================================== ERROR: test_getcwd_long_pathnames (test.test_posix.PosixTester) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home2/buildbot/slave/3.x.loewis-sun/build/Lib/test/test_posix.py", line 251, in test_getcwd_long_pathnames support.rmtree(base_path) File "/home2/buildbot/slave/3.x.loewis-sun/build/Lib/test/support.py", line 181, in rmtree shutil.rmtree(path) File "/home2/buildbot/slave/3.x.loewis-sun/build/Lib/shutil.py", line 239, in rmtree onerror(os.rmdir, path, sys.exc_info()) File "/home2/buildbot/slave/3.x.loewis-sun/build/Lib/shutil.py", line 237, in rmtree os.rmdir(path) OSError: [Errno 22] Invalid argument: '/home2/buildbot/slave/3.x.loewis-sun/build/@test_9709_tmp.getcwd/@test_9709_tmp.getcwd' sincerely, -The Buildbot From python-checkins at python.org Mon Jun 29 17:52:21 2009 From: python-checkins at python.org (hirokazu.yamamoto) Date: Mon, 29 Jun 2009 15:52:21 -0000 Subject: [Python-checkins] r73686 - python/trunk/Objects/fileobject.c Message-ID: Author: hirokazu.yamamoto Date: Mon Jun 29 17:52:21 2009 New Revision: 73686 Log: Issue #6368: Fixed unused variable warning on Unix. Modified: python/trunk/Objects/fileobject.c Modified: python/trunk/Objects/fileobject.c ============================================================================== --- python/trunk/Objects/fileobject.c (original) +++ python/trunk/Objects/fileobject.c Mon Jun 29 17:52:21 2009 @@ -2238,7 +2238,9 @@ char *mode = "r"; int bufsize = -1; int wideargument = 0; +#ifdef MS_WINDOWS PyObject *po; +#endif assert(PyFile_Check(self)); if (foself->f_fp != NULL) { From buildbot at python.org Mon Jun 29 17:58:46 2009 From: buildbot at python.org (buildbot at python.org) Date: Mon, 29 Jun 2009 15:58:46 +0000 Subject: [Python-checkins] buildbot failure in x86 XP-4 trunk Message-ID: The Buildbot has detected a new failure of x86 XP-4 trunk. Full details are available at: http://www.python.org/dev/buildbot/all/x86%20XP-4%20trunk/builds/2281 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: bolen-windows Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: benjamin.peterson,hirokazu.yamamoto BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_bsddb3 ====================================================================== FAIL: test01_basic_replication (bsddb.test.test_replication.DBBaseReplication) ---------------------------------------------------------------------- Traceback (most recent call last): File "E:\cygwin\home\db3l\buildarea\trunk.bolen-windows\build\lib\bsddb\test\test_replication.py", line 315, in test01_basic_replication self.assertTrue(time.time() Author: hirokazu.yamamoto Date: Mon Jun 29 18:03:21 2009 New Revision: 73687 Log: Blocked revisions 73686 via svnmerge ........ r73686 | hirokazu.yamamoto | 2009-06-30 00:52:21 +0900 | 1 line Issue #6368: Fixed unused variable warning on Unix. ........ Modified: python/branches/py3k/ (props changed) From python-checkins at python.org Mon Jun 29 18:13:39 2009 From: python-checkins at python.org (tarek.ziade) Date: Mon, 29 Jun 2009 16:13:39 -0000 Subject: [Python-checkins] r73688 - in python/trunk: Lib/distutils/command/build_ext.py Lib/distutils/tests/test_build_ext.py Misc/NEWS Message-ID: Author: tarek.ziade Date: Mon Jun 29 18:13:39 2009 New Revision: 73688 Log: Fixed 6365: wrong inplace location for build_ext if the extension had dots Modified: python/trunk/Lib/distutils/command/build_ext.py python/trunk/Lib/distutils/tests/test_build_ext.py python/trunk/Misc/NEWS Modified: python/trunk/Lib/distutils/command/build_ext.py ============================================================================== --- python/trunk/Lib/distutils/command/build_ext.py (original) +++ python/trunk/Lib/distutils/command/build_ext.py Mon Jun 29 18:13:39 2009 @@ -643,16 +643,16 @@ (inplace option). """ fullname = self.get_ext_fullname(ext_name) - filename = self.get_ext_filename(fullname) + modpath = fullname.split('.') + package = '.'.join(modpath[0:-1]) + base = modpath[-1] + filename = self.get_ext_filename(base) if not self.inplace: # no further work needed return os.path.join(self.build_lib, filename) # the inplace option requires to find the package directory # using the build_py command - modpath = fullname.split('.') - package = '.'.join(modpath[0:-1]) - base = modpath[-1] build_py = self.get_finalized_command('build_py') package_dir = os.path.abspath(build_py.get_package_dir(package)) return os.path.join(package_dir, filename) Modified: python/trunk/Lib/distutils/tests/test_build_ext.py ============================================================================== --- python/trunk/Lib/distutils/tests/test_build_ext.py (original) +++ python/trunk/Lib/distutils/tests/test_build_ext.py Mon Jun 29 18:13:39 2009 @@ -339,10 +339,9 @@ # inplace = 0, cmd.package = 'bar' cmd.package = 'bar' path = cmd.get_ext_fullpath('foo') - # checking that the last directory is bar + # checking that the last directory is the build_dir path = os.path.split(path)[0] - lastdir = os.path.split(path)[-1] - self.assertEquals(lastdir, cmd.package) + self.assertEquals(path, cmd.build_lib) # inplace = 1, cmd.package = 'bar' cmd.inplace = 1 @@ -358,6 +357,19 @@ lastdir = os.path.split(path)[-1] self.assertEquals(lastdir, cmd.package) + def test_build_ext_inplace(self): + etree_c = os.path.join(self.tmp_dir, 'lxml.etree.c') + etree_ext = Extension('lxml.etree', [etree_c]) + dist = Distribution({'name': 'lxml', 'ext_modules': [etree_ext]}) + cmd = build_ext(dist) + cmd.inplace = 1 + cmd.distribution.package_dir = {'': 'src'} + cmd.distribution.packages = ['lxml', 'lxml.html'] + curdir = os.getcwd() + wanted = os.path.join(curdir, 'src', 'lxml', 'etree.so') + path = cmd.get_ext_fullpath('lxml.etree') + self.assertEquals(wanted, path) + def test_suite(): src = _get_source_filename() if not os.path.exists(src): Modified: python/trunk/Misc/NEWS ============================================================================== --- python/trunk/Misc/NEWS (original) +++ python/trunk/Misc/NEWS Mon Jun 29 18:13:39 2009 @@ -337,6 +337,9 @@ Library ------- +- Issue #6365: Distutils build_ext inplace mode was copying the compiled + extension in a subdirectory if the extension name had dots. + - Issue #6344: Fixed a crash of mmap.read() when passed a negative argument. - Issue #5230: pydoc would report no documentation found if a module generated From python-checkins at python.org Mon Jun 29 18:19:22 2009 From: python-checkins at python.org (tarek.ziade) Date: Mon, 29 Jun 2009 16:19:22 -0000 Subject: [Python-checkins] r73689 - in python/branches/py3k: Lib/distutils/command/build_ext.py Lib/distutils/tests/test_build_ext.py Misc/NEWS Message-ID: Author: tarek.ziade Date: Mon Jun 29 18:19:22 2009 New Revision: 73689 Log: Merged revisions 73688 via svnmerge from svn+ssh://pythondev at svn.python.org/python/trunk ........ r73688 | tarek.ziade | 2009-06-29 18:13:39 +0200 (Mon, 29 Jun 2009) | 1 line Fixed 6365: wrong inplace location for build_ext if the extension had dots ........ Modified: python/branches/py3k/ (props changed) python/branches/py3k/Lib/distutils/command/build_ext.py python/branches/py3k/Lib/distutils/tests/test_build_ext.py python/branches/py3k/Misc/NEWS Modified: python/branches/py3k/Lib/distutils/command/build_ext.py ============================================================================== --- python/branches/py3k/Lib/distutils/command/build_ext.py (original) +++ python/branches/py3k/Lib/distutils/command/build_ext.py Mon Jun 29 18:19:22 2009 @@ -630,16 +630,16 @@ (inplace option). """ fullname = self.get_ext_fullname(ext_name) - filename = self.get_ext_filename(fullname) + modpath = fullname.split('.') + package = '.'.join(modpath[0:-1]) + base = modpath[-1] + filename = self.get_ext_filename(base) if not self.inplace: # no further work needed return os.path.join(self.build_lib, filename) # the inplace option requires to find the package directory # using the build_py command - modpath = fullname.split('.') - package = '.'.join(modpath[0:-1]) - base = modpath[-1] build_py = self.get_finalized_command('build_py') package_dir = os.path.abspath(build_py.get_package_dir(package)) return os.path.join(package_dir, filename) Modified: python/branches/py3k/Lib/distutils/tests/test_build_ext.py ============================================================================== --- python/branches/py3k/Lib/distutils/tests/test_build_ext.py (original) +++ python/branches/py3k/Lib/distutils/tests/test_build_ext.py Mon Jun 29 18:19:22 2009 @@ -339,10 +339,9 @@ # inplace = 0, cmd.package = 'bar' cmd.package = 'bar' path = cmd.get_ext_fullpath('foo') - # checking that the last directory is bar + # checking that the last directory is the build_dir path = os.path.split(path)[0] - lastdir = os.path.split(path)[-1] - self.assertEquals(lastdir, cmd.package) + self.assertEquals(path, cmd.build_lib) # inplace = 1, cmd.package = 'bar' cmd.inplace = 1 @@ -358,6 +357,19 @@ lastdir = os.path.split(path)[-1] self.assertEquals(lastdir, cmd.package) + def test_build_ext_inplace(self): + etree_c = os.path.join(self.tmp_dir, 'lxml.etree.c') + etree_ext = Extension('lxml.etree', [etree_c]) + dist = Distribution({'name': 'lxml', 'ext_modules': [etree_ext]}) + cmd = build_ext(dist) + cmd.inplace = 1 + cmd.distribution.package_dir = {'': 'src'} + cmd.distribution.packages = ['lxml', 'lxml.html'] + curdir = os.getcwd() + wanted = os.path.join(curdir, 'src', 'lxml', 'etree.so') + path = cmd.get_ext_fullpath('lxml.etree') + self.assertEquals(wanted, path) + def test_suite(): src = _get_source_filename() if not os.path.exists(src): Modified: python/branches/py3k/Misc/NEWS ============================================================================== --- python/branches/py3k/Misc/NEWS (original) +++ python/branches/py3k/Misc/NEWS Mon Jun 29 18:19:22 2009 @@ -843,6 +843,9 @@ Library ------- +- Issue #6365: Distutils build_ext inplace mode was copying the compiled + extension in a subdirectory if the extension name had dots. + - Issue #6164: Added an AIX specific linker argument in Distutils unixcompiler. Original patch by Sridhar Ratnakumar. From python-checkins at python.org Mon Jun 29 18:21:46 2009 From: python-checkins at python.org (tarek.ziade) Date: Mon, 29 Jun 2009 16:21:46 -0000 Subject: [Python-checkins] r73690 - python/branches/release26-maint Message-ID: Author: tarek.ziade Date: Mon Jun 29 18:21:46 2009 New Revision: 73690 Log: Blocked revisions 73688 via svnmerge ........ r73688 | tarek.ziade | 2009-06-29 18:13:39 +0200 (Mon, 29 Jun 2009) | 1 line Fixed 6365: wrong inplace location for build_ext if the extension had dots ........ Modified: python/branches/release26-maint/ (props changed) From python-checkins at python.org Mon Jun 29 18:23:50 2009 From: python-checkins at python.org (tarek.ziade) Date: Mon, 29 Jun 2009 16:23:50 -0000 Subject: [Python-checkins] r73691 - python/branches/release30-maint Message-ID: Author: tarek.ziade Date: Mon Jun 29 18:23:50 2009 New Revision: 73691 Log: Blocked revisions 73689 via svnmerge ................ r73689 | tarek.ziade | 2009-06-29 18:19:22 +0200 (Mon, 29 Jun 2009) | 9 lines Merged revisions 73688 via svnmerge from svn+ssh://pythondev at svn.python.org/python/trunk ........ r73688 | tarek.ziade | 2009-06-29 18:13:39 +0200 (Mon, 29 Jun 2009) | 1 line Fixed 6365: wrong inplace location for build_ext if the extension had dots ........ ................ Modified: python/branches/release30-maint/ (props changed) From python-checkins at python.org Mon Jun 29 18:46:15 2009 From: python-checkins at python.org (tarek.ziade) Date: Mon, 29 Jun 2009 16:46:15 -0000 Subject: [Python-checkins] r73692 - in python/branches/release31-maint: Lib/distutils/command/build_ext.py Lib/distutils/tests/test_build_ext.py Misc/NEWS Message-ID: Author: tarek.ziade Date: Mon Jun 29 18:46:14 2009 New Revision: 73692 Log: Merged revisions 73689 via svnmerge from svn+ssh://pythondev at svn.python.org/python/branches/py3k ................ r73689 | tarek.ziade | 2009-06-29 18:19:22 +0200 (Mon, 29 Jun 2009) | 9 lines Merged revisions 73688 via svnmerge from svn+ssh://pythondev at svn.python.org/python/trunk ........ r73688 | tarek.ziade | 2009-06-29 18:13:39 +0200 (Mon, 29 Jun 2009) | 1 line Fixed 6365: wrong inplace location for build_ext if the extension had dots ........ ................ Modified: python/branches/release31-maint/ (props changed) python/branches/release31-maint/Lib/distutils/command/build_ext.py python/branches/release31-maint/Lib/distutils/tests/test_build_ext.py python/branches/release31-maint/Misc/NEWS Modified: python/branches/release31-maint/Lib/distutils/command/build_ext.py ============================================================================== --- python/branches/release31-maint/Lib/distutils/command/build_ext.py (original) +++ python/branches/release31-maint/Lib/distutils/command/build_ext.py Mon Jun 29 18:46:14 2009 @@ -630,16 +630,16 @@ (inplace option). """ fullname = self.get_ext_fullname(ext_name) - filename = self.get_ext_filename(fullname) + modpath = fullname.split('.') + package = '.'.join(modpath[0:-1]) + base = modpath[-1] + filename = self.get_ext_filename(base) if not self.inplace: # no further work needed return os.path.join(self.build_lib, filename) # the inplace option requires to find the package directory # using the build_py command - modpath = fullname.split('.') - package = '.'.join(modpath[0:-1]) - base = modpath[-1] build_py = self.get_finalized_command('build_py') package_dir = os.path.abspath(build_py.get_package_dir(package)) return os.path.join(package_dir, filename) Modified: python/branches/release31-maint/Lib/distutils/tests/test_build_ext.py ============================================================================== --- python/branches/release31-maint/Lib/distutils/tests/test_build_ext.py (original) +++ python/branches/release31-maint/Lib/distutils/tests/test_build_ext.py Mon Jun 29 18:46:14 2009 @@ -339,10 +339,9 @@ # inplace = 0, cmd.package = 'bar' cmd.package = 'bar' path = cmd.get_ext_fullpath('foo') - # checking that the last directory is bar + # checking that the last directory is the build_dir path = os.path.split(path)[0] - lastdir = os.path.split(path)[-1] - self.assertEquals(lastdir, cmd.package) + self.assertEquals(path, cmd.build_lib) # inplace = 1, cmd.package = 'bar' cmd.inplace = 1 @@ -358,6 +357,19 @@ lastdir = os.path.split(path)[-1] self.assertEquals(lastdir, cmd.package) + def test_build_ext_inplace(self): + etree_c = os.path.join(self.tmp_dir, 'lxml.etree.c') + etree_ext = Extension('lxml.etree', [etree_c]) + dist = Distribution({'name': 'lxml', 'ext_modules': [etree_ext]}) + cmd = build_ext(dist) + cmd.inplace = 1 + cmd.distribution.package_dir = {'': 'src'} + cmd.distribution.packages = ['lxml', 'lxml.html'] + curdir = os.getcwd() + wanted = os.path.join(curdir, 'src', 'lxml', 'etree.so') + path = cmd.get_ext_fullpath('lxml.etree') + self.assertEquals(wanted, path) + def test_suite(): src = _get_source_filename() if not os.path.exists(src): Modified: python/branches/release31-maint/Misc/NEWS ============================================================================== --- python/branches/release31-maint/Misc/NEWS (original) +++ python/branches/release31-maint/Misc/NEWS Mon Jun 29 18:46:14 2009 @@ -839,6 +839,9 @@ Library ------- +- Issue #6365: Distutils build_ext inplace mode was copying the compiled + extension in a subdirectory if the extension name had dots. + - Issue #6287: Added the license field in Distutils documentation. - Issue #6263: Fixed syntax error in distutils.cygwincompiler. From python-checkins at python.org Mon Jun 29 20:20:34 2009 From: python-checkins at python.org (jesse.noller) Date: Mon, 29 Jun 2009 18:20:34 -0000 Subject: [Python-checkins] r73693 - python/trunk/Doc/library/multiprocessing.rst Message-ID: Author: jesse.noller Date: Mon Jun 29 20:20:34 2009 New Revision: 73693 Log: Bug 5906: add a documentation note for unix daemons vs. multiprocessing daemons Modified: python/trunk/Doc/library/multiprocessing.rst Modified: python/trunk/Doc/library/multiprocessing.rst ============================================================================== --- python/trunk/Doc/library/multiprocessing.rst (original) +++ python/trunk/Doc/library/multiprocessing.rst Mon Jun 29 20:20:34 2009 @@ -374,7 +374,9 @@ Note that a daemonic process is not allowed to create child processes. Otherwise a daemonic process would leave its children orphaned if it gets - terminated when its parent process exits. + terminated when its parent process exits. Additionally, these are **not** + Unix daemons or services, they are normal processes that will be + terminated (and not joined) if non-dameonic processes have exited. In addition to the :class:`Threading.Thread` API, :class:`Process` objects also support the following attributes and methods: From python-checkins at python.org Mon Jun 29 20:24:26 2009 From: python-checkins at python.org (jesse.noller) Date: Mon, 29 Jun 2009 18:24:26 -0000 Subject: [Python-checkins] r73694 - python/trunk/Doc/library/multiprocessing.rst Message-ID: Author: jesse.noller Date: Mon Jun 29 20:24:26 2009 New Revision: 73694 Log: Issue 5740: multiprocessing.connection.* authkey fixes Modified: python/trunk/Doc/library/multiprocessing.rst Modified: python/trunk/Doc/library/multiprocessing.rst ============================================================================== --- python/trunk/Doc/library/multiprocessing.rst (original) +++ python/trunk/Doc/library/multiprocessing.rst Mon Jun 29 20:24:26 2009 @@ -1717,7 +1717,7 @@ generally be omitted since it can usually be inferred from the format of *address*. (See :ref:`multiprocessing-address-formats`) - If *authentication* is ``True`` or *authkey* is a string then digest + If *authenticate* is ``True`` or *authkey* is a string then digest authentication is used. The key used for authentication will be either *authkey* or ``current_process().authkey)`` if *authkey* is ``None``. If authentication fails then :exc:`AuthenticationError` is raised. See @@ -1759,7 +1759,7 @@ If *authkey* is ``None`` and *authenticate* is ``True`` then ``current_process().authkey`` is used as the authentication key. If - *authkey* is ``None`` and *authentication* is ``False`` then no + *authkey* is ``None`` and *authenticate* is ``False`` then no authentication is done. If authentication fails then :exc:`AuthenticationError` is raised. See :ref:`multiprocessing-auth-keys`. From python-checkins at python.org Mon Jun 29 20:30:43 2009 From: python-checkins at python.org (raymond.hettinger) Date: Mon, 29 Jun 2009 18:30:43 -0000 Subject: [Python-checkins] r73695 - python/branches/py3k/Lib/collections.py Message-ID: Author: raymond.hettinger Date: Mon Jun 29 20:30:43 2009 New Revision: 73695 Log: Issue 6370: Performance issue with collections.Counter(). Modified: python/branches/py3k/Lib/collections.py Modified: python/branches/py3k/Lib/collections.py ============================================================================== --- python/branches/py3k/Lib/collections.py (original) +++ python/branches/py3k/Lib/collections.py Mon Jun 29 20:30:43 2009 @@ -421,13 +421,15 @@ if iterable is not None: if isinstance(iterable, Mapping): if self: + self_get = self.get for elem, count in iterable.items(): - self[elem] += count + self[elem] = count + self_get(elem, 0) else: dict.update(self, iterable) # fast path when counter is empty else: + self_get = self.get for elem in iterable: - self[elem] += 1 + self[elem] = 1 + self_get(elem, 0) if kwds: self.update(kwds) From python-checkins at python.org Mon Jun 29 20:34:46 2009 From: python-checkins at python.org (raymond.hettinger) Date: Mon, 29 Jun 2009 18:34:46 -0000 Subject: [Python-checkins] r73696 - python/branches/release31-maint/Lib/collections.py Message-ID: Author: raymond.hettinger Date: Mon Jun 29 20:34:46 2009 New Revision: 73696 Log: Issue 6370: Performance issue with collections.Counter(). Modified: python/branches/release31-maint/Lib/collections.py Modified: python/branches/release31-maint/Lib/collections.py ============================================================================== --- python/branches/release31-maint/Lib/collections.py (original) +++ python/branches/release31-maint/Lib/collections.py Mon Jun 29 20:34:46 2009 @@ -421,13 +421,15 @@ if iterable is not None: if isinstance(iterable, Mapping): if self: + self_get = self.get for elem, count in iterable.items(): - self[elem] += count + self[elem] = count + self_get(elem, 0) else: dict.update(self, iterable) # fast path when counter is empty else: + self_get = self.get for elem in iterable: - self[elem] += 1 + self[elem] = 1 + self_get(elem, 0) if kwds: self.update(kwds) From buildbot at python.org Mon Jun 29 20:56:01 2009 From: buildbot at python.org (buildbot at python.org) Date: Mon, 29 Jun 2009 18:56:01 +0000 Subject: [Python-checkins] buildbot failure in amd64 gentoo 3.x Message-ID: The Buildbot has detected a new failure of amd64 gentoo 3.x. Full details are available at: http://www.python.org/dev/buildbot/all/amd64%20gentoo%203.x/builds/878 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: norwitz-amd64 Build Reason: Build Source Stamp: [branch branches/py3k] HEAD Blamelist: raymond.hettinger BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_binhex ====================================================================== ERROR: test_binhex (test.test_binhex.BinHexTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/buildbot/slave/py-build/3.x.norwitz-amd64/build/Lib/test/test_binhex.py", line 32, in test_binhex binhex.hexbin(self.fname2, self.fname1) File "/home/buildbot/slave/py-build/3.x.norwitz-amd64/build/Lib/binhex.py", line 445, in hexbin ifp = HexBin(inp) File "/home/buildbot/slave/py-build/3.x.norwitz-amd64/build/Lib/binhex.py", line 364, in __init__ self._readheader() File "/home/buildbot/slave/py-build/3.x.norwitz-amd64/build/Lib/binhex.py", line 384, in _readheader rest = self._read(1 + 4 + 4 + 2 + 4 + 4) File "/home/buildbot/slave/py-build/3.x.norwitz-amd64/build/Lib/binhex.py", line 367, in _read data = self.ifp.read(len) File "/home/buildbot/slave/py-build/3.x.norwitz-amd64/build/Lib/binhex.py", line 300, in read self._fill(wtd - len(self.post_buffer)) File "/home/buildbot/slave/py-build/3.x.norwitz-amd64/build/Lib/binhex.py", line 337, in _fill binascii.rledecode_hqx(self.pre_buffer[:mark]) binascii.Error: Orphaned RLE code at start make: *** [buildbottest] Error 1 sincerely, -The Buildbot From python-checkins at python.org Mon Jun 29 21:10:29 2009 From: python-checkins at python.org (raymond.hettinger) Date: Mon, 29 Jun 2009 19:10:29 -0000 Subject: [Python-checkins] r73697 - python/trunk/Lib/collections.py Message-ID: Author: raymond.hettinger Date: Mon Jun 29 21:10:29 2009 New Revision: 73697 Log: Issue 6370: Performance issue with collections.Counter(). Modified: python/trunk/Lib/collections.py Modified: python/trunk/Lib/collections.py ============================================================================== --- python/trunk/Lib/collections.py (original) +++ python/trunk/Lib/collections.py Mon Jun 29 21:10:29 2009 @@ -418,13 +418,15 @@ if iterable is not None: if isinstance(iterable, Mapping): if self: + self_get = self.get for elem, count in iterable.iteritems(): - self[elem] += count + self[elem] = self_get(elem, 0) + count else: dict.update(self, iterable) # fast path when counter is empty else: + self_get = self.get for elem in iterable: - self[elem] += 1 + self[elem] = self_get(elem, 0) + 1 if kwds: self.update(kwds) From buildbot at python.org Mon Jun 29 21:17:47 2009 From: buildbot at python.org (buildbot at python.org) Date: Mon, 29 Jun 2009 19:17:47 +0000 Subject: [Python-checkins] buildbot failure in sparc solaris10 gcc 3.0 Message-ID: The Buildbot has detected a new failure of sparc solaris10 gcc 3.0. Full details are available at: http://www.python.org/dev/buildbot/all/sparc%20solaris10%20gcc%203.0/builds/419 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: loewis-sun Build Reason: Build Source Stamp: [branch branches/release30-maint] HEAD Blamelist: mark.dickinson,tarek.ziade BUILD FAILED: failed test Excerpt from the test logfile: 3 tests failed: test_distutils test_posix test_subprocess ====================================================================== FAIL: test_get_python_inc (distutils.tests.test_sysconfig.SysconfigTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home2/buildbot/slave/3.0.loewis-sun/build/Lib/distutils/tests/test_sysconfig.py", line 54, in test_get_python_inc self.assert_(os.path.isdir(inc_dir), inc_dir) AssertionError: /home2/buildbot/slave/3.0.loewis-sun/build/@test.getcwd/Include ====================================================================== ERROR: test_getcwd_long_pathnames (test.test_posix.PosixTester) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home2/buildbot/slave/3.0.loewis-sun/build/Lib/test/test_posix.py", line 252, in test_getcwd_long_pathnames support.rmtree(base_path) File "/home2/buildbot/slave/3.0.loewis-sun/build/Lib/test/support.py", line 98, in rmtree shutil.rmtree(path) File "/home2/buildbot/slave/3.0.loewis-sun/build/Lib/shutil.py", line 225, in rmtree onerror(os.rmdir, path, sys.exc_info()) File "/home2/buildbot/slave/3.0.loewis-sun/build/Lib/shutil.py", line 223, in rmtree os.rmdir(path) OSError: [Errno 22] Invalid argument: '/home2/buildbot/slave/3.0.loewis-sun/build/@test.getcwd/@test.getcwd' ====================================================================== FAIL: test_executable (test.test_subprocess.ProcessTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home2/buildbot/slave/3.0.loewis-sun/build/Lib/test/test_subprocess.py", line 115, in test_executable self.assertEqual(p.returncode, 47) AssertionError: -6 != 47 sincerely, -The Buildbot From python-checkins at python.org Tue Jun 30 00:36:50 2009 From: python-checkins at python.org (amaury.forgeotdarc) Date: Mon, 29 Jun 2009 22:36:50 -0000 Subject: [Python-checkins] r73698 - in python/branches/py3k: Lib/test/test_codecs.py Misc/NEWS Objects/unicodeobject.c Message-ID: Author: amaury.forgeotdarc Date: Tue Jun 30 00:36:49 2009 New Revision: 73698 Log: #6373: SystemError in str.encode('latin1', 'surrogateescape') if the string contains unpaired surrogates. (In debug build, crash in assert()) This can happen with normal processing, if python starts with utf-8, then calls sys.setfilesystemencoding('latin-1') Modified: python/branches/py3k/Lib/test/test_codecs.py python/branches/py3k/Misc/NEWS python/branches/py3k/Objects/unicodeobject.c Modified: python/branches/py3k/Lib/test/test_codecs.py ============================================================================== --- python/branches/py3k/Lib/test/test_codecs.py (original) +++ python/branches/py3k/Lib/test/test_codecs.py Tue Jun 30 00:36:49 2009 @@ -1549,6 +1549,11 @@ self.assertEqual("foo\udca5bar".encode("iso-8859-3", "surrogateescape"), b"foo\xa5bar") + def test_latin1(self): + # Issue6373 + self.assertEqual("\udce4\udceb\udcef\udcf6\udcfc".encode("latin1", "surrogateescape"), + b"\xe4\xeb\xef\xf6\xfc") + def test_main(): support.run_unittest( Modified: python/branches/py3k/Misc/NEWS ============================================================================== --- python/branches/py3k/Misc/NEWS (original) +++ python/branches/py3k/Misc/NEWS Tue Jun 30 00:36:49 2009 @@ -12,6 +12,10 @@ Core and Builtins ----------------- +- Issue #6373: Fixed a RuntimeError when encoding with the latin-1 codec and + the 'surrogateescape' error handler, a string which contains unpaired + surrogates. + - Issue #4856: Remove checks for win NT. Library Modified: python/branches/py3k/Objects/unicodeobject.c ============================================================================== --- python/branches/py3k/Objects/unicodeobject.c (original) +++ python/branches/py3k/Objects/unicodeobject.c Tue Jun 30 00:36:49 2009 @@ -4201,10 +4201,12 @@ repsize = PyBytes_Size(repunicode); if (repsize > 1) { /* Make room for all additional bytes. */ + respos = str - PyBytes_AS_STRING(res); if (_PyBytes_Resize(&res, ressize+repsize-1)) { Py_DECREF(repunicode); goto onError; } + str = PyBytes_AS_STRING(res) + respos; ressize += repsize-1; } memcpy(str, PyBytes_AsString(repunicode), repsize); From python-checkins at python.org Tue Jun 30 00:38:54 2009 From: python-checkins at python.org (amaury.forgeotdarc) Date: Mon, 29 Jun 2009 22:38:54 -0000 Subject: [Python-checkins] r73699 - in python/branches/release31-maint: Lib/test/test_codecs.py Misc/NEWS Objects/unicodeobject.c Message-ID: Author: amaury.forgeotdarc Date: Tue Jun 30 00:38:54 2009 New Revision: 73699 Log: Merged revisions 73698 via svnmerge from svn+ssh://pythondev at svn.python.org/python/branches/py3k ........ r73698 | amaury.forgeotdarc | 2009-06-30 00:36:49 +0200 (mar., 30 juin 2009) | 7 lines #6373: SystemError in str.encode('latin1', 'surrogateescape') if the string contains unpaired surrogates. (In debug build, crash in assert()) This can happen with normal processing, if python starts with utf-8, then calls sys.setfilesystemencoding('latin-1') ........ Modified: python/branches/release31-maint/ (props changed) python/branches/release31-maint/Lib/test/test_codecs.py python/branches/release31-maint/Misc/NEWS python/branches/release31-maint/Objects/unicodeobject.c Modified: python/branches/release31-maint/Lib/test/test_codecs.py ============================================================================== --- python/branches/release31-maint/Lib/test/test_codecs.py (original) +++ python/branches/release31-maint/Lib/test/test_codecs.py Tue Jun 30 00:38:54 2009 @@ -1549,6 +1549,11 @@ self.assertEqual("foo\udca5bar".encode("iso-8859-3", "surrogateescape"), b"foo\xa5bar") + def test_latin1(self): + # Issue6373 + self.assertEqual("\udce4\udceb\udcef\udcf6\udcfc".encode("latin1", "surrogateescape"), + b"\xe4\xeb\xef\xf6\xfc") + def test_main(): support.run_unittest( Modified: python/branches/release31-maint/Misc/NEWS ============================================================================== --- python/branches/release31-maint/Misc/NEWS (original) +++ python/branches/release31-maint/Misc/NEWS Tue Jun 30 00:38:54 2009 @@ -12,6 +12,10 @@ Core and Builtins ----------------- +- Issue #6373: Fixed a RuntimeError when encoding with the latin-1 codec and + the 'surrogateescape' error handler, a string which contains unpaired + surrogates. + Library ------- Modified: python/branches/release31-maint/Objects/unicodeobject.c ============================================================================== --- python/branches/release31-maint/Objects/unicodeobject.c (original) +++ python/branches/release31-maint/Objects/unicodeobject.c Tue Jun 30 00:38:54 2009 @@ -4201,10 +4201,12 @@ repsize = PyBytes_Size(repunicode); if (repsize > 1) { /* Make room for all additional bytes. */ + respos = str - PyBytes_AS_STRING(res); if (_PyBytes_Resize(&res, ressize+repsize-1)) { Py_DECREF(repunicode); goto onError; } + str = PyBytes_AS_STRING(res) + respos; ressize += repsize-1; } memcpy(str, PyBytes_AsString(repunicode), repsize); From buildbot at python.org Tue Jun 30 01:39:09 2009 From: buildbot at python.org (buildbot at python.org) Date: Mon, 29 Jun 2009 23:39:09 +0000 Subject: [Python-checkins] buildbot failure in x86 FreeBSD 3.x Message-ID: The Buildbot has detected a new failure of x86 FreeBSD 3.x. Full details are available at: http://www.python.org/dev/buildbot/all/x86%20FreeBSD%203.x/builds/873 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: bolen-freebsd Build Reason: Build Source Stamp: [branch branches/py3k] HEAD Blamelist: amaury.forgeotdarc BUILD FAILED: failed test Excerpt from the test logfile: sincerely, -The Buildbot From buildbot at python.org Tue Jun 30 02:03:38 2009 From: buildbot at python.org (buildbot at python.org) Date: Tue, 30 Jun 2009 00:03:38 +0000 Subject: [Python-checkins] buildbot failure in x86 XP-4 3.x Message-ID: The Buildbot has detected a new failure of x86 XP-4 3.x. Full details are available at: http://www.python.org/dev/buildbot/all/x86%20XP-4%203.x/builds/724 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: bolen-windows Build Reason: Build Source Stamp: [branch branches/py3k] HEAD Blamelist: amaury.forgeotdarc BUILD FAILED: failed test Excerpt from the test logfile: Traceback (most recent call last): File "E:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\test\test_import.py", line 62, in test_with_extension self.fail("import from %s failed: %s" % (ext, err)) File "E:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\unittest.py", line 543, in fail raise self.failureException(msg) AssertionError: import from .PY failed: No module named @test_2996_tmp Traceback (most recent call last): File "E:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\test\test_import.py", line 79, in testImport test_with_extension(ext) File "E:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\test\test_import.py", line 72, in test_with_extension del sys.modules[TESTFN] KeyError: '@test_2996_tmp' 3 tests failed: test_csv test_import test_tempfile ====================================================================== ERROR: test_char_write (test.test_csv.TestArrayWrites) ---------------------------------------------------------------------- Traceback (most recent call last): File "E:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\test\test_csv.py", line 694, in test_char_write with TemporaryFile("w+", newline='') as fileobj: AttributeError: __exit__ ====================================================================== ERROR: test_double_write (test.test_csv.TestArrayWrites) ---------------------------------------------------------------------- Traceback (most recent call last): File "E:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\test\test_csv.py", line 672, in test_double_write with TemporaryFile("w+", newline='') as fileobj: AttributeError: __exit__ ====================================================================== ERROR: test_float_write (test.test_csv.TestArrayWrites) ---------------------------------------------------------------------- Traceback (most recent call last): File "E:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\test\test_csv.py", line 683, in test_float_write with TemporaryFile("w+", newline='') as fileobj: AttributeError: __exit__ ====================================================================== ERROR: test_int_write (test.test_csv.TestArrayWrites) ---------------------------------------------------------------------- Traceback (most recent call last): File "E:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\test\test_csv.py", line 661, in test_int_write with TemporaryFile("w+", newline='') as fileobj: AttributeError: __exit__ ====================================================================== ERROR: test_blankline (test.test_csv.TestDialectExcel) ---------------------------------------------------------------------- Traceback (most recent call last): File "E:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\test\test_csv.py", line 419, in test_blankline self.readerAssertEqual('', []) File "E:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\test\test_csv.py", line 395, in readerAssertEqual with TemporaryFile("w+", newline='') as fileobj: AttributeError: __exit__ ====================================================================== ERROR: test_dubious_quote (test.test_csv.TestDialectExcel) ---------------------------------------------------------------------- Traceback (most recent call last): File "E:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\test\test_csv.py", line 486, in test_dubious_quote self.readerAssertEqual('12,12,1",', [['12', '12', '1"', '']]) File "E:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\test\test_csv.py", line 395, in readerAssertEqual with TemporaryFile("w+", newline='') as fileobj: AttributeError: __exit__ ====================================================================== ERROR: test_empty_fields (test.test_csv.TestDialectExcel) ---------------------------------------------------------------------- Traceback (most recent call last): File "E:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\test\test_csv.py", line 422, in test_empty_fields self.readerAssertEqual(',', [['', '']]) File "E:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\test\test_csv.py", line 395, in readerAssertEqual with TemporaryFile("w+", newline='') as fileobj: AttributeError: __exit__ ====================================================================== ERROR: test_inline_quote (test.test_csv.TestDialectExcel) ---------------------------------------------------------------------- Traceback (most recent call last): File "E:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\test\test_csv.py", line 440, in test_inline_quote self.readerAssertEqual('a""b', [['a""b']]) File "E:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\test\test_csv.py", line 395, in readerAssertEqual with TemporaryFile("w+", newline='') as fileobj: AttributeError: __exit__ ====================================================================== ERROR: test_inline_quotes (test.test_csv.TestDialectExcel) ---------------------------------------------------------------------- Traceback (most recent call last): File "E:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\test\test_csv.py", line 443, in test_inline_quotes self.readerAssertEqual('a"b"c', [['a"b"c']]) File "E:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\test\test_csv.py", line 395, in readerAssertEqual with TemporaryFile("w+", newline='') as fileobj: AttributeError: __exit__ ====================================================================== ERROR: test_lone_quote (test.test_csv.TestDialectExcel) ---------------------------------------------------------------------- Traceback (most recent call last): File "E:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\test\test_csv.py", line 451, in test_lone_quote self.readerAssertEqual('a"b', [['a"b']]) File "E:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\test\test_csv.py", line 395, in readerAssertEqual with TemporaryFile("w+", newline='') as fileobj: AttributeError: __exit__ ====================================================================== ERROR: test_newlines (test.test_csv.TestDialectExcel) ---------------------------------------------------------------------- Traceback (most recent call last): File "E:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\test\test_csv.py", line 504, in test_newlines self.writerAssertEqual([[1, 2, 'a\nbc', 3, 4]], '1,2,"a\nbc",3,4\r\n') File "E:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\test\test_csv.py", line 403, in writerAssertEqual with TemporaryFile("w+", newline='') as fileobj: AttributeError: __exit__ ====================================================================== ERROR: test_null (test.test_csv.TestDialectExcel) ---------------------------------------------------------------------- Traceback (most recent call last): File "E:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\test\test_csv.py", line 489, in test_null self.writerAssertEqual([], '') File "E:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\test\test_csv.py", line 403, in writerAssertEqual with TemporaryFile("w+", newline='') as fileobj: AttributeError: __exit__ ====================================================================== ERROR: test_quote_and_quote (test.test_csv.TestDialectExcel) ---------------------------------------------------------------------- Traceback (most recent call last): File "E:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\test\test_csv.py", line 456, in test_quote_and_quote self.readerAssertEqual('"a" "b"', [['a "b"']]) File "E:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\test\test_csv.py", line 395, in readerAssertEqual with TemporaryFile("w+", newline='') as fileobj: AttributeError: __exit__ ====================================================================== ERROR: test_quote_fieldsep (test.test_csv.TestDialectExcel) ---------------------------------------------------------------------- Traceback (most recent call last): File "E:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\test\test_csv.py", line 501, in test_quote_fieldsep self.writerAssertEqual([['abc,def']], '"abc,def"\r\n') File "E:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\test\test_csv.py", line 403, in writerAssertEqual with TemporaryFile("w+", newline='') as fileobj: AttributeError: __exit__ ====================================================================== ERROR: test_quoted (test.test_csv.TestDialectExcel) ---------------------------------------------------------------------- Traceback (most recent call last): File "E:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\test\test_csv.py", line 465, in test_quoted '5', '6']]) File "E:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\test\test_csv.py", line 395, in readerAssertEqual with TemporaryFile("w+", newline='') as fileobj: AttributeError: __exit__ ====================================================================== ERROR: test_quoted_nl (test.test_csv.TestDialectExcel) ---------------------------------------------------------------------- Traceback (most recent call last): File "E:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\test\test_csv.py", line 483, in test_quoted_nl ['9','8','7','6']]) File "E:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\test\test_csv.py", line 395, in readerAssertEqual with TemporaryFile("w+", newline='') as fileobj: AttributeError: __exit__ ====================================================================== ERROR: test_quoted_quote (test.test_csv.TestDialectExcel) ---------------------------------------------------------------------- Traceback (most recent call last): File "E:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\test\test_csv.py", line 471, in test_quoted_quote 'as he picked up his hammer and saw']]) File "E:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\test\test_csv.py", line 395, in readerAssertEqual with TemporaryFile("w+", newline='') as fileobj: AttributeError: __exit__ ====================================================================== ERROR: test_quoted_quotes (test.test_csv.TestDialectExcel) ---------------------------------------------------------------------- Traceback (most recent call last): File "E:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\test\test_csv.py", line 437, in test_quoted_quotes self.readerAssertEqual('""""""', [['""']]) File "E:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\test\test_csv.py", line 395, in readerAssertEqual with TemporaryFile("w+", newline='') as fileobj: AttributeError: __exit__ ====================================================================== ERROR: test_quotes (test.test_csv.TestDialectExcel) ---------------------------------------------------------------------- Traceback (most recent call last): File "E:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\test\test_csv.py", line 498, in test_quotes self.writerAssertEqual([[1, 2, 'a"bc"', 3, 4]], '1,2,"a""bc""",3,4\r\n') File "E:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\test\test_csv.py", line 403, in writerAssertEqual with TemporaryFile("w+", newline='') as fileobj: AttributeError: __exit__ ====================================================================== ERROR: test_quotes_and_more (test.test_csv.TestDialectExcel) ---------------------------------------------------------------------- Traceback (most recent call last): File "E:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\test\test_csv.py", line 448, in test_quotes_and_more self.readerAssertEqual('"a"b', [['ab']]) File "E:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\test\test_csv.py", line 395, in readerAssertEqual with TemporaryFile("w+", newline='') as fileobj: AttributeError: __exit__ ====================================================================== ERROR: test_simple (test.test_csv.TestDialectExcel) ---------------------------------------------------------------------- Traceback (most recent call last): File "E:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\test\test_csv.py", line 495, in test_simple self.writerAssertEqual([[1, 2, 'abc', 3, 4]], '1,2,abc,3,4\r\n') File "E:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\test\test_csv.py", line 403, in writerAssertEqual with TemporaryFile("w+", newline='') as fileobj: AttributeError: __exit__ ====================================================================== ERROR: test_single (test.test_csv.TestDialectExcel) ---------------------------------------------------------------------- Traceback (most recent call last): File "E:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\test\test_csv.py", line 492, in test_single self.writerAssertEqual([['abc']], 'abc\r\n') File "E:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\test\test_csv.py", line 403, in writerAssertEqual with TemporaryFile("w+", newline='') as fileobj: AttributeError: __exit__ ====================================================================== ERROR: test_single_quoted_quote (test.test_csv.TestDialectExcel) ---------------------------------------------------------------------- Traceback (most recent call last): File "E:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\test\test_csv.py", line 434, in test_single_quoted_quote self.readerAssertEqual('""""', [['"']]) File "E:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\test\test_csv.py", line 395, in readerAssertEqual with TemporaryFile("w+", newline='') as fileobj: AttributeError: __exit__ ====================================================================== ERROR: test_singlequoted (test.test_csv.TestDialectExcel) ---------------------------------------------------------------------- Traceback (most recent call last): File "E:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\test\test_csv.py", line 425, in test_singlequoted self.readerAssertEqual('""', [['']]) File "E:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\test\test_csv.py", line 395, in readerAssertEqual with TemporaryFile("w+", newline='') as fileobj: AttributeError: __exit__ ====================================================================== ERROR: test_singlequoted_left_empty (test.test_csv.TestDialectExcel) ---------------------------------------------------------------------- Traceback (most recent call last): File "E:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\test\test_csv.py", line 428, in test_singlequoted_left_empty self.readerAssertEqual('"",', [['','']]) File "E:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\test\test_csv.py", line 395, in readerAssertEqual with TemporaryFile("w+", newline='') as fileobj: AttributeError: __exit__ ====================================================================== ERROR: test_singlequoted_right_empty (test.test_csv.TestDialectExcel) ---------------------------------------------------------------------- Traceback (most recent call last): File "E:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\test\test_csv.py", line 431, in test_singlequoted_right_empty self.readerAssertEqual(',""', [['','']]) File "E:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\test\test_csv.py", line 395, in readerAssertEqual with TemporaryFile("w+", newline='') as fileobj: AttributeError: __exit__ ====================================================================== ERROR: test_space_and_quote (test.test_csv.TestDialectExcel) ---------------------------------------------------------------------- Traceback (most recent call last): File "E:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\test\test_csv.py", line 459, in test_space_and_quote self.readerAssertEqual(' "a"', [[' "a"']]) File "E:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\test\test_csv.py", line 395, in readerAssertEqual with TemporaryFile("w+", newline='') as fileobj: AttributeError: __exit__ ====================================================================== ERROR: test_dialect_apply (test.test_csv.TestDialectRegistry) ---------------------------------------------------------------------- Traceback (most recent call last): File "E:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\test\test_csv.py", line 373, in test_dialect_apply self.compare_dialect_123("1,2,3\r\n") File "E:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\test\test_csv.py", line 354, in compare_dialect_123 with TemporaryFile("w+", newline='', encoding="utf-8") as fileobj: AttributeError: __exit__ ====================================================================== ERROR: test_space_dialect (test.test_csv.TestDialectRegistry) ---------------------------------------------------------------------- Traceback (most recent call last): File "E:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\test\test_csv.py", line 345, in test_space_dialect with TemporaryFile("w+") as fileobj: AttributeError: __exit__ ====================================================================== ERROR: test_read_dict_fieldnames_chain (test.test_csv.TestDictFields) ---------------------------------------------------------------------- Traceback (most recent call last): File "E:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\test\test_csv.py", line 575, in test_read_dict_fieldnames_chain with TemporaryFile("w+") as fileobj: AttributeError: __exit__ ====================================================================== ERROR: test_read_dict_fieldnames_from_file (test.test_csv.TestDictFields) ---------------------------------------------------------------------- Traceback (most recent call last): File "E:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\test\test_csv.py", line 565, in test_read_dict_fieldnames_from_file with TemporaryFile("w+") as fileobj: AttributeError: __exit__ ====================================================================== ERROR: test_read_dict_fields (test.test_csv.TestDictFields) ---------------------------------------------------------------------- Traceback (most recent call last): File "E:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\test\test_csv.py", line 547, in test_read_dict_fields with TemporaryFile("w+") as fileobj: AttributeError: __exit__ ====================================================================== ERROR: test_read_dict_no_fieldnames (test.test_csv.TestDictFields) ---------------------------------------------------------------------- Traceback (most recent call last): File "E:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\test\test_csv.py", line 555, in test_read_dict_no_fieldnames with TemporaryFile("w+") as fileobj: AttributeError: __exit__ ====================================================================== ERROR: test_read_long (test.test_csv.TestDictFields) ---------------------------------------------------------------------- Traceback (most recent call last): File "E:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\test\test_csv.py", line 585, in test_read_long with TemporaryFile("w+") as fileobj: AttributeError: __exit__ ====================================================================== ERROR: test_read_long_with_rest (test.test_csv.TestDictFields) ---------------------------------------------------------------------- Traceback (most recent call last): File "E:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\test\test_csv.py", line 594, in test_read_long_with_rest with TemporaryFile("w+") as fileobj: AttributeError: __exit__ ====================================================================== ERROR: test_read_long_with_rest_no_fieldnames (test.test_csv.TestDictFields) ---------------------------------------------------------------------- Traceback (most recent call last): File "E:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\test\test_csv.py", line 603, in test_read_long_with_rest_no_fieldnames with TemporaryFile("w+") as fileobj: AttributeError: __exit__ ====================================================================== ERROR: test_read_short (test.test_csv.TestDictFields) ---------------------------------------------------------------------- Traceback (most recent call last): File "E:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\test\test_csv.py", line 612, in test_read_short with TemporaryFile("w+") as fileobj: AttributeError: __exit__ ====================================================================== ERROR: test_write_simple_dict (test.test_csv.TestDictFields) ---------------------------------------------------------------------- Traceback (most recent call last): File "E:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\test\test_csv.py", line 536, in test_write_simple_dict with TemporaryFile("w+", newline='') as fileobj: AttributeError: __exit__ ====================================================================== ERROR: test_escape_fieldsep (test.test_csv.TestEscapedExcel) ---------------------------------------------------------------------- Traceback (most recent call last): File "E:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\test\test_csv.py", line 514, in test_escape_fieldsep self.writerAssertEqual([['abc,def']], 'abc\\,def\r\n') File "E:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\test\test_csv.py", line 403, in writerAssertEqual with TemporaryFile("w+", newline='') as fileobj: AttributeError: __exit__ ====================================================================== ERROR: test_read_escape_fieldsep (test.test_csv.TestEscapedExcel) ---------------------------------------------------------------------- Traceback (most recent call last): File "E:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\test\test_csv.py", line 517, in test_read_escape_fieldsep self.readerAssertEqual('abc\\,def\r\n', [['abc,def']]) File "E:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\test\test_csv.py", line 395, in readerAssertEqual with TemporaryFile("w+", newline='') as fileobj: AttributeError: __exit__ ====================================================================== ERROR: test_read_escape_fieldsep (test.test_csv.TestQuotedEscapedExcel) ---------------------------------------------------------------------- Traceback (most recent call last): File "E:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\test\test_csv.py", line 530, in test_read_escape_fieldsep self.readerAssertEqual('"abc\\,def"\r\n', [['abc,def']]) File "E:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\test\test_csv.py", line 395, in readerAssertEqual with TemporaryFile("w+", newline='') as fileobj: AttributeError: __exit__ ====================================================================== ERROR: test_write_escape_fieldsep (test.test_csv.TestQuotedEscapedExcel) ---------------------------------------------------------------------- Traceback (most recent call last): File "E:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\test\test_csv.py", line 527, in test_write_escape_fieldsep self.writerAssertEqual([['abc,def']], '"abc,def"\r\n') File "E:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\test\test_csv.py", line 403, in writerAssertEqual with TemporaryFile("w+", newline='') as fileobj: AttributeError: __exit__ ====================================================================== ERROR: test_unicode_read (test.test_csv.TestUnicode) ---------------------------------------------------------------------- Traceback (most recent call last): File "E:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\test\test_csv.py", line 911, in test_unicode_read with TemporaryFile("w+", newline='', encoding="utf-8") as fileobj: AttributeError: __exit__ ====================================================================== ERROR: test_unicode_write (test.test_csv.TestUnicode) ---------------------------------------------------------------------- Traceback (most recent call last): File "E:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\test\test_csv.py", line 920, in test_unicode_write with TemporaryFile("w+", newline='', encoding="utf-8") as fileobj: AttributeError: __exit__ ====================================================================== ERROR: test_roundtrip_quoteed_newlines (test.test_csv.Test_Csv) ---------------------------------------------------------------------- Traceback (most recent call last): File "E:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\test\test_csv.py", line 283, in test_roundtrip_quoteed_newlines with TemporaryFile("w+", newline='') as fileobj: AttributeError: __exit__ ====================================================================== ERROR: test_write_arg_valid (test.test_csv.Test_Csv) ---------------------------------------------------------------------- Traceback (most recent call last): File "E:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\test\test_csv.py", line 129, in test_write_arg_valid self.assertRaises(csv.Error, self._write_test, None, '') File "E:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\unittest.py", line 592, in assertRaises callableObj(*args, **kwargs) File "E:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\test\test_csv.py", line 121, in _write_test with TemporaryFile("w+", newline='') as fileobj: AttributeError: __exit__ ====================================================================== ERROR: test_write_bigfield (test.test_csv.Test_Csv) ---------------------------------------------------------------------- Traceback (most recent call last): File "E:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\test\test_csv.py", line 151, in test_write_bigfield (bigstring, bigstring)) File "E:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\test\test_csv.py", line 121, in _write_test with TemporaryFile("w+", newline='') as fileobj: AttributeError: __exit__ ====================================================================== ERROR: test_write_escape (test.test_csv.Test_Csv) ---------------------------------------------------------------------- Traceback (most recent call last): File "E:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\test\test_csv.py", line 170, in test_write_escape escapechar='\\') File "E:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\test\test_csv.py", line 121, in _write_test with TemporaryFile("w+", newline='') as fileobj: AttributeError: __exit__ ====================================================================== ERROR: test_write_quoting (test.test_csv.Test_Csv) ---------------------------------------------------------------------- Traceback (most recent call last): File "E:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\test\test_csv.py", line 154, in test_write_quoting self._write_test(['a',1,'p,q'], 'a,1,"p,q"') File "E:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\test\test_csv.py", line 121, in _write_test with TemporaryFile("w+", newline='') as fileobj: AttributeError: __exit__ ====================================================================== ERROR: test_writerows (test.test_csv.Test_Csv) ---------------------------------------------------------------------- Traceback (most recent call last): File "E:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\test\test_csv.py", line 194, in test_writerows with TemporaryFile("w+", newline='') as fileobj: AttributeError: __exit__ ====================================================================== ERROR: testImport (test.test_import.ImportTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "E:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\test\test_import.py", line 60, in test_with_extension mod = __import__(TESTFN) ImportError: No module named @test_2996_tmp Traceback (most recent call last): File "E:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\test\test_import.py", line 62, in test_with_extension self.fail("import from %s failed: %s" % (ext, err)) File "E:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\unittest.py", line 543, in fail raise self.failureException(msg) AssertionError: import from .PY failed: No module named @test_2996_tmp Traceback (most recent call last): File "E:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\test\test_import.py", line 79, in testImport test_with_extension(ext) File "E:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\test\test_import.py", line 72, in test_with_extension del sys.modules[TESTFN] KeyError: '@test_2996_tmp' Traceback (most recent call last): File "E:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\test\test_import.py", line 62, in test_with_extension self.fail("import from %s failed: %s" % (ext, err)) File "E:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\unittest.py", line 543, in fail raise self.failureException(msg) AssertionError: import from .PY failed: No module named @test_2996_tmp Traceback (most recent call last): File "E:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\test\test_import.py", line 79, in testImport test_with_extension(ext) File "E:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\test\test_import.py", line 72, in test_with_extension del sys.modules[TESTFN] KeyError: '@test_2996_tmp' ====================================================================== ERROR: test_context_manager (test.test_tempfile.test_NamedTemporaryFile) ---------------------------------------------------------------------- Traceback (most recent call last): File "E:\cygwin\home\db3l\buildarea\3.x.bolen-windows\build\lib\test\test_tempfile.py", line 627, in test_context_manager with tempfile.NamedTemporaryFile() as f: AttributeError: __exit__ sincerely, -The Buildbot From nnorwitz at gmail.com Tue Jun 30 06:59:42 2009 From: nnorwitz at gmail.com (Neal Norwitz) Date: Mon, 29 Jun 2009 21:59:42 -0700 Subject: [Python-checkins] r73698 - in python/branches/py3k: Lib/test/test_codecs.py Misc/NEWS Objects/unicodeobject.c In-Reply-To: <4a494209.1167f10a.1ab4.168bSMTPIN_ADDED@mx.google.com> References: <4a494209.1167f10a.1ab4.168bSMTPIN_ADDED@mx.google.com> Message-ID: On Mon, Jun 29, 2009 at 3:36 PM, amaury.forgeotdarc wrote: > Author: amaury.forgeotdarc > Date: Tue Jun 30 00:36:49 2009 > New Revision: 73698 > > Log: > #6373: SystemError in str.encode('latin1', 'surrogateescape') This says SystemError. See below. > if the string contains unpaired surrogates. > (In debug build, crash in assert()) > > This can happen with normal processing, if python starts with utf-8, > then calls sys.setfilesystemencoding('latin-1') > > > Modified: > ? python/branches/py3k/Lib/test/test_codecs.py > ? python/branches/py3k/Misc/NEWS > ? python/branches/py3k/Objects/unicodeobject.c > > Modified: python/branches/py3k/Misc/NEWS > ============================================================================== > --- python/branches/py3k/Misc/NEWS ? ? ?(original) > +++ python/branches/py3k/Misc/NEWS ? ? ?Tue Jun 30 00:36:49 2009 > @@ -12,6 +12,10 @@ > ?Core and Builtins > ?----------------- > > +- Issue #6373: Fixed a RuntimeError when encoding with the latin-1 codec and > + ?the 'surrogateescape' error handler, a string which contains unpaired > + ?surrogates. > + This says RuntimeError. I assume one is incorrect. :-) n From python-checkins at python.org Tue Jun 30 07:33:50 2009 From: python-checkins at python.org (gregory.p.smith) Date: Tue, 30 Jun 2009 05:33:50 -0000 Subject: [Python-checkins] r73700 - in python/branches/py3k/Lib: ntpath.py unittest.py Message-ID: Author: gregory.p.smith Date: Tue Jun 30 07:33:50 2009 New Revision: 73700 Log: PendingDeprecationWarning -> DeprecationWarning. Both of these were properly documented as being deprecated in 3.1. Modified: python/branches/py3k/Lib/ntpath.py python/branches/py3k/Lib/unittest.py Modified: python/branches/py3k/Lib/ntpath.py ============================================================================== --- python/branches/py3k/Lib/ntpath.py (original) +++ python/branches/py3k/Lib/ntpath.py Tue Jun 30 07:33:50 2009 @@ -233,7 +233,7 @@ """ import warnings warnings.warn("ntpath.splitunc is deprecated, use ntpath.splitdrive instead", - PendingDeprecationWarning) + DeprecationWarning) sep = _get_sep(p) if not p[1:2]: return p[:0], p # Drive letter present Modified: python/branches/py3k/Lib/unittest.py ============================================================================== --- python/branches/py3k/Lib/unittest.py (original) +++ python/branches/py3k/Lib/unittest.py Tue Jun 30 07:33:50 2009 @@ -680,7 +680,7 @@ def deprecated_func(*args, **kwargs): warnings.warn( 'Please use {0} instead.'.format(original_func.__name__), - PendingDeprecationWarning, 2) + DeprecationWarning, 2) return original_func(*args, **kwargs) return deprecated_func From python-checkins at python.org Tue Jun 30 17:32:31 2009 From: python-checkins at python.org (mark.dickinson) Date: Tue, 30 Jun 2009 15:32:31 -0000 Subject: [Python-checkins] r73701 - in python/trunk: Include/pyport.h Misc/NEWS Message-ID: Author: mark.dickinson Date: Tue Jun 30 17:32:30 2009 New Revision: 73701 Log: Issue #6347: Add inttypes.h to the pyport.h #includes; fixes a build failure on HP-UX 11.00. Modified: python/trunk/Include/pyport.h python/trunk/Misc/NEWS Modified: python/trunk/Include/pyport.h ============================================================================== --- python/trunk/Include/pyport.h (original) +++ python/trunk/Include/pyport.h Tue Jun 30 17:32:30 2009 @@ -3,6 +3,12 @@ #include "pyconfig.h" /* include for defines */ +/* Some versions of HP-UX & Solaris need inttypes.h for int32_t, + INT32_MAX, etc. */ +#ifdef HAVE_INTTYPES_H +#include +#endif + #ifdef HAVE_STDINT_H #include #endif Modified: python/trunk/Misc/NEWS ============================================================================== --- python/trunk/Misc/NEWS (original) +++ python/trunk/Misc/NEWS Tue Jun 30 17:32:30 2009 @@ -12,6 +12,10 @@ Core and Builtins ----------------- +- Issue #6347: Include inttypes.h as well as stdint.h in pyport.h. + This fixes a build failure on HP-UX: int32_t and uint32_t are + defined in inttypes.h instead of stdint.h on that platform. + - Issue #4856: Remove checks for win NT. - Issue #2016: Fixed a crash in a corner case where the dictionary of keyword From python-checkins at python.org Tue Jun 30 17:45:17 2009 From: python-checkins at python.org (mark.dickinson) Date: Tue, 30 Jun 2009 15:45:17 -0000 Subject: [Python-checkins] r73702 - in python/branches/py3k: Include/pyport.h Misc/NEWS Message-ID: Author: mark.dickinson Date: Tue Jun 30 17:45:17 2009 New Revision: 73702 Log: Merged revisions 73701 via svnmerge from svn+ssh://pythondev at svn.python.org/python/trunk ........ r73701 | mark.dickinson | 2009-06-30 16:32:30 +0100 (Tue, 30 Jun 2009) | 3 lines Issue #6347: Add inttypes.h to the pyport.h #includes; fixes a build failure on HP-UX 11.00. ........ Modified: python/branches/py3k/ (props changed) python/branches/py3k/Include/pyport.h python/branches/py3k/Misc/NEWS Modified: python/branches/py3k/Include/pyport.h ============================================================================== --- python/branches/py3k/Include/pyport.h (original) +++ python/branches/py3k/Include/pyport.h Tue Jun 30 17:45:17 2009 @@ -3,6 +3,12 @@ #include "pyconfig.h" /* include for defines */ +/* Some versions of HP-UX & Solaris need inttypes.h for int32_t, + INT32_MAX, etc. */ +#ifdef HAVE_INTTYPES_H +#include +#endif + #ifdef HAVE_STDINT_H #include #endif Modified: python/branches/py3k/Misc/NEWS ============================================================================== --- python/branches/py3k/Misc/NEWS (original) +++ python/branches/py3k/Misc/NEWS Tue Jun 30 17:45:17 2009 @@ -12,6 +12,10 @@ Core and Builtins ----------------- +- Issue #6347: Include inttypes.h as well as stdint.h in pyport.h. + This fixes a build failure on HP-UX: int32_t and uint32_t are + defined in inttypes.h instead of stdint.h on that platform. + - Issue #6373: Fixed a RuntimeError when encoding with the latin-1 codec and the 'surrogateescape' error handler, a string which contains unpaired surrogates. From python-checkins at python.org Tue Jun 30 17:46:37 2009 From: python-checkins at python.org (mark.dickinson) Date: Tue, 30 Jun 2009 15:46:37 -0000 Subject: [Python-checkins] r73703 - in python/branches/release31-maint: Include/pyport.h Misc/NEWS Message-ID: Author: mark.dickinson Date: Tue Jun 30 17:46:37 2009 New Revision: 73703 Log: Merged revisions 73702 via svnmerge from svn+ssh://pythondev at www.python.org/python/branches/py3k ................ r73702 | mark.dickinson | 2009-06-30 16:45:17 +0100 (Tue, 30 Jun 2009) | 10 lines Merged revisions 73701 via svnmerge from svn+ssh://pythondev at svn.python.org/python/trunk ........ r73701 | mark.dickinson | 2009-06-30 16:32:30 +0100 (Tue, 30 Jun 2009) | 3 lines Issue #6347: Add inttypes.h to the pyport.h #includes; fixes a build failure on HP-UX 11.00. ........ ................ Modified: python/branches/release31-maint/ (props changed) python/branches/release31-maint/Include/pyport.h python/branches/release31-maint/Misc/NEWS Modified: python/branches/release31-maint/Include/pyport.h ============================================================================== --- python/branches/release31-maint/Include/pyport.h (original) +++ python/branches/release31-maint/Include/pyport.h Tue Jun 30 17:46:37 2009 @@ -3,6 +3,12 @@ #include "pyconfig.h" /* include for defines */ +/* Some versions of HP-UX & Solaris need inttypes.h for int32_t, + INT32_MAX, etc. */ +#ifdef HAVE_INTTYPES_H +#include +#endif + #ifdef HAVE_STDINT_H #include #endif Modified: python/branches/release31-maint/Misc/NEWS ============================================================================== --- python/branches/release31-maint/Misc/NEWS (original) +++ python/branches/release31-maint/Misc/NEWS Tue Jun 30 17:46:37 2009 @@ -12,6 +12,10 @@ Core and Builtins ----------------- +- Issue #6347: Include inttypes.h as well as stdint.h in pyport.h. + This fixes a build failure on HP-UX: int32_t and uint32_t are + defined in inttypes.h instead of stdint.h on that platform. + - Issue #6373: Fixed a RuntimeError when encoding with the latin-1 codec and the 'surrogateescape' error handler, a string which contains unpaired surrogates. From python-checkins at python.org Tue Jun 30 18:15:43 2009 From: python-checkins at python.org (georg.brandl) Date: Tue, 30 Jun 2009 16:15:43 -0000 Subject: [Python-checkins] r73704 - python/trunk/Doc/library/decimal.rst Message-ID: Author: georg.brandl Date: Tue Jun 30 18:15:43 2009 New Revision: 73704 Log: #6376: fix copy-n-paste oversight. Modified: python/trunk/Doc/library/decimal.rst Modified: python/trunk/Doc/library/decimal.rst ============================================================================== --- python/trunk/Doc/library/decimal.rst (original) +++ python/trunk/Doc/library/decimal.rst Tue Jun 30 18:15:43 2009 @@ -624,10 +624,9 @@ .. versionadded:: 2.6 - .. method:: logical_invert(other[, context]) + .. method:: logical_invert([context]) - :meth:`logical_invert` is a logical operation. The argument must - be a *logical operand* (see :ref:`logical_operands_label`). The + :meth:`logical_invert` is a logical operation. The result is the digit-wise inversion of the operand. .. versionadded:: 2.6 From python-checkins at python.org Tue Jun 30 18:17:29 2009 From: python-checkins at python.org (georg.brandl) Date: Tue, 30 Jun 2009 16:17:29 -0000 Subject: [Python-checkins] r73705 - python/trunk/Doc/library/subprocess.rst Message-ID: Author: georg.brandl Date: Tue Jun 30 18:17:28 2009 New Revision: 73705 Log: #6374: add a bit of explanation about shell=True on Windows. Modified: python/trunk/Doc/library/subprocess.rst Modified: python/trunk/Doc/library/subprocess.rst ============================================================================== --- python/trunk/Doc/library/subprocess.rst (original) +++ python/trunk/Doc/library/subprocess.rst Tue Jun 30 18:17:28 2009 @@ -73,7 +73,11 @@ needed: Usually, the program to execute is defined by the *args* argument. If ``shell=True``, the *executable* argument specifies which shell to use. On Unix, the default shell is :file:`/bin/sh`. On Windows, the default shell is - specified by the :envvar:`COMSPEC` environment variable. + specified by the :envvar:`COMSPEC` environment variable. The only reason you + would need to specify ``shell=True`` on Windows is where the command you + wish to execute is actually built in to the shell, eg ``dir``, ``copy``. + You don't need ``shell=True`` to run a batch file, nor to run a console-based + executable. *stdin*, *stdout* and *stderr* specify the executed programs' standard input, standard output and standard error file handles, respectively. Valid values From python-checkins at python.org Tue Jun 30 18:18:55 2009 From: python-checkins at python.org (georg.brandl) Date: Tue, 30 Jun 2009 16:18:55 -0000 Subject: [Python-checkins] r73706 - python/trunk/Doc/library/exceptions.rst Message-ID: Author: georg.brandl Date: Tue Jun 30 18:18:55 2009 New Revision: 73706 Log: #6384: Add a heading for the exception hierarchy. Modified: python/trunk/Doc/library/exceptions.rst Modified: python/trunk/Doc/library/exceptions.rst ============================================================================== --- python/trunk/Doc/library/exceptions.rst (original) +++ python/trunk/Doc/library/exceptions.rst Tue Jun 30 18:18:55 2009 @@ -477,7 +477,10 @@ .. versionadded:: 2.5 -The class hierarchy for built-in exceptions is: +Exception hierarchy +------------------- + +The class hierarchy for built-in exceptions is: .. literalinclude:: ../../Lib/test/exception_hierarchy.txt From python-checkins at python.org Tue Jun 30 18:35:11 2009 From: python-checkins at python.org (georg.brandl) Date: Tue, 30 Jun 2009 16:35:11 -0000 Subject: [Python-checkins] r73707 - python/trunk/Doc/library/optparse.rst Message-ID: Author: georg.brandl Date: Tue Jun 30 18:35:11 2009 New Revision: 73707 Log: #6371: fix link targets. Modified: python/trunk/Doc/library/optparse.rst Modified: python/trunk/Doc/library/optparse.rst ============================================================================== --- python/trunk/Doc/library/optparse.rst (original) +++ python/trunk/Doc/library/optparse.rst Tue Jun 30 18:35:11 2009 @@ -642,8 +642,8 @@ ``parser.error()`` from your application code. If :mod:`optparse`'s default error-handling behaviour does not suit your needs, -you'll need to subclass OptionParser and override its :meth:`exit` and/or -:meth:`error` methods. +you'll need to subclass OptionParser and override its :meth:`~OptionParser.exit` +and/or :meth:`~OptionParser.error` methods. .. _optparse-putting-it-all-together: From buildbot at python.org Tue Jun 30 18:35:11 2009 From: buildbot at python.org (buildbot at python.org) Date: Tue, 30 Jun 2009 16:35:11 +0000 Subject: [Python-checkins] buildbot failure in x86 osx.5 3.x Message-ID: The Buildbot has detected a new failure of x86 osx.5 3.x. Full details are available at: http://www.python.org/dev/buildbot/all/x86%20osx.5%203.x/builds/1100 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: heller-x86-osx5 Build Reason: Build Source Stamp: [branch branches/py3k] HEAD Blamelist: mark.dickinson BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_binhex ====================================================================== ERROR: test_binhex (test.test_binhex.BinHexTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/test/test_binhex.py", line 32, in test_binhex binhex.hexbin(self.fname2, self.fname1) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/binhex.py", line 445, in hexbin ifp = HexBin(inp) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/binhex.py", line 364, in __init__ self._readheader() File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/binhex.py", line 384, in _readheader rest = self._read(1 + 4 + 4 + 2 + 4 + 4) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/binhex.py", line 367, in _read data = self.ifp.read(len) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/binhex.py", line 300, in read self._fill(wtd - len(self.post_buffer)) File "/Users/buildbot/buildarea/3.x.heller-x86-osx5/build/Lib/binhex.py", line 337, in _fill binascii.rledecode_hqx(self.pre_buffer[:mark]) binascii.Error: Orphaned RLE code at start make: *** [buildbottest] Error 1 sincerely, -The Buildbot From buildbot at python.org Tue Jun 30 18:42:21 2009 From: buildbot at python.org (buildbot at python.org) Date: Tue, 30 Jun 2009 16:42:21 +0000 Subject: [Python-checkins] buildbot failure in sparc solaris10 gcc trunk Message-ID: The Buildbot has detected a new failure of sparc solaris10 gcc trunk. Full details are available at: http://www.python.org/dev/buildbot/all/sparc%20solaris10%20gcc%20trunk/builds/592 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: loewis-sun Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: mark.dickinson BUILD FAILED: failed test Excerpt from the test logfile: Traceback (most recent call last): File "/home2/buildbot/slave/trunk.loewis-sun/build/Lib/threading.py", line 524, in __bootstrap_inner self.run() File "/home2/buildbot/slave/trunk.loewis-sun/build/Lib/threading.py", line 477, in run self.__target(*self.__args, **self.__kwargs) File "/home2/buildbot/slave/trunk.loewis-sun/build/Lib/SocketServer.py", line 224, in serve_forever r, w, e = select.select([self], [], [], poll_interval) error: (4, 'Interrupted system call') 3 tests failed: test_posix test_socket test_socketserver ====================================================================== ERROR: test_getcwd_long_pathnames (test.test_posix.PosixTester) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home2/buildbot/slave/trunk.loewis-sun/build/Lib/test/test_posix.py", line 270, in test_getcwd_long_pathnames shutil.rmtree(base_path) File "/home2/buildbot/slave/trunk.loewis-sun/build/Lib/shutil.py", line 239, in rmtree onerror(os.rmdir, path, sys.exc_info()) File "/home2/buildbot/slave/trunk.loewis-sun/build/Lib/shutil.py", line 237, in rmtree os.rmdir(path) OSError: [Errno 22] Invalid argument: '/home2/buildbot/slave/trunk.loewis-sun/build/@test_13456_tmp.getcwd/@test_13456_tmp.getcwd' ====================================================================== ERROR: test_getcwd_long_pathnames (test.test_posix.PosixTester) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home2/buildbot/slave/trunk.loewis-sun/build/Lib/test/test_posix.py", line 27, in tearDown os.unlink(test_support.TESTFN) OSError: [Errno 2] No such file or directory: '@test_13456_tmp' ====================================================================== FAIL: test_ForkingTCPServer (test.test_socketserver.SocketServerTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home2/buildbot/slave/trunk.loewis-sun/build/Lib/test/test_socketserver.py", line 189, in test_ForkingTCPServer self.stream_examine) File "/home2/buildbot/slave/trunk.loewis-sun/build/Lib/test/test_socketserver.py", line 147, in run_server testfunc(svrcls.address_family, addr) File "/home2/buildbot/slave/trunk.loewis-sun/build/Lib/test/test_socketserver.py", line 161, in stream_examine self.assertEquals(buf, TEST_STR) AssertionError: '' != 'hello world\n' ====================================================================== FAIL: test_ForkingUnixStreamServer (test.test_socketserver.SocketServerTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home2/buildbot/slave/trunk.loewis-sun/build/Lib/test/test_socketserver.py", line 207, in test_ForkingUnixStreamServer self.stream_examine) File "/home2/buildbot/slave/trunk.loewis-sun/build/Lib/test/test_socketserver.py", line 147, in run_server testfunc(svrcls.address_family, addr) File "/home2/buildbot/slave/trunk.loewis-sun/build/Lib/test/test_socketserver.py", line 161, in stream_examine self.assertEquals(buf, TEST_STR) AssertionError: '' != 'hello world\n' Traceback (most recent call last): Unhandled exception in thread started by > File "/home2/buildbot/slave/trunk.loewis-sun/build/Lib/threading.py", line 497, in __bootstrap Traceback (most recent call last): [761092 refs] *** Error code 1 sincerely, -The Buildbot From buildbot at python.org Tue Jun 30 19:09:31 2009 From: buildbot at python.org (buildbot at python.org) Date: Tue, 30 Jun 2009 17:09:31 +0000 Subject: [Python-checkins] buildbot failure in x86 FreeBSD trunk Message-ID: The Buildbot has detected a new failure of x86 FreeBSD trunk. Full details are available at: http://www.python.org/dev/buildbot/all/x86%20FreeBSD%20trunk/builds/2386 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: bolen-freebsd Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: mark.dickinson BUILD FAILED: failed test Excerpt from the test logfile: Traceback (most recent call last): File "/usr/home/db3l/buildarea/trunk.bolen-freebsd/build/Lib/threading.py", line 524, in __bootstrap_inner self.run() File "/usr/home/db3l/buildarea/trunk.bolen-freebsd/build/Lib/threading.py", line 477, in run self.__target(*self.__args, **self.__kwargs) File "/usr/home/db3l/buildarea/trunk.bolen-freebsd/build/Lib/SocketServer.py", line 224, in serve_forever r, w, e = select.select([self], [], [], poll_interval) error: (4, 'Interrupted system call') Traceback (most recent call last): File "/usr/home/db3l/buildarea/trunk.bolen-freebsd/build/Lib/threading.py", line 524, in __bootstrap_inner self.run() File "/usr/home/db3l/buildarea/trunk.bolen-freebsd/build/Lib/threading.py", line 477, in run self.__target(*self.__args, **self.__kwargs) File "/usr/home/db3l/buildarea/trunk.bolen-freebsd/build/Lib/SocketServer.py", line 224, in serve_forever r, w, e = select.select([self], [], [], poll_interval) error: (4, 'Interrupted system call') sincerely, -The Buildbot From python-checkins at python.org Tue Jun 30 19:11:52 2009 From: python-checkins at python.org (jesse.noller) Date: Tue, 30 Jun 2009 17:11:52 -0000 Subject: [Python-checkins] r73708 - in python/trunk: Doc/library/multiprocessing.rst Lib/multiprocessing/process.py Lib/test/test_multiprocessing.py Misc/ACKS Misc/NEWS Message-ID: Author: jesse.noller Date: Tue Jun 30 19:11:52 2009 New Revision: 73708 Log: Resolves issues 5155, 5313, 5331 - bad file descriptor error with processes in processes Modified: python/trunk/Doc/library/multiprocessing.rst python/trunk/Lib/multiprocessing/process.py python/trunk/Lib/test/test_multiprocessing.py python/trunk/Misc/ACKS python/trunk/Misc/NEWS Modified: python/trunk/Doc/library/multiprocessing.rst ============================================================================== --- python/trunk/Doc/library/multiprocessing.rst (original) +++ python/trunk/Doc/library/multiprocessing.rst Tue Jun 30 19:11:52 2009 @@ -2101,6 +2101,38 @@ for i in range(10): Process(target=f, args=(lock,)).start() +Beware replacing sys.stdin with a "file like object" + + :mod:`multiprocessing` originally unconditionally called:: + + os.close(sys.stdin.fileno()) + + In the :meth:`multiprocessing.Process._bootstrap` method of - this resulted + in issues with processes-in-processes. This has been changed to:: + + sys.stdin.close() + sys.stdin = open(os.devnull) + + Which solves the fundamental issue of processes colliding with each other + resulting in a bad file descriptor error, but introduces a potential danger + to applications which replace :func:`sys.stdin` with a "file-like object" + with output buffering, this danger is that if multiple processes call + :func:`close()` on this file-like object, it could result in the same + data being flushed to the object multiple times, resulting in corruption. + + If you write a file-like object and implement your own caching, you can + make it fork-safe by storing the pid whenever you append to the cache, + and discarding the cache when the pid changes. For example:: + + @property + def cache(self): + pid = os.getpid() + if pid != self._pid: + self._pid = pid + self._cache = [] + return self._cache + + For more information, see :issue:`5155`, :issue:`5313` and :issue:`5331` Windows ~~~~~~~ Modified: python/trunk/Lib/multiprocessing/process.py ============================================================================== --- python/trunk/Lib/multiprocessing/process.py (original) +++ python/trunk/Lib/multiprocessing/process.py Tue Jun 30 19:11:52 2009 @@ -220,7 +220,8 @@ self._children = set() self._counter = itertools.count(1) try: - os.close(sys.stdin.fileno()) + sys.stdin.close() + sys.stdin = open(os.devnull) except (OSError, ValueError): pass _current_process = self Modified: python/trunk/Lib/test/test_multiprocessing.py ============================================================================== --- python/trunk/Lib/test/test_multiprocessing.py (original) +++ python/trunk/Lib/test/test_multiprocessing.py Tue Jun 30 19:11:52 2009 @@ -18,6 +18,7 @@ import random import logging import test_support +from StringIO import StringIO _multiprocessing = test_support.import_module('_multiprocessing') @@ -1861,7 +1862,74 @@ p.join() self.assertEqual(self.ns.test, 1) -testcases_other = [OtherTest, TestInvalidHandle, TestInitializers] +# +# Issue 5155, 5313, 5331: Test process in processes +# Verifies os.close(sys.stdin.fileno) vs. sys.stdin.close() behavior +# + +def _ThisSubProcess(q): + try: + item = q.get(block=False) + except Queue.Empty: + pass + +def _TestProcess(q): + queue = multiprocessing.Queue() + subProc = multiprocessing.Process(target=_ThisSubProcess, args=(queue,)) + subProc.start() + subProc.join() + +def _afunc(x): + return x*x + +def pool_in_process(): + pool = multiprocessing.Pool(processes=4) + x = pool.map(_afunc, [1, 2, 3, 4, 5, 6, 7]) + +class _file_like(object): + def __init__(self, delegate): + self._delegate = delegate + self._pid = None + + @property + def cache(self): + pid = os.getpid() + # There are no race conditions since fork keeps only the running thread + if pid != self._pid: + self._pid = pid + self._cache = [] + return self._cache + + def write(self, data): + self.cache.append(data) + + def flush(self): + self._delegate.write(''.join(self.cache)) + self._cache = [] + +class TestStdinBadfiledescriptor(unittest.TestCase): + + def test_queue_in_process(self): + queue = multiprocessing.Queue() + proc = multiprocessing.Process(target=_TestProcess, args=(queue,)) + proc.start() + proc.join() + + def test_pool_in_process(self): + p = multiprocessing.Process(target=pool_in_process) + p.start() + p.join() + + def test_flushing(self): + sio = StringIO() + flike = _file_like(sio) + flike.write('foo') + proc = multiprocessing.Process(target=lambda: flike.flush()) + flike.flush() + assert sio.getvalue() == 'foo' + +testcases_other = [OtherTest, TestInvalidHandle, TestInitializers, + TestStdinBadfiledescriptor] # # Modified: python/trunk/Misc/ACKS ============================================================================== --- python/trunk/Misc/ACKS (original) +++ python/trunk/Misc/ACKS Tue Jun 30 19:11:52 2009 @@ -46,6 +46,7 @@ Ulf Bartelt Nick Bastin Jeff Bauer +Mike Bayer Michael R Bax Anthony Baxter Samuel L. Bayer @@ -183,6 +184,7 @@ Dean Draayer John DuBois Paul Dubois +Graham Dumpleton Quinn Dunkan Robin Dunn Luke Dunstan @@ -553,6 +555,7 @@ Santiago Peres?n Mark Perrego Trevor Perrin +Gabriel de Perthuis Tim Peters Benjamin Peterson Chris Petrilli Modified: python/trunk/Misc/NEWS ============================================================================== --- python/trunk/Misc/NEWS (original) +++ python/trunk/Misc/NEWS Tue Jun 30 19:11:52 2009 @@ -341,6 +341,10 @@ Library ------- +- Issues #5155, 5313, 5331: multiprocessing.Process._bootstrap was + unconditionally calling "os.close(sys.stdin.fileno())" resulting in file + descriptor errors + - Issue #6365: Distutils build_ext inplace mode was copying the compiled extension in a subdirectory if the extension name had dots. From buildbot at python.org Tue Jun 30 22:37:15 2009 From: buildbot at python.org (buildbot at python.org) Date: Tue, 30 Jun 2009 20:37:15 +0000 Subject: [Python-checkins] buildbot failure in x86 XP-4 trunk Message-ID: The Buildbot has detected a new failure of x86 XP-4 trunk. Full details are available at: http://www.python.org/dev/buildbot/all/x86%20XP-4%20trunk/builds/2284 Buildbot URL: http://www.python.org/dev/buildbot/all/ Buildslave for this Build: bolen-windows Build Reason: Build Source Stamp: [branch trunk] HEAD Blamelist: georg.brandl,jesse.noller BUILD FAILED: failed test Excerpt from the test logfile: 1 test failed: test_distutils ====================================================================== FAIL: test_build_ext_inplace (distutils.tests.test_build_ext.BuildExtTestCase) ---------------------------------------------------------------------- Traceback (most recent call last): File "E:\cygwin\home\db3l\buildarea\trunk.bolen-windows\build\lib\distutils\tests\test_build_ext.py", line 371, in test_build_ext_inplace self.assertEquals(wanted, path) AssertionError: 'E:\\cygwin\\home\\db3l\\buildarea\\trunk.bolen-windows\\build\\PCbuild\\src\\lxml\\etree.so' != 'E:\\cygwin\\home\\db3l\\buildarea\\trunk.bolen-windows\\build\\PCbuild\\src\\lxml\\etree.pyd' sincerely, -The Buildbot From eric at trueblade.com Fri Jun 12 18:59:24 2009 From: eric at trueblade.com (Eric Smith) Date: Fri, 12 Jun 2009 16:59:24 -0000 Subject: [Python-checkins] r73389 - in python/branches/py3k: Lib/doctest.py Lib/test/test_doctest.py Misc/NEWS In-Reply-To: <20090612153319.D88BFC514@mail.python.org> References: <20090612153319.D88BFC514@mail.python.org> Message-ID: <55521.63.251.87.214.1244825960.squirrel@mail.trueblade.com> > + if not file[0]+file[-2:] == '<]>': file = None > + if file is None: source_lines = None > + else: I don't see a reason to put these on a single line. > + if not source_lines: > + source_lines = None Especially when this similar line is treated differently. Eric.