https://bugs.ruby-lang.org/https://bugs.ruby-lang.org/favicon.ico?17113305112021-09-19T00:16:11ZRuby Issue Tracking SystemRuby master - Bug #18177: An error occurs when running RSpec with Ruby 3.1.0-devhttps://bugs.ruby-lang.org/issues/18177?journal_id=937602021-09-19T00:16:11Zyahonda (Yasuo Honda)yasuo.honda@gmail.com
<ul></ul><p>Rails CI against Ruby master is also affected by this commit. <a href="https://github.com/ruby/ruby/pull/4858/commits/178ee1e801acb33d13b3e8a630f6ca4926c68fbc" class="external">https://github.com/ruby/ruby/pull/4858/commits/178ee1e801acb33d13b3e8a630f6ca4926c68fbc</a></p>
<ul>
<li>
<p>CI failure<br>
<a href="https://buildkite.com/rails/rails/builds/81084#67d95e32-91b9-49c2-a463-3499e25d2660/1110-1113" class="external">https://buildkite.com/rails/rails/builds/81084#67d95e32-91b9-49c2-a463-3499e25d2660/1110-1113</a></p>
</li>
<li>
<p>Argument Error raised at this line<br>
<a href="https://github.com/rails/rails/blob/c839fdb4d715e0866bb4e483283e7e3e60e5bfe1/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb#L689" class="external">https://github.com/rails/rails/blob/c839fdb4d715e0866bb4e483283e7e3e60e5bfe1/activerecord/lib/active_record/connection_adapters/abstract_adapter.rb#L689</a></p>
</li>
</ul> Ruby master - Bug #18177: An error occurs when running RSpec with Ruby 3.1.0-devhttps://bugs.ruby-lang.org/issues/18177?journal_id=937622021-09-19T13:36:17Znobu (Nobuyoshi Nakada)nobu@ruby-lang.org
<ul></ul><p>As I'm not sure where the uninitialized module came from, can't make a simple test code.</p>
<p>Does this fix it?</p>
<pre><code class="diff syntaxhl" data-language="diff"><span class="gh">diff --git a/class.c b/class.c
index 0b075a9abb8..c56a149afc7 100644
</span><span class="gd">--- a/class.c
</span><span class="gi">+++ b/class.c
</span><span class="p">@@ -917,7 +917,8 @@</span> ensure_includable(VALUE klass, VALUE module)
rb_class_modify_check(klass);
Check_Type(module, T_MODULE);
if (RMODULE_UNINITIALIZED(module)) {
<span class="gd">- rb_raise(rb_eArgError, "uninitialized module");
</span><span class="gi">+ RB_OBJ_WRITE(module, &RCLASS(module)->super, 0);
+ /* no more re-initialization */
</span> }
if (!NIL_P(rb_refinement_module_get_refined_class(module))) {
rb_raise(rb_eArgError, "refinement module is not allowed");
</code></pre> Ruby master - Bug #18177: An error occurs when running RSpec with Ruby 3.1.0-devhttps://bugs.ruby-lang.org/issues/18177?journal_id=937632021-09-19T14:08:40Znobu (Nobuyoshi Nakada)nobu@ruby-lang.org
<ul></ul><p>Maybe, like this?</p>
<pre><code class="ruby syntaxhl" data-language="ruby"><span class="n">m</span> <span class="o">=</span> <span class="no">Class</span><span class="p">.</span><span class="nf">new</span><span class="p">(</span><span class="no">Module</span><span class="p">)</span> <span class="p">{</span><span class="k">def</span> <span class="nf">initialize_copy</span><span class="p">(</span><span class="n">other</span><span class="p">);</span><span class="k">end</span><span class="p">}.</span><span class="nf">new</span><span class="p">.</span><span class="nf">dup</span>
<span class="no">Class</span><span class="p">.</span><span class="nf">new</span><span class="p">.</span><span class="nf">include</span><span class="p">(</span><span class="n">m</span><span class="p">)</span>
</code></pre> Ruby master - Bug #18177: An error occurs when running RSpec with Ruby 3.1.0-devhttps://bugs.ruby-lang.org/issues/18177?journal_id=937642021-09-20T06:25:49Znobu (Nobuyoshi Nakada)nobu@ruby-lang.org
<ul><li><strong>Status</strong> changed from <i>Open</i> to <i>Closed</i></li></ul><p>Applied in changeset <a class="changeset" title="Allow to include uninitialized modules [Bug #18177] The module that is about to be included is c..." href="https://bugs.ruby-lang.org/projects/ruby-master/repository/git/revisions/2e3d43e5775799d1b4d6672a3a18b3fc5777c52b">git|2e3d43e5775799d1b4d6672a3a18b3fc5777c52b</a>.</p>
<hr>
<p>Allow to include uninitialized modules [Bug <a class="issue tracker-1 status-5 priority-4 priority-default closed" title="Bug: An error occurs when running RSpec with Ruby 3.1.0-dev (Closed)" href="https://bugs.ruby-lang.org/issues/18177">#18177</a>]</p>
<p>The module that is about to be included is considered initialized.</p> Ruby master - Bug #18177: An error occurs when running RSpec with Ruby 3.1.0-devhttps://bugs.ruby-lang.org/issues/18177?journal_id=937682021-09-20T14:08:53Zkoic (Koichi ITO)koic.ito@gmail.com
<ul></ul><p>I have confirmed that the issue has been resolved that was raising <code>ArgumentError</code> when running RSpec. Thanks a lot for the quick fix!</p>