summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_exceptions.py
Commit message (Collapse)AuthorAgeFilesLines
* bpo-40275: Use new test.support helper submodules in tests (GH-21448)Hai Shi2020-08-031-3/+6
|
* bpo-40334: Produce better error messages on invalid targets (GH-20106)Lysandros Nikolaou2020-06-181-1/+1
| | | | | | | | | | | | | | The following error messages get produced: - `cannot delete ...` for invalid `del` targets - `... is an illegal 'for' target` for invalid targets in for statements - `... is an illegal 'with' target` for invalid targets in with statements Additionally, a few `cut`s were added in various places before the invocation of the `invalid_*` rule, in order to speed things up. Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
* bpo-40939: Remove the old parser (GH-20768)Pablo Galindo2020-06-111-3/+3
| | | This commit removes the old parser, the deprecated parser module, the old parser compatibility flags and environment variables and all associated support code and documentation.
* Use subTest in test_exceptions for better error reporting (GH-20140)Pablo Galindo2020-05-171-26/+29
|
* bpo-40619: Correctly handle error lines in programs without file mode (GH-20090)Pablo Galindo2020-05-141-0/+2
|
* bpo-40334: Always show the caret on SyntaxErrors (GH-20050)Lysandros Nikolaou2020-05-131-9/+6
| | | | | | | | | | | | | | This commit fixes SyntaxError locations when the caret is not displayed, by doing the following: - `col_number` always gets set to the location of the offending node/expr. When no caret is to be displayed, this gets achieved by setting the object holding the error line to None. - Introduce a new function `_PyPegen_raise_error_known_location`, which can be called, when an arbitrary `lineno`/`col_offset` needs to be passed. This function then gets used in the grammar (through some new macros and inline functions) so that SyntaxError locations of the new parser match that of the old.
* bpo-40334: Error message for invalid default args in function call (GH-19973)Lysandros Nikolaou2020-05-071-2/+2
| | | | | When parsing something like `f(g()=2)`, where the name of a default arg is not a NAME, but an arbitrary expression, a specialised error message is emitted.
* bpo-40334: Spacialized error message for invalid args after bare '*' (GH-19865)Lysandros Nikolaou2020-05-041-1/+1
| | | When parsing things like `def f(*): pass` the old parser used to output `SyntaxError: named arguments must follow bare *`, which the new parser wasn't able to do.
* bpo-40334: Improve column offsets for thrown syntax errors by Pegen (GH-19782)Batuhan Taskaya2020-05-011-21/+21
|
* bpo-40334: Rename PyConfig.use_peg to _use_peg_parser (GH-19670)Victor Stinner2020-04-231-1/+1
| | | | | | | | | | | * Rename PyConfig.use_peg to _use_peg_parser * Document PyConfig._use_peg_parser and mark it a deprecated * Mark -X oldparser option and PYTHONOLDPARSER env var as deprecated in the documentation. * Add use_old_parser() and skip_if_new_parser() to test.support * Remove sys.flags.use_peg: use_old_parser() uses _testinternalcapi.get_configs() instead. * Enhance test_embed tests * subprocess._args_from_interpreter_flags() copies -X oldparser
* bpo-40334: PEP 617 implementation: New PEG parser for CPython (GH-19503)Pablo Galindo2020-04-221-0/+1
| | | | Co-authored-by: Guido van Rossum <guido@python.org> Co-authored-by: Lysandros Nikolaou <lisandrosnik@gmail.com>
* bpo-40335: Correctly handle multi-line strings in tokenize error scenarios ↵Pablo Galindo2020-04-211-1/+11
| | | | | (GH-19619) Co-authored-by: Guido van Rossum <gvanrossum@gmail.com>
* bpo-39947: Move get_recursion_depth() to _testinternalcapi (GH-18974)Victor Stinner2020-03-131-1/+1
| | | | | Move get_recursion_depth() function from _testcapi to _testinternalcapi to avoid accessing PyThreadState attributes directly in _testcapi.
* bpo-39882: Py_FatalError() logs the function name (GH-18819)Victor Stinner2020-03-061-2/+3
| | | | | | | | | | | | The Py_FatalError() function is replaced with a macro which logs automatically the name of the current function, unless the Py_LIMITED_API macro is defined. Changes: * Add _Py_FatalErrorFunc() function. * Remove the function name from the message of Py_FatalError() calls which included the function name. * Update tests.
* bpo-39219: Fix SyntaxError attributes in the tokenizer. (GH-17828)Serhiy Storchaka2020-02-121-1/+13
| | | | * Always set the text attribute. * Correct the offset attribute for non-ascii sources.
* bpo-34880: Add the LOAD_ASSERTION_ERROR opcode. (GH-15073)Zackery Spytz2019-08-251-0/+16
| | | | Fix assert statement misbehavior if AssertionError is shadowed.
* Remove unused imports in tests (GH-14518)Victor Stinner2019-07-011-1/+1
|
* bpo-36829: Add test.support.catch_unraisable_exception() (GH-13490)Victor Stinner2019-05-221-22/+8
| | | | | | * Copy test_exceptions.test_unraisable() to test_sys.UnraisableHookTest(). * Use catch_unraisable_exception() in test_coroutines, test_exceptions, test_generators.
* bpo-31241: Fix AST node position for list and generator comprehensions. ↵Serhiy Storchaka2018-11-271-1/+1
| | | | | | | | (GH-10633) The lineno and col_offset attributes of AST nodes for list comprehensions, generator expressions and tuples are now point to the opening parenthesis or square brace. For tuples without parenthesis they point to the position of the first item.
* bpo-34683: Make SyntaxError column offsets consistently 1-indexed (gh-9338)Ammar Askar2018-09-241-0/+39
| | | | | | Also point to start of tokens in parsing errors. Fixes bpo-34683
* bpo-32489: Allow 'continue' in 'finally' clause. (GH-5822)Serhiy Storchaka2018-03-181-9/+0
|
* Fix miscellaneous typos (#4275)luzpaz2017-11-051-1/+1
|
* bpo-30697: Fix PyErr_NormalizeException() when no memory (GH-2327)xdegaye2017-10-261-2/+101
|
* bpo-30817: Fix PyErr_PrintEx() when no memory (#2526)xdegaye2017-10-231-1/+18
|
* Move exc state to generator. Fixes bpo-25612 (#1773)Mark Shannon2017-10-221-0/+56
| | | Move exception state information from frame objects to coroutine (generator/thread) object where it belongs.
* bpo-31161: only check for parens error for SyntaxError (#3082)Martijn Pieters2017-08-221-0/+28
| | | | Subclasses such as IndentError and TabError should not have this message applied.
* bpo-29951: Include function name for some error messages in ↵Michael Seifert2017-04-091-1/+1
| | | | | | | `PyArg_ParseTuple*` (#916) Also changed format specifier for function name from "%s" to "%.200s" and exception messages should start with lowercase letter.
* bpo-29998: Pickling and copying ImportError now preserves name and path (#1010)Serhiy Storchaka2017-04-081-0/+20
| | | attributes.
* bpo-20548: Use specific asserts in warnings and exceptions tests (#788)Serhiy Storchaka2017-03-301-9/+9
|
* Issue #29507: Update test_exceptionsVictor Stinner2017-02-091-9/+2
| | | | | | | | | | | | | | | | test_unraisable() of test_exceptions expects that PyErr_WriteUnraisable(method) fails on repr(method). Before the previous change (7b8df4a5d81d), slot_tp_finalize() called PyErr_WriteUnraisable() with a PyMethodObject. In this case, repr(method) calls repr(self) which is BrokenRepr.__repr__() and the calls raises a new exception. After the previous change, slot_tp_finalize() uses an unbound method: repr() is called on a regular __del__() method which doesn't call repr(self). repr() doesn't fail anymore. PyErr_WriteUnraisable() doesn't call __repr__() anymore, so remove BrokenRepr unit test.
* Issue #28289: ImportError.__init__ now resets not specified attributes.Serhiy Storchaka2016-09-281-0/+14
|
* Issue #21578: Fixed misleading error message when ImportError called withSerhiy Storchaka2016-09-271-0/+16
|\ | | | | | | invalid keyword args.
| * Issue #21578: Fixed misleading error message when ImportError called withSerhiy Storchaka2016-09-271-0/+17
|/ | | | invalid keyword args.
* Issue #22836: Keep exception reports sensible despite errorsMartin Panter2016-02-281-2/+66
|
* Issue #23391: Merge OSError doc from 3.4 into 3.5Martin Panter2015-10-261-5/+12
|\
| * Issue #23391: Restore OSError constructor argument documentationMartin Panter2015-10-261-5/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This restores details lost in revision 097f4fda61a4 (since Python 3.3, related to the new OSError subclasses). Further additions: * Markup for attributes and constructor signature * Explain "winerror" and "filename2" * Extend test to check for filename2 defaulting to None * Clarify that the constructor can return a subclass I have intentionally left out any details of allowing more than five arguments, or how the "args" attribute is set for four or more arguments. These details seem to be dependent on the Python version and platform.
* | Add a rudimentary test for StopAsyncIteration in test_exceptions.Yury Selivanov2015-07-031-0/+2
| |
* | Issue #19235: Add new RecursionError exception. Patch by Georg Brandl.Yury Selivanov2015-07-031-6/+7
|/
* Issue #22977: Remove unconditional import of ctypes.Serhiy Storchaka2015-04-061-1/+0
|
* Issue #22977: Fix test_exceptionsVictor Stinner2015-04-021-5/+8
|
* Issue #22977: Fixed formatting Windows error messages on Wine.Serhiy Storchaka2015-04-021-1/+9
| | | | Patch by Martin Panter.
* Issue #23353: improve exceptions tests for generatorsAntoine Pitrou2015-03-181-0/+46
|
* make sure to test UnicodeEncodeError, tooBenjamin Peterson2014-04-021-1/+1
|
* bail in unicode error's __str__ methods if the objects are not properly ↵Benjamin Peterson2014-04-021-0/+6
| | | | initialized (closes #21134)
* make test name consistent with the rest of the fileBenjamin Peterson2014-04-021-1/+1
|
* Issue #20517: Functions in the os module that accept two filenamesLarry Hastings2014-02-101-2/+2
| | | | | | now register both filenames in the exception on failure. This required adding new C API functions allowing OSError exceptions to reference two filenames instead of one.
* Issue #20532: Tests which use _testcapi now are marked as CPython only.Serhiy Storchaka2014-02-071-0/+2
|\
| * Issue #20532: Tests which use _testcapi now are marked as CPython only.Serhiy Storchaka2014-02-071-0/+2
| |
| * Silence BytesWarning (backport 267a4d4d9d65).Serhiy Storchaka2014-02-061-5/+6
| |
* | Issue #2382: SyntaxError cursor "^" now is written at correct position in mostSerhiy Storchaka2014-01-211-0/+13
|\ \ | |/ | | | | | | cases when multibyte characters are in line (before "^"). This still not works correctly with wide East Asian characters.