This file is indexed.

/usr/lib/python2.7/dist-packages/numba/llvmthreadsafe.py is in python-numba 0.34.0-3.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
"""
Utils for managing LLVM for threadsafe usage.
"""
import types
import threading
import functools
import contextlib
import llvmlite.binding as llvm


class LockLLVM(object):
    """
    For locking LLVM.
    Usable as contextmanager and decorator.
    """

    def __init__(self):
        self._llvm_lock = threading.RLock()

    def __enter__(self):
        self._llvm_lock.acquire()

    def __exit__(self, *args, **kwargs):
        self._llvm_lock.release()

    def __call__(self, fn):
        @functools.wraps(fn)
        def wrapped(*args, **kwargs):
            with self:
                return fn(*args, **kwargs)
        return wrapped


# Make singleton
lock_llvm = LockLLVM()
del LockLLVM


def _patch_dispose(llvmobj):
    """
    Patch the _dispose method of the llvm object to use the llvm lock.
    """
    dtor = llvmobj._dispose

    def _ts_dispose():
        with lock_llvm:
            dtor()

    llvmobj._dispose = _ts_dispose
    return llvmobj


def _patch_retval_dispose(fn):
    """
    Patch the _dispose method of the return value of the wrapped function.
    """
    @functools.wraps(fn)
    def wrapper(*args, **kwargs):
        return _patch_dispose(fn(*args, **kwargs))
    return wrapper


# Bind llvm API with the lock
parse_assembly = lock_llvm(_patch_retval_dispose(llvm.parse_assembly))
parse_bitcode = lock_llvm(_patch_retval_dispose(llvm.parse_bitcode))
create_mcjit_compiler = lock_llvm(llvm.create_mcjit_compiler)
create_module_pass_manager = lock_llvm(llvm.create_module_pass_manager)
create_function_pass_manager = lock_llvm(llvm.create_function_pass_manager)