Issue #2435: Difference between PyPy and CPython when converting a subclass of dict to kwargs (pypy/pypy)
New issue 2435: Difference between PyPy and CPython when converting a subclass of dict to kwargs https://bitbucket.org/pypy/pypy/issues/2435/difference-between-pypy-and-cpyt... Mark Heppner: In Django, there is a data structure called a [`MultiValueDict`](https://github.com/django/django/blob/1.10.3/django/utils/datastructures.py#...) that subclasses off of `dict`. When converting it to kwargs, it behaves differently than CPython. I submitted a [ticket to Django](https://code.djangoproject.com/ticket/27521) that was closed pretty quickly. An example using a [`QueryDict`](https://github.com/django/django/blob/1.10.3/django/http/request.py#L355): ```python from django.conf import settings settings.configure() from django.http.request import QueryDict q = QueryDict('foo=bar&foo=baz') def test(**kwargs): print(kwargs) test(**q) ``` In CPython, this returns `{u'foo': [u'bar', u'baz']}`, but in PyPy `{u'foo': u'baz'}` is returned. This only happens on conversion from the subclassed `dict` to kwargs. I'm not sure if this is a bug or if the docs already [explain this behavior](http://doc.pypy.org/en/latest/cpython_differences.html#mutating-classes-of-o...).
participants (1)
-
Mark Heppner