ConradIrwin/interception — pull request #2 by kyrylo (2013-07-03 15:33:04+00:00)
Title: interception_spec: add a failing test (SystemStackError stuff)

Original issue: https://github.com/pry/pry/issues/942

The problem occurs in pry-rescue plugin, which the original poster uses. I really wished to fix that myself, but I stumbled upon a wall. So I just added a failing test.

The failing test errors with the following message (on 1.9.3 and higher): `can't modify frozen object (RuntimeError)`. Notice that this time it's frozen `object`, not `Class`.

On 1.8.7 the error message is different (BTW, I think we, Ruby developers, should forget about 1.8.7 now): ``NameError: undefined local variable or method `shoulder'``. I'm not sure, but it looks like it cannot retrieve the correct binding.

I discovered that the problem lies somewhere around that line: https://github.com/ConradIrwin/interception/blob/e6259a786b1f9715127e9a26491331c5c525e549/ext/interception.c#L47

For what it's worth, I also found that `SystemStackError` inherits from `Exception`. It also freezes the message error string, but I don't think that's relevant. https://github.com/ruby/ruby/blob/bbe36f64a065dd6124b119590c5d4e5370c893e5/proc.c#L2154-L2157