From f6547eca5fc660288439c92e3bee63e9b528edb8 Mon Sep 17 00:00:00 2001 From: mattdowle Date: Wed, 18 Sep 2019 22:56:08 -0700 Subject: [PATCH] removed sole SET_NAMED --- R/data.table.R | 2 +- inst/tests/tests.Rraw | 4 ++-- src/init.c | 2 -- src/wrappers.c | 8 -------- 4 files changed, 3 insertions(+), 13 deletions(-) diff --git a/R/data.table.R b/R/data.table.R index a3ae2cc0dd..8773f1391e 100644 --- a/R/data.table.R +++ b/R/data.table.R @@ -2362,7 +2362,7 @@ setalloccol = alloc.col = function(DT, n=getOption("datatable.alloccol"), verbos name = as.character(name) assign(name,ans,parent.frame(),inherits=TRUE) } - .Call(Csetmutable,ans) + ans } selfrefok = function(DT,verbose=getOption("datatable.verbose")) { diff --git a/inst/tests/tests.Rraw b/inst/tests/tests.Rraw index 97ab9ea49a..84cd2bbdc7 100644 --- a/inst/tests/tests.Rraw +++ b/inst/tests/tests.Rraw @@ -1496,8 +1496,8 @@ DT = data.table(a=3:1,b=4:6) test(506, key(DT)<-"a", "a", warning="deprecated") test(508, DT, data.table(a=1:3,b=6:4,key="a")) test(509, DT[,b:=10L], data.table(a=1:3,b=10L,key="a")) -test(510, DT[,c:=11L], data.table(a=1:3,b=10L,c=11L,key="a")) # Used to be warning about invalid .internal.selfref detected and fixed. As from v1.8.3 data.table() returns a NAMED==0 object, and key<- appears not to copy that. But within functions, key<- would still copy. TO DO: add tests.... -#test(511,) +test(510, DT[,c:=11L], data.table(a=1:3,b=10L,c=11L,key="a"), # no warning between 1.8.3 and 1.12.2 due to (now removed) setmutable and SET_NAMED in setalloccol, #3729 + warning="Invalid .internal.selfref detected and fixed") # but the warning makes sense after the (deprecated) key(DT)<- above, so this warns again from 1.12.4 # Test new functons chmatch and %chin% y=letters diff --git a/src/init.c b/src/init.c index b7853a3f19..1147bff23a 100644 --- a/src/init.c +++ b/src/init.c @@ -25,7 +25,6 @@ SEXP reorder(); SEXP rbindlist(); SEXP vecseq(); SEXP setlistelt(); -SEXP setmutable(); SEXP address(); SEXP expandAltRep(); SEXP fmelt(); @@ -111,7 +110,6 @@ R_CallMethodDef callMethods[] = { {"Crbindlist", (DL_FUNC) &rbindlist, -1}, {"Cvecseq", (DL_FUNC) &vecseq, -1}, {"Csetlistelt", (DL_FUNC) &setlistelt, -1}, -{"Csetmutable", (DL_FUNC) &setmutable, -1}, {"Caddress", (DL_FUNC) &address, -1}, {"CexpandAltRep", (DL_FUNC) &expandAltRep, -1}, {"Cfmelt", (DL_FUNC) &fmelt, -1}, diff --git a/src/wrappers.c b/src/wrappers.c index 928be0c05a..af9ac39ccf 100644 --- a/src/wrappers.c +++ b/src/wrappers.c @@ -64,14 +64,6 @@ SEXP setlistelt(SEXP l, SEXP i, SEXP value) return(R_NilValue); } -SEXP setmutable(SEXP x) -{ - // called from one single place at R level. TODO: avoid somehow, but fails tests without - // At least the SET_NAMED() direct call is passed 0 and makes no assumptions about >0. Good enough for now as patch for CRAN is needed. - SET_NAMED(x,0); - return(x); -} - SEXP address(SEXP x) { // A better way than : http://stackoverflow.com/a/10913296/403310