# Buggy code
def push_MatchSpec(self, C, spec):
    spec = MatchSpec(spec)
    sat_name = self.to_sat_name(spec)
    m = C.from_name(sat_name)
    if m is not None:
        # the spec has already been pushed onto the clauses stack
        return sat_name

    simple = spec._is_single()
    nm = spec.get_exact_value("name")
    tf = spec.get_exact_value("track_features")

    if nm:
        tgroup = libs = self.groups.get(nm, [])
    elif tf:
        assert len(tf) == 1
        k = next(iter(tf))
        tgroup = libs = self.trackers.get(k, [])
    else:
        tgroup = libs = self.index.keys()
        simple = False
    if not simple:
        libs = [fkey for fkey in tgroup if self.match(spec, fkey)]
    if len(libs) == len(tgroup):
        if spec.optional:
            m = True
        elif not simple:
            ms2 = MatchSpec(track_features=tf) if tf else MatchSpec(nm)
            m = C.from_name(self.push_MatchSpec(C, ms2))
    if m is None:
        dists = [dist.full_name for dist in libs]
        if spec.optional:
            ms2 = MatchSpec(track_features=tf) if tf else MatchSpec(nm)
            dists.append("!" + self.to_sat_name(ms2))
        m = C.Any(dists)
    C.name_var(m, sat_name)
    return sat_name


# Traceback (RuntimeError)
(base) [nwani@centos7-nwani scratch]$ conda install scratch -c local
Solving environment: failed

# >>>>>>>>>>>>>>>>>>>>>> ERROR REPORT <<<<<<<<<<<<<<<<<<<<<<

Traceback (most recent call last):
File "/home/nwani/m2/lib/python2.7/site-packages/conda/exceptions.py", line 789, in __call__
return func(*args, **kwargs)
File "/home/nwani/m2/lib/python2.7/site-packages/conda/cli/main.py", line 78, in _main
exit_code = do_call(args, p)
File "/home/nwani/m2/lib/python2.7/site-packages/conda/cli/conda_argparse.py", line 77, in do_call
exit_code = getattr(module, func_name)(args, parser)
File "/home/nwani/m2/lib/python2.7/site-packages/conda/cli/main_install.py", line 11, in execute
install(args, parser, 'install')
File "/home/nwani/m2/lib/python2.7/site-packages/conda/cli/install.py", line 236, in install
force_reinstall=context.force,
File "/home/nwani/m2/lib/python2.7/site-packages/conda/core/solve.py", line 504, in solve_for_transaction
force_remove, force_reinstall)
File "/home/nwani/m2/lib/python2.7/site-packages/conda/core/solve.py", line 437, in solve_for_diff
final_precs = self.solve_final_state(deps_modifier, prune, ignore_pinned, force_remove)
File "/home/nwani/m2/lib/python2.7/site-packages/conda/core/solve.py", line 317, in solve_final_state
conflicting_specs = r.get_conflicting_specs(tuple(final_environment_specs))
File "/home/nwani/m2/lib/python2.7/site-packages/conda/resolve.py", line 705, in get_conflicting_specs
C = r2.gen_clauses()
File "/home/nwani/m2/lib/python2.7/site-packages/conda/resolve.py", line 505, in gen_clauses
C.Require(C.Or, nkey, self.push_MatchSpec(C, ms))
File "/home/nwani/m2/lib/python2.7/site-packages/conda/resolve.py", line 477, in push_MatchSpec
m = C.from_name(self.push_MatchSpec(C, ms2))
File "/home/nwani/m2/lib/python2.7/site-packages/conda/resolve.py", line 477, in push_MatchSpec
m = C.from_name(self.push_MatchSpec(C, ms2))
...yada...
...yada...
...yada...
File "/home/nwani/m2/lib/python2.7/site-packages/conda/resolve.py", line 477, in push_MatchSpec
m = C.from_name(self.push_MatchSpec(C, ms2))
File "/home/nwani/m2/lib/python2.7/site-packages/conda/resolve.py", line 477, in push_MatchSpec
m = C.from_name(self.push_MatchSpec(C, ms2))
File "/home/nwani/m2/lib/python2.7/site-packages/conda/resolve.py", line 477, in push_MatchSpec
m = C.from_name(self.push_MatchSpec(C, ms2))
File "/home/nwani/m2/lib/python2.7/site-packages/conda/resolve.py", line 476, in push_MatchSpec
ms2 = MatchSpec(track_features=tf) if tf else MatchSpec(nm)
File "/home/nwani/m2/lib/python2.7/site-packages/conda/models/match_spec.py", line 76, in __call__
return super(MatchSpecType, cls).__call__(**kwargs)
File "/home/nwani/m2/lib/python2.7/site-packages/conda/models/match_spec.py", line 178, in __init__
self._match_components = self._build_components(**kwargs)
File "/home/nwani/m2/lib/python2.7/site-packages/conda/models/match_spec.py", line 365, in _build_components
return frozendict(_make(key, value) for key, value in iteritems(kwargs))
File "/home/nwani/m2/lib/python2.7/collections.py", line 69, in __init__
self.__update(*args, **kwds)
File "/home/nwani/m2/lib/python2.7/_abcoll.py", line 564, in update
if isinstance(other, Mapping):
File "/home/nwani/m2/lib/python2.7/abc.py", line 141, in __instancecheck__
subtype in cls._abc_negative_cache):
File "/home/nwani/m2/lib/python2.7/_weakrefset.py", line 75, in __contains__
return wr in self.data
RuntimeError: maximum recursion depth exceeded in cmp

`$ /home/nwani/m2/bin/conda install scratch -c local`

environment variables:
CIO_TEST=<not set>
CONDA_DEFAULT_ENV=base
CONDA_PREFIX=/home/nwani/m2
CONDA_PROMPT_MODIFIER=(base)
CONDA_PYTHON_EXE=/home/nwani/m2/bin/python
CONDA_ROOT=/home/nwani/m2
CONDA_SHLVL=1
PATH=/home/nwani/m2/bin:/usr/local/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/
home/nwani/.local/bin:/home/nwani/bin
REQUESTS_CA_BUNDLE=<not set>
SSL_CERT_FILE=<not set>

active environment : base
active env location : /home/nwani/m2
shell level : 1
user config file : /home/nwani/.condarc
populated config files :
conda version : 4.4.9
conda-build version : 3.4.1
python version : 2.7.14.final.0
base environment : /home/nwani/m2  (writable)
channel URLs : file:///home/nwani/m2/conda-bld/linux-64
file:///home/nwani/m2/conda-bld/noarch
https://repo.continuum.io/pkgs/main/linux-64
https://repo.continuum.io/pkgs/main/noarch
https://repo.continuum.io/pkgs/free/linux-64
https://repo.continuum.io/pkgs/free/noarch
https://repo.continuum.io/pkgs/r/linux-64
https://repo.continuum.io/pkgs/r/noarch
https://repo.continuum.io/pkgs/pro/linux-64
https://repo.continuum.io/pkgs/pro/noarch
package cache : /home/nwani/m2/pkgs
/home/nwani/.conda/pkgs
envs directories : /home/nwani/m2/envs
/home/nwani/.conda/envs
platform : linux-64
user-agent : conda/4.4.9 requests/2.18.4 CPython/2.7.14 Linux/3.10.0-693.5.2.el7.x86_64 centos/7 glibc/2.17
UID:GID : 1001:1001
netrc file : None
offline mode : False


An unexpected error has occurred. Conda has prepared the above report.
If submitted, this report will be used by core maintainers to improve
future releases of conda.
Would you like conda to send this report to the core maintainers?
[y/N]: y
Upload did not complete.
Thank you for helping to improve conda.
Opt-in to always sending reports (and not see this message again)
by running

$ conda config --set report_errors true

# Fixed code
def push_MatchSpec(self, C, spec):
    spec = MatchSpec(spec)
    sat_name = self.to_sat_name(spec)
    m = C.from_name(sat_name)
    if m is not None:
        # the spec has already been pushed onto the clauses stack
        return sat_name

    simple = spec._is_single()
    nm = spec.get_exact_value("name")
    tf = frozenset(
        _tf
        for _tf in (f.strip() for f in spec.get_exact_value("track_features") or ())
        if _tf
    )

    if nm:
        tgroup = libs = self.groups.get(nm, [])
    elif tf:
        assert len(tf) == 1
        k = next(iter(tf))
        tgroup = libs = self.trackers.get(k, [])
    else:
        tgroup = libs = self.index.keys()
        simple = False
    if not simple:
        libs = [fkey for fkey in tgroup if self.match(spec, fkey)]
    if len(libs) == len(tgroup):
        if spec.optional:
            m = True
        elif not simple:
            ms2 = MatchSpec(track_features=tf) if tf else MatchSpec(nm)
            m = C.from_name(self.push_MatchSpec(C, ms2))
    if m is None:
        dists = [dist.full_name for dist in libs]
        if spec.optional:
            ms2 = MatchSpec(track_features=tf) if tf else MatchSpec(nm)
            dists.append("!" + self.to_sat_name(ms2))
        m = C.Any(dists)
    C.name_var(m, sat_name)
    return sat_name