ruby-core@ruby-lang.org archive (unofficial mirror)
 help / color / mirror / Atom feed
* [ruby-core:120619] [Ruby master Bug#21030] Bug: #step with Range<ActiveSupport::Duration> behavior broken on Ruby 3.4.1
@ 2025-01-12  5:59 johnnyshields (Johnny Shields) via ruby-core
  2025-01-12  8:21 ` [ruby-core:120622] " zverok (Victor Shepelev) via ruby-core
                   ` (9 more replies)
  0 siblings, 10 replies; 11+ messages in thread
From: johnnyshields (Johnny Shields) via ruby-core @ 2025-01-12  5:59 UTC (permalink / raw)
  To: ruby-core; +Cc: johnnyshields (Johnny Shields)

Issue #21030 has been reported by johnnyshields (Johnny Shields).

----------------------------------------
Bug #21030: Bug: #step with Range<ActiveSupport::Duration> behavior broken on Ruby 3.4.1
https://bugs.ruby-lang.org/issues/21030

* Author: johnnyshields (Johnny Shields)
* Status: Open
* Backport: 3.1: UNKNOWN, 3.2: UNKNOWN, 3.3: UNKNOWN, 3.4: UNKNOWN
----------------------------------------
Issue also filed at: https://github.com/rails/rails/issues/54199

### System configuration
**Rails version**: 7.1.5.1
**Ruby version**: 3.3.4 (works) vs 3.4.1 (broken)

### What's broken

Calling `#step` then `#to_a` on a `Range` whose beginning/end values are the same is expected to return an `Array` wrapping the `Range`'s singular value. In other words, `(x..x).step(n).to_a` should return `[x]` -- note this is also the same as `(x..x).to_a`

The following case breaks on Ruby 3.4.1 related to `ActiveSupport::Duration` class, where it returns an empty array. It works on Ruby 3.3. Both tested with Rails 7.1.5.1. It's very easy to reproduce.

I'm unsure if this is a Ruby bug or a Rails bug so I'm filing it in both places. The upgrade of Ruby is what produces the difference.

```ruby
require 'active_support/all' # version 7.1.5.1

int = 100
dur = 100.seconds # ActiveSupport/Duration

# The bug

(dur..dur).step(10).to_a  # => Ruby 3.3 returns [100 seconds] - CORRECT
                          # => Ruby 3.4 returns [] - INCORRECT

(int..dur).step(10).to_a  # => Ruby 3.3 returns [100] - CORRECT
                          # => Ruby 3.4 returns [] - INCORRECT

# Note the following cases work correctly on both Ruby versions:
(int..int).step(10).to_a  #=> [100]
(int..dur).to_a           #=> [100]

# Range with non-equivalent values also works fine on different versions:
dur2 = 120.seconds
(dur..dur2).step(10).to_a  #=> [100 seconds, 110 seconds, 120 seconds]
(int..dur2).step(10).to_a  #=> [100, 110, 120]
```



-- 
https://bugs.ruby-lang.org/
 ______________________________________________
 ruby-core mailing list -- ruby-core@ml.ruby-lang.org
 To unsubscribe send an email to ruby-core-leave@ml.ruby-lang.org
 ruby-core info -- https://ml.ruby-lang.org/mailman3/lists/ruby-core.ml.ruby-lang.org/

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

* [ruby-core:120622] [Ruby master Bug#21030] Bug: #step with Range<ActiveSupport::Duration> behavior broken on Ruby 3.4.1
  2025-01-12  5:59 [ruby-core:120619] [Ruby master Bug#21030] Bug: #step with Range<ActiveSupport::Duration> behavior broken on Ruby 3.4.1 johnnyshields (Johnny Shields) via ruby-core
@ 2025-01-12  8:21 ` zverok (Victor Shepelev) via ruby-core
  2025-01-12  8:23 ` [ruby-core:120623] " zverok (Victor Shepelev) via ruby-core
                   ` (8 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: zverok (Victor Shepelev) via ruby-core @ 2025-01-12  8:21 UTC (permalink / raw)
  To: ruby-core; +Cc: zverok (Victor Shepelev)

Issue #21030 has been updated by zverok (Victor Shepelev).

Assignee set to zverok (Victor Shepelev)
Backport changed from 3.1: UNKNOWN, 3.2: UNKNOWN, 3.3: UNKNOWN, 3.4: UNKNOWN to 3.1: DONTNEED, 3.2: DONTNEED, 3.3: DONTNEED, 3.4: UNKNOWN

----------------------------------------
Bug #21030: Bug: #step with Range<ActiveSupport::Duration> behavior broken on Ruby 3.4.1
https://bugs.ruby-lang.org/issues/21030#change-111451

* Author: johnnyshields (Johnny Shields)
* Status: Open
* Assignee: zverok (Victor Shepelev)
* Backport: 3.1: DONTNEED, 3.2: DONTNEED, 3.3: DONTNEED, 3.4: UNKNOWN
----------------------------------------
Issue also filed at: https://github.com/rails/rails/issues/54199

### System configuration
**Rails version**: 7.1.5.1
**Ruby version**: 3.3.4 (works) vs 3.4.1 (broken)

### What's broken

Calling `#step` then `#to_a` on a `Range` whose beginning/end values are the same is expected to return an `Array` wrapping the `Range`'s singular value. In other words, `(x..x).step(n).to_a` should return `[x]` -- note this is also the same as `(x..x).to_a`

The following case breaks on Ruby 3.4.1 related to `ActiveSupport::Duration` class, where it returns an empty array. It works on Ruby 3.3. Both tested with Rails 7.1.5.1. It's very easy to reproduce.

I'm unsure if this is a Ruby bug or a Rails bug so I'm filing it in both places. The upgrade of Ruby is what produces the difference.

```ruby
require 'active_support/all' # version 7.1.5.1

int = 100
dur = 100.seconds # ActiveSupport/Duration

# The bug

(dur..dur).step(10).to_a  # => Ruby 3.3 returns [100 seconds] - CORRECT
                          # => Ruby 3.4 returns [] - INCORRECT

(int..dur).step(10).to_a  # => Ruby 3.3 returns [100] - CORRECT
                          # => Ruby 3.4 returns [] - INCORRECT

# Note the following cases work correctly on both Ruby versions:
(int..int).step(10).to_a  #=> [100]
(int..dur).to_a           #=> [100]

# Range with non-equivalent values also works fine on different versions:
dur2 = 120.seconds
(dur..dur2).step(10).to_a  #=> [100 seconds, 110 seconds, 120 seconds]
(int..dur2).step(10).to_a  #=> [100, 110, 120]
```



-- 
https://bugs.ruby-lang.org/
 ______________________________________________
 ruby-core mailing list -- ruby-core@ml.ruby-lang.org
 To unsubscribe send an email to ruby-core-leave@ml.ruby-lang.org
 ruby-core info -- https://ml.ruby-lang.org/mailman3/lists/ruby-core.ml.ruby-lang.org/

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

* [ruby-core:120623] [Ruby master Bug#21030] Bug: #step with Range<ActiveSupport::Duration> behavior broken on Ruby 3.4.1
  2025-01-12  5:59 [ruby-core:120619] [Ruby master Bug#21030] Bug: #step with Range<ActiveSupport::Duration> behavior broken on Ruby 3.4.1 johnnyshields (Johnny Shields) via ruby-core
  2025-01-12  8:21 ` [ruby-core:120622] " zverok (Victor Shepelev) via ruby-core
@ 2025-01-12  8:23 ` zverok (Victor Shepelev) via ruby-core
  2025-01-12 23:15 ` [ruby-core:120625] " johnnyshields (Johnny Shields) via ruby-core
                   ` (7 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: zverok (Victor Shepelev) via ruby-core @ 2025-01-12  8:23 UTC (permalink / raw)
  To: ruby-core; +Cc: zverok (Victor Shepelev)

Issue #21030 has been updated by zverok (Victor Shepelev).


Confirmed, looking into it.

----------------------------------------
Bug #21030: Bug: #step with Range<ActiveSupport::Duration> behavior broken on Ruby 3.4.1
https://bugs.ruby-lang.org/issues/21030#change-111452

* Author: johnnyshields (Johnny Shields)
* Status: Open
* Assignee: zverok (Victor Shepelev)
* Backport: 3.1: DONTNEED, 3.2: DONTNEED, 3.3: DONTNEED, 3.4: UNKNOWN
----------------------------------------
Issue also filed at: https://github.com/rails/rails/issues/54199

### System configuration
**Rails version**: 7.1.5.1
**Ruby version**: 3.3.4 (works) vs 3.4.1 (broken)

### What's broken

Calling `#step` then `#to_a` on a `Range` whose beginning/end values are the same is expected to return an `Array` wrapping the `Range`'s singular value. In other words, `(x..x).step(n).to_a` should return `[x]` -- note this is also the same as `(x..x).to_a`

The following case breaks on Ruby 3.4.1 related to `ActiveSupport::Duration` class, where it returns an empty array. It works on Ruby 3.3. Both tested with Rails 7.1.5.1. It's very easy to reproduce.

I'm unsure if this is a Ruby bug or a Rails bug so I'm filing it in both places. The upgrade of Ruby is what produces the difference.

```ruby
require 'active_support/all' # version 7.1.5.1

int = 100
dur = 100.seconds # ActiveSupport/Duration

# The bug

(dur..dur).step(10).to_a  # => Ruby 3.3 returns [100 seconds] - CORRECT
                          # => Ruby 3.4 returns [] - INCORRECT

(int..dur).step(10).to_a  # => Ruby 3.3 returns [100] - CORRECT
                          # => Ruby 3.4 returns [] - INCORRECT

# Note the following cases work correctly on both Ruby versions:
(int..int).step(10).to_a  #=> [100]
(int..dur).to_a           #=> [100]

# Range with non-equivalent values also works fine on different versions:
dur2 = 120.seconds
(dur..dur2).step(10).to_a  #=> [100 seconds, 110 seconds, 120 seconds]
(int..dur2).step(10).to_a  #=> [100, 110, 120]
```



-- 
https://bugs.ruby-lang.org/
 ______________________________________________
 ruby-core mailing list -- ruby-core@ml.ruby-lang.org
 To unsubscribe send an email to ruby-core-leave@ml.ruby-lang.org
 ruby-core info -- https://ml.ruby-lang.org/mailman3/lists/ruby-core.ml.ruby-lang.org/

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

* [ruby-core:120625] [Ruby master Bug#21030] Bug: #step with Range<ActiveSupport::Duration> behavior broken on Ruby 3.4.1
  2025-01-12  5:59 [ruby-core:120619] [Ruby master Bug#21030] Bug: #step with Range<ActiveSupport::Duration> behavior broken on Ruby 3.4.1 johnnyshields (Johnny Shields) via ruby-core
  2025-01-12  8:21 ` [ruby-core:120622] " zverok (Victor Shepelev) via ruby-core
  2025-01-12  8:23 ` [ruby-core:120623] " zverok (Victor Shepelev) via ruby-core
@ 2025-01-12 23:15 ` johnnyshields (Johnny Shields) via ruby-core
  2025-01-13  1:22 ` [ruby-core:120626] " nobu (Nobuyoshi Nakada) via ruby-core
                   ` (6 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: johnnyshields (Johnny Shields) via ruby-core @ 2025-01-12 23:15 UTC (permalink / raw)
  To: ruby-core; +Cc: johnnyshields (Johnny Shields)

Issue #21030 has been updated by johnnyshields (Johnny Shields).


May I confirm this will be patched in Ruby 3.4.2?

----------------------------------------
Bug #21030: Bug: #step with Range<ActiveSupport::Duration> behavior broken on Ruby 3.4.1
https://bugs.ruby-lang.org/issues/21030#change-111455

* Author: johnnyshields (Johnny Shields)
* Status: Closed
* Assignee: zverok (Victor Shepelev)
* Backport: 3.1: DONTNEED, 3.2: DONTNEED, 3.3: DONTNEED, 3.4: UNKNOWN
----------------------------------------
Issue also filed at: https://github.com/rails/rails/issues/54199

### System configuration
**Rails version**: 7.1.5.1
**Ruby version**: 3.3.4 (works) vs 3.4.1 (broken)

### What's broken

Calling `#step` then `#to_a` on a `Range` whose beginning/end values are the same is expected to return an `Array` wrapping the `Range`'s singular value. In other words, `(x..x).step(n).to_a` should return `[x]` -- note this is also the same as `(x..x).to_a`

The following case breaks on Ruby 3.4.1 related to `ActiveSupport::Duration` class, where it returns an empty array. It works on Ruby 3.3. Both tested with Rails 7.1.5.1. It's very easy to reproduce.

I'm unsure if this is a Ruby bug or a Rails bug so I'm filing it in both places. The upgrade of Ruby is what produces the difference.

```ruby
require 'active_support/all' # version 7.1.5.1

int = 100
dur = 100.seconds # ActiveSupport/Duration

# The bug

(dur..dur).step(10).to_a  # => Ruby 3.3 returns [100 seconds] - CORRECT
                          # => Ruby 3.4 returns [] - INCORRECT

(int..dur).step(10).to_a  # => Ruby 3.3 returns [100] - CORRECT
                          # => Ruby 3.4 returns [] - INCORRECT

# Note the following cases work correctly on both Ruby versions:
(int..int).step(10).to_a  #=> [100]
(int..dur).to_a           #=> [100]

# Range with non-equivalent values also works fine on different versions:
dur2 = 120.seconds
(dur..dur2).step(10).to_a  #=> [100 seconds, 110 seconds, 120 seconds]
(int..dur2).step(10).to_a  #=> [100, 110, 120]
```



-- 
https://bugs.ruby-lang.org/
 ______________________________________________
 ruby-core mailing list -- ruby-core@ml.ruby-lang.org
 To unsubscribe send an email to ruby-core-leave@ml.ruby-lang.org
 ruby-core info -- https://ml.ruby-lang.org/mailman3/lists/ruby-core.ml.ruby-lang.org/

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

* [ruby-core:120626] [Ruby master Bug#21030] Bug: #step with Range<ActiveSupport::Duration> behavior broken on Ruby 3.4.1
  2025-01-12  5:59 [ruby-core:120619] [Ruby master Bug#21030] Bug: #step with Range<ActiveSupport::Duration> behavior broken on Ruby 3.4.1 johnnyshields (Johnny Shields) via ruby-core
                   ` (2 preceding siblings ...)
  2025-01-12 23:15 ` [ruby-core:120625] " johnnyshields (Johnny Shields) via ruby-core
@ 2025-01-13  1:22 ` nobu (Nobuyoshi Nakada) via ruby-core
  2025-02-11  5:26 ` [ruby-core:120936] " johnnyshields (Johnny Shields) via ruby-core
                   ` (5 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: nobu (Nobuyoshi Nakada) via ruby-core @ 2025-01-13  1:22 UTC (permalink / raw)
  To: ruby-core; +Cc: nobu (Nobuyoshi Nakada)

Issue #21030 has been updated by nobu (Nobuyoshi Nakada).


3.4.2 is not scheduled yet.

----------------------------------------
Bug #21030: Bug: #step with Range<ActiveSupport::Duration> behavior broken on Ruby 3.4.1
https://bugs.ruby-lang.org/issues/21030#change-111456

* Author: johnnyshields (Johnny Shields)
* Status: Closed
* Assignee: zverok (Victor Shepelev)
* Backport: 3.1: DONTNEED, 3.2: DONTNEED, 3.3: DONTNEED, 3.4: UNKNOWN
----------------------------------------
Issue also filed at: https://github.com/rails/rails/issues/54199

### System configuration
**Rails version**: 7.1.5.1
**Ruby version**: 3.3.4 (works) vs 3.4.1 (broken)

### What's broken

Calling `#step` then `#to_a` on a `Range` whose beginning/end values are the same is expected to return an `Array` wrapping the `Range`'s singular value. In other words, `(x..x).step(n).to_a` should return `[x]` -- note this is also the same as `(x..x).to_a`

The following case breaks on Ruby 3.4.1 related to `ActiveSupport::Duration` class, where it returns an empty array. It works on Ruby 3.3. Both tested with Rails 7.1.5.1. It's very easy to reproduce.

I'm unsure if this is a Ruby bug or a Rails bug so I'm filing it in both places. The upgrade of Ruby is what produces the difference.

```ruby
require 'active_support/all' # version 7.1.5.1

int = 100
dur = 100.seconds # ActiveSupport/Duration

# The bug

(dur..dur).step(10).to_a  # => Ruby 3.3 returns [100 seconds] - CORRECT
                          # => Ruby 3.4 returns [] - INCORRECT

(int..dur).step(10).to_a  # => Ruby 3.3 returns [100] - CORRECT
                          # => Ruby 3.4 returns [] - INCORRECT

# Note the following cases work correctly on both Ruby versions:
(int..int).step(10).to_a  #=> [100]
(int..dur).to_a           #=> [100]

# Range with non-equivalent values also works fine on different versions:
dur2 = 120.seconds
(dur..dur2).step(10).to_a  #=> [100 seconds, 110 seconds, 120 seconds]
(int..dur2).step(10).to_a  #=> [100, 110, 120]
```



-- 
https://bugs.ruby-lang.org/
 ______________________________________________
 ruby-core mailing list -- ruby-core@ml.ruby-lang.org
 To unsubscribe send an email to ruby-core-leave@ml.ruby-lang.org
 ruby-core info -- https://ml.ruby-lang.org/mailman3/lists/ruby-core.ml.ruby-lang.org/

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

* [ruby-core:120936] [Ruby master Bug#21030] Bug: #step with Range<ActiveSupport::Duration> behavior broken on Ruby 3.4.1
  2025-01-12  5:59 [ruby-core:120619] [Ruby master Bug#21030] Bug: #step with Range<ActiveSupport::Duration> behavior broken on Ruby 3.4.1 johnnyshields (Johnny Shields) via ruby-core
                   ` (3 preceding siblings ...)
  2025-01-13  1:22 ` [ruby-core:120626] " nobu (Nobuyoshi Nakada) via ruby-core
@ 2025-02-11  5:26 ` johnnyshields (Johnny Shields) via ruby-core
  2025-02-20 19:26 ` [ruby-core:121135] " jamesst20 (James St-Pierre) via ruby-core
                   ` (4 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: johnnyshields (Johnny Shields) via ruby-core @ 2025-02-11  5:26 UTC (permalink / raw)
  To: ruby-core; +Cc: johnnyshields (Johnny Shields)

Issue #21030 has been updated by johnnyshields (Johnny Shields).


May we mark this as 3.4 backport? I'm hesitant to upgrade my app to 3.4 without this fix.

----------------------------------------
Bug #21030: Bug: #step with Range<ActiveSupport::Duration> behavior broken on Ruby 3.4.1
https://bugs.ruby-lang.org/issues/21030#change-111827

* Author: johnnyshields (Johnny Shields)
* Status: Closed
* Assignee: zverok (Victor Shepelev)
* Backport: 3.1: DONTNEED, 3.2: DONTNEED, 3.3: DONTNEED, 3.4: UNKNOWN
----------------------------------------
Issue also filed at: https://github.com/rails/rails/issues/54199

### System configuration
**Rails version**: 7.1.5.1
**Ruby version**: 3.3.4 (works) vs 3.4.1 (broken)

### What's broken

Calling `#step` then `#to_a` on a `Range` whose beginning/end values are the same is expected to return an `Array` wrapping the `Range`'s singular value. In other words, `(x..x).step(n).to_a` should return `[x]` -- note this is also the same as `(x..x).to_a`

The following case breaks on Ruby 3.4.1 related to `ActiveSupport::Duration` class, where it returns an empty array. It works on Ruby 3.3. Both tested with Rails 7.1.5.1. It's very easy to reproduce.

I'm unsure if this is a Ruby bug or a Rails bug so I'm filing it in both places. The upgrade of Ruby is what produces the difference.

```ruby
require 'active_support/all' # version 7.1.5.1

int = 100
dur = 100.seconds # ActiveSupport/Duration

# The bug

(dur..dur).step(10).to_a  # => Ruby 3.3 returns [100 seconds] - CORRECT
                          # => Ruby 3.4 returns [] - INCORRECT

(int..dur).step(10).to_a  # => Ruby 3.3 returns [100] - CORRECT
                          # => Ruby 3.4 returns [] - INCORRECT

# Note the following cases work correctly on both Ruby versions:
(int..int).step(10).to_a  #=> [100]
(int..dur).to_a           #=> [100]

# Range with non-equivalent values also works fine on different versions:
dur2 = 120.seconds
(dur..dur2).step(10).to_a  #=> [100 seconds, 110 seconds, 120 seconds]
(int..dur2).step(10).to_a  #=> [100, 110, 120]
```



-- 
https://bugs.ruby-lang.org/
 ______________________________________________
 ruby-core mailing list -- ruby-core@ml.ruby-lang.org
 To unsubscribe send an email to ruby-core-leave@ml.ruby-lang.org
 ruby-core info -- https://ml.ruby-lang.org/mailman3/lists/ruby-core.ml.ruby-lang.org/

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

* [ruby-core:121135] [Ruby master Bug#21030] Bug: #step with Range<ActiveSupport::Duration> behavior broken on Ruby 3.4.1
  2025-01-12  5:59 [ruby-core:120619] [Ruby master Bug#21030] Bug: #step with Range<ActiveSupport::Duration> behavior broken on Ruby 3.4.1 johnnyshields (Johnny Shields) via ruby-core
                   ` (4 preceding siblings ...)
  2025-02-11  5:26 ` [ruby-core:120936] " johnnyshields (Johnny Shields) via ruby-core
@ 2025-02-20 19:26 ` jamesst20 (James St-Pierre) via ruby-core
  2025-03-03 23:06 ` [ruby-core:121227] " k0kubun (Takashi Kokubun) via ruby-core
                   ` (3 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: jamesst20 (James St-Pierre) via ruby-core @ 2025-02-20 19:26 UTC (permalink / raw)
  To: ruby-core; +Cc: jamesst20 (James St-Pierre)

Issue #21030 has been updated by jamesst20 (James St-Pierre).


According to the changelogs for v3.4.2, this wasn't included?

https://github.com/ruby/ruby/releases/tag/v3_4_2

----------------------------------------
Bug #21030: Bug: #step with Range<ActiveSupport::Duration> behavior broken on Ruby 3.4.1
https://bugs.ruby-lang.org/issues/21030#change-112065

* Author: johnnyshields (Johnny Shields)
* Status: Closed
* Assignee: zverok (Victor Shepelev)
* Backport: 3.1: DONTNEED, 3.2: DONTNEED, 3.3: DONTNEED, 3.4: UNKNOWN
----------------------------------------
Issue also filed at: https://github.com/rails/rails/issues/54199

### System configuration
**Rails version**: 7.1.5.1
**Ruby version**: 3.3.4 (works) vs 3.4.1 (broken)

### What's broken

Calling `#step` then `#to_a` on a `Range` whose beginning/end values are the same is expected to return an `Array` wrapping the `Range`'s singular value. In other words, `(x..x).step(n).to_a` should return `[x]` -- note this is also the same as `(x..x).to_a`

The following case breaks on Ruby 3.4.1 related to `ActiveSupport::Duration` class, where it returns an empty array. It works on Ruby 3.3. Both tested with Rails 7.1.5.1. It's very easy to reproduce.

I'm unsure if this is a Ruby bug or a Rails bug so I'm filing it in both places. The upgrade of Ruby is what produces the difference.

```ruby
require 'active_support/all' # version 7.1.5.1

int = 100
dur = 100.seconds # ActiveSupport/Duration

# The bug

(dur..dur).step(10).to_a  # => Ruby 3.3 returns [100 seconds] - CORRECT
                          # => Ruby 3.4 returns [] - INCORRECT

(int..dur).step(10).to_a  # => Ruby 3.3 returns [100] - CORRECT
                          # => Ruby 3.4 returns [] - INCORRECT

# Note the following cases work correctly on both Ruby versions:
(int..int).step(10).to_a  #=> [100]
(int..dur).to_a           #=> [100]

# Range with non-equivalent values also works fine on different versions:
dur2 = 120.seconds
(dur..dur2).step(10).to_a  #=> [100 seconds, 110 seconds, 120 seconds]
(int..dur2).step(10).to_a  #=> [100, 110, 120]
```



-- 
https://bugs.ruby-lang.org/
 ______________________________________________
 ruby-core mailing list -- ruby-core@ml.ruby-lang.org
 To unsubscribe send an email to ruby-core-leave@ml.ruby-lang.org
 ruby-core info -- https://ml.ruby-lang.org/mailman3/lists/ruby-core.ml.ruby-lang.org/

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

* [ruby-core:121227] [Ruby master Bug#21030] Bug: #step with Range<ActiveSupport::Duration> behavior broken on Ruby 3.4.1
  2025-01-12  5:59 [ruby-core:120619] [Ruby master Bug#21030] Bug: #step with Range<ActiveSupport::Duration> behavior broken on Ruby 3.4.1 johnnyshields (Johnny Shields) via ruby-core
                   ` (5 preceding siblings ...)
  2025-02-20 19:26 ` [ruby-core:121135] " jamesst20 (James St-Pierre) via ruby-core
@ 2025-03-03 23:06 ` k0kubun (Takashi Kokubun) via ruby-core
  2025-05-05 18:44 ` [ruby-core:121831] [Ruby " jamesst20 (James St-Pierre) via ruby-core
                   ` (2 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: k0kubun (Takashi Kokubun) via ruby-core @ 2025-03-03 23:06 UTC (permalink / raw)
  To: ruby-core; +Cc: k0kubun (Takashi Kokubun)

Issue #21030 has been updated by k0kubun (Takashi Kokubun).

Backport changed from 3.1: DONTNEED, 3.2: DONTNEED, 3.3: DONTNEED, 3.4: REQUIRED to 3.1: DONTNEED, 3.2: DONTNEED, 3.3: DONTNEED, 3.4: DONE

ruby_3_4 commit:6d2c7d4304bbf8450d31b624f5dc40a92e44f00b.

----------------------------------------
Bug #21030: Bug: #step with Range<ActiveSupport::Duration> behavior broken on Ruby 3.4.1
https://bugs.ruby-lang.org/issues/21030#change-112174

* Author: johnnyshields (Johnny Shields)
* Status: Closed
* Assignee: zverok (Victor Shepelev)
* Backport: 3.1: DONTNEED, 3.2: DONTNEED, 3.3: DONTNEED, 3.4: DONE
----------------------------------------
Issue also filed at: https://github.com/rails/rails/issues/54199

### System configuration
**Rails version**: 7.1.5.1
**Ruby version**: 3.3.4 (works) vs 3.4.1 (broken)

### What's broken

Calling `#step` then `#to_a` on a `Range` whose beginning/end values are the same is expected to return an `Array` wrapping the `Range`'s singular value. In other words, `(x..x).step(n).to_a` should return `[x]` -- note this is also the same as `(x..x).to_a`

The following case breaks on Ruby 3.4.1 related to `ActiveSupport::Duration` class, where it returns an empty array. It works on Ruby 3.3. Both tested with Rails 7.1.5.1. It's very easy to reproduce.

I'm unsure if this is a Ruby bug or a Rails bug so I'm filing it in both places. The upgrade of Ruby is what produces the difference.

```ruby
require 'active_support/all' # version 7.1.5.1

int = 100
dur = 100.seconds # ActiveSupport/Duration

# The bug

(dur..dur).step(10).to_a  # => Ruby 3.3 returns [100 seconds] - CORRECT
                          # => Ruby 3.4 returns [] - INCORRECT

(int..dur).step(10).to_a  # => Ruby 3.3 returns [100] - CORRECT
                          # => Ruby 3.4 returns [] - INCORRECT

# Note the following cases work correctly on both Ruby versions:
(int..int).step(10).to_a  #=> [100]
(int..dur).to_a           #=> [100]

# Range with non-equivalent values also works fine on different versions:
dur2 = 120.seconds
(dur..dur2).step(10).to_a  #=> [100 seconds, 110 seconds, 120 seconds]
(int..dur2).step(10).to_a  #=> [100, 110, 120]
```



-- 
https://bugs.ruby-lang.org/
 ______________________________________________
 ruby-core mailing list -- ruby-core@ml.ruby-lang.org
 To unsubscribe send an email to ruby-core-leave@ml.ruby-lang.org
 ruby-core info -- https://ml.ruby-lang.org/mailman3/lists/ruby-core.ml.ruby-lang.org/

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

* [ruby-core:121831] [Ruby Bug#21030] Bug: #step with Range<ActiveSupport::Duration> behavior broken on Ruby 3.4.1
  2025-01-12  5:59 [ruby-core:120619] [Ruby master Bug#21030] Bug: #step with Range<ActiveSupport::Duration> behavior broken on Ruby 3.4.1 johnnyshields (Johnny Shields) via ruby-core
                   ` (6 preceding siblings ...)
  2025-03-03 23:06 ` [ruby-core:121227] " k0kubun (Takashi Kokubun) via ruby-core
@ 2025-05-05 18:44 ` jamesst20 (James St-Pierre) via ruby-core
  2025-05-05 20:09 ` [ruby-core:121833] " Eregon (Benoit Daloze) via ruby-core
  2025-05-05 21:26 ` [ruby-core:121834] " johnnyshields (Johnny Shields) via ruby-core
  9 siblings, 0 replies; 11+ messages in thread
From: jamesst20 (James St-Pierre) via ruby-core @ 2025-05-05 18:44 UTC (permalink / raw)
  To: ruby-core; +Cc: jamesst20 (James St-Pierre)

Issue #21030 has been updated by jamesst20 (James St-Pierre).


jamesst20 (James St-Pierre) wrote in #note-8:
> According to the changelogs for v3.4.2, this wasn't included?
> 
> https://github.com/ruby/ruby/releases/tag/v3_4_2

To add more details, this fix was also not included in v3.4.3.

The fix: https://github.com/ruby/ruby/commit/f56f3eaae55cc6f8d9e79862ee73a9ffb53d6077

It appears to be included in v3.5.0 Preview 1, this probably mean Ruby v3.4 will be a forever buggy version to avoid.

----------------------------------------
Bug #21030: Bug: #step with Range<ActiveSupport::Duration> behavior broken on Ruby 3.4.1
https://bugs.ruby-lang.org/issues/21030#change-112893

* Author: johnnyshields (Johnny Shields)
* Status: Closed
* Assignee: zverok (Victor Shepelev)
* Backport: 3.1: DONTNEED, 3.2: DONTNEED, 3.3: DONTNEED, 3.4: DONE
----------------------------------------
Issue also filed at: https://github.com/rails/rails/issues/54199

### System configuration
**Rails version**: 7.1.5.1
**Ruby version**: 3.3.4 (works) vs 3.4.1 (broken)

### What's broken

Calling `#step` then `#to_a` on a `Range` whose beginning/end values are the same is expected to return an `Array` wrapping the `Range`'s singular value. In other words, `(x..x).step(n).to_a` should return `[x]` -- note this is also the same as `(x..x).to_a`

The following case breaks on Ruby 3.4.1 related to `ActiveSupport::Duration` class, where it returns an empty array. It works on Ruby 3.3. Both tested with Rails 7.1.5.1. It's very easy to reproduce.

I'm unsure if this is a Ruby bug or a Rails bug so I'm filing it in both places. The upgrade of Ruby is what produces the difference.

```ruby
require 'active_support/all' # version 7.1.5.1

int = 100
dur = 100.seconds # ActiveSupport/Duration

# The bug

(dur..dur).step(10).to_a  # => Ruby 3.3 returns [100 seconds] - CORRECT
                          # => Ruby 3.4 returns [] - INCORRECT

(int..dur).step(10).to_a  # => Ruby 3.3 returns [100] - CORRECT
                          # => Ruby 3.4 returns [] - INCORRECT

# Note the following cases work correctly on both Ruby versions:
(int..int).step(10).to_a  #=> [100]
(int..dur).to_a           #=> [100]

# Range with non-equivalent values also works fine on different versions:
dur2 = 120.seconds
(dur..dur2).step(10).to_a  #=> [100 seconds, 110 seconds, 120 seconds]
(int..dur2).step(10).to_a  #=> [100, 110, 120]
```



-- 
https://bugs.ruby-lang.org/
 ______________________________________________
 ruby-core mailing list -- ruby-core@ml.ruby-lang.org
 To unsubscribe send an email to ruby-core-leave@ml.ruby-lang.org
 ruby-core info -- https://ml.ruby-lang.org/mailman3/lists/ruby-core.ml.ruby-lang.org/

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

* [ruby-core:121833] [Ruby Bug#21030] Bug: #step with Range<ActiveSupport::Duration> behavior broken on Ruby 3.4.1
  2025-01-12  5:59 [ruby-core:120619] [Ruby master Bug#21030] Bug: #step with Range<ActiveSupport::Duration> behavior broken on Ruby 3.4.1 johnnyshields (Johnny Shields) via ruby-core
                   ` (7 preceding siblings ...)
  2025-05-05 18:44 ` [ruby-core:121831] [Ruby " jamesst20 (James St-Pierre) via ruby-core
@ 2025-05-05 20:09 ` Eregon (Benoit Daloze) via ruby-core
  2025-05-05 21:26 ` [ruby-core:121834] " johnnyshields (Johnny Shields) via ruby-core
  9 siblings, 0 replies; 11+ messages in thread
From: Eregon (Benoit Daloze) via ruby-core @ 2025-05-05 20:09 UTC (permalink / raw)
  To: ruby-core; +Cc: Eregon (Benoit Daloze)

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


@jamesst20 https://github.com/ruby/ruby/commit/6d2c7d4304bbf8450d31b624f5dc40a92e44f00b is in 3.4.3 though.
And I don't see any revert in https://github.com/ruby/ruby/compare/v3_4_2...v3_4_3
Are you sure it's not fixed in 3.4.3?

----------------------------------------
Bug #21030: Bug: #step with Range<ActiveSupport::Duration> behavior broken on Ruby 3.4.1
https://bugs.ruby-lang.org/issues/21030#change-112895

* Author: johnnyshields (Johnny Shields)
* Status: Closed
* Assignee: zverok (Victor Shepelev)
* Backport: 3.1: DONTNEED, 3.2: DONTNEED, 3.3: DONTNEED, 3.4: DONE
----------------------------------------
Issue also filed at: https://github.com/rails/rails/issues/54199

### System configuration
**Rails version**: 7.1.5.1
**Ruby version**: 3.3.4 (works) vs 3.4.1 (broken)

### What's broken

Calling `#step` then `#to_a` on a `Range` whose beginning/end values are the same is expected to return an `Array` wrapping the `Range`'s singular value. In other words, `(x..x).step(n).to_a` should return `[x]` -- note this is also the same as `(x..x).to_a`

The following case breaks on Ruby 3.4.1 related to `ActiveSupport::Duration` class, where it returns an empty array. It works on Ruby 3.3. Both tested with Rails 7.1.5.1. It's very easy to reproduce.

I'm unsure if this is a Ruby bug or a Rails bug so I'm filing it in both places. The upgrade of Ruby is what produces the difference.

```ruby
require 'active_support/all' # version 7.1.5.1

int = 100
dur = 100.seconds # ActiveSupport/Duration

# The bug

(dur..dur).step(10).to_a  # => Ruby 3.3 returns [100 seconds] - CORRECT
                          # => Ruby 3.4 returns [] - INCORRECT

(int..dur).step(10).to_a  # => Ruby 3.3 returns [100] - CORRECT
                          # => Ruby 3.4 returns [] - INCORRECT

# Note the following cases work correctly on both Ruby versions:
(int..int).step(10).to_a  #=> [100]
(int..dur).to_a           #=> [100]

# Range with non-equivalent values also works fine on different versions:
dur2 = 120.seconds
(dur..dur2).step(10).to_a  #=> [100 seconds, 110 seconds, 120 seconds]
(int..dur2).step(10).to_a  #=> [100, 110, 120]
```



-- 
https://bugs.ruby-lang.org/
 ______________________________________________
 ruby-core mailing list -- ruby-core@ml.ruby-lang.org
 To unsubscribe send an email to ruby-core-leave@ml.ruby-lang.org
 ruby-core info -- https://ml.ruby-lang.org/mailman3/lists/ruby-core.ml.ruby-lang.org/

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

* [ruby-core:121834] [Ruby Bug#21030] Bug: #step with Range<ActiveSupport::Duration> behavior broken on Ruby 3.4.1
  2025-01-12  5:59 [ruby-core:120619] [Ruby master Bug#21030] Bug: #step with Range<ActiveSupport::Duration> behavior broken on Ruby 3.4.1 johnnyshields (Johnny Shields) via ruby-core
                   ` (8 preceding siblings ...)
  2025-05-05 20:09 ` [ruby-core:121833] " Eregon (Benoit Daloze) via ruby-core
@ 2025-05-05 21:26 ` johnnyshields (Johnny Shields) via ruby-core
  9 siblings, 0 replies; 11+ messages in thread
From: johnnyshields (Johnny Shields) via ruby-core @ 2025-05-05 21:26 UTC (permalink / raw)
  To: ruby-core; +Cc: johnnyshields (Johnny Shields)

Issue #21030 has been updated by johnnyshields (Johnny Shields).


I also verified the fix in 3.4.3 in my app. The behavior is correct.

----------------------------------------
Bug #21030: Bug: #step with Range<ActiveSupport::Duration> behavior broken on Ruby 3.4.1
https://bugs.ruby-lang.org/issues/21030#change-112896

* Author: johnnyshields (Johnny Shields)
* Status: Closed
* Assignee: zverok (Victor Shepelev)
* Backport: 3.1: DONTNEED, 3.2: DONTNEED, 3.3: DONTNEED, 3.4: DONE
----------------------------------------
Issue also filed at: https://github.com/rails/rails/issues/54199

### System configuration
**Rails version**: 7.1.5.1
**Ruby version**: 3.3.4 (works) vs 3.4.1 (broken)

### What's broken

Calling `#step` then `#to_a` on a `Range` whose beginning/end values are the same is expected to return an `Array` wrapping the `Range`'s singular value. In other words, `(x..x).step(n).to_a` should return `[x]` -- note this is also the same as `(x..x).to_a`

The following case breaks on Ruby 3.4.1 related to `ActiveSupport::Duration` class, where it returns an empty array. It works on Ruby 3.3. Both tested with Rails 7.1.5.1. It's very easy to reproduce.

I'm unsure if this is a Ruby bug or a Rails bug so I'm filing it in both places. The upgrade of Ruby is what produces the difference.

```ruby
require 'active_support/all' # version 7.1.5.1

int = 100
dur = 100.seconds # ActiveSupport/Duration

# The bug

(dur..dur).step(10).to_a  # => Ruby 3.3 returns [100 seconds] - CORRECT
                          # => Ruby 3.4 returns [] - INCORRECT

(int..dur).step(10).to_a  # => Ruby 3.3 returns [100] - CORRECT
                          # => Ruby 3.4 returns [] - INCORRECT

# Note the following cases work correctly on both Ruby versions:
(int..int).step(10).to_a  #=> [100]
(int..dur).to_a           #=> [100]

# Range with non-equivalent values also works fine on different versions:
dur2 = 120.seconds
(dur..dur2).step(10).to_a  #=> [100 seconds, 110 seconds, 120 seconds]
(int..dur2).step(10).to_a  #=> [100, 110, 120]
```



-- 
https://bugs.ruby-lang.org/
 ______________________________________________
 ruby-core mailing list -- ruby-core@ml.ruby-lang.org
 To unsubscribe send an email to ruby-core-leave@ml.ruby-lang.org
 ruby-core info -- https://ml.ruby-lang.org/mailman3/lists/ruby-core.ml.ruby-lang.org/

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

end of thread, other threads:[~2025-05-05 21:27 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-01-12  5:59 [ruby-core:120619] [Ruby master Bug#21030] Bug: #step with Range<ActiveSupport::Duration> behavior broken on Ruby 3.4.1 johnnyshields (Johnny Shields) via ruby-core
2025-01-12  8:21 ` [ruby-core:120622] " zverok (Victor Shepelev) via ruby-core
2025-01-12  8:23 ` [ruby-core:120623] " zverok (Victor Shepelev) via ruby-core
2025-01-12 23:15 ` [ruby-core:120625] " johnnyshields (Johnny Shields) via ruby-core
2025-01-13  1:22 ` [ruby-core:120626] " nobu (Nobuyoshi Nakada) via ruby-core
2025-02-11  5:26 ` [ruby-core:120936] " johnnyshields (Johnny Shields) via ruby-core
2025-02-20 19:26 ` [ruby-core:121135] " jamesst20 (James St-Pierre) via ruby-core
2025-03-03 23:06 ` [ruby-core:121227] " k0kubun (Takashi Kokubun) via ruby-core
2025-05-05 18:44 ` [ruby-core:121831] [Ruby " jamesst20 (James St-Pierre) via ruby-core
2025-05-05 20:09 ` [ruby-core:121833] " Eregon (Benoit Daloze) via ruby-core
2025-05-05 21:26 ` [ruby-core:121834] " johnnyshields (Johnny Shields) via ruby-core

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 NNTP newsgroup(s).