<feed xmlns='http://www.w3.org/2005/Atom'>
<title>ruby.git/proc.c, 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>Fix UnboundMethod#== for methods from included/extended modules [Backport #21873]</title>
<updated>2026-02-12T06:05:36+00:00</updated>
<author>
<name>Mike Dalessio</name>
<email>mike@37signals.com</email>
</author>
<published>2026-02-10T17:19:35+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=b952b6f099af08a14b57afc0a069597646f3161a'/>
<id>b952b6f099af08a14b57afc0a069597646f3161a</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>merge revision(s) ce849d565bf6aae8e0179fffb04eb1f665f17347, acb29f7fa1497463ed3bdd65549ef20b61beda64: [Backport #21402]</title>
<updated>2025-09-14T03:47:12+00:00</updated>
<author>
<name>nagachika</name>
<email>nagachika@ruby-lang.org</email>
</author>
<published>2025-09-14T03:47:12+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=e39a0a19c03fbb37d1c9d1e050bb551dccfc11c6'/>
<id>e39a0a19c03fbb37d1c9d1e050bb551dccfc11c6</id>
<content type='text'>
	ruby2_keywords warnings: Quote non-UTF8 method names fully

	It used to quote only part of the method name because NUL byte in
	the method terminates the C string:

	```
	(irb)&gt; "abcdef".encode("UTF-16LE").bytes
	=&gt; [97, 0, 98, 0, 99, 0, 100, 0, 101, 0, 102, 0]
	```

	```
	expected: /abcdef/
	actual: warning: Skipping set of ruby2_keywords flag for a (method not defined in Ruby)\n".
	```

	Do not respect ruby2_keywords on method/proc with post arguments

	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.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
	ruby2_keywords warnings: Quote non-UTF8 method names fully

	It used to quote only part of the method name because NUL byte in
	the method terminates the C string:

	```
	(irb)&gt; "abcdef".encode("UTF-16LE").bytes
	=&gt; [97, 0, 98, 0, 99, 0, 100, 0, 101, 0, 102, 0]
	```

	```
	expected: /abcdef/
	actual: warning: Skipping set of ruby2_keywords flag for a (method not defined in Ruby)\n".
	```

	Do not respect ruby2_keywords on method/proc with post arguments

	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.
</pre>
</div>
</content>
</entry>
<entry>
<title>merge revision(s) f6cbf499bc98b851034fffb49fcbb59d495f6f7b: [Backport #21354]</title>
<updated>2025-06-14T02:39:08+00:00</updated>
<author>
<name>nagachika</name>
<email>nagachika@ruby-lang.org</email>
</author>
<published>2025-06-14T02:39:08+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=d5c8fd2043f4425c3fe2a87558dfbd80ebff9911'/>
<id>d5c8fd2043f4425c3fe2a87558dfbd80ebff9911</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) 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>merge revision(s) 58918788abd63901588e4aa1e39b5c057321c10a: [Backport #20342]</title>
<updated>2024-05-29T22:40:49+00:00</updated>
<author>
<name>Takashi Kokubun</name>
<email>takashikkbn@gmail.com</email>
</author>
<published>2024-05-29T22:40:49+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=a24f19742bfa398a3b32c51df01133db7bcbc6e0'/>
<id>a24f19742bfa398a3b32c51df01133db7bcbc6e0</id>
<content type='text'>
	[Bug #20342] Consider wrapped load in `main` methods
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
	[Bug #20342] Consider wrapped load in `main` methods
</pre>
</div>
</content>
</entry>
<entry>
<title>merge revision(s) d19d683a354530a27b4cbb049223f8dc70c75849,de1a586ecc2ee7f465f0c0a69291054136a3a819: [Backport #20250] (#10308)</title>
<updated>2024-03-21T01:45:01+00:00</updated>
<author>
<name>NARUSE, Yui</name>
<email>nurse@users.noreply.github.com</email>
</author>
<published>2024-03-21T01:45:01+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=a63e979853783601a60228b45741f8b3776e5507'/>
<id>a63e979853783601a60228b45741f8b3776e5507</id>
<content type='text'>
rb_obj_setup: do not copy RUBY_FL_SEEN_OBJ_ID

	[Bug #20250]

	We're seting up a new instance, so it never had an associated
	object_id.

	proc.c: get rid of `CLONESETUP`
	MIME-Version: 1.0
	Content-Type: text/plain; charset=UTF-8
	Content-Transfer-Encoding: 8bit

	[Bug #20253]

	All the way down to Ruby 1.9, `Proc`, `Method`, `UnboundMethod`
	and `Binding` always had their own specific clone and dup routine.

	This caused various discrepancies with how other objects behave
	on `dup` and `clone. [Bug #20250], [Bug #20253].

	This commit get rid of `CLONESETUP` and use the the same codepath
	as all other types, so ensure consistency.

	NB: It's still not accepting the `freeze` keyword argument on `clone`.

	Co-Authored-By: Étienne Barrié &lt;etienne.barrie@gmail.com&gt;</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
rb_obj_setup: do not copy RUBY_FL_SEEN_OBJ_ID

	[Bug #20250]

	We're seting up a new instance, so it never had an associated
	object_id.

	proc.c: get rid of `CLONESETUP`
	MIME-Version: 1.0
	Content-Type: text/plain; charset=UTF-8
	Content-Transfer-Encoding: 8bit

	[Bug #20253]

	All the way down to Ruby 1.9, `Proc`, `Method`, `UnboundMethod`
	and `Binding` always had their own specific clone and dup routine.

	This caused various discrepancies with how other objects behave
	on `dup` and `clone. [Bug #20250], [Bug #20253].

	This commit get rid of `CLONESETUP` and use the the same codepath
	as all other types, so ensure consistency.

	NB: It's still not accepting the `freeze` keyword argument on `clone`.

	Co-Authored-By: Étienne Barrié &lt;etienne.barrie@gmail.com&gt;</pre>
</div>
</content>
</entry>
<entry>
<title>Remove unused macros</title>
<updated>2023-12-12T22:24:17+00:00</updated>
<author>
<name>Alan Wu</name>
<email>alanwu@ruby-lang.org</email>
</author>
<published>2023-12-12T22:24:17+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=9f77eb1f5a1e52a32b249abaef990e50c31e2ecc'/>
<id>9f77eb1f5a1e52a32b249abaef990e50c31e2ecc</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>Make env_clone compaction safe</title>
<updated>2023-12-05T13:42:25+00:00</updated>
<author>
<name>Peter Zhu</name>
<email>peter@peterzhu.ca</email>
</author>
<published>2023-12-04T19:00:00+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=ed25f0bd5a4fb936eddde080b90446e7d55afb2d'/>
<id>ed25f0bd5a4fb936eddde080b90446e7d55afb2d</id>
<content type='text'>
The original order of events is:

1. Allocate new_body.
2. Peform memcpy into new_body.
3. Create new_env using new_body.

However, if GC compaction runs during step 3, then new_env would not
have yet been created and objects on new_body could move but it would
not be reference updated.

This commit changes the order of the last two events.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The original order of events is:

1. Allocate new_body.
2. Peform memcpy into new_body.
3. Create new_env using new_body.

However, if GC compaction runs during step 3, then new_env would not
have yet been created and objects on new_body could move but it would
not be reference updated.

This commit changes the order of the last two events.
</pre>
</div>
</content>
</entry>
<entry>
<title>Get rid of useless dsize functions</title>
<updated>2023-11-21T14:15:03+00:00</updated>
<author>
<name>Jean Boussier</name>
<email>byroot@ruby-lang.org</email>
</author>
<published>2023-11-21T11:09:13+00:00</published>
<link rel='alternate' type='text/html' href='https://git.ruby-lang.org/ruby.git/commit/?id=b4f551686b973b03665bcaa3ecf128c0a87ff58b'/>
<id>b4f551686b973b03665bcaa3ecf128c0a87ff58b</id>
<content type='text'>
If we always return 0, we might as well not define
the function at all.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
If we always return 0, we might as well not define
the function at all.
</pre>
</div>
</content>
</entry>
</feed>
