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.4 s
LLM review
Reviewed by claude-haiku-5-5 (Anthropic): 12 of 12 warn and critical signals; 12 demoted to info.
Disclude version
4.1.0
Scanned (UTC)
2026-10-21 20:04

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.93 Caller-module lookup via sys._getframe with AttributeError and ValueError handling.
    Reasoning

    This is the standard fallback for sys._getframe in typing_extensions, used to find the caller's module name for deprecation or default module handling. Its exceptions are caught and it is widely used in stdlib-style code. The anti-analysis label is a false positive from the co-occurrence of sys.exit or exec elsewhere in the file.

  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.92 exec of a locally built test snippet in a typing_extensions test.
    Reasoning

    The file is the typing_extensions test suite. The exec(code, {}) call runs a locally built code string to check error messages when subclassing, a common test technique. The pickle import is incidental and the snippet shows no payload decoding.

  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.92 Same exec call in the typing_extensions test suite, flagged as dynamic execution.
    Reasoning

    This is the dynamic-execution signal on the same exec(code, {}) call. It runs test-generated code in an empty namespace inside a unit test, consistent with testing typing behavior.

  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.93 exec of a dedented test class definition gated by Python version.
    Reasoning

    The exec wraps a textwrap.dedent of a literal class definition gated on Python version, a standard pattern for testing syntax that older interpreters cannot parse. Nothing in the snippet is obfuscated or reaches the network.

  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.93 exec of literal test code defining a PEP 695 generic protocol.
    Reasoning

    The exec runs a literal dedented test string defining a generic protocol, gated by hasattr(typing, 'TypeAliasType'). This is version-conditional test scaffolding in a typing library's test suite.

  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.90 Test helper that execs class source in a namespace and returns the class.
    Reasoning

    The helper builds a namespace and execs a code string, returning the named class. This is a test utility for creating classes from source. The namespace is local and nothing in the snippet suggests malicious intent.

  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 file via a shell command.
    Reasoning

    shell=True is used with an f-string of sys.executable, the -OO flag and a test file path. The inputs are internal, not attacker-controlled, and the call sits in a test checking optimized-mode behavior. It is poor practice but not malicious.

  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.92 exec of test code in a typing_extensions test for no-bivariant behavior.
    Reasoning

    This is the same exec(code, {}) test pattern as the other findings in the typing_extensions test suite, here testing no-bivariant behavior.

  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.93 exec of a literal PEP 695 class definition in a test.
    Reasoning

    A literal textwrap.dedent string defining a PEP 695 generic class is exec'd in a test namespace. This is standard version-gated test code for the typing library.

  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.93 Frame lookup for caller module in typing_extensions, guarded for portability.
    Reasoning

    sys._getframe(2) is used to locate the calling module for a typing construct, with comments explaining the AttributeError and ValueError handling for other implementations. This is ordinary library code, not anti-analysis.

  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.90 eval of string annotations during type hint resolution.
    Reasoning

    eval is applied to string annotation values inside get_type_hints-style evaluation, which is the documented behavior of forward references in the typing module. The inputs are source annotations, not untrusted network data, so this matches the library's intended design.

  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.90 Evaluation of a ForwardRef's compiled code during type resolution.
    Reasoning

    This evaluates a ForwardRef's compiled code object with supplied globals and locals to resolve its value. This is the standard forward-reference evaluation in typing, and the code comes from annotations in the source, not from an external payload.

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.1.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 .