Commit Graph

1534 Commits

Author SHA1 Message Date
Guido van Rossum 04a866170d Add test for pickling new-style class with custom metaclass. 2001-12-19 16:58:54 +00:00
Fred Drake 5935ff07be Add some additional tests that check more proxy behaviors. 2001-12-19 16:54:23 +00:00
Fred Drake 694ed091af Fix the test control support for the pickle & cPickle tests so the tests run
under regrtest.
2001-12-19 16:42:15 +00:00
Guido van Rossum 1444f67fa0 The test using class initarg failed, because it was lacking a
__safe_for_unpickling__ attribute.
2001-12-19 16:38:29 +00:00
Guido van Rossum 796e1e0b30 Don't call resetwarnings(). Be more restrictive in what we filter out
instead.
2001-12-15 18:04:10 +00:00
Jack Jansen f839c27027 Added test_socketserver and test_unicode_file to tests expected to be
skipped on Mac OS X. Not sure yet about test_locale.py: this may be
due to my copy of Mac OS X (although it talks english fine enough).
2001-12-14 21:28:53 +00:00
Guido van Rossum e54616cb6f (Merge into trunk.)
Fix for SF bug #492345.  (I could've sworn I checked this in, but
apparently I didn't!)

This code:

    class Classic:
        pass

    class New(Classic):
        __metaclass__ = type

