Import 'import' instead of inheriting it#11
Merged
doy merged 2 commits intodoy:masterfrom Jan 23, 2014
ilmari:global-destruction
Merged
Import 'import' instead of inheriting it#11doy merged 2 commits intodoy:masterfrom ilmari:global-destruction
doy merged 2 commits intodoy:masterfrom
ilmari:global-destruction
Conversation
This fixes errors when the first use of Try::Tiny happens during global destruction on Perl >= 5.10.0. The problem is that the inheritance caches don't get invalidated during global destruction, and base.pm skips classes that the calling class already inherits from, thus populating an initial empty inheritance cache, which doesn't get invalidated when it adds the class to @isa.
Owner
|
Do you have a test for this? I can't seem to reproduce it (I get this same result on all perls from 5.8 to 5.18): |
Author
|
The problem is caused when a module importing try/catch from Try::Tiny is loaded during global destruction, in which case the subs aren't exported to it, since 'use base' doesn't work. Because exceptions during global destruction are converted to warnings and don't affect the exit status, testing would involve using Capture::Tiny, which until yesterday (version 0.23) didn't install on 5.6. Now that that's fixed, I'll gladly write some tests, if that's an acceptable test prereq. |
Owner
|
Yes, that's fine - just make it an author dependency (and have the test skip if it's not installed). |
doy
added a commit
that referenced
this pull request
Jan 23, 2014
Import 'import' instead of inheriting it
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.
This fixes errors when the first use of Try::Tiny happens during global
destruction on Perl >= 5.10.0.
The problem is that the inheritance caches don't get invalidated during
global destruction, and base.pm skips classes that the calling class
already inherits from, thus populating an initial empty inheritance
cache, which doesn't get invalidated when it adds the class to @isa.