Skip to content

Commit f74e96b

Browse files
committed
Suppress "string returned by #{symbol} will be frozen in the future" warnings
For example: https://github.com/red-data-tools/charty/actions/runs/14327259034/job/40155029515#step:12:1596 pycall-1.5.2/lib/pycall/pyobject_wrapper.rb:37: warning: string returned by :index=.to_s will be frozen in the future This warnings is started from Ruby 3.4.
1 parent f46d1ad commit f74e96b

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

lib/pycall/pyobject_wrapper.rb

+2-3
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,6 @@ def self.extend_object(obj)
3333
}.freeze
3434

3535
def method_missing(name, *args)
36-
name_str = name.to_s if name.kind_of?(Symbol)
37-
name_str.chop! if name_str.end_with?('=')
3836
case name
3937
when *OPERATOR_METHOD_NAMES.keys
4038
op_name = OPERATOR_METHOD_NAMES[name]
@@ -44,7 +42,8 @@ def method_missing(name, *args)
4442
return self.__send__(name, *args)
4543
end
4644
else
47-
if LibPython::Helpers.hasattr?(__pyptr__, name_str)
45+
name_without_last_equal = name.to_s.chomp('=')
46+
if LibPython::Helpers.hasattr?(__pyptr__, name_without_last_equal)
4847
LibPython::Helpers.define_wrapper_method(self, name)
4948
return self.__send__(name, *args)
5049
end

0 commit comments

Comments
 (0)