Skip to content

Commit

Permalink
Merge pull request #2242 from herwinw/marshal_dump_anonymous_module
Browse files Browse the repository at this point in the history
  • Loading branch information
seven1m authored Sep 29, 2024
2 parents a12e271 + b475010 commit ed151a7
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
4 changes: 1 addition & 3 deletions spec/core/marshal/dump_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -254,9 +254,7 @@ def _dump(level)
end

it "raises TypeError with an anonymous Module" do
NATFIXME 'raises TypeError with an anonymous Module', exception: SpecFailedException do
-> { Marshal.dump(Module.new) }.should raise_error(TypeError, /can't dump anonymous module/)
end
-> { Marshal.dump(Module.new) }.should raise_error(TypeError, /can't dump anonymous module/)
end
end

Expand Down
1 change: 1 addition & 0 deletions src/marshal.rb
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,7 @@ def write_class(value)
end

def write_module(value)
raise TypeError, "can't dump anonymous module #{value}" if value.name.nil?
write_char('m')
write_string_bytes(value.name)
end
Expand Down

0 comments on commit ed151a7

Please sign in to comment.