Date.parse(nil) raises TypeError

Discussion in 'Ruby' started by Victor Kryukov, Apr 28, 2010.

  1. Hello,

    in Ruby 1.9 (ruby 1.9.1p378 (2010-01-10 revision 26273) [i386-
    mingw32])

    the following code

    require 'date'
    Date.parse(nil)

    raises TypeError: can't dup NilClass. I think it should be
    "ArgumentError: invalid date", same as what Date.parse reports for
    strings with invalid date formats. Should I file a bug report?
     
    Victor Kryukov, Apr 28, 2010
    #1
    1. Advertising

  2. Victor Kryukov

    Ryan Davis Guest

    On Apr 27, 2010, at 19:00 , Victor Kryukov wrote:

    > Hello,
    >=20
    > in Ruby 1.9 (ruby 1.9.1p378 (2010-01-10 revision 26273) [i386-
    > mingw32])
    >=20
    > the following code
    >=20
    > require 'date'
    > Date.parse(nil)
    >=20
    > raises TypeError: can't dup NilClass. I think it should be
    > "ArgumentError: invalid date", same as what Date.parse reports for
    > strings with invalid date formats. Should I file a bug report?


    sure. you can even provide a patch that raises the exception you'd =
    rather see. post your idea to ruby-core@
     
    Ryan Davis, Apr 28, 2010
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. OKB (not okblacke)

    deepcopy raises TypeError for method/function?

    OKB (not okblacke), Sep 9, 2004, in forum: Python
    Replies:
    3
    Views:
    422
    Alex Martelli
    Sep 10, 2004
  2. Mike Brown
    Replies:
    6
    Views:
    530
    =?UTF-8?B?Ik1hcnRpbiB2LiBMw7Z3aXMi?=
    Feb 23, 2005
  3. Brian Candler

    puts nil generates "nil\n"

    Brian Candler, Nov 6, 2004, in forum: Ruby
    Replies:
    1
    Views:
    124
  4. John Carter
    Replies:
    64
    Views:
    697
    Klaus Stein
    May 19, 2005
  5. Christoffer Sawicki
    Replies:
    5
    Views:
    287
    Christoffer Sawicki
    Sep 2, 2006
Loading...

Share This Page