[#90865] [Ruby trunk Bug#15499] Breaking behavior on ruby 2.6: rb_thread_call_without_gvl doesn't invoke unblock_function when used on the main thread — apolcyn@...
Issue #15499 has been reported by apolcyn (alex polcyn).
3 messages
2019/01/03
[#90877] [Ruby trunk Bug#15499] Breaking behavior on ruby 2.6: rb_thread_call_without_gvl doesn't invoke unblock_function when used on the main thread — apolcyn@...
Issue #15499 has been updated by apolcyn (alex polcyn).
3 messages
2019/01/03
[#90895] Re: [ruby-alerts:11680] failure alert on trunk-mjit@silicon-docker (NG (r66707)) — Eric Wong <normalperson@...>
ko1c-failure@atdot.net wrote:
4 messages
2019/01/05
[#90896] Re: [ruby-alerts:11680] failure alert on trunk-mjit@silicon-docker (NG (r66707))
— Takashi Kokubun <takashikkbn@...>
2019/01/05
VGhhbmtzIHRvIGV4cGxhaW4gdGhhdC4KCj4gSSBzdXNwZWN0IHRoZXJlIGlzIGFub3RoZXIgdGhy
[#91154] Testing MJIT on RHEL 7.5 — Phil Edelbrock <edelbrp@...>
4 messages
2019/01/18
[#91159] Re: Testing MJIT on RHEL 7.5
— Takashi Kokubun <takashikkbn@...>
2019/01/18
SGksCgo+IHRpbWUgL3Vzci9sb2NhbC9ydWJ5LWVkZ2UvYmluL3J1YnkgLS1kaXNhYmxlLWdlbXMg
[#91200] [Ruby trunk Feature#15553] Addrinfo.getaddrinfo supports timeout — glass.saga@...
Issue #15553 has been reported by Glass_saga (Masaki Matsushita).
4 messages
2019/01/21
[#91289] Re: [Ruby trunk Feature#15553] Addrinfo.getaddrinfo supports timeout
— Eric Wong <normalperson@...>
2019/01/26
glass.saga@gmail.com wrote:
[ruby-core:90842] [Ruby trunk Feature#15477] Proc#arity returns -1 for composed lambda Procs of known arguments
From:
mame@...
Date:
2019-01-01 11:09:27 UTC
List:
ruby-core #90842
Issue #15477 has been updated by mame (Yusuke Endoh).
Tracker changed from Bug to Feature
ruby -v deleted (ruby 2.6.0p0 (2018-12-25 revision 66547) [x86_64-linux])
Backport deleted (2.4: UNKNOWN, 2.5: UNKNOWN, 2.6: UNKNOWN)
Looks not a bug to me. Moving to the feature tracker.
A patch is attached.
```diff
diff --git a/proc.c b/proc.c
index c09e845ec0..45e2a21551 100644
--- a/proc.c
+++ b/proc.c
@@ -3063,6 +3063,16 @@ compose(VALUE dummy, VALUE args, int argc, VALUE *argv, VALUE passed_proc)
return rb_funcallv(f, idCall, 1, &fargs);
}
+static VALUE
+compose_proc_new(VALUE procs)
+{
+ VALUE first_proc = RARRAY_AREF(procs, 1);
+ int max_arity, min_arity = rb_proc_min_max_arity(first_proc, &max_arity);
+ int lambda_p = rb_proc_lambda_p(first_proc);
+ struct vm_ifunc *ifunc = rb_vm_ifunc_new((rb_block_call_func_t) compose, (void *)procs, min_arity, max_arity);
+ return cfunc_proc_new(rb_cProc, (VALUE)ifunc, lambda_p);
+}
+
/*
* call-seq:
* prc << g -> a_proc
@@ -3089,7 +3099,7 @@ proc_compose_to_left(VALUE self, VALUE g)
GetProcPtr(self, procp);
is_lambda = procp->is_lambda;
- proc = rb_proc_new(compose, args);
+ proc = compose_proc_new(args);
GetProcPtr(proc, procp);
procp->is_lambda = is_lambda;
@@ -3122,7 +3132,7 @@ proc_compose_to_right(VALUE self, VALUE g)
GetProcPtr(self, procp);
is_lambda = procp->is_lambda;
- proc = rb_proc_new(compose, args);
+ proc = compose_proc_new(args);
GetProcPtr(proc, procp);
procp->is_lambda = is_lambda;
```
----------------------------------------
Feature #15477: Proc#arity returns -1 for composed lambda Procs of known arguments
https://bugs.ruby-lang.org/issues/15477#change-76031
* Author: robb (Robb Shecter)
* Status: Open
* Priority: Normal
* Assignee:
* Target version:
----------------------------------------
```
f = -> x { x + 2 }
g = -> x { x * 2 }
h = f << g
f.arity # => 1
g.arity # => 1
h.arity # => -1 THIS SHOULD BE 1 because h "knows" that it takes exactly 1 argument:
h.call # => ArgumentError (given 0, expected 1)
```
Lambda Procs which are composed using `<<` seem to partially lose knowledge of their arity. I don't know if this affects other procs, or the `>>` operator as well. The Proc#arity docs state that -1 is returned only when a variable or unknown number of arguments are expected by the Proc. But here, that's not the case.
--
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>