Skip to content

Commit 2502ab2

Browse files
homusegiddins
authored andcommitted
Auto merge of #1908 - voxik:fix-inspect, r=segiddins
Prevent negative IDs in output of #inspect. # Description: object_id might be negative, since Ruby tries to avoid Bignums: https://bugs.ruby-lang.org/issues/13397 (cherry picked from commit ca35855)
1 parent 97ce98b commit 2502ab2

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

lib/rubygems/dependency_list.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ def find_name(full_name)
104104
end
105105

106106
def inspect # :nodoc:
107-
"#<%s:0x%x %p>" % [self.class, object_id, map { |s| s.full_name }]
107+
"%s %p>" % [super[0..-2], map { |s| s.full_name }]
108108
end
109109

110110
##

lib/rubygems/platform.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ def initialize(arch)
112112
end
113113

114114
def inspect
115-
"#<%s:0x%x @cpu=%p, @os=%p, @version=%p>" % [self.class, object_id, *to_a]
115+
"%s @cpu=%p, @os=%p, @version=%p>" % [super[0..-2], *to_a]
116116
end
117117

118118
def to_a

lib/rubygems/specification.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2102,7 +2102,7 @@ def inspect # :nodoc:
21022102
if $DEBUG
21032103
super
21042104
else
2105-
"#<#{self.class}:0x#{__id__.to_s(16)} #{full_name}>"
2105+
"#{super[0..-2]} #{full_name}>"
21062106
end
21072107
end
21082108

0 commit comments

Comments
 (0)