sferik / twitter-ruby

A Ruby interface to the Twitter API.
http://www.rubydoc.info/gems/twitter
MIT License
4.59k stars 1.31k forks source link

ruby 3+ and t/twitter result in a lot of frozen string errors #1027

Closed zenspider closed 11 months ago

zenspider commented 1 year ago
9988 % t whoami
/Users/ryan/.gem/sandboxes/t/gems/http-3.3.0/lib/http/response/body.rb:52:in `force_encoding': can't modify frozen String: "" (FrozenError)
    from /Users/ryan/.gem/sandboxes/t/gems/http-3.3.0/lib/http/response/body.rb:52:in `to_s'
    from /Users/ryan/.rubies/ruby-3.2.2/lib/ruby/3.2.0/forwardable.rb:234:in `empty?'
    from /Users/ryan/.gem/sandboxes/t/gems/twitter-6.2.0/lib/twitter/rest/request.rb:37:in `perform'
    from /Users/ryan/.gem/sandboxes/t/gems/twitter-6.2.0/lib/twitter/rest/utils.rb:50:in `perform_request'
    from /Users/ryan/.gem/sandboxes/t/gems/twitter-6.2.0/lib/twitter/rest/utils.rb:72:in `perform_request_with_object'
    from /Users/ryan/.gem/sandboxes/t/gems/twitter-6.2.0/lib/twitter/rest/utils.rb:57:in `perform_get_with_object'
    from /Users/ryan/.gem/sandboxes/t/gems/twitter-6.2.0/lib/twitter/rest/users.rb:235:in `user'
    from /Users/ryan/.gem/sandboxes/t/gems/t-3.1.0/lib/t/cli.rb:899:in `whois'
    from /Users/ryan/.gem/sandboxes/t/gems/t-3.1.0/lib/t/cli.rb:930:in `whoami'
    from /Users/ryan/.gem/sandboxes/t/gems/thor-1.2.1/lib/thor/command.rb:27:in `run'
    from /Users/ryan/.gem/sandboxes/t/gems/thor-1.2.1/lib/thor/invocation.rb:127:in `invoke_command'
    from /Users/ryan/.gem/sandboxes/t/gems/thor-1.2.1/lib/thor.rb:392:in `dispatch'
    from /Users/ryan/.gem/sandboxes/t/gems/thor-1.2.1/lib/thor/base.rb:485:in `start'
    from /Users/ryan/.gem/sandboxes/t/gems/t-3.1.0/bin/t:20:in `<top (required)>'
    from /Users/ryan/Bin/t:26:in `load'
    from /Users/ryan/Bin/t:26:in `<main>'
zenspider commented 1 year ago

Hrm... dove down on this... turns out to be a legit bug from @stream.readpartial in http. I'll file a patch upstream and tag this.

zenspider commented 1 year ago

This is already fixed upstream and requires a gem bump to at least 5.0.2.

https://github.com/httprb/http/commit/2df5e461