Skip to content
  • nagachika's avatar
    5427b083
    merge revision(s) 76228191: [Backport #18023] · 5427b083
    nagachika authored
    	Fix Ractor.make_shareable changing locals for Procs
    
    	env_copy() uses rb_ary_delete_at() with a loop counting up while
    	iterating through the list of read only locals. rb_ary_delete_at() can
    	shift elements in the array to an index lesser than the loop index,
    	causing locals to be missed and set to Qfalse in the returned
    	environment.
    
    	Iterate through the locals in reverse instead, this way the shifting
    	never happens for locals that are yet to be visited and we process all
    	the locals in the array.
    
    	[Bug #18023]
    	---
    	 bootstraptest/test_ractor.rb | 22 ++++++++++++++++++++++
    	 vm.c                         |  2 +-
    	 2 files changed, 23 insertions(+), 1 deletion(-)
    5427b083
    merge revision(s) 76228191: [Backport #18023]
    nagachika authored
    	Fix Ractor.make_shareable changing locals for Procs
    
    	env_copy() uses rb_ary_delete_at() with a loop counting up while
    	iterating through the list of read only locals. rb_ary_delete_at() can
    	shift elements in the array to an index lesser than the loop index,
    	causing locals to be missed and set to Qfalse in the returned
    	environment.
    
    	Iterate through the locals in reverse instead, this way the shifting
    	never happens for locals that are yet to be visited and we process all
    	the locals in the array.
    
    	[Bug #18023]
    	---
    	 bootstraptest/test_ractor.rb | 22 ++++++++++++++++++++++
    	 vm.c                         |  2 +-
    	 2 files changed, 23 insertions(+), 1 deletion(-)
Loading