Граф коммитов

267 Коммитов

Автор SHA1 Сообщение Дата
nobu c7c3a275f3 error.c: rb_sys_fail_path_in
* error.c (syserr_initialize): add optional function name.

* error.c (rb_sys_fail_path_in): rename and move from file.c, and pass
  func_name to SystemCallError#initialize.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39763 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-03-15 11:19:56 +00:00
zzak 47809f0934 * error.c: clarify reason for sleep in SignalException example
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39502 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-02-25 19:52:11 +00:00
kosaki ffbd120efd * error.c: clarify a document of SignalException. Process.kill()
doesn't have any guarantee when signal will be delivered.
  [Bug #7951] [ruby-core:52864]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39501 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-02-25 18:43:41 +00:00
marcandre c34e9f23aa * object.c: Improve error for failed implicit conversions [Bug #7539]
* error.c: Adapt rdoc

* test/ruby/test_object.rb: Test for above

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38979 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-01-29 22:00:58 +00:00
nobu 320b49473e error.c: rb_write_error_str
* error.c (compile_err_append, compile_warn_print, warn_print): use
  rb_write_error_str() instead of writing to rb_stderr directly.
* io.c (rb_write_error_str): a stopgap measure not to unblock GVL.
  warning from require seems to still have race condition errors.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38590 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-12-25 04:38:18 +00:00
nobu d2fa4d7118 error.c: NameError::message _dump
* error.c (name_err_mesg_dump): adapt argument number.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38584 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-12-24 15:58:15 +00:00
nobu 427bcc40ac error.c: VALUE to messages
* error.c (name_err_mesg_to_str, syserr_initialize): use VALUE to
  format messages.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38582 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-12-24 15:57:51 +00:00
nobu e9381c0559 * error.c (rb_compile_error_append): fix typo.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38580 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-12-23 22:23:52 +00:00
nobu 1df33a4a5f error.c: PRIsVALUE
* error.c (rb_compile_error, rb_compile_warn, rb_compile_warning),
  (rb_warn, rb_warning): support PRIsVALUE.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38557 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-12-22 14:59:21 +00:00
nobu 5a5a86cc52 hash.c: refine error messages
* hash.c (rb_hash_s_create): refine error messages.
* error.c (rb_builtin_class_name): share for above.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37620 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-11 06:38:17 +00:00
shugo a1ed68b931 * error.c (exc_to_s, name_err_to_s, name_err_mesg_to_str): do not
taint messages.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37068 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-10-02 17:25:10 +00:00
nobu 0ff0133984 fix typo
* error.c (rb_builtin_type_name): fix typo.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36442 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-07-18 09:25:18 +00:00
nobu 6e018e3f49 error.c: map by index
* error.c (rb_builtin_type_name): map by index.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36441 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-07-18 08:45:29 +00:00
nobu 13bc74fa74 rb_builtin_type_name
* error.c (rb_builtin_type_name): extract from rb_check_type() for
  debug purpose.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36249 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-29 02:26:46 +00:00
nobu 77898c33e3 error.c: rb_check_copyable
* error.c (rb_check_copyable): new function, to ensure the target is
  not frozen and the source is not tainted nor untrusted.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36174 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-22 04:32:39 +00:00
ko1 0cfee32828 * error.c (err_append): rename err_append() to compile_err_append()
and move definition body.  err_append() is used only by compiling.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36158 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-06-20 22:25:46 +00:00
drbrain 9e84f83736 * error.c (exc_set_backtrace): Updated documentation to indicate
set_backtrace allows a string as well as an array of strings.
  [ruby-trunk - Bug #6501]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35837 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-05-29 21:20:45 +00:00
nobu 80aaa3ef6c sprintf.c: inspect by plus
* sprintf.c (ruby__sfvextra): [EXPERIMENTAL] use inspect instead of
  to_s if plus flag is given.
* vsnprintf.c (BSD_vfprintf): pass sign flag.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35779 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-05-24 16:15:42 +00:00
nobu ce8e2d5404 Feature #5896
* vsnprintf.c (BSD_vfprintf): [EXPERIMENTAL] object representation in
  rb_enc_vsprintf(). [Feature #5896]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35776 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-05-24 14:36:54 +00:00
ko1 d5893b91fa * vm_method.c (rb_method_defined_by): removed.
nobu pointed out that rb_method_basic_definition_p() is enough
  for last commit.
* error.c, eval_error.c: change for above.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35770 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-05-24 06:36:44 +00:00
ko1 3dcebce523 * vm.c: add RubyVM::Backtrace object (btobj).
Backtrace information contains an array consists of location
  information for each frames by string.
  RubyVM::Backtrace object is lightweight backtrace information,
  which contains complete information to generate traditional style
  backtrace (an array of strings) with faster generation.
  If someone accesses to backtrace information via
  Exception#backtrace, then convert a RubyVM::Backtrace object to
  traditonal style backtrace.
  This change causes incompatibility on marshal dumpped binary
  of Exception.  If you have any trouble on it, please tell us
  before Ruby 2.0 release.
  Note that RubyVM::Backtrace object should not expose Ruby level.
* error.c, eval.c, vm_eval.c: ditto.
* internal.h: ditto.
* eval_error.c: fix to skip "set_backtrace" method invocation in
  creating an exception object if it call a normal set_backtrace
  method (defined by core).
* test/ruby/test_settracefunc.rb: fix for above change.
* vm_method.c (rb_method_defined_by): added.  This function
  checks that the given object responds with the given method
  by the given cfunc.
* benchmark/bm_vm2_raise1.rb, benchmark/bm_vm2_raise2.rb:
  add to measure exception creation speed. raise1 create
  exception objects from shallow stack frame.  raise2 create
  exception objects from deep stack frame.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35769 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-05-24 06:09:23 +00:00
nobu b0dd250dc9 use RB_TYPE_P() instead of comparison of TYPE()
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35763 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-05-23 07:13:21 +00:00
nobu 72fffe5cee * configure.in (RUBY_MSVCRT_VERSION): define on mingw too.
* win32/Makefile.sub (config.h): prefix RT_VER with RUBY and make
  more descriptive to get rid of potential conflict.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35347 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-04-16 07:08:27 +00:00
nobu 24476c0c0b * eval_error.c (error_print): use RB_TYPE_P instead of TYPE.
* error.c (rb_check_backtrace): ditto.
* error.c (name_err_mesg_to_str): compare immediate values
  directly.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35319 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-04-13 15:34:34 +00:00
nobu f45fc7daa0 * error.c (rb_enc_raise): new function to raise an exception with
the message in the given encoding.  patched by now (Nikolai
  Weibull) at [ruby-core:41160].  [Feature #5650]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35283 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-04-10 10:07:07 +00:00
nobu 075d98c7dc * error.c (rb_load_fail): should honor encoding.
* load.c (load_failed): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34944 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-03-07 07:30:31 +00:00
nobu 72de92d1f9 rb_load_fail
* error.c (rb_load_fail): use path as a string, not char*.
* internal.h: (rb_load_fail): moved from ruby/intern.h.
* ruby.c (load_file_internal): fname cannot be NULL.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34941 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-03-07 03:26:30 +00:00
tenderlove d576a25c26 * error.c (rb_loaderror_with_path): Adding the missing file as an
instance variable to the LoadError exception.

* load.c: call rb_loaderror_with_path so that the missing path is
  added to the exception.

* ruby.c: call rb_loaderror rather than raising our own LoadError
  exception.

* include/ruby/intern.h: add declaration for rb_loaderror_with_path.

* test/ruby/test_require.rb: add supporting test for LoadError#path
  method.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34938 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-03-06 23:38:33 +00:00
naruse d068ac8e0c * error.c (report_bug): use buf and snprintf to avoid consuming stack.
[ruby-dev:45272] [Bug #6058]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34817 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-02-25 20:37:15 +00:00
nobu 85738261a5 * dir.c (dir_initialize): keep path in original encoding.
* error.c (syserr_initialize): prefer the encoding of message over
  locale.  [ruby-dev:45279][Bug #6071]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34794 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-02-24 22:53:42 +00:00
nobu 7d742d47cc * error.c: new functions to deal exceptions with string instances.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34787 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-02-24 07:39:59 +00:00
ayumin 89a2a10508 * error.c (exc_inspect): Fix typo. patch from Trent Ogren
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34462 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-02-07 11:13:40 +00:00
nagachika 15e1ff7f23 * error.c (exc_equal): clear rb_thread_t::errinfo when ignore
an exception under rb_protect(). [ruby-core:41979] [Bug #5865]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34301 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-01-14 09:36:18 +00:00
nobu f2aa0fd5d4 * error.c (exc_equal): ignore exceptions during implicit
conversion.  [ruby-core:41979] [Bug #5865]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34299 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-01-14 03:00:24 +00:00
naruse 1648e9442d Revert "* error.c (exc_equal): try implicit conversion for delegator."
This reverts commit r34291 because it breaks objects whose "exception"
method doesn't allow no argument like XMLRPC::FaultException class.
To reproduce: `RuntimeError.new == XMLRPC::FaultException`.
[ruby-core:41979] [Bug #5865]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34298 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-01-13 23:41:55 +00:00
nobu a5bfe7ca83 * error.c (exc_equal): try implicit conversion for delegator.
[ruby-core:41979] [Bug #5865]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34291 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-01-13 07:44:50 +00:00
nagachika d95ce7fc03 * error.c (builtin_type_name): don't return pointer to the buffer of
temporary String object.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34056 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-12-15 14:19:59 +00:00
nobu 2a5ddef59f * error.c (rb_check_type): fix typo.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34054 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-12-15 08:40:29 +00:00
nobu 9dccfb5513 * error.c (rb_check_typeddata): refine error message with
including expected struct name.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34052 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-12-15 05:33:34 +00:00
nagachika d61d9d5e8e * error.c (name_err_mesg_to_str): clear rb_thread_t::errinfo when
ignore exception under rb_protect().

* test/ruby/test_exception.rb (test_exception_in_name_error_to_str):
  add a corresponding test.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34028 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-12-13 14:50:12 +00:00
nobu ea82d4809d * error.c (exit_initialize): deal with true and false as well as
Kernel#exit.  [ruby-dev:44951] [Bug #5728]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34008 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-12-11 01:48:21 +00:00
akr 63fe8b697c update doc and add test for SystemExit.new.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33985 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-12-08 13:50:10 +00:00
drbrain 34fb36422d * error.c (Init_Exception): Document $! and $@. Provide
recommendations for creating exceptions for a library.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33482 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-10-19 02:52:38 +00:00
drbrain 62bd3dd4af * error.c (Init_Exception): Add hierarchy of Exception subclasses.
Based on patch by Sylvain Daubert.  [Ruby 1.9 - Bug #5438]


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33481 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-10-19 02:32:39 +00:00
nobu 8e6e8e6288 * use RB_TYPE_P which is optimized for constant types, instead of
comparison with TYPE.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33357 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-09-29 11:07:45 +00:00
kosaki 3abbda4f6e * error.c (report_bug): use a small message buffer instead of BUFSIZ.
It is needed for avoiding nested SIGSEGV on Linux.
  Note: BUFSIZ is not proper buffer size. It's unrelated with maximum
  filename length. :-/
  [Bug #5139] [ruby-dev:44315]



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32844 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-08-04 11:23:16 +00:00
nobu 4dc1a21809 * error.c (rb_name_error_str): new function to raise NameError
with the name string but not ID.
* object.c, proc.c, variable.c: more removal of inadvertent symbol
  creation.  [Feature #5079]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32645 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-07-23 15:05:03 +00:00
nobu e2fd80b3d3 * error.c (rb_check_trusted): new function to check an object is
trusted.
* struct.c (rb_struct_modify), time.c (time_modify): check by the
  above function to show proper class names.  [Bug #5036]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32569 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-07-17 07:26:45 +00:00
nobu 18f0a65018 * error.c (rb_warn_m): accept multiple args in like puts. rdoc
patch by Erik Price at [ruby-core:38119].  [Feature #5029]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32568 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-07-17 06:30:10 +00:00
nobu 9878d2199c * error.c (rb_bug): get rid of segfault after all threads
disposed.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32453 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-07-08 06:53:33 +00:00