[#82706] [Ruby trunk Bug#13851] getting "can't modify string; temporarily locked" on non-frozen instances — cardoso_tiago@...
Issue #13851 has been updated by chucke (Tiago Cardoso).
3 messages
2017/09/07
[#82853] [Ruby trunk Bug#13916] Race condition when sending a signal to a new fork — russell.davis@...
Issue #13916 has been reported by russelldavis (Russell Davis).
3 messages
2017/09/19
[#82892] [Ruby trunk Bug#13921] buffered read_nonblock doesn't work as expected using SSLSocket — cardoso_tiago@...
Issue #13921 has been updated by chucke (Tiago Cardoso).
3 messages
2017/09/20
[ruby-core:82637] [Ruby trunk Bug#13844] Toplevel returns should fire ensures
From:
eregontp@...
Date:
2017-09-03 09:12:14 UTC
List:
ruby-core #82637
Issue #13844 has been updated by Eregon (Benoit Daloze).
Agreed, ensure should run in all cases escaping the scope, even more so when it lexically encloses the top-level return.
----------------------------------------
Bug #13844: Toplevel returns should fire ensures
https://bugs.ruby-lang.org/issues/13844#change-66465
* Author: headius (Charles Nutter)
* Status: Closed
* Priority: Normal
* Assignee:
* Target version:
* ruby -v: 2.4.1
* Backport: 2.2: DONTNEED, 2.3: DONTNEED, 2.4: REQUIRED
----------------------------------------
In the following contexts, a return always fires the ensure that wraps it:
```
[] ~/projects/ruby $ ruby -e 'def foo; return; ensure; p :x; end; foo'
:x
[] ~/projects/ruby $ ruby -e 'def foo; 1.times { begin; return; ensure; p :x; end }; end; foo'
:x
```
However the new 2.4 support for toplevel returns does *not* fire ensures:
```
$ ruby -e 'begin; return; ensure; p :x; end'
<no output>
```
I believe this is inconsistent with how returns work everywhere else (both valid and invalid returns always fire ensure) and it should be changed to match.
--
https://bugs.ruby-lang.org/
Unsubscribe: <mailto:ruby-core-request@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>