Commit graph

16449 commits

Author SHA1 Message Date
ima1zumi
68d3952c52 [ruby/reline] Fix breaking to input Emoji with ZWJ.
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
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
89d49ec9e0
2020-12-05 02:58:59 +09:00
aycabta
c2bd5b84d0 [ruby/reline] Support bracketed paste mode
d1a6869322
2020-12-05 02:58:59 +09:00
aycabta
7624f52757 [ruby/reline] Forced newline insertion is not just cursor moving
0e30a49d03
2020-12-05 02:58:59 +09:00
aycabta
37a574b527 [ruby/reline] Drop prompt list cache when num of lines is changed
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.

d1a7e74aa4
2020-12-05 02:58:58 +09:00
manga_osyo
21f26018d2 [ruby/reline] Add test Reline::Unicode.test_get_mbchar_width.
301e9048fc
2020-12-05 02:58:58 +09:00
aycabta
dbfc1f30d5 [ruby/reline] Add alias vi-movement-mode to vi-command-mode for compatibility
a79c297567
2020-12-05 02:58:58 +09:00
aycabta
9750c27afc [ruby/reline] Call process_insert when the end of pasting plural fullwidth chars
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
86e9a76499
2020-12-05 02:58:58 +09:00
aycabta
6be3b2da19 [ruby/reline] Implement vi_yank
164aaf9a5f
2020-12-05 02:58:58 +09:00
aycabta
2dc4aca8d1 [ruby/reline] Operator with arg need to make sure that they take arg to avoid crashing
1c0c06de1f
2020-12-05 02:58:58 +09:00
aycabta
92b22db6a7 [ruby/reline] Unimplemented vi command should be no-op
abc90e6867
2020-12-05 02:58:58 +09:00
aycabta
faf8f216be [ruby/reline] Keep operator proc as a local variable in the scope
The proc variable will be used later so the instance variable will be changes.

496c4361f6
2020-12-05 02:58:58 +09:00
aycabta
564aadce62 [ruby/reline] Skip em_exchange_mark without mark
abb56e5ec3
2020-12-05 02:58:58 +09:00
aycabta
4291ff370f [ruby/reline] Bypass newline insertion at eol on command prompt
A newline is automatically inserted if a character is rendered at eol on
command prompt.

2dfd5d0df8
2020-12-05 02:58:58 +09:00
aycabta
4af2e4111b [ruby/reline] Deduplicate completed items
2dabf0c786
2020-12-05 02:58:58 +09:00
aycabta
da59f65178 [ruby/reline] Add tests about complicated rendering
f4683b72eb
2020-12-05 02:58:58 +09:00
aycabta
dd87d639e9 [ruby/reline] Test prompt with escape sequence
c7c1d5f5d1
2020-12-05 02:58:58 +09:00
aycabta
87f51c7e66 [ruby/reline] Use startup_option instead of startup wait
a63ce6371c
2020-12-05 02:58:58 +09:00
aycabta
092c253bff [ruby/reline] Wait for the process to be started in start_terminal
d29d33dcf5
2020-12-05 02:58:58 +09:00