fix reference losing for _pipfile

This commit is contained in:
Frost Ming
2018-03-22 20:46:13 +08:00
parent 58ba223448
commit f29aedc65c
2 changed files with 13 additions and 1 deletions
+12
View File
@@ -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))
+1 -1
View File
@@ -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)