[pypy-issue] Issue #2508: Dictionary pop (with default) fails with KeyError for some keys (pypy/pypy)

Jason Myers issues-reply at bitbucket.org
Tue Mar 21 12:30:40 EDT 2017


New issue 2508: Dictionary pop (with default) fails with KeyError for some keys
https://bitbucket.org/pypy/pypy/issues/2508/dictionary-pop-with-default-fails-with

Jason Myers:

Latest release (5.7.0) OSX binary

Seems to depend on the type of keys in the dictionary.

```
Python 2.7.13 (fa3249d55d15, Mar 19 2017, 19:48:32)
[PyPy 5.7.0 with GCC 4.2.1 Compatible Apple LLVM 5.1 (clang-503.0.40)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>>> {}.pop(None, None)
>>>> {1: 1}.pop(None, None)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
KeyError: None
>>>> {'a': 'a'}.pop(None, None)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
KeyError: None
>>>> {}.pop(1, None)
>>>> {1: 1}.pop(1, None)
1
>>>> {'a': 'a'}.pop(1, None)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
KeyError: 1
>>>>
```

Confirmed it does work on previous (5.6.0):

```
Python 2.7.12 (aff251e54385, Nov 09 2016, 17:25:49)
[PyPy 5.6.0 with GCC 4.2.1 Compatible Apple LLVM 5.1 (clang-503.0.40)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>>> {}.pop(None, None)
>>>> {1: 1}.pop(None, None)
>>>> {'a': 'a'}.pop(None, None)
>>>> {}.pop(1, None)
>>>> {1: 1}.pop(1, None)
1
>>>> {'a': 'a'}.pop(1, None)
>>>>
```




More information about the pypy-issue mailing list