summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_exceptions.py
Commit message (Collapse)AuthorAgeFilesLines
* warnings.catch_warnings() now returns a list or None instead of the customBrett Cannon2008-09-091-3/+3
| | | | | | | | WarningsRecorder object. This makes the API simpler to use as no special object must be learned. Closes issue 3781. Review by Benjamin Peterson.
* Issue #2534: speed up isinstance() and issubclass() by 50-70%, so as toAntoine Pitrou2008-08-261-6/+26
| | | | | | | | | | 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.
* Remove a dummy test that was checked in by mistakeAmaury Forgeot d'Arc2008-07-311-8/+0
|
* #2542: now that issubclass() may call arbitrary code,Amaury Forgeot d'Arc2008-07-311-1/+34
| | | | make sure that PyErr_ExceptionMatches returns 0 when an exception occurs there.
* Issue 2517: Allow unicode messages in Exceptions again by correctly ↵Nick Coghlan2008-07-081-0/+1
| | | | bypassing the instance dictionary when looking up __unicode__ on new-style classes
* Add a missing quotation mark.Brett Cannon2007-11-031-1/+1
|
* Revert accidental checkins from last commit.Georg Brandl2007-08-211-16/+1
|
* Demand version 2.5.1 since 2.5 has a bug with codecs.open context managers.Georg Brandl2007-08-211-1/+16
|
* Remove test.test_support.guard_warnings_filter.Brett Cannon2007-08-141-2/+2
| | | | | | | | 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.
* Deprecate BaseException.message as per PEP 352.Brett Cannon2007-05-051-27/+31
|
* Add a test for instantiating SyntaxError with no arguments.Brett Cannon2007-02-281-0/+3
|
* Add a test for slicing an exception.Brett Cannon2007-01-291-0/+7
|
* Remove unneeded imports of 'warnings'.Brett Cannon2006-12-131-1/+0
|
* WindowsError.str should display the windows error code,Thomas Heller2006-10-271-0/+13
| | | | | | | not the posix error code; with test. Fixes #1576174. Will backport to release25-maint.
* Bug #1566800: make sure that EnvironmentError can be called with anyGeorg Brandl2006-09-301-3/+8
| | | | number of arguments, as was the case in Python 2.4.
* Remove the __unicode__ method from exceptions. Allows unicode() to be calledBrett Cannon2006-09-091-0/+9
| | | | | | | on exception classes. Would require introducing a tp_unicode slot to make it work otherwise. Fixes bug #1551432 and will be backported.
* Bug #1542051: Exceptions now correctly call PyObject_GC_UnTrack.Georg Brandl2006-09-061-26/+13
| | | | | Also make sure that every exception class has __module__ set to 'exceptions'.
* Fix for an obscure bug introduced by revs 46806 and 46808, with a test.Armin Rigo2006-06-211-0/+12
| | | | | | | | | | | | | | 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.
* SF patch 1501987: Remove randomness from test_exceptions,Tim Peters2006-06-071-19/+30
| | | | | | | | | | | | | | | | | | 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).
* Fix memory leak found by valgrind.Neal Norwitz2006-06-021-2/+4
|
* Convert docstrings to comments so regrtest -v prints method namesNeal Norwitz2006-06-021-7/+7
|
* Some code style tweaks, and remove apply.Georg Brandl2006-06-011-63/+67
|
* Whitespace normalization.Tim Peters2006-05-301-4/+4
|
* Convert test_exceptions to unittest.Georg Brandl2006-05-301-297/+287
|
* Do the check for no keyword arguments in __init__ so thatGeorg Brandl2006-05-301-1/+1
| | | | subclasses of Exception can be supplied keyword args
* Disallow keyword args for exceptions.Georg Brandl2006-05-301-0/+7
|
* Add a test case for exception pickling. args is never NULL.Georg Brandl2006-05-301-0/+13
|
* Conversion of exceptions over from faked-up classes to new-style C types.Richard Jones2006-05-271-8/+85
|
* PEP 352 implementation. Creates a new base class, BaseException, which has anBrett Cannon2006-03-011-4/+1
| | | | | | | | | added message attribute compared to the previous version of Exception. It is also a new-style class, making all exceptions now new-style. KeyboardInterrupt and SystemExit inherit from BaseException directly. String exceptions now raise DeprecationWarning. Applies patch 1104669, and closes bugs 1012952 and 518846.
* Stop producing or using OverflowWarning. PEP 237 thought this wouldTim Peters2004-08-251-7/+8
| | | | | | | happen in 2.3, but nobody noticed it still was getting generated (the warning was disabled by default). OverflowWarning and PyExc_OverflowWarning should be removed for 2.5, and left notes all over saying so.
* Patch #734231: Update RiscOS support. In particular, correctMartin v. Löwis2003-05-101-3/+3
| | | | riscospath.extsep, and use os.extsep throughout.
* Complete the absolute import patch for the test suite. All relativeBarry Warsaw2002-07-301-1/+1
| | | | | | | | imports of test modules now import from the test package. Other related oddities are also fixed (like DeprecationWarning filters that weren't specifying the full import part, etc.). Also did a general code cleanup to remove all "from test.test_support import *"'s. Other from...import *'s weren't changed.
* Tighten up some warning filters, and break some dependencies on theTim Peters2002-04-161-2/+6
| | | | order in which the tests are normally run.
* Enable support for jython:Finn Bock2001-12-081-4/+11
| | | | | | | | | 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"
* Add tests for new PyErr_NormalizeException() behaviorJeremy Hylton2001-09-261-0/+35
| | | | | | | | | | | | Add raise_exception() to the _testcapi module. It isn't a test, but the C API exists only to support test_exceptions. raise_exception() takes two arguments -- an exception class and an integer specifying how many arguments it should be called with. test_exceptions uses BadException() to test the interpreter's behavior when there is a problem instantiating the exception. test_capi1() calls it with too many arguments. test_capi2() causes an exception to be raised in the Python code of the constructor.
* Turn OverflowWarning into an error locally, in order to make theGuido van Rossum2001-08-231-0/+3
| | | | OverflowError test succeed.
* reload(exceptions) should not raise an ImportError, but should actBarry Warsaw2001-08-131-0/+8
| | | | just like reload(sys). Test that this is so. Closes SF bug #422004.
* Allow 'continue' inside 'try' clauseJeremy Hylton2001-02-011-19/+2
| | | | SF patch 102989 by Thomas Wouters
* Use 4-space indents.Fred Drake2000-10-231-8/+8
|
* Add test cases to make sure we get the right SyntaxError message forFred Drake2000-09-081-0/+49
| | | | various illegal uses of "continue".
* Applying patch #100994 to allow JPython to use more of the standardBarry Warsaw2000-09-011-1/+1
| | | | | | | | | | | | | Python test suite. Specifically, - import time instead of strop in test_b1 - test for ClassType of exceptions using isinstance instead of equality in test_exceptions - remove __builtins__ from dir() output in test_pkg test_pkg output needs to be regenerated.
* Create two new exceptions: IndentationError and TabError. These areFred Drake2000-07-111-0/+8
| | | | | | | used for indentation related errors. This patch includes Ping's improvements for indentation-related error messages. Closes SourceForge patches #100734 and #100856.
* add minimal test of exception use. verify that each exception can beJeremy Hylton2000-06-201-0/+12
| | | | raised, caught, and converted to a string.
* Added a test to catch the base class.Barry Warsaw2000-05-251-0/+4
|
* Mass check-in after untabifying all files that need it.Guido van Rossum1998-03-261-10/+10
|
* Expanded r() function to handle class exceptions.Barry Warsaw1997-08-291-1/+6
|
* exec() -> execGuido van Rossum1995-08-111-1/+1
|
* Unmerged except and finally clausesGuido van Rossum1992-05-061-4/+5
|
* Initial revisionGuido van Rossum1992-01-271-0/+91