mirror of
https://github.com/ruby/ruby.git
synced 2025-08-23 21:14:23 +02:00
merge revision(s) r45178,r45180,r45183: [Backport #9568]
eval.c: remove unneeded GC guard * eval.c (setup_exception): remove RB_GC_GUARD which is no longer needed since r41598. * eval.c (setup_exception): preserve errinfo across calling #to_s method on the exception. [ruby-core:61091] [Bug #9568] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_1@46236 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
74d6b68229
commit
fca433e2fd
4 changed files with 34 additions and 4 deletions
|
@ -1,3 +1,8 @@
|
||||||
|
Fri May 30 00:13:19 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||||
|
|
||||||
|
* eval.c (setup_exception): preserve errinfo across calling #to_s
|
||||||
|
method on the exception. [ruby-core:61091] [Bug #9568]
|
||||||
|
|
||||||
Thu May 29 20:57:59 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
Thu May 29 20:57:59 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||||
|
|
||||||
* numeric.c (ruby_num_interval_step_size): check signs and get rid
|
* numeric.c (ruby_num_interval_step_size): check signs and get rid
|
||||||
|
|
5
eval.c
5
eval.c
|
@ -507,9 +507,12 @@ setup_exception(rb_thread_t *th, int tag, volatile VALUE mesg)
|
||||||
!rb_obj_is_kind_of(e, rb_eSystemExit)) {
|
!rb_obj_is_kind_of(e, rb_eSystemExit)) {
|
||||||
int status;
|
int status;
|
||||||
|
|
||||||
|
mesg = e;
|
||||||
PUSH_TAG();
|
PUSH_TAG();
|
||||||
if ((status = EXEC_TAG()) == 0) {
|
if ((status = EXEC_TAG()) == 0) {
|
||||||
RB_GC_GUARD(e) = rb_obj_as_string(e);
|
th->errinfo = Qnil;
|
||||||
|
e = rb_obj_as_string(mesg);
|
||||||
|
th->errinfo = mesg;
|
||||||
if (file && line) {
|
if (file && line) {
|
||||||
warn_printf("Exception `%s' at %s:%d - %"PRIsVALUE"\n",
|
warn_printf("Exception `%s' at %s:%d - %"PRIsVALUE"\n",
|
||||||
rb_obj_classname(th->errinfo), file, line, e);
|
rb_obj_classname(th->errinfo), file, line, e);
|
||||||
|
|
|
@ -78,6 +78,28 @@ class TestException < Test::Unit::TestCase
|
||||||
assert(!bad)
|
assert(!bad)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_errinfo_in_debug
|
||||||
|
bug9568 = EnvUtil.labeled_class("[ruby-core:61091] [Bug #9568]", RuntimeError) do
|
||||||
|
def to_s
|
||||||
|
require '\0'
|
||||||
|
rescue LoadError
|
||||||
|
self.class.to_s
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
err = EnvUtil.verbose_warning do
|
||||||
|
assert_raise(bug9568) do
|
||||||
|
$DEBUG, debug = true, $DEBUG
|
||||||
|
begin
|
||||||
|
raise bug9568
|
||||||
|
ensure
|
||||||
|
$DEBUG = debug
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
assert_include(err, bug9568.to_s)
|
||||||
|
end
|
||||||
|
|
||||||
def test_break_ensure
|
def test_break_ensure
|
||||||
bad = true
|
bad = true
|
||||||
while true
|
while true
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
#define RUBY_VERSION "2.1.2"
|
#define RUBY_VERSION "2.1.2"
|
||||||
#define RUBY_RELEASE_DATE "2014-05-29"
|
#define RUBY_RELEASE_DATE "2014-05-30"
|
||||||
#define RUBY_PATCHLEVEL 116
|
#define RUBY_PATCHLEVEL 117
|
||||||
|
|
||||||
#define RUBY_RELEASE_YEAR 2014
|
#define RUBY_RELEASE_YEAR 2014
|
||||||
#define RUBY_RELEASE_MONTH 5
|
#define RUBY_RELEASE_MONTH 5
|
||||||
#define RUBY_RELEASE_DAY 29
|
#define RUBY_RELEASE_DAY 30
|
||||||
|
|
||||||
#include "ruby/version.h"
|
#include "ruby/version.h"
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue