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

48089 Коммитов

Автор SHA1 Сообщение Дата
nobu f644d3ef67 parse.y: workaround for warnings
* parse.y (mark_lvar_used): enable workaround to suppress unused
  local variables.  [ruby-core:82656] [Bug #13872]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60339 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-10-22 01:37:36 +00:00
nobu 8bd7c8cbc8 fix up r60224
* parse.y (match_op_gen): fix optimization at DREGX_ONCE.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60338 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-10-22 01:13:57 +00:00
glass 2ec29f3f7f hash.c: optimize Hash#compare_by_identity
hash.c (rb_hash_compare_by_id): avoid unnecessary allocation of st_table.
formerly, st_table created in rb_hash_modify() was not used and replaced immediately.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60337 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-10-22 00:57:46 +00:00
yui-knk 25a7dfc6d7 Remove not used node_type NODE_BMETHOD
* ext/objspace/objspace.c (count_nodes): This node_type has
  not been used since r24128.
* node.c (dump_node): ditto
* node.h (node_type, NEW_BMETHOD): ditto

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60336 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-10-22 00:45:05 +00:00
glass f1f7b51d73 Add arity check into Hash#flatten
* hash.c (rb_hash_flatten): add arity check

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60335 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-10-22 00:38:05 +00:00
yui-knk fdc5864090 Remove not used node_type NODE_BLOCK_ARG
* ext/objspace/objspace.c (count_nodes): This node_type has
  not been used since r11840.
* node.c (dump_node, rb_gc_mark_node): ditto
* node.h (node_type, NEW_BLOCK_ARG): ditto

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60334 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-10-22 00:29:40 +00:00
nobu e480660b85 vm_insnhelper.c: array aref optimization
* vm_insnhelper.c (vm_opt_aref): optimize on other than fixnum
  argument too.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60333 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-10-22 00:19:12 +00:00
yui-knk f36ee4406e Remove not used node_type NODE_TO_ARY
* ext/objspace/objspace.c (count_nodes): This node_type has
  not been used since r13236.
* node.c (dump_node, rb_gc_mark_node): ditto
* node.h (node_type, NEW_TO_ARY): ditto

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60332 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-10-22 00:17:39 +00:00
nobu 2050b50d85 string.c: comment layout [ci skip]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60331 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-10-22 00:00:41 +00:00
suke 6f889b50d9 ext/win32ole/win32ole.c (fole_missing): set receiver in NoMethodError.
test/win32ole/test_win32ole.rb: ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60330 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-10-21 23:57:10 +00:00
svn 4b8c94dd84 * remove trailing spaces.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60329 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-10-21 23:49:36 +00:00
sonots 84616bf979 * string.c: [DOC] Split rdoc of String#<< and String#concat [ci skip]
Split String#<< and String#concat docs to reflect single and multiple
arguments

patched by MSP-Greg [fix GH-1614]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60328 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-10-21 23:49:35 +00:00
sonots 2adcc0b8fa * object.c: Improve documentation of Kernel#Array
Array(arg) does more than just call to_ary or to_a on the argument.
It also falls back to returning [arg] if neither method is available.
This patch extends the description and adds a few examples of how it
handles common types of arguments, including an integer
(which does not implement to_ary or to_a).

Extend Kernel#Array doc to mention TypeError

patched by ragesoss (Sage Ross) [fix GH-1663]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60327 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-10-21 23:44:15 +00:00
sonots 71b932d675 * doc/regexp.rdoc: In regexp doc, two backslashes match one literally
In the "Metacharacters and Escapes" section of regexp.rdoc, it said that
to match a backslash literally, it must be backslash-escaped, but the
rendered HTML showed three backslashes (\\\). There should only be two
backslashes (\\).

patched by jlmuir (J. Lewis Muir) [fix GH-1677]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60326 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-10-21 23:38:17 +00:00
sonots ba9e870709 * doc/regexp.rdoc: Fix regexp doc syntax highlighting
patched by jlmuir (J. Lewis Muir) [fix GH-1678]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60325 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-10-21 23:36:53 +00:00
sonots d9e11970f8 * string.c: Remove errant "the" in gsub documentation
patched by jlmuir (J. Lewis Muir) [fix GH-1679]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60324 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-10-21 23:35:40 +00:00
sonots bc28011f02 Fix typo in comment
* test/ruby/test_transcode.rb: fix typo in comment
  patched by larskanis (Lars Kanis) [GH-1681]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60323 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-10-21 23:32:57 +00:00
nobu bb3f2ce752 compile.c: optimize local variable assignments
* compile.c (iseq_peephole_optimize): eliminate repeated
  assignments and copy from/to a same local variable.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60322 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-10-21 23:30:39 +00:00
akr dd5b75af34 reference Socket.getaddrinfo to Addrinfo.getaddrinfo.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60321 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-10-21 23:23:05 +00:00
nobu 80c50308f9 Improve performance of string interpolation
This patch will add pre-allocation in string interpolation.
By this, unecessary capacity resizing is avoided.

For small strings, optimized `rb_str_resurrect` operation is
faster, so pre-allocation is done only when concatenated strings
are large.  `MIN_PRE_ALLOC_SIZE` was decided by experimenting with
local machine (x86_64-apple-darwin 16.5.0, Apple LLVM version
8.1.0 (clang - 802.0.42)).

String interpolation will be faster around 72% when large string is created.

* Before
  ```
  Calculating -------------------------------------
  Large string interpolation
                            1.276M (± 5.9%) i/s -      6.358M in   5.002022s
  Small string interpolation
                            5.156M (± 5.5%) i/s -     25.728M in   5.005731s
  ```

* After
  ```
  Calculating -------------------------------------
  Large string interpolation
                            2.201M (± 5.8%) i/s -     11.063M in   5.043724s
  Small string interpolation
                            5.192M (± 5.7%) i/s -     25.971M in   5.020516s
  ```

* Test code
  ```ruby
  require 'benchmark/ips'

  Benchmark.ips do |x|
    x.report "Large string interpolation" do |t|
      a = "Hellooooooooooooooooooooooooooooooooooooooooooooooooooo"
      b = "Wooooooooooooooooooooooooooooooooooooooooooooooooooorld"

      t.times do
        "#{a}, #{b}!"
      end
    end

    x.report "Small string interpolation" do |t|
      a = "Hello"
      b = "World"

      t.times do
        "#{a}, #{b}!"
      end
    end
  end
  ```

[Fix GH-1626]
From: Nao Minami <south37777@gmail.com>

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60320 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-10-21 23:21:05 +00:00
akr d808918583 deprecate TCPSocket.gethostbyname.
TCPSocket.gethostbyname has problems similar to
Socket.gethostbyname.

An example of the problem which only the address family of
the first address is returned:

```
pp TCPSocket.gethostbyname("www.wide.ad.jp")
#=> ["www.wide.ad.jp",
      [],
      10,
      "2001:200:dff:fff1:216:3eff:fe4b:651c",
      "203.178.137.58"]
```

The address family of the first address, AF_INET6 (10), is
returned but
the address family of the second address, AF_INET, is not
returned.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60319 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-10-21 23:19:47 +00:00
rhe 66fd565153 openssl: merge test fix from upstream
Merge a commit from upstream:

	d1cbf6d75280 test/test_ssl_session: skip tests for session_remove_cb

Tests using SSL::SSLContext#session_remove_cb= are now skipped.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60318 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-10-21 20:26:26 +00:00
knu 0fcac8f1a3 Avoid use of `self.class.new(self)` in Set#collect!
That prevents infinite recursion when a subclass of Set uses
`collect!` in its constructor.

This should fix [Bug #12437].

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60317 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-10-21 17:03:40 +00:00
naruse d02211c9da ignore server side error
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60316 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-10-21 16:44:56 +00:00
naruse b39132e993 Revert "ignore server side error"
This reverts commit r60314.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60315 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-10-21 16:44:56 +00:00
naruse facccd3129 ignore server side error
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60314 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-10-21 16:43:54 +00:00
naruse 800da42cc6 fic expected error message
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60313 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-10-21 16:34:34 +00:00
knu c1c527c290 Fix comparison methods of Set to check if `@hash` is actually comparable
This should fix comparison of rbtree backed SortedSet instances.
[Bug #12072]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60312 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-10-21 16:28:52 +00:00
naruse dcea9198a9 Introduce Net::HTTP#min_version/max_version [Feature #9450]
Set SSL minimum/maximum version.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60311 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-10-21 16:25:22 +00:00
naruse 8cbf2dae5a fix OpenSSL::SSL::SSLContext#min_version doesn't work
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60310 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-10-21 16:25:19 +00:00
akr 6cba29b422 less random generations in Random::Formatter#choose.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60309 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-10-21 16:12:46 +00:00
hsbt 2c27e52f8e Add documentation for `chomp` option.
https://github.com/ruby/ruby/pull/1717

  Patch by @ksss [fix GH-1717]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60308 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-10-21 16:11:58 +00:00
yui-knk d98db55b73 Remove not used node_type NODE_CVDECL
* compile.c (defined_expr0): This node_type has
  not been used since r11614.
* ext/objspace/objspace.c (count_nodes): ditto
* node.c (dump_node): ditto
* node.h (node_type, NEW_CVDECL): ditto

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60307 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-10-21 16:09:51 +00:00
hsbt 111a2de495 Handle Errno::EADDRNOTAVAIL with Raspberry Pi environment.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60306 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-10-21 16:05:01 +00:00
k0kubun 6caa91ede2 erb.1: add missing option in detailed description
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60305 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-10-21 16:01:48 +00:00
knu 8daa6985dc Use a mutex to make SortedSet.setup thread-safe
This should fix [Bug #13735].

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60304 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-10-21 15:57:32 +00:00
knu 76e3825376 Remove redundant use of module_eval
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60303 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-10-21 15:57:26 +00:00
yui-knk 92746378ab Remove not used node_type NODE_IASGN2
* compile.c (compile_massign_opt, iseq_compile_each0): This
  node_type has not been used since r11813.
* ext/objspace/objspace.c (count_nodes): ditto
* node.c (dump_node, rb_gc_mark_node): ditto
* node.h (node_type, NEW_IASGN2): ditto
* parse.y (node_assign_gen): ditto

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60302 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-10-21 15:56:03 +00:00
k0kubun dafb230c0b driver.rb: allow executing driver.rb directly
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60301 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-10-21 15:45:32 +00:00
usa 3e8c0c577c The encoding of __FILE__ and __dir__ should be same
* ruby.c (process_options): convert the real path of the script to locale
  encoding if its encoding is not locale (maybe UTF-8) on Windows/OS X.
  this change makes the encoding of __dir__ to the same encoding of __FILE__
  when the script name is passed from commandline.

* test/ruby/test_options.rb (test___dir__encoding): test for this change.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60300 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-10-21 15:43:05 +00:00
k0kubun 8949479e1a driver.rb: add option to specify target with rbenv
[close GH-1724]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60299 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-10-21 15:39:35 +00:00
knu 3090169c9b Allow a SortedSet to be frozen and still functional [Bug #12091]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60298 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-10-21 15:38:38 +00:00
akr b867882a1c SecureRandom.alphanumeric implemented.
[ruby-core:68098] [Feature #10849] proposed by Andrew Butterfield.

SecureRandom.choose and SecureRandom.graph is not included.
(The implementation has SecureRandom.choose but it is private.)

I feel the method name, SecureRandom.choose, doesn't represent
the behavior well.

The actual use cases of SecureRandom.graph is not obvious.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60297 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-10-21 15:21:26 +00:00
svn cd381d8acc * remove trailing spaces.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60296 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-10-21 15:19:46 +00:00
hsbt 86f1d9b705 Clarify return value for assignment methods.
https://github.com/ruby/ruby/pull/1682

  Patch by @sos4nt [fix GH-1682]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60295 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-10-21 15:19:45 +00:00
hsbt 2476bf2bb1 Clarify the behavior of IO.write without offset in write mode.
https://github.com/ruby/ruby/pull/1571

  Patch by @takanabe [fix GH-1571]
  [Bug #11638][ruby-core:71277]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60294 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-10-21 15:16:54 +00:00
k0kubun 774b42d643 erb.rb: specify frozen_string_literal: true
for compilation performance.

$ ruby ./benchmark/driver.rb -e "trunk::/Users/k0kubun/.rbenv/versions/trunk/bin/ruby;modified::/Users/k0kubun/.rbenv/versions/modified/bin/ruby" -d ./benchmark -p app_erb

-----------------------------------------------------------
benchmark results:
Execution time (sec)
name    trunk   modified
app_erb 1.911      1.885

Speedup ratio: compare with the result of `trunk' (greater is better)
name    modified
app_erb    1.014

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60293 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-10-21 15:02:46 +00:00
svn 4aed1c7fc9 * 2017-10-22
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60292 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-10-21 15:02:26 +00:00
hsbt f4ae225b04 Update some words on README.md.
* Remove space on double spaces.
  * Capitalization of "Ruby".
  * Use macOS instead of OS X.

  https://github.com/ruby/ruby/pull/1610

  Patch by @bunkrich [fix GH-1610]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60291 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-10-21 15:02:25 +00:00
hsbt 7d2e5fb979 Added explicitly require to example code.
https://github.com/ruby/ruby/pull/1666

  Patch by @guilherme [fix GH-1666]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60290 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-10-21 14:55:22 +00:00