summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2021-03-30Fixed a compilation errorNobuyoshi Nakada
Notes: Merged: https://github.com/ruby/ruby/pull/4173
2021-03-30Prefer `rb_check_funcall`.Samuel Williams
Notes: Merged: https://github.com/ruby/ruby/pull/4173
2021-03-30Update lib/timeout.rbSamuel Williams
Co-authored-by: Nobuyoshi Nakada <nobu@ruby-lang.org> Notes: Merged: https://github.com/ruby/ruby/pull/4173
2021-03-30Add hook for `Timeout.timeout`.Samuel Williams
Notes: Merged: https://github.com/ruby/ruby/pull/4173
2021-03-30* 2021-03-30 [ci skip]git
2021-03-30[ruby/irb] Prevent the completion from crashing if rdoc is missingAleksandar Ivanov
There are cases where ruby is installed without rdoc and e.g. lib/irb/cmd/help.rb also handles the LoadError Here is how to replicate the issue: ``` $ docker run -it alpine:3.13.3 sh / # apk add ruby ruby-irb ruby-io-console / # irb irb(main):001:0> Class[TAB][TAB] ``` And you end up with something like: ``` irb(main):001:0> ClassTraceback (most recent call last): 34: from /usr/bin/irb:23:in `<main>' 33: from /usr/bin/irb:23:in `load' 32: from /usr/lib/ruby/gems/2.7.0/gems/irb-1.2.6/exe/irb:11:in `<top (required)>' 31: from /usr/lib/ruby/2.7.0/irb.rb:400:in `start' 30: from /usr/lib/ruby/2.7.0/irb.rb:471:in `run' 29: from /usr/lib/ruby/2.7.0/irb.rb:471:in `catch' 28: from /usr/lib/ruby/2.7.0/irb.rb:472:in `block in run' 27: from /usr/lib/ruby/2.7.0/irb.rb:537:in `eval_input' 26: from /usr/lib/ruby/2.7.0/irb/ruby-lex.rb:150:in `each_top_level_statement' 25: from /usr/lib/ruby/2.7.0/irb/ruby-lex.rb:150:in `catch' 24: from /usr/lib/ruby/2.7.0/irb/ruby-lex.rb:151:in `block in each_top_level_statement' 23: from /usr/lib/ruby/2.7.0/irb/ruby-lex.rb:151:in `loop' 22: from /usr/lib/ruby/2.7.0/irb/ruby-lex.rb:154:in `block (2 levels) in each_top_level_statement' 21: from /usr/lib/ruby/2.7.0/irb/ruby-lex.rb:182:in `lex' 20: from /usr/lib/ruby/2.7.0/irb.rb:518:in `block in eval_input' 19: from /usr/lib/ruby/2.7.0/irb.rb:704:in `signal_status' 18: from /usr/lib/ruby/2.7.0/irb.rb:519:in `block (2 levels) in eval_input' 17: from /usr/lib/ruby/2.7.0/irb/input-method.rb:294:in `gets' 16: from /usr/lib/ruby/2.7.0/forwardable.rb:235:in `readmultiline' 15: from /usr/lib/ruby/2.7.0/forwardable.rb:235:in `readmultiline' 14: from /usr/lib/ruby/2.7.0/reline.rb:175:in `readmultiline' 13: from /usr/lib/ruby/2.7.0/reline.rb:238:in `inner_readline' 12: from /usr/lib/ruby/2.7.0/reline.rb:238:in `loop' 11: from /usr/lib/ruby/2.7.0/reline.rb:239:in `block in inner_readline' 10: from /usr/lib/ruby/2.7.0/reline.rb:270:in `read_io' 9: from /usr/lib/ruby/2.7.0/reline.rb:270:in `loop' 8: from /usr/lib/ruby/2.7.0/reline.rb:311:in `block in read_io' 7: from /usr/lib/ruby/2.7.0/reline.rb:240:in `block (2 levels) in inner_readline' 6: from /usr/lib/ruby/2.7.0/reline.rb:240:in `each' 5: from /usr/lib/ruby/2.7.0/reline.rb:241:in `block (3 levels) in inner_readline' 4: from /usr/lib/ruby/2.7.0/reline/line_editor.rb:820:in `input_key' 3: from /usr/lib/ruby/2.7.0/reline/line_editor.rb:608:in `complete' 2: from /usr/lib/ruby/2.7.0/irb/completion.rb:269:in `block in <module:InputCompletor>' 1: from /usr/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:92:in `require' /usr/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:92:in `require': cannot load such file -- rdoc (LoadError) ``` https://github.com/ruby/irb/commit/a2d299c2ac
2021-03-29Add more tests for defined? with method callsJeremy Evans
Notes: Merged: https://github.com/ruby/ruby/pull/4213
2021-03-29Make defined? cache the results of method callsJeremy Evans
Previously, defined? could result in many more method calls than the code it was checking. `defined? a.b.c.d.e.f` generated 15 calls, with `a` called 5 times, `b` called 4 times, etc.. This was due to the fact that defined works in a recursive manner, but it previously did not cache results. So for `defined? a.b.c.d.e.f`, the logic was similar to ```ruby return nil unless defined? a return nil unless defined? a.b return nil unless defined? a.b.c return nil unless defined? a.b.c.d return nil unless defined? a.b.c.d.e return nil unless defined? a.b.c.d.e.f "method" ``` With this change, the logic is similar to the following, without the creation of a local variable: ```ruby return nil unless defined? a _ = a return nil unless defined? _.b _ = _.b return nil unless defined? _.c _ = _.c return nil unless defined? _.d _ = _.d return nil unless defined? _.e _ = _.e return nil unless defined? _.f "method" ``` In addition to eliminating redundant method calls for defined statements, this greatly simplifies the instruction sequences by eliminating duplication. Previously: ``` 0000 putnil ( 1)[Li] 0001 putself 0002 defined func, :a, false 0006 branchunless 73 0008 putself 0009 opt_send_without_block <calldata!mid:a, argc:0, FCALL|VCALL|ARGS_SIMPLE> 0011 defined method, :b, false 0015 branchunless 73 0017 putself 0018 opt_send_without_block <calldata!mid:a, argc:0, FCALL|VCALL|ARGS_SIMPLE> 0020 opt_send_without_block <calldata!mid:b, argc:0, ARGS_SIMPLE> 0022 defined method, :c, false 0026 branchunless 73 0028 putself 0029 opt_send_without_block <calldata!mid:a, argc:0, FCALL|VCALL|ARGS_SIMPLE> 0031 opt_send_without_block <calldata!mid:b, argc:0, ARGS_SIMPLE> 0033 opt_send_without_block <calldata!mid:c, argc:0, ARGS_SIMPLE> 0035 defined method, :d, false 0039 branchunless 73 0041 putself 0042 opt_send_without_block <calldata!mid:a, argc:0, FCALL|VCALL|ARGS_SIMPLE> 0044 opt_send_without_block <calldata!mid:b, argc:0, ARGS_SIMPLE> 0046 opt_send_without_block <calldata!mid:c, argc:0, ARGS_SIMPLE> 0048 opt_send_without_block <calldata!mid:d, argc:0, ARGS_SIMPLE> 0050 defined method, :e, false 0054 branchunless 73 0056 putself 0057 opt_send_without_block <calldata!mid:a, argc:0, FCALL|VCALL|ARGS_SIMPLE> 0059 opt_send_without_block <calldata!mid:b, argc:0, ARGS_SIMPLE> 0061 opt_send_without_block <calldata!mid:c, argc:0, ARGS_SIMPLE> 0063 opt_send_without_block <calldata!mid:d, argc:0, ARGS_SIMPLE> 0065 opt_send_without_block <calldata!mid:e, argc:0, ARGS_SIMPLE> 0067 defined method, :f, true 0071 swap 0072 pop 0073 leave ``` After change: ``` 0000 putnil ( 1)[Li] 0001 putself 0002 dup 0003 defined func, :a, false 0007 branchunless 52 0009 opt_send_without_block <calldata!mid:a, argc:0, FCALL|VCALL|ARGS_SIMPLE> 0011 dup 0012 defined method, :b, false 0016 branchunless 52 0018 opt_send_without_block <calldata!mid:b, argc:0, ARGS_SIMPLE> 0020 dup 0021 defined method, :c, false 0025 branchunless 52 0027 opt_send_without_block <calldata!mid:c, argc:0, ARGS_SIMPLE> 0029 dup 0030 defined method, :d, false 0034 branchunless 52 0036 opt_send_without_block <calldata!mid:d, argc:0, ARGS_SIMPLE> 0038 dup 0039 defined method, :e, false 0043 branchunless 52 0045 opt_send_without_block <calldata!mid:e, argc:0, ARGS_SIMPLE> 0047 defined method, :f, true 0051 swap 0052 pop 0053 leave ``` This fixes issues where for pathological small examples, Ruby would generate huge instruction sequences. Unfortunately, implementing this support is kind of a hack. This adds another parameter to compile_call for whether we should assume the receiver is already present on the stack, and has defined? set that parameter for the specific case where it is compiling a method call where the receiver is also a method call. defined_expr0 also takes an additional parameter for whether it should leave the results of the method call on the stack. If that argument is true, in the case where the method isn't defined, we jump to the pop before the leave, so the extra result is not left on the stack. This requires space for an additional label, so lfinish now needs to be able to hold 3 labels. Fixes [Bug #17649] Fixes [Bug #13708] Notes: Merged: https://github.com/ruby/ruby/pull/4213
2021-03-29[ruby/optparse] bump up to 0.1.1Nobuyoshi Nakada
https://github.com/ruby/optparse/commit/2fe984a603
2021-03-29[ruby/optparse] Fixed error message of unparsed non-optionNobuyoshi Nakada
Close https://github.com/ruby/optparse/issues/3 https://github.com/ruby/optparse/commit/94c5cf4032
2021-03-29[ruby/optparse] Completion scripts themselves are not executableNobuyoshi Nakada
https://github.com/ruby/optparse/commit/65d8aff935
2021-03-29[ruby/optparse] Exclude unnecessary files from the packageNobuyoshi Nakada
https://github.com/ruby/optparse/commit/dfd9380231
2021-03-29[ruby/optparse] Change *opts to *params, to avoid confusionBurdetteLamar
https://github.com/ruby/optparse/commit/f5f5e202dd
2021-03-29[ruby/optparse] Add OptionParser#require_exact accessorJeremy Evans
This allows you to disable allowing abbreviations of long options and using short options for long options. Implements Ruby Feature #11523 https://github.com/ruby/optparse/commit/dfefb2d2e2
2021-03-29[ruby/optparse] Use ZDOTDIR env var to locate .zshrcMartin Rey
https://github.com/ruby/optparse/commit/c4977674bf
2021-03-29sync_default_gems.rb: ignore COPYING file [ci skip]Nobuyoshi Nakada
2021-03-29sync_default_gems.rb: IO#puts prints a newline between each argument [ci skip]Nobuyoshi Nakada
2021-03-29[DOC] Improve an example of Array#count comparison [ci skip]Nobuyoshi Nakada
2021-03-29fiber context update for Mac OS.David CARLIER
it is more about memory accounting sake. At allocation time, we make clear we re possibly reusing regions marked as reusable. Noted also calls might not necessarily succeed at first so we do only when necessary. Notes: Merged: https://github.com/ruby/ruby/pull/4313
2021-03-29[ruby/irb] Always add input method when calling Irb.new in testsaycabta
When passes input method as nil to Context.new through Irb.new, ReidlineInputMethod.new is executed and the global internal state of Reline is rewritten, therefore other tests are failed in the Ruby repository. This commit changes to use TestInputMethod. https://github.com/ruby/irb/commit/010dce9210
2021-03-29* 2021-03-29 [ci skip]git
2021-03-28[Doc] Fix Array#count comparing strategyKenichi Kamiya
Notes: Merged: https://github.com/ruby/ruby/pull/4332
2021-03-28[ruby/io-console] bump up to 0.5.9Nobuyoshi Nakada
https://github.com/ruby/io-console/commit/302e86a28c https://github.com/ruby/io-console/commit/0690862526
2021-03-28sync_default_gems.rb: remove un-committed files [ci skip]Nobuyoshi Nakada
As files non-existing in the repository cannot be checked out, remove files to be ignored once, and re-check the status.
2021-03-28sync_default_gems.rb: search the last merge more strictly [ci skip]Nobuyoshi Nakada
As tag-only match, `[#{repo}]`, may find unexpected commit, e.g., 5bfca88f760727240902a70d1df0cc516ff31a70 for io-console, match by more exact URL pattern.
2021-03-28sync_default_gems.rb: escape filter command [ci skip]Nobuyoshi Nakada
2021-03-28sync_default_gems.rb: message when no commits [ci skip]Nobuyoshi Nakada
2021-03-28Force recycle intermediate collection in Hash#transform_keys! [Bug #17735]Kenichi Kamiya
* Force recycle intermediate hash * Force recycle intermediate array too https://github.com/ruby/ruby/pull/4329#issuecomment-808840718 Notes: Merged-By: nobu <nobu@ruby-lang.org>
2021-03-28[ruby/pathname] Fix segfault of Pathname#splitKenichi Kamiya
Fix segmentation fault of Pathname#split when File.split returns non array value [Bug #17755] https://github.com/ruby/pathname/commit/e29b49e3b1 https://github.com/ruby/pathname/commit/1db7479a74
2021-03-28[ruby/pathname] Support Ruby 3.0Hiroshi SHIBATA
Update test/pathname/test_pathname.rb https://github.com/ruby/pathname/commit/29645187e0 https://github.com/ruby/pathname/commit/78584864de Co-authored-by: Nobuyoshi Nakada <nobu@ruby-lang.org>
2021-03-28sync_default_gems.rb: preserve Co-Authored-By:Nobuyoshi Nakada
2021-03-28Hide an intermediate arrayNobuyoshi Nakada
2021-03-28Clear an intermediate hash [Bug #17735]Nobuyoshi Nakada
2021-03-28Keep non evaluated keys in `Hash#transform_keys!` [Bug #17735]Kenichi Kamiya
Notes: Merged: https://github.com/ruby/ruby/pull/4294 Merged-By: nobu <nobu@ruby-lang.org>
2021-03-28Remove unneeded rb_ident_hash_new function declarationS-H-GAMELINKS
Notes: Merged: https://github.com/ruby/ruby/pull/4325
2021-03-28* 2021-03-28 [ci skip]git
2021-03-28Fix segmentation fault when `Module#name` returns non string value [Bug #17754]Kenichi Kamiya
* Add test for NoMethodError#to_s does not segfault * Ensure no segfault even if Module#name is overridden Notes: Merged: https://github.com/ruby/ruby/pull/4328 Merged-By: nobu <nobu@ruby-lang.org>
2021-03-27Update to ruby/spec@fd6edddBenoit Daloze
2021-03-27Update to ruby/mspec@d1adf59Benoit Daloze
2021-03-27[Doc] Update regex engine to Onigumo in doc/extension.* [ci skip]Kenichi Kamiya
regex.c has been removed in 8e65234086a15f90585bc09cce82dbad2aa647d7 Notes: Merged: https://github.com/ruby/ruby/pull/4306 Merged-By: nobu <nobu@ruby-lang.org>
2021-03-27Add rb_exc_exception functionS.H
`rb_exc_raise` and `rb_fatal` func have similar code(in `eval.c`). I think that better cut out and replace these code like `rb_exc_exception` function. Notes: Merged: https://github.com/ruby/ruby/pull/4319 Merged-By: nobu <nobu@ruby-lang.org>
2021-03-27Fix Enumerable#tally with some arguments pattern [Feature #17744]Kenichi Kamiya
* Add test cases for Enumerable#tally with hash argument * Add ruby/spec for Enumerable#tally with hash argument * Fix Enumerable#tally does not update given frozen hash * Add test cases for Enumerable#tally with hash convertible arguments * Fix SEGV when Enumerable#tally takes non Hash convertible * FIx cosmetic damage enum.c Notes: Merged: https://github.com/ruby/ruby/pull/4327 Merged-By: nobu <nobu@ruby-lang.org>
2021-03-27* 2021-03-27 [ci skip]git
2021-03-27No codesign in testsNobuyoshi Nakada
2021-03-26Enumerable#tally with the resulting hash [Feature #17744]Nobuyoshi Nakada
Notes: Merged: https://github.com/ruby/ruby/pull/4318 Merged-By: nobu <nobu@ruby-lang.org>
2021-03-26[ruby/erb] Version 2.2.3Takashi Kokubun
https://github.com/ruby/erb/commit/03bc4a8274
2021-03-26[ruby/erb] Clarify supported ruby versions in gemspecKenichi Kamiya
https://github.com/ruby/erb/commit/b40db4114a
2021-03-26* 2021-03-26 [ci skip]git
2021-03-26Stop downloading Unicode files twiceNobuyoshi Nakada
These files should have been downloaded in update-remote.
2021-03-25[ruby/irb] Cache completion files to requireaycabta
https://github.com/ruby/irb/commit/612ebcb311