PyPI / typeguard / 4.6.1

typeguard 4.6.1

Source
https://github.com/agronholm/typeguard
Artifact scanned
typeguard-4.6.1-py3-none-any.whl (wheel · 36.2 KB · SHA-256 aca1f3651248…)
Compared with
typeguard-4.6.0-py3-none-any.whl (0 signals introduced since)
Files
14 scanned, 5 skipped (binary, oversized, or unrecognised)
Signals
0 critical · 0 warn · 5 info
Scan time
5.0 s
LLM review
Reviewed by claude-haiku-5-5 (Anthropic): 5 of 5 warn and critical signals; 5 demoted to info.
Disclude version
4.3.0
Scanned (UTC)
2026-11-20 01:58

Signals

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

  1. info warn → info by review dynamic-execution typeguard/_decorators.py:77:19

    `compile` called on a non-literal expression (ast pass, confidence 0.70)

    
        module_code = compile(module_ast, f.__code__.co_filename, "exec", dont_inherit=True)
        new_code = find_target_function(
            module_code, target_path, instrumentor.target_lineno
    likely benign LLM, confidence 0.93 Compiles an instrumented AST of a decorated function so typeguard can inject runtime type checks.
    Reasoning

    The snippet is typeguard's decorator instrumentation: it compiles an AST it has rewritten to inject type checks into a function, then extracts the target function's code object. The file is a well-known type-checking library, and this is its normal mechanism. The non-literal compile is expected here and shows no obfuscation or hidden payload.

  2. info critical → info by review frame-introspection typeguard/_decorators.py:100:33

    `inspect.currentframe` — call-stack frame introspection — file also calls `sys.exit`/`exec`/`eval` (anti-analysis shape) (ast pass, confidence 0.85)

            # Create a new closure and find values for the new free variables
            frame = cast(FrameType, inspect.currentframe())
            frame = cast(FrameType, frame.f_back)
            frame_locals = cast(FrameType, frame.f_back).f_locals
    likely benign LLM, confidence 0.92 Reads caller frame locals to rebuild a closure's free variables for typeguard's instrumented function.
    Reasoning

    The code walks up the call stack to read the caller's local variables so it can resolve free variables for the rebuilt closure. This is standard instrumentation for a decorator that recreates a function. The 'anti-analysis' label comes from the heuristic that a sys.exit/exec/eval appears in the same file. Nothing in the snippet is evasive or malicious, and the file is a legitimate type-checking library.

  3. info warn → info by review frame-introspection typeguard/_functions.py:105:13

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

    
        frame = sys._getframe(1)
        memo = TypeCheckMemo(frame.f_globals, frame.f_locals, config=config)
        try:
    likely benign LLM, confidence 0.94 Reads the caller's frame globals and locals to build a type-check memo for annotation resolution.
    Reasoning

    typeguard's check_type-style helpers use sys._getframe(1) to take the caller's globals and locals for resolving forward references in type annotations. This is the documented way to do that, and the snippet has no network, exec, or encoded payload.

  4. info warn → info by review frame-introspection typeguard/_functions.py:135:13

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

        # supported in all python implementations
        frame = sys._getframe(1)
        func = find_function(frame)
        f_locals = frame.f_locals
    likely benign LLM, confidence 0.94 Fetches the caller's frame and locals to find the enclosing function for type validation.
    Reasoning

    This is the same caller-frame lookup pattern used by typeguard's runtime checking functions. It resolves the calling function and its locals to validate the enclosing call's types. It is a legitimate use of frame introspection in a type-checking library.

  5. info warn → info by review frame-introspection typeguard/_functions.py:202:13

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

        # supported in all python implementations
        frame = sys._getframe(1)
        func = find_function(frame)
        memo = TypeCheckMemo(frame.f_globals, frame.f_locals)
    likely benign LLM, confidence 0.94 Takes the caller's frame globals and locals to construct a type-check memo.
    Reasoning

    Same pattern: sys._getframe(1) to get the caller's globals and locals for constructing a TypeCheckMemo. This is typical of a runtime type checker and nothing in the snippet suggests malicious intent.

Reproduce This Scan

Run disclude locally to verify. These commands scan the published file; the "new in this release" marks come from comparing it with the previous release's file, which they don't repeat. 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.3.0
curl -fsSL -o typeguard-4.6.1-py3-none-any.whl https://files.pythonhosted.org/packages/04/d5/ab99dd595bd3cc307346c9c644556b627ca0bd273d3ee23041e8ac4f20dd/typeguard-4.6.1-py3-none-any.whl
printf '%s  %s\n' aca1f365124873d5325b18aad1a3689d62f7184abe32d899413562cf51729d02 typeguard-4.6.1-py3-none-any.whl | shasum -a 256 -c -
unzip -q typeguard-4.6.1-py3-none-any.whl -d pkg
disclude scan --untrusted --severity info pkg