mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
merge revision(s) 7b9476fbfa
: [Backport #17642]
Ractor.allocate should not be allowed Ractor.allocate and Ractor#dup should not be allowed like Thread. [Bug #17642] --- bootstraptest/test_ractor.rb | 18 ++++++++++++++++++ ractor.c | 2 ++ 2 files changed, 20 insertions(+)
This commit is contained in:
parent
6305d1c6ed
commit
72c6497453
3 changed files with 22 additions and 2 deletions
|
@ -8,6 +8,24 @@ assert_equal 'Ractor', %q{
|
||||||
Ractor.new{}.class
|
Ractor.new{}.class
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Ractor.allocate is not supported
|
||||||
|
assert_equal "[:ok, :ok]", %q{
|
||||||
|
rs = []
|
||||||
|
begin
|
||||||
|
Ractor.allocate
|
||||||
|
rescue => e
|
||||||
|
rs << :ok if e.message == 'allocator undefined for Ractor'
|
||||||
|
end
|
||||||
|
|
||||||
|
begin
|
||||||
|
Ractor.new{}.dup
|
||||||
|
rescue
|
||||||
|
rs << :ok if e.message == 'allocator undefined for Ractor'
|
||||||
|
end
|
||||||
|
|
||||||
|
rs
|
||||||
|
}
|
||||||
|
|
||||||
# A Ractor can have a name
|
# A Ractor can have a name
|
||||||
assert_equal 'test-name', %q{
|
assert_equal 'test-name', %q{
|
||||||
r = Ractor.new name: 'test-name' do
|
r = Ractor.new name: 'test-name' do
|
||||||
|
|
2
ractor.c
2
ractor.c
|
@ -2047,6 +2047,8 @@ void
|
||||||
Init_Ractor(void)
|
Init_Ractor(void)
|
||||||
{
|
{
|
||||||
rb_cRactor = rb_define_class("Ractor", rb_cObject);
|
rb_cRactor = rb_define_class("Ractor", rb_cObject);
|
||||||
|
rb_undef_alloc_func(rb_cRactor);
|
||||||
|
|
||||||
rb_eRactorError = rb_define_class_under(rb_cRactor, "Error", rb_eRuntimeError);
|
rb_eRactorError = rb_define_class_under(rb_cRactor, "Error", rb_eRuntimeError);
|
||||||
rb_eRactorIsolationError = rb_define_class_under(rb_cRactor, "IsolationError", rb_eRactorError);
|
rb_eRactorIsolationError = rb_define_class_under(rb_cRactor, "IsolationError", rb_eRactorError);
|
||||||
rb_eRactorRemoteError = rb_define_class_under(rb_cRactor, "RemoteError", rb_eRactorError);
|
rb_eRactorRemoteError = rb_define_class_under(rb_cRactor, "RemoteError", rb_eRactorError);
|
||||||
|
|
|
@ -12,11 +12,11 @@
|
||||||
# define RUBY_VERSION_MINOR RUBY_API_VERSION_MINOR
|
# define RUBY_VERSION_MINOR RUBY_API_VERSION_MINOR
|
||||||
#define RUBY_VERSION_TEENY 0
|
#define RUBY_VERSION_TEENY 0
|
||||||
#define RUBY_RELEASE_DATE RUBY_RELEASE_YEAR_STR"-"RUBY_RELEASE_MONTH_STR"-"RUBY_RELEASE_DAY_STR
|
#define RUBY_RELEASE_DATE RUBY_RELEASE_YEAR_STR"-"RUBY_RELEASE_MONTH_STR"-"RUBY_RELEASE_DAY_STR
|
||||||
#define RUBY_PATCHLEVEL 52
|
#define RUBY_PATCHLEVEL 53
|
||||||
|
|
||||||
#define RUBY_RELEASE_YEAR 2021
|
#define RUBY_RELEASE_YEAR 2021
|
||||||
#define RUBY_RELEASE_MONTH 3
|
#define RUBY_RELEASE_MONTH 3
|
||||||
#define RUBY_RELEASE_DAY 11
|
#define RUBY_RELEASE_DAY 12
|
||||||
|
|
||||||
#include "ruby/version.h"
|
#include "ruby/version.h"
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue