We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
package metadata is no longer picklable
Since switching to OrderedDict, package metadata can no longer be pickled.

This can cause problems if you try to use setuptools with multiprocessing.

```
Traceback (most recent call last):
  File "/Users/dan/Documents/colcon_ws/src/colcon-python-setup-py/colcon_python_setup_py/package_identification/python_setup_py.py", line 257, in get_setup_information
    'stop_after': 'config'
  File "/usr/local/Cellar/python/3.7.4_1/Frameworks/Python.framework/Versions/3.7/lib/python3.7/multiprocessing/pool.py", line 261, in apply
    return self.apply_async(func, args, kwds).get()
  File "/usr/local/Cellar/python/3.7.4_1/Frameworks/Python.framework/Versions/3.7/lib/python3.7/multiprocessing/pool.py", line 657, in get
    raise self._value
multiprocessing.pool.MaybeEncodingError: Error sending result: '<distutils.dist.DistributionMetadata object at 0x10c1fcd50>'. Reason: 'PicklingError("Can't pickle <class 'setuptools._vendor.ordered_set.OrderedSet'>: it's not the same object as setuptools._vendor.ordered_set.OrderedSet")'
```

_Originally posted by @rotu in https://github.com/pypa/setuptools/pull/1690#issuecomment-545992670_
package metadata is no longer picklable
Since switching to OrderedDict, package metadata can no longer be pickled.

This can cause problems if you try to use setuptools with multiprocessing.

```
Traceback (most recent call last):
  File "/Users/dan/Documents/colcon_ws/src/colcon-python-setup-py/colcon_python_setup_py/package_identification/python_setup_py.py", line 257, in get_setup_information
    'stop_after': 'config'
  File "/usr/local/Cellar/python/3.7.4_1/Frameworks/Python.framework/Versions/3.7/lib/python3.7/multiprocessing/pool.py", line 261, in apply
    return self.apply_async(func, args, kwds).get()
  File "/usr/local/Cellar/python/3.7.4_1/Frameworks/Python.framework/Versions/3.7/lib/python3.7/multiprocessing/pool.py", line 657, in get
    raise self._value
multiprocessing.pool.MaybeEncodingError: Error sending result: '<distutils.dist.DistributionMetadata object at 0x10c1fcd50>'. Reason: 'PicklingError("Can't pickle <class 'setuptools._vendor.ordered_set.OrderedSet'>: it's not the same object as setuptools._vendor.ordered_set.OrderedSet")'
```

_Originally posted by @rotu in https://github.com/pypa/setuptools/pull/1690#issuecomment-545992670_

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `setuptools/extern/__init__.py`
Content:
```
1 import sys
2 
3 
4 class VendorImporter:
5     """
6     A PEP 302 meta path importer for finding optionally-vendored
7     or otherwise naturally-installed packages from root_name.
8     """
9 
10     def __init__(self, root_name, vendored_names=(), vendor_pkg=None):
11         self.root_name = root_name
12         self.vendored_names = set(vendored_names)
13         self.vendor_pkg = vendor_pkg or root_name.replace('extern', '_vendor')
14 
15     @property
16     def search_path(self):
17         """
18         Search first the vendor package then as a natural package.
19         """
20         yield self.vendor_pkg + '.'
21         yield ''
22 
23     def find_module(self, fullname, path=None):
24         """
25         Return self when fullname starts with root_name and the
26         target module is one vendored through this importer.
27         """
28         root, base, target = fullname.partition(self.root_name + '.')
29         if root:
30             return
31         if not any(map(target.startswith, self.vendored_names)):
32             return
33         return self
34 
35     def load_module(self, fullname):
36         """
37         Iterate over the search path to locate and load fullname.
38         """
39         root, base, target = fullname.partition(self.root_name + '.')
40         for prefix in self.search_path:
41             try:
42                 extant = prefix + target
43                 __import__(extant)
44                 mod = sys.modules[extant]
45                 sys.modules[fullname] = mod
46                 # mysterious hack:
47                 # Remove the reference to the extant package/module
48                 # on later Python versions to cause relative imports
49                 # in the vendor package to resolve the same modules
50                 # as those going through this importer.
51                 if sys.version_info >= (3, ):
52                     del sys.modules[extant]
53                 return mod
54             except ImportError:
55                 pass
56         else:
57             raise ImportError(
58                 "The '{target}' package is required; "
59                 "normally this is bundled with this package so if you get "
60                 "this warning, consult the packager of your "
61                 "distribution.".format(**locals())
62             )
63 
64     def install(self):
65         """
66         Install this importer into sys.meta_path if not already present.
67         """
68         if self not in sys.meta_path:
69             sys.meta_path.append(self)
70 
71 
72 names = 'six', 'packaging', 'pyparsing', 'ordered_set',
73 VendorImporter(__name__, names, 'setuptools._vendor').install()
74
```

Path: `pkg_resources/extern/__init__.py`
Content:
```
1 import sys
2 
3 
4 class VendorImporter:
5     """
6     A PEP 302 meta path importer for finding optionally-vendored
7     or otherwise naturally-installed packages from root_name.
8     """
9 
10     def __init__(self, root_name, vendored_names=(), vendor_pkg=None):
11         self.root_name = root_name
12         self.vendored_names = set(vendored_names)
13         self.vendor_pkg = vendor_pkg or root_name.replace('extern', '_vendor')
14 
15     @property
16     def search_path(self):
17         """
18         Search first the vendor package then as a natural package.
19         """
20         yield self.vendor_pkg + '.'
21         yield ''
22 
23     def find_module(self, fullname, path=None):
24         """
25         Return self when fullname starts with root_name and the
26         target module is one vendored through this importer.
27         """
28         root, base, target = fullname.partition(self.root_name + '.')
29         if root:
30             return
31         if not any(map(target.startswith, self.vendored_names)):
32             return
33         return self
34 
35     def load_module(self, fullname):
36         """
37         Iterate over the search path to locate and load fullname.
38         """
39         root, base, target = fullname.partition(self.root_name + '.')
40         for prefix in self.search_path:
41             try:
42                 extant = prefix + target
43                 __import__(extant)
44                 mod = sys.modules[extant]
45                 sys.modules[fullname] = mod
46                 # mysterious hack:
47                 # Remove the reference to the extant package/module
48                 # on later Python versions to cause relative imports
49                 # in the vendor package to resolve the same modules
50                 # as those going through this importer.
51                 if prefix and sys.version_info > (3, 3):
52                     del sys.modules[extant]
53                 return mod
54             except ImportError:
55                 pass
56         else:
57             raise ImportError(
58                 "The '{target}' package is required; "
59                 "normally this is bundled with this package so if you get "
60                 "this warning, consult the packager of your "
61                 "distribution.".format(**locals())
62             )
63 
64     def install(self):
65         """
66         Install this importer into sys.meta_path if not already present.
67         """
68         if self not in sys.meta_path:
69             sys.meta_path.append(self)
70 
71 
72 names = 'packaging', 'pyparsing', 'six', 'appdirs'
73 VendorImporter(__name__, names).install()
74
```
--- 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/pkg_resources/extern/__init__.py b/pkg_resources/extern/__init__.py
--- a/pkg_resources/extern/__init__.py
+++ b/pkg_resources/extern/__init__.py
@@ -43,13 +43,6 @@
                 __import__(extant)
                 mod = sys.modules[extant]
                 sys.modules[fullname] = mod
-                # mysterious hack:
-                # Remove the reference to the extant package/module
-                # on later Python versions to cause relative imports
-                # in the vendor package to resolve the same modules
-                # as those going through this importer.
-                if prefix and sys.version_info > (3, 3):
-                    del sys.modules[extant]
                 return mod
             except ImportError:
                 pass
diff --git a/setuptools/extern/__init__.py b/setuptools/extern/__init__.py
--- a/setuptools/extern/__init__.py
+++ b/setuptools/extern/__init__.py
@@ -43,13 +43,6 @@
                 __import__(extant)
                 mod = sys.modules[extant]
                 sys.modules[fullname] = mod
-                # mysterious hack:
-                # Remove the reference to the extant package/module
-                # on later Python versions to cause relative imports
-                # in the vendor package to resolve the same modules
-                # as those going through this importer.
-                if sys.version_info >= (3, ):
-                    del sys.modules[extant]
                 return mod
             except ImportError:
                 pass

