Repository navigation
fix: DynestyDynamic OverflowError when run without an output path - #1658
Open
samlange04 wants to merge 2 commits into
Open
samlange04 wants to merge 2 commits into
samlange04 wants to merge 2 commits into
Conversation
…tput path With `NullPaths` (a search created without a `name`), `iterations_from` returned `int(1e99)` as the "unbounded" per-chunk budget. dynesty's dynamic sampler computes `maxcall - ncall` with a numpy int64 `ncall`, and a 99-digit Python int cannot be converted to a C long, raising `OverflowError: Python int too large to convert to C long`. The static sampler only compares against `maxcall`, so it was unaffected. Use `sys.maxsize`, which is the sentinel dynesty itself uses for `maxcall=None`. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
…C long Regression test for the OverflowError raised by dynesty's dynamic sampler when a search is run without an output path. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Discussion: https://github.com/orgs/PyAutoLabs/discussions/28
DynestyDynamiccrashed withOverflowError: Python int too large to convert to C longwhenever the search had no output path (NullPaths, i.e. created without aname).AbstractDynesty.iterations_fromreturnedint(1e99)as the "unbounded" per-chunkmaxcallbudget in that case. dynesty's dynamic sampler computesmaxcall - ncallwith a numpy int64ncall, which cannot handle a 99-digit Python int. The static sampler only compares againstmaxcallin pure Python, so it was unaffected.This PR returns
sys.maxsizeinstead, the same sentinel dynesty substitutes formaxcall=None. The branch wheremaxcallis set is unchanged. A comment at the site records why the value matters.API Changes
iterations_fromis internal and theNullPathsreturn value changes fromint(1e99)tosys.maxsize. Both mean "no limit". No downstream code reads this value.Test Plan
test__null_paths_iteration_budget_fits_c_long, parametrised overDynestyStaticandDynestyDynamic: asserts the budget issys.maxsize, that subtracting anp.int64from it works, and that an explicitmaxcallis still returned unchanged. Fails red onmain(int(1e99) != sys.maxsize).DynestyDynamic) now runs to completion, with and withoutn_effective. Fitting with a named search before and after the change gives the same sample counts and effective sample sizes.test_autofit/non_linear/search/nest/: 40 passed, 13 skipped, on macOS / Python 3.13.7 / dynesty 2.1.5. Run with the conftest'sset_start_methodstubbed because of the macOS import-time bug fixed separately in fix: do not fix the multiprocessing start method at import time on macOS #1657.🤖 Generated with Claude Code