Commit graph

66877 commits

Author SHA1 Message Date
Benoit Daloze
fd0df9c4fb Emit deprecatation warnings for rb_iterate()
* It is obsolete since 1.9, see
  https://github.com/ruby/ruby/blob/master/doc/extension.rdoc#label-Control+Structure
  and [Misc #18025]
2021-07-16 12:11:24 +02:00
Nobuyoshi Nakada
301d194ee3 Add Integer.try_convert [Feature #15211] 2021-07-16 17:49:53 +09:00
Yusuke Endoh
eee709595c io.c: Clarify the behavior of IO.read when called as File.read
Ditto to `IO.binread`, `IO.write`, `IO.binwrite`, `IO.foreach`, and
`IO.readlines`.
2021-07-16 16:10:54 +09:00
Masafumi Koba
650a65c6fc
[rubygems/rubygems] Add missing require 'fileutils' in Gem::ConfigFile
c4004fadd9
2021-07-16 15:40:08 +09:00
David Rodríguez
71d3c9bbfa
[rubygems/rubygems] Fix bundle plugin install --help showing bundle install's help
b7b7d16aa8
2021-07-16 15:40:08 +09:00
Andre Arko
c5f78ade5a
[rubygems/rubygems] fix dangling empty hooks
it turns out that running `bundle plugin uninstall some-plugin` would remove that plugin from the list of hooks, but if the list of hooks for an event was now empty, we would serialize the empty array into yaml as an empty single bullet item. which would then get unserialized as a plugin with the name empty string. which we would then try to load and explode. 😬

545ebba9a5
2021-07-16 15:40:08 +09:00
Andre Arko
a3d2200b2a
[rubygems/rubygems] test loading bad plugins with nil/empty names
e64b1f3497
2021-07-16 15:40:07 +09:00
Andre Arko
5cce96891e
[rubygems/rubygems] remove focus
584a393812
2021-07-16 15:40:07 +09:00
Andre Arko
44ba77d16d
[rubygems/rubygems] lock for development on macos
60469e4cac
2021-07-16 15:40:07 +09:00
David Rodríguez
227c2deff4
[rubygems/rubygems] Fix development gem unintentionally removed on an edge case
When a development dependency was duplicated inside the gemspec and
Gemfile with the same requirements, we went from printing a warning to
removing the gem altogether.

This change makes it not print a warning, but don't remove the gem
either.

8bb2488131
2021-07-16 15:40:07 +09:00
Jared Beck
bbaebbf529
[rubygems/rubygems] Fix contradictory message about deletion of default gem
[Fixes #4733]

fce7f3eb7d
2021-07-16 15:40:07 +09:00
Nobuyoshi Nakada
29ed9d1aaa [ruby/error_highlight] Fix leaked tempfiles
8b353a10a7
2021-07-16 15:25:13 +09:00
Samuel Williams
6073a8bdc0 Add debug assertion in rb_funcall* that the current thread has the gvl. 2021-07-16 17:32:02 +12:00
Hiroshi SHIBATA
55a79b648c
Adjust the release version of ruby2_keywords 2021-07-16 13:50:15 +09:00
Nobuyoshi Nakada
25689024cf
Added code fence to the example in [Feature #17724] [ci skip] 2021-07-16 11:26:30 +09:00
Jeremy Evans
95f8ffa5f6
Copy hash compare_by_identity setting in more cases
This makes the compare_by_identity setting always copied
for the following methods:

* except
* merge
* reject
* select
* slice
* transform_values

Some of these methods did not copy the setting, or only
copied the setting if the receiver was not empty.

Fixes [Bug #17757]

Co-authored-by: Kenichi Kamiya <kachick1@gmail.com>
2021-07-15 10:04:17 -07:00
Jeremy Evans
fa87f72e1e Add pattern matching pin support for instance/class/global variables
Pin matching for local variables and constants is already supported,
and it is fairly simple to add support for these variable types.

Note that pin matching for method calls is still not supported
without wrapping in parentheses (pin expressions).  I think that's
for the best as method calls are far more complex (arguments/blocks).

Implements [Feature #17724]
2021-07-15 09:56:02 -07:00
aycabta
f1035248af [ruby/irb] Show code page by irb_info on Windows
6160d74199
2021-07-16 01:55:25 +09:00
aycabta
456d0019dd [ruby/irb] Escape space in free-spacing mode
085ac42947
2021-07-16 01:55:16 +09:00
git
feec80a362 * 2021-07-16 [ci skip] 2021-07-16 00:49:08 +09:00
Peter Zhu
e5fe48646c [Bug #18014] Add assertion to verify freelist
This commit adds an assertion has been added after `gc_page_sweep` to
verify that the freelist length is equal to the number of free slots in
the page.
2021-07-15 11:48:52 -04:00
Peter Zhu
4a627dbdfd [Bug #18014] Fix memory leak in GC when using Ractors
When a Ractor is removed, the freelist in the Ractor cache is not
returned to the GC, leaving the freelist permanently lost. This commit
recycles the freelist when the Ractor is destroyed, preventing a memory
leak from occurring.
2021-07-15 11:48:52 -04:00
Peter Zhu
119697f61e [Bug #18014] Fix rb_gc_force_recycle unmark before sweep
If we force recycle an object before the page is swept, we should clear
it in the mark bitmap. If we don't clear it in the bitmap, then during
sweeping we won't account for this free slot so the `free_slots` count
of the page will be incorrect.
2021-07-15 11:48:52 -04:00
Nobuyoshi Nakada
3e7a7fb28a
Make Struct#keyword_init? return nil by default [Feature #18008] 2021-07-15 22:24:02 +09:00
Nobuyoshi Nakada
33bea3bdff
Regularize keyword_init values not to hold the argument object 2021-07-15 21:32:04 +09:00
NARUSE, Yui
835c63cd88 Add tests and NEWS [Feature #18008] 2021-07-15 18:21:49 +09:00
hkdnet
1a63754416
struct.c: Add keyword_init? singleton method for StructClass (#4609)
Fixes [Feature #18008]
2021-07-15 18:14:27 +09:00
卜部昌平
3ce2bf4d90 rb_interned_id_p: does not exist
This declaration was added at commit 0ee5a49dd4
without its implementation.  Must be a mistake.

Note also that we ended up having this exct same functionality
implemented under a name of rb_check_id().
2021-07-15 16:54:59 +09:00
卜部昌平
2d9aacf644 rb_enc_casefold: does not exist
This declaration was added at commit 0ee5a49dd4
without its implementation.  Must be a mistake.
2021-07-15 16:54:59 +09:00
Yusuke Endoh
645616c273 process.c: Call rb_thread_atfork in rb_fork_ruby
All occurrences of rb_fork_ruby are followed by a call rb_thread_fork in
the created child process.

This is refactoring and a potential preparation for [Feature #17795].
(rb_fork_ruby may be wrapped by Process._fork_.)
2021-07-15 16:46:08 +09:00
Patrik Ragnarsson
8f62f12c35 Fix typo in flag in NEWS.md 2021-07-15 16:16:51 +09:00
Nobuyoshi Nakada
f347b586fb
[ruby/fiddle] Handle#file_name results in very platform dependent 2021-07-15 09:49:56 +09:00
git
0d74ddc5ff * 2021-07-15 [ci skip] 2021-07-15 09:26:19 +09:00
Nobuyoshi Nakada
c67c83fb68
[ruby/fiddle] Module file name may be the realpath
Even when the path which was used to dlopen may be a symlink.
2021-07-15 09:20:10 +09:00
Nobuyoshi Nakada
2fa3209a35
[ruby/fiddle] fixed the test on case-insensitive filesystem 2021-07-14 22:00:56 +09:00
Kenta Murata
67897762cf
[ruby/fiddle] Add Fiddle::Handle#file_name (https://github.com/ruby/fiddle/pull/88)
4ee1c6fc4b
2021-07-14 18:56:00 +09:00
Nobuyoshi Nakada
169529a0c0
[ruby/fiddle] Check HAVE_RUBY_MEMORY_VIEW_H rather than API version (https://github.com/ruby/fiddle/pull/86)
c5abcc3a7e
2021-07-14 18:55:59 +09:00
Kenta Murata
818c74b7f4 [ruby/fiddle] Return the module handle value in Fiddle::Handle#to_i and add FIddle::Handle#to_ptr (https://github.com/ruby/fiddle/pull/87)
170111a0cb
2021-07-14 18:43:32 +09:00
git
57a743efa4 * 2021-07-14 [ci skip] 2021-07-14 10:48:29 +09:00
Hiroshi SHIBATA
896bbb9fad Merge RubyGems/Bundler master from 8459ebd6ad65ce3397233416dc64083ae7572bb9 2021-07-14 10:48:07 +09:00
xtkoba
29f6f79e73 Get ruby_nonempty_memcpy to have C linkage
Fixes [Bug #17788]
2021-07-13 22:55:17 +09:00
Nobuyoshi Nakada
cb955dc9ac
[ruby/fiddle] update dependencies 2021-07-13 21:34:28 +09:00
aycabta
1d03c7da04 [ruby/irb] Add an explanation of default sub commands of "measure", which are :time and :stackprof
759be5a344
2021-07-13 21:21:29 +09:00
Nobuyoshi Nakada
40d45ab093
[ruby/fiddle] Check HAVE_RUBY_MEMORY_VIEW_H rather than API version
93f9564446
2021-07-13 20:36:45 +09:00
Yusuke Endoh
a5d6ea9266 [ruby/error_highlight] Set the binary mode for Tempfile creation in a test
8273d3b6f2
2021-07-13 20:30:20 +09:00
Nobuyoshi Nakada
472d8c5555
[ruby/fiddle] Update required_ruby_version (https://github.com/ruby/fiddle/pull/85)
Drop supports for old versions, keeping 2.5 as CI supports it for
now.

90634e7c55
2021-07-13 19:37:46 +09:00
Sutou Kouhei
bb868f4814
[ruby/fiddle] Use have_header and have_type to detect memory view availability
Fix https://github.com/ruby/fiddle/pull/84

It may detect ruby/memory_view.h for system Ruby that is installed in
/usr.

We can use RUBY_API_VERSION_MAJOR to detect memory view availability
because memory view is available since Ruby 3.0.

Reported by Jun Aruga. Thanks!!!

3292929830
2021-07-13 19:37:46 +09:00
Aaron Patterson
5c0d8c6369
[ruby/fiddle] Add "offsetof" to Struct classes (https://github.com/ruby/fiddle/pull/83)
* Add "offsetof" to Struct classes

I need to get the offset of a member inside a struct without allocating
the struct.  This patch adds an "offsetof" class method to structs that
are generated.

The usage is like this:

```ruby
MyStruct = struct [
  "int64_t i",
  "char c",
]

MyStruct.offsetof("i") # => 0
MyStruct.offsetof("c") # => 8
```

* Update test/fiddle/test_c_struct_builder.rb

Co-authored-by: Sutou Kouhei <kou@cozmixng.org>

4e3b60c5b6

Co-authored-by: Sutou Kouhei <kou@cozmixng.org>
2021-07-13 19:37:46 +09:00
Sutou Kouhei
a2c9e1b58a
[ruby/fiddle] Bump version
049138b4b8
2021-07-13 19:37:46 +09:00
Sutou Kouhei
70b0318646
[ruby/fiddle] MemoryView: ensure reset rb_memory_view_t::obj on error
0ed39345fe
2021-07-13 19:37:46 +09:00