[#82311] [Ruby trunk Bug#13794] Infinite loop of sched_yield — charlie@...
Issue #13794 has been reported by catphish (Charlie Smurthwaite).
4 messages
2017/08/09
[#82518] [Ruby trunk Feature#13618] [PATCH] auto fiber schedule for rb_wait_for_single_fd and rb_waitpid — mame@...
Issue #13618 has been updated by mame (Yusuke Endoh).
5 messages
2017/08/30
[#82552] Re: [Ruby trunk Feature#13618] [PATCH] auto fiber schedule for rb_wait_for_single_fd and rb_waitpid
— Eric Wong <normalperson@...>
2017/08/31
mame@ruby-lang.org wrote:
[#82756] Re: [Ruby trunk Feature#13618] [PATCH] auto fiber schedule for rb_wait_for_single_fd and rb_waitpid
— Eric Wrong <normalperson@...>
2017/09/12
Eric Wrong <normalperson@yhbt.net> wrote:
[ruby-core:82467] [Ruby trunk Bug#13835] Using 'open-uri' with 'tempfile' causes an exception
From:
xkernigh@...
Date:
2017-08-25 02:03:02 UTC
List:
ruby-core #82467
Issue #13835 has been updated by kernigh (George Koehler).
Turns out that `open(temp_file, 'a')` works with the original open, but fails after loading open-uri.
This is because the instances of Tempfile respond to `to_path`, just like instances of File or Pathname. So `open(temp_file, 'a')` acts like `open(temp_file.to_path, 'a')`. I was confused because the documentation for `Kernel.open` (and other methods like `File.path`) has no mention of `to_path`. I needed to read Ruby's source code to learn about it.
The bug happens after loading open-uri. Then `open(temp_file, 'a')` tries to call `temp_file.open('a')`, but `Tempfile#open` fails to do what open-uri expects, and instead raises the ArgumentError.
----------------------------------------
Bug #13835: Using 'open-uri' with 'tempfile' causes an exception
https://bugs.ruby-lang.org/issues/13835#change-66277
* Author: thorsteneckel (Thorsten Eckel)
* Status: Open
* Priority: Normal
* Assignee:
* Target version:
* ruby -v:
* Backport: 2.2: UNKNOWN, 2.3: UNKNOWN, 2.4: UNKNOWN
----------------------------------------
Hi there,
try this in your current ruby env:
~~~ ruby
require 'tempfile'
require 'open-uri'
temp_file = Tempfile.new
open(temp_file, 'a')
~~~
Get this:
~~~
/Users/~/.rvm/rubies/ruby-2.4.1/lib/ruby/2.4.0/tempfile.rb:142:in `open': wrong number of arguments (given 1, expected 0) (ArgumentError)
from /Users/~/.rvm/rubies/ruby-2.4.1/lib/ruby/2.4.0/open-uri.rb:31:in `open'
from debug.rb:5:in `<main>'
~~~
I created the pull request https://github.com/ruby/ruby/pull/1680 as a proposal. It's based on the previous pull request https://github.com/ruby/ruby/pull/1675 and feedback of @nobu .
Greetings.
--
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>