summaryrefslogtreecommitdiffstats
path: root/Lib/warnings.py
Commit message (Collapse)AuthorAgeFilesLines
* Require implementations for warnings.showwarning() support the 'line' argument.Brett Cannon2009-03-111-18/+0
| | | | | | Was a DeprecationWarning for not supporting it since Python 2.6. Closes issue #3652.
* Issue #3781: Final cleanup of warnings.catch_warnings and its usage in the ↵Nick Coghlan2008-09-111-0/+15
| | | | test suite. Closes issue w.r.t. 2.6 (R: Brett Cannon)
* warnings.catch_warnings() now returns a list or None instead of the customBrett Cannon2008-09-091-34/+21
| | | | | | | | WarningsRecorder object. This makes the API simpler to use as no special object must be learned. Closes issue 3781. Review by Benjamin Peterson.
* Deprecate bsddb for removal in Python 3.0.Brett Cannon2008-09-051-1/+8
| | | | | Closes issue 3776. Review by Nick Coghlan.
* Move test.test_support.catch_warning() to the warnings module, rename itBrett Cannon2008-09-021-1/+74
| | | | | | | | | | | catch_warnings(), and clean up the API. While expanding the test suite, a bug was found where a warning about the 'line' argument to showwarning() was not letting functions with '*args' go without a warning. Closes issue 3602. Code review by Benjamin Peterson.
* warnings.warn_explicit() did not have the proper TypeErrors in place to preventBrett Cannon2008-06-271-0/+1
| | | | | | | | bus errors or SystemError being raised. As a side effect of fixing this, a bad DECREF that could be triggered when 'message' and 'category' were both None was fixed. Closes issue 3211. Thanks JP Calderone for the bug report.
* Practice EAFP, and revert 62787Benjamin Peterson2008-05-071-3/+0
|
* Make the Python implementation of warnings compatible with the C ↵Benjamin Peterson2008-05-061-0/+3
| | | | implementation regarding non-callable showwarning
* Remove the use of 'inspect' from 'warnings' for detected deprecated use of theBrett Cannon2008-05-051-5/+12
| | | | | showwarning API. Turns out 'inspect' uses 'operator' which is an extension module. That's a problem when it has not been built yet by setup.py.
* Add a DeprecationWarning for when warnings.showwarning() is set to a functionBrett Cannon2008-05-051-1/+14
| | | | that lacks support for the new 'line' argument.
* Re-implement the 'warnings' module in C. This allows for usage of theBrett Cannon2008-04-121-123/+148
| | | | | | | | | 'warnings' code in places where it was previously not possible (e.g., the parser). It could also potentially lead to a speed-up in interpreter start-up if the C version of the code (_warnings) is imported over the use of the Python version in key places. Closes issue #1631171.
* Expose Py_Py3kWarningFlag as sys.py3kwarning as discussed in #1504Christian Heimes2007-11-271-0/+10
| | | | Also added a warning.warnpy3k() as convenient method for Python 3.x related deprecation warnings.
* Ignore ImportWarning by defaultNick Coghlan2006-07-061-0/+1
|
* 'warning's was improperly requiring that a command-line Warning category beBrett Cannon2006-06-221-2/+1
| | | | | | | both a subclass of Warning and a subclass of types.ClassType. The latter is no longer true thanks to new-style exceptions. Closes bug #1510580. Thanks to AMK for the test.
* Make use of new str.startswith/endswith semantics.Georg Brandl2006-06-091-1/+1
| | | | Occurences in email and compiler were ignored due to backwards compat requirements.
* Conversion of exceptions over from faked-up classes to new-style C types.Richard Jones2006-05-271-2/+0
|
* Updated the warnings, linecache, inspect, traceback, site, and doctest modulesPhillip J. Eby2006-04-111-2/+8
| | | | | to work correctly with modules imported from zipfiles or via other PEP 302 __loader__ objects. Tests and doc updates are included.
* PEP 352 implementation. Creates a new base class, BaseException, which has anBrett Cannon2006-03-011-1/+2
| | | | | | | | | 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.
* Bug #1403410: The warnings module now doesn't get confusedGeorg Brandl2006-01-131-1/+1
| | | | when it can't find out the module name it generates a warning for.
* bug [ 839151 ] attempt to access sys.argv when it doesn't existGeorg Brandl2005-06-261-1/+5
|
* Replace list of constants with tuples of constants.Raymond Hettinger2005-02-061-1/+1
|
* Fix wrong variable name.Walter Dörwald2004-12-291-1/+1
|
* Stop producing or using OverflowWarning. PEP 237 thought this wouldTim Peters2004-08-251-0/+1
| | | | | | | 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.
* SF bug 917108: warnings.py does not define _test().Tim Peters2004-03-211-8/+3
| | | | Removed the entire __name__ == '__main__' block.
* Replace backticks with repr() or "%r"Walter Dörwald2004-02-121-11/+11
| | | | From SF patch #852334.
* Change warnings to avoid importing re module during startup.Jeremy Hylton2003-07-111-43/+28
| | | | | | | | | Add API function simplefilter() that does not create or install regular expressions to match message or module. Extend the filters data structure to store None as an alternative to re.compile(""). Move the _test() function to test_warnings and add some code to try and avoid disturbing the global state of the warnings module.
* defer re module imports to help improve interpreter startupSkip Montanaro2003-05-141-1/+4
|
* Fix bug 683658 - PyErr_Warn may cause import deadlock.Mark Hammond2003-02-191-1/+4
|
* Allow Unicode strings as message and module name.Martin v. Löwis2002-10-141-2/+2
|
* Ignore IOError exceptions when writing the message.Mark Hammond2002-09-111-1/+4
|
* Remove uses of the string and types modules:Walter Dörwald2002-06-031-3/+3
| | | | | | | | | | | | | | | | | | | | | | x in string.whitespace => x.isspace() type(x) in types.StringTypes => isinstance(x, basestring) isinstance(x, types.StringTypes) => isinstance(x, basestring) type(x) is types.StringType => isinstance(x, str) type(x) == types.StringType => isinstance(x, str) string.split(x, ...) => x.split(...) string.join(x, y) => y.join(x) string.zfill(x, ...) => x.zfill(...) string.count(x, ...) => x.count(...) hasattr(types, "UnicodeType") => try: unicode except NameError: type(x) != types.TupleTuple => not isinstance(x, tuple) isinstance(x, types.TupleType) => isinstance(x, tuple) type(x) is types.IntType => isinstance(x, int) Do not mention the string module in the rlcompleter docstring. This partially applies SF patch http://www.python.org/sf/562373 (with basestring instead of string). (It excludes the changes to unittest.py and does not change the os.stat stuff.)
* SF 563203. Replaced 'has_key()' with 'in'.Raymond Hettinger2002-06-011-1/+1
|
* As discussed on python-dev, add a mechanism to indicate featuresNeal Norwitz2002-05-291-0/+1
| | | | | that are in the process of deprecation (PendingDeprecationWarning). Docs could be improved.
* resetwarnings(): Remove extra space from docstring guts.Tim Peters2002-04-161-1/+1
|
* Whitespace normalization.Tim Peters2002-04-161-5/+5
|
* resetwarnings(): change the docstring to reflect what the codeTim Peters2002-04-161-1/+1
| | | | | | | actually does. Note that the description in the Library Reference manual is already accurate. Bugfix candidate.
* [Apply SF patch #504943]Walter Dörwald2002-03-211-5/+14
| | | | | | This patch makes it possible to pass Warning instances as the first argument to warnings.warn. In this case the category argument will be ignored. The message text used will be str(warninginstance).
* Allow for the possibility that globals['__name__'] does not exist;Guido van Rossum2001-08-311-1/+4
| | | | | substitute "<string>" for the module name in that case. This actually occurred when running test_descr.py with -Dwarn.
* Ignore OverflowWarning by default. To enable the warning, useGuido van Rossum2001-08-231-0/+1
| | | | | | | | python -Wdefault or python -Wdefault::OverflowWarning
* final round of __all__ lists (I hope) - skipped urllib2 because Moshe may beSkip Montanaro2001-03-011-0/+3
| | | | giving it a slight facelift
* Move a comment around to where it belongs (the code had alrady beenGuido van Rossum2001-02-281-1/+1
| | | | moved).
* Add a new API:Guido van Rossum2001-02-281-0/+10
| | | | | | | | | warn_explicit(message, category, filename, lineno, module, registry) The regular warn() call calculates a bunch of values and calls warn_explicit() with these. This will be used to issue better syntax warnings.
* Whitespace normalization. Top level of Lib now fixed-point for reindent.py!Tim Peters2001-01-151-23/+23
|
* - Added keyword argument 'append' to filterwarnings(); if true, thisGuido van Rossum2001-01-141-5/+10
| | | | | | | appends to list of filters instead of inserting at the front. This is useful to add a filter with a lower priority than -W options. - Cosmetic improvements to a docstring and an error message.
* Improve error messages for invalid warning arguments; don't raiseGuido van Rossum2000-12-191-4/+10
| | | | exceptions but always print a warning message.
* Python part of the warnings subsystem.Guido van Rossum2000-12-151-0/+227