throw_data passed to rescue through require
When we throw in a require it's incorrectly considered as a raise, making the
throw_data object accessible via rescue (in a contrived case). In regular usage this is unlikely to cause an issue because
Module#=== immediately returns false for objects with klass == 0.
throw :extdep, 42
class Anything < Exception def self.===(_); true; end end catch(:extdep) do begin require "./test_throw" rescue Anything => e p e end end
in 'p': method inspect' called on unexpected T_IMEMO object (0x00007f5e1486b130 flags=0x10000301a) (NotImplementedError)
I've proposed a fix via PR https://github.com/ruby/ruby/pull/5513