Commit Graph

4695 Commits

Author SHA1 Message Date
Georg Brandl 7b71bf3872 Remove usage of sets module (patch #1500609). 2006-07-17 13:23:46 +00:00
Neal Norwitz 84be93b2db Bug #1512814, Fix incorrect lineno's when code within a function
had more than 255 blank lines.  Byte codes need to go first, line #s second.
2006-07-16 01:50:38 +00:00
Peter Astrand 7d1d43630e Bug #1223937: CalledProcessError.errno -> CalledProcessError.returncode. 2006-07-14 14:04:45 +00:00
Neal Norwitz edef2be4af Bug #1520864: unpacking singleton tuples in for loop (for x, in) work again. 2006-07-12 05:26:17 +00:00
Tim Peters 722b88308d Whitespace normalization. 2006-07-10 21:11:49 +00:00
Tim Peters 32a8361f2d After approval from Anthony, merge the tim-current_frames
branch into the trunk.  This adds a new sys._current_frames()
function, which returns a dict mapping thread id to topmost
thread stack frame.
2006-07-10 21:08:24 +00:00
Peter Astrand 2b221ed657 Make it possible to run test_subprocess.py with Python 2.2, which lacks test_support.reap_children(). 2006-07-10 20:39:49 +00:00
Phillip J. Eby 5d86bdb3ae Fix SF#1516184 and add a test to prevent regression. 2006-07-10 19:03:29 +00:00
Neal Norwitz ed65755608 Bug #1512814, Fix incorrect lineno's when code at module scope
started after line 256.
2006-07-10 00:04:44 +00:00
Neal Norwitz 28746aba9b On 64 bit systems, int literals that use less than 64 bits are now ints
rather than longs.  This also fixes the test for eval(-sys.maxint - 1).
2006-07-09 22:14:42 +00:00
Neil Schemenauer 6ec6ab02c3 Fix SF bug 1441486: bad unary minus folding in compiler. 2006-07-09 21:19:29 +00:00
Neil Schemenauer 0e07b60a4e Fix AST compiler bug #1501934: incorrect LOAD/STORE_GLOBAL generation. 2006-07-09 16:16:34 +00:00
Georg Brandl 9575fb241e Add an additional test for bug #1519018. 2006-07-08 12:15:27 +00:00
Neal Norwitz fb48afa708 Fix SF bug #1519018: 'as' is now validated properly in import statements 2006-07-08 05:31:37 +00:00
Neal Norwitz 84bc19a453 Restore rev 47014:
The hppa ubuntu box sometimes hangs forever in these tests.  My guess
is that the wait is failing for some reason.  Use WNOHANG, so we won't
wait until the buildbot kills the test suite.

I haven't been able to reproduce the failure, so I'm not sure if
this will help or not.  Hopefully, this change will cause the test
to fail, rather than hang.  That will be better since we will get
the rest of the test results.  It may also help us debug the real problem.

*** The reason this originally failed was because there were many
zombie children outstanding before rev 47158 cleaned them up.
There are still hangs in test_subprocess that need to be addressed,
but that will take more work.  This should close some holes.
2006-07-07 06:03:15 +00:00
Hye-Shik Chang b9aa7ea660 Test using all CJK encodings for the testcases which don't require
specific encodings.
2006-07-06 15:39:24 +00:00
Hye-Shik Chang 84392bee48 Add a testcase for r47086 which fixed a bug in codec_getstreamcodec(). 2006-07-06 15:21:52 +00:00
Nick Coghlan 56829d5b4a Revert the __module_name__ changes made in rev 47142. We'll revisit this in Python 2.6 2006-07-06 12:53:04 +00:00
Armin Rigo 5953baca0a A couple of examples about how to attack the fact that _PyType_Lookup()
returns a borrowed ref.  Many of the calls are open to attack.
2006-07-06 07:58:18 +00:00
Thomas Wouters add191118f Fix bug in passing tuples to string.Template. All other values (with working
str() or repr()) would work, just not multi-value tuples. Probably not a
backport candidate, since it changes the behaviour of passing a
single-element tuple:

>>> string.Template("$foo").substitute(dict(foo=(1,)))

'(1,)'

versus

'1'
2006-07-05 11:03:49 +00:00
Martin v. Löwis d5cfa5491a Put method-wrappers into trashcan. Fixes #927248. 2006-07-03 13:47:40 +00:00
Martin v. Löwis fcfff0a7fa Bug #1417699: Reject locale-specific decimal point in float()
and atof().
2006-07-03 12:19:50 +00:00
Tim Peters 16a3932774 Whitespace normalization. 2006-07-03 08:23:19 +00:00
Martin v. Löwis ee1e06d497 Correct arithmetic in access on Win32. Fixes #1513646. 2006-07-02 18:44:00 +00:00
Fred Drake 6ffe499397 SF bug #1296433 (Expat bug #1515266): Unchecked calls to character data
handler would cause a segfault.  This merges in Expat's lib/xmlparse.c
revisions 1.154 and 1.155, which fix this and a closely related problem
(the later does not affect Python).

Moved the crasher test to the tests for xml.parsers.expat.
2006-07-01 16:28:20 +00:00
Martin v. Löwis 7596e8342e Release all forwarded functions in .close. Fixes #1513223. 2006-07-01 15:33:37 +00:00
Vinay Sajip a09803329c Added duplicate call to fileConfig() to ensure that it cleans up after itself correctly. 2006-07-01 10:47:20 +00:00
Tim Peters 38ff36c4cc Whitespace normalization. 2006-06-30 06:18:39 +00:00
Neal Norwitz 877fdb01fe This should fix the buildbot failure on s/390 which can't connect to gmail.org.
It makes the error message consistent and always sends to stderr.

It would be much better for all the networking tests to hit only python.org.
2006-06-29 05:48:14 +00:00
Neal Norwitz b15ac3169d Add new utility function, reap_children(), to test_support. This should
be called at the end of each test that spawns children (perhaps it
should be called from regrtest instead?).  This will hopefully prevent
some of the unexplained failures in the buildbots (hppa and alpha)
during tests that spawn children.  The problems were not reproducible.
There were many zombies that remained at the end of several tests.
In the worst case, this shouldn't cause any more problems,
though it may not help either.  Time will tell.
2006-06-29 04:10:08 +00:00
Fred Drake a136210a9f SF bug #1504333: sgmlib should allow angle brackets in quoted values
(modified patch by Sam Ruby; changed to use separate REs for start and end
 tags to reduce matching cost for end tags; extended tests; updated to avoid
 breaking previous changes to support IPv6 addresses in unquoted attribute
 values)
2006-06-29 00:51:53 +00:00
Armin Rigo d77ef8fa51 A couple of crashers of the "won't fix" kind. 2006-06-28 10:49:51 +00:00
Nick Coghlan 999a336ad7 Make full module name available as __module_name__ even when __name__ is set to something else (like '__main__') 2006-06-28 10:41:47 +00:00
Tim Peters 3249d00f4d Whitespace normalization. 2006-06-27 11:52:49 +00:00
Andrew M. Kuchling 15486f78f0 Attempt to fix build failure on OS X and Debian alpha; the symptom is
consistent with os.wait() returning immediately because some other
subprocess had previously exited; the test suite then immediately
tries to lock the mailbox and gets an error saying it's already
locked.

To fix this, do a waitpid() so the test suite only continues once
the intended child process has exited.
2006-06-26 17:00:35 +00:00
Andrew M. Kuchling ec3c368195 Windows doesn't have os.fork(). I'll just disable this test for now 2006-06-26 14:33:24 +00:00
Andrew M. Kuchling 9afbacef27 Add a test for a conflicting lock.
On slow machines, maybe the time intervals (2 sec, 0.5 sec) will be too tight.
I'll see how the buildbots like it.
2006-06-26 13:23:10 +00:00
Fred Drake 2f99da636b - SF bug #853506: IP6 address parsing in sgmllib
('[' and ']' were not accepted in unquoted attribute values)

- cleaned up tests of character and entity reference decoding so the
  tests cover the documented relationships among handle_charref,
  handle_entityref, convert_charref, convert_codepoint, and
  convert_entityref, without bringing up Unicode issues that sgmllib
  cannot be involved in
2006-06-23 06:03:45 +00:00
Peter Astrand d6b2430b7a Make it possible to run test_subprocess.py on Python 2.2, which lacks test_support.is_resource_enabled. 2006-06-22 20:06:46 +00:00
Brett Cannon 53ab5b761d 'warning's was improperly requiring that a command-line Warning category be
both a subclass of Warning and a subclass of types.ClassType.  The latter is no
longer true thanks to new-style exceptions.

Closes bug #1510580.  Thanks to AMK for the test.
2006-06-22 16:49:14 +00:00
Georg Brandl f57c54db03 Test for correct compilation of try-except-finally stmt.
Test for correct lineno on list, tuple, dict literals.
2006-06-22 14:46:46 +00:00
Armin Rigo 53c1692f6a Fix for an obscure bug introduced by revs 46806 and 46808, with a test.
The problem of checking too eagerly for recursive calls is the
following: if a RuntimeError is caused by recursion, and if code needs
to normalize it immediately (as in the 2nd test), then
PyErr_NormalizeException() needs a call to the RuntimeError class to
instantiate it, and this hits the recursion limit again...  causing
PyErr_NormalizeException() to never finish.

Moved this particular recursion check to slot_tp_call(), which is not
involved in instantiating built-in exceptions.

Backport candidate.
2006-06-21 21:58:50 +00:00
Georg Brandl 0870687f44 Patch #1509001: expected skips for netbsd3. 2006-06-21 17:53:17 +00:00
Georg Brandl d819c13769 Make test_fcntl aware of netbsd3. 2006-06-21 17:52:36 +00:00
Brett Cannon 70a77ac23f At the C level, tuple arguments are passed in directly to the exception
constructor, meaning it is treated as *args, not as a single argument.  This
means using the 'message' attribute won't work (until Py3K comes around),
and so one must grab from 'arg' to get the error number.
2006-06-21 16:57:57 +00:00
Brett Cannon 115ecb9211 Fix typo of exception name. 2006-06-20 19:20:17 +00:00
Brett Cannon bb93f4bb0d Raise TestSkipped when the test socket connection is refused. 2006-06-20 17:30:26 +00:00
Tim Peters e7d7caa17a TestHelp.make_parser(): This was making a permanent change to
os.environ (setting envar COLUMNS), which at least caused
test_float_default() to fail if the tests were run more than once.

This repairs the test_optparse -R failures Neal reported on
python-dev.  It also explains some seemingly bizarre test_optparse
failures we saw a couple weeks ago on the buildbots, when
test_optparse failed due to test_file failing to clean up after
itself, and then test_optparse failed in an entirely different
way when regrtest's -w option ran test_optparse a second time.
It's now obvious that make_parser() permanently changing os.environ
was responsible for the second half of that.
2006-06-19 09:09:44 +00:00
Tim Peters 5c298438b0 Repair KeyError when running test_threaded_import under -R,
as reported by Neal on python-dev.
2006-06-19 08:14:28 +00:00
Walter Dörwald 4994d9546c Patch #1506645: add Python wrappers for the curses functions
is_term_resized, resize_term and resizeterm. This uses three
separate configure checks (one for each function).
2006-06-19 08:07:50 +00:00
Tim Peters 43bc3788c0 Whitespace normalization. 2006-06-19 07:45:16 +00:00
Georg Brandl ccff785258 Patch #1507676: improve exception messages in abstract.c, object.c and typeobject.c. 2006-06-18 22:17:29 +00:00
Neal Norwitz 0f51cf6e04 Revert 47014 until it is more robust 2006-06-18 20:10:24 +00:00
Neal Norwitz 10b835c401 The hppa ubuntu box sometimes hangs forever in these tests. My guess
is that the wait is failing for some reason.  Use WNOHANG, so we won't
wait until the buildbot kills the test suite.

I haven't been able to reproduce the failure, so I'm not sure if
this will help or not.  Hopefully, this change will cause the test
to fail, rather than hang.  That will be better since we will get
the rest of the test results.  It may also help us debug the real problem.
2006-06-18 19:37:40 +00:00
Neal Norwitz 9602cc2aa4 Prevent spurious leaks when running regrtest.py -R. There may be more
issues that crop up from time to time, but this change seems to have been
pretty stable (no spurious warnings) for about a week.

Other modules which use threads may require similar use of
threading_setup/threading_cleanup from test_support.
2006-06-18 19:35:01 +00:00
Fred Drake fab461a4b5 SF patch 1504676: Make sgmllib char and entity references pluggable
(implementation/tests contributed by Sam Ruby)
2006-06-16 23:45:06 +00:00
Neal Norwitz 13a7bef73d Add missing period in comment. 2006-06-16 04:31:28 +00:00
Neal Norwitz 217046fb9f Disable this test until we can determine what to do about it 2006-06-16 04:30:34 +00:00
Tim Peters da4b84a07a Oops -- I introduced an off-by-6436159488 error. 2006-06-15 18:38:19 +00:00
Tim Peters a608bb228c Whitespace normalization. 2006-06-15 18:06:29 +00:00
Tim Peters 84b0f581ef Try to reduce the extreme peak memory and disk-space use
of this test.  It probably still requires more disk space
than most buildbots have, and in any case is still so
intrusive that if we don't find another way to test this I'm
taking my buildbot offline permanently ;-)
2006-06-15 18:04:40 +00:00
Neal Norwitz bda1418e65 Print some more info to get an idea of how much longer the test will last 2006-06-15 10:24:49 +00:00
Neal Norwitz 643ad19251 Steal the trick from test_compiler to print out a slow msg.
This will hopefully get the buildbots to pass.  Not sure this
test will be feasible or even work.  But everything is red now,
so it can't get much worse.
2006-06-15 09:57:03 +00:00
Ronald Oussoren 143cefb846 Patch #1446489 (zipfile: support for ZIP64) 2006-06-15 08:14:18 +00:00
Neal Norwitz de7f502879 Try to narrow window of failure on slow/busy boxes (ppc64 buildbot) 2006-06-15 05:55:49 +00:00
Fred Drake a16393efb7 add tests for two cases that are handled correctly in the current code,
but that SF patch 1504676 as written mis-handles
2006-06-14 05:04:47 +00:00
Fred Drake 72c9eff59e - make some disabled tests run what they intend when enabled
- remove some over-zealous triple-quoting
2006-06-14 04:25:02 +00:00
Brett Cannon 5dc3e3f17a Missed test for rev. 46933; infinite recursion from __coerce__() returning its arguments reversed. 2006-06-13 22:26:13 +00:00
Brett Cannon ea3912b0da If a classic class defined a __coerce__() method that just returned its two
arguments in reverse, the interpreter would infinitely recourse trying to get a
coercion that worked.  So put in a recursion check after a coercion is made and
the next call to attempt to use the coerced values.

Fixes bug #992017 and closes crashers/coerce.py .
2006-06-13 21:46:41 +00:00
Andrew MacIntyre 93e3ecb1f4 Increase the small thread stack size to get the test
to pass reliably on the one buildbot that insists on
more than 32kB of thread stack.
2006-06-13 19:02:35 +00:00
Tim Peters ef7fe5f228 Whitespace normalization. 2006-06-13 18:37:07 +00:00
Andrew MacIntyre a7090dfc2c fix exception usage 2006-06-13 17:14:36 +00:00
Andrew MacIntyre 9291332de1 Patch #1454481: Make thread stack size runtime tunable.
Heavily revised, comprising revisions:
46640 - original trunk revision (backed out in r46655)
46647 - markup fix (backed out in r46655)
46692:46918 merged from branch aimacintyre-sf1454481

branch tested on buildbots (Windows buildbots had problems
not related to these changes).
2006-06-13 15:04:24 +00:00
Neal Norwitz 6d3d339d21 Verify the crash due to EncodingMap not initialized does not return 2006-06-13 08:41:06 +00:00
Neal Norwitz 62bc8aadd4 Don't fail if another process is listening on our port. 2006-06-13 04:08:53 +00:00
Tim Peters 2adc626bb5 Added missing svn:eol-style property to text files. 2006-06-13 00:30:50 +00:00
Tim Peters edd66fa7e9 Whitespace normalization. 2006-06-13 00:30:01 +00:00
Ka-Ping Yee f9eb82f252 Add the uuid module.
This module has been tested so far on Windows XP (Python 2.4 and 2.5a2),
Mac OS X (Python 2.3, 2.4, and 2.5a2), and Linux (Python 2.4 and 2.5a2).
2006-06-12 23:47:52 +00:00
Phillip J. Eby 403019b115 Sync w/external release 0.1.2. Please see PEP 360 before making changes to external packages. 2006-06-12 04:04:32 +00:00
Neal Norwitz 6e73aaab47 Patch #1503046, Conditional compilation of zlib.(de)compressobj.copy
copy is only in newer versions of zlib.  This should allow zlibmodule
to work with older versions like the Tru64 buildbot.
2006-06-12 03:33:09 +00:00
Neal Norwitz 909eb12c95 Fix the socket tests so they can be run concurrently. Backport candidate 2006-06-12 02:13:21 +00:00
Neal Norwitz 4a9ff1626a Get test to pass on S/390. Shout if you think this change is incorrect. 2006-06-11 21:38:38 +00:00
Tim Peters 06524b61d0 compare_generic_iter(): Fixed the failure of test_wsgiref's testFileWrapper
when running with -O.

test_simple_validation_error still fails under -O.  That appears to be because
wsgiref's validate.py uses `assert` statements all over the place to check
arguments for sanity.  That should all be changed (it's not a logical error
in the software if a user passes bogus arguments, so this isn't a reasonable
use for `assert` -- checking external preconditions should generally raise
ValueError or TypeError instead, as appropriate).
2006-06-11 20:52:59 +00:00
Neal Norwitz 896c1ea15e Fix test on PPC64 buildbot. It raised an IOError (really an URLError which
derives from an IOError).  That seems valid.  Env Error includes both OSError
and IOError, so this seems like a reasonable fix.
2006-06-11 20:46:46 +00:00
Neal Norwitz f054aeb2a1 Try to fix another networking test. The problem is that if hosts have
a search path setup, some of these hosts resolve to the wrong address.
By appending a period to the hostname, the hostname should only resolve
to what we want it to resolve to.  Hopefully this doesn't break different bots.

Also add more info to failure message to aid debugging test failure.
2006-06-11 20:42:02 +00:00
Neal Norwitz a29fc29f19 Try to fix several networking tests. The problem is that if hosts have
a search path setup, some of these hosts resolve to the wrong address.
By appending a period to the hostname, the hostname should only resolve
to what we want it to resolve to.  Hopefully this doesn't break different bots.
2006-06-11 20:25:56 +00:00
Tim Peters 4f96f1f2b5 Whitespace normalization. 2006-06-11 19:42:51 +00:00
Greg Ward 0e0c9f4740 Bug #1498146: fix optparse to handle Unicode strings in option help,
description, and epilog.
2006-06-11 16:24:11 +00:00
Neal Norwitz d3c52de557 warnings was imported at module scope, no need to import again 2006-06-11 07:26:50 +00:00
Greg Ward 7f54740c4d Bug #1361643: fix textwrap.dedent() so it handles tabs appropriately,
i.e. do *not* expand tabs, but treat them as whitespace that is not
equivalent to spaces.  Add a couple of test cases.  Clarify docs.
2006-06-11 00:40:49 +00:00
Georg Brandl 90e27d38f5 Apply perky's fix for #1503157: "/".join([u"", u""]) raising OverflowError.
Also improve error message on overflow.
2006-06-10 06:40:50 +00:00
Brett Cannon 22565aac3b An object with __call__ as an attribute, when called, will have that attribute checked for __call__ itself, and will continue to look until it finds an object without the attribute. This can lead to an infinite recursion.
Closes bug #532646, again.  Will be backported.
2006-06-09 22:31:23 +00:00
Georg Brandl b2afe855e5 Make use of new str.startswith/endswith semantics.
Occurences in email and compiler were ignored due to backwards compat requirements.
2006-06-09 20:43:48 +00:00
Tim Peters e558486953 Implementing a happy idea from Georg Brandl: make runtest() try to
clean up files and directories the tests often leave behind by
mistake.  This is the first time in history I don't have a bogus
"db_home" directory after running the tests ;-)

Also worked on runtest's docstring, to say something about all the
arguments, and to document the non-obvious return values.

New functions runtest_inner() and cleanup_test_droppings() in
support of the above.
2006-06-09 19:24:44 +00:00
Georg Brandl 242508160e RFE #1491485: str/unicode.endswith()/startswith() now accept a tuple as first argument. 2006-06-09 18:45:48 +00:00
Georg Brandl e7ec81f130 Test file.__exit__. 2006-06-09 18:29:52 +00:00
Phillip J. Eby 5cf565ddd1 Import wsgiref into the stdlib, as of the external version 0.1-r2181. 2006-06-09 16:40:18 +00:00
Andrew M. Kuchling 91c64a05d2 [Bug #1472827] Make saxutils.XMLGenerator handle \r\n\t in attribute values by escaping them properly. 2.4 bugfix candidate. 2006-06-09 13:15:57 +00:00
Neal Norwitz c9778a8951 Fix grammar and reflow 2006-06-09 05:54:18 +00:00
Tim Peters 71dc0a043b Remove the temporary hack to force test_optparse to
run immediately after test_file.  At least 8 buildbot
boxes passed since the underlying problem got fixed,
and they all failed before the fix, so there's no point
to this anymore.
2006-06-09 05:12:40 +00:00
Tim Peters 0556e9b119 testUnicodeOpen(): I have no idea why, but making this
test clean up after itself appears to fix the test failures
when test_optparse follows test_file.

test_main():  Get rid of TESTFN no matter what.  That's
also enough to fix the mystery failures.  Doesn't hurt
to fix them twice :-)
2006-06-09 04:02:06 +00:00
Tim Peters dbb82f623f AutoFileTests.tearDown(): Removed mysterious undocumented
try/except.  Remove TESTFN.

Throughout:  used open() instead of file(), and wrapped
long lines.
2006-06-09 03:51:41 +00:00
Tim Peters 2b6377912e To boost morale :-), force test_optparse to run immediately
after test_file until we can figure out how to fix it.
(See python-dev; at the moment we don't even know which checkin
caused the problem.)
2006-06-09 03:09:42 +00:00
Tim Peters 520d8ddd97 Whitespace normalization.
Since test_file is implicated in mysterious test failures
when followed by test_optparse, if I had any brains I'd
look at the checkin that last changed test_file ;-)
2006-06-09 02:11:02 +00:00
Brett Cannon de3b052216 Buffer objects would return the read or write buffer for a wrapped object when
the char buffer was requested.  Now it actually returns the char buffer if
available or raises a TypeError if it isn't (as is raised for the other buffer
types if they are not present but requested).

Not a backport candidate since it does change semantics of the buffer object
(although it could be argued this is enough of a bug to bother backporting).
2006-06-08 17:00:45 +00:00
Georg Brandl 442b49e938 Convert test_file to unittest. 2006-06-08 14:50:53 +00:00
Nick Coghlan 676725db92 Add functools.update_wrapper() and functools.wraps() as described in PEP 356 2006-06-08 13:54:49 +00:00
Armin Rigo fd01d7933b (arre, arigo) SF bug #1350060
Give a consistent behavior for comparison and hashing of method objects
(both user- and built-in methods).  Now compares the 'self' recursively.
The hash was already asking for the hash of 'self'.
2006-06-08 10:56:24 +00:00
Tim Peters 80dc76e907 SF patch 1501987: Remove randomness from test_exceptions,
from ?iga Seilnacht (sorry about the name, but Firefox
on my box can't display the first character of the name --
the SF "Unix name" is zseil).

This appears to cure the oddball intermittent leaks across
runs when running test_exceptions under -R.  I'm not sure
why, but I'm too sleepy to care ;-)

The thrust of the SF patch was to remove randomness in the
pickle protocol used.  I changed the patch to use
range(pickle.HIGHEST_PROTOCOL + 1), to try both pickle and
cPickle, and randomly mucked with other test lines to put
statements on their own lines.

Not a bugfix candidate (this is fiddling new-in-2.5 code).
2006-06-07 06:57:51 +00:00
Tim Peters c27d655c00 dash_R_cleanup(): Clear filecmp._cache. This accounts for
different results across -R runs (at least on Windows) of
test_filecmp.
2006-06-07 01:04:59 +00:00
Martin Blais 215f13dd11 Normalized a few cases of whitespace in function declarations.
Found them using::

  find . -name '*.py' | while read i ; do grep 'def[^(]*( ' $i /dev/null ; done
  find . -name '*.py' | while read i ; do grep ' ):' $i /dev/null ; done

(I was doing this all over my own code anyway, because I'd been using spaces in
all defs, so I thought I'd make a run on the Python code as well.  If you need
to do such fixes in your own code, you can use xx-rename or parenregu.el within
emacs.)
2006-06-06 12:46:55 +00:00
Tim Peters 852eae1bc1 Access _struct attributes directly instead of mucking with getattr.
string_reverse():  Simplify.

assertRaises():  Raise TestFailed on failure.

