[ruby-core:104969] [Ruby master Bug#18077] Marshal.dump(closed_io) raises IOError instead of TypeError
From:
"larskanis (Lars Kanis)" <noreply@...>
Date:
2021-08-18 15:14:32 UTC
List:
ruby-core #104969
Issue #18077 has been updated by larskanis (Lars Kanis). https://github.com/ruby/ruby/pull/4749 is another fix without the above side effect. Is it OK? ---------------------------------------- Bug #18077: Marshal.dump(closed_io) raises IOError instead of TypeError https://bugs.ruby-lang.org/issues/18077#change-93334 * 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 `<main>' ``` This issue is present in all current ruby versions. -- https://bugs.ruby-lang.org/ Unsubscribe: <mailto:[email protected]?subject=unsubscribe> <http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>