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

225 Коммитов

Автор SHA1 Сообщение Дата
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
nobu 8ad06e2604 * error.c, thread_pthread.c (WRITE_CONST): suppress warnings
`ignoring return value'.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32346 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-06-30 23:03:23 +00:00
drbrain 9802a3e7de * lib/cmath.rb: Hide handle_no_method_error from RDoc.
* error.c:  Document or hide undocumented error classes.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32312 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-06-30 00:22:32 +00:00
ko1 c22126755c * error.c (rb_async_bug_errno): async-safe bug report function.
In timer thread, signal handler shoul use it.
  The patch is contributed by Eric Wong <normalperson@yhbt.net>.
  Refs: [ruby-core:37644] and [ruby-core:37647]
* thread_pthread.c: use rb_async_bug_errno().
  And replace all fprintf() to write().
* internal.h (rb_async_bug_errno): add decl. of above func.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32274 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-06-28 21:17:29 +00:00
akr e7996eb3cc * internal.h: declare internal functions here.
* node.h: declare NODE dependent internal functions here.

* iseq.h: declare rb_iseq_t dependent internal functions here.

* vm_core.h: declare rb_thread_t dependent internal functions here.

* bignum.c, class.c, compile.c, complex.c, cont.c, dir.c, encoding.c,
  enumerator.c, error.c, eval.c, file.c, gc.c, hash.c, inits.c, io.c,
  iseq.c, load.c, marshal.c, math.c, numeric.c, object.c, parse.y,
  proc.c, process.c, range.c, rational.c, re.c, ruby.c, string.c,
  thread.c, time.c, transcode.c, variable.c, vm.c,
  tool/compile_prelude.rb: don't declare internal functions declared
  in above headers.  include above headers if required.

  Note that rb_thread_mark() was declared as
  void rb_thread_mark(rb_thread_t *th) in cont.c but defined as
  void rb_thread_mark(void *ptr) in vm.c.  Now it is declared as
  the later in internal.h.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32156 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-06-17 22:43:38 +00:00
nobu e7c0a6e1d7 * prevent temporary objects from GC, and should not use
RSTRING_PTR() for function calls since it evaluates the argument
  a couple of times.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30922 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-02-20 07:23:55 +00:00
nobu 97b8e4996f * error.c (rb_invalid_str): prevent intermediate variable from GC.
[ruby-core:34820]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30641 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-01-24 12:04:47 +00:00
ryan 36a0e432f2 Exception#to_s should actually call to_s.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30531 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-01-12 22:05:05 +00:00
ryan 89d6841175 Error#to_s should ensure that the value returned is a string.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30455 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-01-05 05:18:48 +00:00
usa 90d5bcf910 * re.c (rb_reg_expr_str): need to escape if the coderage is invalid.
* error.c, include/ruby/intern.h (rb_compile_error_with_enc): new
	  function to raise syntax error, with source encoding'ed message.

	* parse.y (compile_error): use above function.
	  [ruby-core:33951] (#4217)


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30412 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-12-28 09:43:49 +00:00
nobu c5a19b38af * error.c (rb_check_type): check for type from extensions for ruby
1.8.  see [ruby-core:33797].

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30300 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-12-23 02:00:12 +00:00
kosaki 12b8ff1f46 * error.c: Fix build error for win32. This regression was
introduced by r30271.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30277 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-12-20 15:40:07 +00:00
kosaki 7503f19346 * error.c (exit_success_p): Check status code more carefully.
status code may have garbage in upper bit.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30271 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-12-20 14:49:18 +00:00
akr c4442536b2 * encoding.c: parenthesize macro arguments.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30181 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-12-12 02:54:23 +00:00
nobu b3c7867df7 * error.c (rb_syserr_new): new function to make SystemCallError
instance without errno.  [EXPERIMENTAL]
* error.c (rb_syserr_fail, rb_mod_syserr_fail): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29728 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-11-08 22:30:20 +00:00
nobu 58d3597e74 * include/ruby/intern.h (rb_check_frozen): optimize.
[ruby-core:32878]



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29582 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-10-24 08:05:55 +00:00
nobu d410639a6d * compile.c (iseq_build_body), error.c (set_syserr, get_syserr),
(syserr_initialize), gc.c (define_final, rb_gc_copy_finalizer),
  (run_final), hash.c (rb_hash_aref, rb_hash_lookup2),
  (rb_hash_fetch_m, rb_hash_clear, rb_hash_aset, eql_i),
  iseq.c (iseq_load, iseq_data_to_ary), marshal.c (r_symlink),
  thread.c (rb_thread_local_aref),
  variable.c (generic_ivar_remove, ivar_get, rb_const_get_0),
  (rb_cvar_get), vm.c (rb_vm_check_redefinition_opt_method),
  vm_insnhelper.c (vm_get_ev_const), vm_method.c (remove_method),
  ext/iconv/iconv.c (map_charset): use st_data_t.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29462 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-10-12 14:47:23 +00:00
naruse 681e551369 * error.c (exc_to_s): use OBJ_INFECT.
* error.c (name_err_to_s): ditto.

* error.c (name_err_mesg_to_str): ditto.

* error.c (syserr_initialize): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29456 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-10-12 12:39:22 +00:00
naruse 628c802eae * error.c (syserr_initialize): taint message if mesg is given
and it is tainted.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29455 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-10-12 10:09:31 +00:00
naruse c1b24588d3 * error.c (syserr_initialize): use mesg's encoding when locale
encoding is US-ASCII. If locale encoding is not US-ASCII,
  assume err has non ASCII characters. [ruby-dev:42358]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29439 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-10-11 08:43:31 +00:00
naruse 44691b901e * error.c (syserr_initialize): set the encoding of Errno::*#message
as locale. [ruby-dev:42358]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29438 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-10-11 05:15:03 +00:00
nobu 25b9eb5e57 * include/ruby/ruby.h (rb_data_type_t): restructured. [ruby-dev:41862]
add parent member.

* error.c (rb_typeddata_inherited_p): new function.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28676 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-07-18 07:31:54 +00:00
usa de26eababa * error.c (rb_bug): existance of _set_abort_behavior() depends on
runtime version, not compiler version.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28333 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-06-16 06:41:56 +00:00
akr d81b2491f7 * error.c (rb_name_err_mesg_new): guard mesg, recv and method.
The problem in [ruby-dev:41464] is caused because mesg is collected.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28163 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-06-05 02:01:29 +00:00
nobu 45f6fbf339 * removed trailing spaces.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28085 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-05-29 18:51:39 +00:00
tarui 47000e8aeb * error.c (rb_bug): suppress the error report dialog if report_bug()
is finished successfly.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28045 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-05-27 15:53:42 +00:00
akr 0344bece9f * error.c: fix wrong exception class name in rdoc.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27994 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-05-24 14:05:33 +00:00
marcandre c1ecff1b1e * hash.c: Documentation: change => in call-seq to ->.
* enum.c: Documentation: whitespace fix for r27865

* error.c: ditto

* file.c: ditto

* io.c: ditto

* load.c: ditto

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27869 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-05-17 21:31:22 +00:00
marcandre 7729de4d91 * array.c: Documentation: change => in call-seq to ->.
Harmonize "#=>" in examples. [ruby-core:30206]

* bignum.c: ditto

* class.c: ditto

* compar.c: ditto

* cont.c: ditto

* dir.c: ditto

* encoding.c: ditto

* enum.c: ditto

* enumerator.c: ditto

* error.c: ditto

* eval.c: ditto

* file.c: ditto

* gc.c: ditto

* io.c: ditto

* load.c: ditto

* marshal.c: ditto

* math.c: ditto

* numeric.c: ditto

* object.c: ditto

* pack.c: ditto

* proc.c: ditto

* process.c: ditto

* random.c: ditto

* range.c: ditto

* re.c: ditto

* ruby.c: ditto

* signal.c: ditto

* sprintf.c: ditto

* string.c: ditto

* struct.c: ditto

* thread.c: ditto

* time.c: ditto

* transcode.c: ditto

* variable.c: ditto

* vm_eval.c: ditto

* vm_method.c: ditto

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27865 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-05-17 21:07:33 +00:00
nobu 40caeb6bd1 * error.c (rb_loaderror): use locale string, not ascii-8bit.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27813 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-05-16 04:55:29 +00:00
marcandre 4afa9ed041 * array.c: Harmonize documentation, in particular regarding:
- methods returning enumerators
    - array methods and argument naming (array -> ary, an_array -> new_ary)
    - minor improvements, typo fixed and styling issues

  Other documentation errors fixed:
    - return value was self instead of a new array (or vice-versa) for
      Array#{pop,shift,permutation,repeated_permutation,keep_if}
    - Array#rindex was missing the form with a block.

* dir.c: ditto.

* enum.c: ditto. Modified Enumerable#reverse_each' documentation to clarify
  that #each will be finish before any element is yielded.

* error.c: ditto.

* gc.c: ditto.

* hash.c: ditto.

* io.c: ditto. IO#{codepoints,each_codepoint} fixed as per [ruby-core:23948]

* numeric.c: ditto.

* range.c: ditto.

* string.c: ditto.

* struct.c: ditto.

* vm_eval.c: ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27777 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-05-13 05:49:55 +00:00
marcandre 1dee5e34a3 * error.c: RDoc for subclasses of Exception. [ruby-core:28394]
* cont.c: ditto

* enumerator.c: ditto

* io.c: ditto

* math.c: ditto

* numeric.c: ditto

* proc.c: ditto

* re.c: ditto

* thread.c: ditto

* transcode.c: ditto. Thanks to Run Paint for some of the documentation.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27671 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-05-08 04:50:09 +00:00
nobu e8249be9fc * error.c (name_err_mesg_to_str): preserve encoding of inspection.
[ruby-core:29948]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27615 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-05-04 09:51:27 +00:00
akr 8f5865e251 * error.c: include errno.h at beginning.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25907 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-11-24 12:26:06 +00:00
akr ff9d908832 * include/ruby/ruby.h (rb_bug_errno): declared.
* include/ruby/intern.h (rb_strerrno): declaration removed.

* error.c (rb_strerrno): make it static.  return NULL for unknown
  errors.
  (rb_bug_errno): defined.

* thread_pthread.c: use rb_bug_errno.

* signal.c (ruby_signal): use rb_bug_errno.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25904 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-11-24 11:03:51 +00:00
nobu d7ffefb405 * error.c (rb_strerrno): constified.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25896 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-11-24 01:00:02 +00:00
akr 3861ba9f49 * error.c (rb_strerrno): return "UNKNOWNERROR" for non-zero unknown
error.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25895 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-11-24 00:50:26 +00:00
akr 3302b8fff5 * include/ruby/intern.h (rb_strerrno): declared.
* template/known_errors.inc.tmpl: generate defined_error() and
  undefined_error() instead of set_syserr.

* error.c (Init_syserr): define defined_error() and undefined_error()
  to follow the above change.
  (rb_strerrno): defined.

* thread_pthread.c: show error message and errno macro name with
  rb_bug.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25893 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-11-24 00:26:52 +00:00
matz 0580ba0611 * array.c (rb_ary_to_ary): do not use #respond_to? to detect
to_ary.  Just call.  [ruby-core:23738]

* eval.c (rb_check_funcall): new function with method existence
  check.  returns Qundef when the method does not exist.

* enumerator.c (enumerator_rewind): just call method, using
  rb_check_funcall().  [ruby-core:23738]

* error.c (exc_equal): ditto.

* object.c (convert_type): ditto.

* error.c (rb_name_err_mesg_new): export function.

* eval.c (make_exception): ditto.

* io.c (pop_last_hash): return early when the last argument is nil.

* io.c (rb_io_puts): treat T_STRING specially for small
  optimization. 

* vm_eval.c (raise_method_missing): skip method call if possible
  using rb_method_basic_definition_p().

* vm_eval.c (method_missing): ditto.

* test/ruby/test_rubyoptions.rb (TestRubyOptions#test_debug): test
  suites changed to ignore exceptions caused by just-call policy.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25556 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-10-29 04:55:10 +00:00
nobu 355047fb49 * error.c (name_err_mesg_data_type): typed.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24806 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-09-09 02:55:09 +00:00
nobu 081625d16e * error.c (compile_warn_print, warn_print): fixed false warnings.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24010 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-07-09 22:18:55 +00:00
nobu a7c32bf81d * error.c (rb_check_type): rejects typed data.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23992 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-07-08 10:10:28 +00:00
ko1 9e60743008 * include/ruby/ruby.h:
rename
  "...TypeStruct" and "typed_struct" to
  "TypedData..." and "typeddata", respectively.
  rename
  rb_data_type_t#name to
  rb_data_type_t#wrap_struct_name.
* error.c, gc.c, iseq.c, vm.c: ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23987 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-07-07 20:28:27 +00:00