Commit b62a4d7
committed
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
```1 parent a21742d commit b62a4d7
1 file changed
+7
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
367 | 367 | | |
368 | 368 | | |
369 | 369 | | |
370 | | - | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
371 | 375 | | |
372 | 376 | | |
373 | 377 | | |
| |||
406 | 410 | | |
407 | 411 | | |
408 | 412 | | |
409 | | - | |
| 413 | + | |
410 | 414 | | |
411 | | - | |
| 415 | + | |
412 | 416 | | |
413 | 417 | | |
414 | 418 | | |
| |||
0 commit comments