<feed xmlns='http://www.w3.org/2005/Atom'>
<title>ruby.git/test/ruby/test_proc.rb, branch v3_3_11</title>
<subtitle>The Ruby Programming Language</subtitle>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/'/>
<entry>
<title>merge revision(s) 92dd9734a967c20e628c8f77c5ce700058dcd58c: [Backport #20950]</title>
<updated>2025-01-15T01:54:19+00:00</updated>
<author>
<name>Takashi Kokubun</name>
<email>takashikkbn@gmail.com</email>
</author>
<published>2025-01-15T01:54:19+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=299455be9966c0a31dabe00014a4b8fae5093a7d'/>
<id>299455be9966c0a31dabe00014a4b8fae5093a7d</id>
<content type='text'>
	Fix use-after-free in ep in Proc#dup for ifunc procs

	[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>
	Fix use-after-free in ep in Proc#dup for ifunc procs

	[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>merge revision(s) 29c480dd6fca993590c82078ba797e2c4e876ac7: [Backport #20853]</title>
<updated>2024-11-04T22:43:39+00:00</updated>
<author>
<name>Takashi Kokubun</name>
<email>takashikkbn@gmail.com</email>
</author>
<published>2024-11-04T22:43:39+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=6db39f4677ff50aacfe54bd9dda052c09e1c6ab0'/>
<id>6db39f4677ff50aacfe54bd9dda052c09e1c6ab0</id>
<content type='text'>
	[Bug #20853] Fix Proc#hash to not change after compaction

	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>
	[Bug #20853] Fix Proc#hash to not change after compaction

	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>[Feature #19362] Call `#initialize_dup` hook at `Proc#dup`</title>
<updated>2023-10-26T08:28:50+00:00</updated>
<author>
<name>Nobuyoshi Nakada</name>
<email>nobu@ruby-lang.org</email>
</author>
<published>2023-01-22T02:40:37+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=1507118f0b70fc8002b4b0f186b464c64965cd1e'/>
<id>1507118f0b70fc8002b4b0f186b464c64965cd1e</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>Make Kernel#lambda raise when given non-literal block</title>
<updated>2023-09-12T15:25:07+00:00</updated>
<author>
<name>Alan Wu</name>
<email>XrXr@users.noreply.github.com</email>
</author>
<published>2023-09-07T18:56:07+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=39ee3e22bd3d071c1c283b6b8dbd1af413342fb1'/>
<id>39ee3e22bd3d071c1c283b6b8dbd1af413342fb1</id>
<content type='text'>
Previously, Kernel#lambda returned a non-lambda proc when given a
non-literal block and issued a warning under the `:deprecated` category.
With this change, Kernel#lambda will always return a lambda proc, if it
returns without raising.

Due to interactions with block passing optimizations, we previously had
two separate code paths for detecting whether Kernel#lambda got a
literal block. This change allows us to remove one path, the hack done
with rb_control_frame_t::block_code introduced in 85a337f for supporting
situations where Kernel#lambda returned a non-lambda proc.

[Feature #19777]

Co-authored-by: Takashi Kokubun &lt;takashikkbn@gmail.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Previously, Kernel#lambda returned a non-lambda proc when given a
non-literal block and issued a warning under the `:deprecated` category.
With this change, Kernel#lambda will always return a lambda proc, if it
returns without raising.

Due to interactions with block passing optimizations, we previously had
two separate code paths for detecting whether Kernel#lambda got a
literal block. This change allows us to remove one path, the hack done
with rb_control_frame_t::block_code introduced in 85a337f for supporting
situations where Kernel#lambda returned a non-lambda proc.

[Feature #19777]

Co-authored-by: Takashi Kokubun &lt;takashikkbn@gmail.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>Fix autosplat conditions to handle ruby2_keywords case</title>
<updated>2023-07-10T17:06:23+00:00</updated>
<author>
<name>Jeremy Evans</name>
<email>code@jeremyevans.net</email>
</author>
<published>2023-07-10T17:06:23+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=3874381c4483ba7794ac2abf157e265546f9bfa7'/>
<id>3874381c4483ba7794ac2abf157e265546f9bfa7</id>
<content type='text'>
Autosplat should not occur if there are two arguments but second
argument is an array containing a ruby2_keywords splat. Only
autosplat if a single argument to be yielded to the block, and there
is no splatted flagged keyword hash passed.

Fixes [Bug #19759]</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Autosplat should not occur if there are two arguments but second
argument is an array containing a ruby2_keywords splat. Only
autosplat if a single argument to be yielded to the block, and there
is no splatted flagged keyword hash passed.

Fixes [Bug #19759]</pre>
</div>
</content>
</entry>
<entry>
<title>Raise RuntimeError if Kernel#binding is called from a non-Ruby frame</title>
<updated>2022-04-07T02:14:03+00:00</updated>
<author>
<name>Jeremy Evans</name>
<email>code@jeremyevans.net</email>
</author>
<published>2022-04-07T02:14:03+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=0b091fdac6ceb33b7379ceddc9a49a79d0e158b2'/>
<id>0b091fdac6ceb33b7379ceddc9a49a79d0e158b2</id>
<content type='text'>
Check whether the current or previous frame is a Ruby frame in
call_trace_func and rb_tracearg_binding before attempting to
create a binding for the frame.

Fixes [Bug #18487]

Co-authored-by: Alan Wu &lt;XrXr@users.noreply.github.com&gt;</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Check whether the current or previous frame is a Ruby frame in
call_trace_func and rb_tracearg_binding before attempting to
create a binding for the frame.

Fixes [Bug #18487]

Co-authored-by: Alan Wu &lt;XrXr@users.noreply.github.com&gt;</pre>
</div>
</content>
</entry>
<entry>
<title>Revert "Raise RuntimeError if Kernel#binding is called from a non-Ruby frame"</title>
<updated>2022-04-01T14:22:49+00:00</updated>
<author>
<name>Jeremy Evans</name>
<email>code@jeremyevans.net</email>
</author>
<published>2022-04-01T14:22:49+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=d1d48cb690fdad855da94b2a2d11721428bc06ba'/>
<id>d1d48cb690fdad855da94b2a2d11721428bc06ba</id>
<content type='text'>
This reverts commit 343ea9967e4a6b279eed6bd8e81ad0bdc747f254.

This causes an assertion failure with -DRUBY_DEBUG=1 -DRGENGC_CHECK_MODE=2
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This reverts commit 343ea9967e4a6b279eed6bd8e81ad0bdc747f254.

This causes an assertion failure with -DRUBY_DEBUG=1 -DRGENGC_CHECK_MODE=2
</pre>
</div>
</content>
</entry>
<entry>
<title>Do not autosplat array in block call just because keywords accepted</title>
<updated>2022-03-30T18:03:56+00:00</updated>
<author>
<name>Jeremy Evans</name>
<email>code@jeremyevans.net</email>
</author>
<published>2022-03-30T18:03:56+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=fbaadd1cfe7fbfd1b904f193f99d7c845a6ed804'/>
<id>fbaadd1cfe7fbfd1b904f193f99d7c845a6ed804</id>
<content type='text'>
If the block only accepts a single positional argument plus keywords,
then do not autosplat.  Still autosplat if the block accepts more
than one positional argument in addition to keywords.

Autosplatting a single positional argument plus keywords made sense
in Ruby 2, since a final positional hash could be used as keywords,
but it does not make sense in Ruby 3.

Fixes [Bug #18633]</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
If the block only accepts a single positional argument plus keywords,
then do not autosplat.  Still autosplat if the block accepts more
than one positional argument in addition to keywords.

Autosplatting a single positional argument plus keywords made sense
in Ruby 2, since a final positional hash could be used as keywords,
but it does not make sense in Ruby 3.

Fixes [Bug #18633]</pre>
</div>
</content>
</entry>
<entry>
<title>Raise RuntimeError if Kernel#binding is called from a non-Ruby frame</title>
<updated>2022-03-24T19:31:07+00:00</updated>
<author>
<name>Jeremy Evans</name>
<email>code@jeremyevans.net</email>
</author>
<published>2022-02-17T18:24:01+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=343ea9967e4a6b279eed6bd8e81ad0bdc747f254'/>
<id>343ea9967e4a6b279eed6bd8e81ad0bdc747f254</id>
<content type='text'>
Check whether the current or previous frame is a Ruby frame in
call_trace_func before attempting to create a binding for the frame.

Fixes [Bug #18487]

Co-authored-by: Alan Wu &lt;XrXr@users.noreply.github.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Check whether the current or previous frame is a Ruby frame in
call_trace_func before attempting to create a binding for the frame.

Fixes [Bug #18487]

Co-authored-by: Alan Wu &lt;XrXr@users.noreply.github.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>Make Proc#parameters support lambda keyword for returning parameters as if lambda</title>
<updated>2022-03-17T18:52:02+00:00</updated>
<author>
<name>Jeremy Evans</name>
<email>code@jeremyevans.net</email>
</author>
<published>2019-08-28T01:38:48+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=b6804d62f822237e136e698e006c913df9990ec2'/>
<id>b6804d62f822237e136e698e006c913df9990ec2</id>
<content type='text'>
This makes it easier to use Proc#parameters to build wrappers.

Implements [Feature #15357]
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This makes it easier to use Proc#parameters to build wrappers.

Implements [Feature #15357]
</pre>
</div>
</content>
</entry>
</feed>