test_unpack_from(), test_pack_into(), test_pack_into_fn():  never
use `assert` to test for an expected result (it doesn't test anything
when Python is run with -O).
2006-06-05 20:48:49 +00:00
Gregory P. Smith 372b583a6b * fix DBCursor.pget() bug with keyword argument names when no data= is
supplied [SF pybsddb bug #1477863]
2006-06-05 18:48:21 +00:00
Gregory P. Smith f0547d0d3e * add support for DBSequence objects [patch #1466734] 2006-06-05 17:38:04 +00:00
Tim Peters bf0400abe9 Remove doctest.testmod's deprecated (in 2.4) `isprivate`
argument.  A lot of hair went into supporting that!
2006-06-05 01:43:03 +00:00
Tim Peters 06c5c00819 "Flat is better than nested."
Move the long-winded, multiply-nested -R support out
of runtest() and into some module-level helper functions.
This makes runtest() and the -R code easier to follow.
That in turn allowed seeing some opportunities for code
simplification, and made it obvious that reglog.txt
never got closed.
2006-06-05 00:55:26 +00:00
Tim Peters 28eeefe566 Revert revisions:
46640 Patch #1454481:  Make thread stack size runtime tunable.
46647 Markup fix

The first is causing many buildbots to fail test runs, and there
are multiple causes with seemingly no immediate prospects for
repairing them.  See python-dev discussion.

Note that a branch can (and should) be created for resolving these
problems, like

svn copy svn+ssh://svn.python.org/python/trunk -r46640 svn+ssh://svn.python.org/python/branches/NEW_BRANCH

followed by merging rev 46647 to the new branch.
2006-06-04 23:52:47 +00:00
Georg Brandl ddbaa660d3 Patch #1346214: correctly optimize away "if 0"-style stmts
(thanks to Neal for review)
2006-06-04 21:56:52 +00:00
Martin Blais af2ae72cb2 Fixes in struct and socket from merge reviews.
- Following Guido's comments, renamed

  * pack_to -> pack_into
  * recv_buf -> recv_into
  * recvfrom_buf -> recvfrom_into

- Made fixes to _struct.c according to Neal Norwitz comments on the checkins
  list.

- Converted some ints into the appropriate -- I hope -- ssize_t and size_t.
2006-06-04 13:49:49 +00:00
Andrew MacIntyre 6539d2d3c7 Patch #1454481: Make thread stack size runtime tunable. 2006-06-04 12:31:09 +00:00
Tim Peters c65a13f53b Whitespace normalization. 2006-06-04 01:22:53 +00:00
Tim Peters d609b1a20e pprint functions used to sort a dict (by key) if and only if
the output required more than one line.  "Small" dicts got
displayed in seemingly random order (the hash-induced order
produced by dict.__repr__).  None of this was documented.
Now pprint functions always sort dicts by key, and the docs
promise it.

This was proposed and agreed to during the PyCon 2006 core
sprint -- I just didn't have time for it before now.
2006-06-02 23:22:51 +00:00
Martin Blais 7f7386cfd2 Fixed struct test to not use unittest. 2006-06-02 13:03:43 +00:00
Neal Norwitz 38d4d4a35b Fix memory leak found by valgrind. 2006-06-02 04:50:49 +00:00
Neal Norwitz e152aab977 Convert docstrings to comments so regrtest -v prints method names 2006-06-02 04:45:53 +00:00
Tim Peters 80a18f0f9c Re-enable a new empty-string test added during the NFS sprint,
but disabled then because str and unicode strings gave different
results.  The implementations were repaired later during the
sprint, but the new test remained disabled.
2006-06-01 13:56:26 +00:00
Armin Rigo 35f6d36951 [ 1497053 ] Let dicts propagate the exceptions in user __eq__().
[ 1456209 ] dictresize() vulnerability ( <- backport candidate ).
2006-06-01 13:19:12 +00:00
Georg Brandl e08940ef6c Some code style tweaks, and remove apply. 2006-06-01 13:00:49 +00:00
Neal Norwitz 9f16dd026c On 64-bit platforms running test_struct after test_tarfile would fail
since the deprecation warning wouldn't be raised.
2006-05-31 09:02:44 +00:00
Tim Peters dd55b0a32c Whitespace normalization. 2006-05-30 23:28:02 +00:00
Fredrik Lundh 9e9ef9fa5a changed count to return 0 for slices outside the source string 2006-05-30 17:39:58 +00:00
Bob Ippolito 4182a75571 Change wrapping terminology to overflow masking 2006-05-30 17:37:54 +00:00
Fredrik Lundh 93eff6fecd changed find/rfind to return -1 for matches outside the source string 2006-05-30 17:11:48 +00:00
Georg Brandl cdcede62c0 Convert test_exceptions to unittest. 2006-05-30 08:47:19 +00:00
Georg Brandl b0432bc032 Do the check for no keyword arguments in __init__ so that
subclasses of Exception can be supplied keyword args
2006-05-30 08:17:00 +00:00
Georg Brandl 861089fc49 Disallow keyword args for exceptions. 2006-05-30 07:34:45 +00:00
Neal Norwitz 008b861bf0 Don't fail if the (sub)pkgname already exist. 2006-05-30 07:21:10 +00:00
Georg Brandl 05f97bffac Add a test case for exception pickling. args is never NULL. 2006-05-30 07:13:29 +00:00
Tim Peters aba19bc45f deprecated_err(): Stop bizarre warning messages when the tests
are run in the order:

    test_genexps (or any other doctest-based test)
    test_struct
    test_doctest

The `warnings` module needs an advertised way to save/restore
its internal filter list.
2006-05-30 02:25:25 +00:00
Bob Ippolito 2fd3977a9d struct: modulo math plus warning on all endian-explicit formats for compatibility with older struct usage (ugly) 2006-05-29 22:55:48 +00:00
Fredrik Lundh b51b470eb8 fixed "abc".count("", 100) == -96 error (hopefully, nobody's relying on
the current behaviour ;-)
2006-05-29 22:42:07 +00:00
Georg Brandl 261e251df8 Patches #1497027 and #972322: try HTTP digest auth first,
and watch out for handler name collisions.
2006-05-29 20:52:54 +00:00
Nick Coghlan c649ec5b69 Apply modified version of Collin Winter's patch #1478788
Renames functional extension module to _functools and adds a Python
functools module so that utility functions like update_wrapper can be
added easily.
2006-05-29 12:43:05 +00:00
Armin Rigo a6123abb72 A clearer error message when passing -R to regrtest.py with
release builds of Python.
2006-05-28 22:07:08 +00:00
Georg Brandl 2b33037611 Patch #1496206: urllib2 PasswordMgr ./. default ports 2006-05-28 20:23:12 +00:00
Armin Rigo a3f092751a ("Forward-port" of r46506)
Remove various dependencies on dictionary order in the standard library
tests, and one (clearly an oversight, potentially critical) in the
standard library itself - base64.py.

Remaining open issues:
 * test_extcall is an output test, messy to make robust
 * tarfile.py has a potential bug here, but I'm not familiar
   enough with this code.  Filed in as SF bug #1496501.
 * urllib2.HTTPPasswordMgr() returns a random result if there is more
   than one matching root path.  I'm asking python-dev for
   clarification...
2006-05-28 19:13:17 +00:00
George Yoshida f3c65de460 Patch #1080727: add "encoding" parameter to doctest.DocFileSuite
Contributed by Bjorn Tillenius.
2006-05-28 16:39:09 +00:00
Tim Peters 4e30617bad The cheery optimism of old age. 2006-05-27 14:13:13 +00:00
Tim Peters de41dc865a More random thrashing trying to understand spurious
Windows failures.  Who's keeping a bz2 file open?
2006-05-27 12:36:53 +00:00
Richard Jones 7b9558d37d Conversion of exceptions over from faked-up classes to new-style C types. 2006-05-27 12:29:24 +00:00
Bob Ippolito 1fcdc232db Fix up struct docstrings, add struct.pack_to function for symmetry 2006-05-27 12:11:36 +00:00
Martin v. Löwis d004fc810a Patch 1494554: Update numeric properties to Unicode 4.1. 2006-05-27 08:36:52 +00:00
Bob Ippolito aa70a17e13 enable all of the struct tests, use ssize_t, fix some whitespace 2006-05-26 20:25:23 +00:00
Fredrik Lundh 9c0e9c089c needspeed: rpartition documentation, tests, and a bug fixes.
feel free to add more tests and improve the documentation.
2006-05-26 18:24:15 +00:00
Andrew Dalke 725fe4089d Test for more edge strip cases; leading and trailing separator gets removed
even with strip(..., 0)
2006-05-26 16:22:52 +00:00
Tim Peters 02494764cb Explicitly close files. I'm trying to stop the frequent spurious test_tarfile
failures on Windows buildbots, but it's hard to know how since the regrtest
failure output is useless here, and it never fails when a buildbot slave runs
test_tarfile the second time in verbose mode.
2006-05-26 14:02:05 +00:00
Tim Peters b1f3251ceb Use open() to open files (was using file()). 2006-05-26 13:39:17 +00:00
Bob Ippolito e27337b5d0 fix #1229380 No struct.pack exception for some out of range integers 2006-05-26 13:15:44 +00:00
Andrew Dalke 669fa188b1 Added more rstrip tests, including for prealloc'ed arrays 2006-05-26 13:05:55 +00:00
Andrew Dalke 5cc6009f0d Test cases for off-by-one errors in string split with multicharacter pattern. 2006-05-26 12:31:00 +00:00
Andrew Dalke 005aee2c39 I like tests.
The new split functions use a preallocated list.  Added tests which exceed
the preallocation size, to exercise list appends/resizes.

Also added more edge case tests.
2006-05-26 12:28:15 +00:00
Tim Peters fe98f9613b Whitespace normalization. 2006-05-26 12:26:21 +00:00
Martin Blais 2856e5f390 Support for buffer protocol for socket and struct.
* Added socket.recv_buf() and socket.recvfrom_buf() methods, that use the buffer
  protocol (send and sendto already did).

* Added struct.pack_to(), that is the corresponding buffer compatible method to
  unpack_from().

* Fixed minor typos in arraymodule.
2006-05-26 12:03:27 +00:00
Andrew Dalke 03fb444990 Added split whitespace checks for characters other than space. 2006-05-26 11:15:22 +00:00
Andrew Dalke 984b971341 Added a few more test cases for whitespace split. These strings have leading whitespace. 2006-05-26 11:11:38 +00:00
Fredrik Lundh 06a69dd8ff needforspeed: partition implementation, part two.
feel free to improve the documentation and the docstrings.
2006-05-26 08:54:28 +00:00
Tim Peters d95d593f47 Whitespace normalization. 2006-05-25 21:52:19 +00:00
Brett Cannon 36850456ca Change test_values so that it compares the lowercasing of group names since getgrall() can return all lowercase names while getgrgid() returns proper casing.
Discovered on Ubuntu 5.04 (custom).
2006-05-25 21:33:11 +00:00
Fredrik Lundh 0c71f88fc9 needforspeed: check for overflow in replace (from Andrew Dalke) 2006-05-25 16:46:54 +00:00
Andrew Dalke 2bddcbf10e Added tests for implementation error we came up with in the need for speed sprint. 2006-05-25 16:30:52 +00:00
Thomas Wouters 143bdfcee6 Update graminit.c for the fix for #1488915, Multiple dots in relative import
statement raise SyntaxError, and add testcase.
2006-05-25 11:26:25 +00:00
Tim Peters 696cf43b58 Heavily fiddled variant of patch #1442927: PyLong_FromString optimization.
``long(str, base)`` is now up to 6x faster for non-power-of-2 bases.  The
largest speedup is for inputs with about 1000 decimal digits.  Conversion
from non-power-of-2 bases remains quadratic-time in the number of input
digits (it was and remains linear-time for bases 2, 4, 8, 16 and 32).

Speedups at various lengths for decimal inputs, comparing 2.4.3 with
current trunk.  Note that it's actually a bit slower for 1-digit strings:

  len  speedup
 ----  -------
   1     -4.5%
   2      4.6%
   3      8.3%
   4     12.7%
   5     16.9%
   6     28.6%
   7     35.5%
   8     44.3%
   9     46.6%
  10     55.3%
  11     65.7%
  12     77.7%
  13     73.4%
  14     75.3%
  15     85.2%
  16    103.0%
  17     95.1%
  18    112.8%
  19    117.9%
  20    128.3%
  30    174.5%
  40    209.3%
  50    236.3%
  60    254.3%
  70    262.9%
  80    295.8%
  90    297.3%
 100    324.5%
 200    374.6%
 300    403.1%
 400    391.1%
 500    388.7%
 600    440.6%
 700    468.7%
 800    498.0%
 900    507.2%
1000    501.2%
2000    450.2%
3000    463.2%
4000    452.5%
5000    440.6%
6000    439.6%
7000    424.8%
8000    418.1%
9000    417.7%
2006-05-24 21:10:40 +00:00
Tim Peters f4049089c5 Disable the damn empty-string replace test -- it can't
be make to pass now for unicode if it passes for str, or
vice versa.
2006-05-24 21:00:45 +00:00
Tim Peters beaec0c3a1 We can't leave the checked-in tests broken. 2006-05-24 20:27:18 +00:00
Andrew Dalke e5488ec01e Added a slew of test for string replace, based various corner cases from
the Need For Speed sprint coding.  Includes commented out overflow tests
which will be uncommented once the code is fixed.

This test will break the 8-bit string tests because
    "".replace("", "A") == "" when it should == "A"

We have a fix for it, which should be added tomorrow.
2006-05-24 18:55:37 +00:00
Bob Ippolito eb62127842 refactor unpack, add unpack_from 2006-05-24 15:32:06 +00:00
Tim Peters 1bddfb84ee test_struct grew weird behavior under regrtest.py -R,
due to a module-level cache.  Clearing the cache should
make it stop showing up in refleak reports.
2006-05-23 21:51:35 +00:00
Tim Peters b713ec2531 Bug #1334662 / patch #1335972: int(string, base) wrong answers.
In rare cases of strings specifying true values near sys.maxint,
and oddball bases (not decimal or a power of 2), int(string, base)
could deliver insane answers.  This repairs all such problems, and
also speeds string->int significantly.  On my box, here are %
speedups for decimal strings of various lengths:

length speedup
------ -------
 1       12.4%
 2       15.7%
 3       20.6%
 4       28.1%
 5       33.2%
 6       37.5%
 7       41.9%
 8       46.3%
 9       51.2%
10       19.5%
11       19.9%
12       23.9%
13       23.7%
14       23.3%
15       24.9%
16       25.3%
17       28.3%
18       27.9%
19       35.7%

Note that the difference between 9 and 10 is the difference between
short and long Python ints on a 32-bit box.  The patch doesn't
actually do anything to speed conversion to long:  the speedup is
due to detecting "unsigned long" overflow more quickly.

This is a bugfix candidate, but it's a non-trivial patch and it
would be painful to separate the "bug fix" from the "speed up" parts.
2006-05-23 18:45:30 +00:00
Neal Norwitz 5ef922447c Fix #1474677, non-keyword argument following keyword. 2006-05-19 06:43:50 +00:00
Georg Brandl 7b90e168f3 Bug #1462152: file() now checks more thoroughly for invalid mode
strings and removes a possible "U" before passing the mode to the
C library function.
2006-05-18 07:01:27 +00:00
Georg Brandl fad65594ba Fix test_locale for platforms without a default thousands separator. 2006-05-18 06:33:27 +00:00
Georg Brandl b89316fdbf Patch #1180296: improve locale string formatting functions 2006-05-17 15:51:16 +00:00
Tim Peters 1b38357094 Text files missing the SVN eol-style property. 2006-05-16 23:24:08 +00:00
Georg Brandl 8d3342b489 Patch #1435422: zlib's compress and decompress objects now have a
copy() method.
2006-05-16 07:38:27 +00:00
Tim Peters 4ccc0b7dfe test_directory(): Remove the leftover temp directory that's making
the Windows buildbots fail test_tarfile.
2006-05-15 21:32:25 +00:00
Tim Peters 12087bae18 ReadDetectFileobjTest: repair Windows disasters by opening
the file object in binary mode.

The Windows buildbot slaves shouldn't swap themselves to death
anymore.  However, test_tarfile may still fail because of a
temp directory left behind from a previous failing run.
Windows buildbot owners may need to remove that directory
by hand.
2006-05-15 20:44:10 +00:00
Georg Brandl 49c8f4cf36 [ 1488881 ] tarfile.py: support for file-objects and bz2 (cp. #1488634) 2006-05-15 19:30:35 +00:00
Neal Norwitz 373f0a718c - Bug #1487966: Fix SystemError with conditional expression in assignment
Most of the test_syntax changes are just updating the numbers.
2006-05-15 07:04:36 +00:00
Georg Brandl 38c6a22f38 Patch #1484695: Update the tarfile module to version 0.8. This fixes
a couple of issues, notably handling of long file names using the
GNU LONGNAME extension.
2006-05-10 16:26:03 +00:00
Tim Peters ad2ef33245 Variant of patch #1478292. doctest.register_optionflag(name)
shouldn't create a new flag when `name` is already the name of
an option flag.
2006-05-10 02:43:01 +00:00
Georg Brandl b5f2e5cc50 Patch #1479302: Make urllib2 digest auth and basic auth play together. 2006-05-08 17:36:08 +00:00
Georg Brandl a166a91659 Add test for rev. 45934. 2006-05-08 17:28:47 +00:00
Martin v. Löwis d4e3bb3d39 Port access, chmod, parts of getcwdu, mkdir, and utime to direct Win32 API. 2006-05-06 16:32:54 +00:00
Martin v. Löwis 8e0d494e41 Implement os.{chdir,rename,rmdir,remove} using Win32 directly. 2006-05-04 10:08:42 +00:00
Martin v. Löwis 777367103c Patch #1475845: Raise IndentationError for unexpected indent. 2006-05-04 05:51:03 +00:00
Georg Brandl 1bb6230930 Bug #1385040: don't allow "def foo(a=1, b): pass" in the compiler package. 2006-05-03 18:18:32 +00:00
Nick Coghlan afd5e63e24 Finish bringing SVN into line with latest version of PEP 343 by getting rid of all remaining references to context objects that I could find. Without a __context__() method context objects no longer exist. Also get test_with working again, and adopt a suggestion from Neal for decimal.Context.get_manager() 2006-05-03 13:02:47 +00:00
Georg Brandl 1b06a1d4e3 Move network tests from test_urllib2 to test_urllib2net. 2006-05-03 05:15:10 +00:00
Tim Peters 4511a713d5 Whitespace normalization. 2006-05-03 04:46:14 +00:00
Andrew M. Kuchling 214db63df8 Use open() instead of file() 2006-05-02 21:44:33 +00:00
Guido van Rossum b2045837b6 Hopefully this will fix the spurious failures of test_mailbox.py that I'm
experiencing.  (This code and mailbox.py itself are full of calls to file()
that should be calls to open() -- but I'm not fixing those.)
2006-05-02 20:47:36 +00:00
Guido van Rossum da5b701aee Get rid of __context__, per the latest changes to PEP 343 and python-dev
discussion.
There are two places of documentation that still mention __context__:
Doc/lib/libstdtypes.tex -- I wasn't quite sure how to rewrite that without
spending a whole lot of time thinking about it; and whatsnew, which Andrew
usually likes to change himself.
2006-05-02 19:47:52 +00:00
Guido van Rossum 8f6cbe1502 Fix the formatting of KeyboardInterrupt -- a bad issubclass() call. 2006-05-02 17:36:09 +00:00
Fred Drake 017e68c413 SF #1479988: add methods to allow access to weakrefs for the
weakref.WeakKeyDictionary and weakref.WeakValueDictionary
2006-05-02 06:53:59 +00:00
Neal Norwitz a6d01cec3f Try to fix breakage caused by patch #1479181, r45850 2006-05-02 06:23:22 +00:00
Neal Norwitz c4edb0ec81 SF #1479181: split open() and file() from being aliases for each other. 2006-05-02 04:43:14 +00:00
Barry Warsaw dbcc8d9b24 Port forward from 2.4 branch:
Patch #1464708 from William McVey: fixed handling of nested comments in mail
addresses.  E.g.

"Foo ((Foo Bar)) <foo@example.com>"

Fixes for both rfc822.py and email package.  This patch needs to be back
ported to Python 2.3 for email 2.5.
2006-05-01 03:03:02 +00:00
Georg Brandl 3583cff5a9 Patch #1472854: make the rlcompleter.Completer class usable on non-
UNIX platforms.
2006-04-30 18:14:54 +00:00
Georg Brandl de9b624fb9 Bug #1473625: stop cPickle making float dumps locale dependent in protocol 0.
On the way, add a decorator to test_support to facilitate running single
test functions in different locales with automatic cleanup.
2006-04-30 11:13:56 +00:00
Georg Brandl bffb0bc064 In stdlib, use hashlib instead of deprecated md5 and sha modules. 2006-04-30 08:57:35 +00:00
Georg Brandl fa42bd7af4 Patch #1470846: fix urllib2 ProxyBasicAuthHandler. 2006-04-30 07:06:11 +00:00
Georg Brandl 6d78a582ec Bug #1478429: make datetime.datetime.fromtimestamp accept every float,
possibly "rounding up" to the next whole second.
2006-04-28 19:09:24 +00:00
Neal Norwitz dd28d1c6c2 Try to really fix the slow buildbots this time.
Printing to stdout, doesn't mean the data was actually written.
It depends on the buffering, so we need to flush.  This will hopefully
really fix the buildbots getting killed due to no output on the slow bots.
2006-04-28 04:34:43 +00:00
Thomas Wouters 076ba2129b Add more ignores of ImportWarnings; these are all just potential triggers
(since they won't trigger if zlib is already sucessfully imported); they
were found by grepping .py files, instead of looking at warning output :)
2006-04-27 23:41:27 +00:00
Thomas Wouters 9df4e6f673 - Add new Warning class, ImportWarning
- Warn-raise ImportWarning when importing would have picked up a directory
   as package, if only it'd had an __init__.py. This swaps two tests (for
   case-ness and __init__-ness), but case-test is not really more expensive,
   and it's not in a speed-critical section.

 - Test for the new warning by importing a common non-package directory on
   sys.path: site-packages

 - In regrtest.py, silence warnings generated by the build-environment
   because Modules/ (which is added to sys.path for Setup-created modules)
   has 'zlib' and '_ctypes' directories without __init__.py's.
2006-04-27 23:13:20 +00:00
Thomas Wouters 137b1ad8a0 Do the small-memory run of big-meormy tests using a prime number, rather
than a convenient power-of-2-and-multiple-of-5, so incorrect testing
algorithms fail more easily.
2006-04-27 22:38:32 +00:00
Thomas Wouters 58ac820523 Some style fixes and size-calculation fixes. Also do the small-memory run
using a prime number, rather than a convenient power-of-2-and-multiple-of-5,
so incorrect testing algorithms fail more easily.
2006-04-27 22:37:50 +00:00
Thomas Wouters 2574f5cd8b Some more size-estimate fixes, for large-list-tests. 2006-04-27 13:46:59 +00:00
Thomas Wouters b5ccd1416e Some more test-size-estimate fixes: test_append and test_insert trigger a
list resize, which overallocates.
2006-04-26 19:14:46 +00:00
Thomas Wouters cda404bf36 Add tests for += and *= on strings, and fix the memory-use estimate for the
list.extend tests (they were estimating half the actual use.)
2006-04-26 18:46:01 +00:00
Tim Peters 687324918f Whitespace normalization. 2006-04-26 17:11:16 +00:00
Thomas Wouters abd08884a6 The result of SF patch #1471578: big-memory tests for strings, lists and
tuples. Lots to be added, still, but this will give big-memory people
something to play with in 2.5 alpha 2, and hopefully get more people to
write these tests.
2006-04-26 15:53:30 +00:00
Neal Norwitz 9cc3b1ccef Fix this test on Solaris. There can be embedded \r, so don't just replace
the one at the end.
2006-04-26 06:26:12 +00:00
Tim Peters d845e53b5b Rev 45706 renamed stuff in contextlib.py, but didn't rename
uses of it in test_with.py.  As a result, test_with has been skipped
(due to failing imports) on all buildbot boxes since.  Alas, that's
not a test failure -- you have to pay attention to the

    1 skip unexpected on PLATFORM:
        test_with

kinds of output at the ends of test runs to notice that this got
broken.

It's likely that more renaming in test_with.py would be desirable.
2006-04-26 01:15:53 +00:00
Thomas Wouters 6dbff33be8 SF bug/patch #1433877: string parameter to ioctl not null terminated
The new char-array used in ioctl calls wasn't explicitly NUL-terminated;
quite probably the cause for the test_pty failures on Solaris that we
circumvented earlier. (I wasn't able to reproduce it with this patch, but it
has been somewhat elusive to start with.)
2006-04-25 13:53:23 +00:00
Nick Coghlan a7e820a408 Move the PEP 343 documentation and implementation closer to the
terminology in the alpha 1 documentation.

 - "context manager" reverts to its alpha 1 definition
 - the term "context specifier" goes away entirely
 - contextlib.GeneratorContextManager is renamed GeneratorContext

There are still a number of changes relative to alpha 1:

  - the expression in the with statement is explicitly called the
    "context expression" in the language reference
  - the terms 'with statement context', 'context object' or 'with
    statement context' are used in several places instead of a bare
    'context'. The aim of this is to avoid ambiguity in relation to the
    runtime context set up when the block is executed, and the context
    objects that already exist in various application domains (such as
    decimal.Context)
  - contextlib.contextmanager is renamed to contextfactory
    This best reflects the nature of the function resulting from the
    use of that decorator
  - decimal.ContextManager is renamed to WithStatementContext
    Simple dropping the 'Manager' part wasn't possible due to the
    fact that decimal.Context already exists and means something
    different. WithStatementContext is ugly but workable.

A technically unrelated change snuck into this commit:
contextlib.closing now avoids the overhead of creating a
generator, since it's trivial to implement that particular
context manager directly.
2006-04-25 10:56:51 +00:00
Tim Peters 711bf30b89 Patch #1475231: add a new SKIP doctest option, thanks to
Edward Loper.
2006-04-25 03:31:36 +00:00
Phillip J. Eby 0a07ab97c5 Revert addition of setuptools 2006-04-24 20:53:13 +00:00
Thomas Wouters a6c67b56b2 Stop test_tcl's testLoadTk from leaking the Tk commands 'loadtk' registers. 2006-04-24 11:37:13 +00:00
Nick Coghlan 03f76cfbf3 More reliable version of new command line tests that just checks the exit codes 2006-04-24 05:52:15 +00:00
Nick Coghlan 314dadbf98 Back out new command line tests (broke buildbot) 2006-04-24 05:24:26 +00:00
Nick Coghlan 0e01962d51 Fix broken contextlib test from last checkin (I'd've sworn I tested that before checking it in. . .) 2006-04-24 04:59:28 +00:00
Nick Coghlan da2268feec Fix contextlib.nested to cope with exit methods raising and handling exceptions 2006-04-24 04:37:15 +00:00
Nick Coghlan 27ec1a773c Add unit tests for the -m and -c command line switches 2006-04-24 04:32:47 +00:00
Gerhard Häring 3e99c0ad64 Updated the sqlite3 module to the external pysqlite 2.2.2 version. 2006-04-23 15:24:26 +00:00
Greg Ward ab05edc0d1 Update optparse to Optik 1.5.1. 2006-04-23 03:47:58 +00:00
Hye-Shik Chang cdd432808f Remove $CJKCodecs$ RCS tags. The CJKCodecs isn't maintained outside
anymore.
2006-04-22 15:48:15 +00:00
Tim Peters 6d7cd7d6f4 Whitespace normalization. 2006-04-22 05:52:59 +00:00
Andrew M. Kuchling 1da4a94719 Add Gregory K. Johnson's revised version of mailbox.py (funded by
the 2005 Summer of Code).

The revision adds a number of new mailbox classes that support adding
and removing messages; these classes also support mailbox locking and
default to using email.Message instead of rfc822.Message.

The old mailbox classes are largely left alone for backward compatibility.
The exception is the Maildir class, which was present in the old module
and now inherits from the new classes.  The Maildir class's interface
is pretty simple, though, so I think it'll be compatible with existing
code.

(The change to the NEWS file also adds a missing word to a different
news item, which unfortunately required rewrapping the line.)
2006-04-22 02:32:43 +00:00
Andrew M. Kuchling 81efcf6833 Make copy of test_mailbox.py. We'll still want to check the backward
compatibility classes in the new mailbox.py that I'll be committing in
a few minutes.

One change has been made: the tests use len(mbox) instead of len(mbox.boxes).
The 'boxes' attribute was never documented and contains some internal state
that seems unlikely to have been useful.
2006-04-22 02:06:03 +00:00
Tim Peters 21fbd57d66 SF bug #1473760 TempFile can hang on Windows.
Python 2.4 changed ntpath.abspath to do an import
inside the function.  As a result, due to Python's
import lock, anything calling abspath on Windows
(directly, or indirectly like tempfile.TemporaryFile)
hung when it was called from a thread spawned as a
side effect of importing a module.

This is a depressingly frequent problem, and
deserves a more general fix.  I'm settling for
a micro-fix here because this specific one accounts
for a report of Zope Corp's ZEO hanging on Windows,
and it was an odd way to change abspath to begin
with (ntpath needs a different implementation
depending on whether we're actually running on
Windows, and the _obvious_ way to arrange for that
is not to bury a possibly-failing import _inside_
the function).

Note that if/when other micro-fixes of this kind
get made, the new Lib/test/threaded_import_hangers.py
is a convenient place to add tests for them.
2006-04-21 21:18:10 +00:00
Skip Montanaro 94785ef142 Correct implementation and documentation of os.confstr. Add a simple test
case.  I've yet to figure out how to provoke a None return I can test.
2006-04-20 01:29:48 +00:00
Armin Rigo a9017c39ce SF Patch #1062014: AF_UNIX sockets under Linux have a special
abstract namespace that is now fully supported.
2006-04-19 11:50:27 +00:00
Armin Rigo 7e97ee6ac8 A dictresize() attack. If oldtable == mp->ma_smalltable then pure
Python code can mangle with mp->ma_smalltable while it is being walked
over.
2006-04-18 14:00:01 +00:00
Michael W. Hudson 15b1f146bc add a very old crasher from the 2.1 -> 2.2 round of dictionary fixes. 2006-04-18 13:52:32 +00:00
Neal Norwitz 041669fa67 Whitespace normalization 2006-04-18 04:53:28 +00:00
Phillip J. Eby 069159b113 Initial import of setuptools, with integrated tests. 2006-04-18 04:05:34 +00:00
Phillip J. Eby 742cd24c02 test_pyclbr goes nuts when a module contains code to try importing a class
and provide a substitute if the import fails, because pyclbr sees the
class definition.  Changed to ignore such cases' base classes and methods,
since they will not match.
2006-04-18 01:39:25 +00:00
Ronald Oussoren 6c1074888e This patches fixes a number of byteorder problems in MacOSX specific code. 2006-04-17 13:40:08 +00:00
Neal Norwitz 4b16de4350 Add a comment to explain why we are calling _cleanup() 2006-04-17 02:41:25 +00:00
Neal Norwitz 00ac0d22f3 Try to stop the test from leaking and yet still work on windows 2006-04-17 02:39:37 +00:00
Neal Norwitz cb0f66f0ab Get test to consistently show no leaks 2006-04-17 01:48:06 +00:00
Thomas Wouters cb284197f2 Make test_timeout not fail on systems with no dots in their fqdn. 2006-04-16 16:26:28 +00:00
Thomas Wouters 767833dc22 Make test_warnings play nice with regrtest -R:: now that regrtest doesn't
always reload the module (specifically, it doesn't reload if the module has
a 'test_main'.)
2006-04-16 15:43:39 +00:00
Thomas Wouters 993633c6f2 Specialcase 'xs4all' (.nl/.net/.com/whatever else we have) as well as
'python.org' when deciding what server to use for the timeout tests; getting
tired of seeing the test fail on all my boxes ;P This'll still allow the
test to fail for hosts in the XS4ALL network that don't have an 'xs4all'
hostname, so maybe it should use a fallback scheme instead.
2006-04-16 15:22:41 +00:00
Thomas Wouters 631f513fd8 This test no longer leaks, and test_generators sufficiently tests it to
prevent unreported regression.
2006-04-16 15:11:33 +00:00
Thomas Wouters b8f81d4863 Add missing DECREF to PyErr_WriteUnraisable(). That function reports
exceptions that can't be raised any further, because (for instance) they
occur in __del__ methods. The coroutine tests in test_generators was
triggering this leak. Remove the leakers' testcase, and add a simpler
testcase that explicitly tests this leak to test_generators.

test_generators now no longer leaks at all, on my machine. This fix may also
solve other leaks, but my full refleakhunting run is still busy, so who
knows?
2006-04-15 23:27:28 +00:00
Thomas Wouters 60eab2b676 Consolidate 'leak_test1' and 'refleaks_tests', since they both test for the
same kind of thing.
2006-04-15 22:44:07 +00:00
Thomas Wouters b3deb94dc6 Add missing PyObject_GC_Track call, causing *some* itertools.tee objects to
not be tracked by GC. This fixes 254 of test_generators' refleaks on my
machine, but I'm sure something else will make them come back :>

Not adding a separate test for this kind of cycle, since the existing
fib/m235 already test them in more extensive ways than any 'minimal' test
has been able to manage.
2006-04-15 22:33:13 +00:00
Tim Peters 7f098112ee Changed comments to make sense now that the LazyList-based
examples no longer require any explicit closing to avoid
leaking.

That the tee-based examples still do is (I think) still a
mystery.  Part of the mystery is that gc.garbage remains
empty:  if it were the case that some generator in a trash
cycle said it needed finalization, suppressing collection
of that cycle, that generator _would_ show up in gc.garbage.

So this is acting more like, e.g., some tp_traverse slot
isn't visiting all the pointers it should (in which case
the skipped pointer(s) would act like an external root,
silently suppressing collection of everything reachable
from it(them)).
2006-04-15 01:48:57 +00:00
Phillip J. Eby 8ebb28df3a Fix SF#1470508: crash in generator cycle finalization. There were two
problems: first, PyGen_NeedsFinalizing() had an off-by-one bug that
prevented it from ever saying a generator didn't need finalizing, and
second, frame objects cleared themselves in a way that caused their
owning generator to think they were still executable, causing a double
deallocation of objects on the value stack if there was still a loop
on the block stack.  This revision also removes some unnecessary
close() operations from test_generators that are now appropriately
handled by the cycle collector.
2006-04-15 01:02:17 +00:00
Tim Peters c187f33e2b Whitespace normalization. 2006-04-14 18:34:14 +00:00
Walter Dörwald 78a0be6ab3 Add a BufferedIncrementalEncoder class that can be used for implementing
an incremental encoder that must retain part of the data between calls
to the encode() method.

Fix the incremental encoder and decoder for the IDNA encoding.

This closes SF patch #1453235.
2006-04-14 18:25:39 +00:00
Armin Rigo 969ef7501c Show case: reference cycles involving only the ob_type field are rather
uncommon but possible.  Inspired by SF bug 1469629.
2006-04-14 14:58:30 +00:00
Walter Dörwald 15be5ec100 Call encode()/decode() with final==True as the last call in the
incremental codec tests.
2006-04-14 14:03:55 +00:00
Neal Norwitz 38a76a1017 Copy note from leakers README here too. We want to keep all test cases. 2006-04-14 06:35:46 +00:00
Neal Norwitz 621292237c Restore test tee with some modifications.
The test case came from test_generators, not test_itertools.
Ensure there's no cyclic garbage we are counting.

This is weird because it leaks, then reaches a limit:

python.exe -i test_tee.py
>>> leak()
0
[26633 refs]
>>> leak()
0
[26658 refs]
>>> leak()
0
[26683 refs]
>>> leak()
0
[26708 refs]
>>> leak()
0
[26708 refs]
>>> leak()
0
[26708 refs]
>>> leak()
0
2006-04-14 06:33:24 +00:00
Neal Norwitz cde8750414 Move the old test_generator_cycle.py which leaked but was removed into the test 2006-04-14 06:11:08 +00:00
Neal Norwitz 03f3be50af Update notes to address cyclic garbage and what should happen when a test is fixed. 2006-04-14 05:35:39 +00:00
Tim Peters 7db4f2460f When using -R, lots of "*** DocTestRunner.merge:" nuisance messages
appear.  Get rid of them by nuking doctest's default DocTestRunner
instance as part of cleanup().  Also cleanup() before running the
first test repetition (the test was run once before we get into
the -R branch).
2006-04-13 23:12:24 +00:00
Tim Peters 8e6480ca02 Whitespace normalization. 2006-04-13 22:58:42 +00:00
Georg Brandl 7f573f7319 Add a test for Py_ssize_t. Correct typo in getargs.c. 2006-04-13 07:59:30 +00:00
Neal Norwitz 07c6071729 test_compile can be really long if we are using -u compiler.
This may be causing the debian sparc buildbot to fail.
Print a little message to let the user ^w buildbot know it's still thinking.

We may want to adjust the time period which is currently 5 minutes.

Will backport.
2006-04-13 06:34:59 +00:00
Neal Norwitz 0cfa58c43a Remove tests that no longer leak. There is still one leaking generator test 2006-04-13 04:35:36 +00:00
Tim Peters ba8194bd2a tty isn't supported on all boxes. 2006-04-13 03:09:40 +00:00
Anthony Baxter 57fdcbc60f reverting r45321: Patch #860326: traceback.format_exception_only() now
prepends the exception's module name to non-builtin exceptions, like
the interpreter itself does.

broke a number of doctests. should be discussed before checking in (see
discussion on python-dev).
2006-04-13 01:34:33 +00:00
Georg Brandl 24c274f5dc Patch #860326: traceback.format_exception_only() now prepends the
exception's module name to non-builtin exceptions, like the interpreter
itself does.
2006-04-12 21:14:09 +00:00
Gregory P. Smith 64029986bc Fixes bug #1117761
bsddb.*open() methods cachesize parameter wouldn't work (raised an
internal bsddb.db exception when it was given).  The set_cachesize
call needed to be moved from the DB object to the DBEnv since the env
was introduced to allow for threading.

