[#104004] [Ruby master Feature#17883] Load bundler/setup earlier to make `bundle exec ruby -r` respect Gemfile — mame@...
Issue #17883 has been reported by mame (Yusuke Endoh).
21 messages
2021/05/24
[ruby-core:103765] [Ruby master Feature#17832] allow IO write to write memoryview object without copying or add IO#write_memoryview
From:
kou@...
Date:
2021-05-06 21:10:34 UTC
List:
ruby-core #103765
Issue #17832 has been updated by kou (Kouhei Sutou).
Status changed from Open to Third Party's Issue
We can implement this by adding `Fiddle::MemoryView#to_s` with `rb_str_new_static()`.
Could you file this to https://github.com/ruby/fiddle/ ?
----------------------------------------
Feature #17832: allow IO write to write memoryview object without copying or add IO#write_memoryview
https://bugs.ruby-lang.org/issues/17832#change-91876
* Author: dsisnero (Dominic Sisneros)
* Status: Third Party's Issue
* Priority: Normal
----------------------------------------
IO#write() - arguments that are not a string will be converted to string using to_s
want IO#write to be able to write memoryview objects without conversion to string
``` ruby
require 'fiddle'
include Fiddle
ptr = Fiddle::Pointer['this is a string']
mv = MemoryView.new ptr
mv.byte_size #17802
mv[0] # 116
'this is a string'.bytes[0] = 116
File.open('test.txt', 'wb'){ f.write mv}
contents = File.open('test.txt', 'r'){ |f| f.read} # contents is "#<Fiddle::MemoryView:0x000001a75ae76258>" not 'this is a string'
buffer = ByteBuffer.new('this is a string')
File.open('test.txt', 'w'){|f| f.write Fiddle::MemoryView.new(buffer)}
```
allow IO#write to write memoryview objects without converting to string or add a new method on IO to write memoryview objects without converting to string
# Related
#17834
#17833
--
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>