diff --git a/news/toml.vendor.rst b/news/toml.vendor.rst new file mode 100644 index 000000000..566c104f8 --- /dev/null +++ b/news/toml.vendor.rst @@ -0,0 +1 @@ +Upgrade toml to 0.10.2 diff --git a/src/pip/_vendor/toml/__init__.py b/src/pip/_vendor/toml/__init__.py index 7a08fe725..34a5eabb6 100644 --- a/src/pip/_vendor/toml/__init__.py +++ b/src/pip/_vendor/toml/__init__.py @@ -6,7 +6,7 @@ Released under the MIT license. from pip._vendor.toml import encoder from pip._vendor.toml import decoder -__version__ = "0.10.1" +__version__ = "0.10.2" _spec_ = "0.5.0" load = decoder.load diff --git a/src/pip/_vendor/toml/common.py b/src/pip/_vendor/toml/common.py deleted file mode 100644 index a5d673dac..000000000 --- a/src/pip/_vendor/toml/common.py +++ /dev/null @@ -1,6 +0,0 @@ -# content after the \ -escapes = ['0', 'b', 'f', 'n', 'r', 't', '"'] -# What it should be replaced by -escapedchars = ['\0', '\b', '\f', '\n', '\r', '\t', '\"'] -# Used for substitution -escape_to_escapedchars = dict(zip(_escapes, _escapedchars)) diff --git a/src/pip/_vendor/toml/decoder.py b/src/pip/_vendor/toml/decoder.py index e4887770c..e071100de 100644 --- a/src/pip/_vendor/toml/decoder.py +++ b/src/pip/_vendor/toml/decoder.py @@ -440,7 +440,8 @@ def loads(s, _dict=dict, decoder=None): groups[i][0] == "'"): groupstr = groups[i] j = i + 1 - while not groupstr[0] == groupstr[-1]: + while ((not groupstr[0] == groupstr[-1]) or + len(groupstr) == 1): j += 1 if j > len(groups) + 2: raise TomlDecodeError("Invalid group name '" + @@ -811,8 +812,12 @@ class TomlDecoder(object): raise ValueError("Empty value is invalid") if v == 'true': return (True, "bool") + elif v.lower() == 'true': + raise ValueError("Only all lowercase booleans allowed") elif v == 'false': return (False, "bool") + elif v.lower() == 'false': + raise ValueError("Only all lowercase booleans allowed") elif v[0] == '"' or v[0] == "'": quotechar = v[0] testv = v[1:].split(quotechar) diff --git a/src/pip/_vendor/toml/encoder.py b/src/pip/_vendor/toml/encoder.py index a8b03c7be..7fb94da98 100644 --- a/src/pip/_vendor/toml/encoder.py +++ b/src/pip/_vendor/toml/encoder.py @@ -61,7 +61,7 @@ def dumps(o, encoder=None): retval += addtoretval outer_objs = [id(o)] while sections: - section_ids = [id(section) for section in sections] + section_ids = [id(section) for section in sections.values()] for outer_obj in outer_objs: if outer_obj in section_ids: raise ValueError("Circular reference detected") diff --git a/src/pip/_vendor/toml/tz.py b/src/pip/_vendor/toml/tz.py index 93c3c8ad2..bf20593a2 100644 --- a/src/pip/_vendor/toml/tz.py +++ b/src/pip/_vendor/toml/tz.py @@ -11,6 +11,9 @@ class TomlTz(tzinfo): self._hours = int(self._raw_offset[1:3]) self._minutes = int(self._raw_offset[4:6]) + def __deepcopy__(self, memo): + return self.__class__(self._raw_offset) + def tzname(self, dt): return "UTC" + self._raw_offset diff --git a/src/pip/_vendor/vendor.txt b/src/pip/_vendor/vendor.txt index 468107bb6..21614a5e6 100644 --- a/src/pip/_vendor/vendor.txt +++ b/src/pip/_vendor/vendor.txt @@ -20,5 +20,5 @@ resolvelib==0.5.2 retrying==1.3.3 setuptools==44.0.0 six==1.15.0 -toml==0.10.1 +toml==0.10.2 webencodings==0.5.1