stdlib: resolve absolute script paths independently of sys.path by ac1982 · Pull Request #261 · go-python/gpython
Repository navigation
stdlib: resolve absolute script paths independently of sys.path - #261
Open
ac1982 wants to merge 1 commit into go-python:main from ac1982:fix-absolute-run-path
Open
stdlib: resolve absolute script paths independently of sys.path #261 ac1982 wants to merge 1 commit into go-python:main from ac1982:fix-absolute-run-path
Conversation
ac1982 commented Oct 11, 2026
Copy link Copy Markdown
RunFile fails to open an existing absolute script path with the default compile options: resolveRunPath joins it to "." first, which removes the leading slash before the absolute-path check. With an empty sys.path, it never attempts the file at all.
Resolve absolute inputs independently of search directories by joining them only to an empty prefix. Relative-path search and existing error handling are unchanged. Add an execution regression using a real temporary script with both default options and an empty sys.path.
Fixes #259 . This is independent of the nil-module-pointer fix in #260 and is based directly on main.
Validation on Linux/arm64:
- Both absolute-path cases fail with FileNotFoundError before the fix and pass afterward.
- Go 1.27.1 full project runner with
-tags=ci -race -coverpkg=github.com/go-python/gpython/...passes. - Go 1.18.10 targeted test and Staticcheck 2022.1.3 across all packages pass.
goimportsandgit diff --checkpass. Windows/macOS runtime behavior was not tested.
Author registration: go-python/license#24 .
AI assistance: this fix and its regression tests were developed and verified with an AI coding agent.
stdlib: resolve absolute script paths independently of sys.path
e53e007
drew-512 commented Nov 10, 2026
Copy link Copy Markdown
Contributor
|
Tested against main (444ae5e ): One coordination note: this PR and my #268 both added |