summaryrefslogtreecommitdiff
path: root/tool/lib
diff options
context:
space:
mode:
authorLuke Gruber <luke.gru@gmail.com>2023-12-30 13:26:59 -0500
committerJeremy Evans <code@jeremyevans.net>2024-01-01 13:28:26 -0800
commite12d4c654e3cb7a4473014610bc3bae41aaf811e (patch)
tree3184f19e8898ca9af24dd5d6ee22afad83fa0530 /tool/lib
parent676748abcad62c021fc122d137f177d3c0f0f7a8 (diff)
Don't create T_MATCH object if /regexp/.match(string) doesn't match
Fixes [Bug #20104]
Diffstat (limited to 'tool/lib')
-rw-r--r--tool/lib/envutil.rb8
1 files changed, 8 insertions, 0 deletions
diff --git a/tool/lib/envutil.rb b/tool/lib/envutil.rb
index 9be0aac479..309a6af40f 100644
--- a/tool/lib/envutil.rb
+++ b/tool/lib/envutil.rb
@@ -254,6 +254,14 @@ module EnvUtil
end
module_function :under_gc_compact_stress
+ def without_gc
+ prev_disabled = GC.disable
+ yield
+ ensure
+ GC.enable unless prev_disabled
+ end
+ module_function :without_gc
+
def with_default_external(enc)
suppress_warning { Encoding.default_external = enc }
yield