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

340 Коммитов

Автор SHA1 Сообщение Дата
normal 8e64799c96 fix RSTRUCT_LEN macro in public C API
rb_struct_size returns an Integer VALUE, so it must be converted
to a `long` for compatibility with previous Ruby C API versions.

* ext/-test-/struct/len.c: new
* test/-ext-/struct/test_len.rb: new
* include/ruby/ruby.h (RSTRUCT_LEN): use NUM2LONG
  [ruby-core:80692] [Bug #13439]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58359 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-04-15 00:46:00 +00:00
nobu 489776e284 Rename RbConfig::Limits as RbConfig::LIMITS
* template/limits.c.tmpl (Init_limits): rename RbConfig::Limits as
  RbConfig::LIMITS, constants other than class or module are all
  uppercase with underscores by convention.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58260 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-04-06 02:10:40 +00:00
nobu 033c4a083d test: use RbConfig::Limits
* test/lib/envutil.rb: rbconfig/sizeof may not be available when
  cross-compiling.  use RbConfig::Limits instead of calculating
  limits of Fixnum with hard-coded CHAR_BIT.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57757 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-03-02 04:54:19 +00:00
nobu 2aaca10505 eval.c: hide internal objects
* eval.c (rb_ensure): veil internal exception objects not to leak
  in ensure functions.  [ruby-core:79371] [Bug #13176]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57510 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-02-03 06:23:34 +00:00
nobu 57b6d6032c test_iseq_load.rb: refine test_require_integration
* test/-ext-/iseq_load/test_iseq_load.rb (test_require_integration):
  assert with diff.

[ci skip]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57495 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-02-02 05:43:58 +00:00
shyouhei 8ad7429644 make FIXNUM_MAX visible from Ruby
Because our tests now have several places where FIXNUM_MAX is needed,
we decided to provide it along with several other constants.

	* template/limits.c.tmpl: new file, defining RbConfig::Limits

	* ext/rbconfig/sizeof/depend (limits.c): rule to generate limits.c

	* test/-ext-/num2int/test_num2int.rb: use RbConfig::Limits

	* bootstraptest/test_insns.rb: ditto.

	* .gitignore: ignore new generated file.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57465 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-01-30 10:12:18 +00:00
nobu 46454b5ee6 passed block should keep the lambda-ness
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57243 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-01-01 08:22:02 +00:00
nobu 1c16a35017 test_modify_expand.rb: skip if no overflow
* test/-ext-/string/test_modify_expand.rb (test_integer_overflow):
  no longer happens on platforms where size_t is larger than long,
  e.g. 64bit windows, since r57122.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57156 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-12-22 23:20:00 +00:00
nobu c62ab010c8 test_fstring.rb: fix exception
* test/-ext-/string/test_fstring.rb (test_singleton_class): fix
  expected exception class.  [ruby-dev:49867] [Bug #12923]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56754 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-11-12 13:24:23 +00:00
nobu ee160e68f9 class.c: no fstring singleton class
* class.c (singleton_class_of): prohibit fstrings from creating
  singleton classes.
  temporary measure for [ruby-dev:49867] [Bug #12923]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56747 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-11-12 09:43:05 +00:00
nobu 2c0d3e2a2e symbol/noninterned_name.rb
* test/-ext-/symbol/noninterned_name.rb: split from
  test_inadvertent_creation.rb.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56746 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-11-12 08:16:58 +00:00
nobu cbfe54c560 numeric.c: fix return value on big 0
* numeric.c (num_zero_p): should return true if zero.
  rb_bigzero_p returns 1 or 0.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56538 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-11-01 12:35:32 +00:00
hsbt 6b35c34c68 * basictest/test.rb: Adjust spaces in class declarations
with inheritance. [fix GH-1227] Patch by @adrfer
* lib/irb/*: ditto.
* lib/prime.rb: ditto.
* lib/shell/builtin-command.rb: ditto.
* object.c: ditto.
* sample/*.rb: ditto.
* test/-ext-/method/test_arity.rb: ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56371 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-10-07 05:18:57 +00:00
nobu 5ebce690df test_dln.rb: fix constants
* test/-ext-/win32/test_dln.rb (test_check_imported): use toplevel
  constants explicitly to get rid of constants under the scope.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56245 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-09-25 22:29:16 +00:00
nobu 958c04898c dlntest.dll: move
* ext/-test-/win32/dln/{depend,extconf.rb} (dlntest.dll): make
  under the extension directory, instead of the top directory.

* test/-ext-/win32/test_dln.rb (test_check_imported): explicit
  PATH environment variable to load the DLL.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56203 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-09-22 06:35:27 +00:00
rhe be3baa4380 string.c: fix buffer overflow check condition in rb_str_set_len()
* string.c (rb_str_set_len): The buffer overflow check is wrong. The
  space for termlen is allocated outside the capacity returned by
  rb_str_capacity(). This fixes r41920 ("string.c: multi-byte
  terminator", 2013-07-11).  [ruby-core:77257] [Bug #12757]

* test/-ext-/string/test_set_len.rb (test_capacity_equals_to_new_size):
  Test for this change. Applying only the test will trigger [BUG].

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56148 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-09-13 07:08:15 +00:00
naruse 8667e8b186 require "rbconfig/sizeof"
They may fail parallel test-all

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55602 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-07-06 18:17:36 +00:00
nobu 79a85b18cc string.c: return reallocated pointer
* string.c (str_fill_term): return new pointer reallocated by
  filling terminator.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55212 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-30 07:20:28 +00:00
nobu 006634b489 -test-/integer
* ext/-test-/integer/core_ext.c: move testutil/integer.c.
* test/lib/-test-/integer.rb: extract implementation details from
  test/unit/assertions.rb.  [Bug #12408]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55114 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-22 07:27:02 +00:00
nobu b9fe5948f3 move duplicate assertions
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55109 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-22 02:28:03 +00:00
nobu b493d156de string.c: integer overflow
* string.c (rb_str_modify_expand): check integer overflow.
  [ruby-core:75592] [Bug #12390]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55054 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-18 05:52:40 +00:00
akr 449fbfd4d4 Use Integer instead of Fixnum and Bignum.
* object.c, numeric.c, enum.c, ext/-test-/bignum/mul.c,
  lib/rexml/quickpath.rb, lib/rexml/text.rb, lib/rexml/xpath_parser.rb,
  lib/rubygems/specification.rb, lib/uri/generic.rb,
  bootstraptest/test_eval.rb, basictest/test.rb,
  test/-ext-/bignum/test_big2str.rb, test/-ext-/bignum/test_div.rb,
  test/-ext-/bignum/test_mul.rb, test/-ext-/bignum/test_str2big.rb,
  test/csv/test_data_converters.rb, test/date/test_date.rb,
  test/json/test_json_generate.rb, test/minitest/test_minitest_mock.rb,
  test/openssl/test_cipher.rb, test/rexml/test_jaxen.rb,
  test/ruby/test_array.rb, test/ruby/test_basicinstructions.rb,
  test/ruby/test_bignum.rb, test/ruby/test_case.rb,
  test/ruby/test_class.rb, test/ruby/test_complex.rb,
  test/ruby/test_enum.rb, test/ruby/test_eval.rb,
  test/ruby/test_iseq.rb, test/ruby/test_literal.rb,
  test/ruby/test_math.rb, test/ruby/test_module.rb,
  test/ruby/test_numeric.rb, test/ruby/test_range.rb,
  test/ruby/test_rational.rb, test/ruby/test_refinement.rb,
  test/ruby/test_rubyvm.rb, test/ruby/test_struct.rb,
  test/ruby/test_variable.rb, test/rubygems/test_gem_specification.rb,
  test/thread/test_queue.rb: Use Integer instead of Fixnum and Bignum.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55029 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-17 13:15:57 +00:00
akr f9727c12cc [Feature #12005] Unify Fixnum and Bignum into Integer
* [Feature #12005] Unify Fixnum and Bignum into Integer

* include/ruby/ruby.h (rb_class_of): Return rb_cInteger for fixnums.

* insns.def (INTEGER_REDEFINED_OP_FLAG): Unified from
  FIXNUM_REDEFINED_OP_FLAG and BIGNUM_REDEFINED_OP_FLAG.

* vm_core.h: Ditto.

* vm_insnhelper.c (opt_eq_func): Use INTEGER_REDEFINED_OP_FLAG instead
  of FIXNUM_REDEFINED_OP_FLAG.

* vm.c (vm_redefinition_check_flag): Use rb_cInteger instead of
  rb_cFixnum and rb_cBignum.
  (C): Use Integer instead of Fixnum and Bignum.

* numeric.c (fix_succ): Removed.
  (Init_Numeric): Define Fixnum as Integer.

* bignum.c (bignew): Use rb_cInteger instead of Rb_cBignum.
  (rb_int_coerce): replaced from rb_big_coerce and return fixnums
  as-is.
  (Init_Bignum): Define Bignum as Integer.
  Don't define ===.

* error.c (builtin_class_name): Return "Integer" for fixnums.

* sprintf.c (ruby__sfvextra): Use rb_cInteger instead of rb_cFixnum.

* ext/-test-/testutil: New directory to test.
  Currently it provides utilities for fixnum and bignum.

* ext/json/generator/generator.c: Define mInteger_to_json.

* lib/mathn.rb (Fixnum#/): Redefinition removed.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55024 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-17 06:53:48 +00:00
nobu da2e0721b1 struct.c: unique members
* struct.c (struct_make_members_list, rb_struct_s_def): member
  names should be unique. [ruby-core:74971] [Bug #12291]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54612 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-04-16 01:00:13 +00:00
nobu 404bf57aaf assertions.rb: set default internal encoding
* test/lib/test/unit/assertions.rb (assert_raise_with_message):
  set default internal encoding to the excpected message, which
  affects String#inspect in messages.

* test/lib/test/unit/assertions.rb (assert_warning): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54522 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-04-09 01:25:11 +00:00
nobu 990d709eeb at_exit list
* vm_core.h (rb_vm_struct): make at_exit a single linked list but
  not RArray, not to mark the registered functions by the write
  barrier.  based on the patches by Evan Phoenix.
  [ruby-core:73908] [Bug #12095]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54484 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-04-04 14:37:07 +00:00
mrkn 5a213ee2e2 * numeric.c (int_to_f): raise NotImplementedError when a receiver
class is unknown.

* test/-ext-/integer/test_my_integer.rb (test_my_integer_to_f): modify
  a test for the above change.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54192 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-03-19 09:43:35 +00:00
mrkn 81f65a9e05 * bignum.c (Bignum#<=>): remove it because they are unified with
Integer#<=>.

* numeric.c (Integer#<=>, Fixnum#<=>): move <=> method from Fixnum to
  Integer.

* numeric.c (int_cmp): add this method for Integer#<=>.

* test/-ext-/integer/test_my_integer.rb (test_my_integer_cmp): add a
  test to examine Integer#<=> for unknown subclasses.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54190 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-03-19 09:28:12 +00:00
odaira 06037b54af * test/-ext-/time/test_new.rb (test_timespec_new): change a gmtoff
test to a better one that does not depend on whether the current
  time is in summer time or not.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54184 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-03-18 18:05:47 +00:00
mrkn b60a7b43fe * numeric.c (int_to_f, fix_to_f): rename fix_to_f to int_to_f, and add
treatment for subclasses which don't have definitions of to_f method.

* numeric.c (Integer#to_f, Fixnum#to_f): move to_f method from Fixnum
  to Integer.

* ext/-test-/integer/my_integer.rb: define helper class for testing
  to_f method for a subclass of Integer.

* ext/-test-/integer/extconf.rb: ditto.

* ext/-test-/integer/init.c: ditto.

* test/-ext-/integer/test_my_integer.rb: examine to_f method for a
  subclass of Integer.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54179 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-03-18 14:52:46 +00:00
odaira 82b8840320 * test/-ext-/time/test_new.rb (test_timespec_new): Time#gmtoff values
are the same only when both or neither of the Time objects are in
  summer time (daylight-saving time).

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54137 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-03-16 23:20:14 +00:00
odaira adde0a94a2 * test/-ext-/float/test_nextafter.rb: In AIX,
nextafter(+0.0,-0.0)=+0.0, and nextafter(-0.0,+0.0)=-0.0,
  but they should return -0.0 and +0.0, respectively. This is
  a known bug in nextafter(3) on AIX, so skip related tests.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54003 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-03-04 22:43:31 +00:00
nobu 8790fdce57 object.c: fix error message
* object.c (rb_mod_const_get): make error message at uninterned
  string consistent with symbols.  [ruby-dev:49498] [Bug #12089]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53875 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-02-19 16:54:08 +00:00
naruse d46e2aea71 * string.c (rb_str_init): introduce String.new(capacity: size)
[Feature #12024]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53850 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-02-17 03:21:35 +00:00
naruse 040ce05610 * string.c (str_new_frozen): if the given string is embeddedable
but not embedded, embed a new copied string. [Bug #11946]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53724 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-02-03 04:52:13 +00:00
hsbt b7b5692aea * test/-ext-/string/test_capacity.rb: Added missing library.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53674 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-01-27 12:04:47 +00:00
naruse d14f0cfd16 Add tests about String's internal capacity
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53671 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-01-27 11:37:02 +00:00
nobu a5beed9ff4 ext/-test-: reduce feature names
* ext/-test-/**/extconf.rb: bring up extension libraries which
  have same name as the parent directory to reduce feature names.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53494 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-01-10 09:43:47 +00:00
nobu cc52f511b1 vm_backtrace.c: ignore ifunc frames
* vm_backtrace.c (rb_profile_frames): ignore ifunc frames as it
  did before.  [ruby-core:72409] [Bug #11851]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53225 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-21 01:18:48 +00:00
naruse 3e92b635fb Add frozen_string_literal: false for all files
When you change this to true, you may need to add more tests.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53141 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-16 05:07:31 +00:00
nobu 1fadd43881 marshal.c: skip internal names
* marshal.c (w_objivar): skip internal instance variables in
  T_OBJECT too.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52940 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-08 05:20:41 +00:00
nobu d58f17f37d string.c: no frozen error at cstr
* string.c (rb_string_value_cstr): should not raise on frozen
  string.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52833 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-01 08:13:43 +00:00
nobu 41cbb7f050 cstr.c: split bug_str_cstr_unterm
* ext/-test-/string/cstr.c (bug_str_cstr_unterm): split
  unterminating from bug_str_cstr_term.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52832 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-01 08:09:17 +00:00
nobu f8cd2190f0 time/test_new.rb: fix tests
* test/-ext-/time/test_new.rb (test_timespec_new): fix for r52519.
  swap utc and localtime.

* test/-ext-/time/test_new.rb (test_timespec_now): fix method name
  typo which has overwritten test_timespec_new.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52531 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-11-11 00:07:16 +00:00
naruse 4dedfc3cc9 Add tests for rb_time_timespec_new
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52527 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-11-10 17:50:38 +00:00
nobu 4191a6b90d preserve encodings in error messages
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51962 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-09-28 02:40:46 +00:00
nobu 8101cc3de4 string.c: fill the terminator
* string.c (str_replace_shared_without_enc): fill the terminator
  of embedded strings in wide char encodings.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51372 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-07-25 02:05:34 +00:00
nobu 4ab69ebbd7 string.c: pool only bare strings in fstring
* string.c (fstr_update_callback): pool bare strings only.
* string.c (rb_fstring): return the original string with sharing a
  fstring if it has extra attributes, not the fstring itself.
  [ruby-dev:49188] [Bug #11386]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51360 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-07-24 07:38:37 +00:00
nobu 28c42b4c25 encoding.c: drop dummy encoding flag
* encoding.c (enc_autoload): drop dummy encoding flag from
  the loaded encoding index.  this flag is used only in this
  source.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51251 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-07-15 07:55:08 +00:00
nobu daf7b1e479 -test-/string: move
* ext/-test-/string/extconf.rb: move "-test-/string/string.so" to
  "-test-/string.so".

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51249 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-07-15 03:56:17 +00:00
normal 011347e4d7 iseq.c (iseq_data_to_ary): dump kw_arg as symbol
Fix RubyVM::InstructionSequence#to_a after r49517
Keywords were made symbols to fix [Bug #10831] [ruby-core:68031],
so we should dump symbols as-is instead of attempting to convert
them from IDs

* iseq.c (iseq_data_to_ary): dump kw_arg as symbol
* test/-ext-/iseq_load/test_iseq_load.rb: test kw_arg roundtrip
  [ruby-core:69891] [Bug #11338]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51190 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-07-07 19:50:49 +00:00
usa fe94eaa5ae * test/ruby/test_method.rb (TestMethod#test_{instance,define}_method): assumed
default external is UTF-8.  fixed failures introduced at r51175.

* test/-ext-/symbol/test_type.rb
  (Test_Symbol::TestType#test_check_{id,symbol}_invalid_type): ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51189 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-07-07 15:57:12 +00:00
nobu 8a0ab36db1 file.c: skip invalid byte
* file.c (rb_str_normalize_ospath): skip invalid byte sequence not
  to loop infinitely.  this case usually does not happen as the
  input name should come from real file systems.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51180 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-07-07 06:02:21 +00:00
nobu c53464c7e9 symbol.c: preserve encoding
* symbol.c (rb_check_id, rb_check_symbol): preserve encoding of
  the given name.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51175 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-07-07 03:49:14 +00:00
ko1 02d5868962 * vm_core.h: remove rb_iseq_t::klass to reduce dynamic data.
* internal.h, iseq.c (rb_iseq_klass): remove it because
  rb_iseq_t::klass is removed.
* vm_insnhelper.c (vm_super_outside): do not see cfp->iseq, but
  check callable method entry on a frame.
  This fix simplify the logic to search super class.
* test/ruby/test_method.rb: support super() from Proc.
  Now, [Bug #4881] and [Bug #3136] was solved.
* proc.c (rb_mod_define_method): catch up this change.
* vm.c (vm_define_method): ditto.
* vm_backtrace.c (rb_profile_frames): now, each `frame' objects
  are rb_callable_method_entry_t data or iseq VALUEs.
  This fix introduce minor compatibility issue that
  rb_profile_frame_label() always returns
  rb_profile_frame_base_label().
* test/-ext-/debug/test_profile_frames.rb: catch up this change.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51166 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-07-06 18:44:54 +00:00
ngoto 33a17d4839 * test/-ext-/popen_deadlock/test_popen_deadlock.rb: test [Bug #11265]
* ext/-test-/popen_deadlock/infinite_loop_dlsym.c: new ext to call
  dlsym(3) infinitely without GVL, used in the above test.
  
* ext/-test-/popen_deadlock/extconf.rb: extconf.rb for the above
  ext. Currently, only enabled on Solaris (main target) and Linux
  (as a reference platform and for debugging the ext).


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51030 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-06-25 12:42:07 +00:00
nobu fdad97f664 test_last_thread.rb: relax
* test/-ext-/gvl/test_last_thread.rb (test_last_thread): allow low
  resolution sleep.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50974 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-06-19 08:12:54 +00:00
nobu 0ba2ccc51d proc.c: inadvertent ID
* proc.c (rb_mod_define_method): get rid of inadvertent ID
  creations at error.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50969 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-06-19 04:55:01 +00:00
kosaki 8ecd3b7114 * thread.c (thread_start_func_2): don't interrupt when last thread exit
unless main thread is already exited. Otherwise main thread could be
  wrongly interrupted when it uses rb_thread_call_without_gvl(). Patch
  by Takehiro Kubo. [Bug #11237][ruby-dev:49044][GH-898]
* test/-ext-/gvl/test_last_thread.rb: new test for the above fix.
* ext/-test-/gvl/call_without_gvl/call_without_gvl.c: new ext for the
  above test.
* ext/-test-/gvl/call_without_gvl/extconf.rb: ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50900 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-06-14 22:52:01 +00:00
nobu 3b3bc21b53 test_nofree.rb: fix commit miss
* test/-ext-/string/test_nofree.rb (test_no_memory_leak): remove
  limit and make the interation longer.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50843 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-06-12 08:04:39 +00:00
nobu d5a78c89e5 test_nofree.rb: rehearsal
* test/-ext-/string/test_nofree.rb (test_no_memory_leak): add a
  rehearsal.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50842 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-06-12 08:02:49 +00:00
nobu c4d216793b intern.h: rb_f_notimplement for ext on Windows
* include/ruby/intern.h (rb_f_notimplement): should not respond to
  not-implemented methods.  as the address inside a DLL and the
  imported address are different on Windows, use an exported
  variable to share the same address.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50527 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-05-18 06:31:42 +00:00
nobu 47349e8701 notimplement: rename
* ext/-test-/notimplement, test/-ext-/test_notimplement.rb:
  rename from bug-3662.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50524 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-05-17 14:47:36 +00:00
nobu 26fa27fe12 string.c: clear NOFREE flag at embedding
* string.c (STR_SET_EMBED): clear NOFREE flag at embedding as
  embedded strings no longer refer static strings.
  [ruby-core:68436] [Bug #10942]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50334 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-04-17 02:58:37 +00:00
nobu c8a28a5a1b proc.c: respond_to_missing? at Method
* proc.c (respond_to_missing_p): check if the receiver responds to
  the given method by respond_to_missing?.
* proc.c (mnew_missing): create Method object for method_missing.
  [ruby-core:68564] [Bug #10985]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50038 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-03-20 09:41:06 +00:00
nobu 30fdcc3fa8 test_inadvertent_creation.rb: fix messages
* test/-ext-/symbol/test_inadvertent_creation.rb (TestInadvertent):
  fix failure messages.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50035 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-03-20 08:39:17 +00:00
nobu 8575de71d4 test_inadvertent_creation.rb: undefined singleton
* test/-ext-/symbol/test_inadvertent_creation.rb (test_undefined_method):
  test Kernel#singleton_method too.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50034 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-03-20 07:14:38 +00:00
nobu 1e4550ac03 test_rubyoptions.rb: use assert_in_out_err
* test/ruby/test_rubyoptions.rb (assert_segv): assert_in_out_err
  with the pattern list instead of invoke_ruby.

* test/-ext-/bug_reporter/test_bug_reporter.rb (test_bug_reporter_add):
  ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49824 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-03-03 08:19:43 +00:00
nobu b4f61ad610 vm_core.h: fix symbols leak
* vm_core.h (rb_call_info_kw_arg_struct): make keywords a symbols
  list to get rid of inadvertent creation by variable keyword
  arguments.  [ruby-core:68031] [Bug #10831]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49517 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-02-06 01:31:53 +00:00
nobu a932a1b83d test_inadvertent_creation.rb: assert method_missing
* test/-ext-/symbol/test_inadvertent_creation.rb
  (assert_no_immortal_symbol_in_method_missing): assert
  method_missing.  [Bug #10828]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49507 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-02-05 04:49:30 +00:00
nobu 738ce30f99 convert method name to a Symbol
* vm_eval.c (send_internal), vm_insnhelper.c (vm_call_opt_send):
  convert String method name into a Symbol, as method_missing
  method expects its first argument to be a Symbol.  [Bug #10828]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49506 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-02-05 04:41:05 +00:00
nobu 73645c1c51 vm_insnhelper.c: fix missing reason
* vm_insnhelper.c (ci_missing_reason): return the reason of method
  missing in call info.
* vm_insnhelper.c (vm_call_opt_send): re-apply r49500 with the
  proper missing reason.  [Bug #10828]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49505 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-02-05 03:31:07 +00:00
nobu 0e414175fd test_inadvertent_creation.rb: move tests
* test/-ext-/symbol/test_inadvertent_creation.rb: move symbol leak
  tests, for implementation details, from test/ruby/test_symbol.rb.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49504 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-02-05 02:10:44 +00:00
nobu 34d4105556 string.c: consider widechar
* string.c (str_make_independent_expand): consider wide char
  encoding.  [Fix GH-821]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49406 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-01-26 02:39:00 +00:00
nobu 622f3f14b6 string.c: terminate when embedded
* string.c (str_make_independent_expand): terminate String when
  moved from heap to embedded.  [Fix GH-821].

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49405 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-01-26 02:37:51 +00:00
nobu c9b3950d30 ext/-test-/dln/empty: move from ext/-test-/win32/dln
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49154 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-01-05 15:14:54 +00:00
nobu 401c8bb00b thread.c: fix dynamic symbol keys
* thread.c (rb_thread_variable_get): fix dynamic symbol keys.
  rb_check_id() returns non-zero only for static symbols, whereas
  thread local variable keys can be dynamic symbols.
  [ruby-core:67185] [Bug #10667]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49055 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-12-29 02:18:20 +00:00
normal 64241b0921 test_iseq_load: expand tests with stack mismatches
We can ensure the loader works for these cases even if the
reoptimized bytecode is not a match for the original.

* test/-ext-/iseq_load/test_iseq_load.rb
  (test_next_in_block_in_block): test using ISeq#eval
  (test_break_ensure): ditto
  [ruby-core:66988]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49044 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-12-28 09:20:21 +00:00
nobu 88ae402cbf string.c: term fill
* string.c (tr_trans): fill wchar terminator.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48777 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-12-12 01:20:41 +00:00
nobu 5c100b57f8 string.c: term fill
* string.c (rb_str_squeeze_bang): fill wchar terminator.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48768 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-12-11 00:37:58 +00:00
nobu 7a77cf7133 string.c: term fill
* string.c (rb_str_delete_bang): fill wchar terminator.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48764 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-12-10 12:26:11 +00:00
nobu 117438ee7b string.c: term fill
* string.c (rb_str_sub_bang): fill wchar terminator.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48763 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-12-10 12:09:49 +00:00
nobu 9d17096309 string.c: term fill
* string.c (rb_str_splice_0): fill wchar terminator.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48762 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-12-10 07:49:10 +00:00
nobu ed94c24944 string.c: term fill
* string.c (rb_str_chop_bang): fill wchar terminator.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48761 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-12-10 07:48:56 +00:00
nobu c77efe1144 string.c: term fill
* string.c (rb_str_chomp_bang): fill wchar terminator.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48760 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-12-10 07:48:48 +00:00
nobu d5b5338421 test_cstr.rb: all wchar encodings
* test/-ext-/string/test_cstr.rb (assert_wchars_term_char): test
  for all wide char encodings.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48755 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-12-10 04:39:45 +00:00
nobu bf74f633c5 test_cstr.rb: failed encoding name
* test/-ext-/string/test_cstr.rb (test_wchar_long): show the
  failed encoding name in error messages.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48753 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-12-10 00:40:17 +00:00
normal 9581954a96 mostly fix rb_iseq_load
This allows reporters commenters of [Feature #8543] to load
instruction sequences directly.  Some test cases are still failing
but documented in test/-ext-/iseq_load/test_iseq_load.rb.

* compile.c (rb_iseq_build_from_exception): entry->sp is unsigned
  (iseq_build_callinfo_from_hash): account for kw_arg
  (iseq_build_from_ary_body): update for r35459
  (CHECK_STRING, CHECK_INTEGER): remove unused checks
  (int_param): new function for checking new `params' hash
  (iseq_build_kw): new function for loading rb_iseq_param_keyword
  (rb_iseq_build_from_ary): account for `misc' entry and general
   structure changes
  [Feature #8543]
* iseq.c (CHECK_HASH): new macro (for `misc' and `param' entries)
  (iseq_load): account for `misc' and `params' hashes
  (iseq_data_to_ary): add final opt to arg_opt_labels,
   fix kw support, account for unsigned entry->sp
* ext/-test-/iseq_load/iseq_load.c: new ext for test
* ext/-test-/iseq_load/extconf.rb: ditto
* test/-ext-/iseq_load/test_iseq_load.rb: new test

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48705 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-12-03 22:16:58 +00:00
nobu 09fbd56e6f process.c: get rid of inadvertent ID pindown
* process.c (check_exec_redirect_fd, check_exec_redirect),
  (rb_execarg_addopt): get rid of inadvertent ID pindown.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48552 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-11-24 03:44:45 +00:00
nobu 8eb0c810b2 get rid of inadvertent ID creation
* object.c (rb_mod_const_get, rb_mod_const_defined): ditto.
* variable.c (rb_const_missing, rb_mod_const_missing): call
  const_missing without new ID to get rid of inadvertent ID
  creation.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48533 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-11-21 16:11:55 +00:00
nobu 88212206f6 test_inadvertent_creation.rb: split test
* test/-ext-/symbol/test_inadvertent_creation.rb: split
  test_module_const_defined? from test_module_const_get, and
  assertion for the latter.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48473 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-11-17 18:40:50 +00:00
nobu de870875f7 vm_eval.c: rb_current_receiver
* vm_eval.c (rb_current_receiver): new function to return the
  receiver in the current control frame.  [Feature #10195]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48462 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-11-16 10:38:15 +00:00
nobu b1acfbc121 ext/-test-/proc/super.c: rename
* ext/-test-/proc/super.c: renamed the file and maker method.
  [Feature #10195]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48461 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-11-16 10:11:28 +00:00
akr fb2008a73a * test/lib/envutil.rb: Moved from test/ruby/.
* test/lib/find_executable.rb: Ditto.

* test/lib/memory_status.rb: Ditto.

* test/lib/test/unit.rb: require envutil.

* test/: Don't require envutil in test files.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48409 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-11-13 16:05:37 +00:00
nobu 770128ade3 test_bmethod.rb: block in bmethod test
* test/-ext-/proc/test_bmethod.rb (test_super_in_bmethod): block
  in bmethod test for [Feature #10195].

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48350 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-11-09 14:58:33 +00:00
nobu 71c8cf27db test_bmethod.rb: super in bmethod test
* test/-ext-/proc/test_bmethod.rb (test_super_in_bmethod): super
  in bmethod test for [Feature #10195].

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48349 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-11-09 14:33:19 +00:00
nobu 3614f8bd1c string.c: wchar terminator
* string.c (rb_str_lstrip_bang, rb_str_rstrip_bang): terminate
  wchar strings with wchar 0.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48275 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-11-05 01:54:22 +00:00
nobu 7b011fd11e * ext/-test-/printf/printf.c, test/-ext-/test_printf.rb: remove
test for snprintf(3).

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48263 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-11-04 05:03:50 +00:00
nobu d4c22161f3 test/-ext-/hash/test_delete.rb: assert deleted values
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48115 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-10-23 14:18:32 +00:00
nobu ca7835bec6 hash.c: rb_hash_delete does not call the block
* hash.c (rb_hash_delete): now does not call the block given to
  the current method.  [ruby-core:65861] [Bug #10413]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48114 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-10-23 12:42:57 +00:00