# Buggy code
def lookup(self, name):
    # Look up name in this scope or an enclosing one.
    # Return None if not found.
    name = self.mangle_class_private_name(name)
    return (
        self.lookup_here(name)
        or (self.outer_scope and self.outer_scope.lookup(name))
        or None
    )


# Traceback (Cython.Compiler.Errors.CompileError)
(bleeding) ✔  ~/source/other_source/pandas [master {pandas/master}|✚ 2]
jupiter@15:19  ➤  pip install -v .
Non-user install because user site-packages disabled
Created temporary directory: /tmp/pip-ephem-wheel-cache-zcmyaxf3
Created temporary directory: /tmp/pip-req-tracker-dfm6xgbp
Initialized build tracking at /tmp/pip-req-tracker-dfm6xgbp
Created build tracker: /tmp/pip-req-tracker-dfm6xgbp
Entered build tracker: /tmp/pip-req-tracker-dfm6xgbp
Created temporary directory: /tmp/pip-install-_tjupc3v
Processing /home/tcaswell/source/other_source/pandas
Created temporary directory: /tmp/pip-req-build-eh2hlgu3
Added file:///home/tcaswell/source/other_source/pandas to build tracker '/tmp/pip-req-tracker-dfm6xgbp'
Running setup.py (path:/tmp/pip-req-build-eh2hlgu3/setup.py) egg_info for package from file:///home/tcaswell/source/other_source/pandas
Running command python setup.py egg_info
warning: pandas/_libs/groupby.pyx:1101:26: Unreachable code

Error compiling Cython file:
------------------------------------------------------------
...
cdef Py_ssize_t itemsize
cdef bint dtype_signed
cdef char kind
itemsize = -1
cdef bint ___pyx_int64_t_is_signed
___pyx_int64_t_is_signed = not (<___pyx_int64_t> -1 > 0)
^
------------------------------------------------------------

(tree fragment):19:37: '___pyx_int64_t' is not a type identifier

Error compiling Cython file:
------------------------------------------------------------
...
cdef char kind
itemsize = -1
cdef bint ___pyx_int64_t_is_signed
___pyx_int64_t_is_signed = not (<___pyx_int64_t> -1 > 0)
cdef bint ___pyx_uint64_t_is_signed
___pyx_uint64_t_is_signed = not (<___pyx_uint64_t> -1 > 0)
^
------------------------------------------------------------

(tree fragment):21:38: '___pyx_uint64_t' is not a type identifier

Error compiling Cython file:
------------------------------------------------------------
...
values = [self.right, self.left]

sort_order = np.lexsort(values)
return is_monotonic(sort_order, False)[0]

def get_indexer(self, scalar_t[:] target):
^
------------------------------------------------------------

pandas/_libs/intervaltree.pxi:122:4: undeclared name not builtin: ___pyx_int64_t

Error compiling Cython file:
------------------------------------------------------------
...
values = [self.right, self.left]

sort_order = np.lexsort(values)
return is_monotonic(sort_order, False)[0]

def get_indexer(self, scalar_t[:] target):
^
------------------------------------------------------------

pandas/_libs/intervaltree.pxi:122:4: '___pyx_int64_t' redeclared

Error compiling Cython file:
------------------------------------------------------------
...
ctypedef struct __Pyx_memviewslice:
void *memview

void __PYX_XDEC_MEMVIEW(__Pyx_memviewslice *, int have_gil)
bint __pyx_memoryview_check(object)
ctypedef long long ___pyx_int64_t "__pyx_t_5numpy_int64_t"
^
------------------------------------------------------------

__pyxutil:15:4: Previous declaration is here

Error compiling Cython file:
------------------------------------------------------------
...
values = [self.right, self.left]

sort_order = np.lexsort(values)
return is_monotonic(sort_order, False)[0]

def get_indexer(self, scalar_t[:] target):
^
------------------------------------------------------------

pandas/_libs/intervaltree.pxi:122:4: undeclared name not builtin: ___pyx_uint64_t

Error compiling Cython file:
------------------------------------------------------------
...
values = [self.right, self.left]

sort_order = np.lexsort(values)
return is_monotonic(sort_order, False)[0]

def get_indexer(self, scalar_t[:] target):
^
------------------------------------------------------------

pandas/_libs/intervaltree.pxi:122:4: '___pyx_uint64_t' redeclared

Error compiling Cython file:
------------------------------------------------------------
...

void __PYX_XDEC_MEMVIEW(__Pyx_memviewslice *, int have_gil)
bint __pyx_memoryview_check(object)
ctypedef long long ___pyx_int64_t "__pyx_t_5numpy_int64_t"
ctypedef double ___pyx_float64_t "__pyx_t_5numpy_float64_t"
ctypedef unsigned long long ___pyx_uint64_t "__pyx_t_5numpy_uint64_t"
^
------------------------------------------------------------

__pyxutil:17:4: Previous declaration is here

Error compiling Cython file:
------------------------------------------------------------
...
values = [self.right, self.left]

sort_order = np.lexsort(values)
return is_monotonic(sort_order, False)[0]

def get_indexer(self, scalar_t[:] target):
^
------------------------------------------------------------

pandas/_libs/intervaltree.pxi:122:4: undeclared name not builtin: ___pyx_float64_t

Error compiling Cython file:
------------------------------------------------------------
...
values = [self.right, self.left]

sort_order = np.lexsort(values)
return is_monotonic(sort_order, False)[0]

def get_indexer(self, scalar_t[:] target):
^
------------------------------------------------------------

pandas/_libs/intervaltree.pxi:122:4: '___pyx_float64_t' redeclared

Error compiling Cython file:
------------------------------------------------------------
...
void *memview

void __PYX_XDEC_MEMVIEW(__Pyx_memviewslice *, int have_gil)
bint __pyx_memoryview_check(object)
ctypedef long long ___pyx_int64_t "__pyx_t_5numpy_int64_t"
ctypedef double ___pyx_float64_t "__pyx_t_5numpy_float64_t"
^
------------------------------------------------------------

__pyxutil:16:4: Previous declaration is here

Error compiling Cython file:
------------------------------------------------------------
...
values = [self.right, self.left]

sort_order = np.lexsort(values)
return is_monotonic(sort_order, False)[0]

def get_indexer(self, scalar_t[:] target):
^
------------------------------------------------------------

pandas/_libs/intervaltree.pxi:122:4: undeclared name not builtin: ___pyx_int64_t

Error compiling Cython file:
------------------------------------------------------------
...
values = [self.right, self.left]

sort_order = np.lexsort(values)
return is_monotonic(sort_order, False)[0]

def get_indexer(self, scalar_t[:] target):
^
------------------------------------------------------------

pandas/_libs/intervaltree.pxi:122:4: '___pyx_int64_t' redeclared

Error compiling Cython file:
------------------------------------------------------------
...
values = [self.right, self.left]

sort_order = np.lexsort(values)
return is_monotonic(sort_order, False)[0]

def get_indexer(self, scalar_t[:] target):
^
------------------------------------------------------------

pandas/_libs/intervaltree.pxi:122:4: Previous declaration is here

Error compiling Cython file:
------------------------------------------------------------
...
values = [self.right, self.left]

sort_order = np.lexsort(values)
return is_monotonic(sort_order, False)[0]

def get_indexer(self, scalar_t[:] target):
^
------------------------------------------------------------

pandas/_libs/intervaltree.pxi:122:4: undeclared name not builtin: ___pyx_float64_t

Error compiling Cython file:
------------------------------------------------------------
...
values = [self.right, self.left]

sort_order = np.lexsort(values)
return is_monotonic(sort_order, False)[0]

def get_indexer(self, scalar_t[:] target):
^
------------------------------------------------------------

pandas/_libs/intervaltree.pxi:122:4: '___pyx_float64_t' redeclared

Error compiling Cython file:
------------------------------------------------------------
...
values = [self.right, self.left]

sort_order = np.lexsort(values)
return is_monotonic(sort_order, False)[0]

def get_indexer(self, scalar_t[:] target):
^
------------------------------------------------------------

pandas/_libs/intervaltree.pxi:122:4: Previous declaration is here

