ml.ruby-lang.org
Sign In Sign Up
Manage this list Sign In Sign Up

Keyboard Shortcuts

Thread View

  • j: Next unread message
  • k: Previous unread message
  • j a: Jump to all threads
  • j l: Jump to MailingList overview

ruby-core

Thread Start a new thread
Download
Threads by month
  • ----- 2025 -----
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2024 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2023 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2022 -----
  • December
  • November
ruby-core@ml.ruby-lang.org

  • 3 participants
  • 3370 discussions
[ruby-core:111133] [Ruby master Bug#19147] `TestFileExhaustive#test_expand_path_for_existent_username` and `TestDir#test_home` fails on i686
by vo.x (Vit Ondruch) 01 Dec '22

01 Dec '22
Issue #19147 has been updated by vo.x (Vit Ondruch). Interestingly, testing with commit:git|0436f1e15a, there are now additional spec failures which appears to be the same issue: ~~~ 1) File.expand_path expands ~ENV['USER'] to the user's home directory ERROR RuntimeError: can't set length of shared string /builddir/build/BUILD/ruby-3.2.0-0436f1e15a/spec/ruby/core/file/expand_path_spec.rb:99:in `expand_path' /builddir/build/BUILD/ruby-3.2.0-0436f1e15a/spec/ruby/core/file/expand_path_spec.rb:99:in `block (3 levels) in <top (required)>' /builddir/build/BUILD/ruby-3.2.0-0436f1e15a/spec/ruby/core/file/expand_path_spec.rb:7:in `<top (required)>' 2) File.expand_path expands ~ENV['USER']/a to a in the user's home directory ERROR RuntimeError: can't set length of shared string /builddir/build/BUILD/ruby-3.2.0-0436f1e15a/spec/ruby/core/file/expand_path_spec.rb:103:in `expand_path' /builddir/build/BUILD/ruby-3.2.0-0436f1e15a/spec/ruby/core/file/expand_path_spec.rb:103:in `block (3 levels) in <top (required)>' /builddir/build/BUILD/ruby-3.2.0-0436f1e15a/spec/ruby/core/file/expand_path_spec.rb:7:in `<top (required)>' ~~~ ---------------------------------------- Bug #19147: `TestFileExhaustive#test_expand_path_for_existent_username` and `TestDir#test_home` fails on i686 https://bugs.ruby-lang.org/issues/19147#change-100412 * Author: vo.x (Vit Ondruch) * Status: Open * Priority: Normal * ruby -v: ruby 3.2.0dev (2022-11-24 master 66e5200ba4) [i386-linux] * Backport: 2.7: UNKNOWN, 3.0: UNKNOWN, 3.1: UNKNOWN ---------------------------------------- Testing with commit:git|66e5200ba4 on Fedora Rawhide, I observe following error just on i686 (other platforms are passing just fine): ~~~ 1) Error: TestFileExhaustive#test_expand_path_for_existent_username: RuntimeError: can't set length of shared string /builddir/build/BUILD/ruby-3.2.0-66e5200ba4/test/ruby/test_file_exhaustive.rb:1122:in `expand_path' /builddir/build/BUILD/ruby-3.2.0-66e5200ba4/test/ruby/test_file_exhaustive.rb:1122:in `test_expand_path_for_existent_username' 2) Error: TestDir#test_home: RuntimeError: can't set length of shared string /builddir/build/BUILD/ruby-3.2.0-66e5200ba4/test/ruby/test_dir.rb:537:in `expand_path' /builddir/build/BUILD/ruby-3.2.0-66e5200ba4/test/ruby/test_dir.rb:537:in `block in test_home' ~~~ Previously testing with commit:git|4b1504ae0a, the tests were passing just fine. -- https://bugs.ruby-lang.org/
1 0
0 0
[ruby-core:111132] [Ruby master Bug#19079] Modules included in a DelegateClass cannot override delegate methods
by jonathanhefner (Jonathan Hefner) 01 Dec '22

01 Dec '22
Issue #19079 has been updated by jonathanhefner (Jonathan Hefner). This issue occurred for a private module in Rails: https://github.com/rails/rails/pull/46189#discussion_r991440668. Using `include` in a subclass works. Using `prepend` also works, and is the workaround I used for the Rails module. However, my proposed solution for this issue (https://github.com/ruby/delegate/pull/14) also solves #19079 with a performance improvement. I opened this issue and #19079 because the current behavior seemed surprising to me. In particular, I expected the `DelegateClass` block to behave just like a `Class.new` block. I feel like that is a reasonable assumption based on [the documentation](https://github.com/ruby/delegate/blob/2e1272cadbf86a02a0084d…. But, if my assumption is wrong, then I understand the decision. ---------------------------------------- Bug #19079: Modules included in a DelegateClass cannot override delegate methods https://bugs.ruby-lang.org/issues/19079#change-100411 * Author: jonathanhefner (Jonathan Hefner) * Status: Rejected * Priority: Normal * ruby -v: ruby 3.1.2p20 * Backport: 2.7: UNKNOWN, 3.0: UNKNOWN, 3.1: UNKNOWN ---------------------------------------- Because `DelegateClass` defines delegate methods on the class itself, those delegate methods come first in the method lookup chain. This prevents included modules from overriding delegate methods: ```ruby Base = Class.new do def foo "base" end end Helper = Module.new do def foo "helper" end end WithHelper = DelegateClass(Base) { include Helper } WithHelper.new(Base.new).foo # => "base" ``` One possible solution would be to define the delegate methods in a separate module. That way, other modules could come before it in the method lookup chain. -- https://bugs.ruby-lang.org/
1 0
0 0
[ruby-core:111131] [Ruby master Bug#19166] Module#remove_method can change frozen modules when there is a prepended module
by alanwu (Alan Wu) 01 Dec '22

01 Dec '22
Issue #19166 has been reported by alanwu (Alan Wu). ---------------------------------------- Bug #19166: Module#remove_method can change frozen modules when there is a prepended module https://bugs.ruby-lang.org/issues/19166 * Author: alanwu (Alan Wu) * Status: Open * Priority: Normal * ruby -v: 2.7, 3.0, 3.1, dev * Backport: 2.7: UNKNOWN, 3.0: UNKNOWN, 3.1: UNKNOWN ---------------------------------------- ```ruby module A prepend Module.new # remove this line and you'd get FrozenError as expected def foo; end freeze remove_method :foo # remove works even though module is frozen! p instance_methods(false) # => [] end ``` Old bug, reproduces in 2.7 through 3.1 and on master. Found while investigating #19164. -- https://bugs.ruby-lang.org/
1 0
0 0
[ruby-core:111130] [Ruby master Bug#19143] Windows - bundled extension gems compile, but don't copy *.so files to lib folder
by MSP-Greg (Greg L) 01 Dec '22

01 Dec '22
Issue #19143 has been updated by MSP-Greg (Greg L). @nobu Yes, I agree, it might be very helpful when one has more than one platform installed and uses `--user-install`. As in `Gem.install_extension_in_lib`, also [Gem::Ext::ExtConfBuilder](https://github.com/ruby/ruby/blob/master/lib/ruby…. I overwrite my Windows Ruby master installs daily, so I always use `--user-install`. Maybe issues with existing extension gems that load with `require_relative`, and also pre-compiled gems? ---------------------------------------- Bug #19143: Windows - bundled extension gems compile, but don't copy *.so files to lib folder https://bugs.ruby-lang.org/issues/19143#change-100408 * Author: MSP-Greg (Greg L) * Status: Closed * Priority: Normal * Backport: 2.7: UNKNOWN, 3.0: UNKNOWN, 3.1: UNKNOWN ---------------------------------------- Just finished updating ruby-loco's mswin build to use a system similar to the ucrt & mingw builds. Confirmed something I noticed previously, and also occurs with the RubyInstaller2 head build. On Windows, bundled extension gems (debug, rbs) compile their extension in the `ext` folder, but do not copy them to the `lib` folder. So, the *.so file is created, but not copied. I think this was working correctly on Ruby 3.1? -- https://bugs.ruby-lang.org/
1 0
0 0
[ruby-core:111129] [Ruby master Bug#19079] Modules included in a DelegateClass cannot override delegate methods
by Hanmac (Hans Mackowiak) 01 Dec '22

01 Dec '22
Issue #19079 has been updated by Hanmac (Hans Mackowiak). you can also try prepend instead of include: ```ruby WithHelper = DelegateClass(Base) { prepend Helper } ``` ---------------------------------------- Bug #19079: Modules included in a DelegateClass cannot override delegate methods https://bugs.ruby-lang.org/issues/19079#change-100407 * Author: jonathanhefner (Jonathan Hefner) * Status: Rejected * Priority: Normal * ruby -v: ruby 3.1.2p20 * Backport: 2.7: UNKNOWN, 3.0: UNKNOWN, 3.1: UNKNOWN ---------------------------------------- Because `DelegateClass` defines delegate methods on the class itself, those delegate methods come first in the method lookup chain. This prevents included modules from overriding delegate methods: ```ruby Base = Class.new do def foo "base" end end Helper = Module.new do def foo "helper" end end WithHelper = DelegateClass(Base) { include Helper } WithHelper.new(Base.new).foo # => "base" ``` One possible solution would be to define the delegate methods in a separate module. That way, other modules could come before it in the method lookup chain. -- https://bugs.ruby-lang.org/
1 0
0 0
[ruby-core:111127] [Ruby master Bug#19047] DelegateClass displays "method redefined" warning when overriding methods
by matz (Yukihiro Matsumoto) 01 Dec '22

01 Dec '22
Issue #19047 has been updated by matz (Yukihiro Matsumoto). For example, the example in #19079 does not give warning for overwriting the method `foo`. Matz. ---------------------------------------- Bug #19047: DelegateClass displays "method redefined" warning when overriding methods https://bugs.ruby-lang.org/issues/19047#change-100405 * Author: jonathanhefner (Jonathan Hefner) * Status: Closed * Priority: Normal * ruby -v: ruby 3.1.2p20 * Backport: 2.7: UNKNOWN, 3.0: UNKNOWN, 3.1: UNKNOWN ---------------------------------------- Perhaps this is not a bug, but it does seem unexpected. When creating a `DelegateClass` class without an intervening ancestor, overriding a method displays "method redefined" warning: ```ruby Base = Class.new do def foo "foo" end end Delegate1 = DelegateClass(Base) do def foo super + "1" end end # warning: method redefined; discarding old foo Delegate2 = Class.new(DelegateClass(Base)) do def foo super + "2" end end # no warning Delegate1.new(Base.new).foo # => "foo1" Delegate2.new(Base.new).foo # => "foo2" ``` One possible solution would be to evaluate the `DelegateClass` block in a separate module, and prepend that module to the returned class. Another possible solution would be to silence warnings around [when the block is evaluated](https://github.com/ruby/delegate/blob/df2283b8d8874446086b80355c…. I would be happy to submit a PR to https://github.com/ruby/delegate if this is something we want to address. -- https://bugs.ruby-lang.org/
1 0
0 0
[ruby-core:111126] [Ruby master Bug#19079] Modules included in a DelegateClass cannot override delegate methods
by matz (Yukihiro Matsumoto) 01 Dec '22

01 Dec '22
Issue #19079 has been updated by matz (Yukihiro Matsumoto). If you want to include a module to a delegated class, try the following: ```ruby class WithHelper<DelegateClass(Base) include Helper end ``` Matz. ---------------------------------------- Bug #19079: Modules included in a DelegateClass cannot override delegate methods https://bugs.ruby-lang.org/issues/19079#change-100404 * Author: jonathanhefner (Jonathan Hefner) * Status: Rejected * Priority: Normal * ruby -v: ruby 3.1.2p20 * Backport: 2.7: UNKNOWN, 3.0: UNKNOWN, 3.1: UNKNOWN ---------------------------------------- Because `DelegateClass` defines delegate methods on the class itself, those delegate methods come first in the method lookup chain. This prevents included modules from overriding delegate methods: ```ruby Base = Class.new do def foo "base" end end Helper = Module.new do def foo "helper" end end WithHelper = DelegateClass(Base) { include Helper } WithHelper.new(Base.new).foo # => "base" ``` One possible solution would be to define the delegate methods in a separate module. That way, other modules could come before it in the method lookup chain. -- https://bugs.ruby-lang.org/
1 0
0 0
[ruby-core:111125] [Ruby master Feature#19078] Introduce `Fiber#storage` for inheritable fiber-scoped variables.
by ioquatix (Samuel Williams) 01 Dec '22

01 Dec '22
Issue #19078 has been updated by ioquatix (Samuel Williams). Status changed from Open to Closed It was merged. ---------------------------------------- Feature #19078: Introduce `Fiber#storage` for inheritable fiber-scoped variables. https://bugs.ruby-lang.org/issues/19078#change-100401 * Author: ioquatix (Samuel Williams) * Status: Closed * Priority: Normal * Assignee: ioquatix (Samuel Williams) ---------------------------------------- Pull Request: https://github.com/ruby/ruby/pull/6612 This is an evolution of the previous ideas: - https://bugs.ruby-lang.org/issues/19058 - https://bugs.ruby-lang.org/issues/19062 This PR introduces fiber scoped variables, and is a solution for problems like <https://github.com/ioquatix/ioquatix/discussions/17>. The main interface is: ```ruby Fiber[key] = value Fiber[key] # => value ``` The variables are scoped (local to) a fiber and inherited into child fibers and threads. ```ruby Fiber[:request_id] = SecureRandom.hex(16) Fiber.new do p Fiber[:request_id] # prints the above request id end ``` The fiber scoped variables are stored and can be accessed: ```ruby Fiber.current.storage # => returns a Hash (copy) of the internal storage. Fiber.current.storage= # => assigns a Hash (copy) to the internal storage. ``` Fiber itself has one new keyword argument: ``` Fiber.new(..., storage: hash, false, undef, nil) ``` This can control how the fiber variables are setup in a child context. To minimise the performance overhead of some of the implementation choices, we are also simultaneously implementing <https://bugs.ruby-lang.org/issues/19077>. ## Examples ### Request loop ```ruby Thread.new do while request = queue.pop Fiber.new(storage: {id: SecureRandom.hex(16)}) do handle_request.call(request) end end end ``` OR ```ruby Thread.new do while request = queue.pop Fiber.current.storage = {id: SecureRandom.hex(16)} handle_request.call(request) end end ``` -- https://bugs.ruby-lang.org/
1 0
0 0
[ruby-core:111123] [Ruby master Bug#19047] DelegateClass displays "method redefined" warning when overriding methods
by byroot (Jean Boussier) 01 Dec '22

01 Dec '22
Issue #19047 has been updated by byroot (Jean Boussier). > we missed the warnings from DelegateClass misuse Do you have a reference to that? ---------------------------------------- Bug #19047: DelegateClass displays "method redefined" warning when overriding methods https://bugs.ruby-lang.org/issues/19047#change-100397 * Author: jonathanhefner (Jonathan Hefner) * Status: Closed * Priority: Normal * ruby -v: ruby 3.1.2p20 * Backport: 2.7: UNKNOWN, 3.0: UNKNOWN, 3.1: UNKNOWN ---------------------------------------- Perhaps this is not a bug, but it does seem unexpected. When creating a `DelegateClass` class without an intervening ancestor, overriding a method displays "method redefined" warning: ```ruby Base = Class.new do def foo "foo" end end Delegate1 = DelegateClass(Base) do def foo super + "1" end end # warning: method redefined; discarding old foo Delegate2 = Class.new(DelegateClass(Base)) do def foo super + "2" end end # no warning Delegate1.new(Base.new).foo # => "foo1" Delegate2.new(Base.new).foo # => "foo2" ``` One possible solution would be to evaluate the `DelegateClass` block in a separate module, and prepend that module to the returned class. Another possible solution would be to silence warnings around [when the block is evaluated](https://github.com/ruby/delegate/blob/df2283b8d8874446086b80355c…. I would be happy to submit a PR to https://github.com/ruby/delegate if this is something we want to address. -- https://bugs.ruby-lang.org/
1 0
0 0
[ruby-core:111122] [Ruby master Feature#19107] Allow trailing comma in method signature
by byroot (Jean Boussier) 01 Dec '22

01 Dec '22
Issue #19107 has been updated by byroot (Jean Boussier). > Is there an actual case where this proposal is convenient? Yes, when replacing old APIs that took an "option hash" by explicit keyword arguments, it tend to create very large signature. The last example I have in mind is `redis-client`: https://github.com/redis-rb/redis-client/blob/dcfe43abb83597bee129537464e20… ```ruby def initialize( username: nil, password: nil, db: nil, id: nil, timeout: DEFAULT_TIMEOUT, read_timeout: timeout, write_timeout: timeout, connect_timeout: timeout, ssl: nil, custom: {}, ssl_params: nil, driver: nil, protocol: 3, client_implementation: RedisClient, command_builder: CommandBuilder, inherit_socket: false, reconnect_attempts: false, middlewares: false, circuit_breaker: nil ) ``` When adding a new argument, it cause these annoying diffs: ```diff diff --git a/lib/redis_client/config.rb b/lib/redis_client/config.rb index fc74367..6412171 100644 --- a/lib/redis_client/config.rb +++ b/lib/redis_client/config.rb @@ -36,7 +36,8 @@ class RedisClient command_builder: CommandBuilder, inherit_socket: false, reconnect_attempts: false, - middlewares: false + middlewares: false, + circuit_breaker: nil ) @username = username @password = password ``` Also this inconsistency is the reason why some popular styleguides reverted back to not using trailing comma for multi-line enumerations: - https://github.com/testdouble/standard/pull/453#issuecomment-1234208705 - https://github.com/fables-tales/rubyfmt/issues/154 ---------------------------------------- Feature #19107: Allow trailing comma in method signature https://bugs.ruby-lang.org/issues/19107#change-100396 * Author: byroot (Jean Boussier) * Status: Open * Priority: Normal ---------------------------------------- A popular style for multiline arrays, hashes or method calls, is to use trailing commas: ```ruby array = [ 1, 2, 3, ] hash = { foo: 1, bar: 2, baz: 3, } Some.method( 1, 2, foo: 3, ) ``` The main reason to do this is to avoid unnecessary noise when adding one extra element: ```diff diff --git a/foo.rb b/foo.rb index b2689a7e4f..ddb7dc3552 100644 --- a/foo.rb +++ b/foo.rb @@ -1,4 +1,5 @@ Foo.bar( foo: 1, - bar: 2 + bar: 2, + baz: 3 ) ``` However, this pattern doesn't work with method declarations: ```ruby def foo(bar:,) # syntax error, unexpected ')' ``` ### Proposal For consistency and convenience I propose to allow trailing commas in method declarations. -- https://bugs.ruby-lang.org/
1 0
0 0
  • ← Newer
  • 1
  • ...
  • 326
  • 327
  • 328
  • 329
  • 330
  • 331
  • 332
  • ...
  • 337
  • Older →

HyperKitty Powered by HyperKitty version 1.3.12.