# Buggy code
def __call__(self, *args, **kw):
    newargs = []
    for arg in args:
        if isinstance(arg, list):
            newargs.append(tuple(arg))
        elif not isinstance(arg, collections.Hashable):
            # uncacheable. a list, for instance.
            # better to not cache than blow up.
            return self.func(*args, **kw)
        else:
            newargs.append(arg)
    newargs = tuple(newargs)
    key = (newargs, frozenset(sorted(kw.items())))
    with self.lock:
        if key in self.cache:
            return self.cache[key]
        else:
            value = self.func(*args, **kw)
            self.cache[key] = value
            return value


# Traceback (ImportError)
$ conda install pandas

An unexpected error has occurred.
Please consider posting the following information to the
conda GitHub issue tracker at:

https://github.com/conda/conda/issues



Traceback (most recent call last):
File "/home/simmi/anaconda3/lib/python3.6/site-packages/conda/exceptions.py", line 591, in conda_exception_handler
return_value = func(*args, **kwargs)
File "/home/simmi/anaconda3/lib/python3.6/site-packages/conda/cli/main.py", line 98, in _main
imported = importlib.import_module(module)
File "/home/simmi/anaconda3/lib/python3.6/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 978, in _gcd_import
File "<frozen importlib._bootstrap>", line 961, in _find_and_load
File "<frozen importlib._bootstrap>", line 950, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 655, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 678, in exec_module
File "<frozen importlib._bootstrap>", line 205, in _call_with_frames_removed
File "/home/simmi/anaconda3/lib/python3.6/site-packages/conda/cli/main_list.py", line 20, in <module>
from ..egg_info import get_egg_info
File "/home/simmi/anaconda3/lib/python3.6/site-packages/conda/egg_info.py", line 15, in <module>
from .misc import rel_path
File "/home/simmi/anaconda3/lib/python3.6/site-packages/conda/misc.py", line 19, in <module>
from .core.index import get_index, _supplement_index_with_cache
File "/home/simmi/anaconda3/lib/python3.6/site-packages/conda/core/index.py", line 8, in <module>
from .package_cache import PackageCache
File "/home/simmi/anaconda3/lib/python3.6/site-packages/conda/core/package_cache.py", line 9, in <module>
from .path_actions import CacheUrlAction, ExtractPackageAction
File "/home/simmi/anaconda3/lib/python3.6/site-packages/conda/core/path_actions.py", line 32, in <module>
from ..gateways.download import download
File "/home/simmi/anaconda3/lib/python3.6/site-packages/conda/gateways/download.py", line 15, in <module>
from ..connection import CondaSession
File "/home/simmi/anaconda3/lib/python3.6/site-packages/conda/connection.py", line 42, in <module>
glibc_ver = gnu_get_libc_version()
File "/home/simmi/anaconda3/lib/python3.6/site-packages/conda/utils.py", line 45, in __call__
value = self.func(*args, **kw)
File "/home/simmi/anaconda3/lib/python3.6/site-packages/conda/utils.py", line 82, in gnu_get_libc_version
from ctypes import CDLL, cdll, c_char_p
File "/home/simmi/anaconda3/lib/python3.6/ctypes/__init__.py", line 7, in <module>
from _ctypes import Union, Structure, Array
ImportError: /home/simmi/anaconda3/lib/python3.6/lib-dynload/_ctypes.cpython-36m-x86_64-linux-gnu.so: undefined symbol: PySlice_Unpack

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/home/simmi/anaconda3/bin/conda", line 6, in <module>
sys.exit(conda.cli.main())
File "/home/simmi/anaconda3/lib/python3.6/site-packages/conda/cli/main.py", line 164, in main
return conda_exception_handler(_main, *args)
File "/home/simmi/anaconda3/lib/python3.6/site-packages/conda/exceptions.py", line 607, in conda_exception_handler
print_unexpected_error_message(e)
File "/home/simmi/anaconda3/lib/python3.6/site-packages/conda/exceptions.py", line 561, in print_unexpected_error_message
info_stdout, info_stderr = get_info()
File "/home/simmi/anaconda3/lib/python3.6/site-packages/conda/exceptions.py", line 531, in get_info
args.func(args, p)
File "/home/simmi/anaconda3/lib/python3.6/site-packages/conda/cli/main_info.py", line 142, in execute
from conda.api import get_index
File "/home/simmi/anaconda3/lib/python3.6/site-packages/conda/api.py", line 1, in <module>
from .core.index import get_index
File "/home/simmi/anaconda3/lib/python3.6/site-packages/conda/core/index.py", line 8, in <module>
from .package_cache import PackageCache
File "/home/simmi/anaconda3/lib/python3.6/site-packages/conda/core/package_cache.py", line 9, in <module>
from .path_actions import CacheUrlAction, ExtractPackageAction
File "/home/simmi/anaconda3/lib/python3.6/site-packages/conda/core/path_actions.py", line 32, in <module>
from ..gateways.download import download
File "/home/simmi/anaconda3/lib/python3.6/site-packages/conda/gateways/download.py", line 15, in <module>
from ..connection import CondaSession
File "/home/simmi/anaconda3/lib/python3.6/site-packages/conda/connection.py", line 42, in <module>
glibc_ver = gnu_get_libc_version()
File "/home/simmi/anaconda3/lib/python3.6/site-packages/conda/utils.py", line 45, in __call__
value = self.func(*args, **kw)
File "/home/simmi/anaconda3/lib/python3.6/site-packages/conda/utils.py", line 82, in gnu_get_libc_version
from ctypes import CDLL, cdll, c_char_p
File "/home/simmi/anaconda3/lib/python3.6/ctypes/__init__.py", line 7, in <module>
from _ctypes import Union, Structure, Array
ImportError: /home/simmi/anaconda3/lib/python3.6/lib-dynload/_ctypes.cpython-36m-x86_64-linux-gnu.so: undefined symbol: PySlice_Unpack```

# Fixed code
def __call__(self, *args, **kw):
    newargs = []
    for arg in args:
        if isinstance(arg, list):
            newargs.append(tuple(arg))
        elif not isinstance(arg, Hashable):
            # uncacheable. a list, for instance.
            # better to not cache than blow up.
            return self.func(*args, **kw)
        else:
            newargs.append(arg)
    newargs = tuple(newargs)
    key = (newargs, frozenset(sorted(kw.items())))
    with self.lock:
        if key in self.cache:
            return self.cache[key]
        else:
            value = self.func(*args, **kw)
            self.cache[key] = value
            return value