From 3f025d2078157e895fdcf77e31bfe62351bf90b4 Mon Sep 17 00:00:00 2001 From: nobu Date: Sat, 18 Aug 2007 05:05:36 +0000 Subject: * parse.y (reg_compile_gen): obtain error info from errinfo. * re.c (rb_reg_error_desc): make RegexpError for initialization error. * re.c (rb_reg_compile): return nil and set errinfo if error. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13092 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- parse.y | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'parse.y') diff --git a/parse.y b/parse.y index af4fa6f8d7..583bc45bdd 100644 --- a/parse.y +++ b/parse.y @@ -8115,7 +8115,8 @@ reg_compile_gen(struct parser_params* parser, const char *ptr, long len, int opt VALUE rb_reg_compile(const char *, long, int); VALUE re = rb_reg_compile(ptr, len, (options) & ~RE_OPTION_ONCE); - if (TYPE(re) == T_STRING) { + if (NIL_P(re)) { + RB_GC_GUARD(re) = rb_obj_as_string(rb_errinfo()); compile_error(PARSER_ARG "%s", RSTRING_PTR(re)); return Qnil; } -- cgit v1.2.3