зеркало из https://github.com/github/ruby.git
[ruby/csv] Support RJIT (https://github.com/ruby/csv/pull/281)
In Ruby 3.3, MJIT is replaced with RJIT. https://github.com/ruby/csv/commit/cc6b47a4a7
This commit is contained in:
Родитель
38ef537ce0
Коммит
31b28b31fa
|
@ -323,15 +323,22 @@ line,5,jkl
|
|||
end
|
||||
|
||||
private
|
||||
def assert_parse_errors_out(data, **options)
|
||||
|
||||
{
|
||||
"YJIT"=>1, # for --yjit-call-threshold=1
|
||||
"MJIT"=>5, "RJIT"=>5, # for --jit-wait
|
||||
}.any? do |jit, timeout|
|
||||
if (RubyVM.const_defined?(jit) and
|
||||
jit = RubyVM.const_get(jit) and
|
||||
jit.respond_to?(:enabled?) and
|
||||
jit.enabled?)
|
||||
PARSE_ERROR_TIMEOUT = timeout
|
||||
end
|
||||
end
|
||||
PARSE_ERROR_TIMEOUT ||= 0.2
|
||||
|
||||
def assert_parse_errors_out(data, timeout: PARSE_ERROR_TIMEOUT, **options)
|
||||
assert_raise(CSV::MalformedCSVError) do
|
||||
timeout = 0.2
|
||||
if defined?(RubyVM::YJIT.enabled?) and RubyVM::YJIT.enabled?
|
||||
timeout = 1 # for --yjit-call-threshold=1
|
||||
end
|
||||
if defined?(RubyVM::RJIT.enabled?) and RubyVM::RJIT.enabled?
|
||||
timeout = 5 # for --jit-wait
|
||||
end
|
||||
Timeout.timeout(timeout) do
|
||||
CSV.parse(data, **options)
|
||||
fail("Parse didn't error out")
|
||||
|
|
Загрузка…
Ссылка в новой задаче