From: "larskanis (Lars Kanis)" Date: 2021-08-19T08:39:41+00:00 Subject: [ruby-core:105004] [Ruby master Bug#18077] Marshal.dump(closed_io) raises IOError instead of TypeError Issue #18077 has been updated by larskanis (Lars Kanis). @eregon This was my first though as well, but the current behavior is already defined in ruby-spec. I would prefer the behavioral change of `IO#(in|ex)ternal_encoding` being usable on closed IOs and prepared a PR: https://github.com/ruby/ruby/pull/4758 ---------------------------------------- Bug #18077: Marshal.dump(closed_io) raises IOError instead of TypeError https://bugs.ruby-lang.org/issues/18077#change-93404 * 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: