Age | Commit message (Collapse) | Author |
|
[Feature #16495]
|
|
[Bug #20245]
We sometimes pass in a fake string to sym_check_asciionly. This can crash
if sym_check_asciionly raises because it creates a CFP with the fake
string as the receiver which will crash if GC tries to mark the CFP.
For example, the following script crashes:
GC.stress = true
Object.const_defined?("\xC3")
|
|
fix leak in module clone
Co-authored-by: Peter Zhu <[email protected]>
|
|
fix memory leak in vm_method
This introduces a unified reference_count to clarify who is referencing a method.
This also allows us to treat the refinement method as the def owner since it counts itself as a reference
Co-authored-by: Peter Zhu <[email protected]>
|
|
[Bug #19894]
When a copy of a complemented method entry is created, there are two
issues:
1. IMEMO_FL_USER3 is not copied, so the complemented status is not
copied over.
2. In rb_method_entry_clone we increment both alias_count and
complemented_count. However, when we free the method entry in
rb_method_definition_release, we only decrement one of the two
counters, resulting in the rb_method_definition_t being leaked.
Co-authored-by: Adam Hess <[email protected]>
|
|
|
|
[Bug #19550]
If !RCLASS_EXT_EMBEDDED (e.g. 32 bit systems) then the rb_classext_t is
allocated throug malloc so it must be freed.
The issue can be seen in the following script:
```
20.times do
100_000.times do
mod = Module.new
Class.new do
include mod
end
end
# Output the Resident Set Size (memory usage, in KB) of the current Ruby process
puts `ps -o rss= -p #{$$}`
end
```
Before this fix, the max RSS is 280MB, while after this change, it's
30MB.
Notes:
Merged: https://github.com/ruby/ruby/pull/7597
|
|
* Fix temporary methods on Object leaking across test cases.
* Remove temporary classes/modules leaking across test cases.
Notes:
Merged: https://github.com/ruby/ruby/pull/7513
|
|
Notes:
Merged: https://github.com/ruby/ruby/pull/7462
|
|
Notes:
Merged: https://github.com/ruby/ruby/pull/7462
|
|
Notes:
Merged: https://github.com/ruby/ruby/pull/6950
|
|
Previously, the frozen check happened on `RCLASS_ORIGIN(self)`, which
can return an iclass. The frozen check is supposed to respond to objects
that users can call methods on while iclasses are hidden from users.
Other mutation methods like Module#{define_method,alias_method,public}
don't do this. Check frozen status on the module itself.
Fixes [Bug #19164] and [Bug #19166].
Co-authored-by: Alan Wu <[email protected]>
Notes:
Merged: https://github.com/ruby/ruby/pull/6842
Merged-By: XrXr
|
|
Investigating:
http://ci.rvm.jp/logfiles/brlog.trunk-mjit.20220906-025646
which is not immediately reproducible on my laptop.
|
|
Fixes case where Object includes a module that defines a constant,
then using class/module keyword to define the same constant on
Object itself.
Implements [Feature #18832]
Notes:
Merged: https://github.com/ruby/ruby/pull/6048
|
|
Implements [Feature #12655]
Co-authored-by: Nobuyoshi Nakada <[email protected]>
Notes:
Merged: https://github.com/ruby/ruby/pull/5733
Merged-By: jeremyevans <[email protected]>
|
|
Previously in some when classes were duped (specifically those with a
prepended module), they would not correctly have their "superclasses"
array or depth filled in.
This could cause ancestry checks (like is_a? and Module comparisons) to
return incorrect results.
This happened because rb_mod_init_copy builds origin classes in an order
that doesn't have the super linked list fully connected until it's
finished. This commit fixes the previous issue by calling
rb_class_update_superclasses before returning the cloned class. This is
similar to what's already done in make_metaclass.
Notes:
Merged: https://github.com/ruby/ruby/pull/5808
|
|
Notes:
Merged: https://github.com/ruby/ruby/pull/5642
|
|
Notes:
Merged: https://github.com/ruby/ruby/pull/5455
|
|
[Feature #17881]
Works similarly to `method_added` but for constants.
```ruby
Foo::BAR = 42 # call Foo.const_added(:FOO)
class Foo::Baz; end # call Foo.const_added(:Baz)
Foo.autoload(:Something, "path") # call Foo.const_added(:Something)
```
Notes:
Merged: https://github.com/ruby/ruby/pull/4521
|
|
Co-authored-by: Nobuyoshi Nakada <[email protected]>
Notes:
Merged: https://github.com/ruby/ruby/pull/5398
|
|
This is to allow Module subclasses that include modules before
calling super in the subclass's initialize.
Remove rb_module_check_initializable from Module#initialize.
Module#initialize only calls module_exec if a block is passed,
it doesn't have other issues that would cause problems if
called multiple times or with an already initialized module.
Move initialization of super to Module#allocate, though I'm not
sure it is required there. However, it's needed to be removed
from Module#initialize for this to work.
Fixes [Bug #18292]
Notes:
Merged: https://github.com/ruby/ruby/pull/5398
|
|
Previously, each of these methods returned self, but it is
more useful to return arguments, to allow for simpler method
decorators, such as:
```ruby
cached private def foo; some_long_calculation; end
```
Where cached sets up caching for the method.
For each of these methods, the following behavior is used:
1) No arguments returns nil
2) Single argument is returned
3) Multiple arguments are returned as an array
The single argument case is really the case we are trying to
optimize for, for the same reason that def was changed to return
a symbol for the method.
Idea and initial patch from Herwin Quarantainenet.
Implements [Feature #12495]
Notes:
Merged: https://github.com/ruby/ruby/pull/5037
|
|
Make `Module#ancestors` not to include `BasicObject`.
Notes:
Merged: https://github.com/ruby/ruby/pull/4883
|
|
Notes:
Merged: https://github.com/ruby/ruby/pull/4883
|
|
The module that is about to be included is considered initialized.
Notes:
Merged: https://github.com/ruby/ruby/pull/4868
|
|
Notes:
Merged: https://github.com/ruby/ruby/pull/4858
|
|
Notes:
Merged: https://github.com/ruby/ruby/pull/4858
|
|
Notes:
Merged: https://github.com/ruby/ruby/pull/4813
|
|
Notes:
Merged: https://github.com/ruby/ruby/pull/4813
|
|
Before this commit, const_get with inherit=true and constant lookup
expressions searched the ancestors of the starting point in an order
different from `starting_point.ancestors`.
Items in the ancestry list introduced through prepend were searched
after searching the module they were prepended into. This oddity allowed
for situations where constant lookups gave different results even though
`starting_point.ancestors` is the same.
Do the lookup in the same order as `starting_point.ancestors` by
skipping classes and modules that have an origin iclass. The origin
iclass is in the super chain after the prepended modules.
Note that just like before this commit, the starting point of the
constant lookup is always the first item that we search, regardless of
the presence of any prepended modules.
[Bug #17887]
Notes:
Merged: https://github.com/ruby/ruby/pull/4585
|
|
```
$ ./local/bin/ruby -e '1.time {}'
-e:1:in `<main>': undefined method `time' for 1:Integer (NoMethodError)
1.time {}
^^^^^
Did you mean? times
```
https://bugs.ruby-lang.org/issues/17930
Notes:
Merged: https://github.com/ruby/ruby/pull/4586
|
|
If a class has been refined but does not have an origin class,
there is a single method entry marked with VM_METHOD_TYPE_REFINED,
but it contains the original method entry. If the original method
entry is present, we shouldn't skip the method when searching even
when skipping refined methods.
Fixes [Bug #17519]
Notes:
Merged: https://github.com/ruby/ruby/pull/4357
|
|
Previously, attempting to change the visibility of a method in a
singleton class for a class/module that is prepended to and refined
would raise a NoMethodError.
Fixes [Bug #17519]
Notes:
Merged: https://github.com/ruby/ruby/pull/4200
|
|
It's important to only make the origin when the prepend goes
through, as the precense of the origin informs whether to do an
origin backfill.
This plus 2d877327e fix [Bug #17590].
Notes:
Merged: https://github.com/ruby/ruby/pull/4181
|
|
Check for cyclic prepend before making any changes. This requires
scanning the module ancestor chain twice, but in general modules
do not have large numbers of ancestors.
Notes:
Merged: https://github.com/ruby/ruby/pull/4165
|
|
in receiver
Previously, if a class included a module and then prepended the
same module, the prepend had no effect. This changes the behavior
so that the prepend has an effect unless the module is already
prepended the receiver.
While here, rename the origin_seen variable in include_modules_at,
since it is misleading. The variable tracks whether c has been seen,
not whether the origin of klass has been.
Fixes [Bug #17423]
Notes:
Merged: https://github.com/ruby/ruby/pull/4072
|
|
|
|
|
|
I'm unsure if this is intentional, but add a document anyway.
[Feature #17314]
|
|
|
|
|
|
34f06062174882a98ebef998c50ad8d4f7fc0f2e
Add a test for alias_method
|
|
|
|
Partially reintroduce 34f06062174882a98ebef998c50ad8d4f7fc0f2e
|
|
Also document that both :deprecated and :experimental are supported
:category option values.
The locations where warnings were marked as deprecation warnings
was previously reviewed by shyouhei.
Comment a couple locations where deprecation warnings should probably
be used but are not currently used because deprecation warning
enablement has not occurred at the time they are called
(RUBY_FREE_MIN, RUBY_HEAP_MIN_SLOTS, -K).
Add assert_deprecated_warn to test assertions. Use this to simplify
some tests, and fix failing tests after marking some warnings with
deprecated category.
Notes:
Merged: https://github.com/ruby/ruby/pull/3917
|
|
This reverts commit e042e8460bb9a63c05f938d51e8c7c5345a6f3a4.
|
|
This reverts commit 34f06062174882a98ebef998c50ad8d4f7fc0f2e.
|
|
|
|
|
|
Instead of suppressing all warnings wholly in each test scripts by
setting `$VERBOSE` to `nil` in `setup` methods.
Notes:
Merged: https://github.com/ruby/ruby/pull/3925
Merged-By: nobu <[email protected]>
|