Issue #9226 has been updated by charliesome (Charlie Somerville).


Instead of shading the hash, we could probably do something like this:

diff --git hash.c hash.c
index a52e02f..e7a505e 100644
--- hash.c
+++ hash.c
@@ -1414,22 +1414,9 @@ rb_hash_replace(VALUE hash, VALUE hash2)
 
     table2 = RHASH(hash2)->ntbl;
 
-    if (RHASH_EMPTY_P(hash2)) {
-	rb_hash_clear(hash);
-	if (table2) hash_tbl(hash)->type = table2->type;
-	return hash;
-    }
-
-    if (RHASH_ITER_LEV(hash) > 0) {
-	rb_hash_clear(hash);
-	hash_tbl(hash)->type = table2->type;
-	rb_hash_foreach(hash2, replace_i, hash);
-    }
-    else {
-	st_table *old_table = RHASH(hash)->ntbl;
-	if (old_table) st_free_table(old_table);
-	RHASH(hash)->ntbl = st_copy(table2);
-    }
+    rb_hash_clear(hash);
+    hash_tbl(hash)->type = table2->type;
+    rb_hash_foreach(hash2, replace_i, hash);
 
     return hash;
 }

----------------------------------------
Bug #9226: Getting method `inspect' called on unexpected T_NODE object (0x000000025ddea8 flags=0x109089c klass=0x0) (NotImplementedError) from Hash#inspect
https://bugs.ruby-lang.org/issues/9226#change-43499

Author: myronmarston (Myron Marston)
Status: Open
Priority: Normal
Assignee: 
Category: 
Target version: current: 2.1.0
ruby -v: 2.1.0.preview2
Backport: 1.9.3: UNKNOWN, 2.0.0: UNKNOWN


We're trying to get a green RSpec build against ruby 2.1.0.preview2, and we're getting this very odd failure on travis:

https://travis-ci.org/rspec/rspec-core/jobs/15066502#L122

The line where it's failing is here:

https://github.com/rspec/rspec-core/blob/2e77a83d92eb1e661398f00359fc784da019401a/lib/rspec/core/filter_manager.rb#L75

It's calling `inspect` on a Hash and blowing up with that confusing error.  The hash that's causing this failure (if that helps) is here:

https://github.com/rspec/rspec-core/blob/2e77a83d92eb1e661398f00359fc784da019401a/spec/spec_helper.rb#L149-L158

It's the `{ :ruby => lambda { } }` hash being passed to `filter_run_excluding`.


-- 
http://bugs.ruby-lang.org/