<feed xmlns='http://www.w3.org/2005/Atom'>
<title>ruby.git/proc.c, branch v3_4_9</title>
<subtitle>The Ruby Programming Language</subtitle>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/'/>
<entry>
<title>Fix UnboundMethod#== for methods from included/extended modules [Backport #21873]</title>
<updated>2026-03-07T05:41:17+00:00</updated>
<author>
<name>Mike Dalessio</name>
<email>mike@37signals.com</email>
</author>
<published>2026-02-10T17:10:21+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=0097b87b1e2c6aa60489527e421e8bf2e2791d69'/>
<id>0097b87b1e2c6aa60489527e421e8bf2e2791d69</id>
<content type='text'>
Method#unbind clones the method entry, preserving its defined_class.
For methods mixed in via include/extend, defined_class is an ICLASS,
causing UnboundMethod#== to return false when comparing against the
same method obtained via Module#instance_method.

Resolve ICLASS defined_class in method_eq.

[Bug #21873]
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Method#unbind clones the method entry, preserving its defined_class.
For methods mixed in via include/extend, defined_class is an ICLASS,
causing UnboundMethod#== to return false when comparing against the
same method obtained via Module#instance_method.

Resolve ICLASS defined_class in method_eq.

[Bug #21873]
</pre>
</div>
</content>
</entry>
<entry>
<title>Do not respect ruby2_keywords on method/proc with post arguments</title>
<updated>2025-08-27T21:29:42+00:00</updated>
<author>
<name>Jeremy Evans</name>
<email>code@jeremyevans.net</email>
</author>
<published>2025-05-30T05:32:09+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=fd036dbc3f39e6bdce735edf9ca187a690fe2079'/>
<id>fd036dbc3f39e6bdce735edf9ca187a690fe2079</id>
<content type='text'>
Previously, ruby2_keywords could be used on a method or proc with
post arguments, but I don't think the behavior is desired:

```ruby
def a(*c, **kw) [c, kw] end
def b(*a, b) a(*a, b) end
ruby2_keywords(:b)

b({foo: 1}, bar: 1)
```

This changes ruby2_keywords to emit a warning and not set the
flag on a method/proc with post arguments.

While here, fix the ruby2_keywords specs for warnings, since they
weren't testing what they should be testing.  They all warned
because the method didn't accept a rest argument, not because it
accepted a keyword or keyword rest argument.

[Backport #21402]
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Previously, ruby2_keywords could be used on a method or proc with
post arguments, but I don't think the behavior is desired:

```ruby
def a(*c, **kw) [c, kw] end
def b(*a, b) a(*a, b) end
ruby2_keywords(:b)

b({foo: 1}, bar: 1)
```

This changes ruby2_keywords to emit a warning and not set the
flag on a method/proc with post arguments.

While here, fix the ruby2_keywords specs for warnings, since they
weren't testing what they should be testing.  They all warned
because the method didn't accept a rest argument, not because it
accepted a keyword or keyword rest argument.

[Backport #21402]
</pre>
</div>
</content>
</entry>
<entry>
<title>merge revision(s) f6cbf499bc98b851034fffb49fcbb59d495f6f7b: [Backport #21354]</title>
<updated>2025-07-14T21:10:16+00:00</updated>
<author>
<name>Takashi Kokubun</name>
<email>takashikkbn@gmail.com</email>
</author>
<published>2025-07-14T21:10:16+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=82e05dc945e3e2c5ab22be661f6caf6c7436461f'/>
<id>82e05dc945e3e2c5ab22be661f6caf6c7436461f</id>
<content type='text'>
	Fix Symbol#to_proc (rb_sym_to_proc) to be ractor safe

	In non-main ractors, don't use `sym_proc_cache`. It is not thread-safe
	to add to this array without a lock and also it leaks procs from one
	ractor to another. Instead, we create a new proc each time. If this
	results in poor performance we can come up with a solution later.

	Fixes [Bug #21354]
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
	Fix Symbol#to_proc (rb_sym_to_proc) to be ractor safe

	In non-main ractors, don't use `sym_proc_cache`. It is not thread-safe
	to add to this array without a lock and also it leaks procs from one
	ractor to another. Instead, we create a new proc each time. If this
	results in poor performance we can come up with a solution later.

	Fixes [Bug #21354]
</pre>
</div>
</content>
</entry>
<entry>
<title>merge revision(s) db02a6b3ab4cabbdf492c26dcb1929b4ef0370a1: [Backport #21103]</title>
<updated>2025-02-14T05:12:33+00:00</updated>
<author>
<name>Takashi Kokubun</name>
<email>takashikkbn@gmail.com</email>
</author>
<published>2025-02-14T05:12:33+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=e5403bd137d57991d8788cd29bbb5916d75acb36'/>
<id>e5403bd137d57991d8788cd29bbb5916d75acb36</id>
<content type='text'>
	[Bug #21103] Fix local variable index calculation with forwarding

	Forwarding argument is optimized not to packed when no other arguments
	and an internal object refers values before it.  This size is decided
	at called time, calculate the local variable index from the fixed end
	point.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
	[Bug #21103] Fix local variable index calculation with forwarding

	Forwarding argument is optimized not to packed when no other arguments
	and an internal object refers values before it.  This size is decided
	at called time, calculate the local variable index from the fixed end
	point.
</pre>
</div>
</content>
</entry>
<entry>
<title>Document 'it' and update numbered parameters docs (#12375)</title>
<updated>2024-12-18T19:38:40+00:00</updated>
<author>
<name>Victor Shepelev</name>
<email>zverok.offline@gmail.com</email>
</author>
<published>2024-12-18T19:38:40+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=173ae93e56c62e5cf178d403ae8abcc1b125306d'/>
<id>173ae93e56c62e5cf178d403ae8abcc1b125306d</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>Fix use-after-free in ep in Proc#dup for ifunc procs</title>
<updated>2024-12-13T15:10:03+00:00</updated>
<author>
<name>Peter Zhu</name>
<email>peter@peterzhu.ca</email>
</author>
<published>2024-12-12T19:03:07+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=92dd9734a967c20e628c8f77c5ce700058dcd58c'/>
<id>92dd9734a967c20e628c8f77c5ce700058dcd58c</id>
<content type='text'>
[Bug #20950]

ifunc proc has the ep allocated in the cfunc_proc_t which is the data of
the TypedData object. If an ifunc proc is duplicated, the ep points to
the ep of the source object. If the source object is freed, then the ep
of the duplicated object now points to a freed memory region. If we try
to use the ep we could crash.

For example, the following script crashes:

    p = { a: 1 }.to_proc
    100.times do
      p = p.dup
      GC.start
      p.call
    rescue ArgumentError
    end

This commit changes ifunc proc to also duplicate the ep when it is duplicated.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
[Bug #20950]

ifunc proc has the ep allocated in the cfunc_proc_t which is the data of
the TypedData object. If an ifunc proc is duplicated, the ep points to
the ep of the source object. If the source object is freed, then the ep
of the duplicated object now points to a freed memory region. If we try
to use the ep we could crash.

For example, the following script crashes:

    p = { a: 1 }.to_proc
    100.times do
      p = p.dup
      GC.start
      p.call
    rescue ArgumentError
    end

This commit changes ifunc proc to also duplicate the ep when it is duplicated.
</pre>
</div>
</content>
</entry>
<entry>
<title>[Bug #20853] Fix Proc#hash to not change after compaction</title>
<updated>2024-11-01T14:49:50+00:00</updated>
<author>
<name>Peter Zhu</name>
<email>peter@peterzhu.ca</email>
</author>
<published>2024-10-30T20:41:55+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=29c480dd6fca993590c82078ba797e2c4e876ac7'/>
<id>29c480dd6fca993590c82078ba797e2c4e876ac7</id>
<content type='text'>
The hash value of a Proc must remain constant after a compaction, otherwise
it may not work as the key in a hash table.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The hash value of a Proc must remain constant after a compaction, otherwise
it may not work as the key in a hash table.
</pre>
</div>
</content>
</entry>
<entry>
<title>Make Object#singleton_method return methods in modules included in or prepended to singleton class</title>
<updated>2024-10-03T14:27:01+00:00</updated>
<author>
<name>Jeremy Evans</name>
<email>code@jeremyevans.net</email>
</author>
<published>2024-09-12T04:29:41+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=9986a7c3930437bc9d9b88736c22695585aa6c48'/>
<id>9986a7c3930437bc9d9b88736c22695585aa6c48</id>
<content type='text'>
To simplify the implementation, this makes Object#singleton_method
call the same method called by Object#method (rb_obj_method), then
check that the returned Method is defined before the superclass of the
object's singleton class.  To keep the same error messages, it rescues
exceptions raised by rb_obj_method, and then raises its own exception.

Fixes [Bug #20620]
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
To simplify the implementation, this makes Object#singleton_method
call the same method called by Object#method (rb_obj_method), then
check that the returned Method is defined before the superclass of the
object's singleton class.  To keep the same error messages, it rescues
exceptions raised by rb_obj_method, and then raises its own exception.

Fixes [Bug #20620]
</pre>
</div>
</content>
</entry>
<entry>
<title>s/erorr/error/</title>
<updated>2024-09-27T00:58:17+00:00</updated>
<author>
<name>ydah</name>
<email>t.yudai92@gmail.com</email>
</author>
<published>2024-09-26T12:13:45+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=a50a7c70702c51cca9058b1f070a8e32c64b9774'/>
<id>a50a7c70702c51cca9058b1f070a8e32c64b9774</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>Add rb_block_call2, a flexible variant of rb_block_call</title>
<updated>2024-07-10T04:00:47+00:00</updated>
<author>
<name>Yusuke Endoh</name>
<email>mame@ruby-lang.org</email>
</author>
<published>2024-07-09T09:27:02+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=114e32b35796ca546f429ee3295607a127d7e519'/>
<id>114e32b35796ca546f429ee3295607a127d7e519</id>
<content type='text'>
This function accepts flags:

RB_NO_KEYWORDS, RB_PASS_KEYWORDS, RB_PASS_CALLED_KEYWORDS:
Works as the same as rb_block_call_kw.

RB_BLOCK_NO_USE_PACKED_ARGS:
The given block ("bl_proc") does not use "yielded_arg" of rb_block_call_func_t.
Instead, the block accesses the yielded arguments via "argc" and "argv".
This flag allows the called method to yield arguments without allocating an Array.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This function accepts flags:

RB_NO_KEYWORDS, RB_PASS_KEYWORDS, RB_PASS_CALLED_KEYWORDS:
Works as the same as rb_block_call_kw.

RB_BLOCK_NO_USE_PACKED_ARGS:
The given block ("bl_proc") does not use "yielded_arg" of rb_block_call_func_t.
Instead, the block accesses the yielded arguments via "argc" and "argv".
This flag allows the called method to yield arguments without allocating an Array.
</pre>
</div>
</content>
</entry>
</feed>
