Make OpenSSL::Digest classes Ractor-safe#1053
Conversation
b49c946 to
a363226
Compare
| if defined?(Ractor) | ||
| Ractor.alias_method(:value, :take) unless Ractor.method_defined?(:value) | ||
|
|
||
| def test_ractor | ||
| experimental_before = Warning[:experimental] | ||
| Warning[:experimental] = false |
There was a problem hiding this comment.
| if defined?(Ractor) | |
| Ractor.alias_method(:value, :take) unless Ractor.method_defined?(:value) | |
| def test_ractor | |
| experimental_before = Warning[:experimental] | |
| Warning[:experimental] = false | |
| if respond_to?(:ractor) | |
| ractor | |
| def test_ractor |
test-unit's ractor can be used here.
There was a problem hiding this comment.
I still had to check for Ractor and had to add the Ractor#value alias for Ruby < 4, but it's passing now (the ubuntu-24.04-ppc64le job is not making any progress though).
There was a problem hiding this comment.
I thought test-unit would take care of it, but I was mistaken. However, tests shouldn't update the global state. I think it's OK to simply skip testing it with older Ruby versions considering it's experimental.
There was a problem hiding this comment.
Ok changed the condition to respond_to?(:ractor) && Ractor.method_defined?(:value) to limit it to 4.0.
19266ba to
a342ea6
Compare
| experimental_before = Warning[:experimental] | ||
| Warning[:experimental] = false |
There was a problem hiding this comment.
This doesn't work because there are other tests using Ractors. However, it seems a good idea to suppress this warning category: #1057
There was a problem hiding this comment.
Ok removed this part and rebased since it's taken care of now.
a342ea6 to
418014b
Compare
Use class_eval with a string so the initialize instance method, and the digest and hexdigest class methods are not defined via define_method with a Proc (which is not Ractor-safe).
418014b to
502bc6c
Compare
Use class_eval with a string so the initialize instance method, and the digest and hexdigest class methods are not defined via define_method with a Proc (which is not Ractor-safe).