Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use TracePoint.allow_reentry when available
This fixes compatibility with TracePoint users such as Zeitwerk Test script: ```ruby require 'fileutils' FileUtils.mkdir_p('/tmp/lib/foo') File.write('/tmp/lib/foo.rb', 'module Foo; end') File.write('/tmp/lib/foo/bar.rb', 'Foo::Bar = 1') require 'zeitwerk' loader = Zeitwerk::Loader.new loader.push_dir('/tmp/lib') loader.setup require 'debug' binding.break p Foo::Bar ``` before: ``` [8, 16] in /tmp/debug-zeitwerk.rb 8| loader = Zeitwerk::Loader.new 9| loader.push_dir('/tmp/lib') 10| loader.setup 11| 12| require 'debug' => 13| binding.break 14| p Foo::Bar 15| 16| p :done =>#0 <main> at /tmp/debug-zeitwerk.rb:13 (rdbg) p Foo::Bar # command eval error: uninitialized constant Foo::Bar (rdbg)//tmp/debug-zeitwerk.rb:1:in `<main>' => nil ``` after: ``` [8, 16] in /tmp/debug-zeitwerk.rb 8| loader = Zeitwerk::Loader.new 9| loader.push_dir('/tmp/lib') 10| loader.setup 11| 12| require 'debug' => 13| binding.break 14| p Foo::Bar 15| 16| p :done =>#0 <main> at /tmp/debug-zeitwerk.rb:13 (rdbg) p Foo::Bar # command => 1 ```
- Loading branch information