Skip to content

Commit

Permalink
Merge branch 'master' into stop-writing-title-twice
Browse files Browse the repository at this point in the history
  • Loading branch information
adiroiban committed Sep 22, 2021
2 parents 0e0f30b + f414111 commit b2bcd8c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
14 changes: 9 additions & 5 deletions src/towncrier/_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@
import pkg_resources

if sys.version_info >= (3, 6):
from tomli import load as _toml_load
import tomli
else:
from toml import load as _toml_load
tomli = None
import toml

from collections import OrderedDict

Expand Down Expand Up @@ -74,9 +75,12 @@ def load_config(directory):


def load_config_from_file(directory, config_file):

with io.open(config_file, "r", encoding="utf8") as conffile:
config = _toml_load(conffile)
if tomli:
with io.open(config_file, "rb") as conffile:
config = tomli.load(conffile)
else:
with io.open(config_file, "r", encoding="utf8", newline="") as conffile:
config = toml.load(conffile)

return parse_toml(directory, config)

Expand Down
1 change: 1 addition & 0 deletions src/towncrier/newsfragments/359.bugfix.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Disable universal newlines when reading TOML

0 comments on commit b2bcd8c

Please sign in to comment.