diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2019-01-09 13:34:51 -0800 |
---|---|---|
committer | Hiroshi SHIBATA <hsbt@ruby-lang.org> | 2019-06-25 15:56:20 +0900 |
commit | a53ab897c35586a836710a8afeb1e8c1abd9b087 (patch) | |
tree | 08a43afe2df4251c3154aa680ecc0c8e33366049 /ext/psych/lib | |
parent | f770a5be66412fcbdb238db950c80367100a257e (diff) |
Round trip exception backtraces
This commit allows exception backtraces to round trip
Diffstat (limited to 'ext/psych/lib')
-rw-r--r-- | ext/psych/lib/psych/visitors/to_ruby.rb | 2 | ||||
-rw-r--r-- | ext/psych/lib/psych/visitors/yaml_tree.rb | 3 |
2 files changed, 5 insertions, 0 deletions
diff --git a/ext/psych/lib/psych/visitors/to_ruby.rb b/ext/psych/lib/psych/visitors/to_ruby.rb index 74a52df866..c265acb819 100644 --- a/ext/psych/lib/psych/visitors/to_ruby.rb +++ b/ext/psych/lib/psych/visitors/to_ruby.rb @@ -252,6 +252,8 @@ module Psych e = build_exception((resolve_class($1) || class_loader.exception), h.delete('message')) + + e.set_backtrace h.delete('backtrace') if h.key? 'backtrace' init_with(e, h, o) when '!set', 'tag:yaml.org,2002:set' diff --git a/ext/psych/lib/psych/visitors/yaml_tree.rb b/ext/psych/lib/psych/visitors/yaml_tree.rb index bc7d2352e4..62d1d5c3f4 100644 --- a/ext/psych/lib/psych/visitors/yaml_tree.rb +++ b/ext/psych/lib/psych/visitors/yaml_tree.rb @@ -472,6 +472,9 @@ module Psych accept msg end + @emitter.scalar 'backtrace', nil, nil, true, false, Nodes::Scalar::ANY + accept o.backtrace + dump_ivars o @emitter.end_mapping |