Skip to content

Dumping Hash with default_proc that was reset #4302

@kirs

Description

@kirs
# default_proc.rb
hash = Hash.new { |k| "default value" }
hash.default_proc = nil
Marshal.dump(hash)

$ jruby default_proc.rb
TypeError: can't dump hash with default proc
    dump at org/jruby/RubyMarshal.java:102
  <main> at default_proc.rb:3

Running on jruby 9.1.6.0 (2.3.1) 2016-11-09 0150a76 Java HotSpot(TM) 64-Bit Server VM 25.45-b02 on 1.8.0_45-b14 +jit [darwin-x86_64]

Expected Behavior

JRuby should be able to dump a hash that was initialized with default_proc that was later set to nil.

Actual Behavior

JRuby currently ignores default_proc set to nil and gives an error that a hash with default_proc cannot be dumped.

@headius @guilleiguaran

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions