Project

General

Profile

Actions

Backport #5415

closed

YAML serialization problem for Exception

Added by jingweno (Owen Ou) over 12 years ago. Updated almost 12 years ago.

Status:
Closed
Assignee:
-
[ruby-core:39978]

Description

The implementation of YAML.object_maker allocates an object and
instance_variable_set the instance variables passed as the second
argument, while Exception doesn't seem to use such instance variable to
return the exception message (Exception#message). This bug can be
reproduced by typing
YAML::load(YAML::dump(Exception.new('test_message'))) in IRB.

this bug can be reproduced in Ruby 1.8 as well

Updated by jingweno (Owen Ou) over 12 years ago

To reproduce the bug, try this on IRB:

ruby-1.9.2-p290 :001 > require 'yaml'
=> true
ruby-1.9.2-p290 :002 > YAML::load(YAML::dump(Exception.new('test_message')))
=> #<Exception: Exception>

I expect to see #<Exception: "test_message"> while the result is #<Exception: Exception>.

I have fixed this problem with a pull request on August 09 2011 which hasn't been merged in till now: https://github.com/ruby/ruby/pull/41

Actions #3

Updated by nobu (Nobuyoshi Nakada) about 12 years ago

  • Category set to ext
  • Status changed from Open to Closed
  • Priority changed from 6 to Normal
  • % Done changed from 0 to 100

Applied at r34908.

Actions #4

Updated by nobu (Nobuyoshi Nakada) about 12 years ago

  • Tracker changed from Bug to Backport
  • Project changed from Ruby master to Backport193
  • Category deleted (ext)
  • Target version deleted (1.9.2)

Updated by nobu (Nobuyoshi Nakada) about 12 years ago

  • Status changed from Closed to Open

Updated by naruse (Yui NARUSE) almost 12 years ago

  • Status changed from Open to Closed
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0