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

41987 Коммитов

Автор SHA1 Сообщение Дата
nobu 3e0f09dbe5 ruby-additional.el: escape control code
* misc/ruby-additional.el (ruby-encode-unicode): escape control
  code except for LF.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53393 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-31 01:38:28 +00:00
nobu 34167345ac ruby-additional.el: encode non-ASCII code only
* misc/ruby-additional.el (ruby-encode-unicode): encode non-ASCII
  code only, excluding ASCII control code, e.g. \t, \n, etc.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53392 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-31 00:39:03 +00:00
naruse 2fad016810 skip if locale is not UTF-8
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53391 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-30 19:06:55 +00:00
naruse 5da0e86396 * test/ruby/test_module.rb (test_classpath): r53376 may change
the order of m.constants.
  `make TESTS='-v ruby/test_class.rb ruby/test_module.rb' test-all`
  may fail after that.
  http://rubyci.s3.amazonaws.com/tk2-243-31075/ruby-trunk/log/20151230T164202Z.log.html.gz

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53390 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-30 17:47:43 +00:00
svn 6bdfd21d29 * 2015-12-31
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53389 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-30 17:20:50 +00:00
eregon 6ec9331c2a * common.mk (help): Fix typo.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53388 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-30 17:20:28 +00:00
hsbt 95aadb1426 * lib/net/http/responses.rb: Added new response class for 451 status code.
* lib/net/http.rb: documentation for HTTPUnavailableForLegalReasons

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53387 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-30 11:53:15 +00:00
hsbt 27f00a7a22 * lib/webrick/httpstatus.rb: Added HTTP 451 Status Code.
[fix GH-1167] Patch by @MuhammetDilmac
  https://tools.ietf.org/html/draft-tbray-http-legally-restricted-status-00

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53386 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-30 11:45:52 +00:00
hsbt 8f8f92b508 * doc/syntax/calling_methods.rdoc: fix old operator for safe navigation
operator. [ci skip][fix GH-1182] Patch by @dougo

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53385 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-30 11:26:09 +00:00
nobu f880d5dcd2 Add test for String#ord
* test/ruby/test_string.rb (test_ord): Add test for String#ord.
  [Fix GH-1181]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53384 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-30 07:43:25 +00:00
nobu 6fd18ca51b forwardable.rb: adjust backtrace by tail call
* lib/forwardable.rb (def_instance_delegator): adjust backtrace of
  method body by tail call optimization.  adjusting the delegated
  target is still done by deleting backtrace.
