[#104169] [Ruby master Feature#17938] Keyword alternative for boolean positional arguments — matheusrichardt@...

Issue #17938 has been reported by matheusrich (Matheus Richard).

12 messages 2021/06/04

[#104213] [Ruby master Feature#17942] Add a `initialize(public @a, private @b)` shortcut syntax for defining public/private accessors for instance vars — tyler@...

SXNzdWUgIzE3OTQyIGhhcyBiZWVuIHJlcG9ydGVkIGJ5IFR5bGVyUmljayAoVHlsZXIgUmljayku

6 messages 2021/06/09

[#104288] [Ruby master Bug#17992] Upstreaming the htmlentities gem into CGI#.(un)escape_html — alexandermomchilov@...

Issue #17992 has been reported by AMomchilov (Alexander Momchilov).

9 messages 2021/06/15

[#104338] [Ruby master Misc#17997] DevelopersMeeting20210715Japan — mame@...

Issue #17997 has been reported by mame (Yusuke Endoh).

10 messages 2021/06/17

[#104361] [Ruby master Bug#18000] have_library doesn't work when ruby is compiled with --disable-shared --disable-install-static-library — jean.boussier@...

Issue #18000 has been reported by byroot (Jean Boussier).

9 messages 2021/06/18

[#104381] [Ruby master Feature#18004] Add Async to the stdlib — shannonskipper@...

Issue #18004 has been reported by shan (Shannon Skipper).

9 messages 2021/06/22

[#104401] [Ruby master Feature#18007] Help developers of C extensions meet requirements in "doc/extension.rdoc" — mike.dalessio@...

Issue #18007 has been reported by mdalessio (Mike Dalessio).

16 messages 2021/06/25

[#104430] [Ruby master Bug#18011] `Method#parameters` is incorrect for forwarded arguments — josh.cheek@...

Issue #18011 has been reported by josh.cheek (Josh Cheek).

12 messages 2021/06/29

[ruby-core:104315] [Ruby master Bug#15674] Regression: ObjectSpace.allocation_sourceline produces the wrong location for allocations, it shows the end of the method instead of the line where the object was created

From: merch-redmine@...
Date: 2021-06-16 17:32:55 UTC
List: ruby-core #104315
Issue #15674 has been updated by jeremyevans0 (Jeremy Evans).

Status changed from Open to Closed

This is fixed in Ruby 2.7.3 (and also works in 3.0.1 and master).  As Ruby 2.6 is in security maintenance mode, the change will not be backported to Ruby 2.6, so this can be closed.

----------------------------------------
Bug #15674: Regression: ObjectSpace.allocation_sourceline produces the wrong location for allocations, it shows the end of the method instead of the line where the object was created
https://bugs.ruby-lang.org/issues/15674#change-92538

* Author: schneems (Richard Schneeman)
* Status: Closed
* Priority: Normal
* ruby -v: 2.6.2
* Backport: 2.4: UNKNOWN, 2.5: UNKNOWN, 2.6: UNKNOWN
----------------------------------------
Originally I opened this up as an issue in memory profiler https://github.com/SamSaffron/memory_profiler/issues/67, however I was able to isolate the issue to just Ruby 2.6.

ObjectSpace.allocation_sourceline is reporting the line where a method ends rather than the line where the object was actually allocated.

Here's the script. You would expect that object space would tell me the allocation happens on line 2 but instead it gets reported as line 3:

```
def my_concat(a, b)
  return a + b # <====================
end

require 'fileutils'
require 'objspace'
FileUtils.mkdir_p("tmp")

def run
  ObjectSpace.trace_object_allocations do
    10.times do
      my_concat("hello".freeze, "world".freeze)
    end

    10.times do
      my_concat("hello".freeze, "world".freeze)
    end
  end

  ObjectSpace.each_object do |obj|
    file = ObjectSpace.allocation_sourcefile(obj)
    line = ObjectSpace.allocation_sourceline(obj)
    next unless file && line
    puts "#{file}:#{line}"
  end
end

run
```


If you add space to the method body it keeps incrementing the line number of the output. For example, changing the method body to this, should not change the allocation location:

```ruby
def my_concat(a, b)
  return a + b # <====================





end
```

However, it is reported as a different line:

```
script.rb:8
```

I tested with Ruby 2.3, 2.4, and 2.5 and all those versions produce a correct result, this regression is limited to only 2.6.





-- 
https://bugs.ruby-lang.org/

Unsubscribe: <mailto:ruby-core-request@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>

In This Thread

Prev Next