Commit Graph

2560 Commits

Author SHA1 Message Date
Walter Dörwald 64976e74af Fix copy & paste error in comment. 2003-04-15 16:08:01 +00:00
Walter Dörwald 43bc1f18db Fix the test so that it works even when /etc/group has two entries
for the same gid.
2003-04-15 15:59:36 +00:00
Walter Dörwald 66e1e508b9 Fix the test so that it works even when /etc/passwd has two entries
for the same uid.
2003-04-15 15:39:08 +00:00
Tim Peters 299b3dffd2 test_range(): The C code changed to raise TypeError in one of these
cases, but the test still expected ValueError.  Repaired that.
2003-04-15 14:40:03 +00:00
Walter Dörwald b1ded1e508 Port test_pwd.py to PyUnit. Check that getpwall() and
getpwnam()/getpwuid() return consistent data.

Change test_grp to check that getgrall() and
getgrnam()/getgrgid() return consistent data.
Add error checks similar to test_pwd.py.

Port test___all__.py to PyUnit.

From SF patch #662807.
2003-04-15 11:10:33 +00:00
Guido van Rossum 8b7a9a38c6 The date class is now properly subclassable. (SF bug #720908)
(This is only the tip of the iceberg; the time and datetime classes
need the same treatment.)
2003-04-14 22:01:58 +00:00
Guido van Rossum 4dcdb78c6f Close off the "Verre Carlo hack" as discussed on python-dev. 2003-04-14 21:46:03 +00:00
Guido van Rossum 3a3cca5b82 - list.insert(i, x) now interprets negative i as it would be
interpreted by slicing, so negative values count from the end of the
  list.  This was the only place where such an interpretation was not
  placed on a list index.
2003-04-14 20:58:14 +00:00
Guido van Rossum 41c99e7f96 SF patch #720991 by Gary Herron:
A small fix for bug #545855 and Greg Chapman's
addition of op code SRE_OP_MIN_REPEAT_ONE for
eliminating recursion on simple uses of pattern '*?' on a
long string.
2003-04-14 17:59:34 +00:00
Neal Norwitz ae323198e5 Get test working if gzip support is not available 2003-04-14 01:18:32 +00:00
Guido van Rossum efbbb1c602 Patch by Chad Netzer (with significant change):
- range() now works even if the arguments are longs with magnitude
  larger than sys.maxint, as long as the total length of the sequence
  fits.  E.g., range(2**100, 2**101, 2**100) is the following list:
  [1267650600228229401496703205376L].  (SF patch #707427.)
2003-04-11 18:43:06 +00:00
Barry Warsaw a1ce93f87c From http://mail.python.org/pipermail/i18n-sig/2003-April/001557.html
- Expose NullTranslations and GNUTranslations to __all__

- Set the default charset to iso-8859-1.  It used to be None, which
would cause problems with .ugettext() if the file had no charset
parameter.  Arguably, the po/mo file would be broken, but I still think
iso-8859-1 is a reasonable default.

- Add a "coerce" default argument to GNUTranslations's constructor.  The
reason for this is that in Zope, we want all msgids and msgstrs to be
Unicode.  For the latter, we could use .ugettext() but there isn't
currently a mechanism for Unicode-ifying msgids.

The plan then is that the charset parameter specifies the encoding for
both the msgids and msgstrs, and both are decoded to Unicode when read.
For example, we might encode po files with utf-8. I think the GNU
gettext tools don't care.

Since this could potentially break code [*] that wants to use the
encoded interface .gettext(), the constructor flag is added, defaulting
to False.  Most code I suspect will want to set this to True and use
.ugettext().

- A few other minor changes from the Zope project, including asserting
that a zero-length msgid must have a Project-ID-Version header for it to
be counted as the metadata record.
2003-04-11 18:36:43 +00:00
Neal Norwitz 7f2588c073 SF patch #706707, time.tzset standards compliance update by Stuart Bishop
Update configure and test to use proper timezone specifications
2003-04-11 15:35:53 +00:00
Fred Drake 126f2b76b9 Avoid creating one of the TestSuite objects. 2003-04-11 15:14:05 +00:00
Neal Norwitz ffe33b7f24 Attempt to make all the various string *strip methods the same.
* Doc - add doc for when functions were added
 * UserString
 * string object methods
 * string module functions
'chars' is used for the last parameter everywhere.

These changes will be backported, since part of the changes
have already been made, but they were inconsistent.
2003-04-10 22:35:32 +00:00
Skip Montanaro 594adac0bf hoist contents of csv submodule up to the package level 2003-04-10 17:16:15 +00:00
Guido van Rossum 11d204ca27 Add test for MessageBeep() 2003-04-09 19:57:06 +00:00
Tim Peters 8805e66ec8 New tests identical to boom and boom2, except using new-style classes.
These never failed in 2.3, and the tests confirm it.  They still blow up
in the 2.2 branch, despite that all the gc-vs-__del__ fixes from 2.3
have been backported (and this is expected -- 2.2 needs more work than
2.3 needed).
2003-04-08 19:44:13 +00:00
Tim Peters 730f5535ba s/referrents/referents/g. Gotta love that referrers remains rife with rs. 2003-04-08 17:17:17 +00:00
Tim Peters 0f81ab6d88 Finished implementing gc.get_referrents(): dealt with error and end
cases, wrote docs, added a test.
2003-04-08 16:39:48 +00:00
Tim Peters f6b8045ca5 Reworked has_finalizer() to use the new _PyObject_Lookup() instead
of PyObject_HasAttr(); the former promises never to execute
arbitrary Python code.  Undid many of the changes recently made to
worm around the worst consequences of that PyObject_HasAttr() could
execute arbitrary Python code.

Compatibility is hard to discuss, because the dangerous cases are
so perverse, and much of this appears to rely on implementation
accidents.

To start with, using hasattr() to check for __del__ wasn't only
dangerous, in some cases it was wrong:  if an instance of an old-
style class didn't have "__del__" in its instance dict or in any
base class dict, but a getattr hook said __del__ existed, then
hasattr() said "yes, this object has a __del__".  But
instance_dealloc() ignores the possibility of getattr hooks when
looking for a __del__, so while object.__del__ succeeds, no
__del__ method is called when the object is deleted.  gc was
therefore incorrect in believing that the object had a finalizer.

The new method doesn't suffer that problem (like instance_dealloc(),
_PyObject_Lookup() doesn't believe __del__ exists in that case), but
does suffer a somewhat opposite-- and even more obscure --oddity:
if an instance of an old-style class doesn't have "__del__" in its
instance dict, and a base class does have "__del__" in its dict,
and the first base class with a "__del__" associates it with a
descriptor (an object with a __get__ method), *and* if that
descriptor raises an exception when __get__ is called, then
(a) the current method believes the instance does have a __del__,
but (b) hasattr() does not believe the instance has a __del__.

While these disagree, I believe the new method is "more correct":
because the descriptor *will* be called when the object is
destructed, it can execute arbitrary Python code at the time the
object is destructed, and that's really what gc means by "has a
finalizer":  not specifically a __del__ method, but more generally
the possibility of executing arbitrary Python code at object
destruction time.  Code in a descriptor's __get__() executed at
destruction time can be just as problematic as code in a
__del__() executed then.

So I believe the new method is better on all counts.

Bugfix candidate, but it's unclear to me how all this differs in
the 2.2 branch (e.g., new-style and old-style classes already
took different gc paths in 2.3 before this last round of patches,
but don't in the 2.2 branch).
2003-04-07 19:21:15 +00:00
Raymond Hettinger f394df47fd SF bug #699934: Obscure error message
mwh pointed out that the error message did not
make sense if obtained by rearranging the bases.
2003-04-06 19:13:41 +00:00
Raymond Hettinger ff41c48a77 SF patch #701494: more apply removals 2003-04-06 09:01:11 +00:00
Tim Peters bf384c256e Reworked move_finalizer_reachable() to create two distinct lists:
externally unreachable objects with finalizers, and externally unreachable
objects without finalizers reachable from such objects.  This allows us
to call has_finalizer() at most once per object, and so limit the pain of
nasty getattr hooks.  This fixes the failing "boom 2" example Jeremy
posted (a non-printing variant of which is now part of test_gc), via never
triggering the nasty part of its __getattr__ method.
2003-04-06 00:11:39 +00:00
Tim Peters 2f74fddfc1 test_boom: More comments. Also check that len(gc.garbage) doesn't
change (it would be another kind of bug if the trash cycle weren't
reclaimed).
2003-04-05 17:46:04 +00:00
Jeremy Hylton dee38ac7dd Add Tim's gc boom test to the test suite. 2003-04-04 20:00:04 +00:00
Martin v. Löwis 7fb697b5d2 Revert Patch #670715: iconv support. 2003-04-03 04:49:12 +00:00
Walter Dörwald 44f527fea4 Change formatchar(), so that u"%c" % 0xffffffff now raises
an OverflowError instead of a TypeError to be consistent
with "%c" % 256. See SF patch #710127.
2003-04-02 16:37:24 +00:00
Walter Dörwald 56fbcb525b Remove duplicate test. 2003-03-31 18:18:41 +00:00
Walter Dörwald 43440a621e Fix PyString_Format() so that '%c' % u'a' returns u'a'
instead of raising a TypeError. (From SF patch #710127)

Add tests to verify this is fixed.

Add various tests for '%c' % int.
2003-03-31 18:07:50 +00:00
Martin v. Löwis 3163a3b4b2 Patch #545300: Support marked sections. 2003-03-30 14:25:40 +00:00
Skip Montanaro 89feabc7f5 The socket module now always uses the _socketobject wrapper class, even on
platforms which have dup(2).  The makefile() method is built directly on top
of the socket without duplicating the file descriptor, allowing timeouts to
work properly.  Includes a new test case (urllibnet) which requires the
network resource.

Closes bug 707074.
2003-03-30 04:54:24 +00:00
Neal Norwitz 7035c98c5c Move Mac/Windows specific expected skips from each platform list
to the ExpectedSkips class.  Add test_scriptpackages to Mac only list.
Add test_unicode_file to Windows only list.
2003-03-29 22:01:17 +00:00
Jack Jansen c2a7f22216 Minimal test suite of the generated packages in plat-mac/lib-scriptpackages.
At the moment does little more than testing that the modules import
correctly and some classes can be instantiated.
2003-03-28 22:01:41 +00:00
Walter Dörwald 97951de77c Add two tests for simple error cases. 2003-03-26 14:31:25 +00:00
Thomas Wouters 590fe02ebd CommandTests.testgetoutput():
Make sure we aren't masking any errors raised in tempfile.mkdtemp() by
    referencing the (then) unbound local 'dir'.
2003-03-25 18:50:19 +00:00
Jack Jansen 3e0196cc00 Adding unicode filename support to FSRefs broke things on MacOS9. "Fixed" by disabling unicode filenames on OS9. 2003-03-21 12:54:24 +00:00
Neal Norwitz 7d8145268e Prevent the pty test from hanging by setting an alarm.
Currently, test_pty hangs on AIX & HPUX if run after test_openpty.
2003-03-21 01:39:14 +00:00
Guido van Rossum e3d1df0646 The message "*** skipping leakage tests ***" was causing the test to
fail in a non-debug build.  Only print this in verbose test mode.
2003-03-21 01:15:58 +00:00
Skip Montanaro b4a0417e91 new CSV file processing module - see PEP 305 2003-03-20 23:29:12 +00:00
Tim Peters d50ade68ec SF bug 705836: struct.pack of floats in non-native endian order
pack_float, pack_double, save_float:  All the routines for creating
IEEE-format packed representations of floats and doubles simply ignored
that rounding can (in rare cases) propagate out of a long string of
1 bits.  At worst, the end-off carry can (by mistake) interfere with
the exponent value, and then unpacking yields a result wrong by a factor
of 2.  In less severe cases, it can end up losing more low-order bits
than intended, or fail to catch overflow *caused* by rounding.

Bugfix candidate, but I already backported this to 2.2.

In 2.3, this code remains in severe need of refactoring.
2003-03-20 18:32:13 +00:00
Neal Norwitz 26f42f6821 Skip the ioctl test if we can't open /dev/tty. This happens on
Solaris (and probably other Unixes) when run without a terminal
(eg, from cron or at).
2003-03-20 04:33:16 +00:00
Neal Norwitz 6e54f579a6 Fix SF bug #697556, test_posix fails: getlogin
getlogin() can fail for too many reasons, so remove the test
2003-03-18 13:30:14 +00:00
Martin v. Löwis c2ca32d9ae Test for UnicodeError instead of ImportError to determine whether
the test file name can be encoded.
2003-03-17 18:30:15 +00:00
Thomas Wouters 9e1c192525 binascii_a2b_base64: Properly return an empty string if the input was all
invalid, rather than returning a string of random garbage of the
    estimated result length. Closes SF patch #703471 by Hye-Shik Chang.

Will backport to 2.2-maint (consider it done.)
2003-03-17 11:24:29 +00:00
Guido van Rossum d2b738ee7d If time.tzset doesn't exist, don't test it. 2003-03-15 12:01:52 +00:00
Guido van Rossum d11b62edd0 - New function time.tzset() provides access to the C library tzet()
function, if supported.  (SF patch #675422, by Stuart Bishop.)
2003-03-14 21:51:36 +00:00
Fred Drake 0834d77bc4 Accept commas in unquoted attribute values.
This closes SF patch #669683.
2003-03-14 16:21:57 +00:00
Michael W. Hudson 43ed43bfc1 Take out my (long since disabled) POSIX signal mask handling code.
I'm not going to have the time or energy to get this working x-platform
-- anyone who does is welcome to the code!
2003-03-13 13:56:53 +00:00
Jack Jansen b1fbf855a3 Filter out the depracation warning for macfs. 2003-03-12 13:47:39 +00:00
Raymond Hettinger 83245b5828 SF bug #699934: Obscure error message
Clarify error message for mro conflicts.
2003-03-12 04:25:42 +00:00
Jack Jansen dded84802a Allow unicode pathnames where FSRefs are expected. Fixes 696253. 2003-03-11 21:48:57 +00:00
Guido van Rossum 315aa361fc Add 'audio' resource.
ALERT! A month ago or so I made test_ossaudiodev.py require the
'audio' resource, but I didn't make the necessary changes to
regrtest.py.  This means that *nobody* has been testing the oss module
all that time!
2003-03-11 14:46:48 +00:00
Raymond Hettinger 1fdb633530 SF patch #691928: Use datetime in _strptime
Contributed by Brett Cannon.

To prevent code duplication, I patched _strptime to use datetime's date
object to do Julian day, Gregorian, and day of the week calculations.

Patch also includes new regression tests to test results and the
calculation gets triggered.

Very minor comment changes and the contact email are also changed.
2003-03-09 07:44:42 +00:00
Raymond Hettinger 2c2d322884 SF patch #667730: More DictMixin
* Adds missing pop() methods to weakref.py
* Expands test suite to broaden coverage of objects with
  a mapping interface.

Contributed by Sebastien Keim.
2003-03-09 07:05:43 +00:00
Martin v. Löwis c49435c991 Skip the test if TESTFN_ENCODING is None. Fixes #699386. 2003-03-08 10:25:31 +00:00
Tim Peters 61cd0db3d2 Don't quote the path to Python unless the path contains an embedded space.
Quoting the path doesn't work on Win2K (cmd.exe) regardless, this is just
a hack to let the test pass again on Win2K (so long as Python isn't
installed in a path that does contain an embedded space).  On Win2K it
looks like we'd also have to add a second pair of double quotes, around
the entire command line.
2003-03-07 21:10:21 +00:00
Tim Peters 669454e9dc Whitespace normalization. 2003-03-07 17:30:48 +00:00
Tim Peters eabafebfbc This test relied on significant trailing whitespace in a string literal.
Evil.
2003-03-07 15:55:36 +00:00
Jack Jansen c4d6bdd58a Test_ioctl and test_tarfile are skipped on MacOS9. 2003-03-07 15:38:11 +00:00
Jack Jansen 149a8993b0 The filename fix of the previous checkin was complete bogus, the problem is elsewhere. Retracting. 2003-03-07 13:27:53 +00:00
Jack Jansen c7fcc2d772 Two fixes to make this test pass on MacOS9:
- the test was sloppy about filenames: "0-REGTYPE-TEXT" was used where
  the archive held "/0-REGTYPE-TEXT".
- tarfile extracts all files in binary mode, but the test expected to be able to
  read and compare text files in text mode. Use universal text mode.
2003-03-07 12:50:45 +00:00
Raymond Hettinger a3e1e4cd79 SF patch #693753: fix for bug 639806: default for dict.pop
(contributed by Michael Stone.)
2003-03-06 23:54:28 +00:00
Martin v. Löwis 73d538b9c6 Always initialize Py_FileSystemDefaultEncoding on Unix in Py_Initialize,
and not as a side effect of setlocale. Expose it as sys.getfilesystemencoding.
Adjust test case.
2003-03-05 15:13:47 +00:00
Tim Peters fd8e6e5990 test_ioctl is an expected skip on Windows. 2003-03-04 00:26:38 +00:00
Michael W. Hudson f008998668 Fix bug
[ 555817 ] Flawed fcntl.ioctl implementation.

with my patch that allows for an array to be mutated when passed
as the buffer argument to ioctl() (details complicated by
backwards compatibility considerations -- read the docs!).
2003-03-03 12:29:42 +00:00
Guido van Rossum 206b9a779a MyComplex now works. 2003-03-02 13:53:18 +00:00
Tim Peters fc27375d5a test_load_from_canned_string(): Created a DATA2 string to test a canned
proto 2 pickle too.
2003-03-02 04:54:24 +00:00
Tim Peters 6cca754c20 TestOnlySetsInBinaryOps: Simplified the non-inplace tests by using
assertRaises.  Fixed a repeated subtle bug in the inplace tests by
removing the possibilty that a self.fail() call could raise a
TypeError that the test catches by mistake.
2003-03-02 00:36:10 +00:00
Tim Peters b7bfe4bea4 Typo repairs in new code. 2003-03-02 00:31:23 +00:00
Tim Peters 44f14b0399 SF bug 693121: Set == non-Set is a TypeError.
Allow mixed-type __eq__ and __ne__ for Set objects.  This is messier than
I'd like because Set *also* implements __cmp__.  I know of one glitch now:
cmp(s, t) returns 0 now when s and t are both Sets and s == t, despite
that Set.__cmp__ unconditionally raises TypeError (and by intent).  The
rub is that __eq__ gets tried first, and the x.__eq__(y) True result
convinces Python that cmp(x, y) is 0 without even calling Set.__cmp__.
2003-03-02 00:19:49 +00:00
Tim Peters 3ba491e6b1 The doctest was printing Sets, but that's unreliable because set
elements get displayed in undefined dict order.  Use a Set subclass
instead (which arranges to sort the elements for display).
2003-03-01 23:33:34 +00:00
Guido van Rossum d6473d1ac5 Reindent the new code properly. 2003-03-01 03:25:41 +00:00
Guido van Rossum 46d3dc37e4 - New function sys.exc_clear() clears the current exception. This is
rarely needed, but can sometimes be useful to release objects
  referenced by the traceback held in sys.exc_info()[2].  (SF patch
  #693195.)  Thanks to Kevin Jacobs!
2003-03-01 03:20:41 +00:00
Neal Norwitz 55b61d21d8 Fix SF bugs #692951 and 692988, test_timeout.py needs 'network' resource
require -u network to run test_timeout since
it fails when not connected to a network.
2003-02-28 19:57:03 +00:00
Jack Jansen 98fc683719 Getting rid of macfs. 2003-02-27 23:18:46 +00:00
Skip Montanaro add0ccc251 simple test case for dis module 2003-02-27 21:27:07 +00:00
Guido van Rossum 68468eba63 Get rid of many apply() calls. 2003-02-27 20:14:51 +00:00
Guido van Rossum f389c77273 Use floor division (// and __[r]floordiv__ in right-dispatch test. 2003-02-27 20:04:19 +00:00
Guido van Rossum f359410ce2 Use floor division (//). 2003-02-27 18:39:18 +00:00
Fred Drake 479d280218 The macfs, macostools, and plistlib should not be expected to run
beyond Mac OS and Darwin.  I'm not even sure they should be run on
Darwin, but I'll let someone more knowledgable on that tell us.
2003-02-26 19:51:23 +00:00
Walter Dörwald 37c4728c64 Port test_ucn and test_unicodedata to PyUnit. Add a few tests for error
cases increasing coverage in unicodedata.c from 87% to 95%
(when the normalization tests are run). From SF patch #662807.
2003-02-26 14:49:41 +00:00
Jack Jansen 838e76af2c Test suite for the plistlib module. 2003-02-25 12:58:58 +00:00
Jack Jansen 0c44c0477b sys.executable can contain spaces, cater for this when passing it to
os.popen(). Fixes #692222.
2003-02-24 15:26:39 +00:00
Guido van Rossum 577fb5a1db Fix from SF patch #633359 by Greg Chapman for SF bug #610299:
The problem is in sre_compile.py: the call to
    _compile_charset near the end of _compile_info forgets to
    pass in the flags, so that the info charset is not compiled
    with re.U. (The info charset is used when searching to find
    the first character at which a match could start; it is not
    generated for patterns beginning with a repeat like '\w{1}'.)
2003-02-24 01:18:35 +00:00
Neal Norwitz 15ff0e9342 Get test to work on alpha 2003-02-23 23:15:26 +00:00
Neal Norwitz d5a65a77cf Fix SF bug #689659, 64-bit int and long hash keys incompatible
On a 64-bit machine, a dictionary could contain duplicate int/long keys
if the value was > 2**32.
2003-02-23 23:11:41 +00:00
Jack Jansen c2dd2f0966 Expect to skip test_iconv_codecs on MacOSX. 2003-02-23 22:56:58 +00:00
Neal Norwitz 71b13e8b4c Fix SF bug #690081, test_posix fails when run in non-interactive mode
Don't bother testing os.getlogin() if we aren't running from a tty (terminal)
It fails when run without a tty (e.g., when run from cron).
2003-02-23 22:12:24 +00:00
Raymond Hettinger 61fe64d5de User requested changes to the itertools module.
Subsumed times() into repeat().
Added cycle() and chain().
2003-02-23 04:40:07 +00:00
Jack Jansen 5bb97e66dc Checking mac-specific stuff from the 2.3a2 branch in on the trunk. 2003-02-21 22:33:55 +00:00
Tim Peters 7107a7fbcc SF bug 690622: test_cpickle overflows stack on MacOS9.
test_nonrecursive_deep():  Reduced nesting depth to 60.

Not a bugfix candidate.  2.3 increased the number of stack frames
needed to pickle a list (in order to get implement the "list
batching" unpickling memory optimization new in 2.3).
2003-02-21 20:14:35 +00:00
Tim Peters 14821c5914 Doubled TimeoutTestCase.fuzz, to slash the frequency of bogus failures
on the boxes I use.
2003-02-21 16:45:41 +00:00
Walter Dörwald 0fd583ce4d Port all string tests to PyUnit and share as much tests
between str, unicode, UserString and the string module
as possible. This increases code coverage in stringobject.c
from 83% to 86% and should help keep the string classes
in sync in the future. From SF patch #662807
2003-02-21 12:53:50 +00:00
Raymond Hettinger 785d0a37e5 SF bug #690083: test_random fails sometimes
time.sleep(1) sometimes delays for fractionally less than a second
resulting in too short of an interval for C's time.time() function
to create a distinct seed.
2003-02-21 01:41:36 +00:00
Tim Peters 3b5de4db92 Reverted whitespace normalization on this file. I should really change
this thing so it doesn't rely on being unnormalized.  (That's the
editorial "I", if anyone's listening <wink>.)
2003-02-19 02:44:12 +00:00
Tim Peters 8266af4f06 Removed debugging print in test_tarfile.
In the Windows installer, continued the endless battle to copy over files
with new one-shot extensions.
2003-02-19 02:41:44 +00:00
Tim Peters f2715e0764 Whitespace normalization. 2003-02-19 02:35:07 +00:00
Guido van Rossum e690883ccf Use __reduce_ex__ in copy.py. The test_*copy_cant() tests are simpler again. 2003-02-19 01:19:28 +00:00
Guido van Rossum 2a30b21f64 Three test cases for __reduce_ex__. This fails for cPickle, until Tim
checks in his changes to support this in cPickle.c.
2003-02-18 22:41:24 +00:00
Guido van Rossum c53f009f94 Introducing __reduce_ex__, which is called with a protocol number argument
if it exists in preference over __reduce__.  Now Tim can go implement this
in cPickle.c.
2003-02-18 22:05:12 +00:00
Tim Peters e2052ab82a One doctest displaying a dict didn't sort it first. *Maybe* this fixes
the AIX problem with this test.
2003-02-18 16:54:41 +00:00
Neal Norwitz dcfdceb9a2 Fix SF bug #688424, 64-bit test problems 2003-02-18 15:45:44 +00:00
Neal Norwitz eb2a5ef36a Fix SF bug #688424, 64-bit test problems 2003-02-18 15:22:10 +00:00
Neal Norwitz 6fa635df7a SF patch #687683, Patches to logging (updates from Vinay)
Mostly rename WARN -> WARNING
Other misc tweaks
Update tests (not in original patch)
2003-02-18 14:20:07 +00:00
Neal Norwitz 2ff51a87b3 Make changes suggested by Walter to use self.assert*() methods. 2003-02-17 22:40:31 +00:00
Neal Norwitz 3b8fb47fb0 Import test_support properly 2003-02-17 22:38:56 +00:00
Tim Peters 003eb30882 test_posix is an expected skip on Win32. Also fixed test_posix to
import from test.test_support instead of directly from test_support.
2003-02-17 21:48:48 +00:00
Neal Norwitz e241ce830a Added test_posix (hopefully it works on Windows).
Remove PyArg_ParseTuple() for methods which take no args,
use METH_NOARGS instead
2003-02-17 18:17:05 +00:00
Neal Norwitz 5c1ba53f8c Use correct function name to PyArg_ParseTuple("is_package").
Fix off-by-1 error in normalize_line_endings():
  when *p == '\0' the NUL was copied into q and q was auto-incremented,
  the loop was broken out of,
  then a newline was appended followed by a NUL.
  So the function, in effect, was strcpy() but added two extra chars
  which was caught by obmalloc in debug mode, since there was only
  room for 1 additional newline.

Get test working under regrtest (added test_main).
2003-02-17 18:05:20 +00:00
Neal Norwitz 996acf122d Actually run these tests from regrtest.py.
There was no test_main() and the main body was protected
by if __name__ == '__main__' so the test didn't happen
on import either.
2003-02-17 14:51:41 +00:00
Tim Peters 080c88b912 cPickle.c, load_build(): Taught cPickle how to pick apart
the optional proto 2 slot state.

pickle.py, load_build():  CAUTION:  Noted that cPickle's
load_build and pickle's load_build really don't do the same
things with the state, and didn't before this patch either.
cPickle never tries to do .update(), and has no backoff if
instance.__dict__ can't be retrieved.  There are no tests
that can tell the difference, and part of what cPickle's
load_build() did looked accidental to me, so I don't know
what the true intent is here.

pickletester.py, test_pickle.py:  Got rid of the hack for
exempting cPickle from running some of the proto 2 tests.

dictobject.c, PyDict_Next():  documented intended use.
2003-02-15 03:01:11 +00:00
Tim Peters 71fcda5ba7 cPickle produces NEWOBJ appropriately now. It still doesn't know
how to unpickle the new slot-full state tuples.
2003-02-14 23:05:28 +00:00
Guido van Rossum 4507ec70cf - The audio driver tests (test_ossaudiodev.py and
test_linuxaudiodev.py) are no longer run by default.  This is
  because they don't always work, depending on your hardware and
  software.  To run these tests, you must use an invocation like
    ./python Lib/test/regrtest.py -u audio test_ossaudiodev
2003-02-14 19:29:22 +00:00
Walter Dörwald bb2734ab65 Port test_charmapcodec to PyUnit. From SF patch #662807 2003-02-14 11:21:53 +00:00
Guido van Rossum 4b499dd3fb - Finally fixed the bug in compile() and exec where a string ending
with an indented code block but no newline would raise SyntaxError.
  This would have been a four-line change in parsetok.c...  Except
  codeop.py depends on this behavior, so a compilation flag had to be
  invented that causes the tokenizer to revert to the old behavior;
  this required extra changes to 2 .h files, 2 .c files, and 2 .py
  files.  (Fixes SF bug #501622.)
2003-02-13 22:07:59 +00:00
Tim Peters 18e36f4576 Removed unused cut'n'paste import. 2003-02-13 19:37:19 +00:00
Tim Peters c0c9370985 We didn't have any tests making pickles with one of {pickle, cPickle},
and loading them via the other, except for the special cases of this
Guido added to test_datetime.py for datetime module objects.  The new
test_xpickle.py tries all of pickletester's AbstractPickleTests in
both x-module ways.
2003-02-13 19:30:57 +00:00
Tim Peters e9ef203ea6 Added a simple NEWOBJ test. This is in the pickle-only part of the
test for now (cPickle can't yet produce NEWOBJ).
2003-02-13 18:42:00 +00:00
Andrew M. Kuchling c1eea67d93 Remove filecmp 2003-02-13 18:36:22 +00:00
Walter Dörwald 7585229bbf Port test_userlist to PyUnit and add a few tests to increase code
coverage. From SF patch #662807
2003-02-13 18:07:43 +00:00
Guido van Rossum 298e421453 SF patch #685738 by Michael Stone.
This changes the default __new__ to refuse arguments iff tp_init is the
default __init__ implementation -- thus making it a TypeError when you
try to pass arguments to a constructor if the class doesn't override at
least __init__ or __new__.
2003-02-13 16:30:16 +00:00
Guido van Rossum 0c016a9590 Re-enable compiling ossaudiodev now that it seems to work again. 2003-02-13 16:12:21 +00:00
Tim Peters 8587b3c073 Added a HIGHEST_PROTOCOL module attribute to pickle and cPickle. 2003-02-13 15:44:41 +00:00
Neal Norwitz bb1844148a SF patch #682432, add lookbehind tests 2003-02-13 03:01:18 +00:00
Walter Dörwald 3ea7cc3cbe Fix typo. 2003-02-12 23:49:57 +00:00
Neal Norwitz 7cbd247af6 Add test to ensure files (fds) don't leak 2003-02-12 23:09:53 +00:00
Neal Norwitz 2294c0d4ec Cleanup from patch #683257:
Add missing INCREFs and re-indent returns to be consistent.
 Add \n\ for lines in docstring
 Add a pathetic test
 Add docs
2003-02-12 23:02:21 +00:00
Guido van Rossum 3288f592cb Expect test_ossaudiodev to skip on Linux, too. (It's broken.
Volunteers wanted to fix it!)
2003-02-12 20:40:08 +00:00
Guido van Rossum 9c00f42870 Systematic testing of hex/oct constants. 2003-02-12 17:09:17 +00:00
Guido van Rossum 66b1259dbc SF #660455 : patch by NNorwitz.
"Unsigned" (i.e., positive-looking, but really negative) hex/oct
constants with a leading minus sign are once again properly negated.
The micro-optimization for negated numeric constants did the wrong
thing for such hex/oct constants.  The patch avoids the optimization
for all hex/oct constants.

This needs to be backported to Python 2.2!
2003-02-12 16:57:47 +00:00
Guido van Rossum a89d10edc9 Implement another useful feature for proxies: in super(X, x), x may
now be a proxy for an X instance, as long as issubclass(x.__class__, X).
2003-02-12 03:58:38 +00:00
Guido van Rossum 03bc7d3c4d SF #532767: isinstance(x, X) should work when x is a proxy for an X
instance, as long as x.__class__ is X or a subclass thereof.
Did a little cleanup of PyObject_IsInstance() too.
2003-02-12 03:32:58 +00:00
Tim Peters 42f08ac1e3 Implemented batching for dicts in cPickle. This is after two failed
attempts to merge the C list-batch and dict-batch code -- they worked, but
it was a godawful mess to read.
2003-02-11 22:43:24 +00:00
Tim Peters 1092d64002 Implemented list batching in cPickle. 2003-02-11 21:06:20 +00:00
Guido van Rossum b6e5a0c658 Put proper tests in classmethod_get(). Remove the type argument to
descr_check(); it wasn't useful.  Change the type argument of the
various _get() methods to PyObject * because the call signature of
tp_descr_get doesn't guarantee its type.
2003-02-11 18:44:42 +00:00
Tim Peters 8d2613adbe Added tests to ensure that list and dict "chunking" are actually
getting done.  Since this isn't yet implemented in cPickle, the
new tests are in TempAbstractPickleTests (which cPickle doesn't
run).
2003-02-11 16:40:16 +00:00
Guido van Rossum 3f50cdc05e Get rid of the "bozo" __getstate__ that was inserted when __slots__
was used.  This simplifies some logic in copy_reg.py (used by
pickling).  It also broke a test, but this was rewritten to test the
new feature. :-)
2003-02-10 21:31:27 +00:00
Walter Dörwald 4f046e2e21 Add a few tests to test_count() to increase coverage in
Object/unicodeobject.c::unicode_count().
2003-02-10 17:51:03 +00:00
Walter Dörwald 74640247d4 Fix copy&paste error: call title instead of count 2003-02-10 17:44:16 +00:00
Walter Dörwald 8dd19321bb Change filtertuple() to use tp_as_sequence->sq_item
instead of PyTuple_GetItem, so an overwritten __getitem__
in a tuple subclass works. SF bug #665835.
2003-02-10 17:36:40 +00:00
Walter Dörwald 1918f7755e Change filterstring() and filterunicode(): If the
object is not a real str or unicode but an instance
of a subclass, construct the output via looping
over __getitem__. This guarantees that the result
is the same for function==None and function==lambda x:x

This doesn't happen for tuples, because filtertuple()
uses PyTuple_GetItem().

(This was discussed on SF bug #665835).
2003-02-10 13:19:13 +00:00
Just van Rossum 3aaf42c613 patch #683515: "Add unicode support to compile(), eval() and exec"
Incorporated nnorwitz's comment re. Py__USING_UNICODE.
2003-02-10 08:21:10 +00:00
Neal Norwitz de8b94c3e1 Fix SF bug #683467, 'int' ability to generate longs not inherited
When subclassing from an int but not overriding __new__,
long values were not converted properly.  Try to convert
longs into an int.
2003-02-10 02:12:43 +00:00
Neal Norwitz 9caf9c040e Add tests and news entry about parser errors from bug #678518. 2003-02-10 01:54:06 +00:00
Just van Rossum f032f86e9e patch 680474 that fixes bug 679880: compile/eval/exec refused utf-8 bom
mark. Added unit test.
2003-02-09 20:38:48 +00:00
Raymond Hettinger 60eca9331a C Code:
* Removed the ifilter flag wart by splitting it into two simpler functions.
* Fixed comment tabbing in C code.
* Factored module start-up code into a loop.

Documentation:
* Re-wrote introduction.
* Addede examples for quantifiers.
* Simplified python equivalent for islice().
* Documented split of ifilter().

Sets.py:
* Replace old ifilter() usage with new.
2003-02-09 06:40:58 +00:00
Tim Peters 68124bb771 The Python implementation of datetime was changed in ways that no longer
tickle the 2.2.2 __cmp__ bug test_datetime used to tickle, so the
workarounds for that bug no longer make sense in the test suite (which I'm
still trying to keep as closely in synch as possible with Zope3's
version).
2003-02-08 03:46:31 +00:00
Tim Peters 07534a607b Comparison for timedelta, time, date and datetime objects: __eq__ and
__ne__ no longer complain if they don't know how to compare to the other
thing.  If no meaningful way to compare is known, saying "not equal" is
sensible.  This allows things like

    if adatetime in some_sequence:
and
    somedict[adatetime] = whatever

to work as expected even if some_sequence contains non-datetime objects,
or somedict non-datetime keys, because they only call __eq__.

It still complains (raises TypeError) for mixed-type comparisons in
contexts that require a total ordering, such as list.sort(), use as a
key in a BTree-based data structure, and cmp().
2003-02-07 22:50:28 +00:00
Guido van Rossum 275666fd50 Merge the test part of the below checkin to the sandbox and Zope3, so
the tests will remain in sync:

"""
Tres discovered a weird bug when a datetime is pickled, caused by the
shadowing of __year, __month, __day and the use of proxies.

Here's a quick fix and a quick unit test.  I don't quite understand
why this wasn't caught by the pickling unit tests.
"""
2003-02-07 21:49:01 +00:00