aboutsummaryrefslogtreecommitdiffstats
path: root/error.c
Commit message (Collapse)AuthorAgeFilesLines
...
* Revert "[DOC] Added Exception.exception to Exception.new [ci skip]"Yusuke Endoh2020-06-181-3/+2
| | | | | | This reverts commit 957825639c1422777c09578d4a03adf571eac55d. Do not use [ci skip]!!!!
* [DOC] Added Exception.exception to Exception.new [ci skip]Nobuyoshi Nakada2020-06-181-2/+3
|
* [DOC] argument to Exception#excepton is optional [ci skip]Nobuyoshi Nakada2020-06-181-1/+1
|
* Updated builtin type namesNobuyoshi Nakada2020-06-161-2/+2
| | | | Fixnum and Bignum have been unified to Integer already.
* Use receiver #name rather than #inspect to build NameError messageJean Boussier2020-05-261-1/+14
|
* Merge pull request #3047 from mame/suppress-backtraceYusuke Endoh2020-05-151-0/+1
| | | Add `--suppress-backtrace=num` option to limit the backtrace length
* Remove the 65 size limit for name_err_mesg_to_strJean Boussier2020-05-111-1/+1
| | | | | | | | | | | | | This limit was introduced on Nov 20 1996 in 554b989ba1623b9f6a0b76f00824c83a23fbcbc1 Apparently to protect from a buffer overflow: * eval.c (f_missing): オブジェクトの文字列表現が長すぎる時バッファ を書き潰していた However I tested that path with very large strings and it works fine.
* sed -i 's|ruby/impl|ruby/internal|'卜部昌平2020-05-111-1/+1
| | | | To fix build failures.
* sed -i s|ruby/3|ruby/impl|g卜部昌平2020-05-111-1/+1
| | | | This shall fix compile errors.
* Added rb_syserr_new_pathNobuyoshi Nakada2020-04-151-1/+7
| | | | | Similar to rb_syserr_fail_path, but just returns the created exception instance instead of raising it.
* Merge pull request #2991 from shyouhei/ruby.h卜部昌平2020-04-081-1/+1
| | | Split ruby.h
* Added rb_warn_deprecated_to_removeNobuyoshi Nakada2020-01-231-2/+16
| | | | | Warn the deprecation and future removal, with obeying the warning flag.
* Make taint warnings non-verbose instead of verboseJeremy Evans2020-01-221-2/+2
|
* support RUBY_ON_BUG envval on assert failure.Koichi Sasada2020-01-061-11/+0
| | | | Check RUBY_ON_BUG env val also on rb_assert_failure().
* Separate builtin initialization callsNobuyoshi Nakada2019-12-291-6/+0
|
* decouple internal.h headers卜部昌平2019-12-261-10/+23
| | | | | | | | | | | | | | | | | | Saves comitters' daily life by avoid #include-ing everything from internal.h to make each file do so instead. This would significantly speed up incremental builds. We take the following inclusion order in this changeset: 1. "ruby/config.h", where _GNU_SOURCE is defined (must be the very first thing among everything). 2. RUBY_EXTCONF_H if any. 3. Standard C headers, sorted alphabetically. 4. Other system headers, maybe guarded by #ifdef 5. Everything else, sorted alphabetically. Exceptions are those win32-related headers, which tend not be self- containing (headers have inclusion order dependencies).
* Fix FrozenError#receiver and #initialize docszverok2019-12-221-1/+2
|
* Fixed misspellingsNobuyoshi Nakada2019-12-221-1/+1
| | | | | Fixed misspellings reported at [Bug #16437], missed and a new typo.
* RDoc of Warning.[] and .[]= [Feature #16345] [ci skip]Nobuyoshi Nakada2019-12-221-0/+25
|
* Added `experimental` warning categoryNobuyoshi Nakada2019-12-201-0/+3
| | | | [Feature #16420]
* Added -W: command line optionNobuyoshi Nakada2019-12-201-0/+7
| | | | | To manage `Warning[category]` flags. Only `-W:deprecated` and `-W:no-deprecated` are available now. [Feature #16345]
* Makes the receiver to FrozenError.new a keyword parameterNobuyoshi Nakada2019-12-201-8/+15
| | | | [Feature #16419]
* Added rb_warn_deprecatedNobuyoshi Nakada2019-12-191-0/+16
|
* Made the warning for deprecated constants follow the category flagNobuyoshi Nakada2019-12-191-8/+14
|
* [DOC] Fixed the class name in FrozenError#receiverNobuyoshi Nakada2019-12-151-1/+10
|
* Revert "[DOC] Fixed the class name in FrozenError#receiver"Nobuyoshi Nakada2019-12-151-22/+10
| | | | | | This reverts commit 5f56a5fc9be9ea7b088795c2d3871c2352a020c2. `FrozenError.new(mesg, nil).receiver` should not raise an ArgumentError.
* [DOC] Fixed the class name in FrozenError#receiverNobuyoshi Nakada2019-12-151-10/+22
|
* [DOC] Fixed the FrozenError.new result [ci skip]Nobuyoshi Nakada2019-12-151-1/+1
|
* Add `Warning.[]` and `Warning.[]=`Nobuyoshi Nakada2019-12-131-0/+46
|
* Create backtrace location array directlyNobuyoshi Nakada2019-12-131-4/+2
|
* Moved Kernel#warn to warning.rbNobuyoshi Nakada2019-12-131-68/+29
|
* make functions static卜部昌平2019-11-191-3/+7
| | | | | | | These functions are used from within a compilation unit so we can make them static, for better binary size. This changeset reduces the size of generated ruby binary from 26,590,128 bytes to 26,584,472 bytes on my macihne.
* Deprecate taint/trust and related methods, and make the methods no-opsJeremy Evans2019-11-181-14/+3
| | | | | | This removes the related tests, and puts the related specs behind version guards. This affects all code in lib, including some libraries that may want to support older versions of Ruby.
* Warn on access/modify of $SAFE, and remove effects of modifying $SAFEJeremy Evans2019-11-181-6/+0
| | | | | | | | | | | | | | | | | This removes the security features added by $SAFE = 1, and warns for access or modification of $SAFE from Ruby-level, as well as warning when calling all public C functions related to $SAFE. This modifies some internal functions that took a safe level argument to no longer take the argument. rb_require_safe now warns, rb_require_string has been added as a version that takes a VALUE and does not warn. One public C function that still takes a safe level argument and that this doesn't warn for is rb_eval_cmd. We may want to consider adding an alternative method that does not take a safe level argument, and warn for rb_eval_cmd.
* delete unused functions卜部昌平2019-11-141-7/+0
| | | | | | | | | | | | Looking at the list of symbols inside of libruby-static.a, I found hundreds of functions that are defined, but used from nowhere. There can be reasons for each of them (e.g. some functions are specific to some platform, some are useful when debugging, etc). However it seems the functions deleted here exist for no reason. This changeset reduces the size of ruby binary from 26,671,456 bytes to 26,592,864 bytes on my machine.
* forgot to delete unused #incude line卜部昌平2019-10-101-1/+0
|
* guard rb_fatal against non-GVL call卜部昌平2019-10-101-0/+8
| | | | | | Suggested by ko1. rb_fatal requires GVL so just in case one lacks, print that information and let the process die. As commented, we cannot print the given messages on such situations.
* make rb_raise a GVL-only function again卜部昌平2019-10-101-32/+4
| | | | | | Requested by ko1 that ability of calling rb_raise from anywhere outside of GVL is "too much". Give up that part, move the GVL aquisition routine into gc.c, and make our new gc_raise().
* add "[FATAL]" marker on abort卜部昌平2019-10-101-0/+1
| | | | Indicate that the situation is fatal.
* allow rb_raise from outside of GVL卜部昌平2019-10-101-4/+35
| | | | | | | | | | | | | | | Now that allocation routines like ALLOC_N() can raise exceptions on integer overflows. This is a problem when the calling thread has no GVL. Memory allocations has been allowed without it, but can still fail. Let's just relax rb_raise's restriction so that we can call it with or without GVL. With GVL the behaviour is unchanged. With no GVL, wait for it. Also, integer overflows can theoretically occur during GC when we expand the object space. We cannot do so much then. Call rb_memerror and let that routine abort the process.
* Share ruby_sighandler_t definitionNobuyoshi Nakada2019-10-091-1/+1
|
* signal.c: save the original sighandlers for fatal signalsYusuke Endoh2019-10-091-1/+3
| | | | | | | | | | | On Android, a signal handler that is not SIG_DFL is set by default for SIGSEGV. Ruby's install_sighandler inserts Ruby's handler only when the signal has no handler, so it does not insert Ruby's SEGV report handler, which caused some test failures. This changeset forces to install Ruby's handler for some fatal signals (sigbus, sigsegv, and sigill). They keep the original handlers, and call them when the interpreter receives the signals.
* error.c (rb_bug_for_fatal_signal): renamed from rb_bug_contextYusuke Endoh2019-10-091-1/+1
| | | | | | | | | | Just refactoring. The name "rb_bug_context" is completely unclear for me. (Can you see that "context" means "machine register context"?) The context is available only when a fatal signal (sigbus, sigsegv, or sigill) is received; in fact, the function is used only for fatal signals. So, I think the name should be changed.
* Make rb_scan_args handle keywords more similar to Ruby methods (#2460)Jeremy Evans2019-09-251-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Cfuncs that use rb_scan_args with the : entry suffer similar keyword argument separation issues that Ruby methods suffer if the cfuncs accept optional or variable arguments. This makes the following changes to : handling. * Treats as **kw, prompting keyword argument separation warnings if called with a positional hash. * Do not look for an option hash if empty keywords are provided. For backwards compatibility, treat an empty keyword splat as a empty mandatory positional hash argument, but emit a a warning, as this behavior will be removed in Ruby 3. The argument number check needs to be moved lower so it can correctly handle an empty positional argument being added. * If the last argument is nil and it is necessary to treat it as an option hash in order to make sure all arguments are processed, continue to treat the last argument as the option hash. Emit a warning in this case, as this behavior will be removed in Ruby 3. * If splitting the keyword hash into two hashes, issue a warning, as we will not be splitting hashes in Ruby 3. * If the keyword argument is required to fill a mandatory positional argument, continue to do so, but emit a warning as this behavior will be going away in Ruby 3. * If keyword arguments are provided and the last argument is not a hash, that indicates something wrong. This can happen if a cfunc is calling rb_scan_args multiple times, and providing arguments that were not passed to it from Ruby. Callers need to switch to the new rb_scan_args_kw function, which allows passing of whether keywords were provided. This commit fixes all warnings caused by the changes above. It switches some function calls to *_kw versions with appropriate kw_splat flags. If delegating arguments, RB_PASS_CALLED_KEYWORDS is used. If creating new arguments, RB_PASS_KEYWORDS is used if the last argument is a hash to be treated as keywords. In open_key_args in io.c, use rb_scan_args_kw. In this case, the arguments provided come from another C function, not Ruby. The last argument may or may not be a hash, so we can't set keyword argument mode. However, if it is a hash, we don't want to warn when treating it as keywords. In Ruby files, make sure to appropriately use keyword splats or literal keywords when calling Cfuncs that now issue keyword argument separation warnings through rb_scan_args. Also, make sure not to pass nil in place of an option hash. Work around Kernel#warn warnings due to problems in the Rubygems override of the method. There is an open pull request to fix these issues in Rubygems, but part of the Rubygems tests for their override fail on ruby-head due to rb_scan_args not recognizing empty keyword splats, which this commit fixes. Implementation wise, adding rb_scan_args_kw is kind of a pain, because rb_scan_args takes a variable number of arguments. In order to not duplicate all the code, the function internals need to be split into two functions taking a va_list, and to avoid passing in a ton of arguments, a single struct argument is used to handle the variables previously local to the function.
* Update documentation for Exception [ci skip]Jeremy Evans2019-09-091-20/+36
| | | | | | Mostly from burdettelamar@yahoo.com (Burdette Lamar). Implements [Misc #16156]
* Do not clear backtrace in Exception#exceptionNobuyoshi Nakada2019-09-021-2/+2
| | | | [Bug #15558]
* Minor documentation fixes [ci skip]Jeremy Evans2019-08-241-1/+2
| | | | | | From zverok (Victor Shepelev) Fixes [Misc #16126]
* Use modifier for pid_tNobuyoshi Nakada2019-08-191-1/+1
|
* introduce RUBY_ON_BUG envval. (#2331)Koichi Sasada2019-08-151-1/+13
| | | | | | | | | | | | | | `rb_bug()` is called at critical bug, MRI can't run anymore. To make debug easy, this patch introduces RUBY_ON_BUG environment variable to specify the process which is called with pid. [Feature #16090] [GH #2331] RUBY_ON_BUG='gdb -p' ruby xxx.rb In this case, if ruby interpreter causes critical bug, and call rb_bug(), then "gdb -p [PID]' is called by system(3). You can debug on invoked gdb. This feature is limited on RUBY_DEVEL build.
* backtrace and backtrace_locations can be nil (#2358)Steven Harman2019-08-141-3/+9
| | | | | Exception#backtrace and Exception#backtrace_locations can both be nil if not set. The former can be set via `Exception#set_backtrace`, but the later is only ever set at runtime via `setup_backtrace`.