Commit Graph

84 Commits

Author SHA1 Message Date
Zane Bitter de86073a76 bpo-28603: Fix formatting tracebacks for unhashable exceptions (#4014) 2017-10-18 00:29:39 +03:00
codedragon 3480ef9dd3 bpo-30445: Allow appended output in RecursionError message
Running under coverage sometimes causes 'in comparison' to be added to the end of the RecursionError message, which is acceptable.

Patched by Maria Mckinley
2017-05-24 16:23:46 -05:00
Serhiy Storchaka 2b801456fb Issue #25783: Fixed test_traceback when run directly (without regrtest). 2016-10-07 23:46:22 +03:00
Serhiy Storchaka 1c1130fb5f Issue #25783: Fixed test_traceback when run directly (without regrtest). 2016-10-07 23:45:42 +03:00
Martin Panter f3b0639417 Issue #27348: Merge exception formatting fix from 3.5 into 3.6 2016-09-22 10:33:21 +00:00
Martin Panter bb8b1cb6af Issue #27348: Restore “Exception: None” formatting in traceback module
This fixes a regression caused by revision 73afda5a4e4c. Also reverts the
decimal test workaround added in revision 5f3dd0a2b1ab.

Remove test_without_exception(). According to revision ecaafc32c500, this was
added in Python 2 so that print_exc() would output “None” when called with no
exception set. However print_exc() never worked like this in Python 3, and
the use case is not documented.

Restore TracebackCases class name (instead of SyntaxTracebackCases), because
the class also tests other exceptions.
2016-09-22 09:37:39 +00:00
Serhiy Storchaka b72810583e Issue #27213: Fixed different issues with reworked CALL_FUNCTION* opcodes.
* BUILD_TUPLE_UNPACK and BUILD_MAP_UNPACK_WITH_CALL no longer generated with
  single tuple or dict.
* Restored more informative error messages for incorrect var-positional and
  var-keyword arguments.
* Removed code duplications in _PyEval_EvalCodeWithName().
* Removed redundant runtime checks and parameters in _PyStack_AsDict().
* Added a workaround and enabled previously disabled test in test_traceback.
* Removed dead code from the dis module.
2016-09-12 00:52:40 +03:00
Eric V. Smith 451d0e38fc Issue 27948: Allow backslashes in the literal string portion of f-strings, but not in the expressions. Also, require expressions to begin and end with literal curly braces. 2016-09-09 21:56:20 -04:00
Victor Stinner f9b760f48a Rework CALL_FUNCTION* opcodes
Issue #27213: Rework CALL_FUNCTION* opcodes to produce shorter and more
efficient bytecode:

* CALL_FUNCTION now only accepts position arguments
* CALL_FUNCTION_KW accepts position arguments and keyword arguments, but keys
  of keyword arguments are packed into a constant tuple.
* CALL_FUNCTION_EX is the most generic, it expects a tuple and a dict for
  positional and keyword arguments.

CALL_FUNCTION_VAR and CALL_FUNCTION_VAR_KW opcodes have been removed.

2 tests of test_traceback are currently broken: skip test, the issue #28050 was
created to track the issue.

Patch by Demur Rumed, design by Serhiy Storchaka, reviewed by Serhiy Storchaka
and Victor Stinner.
2016-09-09 10:17:08 -07:00
Eric V. Smith 1b8f7b818f Issue 27921: Remove backslash from another f-string. I'll revert this change before beta 2. 2016-09-03 11:01:53 -04:00
Nick Coghlan d00342347e Issue #26823: Abbreviate recursive tracebacks
Large sections of repeated lines in tracebacks are now abbreviated as
"[Previous line repeated {count} more times]" by both the traceback
module and the builtin traceback rendering.

Patch by Emanuel Barry.
2016-08-15 13:11:34 +10:00
Serhiy Storchaka bae75cf3fe Issue #19527: Fixed tests with defined COUNT_ALLOCS. 2016-07-03 22:30:49 +03:00
Serhiy Storchaka a793037d80 Issue #19527: Fixed tests with defined COUNT_ALLOCS. 2016-07-03 22:27:26 +03:00
Martin Panter 614827c149 Additional grammar fix 2016-04-19 04:05:59 +00:00
Victor Stinner 51d8c526d5 Replace noop constant statement with expression
* Constant statements will be ignored and the compiler will emit a
  SyntaxWarning.
* Replace constant statement (ex: "1") with an expression statement
  (ex: "x=1").
* test_traceback: use context manager on the file.

Issue #26204.
2016-02-08 17:57:02 +01:00
Serhiy Storchaka 3066fc41d1 Issue #25111: Fixed comparison of traceback.FrameSummary. 2015-09-29 22:33:36 +03:00
Serhiy Storchaka e953ba794c Issue #25108: Omitted internal frames in traceback functions print_stack(),
format_stack(), and extract_stack() called without arguments.
2015-09-18 10:04:47 +03:00
Berker Peksag c3f417dc47 Issue #24695: Fix a regression in traceback.print_exception()
If exc_traceback is None we shouldn't print a traceback header
like described in the documentation.
2015-07-24 17:36:21 +03:00
Berker Peksag ce643913a9 Issue #9517: Move script_helper to the support package.
Patch by Christie Wilson.
2015-05-06 06:33:17 +03:00
Serhiy Storchaka 24559e4834 Issue #22619: Added negative limit support in the traceback module.
Based on patch by Dmitry Kazakov.
2015-05-03 13:19:46 +03:00
Berker Peksag 716b3d3e91 Issue #23883: Add missing entries to traceback.__all__. 2015-04-08 09:47:14 +03:00
Robert Collins bbb8ade904 Issue #23631: Fix traceback.format_list when a traceback has been mutated. 2015-03-16 15:27:16 +13:00
Robert Collins d7c7e0ef69 Issue #22936: Make it possible to show local variables in tracebacks. 2015-03-05 20:28:52 +13:00
Robert Collins 07ff16733e Fix brownbag in issue 17911 commit 2015-03-05 12:26:00 +13:00
Robert Collins 6bc2c1e7eb Issue #17911: traceback module overhaul
Provide a way to seed the linecache for a PEP-302 module without actually
loading the code.

Provide a new object API for traceback, including the ability to not lookup
lines at all until the traceback is actually rendered, without any trace of the
original objects being kept alive.
2015-03-05 12:07:57 +13:00
Victor Stinner 9d279b87d8 (Merge 3.4) Issue #22599: Enhance tokenize.open() to be able to call it during
Python finalization.

Before the module kept a reference to the builtins module, but the module
attributes are cleared during Python finalization. Instead, keep directly a
reference to the open() function.

This enhancement is not perfect, calling tokenize.open() can still fail if
called very late during Python finalization.  Usually, the function is called
by the linecache module which is called to display a traceback or emit a
warning.
2014-12-05 10:18:30 +01:00
Serhiy Storchaka 521e5860a5 Issue #22032: __qualname__ instead of __name__ is now always used to format
fully qualified class names of Python implemented classes.
2014-07-22 15:00:37 +03:00
Serhiy Storchaka f28ba369dd Issue #20532: Tests which use _testcapi now are marked as CPython only. 2014-02-07 10:10:55 +02:00
Serhiy Storchaka 5cfc79deae Issue #20532: Tests which use _testcapi now are marked as CPython only. 2014-02-07 10:06:39 +02:00
Florent Xicluna 45e124e26d Issue #17825: Cursor ^ is correctly positioned for SyntaxError and IndentationError. 2014-01-22 01:16:25 +01:00
Florent Xicluna 758fa5ea81 Issue #17825: Cursor ^ is correctly positioned for SyntaxError and IndentationError. 2014-01-22 01:11:43 +01:00
Serhiy Storchaka 2bd59daf58 Issue #2382: SyntaxError cursor "^" now is written at correct position in most
cases when multibyte characters are in line (before "^").  This still not
works correctly with wide East Asian characters.
2014-01-21 22:29:47 +02:00
Serhiy Storchaka 65fd0592fb Issue #2382: SyntaxError cursor "^" now is written at correct position in most
cases when multibyte characters are in line (before "^").  This still not
works correctly with wide East Asian characters.
2014-01-21 22:26:52 +02:00
Serhiy Storchaka 5940b92909 Do not reset the line number because we already set file position to correct
value.

(fixes error in patch for issue #18960)
2014-01-09 20:13:52 +02:00
Serhiy Storchaka 1064a13bb0 Do not reset the line number because we already set file position to correct
value.

(fixes error in patch for issue #18960)
2014-01-09 20:12:49 +02:00
Andrew Kuchling 173a157e72 #1565525: Add traceback.clear_frames() helper function to clear locals ref'd by a traceback 2013-09-15 18:15:56 -04:00
Antoine Pitrou 58720d6145 Issue #17934: Add a clear() method to frame objects, to help clean up expensive details (local variables) and break reference cycles. 2013-08-05 23:26:40 +02:00
Benjamin Peterson d9fec15e9b refactor traceback.py to reduce code duplication (closes #17646)
Patch by Martin Morrison.
2013-04-29 16:09:39 -04:00
Nick Coghlan ab7bf2143e Close issue #6210: Implement PEP 409 2012-02-26 17:49:52 +10:00
Ezio Melotti b3aedd4862 #9424: Replace deprecated assert* methods in the Python test suite. 2010-11-20 19:04:17 +00:00
Benjamin Peterson a95e977e41 decrement offset when it points to a newline (#10186 followup) 2010-10-29 03:28:14 +00:00
Benjamin Peterson 503d6c5ae9 remove broken code accounting an offset the size of the line #10186 2010-10-24 02:52:05 +00:00
Benjamin Peterson 26d64aeee4 rewrite nocaret test to not rely on a specific SyntaxError 2010-09-20 21:47:37 +00:00
Ezio Melotti b58e0bd8bb use assert[Not]In where appropriate 2010-01-23 15:40:09 +00:00
Benjamin Peterson 577473fe68 use assert[Not]In where appropriate
A patch from Dave Malcolm.
2010-01-19 00:09:57 +00:00
Antoine Pitrou 7b0d4a238f Issue #4486: When an exception has an explicit cause, do not print its implicit context too. 2009-11-28 16:12:28 +00:00
Benjamin Peterson c9c0f201fe convert old fail* assertions to assert* 2009-06-30 23:06:06 +00:00
Georg Brandl 751899a59f Merged revisions 73232 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r73232 | georg.brandl | 2009-06-04 20:59:58 +0200 (Do, 04 Jun 2009) | 1 line

  Add test for #3684.
........
2009-06-04 19:41:00 +00:00
Georg Brandl 236f7979ba Merged revisions 71237-71238 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r71237 | georg.brandl | 2009-04-05 16:24:52 +0200 (So, 05 Apr 2009) | 1 line

  #1326077: fix traceback formatting of SyntaxErrors.  This fixes two differences with formatting coming from Python: a) the reproduction of location details in the error message if no line text is given, b) the prefixing of the last line by one space.
........
  r71238 | georg.brandl | 2009-04-05 16:25:41 +0200 (So, 05 Apr 2009) | 1 line

  Add NEWS entry for r71237.
........
2009-04-05 14:28:42 +00:00
Amaury Forgeot d'Arc cf8016a8d6 Issues #2384 and #3975: Tracebacks were not correctly printed when the source file
contains a ``coding:`` header: the wrong line was displayed, and the encoding was not respected.

Patch by Victor Stinner.
2008-10-09 23:37:48 +00:00