From: "Eregon (Benoit Daloze)" Date: 2021-08-21T21:18:05+00:00 Subject: [ruby-core:105045] [Ruby master Bug#18077] Marshal.dump(closed_io) raises IOError instead of TypeError Issue #18077 has been updated by Eregon (Benoit Daloze). larskanis (Lars Kanis) wrote in #note-5: > @eregon This was my first though as well, but the current behavior is already defined in ruby-spec. We can change it in ruby/spec (adding version guards and adding the new expectation). And in fact I would be glad if the adapted specs would test the more sensible behavior. ruby/spec often tests whatever the behavior of CRuby is (for best compatibility with other Rubies), it might not always make sense. ---------------------------------------- Bug #18077: Marshal.dump(closed_io) raises IOError instead of TypeError https://bugs.ruby-lang.org/issues/18077#change-93454 * Author: larskanis (Lars Kanis) * Status: Open * Priority: Normal * ruby -v: ruby 3.1.0dev (2021-08-16T08:00:19Z master a8714b83c4) [x86_64-linux] * Backport: 2.6: UNKNOWN, 2.7: UNKNOWN, 3.0: UNKNOWN ---------------------------------------- Marshal.dump is expected to raise a `TypeError` for unmarshallable objects. But closed streams raise an `IOError`: ``` $ ruby -e "io=IO.pipe.first; io.close; Marshal.dump(io)" -e:1:in `internal_encoding': closed stream (IOError) from -e:1:in `dump' from -e:1:in `
' ``` This issue is present in all current ruby versions. -- https://bugs.ruby-lang.org/ Unsubscribe: