mirror of
https://github.com/ruby/ruby.git
synced 2025-08-15 13:39:04 +02:00
merge revision(s) 131c31a920
: [Backport #19081]
[Bug #19081] Show the caller location in warning for Ractor The internal location in ractor.rb is not usefull at all. ``` $ ruby -e 'Ractor.new {}' <internal:ractor>:267: warning: Ractor is experimental, ... ``` --- bootstraptest/test_ractor.rb | 6 ++++++ ractor.c | 6 ------ ractor.rb | 4 ++++ 3 files changed, 10 insertions(+), 6 deletions(-)
This commit is contained in:
parent
728d9f1834
commit
f8044a7700
4 changed files with 11 additions and 7 deletions
|
@ -1579,4 +1579,10 @@ assert_equal "ok", %q{
|
|||
end
|
||||
}
|
||||
|
||||
assert_match /\Atest_ractor\.rb:1:\s+warning:\s+Ractor is experimental/, %q{
|
||||
Warning[:experimental] = $VERBOSE = true
|
||||
STDERR.reopen(STDOUT)
|
||||
eval("Ractor.new{}.take", nil, "test_ractor.rb", 1)
|
||||
}
|
||||
|
||||
end # if !ENV['GITHUB_WORKFLOW']
|
||||
|
|
6
ractor.c
6
ractor.c
|
@ -1432,12 +1432,6 @@ cancel_single_ractor_mode(void)
|
|||
}
|
||||
|
||||
ruby_single_main_ractor = NULL;
|
||||
|
||||
if (rb_warning_category_enabled_p(RB_WARN_CATEGORY_EXPERIMENTAL)) {
|
||||
rb_category_warn(RB_WARN_CATEGORY_EXPERIMENTAL,
|
||||
"Ractor is experimental, and the behavior may change in future versions of Ruby! "
|
||||
"Also there are many implementation issues.");
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
@ -262,6 +262,10 @@ class Ractor
|
|||
def self.new(*args, name: nil, &block)
|
||||
b = block # TODO: builtin bug
|
||||
raise ArgumentError, "must be called with a block" unless block
|
||||
if __builtin_cexpr!("RBOOL(ruby_single_main_ractor)")
|
||||
warn("Ractor is experimental, and the behavior may change in future versions of Ruby! " \
|
||||
"Also there are many implementation issues.", uplevel: 0, category: :experimental)
|
||||
end
|
||||
loc = caller_locations(1, 1).first
|
||||
loc = "#{loc.path}:#{loc.lineno}"
|
||||
__builtin_ractor_create(loc, name, args, b)
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
# define RUBY_VERSION_MINOR RUBY_API_VERSION_MINOR
|
||||
#define RUBY_VERSION_TEENY 3
|
||||
#define RUBY_RELEASE_DATE RUBY_RELEASE_YEAR_STR"-"RUBY_RELEASE_MONTH_STR"-"RUBY_RELEASE_DAY_STR
|
||||
#define RUBY_PATCHLEVEL 180
|
||||
#define RUBY_PATCHLEVEL 181
|
||||
|
||||
#define RUBY_RELEASE_YEAR 2022
|
||||
#define RUBY_RELEASE_MONTH 11
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue