Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
7529afce
Commit
7529afce
authored
Oct 30, 2010
by
Raymond Hettinger
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue 10221: Improve error message for dict.pop().
parent
6acd4324
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
2 deletions
+4
-2
Misc/NEWS
Misc/NEWS
+3
-0
Objects/dictobject.c
Objects/dictobject.c
+1
-2
No files found.
Misc/NEWS
View file @
7529afce
...
@@ -10,6 +10,9 @@ What's New in Python 3.1.3?
...
@@ -10,6 +10,9 @@ What's New in Python 3.1.3?
Core and Builtins
Core and Builtins
-----------------
-----------------
- Issue #10221: dict.pop(k) now has a key error message that includes the
missing key (same message d[k] returns for missing keys).
- Issue #5437: A preallocated MemoryError instance should not hold traceback
- Issue #5437: A preallocated MemoryError instance should not hold traceback
data (including local variables caught in the stack trace) alive infinitely.
data (including local variables caught in the stack trace) alive infinitely.
...
...
Objects/dictobject.c
View file @
7529afce
...
@@ -1810,8 +1810,7 @@ dict_pop(PyDictObject *mp, PyObject *args)
...
@@ -1810,8 +1810,7 @@ dict_pop(PyDictObject *mp, PyObject *args)
Py_INCREF
(
deflt
);
Py_INCREF
(
deflt
);
return
deflt
;
return
deflt
;
}
}
PyErr_SetString
(
PyExc_KeyError
,
set_key_error
(
key
);
"pop(): dictionary is empty"
);
return
NULL
;
return
NULL
;
}
}
if
(
!
PyUnicode_CheckExact
(
key
)
||
if
(
!
PyUnicode_CheckExact
(
key
)
||
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment