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

59445 Коммитов

Автор SHA1 Сообщение Дата
aycabta ad8fbf444a Fix variable catch 2019-12-05 09:02:23 +09:00
Nobuyoshi Nakada fb11e6089d
[DOC] Added File::FNM_SYSCASE example [Bug #16391] [ci skip] 2019-12-04 21:52:29 +09:00
Yusuke Endoh dbfd4b780e coroutine/ucontext/Context.c: Include "ruby/config.h" for Solaris
getcontext, makecontext, and swapcontext seem to be available only when
`__EXTENSION__` is defined on Solaris.
2019-12-04 20:59:39 +09:00
Kazuhiro NISHIYAMA a0bc0e1ba1 Fix thread leak in drb 2019-12-04 20:57:24 +09:00
卜部昌平 00bbdf4451 implement Range#count
As matz requested in [Bug #16366].
2019-12-04 15:32:49 +09:00
Koichi Sasada c6e3db0c66 new_cond before mon_initialize
MonitorMixin#new_cond can be called before mon_initialize, so we
need to initialize `@monitor` before it.

https://bugs.ruby-lang.org/issues/16255#note-4
2019-12-04 13:36:41 +09:00
Yusuke Endoh f9e5c74cd2 compile.c: stop wrong peephole optimization when covearge is enabled
jump-jump optimization ignores the event flags of the jump instruction
being skipped, which leads to overlook of line events.

This changeset stops the wrong optimization when coverage measurement is
neabled and when the jump instruction has any event flag.

Note that this issue is not only for coverage but also for TracePoint,
and this change does not fix TracePoint.
However, fixing it fundamentally is tough (which requires revamp of
the compiler).  This issue is critical in terms of coverage measurement,
but minor for TracePoint (ko1 said), so we here choose a stopgap
measurement.

[Bug #15980] [Bug #16397]

Note for backporters: this changeset can be viewed by `git diff -w`.
2019-12-04 10:40:54 +09:00
Nobuyoshi Nakada 5a404efd29 [ruby/io-console] Fixed `intr: false` mode on Windows
https://github.com/ruby/io-console/commit/4c172c01aa
2019-12-04 10:10:45 +09:00
Jeremy Evans 447d583536 Silence incorrect assigned but unused variable warnings in ripper
To only emit the warnings in correct cases would require tracking
local variable usage in ripper, which ripper currently does not do.

Fixes [Bug #15188]
2019-12-04 03:04:22 +02:00
Jeremy Evans a91637c516 Make {Method,UnboundMethod}#super_method handle clone/bind/unbind
This wasn't working previously because the iclass entry wasn't
being copied, and without an iclass entry, super_method returns
nil.

Fixes [Bug #15629]
2019-12-04 01:35:34 +02:00
Yusuke Endoh f9754f0ea0 compile.c: trivial refactoring
Use `for` instead of `while` to make it explicit that it is a traverse
of bytecode.
2019-12-04 08:22:48 +09:00
NARUSE, Yui 8852fa8760 Revert "Regexp#match{?} with nil raises TypeError as String, Symbol (#1506)"
This reverts commit 2a22a6b2d8.
Revert [Feature #13083]
2019-12-04 06:40:54 +09:00
NARUSE, Yui 08074eb712 Revert "Revert nil error and adding deprecation message"
This reverts commit 452bee3ee8.
2019-12-04 06:40:54 +09:00
NARUSE, Yui a705f6472c Revert "Improve warning message"
This reverts commit 31110d820c.
2019-12-04 06:40:54 +09:00
NARUSE, Yui 34a66b1f36 Revert "Fix warnings in Regexp#{match,match?} specs"
This reverts commit 782d1b8fb0.
2019-12-04 06:40:54 +09:00
Jeremy Evans a029b54ec7 Make Enumerator::Chain#each treat lambdas as lambda
Previously, lambdas were converted to procs because of how
rb_block_call works.  Switch to rb_funcall_with_block, which
handles procs as procs and lambdas as lambdas.

Fixes [Bug #15613]
2019-12-03 23:18:28 +02:00
Jeremy Evans 47c97e1e84 Do not lose existing constant visibility when autoloading
This copies the private/deprecate constant visibility across the
autoload.  It still is backwards compatible with setting the
private/deprecate constant visibility in the autoloaded file.
However, if you explicitly set public constant in the autoloaded
file, that will be reset after the autoload.

Fixes [Bug #11055]
2019-12-03 17:31:49 +02:00
git b96d559c69 * 2019-12-04 [ci skip] 2019-12-04 00:27:58 +09:00
Jeremy Evans 5c2c396685 Check interrupts before starting thread
Fixes a hang when Thread.new calls Thread.new in a loop.

Fixes [Bug #13688]
2019-12-03 17:27:34 +02:00
KOSAKI Motohiro 7f2cd2ae6f fix typo 2019-12-03 10:50:16 +00:00
Yusuke Endoh a1f98cd4c1 vm_args.c: make the keyword deprecation message helpful
```
$ ./miniruby -e 'def foo(kw: 1); end; h = {kw: 1}; foo(h)'
-e:1: warning: The last argument is used as the keyword parameter
-e:1: warning: for `foo' defined here; maybe ** should be added to the call?
```
2019-12-03 17:56:50 +09:00
Yusuke Endoh 409e4ab740 tool/lib/test/unit/parallel.rb: fail explicitly when failing to get io
`(ulimit -n 30; make test-tool)` fails with unexplicit message:
"undefined method `write' for nil:NilClass" due to lack of stdout.

This change makes it explicit.  [Bug #5577]
2019-12-03 17:26:12 +09:00
Nobuyoshi Nakada e42d9d8df8
Fixed the inverted condition 2019-12-03 14:51:14 +09:00
Nobuyoshi Nakada 9165fcdfa3
Wrap statements in AS_IF properly 2019-12-03 14:46:54 +09:00
aycabta 027e847cd2 Fix auto-indent behavior correctly 2019-12-03 13:02:50 +09:00
Nobuyoshi Nakada 14a17063a1
Fixed stack overflow [Bug #16382]
Get rid of infinite recursion in expanding a load path to the real
path while loading a transcoder.
2019-12-03 08:51:50 +09:00
Yusuke Endoh 8bddf1bc9b mjit.c: fix a mismatch of malloc'ed type
Coverity Scan found this issue.
2019-12-03 08:02:38 +09:00
Benoit Daloze 424ad9a493 Make more attempts to check for the precision of Process.times
* Process.clock_getres specs use 10_000 but that's quite slow for
  the Process.times spec.
2019-12-02 21:23:10 +01:00
git c688487fae * 2019-12-03 [ci skip] 2019-12-03 01:41:22 +09:00
aycabta a92560132b Support incremental search by last determined word
In the incremental search by C-r, search word is saved when it's determined. In
the next incremental search by C-r, if a user presses C-r again with the empty
search word, the determined previous search word is used to search.
2019-12-03 01:39:59 +09:00
aycabta bce38f706e The C-r in vi command mode is also incremental search 2019-12-03 01:39:59 +09:00
Takashi Kokubun a47d6c256f
Fix random failure on getusage-missing environments
`* 1e6` makes a spurious result about floating point number's precision.

```
irb(main)[01:0]> 16.028
=> 16.028
irb(main)[02:0]> (16.028 * 1e6)
=> 16027999.999999998
```
2019-12-02 00:17:41 -08:00
Kazuhiro NISHIYAMA 1a88adcd75 Fix Leaked file descriptor in test/did_you_mean
de74d2c3b0/checks?check_suite_id=336910877#step:19:131
```
Leaked file descriptor: NameErrorExtensionTest#test_correctable_error_objects_are_dumpable: 7 : #<File:test_name_error_extension.rb>
```
2019-12-02 16:25:43 +09:00
Takashi Kokubun 185f760873
Debug random failure of ruby-spec on ci.rvm.jp 2019-12-01 23:23:40 -08:00
Nobuyoshi Nakada 9afaf139f2
Revert "builtin_binary.inc needs miniruby itself for RubyVM.each_builtin"
This reverts commit 2615030c52,
which doesn't work when cross compiling, except for mingw.
2019-12-02 14:15:42 +09:00
Nobuyoshi Nakada 2615030c52
builtin_binary.inc needs miniruby itself for RubyVM.each_builtin 2019-12-02 14:03:57 +09:00
Nobuyoshi Nakada a7b9f085ff
Disable _FORTIFY_SOURCE on mingw for now
It causes a link error due to some `__*_chk` functions on mingw.
2019-12-02 13:20:00 +09:00
Nobuyoshi Nakada b1c92363a7
Wait for the main thread to start reading by Queue
Otherwise, the written data to pty before the reading started may
be just lost.
2019-12-02 13:17:05 +09:00
Takashi Kokubun de74d2c3b0
Simplify variable declaration by C99 2019-12-01 17:32:50 -08:00
aycabta 103b04128f Support incremental search again by C-r in incremental search 2019-12-02 04:18:22 +09:00
Takashi Kokubun b3ea0980db
Check MJIT support in one place
to fix test failure on trunk-no-mjit
https://gist.github.com/ko1/32ab982ffd7555988818773c08f97123
2019-12-01 10:53:59 -08:00
Takashi Kokubun 6bc8b4d8ea
Skip --jit-debug= test on mswin
it fails like
https://ci.appveyor.com/project/ruby/ruby/builds/29235837/job/v0apdjj4qx8afars
2019-12-01 10:51:05 -08:00
aycabta c7f05310a2 Process Backspace key in incremental search correctly 2019-12-02 03:30:38 +09:00
aycabta e15b0313a7 Search history to back in the middle of histories 2019-12-02 03:09:41 +09:00
KOSAKI Motohiro 4d7a6d04b2 Avoid unnecessary tzset() call
Akatsuki reported ENV['TZ'] = 'UTC' improved 7x-8x faster on following code.
t = Time.now; 100000.times { Time.new(2019) }; Time.now - t
https://hackerslab.aktsk.jp/2019/12/01/141551

commit 4bc1669127(reduce tzset) dramatically improved this situation. But still,
TZ=UTC is faster than default.

This patch removs unnecessary tzset() call completely.

Performance check
  ----------------------
test program: t = Time.now; 100000.times { Time.new(2019) }; Time.now - t
before:         0.387sec
before(w/ TZ):  0.197sec
after:          0.162sec
after(w/ TZ):   0.165sec

OK. Now, Time creation 2x faster *and* TZ=UTC doesn't improve anything.
We can forget this hack completely. :)

Side note:
This patch slightly changes Time.new(t) behavior implicitly. Before this patch, it might changes
default timezone implicitly. But after this patch, it doesn't. You need to reset TZ
(I mean ENV['TZ'] = nil) explicitly.
But I don't think this is big impact. Don't try to change /etc/localtime on runtime.

Side note2: following test might be useful for testing "ENV['TZ'] = nil".
  -----------------------------------------
% cat <<'End' | sudo sh -s
rm -f /etc/localtime-; cp -a /etc/localtime /etc/localtime-
rm /etc/localtime; ln -s /usr/share/zoneinfo/Asia/Tokyo /etc/localtime
./ruby -e '
p Time.new(2000).zone # JST
File.unlink("/etc/localtime"); File.symlink("/usr/share/zoneinfo/America/Los_Angeles", "/etc/localtime")
p Time.new(2000).zone # JST (ruby does not follow /etc/localtime modification automatically)
ENV["TZ"] = nil
p Time.new(2000).zone # PST (ruby detect /etc/localtime modification)
'
rm /etc/localtime; cp -a /etc/localtime- /etc/localtime; rm /etc/localtime-
End
2019-12-01 16:34:26 +00:00
git 43811cc3b3 * 2019-12-02 [ci skip] 2019-12-02 00:05:20 +09:00
aycabta 7f0d51704a Remove obsolete code 2019-12-02 00:03:59 +09:00
aycabta 8cb3f29abf The ed_search_prev_history should always search to backward 2019-12-01 23:54:57 +09:00
aycabta f1cfc7da18 Reline::HISTORY can take Range object 2019-12-01 23:54:57 +09:00
Benoit Daloze 617a3735ae Update to ruby/spec@dcf4955 2019-12-01 14:11:42 +01:00