Commit Graph

50 Commits

Author SHA1 Message Date
Benjamin Peterson
5c8da86f3a convert usage of fail* to assert* 2009-06-30 22:57:08 +00:00
Brett Cannon
672237dc6c warnings.catch_warnings() now returns a list or None instead of the custom
WarningsRecorder object. This makes the API simpler to use as no special object
must be learned.

Closes issue 3781.
Review by Benjamin Peterson.
2008-09-09 00:49:16 +00:00
Antoine Pitrou
0668c62677 Issue #2534: speed up isinstance() and issubclass() by 50-70%, so as to
match Python 2.5 speed despite the __instancecheck__ / __subclasscheck__
mechanism. In the process, fix a bug where isinstance() and issubclass(),
when given a tuple of classes as second argument, were looking up
__instancecheck__ / __subclasscheck__ on the tuple rather than on each
type object.

Reviewed by Benjamin Peterson and Raymond Hettinger.
2008-08-26 22:42:08 +00:00
Amaury Forgeot d'Arc
ad9604003c Remove a dummy test that was checked in by mistake 2008-07-31 21:35:03 +00:00
Amaury Forgeot d'Arc
246daedd11 #2542: now that issubclass() may call arbitrary code,
make sure that PyErr_ExceptionMatches returns 0 when an exception occurs there.
2008-07-31 00:42:16 +00:00
Nick Coghlan
524b7773cc Issue 2517: Allow unicode messages in Exceptions again by correctly bypassing the instance dictionary when looking up __unicode__ on new-style classes 2008-07-08 14:08:04 +00:00
Brett Cannon
b13f70df1b Add a missing quotation mark. 2007-11-03 06:47:02 +00:00
Georg Brandl
d7e9f608c3 Revert accidental checkins from last commit. 2007-08-21 06:03:43 +00:00
Georg Brandl
fdca6d8599 Demand version 2.5.1 since 2.5 has a bug with codecs.open context managers. 2007-08-21 06:01:18 +00:00
Brett Cannon
2ee4128e9b Remove test.test_support.guard_warnings_filter.
test.test_support.catch_warning is more full-featured and provides the same
functionality.

Since guard_warnings_filter was added in 2.6 there is no
backwards-compatibility issues.
2007-08-14 05:51:06 +00:00
Brett Cannon
229cee2d3d Deprecate BaseException.message as per PEP 352. 2007-05-05 01:34:02 +00:00
Brett Cannon
f8267df2ad Add a test for instantiating SyntaxError with no arguments. 2007-02-28 18:15:00 +00:00
Brett Cannon
e05e6b0032 Add a test for slicing an exception. 2007-01-29 04:41:44 +00:00
Brett Cannon
c745df8519 Remove unneeded imports of 'warnings'. 2006-12-13 23:02:38 +00:00
Thomas Heller
df08f0b9a0 WindowsError.str should display the windows error code,
not the posix error code; with test.
Fixes #1576174.

Will backport to release25-maint.
2006-10-27 18:31:36 +00:00
Georg Brandl
3267d28f9d Bug #1566800: make sure that EnvironmentError can be called with any
number of arguments, as was the case in Python 2.4.
2006-09-30 09:03:42 +00:00
Brett Cannon
ca2ca79d23 Remove the __unicode__ method from exceptions. Allows unicode() to be called
on exception classes.  Would require introducing a tp_unicode slot to make it
work otherwise.

Fixes bug #1551432 and will be backported.
2006-09-09 07:11:46 +00:00
Georg Brandl
38f6237dfe Bug #1542051: Exceptions now correctly call PyObject_GC_UnTrack.
Also make sure that every exception class has __module__ set to
'exceptions'.
2006-09-06 06:50:05 +00:00
Armin Rigo
53c1692f6a Fix for an obscure bug introduced by revs 46806 and 46808, with a test.
The problem of checking too eagerly for recursive calls is the
following: if a RuntimeError is caused by recursion, and if code needs
to normalize it immediately (as in the 2nd test), then
PyErr_NormalizeException() needs a call to the RuntimeError class to
instantiate it, and this hits the recursion limit again...  causing
PyErr_NormalizeException() to never finish.

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

Backport candidate.
2006-06-21 21:58:50 +00:00
Tim Peters
80dc76e907 SF patch 1501987: Remove randomness from test_exceptions,
from ?iga Seilnacht (sorry about the name, but Firefox
on my box can't display the first character of the name --
the SF "Unix name" is zseil).

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

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

Not a bugfix candidate (this is fiddling new-in-2.5 code).
2006-06-07 06:57:51 +00:00
Neal Norwitz
38d4d4a35b Fix memory leak found by valgrind. 2006-06-02 04:50:49 +00:00
Neal Norwitz
e152aab977 Convert docstrings to comments so regrtest -v prints method names 2006-06-02 04:45:53 +00:00
Georg Brandl
e08940ef6c Some code style tweaks, and remove apply. 2006-06-01 13:00:49 +00:00
Tim Peters
dd55b0a32c Whitespace normalization. 2006-05-30 23:28:02 +00:00
Georg Brandl
cdcede62c0 Convert test_exceptions to unittest. 2006-05-30 08:47:19 +00:00