* error.c (errno_missing): Errno.const_missing to allow references

to SyscallError exceptions not defined on the platform.
  [ruby-core:04522]

* error.c (Init_syserr): Errno::NOERROR(0) for fallback exception.

* eval.c (block_pass): should not push unique number if a block is
  not an orphan.  [ruby-dev:25808]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@8112 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
matz 2005-03-08 01:46:33 +00:00
parent 2a91610f3a
commit 2f2cc0ddfc
4 changed files with 27 additions and 3 deletions

View File

@ -1,3 +1,11 @@
Tue Mar 8 10:05:40 2005 Yukihiro Matsumoto <matz@ruby-lang.org>
* error.c (errno_missing): Errno.const_missing to allow references
to SyscallError exceptions not defined on the platform.
[ruby-core:04522]
* error.c (Init_syserr): Errno::NOERROR(0) for fallback exception.
Sat Mar 8 01:19:00 2005 NARUSE, Yui <naruse@ruby-lang.org> Sat Mar 8 01:19:00 2005 NARUSE, Yui <naruse@ruby-lang.org>
* ext/nkf/nkf-utf8/nkf.c: follow nkf 1.66 * ext/nkf/nkf-utf8/nkf.c: follow nkf 1.66
@ -22,6 +30,11 @@ Mon Mar 7 16:46:02 2005 NAKAMURA Usaku <usa@ruby-lang.org>
* ext/openssl/ossl_ssl.c (ossl_start_ssl, ossl_ssl_read, * ext/openssl/ossl_ssl.c (ossl_start_ssl, ossl_ssl_read,
ossl_ssl_write): need to set errno on Win32 platform. ossl_ssl_write): need to set errno on Win32 platform.
Mon Mar 7 14:55:43 2005 Yukihiro Matsumoto <matz@ruby-lang.org>
* eval.c (block_pass): should not push unique number if a block is
not an orphan. [ruby-dev:25808]
Mon Mar 7 14:13:23 2005 GOTOU Yuuzou <gotoyuzo@notwork.org> Mon Mar 7 14:13:23 2005 GOTOU Yuuzou <gotoyuzo@notwork.org>
* ext/openssl/lib/openssl/buffering.rb (Buffering#initialize): * ext/openssl/lib/openssl/buffering.rb (Buffering#initialize):

10
error.c
View File

@ -312,6 +312,7 @@ VALUE rb_eLoadError;
VALUE rb_eSystemCallError; VALUE rb_eSystemCallError;
VALUE rb_mErrno; VALUE rb_mErrno;
static VALUE eNOERROR;
VALUE VALUE
rb_exc_new(etype, ptr, len) rb_exc_new(etype, ptr, len)
@ -1016,6 +1017,13 @@ syserr_eqq(self, exc)
return Qfalse; return Qfalse;
} }
static VALUE
errno_missing(self, id)
VALUE self, id;
{
return eNOERROR;
}
/* /*
* Descendents of class <code>Exception</code> are used to communicate * Descendents of class <code>Exception</code> are used to communicate
* between <code>raise</code> methods and <code>rescue</code> * between <code>raise</code> methods and <code>rescue</code>
@ -1085,6 +1093,7 @@ Init_Exception()
rb_define_singleton_method(rb_eSystemCallError, "===", syserr_eqq, 1); rb_define_singleton_method(rb_eSystemCallError, "===", syserr_eqq, 1);
rb_mErrno = rb_define_module("Errno"); rb_mErrno = rb_define_module("Errno");
rb_define_singleton_method(rb_mErrno, "const_missing", errno_missing, 1);
rb_define_global_function("warn", rb_warn_m, 1); rb_define_global_function("warn", rb_warn_m, 1);
} }
@ -1587,6 +1596,7 @@ Init_syserr()
#ifdef EDQUOT #ifdef EDQUOT
set_syserr(EDQUOT, "EDQUOT"); set_syserr(EDQUOT, "EDQUOT");
#endif #endif
eNOERROR = set_syserr(0, "NOERROR");
} }
static void static void

2
eval.c
View File

@ -8598,7 +8598,7 @@ rb_block_pass(func, arg, proc)
/* PUSH BLOCK from data */ /* PUSH BLOCK from data */
_block = *data; _block = *data;
_block.outer = ruby_block; _block.outer = ruby_block;
_block.uniq = block_unique++; if (orphan) _block.uniq = block_unique++;
ruby_block = &_block; ruby_block = &_block;
PUSH_ITER(ITER_PRE); PUSH_ITER(ITER_PRE);
if (ruby_frame->iter == ITER_NOT) if (ruby_frame->iter == ITER_NOT)

View File

@ -12,8 +12,9 @@ module ParseDate
def strptime(str, format) def strptime(str, format)
Date._strptime(str, format). d = Date._strptime(str, format)
values_at(:year, :mon, :mday, :hour, :min, :sec, :zone, :wday) raise ArgumentError, "invalid strptime format - `#{format}'" unless d
d.values_at(:year, :mon, :mday, :hour, :min, :sec, :zone, :wday)
end end
module_function :parsedate, :strptime module_function :parsedate, :strptime