Commit Graph

3835 Commits

Author SHA1 Message Date
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
Phillip J. Eby 0d6615fd29 PEP 342 implementation. Per Guido's comments, the generator throw()
method still needs to support string exceptions, and allow None for the
third argument.  Documentation updates are needed, too.
2005-08-02 00:46:46 +00:00
Raymond Hettinger d794666048 * Improve code for the empty frozenset singleton:
- Handle both frozenset() and frozenset([]).
  - Do not use singleton for frozenset subclasses.
  - Finalize the singleton.
  - Add test cases.
* Factor-out set_update_internal() from set_update().  Simplifies the
  code for several internal callers.
* Factor constant expressions out of loop in set_merge_internal().
* Minor comment touch-ups.
2005-08-01 21:39:29 +00:00
Fred Drake 50747fc1b9 add support for svn: and svn+ssh: URL schemes to urlparse 2005-07-29 15:56:32 +00:00
Walter Dörwald 6eea789fd2 Disable encoding/decoding test, if unicode is disabled. 2005-07-28 16:49:15 +00:00
Georg Brandl 7eb4b7d177 Fix all wrong instances of "it's". 2005-07-22 21:49:32 +00:00
Walter Dörwald c9878e1b22 Make attributes and local variables in the StreamReader str objects instead
of unicode objects, so that codecs that do a str->str decoding won't promote
the result to unicode. This fixes SF bug #1241507.
2005-07-20 22:15:39 +00:00
Tim Peters f5f32b4712 Whitespace normalization. 2005-07-17 23:16:17 +00:00
Hye-Shik Chang 4e422817eb Add support for FreeBSD 7. 2005-07-17 02:36:59 +00:00
Georg Brandl 5c5fe2f445 RFE [ 1216944 ] Add Error Code Dictionary to urllib2 2005-07-14 06:40:47 +00:00
Michael W. Hudson 0edc7a03e2 Fix:
[ 1229429 ] missing Py_DECREF in PyObject_CallMethod