Error compiling Cython file:
------------------------------------------------------------
...
values = [self.right, self.left]

sort_order = np.lexsort(values)
return is_monotonic(sort_order, False)[0]

def get_indexer(self, scalar_t[:] target):
^
------------------------------------------------------------

pandas/_libs/intervaltree.pxi:122:4: undeclared name not builtin: ___pyx_uint64_t

Error compiling Cython file:
------------------------------------------------------------
...
values = [self.right, self.left]

sort_order = np.lexsort(values)
return is_monotonic(sort_order, False)[0]

def get_indexer(self, scalar_t[:] target):
^
------------------------------------------------------------

pandas/_libs/intervaltree.pxi:122:4: '___pyx_uint64_t' redeclared

Error compiling Cython file:
------------------------------------------------------------
...
values = [self.right, self.left]

sort_order = np.lexsort(values)
return is_monotonic(sort_order, False)[0]

def get_indexer(self, scalar_t[:] target):
^
------------------------------------------------------------

pandas/_libs/intervaltree.pxi:122:4: Previous declaration is here

Error compiling Cython file:
------------------------------------------------------------
...
cdef Py_ssize_t itemsize
cdef bint dtype_signed
cdef char kind
itemsize = -1
cdef bint ___pyx_int64_t_is_signed
___pyx_int64_t_is_signed = not (<___pyx_int64_t> -1 > 0)
^
------------------------------------------------------------

(tree fragment):19:37: '___pyx_int64_t' is not a type identifier

Error compiling Cython file:
------------------------------------------------------------
...
cdef char kind
itemsize = -1
cdef bint ___pyx_int64_t_is_signed
___pyx_int64_t_is_signed = not (<___pyx_int64_t> -1 > 0)
cdef bint ___pyx_uint64_t_is_signed
___pyx_uint64_t_is_signed = not (<___pyx_uint64_t> -1 > 0)
^
------------------------------------------------------------

(tree fragment):21:38: '___pyx_uint64_t' is not a type identifier

Error compiling Cython file:
------------------------------------------------------------
...
raise KeyError(
'indexer does not intersect a unique set of intervals')
old_len = result.data.n
return result.to_array().astype('intp')

def get_indexer_non_unique(self, scalar_t[:] target):
^
------------------------------------------------------------

pandas/_libs/intervaltree.pxi:150:4: undeclared name not builtin: ___pyx_int64_t

Error compiling Cython file:
------------------------------------------------------------
...
raise KeyError(
'indexer does not intersect a unique set of intervals')
old_len = result.data.n
return result.to_array().astype('intp')

def get_indexer_non_unique(self, scalar_t[:] target):
^
------------------------------------------------------------

pandas/_libs/intervaltree.pxi:150:4: '___pyx_int64_t' redeclared

Error compiling Cython file:
------------------------------------------------------------
...
values = [self.right, self.left]

sort_order = np.lexsort(values)
return is_monotonic(sort_order, False)[0]

def get_indexer(self, scalar_t[:] target):
^
------------------------------------------------------------

pandas/_libs/intervaltree.pxi:122:4: Previous declaration is here

Error compiling Cython file:
------------------------------------------------------------
...
raise KeyError(
'indexer does not intersect a unique set of intervals')
old_len = result.data.n
return result.to_array().astype('intp')

def get_indexer_non_unique(self, scalar_t[:] target):
^
------------------------------------------------------------

pandas/_libs/intervaltree.pxi:150:4: undeclared name not builtin: ___pyx_uint64_t

Error compiling Cython file:
------------------------------------------------------------
...
raise KeyError(
'indexer does not intersect a unique set of intervals')
old_len = result.data.n
return result.to_array().astype('intp')

def get_indexer_non_unique(self, scalar_t[:] target):
^
------------------------------------------------------------

pandas/_libs/intervaltree.pxi:150:4: '___pyx_uint64_t' redeclared

Error compiling Cython file:
------------------------------------------------------------
...
values = [self.right, self.left]

sort_order = np.lexsort(values)
return is_monotonic(sort_order, False)[0]

def get_indexer(self, scalar_t[:] target):
^
------------------------------------------------------------

pandas/_libs/intervaltree.pxi:122:4: Previous declaration is here

Error compiling Cython file:
------------------------------------------------------------
...
raise KeyError(
'indexer does not intersect a unique set of intervals')
old_len = result.data.n
return result.to_array().astype('intp')

def get_indexer_non_unique(self, scalar_t[:] target):
^
------------------------------------------------------------

pandas/_libs/intervaltree.pxi:150:4: undeclared name not builtin: ___pyx_float64_t

Error compiling Cython file:
------------------------------------------------------------
...
raise KeyError(
'indexer does not intersect a unique set of intervals')
old_len = result.data.n
return result.to_array().astype('intp')

def get_indexer_non_unique(self, scalar_t[:] target):
^
------------------------------------------------------------

pandas/_libs/intervaltree.pxi:150:4: '___pyx_float64_t' redeclared

Error compiling Cython file:
------------------------------------------------------------
...
values = [self.right, self.left]

sort_order = np.lexsort(values)
return is_monotonic(sort_order, False)[0]

def get_indexer(self, scalar_t[:] target):
^
------------------------------------------------------------

pandas/_libs/intervaltree.pxi:122:4: Previous declaration is here

Error compiling Cython file:
------------------------------------------------------------
...
raise KeyError(
'indexer does not intersect a unique set of intervals')
old_len = result.data.n
return result.to_array().astype('intp')

def get_indexer_non_unique(self, scalar_t[:] target):
^
------------------------------------------------------------

pandas/_libs/intervaltree.pxi:150:4: undeclared name not builtin: ___pyx_int64_t

Error compiling Cython file:
------------------------------------------------------------
...
raise KeyError(
'indexer does not intersect a unique set of intervals')
old_len = result.data.n
return result.to_array().astype('intp')

def get_indexer_non_unique(self, scalar_t[:] target):
^
------------------------------------------------------------

pandas/_libs/intervaltree.pxi:150:4: '___pyx_int64_t' redeclared

Error compiling Cython file:
------------------------------------------------------------
...
raise KeyError(
'indexer does not intersect a unique set of intervals')
old_len = result.data.n
return result.to_array().astype('intp')

def get_indexer_non_unique(self, scalar_t[:] target):
^
------------------------------------------------------------

pandas/_libs/intervaltree.pxi:150:4: Previous declaration is here

Error compiling Cython file:
------------------------------------------------------------
...
raise KeyError(
'indexer does not intersect a unique set of intervals')
old_len = result.data.n
return result.to_array().astype('intp')

def get_indexer_non_unique(self, scalar_t[:] target):
^
------------------------------------------------------------

pandas/_libs/intervaltree.pxi:150:4: undeclared name not builtin: ___pyx_float64_t

Error compiling Cython file:
------------------------------------------------------------
...
raise KeyError(
'indexer does not intersect a unique set of intervals')
old_len = result.data.n
return result.to_array().astype('intp')

def get_indexer_non_unique(self, scalar_t[:] target):
^
------------------------------------------------------------

pandas/_libs/intervaltree.pxi:150:4: '___pyx_float64_t' redeclared

Error compiling Cython file:
------------------------------------------------------------
...
raise KeyError(
'indexer does not intersect a unique set of intervals')
old_len = result.data.n
return result.to_array().astype('intp')

def get_indexer_non_unique(self, scalar_t[:] target):
^
------------------------------------------------------------

pandas/_libs/intervaltree.pxi:150:4: Previous declaration is here

Error compiling Cython file:
------------------------------------------------------------
...
raise KeyError(
'indexer does not intersect a unique set of intervals')
old_len = result.data.n
return result.to_array().astype('intp')

def get_indexer_non_unique(self, scalar_t[:] target):
^
------------------------------------------------------------

pandas/_libs/intervaltree.pxi:150:4: undeclared name not builtin: ___pyx_uint64_t

Error compiling Cython file:
------------------------------------------------------------
...
raise KeyError(
'indexer does not intersect a unique set of intervals')
old_len = result.data.n
return result.to_array().astype('intp')

def get_indexer_non_unique(self, scalar_t[:] target):
^
------------------------------------------------------------

pandas/_libs/intervaltree.pxi:150:4: '___pyx_uint64_t' redeclared

Error compiling Cython file:
------------------------------------------------------------
...
raise KeyError(
'indexer does not intersect a unique set of intervals')
old_len = result.data.n
return result.to_array().astype('intp')

def get_indexer_non_unique(self, scalar_t[:] target):
^
------------------------------------------------------------

pandas/_libs/intervaltree.pxi:150:4: Previous declaration is here
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-req-build-eh2hlgu3/setup.py", line 794, in <module>
setup_package()
File "/tmp/pip-req-build-eh2hlgu3/setup.py", line 764, in setup_package
ext_modules=maybe_cythonize(extensions, compiler_directives=directives),
File "/tmp/pip-req-build-eh2hlgu3/setup.py", line 537, in maybe_cythonize
return cythonize(extensions, *args, **kwargs)
File "/home/tcaswell/.virtualenvs/bleeding/lib/python3.9/site-packages/Cython/Build/Dependencies.py", line 1105, in cythonize
cythonize_one(*args)
File "/home/tcaswell/.virtualenvs/bleeding/lib/python3.9/site-packages/Cython/Build/Dependencies.py", line 1263, in cythonize_one
raise CompileError(None, pyx_file)
Cython.Compiler.Errors.CompileError: pandas/_libs/interval.pyx
Compiling pandas/_libs/algos.pyx because it changed.
Compiling pandas/_libs/groupby.pyx because it changed.
Compiling pandas/_libs/hashing.pyx because it changed.
Compiling pandas/_libs/hashtable.pyx because it changed.
Compiling pandas/_libs/index.pyx because it changed.
Compiling pandas/_libs/indexing.pyx because it changed.
Compiling pandas/_libs/internals.pyx because it changed.
Compiling pandas/_libs/interval.pyx because it changed.
Compiling pandas/_libs/join.pyx because it changed.
Compiling pandas/_libs/lib.pyx because it changed.
Compiling pandas/_libs/missing.pyx because it changed.
Compiling pandas/_libs/parsers.pyx because it changed.
Compiling pandas/_libs/reduction.pyx because it changed.
Compiling pandas/_libs/ops.pyx because it changed.
Compiling pandas/_libs/ops_dispatch.pyx because it changed.
Compiling pandas/_libs/properties.pyx because it changed.
Compiling pandas/_libs/reshape.pyx because it changed.
Compiling pandas/_libs/sparse.pyx because it changed.
Compiling pandas/_libs/tslib.pyx because it changed.
Compiling pandas/_libs/tslibs/c_timestamp.pyx because it changed.
Compiling pandas/_libs/tslibs/ccalendar.pyx because it changed.
Compiling pandas/_libs/tslibs/conversion.pyx because it changed.
Compiling pandas/_libs/tslibs/fields.pyx because it changed.
Compiling pandas/_libs/tslibs/frequencies.pyx because it changed.
Compiling pandas/_libs/tslibs/nattype.pyx because it changed.
Compiling pandas/_libs/tslibs/np_datetime.pyx because it changed.
Compiling pandas/_libs/tslibs/offsets.pyx because it changed.
Compiling pandas/_libs/tslibs/parsing.pyx because it changed.
Compiling pandas/_libs/tslibs/period.pyx because it changed.
Compiling pandas/_libs/tslibs/resolution.pyx because it changed.
Compiling pandas/_libs/tslibs/strptime.pyx because it changed.
Compiling pandas/_libs/tslibs/timedeltas.pyx because it changed.
Compiling pandas/_libs/tslibs/timestamps.pyx because it changed.
Compiling pandas/_libs/tslibs/timezones.pyx because it changed.
Compiling pandas/_libs/tslibs/tzconversion.pyx because it changed.
Compiling pandas/_libs/testing.pyx because it changed.
Compiling pandas/_libs/window/aggregations.pyx because it changed.
Compiling pandas/_libs/window/indexers.pyx because it changed.
Compiling pandas/_libs/writers.pyx because it changed.
Compiling pandas/io/sas/sas.pyx because it changed.
[ 1/40] Cythonizing pandas/_libs/algos.pyx
[ 2/40] Cythonizing pandas/_libs/groupby.pyx
[ 3/40] Cythonizing pandas/_libs/hashing.pyx
[ 4/40] Cythonizing pandas/_libs/hashtable.pyx
[ 5/40] Cythonizing pandas/_libs/index.pyx
[ 6/40] Cythonizing pandas/_libs/indexing.pyx
[ 7/40] Cythonizing pandas/_libs/internals.pyx
[ 8/40] Cythonizing pandas/_libs/interval.pyx
Cleaning up...
Removing source in /tmp/pip-req-build-eh2hlgu3
Removed file:///home/tcaswell/source/other_source/pandas from build tracker '/tmp/pip-req-tracker-dfm6xgbp'
Removed build tracker: '/tmp/pip-req-tracker-dfm6xgbp'
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
Exception information:
Traceback (most recent call last):
File "/home/tcaswell/.virtualenvs/bleeding/lib/python3.9/site-packages/pip/_internal/cli/base_command.py", line 186, in _main
status = self.run(options, args)
File "/home/tcaswell/.virtualenvs/bleeding/lib/python3.9/site-packages/pip/_internal/commands/install.py", line 331, in run
resolver.resolve(requirement_set)
File "/home/tcaswell/.virtualenvs/bleeding/lib/python3.9/site-packages/pip/_internal/legacy_resolve.py", line 177, in resolve
discovered_reqs.extend(self._resolve_one(requirement_set, req))
File "/home/tcaswell/.virtualenvs/bleeding/lib/python3.9/site-packages/pip/_internal/legacy_resolve.py", line 333, in _resolve_one
abstract_dist = self._get_abstract_dist_for(req_to_install)
File "/home/tcaswell/.virtualenvs/bleeding/lib/python3.9/site-packages/pip/_internal/legacy_resolve.py", line 282, in _get_abstract_dist_for
abstract_dist = self.preparer.prepare_linked_requirement(req)
File "/home/tcaswell/.virtualenvs/bleeding/lib/python3.9/site-packages/pip/_internal/operations/prepare.py", line 515, in prepare_linked_requirement
abstract_dist = _get_prepared_distribution(
File "/home/tcaswell/.virtualenvs/bleeding/lib/python3.9/site-packages/pip/_internal/operations/prepare.py", line 95, in _get_prepared_distribution
abstract_dist.prepare_distribution_metadata(finder, build_isolation)
File "/home/tcaswell/.virtualenvs/bleeding/lib/python3.9/site-packages/pip/_internal/distributions/sdist.py", line 40, in prepare_distribution_metadata
self.req.prepare_metadata()
File "/home/tcaswell/.virtualenvs/bleeding/lib/python3.9/site-packages/pip/_internal/req/req_install.py", line 564, in prepare_metadata
self.metadata_directory = self._generate_metadata()
File "/home/tcaswell/.virtualenvs/bleeding/lib/python3.9/site-packages/pip/_internal/req/req_install.py", line 538, in _generate_metadata
return generate_metadata_legacy(
File "/home/tcaswell/.virtualenvs/bleeding/lib/python3.9/site-packages/pip/_internal/operations/build/metadata_legacy.py", line 115, in generate_metadata
call_subprocess(
File "/home/tcaswell/.virtualenvs/bleeding/lib/python3.9/site-packages/pip/_internal/utils/subprocess.py", line 242, in call_subprocess
raise InstallationError(exc_msg)
pip._internal.exceptions.InstallationError: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.

# Fixed code
def lookup(self, name):
    # Look up name in this scope or an enclosing one.
    # Return None if not found.

    mangled_name = self.mangle_class_private_name(name)
    entry = (
        self.lookup_here(name)  # lookup here also does mangling
        or (self.outer_scope and self.outer_scope.lookup(mangled_name))
        or None
    )
    if entry:
        return entry

    # look up the original name in the outer scope
    # Not strictly Python behaviour but see https://github.com/cython/cython/issues/3544
    entry = (self.outer_scope and self.outer_scope.lookup(name)) or None
    if entry and entry.is_pyglobal:
        self._emit_class_private_warning(entry.pos, name)
    return entry