summaryrefslogtreecommitdiff
path: root/spec/ruby/command_line/fixtures/freeze_flag_required_diff_enc.rb
diff options
context:
space:
mode:
authorAlan Wu <XrXr@users.noreply.github.com>2024-06-13 17:43:41 -0400
committerGitHub <noreply@github.com>2024-06-13 21:43:41 +0000
commit2699e230e467e395c868a9c4daa4af6fc6eb7d8b (patch)
tree4c359535ca99f6b007ed928f4579a755fa9bc634 /spec/ruby/command_line/fixtures/freeze_flag_required_diff_enc.rb
parent420ef906bd13e1dd403047d85207690e1af0db54 (diff)
Crash instead of raising with Check_Type() in RBIMPL_ASSERT_TYPE() in debug buildsHEADmaster
Previously, RBIMPL_ASSERT_TYPE() used Check_Type() only in RUBY_DEBUG builds. It raised TypeError, but only in debug builds. For people testing type mismatch using debug builds looking for a Ruby exception, this can be misleading -- the code could be missing a type check in non-debug builds if it is relying on for example RSTRING_LEN() to raise. Also, Check_Type() can obscure the true cause of error in debug mode. When type check fails because the object is corrupt, instead of crashing with a clear type assertion message, it can crash while trying to construct an exception object to raise. You can see this for example in <https://github.com/ruby/ruby/actions/runs/9489999591/job/26152506434?pr=10985>, where RB_ENCODING_GET() is used on a corrupt object, but the crash happens later and says "Assertion Failed: ../src/vm_method.c:1477:callable_method_entry_or_negative". RBIMPL_ASSERT_TYPE() should assert right away. RBIMPL_ASSERT_OR_ASSUME() asserts when RUBY_DEBUG and assumes in release builds, as desired. This should help investigate flaky CI failures that show up as TypeError from `Kernel#require`, e.g. "'Kernel#require': wrong argument type false (expected String) (TypeError)". Same CI failure examples: - https://github.com/ruby/ruby/actions/runs/9034787861/job/24828147431 - https://github.com/ruby/ruby/actions/runs/9418303667/job/25945492440 - https://github.com/ruby/ruby/actions/runs/9505650952/job/26201031314 The failure occurs with and without use of YJIT.
Diffstat (limited to 'spec/ruby/command_line/fixtures/freeze_flag_required_diff_enc.rb')
0 files changed, 0 insertions, 0 deletions