Bug #7449

Rdoc for obj.object_id

Added by Heesob Park over 1 year ago. Updated over 1 year ago.

[ruby-core:50245]
Status:Closed
Priority:Normal
Assignee:Eric Hodel
Category:doc
Target version:2.0.0
ruby -v:ruby 2.0.0dev (2012-11-27 trunk 37869) [x64-mswin64_100] Backport:

Description

Documentation for return type of obj.object_id is wrong on Windows x64.

C:\Users\phasis>irb
irb(main):001:0> 0.1.objectid
=> -158526706883441454
irb(main):002:0> 0.1.object
id.class
=> Bignum

Here is a patch:
diff --git a/gc.c b/gc.c.new
index d52208d..2a0f26a 100644
--- a/gc.c
+++ b/gc.c.new
@@ -1670,8 +1670,8 @@ id2ref(VALUE obj, VALUE objid)
* Document-method: objectid
*
* call-seq:
- * obj.
id_ -> fixnum
- * obj.objectid -> fixnum
+ * obj.
id_ -> integer
+ * obj.object_id -> integer
*
* Returns an integer identifier for obj. The same number will
* be returned on all calls to id for a given object, and

Associated revisions

Revision 37987
Added by Zachary Scott over 1 year ago

  • gc.c: Documentation for GC, GC::Profiler, ObjectSpace, and ObjectSpace::WeakMap [Bug #7449]

History

#1 Updated by Luis Lavena over 1 year ago

  • Category set to doc
  • Status changed from Open to Assigned
  • Assignee set to Eric Hodel
  • Target version set to 2.0.0

#2 Updated by Zachary Scott over 1 year ago

Luis, can you confirm this on windows?

#3 Updated by Luis Lavena over 1 year ago

zzak (Zachary Scott) wrote:

Luis, can you confirm this on windows?

I don't think the Windows part is relevant but the documentation mistake.

You can confirm this here:

http://rubydoc.info/stdlib/core/Object:object_id

It says "Returns an integer identifier for obj" but then it says fixnum.

I've assigned to Eric Hodel to confirm is a bug in the documentation (or not) and act accordingly.

Thank you.

#4 Updated by Eric Hodel over 1 year ago

changing to Integer is fine with me. It seems to be a better type.

#5 Updated by Zachary Scott over 1 year ago

eric, you mean Fixnum right?

Or change rbobjid implementation to return INT2NUM((SIGNED_VALUE)obj);

#6 Updated by Eric Hodel over 1 year ago

"return a fixnum" is not a specification of #object_id so the more generic "integer" is better.

#7 Updated by Zachary Scott over 1 year ago

  • Status changed from Assigned to Closed
  • % Done changed from 0 to 100

This issue was solved with changeset r37987.
Heesob, thank you for reporting this issue.
Your contribution to Ruby is greatly appreciated.
May Ruby be with you.


  • gc.c: Documentation for GC, GC::Profiler, ObjectSpace, and ObjectSpace::WeakMap [Bug #7449]

Also available in: Atom PDF