Commit Graph

13317 Commits

Author SHA1 Message Date
Mark Dickinson f8476c1573 Issue #2487. math.ldexp(x, n) raised OverflowError when n was large and
negative; fix to return an (appropriately signed) zero instead.
2008-05-09 17:54:23 +00:00
Christian Heimes 17433d206c Add --user option to build_ext 2008-05-09 12:19:09 +00:00
Brett Cannon fa24d9a71c Deprecate the toaiff module for removal in 3.0. 2008-05-09 05:32:42 +00:00
Brett Cannon 3c75914434 Deprecate test.testall for removal in 3.0. 2008-05-09 05:25:37 +00:00
Brett Cannon d7265d6483 Deprecate the new module for removal in 3.0. 2008-05-09 05:18:40 +00:00
Benjamin Peterson 0893a0a961 Add Py3k warnings to os.path.walk 2008-05-09 00:27:01 +00:00
Benjamin Peterson 9ec4aa01f9 Replace instances of os.path.walk with os.walk 2008-05-08 22:09:54 +00:00
Brett Cannon e3b1940eb9 Deprecate the user module for removal in 3.0. 2008-05-08 20:36:09 +00:00
Brett Cannon be1501b976 Fix sys.flags to properly expose bytes_warning.
Closes issue #2790.
2008-05-08 20:23:06 +00:00
Brett Cannon 5d023c3afa Fix a bug introduced by the addition of the 'record' argument to
test.test_support.catch_warning() where showwarning() was not being set
properly.
2008-05-08 20:20:24 +00:00
Brett Cannon 6071cc8fb0 Deprecate stringold for removal in 3.0. 2008-05-08 19:52:45 +00:00
Brett Cannon bfb997d6a5 Make test.test_support.catch_warning() take an argument specifying if any
triggered warnings should be captured. This allows the context manager to be
used to just prevent the internal state of the 'warnings' framework and thus
allow triggered warnings to be displayed.
2008-05-08 19:50:51 +00:00
Brett Cannon 9d44182427 The mutex module has been deprecated for removal in 3.0. 2008-05-08 19:26:08 +00:00
Brett Cannon 80bb9d92e3 Deprecate the imputil module for removal in 3.0. 2008-05-08 18:15:14 +00:00
Barry Warsaw 6cc7940e10 Bump to 2.6a3 2008-05-08 13:16:19 +00:00
Ronald Oussoren c27b8b88e3 Fix for issue 1770190: platform.mac_ver() now returns the right
version on OSX 10.4.10
2008-05-08 10:34:39 +00:00
Raymond Hettinger cf98f03a62 The __all__ variable forgot to expose the gcd() function. 2008-05-08 04:36:12 +00:00
Benjamin Peterson 2e6407d813 Practice EAFP, and revert 62787 2008-05-07 23:11:54 +00:00
Christian Heimes 33e4a98a3e Replace more float hacks with correct math functions 2008-05-07 22:54:17 +00:00
Christian Heimes c2ca6db143 Disabled some unit tests for the upcoming release. See #2777 2008-05-06 23:42:58 +00:00
Brett Cannon e5d2cbaeaf Deprecate the audiodev module for 3.0. 2008-05-06 23:23:34 +00:00
Brett Cannon 79618239d1 When testing a module's __all__, we really don't care if it is deprecated. 2008-05-06 23:22:02 +00:00
Christian Heimes af748c3ab8 Implemented PEP 370 2008-05-06 22:41:46 +00:00
Benjamin Peterson 323c40d48c Make the Python implementation of warnings compatible with the C implementation regarding non-callable showwarning 2008-05-06 22:31:52 +00:00
Benjamin Peterson d295032910 Fix logic error in Python/_warnings.c and add a test to verify 2008-05-06 22:18:11 +00:00
Christian Heimes c8a0d2f368 Intern static string
Use float constructors instead of magic code for float constants
2008-05-06 16:18:41 +00:00
Gregory P. Smith 8e4997390c fix issue2707 - os.walk docstring example correctness typo. 2008-05-06 07:05:18 +00:00
Brett Cannon e3dcb01bfc Fix a bug in the handling of the stacklevel argument in warnings.warn() where
the stack was being unwound by two levels instead of one each time.
2008-05-06 04:37:31 +00:00
Benjamin Peterson 0b7f77847a PEP 8 nits in json package 2008-05-06 02:51:10 +00:00
Gregory P. Smith 24237ea8a1 Fix a bug introduced in r62627. see issue2760 and issue2632.
An assertion in readline() would fail as data was already in the
internal buffer even though the socket was in unbuffered read mode.
That case is now handled.  More importantly, read() has been fixed to
not over-recv() and leave newly recv()d data in the _fileobject buffer.

The max() vs min() issue in read() is now gone.  Neither was correct.
On bounded reads, always ask recv() for the exact amount of data we
still need.

Candidate for backporting to release25-maint along with r62627.
2008-05-05 21:53:45 +00:00
Brett Cannon 4b964f9c90 Add the 'json' package. Code taken from simplejson 1.9 and contributed by Bob
Ippolito.

Closes issue #2750.
2008-05-05 20:21:38 +00:00
Martin v. Löwis 5f2e0e5ccb Revert bogus checkin in r62724 to that file. 2008-05-05 17:54:01 +00:00
Martin v. Löwis c3ad68c88a Fix Unicode filename test. 2008-05-05 17:47:06 +00:00
Martin v. Löwis 471617d6d3 Issue #1734346: Support Unicode file names for zipfiles. 2008-05-05 17:16:58 +00:00
Brett Cannon 9c19bc6247 Remove the use of 'inspect' from 'warnings' for detected deprecated use of the
showwarning API. Turns out 'inspect' uses 'operator' which is an extension
module. That's a problem when it has not been built yet by setup.py.
2008-05-05 16:57:38 +00:00
Brett Cannon 8a232cc385 Add a DeprecationWarning for when warnings.showwarning() is set to a function
that lacks support for the new 'line' argument.
2008-05-05 05:32:07 +00:00
Benjamin Peterson 9ae080ee5a Remove method signatures from the docstrings of io.py 2008-05-04 22:39:33 +00:00
Georg Brandl 8d66dcd0f4 #2695: Do case-insensitive check for algorithms. 2008-05-04 21:40:44 +00:00
Gerhard Häring e11c9b3dfd Implemented feature request 2157: Converter names are cut off at '('
characters. This avoids the common case of something like 'NUMBER(10)' not
being parsed as 'NUMBER', like expected. Also corrected the docs about
converter names being case-sensitive. They aren't any longer.
2008-05-04 13:42:44 +00:00
Gerhard Häring 5a366c3b8b Applied sqliterow-richcmp.diff patch from Thomas Heller in Issue2152. The
sqlite3.Row type is now correctly hashable.
2008-05-04 13:15:12 +00:00
Mark Dickinson 71f3b85497 Make sure that Context traps and flags dictionaries have values 0 and 1
(as documented) rather than True and False.
2008-05-04 02:25:46 +00:00
Mark Dickinson 8aca9d032e Some very minor changes to decimal.py in Python 2.6, aimed
at reducing the size of the diff between the 2.x decimal.py
and 3.x decimal.py and thereby making future merges easier:

- replace one instnace of an old-style raise statement
- define __div__ in terms of __truediv__ instead of the
  other way around
- make wording match on an exception message
2008-05-04 02:05:06 +00:00
Benjamin Peterson 979395b7a8 Moved testing of builtin types out of test_builtin and into type specific modules 2008-05-03 21:35:18 +00:00
Mark Dickinson 1840c1abca Backport Raymond's changes in r60508 to Python 2.6.
'Context flags get set, not incremented'
2008-05-03 18:23:14 +00:00
Amaury Forgeot d'Arc 7684f85297 In test_io, StatefulIncrementalDecoderTest was not part of the test suite.
And of course, the test failed:
a bytearray was used without reason in io.TextIOWrapper.tell().

The difference is that iterating over bytes (i.e. str in python2.6) returns 1-char bytes,
whereas bytearrays yield integers.
This code should still work with python3.0
2008-05-03 12:21:13 +00:00
Brett Cannon 64a4bbeb25 Fix the C implementation of 'warnings' to infer the filename of the module that
raised an exception properly when __file__ is not set, __name__ == '__main__',
and sys.argv[0] is a false value.

Closes issue2743.
2008-05-03 03:19:39 +00:00
Ronald Oussoren 26f545c662 Fix for issue #2520 (cannot import macerrors) 2008-05-02 21:54:56 +00:00
Ronald Oussoren f2ef92cee7 Fix for #1905: PythonLauncher not working correctly on OSX 10.5/Leopard
This fixes both Python Launchar and the terminalcommand module.
2008-05-02 21:42:35 +00:00
Martin v. Löwis 6780a9dd9f Merged revisions 62263-62646 via svnmerge from
svn+ssh://pythondev@svn.python.org/sandbox/trunk/2to3/lib2to3

........
  r62470 | david.wolever | 2008-04-24 02:11:07 +0200 (Do, 24 Apr 2008) | 3 lines

  Fixed up and applied the patch for #2431 -- speeding up 2to3 with a lookup table.
........
  r62646 | martin.v.loewis | 2008-05-02 23:29:27 +0200 (Fr, 02 Mai 2008) | 2 lines

  Fix whitespace.
........
2008-05-02 21:30:20 +00:00
Facundo Batista ee340e501d Fixed some test structures. Thanks Mark Dickinson. 2008-05-02 17:39:00 +00:00
Mark Hammond 7c5c8e6823 #2581: Vista UAC/elevation support for bdist_wininst 2008-05-02 12:48:15 +00:00
Gregory P. Smith f8cc64017c This should fix issue2632. A long description of the two competing
problems is in the bug report (one old, one recently introduced trying
to fix the old one).  In short:

buffer data during socket._fileobject.read() and readlines() within a
cStringIO object instead of a [] of str()s returned from the recv()
call.

This prevents excessive memory use due to the size parameter being
passed to recv() being grossly larger than the actual size of the data
returned *and* prevents excessive cpu usage due to looping in python
calling recv() with a very tiny size value if min() is used as the
previous memory-use bug "fix" did.

It also documents what the socket._fileobject._rbufsize member is
actually used for.

This is a candidate for back porting to 2.5.
2008-05-02 07:26:52 +00:00
Benjamin Peterson 95287fa951 Remove some from __future__ import with_statements 2008-04-30 21:25:55 +00:00
Georg Brandl 655fc7012a #1748: use functools.wraps instead of rolling own metadata update. 2008-04-30 21:08:42 +00:00
Benjamin Peterson d8f2d0bdb3 make test_support's captured_output a bit more robust when exceptions happen 2008-04-30 21:03:58 +00:00
Georg Brandl 28e0873f1f #2719: backport next() from 3k. 2008-04-30 19:47:09 +00:00
Eric Smith 0a95063d73 Issue 2526, float.__format__ 'n' specifier does not support thousands grouping.
Implemented grouping, with tests.
Cleaned up PyOS_ascii_formatd by breaking reformatting into smaller functions.
2008-04-30 01:09:30 +00:00
Amaury Forgeot d'Arc 87da1278eb test_sundry performs minimal tests (a simple import...) on modules that are not tested otherwise.
Some of them now have tests and can be removed.
Only 70 to go...
2008-04-28 21:07:06 +00:00
Brett Cannon 8dc4303297 Rename the test_traceback_print() function to traceback_print() to prevent
test_capi from automatically calling the function.
2008-04-28 04:50:06 +00:00
Skip Montanaro b8bdbc04e7 Get rid of _test(), _main(), _debug() and _check(). Tests are no longer
needed (better set available in Lib/test/test_robotparser.py).  Clean up a
few PEP 8 nits (compound statements on a single line, whitespace around
operators).
2008-04-28 03:27:53 +00:00
Brett Cannon 141534e56f Fix a bug introduced by the warnings rewrite where tracebacks were being
improperly indented.

Closes issue #2699.
2008-04-28 03:23:50 +00:00
Skip Montanaro fe1372c7d5 Minor cleanups:
* Avoid creating unused local variables where we can.  Where we can't prefix
  the unused variables with '_'.
* Avoid shadowing builtins where it won't change the external interface of a
  function.
* Use None as default path arg to readmodule and readmodule_ex.
2008-04-28 02:57:23 +00:00
Skip Montanaro ea59a84244 A few small changes:
* The only exception we should catch when trying to import cStringIO is an
  ImportError.
* Delete the function signatures embedded in the mk*temp docstrings.
* The tempdir global variable was initialized twice.
2008-04-27 22:49:56 +00:00
Kurt B. Kaiser 83101909cb Autocompletion of filenames now support alternate separators, e.g. the
'/' char on Windows.  Patch 2061 Tal Einat.
2008-04-27 21:52:19 +00:00
Kurt B. Kaiser 9c5c0af804 Improved AutoCompleteWindow logic. Patch 2062 Tal Einat. 2008-04-27 21:38:05 +00:00
Kurt B. Kaiser 93cdae5f81 Home / Control-A toggles between left margin and end of leading white
space.  Patch 1196903 Jeff Shute.

M    idlelib/PyShell.py
M    idlelib/EditorWindow.py
M    idlelib/NEWS.txt
2008-04-27 21:07:41 +00:00
Alexandre Vassalotti ba08f072d2 Fixed URL of PEP 205 in weakref's module docstring. 2008-04-27 00:52:24 +00:00
Benjamin Peterson 14204ad982 Allow test_import to work when it is invoked directly 2008-04-25 21:43:56 +00:00
Mark Dickinson fe536f53ea Issue 2635: fix bug in the fix_sentence_endings option to textwrap.fill. 2008-04-25 16:59:09 +00:00
Thomas Heller 6ad5fbb7ea Add from_buffer and from_buffer_copy class methods to ctypes types. 2008-04-25 15:44:16 +00:00
Armin Rigo 5364e2e46f A new crasher. 2008-04-25 09:35:18 +00:00
Amaury Forgeot d'Arc 1c596d5604 Use absolute import for test package 2008-04-24 20:41:50 +00:00
Amaury Forgeot d'Arc 747720540c Add a few tests for pydoc.
This is a modified version of a patch proposed by Humberto Diogenes
in the discussion of issue1883.

I will merge manually this change into the py3k branch: the tests must be adapted.
2008-04-24 20:22:26 +00:00
Amaury Forgeot d'Arc 48ebc264f8 Disable gc when running test_trace, or we may record the __del__ of collected objects.
See http://mail.python.org/pipermail/python-checkins/2008-April/068633.html
the extra events perfectly match several calls to socket._fileobject.__del__()
2008-04-24 20:10:26 +00:00
Amaury Forgeot d'Arc 5216721a53 Issue2681: the literal 0o8 was wrongly accepted, and evaluated as float(0.0).
This happened only when 8 is the first digit.
Credits go to Lukas Meuser.
2008-04-24 18:07:05 +00:00
Amaury Forgeot d'Arc 9686585a82 Issue #2670: urllib2.build_opener() failed when two handlers
derive the same default base class.

Will backport.
2008-04-22 21:14:41 +00:00
Gregory P. Smith 19b4411181 Major improvements:
* Default to using /dev/tty for the password prompt and input before
  falling back to sys.stdin and sys.stderr.
* Use sys.stderr instead of sys.stdout.
* print the 'password may be echoed' warning to stream used to display
  the prompt rather than always sys.stderr.
* warn() with GetPassWarning when input may be echoed.
2008-04-22 08:08:41 +00:00
Amaury Forgeot d'Arc dd8d824a56 Issue 2665: On Windows, sys.stderr does not contain a valid file when running without a console.
It seems to work, but will fail at the first flush.

This causes IDLE to crash when too many warnings are printed.

Will backport.
2008-04-21 22:35:30 +00:00
Gregory P. Smith 41e3018336 If sys.stdin is not a tty, fall back to default_getpass after printing
a warning instead of failing with a termios.error.
2008-04-21 21:31:08 +00:00
Andrew M. Kuchling a5489d415e Comment typo 2008-04-21 01:45:57 +00:00
Amaury Forgeot d'Arc eac43afdc9 Correct an apparent refleak in test_pkgutil: zipimport._zip_directory_cache contains
info for all processed zip files, even when they are no longer used.
2008-04-20 21:02:21 +00:00
Mark Dickinson d6d5148b44 Add test for tanh(-0.) == -0. on IEEE 754 systems 2008-04-20 20:38:48 +00:00
Mark Dickinson cec3f138d8 Yet more explicit special case handling to make
math.pow behave on alpha Tru64.  All IEEE 754
special values are now handled directly; only
the finite**finite case is handled by libm.
2008-04-20 04:13:13 +00:00
Mark Dickinson 9f99d70513 Report additional diagnostic information in
test_math, to help track down debian-alpha
buildbot failure.
2008-04-20 01:22:30 +00:00
Mark Dickinson e941d97d12 Additional tests for math.pow, and extra special-case
handling code in math.pow, in the hope of making all
tests pass on the alpha Tru64 buildbot.
2008-04-19 18:51:48 +00:00
Christian Heimes e74c8f2879 Added kill, terminate and send_signal to subprocess.Popen
The bits and pieces for the Windows side were already in place. The POSIX side is trivial (as usual) and uses os.kill().
2008-04-19 02:23:57 +00:00
Amaury Forgeot d'Arc 607bff1ebe Some tests did not pass on repeated calls (regrtest -R::)
Perform additional cleanup, mostly deleting from sys.modules, or clearing the warnings registry.
2008-04-18 23:31:33 +00:00
Christian Heimes 6f34109384 I finally got the time to update and merge Mark's and my trunk-math branch. The patch is collaborated work of Mark Dickinson and me. It was mostly done a few months ago. The patch fixes a lot of loose ends and edge cases related to operations with NaN, INF, very small values and complex math.
The patch also adds acosh, asinh, atanh, log1p and copysign to all platforms. Finally it fixes differences between platforms like different results or exceptions for edge cases. Have fun :)
2008-04-18 23:13:07 +00:00
Skip Montanaro b131f0468f resolve issue 2014 2008-04-18 20:35:46 +00:00
Nick Coghlan 1e88992224 Add test file missing from rev 62350 2008-04-15 10:28:14 +00:00
Nick Coghlan 106fc48336 Issue 2439: add pkgutils.get_data() as a convenience wrapper for the PEP 302 get_data() API (contributed by Paul Moore) 2008-04-15 10:25:31 +00:00
Thomas Heller 046e6a43ff Issue #2616: Implement ctypes.pointer() and ctypes.POINTER() in C for
better performance.
2008-04-14 16:10:07 +00:00
Brett Cannon c477427eba Fix spliting on colons on Windows machines with a file path by limiting the
number of splits.
2008-04-13 17:41:31 +00:00
Brett Cannon 25bb8182c6 Add an explicit check for output in a test to try to diagnose a failure on
Windows.
2008-04-13 17:09:43 +00:00
Skip Montanaro e3d3785e11 spelling 2008-04-13 03:17:30 +00:00
Brett Cannon 667bb4f236 Fix test_warnings by making the state of things more consistent for each test
when it is run.
2008-04-13 02:42:36 +00:00
Benjamin Peterson a3d19f35c4 Backport the removal of a __repr__ from 62251 2008-04-13 02:05:48 +00:00
Benjamin Peterson 7bb4d2d0fa Backported io module docs 2008-04-13 02:01:27 +00:00
Brett Cannon e974689038 Re-implement the 'warnings' module in C. This allows for usage of the
'warnings' code in places where it was previously not possible (e.g., the
parser). It could also potentially lead to a speed-up in interpreter start-up
if the C version of the code (_warnings) is imported over the use of the
Python version in key places.

Closes issue #1631171.
2008-04-12 23:44:07 +00:00
Gregory P. Smith e6c03033af socket.error inherits from IOError, it no longer needs listing in
the all_errors tuple.
2008-04-12 22:24:04 +00:00
Neal Norwitz 36a59b4a08 Remove the test file before writing it in case there is no write permission.
This might help fix some of the failures on Windows box(es).  It doesn't hurt
either way and ensure the tests are a little more self contained (ie have
less assumptions).
2008-04-10 05:46:39 +00:00
Martin v. Löwis 60a819d681 Merged revisions 62080-62262 via svnmerge from
svn+ssh://pythondev@svn.python.org/sandbox/trunk/2to3/lib2to3

........
  r62092 | collin.winter | 2008-04-01 18:27:10 +0200 (Di, 01 Apr 2008) | 1 line

  Add get_prev_sibling() to complement pytree's get_next_sibling().
........
  r62226 | collin.winter | 2008-04-08 21:07:56 +0200 (Di, 08 Apr 2008) | 1 line

  Add min() and max() to the list of special contexts that don't require adding list() calls around dict methods.
........
  r62232 | collin.winter | 2008-04-09 00:12:38 +0200 (Mi, 09 Apr 2008) | 4 lines

  Fix for http://bugs.python.org/issue2596

  This extends fix_xrange to know about the (mostly) same special contexts as fix_dict (where a special context is something that is guaranteed to fully consume the iterable), adding list() calls where appropriate. It also special-cases "x in range(y)".
