Skip to content

Commit 80263a0

Browse files
committed
Merge branch 'master' into resizable-API
2 parents 3b9a572 + 41e1123 commit 80263a0

File tree

8 files changed

+36
-22
lines changed

8 files changed

+36
-22
lines changed

.gitattributes

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,16 @@
88
# want to preserve the line endings robustly
99
inst/tests/** -text
1010
inst/tests/*.Rraw text eol=lf linguist-language=R
11+
# Ensure GitHub linguist only considers source code files
12+
# for language statistics
13+
docs/** linguist-documentation
14+
man/** linguist-documentation
15+
tests/** linguist-vendored
16+
vignettes/** linguist-vendored
17+
po/** linguist-vendored
18+
.github/** linguist-vendored
19+
.ci/** linguist-vendored
20+
.dev/** linguist-vendored
21+
.devcontainer/** linguist-vendored
22+
.graphics/** linguist-vendored
23+
.Rproj.user/** linguist-vendored

NEWS.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -375,6 +375,8 @@ See [#2611](https://github.com/Rdatatable/data.table/issues/2611) for details. T
375375
376376
7. In rare situations a data.table object may lose its internal attribute that holds a self-reference. New helper function `.selfref.ok()` tests just that. It is only intended for technical use cases. See manual for examples.
377377
378+
8. Retain important information in the error message about the source of the error when `i=` fails, e.g. pointing to `charToDate()` failing in `DT[date_col == "20250101"]`, [#7444](https://github.com/Rdatatable/data.table/issues/7444). Thanks @jan-swissre for the report and @MichaelChirico for the fix.
379+
378380
## data.table [v1.17.8](https://github.com/Rdatatable/data.table/milestone/41) (6 July 2025)
379381
380382
1. Internal functions used to signal errors are now marked as non-returning, silencing a compiler warning about potentially unchecked allocation failure. Thanks to Prof. Brian D. Ripley for the report and @aitap for the fix, [#7070](https://github.com/Rdatatable/data.table/pull/7070).

R/data.table.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ replace_dot_alias = function(e) {
111111
)
112112
idx = regexpr(missing_obj_regex, err_str, perl=TRUE)
113113
if (idx == -1L)
114-
stopf("%s", err_str, domain=NA) # Don't use stopf() directly, since err_str might have '%', #6588
114+
stop(err) # Pass 'err' to retain call site data (#7444); beware also #6588
115115
start = attr(idx, "capture.start", exact=TRUE)[ , "obj_name"]
116116
used = substr(
117117
err_str,

inst/tests/programming.Rraw

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -616,3 +616,10 @@ test(202.2, f(dt, params=jpar), data.table(y=2:1))
616616
"." = function(...) list(.j=list("x"))
617617
test(202.3, dt[, .j, env=.(.j=list("y"))], data.table(x=1:2))
618618
rm(list=".")
619+
x = 2L ## no NSE, tests explicitly : ! -
620+
y = 2L
621+
test(202.4, dt[, .j, env = list(.j = x:y)], data.table(y=2:1))
622+
col = "x"
623+
test(202.5, dt[, .j, env = list(.j = !col)], error = "invalid argument type")
624+
test(202.6, dt[, .j, env = list(.j = -col)], error = "invalid argument to unary operator")
625+
rm(x, y, col)

inst/tests/tests.Rraw

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20800,7 +20800,8 @@ baz(x)
2080020800
test(2295.7, is.data.table(x))
2080120801

2080220802
# #6588: .checkTypos used to give arbitrary strings to stopf as the first argument
20803-
test(2296, d2[x %no such operator% 1], error = '%no such operator%')
20803+
DT = data.table(a = 1)
20804+
test(2296, DT[x %no such operator% 1], error = '%no such operator%')
2080420805

2080520806
# fix coercing integer/double for joins on multiple columns, #6602
2080620807
x = data.table(a=1L)
@@ -21870,3 +21871,8 @@ test(2346, data.table::fread(text = text), data.table(mary = rep("mary", 99), ha
2187021871
DT = data.table(a="a", grp=1L)
2187121872
i = c(1, 1, 1, NA, NA)
2187221873
test(2347, DT[i, .(result = all(is.na(grp) == is.na(a))), by = grp][,all(result)], options = list(datatable.optimize = 0))
21874+
21875+
# .checkTypos internal implementation not exposed for non-typo bug, #7444
21876+
DT = data.table(a = as.Date("2010-01-01"), b = 1L)
21877+
test(2348.1, tryCatch(DT[a == as.Date("20100101")], error=conditionCall)[[1L]], quote(charToDate))
21878+
test(2348.2, tryCatch(DT[a == as.Date("20100101") | b == 2L], error=conditionCall)[[1L]], quote(charToDate))

src/dogroups.c

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -511,21 +511,6 @@ SEXP dogroups(SEXP dt, SEXP dtcols, SEXP groups, SEXP grpcols, SEXP jiscols, SEX
511511
return(ans);
512512
}
513513

514-
SEXP keepattr(SEXP to, SEXP from)
515-
{
516-
// Same as R_copyDFattr in src/main/attrib.c, but that seems not exposed in R's api
517-
// Only difference is that we reverse from and to in the prototype, for easier calling above
518-
SET_ATTRIB(to, ATTRIB(from));
519-
if (isS4(from)) {
520-
to = PROTECT(asS4(to, TRUE, 1));
521-
SET_OBJECT(to, isObject(from));
522-
UNPROTECT(1);
523-
} else {
524-
SET_OBJECT(to, isObject(from));
525-
}
526-
return to;
527-
}
528-
529514
SEXP growVector(SEXP x, const R_len_t newlen)
530515
{
531516
// Similar to EnlargeVector in src/main/subassign.c, with the following changes :
@@ -538,7 +523,7 @@ SEXP growVector(SEXP x, const R_len_t newlen)
538523
PROTECT(newx = R_allocResizableVector(TYPEOF(x), newlen)); // TO DO: R_realloc(?) here?
539524
if (newlen < len) len=newlen; // i.e. shrink
540525
if (!len) { // cannot memcpy invalid pointer, #6819
541-
keepattr(newx, x);
526+
SHALLOW_DUPLICATE_ATTRIB(newx, x);
542527
UNPROTECT(1);
543528
return newx;
544529
}
@@ -563,7 +548,7 @@ SEXP growVector(SEXP x, const R_len_t newlen)
563548
}
564549
// if (verbose) Rprintf(_("Growing vector from %d to %d items of type '%s'\n"), len, newlen, type2char(TYPEOF(x)));
565550
// Would print for every column if here. Now just up in dogroups (one msg for each table grow).
566-
keepattr(newx,x);
551+
SHALLOW_DUPLICATE_ATTRIB(newx, x);
567552
UNPROTECT(1);
568553
return newx;
569554
}

tests/autoprint.R

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
require(data.table)
1+
# TODO(#7453): re-enable warn.conflicts
2+
require(data.table, warn.conflicts=FALSE)
23
# Tests the suppression of := output
34
# Since this tests autoprinting at the console, it needs to use the .Rout.save mechanism in R CMD check
45
DT = data.table(a=1:2) # Should print at console?

tests/autoprint.Rout.save

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ Type 'demo()' for some demos, 'help()' for on-line help, or
1515
'help.start()' for an HTML browser interface to help.
1616
Type 'q()' to quit R.
1717

18-
> require(data.table)
19-
Loading required package: data.table
18+
> # TODO(#7453): re-enable warn.conflicts
19+
> require(data.table, warn.conflicts=FALSE)
2020
> # Tests the suppression of := output
2121
> # Since this tests autoprinting at the console, it needs to use the .Rout.save mechanism in R CMD check
2222
> DT = data.table(a=1:2) # Should print at console?

0 commit comments

Comments
 (0)