(will backport to 2.4)
2006-04-12 20:35:02 +00:00
Gregory P. Smith 14c6b4626f Closes bug #1149413
Using None for a filename with the 'n' flag when calling bsddb.btopen
would cause an error while checking if the file None existed.  error
not likely to be seen as anyone using None for a filename would likely
use the 'c' flag in the first place.
2006-04-12 20:16:56 +00:00
Georg Brandl f69a24c6ac Update test_sundry. Many modules have now tests, but
e.g. SimpleXMLRPCServer wasn't in here yet.
2006-04-12 12:44:36 +00:00
Walter Dörwald bc96609555 Patch #1463288: use a context manager to temporarily switch locales.
Add tests for the output of the TextCalendar and HTMLCalendar classes.
2006-04-12 10:09:16 +00:00
Neal Norwitz d3a9162e5e Add another little test to make sure we roundtrip multiple list comp ifs ok.
Add tests for generator expressions too.
2006-04-12 05:27:46 +00:00
Thomas Wouters ced6cddc03 Part two of the fix for SF bug #1466641: Regenerate graminit.c and add test
for the bogus failure.
2006-04-12 00:07:59 +00:00
Tim Peters 171b868195 subclasspropagation(): Squash two more bogus hash(x) == id(x)
tests.  Alas, because only the "x86 OpenBSD trunk" buildbot fails
these tests, and test_descr stops after the first failure, there's
no sane way for me to fix these short of fixing one and then
waiting for the buildbot to reveal the next one.
2006-04-11 01:59:34 +00:00
Tim Peters 413c9226d2 Whitespace normalization. 2006-04-11 01:44:26 +00:00
Tim Peters 85b362f007 specials(): squash another incorrect hash(x) == id(x)
test.  Add some lines that at least invoke the default
__hash__, although there's nothing to check there beyond
that they don't blow up.
2006-04-11 01:21:00 +00:00
Phillip J. Eby 4703211080 Updated the warnings, linecache, inspect, traceback, site, and doctest modules
to work correctly with modules imported from zipfiles or via other PEP 302
__loader__ objects.  Tests and doc updates are included.
2006-04-11 01:07:43 +00:00
Tim Peters 7731dfdaad Huh. This belonged with the last checkin -- no idea why svn
didn't commit it.
2006-04-11 00:44:27 +00:00
Tim Peters 6902b44406 Try to repair more new buildbot failures in "x86 OpenBSD trunk", due
to that id() can now return a Python long on a 32-bit box that allocates
addresses "with the sign bit set".

test_set.py test_subclass_with_custom_hash():  it's never been portably
legal for a __hash__() method to return id(self), but on 32-bit boxes
that never caused a problem before it became possible for id() to
return a Python long.  Changed __hash__ here to return a Python int
regardless of platform.

test_descr.py specials():
    vereq(hash(c1), id(c1))
