diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-10-21 14:57:55 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-10-21 14:57:55 +0000 |
commit | 274e50c1892eaa24c2287146a43360a576a6a465 (patch) | |
tree | a658f9833ebea8761ce4eaeae535367a79a67374 /encoding.c | |
parent | 3f939a449d01b1ac578230a8884144d51cd7637f (diff) |
encoding.c: preserve outer errinfo
* encoding.c (load_encoding): should preserve outer errinfo, so that
expected exception may not be lost. [ruby-core:57949] [Bug #9038]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43376 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'encoding.c')
-rw-r--r-- | encoding.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/encoding.c b/encoding.c index 4793e67375..b073311c8d 100644 --- a/encoding.c +++ b/encoding.c @@ -623,6 +623,7 @@ load_encoding(const char *name) VALUE enclib = rb_sprintf("enc/%s.so", name); VALUE verbose = ruby_verbose; VALUE debug = ruby_debug; + VALUE errinfo; VALUE loaded; char *s = RSTRING_PTR(enclib) + 4, *e = RSTRING_END(enclib) - 3; int idx; @@ -636,10 +637,11 @@ load_encoding(const char *name) OBJ_FREEZE(enclib); ruby_verbose = Qfalse; ruby_debug = Qfalse; + errinfo = rb_errinfo(); loaded = rb_protect(require_enc, enclib, 0); ruby_verbose = verbose; ruby_debug = debug; - rb_set_errinfo(Qnil); + rb_set_errinfo(errinfo); if (NIL_P(loaded)) return -1; if ((idx = rb_enc_registered(name)) < 0) return -1; if (enc_autoload_p(enc_table.list[idx].enc)) return -1; |