summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_fstring.py
Commit message (Collapse)AuthorAgeFilesLines
* bpo-46762: Fix an assert failure in f-strings where > or < is the last ↵Miss Islington (bot)2022-02-161-0/+2
| | | | | | | character if the f-string is missing a trailing right brace. (GH-31365) (cherry picked from commit ffd9f8ff84ed53c956b16d027f7d2926ea631051) Co-authored-by: Eric V. Smith <ericvsmith@users.noreply.github.com>
* bpo-46503: Prevent an assert from firing when parsing some invalid \N ↵Miss Islington (bot)2022-01-251-0/+4
| | | | | | | | | | | | sequences in f-strings. (GH-30865) (30867) * bpo-46503: Prevent an assert from firing. Also fix one nearby tiny PEP-7 nit. * Added blurb. (cherry picked from commit 0daf72194bd4e31de7f12020685bb39a14d6f45e) Co-authored-by: Eric V. Smith <ericvsmith@users.noreply.github.com> Co-authored-by: Eric V. Smith <ericvsmith@users.noreply.github.com>
* [3.9] Fix the test suite for the old parser (GH-27749)Pablo Galindo Salgado2021-08-131-0/+2
| | | Co-authored-by: Łukasz Langa <lukasz@langa.pl>
* [3.9] bpo-44885: Correct the ast locations of f-strings with format specs ↵Pablo Galindo Salgado2021-08-121-11/+29
| | | | | | | and repeated expressions (GH-27729) (GH-27744) (cherry picked from commit 8e832fb2a2cb54d7262148b6ec15563dffb48d63) Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
* [3.9] bpo-43272: Fix old parser test failures for backported grammar ↵Pablo Galindo2021-02-201-4/+4
| | | | constructs (GH-24591)
* [3.9] bpo-42806: Fix ast locations of f-strings inside parentheses ↵Pablo Galindo2021-01-031-0/+53
| | | | | | | (GH-24067) (GH-24069) (cherry picked from commit bd2728b1e8a99ba8f8c2d481f88aeb99b8b8360f) Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
* Fixed mistake in test for f-string error description (GH-22036) (GH-22059) ↵Miss Islington (bot)2020-09-021-1/+1
| | | | | | | | | (GH-22060) (cherry picked from commit 749ed85e4446f548e22934931241f644a33d81ce) Co-authored-by: han-solo <hanish0019@gmail.com> Co-authored-by: han-solo <hanish0019@gmail.com>
* bpo-41681: Fix for `f-string/str.format` error description when using 2 `,` ↵Miss Islington (bot)2020-09-011-0/+20
| | | | | | | | | | | | in format specifier (GH-22036) (GH-22041) * Fixed `f-string/str.format` error description when using two `,` in format specifier. Co-authored-by: millefalcon <hanish0019@hmail.com> (cherry picked from commit 0d6aa7f0ee38eb453bc8f73bf4830e6172be2f35) Co-authored-by: han-solo <hanish0019@gmail.com> Co-authored-by: han-solo <hanish0019@gmail.com>
* [3.9] bpo-41084: Fix test_fstring failure when using the old parser (GH-21212)Lysandros Nikolaou2020-06-291-4/+8
|
* bpo-41084: Adjust message when an f-string expression causes a SyntaxError ↵Miss Islington (bot)2020-06-271-3/+7
| | | | | | | | (GH-21084) Prefix the error message with `fstring: `, when parsing an f-string expression throws a `SyntaxError`. (cherry picked from commit 2e0a920e9eb540654c0bb2298143b00637dc5961) Co-authored-by: Lysandros Nikolaou <lisandrosnik@gmail.com>
* [3.9] bpo-41069: Make TESTFN and the CWD for tests containing non-ascii ↵Serhiy Storchaka2020-06-251-2/+3
| | | | | | characters. (GH-21035). (GH-21156) (cherry picked from commit 700cfa8c90a90016638bac13c4efd03786b2b2a0)
* bpo-40904: Fix segfault in the new parser with f-string containing yield ↵Miss Islington (bot)2020-06-081-0/+2
| | | | | | | statements with no value (GH-20701) (cherry picked from commit 972ab0327675e695373fc6272d5ac24e187579ad) Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
* [3.9] bpo-38964: Print correct filename on a SyntaxError in an fstring ↵Lysandros Nikolaou2020-05-261-1/+13
| | | | | | | | | | | (GH-20399) (GH-20404) When a `SyntaxError` in the expression part of a fstring is found, the filename attribute of the `SyntaxError` is always `<fstring>`. With this commit, it gets changed to always have the name of the file the fstring resides in. Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>. (cherry picked from commit f7b1e461567e5e3fa3ba46f589d9edc1b45b2dd0)
* bpo-40246: Fix test_fstring when run with the old parser (GH-20402)Lysandros Nikolaou2020-05-261-1/+7
|
* bpo-40593: Improve syntax errors for invalid characters in source code. ↵Serhiy Storchaka2020-05-121-1/+1
| | | | (GH-20033)
* bpo-40246: Revert reporting of invalid string prefixes (GH-19888)Lysandros Nikolaou2020-05-041-1/+1
| | | | Due to backwards compatibility concerns regarding keywords immediately followed by a string without whitespace between them (like in `bg="#d00" if clear else"#fca"`) will fail to parse, commit 41d5b94af44e34ac05d4cd57460ed104ccf96628 has to be reverted.
* bpo-40443: Remove unused imports in tests (GH-19804)Victor Stinner2020-04-301-2/+0
|
* bpo-40334: Fix shifting of nested f-strings in the new parser (GH-19771)Lysandros Nikolaou2020-04-291-2/+1
| | | `JoinedStr`s and `FormattedValue also needs to be shifted, in order to correctly compute the location information of nested f-strings.
* bpo-40334: Rename PyConfig.use_peg to _use_peg_parser (GH-19670)Victor Stinner2020-04-231-1/+2
| | | | | | | | | | | * 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-1/+3
| | | | Co-authored-by: Guido van Rossum <guido@python.org> Co-authored-by: Lysandros Nikolaou <lisandrosnik@gmail.com>
* bpo-40267: Fix message when last input character produces a SyntaxError ↵Lysandros Nikolaou2020-04-151-1/+1
| | | | | | | | (GH-19521) When there is a SyntaxError after reading the last input character from the tokenizer and if no newline follows it, the error message used to be `unexpected EOF while parsing`, which is wrong.
* Add double quote cases to invalid prefix tests (GH-19489)Pablo Galindo2020-04-131-4/+5
|
* bpo-40246: Report a better error message for invalid string prefixes (GH-19476)Lysandros Nikolaou2020-04-121-1/+1
|
* bpo-32912: Revert SyntaxWarning on invalid escape sequences. (GH-15195)Gregory P. Smith2019-08-101-1/+1
| | | | | | | | | | | | | | | | | | DeprecationWarning will continue to be emitted for invalid escape sequences in string and bytes literals just as it did in 3.7. SyntaxWarning may be emitted in the future. But per mailing list discussion, we don't yet know when because we haven't settled on how to do so in a non-disruptive manner. (Applies 4c5b6bac2408f879231c7cd38d67657dd4804e7c to the master branch). (This is https://github.com/python/cpython/pull/15142 for master/3.9) https://bugs.python.org/issue32912 Automerge-Triggered-By: @gpshead
* Fix typos in docs, comments and test assert messages (#14872)Min ho Kim2019-07-211-1/+1
|
* bpo-37050: Remove expr_text from FormattedValue ast node, use Constant node ↵Eric V. Smith2019-05-271-0/+18
| | | | | instead (GH-13597) When using the "=" debug functionality of f-strings, use another Constant node (or a merged constant node) instead of adding expr_text to the FormattedValue node.
* bpo-36817: Do not decrement reference for expr_text on fstring = parsing ↵Pablo Galindo2019-05-121-0/+2
| | | | failure (GH-13256)
* bpo-36817: Add f-string debugging using '='. (GH-13123)Eric V. Smith2019-05-081-0/+109
| | | If a "=" is specified a the end of an f-string expression, the f-string will evaluate to the text of the expression, followed by '=', followed by the repr of the value of the expression.
* bpo-16806: Fix `lineno` and `col_offset` for multi-line string tokens (GH-10021)Anthony Sottile2019-01-131-19/+13
|
* bpo-35494: Improve syntax error messages for unbalanced parentheses in ↵Serhiy Storchaka2019-01-121-13/+23
| | | | f-string. (GH-11161)
* bpo-33306: Improve SyntaxError messages for unbalanced parentheses. (GH-6516)Serhiy Storchaka2018-12-171-4/+8
|
* bpo-32912: Replace a DeprecationWarning with a SyntaxWarning (GH-9652)Serhiy Storchaka2018-10-191-1/+1
| | | | for invalid escape sequences in string and bytes literals.
* bpo-32892: Use ast.Constant instead of specific constant AST types. (GH-9445)Serhiy Storchaka2018-09-271-8/+16
|
* bpo-30465: Fix lineno and col_offset in fstring AST nodes (#1800)Łukasz Langa2017-09-071-0/+248
| | | For f-string ast nodes, fix the line and columns so that tools such as flake8 can identify them correctly.
* bpo-30682: Removed a too-strict assertion that failed for certain f-strings. ↵ericvsmith2017-06-161-0/+6
| | | | | | (#2232) This caused a segfault on eval("f'\\\n'") and eval("f'\\\r'") in debug build.
* bpo-30529: Fix errors for invalid whitespaces in f-string subexpressions. ↵Serhiy Storchaka2017-06-081-0/+10
| | | | | | | | (#1888) 'invalid character in identifier' now is raised instead of 'f-string: empty expression not allowed' if a subexpression contains only whitespaces and they are not accepted by Python parser.
* bpo-29104: Fixed parsing backslashes in f-strings. (#490)Serhiy Storchaka2017-05-251-0/+14
|
* Issue #28739: f-string expressions no longer accepted as docstrings andSerhiy Storchaka2016-12-111-10/+10
| | | | by ast.literal_eval() even if they do not include subexpressions.
* Fixed issue #28633: segfault when concatenating bytes literal and f-string.Eric V. Smith2016-11-071-0/+7
|
* Update test_no_escapes_for_braces to clarify behavior with a docstring and ↵Jason R. Coombs2016-11-061-5/+8
| | | | expressions that clearly are not evaluated.
* Additionally show that a backslash-escaped opening brace is treated as a ↵Jason R. Coombs2016-11-061-0/+1
| | | | literal and thus triggers the single closing brace error, clarifying #28590.
* Add an additional test with a newline, one that's very similar to ↵Jason R. Coombs2016-11-061-0/+1
| | | | test_parens_in_expressions, but because the newline is not a literal newline, but a backslash en, this error is triggered.
* Update the f-string test broken in issue #28385.Serhiy Storchaka2016-10-311-1/+1
|
* Add another f-string comment test, to make sure # are being caught in the ↵Eric V. Smith2016-09-111-0/+2
| | | | right place.
* Make an f-string error message more exact and consistent.Eric V. Smith2016-09-111-1/+2
|
* Issue 27948: Allow backslashes in the literal string portion of f-strings, ↵Eric V. Smith2016-09-101-46/+86
| | | | but not in the expressions. Also, require expressions to begin and end with literal curly braces.
* Closes issue 27921: Disallow backslashes anywhere in f-strings. This is a ↵Eric V. Smith2016-09-031-91/+51
| | | | temporary restriction. In 3.6 beta 2, the plan is to again allow backslashes in the string parts of f-strings, but disallow them in the expression parts.
* Issue #27626: Further spelling fixes for 3.6Martin Panter2016-07-281-1/+1
|
* Fix issue 26287: While handling FORMAT_VALUE opcode, the top of stack was ↵Eric V. Smith2016-02-051-0/+11
| | | | being corrupted if an error occurred in PyObject_Format().
* f-strings: More tests for empty expressions along with missing closing braces.Eric V. Smith2015-09-231-0/+7
|