[#83096] File.setuid? on IO (Re: [ruby-cvs:67289] normal:r60108 (trunk): file.c: release GVL in File.{setuid?, setgid?, sticky?}) — Nobuyoshi Nakada <nobu@...>
On 2017/10/04 8:47, normal@ruby-lang.org wrote:
5 messages
2017/10/04
[#83100] Re: File.setuid? on IO (Re: [ruby-cvs:67289] normal:r60108 (trunk): file.c: release GVL in File.{setuid?, setgid?, sticky?})
— Eric Wong <normalperson@...>
2017/10/04
Nobuyoshi Nakada <nobu@ruby-lang.org> wrote:
[#83105] Re: File.setuid? on IO (Re: [ruby-cvs:67289] normal:r60108 (trunk): file.c: release GVL in File.{setuid?, setgid?, sticky?})
— Nobuyoshi Nakada <nobu@...>
2017/10/04
On 2017/10/04 15:55, Eric Wong wrote:
[#83107] Alias Enumerable#include? to Enumerable#includes? — Alberto Almagro <albertoalmagro@...>
Hello,
9 messages
2017/10/04
[#83113] Re: Alias Enumerable#include? to Enumerable#includes?
— "Urabe, Shyouhei" <shyouhei@...>
2017/10/05
This has been requested countless times, then rejected each and every time.
[#83129] Re: Alias Enumerable#include? to Enumerable#includes?
— Alberto Almagro <albertoalmagro@...>
2017/10/05
Sorry I didn't found it on the core mail list's archive.
[#83138] Re: Alias Enumerable#include? to Enumerable#includes?
— "Urabe, Shyouhei" <shyouhei@...>
2017/10/06
Ruby has not been made of popular votes so far. You have to show us
[#83149] Re: Alias Enumerable#include? to Enumerable#includes?
— Eric Wong <normalperson@...>
2017/10/06
Alberto Almagro <albertoalmagro@gmail.com> wrote:
[#83200] [Ruby trunk Feature#13996] [PATCH] file.c: apply2files releases GVL — normalperson@...
Issue #13996 has been reported by normalperson (Eric Wong).
4 messages
2017/10/10
[ruby-core:83541] [Ruby trunk Bug#14048] Enumerable#sum sometimes assumes objects are `Range`s when they're not
From:
rohitpaulk@...
Date:
2017-10-24 12:02:54 UTC
List:
ruby-core #83541
Issue #14048 has been reported by rohitpaulk (Paul Kuruvilla).
----------------------------------------
Bug #14048: Enumerable#sum sometimes assumes objects are `Range`s when they're not
https://bugs.ruby-lang.org/issues/14048
* Author: rohitpaulk (Paul Kuruvilla)
* Status: Open
* Priority: Normal
* Assignee:
* Target version:
* ruby -v: ruby 2.4.2p198 (2017-09-14 revision 59899) [x86_64-darwin16]
* Backport: 2.3: UNKNOWN, 2.4: UNKNOWN
----------------------------------------
If a class defines the methods `begin` and `end`, Enumerable assumes that it is a `Range` object and tries to access the `exclude_end?` method.
~~~ruby
class NotARange
include Enumerable # Defines the `#sum` method
def each
yield 2
yield 4
yield 6
end
def begin; end
def end; end
end
not_a_range = NotARange.new
puts not_a_range.sum
~~~
The above program throws an error:
~~~
main.rb:20:in `sum': undefined method `exclude_end?' for #<NotARange:0x00007f8750950c70> (NoMethodError)
~~~
If either `begin` or `end` are not defined though, it works fine and returns `12`.
It looks like the commit that introduced this was: https://github.com/ruby/ruby/commit/53b4c2b87a9c6832e663cf5773a8aca9a1cf3341
I think that `Enumerable` should only attempt to perform the optimization on objects that are indeed `Range` or subclasses of `Range`.
--
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>