PyPI / filelock / 4.2.1

filelock 4.2.1

Source
https://github.com/tox-dev/py-filelock
Tag scanned
4.2.1
Compared with
4.2.0 (6 signals introduced since)
Files
95 scanned, 9 skipped (binary, oversized, or unrecognised)
Signals
0 critical · 0 warn · 23 info
Scan time
14.3 s
LLM review
Reviewed by claude-haiku-5-5 (Anthropic): 23 of 23 warn and critical signals; 23 demoted to info.
Disclude version
4.0.0
Scanned (UTC)
2026-10-18 09:41

Signals

Ordered by severity, then signals introduced in this release. Hidden characters are shown as ⟨U+…⟩.

  1. info warn → info by review frame-introspection tests/test_async_filelock.py:1524:5 new in this release

    `sys.setprofile` — call-stack frame introspection (ast pass, confidence 0.70)

    
        sys.setprofile(take_from_cache)
        try:
            AsyncFileLock(lock_path, is_singleton=True, thread_local=thread_local, run_in_executor=False)
    likely benign LLM, confidence 0.90 Test installs a profiler hook to exercise a singleton cache race.
    Reasoning

    A test installs a profile hook to force a cache-path race in singleton creation and then restores it in finally. This is standard test instrumentation.

  2. info warn → info by review frame-introspection tests/test_async_filelock.py:1528:9 new in this release

    `sys.setprofile` — call-stack frame introspection (ast pass, confidence 0.70)

        finally:
            sys.setprofile(None)
    
        with pytest.raises(Timeout):
    likely benign LLM, confidence 0.92 Clears the test profiler hook in cleanup.
    Reasoning

    Clearing the profile hook in a finally block is test cleanup.

  3. info warn → info by review frame-introspection tests/test_filelock.py:629:5 new in this release

    `sys.setprofile` — call-stack frame introspection (ast pass, confidence 0.70)

    
        sys.setprofile(take_from_cache)
        try:
            FileLock(lock_path, is_singleton=True, thread_local=thread_local)
    likely benign LLM, confidence 0.90 Test installs a profiler hook to exercise a singleton cache race.
    Reasoning

    Same singleton race test instrumentation as the async variant, installing a profile hook and cleaning up afterwards.

  4. info warn → info by review frame-introspection tests/test_filelock.py:633:9 new in this release

    `sys.setprofile` — call-stack frame introspection (ast pass, confidence 0.70)

        finally:
            sys.setprofile(None)
        return handed_out.pop()
    likely benign LLM, confidence 0.92 Clears the test profiler hook in cleanup.
    Reasoning

    Resetting the profile hook in finally is test cleanup.

  5. info warn → info by review frame-introspection tests/test_read_write_unit.py:861:5 new in this release

    `sys.setprofile` — call-stack frame introspection (ast pass, confidence 0.70)

    
        sys.setprofile(look_up_while_closing)
        try:
            del lock
    likely benign LLM, confidence 0.90 Test profiler hook used during lock close in a read/write unit test.
    Reasoning

    A read/write lock unit test uses a profile hook to look up lock state while closing, then the test proceeds. This is ordinary test instrumentation.

  6. info warn → info by review frame-introspection tests/test_read_write_unit.py:865:9 new in this release

    `sys.setprofile` — call-stack frame introspection (ast pass, confidence 0.70)

        finally:
            sys.setprofile(None)
    
        with (looked_up[0].read_lock if mode == "read" else looked_up[0].write_lock)(), pytest.raises(Timeout):
    likely benign LLM, confidence 0.92 Clears the test profiler hook in cleanup.
    Reasoning

    Clearing the profile hook in finally is test cleanup.

  7. info warn → info by review dynamic-execution compose.yaml:18:30

    [embedded bash] command name is a variable (`$$`) not set in this file — the caller or environment decides what runs (ast pass, confidence 0.70)

    "cp -a /repo \"$$HOME/work\" && cd \"$$HOME/work\" && pip install -q . && exec tox run -e py -x env.py.base_python=3.14 -x env_pkg_base.default_base_python=3.14"
    likely benign LLM, confidence 0.80 A compose healthcheck or command runs a copy, pip install, and tox invocation inside a shell.
    Reasoning

    A compose file embeds a bash command where the command name is an environment-variable expansion, but the rest is a plain copy, pip install, and tox run with ordinary arguments. The variable use appears to be a template placeholder rather than an obfuscated payload, though the dynamic command name is worth a note.

  8. info warn → info by review dynamic-attribute src/filelock/__init__.py:124:5

    reach-by-name through `globals` (ast pass, confidence 0.60)

                value = getattr(module, f"Async{_FileLock.__name__}" if name == "AsyncFileLock" else name)
        globals()[name] = value
        return value
    likely benign LLM, confidence 0.90 Lazy attribute resolution in filelock's package init that caches looked-up objects in globals.
    Reasoning

    This is a module-level __getattr__ pattern that resolves names lazily via getattr and caches them in globals(). It is a standard lazy-import idiom in Python libraries and does not indicate malicious intent.

  9. info warn → info by review frame-introspection src/filelock/_api.py:1324:31

    `inspect.currentframe` — call-stack frame introspection (ast pass, confidence 0.70)

                    return
                state.releasing = inspect.currentframe()
                try:
                    _LOGGER.debug("Attempting to release lock %s on %s", id(self), self.lock_file)
    likely benign LLM, confidence 0.93 Stores the current stack frame on the lock state during release.
    Reasoning

    inspect.currentframe is used to record the releasing caller for reentrancy and debugging in a file-lock library. This is ordinary library bookkeeping.

  10. info warn → info by review frame-introspection src/filelock/_api.py:1467:35

    `inspect.currentframe` — call-stack frame introspection (ast pass, confidence 0.70)

            attempt = 0
            self._context.acquiring = inspect.currentframe()
            try:
                # Created once, so a directory that disappears while the acquisition waits fails it, not builds a second
    likely benign LLM, confidence 0.93 Records the acquiring frame on the lock context.
    Reasoning

    Storing the current frame as the acquiring context in a file-lock acquire path is ordinary internal state tracking.

  11. info warn → info by review frame-introspection src/filelock/_api.py:1776:14

    `inspect.currentframe` — call-stack frame introspection (ast pass, confidence 0.70)

            return False
        caller = inspect.currentframe()
        while caller is not None and caller is not frame:
            caller = caller.f_back
    likely benign LLM, confidence 0.93 Walks the call stack to locate a target frame.
    Reasoning

    Walking f_back from the current frame to find a caller frame is a common helper for locating the calling frame in a library.

  12. info warn → info by review frame-introspection tasks/capabilities.py:182:5

    `sys.setprofile` — call-stack frame introspection (ast pass, confidence 0.70)

        previous: Final = sys.getprofile()
        sys.setprofile(interrupt)
        try:
            with suppress(KeyboardInterrupt), contextmanager(probe)():
    likely benign LLM, confidence 0.88 Installs a temporary profile hook to probe interruption behavior and restores the previous profiler.
    Reasoning

    This is a development task that probes whether a profiler hook can interrupt execution, using sys.setprofile with a try/finally restore. It is test-capability tooling in a project's tasks directory, not an attack.

  13. info warn → info by review frame-introspection tasks/capabilities.py:187:9

    `sys.setprofile` — call-stack frame introspection (ast pass, confidence 0.70)

        finally:
            sys.setprofile(previous)
        return bool(finished)
    likely benign LLM, confidence 0.88 Restores the previous profiler in a finally block.
    Reasoning

    The finally block restores the previous profile function, which is the expected cleanup for the temporary hook above.

  14. info warn → info by review frame-introspection tasks/capabilities.py:230:13

    `sys.setprofile` — call-stack frame introspection (ast pass, confidence 0.70)

                nested.append(True)
                sys.setprofile(sys.getprofile())
    
        sys.addaudithook(setprofile_again)
    likely benign LLM, confidence 0.85 Audit hook that re-applies the profile function within a capability probe.
    Reasoning

    An audit hook re-installs the profile function to keep it set during nested calls. This is an unusual but self-contained capability probe in a test-tooling file, with no network, exec, or exfiltration behavior.

  15. info warn → info by review frame-introspection tasks/capabilities.py:234:9

    `sys.setprofile` — call-stack frame introspection (ast pass, confidence 0.70)

        try:
            sys.setprofile(sys.getprofile())
        except RuntimeError:
            return False
    likely benign LLM, confidence 0.87 Probes whether setting the profile function is allowed, returning False on RuntimeError.
    Reasoning

    A capability check calls sys.setprofile with the current profile to see whether it is permitted, catching RuntimeError. This is probing code, not malicious.

  16. info warn → info by review frame-introspection tests/test_filelock.py:1679:5

    `sys.setprofile` — call-stack frame introspection (ast pass, confidence 0.70)

        entered: Final[set[FrameType]] = set()
        sys.setprofile(interrupt)
        try:
            operation()
    likely benign LLM, confidence 0.90 Test profiler hook used to interrupt an operation during a lock test.
    Reasoning

    A test installs a profile hook to interrupt an operation at specific frames, checking reentrancy behavior. This is standard test instrumentation.

  17. info warn → info by review frame-introspection tests/test_filelock.py:1685:9

    `sys.setprofile` — call-stack frame introspection (ast pass, confidence 0.70)

        finally:
            sys.setprofile(None)
        return False
    likely benign LLM, confidence 0.92 Clears the test profiler hook in cleanup.
    Reasoning

    Clearing the profile hook in finally is test cleanup.

  18. info warn → info by review frame-introspection tests/test_soft_lease.py:478:9

    `sys.setprofile` — call-stack frame introspection (ast pass, confidence 0.70)

        def read_compromise() -> None:
            sys.setprofile(pause_in_claim_creation)
            try:
                assert lease.compromise is None
    likely benign LLM, confidence 0.93 Installs a profile hook in a test to pause a thread at a chosen point while checking lease compromise state.
    Reasoning

    The sys.setprofile call installs a profiler hook that pauses a thread during lease claim creation, a deterministic way to force a race in a concurrency test. The file is a test module for a lock library, and the hook is cleared in a finally block. This is test scaffolding, not malicious introspection.

  19. info warn → info by review frame-introspection tests/test_soft_lease.py:482:13

    `sys.setprofile` — call-stack frame introspection (ast pass, confidence 0.70)

            finally:
                sys.setprofile(None)
    
        reader: Final = Thread(target=read_compromise)
    likely benign LLM, confidence 0.93 Clears the profile hook after the compromise-check test runs.
    Reasoning

    This is the matching cleanup of the setprofile hook in a finally block, restoring the default after the reader thread runs. Nothing here exfiltrates data or runs remote code. It is standard test teardown.

  20. info warn → info by review frame-introspection tests/test_soft_lifetime_warning.py:47:28

    `sys._getframe` — call-stack frame introspection (ast pass, confidence 0.70)

            if entry_point == "constructor":
                warning_line = sys._getframe().f_lineno + 1
                lock_type(tmp_path / "test.lock", lifetime=10)
            else:
    likely benign LLM, confidence 0.95 Reads the current line number in a test to verify where a lifetime warning is reported.
    Reasoning

    sys._getframe().f_lineno is used to record the source line where a lifetime warning should be emitted, so the test can assert the warning points at the correct caller line. This is a common technique for checking warnings.warn stacklevel behavior in a test, not evasion.

  21. info warn → info by review frame-introspection tests/test_soft_lifetime_warning.py:51:28

    `sys._getframe` — call-stack frame introspection (ast pass, confidence 0.70)

                lock = lock_type(tmp_path / "test.lock")
                warning_line = sys._getframe().f_lineno + 1
                lock.lifetime = 10
    likely benign LLM, confidence 0.95 Captures the current line number so the test can check the lifetime-setter warning location.
    Reasoning

    Same pattern as the other frame lookup: the test captures the line number before setting the lifetime attribute so it can assert the warning location. Benign test code.

  22. info warn → info by review frame-introspection tests/test_soft_lifetime_warning.py:139:28

    `sys._getframe` — call-stack frame introspection (ast pass, confidence 0.70)

            if entry_point == "constructor":
                warning_line = sys._getframe().f_lineno + 1
                lock_type(tmp_path / "test.lock", lifetime=10)
            else:
    likely benign LLM, confidence 0.95 Records the expected warning line for the constructor entry-point test.
    Reasoning

    Duplicate of the constructor-path warning-line capture in a parametrized test. It uses frame introspection only to compute an expected line number. Benign.

  23. info warn → info by review frame-introspection tests/test_soft_lifetime_warning.py:143:28

    `sys._getframe` — call-stack frame introspection (ast pass, confidence 0.70)

                lock = lock_type(tmp_path / "test.lock")
                warning_line = sys._getframe().f_lineno + 1
                lock.lifetime = 10
    likely benign LLM, confidence 0.95 Records the expected warning line for the lifetime-attribute entry-point test.
    Reasoning

    Duplicate of the attribute-setter warning-line capture in the same parametrized test. Frame introspection here only supports an assertion on the warning's source location. Benign.

Reproduce This Scan

Run disclude locally to verify. Add --format sarif for SARIF output. Add --llm (with an API key in the environment) to include the LLM review.

cargo install disclude --version 4.0.0
git clone https://github.com/tox-dev/py-filelock py-filelock && cd py-filelock
git checkout 4.2.1
disclude scan --severity info --diff 4.2.0 .