We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
`TestNpz.test_dump` test failure
https://jenkins.preferred.jp/job/chainer/job/cupy_pr/161/TEST=cupy-py3,label=mn1-p100/console


--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `cupy/io/npz.py`
Content:
```
1 import numpy
2 
3 import cupy
4 
5 
6 class NpzFile(object):
7 
8     def __init__(self, npz_file):
9         self.npz_file = npz_file
10 
11     def __enter__(self):
12         self.npz_file.__enter__()
13         return self
14 
15     def __exit__(self, typ, val, traceback):
16         self.npz_file.__exit__(typ, val, traceback)
17 
18     def __getitem__(self, key):
19         arr = self.npz_file[key]
20         return cupy.array(arr)
21 
22     def close(self):
23         self.npz_file.close()
24 
25 
26 def load(file, mmap_mode=None):
27     """Loads arrays or pickled objects from ``.npy``, ``.npz`` or pickled file.
28 
29     This function just calls ``numpy.load`` and then sends the arrays to the
30     current device. NPZ file is converted to NpzFile object, which defers the
31     transfer to the time of accessing the items.
32 
33     Args:
34         file (file-like object or string): The file to read.
35         mmap_mode (None, 'r+', 'r', 'w+', 'c'): If not ``None``, memory-map the
36             file to construct an intermediate :class:`numpy.ndarray` object and
37             transfer it to the current device.
38 
39     Returns:
40         CuPy array or NpzFile object depending on the type of the file. NpzFile
41         object is a dictionary-like object with the context manager protocol
42         (which enables us to use *with* statement on it).
43 
44     .. seealso:: :func:`numpy.load`
45 
46     """
47     obj = numpy.load(file, mmap_mode)
48     if isinstance(obj, numpy.ndarray):
49         return cupy.array(obj)
50     elif isinstance(obj, numpy.lib.npyio.NpzFile):
51         return NpzFile(obj)
52     else:
53         return obj
54 
55 
56 def save(file, arr):
57     """Saves an array to a binary file in ``.npy`` format.
58 
59     Args:
60         file (file or str): File or filename to save.
61         arr (array_like): Array to save. It should be able to feed to
62             :func:`cupy.asnumpy`.
63 
64     .. seealso:: :func:`numpy.save`
65 
66     """
67     numpy.save(file, cupy.asnumpy(arr))
68 
69 
70 def savez(file, *args, **kwds):
71     """Saves one or more arrays into a file in uncompressed ``.npz`` format.
72 
73     Arguments without keys are treated as arguments with automatic keys named
74     ``arr_0``, ``arr_1``, etc. corresponding to the positions in the argument
75     list. The keys of arguments are used as keys in the ``.npz`` file, which
76     are used for accessing NpzFile object when the file is read by
77     :func:`cupy.load` function.
78 
79     Args:
80         file (file or str): File or filename to save.
81         *args: Arrays with implicit keys.
82         **kwds: Arrays with explicit keys.
83 
84     .. seealso:: :func:`numpy.savez`
85 
86     """
87     args = map(cupy.asnumpy, args)
88     for key in kwds:
89         kwds[key] = cupy.asnumpy(kwds[key])
90     numpy.savez(file, *args, **kwds)
91 
92 
93 def savez_compressed(file, *args, **kwds):
94     """Saves one or more arrays into a file in compressed ``.npz`` format.
95 
96     It is equivalent to :func:`cupy.savez` function except the output file is
97     compressed.
98 
99     .. seealso::
100        :func:`cupy.savez` for more detail,
101        :func:`numpy.savez_compressed`
102 
103     """
104     args = map(cupy.asnumpy, args)
105     for key in kwds:
106         kwds[key] = cupy.asnumpy(kwds[key])
107     numpy.savez_compressed(file, *args, **kwds)
108
```
--- 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/cupy/io/npz.py b/cupy/io/npz.py
--- a/cupy/io/npz.py
+++ b/cupy/io/npz.py
@@ -1,8 +1,13 @@
+import warnings
+
 import numpy
 
 import cupy
 
 
+_support_allow_pickle = (numpy.lib.NumpyVersion(numpy.__version__) >= '1.10.0')
+
+
 class NpzFile(object):
 
     def __init__(self, npz_file):
