Skip to content

Add missing core singleton methods - #3218

Open
zonuexe wants to merge 1 commit into
ruby:masterfrom
zonuexe:add-missing-singleton-methods
Open

zonuexe wants to merge 1 commit into
ruby:masterfrom
zonuexe:add-missing-singleton-methods

Conversation

@zonuexe

@zonuexe zonuexe commented Oct 10, 2026

Copy link
Copy Markdown
Contributor

Adds signatures for singleton methods that Ruby 4.0 defines but core/ lacked (RubyVM internals and Process::Tms.[] are out of scope). Doc comments are generated by rbs annotate from the RDoc of v4.0.7.

Ruby Method Change C function
Hash.ruby2_keywords_hash Added. Takes Hash (Check_Type, no to_hash conversion) and keeps its subclass rb_hash_s_ruby2_keywords_hash
Hash.ruby2_keywords_hash? Added. Takes Hash (Check_Type, no to_hash conversion) rb_hash_s_ruby2_keywords_hash_p
Kernel.set_trace_func Added (global function) set_trace_func
Kernel.trap Added (global function). Same C function as Signal.trap, so same signature sig_trap
Process.last_status Added. nil when no status is recorded for the current thread proc_s_last_status
Process.setpgrp Added proc_setpgrp
Process::Status.wait Added. Returns nil when flags has WNOHANG and no child has exited (source), unlike the call-seq rb_process_status_waitv
Process::Sys.getegid Added proc_getegid

Process.setpgrp is tested in a forked child so that the test runner's process group is not changed.

Add signatures for singleton methods that are defined in Ruby 4.0 but
were missing from core/:

- Hash.ruby2_keywords_hash, Hash.ruby2_keywords_hash?
- Kernel.set_trace_func, Kernel.trap
- Process.last_status, Process.setpgrp
- Process::Status.wait
- Process::Sys.getegid
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.

1 participant