mirror of
https://github.com/ruby/ruby.git
synced 2025-08-15 13:39:04 +02:00
rb_raise when attempting to set the GC implementation name
Instead of silently ignoring the key, we should raise to clearly tell the user that this key is read-only.
This commit is contained in:
parent
6795fc4981
commit
42501015b4
Notes:
git
2024-11-14 10:46:53 +00:00
2 changed files with 10 additions and 4 deletions
10
gc.rb
10
gc.rb
|
@ -306,7 +306,15 @@ module GC
|
|||
def self.config hash = nil
|
||||
return Primitive.gc_config_get unless hash
|
||||
|
||||
Primitive.gc_config_set hash
|
||||
if(Primitive.cexpr!("RBOOL(RB_TYPE_P(hash, T_HASH))"))
|
||||
if hash.include?(:implementation)
|
||||
raise ArgumentError, 'Attempting to set read-only key "Implementation"'
|
||||
end
|
||||
|
||||
Primitive.gc_config_set hash
|
||||
else
|
||||
raise ArgumentError
|
||||
end
|
||||
end
|
||||
|
||||
# call-seq:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue