diff options
author | Jeremy Evans <[email protected]> | 2021-05-21 11:01:06 -0700 |
---|---|---|
committer | Jeremy Evans <[email protected]> | 2021-07-29 13:51:03 -0700 |
commit | 64ac984129a7a4645efe5ac57c168ef880b479b2 (patch) | |
tree | 3d5aa171e3e63e39b9b8d4ab4425d01894880f02 /iseq.c | |
parent | 6998d758248d778fa95b008c78d05473e48b8428 (diff) |
Make RubyVM::AbstractSyntaxTree.of raise for method/proc created in eval
This changes Thread::Location::Backtrace#absolute_path to return
nil for methods/procs defined in eval. If the realpath of an iseq
is nil, that indicates it was defined in eval, in which case you
cannot use RubyVM::AbstractSyntaxTree.of.
Fixes [Bug #16983]
Co-authored-by: Koichi Sasada <[email protected]>
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/4519
Diffstat (limited to 'iseq.c')
-rw-r--r-- | iseq.c | 6 |
1 files changed, 6 insertions, 0 deletions
@@ -1115,6 +1115,12 @@ rb_iseq_absolute_path(const rb_iseq_t *iseq) return rb_iseq_realpath(iseq); } +int +rb_iseq_from_eval_p(const rb_iseq_t *iseq) +{ + return NIL_P(rb_iseq_realpath(iseq)); +} + VALUE rb_iseq_label(const rb_iseq_t *iseq) { |