Commit graph

36 commits

Author SHA1 Message Date
Phillip J. Eby
4703211080 Updated the warnings, linecache, inspect, traceback, site, and doctest modules
to work correctly with modules imported from zipfiles or via other PEP 302
__loader__ objects.  Tests and doc updates are included.
2006-04-11 01:07:43 +00:00
Georg Brandl
51dbc4c879 traceback now shows error position for all SyntaxError subclasses,
e.g. IndentationError. (bug #1447885)
2006-03-31 15:59:13 +00:00
Phillip J. Eby
4a26633e0e Revert r42719, because the isinstance() check wasn't redundant; formatting a
string exception was causing a TypeError.
2006-03-24 22:10:54 +00:00
Thomas Wouters
7c187bcc82 Remove redundant isinstance() check. 2006-03-01 05:34:22 +00:00
Brett Cannon
bf36409e2a PEP 352 implementation. Creates a new base class, BaseException, which has an
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.
2006-03-01 04:25:17 +00:00
Hye-Shik Chang
182ac85147 SF #737473: Show up-to-date source code in tracebacks always.
And add an optional argument 'filename' to linecache.checkcache()
to enable checking caches per-file.
2004-10-26 09:16:42 +00:00
Tim Peters
58eb11cf62 Whitespace normalization. 2004-01-18 20:29:55 +00:00
Neil Schemenauer
f607fc5395 Add traceback.format_exc(). 2003-11-05 23:03:00 +00:00
Michael W. Hudson
dd32a91cc0 This is my patch
[ 587993 ] SET_LINENO killer

Remove SET_LINENO.  Tracing is now supported by inspecting co_lnotab.

Many sundry changes to document and adapt to this change.
2002-08-15 14:59:02 +00:00
Raymond Hettinger
10ff706e27 Replaced boolean tests with is None. 2002-06-02 03:04:52 +00:00
Tim Peters
0bb580d297 SF bug 431772: traceback.print_exc() causes traceback
Patch from Michael Hundson.
format_exception_only() blew up when trying to report a SyntaxError
from a string input (line is None in this case, but it assumed a string).
Bugfix candidate.
2001-06-10 18:58:26 +00:00
Tim Peters
a19a168ccc Whitespace normalization. 2001-03-29 04:36:09 +00:00
Jeremy Hylton
ed9d0ba482 Do not print caret when offset is None. 2001-03-21 20:29:18 +00:00
Jeremy Hylton
69e9e8bd51 Reformat and edit docstrings to follow modern conventions. Single
line summary followed by blank line and description.
2001-03-21 19:09:31 +00:00
Skip Montanaro
40fc16059f final round of __all__ lists (I hope) - skipped urllib2 because Moshe may be
giving it a slight facelift
2001-03-01 04:27:19 +00:00
Eric S. Raymond
6e025bcde8 String method cleanup. 2001-02-10 00:22:33 +00:00
Eric S. Raymond
ec3bbdef94 String method conversion. 2001-02-09 09:39:08 +00:00
Tim Peters
b90f89a496 Whitespace normalization. 2001-01-15 03:26:36 +00:00
Guido van Rossum
3ad167ae34 mwh: [ Patch #103228 ] traceback.py nit.
When the exception has no message, don't insert a colon after the
exception name.
2001-01-13 22:14:31 +00:00
Guido van Rossum
2823f03a56 Patch by Toby Dickenson: don't die when an error occurs during string
conversion in an exception, but instead display <unprintable %s
object> where %s is the type name.
2000-08-22 02:04:46 +00:00
Thomas Wouters
7e47402264 Spelling fixes supplied by Rob W. W. Hooft. All these are fixes in either
comments, docstrings or error messages. I fixed two minor things in
test_winreg.py ("didn't" -> "Didn't" and "Didnt" -> "Didn't").

There is a minor style issue involved: Guido seems to have preferred English
grammar (behaviour, honour) in a couple places. This patch changes that to
American, which is the more prominent style in the source. I prefer English
myself, so if English is preferred, I'd be happy to supply a patch myself ;)
2000-07-16 12:04:32 +00:00
Guido van Rossum
3bb1edb328 Match the error messages to say "(most recent call last)" like the
built-in messages.
2000-04-10 16:29:29 +00:00
Guido van Rossum
e7b146fb3b The third and final doc-string sweep by Ka-Ping Yee.
The attached patches update the standard library so that all modules
have docstrings beginning with one-line summaries.

A new docstring was added to formatter.  The docstring for os.py
was updated to mention nt, os2, ce in addition to posix, dos, mac.
2000-02-04 15:28:42 +00:00
Guido van Rossum
3f0666c4a2 Add obvious needed else clause to format_exception(). 1998-03-18 17:48:06 +00:00
Guido van Rossum
6e73af723c New version of tb_lineno(), this time *not* using try-except, to avoid
disturbing the current exception, and returning tb.tb_lineno, which is
the line number of thr traceback, rather than the current line number.
By Jim Hugunin.
1998-02-26 17:25:02 +00:00
Guido van Rossum
7266496b00 Tweak the tb_lineno() function to be compatible with JPython, which
has no line number table etc.
1998-02-25 16:33:39 +00:00
Guido van Rossum
4752966193 Use Marc Lemburg's tb_lineno() to calculate the correct line number.
Apparently the traceback object doesn't contains the right linenumber
when -O is used.  Rather than guessing whether -O is on or off, use
tb_lineno() unconditionally.
1997-09-26 22:43:02 +00:00
Guido van Rossum
2deb73a961 Use sys.exc_info() instead of sys.exc_{type,value,traceback}.
Also corrected a typo in format_stack (t should've been f).
1997-07-18 16:46:36 +00:00
Guido van Rossum
2715bb20db Changes to always call list.append with a single argument. 1996-10-08 14:06:35 +00:00
Guido van Rossum
dcc057a793 Added routines to print, format and extract the current, ``live'' stack.
Also added print_list() and format_list() which format the output from
an extract_*() routine.
1996-08-12 23:18:13 +00:00
Guido van Rossum
3c998825bd removed history comment 1996-05-28 23:09:09 +00:00
Guido van Rossum
194e20a9db add file parameter to all printing fns, default stderr 1995-09-20 20:31:51 +00:00
Guido van Rossum
28e99fe96f added format_* functions (suggestion by Ken M) 1995-08-04 04:30:30 +00:00
Guido van Rossum
c7acf2a106 handle class exceptions 1995-02-27 13:15:45 +00:00
Guido van Rossum
7aeb4b9ce8 * Lib/linecache.py: don't crash on empty filename
* Lib/macpath.py: don't return trailing colon for dirname()
	(XXX won't do for volume names -- but otherwise glob(':*:*.py')
	loops forever)
	* Lib/traceback.py: print SyntaxError correctly
	* Lib/stat.py: moved to posixstat.py; added macstat.py which has
	the constants for the Mac; and created new stat.py which includes
	the right one
	* Lib/urllib.py: fix caching bug (by disabling the cache)
1994-08-23 13:32:20 +00:00
Guido van Rossum
526beed88d New module, formats traceback just like the C code does 1994-07-01 15:36:46 +00:00