Skip to content
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

catch_backtrace must be called early after catch #415

Merged
merged 1 commit into from
Apr 20, 2016

Conversation

gustafsson
Copy link
Contributor

@gustafsson gustafsson commented Apr 20, 2016

The state fetched by catch_backtrace might get erased if IO operations occur in the same catch block before catch_backtrace is called.

(this is a workaround to JuliaLang/julia#13947)

Test case (a less complex call to println doesn't show the same problem):

println(" ", 1, " ", Dates.Date(2016,1,1))
collect(Int64,[1.5])

on x86_64-apple-darwin15.4.0 from homebrew Version 0.4.5 (2016-03-18 00:58 UTC) this produces

 1 2016-01-01
LoadError: InexactError()
while loading In[1], in expression starting on line 2


after this PR the output contains the backtrace as intended:

 1 2016-01-01
LoadError: InexactError()
while loading In[1], in expression starting on line 2

 in collect at array.jl:256

The state is erased somewhere in the nested try block.

(this might be a Julia bug)

Test case:

println(" ", 1, " ", Dates.Date(2016,1,1))
collect(Int64,[1.5])

on x86_64-apple-darwin15.4.0 from homebrew Version 0.4.5 (2016-03-18 00:58 UTC) this produces

 1 2016-01-01
LoadError: InexactError()
while loading In[1], in expression starting on line 2

after this patch it produces an additional line:

 in collect at array.jl:256
@stevengj stevengj merged commit 1c365bf into JuliaLang:master Apr 20, 2016
@stevengj
Copy link
Member

Looks good, thanks.

@gustafsson gustafsson deleted the early_catch_backtrace branch April 20, 2016 20:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants