Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: jruby/jruby
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: d6e561d981b4^
Choose a base ref
...
head repository: jruby/jruby
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: a6fca158e575
Choose a head ref
  • 2 commits
  • 259 files changed
  • 1 contributor

Commits on Oct 12, 2017

  1. Copy the full SHA
    d6e561d View commit details
  2. Update tests from Ruby 2.3.5.

    headius committed Oct 12, 2017
    Copy the full SHA
    a6fca15 View commit details
Showing with 3,326 additions and 651 deletions.
  1. +7 −7 lib/ruby/stdlib/erb.rb
  2. +1 −0 lib/ruby/stdlib/fileutils.rb
  3. +33 −36 lib/ruby/stdlib/forwardable.rb
  4. +1 −1 lib/ruby/stdlib/irb/ruby-lex.rb
  5. +1 −15 lib/ruby/stdlib/net/http.rb
  6. +30 −2 lib/ruby/stdlib/net/http/header.rb
  7. +18 −0 lib/ruby/stdlib/net/protocol.rb
  8. +11 −2 lib/ruby/stdlib/net/smtp.rb
  9. +13 −7 lib/ruby/stdlib/optparse.rb
  10. +5 −1 lib/ruby/stdlib/ostruct.rb
  11. +1 −1 lib/ruby/stdlib/pathname.rb
  12. +26 −3 lib/ruby/stdlib/rexml/functions.rb
  13. +8 −0 lib/ruby/stdlib/rexml/parsers/streamparser.rb
  14. +1 −1 lib/ruby/stdlib/rss/rss.rb
  15. +10 −10 lib/ruby/stdlib/uri/mailto.rb
  16. +0 −4 lib/ruby/stdlib/webrick/httpstatus.rb
  17. +2 −2 lib/ruby/stdlib/webrick/log.rb
  18. +6 −4 lib/ruby/stdlib/win32/registry.rb
  19. +15 −0 lib/ruby/stdlib/win32/resolv.rb
  20. +9 −0 test/mri/-ext-/string/test_fstring.rb
  21. +10 −0 test/mri/-ext-/string/test_modify_expand.rb
  22. +23 −0 test/mri/-ext-/thread_fd_close/test_thread_fd_close.rb
  23. +11 −0 test/mri/-ext-/typeddata/test_typeddata.rb
  24. +13 −8 test/mri/bigdecimal/test_bigdecimal.rb
  25. +10 −1 test/mri/coverage/test_coverage.rb
  26. +2 −0 test/mri/date/test_date.rb
  27. +8 −0 test/mri/date/test_date_strftime.rb
  28. +27 −43 test/mri/drb/ut_timerholder.rb
  29. +16 −0 test/mri/erb/test_erb.rb
  30. +3 −3 test/mri/fiddle/test_pointer.rb
  31. +34 −3 test/mri/fileutils/test_fileutils.rb
  32. +31 −0 test/mri/io/console/test_io_console.rb
  33. +11 −2 test/mri/lib/test/unit/assertions.rb
  34. +1 −2 test/mri/lib/test/unit/parallel.rb
  35. +90 −0 test/mri/logger/test_logdevice.rb
  36. +5 −1 test/mri/misc/test_ruby_mode.rb
  37. +10 −0 test/mri/net/ftp/test_ftp.rb
  38. +44 −0 test/mri/net/http/test_http.rb
  39. +11 −0 test/mri/net/http/test_httpheader.rb
  40. +118 −0 test/mri/net/smtp/test_smtp.rb
  41. +5 −0 test/mri/net/smtp/test_ssl_socket.rb
  42. +23 −0 test/mri/openssl/test_asn1.rb
  43. +31 −4 test/mri/openssl/test_bn.rb
  44. +23 −6 test/mri/openssl/test_cipher.rb
  45. +12 −1 test/mri/openssl/test_digest.rb
  46. +11 −0 test/mri/openssl/test_pair.rb
  47. +22 −0 test/mri/openssl/test_ssl.rb
  48. +0 −1 test/mri/openssl/test_ssl_session.rb
  49. +15 −9 test/mri/openssl/test_x509ext.rb
  50. +26 −0 test/mri/openssl/test_x509store.rb
  51. +3 −0 test/mri/optparse/test_acceptable.rb
  52. +18 −0 test/mri/optparse/test_cclass.rb
  53. +11 −1 test/mri/ostruct/test_ostruct.rb
  54. +4 −2 test/mri/pathname/test_pathname.rb
  55. +5 −0 test/mri/psych/test_psych.rb
  56. +6 −0 test/mri/psych/visitors/test_yaml_tree.rb
  57. +10 −0 test/mri/rdoc/test.ja.rdoc
  58. +32 −0 test/mri/rexml/parser/test_stream.rb
  59. +13 −0 test/mri/rexml/test_functions.rb
  60. +4 −0 test/mri/rinda/test_rinda.rb
  61. +35 −0 test/mri/ripper/test_lexer.rb
  62. +6 −0 test/mri/ripper/test_scanner_events.rb
  63. +24 −0 test/mri/rss/test_to_s.rb
  64. +20 −0 test/mri/ruby/bug-13526.rb
  65. +68 −0 test/mri/ruby/enc/test_utf32.rb
  66. +0 −7 test/mri/ruby/marshaltestlib.rb
  67. +42 −5 test/mri/ruby/test_array.rb
  68. +5 −0 test/mri/ruby/test_autoload.rb
  69. +8 −0 test/mri/ruby/test_call.rb
  70. +19 −0 test/mri/ruby/test_class.rb
  71. +4 −0 test/mri/ruby/test_defined.rb
  72. +3 −1 test/mri/ruby/test_dir_m17n.rb
  73. +8 −0 test/mri/ruby/test_eval.rb
  74. +105 −0 test/mri/ruby/test_exception.rb
  75. +3 −1 test/mri/ruby/test_file.rb
  76. +237 −88 test/mri/ruby/test_file_exhaustive.rb
  77. +7 −0 test/mri/ruby/test_float.rb
  78. +7 −0 test/mri/ruby/test_gc.rb
  79. +13 −0 test/mri/ruby/test_hash.rb
  80. +108 −0 test/mri/ruby/test_io.rb
  81. +2 −2 test/mri/ruby/test_io_m17n.rb
  82. +19 −1 test/mri/ruby/test_iseq.rb
  83. +39 −0 test/mri/ruby/test_keyword.rb
  84. +7 −0 test/mri/ruby/test_lambda.rb
  85. +8 −1 test/mri/ruby/test_m17n.rb
  86. +15 −0 test/mri/ruby/test_marshal.rb
  87. +28 −0 test/mri/ruby/test_method.rb
  88. +10 −0 test/mri/ruby/test_module.rb
  89. +46 −0 test/mri/ruby/test_objectspace.rb
  90. +46 −2 test/mri/ruby/test_optimization.rb
  91. +7 −0 test/mri/ruby/test_pack.rb
  92. +12 −0 test/mri/ruby/test_parse.rb
  93. +46 −4 test/mri/ruby/test_process.rb
  94. +4 −0 test/mri/ruby/test_rand.rb
  95. +18 −0 test/mri/ruby/test_rational.rb
  96. +53 −0 test/mri/ruby/test_refinement.rb
  97. +28 −3 test/mri/ruby/test_regexp.rb
  98. +20 −0 test/mri/ruby/test_require.rb
  99. +28 −0 test/mri/ruby/test_rubyoptions.rb
  100. +168 −3 test/mri/ruby/test_settracefunc.rb
  101. +62 −0 test/mri/ruby/test_sprintf.rb
  102. +7 −0 test/mri/ruby/test_string.rb
  103. +14 −0 test/mri/ruby/test_super.rb
  104. +48 −0 test/mri/ruby/test_symbol.rb
  105. +19 −1 test/mri/ruby/test_syntax.rb
  106. +27 −2 test/mri/ruby/test_thread.rb
  107. +15 −0 test/mri/ruby/test_trace.rb
  108. +23 −7 test/mri/ruby/test_transcode.rb
  109. +1 −1 test/mri/rubygems/bad_rake.rb
  110. +1 −1 test/mri/rubygems/bogussources.rb
  111. +1 −1 test/mri/rubygems/fake_certlib/openssl.rb
  112. +1 −1 test/mri/rubygems/fix_openssl_warnings.rb
  113. +1 −1 test/mri/rubygems/foo/discover.rb
  114. +1 −1 test/mri/rubygems/good_rake.rb
  115. +1 −1 test/mri/rubygems/plugin/exception/rubygems_plugin.rb
  116. +1 −1 test/mri/rubygems/plugin/load/rubygems_plugin.rb
  117. +1 −1 test/mri/rubygems/plugin/standarderror/rubygems_plugin.rb
  118. +1 −1 test/mri/rubygems/rubygems/commands/crash_command.rb
  119. +1 −1 test/mri/rubygems/rubygems_plugin.rb
  120. +1 −1 test/mri/rubygems/sff/discover.rb
  121. +1 −1 test/mri/rubygems/simple_gem.rb
  122. +40 −38 test/mri/rubygems/test_bundled_ca.rb
  123. +1 −1 test/mri/rubygems/test_config.rb
  124. +1 −1 test/mri/rubygems/test_deprecate.rb
  125. +1 −2 test/mri/rubygems/test_gem.rb
  126. +1 −1 test/mri/rubygems/test_gem_available_set.rb
  127. +1 −1 test/mri/rubygems/test_gem_command.rb
  128. +1 −1 test/mri/rubygems/test_gem_command_manager.rb
  129. +11 −1 test/mri/rubygems/test_gem_commands_build_command.rb
  130. +1 −1 test/mri/rubygems/test_gem_commands_cert_command.rb
  131. +1 −1 test/mri/rubygems/test_gem_commands_check_command.rb
  132. +1 −1 test/mri/rubygems/test_gem_commands_cleanup_command.rb
  133. +1 −1 test/mri/rubygems/test_gem_commands_contents_command.rb
  134. +1 −1 test/mri/rubygems/test_gem_commands_dependency_command.rb
  135. +1 −1 test/mri/rubygems/test_gem_commands_environment_command.rb
  136. +1 −1 test/mri/rubygems/test_gem_commands_fetch_command.rb
  137. +1 −1 test/mri/rubygems/test_gem_commands_generate_index_command.rb
  138. +1 −1 test/mri/rubygems/test_gem_commands_help_command.rb
  139. +1 −1 test/mri/rubygems/test_gem_commands_install_command.rb
  140. +1 −1 test/mri/rubygems/test_gem_commands_list_command.rb
  141. +1 −1 test/mri/rubygems/test_gem_commands_lock_command.rb
  142. +1 −1 test/mri/rubygems/test_gem_commands_mirror.rb
  143. +1 −1 test/mri/rubygems/test_gem_commands_open_command.rb
  144. +1 −1 test/mri/rubygems/test_gem_commands_outdated_command.rb
  145. +1 −1 test/mri/rubygems/test_gem_commands_owner_command.rb
  146. +1 −1 test/mri/rubygems/test_gem_commands_pristine_command.rb
  147. +28 −1 test/mri/rubygems/test_gem_commands_push_command.rb
  148. +104 −1 test/mri/rubygems/test_gem_commands_query_command.rb
  149. +1 −1 test/mri/rubygems/test_gem_commands_search_command.rb
  150. +1 −1 test/mri/rubygems/test_gem_commands_server_command.rb
  151. +1 −2 test/mri/rubygems/test_gem_commands_setup_command.rb
  152. +1 −1 test/mri/rubygems/test_gem_commands_sources_command.rb
  153. +1 −1 test/mri/rubygems/test_gem_commands_specification_command.rb
  154. +1 −1 test/mri/rubygems/test_gem_commands_stale_command.rb
  155. +1 −1 test/mri/rubygems/test_gem_commands_uninstall_command.rb
  156. +1 −1 test/mri/rubygems/test_gem_commands_unpack_command.rb
  157. +1 −1 test/mri/rubygems/test_gem_commands_update_command.rb
  158. +1 −1 test/mri/rubygems/test_gem_commands_which_command.rb
  159. +13 −11 test/mri/rubygems/test_gem_commands_yank_command.rb
  160. +24 −1 test/mri/rubygems/test_gem_config_file.rb
  161. +1 −1 test/mri/rubygems/test_gem_dependency.rb
  162. +1 −1 test/mri/rubygems/test_gem_dependency_installer.rb
  163. +1 −1 test/mri/rubygems/test_gem_dependency_list.rb
  164. +1 −1 test/mri/rubygems/test_gem_dependency_resolution_error.rb
  165. +1 −1 test/mri/rubygems/test_gem_doctor.rb
  166. +6 −2 test/mri/rubygems/test_gem_ext_builder.rb
  167. +1 −1 test/mri/rubygems/test_gem_ext_cmake_builder.rb
  168. +1 −1 test/mri/rubygems/test_gem_ext_configure_builder.rb
  169. +1 −1 test/mri/rubygems/test_gem_ext_ext_conf_builder.rb
  170. +1 −1 test/mri/rubygems/test_gem_ext_rake_builder.rb
  171. +1 −1 test/mri/rubygems/test_gem_gem_runner.rb
  172. +1 −1 test/mri/rubygems/test_gem_gemcutter_utilities.rb
  173. +1 −1 test/mri/rubygems/test_gem_impossible_dependencies_error.rb
  174. +1 −1 test/mri/rubygems/test_gem_indexer.rb
  175. +13 −1 test/mri/rubygems/test_gem_install_update_options.rb
  176. +37 −5 test/mri/rubygems/test_gem_installer.rb
  177. +1 −1 test/mri/rubygems/test_gem_local_remote_options.rb
  178. +1 −1 test/mri/rubygems/test_gem_name_tuple.rb
  179. +16 −10 test/mri/rubygems/test_gem_package.rb
  180. +1 −1 test/mri/rubygems/test_gem_package_old.rb
  181. +1 −1 test/mri/rubygems/test_gem_package_tar_header.rb
  182. +1 −1 test/mri/rubygems/test_gem_package_tar_reader.rb
  183. +2 −2 test/mri/rubygems/test_gem_package_tar_reader_entry.rb
  184. +1 −1 test/mri/rubygems/test_gem_package_tar_writer.rb
  185. +1 −1 test/mri/rubygems/test_gem_package_task.rb
  186. +1 −1 test/mri/rubygems/test_gem_path_support.rb
  187. +1 −1 test/mri/rubygems/test_gem_platform.rb
  188. +1 −1 test/mri/rubygems/test_gem_rdoc.rb
  189. +18 −1 test/mri/rubygems/test_gem_remote_fetcher.rb
  190. +1 −1 test/mri/rubygems/test_gem_request.rb
  191. +1 −1 test/mri/rubygems/test_gem_request_connection_pools.rb
  192. +3 −3 test/mri/rubygems/test_gem_request_set.rb
  193. +34 −46 test/mri/rubygems/test_gem_request_set_gem_dependency_api.rb
  194. +1 −1 test/mri/rubygems/test_gem_request_set_lockfile.rb
  195. +9 −4 test/mri/rubygems/test_gem_request_set_lockfile_parser.rb
  196. +1 −1 test/mri/rubygems/test_gem_request_set_lockfile_tokenizer.rb
  197. +1 −1 test/mri/rubygems/test_gem_requirement.rb
  198. +1 −1 test/mri/rubygems/test_gem_resolver.rb
  199. +1 −1 test/mri/rubygems/test_gem_resolver_activation_request.rb
  200. +1 −1 test/mri/rubygems/test_gem_resolver_api_set.rb
  201. +1 −1 test/mri/rubygems/test_gem_resolver_api_specification.rb
  202. +1 −1 test/mri/rubygems/test_gem_resolver_best_set.rb
  203. +1 −1 test/mri/rubygems/test_gem_resolver_composed_set.rb
  204. +1 −1 test/mri/rubygems/test_gem_resolver_conflict.rb
  205. +1 −1 test/mri/rubygems/test_gem_resolver_dependency_request.rb
  206. +1 −1 test/mri/rubygems/test_gem_resolver_git_set.rb
  207. +1 −1 test/mri/rubygems/test_gem_resolver_git_specification.rb
  208. +1 −1 test/mri/rubygems/test_gem_resolver_index_set.rb
  209. +1 −1 test/mri/rubygems/test_gem_resolver_index_specification.rb
  210. +1 −1 test/mri/rubygems/test_gem_resolver_installed_specification.rb
  211. +1 −1 test/mri/rubygems/test_gem_resolver_installer_set.rb
  212. +1 −1 test/mri/rubygems/test_gem_resolver_local_specification.rb
  213. +1 −1 test/mri/rubygems/test_gem_resolver_lock_set.rb
  214. +7 −7 test/mri/rubygems/test_gem_resolver_lock_specification.rb
  215. +1 −1 test/mri/rubygems/test_gem_resolver_requirement_list.rb
  216. +1 −1 test/mri/rubygems/test_gem_resolver_specification.rb
  217. +1 −1 test/mri/rubygems/test_gem_resolver_vendor_set.rb
  218. +1 −1 test/mri/rubygems/test_gem_resolver_vendor_specification.rb
  219. +1 −1 test/mri/rubygems/test_gem_security.rb
  220. +1 −1 test/mri/rubygems/test_gem_security_policy.rb
  221. +1 −1 test/mri/rubygems/test_gem_security_signer.rb
  222. +1 −1 test/mri/rubygems/test_gem_security_trust_dir.rb
  223. +1 −1 test/mri/rubygems/test_gem_server.rb
  224. +1 −1 test/mri/rubygems/test_gem_silent_ui.rb
  225. +1 −1 test/mri/rubygems/test_gem_source.rb
  226. +1 −1 test/mri/rubygems/test_gem_source_fetch_problem.rb
  227. +1 −1 test/mri/rubygems/test_gem_source_git.rb
  228. +1 −1 test/mri/rubygems/test_gem_source_installed.rb
  229. +1 −1 test/mri/rubygems/test_gem_source_list.rb
  230. +1 −1 test/mri/rubygems/test_gem_source_local.rb
  231. +1 −1 test/mri/rubygems/test_gem_source_lock.rb
  232. +1 −1 test/mri/rubygems/test_gem_source_specific_file.rb
  233. +1 −1 test/mri/rubygems/test_gem_source_vendor.rb
  234. +1 −1 test/mri/rubygems/test_gem_spec_fetcher.rb
  235. +111 −66 test/mri/rubygems/test_gem_specification.rb
  236. +1 −1 test/mri/rubygems/test_gem_stream_ui.rb
  237. +1 −1 test/mri/rubygems/test_gem_stub_specification.rb
  238. +12 −1 test/mri/rubygems/test_gem_text.rb
  239. +1 −1 test/mri/rubygems/test_gem_uninstaller.rb
  240. +1 −1 test/mri/rubygems/test_gem_unsatisfiable_dependency_error.rb
  241. +1 −1 test/mri/rubygems/test_gem_uri_formatter.rb
  242. +1 −1 test/mri/rubygems/test_gem_util.rb
  243. +1 −1 test/mri/rubygems/test_gem_validator.rb
  244. +1 −1 test/mri/rubygems/test_gem_version.rb
  245. +1 −1 test/mri/rubygems/test_gem_version_option.rb
  246. +1 −1 test/mri/rubygems/test_kernel.rb
  247. +1 −1 test/mri/rubygems/test_require.rb
  248. +4 −0 test/mri/stringio/test_stringio.rb
  249. +10 −0 test/mri/strscan/test_stringscanner.rb
  250. +51 −3 test/mri/test_forwardable.rb
  251. +7 −0 test/mri/test_tempfile.rb
  252. +18 −1 test/mri/thread/test_queue.rb
  253. +9 −0 test/mri/uri/test_generic.rb
  254. +62 −11 test/mri/uri/test_mailto.rb
  255. +14 −0 test/mri/webrick/test_cgi.rb
  256. +36 −0 test/mri/webrick/test_httpauth.rb
  257. +3 −1 test/mri/webrick/webrick.cgi
  258. +12 −0 test/mri/zlib/test_zlib.rb
  259. 0 tool/{globals_2_3_3.rb → globals_2_3_5.rb}
14 changes: 7 additions & 7 deletions lib/ruby/stdlib/erb.rb
Original file line number Diff line number Diff line change
@@ -429,10 +429,10 @@ def scan_line(line)
end

def trim_line1(line)
line.scan(/(.*?)(<%%|%%>|<%=|<%#|<%|%>\n|%>|\n|\z)/m) do |tokens|
line.scan(/(.*?)(<%%|%%>|<%=|<%#|<%|%>\r?\n|%>|\n|\z)/m) do |tokens|
tokens.each do |token|
next if token.empty?
if token == "%>\n"
if token == "%>\n" || token == "%>\r\n"
yield('%>')
yield(:cr)
else
@@ -444,11 +444,11 @@ def trim_line1(line)

def trim_line2(line)
head = nil
line.scan(/(.*?)(<%%|%%>|<%=|<%#|<%|%>\n|%>|\n|\z)/m) do |tokens|
line.scan(/(.*?)(<%%|%%>|<%=|<%#|<%|%>\r?\n|%>|\n|\z)/m) do |tokens|
tokens.each do |token|
next if token.empty?
head = token unless head
if token == "%>\n"
if token == "%>\n" || token == "%>\r\n"
yield('%>')
if is_erb_stag?(head)
yield(:cr)
@@ -465,12 +465,12 @@ def trim_line2(line)
end

def explicit_trim_line(line)
line.scan(/(.*?)(^[ \t]*<%\-|<%\-|<%%|%%>|<%=|<%#|<%|-%>\n|-%>|%>|\z)/m) do |tokens|
line.scan(/(.*?)(^[ \t]*<%\-|<%\-|<%%|%%>|<%=|<%#|<%|-%>\r?\n|-%>|%>|\z)/m) do |tokens|
tokens.each do |token|
next if token.empty?
if @stag.nil? && /[ \t]*<%-/ =~ token
yield('<%')
elsif @stag && token == "-%>\n"
elsif @stag && token == "-%>\n" || token == "-%>\r\n"
yield('%>')
yield(:cr)
elsif @stag && token == '-%>'
@@ -533,7 +533,7 @@ def scan
yield('<%')
elsif elem == '-%>'
yield('%>')
yield(:cr) if scanner.scan(/(\n|\z)/)
yield(:cr) if scanner.scan(/(\r?\n|\z)/)
else
yield(elem)
end
1 change: 1 addition & 0 deletions lib/ruby/stdlib/fileutils.rb
Original file line number Diff line number Diff line change
@@ -222,6 +222,7 @@ def mkdir_p(list, options = {})
stack.push path
path = File.dirname(path)
end
stack.pop # root directory should exist
stack.reverse_each do |dir|
begin
fu_mkdir dir, options[:mode]
69 changes: 33 additions & 36 deletions lib/ruby/stdlib/forwardable.rb
Original file line number Diff line number Diff line change
@@ -178,33 +178,44 @@ def def_instance_delegators(accessor, *methods)
# q.push 23 #=> NoMethodError
#
def def_instance_delegator(accessor, method, ali = method)
accessor = accessor.to_s
if method_defined?(accessor) || private_method_defined?(accessor)
accessor = "#{accessor}()"
end
gen = Forwardable._delegator_method(self, accessor, method, ali)

line_no = __LINE__; str = %{
def #{ali}(*args, &block)
begin
#{accessor}.__send__(:#{method}, *args, &block)
rescue ::Exception
$@.delete_if{|s| ::Forwardable::FILE_REGEXP =~ s} unless ::Forwardable::debug
::Kernel::raise
end
end
}
# If it's not a class or module, it's an instance
begin
module_eval(str, __FILE__, line_no)
rescue
instance_eval(str, __FILE__, line_no)
end

(Module === self ? self : singleton_class).module_eval(&gen)
end

alias delegate instance_delegate
alias def_delegators def_instance_delegators
alias def_delegator def_instance_delegator

def self._delegator_method(obj, accessor, method, ali)
accessor = accessor.to_s unless Symbol === accessor

if Module === obj ?
obj.method_defined?(accessor) || obj.private_method_defined?(accessor) :
obj.respond_to?(accessor, true)
accessor = "#{accessor}()"
end

line_no = __LINE__+1; str = "#{<<-"begin;"}\n#{<<-"end;"}"
begin;
proc do
def #{ali}(*args, &block)
begin
#{accessor}
ensure
$@.delete_if {|s| ::Forwardable::FILE_REGEXP =~ s} if $@ and !::Forwardable::debug
end.__send__ :#{method}, *args, &block
end
end
end;

RubyVM::InstructionSequence
.compile(str, __FILE__, __FILE__, line_no,
trace_instruction: false,
tailcall_optimization: true)
.eval
end
end

# SingleForwardable can be used to setup delegation at the object level as well.
@@ -275,23 +286,9 @@ def def_single_delegators(accessor, *methods)
# the method of the same name in _accessor_). If _new_name_ is
# provided, it is used as the name for the delegate method.
def def_single_delegator(accessor, method, ali = method)
accessor = accessor.to_s
if method_defined?(accessor) || private_method_defined?(accessor)
accessor = "#{accessor}()"
end

line_no = __LINE__; str = %{
def #{ali}(*args, &block)
begin
#{accessor}.__send__(:#{method}, *args, &block)
rescue ::Exception
$@.delete_if{|s| ::Forwardable::FILE_REGEXP =~ s} unless ::Forwardable::debug
::Kernel::raise
end
end
}
gen = Forwardable._delegator_method(self, accessor, method, ali)

instance_eval(str, __FILE__, line_no)
instance_eval(&gen)
end

alias delegate single_delegate
2 changes: 1 addition & 1 deletion lib/ruby/stdlib/irb/ruby-lex.rb
Original file line number Diff line number Diff line change
@@ -792,7 +792,7 @@ def identify_identifier
token_c = TkSymbol2Token[trans[1]]
@lex_state = trans[0]
else
if @lex_state != EXPR_FNAME
if @lex_state != EXPR_FNAME and peek(0) != ':'
if ENINDENT_CLAUSE.include?(token)
# check for ``class = val'' etc.
valid = true
16 changes: 1 addition & 15 deletions lib/ruby/stdlib/net/http.rb
Original file line number Diff line number Diff line change
@@ -930,21 +930,7 @@ def connect
Process.clock_gettime(Process::CLOCK_REALTIME) < @ssl_session.time.to_f + @ssl_session.timeout
s.session = @ssl_session if @ssl_session
end
if timeout = @open_timeout
while true
raise Net::OpenTimeout if timeout <= 0
start = Process.clock_gettime Process::CLOCK_MONOTONIC
# to_io is required because SSLSocket doesn't have wait_readable yet
case s.connect_nonblock(exception: false)
when :wait_readable; s.to_io.wait_readable(timeout)
when :wait_writable; s.to_io.wait_writable(timeout)
else; break
end
timeout -= Process.clock_gettime(Process::CLOCK_MONOTONIC) - start
end
else
s.connect
end
ssl_socket_connect(s, @open_timeout)
if @ssl_context.verify_mode != OpenSSL::SSL::VERIFY_NONE
s.post_connection_check(@address)
end
32 changes: 30 additions & 2 deletions lib/ruby/stdlib/net/http/header.rb
Original file line number Diff line number Diff line change
@@ -38,7 +38,7 @@ def []=(key, val)
@header.delete key.downcase
return val
end
@header[key.downcase] = [val]
set_field(key, val)
end

# [Ruby 1.8.3]
@@ -58,12 +58,40 @@ def []=(key, val)
#
def add_field(key, val)
if @header.key?(key.downcase)
@header[key.downcase].push val
append_field_value(@header[key.downcase], val)
else
set_field(key, val)
end
end

private def set_field(key, val)
case val
when Enumerable
ary = []
append_field_value(ary, val)
@header[key.downcase] = ary
else
val = val.to_s
if /[\r\n]/ =~ val
raise ArgumentError, 'header field value cannnot include CR/LF'
end
@header[key.downcase] = [val]
end
end

private def append_field_value(ary, val)
case val
when Enumerable
val.each{|x| append_field_value(ary, x)}
else
val = val.to_s
if /[\r\n]/ =~ val
raise ArgumentError, 'header field value cannnot include CR/LF'
end
ary.push val
end
end

# [Ruby 1.8.3]
# Returns an array of header field strings corresponding to the
# case-insensitive +key+. This method allows you to get duplicated
18 changes: 18 additions & 0 deletions lib/ruby/stdlib/net/protocol.rb
Original file line number Diff line number Diff line change
@@ -34,6 +34,24 @@ def #{name}
end
End
end

def ssl_socket_connect(s, timeout)
if timeout
while true
raise Net::OpenTimeout if timeout <= 0
start = Process.clock_gettime Process::CLOCK_MONOTONIC
# to_io is required because SSLSocket doesn't have wait_readable yet
case s.connect_nonblock(exception: false)
when :wait_readable; s.to_io.wait_readable(timeout)
when :wait_writable; s.to_io.wait_writable(timeout)
else; break
end
timeout -= Process.clock_gettime(Process::CLOCK_MONOTONIC) - start
end
else
s.connect
end
end
end


13 changes: 11 additions & 2 deletions lib/ruby/stdlib/net/smtp.rb
Original file line number Diff line number Diff line change
@@ -170,7 +170,7 @@ class SMTPUnsupportedCommand < ProtocolError
# Net::SMTP.start('your.smtp.server', 25, 'mail.from.domain',
# 'Your Account', 'Your Password', :cram_md5)
#
class SMTP
class SMTP < Protocol

Revision = %q$Revision$.split[1]

@@ -584,7 +584,7 @@ def tlsconnect(s)
s = ssl_socket(s, @ssl_context)
logging "TLS connection started"
s.sync_close = true
s.connect
ssl_socket_connect(s, @open_timeout)
if @ssl_context.verify_mode != OpenSSL::SSL::VERIFY_NONE
s.post_connection_check(@address)
end
@@ -926,7 +926,15 @@ def quit

private

def validate_line(line)
# A bare CR or LF is not allowed in RFC5321.
if /[\r\n]/ =~ line
raise ArgumentError, "A line must not contain CR or LF"
end
end

def getok(reqline)
validate_line reqline
res = critical {
@socket.writeline reqline
recv_response()
@@ -936,6 +944,7 @@ def getok(reqline)
end

def get_response(reqline)
validate_line reqline
@socket.writeline reqline
recv_response()
end
20 changes: 13 additions & 7 deletions lib/ruby/stdlib/optparse.rb
Original file line number Diff line number Diff line change
@@ -1836,7 +1836,7 @@ def environment(env = File.basename($0, '.*'))
#
# Float number format, and converts to Float.
#
float = "(?:#{decimal}(?:\\.(?:#{decimal})?)?|\\.#{decimal})(?:E[-+]?#{decimal})?"
float = "(?:#{decimal}(?=(.)?)(?:\\.(?:#{decimal})?)?|\\.#{decimal})(?:E[-+]?#{decimal})?"
floatpat = %r"\A[-+]?#{float}\z"io
accept(Float, floatpat) {|s,| s.to_f if s}

@@ -1845,11 +1845,13 @@ def environment(env = File.basename($0, '.*'))
# for float format, and Rational for rational format.
#
real = "[-+]?(?:#{octal}|#{float})"
accept(Numeric, /\A(#{real})(?:\/(#{real}))?\z/io) {|s, d, n|
accept(Numeric, /\A(#{real})(?:\/(#{real}))?\z/io) {|s, d, f, n,|
if n
Rational(d, n)
elsif s
eval(s)
elsif f
Float(s)
else
Integer(s)
end
}

@@ -1883,10 +1885,14 @@ def environment(env = File.basename($0, '.*'))
# integer format, Float for float format.
#
DecimalNumeric = floatpat # decimal integer is allowed as float also.
accept(DecimalNumeric, floatpat) {|s,|
accept(DecimalNumeric, floatpat) {|s, f|
begin
eval(s)
rescue SyntaxError
if f
Float(s)
else
Integer(s)
end
rescue ArgumentError
raise OptionParser::InvalidArgument, s
end if s
}
6 changes: 5 additions & 1 deletion lib/ruby/stdlib/ostruct.rb
Original file line number Diff line number Diff line change
@@ -73,7 +73,10 @@
class OpenStruct
# :nodoc:
class << self
alias allocate new
def allocate
(x = super).instance_variable_set(:@table, {})
x
end
end

#
@@ -131,6 +134,7 @@ def to_h
def each_pair
return to_enum(__method__) { @table.size } unless block_given?
@table.each_pair{|p| yield p}
self
end

#
2 changes: 1 addition & 1 deletion lib/ruby/stdlib/pathname.rb
Original file line number Diff line number Diff line change
@@ -378,7 +378,7 @@ def plus(path1, path2) # -> path # :nodoc:
basename_list2.shift
end
r1 = chop_basename(prefix1)
if !r1 && /#{SEPARATOR_PAT}/o =~ File.basename(prefix1)
if !r1 && (r1 = /#{SEPARATOR_PAT}/o =~ File.basename(prefix1))
while !basename_list2.empty? && basename_list2.first == '..'
index_list2.shift
basename_list2.shift
Loading