Skip to content

Remember failed type creations to stop exponential generator fallback - #155

Merged
LuKrO2011 merged 1 commit into
se2p:mainfrom
Esmail-ibraheem:fix/bound-generator-fallback
Oct 26, 2026
Merged

LuKrO2011 merged 1 commit into
se2p:mainfrom
Esmail-ibraheem:fix/bound-generator-fallback

Conversation

@Esmail-ibraheem

Copy link
Copy Markdown
Contributor

Since sub-types for abstract classes are supported, _create_var_of_type tries every candidate generator until one succeeds. When no generator can build a type, e.g., an abstract class whose generators need an instance of itself, this backtracking grows exponentially with max_recursion, so the initial population for the stdlib numbers module never finished.

Within the outermost _create_var_of_type call, remember the smallest depth at which creating a type failed and fail fast for the same type at that depth or deeper, before looking up its generators.

Since sub-types for abstract classes are supported, _create_var_of_type
tries every candidate generator until one succeeds. When no generator can
build a type, e.g., an abstract class whose generators need an instance of
itself, this backtracking grows exponentially with max_recursion, so the
initial population for the stdlib numbers module never finished.

Within the outermost _create_var_of_type call, remember the smallest depth
at which creating a type failed and fail fast for the same type at that
depth or deeper, before looking up its generators.
@LuKrO2011

Copy link
Copy Markdown
Member

Hi,

thank you for your contribution. I have no objections merging this, but let me first fix the CI (not your fault) and check if this introduces any regressions.

@LuKrO2011
LuKrO2011 merged commit bea483d into se2p:main Oct 26, 2026
14 of 16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants