PyPI / hypothesis / 6.170.0
hypothesis 6.170.0
- Source
- https://github.com/HypothesisWorks/hypothesis
- Tag scanned
v6.170.0- Directory
hypothesis- Compared with
v6.169.4(0 signals introduced since)- Files
- 537 scanned, 16 skipped (binary, oversized, or unrecognised)
- Signals
- 0 critical · 0 warn · 107 info
- Scan time
- 32.1 s
- LLM review
- Reviewed by claude-haiku-5-5 (Anthropic): 47 of 47 warn and critical signals; 47 demoted to info.
- Disclude version
- 4.0.0
- Scanned (UTC)
- 2026-10-16 17:43
Signals
Ordered by severity, then signals introduced in this release. Hidden characters are shown as ⟨U+…⟩.
-
= = =likely benign Docs config execs the package's own version.py to read __version__.Reasoning
The exec reads the project's own src/hypothesis/version.py via a path joined from the repo root and runs it into a dict to extract __version__. This is a common Sphinx docs pattern; the file is in-repo and not attacker-controlled at runtime, though exec on file contents at import is a bad practice.
-
-
# Run all the no-extra-dependency tests for this version (except slow nocover tests) # Run tests for each extra module while the requirements are installed -
-
-
-
-
-
-
-
-
# Run some tests without docstrings or assertions, to catch bugs -
# like issue #822 in one of the test decorators. See also #1541. PYTHONOPTIMIZE=2 -
-
-
-
# like issue #822 in one of the test decorators. See also #1541. PYTHONOPTIMIZE=2 -
-
-
-
-
-
if [; then -
-
-
-
if [ ; then -
-
-
# ...but running twice takes time, don't overdo it -
# ...but running twice takes time, don't overdo it else -
else fi -
) = =dismissed Uses frame introspection to report where reject() was called.Reasoning
inspect.currentframe is used to locate the caller for error reporting in reject(). Standard test-library introspection with no network or dropper behaviour.
-
= =dismissed Uses frame introspection to report where assume() was called.Reasoning
Same benign caller-location lookup for assume(), used only for observability reporting.
-
=dismissed Decompresses stored example bytes for the example database.Reasoning
zlib.decompress on a database-stored example blob with a version-prefix byte, guarded by a zlib.error handler. This is Hypothesis's example serialization format, not an embedded malicious payload.
-
dismissed Syntax-checks a repr of a strategy default value.
Reasoning
compile is used as a syntax check on repr() of a strategy for a default argument; the input is generated internally and the result is only validated, never executed.
-
= # Finally, try to work out the imports we need for builds(), .map(), # .filter(), and .flatmap() to work without NameErrordismissed Syntax-checks generated test source text.Reasoning
compile validates generated source text for a ghostwritten test before it is emitted; it is a syntax check, not execution of untrusted input.
-
# executed; so you still shouldn't ghostwrite for hostile code. =dismissed Syntax-checks a repr of an identity value.Reasoning
compile(repr(identity)) is a syntax check inside SyntaxError handling; the comment explicitly notes it does not execute the target code.
-
# The sum of a geometric series is given by (ref: wikipedia): # ᵐ∑ₖ₌₀ aᵏ = (aᵐ⁺¹ - 1) / (a - 1) # = S(m) / S(0) # assuming a != 1 and using the definition -
# The sum of a geometric series is given by (ref: wikipedia): # ᵐ∑ₖ₌₀ aᵏ = (aᵐ⁺¹ - 1) / (a - 1) # = S(m) / S(0) # assuming a != 1 and using the definition -
# assuming a != 1 and using the definition # S(m) := aᵐ⁺¹ - 1. # The sum we want, starting from a number n [0 <= n <= m] rather than zero, is # ᵐ∑ₖ₌ₙ aᵏ = ᵐ∑ₖ₌₀ aᵏ - ⁿ⁻¹∑ₖ₌₀ aᵏ = S(m) / S(0) - S(n - 1) / S(0) -
# The sum we want, starting from a number n [0 <= n <= m] rather than zero, is # ᵐ∑ₖ₌ₙ aᵏ = ᵐ∑ₖ₌₀ aᵏ - ⁿ⁻¹∑ₖ₌₀ aᵏ = S(m) / S(0) - S(n - 1) / S(0) return ** - 1 -
# The sum we want, starting from a number n [0 <= n <= m] rather than zero, is # ᵐ∑ₖ₌ₙ aᵏ = ᵐ∑ₖ₌₀ aᵏ - ⁿ⁻¹∑ₖ₌₀ aᵏ = S(m) / S(0) - S(n - 1) / S(0) return ** - 1 -
# The sum we want, starting from a number n [0 <= n <= m] rather than zero, is # ᵐ∑ₖ₌ₙ aᵏ = ᵐ∑ₖ₌₀ aᵏ - ⁿ⁻¹∑ₖ₌₀ aᵏ = S(m) / S(0) - S(n - 1) / S(0) return ** - 1 -
info
warn→ info by reviewframe-introspectionhypothesis/src/hypothesis/internal/conjecture/junkdrawer.py:316:13""" frame = sys._getframe(2) size = 1 while frame:dismissed Walks stack frames to estimate object size.Reasoning
sys._getframe walks the caller stack to estimate size of local data for internal bookkeeping. Ordinary library code.
-
# common unicode characters , # characters which increase in length when lowercased -
# common unicode characters , # characters which increase in length when lowercased -
# common unicode characters , # characters which increase in length when lowercased -
# ligatures , # emoticons , -
# upsidown text , # reserved strings in windows , -
# upsidown text , # reserved strings in windows , -
# upsidown text , # reserved strings in windows , -
# upsidown text , # reserved strings in windows , -
# upsidown text , # reserved strings in windows , -
�̲e͇̣̰̦̬͎ ̢̼̻̱̘h͚͎͙̜̣̲ͅi̦̲̣̰̤v̻͍e̺̭̳̪̰-m̢iͅn̖̺̞̲̯̰d̵̼̟͙̩̼̘̳ ̞̥̱̳̭r̛̗̘e͙p͠r̼̞̻̭̗e̺̠̣͟s̘͇̳͍̝͉e͉̥̯̞̲͚̬͜ǹ̬͎͎̟̖͇̤t͍̬̤͓̼̭͘ͅi̪̱n͠g̴͉ ⟨U+034F⟩͉ͅc̬̟h͡a̫̻̯͘o̫̟̖͍̙̝͉s̗̦̲.̨̹͈̣ -
�̜̣̲ͅi̦̲̣̰̤v̻͍e̺̭̳̪̰-m̢iͅn̖̺̞̲̯̰d̵̼̟͙̩̼̘̳ ̞̥̱̳̭r̛̗̘e͙p͠r̼̞̻̭̗e̺̠̣͟s̘͇̳͍̝͉e͉̥̯̞̲͚̬͜ǹ̬͎͎̟̖͇̤t͍̬̤͓̼̭͘ͅi̪̱n͠g̴͉ ⟨U+034F⟩͉ͅc̬̟h͡a̫̻̯͘o̫̟̖͍̙̝͉s̗̦̲.̨̹͈̣ -
�̲͚̬͜ǹ̬͎͎̟̖͇̤t͍̬̤͓̼̭͘ͅi̪̱n͠g̴͉ ⟨U+034F⟩͉ͅc̬̟h͡a̫̻̯͘o̫̟̖͍̙̝͉s̗̦̲.̨̹͈̣ -
�͇̤t͍̬̤͓̼̭͘ͅi̪̱n͠g̴͉ ⟨U+034F⟩͉ͅc̬̟h͡a̫̻̯͘o̫̟̖͍̙̝͉s̗̦̲.̨̹͈̣ -
# stack frames up. = = = fdismissed Reads caller file and line for coverage labels.Reasoning
sys._getframe retrieves the caller's file and line for coverage-description labels. Benign introspection used by the testing framework.
-
info
warn→ info by reviewdynamic-executionhypothesis/src/hypothesis/internal/lambda_sources.py:265:20=likely benign Evals recovered lambda source to rebuild a callable.Reasoning
eval reconstructs a lambda from its recovered source text in the test's own globals to produce a callable; it is a known pattern for recovering lambda objects, and the source comes from the user's own code.
-
info
warn→ info by reviewdynamic-executionhypothesis/src/hypothesis/internal/lambda_sources.py:298:9) =likely benign Execs generated code to reconstruct a lambda.Reasoning
exec builds a wrapper function that reconstructs a lambda from its source in the caller's globals, a metaprogramming step over source already present in the project.
-
assert = returnlikely benign Execs function source into a namespace and caches the result.Reasoning
exec runs source text for a function in a fresh namespace and caches it; this is the helper that rebuilds functions from their source for Hypothesis's reflection utilities, consistent with the surrounding code.
-
info
warn→ info by reviewframe-introspectionhypothesis/src/hypothesis/internal/scrutineer.py:114:13# pragma: no cover # only on Python < 3.12 returndismissed Installs a trace function for scrutiny analysis.Reasoning
sys.settrace installs a coverage/tracing hook for the scrutineer on Python versions before 3.12, and is paired with cleanup. Standard tracing code.
-
info
warn→ info by reviewframe-introspectionhypothesis/src/hypothesis/internal/scrutineer.py:137:13# pragma: no cover # only on Python < 3.12 returndismissed Removes the trace function set by the scrutineer.Reasoning
sys.settrace(None) is the matching teardown for the tracer installed above, so it is benign.
-
info
warn→ info by reviewframe-introspectionhypothesis/src/hypothesis/strategies/_internal/strategies.py:102:31return : | None = =likely benign Hypothesis walks the call stack to locate the user's code that created a strategy.Reasoning
sys._getframe(1) walks up the stack past Hypothesis's own files to find the user's calling location for error messages. This is a standard, bounded use of frame introspection in a testing library.
-
info
warn→ info by reviewframe-introspectionhypothesis/src/hypothesis/strategies/_internal/types.py:227:37: | None = None : | None = = flikely benign Hypothesis inspects frames to report where a strategy was defined.Reasoning
sys._getframe() is used to find the source location of a type-related call for reporting. The loop only reads filenames and line numbers and performs no sensitive action.
-
info
critical→ info by reviewdynamic-executionhypothesis/tests/codemods/test_codemod_cli.py:40:12returnlikely benign A test helper runs shell commands for the codemod CLI tests.Reasoning
This is a small test helper that runs a command through subprocess with shell=True so that codemod CLI tests can invoke the tool. The command comes from test code, not untrusted input, so there is no real attack path.
-
info
warn→ info by reviewframe-introspectionhypothesis/tests/conjecture/test_junkdrawer.py:201:16assert ==likely benign A test asserts stack depth using inspect.stack in a recursive helper.Reasoning
inspect.stack(0) is used in a test to check that stack depth matches expectations. It is test scaffolding with no side effects.
-
assert not = assert assert notlikely benign Test evaluates the repr of a feature flags object to verify round-tripping.Reasoning
eval(repr(flags)) is a round-trip serialization check on a FeatureFlags object that the test itself constructed. The input is trusted and generated by the library's own repr.
-
=likely benign Test evaluates the repr of a feature flags object to verify round-tripping.Reasoning
Same round-trip pattern as the earlier eval: it evaluates the library's own repr of a locally constructed object in a test.
-
# the line `offset` lines below the `def` statement of the calling function = . return flikely benign Test computes an expected file and line from the calling frame.Reasoning
inspect.currentframe().f_back is used to compute an expected source line number for an observability assertion. It is test code only.
-
]: = assert == assert ==likely benign Test evals pretty-printed regex output to verify round-tripping.Reasoning
eval of pretty.pretty(r) checks that a compiled regex pretty-prints to valid code that reconstructs it. The input is generated locally by the test.
-
assert ==likely benign Test evals a pretty-printed float representation with a limited namespace.Reasoning
The eval runs a repr string under a restricted namespace, as part of checking float_to_lex on pretty-printed values. The input is locally produced test data.
-
assert ==likely benign Test evals enum pretty-print output to confirm it is valid code.Reasoning
The test evaluates the pretty-printed form of enum reps to confirm they round-trip as code. The inputs are parametrized test strings.
-
assert == f # hexadecimal with underscores assert ==likely benign Test evals a formatted hex literal to check its value.Reasoning
The test evaluates a formatted hexadecimal literal it generated itself to check the value. It is a plain assertion helper.
-
info
warn→ info by reviewdecoder-import-with-exechypothesis/tests/cover/test_reproduce_failure.py:146:20= = =likely benign Test reconstructs a reproduce_failure decorator from captured notes via eval.Reasoning
The flagged shape is the decoder-plus-exec pattern, but the eval operates on a regex match of a reproduce_failure(...) decorator string from the test's own notes. Hypothesis's reproduce_failure mechanism legitimately decodes such blobs. The decoding is in the library, not an attacker payload, so this is a false positive.
-
info
warn→ info by reviewdynamic-executionhypothesis/tests/cover/test_reproduce_failure.py:146:20= = =likely benign Same eval as above, flagged separately for dynamic execution.Reasoning
The dynamic-execution signal on the same eval line. The argument is a regex-extracted decorator string from Hypothesis's own failure notes, so it is expected behaviour.
-
-
-
= = -
= = -
= = -
= = -
= = -
= = -
= = -
= = -
info
warn→ info by reviewunicode-mixed-scripthypothesis/tests/cover/test_unicode_identifiers.py:37:1= == 3.1415likely benign Test defines a lambda with a Unicode identifier containing Greek π.Reasoning
A Greek letter pi in an identifier is deliberate, as the test name indicates it checks Unicode identifier handling. The Latin plus Greek mix is the point of the test, not obfuscation.
-
info
warn→ info by reviewunicode-mixed-scripthypothesis/tests/cover/test_unicode_identifiers.py:41:44assert ==likely benign Test uses the Greek-letter identifier to check lambda description output.Reasoning
The same deliberate Unicode identifier used in a test for pretty-printing lambdas on the same line. Intentional test content.
-
info
warn→ info by reviewdynamic-executionhypothesis/tests/ghostwriter/recorded/magic_builtins.txt:112:5eval(source, globals, locals)likely benign Recorded text output containing an eval example in prose.Reasoning
This is a recorded documentation or expected-output text file. The eval appears in prose or markup as an example of generated code, not executed code.
-
info
warn→ info by reviewdecoder-import-with-exechypothesis/tests/ghostwriter/test_expected_output.py:302:5assert == # We got the expected source code # and there are no SyntaxError or NameErrorslikely benign Test helper executes generated test source code to verify it is valid.Reasoning
Test file for Hypothesis ghostwriter; exec of generated source code to check it runs without SyntaxError/NameError. The base64 import flag is incidental to the test harness, not a payload decoder.
-
info
warn→ info by reviewdynamic-executionhypothesis/tests/ghostwriter/test_expected_output.py:302:5assert == # We got the expected source code # and there are no SyntaxError or NameErrorslikely benign Test executes expected generated source code string.Reasoning
exec of expected generated source in a test, with an empty namespace; the expected string is a test fixture, not attacker-controlled input.
-
info
warn→ info by reviewdynamic-executionhypothesis/tests/ghostwriter/test_expected_output.py:317:5assert ==likely benign Test executes fixture source code with a controlled namespace.Reasoning
Same pattern: exec of fixture source in a test to confirm it compiles and runs.
-
info
warn→ info by reviewdynamic-executionhypothesis/tests/ghostwriter/test_expected_output.py:339:5assert == # We got the expected source code # and there are no SyntaxError or NameErrorslikely benign Test executes expected generated source code.Reasoning
Same test-fixture exec pattern verifying generated code validity.
-
likely benign Test helper execs generated source code and reports failures.
Reasoning
Helper that execs generated source inside a try block and prints it on failure; a standard test-harness pattern.
-
=likely benign Test execs output of ghostwriter.magic.Reasoning
Test executes ghostwriter-generated code to ensure it runs; source originates from the library under test.
-
=likely benign Test execs output of ghostwriter.binary_operation.Reasoning
Test execs ghostwriter-generated binary operation source; benign test verification.
-
# Most importantly: the code should execute without NameErrorlikely benign Test execs generated source to check for NameError.Reasoning
Test asserting the generated code executes without NameError; benign.
-
= # and also works with explicit identity element =likely benign Test execs generated binary operation source.Reasoning
Test execs generated binary operation code; benign verification of library output.
-
=likely benign Test execs generated binary operation source with identity.Reasoning
Same benign test pattern with explicit identity argument.
-
assert inlikely benign Test execs generated source code.Reasoning
Test execs generated one_of source code after asserting its content; benign.
-
= # Also cover passing an explicit `annotate`, rather than the default None. =likely benign Test execs generated ufunc source code.Reasoning
Test execs ufunc-generated source; benign test verification.
-
=likely benign Test execs generated ufunc source with annotate.Reasoning
Same benign ufunc generated-code test pattern.
-
info
critical→ info by reviewdynamic-executionhypothesis/tests/ghostwriter/test_ghostwriter_cli.py:43:12returnlikely benign Test helper wrapping subprocess.run with shell=True for CLI invocations.Reasoning
Test helper running CLI commands via shell=True; the command is test-controlled and this is a common test utility. Critical severity is overstated, but shell=True with a non-literal cmd warrants a note.
-
= = = assert ==likely benign Test evals strategy repr to verify round-trip.Reasoning
Evals repr of Hypothesis strategies in a test to check round-trip repr stability; input is the library's own repr output.
-
assert ==likely benign Test evals sampled transform reprs for round-trip checks.Reasoning
Parametrized test evaluating sampled strategy repr strings; test-controlled, benign.
-
= = =likely benign A numpy floor/ceil test function uses eval on a parameter to construct an input array.Reasoning
The eval call sits in a test function that takes a parameter named value, likely parametrized with numeric literal strings such as '[1.5, -2.5]' to build numpy arrays for floor and ceil comparisons. This is a common test-harness idiom, not a dropper or obfuscation. The eval on a non-literal is still a risky pattern in principle, and the function name and value parameter alone do not prove the inputs are trusted, so a doubt remains, but the context points to benign test code.
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.
&&