Skip to content

Commit

Permalink
Raise an error on carriage return in multi-line basic string
Browse files Browse the repository at this point in the history
  • Loading branch information
hukkin committed Jul 30, 2021
1 parent 1b35b36 commit 8b8be54
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Changelog

## **unreleased**

- Fixed
- Raise an error if a carriage return (without a following line feed) is found in a multi-line basic string

## 1.2.0

- Deprecated
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
s="""cr is not an allowed line endingbut we just tried to use it
"""
Expand Down
4 changes: 2 additions & 2 deletions tomli/_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@
# Neither of these sets include quotation mark or backslash. They are
# currently handled as separate cases in the parser functions.
ILLEGAL_BASIC_STR_CHARS = ASCII_CTRL - frozenset("\t")
ILLEGAL_MULTILINE_BASIC_STR_CHARS = ASCII_CTRL - frozenset("\t\n\r")
ILLEGAL_MULTILINE_BASIC_STR_CHARS = ASCII_CTRL - frozenset("\t\n")

ILLEGAL_LITERAL_STR_CHARS = ILLEGAL_BASIC_STR_CHARS
ILLEGAL_MULTILINE_LITERAL_STR_CHARS = ASCII_CTRL - frozenset("\t\n")
ILLEGAL_MULTILINE_LITERAL_STR_CHARS = ILLEGAL_MULTILINE_BASIC_STR_CHARS

ILLEGAL_COMMENT_CHARS = ILLEGAL_BASIC_STR_CHARS

Expand Down

0 comments on commit 8b8be54

Please sign in to comment.