From f29aedc65c14da43ca619cd2c41f7e5d47876b70 Mon Sep 17 00:00:00 2001 From: Frost Ming Date: Thu, 22 Mar 2018 20:46:13 +0800 Subject: [PATCH] fix reference losing for _pipfile --- pipenv/patched/contoml/file/file.py | 12 ++++++++++++ pipenv/project.py | 2 +- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/pipenv/patched/contoml/file/file.py b/pipenv/patched/contoml/file/file.py index 99ce1483..27001fc3 100755 --- a/pipenv/patched/contoml/file/file.py +++ b/pipenv/patched/contoml/file/file.py @@ -271,6 +271,18 @@ class TOMLFile: def elements(self): return self._elements + _marker = object() + + def pop(self, item, default=_marker): + """Pops an item and return the value""" + if item in self: + rv = self[item] + del self[item] + return rv + if default is self._marker: + raise KeyError(item) + return default + def __str__(self): is_empty = (not self['']) and (not tuple(k for k in self.keys() if k)) diff --git a/pipenv/project.py b/pipenv/project.py index 001652fe..0e6cb6ba 100644 --- a/pipenv/project.py +++ b/pipenv/project.py @@ -377,7 +377,7 @@ class Project(object): # mutation time! self.clear_pipfile_cache() for section in ('packages', 'dev-packages'): - p_section = dict(pfile.get(section, {})) + p_section = pfile.get(section, {}) for key in list(p_section.keys()): # Normalize key name to PEP 423. norm_key = pep423_name(key)