PyPI / typing-extensions / 4.16.0

typing-extensions 4.16.0

Source
https://github.com/python/typing_extensions
Tag scanned
4.16.0
Compared with
4.15.0 (1 signals introduced since)
Files
12 scanned, 5 skipped (binary, oversized, or unrecognised)
Signals
0 critical · 0 warn · 12 info
Scan time
9.8 s
LLM review
Reviewed by claude-haiku-5-5 (Anthropic): 12 of 12 warn and critical signals; 12 demoted to info.
Disclude version
4.0.0
Scanned (UTC)
2026-10-14 18:08

Signals

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

  1. info critical → info by review frame-introspection src/typing_extensions.py:170:16 new in this release

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

        try:
            return sys._getframe(depth + 1).f_globals.get('__name__', default)
        except (AttributeError, ValueError):  # For platforms without _getframe()
            pass
    likely benign LLM, confidence 0.90 Caller-module lookup via sys._getframe with AttributeError and ValueError fallbacks.
    Reasoning

    This is the standard typing_extensions helper that reads the caller's module name via sys._getframe with a fallback for platforms lacking it. The anti-analysis label is a false match: the frame access is a normal, documented library technique.

  2. info warn → info by review decoder-import-with-exec src/test_typing_extensions.py:2457:9

    file imports decoder module(s) pickle and calls `exec`/`eval`/`compile` — multi-stage payload shape (ast pass, confidence 0.80)

                    )
            exec(code, {})
    
        def test_error_message_when_subclassing(self):
    likely benign LLM, confidence 0.90 Test helper that execs a code string to verify subclassing error messages.
    Reasoning

    The file is the typing_extensions test suite. The exec(code, {}) call runs a test-generated snippet to check error messages when subclassing. The decoder-import signal is a generic heuristic match with no encoded payload or dropper pipeline visible.

  3. info warn → info by review dynamic-execution src/test_typing_extensions.py:2457:9

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

                    )
            exec(code, {})
    
        def test_error_message_when_subclassing(self):
    likely benign LLM, confidence 0.90 exec of a locally constructed code object inside a typing test.
    Reasoning

    exec is applied to a locally built code string inside a test method with an empty globals dict. This is the normal way to test syntax-dependent typing behavior, not a hidden payload.

  4. info warn → info by review dynamic-execution src/test_typing_extensions.py:3424:9

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

        if sys.version_info >= (3, 12):
            exec(textwrap.dedent(
                """
                @skip_if_py312b1
    likely benign LLM, confidence 0.90 Version-gated exec of dedented test source for PEP 695 syntax.
    Reasoning

    The exec call is guarded by a sys.version_info check and runs textwrap.dedent of a triple-quoted test source. This is standard version-gated test code for Python 3.12 syntax.

  5. info warn → info by review dynamic-execution src/test_typing_extensions.py:3685:9

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

        if hasattr(typing, "TypeAliasType"):
            exec(textwrap.dedent(
                """
                def test_pep695_generic_protocol_callable_members(self):
    likely benign LLM, confidence 0.90 Feature-gated exec of test source defining generic protocol tests.
    Reasoning

    The exec call is guarded by hasattr(typing, 'TypeAliasType') and runs dedented test source. This is a feature-detected test for newer typing constructs.

  6. info warn → info by review dynamic-execution src/test_typing_extensions.py:4531:13

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

                ns = {**extra_names} if extra_names else {}
                exec(code, ns)
                return ns[class_name]
    likely benign LLM, confidence 0.88 Test helper that execs class source in a namespace and returns the defined class.
    Reasoning

    The helper builds a namespace from extra_names, execs a class-definition code string, and returns the class. This is a typical test helper for generating classes from source, with no network or obfuscation involved.

  7. info warn → info by review dynamic-execution src/test_typing_extensions.py:7226:13

    `subprocess.check_output` called with `shell=True` and a literal command (ast pass, confidence 0.70)

            try:
                subprocess.check_output(f'{sys.executable} -OO {file_path}',
                                        stderr=subprocess.STDOUT,
                                        shell=True)
    likely benign LLM, confidence 0.85 Test runs the interpreter with -OO on a temporary file via a shell command.
    Reasoning

    The command is an f-string built from sys.executable, a fixed -OO flag, and a test-controlled file path, run with shell=True. The inputs are not attacker-controlled in a normal test run, so this is a test of optimized-mode behavior rather than a dropper.

  8. info warn → info by review dynamic-execution src/test_typing_extensions.py:7795:9

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

                    )
            exec(code, {})
    
        def test_no_bivariant(self):
    likely benign LLM, confidence 0.90 Test exec of a code string to check a typing rule.
    Reasoning

    The exec(code, {}) call runs a test snippet in a fresh namespace, the same pattern as the other test-suite findings. It checks typing behavior, and nothing in the snippet suggests malicious intent.

  9. info warn → info by review dynamic-execution src/test_typing_extensions.py:9531:13

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

                ns = {}
                exec(textwrap.dedent("""
                class Gen[Tx]:
                    alias = int
    likely benign LLM, confidence 0.90 Exec of PEP 695 class source in a test namespace.
    Reasoning

    The exec call runs dedented test source defining a PEP 695 generic class in a namespace. This is a standard test for newer syntax that older interpreters cannot parse directly.

  10. info critical → info by review frame-introspection src/typing_extensions.py:3283:17

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

        try:
            frame = sys._getframe(2)
        # - Catch AttributeError: not all Python implementations have sys._getframe()
        # - Catch ValueError: maybe we're called from an unexpected module
    likely benign LLM, confidence 0.90 Frame lookup to locate the calling module namespace for typing helpers.
    Reasoning

    The sys._getframe(2) call is used to find the caller's namespace when defining typing constructs, and the surrounding comments describe the expected failure modes. It is a legitimate, documented library pattern.

  11. info warn → info by review dynamic-execution src/typing_extensions.py:4172:54

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

            return_value = {key:
                value if not isinstance(value, str) else eval(value, globals, locals)
                for key, value in ann.items() }
            return return_value
    likely benign LLM, confidence 0.88 Evaluates string annotations during type-hint resolution.
    Reasoning

    eval is applied to string annotations inside a get-type-hints style function, which is the documented purpose of forward-reference resolution. The input is the library's own annotation strings, not untrusted external data.

  12. info warn → info by review dynamic-execution src/typing_extensions.py:4254:21

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

                code = forward_ref.__forward_code__
                value = eval(code, globals, locals)
            forward_ref.__forward_evaluated__ = True
            forward_ref.__forward_value__ = value
    likely benign LLM, confidence 0.88 Evaluates a forward reference's compiled code to resolve its value.
    Reasoning

    This evaluates a ForwardRef's compiled code object against the given globals and locals to resolve a forward reference. This is the normal mechanism of the typing module and matches its known implementation.

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/python/typing_extensions typing_extensions && cd typing_extensions
git checkout 4.16.0
disclude scan --severity info --diff 4.15.0 .