summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_fstring.py
Commit message (Collapse)AuthorAgeFilesLines
* [3.12] gh-105820: Fix tok_mode expression buffer in file & readline ↵Miss Islington (bot)2023-06-151-1/+14
| | | | | | | tokenizer (GH-105828) (#105832) (cherry picked from commit d382ad49157b3802fc5619f68d96810def517869) Co-authored-by: Lysandros Nikolaou <lisandrosnik@gmail.com>
* [3.12] gh-105800: Issue SyntaxWarning in f-strings for invalid escape ↵Miss Islington (bot)2023-06-151-0/+3
| | | | | | sequences (GH-105801) (#105806) Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
* [3.12] gh-105194: Fix format specifier escaped characters in f-strings ↵Miss Islington (bot)2023-06-021-0/+10
| | | | (GH-105231) (#105234)
* gh-102856: Allow comments inside multi-line f-string expresions (#104006)Cristián Maureira-Fredes2023-05-221-3/+38
|
* gh-104658: Fix location of unclosed quote error for multiline f-strings ↵Pablo Galindo Salgado2023-05-201-1/+15
| | | | (#104660)
* gh-104089: catch DeprecationWarning in `test_fstring` (#104137)sunmy20192023-05-041-5/+12
| | | Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
* gh-104016: Skip test for deeply neste f-strings on wasi (#104071)Pablo Galindo Salgado2023-05-011-3/+4
|
* gh-104016: Fixed off by 1 error in f string tokenizer (#104047)jx1242023-05-011-0/+16
| | | | | | Co-authored-by: sunmy2019 <59365878+sunmy2019@users.noreply.github.com> Co-authored-by: Ken Jin <kenjin@python.org> Co-authored-by: Pablo Galindo <pablogsal@gmail.com>
* gh-103656: Transfer f-string buffers to parser to avoid use-after-free ↵Lysandros Nikolaou2023-04-271-0/+14
| | | | | (GH-103896) Co-authored-by: Pablo Galindo <pablogsal@gmail.com>
* GH-103727: Avoid advancing tokenizer too far in f-string mode (GH-103775)Lysandros Nikolaou2023-04-241-6/+4
|
* GH-103718: Correctly cache and restore f-string buffers when needed (GH-103719)Lysandros Nikolaou2023-04-231-0/+5
|
* gh-102856: Skip test_mismatched_parens in WASI builds (#103633)Pablo Galindo Salgado2023-04-191-0/+2
|
* gh-102856: Initial implementation of PEP 701 (#102855)Pablo Galindo Salgado2023-04-191-74/+237
| | | | | | Co-authored-by: Lysandros Nikolaou <lisandrosnik@gmail.com> Co-authored-by: Batuhan Taskaya <isidentical@gmail.com> Co-authored-by: Marta Gómez Macías <mgmacias@google.com> Co-authored-by: sunmy2019 <59365878+sunmy2019@users.noreply.github.com>
* Fix typo in test_fstring.py (#101823)mjoerg2023-02-111-1/+1
|
* Fix typo in `test_fstring.py` (#101600)Ikko Eltociear Ashimine2023-02-091-1/+1
|
* gh-98401: Invalid escape sequences emits SyntaxWarning (#99011)Victor Stinner2022-11-031-1/+1
| | | | | | | | | | | | | | | | | | | | | | A backslash-character pair that is not a valid escape sequence now generates a SyntaxWarning, instead of DeprecationWarning. For example, re.compile("\d+\.\d+") now emits a SyntaxWarning ("\d" is an invalid escape sequence), use raw strings for regular expression: re.compile(r"\d+\.\d+"). In a future Python version, SyntaxError will eventually be raised, instead of SyntaxWarning. Octal escapes with value larger than 0o377 (ex: "\477"), deprecated in Python 3.11, now produce a SyntaxWarning, instead of DeprecationWarning. In a future Python version they will be eventually a SyntaxError. codecs.escape_decode() and codecs.unicode_escape_decode() are left unchanged: they still emit DeprecationWarning. * The parser only emits SyntaxWarning for Python 3.12 (feature version), and still emits DeprecationWarning on older Python versions. * Fix SyntaxWarning by using raw strings in Tools/c-analyzer/ and wasm_build.py.
* gh-94869: Fix the location in some expressions for multi-line f-string ast ↵Pablo Galindo Salgado2022-07-161-2/+31
| | | | nodes (#94895)
* gh-93418: Fix an assert when an f-string expression is followed by an '=', ↵Eric V. Smith2022-06-011-0/+1
| | | | but no closing brace. (gh-93419)
* gh-93283: Improve error message for f-string with invalid conversion ↵Serhiy Storchaka2022-05-311-11/+22
| | | | character (GH-93349)
* bpo-47129: Add more informative messages to f-string syntax errors (32127)Maciej Górski2022-03-281-11/+29
| | | | | | | | | | | | | * Add more informative messages to f-string syntax errors * 📜🤖 Added by blurb_it. * Fix whitespaces * Change error message * Remove the 'else' statement (as sugested in review) Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
* bpo-46762: Fix an assert failure in f-strings where > or < is the last ↵Eric V. Smith2022-02-161-0/+2
| | | | character if the f-string is missing a trailing right brace. (#31365)
* bpo-46503: Prevent an assert from firing when parsing some invalid \N ↵Eric V. Smith2022-01-251-0/+4
| | | | | | | sequences in f-strings. (GH-30865) * bpo-46503: Prevent an assert from firing. Also fix one nearby tiny PEP-7 nit. * Added blurb.
* bpo-45727: Only trigger the 'did you forgot a comma' error suggestion if ↵Pablo Galindo Salgado2021-11-241-1/+1
| | | | inside parentheses (GH-29757)
* bpo-44885: Correct the ast locations of f-strings with format specs and ↵Pablo Galindo Salgado2021-08-121-11/+29
| | | | repeated expressions (GH-27729)
* bpo-43797: Improve syntax error for invalid comparisons (#25317)Pablo Galindo2021-04-121-3/+3
| | | | | | | | | | | | | * bpo-43797: Improve syntax error for invalid comparisons * Update Lib/test/test_fstring.py Co-authored-by: Guido van Rossum <gvanrossum@gmail.com> * Apply review comments * can't -> cannot Co-authored-by: Guido van Rossum <gvanrossum@gmail.com>
* bpo-43651: PEP 597: Fix EncodingWarning in some tests (GH-25171)Inada Naoki2021-04-041-1/+1
| | | | | | | | | | | * Fix test_float * Fix _osx_support * Fix test_fstring * Fix test_gc * Fix test_gzip * Fix test_hashlib * Fix unrelated whitespace issue Co-authored-by: Ned Deily <nad@python.org>
* bpo-41064: Improve syntax error for invalid usage of '**' in f-strings ↵Pablo Galindo2021-03-241-0/+9
| | | | (GH-25006)
* bpo-42986: Fix parser crash when reporting syntax errors in f-string with ↵Pablo Galindo2021-01-311-0/+3
| | | | newlines (GH-24279)
* bpo-40176: Improve error messages for unclosed string literals (GH-19346)Batuhan Taskaya2021-01-201-1/+1
| | | Automerge-Triggered-By: GH:isidentical
* bpo-42806: Fix ast locations of f-strings inside parentheses (GH-24067)Pablo Galindo2021-01-031-0/+53
|
* Fixed mistake in test for f-string error description (GH-22036) (GH-22059)han-solo2020-09-021-1/+1
|
* bpo-41681: Fix for `f-string/str.format` error description when using 2 `,` ↵han-solo2020-09-011-0/+20
| | | | | | | in format specifier (GH-22036) * Fixed `f-string/str.format` error description when using two `,` in format specifier. Co-authored-by: millefalcon <hanish0019@hmail.com>
* bpo-40275: Use new test.support helper submodules in tests (GH-21315)Hai Shi2020-07-061-1/+1
|
* bpo-41084: Adjust message when an f-string expression causes a SyntaxError ↵Lysandros Nikolaou2020-06-261-3/+7
| | | | | (GH-21084) Prefix the error message with `fstring: `, when parsing an f-string expression throws a `SyntaxError`.
* bpo-41069: Make TESTFN and the CWD for tests containing non-ascii ↵Serhiy Storchaka2020-06-251-2/+3
| | | | characters. (GH-21035)
* bpo-40939: Remove the old parser (GH-20768)Pablo Galindo2020-06-111-2/+1
| | | 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.
* bpo-40904: Fix segfault in the new parser with f-string containing yield ↵Pablo Galindo2020-06-081-0/+2
| | | | statements with no value (GH-20701)
* bpo-38964: Print correct filename on a SyntaxError in an fstring (GH-20399)Lysandros Nikolaou2020-05-261-0/+13
| | | | | | | | 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>
* 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.