-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Soft deprecation of LoadError in runtime #31882
base: master
Are you sure you want to change the base?
Conversation
To get a better feel for remaining breakage not mitigated in this PR, I have run the tests of all 22/350 packages which I have installed locally and which mention
This is surprisingly encouraging, though it's by no means a systematic survey of all packages. I'm not sure I have the resources to cast the net wider though. |
[Edit: I think the following questions have been answered sufficiently by the discussion below] Questions for triageI've attached the triage label because I'd like some feedback in regard to the 1.2 release:
Apologies if this comes late in the release cycle, I don't know where we are in preparing the RC. |
If the only breakages are in internal guts of packages like Revise and the debugger stack, it's not worth stressing over: these packages make heavy usage of Julia's internal representations of code, so are fair game for breakage as far as I am concerned. (I don't enjoy the maintenance burden, but "freezing" the development of Julia's internals would be far worse.) OTOH, if they are just flagging things that look like the kind of code patterns that might appear in more enduser-oriented packages, there's more to think about. What's the specific breakage error message in Revise? |
The failure in the Revise tests is quite mundane. It's simply because This is definitely a pattern which could occur elsewhere and probably does, though much less than I originally feared. Also much more likely to occur as a spurious test failure than an actual failure in package code. |
@@ -1914,6 +1914,9 @@ AssertionError | |||
|
|||
An error occurred while [`include`](@ref Base.include)ing, [`require`](@ref Base.require)ing, or [`using`](@ref) a file. The error specifics | |||
should be available in the `.error` field. | |||
|
|||
!!! compat "Julia 1.3" | |||
LoadError is deprecated because it is no longer emitted by the runtime as of Julia 1.3. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Message needs changing if this was to go into 1.2
I'd say this is probably a fine candidate to go into a 1.x release, but it's too late for 1.2. |
I recall discussing somewhere that the type of a thrown exception is allowed to change, and I believe there have already been 1.x changes of that nature. |
If that's the case, it occurs to me that a logical step related to this PR might be to replace a lot of what are |
To clarify, something has to go into 1.2, even if it's just a NEWS item announcing a breaking change. See #31830. |
It seems likely that this change will break at least some of the above? Would be good to look more closely, at least. |
My view of #31830 is that it doesn't really make sense to throw So for 1.2, I think we should just revert the |
Oh, good catch. I thought this was fixed by #31881, but that only fixes a subset of these kind of problems, unfortunately not including macro invocation. So either we need an equivalent of |
We could add a |
A |
Remove use of LoadError from the runtime now that backtraces are more reliable. It's left in boot.jl for now for 1.x compatibility. Compatibility: It's difficult to deprecate this in a fully backward compatible way, because packages commonly test macro expansion using constructs like @ test_throws LoadError macroexpand(:(@ some_pkg_macro)) to make this into as minor a change as possible, grandfather special rules for LoadError into stdlib/Test.
Status? Seems like this isn't a 1.5 blocker. |
Correct, not a 1.5 blocker in any way. There's some design decisions and certainly some implementation to finish here. |
Remove use of
LoadError
from the runtime now that backtraces are more reliable. It's left in boot.jl for now for 1.x compatibility. This is one approach to fixing #31830 (I'm not sure how this interacts with the 1.2 release schedule).It also partly addresses #31257 as suggested in #31257 (comment)
I'd like to point out that there's several instances of special code for unwrapping
LoadError
which are removed here, and my feeling is that this is general improvement which will allow people to delete similar code.I've pulled out the first patch of this change as #31881 because I think that is independently useful and non-breaking. Hopefully that will be resolved quickly in which case I'll rebase this.
Compatibility
I expect that removing this may be difficult from a compatibility point of view and I'm not sure whether this can be considered a minor change. My impression is that packages don't rely on
LoadError
much in code, but do rely on it in tests. In an informal survey of locally installed packages, I've seen 8/350 with test constructs looking likeand at least one which explicitly unpacks the
LoadError
.To make this into as minor a change as possible (avoid breaking such tests) I've grandfather special rules for LoadError into stdlib/Test. However, this won't completely make this into a non-breaking change and the question is whether the remaining breakage is acceptable.
TODO
TODOs which have arisen from the discussion:
SyntaxError
(or existingParseError
?) to replaceLoadError(ErrorException("syntax: ...
while we're changing these things.