has never been a correct test -- just removed it (hash() is always
a Python int; id() may be a Python long).
2006-04-11 00:43:27 +00:00
Tim Peters 9bdc85f8bf Fix one of the tests that fails on the "x86 OpenBSD trunk" buildbot,
due to that id() may return a long on a 32-bit box now.  On a box that
assigns addresses "with the sign bit set", id() always returns a long now.
2006-04-10 21:38:11 +00:00
Tim Peters 88459359b1 Fix one of the tests that fails on the "x86 OpenBSD trunk" buildbot, due
to that id() may return a long on a 32-bit box now.  On a box that assigns
addresses "with the sign bit set", id() always returns a long now.
2006-04-10 21:34:00 +00:00
Tim Peters a19dc0beb1 DecimalContextTestCase: this permanently changed the
default decimal context, causing test_tokenize to fail
if it ran after test_contextlib.  Changed to restore
the decimal context in effect at the test's start.
2006-04-10 20:25:47 +00:00
Phillip J. Eby bd0c10f7c9 test_contextlib wasn't actually being run by regrtest.py. Or more precisely,
it was being run, but no tests were actually executed!
2006-04-10 18:33:17 +00:00
Anthony Baxter 8220174489 Python on OS X 10.3 and above now uses dlopen() (via dynload_shlib.c)
to load extension modules and now provides the dl module. As a result,
sys.setdlopenflags() now works correctly on these systems. (SF patch
#1454844)
2006-04-09 15:07:40 +00:00
Neal Norwitz ce4a9c9019 Fix tests so they pass in -R mode 2006-04-09 08:36:46 +00:00
Neal Norwitz aa34b6c2e3 Get test_optparse to pass in -R mode by stop changing state (COLUMNS env var) 2006-04-09 06:26:12 +00:00
Neal Norwitz 349c0ed27f Convert test_compare to use unittest. Hopefully we can find out
why this breaks on openbsd sometimes.
2006-04-09 04:50:18 +00:00
Neal Norwitz a31bf18c48 glob('anything*/') would fail because isdir is in os.path, not os. 2006-04-09 03:35:43 +00:00
Tim Peters e0bb597d03 test_timeout(): This test was added during Bug Day, but disabled
soon after because the gmail address it connects to started timing
out on all the buildbot slaves.  Rewrote the test to produce a
warning message (instead of failing) when the address times out.

Also removed the special case for Windows -- this test started to
work on Windows as soon as bug 1462352 was fixed.
2006-04-08 12:05:15 +00:00
Neal Norwitz 5102c4e385 Hopefully this makes test_urllib2 have inconsistent leak results 2006-04-06 08:00:20 +00:00
Anthony Baxter 04b9403e5b Fix for failure of test_urllib2 breaking test_mimetypes (SF bug 1464978)
will backport.
2006-04-06 07:31:31 +00:00
Anthony Baxter e94e3b440f In some environments (under screen, in a chroot) curses doesn't support
mouse events. This makes the test fail. Catch that case and don't run
the tests. Should make the debian/ubuntu buildbots that run in a chroot
work again.

Will backport to release24-maint.
2006-04-06 07:12:39 +00:00
Anthony Baxter a2a26b9e1f whitespace normalisation 2006-04-05 17:30:38 +00:00
Anthony Baxter 22495c02e2 no-one but windows should expect startfile to work 2006-04-05 13:24:26 +00:00
Neal Norwitz 9ad18bbb52 we need os.path too for the normal run on windows 2006-04-04 19:29:29 +00:00
Thomas Heller b882f47383 Change the import statement so that the test is skipped when
os.startfile is not present.
2006-04-04 18:52:27 +00:00
Thomas Heller 19fd857906 Add a simple test for os.startfile(). 2006-04-04 18:31:35 +00:00
Thomas Wouters f4d8f39053 Make xrange more Py_ssize_t aware, by assuming a Py_ssize_t is always at
least as big as a long. I believe this to be a safe assumption that is being
made in many parts of CPython, but a check could be added.

len(xrange(sys.maxint)) works now, so fix the testsuite's odd exception for
64-bit platforms too. It also fixes 'zip(xrange(sys.maxint), it)' as a
portable-ish (if expensive) alternative to enumerate(it); since zip() now
calls len(), this was breaking on (real) 64-bit platforms. No additional
test was added for that behaviour.
2006-04-04 17:28:12 +00:00
Thomas Wouters 8ddab27182 Fix __import__("") to raise ValueError rather than return None. 2006-04-04 16:17:02 +00:00
Anthony Baxter 06853fc150 Fix test_platform on cygwin. When running from build area, sys.executable
is 'python'. But 'python' is actually a directory, 'python.exe' is the
executable.
2006-04-04 15:52:00 +00:00
Tim Peters b2fc21e9f8 sqlite on Windows:
- The buildbot "fetch it" step failed at the end, due to
  using Unix syntax in the final "copy the DLL" step.
  test_sqlite was skipped as a result.

- test_sqlite is no longer an expected skip on Windows.
2006-04-04 15:21:02 +00:00
Jeremy Hylton ed40ea1159 Generate line number table entries for except handlers.
Re-enable all the tests in test_trace.py except one.  Still not sure that these tests test what they used to test, but they pass.  One failing test seems to be caused by undocumented line number table behavior in Python 2.4.
2006-04-04 14:26:39 +00:00
Anthony Baxter 768018592c cygwin's curses support isn't up to scratch to run the tests. 2006-04-04 13:32:08 +00:00
Jeremy Hylton 1b6cab6531 Remove debugging prints. 2006-04-04 12:48:33 +00:00
Neal Norwitz a7a3cfe792 Comment out the prints. These appear to be only for debugging purposes.
Jeremy, please fix this correctly after the alpha.
2006-04-04 05:44:36 +00:00
Jeremy Hylton 2f327c14eb Add lineno, col_offset to excephandler to enable future fix for
tracing/line number table in except blocks.

Reflow long lines introduced by col_offset changes.  Update test_ast
to handle new fields in excepthandler.

As note in Python.asdl says, we might want to rethink how attributes
are handled.  Perhaps they should be the same as other fields, with
the primary difference being how they are defined for all types within
a sum.

Also fix asdl_c so that constructors with int fields don't fail when
passed a zero value.
2006-04-04 04:00:23 +00:00
Phillip J. Eby 9444bd51c4 Fix SF#1462485: StopIteration raised in body of 'with' statement suppressed 2006-04-03 20:05:05 +00:00
Martin v. Löwis a8cd7a26d4 Add test case for #43581. 2006-04-03 11:05:39 +00:00
Anthony Baxter cf0a2a8576 Deal with openbsd's different style of default /etc/hosts by forcing the fqdn
lookup to use the IP address returned by gethosbyname.
2006-04-03 08:10:33 +00:00
Neal Norwitz 84c95b9407 Fix test_pty on OSF/1 (Tru64). The problem is that the newline gets
converted to CR CR NL.  There may be a way to fix this with tcsetattr,
but I couldn't find it.  There was a similar problem on IRIX.

Just normalize the output and compare that.

Will backport.
2006-04-03 05:28:31 +00:00
Neal Norwitz 9cdfa4c98c Skip the test for sys.stdin.seek(-1) on OSF/1 (Tru64) since it does Bad Things
like cause the interpreter to exit abruptly.  If there's a way to fix this,
it would be good to really fix it.  It could just be the operation of the
std C library and we just aren't supposed to do that.

When the test case is skipped, we print a message so the user can check
for themselves.
2006-04-03 05:27:05 +00:00
Neal Norwitz b902f4e401 Use absolute imports 2006-04-03 04:45:34 +00:00
Tim Peters 480725d4c5 Whitespace normalization. 2006-04-03 02:46:44 +00:00
Georg Brandl 720096a6bf Patch #1462790: fix urllib2 ProxyHandler for host:port proxies 2006-04-02 20:45:34 +00:00
Fred Drake ad5177cf8d Patch #624325: urlparse.urlparse() and urlparse.urlsplit() results
now sport attributes that provide access to the parts of the result.
2006-04-01 22:14:43 +00:00
Georg Brandl 7f6b67c235 patch #1462498: handle entityrefs in attribute values. 2006-04-01 08:35:18 +00:00
Tim Peters d8eaa49092 Fix stupid typo. 2006-04-01 01:32:13 +00:00
Tim Peters 4423b8cebc test_timeout(): Disable this new test on all platforms.
The

    s.connect(("gmail.org", 995))

line has been timing out on all buildbot slaves for hours
now, causing the test to fail.
2006-04-01 01:28:51 +00:00
Anthony Baxter c51ee69b27 merged the sqlite-integration branch.
This is based on pysqlite2.1.3, and provides a DB-API interface in
the standard library. You'll need sqlite 3.2.2 or later to build
this - if you have an earlier version, the C extension module will
not be built.
2006-04-01 00:57:31 +00:00
Tim Peters c17976e983 Another crack at bug #1460340: make random.sample(dict)
work, this time by ugly brute force.
2006-04-01 00:26:53 +00:00
Georg Brandl c90397a7c9 Make test_socket_ssl finally pass on WIn 2006-03-31 21:12:32 +00:00
Georg Brandl d49be30938 Disable test_socket_ssl timeout test on Windows. 2006-03-31 19:09:56 +00:00
Georg Brandl ccadf84a1b Patch #1460496: round() now accepts keyword arguments. 2006-03-31 18:54:53 +00:00
Georg Brandl 22ec80bc4f Patch #1462313, bug #1443328: the pickle modules now can handle classes
that have __private names in their __slots__.
2006-03-31 18:25:44 +00:00
Georg Brandl 43f08a85e4 Patch #1380952: fix SSL objects timing out on consecutive read()s 2006-03-31 18:01:16 +00:00
Georg Brandl dd2245f230 Bug #1250170, Patch #1462230: handle socket.gethostname()
failures gracefully
2006-03-31 17:18:06 +00:00
Georg Brandl 51dbc4c879 traceback now shows error position for all SyntaxError subclasses,
e.g. IndentationError. (bug #1447885)
2006-03-31 15:59:13 +00:00
Thomas Wouters a6126ba890 Fix the reference leak in test_generators, by explicitly breaking the cycle
we are about to leave behind. An example of the cause of this leak can be
found in the leakers directory, in case we ever want to tackle the
underlying problem.
2006-03-31 15:31:43 +00:00
Walter Dörwald 58917a6083 Bug #947906: An object oriented interface has been added to the calendar
module. It's possible to generate HTML calendar now and the module can be
called as a script (e.g. via ``python -mcalendar``).
2006-03-31 15:26:22 +00:00
Tim Peters 46cc702b72 test_main(): Restore the decimal context that was in
effect at the time test_decimal was imported.  Else
running test_decimal had the bad side effect of
permanently changing the decimal context in effect.
That caused text_tokenize to fail if it ran after
test_decimal.
2006-03-31 04:11:16 +00:00
Tim Peters ef57567de0 Repaired a number of errors in this test:
- The doctests in decistmt() weren't run at all when
  test_tokenize was run via regrtest.py.

- Some expected output in decistmt() was Windows-specific
  (but nobody noticed because the doctests weren't getting
  run).

- test_roundtrip() didn't actually test anything when
  running the tests with -O.  Now it does.

- Changed test_roundtrip() to show the name of the input
  file when it fails.  That would have saved a lot of
  time earlier today.

- Added a bunch of comments.
2006-03-31 03:17:30 +00:00
Barry Warsaw 176014ffad SF patch #1458476 with modifications based on discussions in python-dev. This
adds the following API calls: PySet_Clear(), _PySet_Next(), and
_PySet_Update().  The latter two are considered non-public.  Tests and
documentation (for the public API) are included.
2006-03-30 22:45:35 +00:00
Armin Rigo 314861c568 Minor bugs in the __index__ code (PEP 357), with tests. 2006-03-30 14:04:02 +00:00
Anthony Baxter 4ef3a23a35 whitespace normalisation 2006-03-30 12:59:11 +00:00
Armin Rigo 5eca19b894 Checking in the test for PEP 357.
This is from the SF tracker as well; for some reason the
content of test_index.py was lost and an empty file was
checked in instead.
2006-03-30 11:28:43 +00:00
Anthony Baxter 67b6d516ce Fixed bug #1459029 - unicode reprs were double-escaped. 2006-03-30 10:54:07 +00:00
Raymond Hettinger 3c3346daa9 SF bug #1460340: random.sample can raise KeyError
Fix the hit and miss style of testing for sets and dicts.
2006-03-29 09:13:13 +00:00
Georg Brandl 80bb2bb7eb Revert r43399. 2006-03-28 19:19:56 +00:00
Georg Brandl f1349cd05d Bug #1459963: urllib2 now normalizes HTTP header names correctly
with title().
2006-03-28 12:40:24 +00:00
Georg Brandl 019514e854 Make test_augassign pass with -Qnew and convert to unittest. 2006-03-28 10:26:45 +00:00
Georg Brandl 686eaeb0b8 Make test_coercion pass with -Qnew. Converted to unittest on the occasion. 2006-03-28 10:00:53 +00:00
Thomas Wouters 4054b9720b In true regression-test spirit, make sure the
itertools.tee->instance->attribute->itertools.tee and
itertools.tee->teedataobject->itertools.tee cycles, which can be found now
that itertools.tee and its teedataobject participate in GC, remain findable
and cleanable. The test won't fail when they aren't, but at least the
frequent hunt-refleaks runs would spot the rise in refleaks.
2006-03-28 08:44:55 +00:00
Thomas Wouters a33b2bc873 Add an example of a generator->freevar->cell->generator reference-cycle that
doesn't get cleaned up and thus leaks.
2006-03-28 08:14:24 +00:00
Georg Brandl 96c3f7f56b Make test_decimal work with -Qnew. 2006-03-28 08:06:35 +00:00
Tim Peters b82cb8dcd5 Part of bug 1459808: fiddle test_input_and_raw_input()
so it passes w/ -Qnew.
2006-03-28 07:39:22 +00:00
Tim Peters 1c5bc1c9d7 Part of bug 1459808: fiddle so that this passes
with or without -Qnew.
2006-03-28 07:28:40 +00:00
Phillip J. Eby 35fd142435 Fix contextlib not copying function attributes 2006-03-28 00:07:24 +00:00
Neal Norwitz 33b730e33c Fix SF bug #1458903 with AST compiler.
def foo((x)): was getting recognized as requiring tuple unpacking
which is not correct.

Add tests for this case and the proper way to unpack a tuple of one:
	def foo((x,)):

test_inpsect was incorrect before.  I'm not sure why it was passing,
but that has been corrected with a test for both functions above.
This means the test (and therefore inspect.getargspec()) are broken in 2.4.
2006-03-27 08:58:23 +00:00
Martin v. Löwis 04855cc100 Fix typo. 2006-03-26 16:40:47 +00:00
Martin v. Löwis 6da56f9428 Patch from Aldo Cortesi: expected skips for OpenBSD. 2006-03-26 10:02:34 +00:00
Martin v. Löwis c667d052e5 Provide more debug output, to diagnose OpenBSD test failures. 2006-03-26 09:50:11 +00:00
Hye-Shik Chang 9f4b632212 Allow long objects as a position value of error callbacks returned. 2006-03-26 06:21:34 +00:00
Neal Norwitz 7545a6bac2 regsub is gone, nothing to ignore 2006-03-26 04:59:27 +00:00
Neal Norwitz 2c85d826d8 Try to handle sys.getfilesystemencoding() returning None.
ascii seems like the safest bet that it will exist.  I wonder if utf-8
would be a better choice?  This should get test_fileinput passing on OpenBSD.
2006-03-26 03:11:57 +00:00
Hye-Shik Chang e2ac4abd01 Patch #1443155: Add the incremental codecs support for CJK codecs.
(reviewed by Walter Dörwald)
2006-03-26 02:34:59 +00:00
Georg Brandl baf05b7e09 fix typo 2006-03-25 13:12:56 +00:00
Raymond Hettinger c4e94b90a8 Don't decrement below zero. And add more tests. 2006-03-25 12:15:04 +00:00
Tim Peters e33901eb2b Whitespace normalization. 2006-03-25 01:50:43 +00:00
Phillip J. Eby 6edd258608 Fix a problem with @contextmanager not detecting a broken generator
that yields after a throw().  Make @contextmanager not reraise
exceptions, but return a false value in that case instead.  Add test
cases for both behaviors.
2006-03-25 00:28:24 +00:00
Phillip J. Eby bee0712214 Support throw() of string exceptions. 2006-03-25 00:05:50 +00:00
Raymond Hettinger 43b00da219 Revert previous change. Wasn't ready yet. 2006-03-24 23:55:32 +00:00
Raymond Hettinger e751c86dcb Add more tests 2006-03-24 23:47:53 +00:00
Raymond Hettinger fd3fcf0b35 SF Patch #1455676: Simplify using Queues with daemon consumer threads
Adds join() and task_done() methods to track when all enqueued tasks have
been gotten and fully processed by daemon consumer threads.
2006-03-24 20:43:29 +00:00
Neal Norwitz cdb7948f97 Use absolute import. 2006-03-24 08:58:38 +00:00
Martin v. Löwis 478c82d30f Bug #1183780: Add Popen objects to _active only in __del__.
Cleanup terminated processes as well.
Add cmd attribute to Popen4.
2006-03-24 08:14:54 +00:00
Neal Norwitz 846d72a7d7 Exceptions should inherit from Exception now. 2006-03-24 08:02:51 +00:00
Neal Norwitz de868c9a1b Hmmm, I don't think we wanted to test // twice and / not at all (in this section). 2006-03-24 07:30:56 +00:00
Neal Norwitz 5a822fb720 Exceptions should inherit from Exception now. 2006-03-24 07:03:44 +00:00
Martin v. Löwis c92157ff52 Relax result test for program mode of quopri. 2006-03-23 19:14:23 +00:00
Martin v. Löwis 83be9669c8 Rewrite pipe code using subprocess, to make sure the
child process is closed when the test completes.
2006-03-23 18:16:43 +00:00
Neal Norwitz e98ccf6690 Forward port MvL's fix in 43227:
Fix crash when a Unicode string containing an encoding declaration is
compile()d. Fixes #1115379.
2006-03-23 05:39:47 +00:00
Tim Peters b84de02f75 Record that test_wait[34] get skipped on native Windows. 2006-03-22 02:58:17 +00:00
Georg Brandl bb03ac0dae Correct API design mistake from rev. 43126: make socket attributes readonly properties. 2006-03-21 18:17:25 +00:00
Tim Peters 59b96c1029 Try to repair at least one segfault on the Mac buildbot,
as diagnosed by Nick Coghlan.

test_capi.py:  A test module should never spawn a thread as
a side effect of being imported.  Because this one did, the
segfault one of its thread tests caused didn't occur until
a few tests after test_regrtest.py thought test_capi was
finished.  Repair that.  Also join() the thread spawned
at the end, so that test_capi is truly finished when
regrtest reports that it's done.

_testcapimodule.c test_thread_state():  this spawns a
couple of non-threading.py threads, passing them a PyObject*
argument, but did nothing to ensure that those threads
finished before returning.  As a result, the PyObject*
_could_ (although this was unlikely) get decref'ed out of
existence before the threads got around to using it.
Added explicit synchronization (via a Python mutex) so
that test_thread_state can reliably wait for its spawned
threads to finish.
2006-03-21 03:58:41 +00:00
Anthony Baxter 46fa48ab04 whitespace n11n 2006-03-20 07:10:01 +00:00
Neal Norwitz 05a45599d7 Patch #1309579: wait3 and wait4 were added to the posix module by Chad J. Schroeder.
This was a fair amount of rework of the patch.  Refactored test_fork1 so it
could be reused by the new tests for wait3/4.  Also made them into new style
unittests (derive from unittest.TestCase).
2006-03-20 06:30:08 +00:00
Anthony Baxter fa86907aae SF [ 1231053 ] audioop - alaw encoding/decoding added, code updated
This patch adds a-LAW encoding to audioop and replaces the old
u-LAW encoding/decoding code with the current code from sox.

Possible issues: the code from sox uses int16_t.

Code by Lars Immisch
2006-03-20 05:21:58 +00:00
Neal Norwitz d5b0c9b87e Fix problem spotted by Coverity that occurs if tzinfo.tzname().replace()
returns a non-string when converting %Z.

Will backport.
2006-03-20 01:58:39 +00:00
Barry Warsaw e5c5117acf Shim for test_email_renamed.py tests. 2006-03-18 16:17:17 +00:00
Barry Warsaw 40ef0067ad Merge email package 4.0 from the sandbox, including documentation, test cases,
and NEWS updates.
2006-03-18 15:41:53 +00:00
Walter Dörwald 9ae019bf5b Add tests for the C APIs PyCodec_IncrementalEncoder() and
PyCodec_IncrementalDecoder().
2006-03-18 14:22:26 +00:00
Georg Brandl bc45a3f821 RFE #567972: Socket objects' family, type and proto properties are
now exposed via new get...() methods.
2006-03-17 19:17:34 +00:00
Neal Norwitz c72f501aa2 as is on the road to keyword-hood, use a different var name. 2006-03-17 08:55:46 +00:00
Neal Norwitz d5f8ec27a8 Oops, copied the wrong code from keeprefs. Get the right code
this time and call gc.collect(), since there is some garbage.

The original code didn't really leak (if gc.collect() was called).
2006-03-17 07:15:59 +00:00
Neal Norwitz 770a800967 Update/expand on comments about leaking tests. 2006-03-17 04:52:38 +00:00
Neal Norwitz ddda855337 Ignore ctypes leaks, but add a test case so we do not forget. 2006-03-17 04:45:38 +00:00
Neal Norwitz 8749316c08 Try to find a host that responds slower from python.org so this test does not fail on macteagle (G4 OSX.4 in buildbot) 2006-03-17 04:37:34 +00:00
Tim Peters d71afb2d10 Set eol-style to native. 2006-03-16 18:55:20 +00:00
Trent Mick f8cf13eeb7 Update test_winsound to check for a configured sound card (using a VBScript
helper written by Roger Upole and Mark Hammond) and adjust the expected
PlaySoundTest case results accordingly.
2006-03-16 17:34:41 +00:00
Neal Norwitz 10be10cbe7 Remove regsub, reconvert, regex, regex_syntax and everything under lib-old. 2006-03-16 06:50:13 +00:00
Neal Norwitz 94a9c09e10 Rename sre.py -> re.py 2006-03-16 06:30:02 +00:00
Neal Norwitz 04d1513724 The pre module has been gone for a while. Need to go through and find other modules that no longer exists, since errors are silently ignored. 2006-03-16 06:21:19 +00:00
Walter Dörwald 197e8321c6 SF patch #1359365: cStringIO.StringIO.isatty() will raise a ValueError
now if close() has been called before (like file and StringIO.StringIO do)
2006-03-15 22:13:13 +00:00
Tim Peters f99b8162a2 Whitespace normalization. 2006-03-15 18:08:37 +00:00
Nick Coghlan 598f8a0031 Don't try to explicitly set path in runpy package tests (tests were broken on Windows) 2006-03-15 13:29:19 +00:00
Nick Coghlan 586b83c4bb Don't let cleanup errors mask real errors in the runpy tests 2006-03-15 13:11:54 +00:00
Nick Coghlan 5424ad8a2a Make test_runpy close all references to test modules before trying to delete the underlying files 2006-03-15 12:40:38 +00:00
Walter Dörwald abb02e5994 Patch #1436130: codecs.lookup() now returns a CodecInfo object (a subclass
of tuple) that provides incremental decoders and encoders (a way to use
stateful codecs without the stream API). Functions
codecs.getincrementaldecoder() and codecs.getincrementalencoder() have
been added.
2006-03-15 11:35:15 +00:00
Nick Coghlan e2ebb2d7f7 Implement PEP 338 which has been marked as accepted by GvR 2006-03-15 11:00:26 +00:00
Walter Dörwald 0af5d93d8a SF patch #1359365: file and cStringIO raise a ValueError when next() is called
after calling close(). Change StringIO, so that it behaves the same way.
2006-03-15 08:23:53 +00:00
Tim Peters 903d846a69 Renamed test_hashlib_speed.py to time_hashlib.py.
Since it's never intended that this script be run by
regrtest.py, it shouldn't have been named with a "test_"
prefix to begin with.  A consequence is that we shouldn't
see useless:

    test_hashlib_speed skipped -- not a unit test (stand alone benchmark)

lines in regrtest output anymore.
2006-03-14 22:48:56 +00:00
Nick Coghlan eadee9a744 Fix SF bug #1448804 and ad a test to ensure that all subscript operations continue to be handled correctly 2006-03-13 12:31:58 +00:00
Hye-Shik Chang abb903fd54 Bug #1448490: Fix a bug that ISO-2022 codecs could not handle
SS2 (single-shift 2) escape sequences correctly.
2006-03-13 10:20:08 +00:00
Tim Peters 88ca467ca4 Whitespace normalization. 2006-03-10 23:39:56 +00:00
Tim Peters 922dd7d49d When the new -w option (yay! great idea) reruns a
failed test, first display the name of the test (else
it's not always clear from the output which test is
getting run).
2006-03-10 23:37:10 +00:00
Martin v. Löwis 04824ce8ed Add regrtest -w option. 2006-03-10 21:26:16 +00:00
Martin v. Löwis 4196296605 Update test data to 4.1; disable PRI #29 for now. 2006-03-10 11:59:47 +00:00
Guido van Rossum f669436189 Um, I thought I'd already checked this in.
Anyway, this is the changes to the with-statement
so that __exit__ must return a true value in order
for a pending exception to be ignored.
The PEP (343) is already updated.
2006-03-10 02:28:35 +00:00
Martin v. Löwis 480f1bb67b Update Unicode database to Unicode 4.1. 2006-03-09 23:38:20 +00:00
Georg Brandl d09def36d5 Bug #1442874: handle "<!>", the empty SGML comment 2006-03-09 13:27:14 +00:00
Thomas Heller e317d0e307 Replace the trivial ctypes test (did only an import) with the real test suite. 2006-03-09 07:21:33 +00:00
Neal Norwitz 72c2c062d7 Try to be a bit more consistent on all platforms:
python .
  python < .

both print a message, return non-zero and do not core dump.
2006-03-09 05:58:11 +00:00
Tim Peters e8d09e5818 Whitespace normalization. 2006-03-09 01:15:05 +00:00
Thomas Heller 200af39722 Trivial test for ctypes, more to come 2006-03-08 20:38:11 +00:00
Georg Brandl 533ff6fc06 Patch #1434038: property() now uses the getter's docstring if there is
no "doc" argument given. This makes it possible to legitimately use
property() as a decorator to produce a read-only property.
2006-03-08 18:09:27 +00:00
Tim Peters df44ab7b1c _hotshot hotshot_profiler(): If write_header() returned
an error code, this let `self` leak.  This is a disaster
on Windows, since `self` already points to a newly-opened
file object, and it was impossible for Python code to
close the thing since the only reference to it was in a
blob of leaked C memory.

test_hotshot test_bad_sys_path():  This new test provoked
the C bug above.  This test passed, but left an open
"@test" file behind, which caused a massive cascade of
bogus test failures in later, unrelated tests on Windows.
Changed the test code to remove the @test file it leaves
behind, which relies on the change above to close that
file first.
2006-03-07 23:53:32 +00:00
Guido van Rossum 38fff8c4e4 Checking in the code for PEP 357.
This was mostly written by Travis Oliphant.
I've inspected it all; Neal Norwitz and MvL have also looked at it
(in an earlier incarnation).
2006-03-07 18:50:55 +00:00
Barry Warsaw d3c38ff7f8 SF patch #1443865; gc.get_count() added and optional argument 'generation'
added to gc.collect().  Updated docs, unit test, and NEWS entry.

(Also, fixed a typo in NEWS.)
2006-03-07 09:46:03 +00:00
Neal Norwitz 60da31660c Thanks to Coverity, these were all reported by their Prevent tool.
All of these (except _lsprof.c) should be backported.  Particularly
the hotshot change which validates sys.path.  Can someone backport?
2006-03-07 04:48:24 +00:00
Walter Dörwald ca199432c2 If size is specified, try to read at least size characters.
This is a alternative version of patch #1379332.
2006-03-06 22:39:12 +00:00
Neal Norwitz 5bab0f8872 Backout the last hack and add in this new one.
The failure definitely seems timing related.  This change *seems* to work.
Since the failure isn't doesn't occur consistently, it's hard to tell.

Running these tests on Solaris in this order:
	test_urllibnet test_operator test_cgi \
	test_isinstance test_future test_ast test_logging

generally caused a failure (about 50% of the time) before the sleep.
I couldn't provoke the failure with the sleep.

This should really be cleaned up by using threading.Events or something
so it is not timing dependent and doesn't hang forever on failure.
2006-03-05 02:16:12 +00:00
Neal Norwitz 83cbb24cd4 Oops, urllib may or may not already be loaded. 2006-03-04 23:56:53 +00:00
Neal Norwitz d8cea79bb4 Fix spurious test failure of test_socket_ssl when run in this order:
test_codecmaps_tw test_importhooks test_socket_ssl

I don't completely understand the cause, but there's a lot of import magic
going on and this is the smallest change which fixes the problem.
2006-03-04 23:13:41 +00:00
Neal Norwitz b62c433d71 Remove test for timing (already not built since commented out in setup.py).
Add note to NEWS.
2006-03-04 18:35:47 +00:00
Neal Norwitz 67dfb6f086 I think the test_logging failure on Solaris is timing related. We don't
want to wait forever if we don't receive the last message.  But we also
don't want the test to fail if we shutdown too quickly.  I can't reliably
reproduce this failure, so I'm kinda guessing this is the problem.
We'll see if this band-aid helps.
2006-03-03 21:53:14 +00:00
Neal Norwitz 10be2ea85d SF bug 1442442: LIST_APPEND optimization got lost in the AST merge.
Add it back.
2006-03-03 20:29:11 +00:00
Brett Cannon 4954b384e4 Fix mismatch opening and closing quotes on a string. 2006-03-02 17:47:01 +00:00
Guido van Rossum 5bde08dba3 Fix failure of test_compiler.py when compiling test_contextlib.py.
The culprit was an expression-less yield -- the first apparently in
the standard library.  I added a unit test for this.
Also removed the hack to force compilation of test_with.py.
2006-03-02 04:24:01 +00:00
Martin v. Löwis d9bfeac330 Reformat the exception message by going through a list. 2006-03-01 23:24:34 +00:00
Tim Peters 5ddfe41e84 Whitespace normalization. 2006-03-01 23:02:57 +00:00
Martin v. Löwis 49c5da1d88 Patch #1440601: Add col_offset attribute to AST nodes. 2006-03-01 22:49:05 +00:00
Martin v. Löwis 15bfc3b082 Make failures in test cases print failing source file. 2006-03-01 21:11:49 +00:00
Guido van Rossum a9f068726f Fix a bug in nested() - if one of the sub-context-managers swallows the
exception, it should not be propagated up.  With unit tests.
2006-03-01 17:10:01 +00:00
Tim Peters 1a57296450 Set svn:eol-style to native. 2006-03-01 06:19:04 +00:00
Brett Cannon 6b4ed74791 Fix parsing of exception_hierarchy.txt when a platform-specific exception is
specified.  Hopefully this wll bring warming to Tim's Windows-loving heart.
2006-03-01 06:10:48 +00:00
Brett Cannon bf36409e2a PEP 352 implementation. Creates a new base class, BaseException, which has an
added message attribute compared to the previous version of Exception.  It is
also a new-style class, making all exceptions now new-style.  KeyboardInterrupt
and SystemExit inherit from BaseException directly.  String exceptions now
raise DeprecationWarning.

Applies patch 1104669, and closes bugs 1012952 and 518846.
2006-03-01 04:25:17 +00:00
Guido van Rossum 1a5e21e033 Updates to the with-statement:
- New semantics for __exit__() -- it must re-raise the exception
  if type is not None; the with-statement itself doesn't do this.
  (See the updated PEP for motivation.)

- Added context managers to:
  - file
  - thread.LockType
  - threading.{Lock,RLock,Condition,Semaphore,BoundedSemaphore}
  - decimal.Context

- Added contextlib.py, which defines @contextmanager, nested(), closing().

- Unit tests all around; bot no docs yet.
2006-02-28 21:57:43 +00:00
Neal Norwitz cd8ca8092f Add a note about removing the file once the bug is fixed 2006-02-28 20:40:50 +00:00
Tim Peters dfc240450c Gave README a .txt extension. 2006-02-28 19:05:29 +00:00
Thomas Wouters 34aa7ba114 from __future__ import with_statement addon for 'with', mostly written by
Neal.
2006-02-28 19:02:24 +00:00
Neal Norwitz edc8f1366a Add directory which contains known ref leaks. Some of these are likely to be system dependent (like test_gestalt). 2006-02-28 19:02:05 +00:00
Tim Peters 400cbc3a44 Set EOL style to native. 2006-02-28 18:44:41 +00:00
Tim Peters 710ab3b5f8 Whitespace normalization. 2006-02-28 18:30:36 +00:00
Neal Norwitz 14ca327f99 Instead of printing the exception when you interrupt a test (Ctrl-C),
print the status so far and suppress printing the exception (but still exit).
2006-02-28 18:05:43 +00:00
Neal Norwitz 03bdedd574 Update comments 2006-02-28 17:53:58 +00:00
Jeremy Hylton 7b03bade2b Test case to cover subscription bug from SF 1333982 2006-02-28 17:46:23 +00:00
Thomas Wouters f7f438ba3b SF patch #1438387, PEP 328: relative and absolute imports.
- IMPORT_NAME takes an extra argument from the stack: the relativeness of
   the import. Only passed to __import__ when it's not -1.

 - __import__() takes an optional 5th argument for the same thing; it
   __defaults to -1 (old semantics: try relative, then absolute)

 - 'from . import name' imports name (be it module or regular attribute)
   from the current module's *package*. Likewise, 'from .module import name'
   will import name from a sibling to the current module.

 - Importing from outside a package is not allowed; 'from . import sys' in a
   toplevel module will not work, nor will 'from .. import sys' in a
   (single-level) package.

 - 'from __future__ import absolute_import' will turn on the new semantics
   for import and from-import: imports will be absolute, except for
   from-import with dots.

Includes tests for regular imports and importhooks, parser changes and a
NEWS item, but no compiler-package changes or documentation changes.
2006-02-28 16:09:29 +00:00
Guido van Rossum 7ad94f011e Update the compiler package to compile the with-statement.
Jeremy, please review!
2006-02-28 00:32:16 +00:00
Guido van Rossum c2e20744b2 PEP 343 -- the with-statement.
This was started by Mike Bland and completed by Guido
(with help from Neal).

This still needs a __future__ statement added;
Thomas is working on Michael's patch for that aspect.

There's a small amount of code cleanup and refactoring
in ast.c, compile.c and ceval.c (I fixed the lltrace
behavior when EXT_POP is used -- however I had to make
lltrace a static global).
2006-02-27 22:32:47 +00:00
Neal Norwitz 9aaad88393 Even though we don't currently use unicode or complex numbers in the test,
be complete when when checking types.

Yield cannot be tested outside a function, so add a comment to that effect.
2006-02-27 21:08:23 +00:00
Brett Cannon be66e943c2 Don't filter out OverflowWarning; should be a test failure if it is raised by
the interpreter in 2.5 .
2006-02-27 20:03:56 +00:00
Thomas Wouters dca3b9c797 PEP 308 implementation, including minor refdocs and some testcases. It
breaks the parser module, because it adds the if/else construct as well as
two new grammar rules for backward compatibility. If no one else fixes
parsermodule, I guess I'll go ahead and fix it later this week.

The TeX code was checked with texcheck.py, but not rendered. There is
actually a slight incompatibility:

>>> (x for x in lambda:0)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: iteration over non-sequence

changes into

>>> (x for x in lambda: 0)
  File "<stdin>", line 1
    (x for x in lambda: 0)
                     ^
SyntaxError: invalid syntax

Since there's no way the former version can be useful, it's probably a
bugfix ;)
2006-02-27 00:24:13 +00:00
Martin v. Löwis bd260da900 Generate code to recursively copy an AST into
a tree of Python objects. Expose this through compile().
2006-02-26 19:42:26 +00:00
Guido van Rossum 1968ad32cd - Patch 1433928:
- The copy module now "copies" function objects (as atomic objects).
  - dict.__getitem__ now looks for a __missing__ hook before raising
    KeyError.
  - Added a new type, defaultdict, to the collections module.
    This uses the new __missing__ hook behavior added to dict (see above).
2006-02-25 22:38:04 +00:00
Georg Brandl 418a1ef089 RFE #1436243: make integers in [0..256] preallocated. 2006-02-22 11:30:06 +00:00
Georg Brandl 6a29c323ba Add test for classmethod ./. keyword args. 2006-02-21 22:17:46 +00:00
Tim Peters 42a3deb7b5 Suppress another deprecation warning in the tests. 2006-02-21 03:28:49 +00:00
Tim Peters 32cbc96150 Whitespace normalization. 2006-02-20 21:42:18 +00:00
Georg Brandl 5771310a09 Bug #1101233: fix test_fcntl on netbsd2 platform. 2006-02-20 10:32:02 +00:00
Georg Brandl 8f7c54eaa5 Bug #1413790: zipfile now sanitizes absolute archive names that are
not allowed by the specs.
2006-02-20 08:40:38 +00:00
Tim Peters 4d7cad115d Repair new test failures on Windows due to
implicit assumptions that there's no difference
between text and binary modes.
2006-02-19 21:22:10 +00:00
Marc-André Lemburg fe4b34cc4b Fix the encodings package codec search function to only search
inside its own package. Fixes problem reported in patch #1433198.

Add codec search function for codec test codec.
2006-02-19 15:22:22 +00:00
Georg Brandl c98eeede17 Patch #1215184: FileInput now can be given an opening hook which can
be used to control how files are opened.
2006-02-19 14:57:47 +00:00
Georg Brandl c029f873cb Patch #1212287: fileinput.input() now has a mode parameter for
specifying the file mode input files should be opened with.
2006-02-19 14:12:34 +00:00
Georg Brandl 67e9fb9d7a Patch #1215184: fileinput now has a fileno() function for getting the
current file number.
2006-02-19 13:56:17 +00:00
Georg Brandl 602b9ba6b3 Patch #1349274: gettext.install() now optionally installs additional
translation functions other than _() in the builtin namespace.
2006-02-19 13:26:36 +00:00
Georg Brandl e466217ab9 Patch #1337756: fileinput now accepts Unicode filenames. 2006-02-19 09:51:27 +00:00
Tim Peters 2a8ec996ce test_gopher(): Squash another deprecation
warning about gopherlib.
2006-02-19 05:09:00 +00:00
Neal Norwitz bb45973455 This fixes test _locale failing on macteagle (Mac OS 10.4 AFAIK).
Google for:  eu_ES decimal point
shows that BSD locales had the eu_ES decimal point as
a single quote (') instead of a comma (,).

This was seems to have been fixed 15 months ago, but it's not on our
Mac and presumably others.  So skip this broken locale.
2006-02-19 00:13:15 +00:00
Neal Norwitz d5b6715083 This should get test_timeout to pass when running on any python.org host. Will backport 2006-02-18 21:20:31 +00:00
Tim Peters e2c9a6cea7 Suppress new deprecation warnings when running the
test suite.

For urllib2, move the import of gopherlib into the
only function that uses it:  users (including the
test suite) certainly shouldn't see a deprecation
warning just because they import urllib2!  If they
actually use gopher_open(), fine, _then_ they should
see a deprecation warning.
2006-02-18 04:14:16 +00:00
Georg Brandl 4cbd1e3fc1 Move test case for HTTP response dict to httplib. 2006-02-17 22:01:08 +00:00
Martin v. Löwis 18e165558b Merge ssize_t branch. 2006-02-15 17:27:45 +00:00
Tim Peters cffcfed126 New test code failed to close the file. This caused
test_file to fail on Windows in reality (can't delete
a still-open file), but a new bare "except:" hid that
test_file failed on Windows, and leaving behind the
still-open TESTFN caused a cascade of bogus failures
in later tests.

So, close the file, and stop hiding failure to unlink.
2006-02-14 17:41:18 +00:00
Thomas Wouters c45251a485 SF patch #1397960: When mixing file-iteration and
readline/readlines/read/readinto, loudly break by raising ValueError, rather
than silently deliver data out of order or hitting EOF prematurely.

Probably not a bugfix candidate, even though it affects no 'working' code.
2006-02-12 11:53:32 +00:00
Armin Rigo f5b3e36493 Renamed _length_cue() to __length_hint__(). See:
http://mail.python.org/pipermail/python-dev/2006-February/060524.html
2006-02-11 21:32:43 +00:00
Vinay Sajip 1eb77a50c8 Added lock acquisition/release around shared data structure manipulation 2006-02-09 08:31:00 +00:00
Armin Rigo a871ef2b3e Added the cProfile module.
Based on lsprof (patch #1212837) by Brett Rosen and Ted Czotter.
With further editing by Michael Hudson and myself.
History in svn repo: http://codespeak.net/svn/user/arigo/hack/misc/lsprof

* Module/_lsprof.c is the internal C module, Lib/cProfile.py a wrapper.
* pstats.py updated to display cProfile's caller/callee timings if available.
* setup.py and NEWS updated.
* documentation updates in the profiler section:
   - explain the differences between the three profilers that we have now
   - profile and cProfile can use a unified documentation, like (c)Pickle
   - mention that hotshot is "for specialized usage" now
   - removed references to the "old profiler" that no longer exists
* test updates:
   - extended test_profile to cover delicate cases like recursion
   - added tests for the caller/callee displays
   - added test_cProfile, performing the same tests for cProfile
* TO-DO:
   - cProfile gives a nicer name to built-in, particularly built-in methods,
     which could be backported to profile.
   - not tested on Windows recently!
2006-02-08 12:53:56 +00:00
Vinay Sajip f0a95eca45 Saved and restored logging._handlerList at the same time as saving/restoring logging._handlers. 2006-02-07 13:44:48 +00:00
Neal Norwitz 55cd82fe0a Get test_logging to not hang when running under regrtest.py -R ::
Not sure why/how _handlers/_handlerList is out of sync.  This could
indicate a deeper problem.

In test_logging, the only absolutely necessary change to get working
was tcpserver.abort = 1.  But we don't want to wait infinitely
to join the threads, so give a 2.0 second timeout.

There doesn't appear to be a need for a local abort variable
in serve_until_stopped, so just use the instance member.

Note the problem is only on HEAD, not in 2.4.
2006-02-05 08:21:08 +00:00
Neal Norwitz 0e6bc8c260 Patch #1407135, bug #1424041, make mmap.mmap(-1, length) work the same
on both Unix (SVR4 and BSD) and Windows.  Restores behaviour of passing -1
for anonymous memory on Unix.  Use MAP_ANONYMOUS instead of _ANON since
the latter is deprecated according to Linux (gentoo) man pages.

Should we continue to allow mmap.mmap(0, length) to work on Windows?
0 is a valid fd.

Will backport bugfix portions.
2006-02-05 05:45:43 +00:00
Neal Norwitz faa26dfdd8 Fix typo 2006-02-04 03:26:20 +00:00
Gustavo Niemeyer 548148810b Patch #1413711: Certain patterns of differences were making difflib
touch the recursion limit. The applied patch inlines the recursive
__helper method in a non-recursive way.
2006-01-31 18:34:13 +00:00
Tim Peters 249c7b050b Whitespace normalization. 2006-01-29 22:50:26 +00:00
Martin v. Löwis 5b1e003da8 Try a number of ports, in case 9020 is already in use. 2006-01-29 20:10:38 +00:00
Martin v. Löwis f684888b1e Explicitly close the server socket. 2006-01-29 19:55:18 +00:00
Thomas Wouters 35f34f8d60 Work around a Solaris peculiarity that caused test_pty to sometimes fail: a
tty opened by os.openpty() isn't always a tty according to os.isatty(), when
it's tested inside the process that opened it. Doesn't affect actual
functionality, as using a tty this way is rarely, if ever, useful. Ignoring
the failure allows the test for actual functionality to continue.

Will backport to 2.4-maint.
2006-01-28 12:05:54 +00:00
Jeremy Hylton c960f26044 Improved handling of syntax errors.
Expand set of errors caught in set_context().  Some new errors, some
old error messages changed for consistency.

Fixed error checking in generator expression code.  The first set of
tests were impossible condition given the grammar.  In general, the
ast code uses REQ() for those sanity checks.

Fix some error handling for augmented assignments.  As comments in the
code explain, set_context() ought to work here, but I got unexpected
crashes when I tried it.  Should come back to this.

Add note to Grammar that yield expression is a special case.

Add doctest cases for SyntaxErrors raised by ast.c.
2006-01-27 15:18:39 +00:00
Neal Norwitz 08e301f8bd There was a race condition where the connector would try to connect
before the listener was ready (on gentoo x86 buildslave).  This
caused the listener to not exit normally since nobody connected to it
(waited in accept()).  The exception was raised in the other thread
and the test failed.

This fix doesn't completely eliminate the race, but should make it
near impossible to trigger.  Hopefully it's good enough.
2006-01-25 08:39:35 +00:00
Neal Norwitz 14361fffc2 Remove generated test db files 2006-01-25 07:20:47 +00:00
Neal Norwitz 62a21121b4 Fix bug #1413192, fix seg fault in bsddb if a txn was deleted before the env.
Will backport.
2006-01-25 05:21:55 +00:00
Tim Peters 2a4712dc80 test_rude_shutdown(): Rewrote to use proper thread
synchronization and termination.
2006-01-24 22:44:54 +00:00
Tim Peters 68f2d000e9 Repaired new test failures on Windows:
- The path separator isn't "/" on Windows.

- Leaving behind a read-only file causes cascades
  of bogus failures on Windows.
2006-01-23 22:19:24 +00:00
Tim Peters bc29c1a4cc Whitespace normalization. 2006-01-23 21:28:42 +00:00
Neal Norwitz dbc95f4222 Disable this test until I can test on big-endian machines and get passing 2006-01-23 08:48:03 +00:00
Neal Norwitz b155b62f54 Test zipimporter a bit more. Also get working with -R :: option for finding ref leaks 2006-01-23 07:52:13 +00:00
Neal Norwitz 0e17f8cd38 Convenience function to remove a possibly non-existant file 2006-01-23 07:51:27 +00:00
Neal Norwitz 9730bcb4a6 Test getsignal() and some error conditions 2006-01-23 07:50:06 +00:00
Neal Norwitz cd3e219cda Use unittest and make sure a few other cases don't crash 2006-01-23 07:49:36 +00:00
Vinay Sajip 568482a266 Added a test for the ability to specify a class attribute in Formatter configuration. Contributed by Shane Hathaway. 2006-01-20 18:29:36 +00:00
Vinay Sajip 80d2df86dc Added a test for the ability to specify a class attribute in Formatter configuration. Contributed by Shane Hathaway. 2006-01-20 18:28:59 +00:00
Georg Brandl da6b107745 Checkin the test of patch #1400181. 2006-01-20 17:48:54 +00:00
Brett Cannon 2dbf2a98f4 Add a more informative error message for test_float_parsing so the failing
locale can be known.
2006-01-19 07:09:09 +00:00
Vinay Sajip fe03bee62f Changes due to added test for fileConfig contributed by Shane Hathaway. 2006-01-16 21:25:28 +00:00
Vinay Sajip 22b25aa9e2 Added test for fileConfig. Contributed by Shane Hathaway. 2006-01-16 21:24:38 +00:00
Armin Rigo b4b5a7601b collected my segfaulting Python examples from the SF trackers
(is the purpose of the crashers directory to scare people? :-)
2006-01-14 10:58:30 +00:00
Tim Peters a28ad77844 Whitespace normalization. 2006-01-13 03:05:25 +00:00
Georg Brandl 05f5ba9636 Test curses.setupterm() before initscr(). 2006-01-12 15:41:05 +00:00
Neal Norwitz 3b4fff8079 Fix SF bug #1402308, segfault when using mmap(-1, ...)
This didn't crash on Linux, but valgrind complained.
I'm not sure if this test is valid on Windows.

Will backport.
2006-01-11 08:54:45 +00:00
Neal Norwitz ae1df41127 add another crash reported by Thomas Wouters 2006-01-11 07:21:19 +00:00
Georg Brandl 05af43d6a0 Remove outstanding_crashes again. 2006-01-10 20:07:13 +00:00
Georg Brandl 7e8bfa4163 Add outstanding_crashes.py with tests for crashes. 2006-01-10 19:29:24 +00:00
Neal Norwitz 8cc4ef561c As I threatened on python-dev, add a directory which contains all known
bugs which cause the interpreter to crash.  I'm sure we can find a few
more.  Many missing bugs deal with variations on unchecked infinite recursion
(like coerce.py).
2006-01-10 07:49:41 +00:00
Neal Norwitz 88bbd73d07 SF bug #1400822, Extended version of _curses over{lay,write} does not work
Fix signatures to conform to doc (also fixed ungetmouse()).

Will backport.
2006-01-10 07:05:44 +00:00
Georg Brandl ed1e497fb2 Correct test_builtin locale handling. 2006-01-09 22:36:58 +00:00
Neal Norwitz 5e3d862392 Bug #1400115, Fix segfault when calling curses.panel.userptr()
without prior setting of the userptr.

Will backport.
2006-01-09 06:24:35 +00:00
Georg Brandl c4e2a9b70a Add a test file (which isn't run by regrtest) for bugs which
aren't fixed yet.

Includes a first test (for compiler).
2006-01-08 14:32:19 +00:00
Martin v. Löwis 412ed3b8a7 Patch #1177307: UTF-8-Sig codec. 2006-01-08 10:45:39 +00:00
Tim Peters 2841af4cec Revert revision 41940: the test causes -uall to
fail everywhere.
2006-01-07 23:20:46 +00:00
Georg Brandl 39cdfff691 Add compiler test regarding optional arguments. 2006-01-06 19:28:15 +00:00
Neal Norwitz 9f39f68533 initscr() will exit if there's an error. Try to catch the obvious failure
cases if TERM isn't set or is unknown (perhaps we should only check if
unset or empty?)

Skip the test if TERM isn't set.  This seems to occur when running under
buildbot and presumably cron.

For some more info check here:
http://mail.python.org/pipermail/python-checkins/2006-January/048704.html

Will backport if it works.
2006-01-06 04:18:21 +00:00
Neal Norwitz c6d1f9100f If the audio file does not exist, the test should be skipped. Will backport. 2006-01-05 07:16:13 +00:00
Neal Norwitz eeab7da591 Skip test_curses if stdin is not a tty (like when run from cron or buildbot). Will backport. 2006-01-05 06:09:13 +00:00
Tim Peters 0cdc3d884e test_main(): Restore the original root logger level after running
the tests.  This stops the confusing/annoying:

    No handlers could be found for logger "cookielib"

message we got whenever some test running after test_logging
happened to use cookielib.py (when not using regrtest's -r,
this happened during test_urllib2; when using -r, it varied).
2005-12-30 20:46:23 +00:00
Tim Peters 1b27f86411 Whitespace normalization. 2005-12-30 18:42:42 +00:00
Martin v. Löwis 4cfa136680 Work around test_locale failing on Solaris.
Will backport to 2.4.
2005-12-30 12:51:45 +00:00
Skip Montanaro 39b29be8a6 Fix a delimiter detection problem in sniffer. Sniffing "a|b|c\r\n" was
returning 'a' as the delimiter.  It now returns '|', but not because I
understood better what the code was supposed to do.  Would someone that
understands the idea behind _guess_delimiter() (see its doc string) look to
see if my fallback choice is better than before or if it's just serendipity
that I picked the proper delimiter?
2005-12-30 05:09:48 +00:00
Fredrik Lundh 24f0fa97c5 SF#1391872
Floating point literals don't work in non-US locale in 2.5.  Patch and
new locale tests by Hye-Shik Chang.
2005-12-29 20:35:52 +00:00
Armin Rigo 037d1e0ff3 SF bug #1153075: "PyXxx_Check(x) trusts x->ob_type->tp_mro".
A patch by mwh to check that user-defined mro's are reasonable
enough.
2005-12-29 17:07:39 +00:00
Armin Rigo f5bd3b442d adding in-place operators to the operator module. 2005-12-29 16:50:42 +00:00
Armin Rigo fd163f92ce SF patch #1390657:
* set sq_repeat and sq_concat to NULL for user-defined new-style
  classes, as a way to fix a number of related problems.  See
  test_descr.notimplemented()).  One of these problems was fixed
  in r25556 and r25557 but many more existed; this is a general
  fix and thus reverts r25556-r25557.

* to avoid having PySequence_Repeat()/PySequence_Concat() failing
  on user-defined classes, they now fall back to nb_add/nb_mul if
  sq_concat/sq_repeat are not defined and the arguments appear to
  be sequences.

* added tests.

Backport candidate.
2005-12-29 15:59:19 +00:00
Skip Montanaro 91bb70c5c0 Fix for problem with Sniffer class. If your delimiter is whitespace and the
last field was empty it would strip the delimiter and incorrectly guess that
"" was the delimiter.  Reported in c.l.py by Laurent Laporte.  Will
backport.
2005-12-28 15:37:25 +00:00
Tim Peters 536cf99536 Whitespace normalization. 2005-12-25 23:18:31 +00:00
Tim Peters 83a8c393b0 test_bug_1333982(): This one must fail under -O.
All the --all test pass using -O on WinXP now.
2005-12-25 22:52:32 +00:00
Neal Norwitz 71dad72ebe SF patch #1157027, cookielib mis-handles RFC 2109 cookies in Netscape mode 2005-12-23 21:43:48 +00:00
Neal Norwitz 3e7de59bd2 Fix SF #1117398, cookielib LWPCookieJar and MozillaCookieJar exceptions
cookielib.LWPCookieJar and .MozillaCookieJar are documented to raise
cookielib.LoadError on attempt to load an invalid cookies file, but
raise IOError instead.  Compromise by having LoadError subclass IOError.
2005-12-23 21:24:35 +00:00
Neal Norwitz 51abbc7b4a Fix Armin's bug 1333982. He found it, he didn't created it :-)
This code generated a C assertion:
        assert 1, ([s for s in x] +
                   [s for s in x])
        pass