{"golden_diff": "diff --git a/pkg_resources/extern/__init__.py b/pkg_resources/extern/__init__.py\n--- a/pkg_resources/extern/__init__.py\n+++ b/pkg_resources/extern/__init__.py\n@@ -43,13 +43,6 @@\n                 __import__(extant)\n                 mod = sys.modules[extant]\n                 sys.modules[fullname] = mod\n-                # mysterious hack:\n-                # Remove the reference to the extant package/module\n-                # on later Python versions to cause relative imports\n-                # in the vendor package to resolve the same modules\n-                # as those going through this importer.\n-                if prefix and sys.version_info > (3, 3):\n-                    del sys.modules[extant]\n                 return mod\n             except ImportError:\n                 pass\ndiff --git a/setuptools/extern/__init__.py b/setuptools/extern/__init__.py\n--- a/setuptools/extern/__init__.py\n+++ b/setuptools/extern/__init__.py\n@@ -43,13 +43,6 @@\n                 __import__(extant)\n                 mod = sys.modules[extant]\n                 sys.modules[fullname] = mod\n-                # mysterious hack:\n-                # Remove the reference to the extant package/module\n-                # on later Python versions to cause relative imports\n-                # in the vendor package to resolve the same modules\n-                # as those going through this importer.\n-                if sys.version_info >= (3, ):\n-                    del sys.modules[extant]\n                 return mod\n             except ImportError:\n                 pass\n", "issue": "package metadata is no longer picklable\nSince switching to OrderedDict, package metadata can no longer be pickled.\r\n\r\nThis can cause problems if you try to use setuptools with multiprocessing.\r\n\r\n```\r\nTraceback (most recent call last):\r\n  File \"/Users/dan/Documents/colcon_ws/src/colcon-python-setup-py/colcon_python_setup_py/package_identification/python_setup_py.py\", line 257, in get_setup_information\r\n    'stop_after': 'config'\r\n  File \"/usr/local/Cellar/python/3.7.4_1/Frameworks/Python.framework/Versions/3.7/lib/python3.7/multiprocessing/pool.py\", line 261, in apply\r\n    return self.apply_async(func, args, kwds).get()\r\n  File \"/usr/local/Cellar/python/3.7.4_1/Frameworks/Python.framework/Versions/3.7/lib/python3.7/multiprocessing/pool.py\", line 657, in get\r\n    raise self._value\r\nmultiprocessing.pool.MaybeEncodingError: Error sending result: '<distutils.dist.DistributionMetadata object at 0x10c1fcd50>'. Reason: 'PicklingError(\"Can't pickle <class 'setuptools._vendor.ordered_set.OrderedSet'>: it's not the same object as setuptools._vendor.ordered_set.OrderedSet\")'\r\n```\r\n\r\n_Originally posted by @rotu in https://github.com/pypa/setuptools/pull/1690#issuecomment-545992670_\npackage metadata is no longer picklable\nSince switching to OrderedDict, package metadata can no longer be pickled.\r\n\r\nThis can cause problems if you try to use setuptools with multiprocessing.\r\n\r\n```\r\nTraceback (most recent call last):\r\n  File \"/Users/dan/Documents/colcon_ws/src/colcon-python-setup-py/colcon_python_setup_py/package_identification/python_setup_py.py\", line 257, in get_setup_information\r\n    'stop_after': 'config'\r\n  File \"/usr/local/Cellar/python/3.7.4_1/Frameworks/Python.framework/Versions/3.7/lib/python3.7/multiprocessing/pool.py\", line 261, in apply\r\n    return self.apply_async(func, args, kwds).get()\r\n  File \"/usr/local/Cellar/python/3.7.4_1/Frameworks/Python.framework/Versions/3.7/lib/python3.7/multiprocessing/pool.py\", line 657, in get\r\n    raise self._value\r\nmultiprocessing.pool.MaybeEncodingError: Error sending result: '<distutils.dist.DistributionMetadata object at 0x10c1fcd50>'. Reason: 'PicklingError(\"Can't pickle <class 'setuptools._vendor.ordered_set.OrderedSet'>: it's not the same object as setuptools._vendor.ordered_set.OrderedSet\")'\r\n```\r\n\r\n_Originally posted by @rotu in https://github.com/pypa/setuptools/pull/1690#issuecomment-545992670_\n", "before_files": [{"content": "import sys\n\n\nclass VendorImporter:\n    \"\"\"\n    A PEP 302 meta path importer for finding optionally-vendored\n    or otherwise naturally-installed packages from root_name.\n    \"\"\"\n\n    def __init__(self, root_name, vendored_names=(), vendor_pkg=None):\n        self.root_name = root_name\n        self.vendored_names = set(vendored_names)\n        self.vendor_pkg = vendor_pkg or root_name.replace('extern', '_vendor')\n\n    @property\n    def search_path(self):\n        \"\"\"\n        Search first the vendor package then as a natural package.\n        \"\"\"\n        yield self.vendor_pkg + '.'\n        yield ''\n\n    def find_module(self, fullname, path=None):\n        \"\"\"\n        Return self when fullname starts with root_name and the\n        target module is one vendored through this importer.\n        \"\"\"\n        root, base, target = fullname.partition(self.root_name + '.')\n        if root:\n            return\n        if not any(map(target.startswith, self.vendored_names)):\n            return\n        return self\n\n    def load_module(self, fullname):\n        \"\"\"\n        Iterate over the search path to locate and load fullname.\n        \"\"\"\n        root, base, target = fullname.partition(self.root_name + '.')\n        for prefix in self.search_path:\n            try:\n                extant = prefix + target\n                __import__(extant)\n                mod = sys.modules[extant]\n                sys.modules[fullname] = mod\n                # mysterious hack:\n                # Remove the reference to the extant package/module\n                # on later Python versions to cause relative imports\n                # in the vendor package to resolve the same modules\n                # as those going through this importer.\n                if sys.version_info >= (3, ):\n                    del sys.modules[extant]\n                return mod\n            except ImportError:\n                pass\n        else:\n            raise ImportError(\n                \"The '{target}' package is required; \"\n                \"normally this is bundled with this package so if you get \"\n                \"this warning, consult the packager of your \"\n                \"distribution.\".format(**locals())\n            )\n\n    def install(self):\n        \"\"\"\n        Install this importer into sys.meta_path if not already present.\n        \"\"\"\n        if self not in sys.meta_path:\n            sys.meta_path.append(self)\n\n\nnames = 'six', 'packaging', 'pyparsing', 'ordered_set',\nVendorImporter(__name__, names, 'setuptools._vendor').install()\n", "path": "setuptools/extern/__init__.py"}, {"content": "import sys\n\n\nclass VendorImporter:\n    \"\"\"\n    A PEP 302 meta path importer for finding optionally-vendored\n    or otherwise naturally-installed packages from root_name.\n    \"\"\"\n\n    def __init__(self, root_name, vendored_names=(), vendor_pkg=None):\n        self.root_name = root_name\n        self.vendored_names = set(vendored_names)\n        self.vendor_pkg = vendor_pkg or root_name.replace('extern', '_vendor')\n\n    @property\n    def search_path(self):\n        \"\"\"\n        Search first the vendor package then as a natural package.\n        \"\"\"\n        yield self.vendor_pkg + '.'\n        yield ''\n\n    def find_module(self, fullname, path=None):\n        \"\"\"\n        Return self when fullname starts with root_name and the\n        target module is one vendored through this importer.\n        \"\"\"\n        root, base, target = fullname.partition(self.root_name + '.')\n        if root:\n            return\n        if not any(map(target.startswith, self.vendored_names)):\n            return\n        return self\n\n    def load_module(self, fullname):\n        \"\"\"\n        Iterate over the search path to locate and load fullname.\n        \"\"\"\n        root, base, target = fullname.partition(self.root_name + '.')\n        for prefix in self.search_path:\n            try:\n                extant = prefix + target\n                __import__(extant)\n                mod = sys.modules[extant]\n                sys.modules[fullname] = mod\n                # mysterious hack:\n                # Remove the reference to the extant package/module\n                # on later Python versions to cause relative imports\n                # in the vendor package to resolve the same modules\n                # as those going through this importer.\n                if prefix and sys.version_info > (3, 3):\n                    del sys.modules[extant]\n                return mod\n            except ImportError:\n                pass\n        else:\n            raise ImportError(\n                \"The '{target}' package is required; \"\n                \"normally this is bundled with this package so if you get \"\n                \"this warning, consult the packager of your \"\n                \"distribution.\".format(**locals())\n            )\n\n    def install(self):\n        \"\"\"\n        Install this importer into sys.meta_path if not already present.\n        \"\"\"\n        if self not in sys.meta_path:\n            sys.meta_path.append(self)\n\n\nnames = 'packaging', 'pyparsing', 'six', 'appdirs'\nVendorImporter(__name__, names).install()\n", "path": "pkg_resources/extern/__init__.py"}], "after_files": [{"content": "import sys\n\n\nclass VendorImporter:\n    \"\"\"\n    A PEP 302 meta path importer for finding optionally-vendored\n    or otherwise naturally-installed packages from root_name.\n    \"\"\"\n\n    def __init__(self, root_name, vendored_names=(), vendor_pkg=None):\n        self.root_name = root_name\n        self.vendored_names = set(vendored_names)\n        self.vendor_pkg = vendor_pkg or root_name.replace('extern', '_vendor')\n\n    @property\n    def search_path(self):\n        \"\"\"\n        Search first the vendor package then as a natural package.\n        \"\"\"\n        yield self.vendor_pkg + '.'\n        yield ''\n\n    def find_module(self, fullname, path=None):\n        \"\"\"\n        Return self when fullname starts with root_name and the\n        target module is one vendored through this importer.\n        \"\"\"\n        root, base, target = fullname.partition(self.root_name + '.')\n        if root:\n            return\n        if not any(map(target.startswith, self.vendored_names)):\n            return\n        return self\n\n    def load_module(self, fullname):\n        \"\"\"\n        Iterate over the search path to locate and load fullname.\n        \"\"\"\n        root, base, target = fullname.partition(self.root_name + '.')\n        for prefix in self.search_path:\n            try:\n                extant = prefix + target\n                __import__(extant)\n                mod = sys.modules[extant]\n                sys.modules[fullname] = mod\n                return mod\n            except ImportError:\n                pass\n        else:\n            raise ImportError(\n                \"The '{target}' package is required; \"\n                \"normally this is bundled with this package so if you get \"\n                \"this warning, consult the packager of your \"\n                \"distribution.\".format(**locals())\n            )\n\n    def install(self):\n        \"\"\"\n        Install this importer into sys.meta_path if not already present.\n        \"\"\"\n        if self not in sys.meta_path:\n            sys.meta_path.append(self)\n\n\nnames = 'six', 'packaging', 'pyparsing', 'ordered_set',\nVendorImporter(__name__, names, 'setuptools._vendor').install()\n", "path": "setuptools/extern/__init__.py"}, {"content": "import sys\n\n\nclass VendorImporter:\n    \"\"\"\n    A PEP 302 meta path importer for finding optionally-vendored\n    or otherwise naturally-installed packages from root_name.\n    \"\"\"\n\n    def __init__(self, root_name, vendored_names=(), vendor_pkg=None):\n        self.root_name = root_name\n        self.vendored_names = set(vendored_names)\n        self.vendor_pkg = vendor_pkg or root_name.replace('extern', '_vendor')\n\n    @property\n    def search_path(self):\n        \"\"\"\n        Search first the vendor package then as a natural package.\n        \"\"\"\n        yield self.vendor_pkg + '.'\n        yield ''\n\n    def find_module(self, fullname, path=None):\n        \"\"\"\n        Return self when fullname starts with root_name and the\n        target module is one vendored through this importer.\n        \"\"\"\n        root, base, target = fullname.partition(self.root_name + '.')\n        if root:\n            return\n        if not any(map(target.startswith, self.vendored_names)):\n            return\n        return self\n\n    def load_module(self, fullname):\n        \"\"\"\n        Iterate over the search path to locate and load fullname.\n        \"\"\"\n        root, base, target = fullname.partition(self.root_name + '.')\n        for prefix in self.search_path:\n            try:\n                extant = prefix + target\n                __import__(extant)\n                mod = sys.modules[extant]\n                sys.modules[fullname] = mod\n                return mod\n            except ImportError:\n                pass\n        else:\n            raise ImportError(\n                \"The '{target}' package is required; \"\n                \"normally this is bundled with this package so if you get \"\n                \"this warning, consult the packager of your \"\n                \"distribution.\".format(**locals())\n            )\n\n    def install(self):\n        \"\"\"\n        Install this importer into sys.meta_path if not already present.\n        \"\"\"\n        if self not in sys.meta_path:\n            sys.meta_path.append(self)\n\n\nnames = 'packaging', 'pyparsing', 'six', 'appdirs'\nVendorImporter(__name__, names).install()\n", "path": "pkg_resources/extern/__init__.py"}]}