Skip to content

warning with ruby 2.7 #51

Closed
Closed

Description

@nobu

The recent pp causes a warning with ruby 2.7.

$ ruby2.7 -w -e 'gem "pp"; require "pp"'
/opt/local/lib/ruby2.7/gems/2.7.0/gems/pp-0.6.2/lib/pp.rb:487: warning: constant ::Data is deprecated

defined? does not suppress warnings.

Originally posted by @nobu in #20 (comment)

Activity

  1. nobu commented on Oct 4, 2025

    @nobu
    MemberAuthor

    A plan I'm thinking is:

    1. revert Fixes for Data and add TruffleRuby in CI #20.
    2. release 0.6.3, the final version for ruby 2.
    3. bump up to 0.7.0.
    4. drop the support for ruby 2.
    5. re-apply Fixes for Data and add TruffleRuby in CI #20.

    @eregon How do you think?

  2. eregon commented on Oct 4, 2025

    @eregon
    Member

    Sorry about the warning.

    Yes, that would work but seems higher effort than just checking while setting $VERBOSE to nil like:

    verbose, $VERBOSE = $VERBOSE, nil
    begin
      has_data_define = defined?(Data.define)
    ensure
      $VERBOSE = verbose
    end

    Also 2.7 is EOL for 2.5 years, I think such warnings or minor inconveniences are OK, and it would only affect 2.7 users keeping pp updated. So maybe it would be fine to do nothing?
    Not against fixing this though, especially with that has_data_define approach it's very simple.

  3. added a commit that references this issue on Oct 4, 2025
  4. eregon commented on Oct 4, 2025

    @eregon
    Member

    Proposed simple fix: #53

  5. eregon commented on Oct 4, 2025

    @eregon
    Member

    BTW reverting the whole #20 seems bad, there are other commits which don't seem worth undoing & redoing, they are fine AFAIK. Could only revert & redo ed602b9 though.

  6. nobu commented on Oct 4, 2025

    @nobu
    MemberAuthor

    Also 2.7 is EOL for 2.5 years, I think such warnings or minor inconveniences are OK, and it would only affect 2.7 users keeping pp updated. So maybe it would be fine to do nothing?

    I encountered test failures by this warning at bigdecimal with ruby 2.7.

    Well, I agree that 2.7 support will not matter nowadays, and propose the dropping it, like as 2-4 in #51 (comment).

    Proposed simple fix: #53

    It is almost same as my first fix, except for the variable name.

    BTW reverting the whole #20 seems bad, there are other commits which don't seem worth undoing & redoing, they are fine AFAIK. Could only revert & redo ed602b9 though.

    Ah, yes, my bad.

  7. added a commit that references this issue on Oct 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions