ruby-core@ruby-lang.org archive (unofficial mirror)
 help / color / mirror / Atom feed
* [ruby-core:91232] [Ruby trunk Bug#15558] Should Exception#exception copy the backtrace?
       [not found] <redmine.issue-15558.20190123161849@ruby-lang.org>
@ 2019-01-23 16:18 ` eregontp
  2019-03-22 22:41 ` [ruby-core:91951] " eregontp
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 6+ messages in thread
From: eregontp @ 2019-01-23 16:18 UTC (permalink / raw)
  To: ruby-core

Issue #15558 has been reported by Eregon (Benoit Daloze).

----------------------------------------
Bug #15558: Should Exception#exception copy the backtrace?
https://bugs.ruby-lang.org/issues/15558

* Author: Eregon (Benoit Daloze)
* Status: Open
* Priority: Normal
* Assignee: 
* Target version: 
* ruby -v: ruby 2.6.0p0 (2018-12-25 revision 66547) [x86_64-linux]
* Backport: 2.4: UNKNOWN, 2.5: UNKNOWN, 2.6: UNKNOWN
----------------------------------------
Currently it does not on MRI:
```
ruby -e 'begin raise "foo"; rescue => e; c=e.exception "bar"; p c.backtrace; end'
nil
```

But it does on JRuby 9.2.5.0 and TruffleRuby 1.0.0-rc11:
```
truffleruby -e 'begin raise "foo"; rescue => e; c=e.exception "bar"; p e.backtrace; end'
["-e:1:in `<main>'"]
```

This means in some cases, code needs about this difference such as in
https://github.com/asciidoctor/asciidoctor/blob/41da20a47a8da96966ef3ec1c2f509e07e7920e3/lib/asciidoctor.rb#L1322-L1338
More context in:
https://github.com/oracle/truffleruby/issues/1542#issuecomment-456850066



-- 
https://bugs.ruby-lang.org/

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [ruby-core:91951] [Ruby trunk Bug#15558] Should Exception#exception copy the backtrace?
       [not found] <redmine.issue-15558.20190123161849@ruby-lang.org>
  2019-01-23 16:18 ` [ruby-core:91232] [Ruby trunk Bug#15558] Should Exception#exception copy the backtrace? eregontp
@ 2019-03-22 22:41 ` eregontp
  2019-03-23 21:43 ` [ruby-core:91960] " eregontp
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 6+ messages in thread
From: eregontp @ 2019-03-22 22:41 UTC (permalink / raw)
  To: ruby-core

Issue #15558 has been updated by Eregon (Benoit Daloze).


@nobu and other MRI committers: what do you think?

It's somewhat inconsistent with Exception#clone which does copy the backtrace.

Would it make sense to follow JRuby and TruffleRuby's behavior, by copying the backtrace too, here?

----------------------------------------
Bug #15558: Should Exception#exception copy the backtrace?
https://bugs.ruby-lang.org/issues/15558#change-77283

* Author: Eregon (Benoit Daloze)
* Status: Open
* Priority: Normal
* Assignee: 
* Target version: 
* ruby -v: ruby 2.6.0p0 (2018-12-25 revision 66547) [x86_64-linux]
* Backport: 2.4: UNKNOWN, 2.5: UNKNOWN, 2.6: UNKNOWN
----------------------------------------
Currently it does not on MRI:
```
ruby -e 'begin raise "foo"; rescue => e; c=e.exception "bar"; p c.backtrace; end'
nil
```

But it does on JRuby 9.2.5.0 and TruffleRuby 1.0.0-rc11:
```
truffleruby -e 'begin raise "foo"; rescue => e; c=e.exception "bar"; p e.backtrace; end'
["-e:1:in `<main>'"]
```

This means in some cases, code needs about this difference such as in
https://github.com/asciidoctor/asciidoctor/blob/41da20a47a8da96966ef3ec1c2f509e07e7920e3/lib/asciidoctor.rb#L1322-L1338
More context in:
https://github.com/oracle/truffleruby/issues/1542#issuecomment-456850066



-- 
https://bugs.ruby-lang.org/

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [ruby-core:91960] [Ruby trunk Bug#15558] Should Exception#exception copy the backtrace?
       [not found] <redmine.issue-15558.20190123161849@ruby-lang.org>
  2019-01-23 16:18 ` [ruby-core:91232] [Ruby trunk Bug#15558] Should Exception#exception copy the backtrace? eregontp
  2019-03-22 22:41 ` [ruby-core:91951] " eregontp
@ 2019-03-23 21:43 ` eregontp
  2019-06-04 12:20 ` [ruby-core:92955] " eregontp
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 6+ messages in thread
From: eregontp @ 2019-03-23 21:43 UTC (permalink / raw)
  To: ruby-core

Issue #15558 has been updated by Eregon (Benoit Daloze).


BTW, MRuby 2.0.0 also copies the backtrace (because it implements Exception#exception as clone + setting the message):

```
$ mruby -e 'begin raise "foo"; rescue => e; c=e.exception "bar"; p c.backtrace; end'          
["-e:1"]
```

MRI also clones (with `rb_obj_clone`), but `exc_init` resets the backtrace to `nil`.
So should `exc_exception()` just call `rb_ivar_set(exc, id_mesg, argv[0]);` instead of `exc_initialize` (which kind of initializes the object twice)?

----------------------------------------
Bug #15558: Should Exception#exception copy the backtrace?
https://bugs.ruby-lang.org/issues/15558#change-77294

* Author: Eregon (Benoit Daloze)
* Status: Open
* Priority: Normal
* Assignee: 
* Target version: 
* ruby -v: ruby 2.6.0p0 (2018-12-25 revision 66547) [x86_64-linux]
* Backport: 2.4: UNKNOWN, 2.5: UNKNOWN, 2.6: UNKNOWN
----------------------------------------
Currently it does not on MRI:
```
ruby -e 'begin raise "foo"; rescue => e; c=e.exception "bar"; p c.backtrace; end'
nil
```

But it does on JRuby 9.2.5.0 and TruffleRuby 1.0.0-rc11:
```
truffleruby -e 'begin raise "foo"; rescue => e; c=e.exception "bar"; p e.backtrace; end'
["-e:1:in `<main>'"]
```

This means in some cases, code needs about this difference such as in
https://github.com/asciidoctor/asciidoctor/blob/41da20a47a8da96966ef3ec1c2f509e07e7920e3/lib/asciidoctor.rb#L1322-L1338
More context in:
https://github.com/oracle/truffleruby/issues/1542#issuecomment-456850066



-- 
https://bugs.ruby-lang.org/

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [ruby-core:92955] [Ruby trunk Bug#15558] Should Exception#exception copy the backtrace?
       [not found] <redmine.issue-15558.20190123161849@ruby-lang.org>
                   ` (2 preceding siblings ...)
  2019-03-23 21:43 ` [ruby-core:91960] " eregontp
@ 2019-06-04 12:20 ` eregontp
  2019-06-05 20:19 ` [ruby-core:92988] " eregontp
  2019-07-29  7:56 ` [ruby-core:93982] [Ruby master " ko1
  5 siblings, 0 replies; 6+ messages in thread
From: eregontp @ 2019-06-04 12:20 UTC (permalink / raw)
  To: ruby-core

Issue #15558 has been updated by Eregon (Benoit Daloze).


I plan to fix this and copy the backtrace too in MRI, because it looks not intentional and inconsistent.
Anyone against?

----------------------------------------
Bug #15558: Should Exception#exception copy the backtrace?
https://bugs.ruby-lang.org/issues/15558#change-78332

* Author: Eregon (Benoit Daloze)
* Status: Open
* Priority: Normal
* Assignee: 
* Target version: 
* ruby -v: ruby 2.6.0p0 (2018-12-25 revision 66547) [x86_64-linux]
* Backport: 2.4: UNKNOWN, 2.5: UNKNOWN, 2.6: UNKNOWN
----------------------------------------
Currently it does not on MRI:
```
ruby -e 'begin raise "foo"; rescue => e; c=e.exception "bar"; p c.backtrace; end'
nil
```

But it does on JRuby 9.2.5.0 and TruffleRuby 1.0.0-rc11:
```
truffleruby -e 'begin raise "foo"; rescue => e; c=e.exception "bar"; p e.backtrace; end'
["-e:1:in `<main>'"]
```

This means in some cases, code needs about this difference such as in
https://github.com/asciidoctor/asciidoctor/blob/41da20a47a8da96966ef3ec1c2f509e07e7920e3/lib/asciidoctor.rb#L1322-L1338
More context in:
https://github.com/oracle/truffleruby/issues/1542#issuecomment-456850066



-- 
https://bugs.ruby-lang.org/

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [ruby-core:92988] [Ruby trunk Bug#15558] Should Exception#exception copy the backtrace?
       [not found] <redmine.issue-15558.20190123161849@ruby-lang.org>
                   ` (3 preceding siblings ...)
  2019-06-04 12:20 ` [ruby-core:92955] " eregontp
@ 2019-06-05 20:19 ` eregontp
  2019-07-29  7:56 ` [ruby-core:93982] [Ruby master " ko1
  5 siblings, 0 replies; 6+ messages in thread
From: eregontp @ 2019-06-05 20:19 UTC (permalink / raw)
  To: ruby-core

Issue #15558 has been updated by Eregon (Benoit Daloze).

Assignee set to Eregon (Benoit Daloze)

----------------------------------------
Bug #15558: Should Exception#exception copy the backtrace?
https://bugs.ruby-lang.org/issues/15558#change-78366

* Author: Eregon (Benoit Daloze)
* Status: Open
* Priority: Normal
* Assignee: Eregon (Benoit Daloze)
* Target version: 
* ruby -v: ruby 2.6.0p0 (2018-12-25 revision 66547) [x86_64-linux]
* Backport: 2.4: UNKNOWN, 2.5: UNKNOWN, 2.6: UNKNOWN
----------------------------------------
Currently it does not on MRI:
```
ruby -e 'begin raise "foo"; rescue => e; c=e.exception "bar"; p c.backtrace; end'
nil
```

But it does on JRuby 9.2.5.0 and TruffleRuby 1.0.0-rc11:
```
truffleruby -e 'begin raise "foo"; rescue => e; c=e.exception "bar"; p e.backtrace; end'
["-e:1:in `<main>'"]
```

This means in some cases, code needs about this difference such as in
https://github.com/asciidoctor/asciidoctor/blob/41da20a47a8da96966ef3ec1c2f509e07e7920e3/lib/asciidoctor.rb#L1322-L1338
More context in:
https://github.com/oracle/truffleruby/issues/1542#issuecomment-456850066



-- 
https://bugs.ruby-lang.org/

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [ruby-core:93982] [Ruby master Bug#15558] Should Exception#exception copy the backtrace?
       [not found] <redmine.issue-15558.20190123161849@ruby-lang.org>
                   ` (4 preceding siblings ...)
  2019-06-05 20:19 ` [ruby-core:92988] " eregontp
@ 2019-07-29  7:56 ` ko1
  5 siblings, 0 replies; 6+ messages in thread
From: ko1 @ 2019-07-29  7:56 UTC (permalink / raw)
  To: ruby-core

Issue #15558 has been updated by ko1 (Koichi Sasada).


I'm not sure the intention, but


Japanese document shows how to use it:

```
# http://rurema.clear-code.com/2.6.0/method/Exception/i/exception.html
begin
 ...        # do something
rescue => e
 raise e.exception("an error occurs during hogehoge process")  # detailed message
end
```

If this method is intended to be raised immediately, the empty backtrace is reasonable.

----------------------------------------
Bug #15558: Should Exception#exception copy the backtrace?
https://bugs.ruby-lang.org/issues/15558#change-80175

* Author: Eregon (Benoit Daloze)
* Status: Open
* Priority: Normal
* Assignee: Eregon (Benoit Daloze)
* Target version: 
* ruby -v: ruby 2.6.0p0 (2018-12-25 revision 66547) [x86_64-linux]
* Backport: 2.4: UNKNOWN, 2.5: UNKNOWN, 2.6: UNKNOWN
----------------------------------------
Currently it does not on MRI:
```
ruby -e 'begin raise "foo"; rescue => e; c=e.exception "bar"; p c.backtrace; end'
nil
```

But it does on JRuby 9.2.5.0 and TruffleRuby 1.0.0-rc11:
```
truffleruby -e 'begin raise "foo"; rescue => e; c=e.exception "bar"; p e.backtrace; end'
["-e:1:in `<main>'"]
```

This means in some cases, code needs about this difference such as in
https://github.com/asciidoctor/asciidoctor/blob/41da20a47a8da96966ef3ec1c2f509e07e7920e3/lib/asciidoctor.rb#L1322-L1338
More context in:
https://github.com/oracle/truffleruby/issues/1542#issuecomment-456850066



-- 
https://bugs.ruby-lang.org/

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2019-07-29  7:56 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <redmine.issue-15558.20190123161849@ruby-lang.org>
2019-01-23 16:18 ` [ruby-core:91232] [Ruby trunk Bug#15558] Should Exception#exception copy the backtrace? eregontp
2019-03-22 22:41 ` [ruby-core:91951] " eregontp
2019-03-23 21:43 ` [ruby-core:91960] " eregontp
2019-06-04 12:20 ` [ruby-core:92955] " eregontp
2019-06-05 20:19 ` [ruby-core:92988] " eregontp
2019-07-29  7:56 ` [ruby-core:93982] [Ruby master " ko1

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).