From 64ac984129a7a4645efe5ac57c168ef880b479b2 Mon Sep 17 00:00:00 2001 From: Jeremy Evans Date: Fri, 21 May 2021 11:01:06 -0700 Subject: 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 --- iseq.h | 1 + 1 file changed, 1 insertion(+) (limited to 'iseq.h') diff --git a/iseq.h b/iseq.h index 87e498227b..b792e13703 100644 --- a/iseq.h +++ b/iseq.h @@ -192,6 +192,7 @@ VALUE rb_iseqw_new(const rb_iseq_t *iseq); const rb_iseq_t *rb_iseqw_to_iseq(VALUE iseqw); VALUE rb_iseq_absolute_path(const rb_iseq_t *iseq); /* obsolete */ +int rb_iseq_from_eval_p(const rb_iseq_t *iseq); VALUE rb_iseq_label(const rb_iseq_t *iseq); VALUE rb_iseq_base_label(const rb_iseq_t *iseq); VALUE rb_iseq_first_lineno(const rb_iseq_t *iseq); -- cgit v1.2.1