We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
JSON Merge Patch deserialization is broken 
Merge-patch operations are broken. It looks like a deserialization problem, which may have been introduced with  #790.  Also, we should definitely include some view tests for this content-type. My bad :/ 
  
```
echo '{"data": {"aaa": "bbb"}}' | http patch localhost:8888/v1/buckets/b1 Content-Type:application/merge-patch+json -a aaa:
HTTP/1.1 400 Bad Request
Access-Control-Expose-Headers: Retry-After, Content-Length, Alert, Backoff
Content-Length: 331
Content-Type: application/json; charset=UTF-8
Date: Sun, 11 Dec 2016 23:47:26 GMT
Server: waitress

{
    "code": 400,
    "details": [
        {
            "description": "\"{\"data\": {\"aaa\": \"bbb\"}}\n\" is not a mapping type: Does not implement dict-like functionality.",
            "location": "body",
            "name": ""
        }
    ],
    "errno": 107,
    "error": "Invalid parameters",
    "message": "\"{\"data\": {\"aaa\": \"bbb\"}}\n\" is not a mapping type: Does not implement dict-like functionality."
}
```
JSON Merge Patch deserialization is broken 
Merge-patch operations are broken. It looks like a deserialization problem, which may have been introduced with  #790.  Also, we should definitely include some view tests for this content-type. My bad :/ 
  
```
echo '{"data": {"aaa": "bbb"}}' | http patch localhost:8888/v1/buckets/b1 Content-Type:application/merge-patch+json -a aaa:
HTTP/1.1 400 Bad Request
Access-Control-Expose-Headers: Retry-After, Content-Length, Alert, Backoff
Content-Length: 331
Content-Type: application/json; charset=UTF-8
Date: Sun, 11 Dec 2016 23:47:26 GMT
Server: waitress

{
    "code": 400,
    "details": [
        {
            "description": "\"{\"data\": {\"aaa\": \"bbb\"}}\n\" is not a mapping type: Does not implement dict-like functionality.",
            "location": "body",
            "name": ""
        }
    ],
    "errno": 107,
    "error": "Invalid parameters",
    "message": "\"{\"data\": {\"aaa\": \"bbb\"}}\n\" is not a mapping type: Does not implement dict-like functionality."
}
```
JSON Merge Patch deserialization is broken 
Merge-patch operations are broken. It looks like a deserialization problem, which may have been introduced with  #790.  Also, we should definitely include some view tests for this content-type. My bad :/ 
  
