kgio RubyGem user+dev discussion/patches/pulls/bugs/help
 help / color / mirror / code / Atom feed
From: Jeremy Evans <code@jeremyevans.net>
To: kgio-public@bogomips.org
Subject: Fix error on ruby 2.5
Date: Thu, 14 Dec 2017 21:34:34 -0800	[thread overview]
Message-ID: <20171215053434.GT7579@jeremyevans.local> (raw)

Example code:

require 'socket'
require 'kgio'
addr = Socket.pack_sockaddr_in(80, 'www')
socket = Kgio::Socket.connect(addr)
buf = String.new(:capacity=>16384); nil
socket.kgio_read!(16384, buf)

Result on ruby 2.5:

TypeError: can't convert FalseClass into time interval

Cause:

Misuse of rb_funcall.  Not sure why ruby 2.5 is pickier than previous
versions.

Noticed when testing unicorn with ruby 2.5.

Fix:

--- ext/kgio/wait.c.orig
+++ ext/kgio/wait.c
@@ -92,12 +92,12 @@ static VALUE kgio_wait_writable(int argc, VALUE *argv,
 
 VALUE kgio_call_wait_writable(VALUE io)
 {
-	return rb_funcall(io, id_wait_wr, 0, 0);
+	return rb_funcall(io, id_wait_wr, 0);
 }
 
 VALUE kgio_call_wait_readable(VALUE io)
 {
-	return rb_funcall(io, id_wait_rd, 0, 0);
+	return rb_funcall(io, id_wait_rd, 0);
 }
 
 void init_kgio_wait(void)

             reply	other threads:[~2017-12-15  5:34 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-15  5:34 Jeremy Evans [this message]
2017-12-15  6:32 ` [PATCH] wait: avoid passing unnecessary args to rb_funcall Eric Wong
2017-12-15 15:49   ` Jeremy Evans

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://yhbt.net/kgio/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20171215053434.GT7579@jeremyevans.local \
    --to=code@jeremyevans.net \
    --cc=kgio-public@bogomips.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://yhbt.net/kgio.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).