........
2008-04-10 02:48:01 +00:00
Gregory P. Smith f108320055 better diagnostics 2008-04-09 23:11:56 +00:00
Georg Brandl 99bb5f3fef #2585: initialize code attribute of HTTPError. 2008-04-09 17:57:38 +00:00
Jerry Seutter 8f80a6a5f9 Changed test so it no longer runs as a side effect of importing. 2008-04-09 05:07:58 +00:00
Trent Nelson 6c4a7c6821 Fix typo with regards to self.PORT shadowing class variables with the same name. 2008-04-09 00:34:53 +00:00
Gregory P. Smith 79e42a0e08 Fix zlib crash from zlib.decompressobj().flush(val) when val was not positive.
It tried to allocate negative or zero memory.  That fails.
2008-04-09 00:25:17 +00:00
Trent Nelson e41b0061dd - Issue #2550: The approach used by client/server code for obtaining ports
to listen on in network-oriented tests has been refined in an effort to
  facilitate running multiple instances of the entire regression test suite
  in parallel without issue.  test_support.bind_port() has been fixed such
  that it will always return a unique port -- which wasn't always the case
  with the previous implementation, especially if socket options had been
  set that affected address reuse (i.e. SO_REUSEADDR, SO_REUSEPORT).  The
  new implementation of bind_port() will actually raise an exception if it
  is passed an AF_INET/SOCK_STREAM socket with either the SO_REUSEADDR or
  SO_REUSEPORT socket option set.  Furthermore, if available, bind_port()
  will set the SO_EXCLUSIVEADDRUSE option on the socket it's been passed.
  This currently only applies to Windows.  This option prevents any other
  sockets from binding to the host/port we've bound to, thus removing the
  possibility of the 'non-deterministic' behaviour, as Microsoft puts it,
  that occurs when a second SOCK_STREAM socket binds and accepts to a
  host/port that's already been bound by another socket.  The optional
  preferred port parameter to bind_port() has been removed.  Under no
  circumstances should tests be hard coding ports!

  test_support.find_unused_port() has also been introduced, which will pass
  a temporary socket object to bind_port() in order to obtain an unused port.
  The temporary socket object is then closed and deleted, and the port is
  returned.  This method should only be used for obtaining an unused port
  in order to pass to an external program (i.e. the -accept [port] argument
  to openssl's s_server mode) or as a parameter to a server-oriented class
  that doesn't give you direct access to the underlying socket used.

  Finally, test_support.HOST has been introduced, which should be used for
  the host argument of any relevant socket calls (i.e. bind and connect).

  The following tests were updated to following the new conventions:
    test_socket, test_smtplib, test_asyncore, test_ssl, test_httplib,
    test_poplib, test_ftplib, test_telnetlib, test_socketserver,
    test_asynchat and test_socket_ssl.

  It is now possible for multiple instances of the regression test suite to
  run in parallel without issue.
2008-04-08 23:47:30 +00:00
Amaury Forgeot d'Arc 7adc776ea6 Issue 2408: remove the _types module
It was only used as a helper in types.py to access types (GetSetDescriptorType and MemberDescriptorType),
when they can easily be obtained with python code.
These expressions even work with Jython.

I don't know what the future of the types module is; (cf. discussion in http://bugs.python.org/issue1605 )
at least this change makes it simpler.
2008-04-08 22:07:05 +00:00
Amaury Forgeot d'Arc 24f3c5c646 Prevent an error when inspect.isabstract() is called with something else than a new-style class. 2008-04-08 21:51:57 +00:00
Amaury Forgeot d'Arc 4b798bdf8a Issue2564: Prevent a hang in "import test.autotest", which runs the entire test
suite as a side-effect of importing the module.

- in test_capi, a thread tried to import other modules
- re.compile() imported sre_parse again on every call.
2008-04-08 21:27:42 +00:00
Mark Hammond 495cf99aaf Issue #2513: enable 64bit cross compilation on windows. 2008-04-07 01:53:39 +00:00
Gregory P. Smith aa63d0d4af Make file objects as thread safe as the underlying libc FILE* implementation.
close() will now raise an IOError if any operations on the file object
are currently in progress in other threads.

Most code was written by Antoine Pitrou (pitrou).  Additional testing,
documentation and test suite cleanup done by me (gregory.p.smith).

Fixes issue 815646 and 595601 (as well as many other bugs and
references to this problem dating back to the dawn of Python).
2008-04-06 23:11:17 +00:00
Jeffrey Yasskin ee76777846 Add enough debugging information to diagnose failures where the
HandlerBException is ignored, and fix one such problem, where it was thrown
during the __del__ method of the previous Popen object.

We may want to find a better way of printing verbose information so it's not
spammy when the test passes.
2008-04-06 23:04:28 +00:00
Thomas Wouters 2fab8f1abb Fix test_distutils to not fail when running 'make test' from a Python build
directory that is not the source directory (ie, one created using
'/path/to/source/configure'.) Leaves this test very slightly degraded in
that particular case, compared to the build-in-sourcedir case, but that case
isn't a particularly strong test either: neither test the actual path that
will be used after installing. There isn't a particularly good way to test
this, and a poor test beats a failing test.
2008-04-05 23:39:15 +00:00
Neal Norwitz 8510195ceb Prevent test_sqlite from hanging on older versions of sqlite.
The problem is that when trying to do the second insert, sqlite seems to sleep
for a very long time.  Here is the output from strace:

  read(6, "SQLite format 3\0\4\0\1\1\0@  \0\0\0\1\0\0\0\0"..., 1024) = 1024
  nanosleep({4294, 966296000},  <unfinished ...>

I don't know which version this was fixed in, but 3.2.1 definitely fails.
2008-04-05 04:26:31 +00:00
Trent Nelson 4bffe8293f Revert r62152 (Issue #2550). Being able to observe the results of all the buildbots was certainly useful. All of the platforms that have some form of BSD lineage -- FreeBSD, OS X, Solaris and Tru64 -- all pass the test. Windows and Linux, on the other hand, don't. Windows I knew about, Linux was a surprise. Knowing this, I believe a more appropriate fix will revolve around test_support.bind_socket() -- this method needs to return a port that nothing in the system has bound already. The best way to do this may just be to rely on ephemeral ports, rather than having the user specify a desired port, then fall back to four random ports, then try 0. 2008-04-04 20:04:09 +00:00
Trent Nelson b8e120c7c0 Issue 2550: extend test_socket.py to test SO_REUSEADDR semantics when bind() is called on identical (host, port) combinations in two separate sockets. This should raise an EADDRINUSE socket.error in all cases, irrespective of whether or not SO_REUSEADDR is set on the sockets. However, with Windows, when SO_REUSEADDR is set on the sockets, no error is thrown (an error is thrown when the option isn't set), which results in an extremely wedged python process whenever accept() is called on either of the bound sockets. I'm committing this test now to observe if it's only Windows that has this behaviour (via the buildbots). Note: this WILL break all Windows buildbots for now; once I've observed the results on other platforms, I'll revert, then start looking into a patch. 2008-04-04 17:26:21 +00:00
Jeffrey Yasskin e71d8124c2 Oops again. EINTR is in errno, not signal. 2008-04-04 16:48:19 +00:00
Fred Drake 449651558c stupid, stupid, stupid! 2008-04-04 11:38:51 +00:00
Fred Drake fe7056240b my previous change did what I said it should not: it changed the current
directory to the directory in which the setup.py script lived (which made
__file__ wrong)

fixed, with test that the script is run in the current directory of the caller
2008-04-04 11:31:14 +00:00
Thomas Heller 8e8ba151dd Issue #2543: Make ctypes compatible (again) with Python 2.3, 2.4, and 2.5. 2008-04-04 08:35:44 +00:00
Fred Drake 46c58c17f1 - Issue #2385: distutils.core.run_script() makes __file__ available, so the
controlled environment will more closely mirror the typical script
  environment.  This supports setup.py scripts that refer to data files.
2008-04-04 05:41:30 +00:00
Jeffrey Yasskin 2b860db35c Doh! os.read() raises an OSError, not an IOError when it's interrupted.
And fix some flakiness in test_itimer_prof, which could detect that the timer
had reached 0 before the signal arrived announcing that fact.
2008-04-04 04:51:19 +00:00
Amaury Forgeot d'Arc d7a265129c #1733757: the interpreter would hang on shutdown, if the function set by sys.settrace
calls threading.currentThread.

The correction somewhat improves the code, but it was close.
Many thanks to the "with" construct, which turns python code into C calls.

I wonder if it is not better to sys.settrace(None) just after
running the __main__ module and before finalization.
2008-04-03 23:07:55 +00:00
Barry Warsaw 9649cdd5d4 Updating for 2.6a2 2008-04-03 04:10:02 +00:00
Amaury Forgeot d'Arc f7cf388c31 Remove debug prints; the buildbot now passes the tests 2008-04-02 21:18:46 +00:00
Vinay Sajip e5aefa0b30 Fix: #2315, #2316, #2317: TimedRotatingFileHandler - changed logic to better handle daylight savings time, deletion of old log files, and fixed a bug in calculating rollover when no logging occurs for a longer interval than the rollover period. 2008-04-02 21:09:27 +00:00
Neal Norwitz d0a91afa70 Apply same patch from 3k branch to try and prevent this test from hanging
on various platforms, most recently the Alpha Tru64.
2008-04-02 05:54:27 +00:00
Jeffrey Yasskin ab56131720 Try to make test_signal less flaky. I still see some flakiness in
test_itimer_prof.
2008-04-02 04:07:44 +00:00
Amaury Forgeot d'Arc cb0f2ad0c2 A DocTestSuite cannot run multiple times: it clears its globals dictionary after the first run.
Rebuild the DocTestSuite on each iteration.
2008-04-02 00:55:04 +00:00
Amaury Forgeot d'Arc 4d0c1170ef Correct the apparent refleak in test_io:
When cls is an ABCMeta, every call to isinstance(x, cls)
records type(x) in the cls._abc_cache of cls_abc_negative_cache.
So we clear these caches at the end of the test.

inspect.isabstract() is not the correct test for all ABCs, because there is no @abstractmethod in io.py (why?)
isinstance(cls, ABCMeta) would be more exact, but it fails with an infinite recursion.
So I used a hack to determine whether a class is an ABCMeta.

The true correction would be to turn cls._abc_cache &co into a WeakSet, as py3k does.
But classic classes are not weak referenceable...

Of course, this change should not be merged into the py3k branch.
2008-04-02 00:25:14 +00:00
Amaury Forgeot d'Arc f0a49708eb Newly enabled test appears to leak:
it registers the same codec on each iteration.
Do it only once at load time.
2008-04-01 22:52:48 +00:00
Amaury Forgeot d'Arc ce6f6c12c6 Fix and enable a skipped test:
with python 2.6, enumerating bytes yields 1-char strings, not numbers.

Don't merge this into the py3k branch.
2008-04-01 22:37:33 +00:00
Brett Cannon 8820f2a979 Add ``if __name__ == '__main__'`` to some test files where it didn't take a lot
of effort to do so.
2008-04-01 12:46:02 +00:00
Brett Cannon 8d2a90af2d Generalize test.test_support.test_stdout() with a base context manager so that
it is easy to capture stderr if desired.
2008-04-01 12:37:43 +00:00
Neal Norwitz d48a2f77f0 Be sure to close the file. 2 places were deleting the file, so it was probably
fine, but the last change may be required for the test to pass on Windows.
Should we always close the mmap too?
2008-04-01 05:40:43 +00:00
Martin v. Löwis affbe80a54 Merged revisions 61990-62079 via svnmerge from
svn+ssh://pythondev@svn.python.org/sandbox/trunk/2to3/lib2to3

........
  r62017 | david.wolever | 2008-03-28 21:54:37 +0100 (Fr, 28 Mär 2008) | 1 line

  Fixed an out-of-date comment.
........
2008-03-31 05:20:55 +00:00
Jeffrey Yasskin 105f3d4fdc Block the sys.exc_clear -3 warning from threading.py. 2008-03-31 00:35:53 +00:00
Georg Brandl e34c21c2a0 Make AST nodes pickleable. 2008-03-30 20:20:39 +00:00
Georg Brandl 2c55c597fa Make _fields attr for no fields consistent with _attributes attr. 2008-03-30 19:00:49 +00:00
Georg Brandl ebc8dedd19 Convert test_ast to unittest and add a test for r62049. 2008-03-30 07:09:22 +00:00
Georg Brandl c87c5800e7 Adapt test_ast to the new ExceptHandler type. 2008-03-30 06:53:55 +00:00
Benjamin Peterson 5b63acd31e #2503 make singletons compared with "is" not == or !=
Thanks to Wummel for the patch
2008-03-29 15:24:25 +00:00
Amaury Forgeot d'Arc 672fbf5195 Still investigating on the hanging test_socket.
the test itself doesn't do anything on windows, focus on setUp and tearDown.
2008-03-29 14:53:05 +00:00
Amaury Forgeot d'Arc 5e08e8b15c The buildbot "x86 W2k8 trunk" seems to hang in test_socket.
http://www.python.org/dev/buildbot/trunk/x86%20W2k8%20trunk/builds/255/step-test/0

Temporarily increase verbosity of this test.
2008-03-29 13:47:05 +00:00
Georg Brandl f2bfd54d6f Properly check for consistency with the third argument of
compile() when compiling an AST node.
2008-03-29 13:24:23 +00:00
Amaury Forgeot d'Arc ea13dc629c Now that Lib/test/output is gone, tests should not print anything,
except in verbose mode.
Support code is much simpler.
2008-03-29 13:14:52 +00:00
Amaury Forgeot d'Arc bae17a8aa1 lib2to3 should install a logging handler only when run as a main program,
not when used as a library.

This may please the buildbots, which fail when test_lib2to3 is run before test_logging.
2008-03-29 12:42:54 +00:00
Amaury Forgeot d'Arc 2aece57d7f Correctly call the base class tearDown();
otherwise running test_logging twice produce the errors we see on all buildbots
2008-03-29 01:42:31 +00:00
Amaury Forgeot d'Arc 504a48f90a Revert my experiment. I found one reason of failures in test_logging. 2008-03-29 01:41:08 +00:00
Amaury Forgeot d'Arc 554d4f0c13 At least let the module compile 2008-03-29 00:49:07 +00:00
Amaury Forgeot d'Arc 8a69707b80 Try to understand why most buildbots suddenly turned to red.
Undo the only change that might have unexpected effects.

To be followed.
2008-03-29 00:44:58 +00:00
Benjamin Peterson 41cf50d613 #2498 modernized try, except, finally statements in bdb 2008-03-28 20:56:00 +00:00
Gregory P. Smith a98be45f18 These svn adds were forgotten in r62000 2008-03-28 20:11:49 +00:00
Gerhard Häring 2a11c05b9d Update sqlite3 module to match current version of pysqlite. 2008-03-28 20:08:36 +00:00
Georg Brandl fc8eef3c78 Patch #1810 by Thomas Lee, reviewed by myself:
allow compiling Python AST objects into code objects
in compile().
2008-03-28 12:11:56 +00:00
Gregory P. Smith b9803421d2 Accept patch issue2426 by Paul Kippes (kippesp).
Adds sqlite3.Connection.iterdump to allow dumping of databases.
2008-03-28 08:32:09 +00:00
Gregory P. Smith 0001c2ecbc This patch moves some tests from test_urllib2_net to test_urllib2_localnet.
The moved tests use a local server rather than going out to external servers.

Accepts patch from issue2429.

Contributed by Jerry Seutter & Michael Foord (fuzzyman) at PyCon 2008.
2008-03-28 08:00:44 +00:00
Neal Norwitz ab364c4366 Name the main method correctly so the test is run 2008-03-28 07:36:31 +00:00
Neal Norwitz 70cea58c84 Bug 1503: Get the test to pass on OSX. This should make the test more
reliable, but I'm not convinced it is the right solution.  We need
to determine if this causes the test to hang on any platforms or do
other bad things.

Even if it gets the test to pass reliably, it might be that we want
to fix this in socket.  The socket returned from accept() is different
on different platforms (inheriting attributes or not) and we might
want to ensure that the attributes (at least blocking) is the same
across all platforms.
2008-03-28 06:34:03 +00:00
Martin v. Löwis 85a896902c Merged revisions 61825-61989 via svnmerge from
svn+ssh://pythondev@svn.python.org/sandbox/trunk/2to3/lib2to3

........
  r61899 | collin.winter | 2008-03-25 17:53:41 +0100 (Di, 25 Mär 2008) | 1 line

  Add a missing explicit fixer to test_all_fixers.
........
  r61983 | collin.winter | 2008-03-28 03:19:46 +0100 (Fr, 28 Mär 2008) | 2 lines

  Fix http://bugs.python.org/issue2453: support empty excepts in fix_except.
........
2008-03-28 05:27:44 +00:00
Martin v. Löwis 53dbcd33a9 Run 2to3 tests. 2008-03-28 05:26:10 +00:00
Martin v. Löwis fac4f095c1 Disable test that depends on #2412 being fixed. 2008-03-28 05:25:36 +00:00
Jeffrey Yasskin 36550bdde9 Print more information the next time test_socket throws the wrong exception. 2008-03-28 04:53:10 +00:00
Neal Norwitz 023cd00ccc Allow use of other ports so the test can pass if 9091 is in use 2008-03-28 04:41:34 +00:00
Jeffrey Yasskin 8b9091fba0 Kill a race in test_threading in which the exception info in a thread finishing
up after it was joined had a traceback pointing to that thread's (deleted)
target attribute, while the test was trying to check that the target was
destroyed. Big thanks to Antoine Pitrou for diagnosing the race and pointing
out sys.exc_clear() to kill the exception early. This fixes issue 2496.
2008-03-28 04:11:18 +00:00
Amaury Forgeot d'Arc 7db15fe9d9 test_future3.py is a regular test file, and should be part of the test suite 2008-03-28 00:21:34 +00:00
Amaury Forgeot d'Arc da0c025a43 Issue2495: tokenize.untokenize did not insert space between two consecutive string literals:
"" "" => """", which is invalid code.

Will backport
2008-03-27 23:23:54 +00:00
Georg Brandl 853e44ca8c The bug for which there was a test in outstanding_bugs.py was agreed not to be a bug. 2008-03-27 13:34:59 +00:00
Georg Brandl deaf2cafbd #2248: return result of QUIT from quit(). 2008-03-27 13:27:31 +00:00
Christian Heimes 6c052fd523 Fixed tokenize tests
The tokenize module doesn't understand __future__.unicode_literals yet
2008-03-27 11:46:37 +00:00
Eric Smith 23a48ad101 Added test cases for single quoted strings, both forms of triple quotes,
and some string concatenations.
Removed unneeded __future__ print_function import.
2008-03-27 09:42:35 +00:00
Neal Norwitz 311d071541 Fix test_compiler after adding unicode_literals 2008-03-27 05:02:57 +00:00
Christian Heimes 3784c6b1af Use the new unicode literals for the io module
use basestring instead of str in Python 2.x
2008-03-26 23:13:59 +00:00
Christian Heimes fa50bad957 I forgot to svn add the future test 2008-03-26 22:55:31 +00:00
Christian Heimes 3c60833e1e Patch #2477: Added from __future__ import unicode_literals
The new PyParser_*Ex() functions are based on Neal's suggestion and initial patch. The new __future__ feature makes all '' and r'' unicode strings. b'' and br'' stay (byte) strings.
2008-03-26 22:01:37 +00:00
Christian Heimes 1a6387e683 Merged revisions 61750,61752,61754,61756,61760,61763,61768,61772,61775,61805,61809,61812,61819,61917,61920,61930,61933-61934 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/trunk-bytearray

........
  r61750 | christian.heimes | 2008-03-22 20:47:44 +0100 (Sat, 22 Mar 2008) | 1 line

  Copied files from py3k w/o modifications
........
  r61752 | christian.heimes | 2008-03-22 20:53:20 +0100 (Sat, 22 Mar 2008) | 7 lines

  Take One
  * Added initialization code, warnings, flags etc. to the appropriate places
  * Added new buffer interface to string type
  * Modified tests
  * Modified Makefile.pre.in to compile the new files
  * Added bytesobject.c to Python.h
........
  r61754 | christian.heimes | 2008-03-22 21:22:19 +0100 (Sat, 22 Mar 2008) | 2 lines

  Disabled bytearray.extend for now since it causes an infinite recursion
  Fixed serveral unit tests
........
  r61756 | christian.heimes | 2008-03-22 21:43:38 +0100 (Sat, 22 Mar 2008) | 5 lines

  Added PyBytes support to several places:
  str + bytearray
  ord(bytearray)
  bytearray(str, encoding)
........
  r61760 | christian.heimes | 2008-03-22 21:56:32 +0100 (Sat, 22 Mar 2008) | 1 line

  Fixed more unit tests related to type('') is not unicode
........
  r61763 | christian.heimes | 2008-03-22 22:20:28 +0100 (Sat, 22 Mar 2008) | 2 lines

  Fixed more unit tests
  Fixed bytearray.extend
........
  r61768 | christian.heimes | 2008-03-22 22:40:50 +0100 (Sat, 22 Mar 2008) | 1 line

  Implemented old buffer interface for bytearray
........
  r61772 | christian.heimes | 2008-03-22 23:24:52 +0100 (Sat, 22 Mar 2008) | 1 line

  Added backport of the io module
........
  r61775 | christian.heimes | 2008-03-23 03:50:49 +0100 (Sun, 23 Mar 2008) | 1 line

  Fix str assignement to bytearray. Assignment of a str of size 1 is interpreted as a single byte
........
  r61805 | christian.heimes | 2008-03-23 19:33:48 +0100 (Sun, 23 Mar 2008) | 3 lines

  Fixed more tests
  Fixed bytearray() comparsion with unicode()
  Fixed iterator assignment of bytearray
........
  r61809 | christian.heimes | 2008-03-23 21:02:21 +0100 (Sun, 23 Mar 2008) | 2 lines

  str(bytesarray()) now returns the bytes and not the representation of the bytearray object
  Enabled and fixed more unit tests
........
  r61812 | christian.heimes | 2008-03-23 21:53:08 +0100 (Sun, 23 Mar 2008) | 3 lines

  Clear error PyNumber_AsSsize_t() fails
  Use CHARMASK for ob_svall access
  disabled a test with memoryview again
........
  r61819 | christian.heimes | 2008-03-23 23:05:57 +0100 (Sun, 23 Mar 2008) | 1 line

  Untested updates to the PCBuild directory
........
  r61917 | christian.heimes | 2008-03-26 00:57:06 +0100 (Wed, 26 Mar 2008) | 1 line

  The type system of Python 2.6 has subtle differences to 3.0's. I've removed the Py_TPFLAGS_BASETYPE flags from bytearray for now. bytearray can't be subclasses until the issues with bytearray subclasses are fixed.
........
  r61920 | christian.heimes | 2008-03-26 01:44:08 +0100 (Wed, 26 Mar 2008) | 2 lines

  Disabled last failing test
  I don't understand what the test is testing and how it suppose to work. Ka-Ping, please check it out.
........
  r61930 | christian.heimes | 2008-03-26 12:46:18 +0100 (Wed, 26 Mar 2008) | 1 line

  Re-enabled bytes warning code
........
  r61933 | christian.heimes | 2008-03-26 13:20:46 +0100 (Wed, 26 Mar 2008) | 1 line

  Fixed a bug in the new buffer protocol. The buffer slots weren't copied into a subclass.
........
  r61934 | christian.heimes | 2008-03-26 13:25:09 +0100 (Wed, 26 Mar 2008) | 1 line

  Re-enabled bytearray subclassing - all tests are passing.
........
2008-03-26 12:49:49 +00:00
Benjamin Peterson 13be2cf284 Added help options to PDB 2008-03-26 11:57:47 +00:00
Jerry Seutter fc7b3e3aa2 Changed test so it no longer runs as a side effect of importing. 2008-03-26 05:58:14 +00:00
Jerry Seutter 9f7af8d4da Changed test so it no longer runs as a side effect of importing. 2008-03-26 05:32:51 +00:00
Neal Norwitz 22b3e3aff8 Ensure that the mailbox is closed to prevent problems on Windows with removing
an open file.  This doesn't seem to be a problem in 2.6, but that appears
to be somewhat accidental (specific to reference counting).  When this
gets merged to 3.0, it will make the 3.0 code simpler.
2008-03-26 05:19:41 +00:00
Jerry Seutter 14f0bc7900 Changed test so it no longer runs as a side effect of importing. 2008-03-26 05:03:03 +00:00
Neal Norwitz 85fc3c1f1c Try to get this test to be less flaky. It was failing sometimes because
the connect would succeed before the timeout occurred.  Try using an
address and port that hopefully doesn't exist to ensure we get no response.
If this doesn't work, we can use a public address close to python.org
and hopefully that address never gets taken.
2008-03-26 04:55:51 +00:00
Mark Dickinson 8e85ffa4b2 Issue #2482: Make sure that the coefficient of a Decimal
instance is always stored as a str instance, even
when that Decimal has been created from a unicode string.
2008-03-25 18:47:59 +00:00
Mark Dickinson 3b24ccbe7e Issue #2478: Decimal(sqrt(0)) failed when the decimal context
was not explicitly supplied.
2008-03-25 14:33:23 +00:00
Georg Brandl d5b635f196 Make Py3k warnings consistent w.r.t. punctuation; also respect the
EOL 80 limit and supply more alternatives in warning messages.
2008-03-25 08:29:14 +00:00
Georg Brandl 80055f6295 #2355: py3k warning for buffer(). 2008-03-25 07:56:27 +00:00
Neal Norwitz bb89e686e3 Try to get this test to be more stable:
* disable gc during the test run because we are spawning objects and there
   was an exception when calling Popen.__del__
 * Always set an alarm handler so the process doesn't exit if the test fails
   (should probably add assertions on the value of hndl_called in more places)
 * Using a negative time causes Linux to treat it as zero, so disable that test.
2008-03-25 07:00:39 +00:00
Neal Norwitz be9160b035 Don't try to close a non-open file.
Don't let file removal cause the test to fail.
2008-03-25 06:35:10 +00:00
Gregory P. Smith 88440960f9 A stab in the dark attempt to fix the alpha/tru64 buildbot problem and add more
test coverage of valid inputs to zlib.crc32.
2008-03-25 06:12:45 +00:00
Neal Norwitz 40f5e4c5a2 Fix a bunch of UnboundLocalErrors when the tests fail. 2008-03-25 04:17:38 +00:00
Martin v. Löwis aef18b1c67 Patch #2240: Implement signal.setitimer and signal.getitimer. 2008-03-24 13:31:16 +00:00
Raymond Hettinger b72233ce63 Issue 2460: Make Ellipsis objects copyable. 2008-03-24 08:17:39 +00:00
Martin v. Löwis 966d0e0930 Merged revisions 61724-61824 via svnmerge from
svn+ssh://pythondev@svn.python.org/sandbox/trunk/2to3/lib2to3

........
  r61730 | martin.v.loewis | 2008-03-22 02:20:58 +0100 (Sa, 22 Mär 2008) | 2 lines

  More explicit relative imports.
........
  r61755 | david.wolever | 2008-03-22 21:33:52 +0100 (Sa, 22 Mär 2008) | 1 line

  Fixing #2446 -- 2to3 now translates 'import foo' to 'from . import foo'
........
  r61824 | david.wolever | 2008-03-24 01:30:24 +0100 (Mo, 24 Mär 2008) | 3 lines

  Fixed a bug where 'from itertools import izip' would return 'from itertools import'
........
2008-03-24 00:46:53 +00:00
Gregory P. Smith dd10284516 prevent a warning from the struct module when data size >= 2**32. 2008-03-23 23:45:12 +00:00
Gregory P. Smith ac830e932d A bugfix for r61813, it would fail if the data size was >=2**32. 2008-03-23 23:43:02 +00:00
Gregory P. Smith 79b4ba8fd7 Fix gzip to deal with CRC's being signed values in Python 2.x properly and to
read 32bit values as unsigned to start with rather than applying signedness
fixups allover the place afterwards.

This hopefully fixes the test_tarfile failure on the alpha/tru64 buildbot.
2008-03-23 21:04:43 +00:00
Raymond Hettinger c4f7bab0a0 Adopt Nick's suggestion for useful default arguments.
Clean-up floating point issues by adding true division and float constants.
2008-03-23 19:37:53 +00:00
Raymond Hettinger bbc50eafe5 Issue 1681432: Add triangular distribution the random module. 2008-03-23 13:32:32 +00:00
Amaury Forgeot d'Arc 9a0d3462fc #1477: ur'\U0010FFFF' raised in narrow unicode builds.
Corrected the raw-unicode-escape codec to use UTF-16 surrogates in
this case, just like the unicode-escape codec.
2008-03-23 09:55:29 +00:00
Neal Norwitz acdb6fb2a5 Try to prevent the alarm going off early in tearDown 2008-03-23 06:16:04 +00:00
Neal Norwitz 41d649116c Suppress failure (to avoid a flaky test) if we cannot connect to svn.python.org 2008-03-23 05:47:20 +00:00
Neal Norwitz 3bda069c5a Skip the epoll test if epoll() does not work 2008-03-23 04:43:09 +00:00
Neal Norwitz 162d719113 Speed up the test by avoiding socket timeouts. 2008-03-23 04:08:30 +00:00
Neal Norwitz 1f2995b014 Try to make this test a little more robust and not fail with:
timeout (10.0025) is more than 2 seconds more than expected (0.001)

I'm assuming this problem is caused by DNS lookup.  This change
does a DNS lookup of the hostname before trying to connect, so the time
is not included.
2008-03-23 03:43:33 +00:00
Raymond Hettinger e70bb8d6f2 Simplify demo code. 2008-03-23 00:55:46 +00:00
Alexandre Vassalotti ab68a3dc6f Added warning for the removal of 'hotshot' in Py3k. 2008-03-22 04:08:44 +00:00
Facundo Batista 6415667fe2 Small fix that complicated the test actually when that
test failed.
2008-03-22 02:45:37 +00:00
Martin v. Löwis baf267ceae Merged revisions 61602-61723 via svnmerge from
svn+ssh://pythondev@svn.python.org/sandbox/trunk/2to3/lib2to3

........
  r61626 | david.wolever | 2008-03-19 17:19:16 +0100 (Mi, 19 Mär 2008) | 1 line

  Added fixer for implicit local imports.  See #2414.
........
  r61628 | david.wolever | 2008-03-19 17:57:43 +0100 (Mi, 19 Mär 2008) | 1 line

  Added a class for tests which should not run if a particular import is found.
........
  r61629 | collin.winter | 2008-03-19 17:58:19 +0100 (Mi, 19 Mär 2008) | 1 line

  Two more relative import fixes in pgen2.
........
  r61635 | david.wolever | 2008-03-19 20:16:03 +0100 (Mi, 19 Mär 2008) | 1 line

  Fixed print fixer so it will do the Right Thing when it encounters __future__.print_function.  2to3 gets upset, though, so the tests have been commented out.
........
  r61637 | david.wolever | 2008-03-19 21:37:17 +0100 (Mi, 19 Mär 2008) | 3 lines

  Added a fixer for itertools imports (from itertools import imap, ifilterfalse --> from itertools import filterfalse)
........
  r61645 | david.wolever | 2008-03-19 23:22:35 +0100 (Mi, 19 Mär 2008) | 1 line

  SVN is happier when you add the files you create... -_-'
........
  r61654 | david.wolever | 2008-03-20 01:09:56 +0100 (Do, 20 Mär 2008) | 1 line

  Added an explicit sort order to fixers -- fixes problems like #2427
........
  r61664 | david.wolever | 2008-03-20 04:32:40 +0100 (Do, 20 Mär 2008) | 3 lines

  Fixes #2428 -- comments are no longer eatten by __future__ fixer.
........
  r61673 | david.wolever | 2008-03-20 17:22:40 +0100 (Do, 20 Mär 2008) | 1 line

  Added 2to3 node pretty-printer
........
  r61679 | david.wolever | 2008-03-20 20:50:42 +0100 (Do, 20 Mär 2008) | 1 line

  Made node printing a little bit prettier
........
  r61723 | martin.v.loewis | 2008-03-22 00:59:27 +0100 (Sa, 22 Mär 2008) | 2 lines

  Fix whitespace.
........
2008-03-22 00:01:12 +00:00
Christian Heimes 0e9ab5f2f0 Applied patch #1657 epoll and kqueue wrappers for the select module
The patch adds wrappers for the Linux epoll syscalls and the BSD kqueue syscalls. Thanks to Thomas Herve and the Twisted people for their support and help.
TODO: Finish documentation documentation
2008-03-21 23:49:44 +00:00
Steven Bethard d290b04ee3 Replace hack in regrtest.py with use of sys.py3kwarning. 2008-03-21 21:01:18 +00:00
Georg Brandl 65bb42dc1b #2348: add py3k warning for file.softspace. 2008-03-21 20:38:24 +00:00
Georg Brandl 07e5681fd3 #2346/#2347: add py3k warning for __methods__ and __members__. Patch by Jack Diederich. 2008-03-21 20:21:46 +00:00
Georg Brandl 5a44424c5e #2358: add py3k warning to sys.exc_clear(). 2008-03-21 20:11:46 +00:00
Georg Brandl 77354cf5ef Issue #2432: give DictReader the dialect and line_num attributes
advertised in the docs.
2008-03-21 20:01:51 +00:00
Georg Brandl 331243270d #2136: allow single quotes in realm spec. 2008-03-21 19:54:00 +00:00
Jeffrey Yasskin 510eab5965 Speed test_threading up from 14s to .5s, and avoid a deadlock on certain
failures. The test for enumerate-after-join is now a little less rigorous, but
the bug it references says the error happened in the first couple iterations,
so 100 iterations should still be enough.

cProfile was useful for identifying the slow tests here.
2008-03-21 18:48:04 +00:00
Jeffrey Yasskin 413f588a36 Try to fix test_signal on FreeBSD. I'm assuming that os.kill is failing to
raise a signal, but switching to subprocess makes the code cleaner anyway.
2008-03-21 18:25:06 +00:00
Jeffrey Yasskin 6cda88ea11 Try to fix test_signal breakages on Linux due to r61687. It appears that at
least two of the linux build bots aren't leaving zombie processes around for
os.waitpid to wait for, causing ECHILD errors. This would be a symptom of a bug
somewhere, but probably not in signal itself.
2008-03-21 05:51:37 +00:00
Jeffrey Yasskin cf26f5419e Speed up test_signal from ~24s to 4s by avoiding nearly all of the sleep calls. 2008-03-21 05:02:44 +00:00
Eric Smith 816a168053 Comment how 'from __future__ import print_function' operates in 3.0. 2008-03-20 23:56:08 +00:00
Marc-André Lemburg dbd61a2bff If Mark Hammonds win32 tools are not available, try to use the _winreg module
and sys.getwindowsversion() to get at the Windows version info.

For the machine and processor uname() values, use the environment variables
for these on Windows XP and later.
2008-03-20 17:31:36 +00:00
Georg Brandl 402b270799 #2383: remove obsolete XXX comment in stat.py. 2008-03-20 07:25:55 +00:00
Gregory P. Smith 6af3db8632 Attempt to fix the Solaris Sparc 10 buildbot. It was failing with an invalid
argument error on ioctl.  This was caused by the added test_fcntl ioctl test
that hard coded 0 as the fd to use.  Without a terminal, this fails on solaris.
(it passed from the command line on sol 10, both 32 and 64 bit)

Also, test_ioctl exists so I moved the test into there where it belongs.
2008-03-20 05:41:53 +00:00
Trent Nelson 00b53ea1b8 Revert r61650; the intent of this commit was to try and address alarm failures on some of the build slaves. As Neal points out, it's called after test_main(), so it's not going to factor into the test when run via regrtest.py (and removes the original functionality that Jeffrey wanted that would kill the test if it took longer than 3 seconds to run when executing it directly during development). 2008-03-20 00:58:44 +00:00
Sean Reifscheider ac2ed1e0ac Issue #2143: Fix embedded readline() hang on SSL socket EOF. 2008-03-20 00:46:50 +00:00
Gregory P. Smith a5cfcad0e3 Prevent ioctl op codes from being sign extended from int to unsigned long
when used on platforms that actually define ioctl as taking an unsigned long.
(the BSDs and OS X / Darwin)

Adds a unittest for fcntl.ioctl that tests what happens with both positive and
negative numbers.

This was done because of issue1471 but I'm not able to reproduce -that- problem
in the first place on Linux 32bit or 64bit or OS X 10.4 & 10.5 32bit or 64 bit.
2008-03-19 23:03:25 +00:00
Brett Cannon 48581c5f08 Make sure that the warnings filter is not reset or changed beyond the current
running test file.

Closes issue2407. Thanks Jerry Seutter.
2008-03-19 23:01:17 +00:00
Trent Nelson a0ce6b6b71 Bump the SIGALM delay from 3 seconds to 20 seconds, mainly in an effort to see if it fixes the alarm failures in this test experienced by some of the buildbots. 2008-03-19 22:51:42 +00:00
Gregory P. Smith f15cde3732 Improve the error message when the CRCs don't match. 2008-03-19 22:23:51 +00:00
Raymond Hettinger 10dca6e282 The filter() function does support a None argument in Py3.0. 2008-03-19 17:58:59 +00:00
Raymond Hettinger 05387861ea Issue 2354: Fix-up compare warning. Patch contributed by Jeff Balogh. 2008-03-19 17:45:19 +00:00
Brett Cannon 977eb021f3 Use sys.py3kwarning instead of trying to trigger a Py3k-related warning. 2008-03-19 17:37:43 +00:00
Brett Cannon 7919d98d56 test_nis would fail if test.test_support.verbose was true but NIS was not set
up on the machine.

Closes issue2411. Thanks Michael Bishop.
2008-03-19 16:50:13 +00:00
Eric Smith 8ff4963594 Trivial typo. 2008-03-19 12:15:10 +00:00
Eric Smith e504445972 Use test.test_support.captured_stdout instead of a custom contextmanager.
Thanks Nick Coghlan.
2008-03-19 12:09:55 +00:00
Trent Nelson b27745fb6d Issue2290: Support x64 Windows builds that live in pcbuild/amd64. Without it, sysutils._python_build() returns the wrong directory, which causes the test_get_config_h_filename method in Lib/distutils/tests/test_sysconfig.py to fail. 2008-03-19 06:28:24 +00:00
Martin v. Löwis 16b2e6bd7f Import relimport using a relative import. 2008-03-19 06:00:28 +00:00
Martin v. Löwis ab41b370a3 Merged revisions 61598-61599,61601 via svnmerge from
svn+ssh://pythondev@svn.python.org/sandbox/trunk/2to3/lib2to3

........
  r61598 | david.wolever | 2008-03-18 23:58:33 -0500 (Di, 18 Mär 2008) | 1 line

  Added fixer for zip, and refactored a bit of code in the process.  Closing #2171.
........
  r61599 | david.wolever | 2008-03-19 00:04:26 -0500 (Mi, 19 Mär 2008) | 3 lines

  Removed a bunch of duplicate code -- it's in util now.
........
  r61601 | martin.v.loewis | 2008-03-19 00:21:12 -0500 (Mi, 19 Mär 2008) | 2 lines

  Fix whitespace.
........
2008-03-19 05:22:42 +00:00
Martin v. Löwis 5e37baea80 Import lib2to3. 2008-03-19 04:43:46 +00:00
Martin v. Löwis a4d77898db Issue #2400: Allow relative imports to "import *". 2008-03-19 04:39:13 +00:00
Gregory P. Smith bf02e3bb21 Fix the struct module DeprecationWarnings that zipfile was triggering by
removing all use of signed struct values.

test_zipfile and test_zipfile64 pass.  no more warnings.
2008-03-19 03:14:41 +00:00
Eric Smith 14cae96fa6 Another test for __future__ print_function. 2008-03-19 03:13:34 +00:00
David Wolever 2724ab99c8 Added zip, map, filter to future_bultins (#2171) 2008-03-19 02:35:45 +00:00
Eric Smith 5d5c63f462 Fixed compiler module so __future__ print_function is compilable. 2008-03-19 02:11:30 +00:00
Gregory P. Smith b89a096d6d Use zlib's crc32 routine instead of binascii when available. zlib's is faster
when compiled properly optimized and about the same speed otherwise.
2008-03-19 01:46:10 +00:00
Gregory P. Smith bde40078b0 Mention that crc32 and adler32 are available in a different module (zlib).
Some people look for them in hashlib.
2008-03-19 01:38:35 +00:00
Eric Smith 7c47894a2a Backport of the print function, using a __future__ import.
This work is substantially Anthony Baxter's, from issue
1633807.  I just freshened it, made a few minor tweaks,
and added the test cases.  I also created issue 2412,
which is to check for 2to3's behavior with the print
function.  I also added myself to ACKS.
2008-03-18 23:45:49 +00:00
Gregory P. Smith c856fa811d Add a test to make sure zlib.crc32 and binascii.crc32 return the same thing.
Fix a buglet in binascii.crc32, the second optional argument could previously
have a signedness mismatch with the C variable its going into.
2008-03-18 22:27:41 +00:00
Steven Bethard 6a644f92ef Add py3k warnings for code and method inequality comparisons. This should resolve issue 2373. The codeobject.c and methodobject.c changes are both just backports of the Python 3 code. 2008-03-18 22:08:20 +00:00
Steven Bethard e8e22cf3c0 Have regrtest skip test_py3kwarn when the -3 flag is missing. 2008-03-18 21:30:13 +00:00
Neal Norwitz 0c1ef470f8 Import the test properly. This is especially important for py3k. 2008-03-18 20:30:38 +00:00
Steven Bethard a7a3e28e4e Fix test_atexit so that it still passes when -3 is supplied. (It was catching the warning messages on stdio from using the reload() function.) 2008-03-18 19:59:14 +00:00
Gregory P. Smith f48da8fbcd Fix chown on 64-bit linux. It needed to take a long (64-bit on 64bit linux) as
uid and gid input to accept values >=2**31 as valid while still accepting
negative numbers to pass -1 to chown for "no change".

Fixes issue1747858.

This should be backported to release25-maint.
2008-03-18 19:05:32 +00:00
Steven Bethard 8906575380 _have_soundcard() is a bad check for winsound.Beep, since you can have a soundcard but have the beep driver disabled. This revision basically disables the beep tests by wrapping them in a try/except. The Right Way To Do It is to come up with a _have_enabled_beep_driver() and use that. 2008-03-18 19:04:32 +00:00
Neal Norwitz 5fe5cf6df2 Get regrtest working when re-running tests 2008-03-18 17:58:02 +00:00
Steven Bethard ae42f33cdf Add py3k warnings for object, type, cell and dict comparisons. This should resolve issue2342 and partly resolve issue2373. 2008-03-18 17:26:10 +00:00
Sean Reifscheider 493894c3e0 Issue 1577: shutil.move() where destination is a directory was doing a
copy, now it is doing a os.rename() if it's on the same file-system.
2008-03-18 17:24:12 +00:00
Steven Bethard ed427e7be9 Use test_support.unlink instead of os.unlink in tearDown(). (Seems to fix an occasional failure in Windows Vista.) 2008-03-18 16:00:19 +00:00
Brett Cannon f084e04820 Fix test_errno to only check for error numbers that are defined by Standard C. 2008-03-18 15:52:00 +00:00
Martin v. Löwis 66e2663eba Note that the stderr output of the test is intentional. 2008-03-18 13:16:05 +00:00
Martin v. Löwis afb416b002 Add WSA errors. 2008-03-18 13:05:03 +00:00
Martin v. Löwis 637f239bbb Add more Linux error codes. 2008-03-18 12:45:37 +00:00
Martin v. Löwis d43ca3b395 norwitz-amd64 (gentoo) has EREMOTEIO. 2008-03-18 12:20:15 +00:00
Trent Nelson 496ad27186 The behaviour of winsound.Beep() seems to differ between different versions of Windows when there's either:
a) no sound card entirely
    b) legacy beep driver has been disabled
    c) the legacy beep driver has been uninstalled
Sometimes RuntimeErrors are raised, sometimes they're not.  If _have_soundcard() returns False, don't expect winsound.Beep() to raise a RuntimeError, as this clearly isn't the case, as demonstrated by the various Win32 XP buildbots.
2008-03-18 07:32:47 +00:00
Neal Norwitz d1befd7c50 Add some info to the failure messages 2008-03-18 06:03:46 +00:00
Jeffrey Yasskin 36dbcb9e98 Add a -S/--slow flag to regrtest to have it print the 10 slowest tests with
their times.
2008-03-18 05:45:40 +00:00
Brett Cannon 08811dde5d Improve the error message for a test that failed on the S-390 Debian buildbot. 2008-03-18 05:43:04 +00:00
Neal Norwitz 819f139c4b Try increasing the timeout to reduce the flakiness of this test. 2008-03-18 05:20:29 +00:00
Jeffrey Yasskin ed414654c4 Speed up test_dict by about 10x by only checking selected dict literal sizes,
instead of every integer from 0 to 400. Exhaustive testing wastes time without
providing enough more assurance that the code is correct.
2008-03-18 05:12:41 +00:00
Jeffrey Yasskin a14585308a Speed test_thread up from 51.328s to 0.081s by reducing its sleep times. We
still sleep at all to make it likely that all threads are active at the same
time.
2008-03-18 04:56:06 +00:00
Jeffrey Yasskin 0bfc896979 Block the "socket.ssl() is deprecated" warning from test_socket_ssl. 2008-03-18 04:29:35 +00:00
Brett Cannon a5573b3153 The output directory for tests that compare against stdout is now gone! 2008-03-18 04:16:06 +00:00
Brett Cannon b7ec8e5a9e test_errno was a no-op test; now it actually tests things and uses unittest. 2008-03-18 03:46:22 +00:00
Brett Cannon 0bb7950829 Move test_extcall to doctest. 2008-03-18 01:58:56 +00:00
Brett Cannon ba17cfc66c Convert test_dummy_threading and test_dbm to unittest. 2008-03-18 01:50:25 +00:00
Brett Cannon 6eeaddc341 Convert test_strftime, test_getargs, and test_pep247 to use unittest. 2008-03-18 01:00:07 +00:00
Eric Smith 0aed07ad80 Added PEP 3127 support to tokenize (with tests); added PEP 3127 to NEWS. 2008-03-17 19:43:40 +00:00
Gregory P. Smith f48f9d38c0 Force zlib.crc32 and zlib.adler32 to return a signed integer on all platforms
regardless of the native sizeof(long) used in the integer object.

This somewhat odd behavior of returning a signed is maintained in 2.x for
compatibility reasons of always returning an integer rather than a long object.

Fixes Issue1202 for Python 2.6
2008-03-17 18:48:05 +00:00
Eric Smith 9ff19b5434 Finished backporting PEP 3127, Integer Literal Support and Syntax.
Added 0b and 0o literals to tokenizer.
Modified PyOS_strtoul to support 0b and 0o inputs.
Modified PyLong_FromString to support guessing 0b and 0o inputs.
Renamed test_hexoct.py to test_int_literal.py and added binary tests.
Added upper and lower case 0b, 0O, and 0X tests to test_int_literal.py
2008-03-17 17:32:20 +00:00
Jeffrey Yasskin b9e15f7555 Make isinstance(OldstyleClass, NewstyleClass) return False instead of raising
an exception. Issue reported by Joseph Armbruster.
2008-03-17 16:31:21 +00:00
Eric Smith 8113ca63b9 Issue 2264: empty float presentation type needs to have at least one digit past the decimal point.
Added "Z" format_char to PyOS_ascii_formatd to support empty float presentation type.
Renamed buf_size in PyOS_ascii_formatd to more accurately reflect it's meaning.
Modified format.__float__ to use the new "Z" format as the default.
Added test cases.
2008-03-17 11:01:01 +00:00
Raymond Hettinger cd6bfab410 Zap one more use of Exact/Inexact. 2008-03-15 20:37:50 +00:00
Raymond Hettinger 6b46762974 Removed Exact/Inexact after discussion with Yasskin.
Unlike Scheme where exactness is implemented as taints, the Python
implementation associated exactness with data types.  This created
inheritance issues (making an exact subclass of floats would result
in the subclass having both an explicit Exact registration and an
inherited Inexact registration).  This was a problem for the
decimal module which was designed to span both exact and inexact
arithmetic.  There was also a question of use cases and no examples
were found where ABCs for exactness could be used to improve code.
One other issue was having separate tags for both the affirmative
and negative cases.  This is at odds with the approach taken
elsewhere in the Python (i.e. we don't have an ABC both Hashable
and Unhashable).
2008-03-15 20:02:04 +00:00
Skip Montanaro fc070d2731 add %f format to datetime - issue 1158 2008-03-15 16:04:45 +00:00
Mark Dickinson c23b8a7af9 Issue 705836: Fix struct.pack(">f", 1e40) to behave consistently
across platforms:  it should now raise OverflowError on all
platforms.  (Previously it raised OverflowError only on
non IEEE 754 platforms.)

Also fix the (already existing) test for this behaviour
so that it actually raises TestFailed instead of just
referencing it.
2008-03-14 14:23:37 +00:00
Brett Cannon 6119540d70 Remove a bad test. 2008-03-14 14:03:10 +00:00
Brett Cannon 1f5182b572 Convert test_fcntl to unittest.
Closes issue #2055. Thanks Giampaolo Rodola.
2008-03-13 21:09:28 +00:00
Brett Cannon 4a6e8d669a Move test_gdbm to use unittest.
Closes issue #1960. Thanks Giampaolo Rodola.
2008-03-13 21:02:16 +00:00
Brett Cannon 2e0f9f3dd9 Convert test_contains, test_crypt, and test_select to unittest.
Patch from GHOP 294 by David Marek.
2008-03-13 20:47:41 +00:00
Brett Cannon b8d37359cd Move test_tokenize to doctest.
Done as GHOP 238 by Josip Dzolonga.
2008-03-13 20:33:10 +00:00
Brett Cannon 66865d2ebd Move test_thread over to unittest. Commits GHOP 237.
Thanks Benjamin Peterson for the patch.
2008-03-13 20:27:00 +00:00
Raymond Hettinger 83aa6a3b1a Simplify the nlargest() code using heappushpop(). 2008-03-13 19:33:34 +00:00
Raymond Hettinger 53bdf09343 Issue 2274: Add heapq.heappushpop(). 2008-03-13 19:03:51 +00:00
Raymond Hettinger e8b4b60555 Add recipe to docs. 2008-03-11 00:19:07 +00:00
Neal Norwitz 0098c9d609 Introduce a lock to fix a race condition which caused an exception in the test.
Some buildbots were consistently failing (e.g., amd64).
Also remove a couple of semi-colons.
2008-03-09 19:03:42 +00:00
Facundo Batista c54aec1fda Issue 1106316. post_mortem()'s parameter, traceback, is now
optional: it defaults to the traceback of the exception that is currently
being handled.
2008-03-08 16:50:27 +00:00
Marc-André Lemburg 50967bdec2 Add new name for Mandrake: Mandriva. 2008-03-08 10:01:43 +00:00
Nick Coghlan 7af53be66f Speed up with statements by storing the __exit__ method on the stack instead of in a temp variable (bumps the magic number for pyc files) 2008-03-07 14:13:28 +00:00