From: "mame (Yusuke Endoh) via ruby-core" Date: 2025-05-21T09:28:15+00:00 Subject: [ruby-core:122217] [Ruby Bug#21356] Error when accessing local variable named "default" with Binding#local_variable_get Issue #21356 has been updated by mame (Yusuke Endoh). Good catch, you are correct. Thank you! https://github.com/ruby/ruby/pull/13396 ---------------------------------------- Bug #21356: Error when accessing local variable named "default" with Binding#local_variable_get https://bugs.ruby-lang.org/issues/21356#change-113365 * Author: richardboehme (Richard B�hme) * Status: Open * ruby -v: ruby 3.5.0dev (2025-05-21T06:12:18Z master f6cbf499bc) +PRISM [x86_64-linux] * Backport: 3.2: REQUIRED, 3.3: REQUIRED, 3.4: REQUIRED ---------------------------------------- On Ruby master when using `Binding#local_variable_get` with the name `:default` it raises the following error: ``` 'Binding#local_variable_get': numbered parameter 'default' is not a local variable (NameError) ``` I saw that this error was introduced in #21049 but it seems like the check for whether the passed variable name is a numbered parameter does not work for the `:default` symbol. I think this might be an off-by-one error in the `rb_numparam_id_p` function in proc.c, where instead of adding 9 (the maximum number of numbered parameters) to tNUMPARAM_1 we currently add 10 which then includes the id of default as well? Compiling with this change (see attached diff) fixed the issue but I'm not sure if it might break other things. ---Files-------------------------------- patch.diff (384 Bytes) -- https://bugs.ruby-lang.org/ ______________________________________________ ruby-core mailing list -- ruby-core@ml.ruby-lang.org To unsubscribe send an email to ruby-core-leave@ml.ruby-lang.org ruby-core info -- https://ml.ruby-lang.org/mailman3/lists/ruby-core.ml.ruby-lang.org/