Bug #123

Time.now <=> SimpleDelegator.new(Time.now)

Added by Anonymous over 6 years ago. Updated almost 4 years ago.

[ruby-dev:35011]
Status:Closed
Priority:Low
Assignee:Yukihiro Matsumoto
ruby -v: Backport:

Description

=begin
Time.now <=> SimpleDelegator.new(Time.now) が nil になるのは
SimpleDelegator.new(Time.now) <=> Time.now がそうならないの
と違ってよろしくないんじゃないでしょうか。

% ./ruby -rdelegate -ve '
t = Time.now
d = SimpleDelegator.new(Time.now)
p t <=> d
p d <=> t
'
ruby 1.9.0 (2008-06-09 revision 17043) [i686-linux]
/home/akr/ruby/yarvo0/lib/ruby/1.9.0/delegate.rb:225: warning: instance variable @delegate_sd_obj not initialized
nil
1
--
[田中 哲][たなか あきら][Tanaka Akira]
=end


Related issues

Follows Ruby trunk - Bug #431: Time.now <=> SimpleDelegator.new(Time.now) Closed

Associated revisions

Revision 9169
Added by Hiroshi Nakamura over 9 years ago

  • lib/{soap,wsdl,xsd}, test/{soap,wsdl,xsd}: imported soap4r/1.5.5.

      #nnn is a ticket number at http://dev.ctor.org/soap4r
    
      * SOAP
    
        * allow to configure an envelope namespace of SOAP request. (#124)
            TemporaryNamespace = 'http://www.w3.org/2003/05/soap-envelope'
            @client.options["soap.envelope.requestnamespace"] =
              TemporaryNamespace
            @client.options["soap.envelope.responsenamespace"] =
              TemporaryNamespace
            @client.do_proc(...)
    
        * let SOAP request XML indent space configuable.  see
          "soap.envelope.no_indent" option. (#130)
    
        * let external CES configuable.
          ex. client["soap.mapping.external_ces"] = 'SJIS'.  $KCODE is used
          by default. (#133)
            external CES ::= CES used in Ruby object of client and server
            internal CES ::= CES used in SOAP/OM
    
        * add iso-8859-1 external CES support. (#106)
    
        * fixed illegal 'qualified' handling of elements.  it caused
          ASP.NET inteoperability problem. (#144)
    
        * added 'soap.envelope.use_numeric_character_reference' (boolean)
          option to let query XML use numeric character reference in XML,
          not plain UTF-8 character.  !GoogleSearch server seems to not
          allow plain UTF-8 character since 2005-08-15 update. (#147)
    
        * SOAP::Header::SimpleHeader (de)serialization throws an exception
          on !SimpleHeader.on_(in|out)bound when header is a String.  so we
          could not use a simple single element headerItem.  fixed.  thanks
          to emil. (#129)
    
        * out parameter of rpc operation did not work.  (#132)
    
        * follow HTTP redirect only if using http-access2.  (#125) (#145)
    
        * add a workaround for importing an WSDL whose path begins with
          drive letter.  (#115)
    
      * WSDL
    
        * SOAP Data which is defined as a simpletype was not mapped
          correctly to Ruby obj when using wsdl2ruby.rb generated classdef
          file. (#123)
    
        * rpc/literal support. (#118)
    
        * re-implemented local element qualify/unqualify control.  handles
          elementFormDefault and form in WSDL.  (#119)
    
        * Array of an element which has simpleType causes a crash. (#128)
    
        * prarmeterOrder may not contain return part so it can be shorter
          than parts size.  Thanks to Hugh.  (#139)
    
      * Samples
    
        * added !BasicAuth client sample. (#117)
    
        * added Base64 client/server sample.
    
        * added Flickr SOAP interface client sample. (#122)
    
        * added !SalesForce client sample. (#135)
    
        * updated Thawte CA certificate for !GoogleAdWords sample.
    
        * updated a client script with the newer version made by Johan.
          thanks!
    
        * shortened long file names. (#120)
    
        * fixed typo in authheader sample. (#129)
    
        * updated deprecated method usage.  (#138)
    

Revision 9169
Added by Hiroshi Nakamura over 9 years ago

  • lib/{soap,wsdl,xsd}, test/{soap,wsdl,xsd}: imported soap4r/1.5.5.

      #nnn is a ticket number at http://dev.ctor.org/soap4r
    
      * SOAP
    
        * allow to configure an envelope namespace of SOAP request. (#124)
            TemporaryNamespace = 'http://www.w3.org/2003/05/soap-envelope'
            @client.options["soap.envelope.requestnamespace"] =
              TemporaryNamespace
            @client.options["soap.envelope.responsenamespace"] =
              TemporaryNamespace
            @client.do_proc(...)
    
        * let SOAP request XML indent space configuable.  see
          "soap.envelope.no_indent" option. (#130)
    
        * let external CES configuable.
          ex. client["soap.mapping.external_ces"] = 'SJIS'.  $KCODE is used
          by default. (#133)
            external CES ::= CES used in Ruby object of client and server
            internal CES ::= CES used in SOAP/OM
    
        * add iso-8859-1 external CES support. (#106)
    
        * fixed illegal 'qualified' handling of elements.  it caused
          ASP.NET inteoperability problem. (#144)
    
        * added 'soap.envelope.use_numeric_character_reference' (boolean)
          option to let query XML use numeric character reference in XML,
          not plain UTF-8 character.  !GoogleSearch server seems to not
          allow plain UTF-8 character since 2005-08-15 update. (#147)
    
        * SOAP::Header::SimpleHeader (de)serialization throws an exception
          on !SimpleHeader.on_(in|out)bound when header is a String.  so we
          could not use a simple single element headerItem.  fixed.  thanks
          to emil. (#129)
    
        * out parameter of rpc operation did not work.  (#132)
    
        * follow HTTP redirect only if using http-access2.  (#125) (#145)
    
        * add a workaround for importing an WSDL whose path begins with
          drive letter.  (#115)
    
      * WSDL
    
        * SOAP Data which is defined as a simpletype was not mapped
          correctly to Ruby obj when using wsdl2ruby.rb generated classdef
          file. (#123)
    
        * rpc/literal support. (#118)
    
        * re-implemented local element qualify/unqualify control.  handles
          elementFormDefault and form in WSDL.  (#119)
    
        * Array of an element which has simpleType causes a crash. (#128)
    
        * prarmeterOrder may not contain return part so it can be shorter
          than parts size.  Thanks to Hugh.  (#139)
    
      * Samples
    
        * added !BasicAuth client sample. (#117)
    
        * added Base64 client/server sample.
    
        * added Flickr SOAP interface client sample. (#122)
    
        * added !SalesForce client sample. (#135)
    
        * updated Thawte CA certificate for !GoogleAdWords sample.
    
        * updated a client script with the newer version made by Johan.
          thanks!
    
        * shortened long file names. (#120)
    
        * fixed typo in authheader sample. (#129)
    
        * updated deprecated method usage.  (#138)
    

Revision 15141
Added by Sean Russell about 7 years ago

r1479@bean: ser | 2008-01-19 14:26:31 -0500

r1483@bean: ser | 2008-01-19 14:47:23 -0500
Sam's fixes:
* Don't blow up on empty documents
* Add a test case for sorted attributes
* Making the output predictable simplifies unit tests, and doesn't cost
much given that most xml element have few attributes
* Ruby 1.9 revision 14922 is more strict
* Complete Ticket #134
* Fix for ticket #121
* Fix for ticket #124
* Fix for ticket #128
* Fix ticket #133
* Ticket #131 (Support Ruby 1.9)
* Fix for ticket #127
* Fix for ticket #123
* Add missing data needed by test case

r1481@bean (orig r1303): ser | 2008-01-19 17:22:32 -0500
Tagged for release
r1482@bean (orig r1304): ser | 2008-01-19 17:27:10 -0500
Version bump

Revision 15141
Added by Sean Russell about 7 years ago

r1479@bean: ser | 2008-01-19 14:26:31 -0500

r1483@bean: ser | 2008-01-19 14:47:23 -0500
Sam's fixes:
* Don't blow up on empty documents
* Add a test case for sorted attributes
* Making the output predictable simplifies unit tests, and doesn't cost
much given that most xml element have few attributes
* Ruby 1.9 revision 14922 is more strict
* Complete Ticket #134
* Fix for ticket #121
* Fix for ticket #124
* Fix for ticket #128
* Fix ticket #133
* Ticket #131 (Support Ruby 1.9)
* Fix for ticket #127
* Fix for ticket #123
* Add missing data needed by test case

r1481@bean (orig r1303): ser | 2008-01-19 17:22:32 -0500
Tagged for release
r1482@bean (orig r1304): ser | 2008-01-19 17:27:10 -0500
Version bump

History

#1 Updated by Yukihiro Matsumoto over 6 years ago

  • Assignee set to Yukihiro Matsumoto

=begin

=end

#2 Updated by Yukihiro Matsumoto over 6 years ago

  • Status changed from Open to Closed

=begin

=end

#3 Updated by _ wanabe over 6 years ago

=begin
ワナベと申します。

2008/06/09 15:56 Tanaka Akira akr@fsij.org:

Time.now <=> SimpleDelegator.new(Time.now) が nil になるのは
SimpleDelegator.new(Time.now) <=> Time.now がそうならないの
と違ってよろしくないんじゃないでしょうか。

パッチを書いてみましたが rb_funcall が多く、結果がコストに見合っていない気がします。
なにか良い方法をご存知の方は教えていただけるとありがたいです。

Index: time.c
===================================================================
--- time.c (revision 18196)
+++ time.c (working copy)
@@ -1087,7 +1087,16 @@
if (tobj1->ts.tv_sec > tobj2->ts.tv_sec) return INT2FIX(1);
return INT2FIX(-1);
}
+ else if (RTEST(rb_funcall(time2, rb_intern("kind_of?"), 1, rb_cTime))) {
+ VALUE tmp = rb_funcall(time2, rb_intern("<=>"), 1, time1);

  • if (NIL_P(tmp)) return Qnil;
  • if (!FIXNUM_P(tmp)) {
  • return rb_funcall(LONG2FIX(0), '-', 1, tmp);
  • }
  • return LONG2NUM(-FIX2LONG(tmp));
  • }
    +
    return Qnil;
    }

    ワナベ

=end

Also available in: Atom PDF