Hi Duncan, Martin

Here's a small patch that fixes bug 15199 reported at:
https://bugs.r-project.org/bugzilla3/show_bug.cgi?id=15199

I was able to reproduce the bug as Duncan had outlined just fine, but I did notice that when we debug(f), the problem went away. I later realized that f(1,,3) behaved correctly the first time it was executed, but misbehaved as documented on subsequent calls. This narrowed the problem down to the byte-compilation that occurs on subsequent function calls.

This patch prevents byte-compilation on closure objects.
Although it's a less than ideal solution, this patch fixes the bug at least until the underlying byte-compilation issue can be found (I'm currently scrutinizing the promiseArgs function at eval.c:2771).

Thanks,
Sahil
Index: src/main/eval.c
===================================================================
--- src/main/eval.c	(revision 72894)
+++ src/main/eval.c	(working copy)
@@ -1059,8 +1059,8 @@
 
     SEXP body = BODY(fun);
 
-    if (R_jit_enabled > 0 && TYPEOF(body) != BCODESXP &&
-	! R_disable_bytecode && ! NOJIT(fun)) {
+    if (R_jit_enabled > 0 && TYPEOF(fun) != CLOSXP && TYPEOF(body) != BCODESXP
+    	&& !R_disable_bytecode && ! NOJIT(fun)) {
 
 	if (MAYBEJIT(fun)) {
 	    /* function marked as MAYBEJIT the first time now seen
______________________________________________
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel

Reply via email to