From: "nobu (Nobuyoshi Nakada)" Date: 2021-08-16T12:40:54+00:00 Subject: [ruby-core:104928] [Ruby master Bug#18077] Marshal.dump(closed_io) raises IOError instead of TypeError Issue #18077 has been updated by nobu (Nobuyoshi Nakada). One concern for that [PR], probably may not be a matter, is closed `IO`s will no longer raise `IOError` on other `Encoding` operations too. [PR]: https://github.com/ruby/ruby/pull/4746 ``` $ ./ruby -v -e 'p Encoding.compatible?(Encoding::US_ASCII, File.open(IO::NULL).tap(&:close))' ruby 3.1.0dev (2021-08-16T08:00:19Z master a8714b83c4) [x86_64-darwin19] -e:1:in `internal_encoding': closed stream (IOError) from -e:1:in `compatible?' from -e:1:in `
' ``` ``` $ ./ruby -v -e 'p Encoding.compatible?(Encoding::US_ASCII, File.open(IO::NULL).tap(&:close))' ruby 3.1.0dev (2021-08-16T12:33:34Z master 9dd58a421b) [x86_64-darwin19] last_commit=Fix Marshal.dump(closed_io) to raise TypeError nil ``` ---------------------------------------- Bug #18077: Marshal.dump(closed_io) raises IOError instead of TypeError https://bugs.ruby-lang.org/issues/18077#change-93294 * 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: