Project

General

Profile

Bug #11935 ยป date-new-argument-errors.patch

Patch to ext/date/date_core.c from ruby 2.4.0dev - CJKinni (Christopher Kinniburgh), 12/31/2015 06:01 PM

View differences:

ext/date/date_core.c (working copy)
3398 3398
    fr2 = INT2FIX(0);
3399 3399
    sg = DEFAULT_SG;
3400 3400

  
3401

  
3401 3402
    switch (argc) {
3402 3403
      case 4:
3403
	val2sg(vsg, sg);
3404
        val2sg(vsg, sg);
3404 3405
      case 3:
3405
	num2int_with_frac(d, positive_inf);
3406
        if (!(TYPE(vd) == T_FLOAT || 
3407
              TYPE(vd) == T_FIXNUM || 
3408
              TYPE(vd) == T_BIGNUM)) { 
3409
          rb_raise(rb_eArgError, "invalid day"); 
3410
        }
3411
        num2int_with_frac(d, positive_inf);
3406 3412
      case 2:
3407
	m = NUM2INT(vm);
3413
        if (!(TYPE(vm) == T_FLOAT || 
3414
              TYPE(vm) == T_FIXNUM || 
3415
              TYPE(vm) == T_BIGNUM)) { 
3416
          rb_raise(rb_eArgError, "invalid month"); 
3417
        }
3418
        m = NUM2INT(vm);
3408 3419
      case 1:
3409
	y = vy;
3420
        if (!(TYPE(vy) == T_FLOAT || 
3421
              TYPE(vy) == T_FIXNUM || 
3422
              TYPE(vy) == T_BIGNUM)) { 
3423
          rb_raise(rb_eArgError, "invalid year"); 
3424
        }
3425
        y = vy;
3410 3426
    }
3411 3427

  
3412 3428
    if (guess_style(y, sg) < 0) {