Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle Mutex#sleep change planned in Ruby 3.1 #683

Merged
merged 3 commits into from
Jun 21, 2021

Conversation

jeremyevans
Copy link
Contributor

Mutex#sleep in Ruby 3.1 will return nil if not interrupted. This
change is needed so that ruby/ruby PR 4256 can be merged, in order
to fix Ruby bug 16608.

Mutex#sleep in Ruby 3.1 will return nil if not interrupted. This
change is needed so that ruby/ruby PR 4256 can be merged, in order
to fix Ruby bug 16608.
@jeremyevans
Copy link
Contributor Author

CI failure does not look related to the change, as it occurs while installing dependencies, before the tests are run: E: Unable to locate package libdb-dev

@@ -47,9 +47,10 @@ def test_mu_unlock
def test_sleep
mu = mu()
mu.lock
assert_send_type "(Integer) -> Integer",
return_type = "Integer#{'?' if RUBY_VERSION >= '3.1'}"
assert_send_type "(Integer) -> #{return_type}",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think simply changing to Integer? for all versions is good.

@soutaro
Copy link
Member

soutaro commented Jun 18, 2021

Thank you @jeremyevans!
I think we should also change the definition in mutex_m.rbs to return nil.

  def sleep: (?Numeric timeout) -> Integer?

@jeremyevans
Copy link
Contributor Author

@soutaro Thank you for your review. I've pushed commits to address both of those issues.

Copy link
Member

@soutaro soutaro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you! 🎉

@soutaro soutaro merged commit 3c046c7 into ruby:master Jun 21, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants