pry / pry-stack_explorer

Walk the stack in a Pry session
Other
454 stars 28 forks source link

Multiple warnings in Ruby 2.7.0 to use Binding#source_location #43

Closed dmlary closed 4 years ago

dmlary commented 4 years ago

Ruby 2.7 introduced Binding#source_location, and with that addition warnings are now being generated each time binding.eval('__FILE__') and binding.eval('__LINE__') are called.

This is the output using pry-stack_explorer (0.4.9.3)

/Users/dmlary/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/pry-stack_explorer-0.4.9.3/lib/pry-stack_explorer/commands.rb:58: warning: in `eval'
(pry):1: warning: __LINE__ in eval may not return location in binding; use Binding#source_location instead
/Users/dmlary/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/pry-stack_explorer-0.4.9.3/lib/pry-stack_explorer/commands.rb:58: warning: in `eval'
/Users/dmlary/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/pry-0.12.2/lib/pry/pry_instance.rb:387: warning: __FILE__ in eval may not return location in binding; use Binding#source_location instead
joallard commented 4 years ago

Fixed by #49

stewgloves commented 2 years ago

I am still seeing these warnings and on Pry version 0.13.1 on Ruby 2.7.4. Any ideas?

/Users/stewartglover/code/toshi-web/app/models/journey.rb:59: warning: __FILE__ in eval may not return location in binding; use Binding#source_location instead
/Users/stewartglover/.rbenv/versions/2.7.4/lib/ruby/gems/2.7.0/gems/pry-0.12.2/lib/pry/commands/whereami.rb:40: warning: in `eval'
/Users/stewartglover/code/toshi-web/app/models/journey.rb:59: warning: __LINE__ in eval may not return location in binding; use Binding#source_location instead
/Users/stewartglover/.rbenv/versions/2.7.4/lib/ruby/gems/2.7.0/gems/pry-0.12.2/lib/pry/commands/whereami.rb:41: warning: in `eval'
/Users/stewartglover/code/toshi-web/app/models/journey.rb:59: warning: __FILE__ in eval may not return location in binding; use Binding#source_location instead
/Users/stewartglover/.rbenv/versions/2.7.4/lib/ruby/gems/2.7.0/gems/pry-0.12.2/lib/pry/method/weird_method_locator.rb:28: warning: in `eval'
/Users/stewartglover/code/toshi-web/app/models/journey.rb:59: warning: __LINE__ in eval may not return location in binding; use Binding#source_location instead
/Users/stewartglover/.rbenv/versions/2.7.4/lib/ruby/gems/2.7.0/gems/pry-0.12.2/lib/pry/method/weird_method_locator.rb:28: warning: in `eval'
andrehjr commented 2 years ago

@stewgloves according to your error message it seems like you're using pry 0.12.2 🤔

stewgloves commented 2 years ago

that is very strange. Thanks for the spot. @andrehjr Please ignore my comment as it would appear to be an environment issue on my end.