Skip to content

Commit fcf8925

Browse files
authored
Merge pull request #651 from voxik/fix-inspect
#inspect should not output negative object IDs.
2 parents 3265766 + cc4ef3e commit fcf8925

File tree

2 files changed

+2
-6
lines changed

2 files changed

+2
-6
lines changed

lib/concurrent/edge/processing_actor.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ def ask(message, answer = Promises.resolvable_future)
146146

147147
# @return [String] string representation.
148148
def inspect
149-
format '<#%s:0x%x termination:%s>', self.class, object_id << 1, termination.state
149+
format '%s termination:%s>', super[0..-2], termination.state
150150
end
151151

152152
private

lib/concurrent/map.rb

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -210,12 +210,8 @@ def marshal_load(hash)
210210
undef :freeze
211211

212212
# @!visibility private
213-
DEFAULT_OBJ_ID_STR_WIDTH = 0.size == 4 ? 7 : 14 # we want to look "native", 7 for 32-bit, 14 for 64-bit
214-
# override default #inspect() method: firstly, we don't want to be spilling our guts (i-vars), secondly, MRI backend's
215-
# #inspect() call on its @backend i-var will bump @backend's iter level while possibly yielding GVL
216213
def inspect
217-
id_str = (object_id << 1).to_s(16).rjust(DEFAULT_OBJ_ID_STR_WIDTH, '0')
218-
"#<#{self.class.name}:0x#{id_str} entries=#{size} default_proc=#{@default_proc.inspect}>"
214+
format '%s entries=%d default_proc=%s>', to_s[0..-2], size.to_s, @default_proc.inspect
219215
end
220216

221217
private

0 commit comments

Comments
 (0)