Skip to content

Conversation

@JamesWrigley
Copy link
Member

This should fix errors from IJulia and the VS Code extension that redirect stdio to a custom IO type. Packages are loaded in a fixed world-age to prevent invalidations but precompilation will print messages, so if stdout/stderr are set to types defined in a newer world than Base._require_world_age (almost guaranteed if from an external package) then pipe_writer(custom_io) will end up being called, which will error because it's running in a world before the methods for custom_io were defined.

This essentially restores #51397, which was removed in #53403.

Fixes #60223.

@JamesWrigley JamesWrigley added backport 1.12 Change should be backported to release-1.12 backport 1.13 Change should be backported to release-1.13 labels Jan 19, 2026
@DilumAluthge DilumAluthge mentioned this pull request Jan 19, 2026
40 tasks
@JamesWrigley
Copy link
Member Author

(bump)

@LilithHafner
Copy link
Member

@KristofferC, this seems like something you might want to take a look at.

Copy link
Member

@KristofferC KristofferC left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe add a comment

This should fix errors from IJulia and the VS Code extension that redirect stdio
to a custom IO type. Packages are loaded in a fixed world-age to prevent
invalidations but precompilation will print messages, so if stdout/stderr are
set to types defined in a newer world than `Base._require_world_age` (almost
guaranteed if from an external package) then `pipe_writer(custom_io)` will end up
being called, which will error because it's running in a world before the
methods for `custom_io` were defined.
@JamesWrigley
Copy link
Member Author

Good point, added in 5dec715.

@KristofferC KristofferC mentioned this pull request Jan 26, 2026
43 tasks
@JamesWrigley
Copy link
Member Author

(bump)

@IanButterworth IanButterworth added the backport 1.10 Change should be backported to the 1.10 release label Jan 26, 2026
@IanButterworth IanButterworth merged commit 4d04bb6 into JuliaLang:master Jan 26, 2026
9 checks passed
@JamesWrigley JamesWrigley deleted the precompile-world-age branch January 26, 2026 16:43
@JamesWrigley JamesWrigley removed the backport 1.10 Change should be backported to the 1.10 release label Jan 26, 2026
@JamesWrigley
Copy link
Member Author

@IanButterworth I took the liberty of removing the backport label for 1.10, I don't think it's necessary because #53403 was only merged in 1.11, 1.10 should still contain #51397.

@IanButterworth
Copy link
Member

We backported precompilepkgs to 1.10. Can you review the 1.10 code to check.

@JamesWrigley
Copy link
Member Author

Hmm it doesn't look it was backported, the code is still calling the Pkg hook:

@invokelatest PKG_PRECOMPILE_HOOK[](pkg.name, _from_loading = true)

It looks ok to me, unless the plan is to backport precompilepkgs now (in which case yeah this PR should also be backported).

@IanButterworth
Copy link
Member

I can't find any evidence of it being backported.. odd. Maybe we tried and abandoned it or something.

Copy link
Member

@vtjnash vtjnash left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This feels somewhat aggressive to possibly recompile this huge function in order just to do the IO only in a different world. But otherwise does LGTM

@JamesWrigley
Copy link
Member Author

I can test it for invalidations later in the week. But last I looked at it'd be tricky to be more fine-grained because there's a lot of printing stuff in there.

KristofferC pushed a commit that referenced this pull request Feb 2, 2026
@KristofferC KristofferC removed the backport 1.13 Change should be backported to release-1.13 label Feb 4, 2026
@MasonProtter
Copy link
Contributor

Will this be backported to 1.12?

@JamesWrigley
Copy link
Member Author

I think it will since it still has the 1.12 label. Probably a bit late for 1.12.5 though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport 1.12 Change should be backported to release-1.12

Projects

None yet

Development

Successfully merging this pull request may close these issues.

MethodError when precompiling with custom stderr IO type

6 participants