* eval.c (method_inspect): should not dump core for unbound

singleton methods.

* object.c (rb_mod_to_s): better description.

* hash.c (env_select): should path the assoc list.

* process.c (rb_syswait): thread kludge; should be fixed to
  support native thread.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2128 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
matz 2002-02-25 09:16:25 +00:00
Родитель aaa30fd040
Коммит 6d47b8a9cc
6 изменённых файлов: 63 добавлений и 27 удалений

Просмотреть файл

@ -17,8 +17,8 @@ You can redistribute it and/or modify it under either the terms of the GPL
b) use the modified software only within your corporation or b) use the modified software only within your corporation or
organization. organization.
c) rename any non-standard binaries so the names do not conflict c) give non-standard binaries non-standard names, with
with standard binaries, which must also be provided. instructions on where to get the original software distribution.
d) make other distribution arrangements with the author. d) make other distribution arrangements with the author.

Просмотреть файл

@ -1,12 +1,28 @@
Mon Feb 25 15:14:01 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
* eval.c (method_inspect): should not dump core for unbound
singleton methods.
* object.c (rb_mod_to_s): better description.
Mon Feb 25 13:32:13 2002 Nobuyoshi Nakada <nobu.nakada@nifty.ne.jp> Mon Feb 25 13:32:13 2002 Nobuyoshi Nakada <nobu.nakada@nifty.ne.jp>
* lib/shell.rb (Shell::expand_path): relative to @cwd. * lib/shell.rb (Shell::expand_path): relative to @cwd.
Mon Feb 25 06:30:11 2002 Koji Arai <jca02266@nifty.ne.jp>
* hash.c (env_select): should path the assoc list.
Sun Feb 24 17:20:22 2002 Akinori MUSHA <knu@iDaemons.org> Sun Feb 24 17:20:22 2002 Akinori MUSHA <knu@iDaemons.org>
* ext/digest/*/*.h: Merge from rough. * ext/digest/*/*.h: Merge from rough.
- Avoid namespace pollution. (MD5_* -> rb_Digest_MD5_*, etc.) - Avoid namespace pollution. (MD5_* -> rb_Digest_MD5_*, etc.)
Sat Feb 23 21:12:13 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
* process.c (rb_syswait): thread kludge; should be fixed to
support native thread.
Fri Feb 22 21:20:53 2002 Minero Aoki <aamine@loveruby.net> Fri Feb 22 21:20:53 2002 Minero Aoki <aamine@loveruby.net>
* lib/net/protocol.rb: set read_timeout dynamically. * lib/net/protocol.rb: set read_timeout dynamically.

31
eval.c
Просмотреть файл

@ -6941,28 +6941,33 @@ method_inspect(method)
rb_str_buf_cat2(str, ": "); rb_str_buf_cat2(str, ": ");
if (FL_TEST(data->klass, FL_SINGLETON)) { if (FL_TEST(data->klass, FL_SINGLETON)) {
VALUE v; VALUE v = rb_iv_get(data->klass, "__attached__");
rb_str_buf_append(str, rb_inspect(data->recv)); if (data->recv == Qundef) {
v = rb_iv_get(data->klass, "__attached__"); rb_str_buf_append(str, rb_inspect(data->klass));
if (data->recv != v) { }
rb_str_buf_cat2(str, "("); else if (data->recv == v) {
rb_str_buf_append(str, rb_inspect(v)); rb_str_buf_append(str, rb_inspect(v));
rb_str_buf_cat2(str, ")."); sharp = ".";
} }
else { else {
rb_str_buf_cat2(str, "."); rb_str_buf_append(str, rb_inspect(data->recv));
rb_str_buf_cat2(str, "(");
rb_str_buf_append(str, rb_inspect(v));
rb_str_buf_cat2(str, ")");
sharp = ".";
} }
} }
else { else {
rb_str_buf_cat2(str, rb_class2name(data->rklass)); rb_str_buf_cat2(str, rb_class2name(data->rklass));
rb_str_buf_cat2(str, "("); if (data->rklass != data->klass) {
s = rb_class2name(data->klass); rb_str_buf_cat2(str, "(");
rb_str_buf_cat2(str, s); rb_str_buf_cat2(str, rb_class2name(data->klass));
rb_str_buf_cat2(str, ")#"); rb_str_buf_cat2(str, ")");
}
} }
s = rb_id2name(data->oid); rb_str_buf_cat2(str, sharp);
rb_str_buf_cat2(str, s); rb_str_buf_cat2(str, rb_id2name(data->oid));
rb_str_buf_cat2(str, ">"); rb_str_buf_cat2(str, ">");
return str; return str;

8
hash.c
Просмотреть файл

@ -1327,10 +1327,10 @@ env_select(argc, argv)
while (*env) { while (*env) {
char *s = strchr(*env, '='); char *s = strchr(*env, '=');
if (s) { if (s) {
VALUE str = rb_tainted_str_new(*env, s-*env); VALUE assoc = rb_assoc_new(rb_tainted_str_new(*env, s-*env),
rb_tainted_str_new2(s+1));
if (RTEST(rb_yield(str))) { if (RTEST(rb_yield(assoc))) {
rb_ary_push(result, str); rb_ary_push(result, assoc);
} }
} }
env++; env++;

Просмотреть файл

@ -500,9 +500,17 @@ rb_mod_to_s(klass)
{ {
if (FL_TEST(klass, FL_SINGLETON)) { if (FL_TEST(klass, FL_SINGLETON)) {
VALUE s = rb_str_new2("#<"); VALUE s = rb_str_new2("#<");
VALUE v = rb_iv_get(klass, "__attached__");
rb_str_cat2(s, "Class:"); rb_str_cat2(s, "Class:");
rb_str_cat2(s, rb_class2name(klass)); switch (TYPE(v)) {
case T_CLASS: case T_MODULE:
rb_str_append(s, rb_inspect(v));
break;
default:
rb_str_append(s, rb_any_to_s(v));
break;
}
rb_str_cat2(s, ">"); rb_str_cat2(s, ">");
return s; return s;

Просмотреть файл

@ -768,29 +768,36 @@ void
rb_syswait(pid) rb_syswait(pid)
int pid; int pid;
{ {
static int overriding;
RETSIGTYPE (*hfunc)_((int)), (*qfunc)_((int)), (*ifunc)_((int)); RETSIGTYPE (*hfunc)_((int)), (*qfunc)_((int)), (*ifunc)_((int));
int status; int status;
int i; int i, hooked = Qfalse;
if (!overriding) {
#ifdef SIGHUP #ifdef SIGHUP
hfunc = signal(SIGHUP, SIG_IGN); hfunc = signal(SIGHUP, SIG_IGN);
#endif #endif
#ifdef SIGQUIT #ifdef SIGQUIT
qfunc = signal(SIGQUIT, SIG_IGN); qfunc = signal(SIGQUIT, SIG_IGN);
#endif #endif
ifunc = signal(SIGINT, SIG_IGN); ifunc = signal(SIGINT, SIG_IGN);
overriding = Qtrue;
hooked = Qtrue;
}
do { do {
i = rb_waitpid(pid, &status, 0); i = rb_waitpid(pid, &status, 0);
} while (i == -1 && errno == EINTR); } while (i == -1 && errno == EINTR);
if (hooked) {
#ifdef SIGHUP #ifdef SIGHUP
signal(SIGHUP, hfunc); signal(SIGHUP, hfunc);
#endif #endif
#ifdef SIGQUIT #ifdef SIGQUIT
signal(SIGQUIT, qfunc); signal(SIGQUIT, qfunc);
#endif #endif
signal(SIGINT, ifunc); signal(SIGINT, ifunc);
}
} }
static VALUE static VALUE