Skip to content

v8.1.3

Choose a tag to compare

@kkozik-amplify kkozik-amplify released this 26 Aug 13:02
· 4 commits to main since this release
1874eb7

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.typed marker so type checkers recognize hcl2 (and cli) 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_quotes no longer unquotes string literals nested inside expressions, which produced invalid HCL such as ${upper(x)} from upper("x"). Thanks, @livingstaccato (#313)
  • strip_string_quotes now 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 \r acting as part of a line ending is ignored, so a CRLF file reconstructs with LF endings; a \r that 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 <<MARKER and <<-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=False combined with strip_string_quotes now 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 without strip_string_quotes. (#324)

Full Changelog: v8.1.2...v8.1.3