assert was completely broken, it needed to use the proper block.
compiler_use_block() is now no longer used, so remove it.
2005-12-18 07:06:23 +00:00
Neal Norwitz db83eb3170 Fix Bug #1378022, UTF-8 files with a leading BOM crashed the interpreter.
Needs backport.
2005-12-18 05:29:30 +00:00
Neal Norwitz e7214a130b Get float() to be more portable across platforms. Disable hex strings. 2005-12-18 05:03:17 +00:00
Neal Norwitz 8856fb750b SF Patch #1365916, mmap fails on AMD64
Fix some 64-bit issues due to mismatch format characters w/actual data types
2005-12-18 03:34:22 +00:00
Neal Norwitz f599f424a2 SF patch #1355913, PEP 341 - Unification of try/except and try/finally
Modified since ast-arenas was implemented.
2005-12-17 21:33:47 +00:00
Hye-Shik Chang 835b243c71 Bug #1379994: Fix *unicode_escape codecs to encode r'\' as r'\\'
just like string codecs.
2005-12-17 04:38:31 +00:00
Fredrik Lundh 8911ca3d70 added encoding tests to ElementTree/cElementTree tests 2005-12-16 22:07:17 +00:00
Walter Dörwald 3b287702dd Add two tests for the script interface. 2005-12-15 20:17:20 +00:00
Fredrik Lundh 9235ea4f26 added cElementTree tests 2005-12-15 18:41:22 +00:00
Neal Norwitz a716eabca7 Revert r41662 and the part of 41552 that originally caused the problem
(calling ftell(stdin) doesn't seem defined).  So we won't test errors
from ftell unless we can do it portably.
2005-12-15 05:25:09 +00:00
Walter Dörwald b197543680 If quopri uses the implementations from binascii do the tests a second time
using the Python implementations of the functions. This imcreases code
coverage and makes sure that both implementations do the same thing.
2005-12-14 23:32:22 +00:00
Armin Rigo 9ed7306031 Subversion settings:
svn:ignore *.pyc *.pyo
  svn:eol-style native

The .py files appear to have been checked in with Windows or inconsistent line
endings.  The current check-in disrupts the 'svn blame', but hopefully it is
irrelevant for freshly imported code.
2005-12-14 18:10:45 +00:00
Fred Drake c6730e1772 move the xml package implementation to xmlcore, and adjust the tests to
test that package, not the xmlcore/PyXML switcheroo fiasco in the xml
module/package
2005-12-14 06:20:35 +00:00
Hye-Shik Chang e2f8e3c14f Fix test not to fail on FreeBSD. Directories work also as data
files on the platform.
2005-12-13 17:06:45 +00:00
Fredrik Lundh 0e664e15ef skip NIS entries, empty entries, etc 2005-12-12 20:53:40 +00:00
Fredrik Lundh 80768f8635 skip nis entries, if not filtered out by getpwall itself 2005-12-12 20:46:31 +00:00
Fredrik Lundh 2a60d9ac2d added xml.etree test (enough of the ElementTree selftest to
make sure that all included components work)
2005-12-12 20:19:44 +00:00
Fredrik Lundh 7e0aef0e75 r1068@spiff: Fredrik | 2005-12-12 19:50:30 +0100
assorted xml.etree tweaks
2005-12-12 18:54:55 +00:00
Neal Norwitz f8d403dd97 SF #1377897, Bus error in ast
If a line had multiple semi-colons and ended with a semi-colon, we would
loop too many times and access a NULL node.  Exit the loop early if
there are no more children.
2005-12-11 20:12:40 +00:00
Hye-Shik Chang aaa2f1dea7 Patch #1276356: Implement new resource "urlfetch" for regrtest.
This enables even impatient people to run tests that require remote
files such as test_normalization and test_codecmaps_*.
2005-12-10 17:44:27 +00:00
Neal Norwitz ec77645df9 mwh spotted a copied error message, make it unique (and correct) 2005-12-05 01:23:48 +00:00
Neal Norwitz a6fc397a80 Fix SF #1373161, r41552 broke test_file on OS X
You apparently can seek(0) on sys.stdin on OS X.
But you can't go backwards, so seek(-1).
2005-12-05 01:17:03 +00:00
Andrew M. Kuchling bdb3901001 [Bug #1164912] Ensure Datetime wrapper class .value attribute is an 8-bit string, not a Unicode string 2005-12-04 19:11:17 +00:00
Walter Dörwald ede187f022 Test another error case in PyFloat_FromString(). 2005-11-29 15:45:14 +00:00
Neal Norwitz fcf4435ae0 Improve test coverage. Hope the test_file changes work the same on windows. 2005-11-27 20:37:43 +00:00
Walter Dörwald 9356fb9881 SF patch #1364545: test_cmd_line.py relied on english error messages when
invoking the Python interpreter (which didn't work on non-english Windows
versions). Check return codes instead.
2005-11-25 15:22:10 +00:00
Neal Norwitz 89886ab2b0 Test is still disabled, but access through public module 2005-11-25 03:15:49 +00:00
Neal Norwitz 545d4962f5 Cleanup a bit more references so test_urllibnet is stable (test_urllib2 is sometimes stable, at least in isolation) 2005-11-25 02:55:49 +00:00
Neal Norwitz 2fcf206a6f Fix typo in comment.
Delete globals which contain variable information at the end of the test.
This makes the test stable (no reported leaks) when running regrtest -R
to find reference leaks.
2005-11-24 23:28:37 +00:00
Neal Norwitz 430f68b447 Move registration of the codec search function to the module scope
so it is only executed once.  Otherwise the same search function is
repeated added to the codec search path when regrtest is run with -R
and leaks are reported.
2005-11-24 22:00:56 +00:00
Neal Norwitz a98e7694ee move test into a unittest.TestCase, no functional changes 2005-11-24 21:58:51 +00:00
Andrew M. Kuchling 841d25ee66 [Patch #1094164] replaceChild(x,x) ends up removing x of the tree. Add fix from Felix Rabe and a test case 2005-11-22 19:03:16 +00:00
Andrew M. Kuchling bb7e800506 [Patch #1350573] zlib.crc32 doesn't handle 0xffffffff seed. Add tests and bugfix. Bug reported by John Schmidt; bugfix by Danny Yoo. 2005-11-22 15:32:28 +00:00
Neal Norwitz 5898fa2dcd improve test coverage in Python/pystrtod.c and Python/mystrtoul.c. 2005-11-22 05:17:40 +00:00
Walter Dörwald 705fd474e9 Add a test for uu.encode() that passed filenames as
in_file and out_file.
2005-11-21 18:55:56 +00:00
Walter Dörwald c69d1c498f Add a rudimentary test for the platform module that at least calls each
documented function once.
2005-11-21 17:48:12 +00:00
Walter Dörwald c85c74cd08 Increase code coverage in Python/structmember.c from 33% to 40%
(by forcing a call to the listmember() function).
2005-11-18 16:51:05 +00:00
Walter Dörwald 690402ff17 Add tests to increase code coverage in Python/codecs.c and Python/exceptions.c. 2005-11-17 18:51:34 +00:00
Walter Dörwald e22d339dc5 Add tests for various error cases and for readbuffer_encode() and
charbuffer_encode(). This increases code coverage in Modules/_codecsmodule.c
from 83% to 95%.
2005-11-17 08:52:34 +00:00
Armin Rigo c6686b7c7e Added proper reflection on instances of <type 'method-wrapper'>, e.g.
'[].__add__', to match what the other internal descriptor types provide:
'__objclass__' attribute, '__self__' member, and reasonable repr and
comparison.

Added a test.
2005-11-07 08:38:00 +00:00
Armin Rigo f4afb21526 similar to SF bug 847019: a quick check in the time() constructor, which
accepts strings only for unpickling reasons.  This check prevents the honest
mistake of passing a string like '2:59.0' to time() and getting an insane
object.
2005-11-07 07:15:48 +00:00
Neal Norwitz 6d98ed4ad2 Oops, forgot to add the output file to 41388. 2005-11-03 05:07:15 +00:00
Neal Norwitz 0f46bbf781 Bug #1346533, select.poll() doesn't raise an error if timeout > sys.maxint
Need to check return result of PyInt_AsLong()

Will backport.
2005-11-03 05:00:25 +00:00
Brett Cannon 5d0bf9446b Change time.strptime() to raise ValueError whenever there is an error in the
format string.  Before exceptions generated by the internal code propagated up
to the user and were not helpful.

Closes bug #1340337.
2005-11-02 23:04:26 +00:00
Neal Norwitz cf4863831c Fix SF #1345263, colorsys tests, bug in frange
Fix a typo that caused step to be ignored.

Will backport.
2005-11-02 05:54:27 +00:00
Tim Peters 383d3c0a68 test_directories(): This test had no chance of passing on
Windows.  Hacked it to pass, but not sure it's worth the
bother.
2005-10-30 01:15:38 +00:00
Fred Drake db390c1ad8 fix typos, mostly in comments 2005-10-28 14:39:47 +00:00
Neal Norwitz f339654280 Patch #1338314, Bug #1336623: fix tarfile so it can extract
REGTYPE directories from tarfiles written by old programs.

Will backport.
2005-10-28 05:52:22 +00:00
Neal Norwitz 6ab080cd40 Fix problem handling EXTENDED_ARGs from SF bug # 1333982 2005-10-24 00:08:10 +00:00
Neal Norwitz f8950654e3 Fix compiler test when run with -u (long mode) 2005-10-24 00:01:37 +00:00
Neil Schemenauer d403c45386 Fix arigo's funky LOAD_NAME bug: implicit globals inside classes have
historically been looked up using LOAD_NAME, not LOAD_GLOBAL.
looked up by LOAD_NAME, not
2005-10-23 04:24:49 +00:00
Neal Norwitz ebc3457937 Revert previous checkin:
According to Jeremy, the comment only made sense when
the yield was disallowed.  Now it's testing that the yield
is allowed, so it's not bad and the outer finally is irrelevant.
2005-10-22 03:51:42 +00:00
Neil Schemenauer ab541bb98e Revert change, func_name of lambda's is back to <lambda>. 2005-10-21 18:11:40 +00:00
Michael W. Hudson b2308bb9be Fix bug:
[ 1327110 ] wrong TypeError traceback in generator expressions

by removing the code that can stomp on the users' TypeError raised by the
iterable argument to ''.join() -- PySequence_Fast (now?) gives a perfectly
reasonable message itself.  Also, a couple of tests.
2005-10-21 11:45:01 +00:00
Neal Norwitz 37c0844b35 Fix SF bug #1167751, Argument genexp corner case
Incorrect code was generated for:

  foo(a = i for i in range(10))

This should have generated a SyntaxError.  Fix the Grammar so
it raises a SyntaxError and test it.

I'm uncertain whether this should be backported.  It makes
something that was Syntactically valid invalid.  However,
the code would either be completely broken or do the wrong thing.
2005-10-21 06:24:02 +00:00
Neal Norwitz f21c8ed58a Add comment lost from AST merge 2005-10-21 04:34:18 +00:00
Jeremy Hylton 3e0055f8c6 Merge ast-branch to head
This change implements a new bytecode compiler, based on a
transformation of the parse tree to an abstract syntax defined in
Parser/Python.asdl.

The compiler implementation is not complete, but it is in stable
enough shape to run the entire test suite excepting two disabled
tests.
2005-10-20 19:59:25 +00:00
Jeremy Hylton bc2a62fcfd Disable some tests in anticipation of merging ast-branch to the head 2005-10-20 14:27:21 +00:00
Neal Norwitz b0e32e2b71 Fix SF bug # 1330039, patch # 1331635 from Lars Gustaebel (tarfile maintainer)
Problem: if two files are assigned the same inode
number by the filesystem, the second one will be added
as a hardlink to the first, which means that the
content will be lost.

The patched code checks if the file's st_nlink is
greater 1. So only for files that actually have several
links pointing to them hardlinks will be created, which
is what GNU tar does.

Will backport.
2005-10-20 04:50:13 +00:00
Raymond Hettinger 4b0f20def3 Teach unquote() to handle unicode inputs 2005-10-15 16:41:53 +00:00
Guido van Rossum c252c5964c Fix unit test failure -- the output received from Python can be empty,
but verify_valid_flag() wasn't expecting that.  Will backport.
2005-10-08 20:04:35 +00:00
Walter Dörwald d1c1e10f70 Part of SF patch #1313939: Speedup charmap decoding by extending
PyUnicode_DecodeCharmap() the accept a unicode string as the mapping
argument which is used as a mapping table.

This code isn't used by any of the codecs yet.
2005-10-06 20:29:57 +00:00
Raymond Hettinger cc9a951f35 SF #1313496: bisect C replacement doesn't accept named args 2005-10-05 11:39:12 +00:00
Neal Norwitz 11bd119226 SF bug #887946, segfault if redirecting directory
Also provide a warning if a directory is passed on the command line.
Add minimal command line test.

Will backport.
2005-10-03 00:54:56 +00:00
Neal Norwitz 40d3781416 - Fix segfault with invalid coding.
- SF Bug #772896, unknown encoding results in MemoryError, which is not helpful

I will only backport the segfault fix.  I'll let Anthony decide if he wants
the other changes backported.  I will do the backport if asked.
2005-10-02 01:48:49 +00:00
Neal Norwitz 484d9a409a Patch #1309009, Fix segfault in pyexpat when the XML document is
in latin_1, but Python incorrectly assumes it is in UTF-8 format

Will backport.
2005-09-30 04:46:49 +00:00
Armin Rigo dd5c023af5 some more fixes and tests for inspect.getsource(), triggered by crashes
from the PyPy project as well as the SF bug #1295909.
2005-09-25 11:45:45 +00:00
Raymond Hettinger 6b27cda643 Convert iterator __len__() methods to a private API. 2005-09-24 21:23:05 +00:00
Michael W. Hudson 10402a306f Patches #1298449 and #1298499: Add some missing checks for error
returns in cStringIO.c.  Thanks to Andrew Bennetts.

This must be a backport candidate.
2005-09-22 09:19:01 +00:00
Jack Jansen 19e11c86a7 MacOSX 10.4 apparently does not allow the creation time to be set to later
than the modification time. Changed the SetDates test to accomodate.

Backport candidate.
2005-09-21 20:52:11 +00:00
Armin Rigo f879024487 test and fix for buggy handling of exceptions raised by C functions,
causing the profiler to crash on an AssertionError if the same Python
function catches multiple exceptions from C functions.
2005-09-20 18:50:13 +00:00
Skip Montanaro f8948ca5d7 skip _locale test if OS X < 10.4 2005-09-19 03:54:46 +00:00
Georg Brandl 9e28107ce8 Test case for latest complexobject fix. 2005-09-17 07:51:15 +00:00
Raymond Hettinger 9bda1d6f64 No longer ignore exceptions raised by comparisons during key lookup.
Inspired by Armin Rigo's suggestion to do the same with dictionaries.
2005-09-16 07:14:21 +00:00
Brett Cannon a783d06f8c Clear out the regex cache when the TimeRE cache is invalidated by a locale
change.

Fixes bug #1290505.
2005-09-15 02:34:56 +00:00
Guido van Rossum 8ee3e5aa93 - Changes donated by Elemental Security to make it work on AIX 5.3
with IBM's 64-bit compiler (SF patch #1284289).  This also closes SF
  bug #105470: test_pwd fails on 64bit system (Opteron).
2005-09-14 18:09:42 +00:00
Gustavo Niemeyer 6fa0c5a452 Bug #1202493: Fixing SRE parser to handle '{}' as perl does, rather than
considering it exactly like a '*'.
2005-09-14 08:54:39 +00:00
Raymond Hettinger 2bdec7bfb0 Revert 1.170. Add tests. 2005-09-10 14:30:09 +00:00
Walter Dörwald a47d1c08d0 SF bug #1251300: On UCS-4 builds the "unicode-internal" codec will now complain
about illegal code points. The codec now supports PEP 293 style error handlers.
(This is a variant of the Nik Haldimann's patch that detects truncated data)
2005-08-30 10:23:14 +00:00
Martin v. Löwis 5dbdc59577 Patch #1168594: set sizes of non-regular files to zero. Fixes #1167128.
Will backport to 2.4.
2005-08-27 10:07:56 +00:00
Tim Peters 9e34c04732 Whitespace normalization (via reindent.py). 2005-08-26 15:20:46 +00:00
Tim Peters e8889c5741 testSeekBackwardsFromEnd(): Repair obvious syntax error. 2005-08-26 14:33:57 +00:00
Georg Brandl d603c04bcd Add list() around xreadlines() 2005-08-26 13:23:54 +00:00
Georg Brandl 62fe585b4b *** empty log message *** 2005-08-26 13:21:50 +00:00
Georg Brandl 5a650a253c patch [ 810023 ] Fix for off-by-one bug in urllib.URLopener.retrieve 2005-08-26 08:51:34 +00:00
Georg Brandl d2e3ba7a35 patch [ 756021 ] Allow socket.inet_aton("255.255.255.255") on Windows 2005-08-26 08:34:00 +00:00
Georg Brandl 905a01aba4 bug [ 1262320 ] minidom.py alternate newl support is broken 2005-08-25 22:14:15 +00:00
Martin v. Löwis 8b59514e57 Make IDNA return an empty string when the input is empty. Fixes #1163178.
Will backport to 2.4.
2005-08-25 11:03:38 +00:00
Georg Brandl 8246c439a8 Correct test suite for #848017. 2005-08-25 07:32:42 +00:00
Georg Brandl e1b13d2019 Bug #735248: Fix urllib2.parse_http_list. 2005-08-24 22:20:32 +00:00
Georg Brandl be3856dcd4 patch [ 1141428 ] more __contains__ tests 2005-08-24 09:08:57 +00:00
Georg Brandl 52715f69e7 [ 1113421 ] New tutorial tests in test_generators.py 2005-08-24 09:02:29 +00:00
Georg Brandl 38387b8b91 bug [ 728515 ] mmap's resize method resizes the file in win32 but not unix 2005-08-24 07:17:40 +00:00
Gregory P. Smith f21a5f7739 [ sf.net patch # 1121611 ]
A new hashlib module to replace the md5 and sha modules.  It adds
support for additional secure hashes such as SHA-256 and SHA-512.  The
hashlib module uses OpenSSL for fast platform optimized
implementations of algorithms when available.  The old md5 and sha
modules still exist as wrappers around hashlib to preserve backwards
compatibility.
2005-08-21 18:45:59 +00:00
Georg Brandl 33a5f2af59 Fix BZ2File.(x)readlines() for files without a newline. 2005-08-21 14:16:04 +00:00
Raymond Hettinger a710b331da SF bug #1242657: list(obj) can swallow KeyboardInterrupt
Fix over-aggressive PyErr_Clear().  The same code fragment appears in
various guises in list.extend(), map(), filter(), zip(), and internally
in PySequence_Tuple().
2005-08-21 11:03:59 +00:00
Raymond Hettinger c47e01d020 Numerous fix-ups to C API and docs. Added tests for C API. 2005-08-16 10:44:15 +00:00
Barry Warsaw e2eca0b709 Port from the Python 2.4 branch, patches for SF bug # 900092,
hotshot.stats.load.
2005-08-15 18:14:19 +00:00
Raymond Hettinger 038ca2a551 Teach the sets module to correctly compute s-=s and s^=s as the empty set. 2005-08-13 02:29:58 +00:00
Raymond Hettinger 97979ddc14 * Fix SF #1257731. Make __contains__(), remove(), and discard() only do
a frozenset conversion when the initial search attempt fails with a
  TypeError and the key is some type of set.  Add a testcase.

* Eliminate a duplicate if-stmt.
2005-08-12 23:58:22 +00:00
Neil Schemenauer cf52c07843 Change the %s format specifier for str objects so that it returns a
unicode instance if the argument is not an instance of basestring and
calling __str__ on the argument returns a unicode instance.
2005-08-12 17:34:58 +00:00
Raymond Hettinger c991db240c * Add short-circuit code for in-place operations with self (such as
s|=s, s&=s, s-=s, or s^=s).  Add related tests.

* Improve names for several variables and functions.

* Provide alternate table access functions (next, contains, add, and discard)
  that work with an entry argument instead of just a key.  This improves
  set-vs-set operations because we already have a hash value for each key
  and can avoid unnecessary calls to PyObject_Hash().  Provides a 5% to 20%
  speed-up for quick hashing elements like strings and integers.  Provides
  much more substantial improvements for slow hashing elements like tuples
  or objects defining a custom __hash__() function.

* Have difference operations resize() when 1/5 of the elements are dummies.
  Formerly, it was 1/6.  The new ratio triggers less frequently and only
  in cases that it can resize quicker and with greater benefit.  The right
  answer is probably either 1/4, 1/5, or 1/6.  Picked the middle value for
  an even trade-off between resize time and the space/time costs of dummy
  entries.
2005-08-11 07:58:45 +00:00
Tim Peters e9fe7e0ef3 Whitespace normalization (ran reindent.py over the whole tree). 2005-08-07 03:04:58 +00:00
Walter Dörwald 4e41a4b64c Disable a few other tests, that can't work if Python is compiled without
Unicode support.
2005-08-03 17:09:04 +00:00