attempts to create a new-style class with only classic bases -- but it
doesn't work right.  Attempts to fix it so it works caused problems
elsewhere, so I'm now raising a TypeError in this case.
2001-12-14 04:19:56 +00:00
Jeremy Hylton f36cfef1ae Undo inadvertent change to test_scope in previous checkin 2001-12-13 20:00:26 +00:00
Fred Drake 68773e779a Add a comment explaining what these tests are for, and where to look for
tests of complex().
2001-12-13 19:57:53 +00:00
Fred Drake 526c7a0101 Ensure that complex() only accepts a string argument as the first arg,
and only if there is no second arg.
This closes SF patch #479551.
2001-12-13 19:52:22 +00:00
Jeremy Hylton 3095a4c228 Update output generated by test_scope 2001-12-13 19:47:51 +00:00
Jeremy Hylton ccae8377a3 Add test for SF bug [ #492403 ] exec() segfaults on closure's func_code 2001-12-13 19:45:04 +00:00
Fred Drake d077ca1e7c Very small test suite for the calendar module, mostly to check a constraint
on the return values from isleap().  Also checks firstweekday() and
setfirstweekday().
2001-12-12 05:38:08 +00:00
Tim Peters 017052152b Fiddle test_class so it passes with -Qnew. 2001-12-11 19:28:47 +00:00
Tim Peters e93e477215 Fiddle test_augassign so it passes under -Qnew. 2001-12-11 19:20:15 +00:00
Martin v. Löwis df8adcd7ba Ignore SIGXFSZ. Fixes #490453. 2001-12-11 17:57:26 +00:00
Guido van Rossum 29d260670e Additional coverage tests by Neil Norwitz.
(SF patch #491418, #491420, #491421.)
2001-12-11 04:37:34 +00:00
Fred Drake 2a64f4693d Regression test for SF bug #478534 -- exceptions could "leak" into a weakref
callback.
2001-12-10 23:46:02 +00:00
Finn Bock 2b29cb2593 Skipping some tests by adding the usual jython conditional test around:
- the repr of unicode. Jython only add the u'' if the string contains char
  values > 255.
- A unicode arg to unicode() is perfectly valid in jython.
- A test buffer() test. No buffer() on Jython

This closes patch "[ #490920 ] Jython and test_unicode".
2001-12-10 20:57:34 +00:00
Finn Bock 793ead5696 A workaround for the missing buffer() builtin in jython.
This closes patch "[ #490850 ] Jython and test_StringIO".
2001-12-09 20:06:32 +00:00
Fredrik Lundh 82b230732f bug #133283, #477728, #483789, #490573
backed out of broken minimal repeat patch from July

also fixed a couple of minor potential resource leaks in pattern_subx
(Guido had already fixed the big one)
2001-12-09 16:13:15 +00:00
Finn Bock ed69aeedb9 test(): Avoid a UnboundLocalError when a method is missing from both the string
module and from string methods.

This closes patch "[ #490811 ] Jython and test_string".
2001-12-09 16:06:29 +00:00
Finn Bock d08011a0e1 Moved a print statement outside the jython platform test. Otherwise
the output fails to compare correctly for jython. This change was part
of the original patch #403666.
2001-12-09 10:19:25 +00:00
Finn Bock 4ab7adbd94 The initial patch #468662 was not applied quite verbatim. This should one
will fix the remaining Jython issues.

This closes patch "[ #490411 ] Jython and test_grammar.py".
2001-12-09 09:12:34 +00:00
Finn Bock ada1983950 Refcounting isn't available in Jython. Putting the jython test around it.
This closes patch "[ #490414 ] Jython and test_socket".
2001-12-09 08:57:46 +00:00
Guido van Rossum 146483964e Patch supplied by Burton Radons for his own SF bug #487390: Modifying
type.__module__ behavior.

This adds the module name and a dot in front of the type name in every
type object initializer, except for built-in types (and those that
already had this).  Note that it touches lots of Mac modules -- I have
no way to test these but the changes look right.  Apologies if they're
not.  This also touches the weakref docs, which contains a sample type
object initializer.  It also touches the mmap test output, because the
mmap type's repr is included in that output.  It touches object.h to
put the correct description in a comment.
2001-12-08 18:02:58 +00:00
Finn Bock aa3dc45658 Enable support for jython:
1. Acknowledge the welknown difference that jython
allows continue in the finally clause.

2. Avoid using _testcapi when running with jython.

This closes patch "[ #490417 ] Jython and test_exceptions"
2001-12-08 10:15:48 +00:00
Guido van Rossum baefcebb55 Remove erroneous and confusing comment -- sre patterns *can* be
pickled and we do *not* expect exceptions from either pickle or
cPickle.
2001-12-08 05:11:15 +00:00
Tim Peters cbfc0343fc SF patch 490393: test___all__ and Jython; from Finn Bock.
Don't even try to import _socket when running under Jython.
2001-12-07 21:35:42 +00:00
Guido van Rossum 78f0dd3397 I found that when run as a script, this test suite ran its tests
twice!  Fixed this by avoiding the import of test_email, which loads
the module a second time in that situation, and fiddled the __main__
section to resemble other test suites using unittest.
2001-12-07 21:07:08 +00:00
Finn Bock 71be984b80 Align the number of %s with the number of format arguments.
This closes patch "[ #490330 ] String format bug in test_b2."
2001-12-07 18:21:56 +00:00
Guido van Rossum a35e2cee32 Move import dbhash out of test_sundry and into test_bsddb,
so that test_sundry won't fail if the bsddb module is absent.
2001-12-07 16:43:19 +00:00
Fred Drake 2998a55f2d Attribute nodes did not always get their ownerDocument and ownerElement
properly set.  This fixes that.
2001-12-06 18:27:48 +00:00
Tim Peters 3caca2326e SF bug #488514: -Qnew needs work
Big Hammer to implement -Qnew as PEP 238 says it should work (a global
option affecting all instances of "/").

pydebug.h, main.c, pythonrun.c:  define a private _Py_QnewFlag flag, true
iff -Qnew is passed on the command line.  This should go away (as the
comments say) when true division becomes The Rule.  This is
deliberately not exposed to runtime inspection or modification:  it's
a one-way one-shot switch to pretend you're using Python 3.

ceval.c:  when _Py_QnewFlag is set, treat BINARY_DIVIDE as
BINARY_TRUE_DIVIDE.

test_{descr, generators, zipfile}.py:  fiddle so these pass under
-Qnew too.  This was just a matter of s!/!//! in test_generators and
test_zipfile.  test_descr was trickier, as testbinop() is passed
assumptions that "/" is the same as calling a "__div__" method; put
a temporary hack there to call "__truediv__" instead when the method
name is "__div__" and 1/2 evaluates to 0.5.

Three standard tests still fail under -Qnew (on Windows; somebody
please try the Linux tests with -Qnew too!  Linux runs a whole bunch
of tests Windows doesn't):
    test_augassign
    test_class
    test_coercion
I can't stay awake longer to stare at this (be my guest).  Offhand
cures weren't obvious, nor was it even obvious that cures are possible
without major hackery.

Question:  when -Qnew is in effect, should calls to __div__ magically
change into calls to __truediv__?  See "major hackery" at tail end of
last paragraph <wink>.
2001-12-06 06:23:26 +00:00
Fred Drake e50959a58e Fix appendChild() and insertBefore() (and replaceChild() indirectly) when
the node being added is a fragment node.
This closes SF bug #487929.
2001-12-06 04:32:18 +00:00
Jack Jansen 8a97f4a380 sys.platform on Mac OS X is now "darwin", without any version number appended.
This should probably go into NEWS (who's responsible for that?).
2001-12-05 23:27:32 +00:00
Guido van Rossum 33bab01da6 Fix SF bug #489581: __slots__ leak.
It was easier than I thought, assuming that no other things contribute
to the instance size besides slots -- a pretty good bet.  With a test
suite, no less!
2001-12-05 22:45:48 +00:00
Guido van Rossum d331cb5502 At the PythonLabs meeting someone mentioned it would make Jim really
happy if one could delete the __dict__ attribute of an instance.  I
love to make Jim happy, so here goes...

- New-style objects now support deleting their __dict__.  This is for
  all intents and purposes equivalent to assigning a brand new empty
  dictionary, but saves space if the object is not used further.
2001-12-05 19:46:42 +00:00
Tim Peters 6d30c3e391 Change new tests to use integer division (// instead of /). 2001-12-05 00:30:09 +00:00
Tim Peters a3c01ce696 SF bug #488480: integer multiply to return -max_int-1.
int_mul():  new and vastly simpler overflow checking.  Whether it's
faster or slower will likely vary across platforms, favoring boxes
with fast floating point.  OTOH, we no longer have to worry about
people shipping broken LONG_BIT definitions <0.9 wink>.
2001-12-04 23:05:10 +00:00
Guido van Rossum 6b70599450 Fix SF bug #486144: Uninitialized __slot__ vrbl is None.
There's now a new structmember code, T_OBJECT_EX, which is used for
all __slot__ variables (except __weakref__, which has special behavior
anyway).  This new code raises AttributeError when the variable is
NULL rather than converting NULL to None.
2001-12-04 16:23:42 +00:00
Guido van Rossum bb8f59a371 unpack_iterable(): Add a missing DECREF in an error case. Reported by
Armin Rigo (SF bug #488477).  Added a testcase to test_unpack_iter()
in test_iter.py.
2001-12-03 19:33:25 +00:00
Fred Drake 073148c4ef Add a test that makes sure unclosed entity references are handled consitently. 2001-12-03 16:44:09 +00:00
Guido van Rossum dbb53d9918 Fix of SF bug #475877 (Mutable subtype instances are hashable).
Rather than tweaking the inheritance of type object slots (which turns
out to be too messy to try), this fix adds a __hash__ to the list and
dict types (the only mutable types I'm aware of) that explicitly
raises an error.  This has the advantage that list.__hash__([]) also
raises an error (previously, this would invoke object.__hash__([]),
returning the argument's address); ditto for dict.__hash__.

The disadvantage for this fix is that 3rd party mutable types aren't
automatically fixed.  This should be added to the rules for creating
subclassable extension types: if you don't want your object to be
hashable, add a tp_hash function that raises an exception.

Also, it's possible that I've forgotten about other mutable types for
which this should be done.
2001-12-03 16:32:18 +00:00
Guido van Rossum 5b443c6282 Address SF patch #480716 as well as related issues.
SF patch #480716 by Greg Chapman fixes the problem that super's
__get__ method always returns an instance of super, even when the
instance whose __get__ method is called is an instance of a subclass
of super.

Other issues fixed:

- super(C, C()).__class__ would return the __class__ attribute of C()
  rather than the __class__ attribute of the super object.  This is
  confusing.  To fix this, I decided to change the semantics of super
  so that it only applies to code attributes, not to data attributes.
  After all, overriding data attributes is not supported anyway.

- While super(C, x) carefully checked that x is an instance of C,
  super(C).__get__(x) made no such check, allowing for a loophole.
  This is now fixed.
2001-12-03 15:38:28 +00:00
Jack Jansen 398c236c1b Added tests expected to be skipped on Mac OS X. 2001-12-02 21:41:36 +00:00
Tim Peters 82285dad8e Whitespace normalization. 2001-12-01 04:11:16 +00:00
Jack Jansen b3be216b41 Merged changes made on r22b2-branch between r22b2 and r22b2-mac (the
changes from start of branch upto r22b2 were already merged, of course).
2001-11-30 14:16:36 +00:00
Marc-André Lemburg 41f01994c4 Adding test for Unicode repr()-output. 2001-11-28 14:03:14 +00:00
Barry Warsaw 00859c0538 __format(): Applied SF patch #482003 by Skip to fix multiline dict
output.

Patch includes additional test case test_basic_line_wrap().

This patch is a candidate for Python 2.1.2.
2001-11-28 05:49:39 +00:00