summaryrefslogtreecommitdiff
path: root/ext/psych/lib/psych/visitors/yaml_tree.rb
diff options
context:
space:
mode:
authorCharles Oliver Nutter <headius@headius.com>2020-07-16 10:21:18 -0500
committerHiroshi SHIBATA <hsbt@ruby-lang.org>2020-09-25 13:11:32 +0900
commit33641e00cd0a1a2e4c497f70365f06bf5c5f3f6a (patch)
tree165ed8b1c322d24dd01f3e2421b80a126a26eb11 /ext/psych/lib/psych/visitors/yaml_tree.rb
parent6081ba4a871f857eabdcb1e51b68f11bb10c49af (diff)
Remove private_iv_get
The only remaining use of this function was to get the internal message object from an exception's hidden `mesg` instance variable to allow it to be dumped wiithout converting to a string. As discussed in #103, this exposes internal implementation details of CRuby, and ultimately does not provide any real utility to the user since they can't directly inspect this hidden variable. The test change here is to reflect CRuby behavior that denies equality if the internal message objects do not match, as is the case after the exception has been loaded and now has a simple String value. The impact to users is that exceptions with special hidden message objects will convert those objects to String during marshaling through YAML. I believe this only affects NameError and its descendants, since users can't set this field directly on their own exception types. Fixes #103.
Diffstat (limited to 'ext/psych/lib/psych/visitors/yaml_tree.rb')
-rw-r--r--ext/psych/lib/psych/visitors/yaml_tree.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/ext/psych/lib/psych/visitors/yaml_tree.rb b/ext/psych/lib/psych/visitors/yaml_tree.rb
index 79ca129b83..986c57be70 100644
--- a/ext/psych/lib/psych/visitors/yaml_tree.rb
+++ b/ext/psych/lib/psych/visitors/yaml_tree.rb
@@ -181,7 +181,7 @@ module Psych
end
def visit_Exception o
- dump_exception o, private_iv_get(o, 'mesg')
+ dump_exception o, o.message.to_s
end
def visit_NameError o