New GitHub issue #118522 from ngoldbaum:<br>
<hr>
<pre>
# Bug report
### Bug description:
I bisected and this is a regression that was introduced by 7ccacb220d.
Steps to reproduce:
1. Clone numpy and cython repositories
2. Build python `main` branch with `--disable-gil`
3. Install numpy dependencies, build numpy, and run the full numpy test suite:
```
cd /path/to/numpy
python -m pip install setuptools ninja meson-python pytest hypothesis spin /path/to/cython
spin build --clean
spin test -- -x
```
On my machine, this very quickly exits with the following test failure:
<details>
```
_______________________________________________________________________________ TestArray2String.test_any_text _______________________________________________________________________________
self = <hypothesis.core.StateForActualGivenExecution object at 0x4ecdebabd10>, data = ConjectureData(OVERRUN, 0 bytes, frozen)
with local_settings(self.settings):
with deterministic_PRNG():
with BuildContext(data, is_final=is_final) as context:
# providers may throw in per_case_context_fn, and we'd like
# `result` to still be set in these cases.
result = None
with data.provider.per_test_case_context_manager():
# Run the test function once, via the executor hook.
# In most cases this will delegate straight to `run(data)`.
> result = self.test_runner(data, run)
context = <hypothesis.control.BuildContext object at 0x4ecdeba9910>
data = ConjectureData(OVERRUN, 0 bytes, frozen)
example_kwargs = None
expected_failure = (HypothesisWarning('It looks like `register_random` was passed an object that could be garbage collected immediately a...a62810>\n\n../../../../../../hypothesis/hypothesis-python/src/hypothesis/internal/entropy.py:132: HypothesisWarning\n')
is_final = True
print_example = True
result = None
run = <function StateForActualGivenExecution.execute_once.<locals>.run at 0x4ecdf7042e0>
self = <hypothesis.core.StateForActualGivenExecution object at 0x4ecdebabd10>
test = <function TestArray2String.test_any_text at 0x4ecd055f640>
text_repr = None
../../../../../../hypothesis/hypothesis-python/src/hypothesis/core.py:951:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
../../../../../../hypothesis/hypothesis-python/src/hypothesis/core.py:739: in default_executor
return function(data)
data = ConjectureData(OVERRUN, 0 bytes, frozen)
function = <function StateForActualGivenExecution.execute_once.<locals>.run at 0x4ecdf7042e0>
../../../../../../hypothesis/hypothesis-python/src/hypothesis/core.py:862: in run
kw, argslices = context.prep_args_kwargs_from_strategies(
args = ()
context = <hypothesis.control.BuildContext object at 0x4ecdeba9910>
data = ConjectureData(OVERRUN, 0 bytes, frozen)
example_kwargs = None
expected_failure = (HypothesisWarning('It looks like `register_random` was passed an object that could be garbage collected immediately a...a62810>\n\n../../../../../../hypothesis/hypothesis-python/src/hypothesis/internal/entropy.py:132: HypothesisWarning\n')
kwargs = {'self': <numpy._core.tests.test_arrayprint.TestArray2String object at 0x4ecd0cf0610>}
print_example = True
self = <hypothesis.core.StateForActualGivenExecution object at 0x4ecdebabd10>
test = <function TestArray2String.test_any_text at 0x4ecd055f640>
text_repr = None
../../../../../../hypothesis/hypothesis-python/src/hypothesis/control.py:157: in prep_args_kwargs_from_strategies
obj = check(self.data.draw(s, observe_as=f"generate:{k}"))
arg_labels = {}
check = <hypothesis.control._Checker object at 0x4ecdebacc10>
k = 'text'
kwarg_strategies = {'text': from_dtype(dtype('<U'))}
kwargs = {}
s = from_dtype(dtype('<U'))
self = <hypothesis.control.BuildContext object at 0x4ecdeba9910>
start_idx = 0
../../../../../../hypothesis/hypothesis-python/src/hypothesis/internal/conjecture/data.py:2387: in draw
return strategy.do_draw(self)
at_top_level = True
key = 'generate:text'
label = 7273923036097914769
observe_as = 'generate:text'
self = ConjectureData(OVERRUN, 0 bytes, frozen)
start_time = 6066655.102763833
strategy = from_dtype(dtype('<U'))
../../../../../../hypothesis/hypothesis-python/src/hypothesis/strategies/_internal/lazy.py:167: in do_draw
return data.draw(self.wrapped_strategy)
data = ConjectureData(OVERRUN, 0 bytes, frozen)
self = from_dtype(dtype('<U'))
../../../../../../hypothesis/hypothesis-python/src/hypothesis/internal/conjecture/data.py:2381: in draw
return strategy.do_draw(self)
at_top_level = False
label = 7273923036097914769
observe_as = None
self = ConjectureData(OVERRUN, 0 bytes, frozen)
start_time = None
strategy = text(alphabet=characters()).filter(lambda b: b[-1:] != "\0").map(str_)
../../../../../../hypothesis/hypothesis-python/src/hypothesis/strategies/_internal/lazy.py:167: in do_draw
return data.draw(self.wrapped_strategy)
data = ConjectureData(OVERRUN, 0 bytes, frozen)
self = text(alphabet=characters()).filter(lambda b: b[-1:] != "\0").map(str_)
../../../../../../hypothesis/hypothesis-python/src/hypothesis/internal/conjecture/data.py:2381: in draw
return strategy.do_draw(self)
at_top_level = False
label = 7273923036097914769
observe_as = None
self = ConjectureData(OVERRUN, 0 bytes, frozen)
start_time = None
strategy = text().filter(lambda b: b[-1:] != "\0").map(str_)
../../../../../../hypothesis/hypothesis-python/src/hypothesis/strategies/_internal/strategies.py:843: in do_draw
x = data.draw(self.mapped_strategy)
_ = 0
data = ConjectureData(OVERRUN, 0 bytes, frozen)
self = text().filter(lambda b: b[-1:] != "\0").map(str_)
../../../../../../hypothesis/hypothesis-python/src/hypothesis/internal/conjecture/data.py:2381: in draw
return strategy.do_draw(self)
at_top_level = False
label = 10358930435738099914
observe_as = None
self = ConjectureData(OVERRUN, 0 bytes, frozen)
start_time = None
strategy = text().filter(lambda b: b[-1:] != "\0")
../../../../../../hypothesis/hypothesis-python/src/hypothesis/strategies/_internal/strategies.py:1006: in do_draw
result = self.do_filtered_draw(data)
data = ConjectureData(OVERRUN, 0 bytes, frozen)
self = text().filter(lambda b: b[-1:] != "\0")
../../../../../../hypothesis/hypothesis-python/src/hypothesis/strategies/_internal/strategies.py:1016: in do_filtered_draw
value = data.draw(self.filtered_strategy)
data = ConjectureData(OVERRUN, 0 bytes, frozen)
i = 0
self = text().filter(lambda b: b[-1:] != "\0")
../../../../../../hypothesis/hypothesis-python/src/hypothesis/internal/conjecture/data.py:2381: in draw
return strategy.do_draw(self)
at_top_level = False
label = 13472932985108582247
observe_as = None
self = ConjectureData(OVERRUN, 0 bytes, frozen)
start_time = None
strategy = text()
../../../../../../hypothesis/hypothesis-python/src/hypothesis/strategies/_internal/strings.py:117: in do_draw
return data.draw_string(
__class__ = <class 'hypothesis.strategies._internal.strings.TextStrategy'>
data = ConjectureData(OVERRUN, 0 bytes, frozen)
elems = character
</pre>
<hr>
<a href="https://github.com/python/cpython/issues/118522">View on GitHub</a>
<p>Labels: type-bug</p>
<p>Assignee: </p>