@@ -23,7 +28,7 @@
         self.npz_file.close()
 
 
-def load(file, mmap_mode=None):
+def load(file, mmap_mode=None, allow_pickle=None):
     """Loads arrays or pickled objects from ``.npy``, ``.npz`` or pickled file.
 
     This function just calls ``numpy.load`` and then sends the arrays to the
@@ -35,6 +40,16 @@
         mmap_mode (None, 'r+', 'r', 'w+', 'c'): If not ``None``, memory-map the
             file to construct an intermediate :class:`numpy.ndarray` object and
             transfer it to the current device.
+        allow_pickle (bool): Allow loading pickled object arrays stored in npy
+            files. Reasons for disallowing pickles include security, as
+            loading pickled data can execute arbitrary code. If pickles are
+            disallowed, loading object arrays will fail.
+            Please be aware that CuPy does not support arrays with dtype of
+            `object`.
+            The default is False.
+            This option is available only for NumPy 1.10 or later.
+            In NumPy 1.9, this option cannot be specified (loading pickled
+            objects is always allowed).
 
     Returns:
         CuPy array or NpzFile object depending on the type of the file. NpzFile
@@ -44,7 +59,14 @@
     .. seealso:: :func:`numpy.load`
 
     """
-    obj = numpy.load(file, mmap_mode)
+    if _support_allow_pickle:
+        allow_pickle = False if allow_pickle is None else allow_pickle
+        obj = numpy.load(file, mmap_mode, allow_pickle)
+    else:
+        if allow_pickle is not None:
+            warnings.warn('allow_pickle option is not supported in NumPy 1.9')
+        obj = numpy.load(file, mmap_mode)
+
     if isinstance(obj, numpy.ndarray):
         return cupy.array(obj)
     elif isinstance(obj, numpy.lib.npyio.NpzFile):
@@ -53,18 +75,35 @@
         return obj
 
 
-def save(file, arr):
+def save(file, arr, allow_pickle=None):
     """Saves an array to a binary file in ``.npy`` format.
 
     Args:
         file (file or str): File or filename to save.
         arr (array_like): Array to save. It should be able to feed to
             :func:`cupy.asnumpy`.
+        allow_pickle (bool): Allow saving object arrays using Python pickles.
+            Reasons for disallowing pickles include security (loading pickled
+            data can execute arbitrary code) and portability (pickled objects
+            may not be loadable on different Python installations, for example
+            if the stored objects require libraries that are not available,
+            and not all pickled data is compatible between Python 2 and Python
+            3).
+            The default is True.
+            This option is available only for NumPy 1.10 or later.
+            In NumPy 1.9, this option cannot be specified (saving objects
+            using pickles is always allowed).
 
     .. seealso:: :func:`numpy.save`
 
     """
-    numpy.save(file, cupy.asnumpy(arr))
+    if _support_allow_pickle:
+        allow_pickle = True if allow_pickle is None else allow_pickle
+        numpy.save(file, cupy.asnumpy(arr), allow_pickle)
+    else:
+        if allow_pickle is not None:
+            warnings.warn('allow_pickle option is not supported in NumPy 1.9')
+        numpy.save(file, cupy.asnumpy(arr))
 
 
 def savez(file, *args, **kwds):

