From: "shugo (Shugo Maeda)" Date: 2022-09-22T23:55:48+00:00 Subject: [ruby-core:110019] [Ruby master Bug#18960] Module#using raises RuntimeError when called at toplevel from wrapped script Issue #18960 has been updated by shugo (Shugo Maeda). I guess SEGV is caused by `using` in a method body, which should be prohibited even in a wrapped script. ---------------------------------------- Bug #18960: Module#using raises RuntimeError when called at toplevel from wrapped script https://bugs.ruby-lang.org/issues/18960#change-99270 * Author: shioyama (Chris Salzberg) * Status: Open * Priority: Normal * ruby -v: 3.1.2p20 * Backport: 2.7: UNKNOWN, 3.0: UNKNOWN, 3.1: UNKNOWN ---------------------------------------- I noticed that this file works when loaded with `load`, but fails if you pass `true` (or a module) as the `wrap` argument. ```ruby # using.rb using Module.new ``` This works: ```ruby load "./using.rb" ``` This doesn't: ```ruby load "./using.rb", true # raises RuntimeError (main.using is permitted only at toplevel) ``` I believe the latter should work. -- https://bugs.ruby-lang.org/ Unsubscribe: