v8.1.3
What's Changed
Several fixes below change the values loads() returns for input that already
parsed without error in 8.1.x — negative integer literals, both
strip_string_quotes behaviours, and the two heredoc body fixes. The previous
result was a bug in each case, so this stays a patch release; re-check your
expectations if you built around the old values.
Fixed
- Restore
py.typedmarker so type checkers recognizehcl2(andcli) as typed packages. (#299) - Parse heredocs with an empty body again. A marker immediately followed by its closing delimiter failed to match, and the lexer then ran on to a later delimiter, silently absorbing the attributes in between. Thanks, @livingstaccato (#312)
- Negative integer literals load as numbers again instead of
${-N}expression strings, matching negative floats and the pre-8.x behaviour. Thanks, @livingstaccato (#311) strip_string_quotesno longer unquotes string literals nested inside expressions, which produced invalid HCL such as${upper(x)}fromupper("x"). Thanks, @livingstaccato (#313)strip_string_quotesnow resolves escape sequences, so the values it yields match what the option documents. Escapes naming a codepoint outside the Unicode range, or a lone surrogate, are preserved verbatim rather than raising. Thanks, @livingstaccato (#313)- Parse files with CRLF (
\r\n) line endings, including heredocs. A\racting as part of a line ending is ignored, so a CRLF file reconstructs with LF endings; a\rthat is content — inside a quoted string or a heredoc body — is preserved. Thanks, @agu2347 (#317) - Flattened heredoc bodies keep their trailing blank lines and trailing spaces instead of being right-stripped away, for both
<<MARKERand<<-MARKER. The closing marker line's own indentation is still removed, and a blank line no longer cancels the<<-dedent. Thanks, @agu2347 (#318) - Parse heredocs whose delimiter is a single character, such as
<<E. The spec defines the delimiter as an Identifier, which permits one character. (#323) preserve_heredocs=Falsecombined withstrip_string_quotesnow returns the heredoc body as a plain multi-line string instead of escaping every newline to a literal\n. The escaping is still applied to the quoted source form produced withoutstrip_string_quotes. (#324)
Full Changelog: v8.1.2...v8.1.3