* lib/forwardable.rb (def_single_delegator): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53383 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-30 02:28:59 +00:00
nobu d8eb5ade4f fix commit miss
* test/test_forwardable.rb: add tests for r53381.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53382 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-30 02:26:15 +00:00
nobu 986fb55961 Forwardable: Fix delegating to 'args' and 'block'
* lib/forwardable.rb (def_instance_delegator) fix delegating to
  'args' and 'block', clashing with local variables in generated
  methods.  [ruby-core:72579] [Bug #11916]

* lib/forwardable.rb (def_single_delegator): ditto.

If you have a class that uses Forwardable to delegate a method to
another object, and the method that returns the delegate object is
called `args` or `block`, then Forwardable will fail to work.

Here's a simple example:

    class ModelCreator
      extend Forwardable

      attr_reader :args

      def_delegator :args, :model_name

      def initialize(args)
        @args = args
      end
    end

    ModelCreator.new.model_name

If you run the last line above, then you'll get:

    NoMethodError: undefined method `model_name' for []:Array

This error occurs because `def_delegator` -- as it is written in Ruby --
uses metaprogramming to add methods to the class that will then delegate
to the delegate object. So it's as if we had written:

    class ModelCreator
      extend Forwardable

      attr_reader :args

      def model_name(*args, &block)
        args.model_name(*args, &block)
      end

      def initialize(args)
        @args = args
      end
    end

As you can see, `def_delegator` will not only forward the method call
onto the delegate object, it will also forward any arguments provided as
well. It is here that the bug arises: it splats all of the arguments
into a variable which is called `args`, and because of how variable
scope works in Ruby, it then attempts to call `model_name` on *this*
variable and *not* our delegate object method.

The fix is to call the delegate object method manually using `__send__`.
(This assumes, of course, that the given receiver is, in fact, the name
of a method and not the name of an instance variable, which is also a
possibility.) We use `__send__` because the delegate object method could
be private.

So, that looks like this:

    def model_name(*args, &block)
      __send__(:args).model_name(*args, &block)
    end

Because `def_delegators` and `delegate` use `def_delegator` internally,
they also get this fix as well.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53381 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-30 02:18:44 +00:00
nobu a974041b0e object.c: fix prepend cmp
* object.c (rb_class_inherited_p): search the corresponding
  ancestor to prepended module from prepending class itself.
  [ruby-core:72493] [Bug #11878]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53380 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-30 00:58:58 +00:00
nobu d252e224f6 test_io.rb: test for rb_io_modestr_fmode
* test/stringio/test_io.rb (test_flag): add assertion for error when
  text and binary mode are mixed.
  [ruby-dev:49465] [Feature #11921]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53379 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-30 00:20:03 +00:00
nobu 3586aef4b8 test_stringio.rb: test_initialize
* test/stringio/test_stringio.rb (test_initialize): add test for
  StringIO#initialize.  [ruby-core:72585] [Feature #11920]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53378 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-29 23:44:01 +00:00
normal 7e85d487fe ChangeLog: add entry for r53376
Oops :x
[ruby-core:72112] [Feature #11614]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53377 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-29 20:21:17 +00:00
normal 1142de8e2a use id_table for constant tables
valgrind 3.9.0 on x86-64 reports a minor reduction in memory usage
when loading only RubyGems and RDoc by running: ruby -rrdoc -eexit

before: HEAP SUMMARY:
    in use at exit: 2,913,448 bytes in 27,394 blocks
  total heap usage: 48,362 allocs, 20,968 frees, 9,034,621 bytes alloc

after: HEAP SUMMARY:
    in use at exit: 2,880,056 bytes in 26,712 blocks
  total heap usage: 47,791 allocs, 21,079 frees, 9,046,507 bytes alloc

* class.c (struct clone_const_arg): adjust for id_table
  (clone_const): ditto
  (clone_const_i): ditto
  (rb_mod_init_copy): ditto
  (rb_singleton_class_clone_and_attach): ditto
  (rb_include_class_new): ditto
  (include_modules_at): ditto
* constant.h (rb_free_const_table): ditto
* gc.c (free_const_entry_i): ditto
  (rb_free_const_table): ditto
  (obj_memsize_of): ditto
  (mark_const_entry_i): ditto
  (mark_const_tbl): ditto
* internal.h (struct rb_classext_struct): ditto
* object.c (rb_mod_const_set): resolve class name on assignment
* variable.c (const_update): replace with const_tbl_update
  (const_tbl_update): new function
  (fc_i): adjust for id_table
  (find_class_path): ditto
  (autoload_const_set): st_update => const_tbl_update
  (rb_const_remove): adjust for id_table
  (sv_i): ditto
  (rb_local_constants_i): ditto
  (rb_local_constants): ditto
  (rb_mod_const_at): ditto
  (rb_mod_const_set): ditto
  (rb_const_lookup): ditto

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53376 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-29 20:19:14 +00:00
nagachika b7573a0081 * thread_pthread.c (rb_thread_create_timer_thread): destroy attr even
if pthread_create() failed.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53375 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-29 19:26:52 +00:00
svn 60c49e94eb * 2015-12-30
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53374 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-29 18:20:33 +00:00
normal 24c979bdea thread_pthread.c (rb_thread_create_timer_thread): fix race
This fixes an occasional [ASYNC BUG] failure in
bootstraptest/test_fork.rb '[ruby-dev:37934]'
which tests fork/pthread_create failure by setting
RLIMIT_NPROC to 1 and triggering EAGAIN on pthread_create
when attempting to recreate the timer thread.

The problem timeline is as follows:

thread 1                           thread 2
---------------------------------------------------------------
rb_thread_create_timer_thread
setup_communication_pipe
                                   rb_thread_wakeup_timer_thread_low
pthread_create fails               pipe looks valid, write!
CLOSE_INVALIDATE (x4)              EBADF -> ASYNC BUG

The checks in rb_thread_wakeup_timer_thread_low only tried to
guarantee proper ordering with native_stop_timer_thread, not
rb_thread_create_timer_thread :x

Now, this should allow rb_thread_create_timer_thread to
synchronize properly with rb_thread_wakeup_timer_thread_low by
delaying the validation marking of the timer_thread_pipe until
we are certain the timer thread is alive.

In this version, rb_thread_wakeup_timer_thread_low becomes a
noop.  Threading is still completely broken with NPROC==1, but
there's not much we can do about it beside warn the user.
We no longer spew a scary [ASYNC BUG] message or dump core
on them.

* thread_pthread.c (setup_communication_pipe): delay setting owner
  (rb_thread_create_timer_thread): until thread creation succeeds
  [ruby-core:72590] [Bug #11922]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53373 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-29 18:20:27 +00:00
nobu 290deeb705 ruby.c: overriding warning options
* ruby.c (proc_options): successive -W option overrides previous
  warning options.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53372 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-29 12:23:04 +00:00
nagachika 3d458cd051 * ChangeLog: remove duplicated entries at r53366.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53371 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-29 12:17:21 +00:00
nobu 1eafb3dd4b ruby.c: parse -W option
* ruby.c (proc_options): parse and skip '-W' option and its
  argument even if ignored.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53370 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-29 10:39:53 +00:00
nobu 66fe2c0dd9 ruby.c: command line option over RUBYOPT env
* ruby.c (proc_options): -W command line option should be able to
  override -w in RUBYOPT environment variable.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53369 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-29 10:12:48 +00:00
nobu b6b1038c6b eval.c: warn block for using
* eval.c (ignored_block): warn if a block is given to `using`,
  which is probably for `Module.new`.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53368 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-29 08:54:18 +00:00
nobu 1403dfbf31 compile.c: adjust label reference
* compile.c (new_adjust_body): labels referred by adjuststack
  shoud not be optimized away.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53367 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-29 08:36:22 +00:00
nobu 15960b37e8 ostruct.rb: respond_to?
* lib/ostruct.rb (OpenStruct): make respond_to? working on
  just-allocated objects for workaround of Psych.
  [ruby-core:72501] [Bug #11884]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53366 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-29 03:48:36 +00:00
mrkn 88aa6abf9c * test/mkmf/test_have_func.rb (test_have_func):
Add assertion to examine the existence of HAVE_RUBY_INIT.

* test/mkmf/test_have_func.rb (test_not_have_func):
  Add assertion to examine the absence of HAVE_RUBY_INIT.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53365 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-29 01:37:20 +00:00
normal 5ad289b133 thread_sync.c: static classes
We do not want to waste space by exposing globals to other
objects.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53364 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-28 21:52:15 +00:00
normal a3b53cd991 Resolv::IPv6.create: avoid modifying frozen string literal
* lib/resolv.rb (Resolv::IPv6.create): avoid modifying frozen
* test/resolv/test_dns.rb (test_ipv6_create): test for above
  [Bug #11910] [ruby-core:72559]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53363 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-28 20:31:10 +00:00
a_matsuda d21c54ffbd ⚠️ key "accelerator" is duplicated and overwritten in Tk samples
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53362 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-28 15:10:25 +00:00
a_matsuda 58d698af35 Missing require
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53361 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-28 15:10:19 +00:00
a_matsuda 357ef2f428 parsedate is no more available since 1.9
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53360 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-28 15:10:10 +00:00
svn 1ea5d1ae2a * 2015-12-29
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53359 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-28 15:10:08 +00:00
a_matsuda 67a886cedd Convert euc-jp resource file in Tk sample to utf-8
The sample program assumes the file to be encoded in utf-8
0253189898/ext/tk/sample/tkoptdb.rb (L15-L17)

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53358 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-28 15:09:59 +00:00
a_matsuda 672fe8315d Documentation typo
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53357 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-28 15:09:51 +00:00
kazu 0253189898 fix a typo [ci skip]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53356 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-28 07:04:01 +00:00
nobu f84ba30af5 iseq.c: suppress warnings
* iseq.c (rb_iseq_compile_with_option): suppress "clobbered"
  warnings by old gcc.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53355 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-28 06:42:18 +00:00
nobu 2eb5e09ea5 Add test for String#rstrip!
* test/ruby/test_string.rb (TestString#test_rstrip_bang): Add test
  for String#rstrip!.  [Fix GH-1176]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53354 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-28 05:56:00 +00:00
svn 4ab3c75bc5 * 2015-12-28
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53353 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-28 00:19:11 +00:00
nobu 78d15f5e35 Add test for String#lstrip!
* test/ruby/test_string.rb (TestString#test_lstrip_bang): Add test
  for String#lstrip!.  [Fix GH-1176]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53352 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-28 00:18:55 +00:00
svn b8d9770b6c * remove trailing spaces.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53351 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-27 14:34:16 +00:00
suke db8dcd1b27 * ext/win32ole/win32ole.c (ole_variant2val): refactoring.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53350 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-27 14:34:11 +00:00
usa 1187cf0e00 * test/ruby/test_process.rb (TestProcess#test_execopts_open_chdir_m17n_path):
test for r53346, r53347 and r53348.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53349 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-27 12:24:03 +00:00
usa 8ff043d8cb * process.c (rb_execarg_parent_start1): need to convert the encoding to
ospath's one.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53348 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-27 12:15:20 +00:00
usa 956100bc2e * process.c (rb_execarg_addopt): need to convert to ospath.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53347 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-27 12:03:45 +00:00
usa fe0194e25e * process.c: use rb_w32_uchdir() instead of plain chdir() on Windows.
reported by naruse via twitter.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53346 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-27 11:54:59 +00:00
hsbt 701bfa0fed * enc/x_emoji.h: fix dead-link.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53345 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-27 11:00:36 +00:00
hsbt de962ebbc0 * doc/NEWS-2.3.0: fix a typo.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53344 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-27 10:55:59 +00:00