Add a test in test_enumerate, which is a bit random, but suffices
(reversed_new calls PyObject_CallMethod under some circumstances).
2005-07-12 10:21:19 +00:00
Raymond Hettinger 82cb9a235d Add test for hash commutativity. 2005-07-05 05:34:43 +00:00
Georg Brandl 9a65d583ac Add doctest for examples in libweakref.tex to test_weakref. 2005-07-02 19:07:30 +00:00
Raymond Hettinger 3296e696db SF bug #1224347: int/long unification and hex()
Hex longs now print with lowercase letters like their int counterparts.
2005-06-29 23:29:56 +00:00
Georg Brandl 22bfdab682 Adapt output file to new Cookie JS output. 2005-06-27 05:51:07 +00:00
Georg Brandl ecf93c765c Fix test cases for doctest. 2005-06-26 23:09:51 +00:00
Raymond Hettinger da99d1cbfe SF bug #1224621: tokenize module does not detect inconsistent dedents 2005-06-21 07:43:58 +00:00
Michael W. Hudson 7390942aa1 test_asynchat is no longer expected to produce output.
also, wait for threads to finish before proceeding.
2005-06-20 13:45:34 +00:00
Raymond Hettinger bb999b5925 SF patch #1200018: Restore GC support to set objects
Reverts 1.26 and 1.27.
And adds cycle testing.
2005-06-18 21:00:26 +00:00
Skip Montanaro 9847000267 Add tests for posix O_SHLOCK & O_EXLOCK. Missed checking this in with
posixmodule.c 2.335.  Really should be considered part of patch #1103951.
2005-06-17 01:14:49 +00:00
Andrew M. Kuchling d1badac99c [Patch #1005892 from Alexandr Zamaraev] Fix two errors in the curses test suite 2005-06-15 18:44:23 +00:00
Michael W. Hudson 1a7285250b yet another cache to clear when leak hunting. 2005-06-14 09:31:28 +00:00
Walter Dörwald a00215983b Port test_long.py to unittest. 2005-06-13 21:44:48 +00:00
Michael W. Hudson f2ca5af439 Fix bug
[ 1180997 ] lax error-checking in new-in-2.4 marshal stuff

which I'd assigned to Martin, but actually turned out to be easy to fix.

Also, a test.
2005-06-13 18:28:46 +00:00
Raymond Hettinger 68c0453418 Add untokenize() function to allow full round-trip tokenization.
Should significantly enhance the utility of the module by supporting
the creation of tools that modify the token stream and writeback the
modified result.
2005-06-10 11:05:19 +00:00
Andrew M. Kuchling 5ac2534bbc Convert asynchat test to unittest; exercise the client using a numeric value as the terminator 2005-06-09 14:56:31 +00:00
Andrew M. Kuchling 01cb47b59c [Bug #1074261, patch #1074381] Restrict the size of chunks read from the file in order to avoid overflow or huge memory consumption. Patch by Mark Eichin 2005-06-09 14:19:32 +00:00
Andrew M. Kuchling a6f68e1b1f Convert gzip test suite to use unittest 2005-06-09 14:12:36 +00:00
Andrew M. Kuchling 6e57c2a653 [Patch #1171487, bug #1170331] Fix error in base64.b32decode when encoding a single null byte; test a null byte in all encodings to be sure it works 2005-06-08 22:51:38 +00:00
Anthony Baxter 95a2a4ea70 Tools/scripts/reindent.py _is_ your friend 2005-06-08 04:35:50 +00:00
Andrew M. Kuchling ecdad8575e [Bug #1172763] dumbdbm uses eval() on lines, so it chokes if there's an extra \r on the end of a line; fixed by stripping off trailing whitespace. 2005-06-07 19:36:10 +00:00
Skip Montanaro 61aa630d01 Fix missing assignments of marshal.load() values. Closes #1214662. 2005-06-04 12:55:32 +00:00
Tim Peters 5d36a55eaa Whitespace normalization. 2005-06-03 22:40:27 +00:00
Georg Brandl 6b95f1d963 Bug #1194181: bz2.BZ2File didn't handle mode 'U' correctly. 2005-06-03 19:47:00 +00:00
Anthony Baxter 451ae18751 [ 1197218 ] test_locale fix on modern linux
On more modern linuxes (and probably others) straight 'en_US' isn't a
valid locale. Make the code try a couple of alternates.

backport candidate
2005-06-03 15:04:15 +00:00
Michael W. Hudson df88846ebc This is my patch:
[ 1180995 ] binary formats for marshalling floats

Adds 2 new type codes for marshal (binary floats and binary complexes), a
new marshal version (2), updates MAGIC and fiddles the de-serializing of
code objects to be less likely to clobber the real reason for failing if
it fails.
2005-06-03 14:41:55 +00:00
Georg Brandl 268e61cf74 Bug #1213894: os.path.realpath didn't resolve symlinks that were the first
component of the path.
2005-06-03 14:28:50 +00:00
Michael W. Hudson e7fa1af85b M-x untabify 2005-06-03 13:55:58 +00:00
Andrew M. Kuchling 3554cad009 [Bug #1177831] Exercise (?(id)yes|no) for a group other than the first one 2005-06-02 13:38:45 +00:00
Neil Schemenauer f36947032f Fix compiler.ast.flatten function so that it works on lists. 2005-06-02 05:55:20 +00:00
Michael W. Hudson ba283e2b7f This is my patch:
[ 1181301 ] make float packing copy bytes when they can

which hasn't been reviewed, despite numerous threats to check it in
anyway if noone reviews it.  Please read the diff on the checkin list,
at least!

The basic idea is to examine the bytes of some 'probe values' to see if
the current platform is a IEEE 754-ish platform, and if so
_PyFloat_{Pack,Unpack}{4,8} just copy bytes around.

The rest is hair for testing, and tests.
2005-05-27 15:23:20 +00:00
Michael W. Hudson ff52286d4a Fix test_site to not call open('...', 'wU'), as that now raises an error.
Is anyone running the test suite regularly at the moment?
2005-05-27 14:58:06 +00:00
Skip Montanaro bbf12ba7b2 Disallow opening files with modes 'aU' or 'wU' as specified by PEP
278. Closes bug 967182.
2005-05-20 03:07:06 +00:00
Armin Rigo 57179feec8 This test relied on short-circuiting details of dictobject.py to avoid
crashing, and indirectly on the fact that hash codes in
random.randrange(1000000000) were very unlikely to exhibit collisions.
To see the problem, replace this number with 500 and observe the crash on
either del target[key] or del keys[i].

The fix prevents recursive mutation, just as in the key insertion case.
2005-05-15 13:29:26 +00:00
Skip Montanaro 174dd2219d Add better datetime support to xmlrpclib module. Closes patch #1120353. 2005-05-14 20:54:16 +00:00
Michael W. Hudson abb103b17a Don't use 'is not' to compare strings.
(spotted by reading pypy-svn :)
2005-05-04 11:59:38 +00:00
Brett Cannon 53e9a8b9f3 Fix error in a docstring where a single quote started the docstring but triple
quote ended it.

Closes bug #1192777.  Thanks Christopher Smith.
2005-04-30 05:50:19 +00:00
Brett Cannon c3647ac93e Make subclasses of int, long, complex, float, and unicode perform type
conversion using the proper magic slot (e.g., __int__()).  Also move conversion
code out of PyNumber_*() functions in the C API into the nb_* function.

Applied patch #1109424.  Thanks Walter Doewald.
2005-04-26 03:45:26 +00:00
Walter Dörwald 43148c8413 Update test to the current readline() behaviour. 2005-04-21 21:45:36 +00:00
Barry Warsaw b180c06a54 Fix tests dependent on the exception raised by non-settable descriptors. 2005-04-20 19:41:36 +00:00
Tim Peters e890682e52 Whitespace normalization. 2005-04-20 17:45:13 +00:00
Brett Cannon f4189916e3 Flush out support for ``class B(): pass`` syntax by adding support to the
'parser' module and 'compiler' package.

Closes patch #1176012.  Thanks logistix.
2005-04-09 02:30:16 +00:00
Brett Cannon 4ebc7e3bd0 Add test for ``class B1(): pass``. 2005-04-09 01:27:37 +00:00
Tim Peters f754f5fd68 test_default_encoding_issues(): Fully restore sys.setdefaultencoding.
test_site often failed under "regrtest.py -r", because this xmlrpc test
left sys with a setdefaultencoding attribute, but loading site.py removes
that attribute and test_site.py verifies the attribute is gone.  Changed
this test to get rid of sys.setdefaultencoding if it didn't exist when
this test started.

Don't know whether this is a bugfix (backport) candidate.
2005-04-08 18:00:59 +00:00
Walter Dörwald 7a6dc139de Fix for SF bug #1175396: readline() will now read one more character, if
the last character read is "\r" (and size is None, i.e. we're allowed to
call read() multiple times), so that we can return the correct line ending
(this additional character might be a "\n").

If the stream is temporarily exhausted, we might return the wrong line ending
(if the last character read is "\r" and the next one (after the byte stream
provides more data) is "\n", but at least the atcr member ensure that we
get the correct number of lines (i.e. this "\n" will not be treated as
another line ending.)
2005-04-04 21:38:47 +00:00
Hye-Shik Chang ac89f6ef29 Fix testcase for 64bit BSD systems: long is 8 bytes for those systems
so there's no need to pad after off_t members.  And a small typo fix.
2005-04-04 15:21:04 +00:00
Michael W. Hudson e2749cb264 Fix for rather inaccurately titled bug
[ 1165306 ] Property access with decorator makes interpreter crash

Don't allow the creation of unbound methods with NULL im_class, because
attempting to call such crashes.

Backport candidate.
2005-03-30 16:32:10 +00:00
Tim Peters eba28bea9b Whitespace normalization. 2005-03-28 01:08:02 +00:00
Raymond Hettinger fdf3bd6630 SF patch #1171417: bug fix for islice() in docs 2005-03-27 20:11:44 +00:00
Raymond Hettinger 267b868f23 * Fix decimal's handling of foreign types. Now returns NotImplemented
instead of raising a TypeError.  Allows other types to successfully
  implement __radd__() style methods.
* Remove future division import from test suite.
* Remove test suite's shadowing of __builtin__.dir().
2005-03-27 10:47:39 +00:00
Raymond Hettinger e6c470f255 SF bug #1770766: weakref proxy has incorrect __nonzero__ behavior. 2005-03-27 03:04:54 +00:00
Walter Dörwald 09a3f2cc2f Add tests for tuple, list and UserList that initialize the object from
various iterables.

(Copied from test_deque.py as suggested by Jim Jewett in SF bug #1166274)
2005-03-22 22:43:28 +00:00
Walter Dörwald c448a91ee8 Fix typo. 2005-03-22 11:22:38 +00:00
Walter Dörwald 7355e8133d Add list tests that ensure that remove() removes the first occurrence.
(Copied from test_deque.py as suggested by Jim Jewett in SF bug #1166274)
2005-03-21 21:31:47 +00:00
Raymond Hettinger d73202c596 Apply remove's mutation test after every equality test. 2005-03-19 00:00:51 +00:00
Raymond Hettinger 4aec61e0fc Add a remove() method to collections.deque objects. 2005-03-18 21:20:23 +00:00
Raymond Hettinger bea3f6f5c7 Bug #1163325: "special" decimals aren't hashable 2005-03-15 04:59:17 +00:00
Walter Dörwald 729c31f5c3 Reset internal buffers when seek() is called. This fixes SF bug #1156259. 2005-03-14 19:06:30 +00:00
Johannes Gijsbers a5855d5ace Patch #1159931/bug #1143895: inspect.getsource failed when functions,
etc., had comments after the colon, and some other cases. This patch
take a simpler approach that doesn't rely on looking for a ':'. Thanks
Simon Percivall!
2005-03-12 16:37:11 +00:00
Raymond Hettinger f77d0334f3 Revised the itertools quantifier recipes to match the performance of the
new builtins.
2005-03-11 22:17:30 +00:00
Raymond Hettinger 96229b1918 Add two new functions, any() and all(). 2005-03-11 06:49:40 +00:00
Raymond Hettinger 26e512a04f Test partial() with bound/unbound methods. 2005-03-11 06:48:49 +00:00
Brett Cannon 01668a1ab9 Fix test for socket.getfqdn() to also include the name returned by
socket.gethostname() in the check for a valid return.

Also clarified docs (official and docstring) that the value from gethostname()
is returned if gethostbyaddr() doesn't do the job.
2005-03-11 00:04:17 +00:00
Raymond Hettinger 984f9bb714 operator.itemgetter() and operator.attrgetter() now support extraction
of multiple fields.  This provides direct support for sorting by
multiple keys.
2005-03-09 16:38:48 +00:00
Martin v. Löwis e2713becd8 Build with --disable-unicode again. Fixes #1158607.
Will backport to 2.4.
2005-03-08 15:03:08 +00:00
Martin v. Löwis b60ae99601 Convert file names of posix.access according to the file system encoding. 2005-03-08 09:10:29 +00:00
Raymond Hettinger c8b6d1bd8c Make functional.partial() more closely match the spec by emulating
some useful features of regular functions:

* Made weak referencable.
* Allow attribute access so a user can set __name__, __doc__, etc.
2005-03-08 06:14:50 +00:00
Greg Ward 50682d0f78 SF #818006: merge from release24-maint branch: add useful read-only
attributes to oss_audio_device object: 'closed', 'name', and 'mode'.
2005-03-07 01:41:11 +00:00
Martin v. Löwis 78be7df9e4 Patch #918101: Add tarfile open mode r|* for auto-detection of the
stream compression; add, for symmetry reasons, r:* as a synonym of r.
2005-03-05 12:47:42 +00:00
Brett Cannon 653a5adcca Tweak test_communicate_stderr so that it works when run under a pydebug build. 2005-03-05 06:40:52 +00:00
Greg Ward 40407943b7 SF #1149508: ensure textwrap handles hyphenated numbers correctly,
eg. "2004-03-04" is not broken across lines.  (Merged from 2.4 branch.)
2005-03-05 02:53:17 +00:00
Peter Astrand f7f1bb7ff5 Only run extensive subprocess tests if -usubprocess to regrtest is specified. Fixes #1124637 2005-03-03 20:47:37 +00:00
Peter Astrand cbac93c229 Added three more testcases: Using communicate with only one of
stdin/stdout/stderr redirected.
2005-03-03 20:24:28 +00:00
Raymond Hettinger b67cc80bb9 SF bug #1155938: Missing None check for __init__(). 2005-03-03 16:45:19 +00:00
Martin v. Löwis 6ce7ed23d0 Revert previous checkin on getargs 'L' code. Try to convert all
numbers in PyLong_AsLongLong, and update test suite accordingly.
Backported to 2.4.
2005-03-03 12:26:35 +00:00
Martin v. Löwis 7fe60c0a0a Patches #749830, #1144555: allow UNIX mmap size to default to current
file size.
2005-03-03 11:22:44 +00:00
Martin v. Löwis c5574e809b Patch #1117454: Remove code to special-case cookies without values
in LWPCookieJar. Backported to 2.4.
2005-03-03 10:57:37 +00:00
Martin v. Löwis 4ea3eade51 Patch #1117339: Add cookielib special name tests.
Backported to 2.4.
2005-03-03 10:48:12 +00:00
Martin v. Löwis ff232d7230 Clear internal call error in 'L' format. Fixes #723201.
Backported to 2.4.
2005-03-03 09:24:38 +00:00
Martin v. Löwis df24153f65 Patch #1107973: tarfile.ExFileObject iterators. 2005-03-03 08:17:42 +00:00
Brett Cannon e94e74a8e1 Make test__locale more fine-grained. Now test localeconv and nl_langinfo
individually as tests.

Also improved output when the test fails.
2005-03-01 03:15:50 +00:00
Raymond Hettinger 9c323f8de4 SF patch #941881: PEP 309 Implementation (Partial Function Application).
Combined efforts of many including Peter Harris, Hye-Shik Chang,
Martin v. Löwis, Nick Coghlan, Paul Moore, and Raymond Hettinger.
2005-02-28 19:39:44 +00:00
Martin v. Löwis c2a0ac20b7 Patch #1049151: adding bool support to xdrlib.py.
Also add xdrlib._test into the test suite.
2005-02-24 20:22:10 +00:00
Raymond Hettinger afd842f5b2 Teach the peepholer to fold unary operations on constants.
Afterwards, -0.5 loads in a single step and no longer requires a runtime
UNARY_NEGATIVE operation.
2005-02-20 12:46:54 +00:00
Raymond Hettinger 57e7447c44 * Beef-up tests for str.count().
* Speed-up str.count() by using memchr() to fly between first char matches.
2005-02-20 09:54:53 +00:00
Raymond Hettinger 7cbf1bcb3e * Beef-up testing of str.__contains__() and str.find().
* Speed-up "x in y" where x has more than one character.

The existing code made excessive calls to the expensive memcmp() function.
The new code uses memchr() to rapidly find a start point for memcmp().
In addition to knowing that the first character is a match, the new code
also checks that the last character is a match.  This significantly reduces
the incidence of false starts (saving memcmp() calls and making quadratic
behavior less likely).

Improves the timings on:
    python -m timeit -r7 -s"x='a'*1000" "'ab' in x"
    python -m timeit -r7 -s"x='a'*1000" "'bc' in x"

Once this code has proven itself, then string_find_internal() should refer
to it rather than running its own version.  Also, something similar may
apply to unicode objects.
2005-02-20 04:07:08 +00:00
Walter Dörwald af3b39a182 Add support for negative indices in UserString.MutableString.__setitem__
and UserString.MutableString.__delitem__.
2005-02-18 13:22:43 +00:00
Walter Dörwald 1fd4db9c6c Fix copy & paste error. 2005-02-17 22:31:28 +00:00
Walter Dörwald 7f79152929 Add tests for the methods added by UserString.MutableString. 2005-02-17 22:03:31 +00:00
Martin v. Löwis 5510f65f5a Avoid using items() in environ.update(). Fixes #1124513.
Will backport to 2.4.
2005-02-17 21:23:20 +00:00
Walter Dörwald 3040b19976 Add a basic test for UserString.MutableString. 2005-02-17 18:51:48 +00:00
Michael W. Hudson ee319f66ab Fix
[ 1124295 ] Function's __name__ no longer accessible in restricted mode

which I introduced with a bit of mindless copy-paste when making
__name__ writable.  You can't assign to __name__ in restricted mode,
which I'm going to pretend was intentional :)
2005-02-17 10:37:21 +00:00
Tim Peters f0db38dbf8 Whitespace normalization. 2005-02-15 21:50:12 +00:00
Michael W. Hudson f058858347 Test that SystemExits are handled properly by the exit machinery. I
broke the "raise SystemExit(46)" case when doing new-style exceptions,
but I'd much rather have found out here than in test_tempfile (growl).
2005-02-15 15:26:11 +00:00
Michael W. Hudson a1fb4c891f Exceedingly minor tweak. 2005-02-15 15:22:37 +00:00
Fred Drake 22c0706a58 fix decoding in _stringify to not depend on the default encoding
(closes SF bug #1115989)
2005-02-11 17:59:08 +00:00
Brett Cannon 64d904b715 Remove set conversion optimization test (backed out of Python/compile.c in rev.
2.344).
2005-02-10 20:40:29 +00:00
Fred Drake ba613c3410 accept datetime.datetime instances when marshalling;
dateTime.iso8601 elements still unmarshal into xmlrpclib.DateTime objects
2005-02-10 18:33:30 +00:00
Andrew M. Kuchling bfd7d6a0ea Fix typo 2005-02-10 13:24:50 +00:00
Walter Dörwald a9620d1e2b Fix stupid typo: Don't read from a writer. 2005-02-08 10:10:01 +00:00
Raymond Hettinger 7fcb7869ba Adopt Skip's idea to optimize lists of constants in the context
of a "in" or "not in" test.
2005-02-07 19:32:38 +00:00
Raymond Hettinger a164574937 Transform "x in (1,2,3)" to "x in frozenset([1,2,3])".
Inspired by Skip's idea to recognize the throw-away nature of sequences
in this context and to transform their type to one with better performance.
2005-02-06 22:05:42 +00:00
Walter Dörwald 1f1d252f51 Add a test for UTF-16 reading where the byte sequence doesn't start with
a BOM.
2005-02-04 14:15:34 +00:00
Martin v. Löwis 1d11de6dbd Revert os.py 1.75, and directly implement update.
Fixes #1110478 and #1100235.
2005-01-29 13:29:23 +00:00
Raymond Hettinger 9feb267caf Do not fold a constant if a large sequence will result.
Saves space in the presence of code like: (None,)*10000
2005-01-26 12:50:05 +00:00
Martin v. Löwis 4d394dfebb Truncate st_?time before comparing it with ST_?TIME in the tests. 2005-01-23 09:19:22 +00:00
Walter Dörwald 1083c248df Add a slice test with high < low. 2005-01-21 21:16:51 +00:00
Guido van Rossum 5a8a03784e Use descriptors. 2005-01-16 00:25:31 +00:00
Guido van Rossum fee7b93c60 Use decorators. 2005-01-16 00:21:28 +00:00
Tim Peters 608c2fff69 Whitespace normalization. 2005-01-13 17:37:38 +00:00
Skip Montanaro 0af3ade6aa Add strptime() constructor to datetime class. Thanks to Josh Spoerri for
the changes.
2005-01-13 04:12:31 +00:00
Andrew McNamara 7f2053eff3 Add counting of source iterator lines to the reader object - handy for
user error messages (otherwise difficult to do without instrumenting
the source).
2005-01-12 11:17:16 +00:00
Andrew McNamara 0f0599ddc1 When quoting=QUOTE_NONNUMERIC, the reader now casts unquoted fields
to floats.
2005-01-12 09:45:18 +00:00
Andrew McNamara 5d45a8dc22 Fix logic problem in quoting=csv.QUOTE_ALL, quotechar=None check, add test. 2005-01-12 08:16:17 +00:00
Andrew McNamara c89f284df8 When using QUOTE_NONNUMERIC, we now test for "numericness" with
PyNumber_Check, rather than trying to convert to a float.  Reimplemented
writer - now raises exceptions when it sees a quotechar but neither
doublequote or escapechar are set. Doublequote results are now more
consistent (eg, single quote should generate """", rather than "",
which is ambiguous).
2005-01-12 07:44:42 +00:00
Andrew McNamara 31d8896ee2 Rename csv.set_field_limit to csv.field_size_limit (since it both sets and
gets).
2005-01-12 03:45:10 +00:00
Andrew McNamara af1e312b3b Improve test coverage fractionally. 2005-01-12 01:55:21 +00:00
Andrew McNamara e4d05c4f93 Set an upper limit on the size of the field buffer, raise an exception
when this limit is reached. Limit defaults to 128k, and is changed
by module set_field_limit() method. Previously, an unmatched quote
character could result in the entire file being read into the field
buffer, potentially exhausting virtual memory.
2005-01-11 07:32:02 +00:00
Raymond Hettinger a422c34b70 SF 1098985: set objects cannot be marshalled 2005-01-11 03:03:27 +00:00
Andrew McNamara 7130ff5eb9 Replace python-coded validation of csv dialect with a call to the C
dialect type (which has a better idea of what is and isn't valid).
2005-01-11 02:22:47 +00:00
Andrew McNamara 8c94b42f31 No longer attempt to instantiate python classes describing dialects. This
was done because we were previously performing validation of the dialect
from python, but this is now down within the C module. Also, the method
we were using to detect classes did not work with new-style classes.
2005-01-11 02:18:36 +00:00
Andrew McNamara 86625972a1 Allow dialect-describing keywords to be supplied to register_dialect,
record objects of internal dialect type, rather than instances of
python objects.
2005-01-11 01:28:33 +00:00
Walter Dörwald 9fa0946771 Fix and test for SF bug #1098990: codec readline() splits lines apart. 2005-01-10 12:01:39 +00:00
Andrew McNamara 36a7691c2d Fix parsing of csv files with escapes (escape character previously would be
left in stream).
2005-01-10 01:04:40 +00:00
Johannes Gijsbers 41e4faa82b Patch #712317: In URLs such as http://www.example.com?query=spam, treat '?' as
a delimiter. Previously, the 'network location' (<authority> in RFC 2396) would
become 'www.example.com?query=spam', while RFC 2396 does not allow a '?' in
<authority>. See bug #548176 for further discussion.
2005-01-09 15:29:10 +00:00
Johannes Gijsbers a3beee185c Clean up tests by reusing functions from other modules:
* replace deltree with shutil.rmtree()
* replace mkdirs with os.makedirs()
* fold touchfile into GlobTests.mktemp()
2005-01-08 13:28:54 +00:00
Johannes Gijsbers 836f5433f7 Patch #943206:
`glob.glob()` currently calls itself recursively to build a list of matches of
the dirname part of the pattern and then filters by the basename part. This is
effectively BFS. ``glob.glob('*/*/*/*/*/foo')`` will build a huge list of all
directories 5 levels deep even if only a handful of them contain a ``foo``
entry. A generator-based recusion would never have to store these list at once
by implementing DFS. This patch converts the `glob` function to an `iglob`
recursive generator . `glob()` now just returns ``list(iglob(pattern))``.

I also cleaned up the code a bit (reduced duplicate `has_magic()` checks and
created a second `glob0` helper func so that the main loop need not be
duplicated).

Thanks to Cherniavsky Beni for the patch!
2005-01-08 13:13:19 +00:00
Tim Peters 711906e0c2 threading._DummyThread.__init__(): document obscure new code.
test_threading.test_foreign_thread():  new test does a basic check that
"foreign" threads can using the threading module, and that they create
a _DummyThread instance in at least one use case.  This isn't a very
good test, since a thread created by thread.start_new_thread() isn't
particularly "foreign".
2005-01-08 07:30:42 +00:00
Tim Peters 84d548994e Converted to a unittest. Added checks that the bounded semaphore actually
does what it's supposed to do.
2005-01-08 06:03:17 +00:00
Raymond Hettinger 922b3e2098 Remove test for BINARY_DIVIDE. 2005-01-07 18:34:56 +00:00
Tim Peters 5a9fb3c415 Whitespace normalization. 2005-01-07 16:01:32 +00:00
Andrew McNamara 1196cf185c Improved the implementation of the internal "dialect" type. The new
implementation features better error reporting, and better compliance
with the PEP.
2005-01-07 04:42:45 +00:00
Raymond Hettinger c34f8673a1 Teach the peephole optimizer to fold simple constant expressions. 2005-01-02 06:17:33 +00:00
Peter Astrand 454f76711c New subprocess utility function: check_call. Closes #1071764. 2005-01-01 09:36:35 +00:00
Walter Dörwald ee1d24703f Add a test that checks the basic functionality of every encoding. 2004-12-29 16:04:38 +00:00
Andrew M. Kuchling 3b585b30c0 [Bug #1083110] calling .flush() on decompress objects causes a segfault due to an uninitialized pointer: fixes the problem and adds a test case 2004-12-28 20:10:48 +00:00
Armin Rigo a174813113 Dima Dorfman's patch for coercion/comparison of C types (patch #995939), with
a minor change after the coercion, to accept two objects not necessarily of
the same type but with the same tp_compare.
2004-12-23 22:13:13 +00:00
Fred Drake 7c404a4bf7 add __file__ to the globals available for tests loaded via DocFileSuite;
this is useful for locating supporting data files, just as it is in Python
modules
2004-12-21 23:46:34 +00:00
Walter Dörwald e57d7b179a The changes to the stateful codecs in 2.4 resulted in StreamReader.readline()
trying to return a complete line even if a size parameter was given (see
http://www.python.org/sf/1076985). This leads to buffer overflows with long
source lines under Windows if e.g. cp1252 is used as the source encoding.
This patch reverts the behaviour of readline() to something that behaves more
like Python 2.3: If a size parameter is given, read() is called only once.

As a side effect of this, readline() now supports all types of linebreaks
supported by unicode.splitlines().

Note that the tokenizer is still broken and it's possible to provoke segfaults
(see http://www.python.org/sf/1089395).
2004-12-21 22:24:00 +00:00
Armin Rigo 2ccea17856 Any call to marshal.dumps() with the new optional argument 'version' just
immediately segfaults, due to a typo!  This was obviously never tested...
Added a test for it, and also fixed the documentation.
2004-12-20 12:25:57 +00:00
Brett Cannon 94eaee6d49 Skip test_imp if threading is not available.
Closes bug #1083645.  Thanks Detlef Vollmann.
2004-12-18 21:06:55 +00:00
Raymond Hettinger 7e71fa5cfa Bug #1083645
* The decimal module wouldn't load on builds without threads.
2004-12-18 19:07:19 +00:00
Raymond Hettinger b0900e6a21 SF #1085304: Make array.array pickle-able 2004-12-16 16:23:40 +00:00
Walter Dörwald 29ddfba3d8 Fix copy & paste error in comments. 2004-12-14 21:28:07 +00:00
Johannes Gijsbers 1542f34c42 Patch #1011890: fix inspect.getsource breaking with line-continuation &
more. Thanks to Simon Percivall!

The patch makes changes to inspect.py in two places:

* the pattern to match against functions at line 436 is
modified: lambdas should be matched even if not
preceded by whitespace, as long as "lambda" isn't part
of another word.

* the BlockFinder class is heavily modified. Changes are:
- checking for "def", "class" or "lambda" names
before setting self.started to True. Then checking the
same line for word characters after the colon (if the
colon is on that line). If so, and the line does not
end with a line continuation marker, raise EndOfBlock
immediately.
- adding self.passline to show that the line is to be
included and no more checking is necessary on that
line. Since a NEWLINE token is not generated when a
line continuation marker exists, this allows getsource
to continue with these functions even if the following
line would not be indented.

Also add a bunch of
'quite-unlikely-to-occur-in-real-life-but-working-anyway' tests.
2004-12-12 16:46:28 +00:00
Johannes Gijsbers cb9015dc08 Patch #736962: port test_inspect to unittest. As part of this, move out
the fodder modules to separate files to get rid of the imp.load_source()
trickery.
2004-12-12 16:20:22 +00:00
Johannes Gijsbers 6b220b0355 Use os.geteuid() for checking whether we are root, as suggested by
Michael Hudson.
2004-12-12 15:52:57 +00:00
Tim Peters 7f06187d31 Whitespace normalization. 2004-12-07 21:17:46 +00:00
Johannes Gijsbers b8b09d0513 SF bug #1076467: don't run test_on_error as root, as the permission
errors don't get provoked that way. Also add a bunch of cross-references
to bugs.
2004-12-06 20:50:15 +00:00
Brett Cannon c8aa848ece Have test_mkalias_relative check that sys.prefix already exists; otherwise test
is pointless.

Also add a note to the docs for the 'test' package that test cases should check
first that any conditions needed in the operating system are met before having
a test run.

Closes bug #1077302.  THanks, Ian Holsman.
2004-12-06 06:08:59 +00:00
Raymond Hettinger c7979f16ec Removed deprecated tzparse module. 2004-12-05 11:38:18 +00:00