{"golden_diff": "diff --git a/cupy/io/npz.py b/cupy/io/npz.py\n--- a/cupy/io/npz.py\n+++ b/cupy/io/npz.py\n@@ -1,8 +1,13 @@\n+import warnings\n+\n import numpy\n \n import cupy\n \n \n+_support_allow_pickle = (numpy.lib.NumpyVersion(numpy.__version__) >= '1.10.0')\n+\n+\n class NpzFile(object):\n \n     def __init__(self, npz_file):\n@@ -23,7 +28,7 @@\n         self.npz_file.close()\n \n \n-def load(file, mmap_mode=None):\n+def load(file, mmap_mode=None, allow_pickle=None):\n     \"\"\"Loads arrays or pickled objects from ``.npy``, ``.npz`` or pickled file.\n \n     This function just calls ``numpy.load`` and then sends the arrays to the\n@@ -35,6 +40,16 @@\n         mmap_mode (None, 'r+', 'r', 'w+', 'c'): If not ``None``, memory-map the\n             file to construct an intermediate :class:`numpy.ndarray` object and\n             transfer it to the current device.\n+        allow_pickle (bool): Allow loading pickled object arrays stored in npy\n+            files. Reasons for disallowing pickles include security, as\n+            loading pickled data can execute arbitrary code. If pickles are\n+            disallowed, loading object arrays will fail.\n+            Please be aware that CuPy does not support arrays with dtype of\n+            `object`.\n+            The default is False.\n+            This option is available only for NumPy 1.10 or later.\n+            In NumPy 1.9, this option cannot be specified (loading pickled\n+            objects is always allowed).\n \n     Returns:\n         CuPy array or NpzFile object depending on the type of the file. NpzFile\n@@ -44,7 +59,14 @@\n     .. seealso:: :func:`numpy.load`\n \n     \"\"\"\n-    obj = numpy.load(file, mmap_mode)\n+    if _support_allow_pickle:\n+        allow_pickle = False if allow_pickle is None else allow_pickle\n+        obj = numpy.load(file, mmap_mode, allow_pickle)\n+    else:\n+        if allow_pickle is not None:\n+            warnings.warn('allow_pickle option is not supported in NumPy 1.9')\n+        obj = numpy.load(file, mmap_mode)\n+\n     if isinstance(obj, numpy.ndarray):\n         return cupy.array(obj)\n     elif isinstance(obj, numpy.lib.npyio.NpzFile):\n@@ -53,18 +75,35 @@\n         return obj\n \n \n-def save(file, arr):\n+def save(file, arr, allow_pickle=None):\n     \"\"\"Saves an array to a binary file in ``.npy`` format.\n \n     Args:\n         file (file or str): File or filename to save.\n         arr (array_like): Array to save. It should be able to feed to\n             :func:`cupy.asnumpy`.\n+        allow_pickle (bool): Allow saving object arrays using Python pickles.\n+            Reasons for disallowing pickles include security (loading pickled\n+            data can execute arbitrary code) and portability (pickled objects\n+            may not be loadable on different Python installations, for example\n+            if the stored objects require libraries that are not available,\n+            and not all pickled data is compatible between Python 2 and Python\n+            3).\n+            The default is True.\n+            This option is available only for NumPy 1.10 or later.\n+            In NumPy 1.9, this option cannot be specified (saving objects\n+            using pickles is always allowed).\n \n     .. seealso:: :func:`numpy.save`\n \n     \"\"\"\n-    numpy.save(file, cupy.asnumpy(arr))\n+    if _support_allow_pickle:\n+        allow_pickle = True if allow_pickle is None else allow_pickle\n+        numpy.save(file, cupy.asnumpy(arr), allow_pickle)\n+    else:\n+        if allow_pickle is not None:\n+            warnings.warn('allow_pickle option is not supported in NumPy 1.9')\n+        numpy.save(file, cupy.asnumpy(arr))\n \n \n def savez(file, *args, **kwds):\n", "issue": "`TestNpz.test_dump` test failure\nhttps://jenkins.preferred.jp/job/chainer/job/cupy_pr/161/TEST=cupy-py3,label=mn1-p100/console\r\n\n", "before_files": [{"content": "import numpy\n\nimport cupy\n\n\nclass NpzFile(object):\n\n    def __init__(self, npz_file):\n        self.npz_file = npz_file\n\n    def __enter__(self):\n        self.npz_file.__enter__()\n        return self\n\n    def __exit__(self, typ, val, traceback):\n        self.npz_file.__exit__(typ, val, traceback)\n\n    def __getitem__(self, key):\n        arr = self.npz_file[key]\n        return cupy.array(arr)\n\n    def close(self):\n        self.npz_file.close()\n\n\ndef load(file, mmap_mode=None):\n    \"\"\"Loads arrays or pickled objects from ``.npy``, ``.npz`` or pickled file.\n\n    This function just calls ``numpy.load`` and then sends the arrays to the\n    current device. NPZ file is converted to NpzFile object, which defers the\n    transfer to the time of accessing the items.\n\n    Args:\n        file (file-like object or string): The file to read.\n        mmap_mode (None, 'r+', 'r', 'w+', 'c'): If not ``None``, memory-map the\n            file to construct an intermediate :class:`numpy.ndarray` object and\n            transfer it to the current device.\n\n    Returns:\n        CuPy array or NpzFile object depending on the type of the file. NpzFile\n        object is a dictionary-like object with the context manager protocol\n        (which enables us to use *with* statement on it).\n\n    .. seealso:: :func:`numpy.load`\n\n    \"\"\"\n    obj = numpy.load(file, mmap_mode)\n    if isinstance(obj, numpy.ndarray):\n        return cupy.array(obj)\n    elif isinstance(obj, numpy.lib.npyio.NpzFile):\n        return NpzFile(obj)\n    else:\n        return obj\n\n\ndef save(file, arr):\n    \"\"\"Saves an array to a binary file in ``.npy`` format.\n\n    Args:\n        file (file or str): File or filename to save.\n        arr (array_like): Array to save. It should be able to feed to\n            :func:`cupy.asnumpy`.\n\n    .. seealso:: :func:`numpy.save`\n\n    \"\"\"\n    numpy.save(file, cupy.asnumpy(arr))\n\n\ndef savez(file, *args, **kwds):\n    \"\"\"Saves one or more arrays into a file in uncompressed ``.npz`` format.\n\n    Arguments without keys are treated as arguments with automatic keys named\n    ``arr_0``, ``arr_1``, etc. corresponding to the positions in the argument\n    list. The keys of arguments are used as keys in the ``.npz`` file, which\n    are used for accessing NpzFile object when the file is read by\n    :func:`cupy.load` function.\n\n    Args:\n        file (file or str): File or filename to save.\n        *args: Arrays with implicit keys.\n        **kwds: Arrays with explicit keys.\n\n    .. seealso:: :func:`numpy.savez`\n\n    \"\"\"\n    args = map(cupy.asnumpy, args)\n    for key in kwds:\n        kwds[key] = cupy.asnumpy(kwds[key])\n    numpy.savez(file, *args, **kwds)\n\n\ndef savez_compressed(file, *args, **kwds):\n    \"\"\"Saves one or more arrays into a file in compressed ``.npz`` format.\n\n    It is equivalent to :func:`cupy.savez` function except the output file is\n    compressed.\n\n    .. seealso::\n       :func:`cupy.savez` for more detail,\n       :func:`numpy.savez_compressed`\n\n    \"\"\"\n    args = map(cupy.asnumpy, args)\n    for key in kwds:\n        kwds[key] = cupy.asnumpy(kwds[key])\n    numpy.savez_compressed(file, *args, **kwds)\n", "path": "cupy/io/npz.py"}], "after_files": [{"content": "import warnings\n\nimport numpy\n\nimport cupy\n\n\n_support_allow_pickle = (numpy.lib.NumpyVersion(numpy.__version__) >= '1.10.0')\n\n\nclass NpzFile(object):\n\n    def __init__(self, npz_file):\n        self.npz_file = npz_file\n\n    def __enter__(self):\n        self.npz_file.__enter__()\n        return self\n\n    def __exit__(self, typ, val, traceback):\n        self.npz_file.__exit__(typ, val, traceback)\n\n    def __getitem__(self, key):\n        arr = self.npz_file[key]\n        return cupy.array(arr)\n\n    def close(self):\n        self.npz_file.close()\n\n\ndef load(file, mmap_mode=None, allow_pickle=None):\n    \"\"\"Loads arrays or pickled objects from ``.npy``, ``.npz`` or pickled file.\n\n    This function just calls ``numpy.load`` and then sends the arrays to the\n    current device. NPZ file is converted to NpzFile object, which defers the\n    transfer to the time of accessing the items.\n\n    Args:\n        file (file-like object or string): The file to read.\n        mmap_mode (None, 'r+', 'r', 'w+', 'c'): If not ``None``, memory-map the\n            file to construct an intermediate :class:`numpy.ndarray` object and\n            transfer it to the current device.\n        allow_pickle (bool): Allow loading pickled object arrays stored in npy\n            files. Reasons for disallowing pickles include security, as\n            loading pickled data can execute arbitrary code. If pickles are\n            disallowed, loading object arrays will fail.\n            Please be aware that CuPy does not support arrays with dtype of\n            `object`.\n            The default is False.\n            This option is available only for NumPy 1.10 or later.\n            In NumPy 1.9, this option cannot be specified (loading pickled\n            objects is always allowed).\n\n    Returns:\n        CuPy array or NpzFile object depending on the type of the file. NpzFile\n        object is a dictionary-like object with the context manager protocol\n        (which enables us to use *with* statement on it).\n\n    .. seealso:: :func:`numpy.load`\n\n    \"\"\"\n    if _support_allow_pickle:\n        allow_pickle = False if allow_pickle is None else allow_pickle\n        obj = numpy.load(file, mmap_mode, allow_pickle)\n    else:\n        if allow_pickle is not None:\n            warnings.warn('allow_pickle option is not supported in NumPy 1.9')\n        obj = numpy.load(file, mmap_mode)\n\n    if isinstance(obj, numpy.ndarray):\n        return cupy.array(obj)\n    elif isinstance(obj, numpy.lib.npyio.NpzFile):\n        return NpzFile(obj)\n    else:\n        return obj\n\n\ndef save(file, arr, allow_pickle=None):\n    \"\"\"Saves an array to a binary file in ``.npy`` format.\n\n    Args:\n        file (file or str): File or filename to save.\n        arr (array_like): Array to save. It should be able to feed to\n            :func:`cupy.asnumpy`.\n        allow_pickle (bool): Allow saving object arrays using Python pickles.\n            Reasons for disallowing pickles include security (loading pickled\n            data can execute arbitrary code) and portability (pickled objects\n            may not be loadable on different Python installations, for example\n            if the stored objects require libraries that are not available,\n            and not all pickled data is compatible between Python 2 and Python\n            3).\n            The default is True.\n            This option is available only for NumPy 1.10 or later.\n            In NumPy 1.9, this option cannot be specified (saving objects\n            using pickles is always allowed).\n\n    .. seealso:: :func:`numpy.save`\n\n    \"\"\"\n    if _support_allow_pickle:\n        allow_pickle = True if allow_pickle is None else allow_pickle\n        numpy.save(file, cupy.asnumpy(arr), allow_pickle)\n    else:\n        if allow_pickle is not None:\n            warnings.warn('allow_pickle option is not supported in NumPy 1.9')\n        numpy.save(file, cupy.asnumpy(arr))\n\n\ndef savez(file, *args, **kwds):\n    \"\"\"Saves one or more arrays into a file in uncompressed ``.npz`` format.\n\n    Arguments without keys are treated as arguments with automatic keys named\n    ``arr_0``, ``arr_1``, etc. corresponding to the positions in the argument\n    list. The keys of arguments are used as keys in the ``.npz`` file, which\n    are used for accessing NpzFile object when the file is read by\n    :func:`cupy.load` function.\n\n    Args:\n        file (file or str): File or filename to save.\n        *args: Arrays with implicit keys.\n        **kwds: Arrays with explicit keys.\n\n    .. seealso:: :func:`numpy.savez`\n\n    \"\"\"\n    args = map(cupy.asnumpy, args)\n    for key in kwds:\n        kwds[key] = cupy.asnumpy(kwds[key])\n    numpy.savez(file, *args, **kwds)\n\n\ndef savez_compressed(file, *args, **kwds):\n    \"\"\"Saves one or more arrays into a file in compressed ``.npz`` format.\n\n    It is equivalent to :func:`cupy.savez` function except the output file is\n    compressed.\n\n    .. seealso::\n       :func:`cupy.savez` for more detail,\n       :func:`numpy.savez_compressed`\n\n    \"\"\"\n    args = map(cupy.asnumpy, args)\n    for key in kwds:\n        kwds[key] = cupy.asnumpy(kwds[key])\n    numpy.savez_compressed(file, *args, **kwds)\n", "path": "cupy/io/npz.py"}]}