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

13909 Коммитов

Автор SHA1 Сообщение Дата
Nobuyoshi Nakada f43c71abe0 Implemented shareable_constant_value
It does shallow freeze only for now.
2020-12-14 19:19:16 +09:00
Nobuyoshi Nakada b1bd223085 Support shareable_constant_value pragma 2020-12-14 19:19:16 +09:00
Yusuke Endoh ab869d6b9b test/ruby/test_method_cache.rb: suppress "assigned but unused variable" 2020-12-14 15:56:13 +09:00
Koichi Sasada 0362b4c689 add tests for method cache. 2020-12-14 11:57:46 +09:00
Nobuyoshi Nakada c7530f0d56
Wait testing/helper threads to terminate 2020-12-13 13:39:57 +09:00
Kazuki Tsujimoto 88f3ce12d3
Reintroduce `expr in pat` [Feature #17371] 2020-12-13 11:51:49 +09:00
Yusuke Endoh efbef729b2 test/ruby/test_lambda.rb: prevent lambda(&proc_block) warnings 2020-12-12 23:11:47 +09:00
Koichi Sasada 124321e0c7 fix lambda's warning and tests
There are warning condition bugs and test bugs.
b53ccb9c69
2020-12-12 06:29:11 +09:00
nicholas a. evans 31e8de2920 Let Fiber#raise work with transferring fibers
This automatically choosess whether to use transfer on a transferring
fiber or resume on a yielding fiber.  If the fiber is resuming, it
raises a FiberError.
2020-12-12 10:18:19 +13:00
Nobuyoshi Nakada eea756ac86
Strip trailing spaces [ci skip] 2020-12-11 23:14:36 +09:00
ima1zumi 68d3952c52 [ruby/reline] Fix breaking to input Emoji with ZWJ.
https://github.com/ruby/reline/commit/f21dfdbb11
2020-12-11 23:08:06 +09:00
Nobuyoshi Nakada ed343c76fb
RDoc states that Process::Status.wait returns nil if cannot wait 2020-12-11 20:21:03 +09:00
Koichi Sasada b53ccb9c69 show deprecation warning correctly for lambda(&b)
lambda(&b) where b is given block of method (like: def foo(&b))
should warn correctly.
[Feature #17361]

Also labmda(&labmda_block) or lambda(&:to_s) (Symbol#to_proc)
should not warn (but I'm not sure who cares about it).
2020-12-11 11:57:25 +09:00
Kenta Murata 9b0c36b390
Import fiddle-1.0.4 (#3860)
I don't use tool/sync_default_gem.rb because the last sync was incomplete.

Co-authored-by: Hiroshi SHIBATA <hsbt@ruby-lang.org>
Co-authored-by: Alan Wu <XrXr@users.noreply.github.com>
Co-authored-by: sinisterchipmunk <sinisterchipmunk@gmail.com>
Co-authored-by: Sutou Kouhei <kou@clear-code.com>
2020-12-11 09:41:12 +09:00
Jeremy Evans dca13e2bf7 Make ruby -We the same as ruby -W -e
This changes the behavior, which I'm not sure is acceptable.
However, it's odd to allow an option to be combined, but change
the behavior of the option when combined.
2020-12-10 10:16:40 -08:00
Jeremy Evans 01b7d5acc7 Remove the uninitialized instance variable verbose mode warning
This speeds up all instance variable access, even when not in
verbose mode.  Uninitialized instance variable warnings were
rarely helpful, and resulted in slower code if you wanted to
avoid warnings when run in verbose mode.

Implements [Feature #17055]
2020-12-10 10:16:05 -08:00
Masaki Matsushita 78f188524f Add connect_timeout to TCPSocket
Add connect_timeout to TCPSocket.new in the same way as Socket.tcp.

Closes [Feature #17187]
2020-12-10 20:52:29 +09:00
Hiroshi SHIBATA 5dc786bf86 Move webrick library into internal test toolchain 2020-12-10 18:06:25 +09:00
Kenta Murata 2544f7196e
test/ruby/test_arithmetic_sequence.rb: restore test_last_bug17218
And rename the existing `test_last_bug17218` to `test_to_a_bug17218`.
2020-12-10 00:59:00 +09:00
Kenta Murata bb489aca58
memory_view.c: Add rb_memory_view_get_item and rb_memory_view_prepare_item_desc (#3871) 2020-12-10 00:24:36 +09:00
Yusuke Endoh 3156fb0f2c test/ruby/test_arithmetic_sequence.rb: remove a duplicated test
There is another "test_last_bug17218"
2020-12-10 00:16:49 +09:00
Kenta Murata fad3023e94
Fix ArithmeticSequence#last and ArithmeticSequence#each for non-integer sequences (#3870)
[Bug #17218]
[ruby-core:100312]
2020-12-09 18:48:59 +09:00
Marc-Andre Lafortune cacdf2681d [ruby/matrix] Disable Ractor test 2020-12-09 04:21:00 -05:00
Marc-Andre Lafortune a7dccd08e7 [ruby/matrix] Make frozen matrices Ractor shareable 2020-12-09 02:15:41 -05:00
Marc-Andre Lafortune 1866d483dc [ruby/prime] Optimize `Integer#prime?`
Miller Rabin algorithm can be used to test primality for integers smaller than a max value "MaxMR" (~3e24)

It can be much faster than previous implementation: ~100x faster for numbers with 13 digits, at least 5 orders of magnitude for even larger numbers (previous implementation is so slow that it requires more patience than I have for more precise estimate).

Miller Rabin test becomes faster than previous implementation at somewhere in the range 1e5-1e6. It seems that the range 62000..66000 is where Miller Rabin starts being always faster, so I picked 0xffff arbitrarily; before that, or above "MaxMR", the previous implementation remains.

I compared the `faster_prime` gem too. It is slower than previous implementation up to ~1e4. After that it becomes faster and faster compared to previous implementation, but is still slower than Miller Rabin starting at ~1e5 and up to MaxMR. Thus, after this commit, builtin `Integer#prime?` will be similar or faster than `faster_prime` up to "MaxMR".

Adapted from patch of Stephen Blackstone [Feature #16468]

Benchmark results and code: https://gist.github.com/marcandre/b263bdae488e76dabdda84daf73733b9

Co-authored-by: Stephen Blackstone <sblackstone@gmail.com>
2020-12-09 00:40:09 -05:00
Samuel Williams 2553c5f94a Add support for non-blocking `Process.wait`. 2020-12-09 08:55:35 +13:00
Nobuyoshi Nakada 2749123e21
Supported category option in Warning#warn 2020-12-08 22:50:45 +09:00
Kenta Murata 2427393b4d
Revert "test/fiddle/helper.rb: remove duplication (#3863)" (#3865)
This reverts commit bd47a8d660.

`libc_so` and `libm_so` are `nil` at line 124 because Big Sur doesn't have `/usr/lib/libSystem.B.dylib`.
The reassignment at line 127 is necessary in this case.
2020-12-08 21:58:08 +09:00
Hiroshi SHIBATA 4aca77edde Merge prepare version of RubyGems 3.2.0 2020-12-08 17:30:02 +09:00
Kenta Murata bd47a8d660
test/fiddle/helper.rb: remove duplication (#3863) 2020-12-08 15:42:31 +09:00
Nobuyoshi Nakada ea18c8bb96
Made method-local instance variables local variables 2020-12-08 11:43:42 +09:00
Kenta Murata 7e69296a2b
memory_view.c: Add rb_memory_view_extract_item_members (#3855) 2020-12-08 02:01:31 +09:00
Lars Kanis ca76337a00
Windows: Read ENV names and values as UTF-8 encoded Strings (#3818)
* Windows: Read ENV names and values as UTF-8 encoded Strings

Implements issue #12650: fix https://bugs.ruby-lang.org/issues/12650

This also removes the special encoding for ENV['PATH'] and some
complexity in the code that is unnecessary now.

* Windows: Improve readablity of getenv() encoding

getenv() did use the expected codepage as an implicit parameter of the macro.
This is mis-leading since include/ruby/win32.h has a different definition.
Using the "cp" variable explicit (like the other function calls) makes it
more readable and consistent.

* Windows: Change external C-API macros getenv() and execv() to use UTF-8

They used to process and return strings with locale encoding,
but since all ruby-internal spawn and environment functions use UTF-8,
it makes sense to change the C-API equally.
2020-12-08 02:00:39 +09:00
aycabta 3bf7b999e5 [ruby/reline] Editing to initial content is not just cursor moving
https://github.com/ruby/reline/commit/0a4f175b0a
2020-12-08 00:08:41 +09:00
Nobuyoshi Nakada 7817a438eb Removed deprecated Time#succ 2020-12-07 18:38:59 +09:00
Masaki Matsushita 5d8bcc4870 Revert getaddrinfo_a()
getaddrinfo_a() gets stuck after fork().
To avoid this, we need 1 second sleep to wait for internal
worker threads of getaddrinfo_a() to be finished, but that is unacceptable.

[Bug #17220] [Feature #17134] [Feature #17187]
2020-12-07 13:33:53 +09:00
Kenta Murata 60eabb1aa7
Revert "memory_view.c: Add rb_memory_view_extract_item_members"
This reverts the following three commits.

- ce707079c1
- 1a76bb56b0
- 51500eedef
2020-12-07 00:38:19 +09:00
Kenta Murata 51500eedef
memory_view.c: Add rb_memory_view_extract_item_members 2020-12-06 22:46:06 +09:00
Masaki Matsushita 5e58a9033f Reduce timeout of test_getaddrinfo_after_fork 2020-12-05 17:43:35 +09:00
Marc-Andre Lafortune a83a51932d [ruby/matrix] Optimize **
Avoiding recursive call would imply iterating bits starting from
most significant, which is not easy to do efficiently.
Any saving would be dwarfed by the multiplications anyways.
[Feature #15233]
2020-12-05 00:56:58 -05:00
aycabta 0cf073088e [ruby/reline] Process insertion buffer forcibly
https://github.com/ruby/reline/commit/89d49ec9e0
2020-12-05 02:58:59 +09:00
aycabta c2bd5b84d0 [ruby/reline] Support bracketed paste mode
https://github.com/ruby/reline/commit/d1a6869322
2020-12-05 02:58:59 +09:00
aycabta 7624f52757 [ruby/reline] Forced newline insertion is not just cursor moving
https://github.com/ruby/reline/commit/0e30a49d03
2020-12-05 02:58:59 +09:00
aycabta 37a574b527 [ruby/reline] Drop prompt list cache when num of lines is changed
https://github.com/ruby/reline/commit/1959e22043
2020-12-05 02:58:59 +09:00
aycabta c85035363f [ruby/reline] Key strokes like 2dl should behave d2l
Key strokes, vi arg, operator, and motion should be treated as operator, vi
arg, and motion.

https://github.com/ruby/reline/commit/d1a7e74aa4
2020-12-05 02:58:58 +09:00
manga_osyo 21f26018d2 [ruby/reline] Add test `Reline::Unicode.test_get_mbchar_width`.
https://github.com/ruby/reline/commit/301e9048fc
2020-12-05 02:58:58 +09:00
aycabta dbfc1f30d5 [ruby/reline] Add alias vi-movement-mode to vi-command-mode for compatibility
https://github.com/ruby/reline/commit/a79c297567
2020-12-05 02:58:58 +09:00
aycabta 9750c27afc [ruby/reline] Call process_insert when the end of pasting plural fullwidth chars
https://github.com/ruby/reline/commit/594484d9f9
2020-12-05 02:58:58 +09:00
aycabta ba8e5f77eb [ruby/reline] Motions e, E, t, f should include a char on cursor if follows operator
https://github.com/ruby/reline/commit/86e9a76499
2020-12-05 02:58:58 +09:00
aycabta 6be3b2da19 [ruby/reline] Implement vi_yank
https://github.com/ruby/reline/commit/164aaf9a5f
2020-12-05 02:58:58 +09:00