Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

show-source ($) broken for many methods in Ruby 2.7.0 ("undefined method `skip_cruby_source'") #103

Open
patbl opened this issue Mar 28, 2020 · 0 comments

Comments

@patbl
Copy link

patbl commented Mar 28, 2020

Migrated from pry/pry#2124.

It does still work with some methods, but far fewer than 2.6.5 did. Errors and warnings appear on 2.7.0 (see below); this seems to be the line causing the problem:

raise if _pry_.config.skip_cruby_source

The output below is from macOS Mojave; I've also reproduced the issue on Ubuntu 19.10.

2.6.5

[12:12:30] ~  ➜ rbenv local 2.6.5
[12:12:32] ~  ➜ ruby -v
ruby 2.6.5p114 (2019-10-01 revision 67812) [x86_64-darwin18]
[12:12:34] ~  ➜ pry
[1] pry(main)> $ "".chomp

From: string.c (C Method):
Owner: String
Visibility: public
Number of lines: 7

static VALUE
rb_str_chomp(int argc, VALUE *argv, VALUE str)
{
    VALUE rs = chomp_rs(argc, argv);
    if (NIL_P(rs)) return rb_str_dup(str);
    return rb_str_subseq(str, 0, chompped_length(str, rs));
}
[2] pry(main)> $ "".length

From: string.c (C Method):
Owner: String
Visibility: public
Number of lines: 5

VALUE
rb_str_length(VALUE str)
{
    return LONG2NUM(str_strlen(str, NULL));
}
[3] pry(main)> $ "".ord

From: string.c (C Method):
Owner: String
Visibility: public
Number of lines: 8

VALUE
rb_str_ord(VALUE s)
{
    unsigned int c;

    c = rb_enc_codepoint(RSTRING_PTR(s), RSTRING_END(s), STR_ENC_GET(s));
    return UINT2NUM(c);
}

2.7.0

[12:09:23] ~  ➜ rbenv local 2.7.0
[12:09:23] ~  ➜ ruby -v
ruby 2.7.0p0 (2019-12-25 revision 647ee6f091) [x86_64-darwin18]
[12:09:26] ~  ➜ pry
[1] pry(main)> $ "".chomp
/Users/pat/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/pry-doc-1.1.0/lib/pry-doc/pry_ext/show_source_with_c_internals.rb:34: warning: _pry_ is deprecated, use pry_instance instead
NoMethodError: undefined method `skip_cruby_source' for #<Pry::Config:0x00007fd56e04b640>
from /Users/pat/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/pry-0.13.0/lib/pry/config.rb:250:in `method_missing'
Caused by Pry::CommandError: Cannot locate this method: chomp. (source_location returns nil)
from /Users/pat/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/pry-0.13.0/lib/pry/method.rb:526:in `pry_doc_info'
[1] pry(main)> $ "".length

From: string.c (C Method):
Owner: String
Visibility: public
Signature: length()
Number of lines: 5

VALUE
rb_str_length(VALUE str)
{
    return LONG2NUM(str_strlen(str, NULL));
}
[2] pry(main)> $ "".ord
/Users/pat/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/pry-doc-1.1.0/lib/pry-doc/pry_ext/show_source_with_c_internals.rb:34: warning: _pry_ is deprecated, use pry_instance instead
NoMethodError: undefined method `skip_cruby_source' for #<Pry::Config:0x00007fd56e04b640>
from /Users/pat/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/pry-0.13.0/lib/pry/config.rb:250:in `method_missing'
Caused by Pry::CommandError: Cannot locate this method: ord. (source_location returns nil)
from /Users/pat/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/pry-0.13.0/lib/pry/method.rb:526:in `pry_doc_info'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant