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

Ruby 3.2で、TracePoint#bindingはCで書かれたメソッドではnilを返すことへの対応 #2838

Merged
merged 1 commit into from
Oct 24, 2023

Conversation

kyanagi
Copy link
Contributor

@kyanagi kyanagi commented Oct 15, 2023

TracePoint#binding は、Ruby 3.2では C で書かれたメソッドに対しては nil を返すため、注釈を追加しました。

% docker run -it --rm rubylang/all-ruby env ALL_RUBY_SINCE=ruby-2.7 ./all-ruby -e 'TracePoint.new(:c_call) { |tp| p tp.binding.class }.enable; sprintf("%d", 10)'
ruby-2.7.0          Binding
...
ruby-3.2.0-rc1      Binding
ruby-3.2.0          NilClass
...
ruby-3.3.0-preview2 NilClass

参考:https://docs.ruby-lang.org/en/master/TracePoint.html#method-i-binding

@znz znz merged commit fce29f7 into rurema:master Oct 24, 2023
8 checks passed
@znz
Copy link
Member

znz commented Oct 24, 2023

マージしてから気付いたのですが、以下の行も分岐して nil 対応した方が良さそうです。

--- binding -> Binding

@kyanagi
Copy link
Contributor Author

kyanagi commented Oct 24, 2023

戻り値の型の対応として #2840 を作成しました。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants