summaryrefslogtreecommitdiffstats
path: root/Parser
Commit message (Collapse)AuthorAgeFilesLines
* bpo-46237: Fix the line number of tokenizer errors inside f-strings (GH-30463)Miss Islington (bot)2022-01-112-5/+8
| | | | | (cherry picked from commit 6fa8b2ceee38187b0ae96aee12fe4f0a5c8a2ce7) Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
* bpo-46289: Make conversion of FormattedValue not optional on ASDL (GH-30467)Miss Islington (bot)2022-01-071-1/+1
| | | | | | Automerge-Triggered-By: GH:isidentical (cherry picked from commit d382f7ee0b98e4ab6ade9384268f25c06be462ad) Co-authored-by: Batuhan Taskaya <batuhan@python.org>
* bpo-42918: Improve built-in function compile() in mode 'single' (GH-29934) ↵Miss Islington (bot)2021-12-271-19/+1
| | | | | | | | (GH-30040) Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com> (cherry picked from commit 28179aac796ed1debdce336c4b8ca18e8475d40d) Co-authored-by: Weipeng Hong <hongweichen8888@sina.com>
* [3.10] bpo-46110: Add a recursion check to avoid stack overflow in the PEG ↵Pablo Galindo Salgado2021-12-202-3069/+4403
| | | | | | | | parser (GH-30177) (GH-30214) Co-authored-by: Batuhan Taskaya <isidentical@gmail.com>. (cherry picked from commit e9898bf153d26059261ffef11f7643ae991e2a4c) Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
* bpo-46054: Fix parsing error when parsing non-utf8 characters in source ↵Miss Islington (bot)2021-12-121-8/+5
| | | | | | | | | files (GH-30068) (GH-30069) (cherry picked from commit 4325a766f5f603ef6dfb8c4d5798e5e73cb5efd5) Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com> Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
* [3.10] bpo-46004: Fix error location for loops with invalid targets ↵Pablo Galindo Salgado2021-12-071-1/+2
| | | | | | | (GH-29959). (GH-29961) (cherry picked from commit 1c7a1c3be08ee911d347fffd2716f3911ba751f9) Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
* bpo-45866: pegen strips directory of "generated from" header (GH-29777) ↵Victor Stinner2021-11-261-1/+1
| | | | | | | | | (GH-29792) "make regen-all" now produces the same output when run from a directory other than the source tree: when building Python out of the source tree. (cherry picked from commit 253b7a0a9fef1d72a4cb87b837885576e68e917c)
* [3.10] bpo-45727: Only trigger the 'did you forgot a comma' error suggestion ↵Pablo Galindo Salgado2021-11-254-4/+7
| | | | | | | if inside parentheses. (GH-29767) Backport of GH-29757 Co-authored-by: Pablo Galindo <pablogsal@gmail.com>
* [3.10] Ensure the str member of the tokenizer is always initialised ↵Pablo Galindo Salgado2021-11-214-3/+428
| | | | | | | (GH-29681). (GH-29683) (cherry picked from commit 4f006a789a35f5d1a7ef142bd1304ce167392457) Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
* bpo-45494: Fix error location in EOF tokenizer errors (GH-29108)Miss Islington (bot)2021-11-201-2/+7
| | | | | (cherry picked from commit 79ff0d1687e3f823fb121a19f0297ad052871b1b) Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
* [3.10] bpo-45727: Make the syntax error for missing comma more consistent ↵Pablo Galindo Salgado2021-11-202-328/+263
| | | | | | | (GH-29427) (GH-29647) (cherry picked from commit 546cefcda75d7150b55c8bc1724bea35a1e12890) Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
* [3.10] bpo-45848: Allow the parser to get error lines from encoded files ↵Łukasz Langa2021-11-201-7/+8
| | | | | | | (GH-29646) (GH-29661) (cherry picked from commit fdcc46d9554094994f78bedf6dc9220e5d5ee668) Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
* bpo-45820: Fix a segfault when the parser fails without reading any input ↵Miss Islington (bot)2021-11-171-0/+8
| | | | | | | (GH-29580) (cherry picked from commit df4ae55e66e34ea8de6a34f0b104871ddaf35d53) Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
* [3.10] bpo-45822: Respect PEP 263's coding cookies in the parser even if ↵Pablo Galindo Salgado2021-11-171-1/+1
| | | | | | | flags are not provided (GH-29582) (GH-29586) (cherry picked from commit da20d7401de97b425897d3069f71f77b039eb16f) Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
* [3.10] bpo-45716: Improve the error message when using True/False/None as ↵Pablo Galindo Salgado2021-11-161-572/+678
| | | | | | | keywords in a call (GH-29413). (GH-29428) (cherry picked from commit e2d65630f36712dbdbf7711520c985c526a5cc25) Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
* bpo-45738: Fix computation of error location for invalid continuation (GH-29550)Miss Islington (bot)2021-11-142-11/+5
| | | | | | characters in the parser (cherry picked from commit 25835c518aa7446f3680b62c1fb43827e0f190d9) Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
* [3.10] bpo-44257: fix "assigment_expr" typo + regenerate the grammar, and ↵Pablo Galindo Salgado2021-11-041-60/+60
| | | | | | | | remove unused imports (GH-29393) (GH-29395) Co-authored-by: Wim Glenn <wglenn@jumptrading.com>. (cherry picked from commit 762173c6709f5cf3b59cbbe47d4e6fafbfe7ec2a) Co-authored-by: wim glenn <wim.glenn@gmail.com>
* bpo-45562: Ensure all tokenizer debug messages are printed to stderr (GH-29270)Miss Islington (bot)2021-10-291-1/+1
| | | | | (cherry picked from commit cdc7a5827754bec83970bb052d410d55f85b3fff) Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
* bpo-45562: Print tokenizer debug messages to stderr (GH-29250) (GH-29252)Miss Islington (bot)2021-10-271-4/+4
| | | | | | | (cherry picked from commit 10bbd41ba8c88bc102df108a4e0444abc7c5ea43) Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com> Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
* bpo-45574: fix warning about `print_escape` being unused (GH-29172) (#29176)Miss Islington (bot)2021-10-231-0/+2
| | | | | | | | | | | | | | | | It used to be like this: <img width="1232" alt="Снимок экрана 2021-10-22 в 23 07 40" src="https://user-images.githubusercontent.com/4660275/138516608-fef6ec01-a96a-40f4-81ef-52265b0f536b.png"> Quick `grep` tells that it is just used in one place under `Py_DEBUG`: https://github.com/python/cpython/blame/f6e8b80d20159596cf641305bad3a833bedd2f4f/Parser/tokenizer.cGH-L1047-L1051 <img width="752" alt="Снимок экрана 2021-10-22 в 23 08 09" src="https://user-images.githubusercontent.com/4660275/138516684-ea503136-1e92-48a5-95bb-419e190d5866.png"> I am not sure, but it also looks like a private thing, it should not affect other users. Automerge-Triggered-By: GH:pablogsal (cherry picked from commit 4bc5473a42c5eae0928430930b897209492e849d) Co-authored-by: Nikita Sobolev <mail@sobolevn.me> Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
* bpo-45562: Only show debug output from the parser in debug builds (GH-29140) ↵Miss Islington (bot)2021-10-221-0/+2
| | | | | | | | | (#29149) (cherry picked from commit 86dfb55d2e091cf633dbd7aabcd49d96fb1f9d81) Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com> Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
* [3.10] bpo-45494: Fix parser crash when reporting errors involving invalid ↵Łukasz Langa2021-10-192-122/+130
| | | | | | | | | | | | | | | continuation characters (GH-28993) (GH-29070) There are two errors that this commit fixes: * The parser was not correctly computing the offset and the string source for E_LINECONT errors due to the incorrect usage of strtok(). * The parser was not correctly unwinding the call stack when a tokenizer exception happened in rules involving optionals ('?', [...]) as we always make them return valid results by using the comma operator. We need to check first if we don't have an error before continuing.. (cherry picked from commit a106343f632a99c8ebb0136fa140cf189b4a6a57) Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
* [3.10] bpo-45461: Fix IncrementalDecoder and StreamReader in the ↵Miss Islington (bot)2021-10-141-1/+1
| | | | | | | | | | | | "unicode-escape" codec (GH-28939) (GH-28943) They support now splitting escape sequences between input chunks. Add the third parameter "final" in codecs.unicode_escape_decode(). It is True by default to match the former behavior. (cherry picked from commit c96d1546b11b4c282a7e21737cb1f5d16349656d) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
* [3.10] bpo-45408: Don't override previous tokenizer errors in the second ↵Pablo Galindo Salgado2021-10-071-1/+4
| | | | | | | parser pass (GH-28812). (GH-28813) (cherry picked from commit 0219017df7ec41839fd0d56a3076b5f09c58d313) Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
* [3.10] Fix typos in the Objects directory (GH-28766) (GH-28797)Christian Clauss2021-10-071-1/+1
| | | | | (cherry picked from commit 5f401f10400123afa9171548c432ea3fc37c0736) Automerge-Triggered-By: GH:JulienPalard
* [3.10] Remove trailing spaces (GH-28709)Serhiy Storchaka2021-10-031-1/+1
|
* bpo-43914: Correctly highlight SyntaxError exceptions for invalid generator ↵Miss Islington (bot)2021-09-273-6/+18
| | | | | | | expression in function calls (GH-28576) (cherry picked from commit e5f13ce5b48b551c09fdd0faeafa6ecf860de51c) Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
* bpo-44947: Refine the syntax error for trailing commas in import statements ↵Miss Islington (bot)2021-08-181-5/+8
| | | | | | | (GH-27814) (cherry picked from commit b2f68b190035540872072ac1d2349e7745e85596) Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
* [3.10] bpo-44885: Correct the ast locations of f-strings with format specs ↵Pablo Galindo Salgado2021-08-121-38/+30
| | | | | | | and repeated expressions (GH-27729) (GH-27743) (cherry picked from commit 8e832fb2a2cb54d7262148b6ec15563dffb48d63) Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
* [3.10] bpo-44838: Refine the custom syntax errors for invalid 'if' ↵Pablo Galindo Salgado2021-08-051-553/+610
| | | | | | | | | | | expressions (GH-27615). (GH-27616) … (cherry picked from commit f5cbea6b1b5fc39cca377c6cc93f222916015fc4) Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com> Automerge-Triggered-By: GH:lysnikolaou
* bpo-44792: Improve syntax errors for if expressions (GH-27506) (GH-27565)Miss Islington (bot)2021-08-021-0/+33
| | | | | (cherry picked from commit 28b6dc9dd5d1ce6f8aff7e06d4ef9afdc2bc8332) Co-authored-by: Miguel Brito <5544985+miguendes@users.noreply.github.com>
* bpo-34013: Don't consider a grouped expression when reporting legacy print ↵Miss Islington (bot)2021-08-011-5/+7
| | | | | | | syntax errors (GH-27521) (cherry picked from commit 208a7e957b812ad3b3733791845447677a704f3e) Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
* Update URLs in comments and metadata to use HTTPS (GH-27458) (GH-27478)Miss Islington (bot)2021-07-301-1/+1
| | | | | (cherry picked from commit be42c06bb01206209430f3ac08b72643dc7cad1c) Co-authored-by: Noah Kantrowitz <noah@coderanger.net>
* bpo-34013: Move the Python 2 hints from the exception constructor to the ↵Miss Islington (bot)2021-07-271-7/+7
| | | | | | | parser (GH-27392) (cherry picked from commit ecc3c8e4216958d85385bf2467441c975128f26c) Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
* [3.10] bpo-34013: Generalize the invalid legacy statement error message ↵Pablo Galindo Salgado2021-07-273-244/+323
| | | | | | | (GH-27389). (GH-27391) (cherry picked from commit 6948964ecf94e858448dd28eea634317226d2913) Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
* bpo-44317: Improve tokenizer errors with more informative locations ↵Miss Islington (bot)2021-07-101-18/+54
| | | | | | | (GH-26555) (GH-27079) (cherry picked from commit f24777c2b329974b69d2a3bf5cfc37e0fcace36c) Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
* bpo-44456: Improve the syntax error when mixing keyword and positional ↵Miss Islington (bot)2021-06-243-464/+638
| | | | | | | patterns (GH-26793) (cherry picked from commit 0acc258fe6f0ec200ca2f6f9294adbf52a244802) Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
* [3.10] bpo-44368: Improve syntax errors with invalid as pattern targets ↵Pablo Galindo2021-06-181-213/+313
| | | | | | | (GH-26632) (GH-26792) (cherry picked from commit 05073036dcecefc00b0c3e7397601809da41e2f1) Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
* bpo-44409: Fix error location in tokenizer errors that happen during ↵Miss Islington (bot)2021-06-141-0/+1
| | | | | | | initialization (GH-26712) (cherry picked from commit 507ed6fa1d6661e0f8e6d3282764aa9625a99594) Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
* bpo-44396: Update multi-line-start location when reallocating tokenizer ↵Miss Islington (bot)2021-06-121-0/+5
| | | | | | buffers (GH-26676) (GH-26695) Automerge-Triggered-By: GH:pablogsal (cherry picked from commit a342cc5891dbd8a08d40e9444f2e2c9e93258721)
* [3.10] Add more const modifiers. (GH-26691). (GH-26692)Serhiy Storchaka2021-06-123-15/+15
| | | | | (cherry picked from commit be8b631b7a587aa781245e14c8cca32970e1be5b) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
* bpo-44385: Remove unused grammar rules (GH-26655)Miss Islington (bot)2021-06-101-1256/+791
| | | | | | Automerge-Triggered-By: GH:lysnikolaou (cherry picked from commit e7b4644607789848f9752a3bd20ff216e25b4156) Co-authored-by: Lysandros Nikolaou <lisandrosnik@gmail.com>
* bpo-44368: Ensure we don't raise incorrect custom syntax errors with soft ↵Miss Islington (bot)2021-06-091-4/+11
| | | | | | | keywords (GH-26630) (cherry picked from commit 457ce60fc70f1c9290023f46fb82b6a490dff32e) Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
* bpo-44349: Fix edge case when displaying text from files with encoding in ↵Miss Islington (bot)2021-06-091-2/+5
| | | | | | | | | syntax errors (GH-26611) (GH-26616) (cherry picked from commit 9fd21f649d66dcb10108ee395fd68ed32c8239cd) Co-authored-by: Pablo Galindo <Pablogsal@gmail.com> Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
* bpo-43833: Emit warnings for numeric literals followed by keyword (GH-25466)Miss Islington (bot)2021-06-081-0/+128
| | | | | | | | | | | Emit a deprecation warning if the numeric literal is immediately followed by one of keywords: and, else, for, if, in, is, or. Raise a syntax error with more informative message if it is immediately followed by other keyword or identifier. Automerge-Triggered-By: GH:pablogsal (cherry picked from commit 2ea6d890281c415e0a2f00e63526e592da8ce3d9) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
* bpo-44335: Ensure the tokenizer doesn't go into Python with the error set ↵Miss Islington (bot)2021-06-081-3/+17
| | | | | | | (GH-26608) (cherry picked from commit bafe0aade5741ab0d13143ee261711fdd65e8a1f) Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
* bpo-44335: Fix a regression when identifying invalid characters in syntax ↵Miss Islington (bot)2021-06-081-1/+3
| | | | | | | errors (GH-26589) (cherry picked from commit d334c73b56756e90c33ce06e3a6ec23271aa099d) Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
* fix: use unambiguous punction in 'invalid escape sequence' message (GH-26582)Miss Islington (bot)2021-06-081-2/+2
| | | | | (cherry picked from commit ffd87b7093109c279caf8e3ca060f408a102388a) Co-authored-by: Ned Batchelder <ned@nedbatchelder.com>
* [3.10] bpo-44305: Improve syntax error for try blocks without except or ↵Pablo Galindo2021-06-031-269/+358
| | | | | | | finally (GH-26523) (GH-26524) (cherry picked from commit b250f89bb7e05e72a4641d44b988866b919575db) Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
* [3.10] bpo-44273: Improve syntax error message for assigning to "..." ↵Pablo Galindo2021-06-031-1/+1
| | | | | | | | | | (GH-26477) (GH-26478) Use "ellipsis" instead of "Ellipsis" in syntax error messages to eliminate confusion with built-in variable Ellipsis. (cherry picked from commit 39dd141) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com> Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>