Skip to content

Conversation

@trinistr
Copy link
Contributor

@trinistr trinistr commented Nov 23, 2025

There was a subtle change on master which I didn't notice making #1306: GC.config(hash) now also returns :implementation (commit). This PR makes both behaviors pass tests (and improves tests a tiny bit). However, there is no versioning: this method is rather experimental and forcing other implementations to also closely follow MRI's behavior is probably unneeded, I think, similar to treatment of ruby_bug (this effectively was a bug judging by commit message).

In this way, compatible method would be:

def GC.config(options = nil)
  raise ArgumentError unless options.nil? || Hash === options

  if Hash === options && options.key?(:implementation)
    raise ArgumentError, 'Attempting to set read-only key "Implementation"'
  end

 { implementation: "none" }
end

@trinistr
Copy link
Contributor Author

@eregon Could you review this?

Copy link
Member

@eregon eregon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks.
I was surprised the implementation key was not included for GC.config({}), glad that got fixed.

@eregon eregon merged commit c8a6beb into ruby:master Nov 23, 2025
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants