Bug #21776
closedBinding#local_variable_defined? still supports numbered parameters
Description
On the freshest master:
[1].each {_1; p binding.local_variable_defined?(:_1) }
#=> true
It is inconsistent with changes in #local_variables/#local_variable_get/#local_variable_set. And inconsistent with handling of it:
[1].each { it; p binding.local_variable_defined?(:it) }
#=> false
Updated by mame (Yusuke Endoh) 2 days ago
Thanks! https://github.com/ruby/ruby/pull/15519 will fix the issue.
Updated by mame (Yusuke Endoh) 2 days ago
- Status changed from Open to Closed
Applied in changeset git|04494d9e4064a57accc8309da9b35754a3d24973.
Binding#local_variable_defined? must not handle numbered parameters
[Bug #21776]
Updated by mame (Yusuke Endoh) 2 days ago
I noticed that binding.local_variable_defined?(:@x) raises wrong local variable name '@x' for #<Binding:0x00007cd1e95a94d8> (NameError).
Maybe binding.local_variable_defined?(:_1) should raise a similar error because _1 is not a local variable. I will create a PR.
Updated by mame (Yusuke Endoh) 2 days ago
- Status changed from Closed to Open
Updated by mame (Yusuke Endoh) 2 days ago
- Status changed from Open to Closed
Applied in changeset git|1794cfe12fe61dedebadead542927f9fef4104eb.
Binding#local_variable_defined? raises a NameError for numbered params.
[Bug #21776]