```
echo '{"data": {"aaa": "bbb"}}' | http patch localhost:8888/v1/buckets/b1 Content-Type:application/merge-patch+json -a aaa:
HTTP/1.1 400 Bad Request
Access-Control-Expose-Headers: Retry-After, Content-Length, Alert, Backoff
Content-Length: 331
Content-Type: application/json; charset=UTF-8
Date: Sun, 11 Dec 2016 23:47:26 GMT
Server: waitress

{
    "code": 400,
    "details": [
        {
            "description": "\"{\"data\": {\"aaa\": \"bbb\"}}\n\" is not a mapping type: Does not implement dict-like functionality.",
            "location": "body",
            "name": ""
        }
    ],
    "errno": 107,
    "error": "Invalid parameters",
    "message": "\"{\"data\": {\"aaa\": \"bbb\"}}\n\" is not a mapping type: Does not implement dict-like functionality."
}
```

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `setup.py`
Content:
```
1 import platform
2 import codecs
3 import os
4 from setuptools import setup, find_packages
5 
6 here = os.path.abspath(os.path.dirname(__file__))
7 
8 
9 def read_file(filename):
10     """Open a related file and return its content."""
11     with codecs.open(os.path.join(here, filename), encoding='utf-8') as f:
12         content = f.read()
13     return content
14 
15 README = read_file('README.rst')
16 CHANGELOG = read_file('CHANGELOG.rst')
17 CONTRIBUTORS = read_file('CONTRIBUTORS.rst')
18 
19 installed_with_pypy = platform.python_implementation() == 'PyPy'
20 
21 REQUIREMENTS = [
22     'colander',
23     'colorama',
24     'cornice >= 2.1',
25     'jsonschema',
26     'jsonpatch',
27     'python-dateutil',
28     'pyramid_multiauth >= 0.8',  # User on policy selected event.
29     'transaction',
30     'pyramid_tm',
31     'requests',
32     'six',
33     'structlog >= 16.1.0',
34     'enum34',
35     'waitress',
36 ]
37 
38 if installed_with_pypy:
39     # We install psycopg2cffi instead of psycopg2 when dealing with pypy
40     # Note: JSONB support landed after psycopg2cffi 2.7.0
41     POSTGRESQL_REQUIRES = [
42         'SQLAlchemy',
43         'psycopg2cffi>2.7.0',
44         'zope.sqlalchemy',
45     ]
46 else:
47     # ujson is not pypy compliant, as it uses the CPython C API
48     REQUIREMENTS.append('ujson >= 1.35')
49     POSTGRESQL_REQUIRES = [
50         'SQLAlchemy',
51         'psycopg2>2.5',
52         'zope.sqlalchemy',
53     ]
54 
55 REDIS_REQUIRES = [
56     'kinto_redis'
57 ]
58 
59 SETUP_REQUIRES = [
60     'pytest-runner'
61 ]
62 
63 TEST_REQUIREMENTS = [
64     'pytest',
65     'WebTest'
66 ]
67 
68 DEPENDENCY_LINKS = [
69 ]
70 
71 MONITORING_REQUIRES = [
72     'raven',
73     'statsd',
74     'newrelic',
75     'werkzeug',
76 ]
77 
78 ENTRY_POINTS = {
79     'paste.app_factory': [
80         'main = kinto:main',
81     ],
82     'console_scripts': [
83         'kinto = kinto.__main__:main'
84     ],
85 }
86 
87 
88 setup(name='kinto',
89       version='5.0.1.dev0',
90       description='Kinto Web Service - Store, Sync, Share, and Self-Host.',
91       long_description=README + "\n\n" + CHANGELOG + "\n\n" + CONTRIBUTORS,
92       license='Apache License (2.0)',
93       classifiers=[
94           "Programming Language :: Python",
95           "Programming Language :: Python :: 2",
96           "Programming Language :: Python :: 2.7",
97           "Programming Language :: Python :: 3",
98           "Programming Language :: Python :: 3.4",
99           "Programming Language :: Python :: 3.5",
100           "Programming Language :: Python :: Implementation :: CPython",
101           "Programming Language :: Python :: Implementation :: PyPy",
102           "Topic :: Internet :: WWW/HTTP",
103           "Topic :: Internet :: WWW/HTTP :: WSGI :: Application",
104           "License :: OSI Approved :: Apache Software License"
105       ],
106       keywords="web sync json storage services",
107       author='Mozilla Services',
108       author_email='storage-team@mozilla.com',
109       url='https://github.com/Kinto/kinto',
110       packages=find_packages(),
111       package_data={'': ['*.rst', '*.py']},
112       include_package_data=True,
113       zip_safe=False,
114       setup_requires=SETUP_REQUIRES,
115       tests_require=TEST_REQUIREMENTS,
116       install_requires=REQUIREMENTS,
117       extras_require={
118           'redis': REDIS_REQUIRES,
119           'postgresql': POSTGRESQL_REQUIRES,
120           'monitoring': MONITORING_REQUIRES,
121           ":python_version=='2.7'": ["functools32", "futures"],
122       },
123       test_suite="tests",
124       dependency_links=DEPENDENCY_LINKS,
125       entry_points=ENTRY_POINTS)
126
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -21,7 +21,7 @@
 REQUIREMENTS = [
     'colander',
     'colorama',
-    'cornice >= 2.1',
+    'cornice >= 2.3',
     'jsonschema',
     'jsonpatch',
     'python-dateutil',

{"golden_diff": "diff --git a/setup.py b/setup.py\n--- a/setup.py\n+++ b/setup.py\n@@ -21,7 +21,7 @@\n REQUIREMENTS = [\n     'colander',\n     'colorama',\n-    'cornice >= 2.1',\n+    'cornice >= 2.3',\n     'jsonschema',\n     'jsonpatch',\n     'python-dateutil',\n", "issue": "JSON Merge Patch deserialization is broken \nMerge-patch operations are broken. It looks like a deserialization problem, which may have been introduced with  #790.  Also, we should definitely include some view tests for this content-type. My bad :/ \r\n  \r\n```\r\necho '{\"data\": {\"aaa\": \"bbb\"}}' | http patch localhost:8888/v1/buckets/b1 Content-Type:application/merge-patch+json -a aaa:\r\nHTTP/1.1 400 Bad Request\r\nAccess-Control-Expose-Headers: Retry-After, Content-Length, Alert, Backoff\r\nContent-Length: 331\r\nContent-Type: application/json; charset=UTF-8\r\nDate: Sun, 11 Dec 2016 23:47:26 GMT\r\nServer: waitress\r\n\r\n{\r\n    \"code\": 400,\r\n    \"details\": [\r\n        {\r\n            \"description\": \"\\\"{\\\"data\\\": {\\\"aaa\\\": \\\"bbb\\\"}}\\n\\\" is not a mapping type: Does not implement dict-like functionality.\",\r\n            \"location\": \"body\",\r\n            \"name\": \"\"\r\n        }\r\n    ],\r\n    \"errno\": 107,\r\n    \"error\": \"Invalid parameters\",\r\n    \"message\": \"\\\"{\\\"data\\\": {\\\"aaa\\\": \\\"bbb\\\"}}\\n\\\" is not a mapping type: Does not implement dict-like functionality.\"\r\n}\r\n```\nJSON Merge Patch deserialization is broken \nMerge-patch operations are broken. It looks like a deserialization problem, which may have been introduced with  #790.  Also, we should definitely include some view tests for this content-type. My bad :/ \r\n  \r\n```\r\necho '{\"data\": {\"aaa\": \"bbb\"}}' | http patch localhost:8888/v1/buckets/b1 Content-Type:application/merge-patch+json -a aaa:\r\nHTTP/1.1 400 Bad Request\r\nAccess-Control-Expose-Headers: Retry-After, Content-Length, Alert, Backoff\r\nContent-Length: 331\r\nContent-Type: application/json; charset=UTF-8\r\nDate: Sun, 11 Dec 2016 23:47:26 GMT\r\nServer: waitress\r\n\r\n{\r\n    \"code\": 400,\r\n    \"details\": [\r\n        {\r\n            \"description\": \"\\\"{\\\"data\\\": {\\\"aaa\\\": \\\"bbb\\\"}}\\n\\\" is not a mapping type: Does not implement dict-like functionality.\",\r\n            \"location\": \"body\",\r\n            \"name\": \"\"\r\n        }\r\n    ],\r\n    \"errno\": 107,\r\n    \"error\": \"Invalid parameters\",\r\n    \"message\": \"\\\"{\\\"data\\\": {\\\"aaa\\\": \\\"bbb\\\"}}\\n\\\" is not a mapping type: Does not implement dict-like functionality.\"\r\n}\r\n```\nJSON Merge Patch deserialization is broken \nMerge-patch operations are broken. It looks like a deserialization problem, which may have been introduced with  #790.  Also, we should definitely include some view tests for this content-type. My bad :/ \r\n  \r\n```\r\necho '{\"data\": {\"aaa\": \"bbb\"}}' | http patch localhost:8888/v1/buckets/b1 Content-Type:application/merge-patch+json -a aaa:\r\nHTTP/1.1 400 Bad Request\r\nAccess-Control-Expose-Headers: Retry-After, Content-Length, Alert, Backoff\r\nContent-Length: 331\r\nContent-Type: application/json; charset=UTF-8\r\nDate: Sun, 11 Dec 2016 23:47:26 GMT\r\nServer: waitress\r\n\r\n{\r\n    \"code\": 400,\r\n    \"details\": [\r\n        {\r\n            \"description\": \"\\\"{\\\"data\\\": {\\\"aaa\\\": \\\"bbb\\\"}}\\n\\\" is not a mapping type: Does not implement dict-like functionality.\",\r\n            \"location\": \"body\",\r\n            \"name\": \"\"\r\n        }\r\n    ],\r\n    \"errno\": 107,\r\n    \"error\": \"Invalid parameters\",\r\n    \"message\": \"\\\"{\\\"data\\\": {\\\"aaa\\\": \\\"bbb\\\"}}\\n\\\" is not a mapping type: Does not implement dict-like functionality.\"\r\n}\r\n```\n", "before_files": [{"content": "import platform\nimport codecs\nimport os\nfrom setuptools import setup, find_packages\n\nhere = os.path.abspath(os.path.dirname(__file__))\n\n\ndef read_file(filename):\n    \"\"\"Open a related file and return its content.\"\"\"\n    with codecs.open(os.path.join(here, filename), encoding='utf-8') as f:\n        content = f.read()\n    return content\n\nREADME = read_file('README.rst')\nCHANGELOG = read_file('CHANGELOG.rst')\nCONTRIBUTORS = read_file('CONTRIBUTORS.rst')\n\ninstalled_with_pypy = platform.python_implementation() == 'PyPy'\n\nREQUIREMENTS = [\n    'colander',\n    'colorama',\n    'cornice >= 2.1',\n    'jsonschema',\n    'jsonpatch',\n    'python-dateutil',\n    'pyramid_multiauth >= 0.8',  # User on policy selected event.\n    'transaction',\n    'pyramid_tm',\n    'requests',\n    'six',\n    'structlog >= 16.1.0',\n    'enum34',\n    'waitress',\n]\n\nif installed_with_pypy:\n    # We install psycopg2cffi instead of psycopg2 when dealing with pypy\n    # Note: JSONB support landed after psycopg2cffi 2.7.0\n    POSTGRESQL_REQUIRES = [\n        'SQLAlchemy',\n        'psycopg2cffi>2.7.0',\n        'zope.sqlalchemy',\n    ]\nelse:\n    # ujson is not pypy compliant, as it uses the CPython C API\n    REQUIREMENTS.append('ujson >= 1.35')\n    POSTGRESQL_REQUIRES = [\n        'SQLAlchemy',\n        'psycopg2>2.5',\n        'zope.sqlalchemy',\n    ]\n\nREDIS_REQUIRES = [\n    'kinto_redis'\n]\n\nSETUP_REQUIRES = [\n    'pytest-runner'\n]\n\nTEST_REQUIREMENTS = [\n    'pytest',\n    'WebTest'\n]\n\nDEPENDENCY_LINKS = [\n]\n\nMONITORING_REQUIRES = [\n    'raven',\n    'statsd',\n    'newrelic',\n    'werkzeug',\n]\n\nENTRY_POINTS = {\n    'paste.app_factory': [\n        'main = kinto:main',\n    ],\n    'console_scripts': [\n        'kinto = kinto.__main__:main'\n    ],\n}\n\n\nsetup(name='kinto',\n      version='5.0.1.dev0',\n      description='Kinto Web Service - Store, Sync, Share, and Self-Host.',\n      long_description=README + \"\\n\\n\" + CHANGELOG + \"\\n\\n\" + CONTRIBUTORS,\n      license='Apache License (2.0)',\n      classifiers=[\n          \"Programming Language :: Python\",\n          \"Programming Language :: Python :: 2\",\n          \"Programming Language :: Python :: 2.7\",\n          \"Programming Language :: Python :: 3\",\n          \"Programming Language :: Python :: 3.4\",\n          \"Programming Language :: Python :: 3.5\",\n          \"Programming Language :: Python :: Implementation :: CPython\",\n          \"Programming Language :: Python :: Implementation :: PyPy\",\n          \"Topic :: Internet :: WWW/HTTP\",\n          \"Topic :: Internet :: WWW/HTTP :: WSGI :: Application\",\n          \"License :: OSI Approved :: Apache Software License\"\n      ],\n      keywords=\"web sync json storage services\",\n      author='Mozilla Services',\n      author_email='storage-team@mozilla.com',\n      url='https://github.com/Kinto/kinto',\n      packages=find_packages(),\n      package_data={'': ['*.rst', '*.py']},\n      include_package_data=True,\n      zip_safe=False,\n      setup_requires=SETUP_REQUIRES,\n      tests_require=TEST_REQUIREMENTS,\n      install_requires=REQUIREMENTS,\n      extras_require={\n          'redis': REDIS_REQUIRES,\n          'postgresql': POSTGRESQL_REQUIRES,\n          'monitoring': MONITORING_REQUIRES,\n          \":python_version=='2.7'\": [\"functools32\", \"futures\"],\n      },\n      test_suite=\"tests\",\n      dependency_links=DEPENDENCY_LINKS,\n      entry_points=ENTRY_POINTS)\n", "path": "setup.py"}], "after_files": [{"content": "import platform\nimport codecs\nimport os\nfrom setuptools import setup, find_packages\n\nhere = os.path.abspath(os.path.dirname(__file__))\n\n\ndef read_file(filename):\n    \"\"\"Open a related file and return its content.\"\"\"\n    with codecs.open(os.path.join(here, filename), encoding='utf-8') as f:\n        content = f.read()\n    return content\n\nREADME = read_file('README.rst')\nCHANGELOG = read_file('CHANGELOG.rst')\nCONTRIBUTORS = read_file('CONTRIBUTORS.rst')\n\ninstalled_with_pypy = platform.python_implementation() == 'PyPy'\n\nREQUIREMENTS = [\n    'colander',\n    'colorama',\n    'cornice >= 2.3',\n    'jsonschema',\n    'jsonpatch',\n    'python-dateutil',\n    'pyramid_multiauth >= 0.8',  # User on policy selected event.\n    'transaction',\n    'pyramid_tm',\n    'requests',\n    'six',\n    'structlog >= 16.1.0',\n    'enum34',\n    'waitress',\n]\n\nif installed_with_pypy:\n    # We install psycopg2cffi instead of psycopg2 when dealing with pypy\n    # Note: JSONB support landed after psycopg2cffi 2.7.0\n    POSTGRESQL_REQUIRES = [\n        'SQLAlchemy',\n        'psycopg2cffi>2.7.0',\n        'zope.sqlalchemy',\n    ]\nelse:\n    # ujson is not pypy compliant, as it uses the CPython C API\n    REQUIREMENTS.append('ujson >= 1.35')\n    POSTGRESQL_REQUIRES = [\n        'SQLAlchemy',\n        'psycopg2>2.5',\n        'zope.sqlalchemy',\n    ]\n\nREDIS_REQUIRES = [\n    'kinto_redis'\n]\n\nSETUP_REQUIRES = [\n    'pytest-runner'\n]\n\nTEST_REQUIREMENTS = [\n    'pytest',\n    'WebTest'\n]\n\nDEPENDENCY_LINKS = [\n]\n\nMONITORING_REQUIRES = [\n    'raven',\n    'statsd',\n    'newrelic',\n    'werkzeug',\n]\n\nENTRY_POINTS = {\n    'paste.app_factory': [\n        'main = kinto:main',\n    ],\n    'console_scripts': [\n        'kinto = kinto.__main__:main'\n    ],\n}\n\n\nsetup(name='kinto',\n      version='5.0.1.dev0',\n      description='Kinto Web Service - Store, Sync, Share, and Self-Host.',\n      long_description=README + \"\\n\\n\" + CHANGELOG + \"\\n\\n\" + CONTRIBUTORS,\n      license='Apache License (2.0)',\n      classifiers=[\n          \"Programming Language :: Python\",\n          \"Programming Language :: Python :: 2\",\n          \"Programming Language :: Python :: 2.7\",\n          \"Programming Language :: Python :: 3\",\n          \"Programming Language :: Python :: 3.4\",\n          \"Programming Language :: Python :: 3.5\",\n          \"Programming Language :: Python :: Implementation :: CPython\",\n          \"Programming Language :: Python :: Implementation :: PyPy\",\n          \"Topic :: Internet :: WWW/HTTP\",\n          \"Topic :: Internet :: WWW/HTTP :: WSGI :: Application\",\n          \"License :: OSI Approved :: Apache Software License\"\n      ],\n      keywords=\"web sync json storage services\",\n      author='Mozilla Services',\n      author_email='storage-team@mozilla.com',\n      url='https://github.com/Kinto/kinto',\n      packages=find_packages(),\n      package_data={'': ['*.rst', '*.py']},\n      include_package_data=True,\n      zip_safe=False,\n      setup_requires=SETUP_REQUIRES,\n      tests_require=TEST_REQUIREMENTS,\n      install_requires=REQUIREMENTS,\n      extras_require={\n          'redis': REDIS_REQUIRES,\n          'postgresql': POSTGRESQL_REQUIRES,\n          'monitoring': MONITORING_REQUIRES,\n          \":python_version=='2.7'\": [\"functools32\", \"futures\"],\n      },\n      test_suite=\"tests\",\n      dependency_links=DEPENDENCY_LINKS,\n      entry_points=ENTRY_POINTS)\n", "path": "setup.py"}]}