Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

always unlock jval #3791

Merged
merged 5 commits into from
Aug 27, 2019
Merged

always unlock jval #3791

merged 5 commits into from
Aug 27, 2019

Conversation

MichaelChirico
Copy link
Member

@MichaelChirico MichaelChirico commented Aug 27, 2019

Closes #2245
follow-up to #3768

@mattdowle mattdowle changed the title Closes #2245 -- always unlock jval always unlock jval Aug 27, 2019
@mattdowle mattdowle added this to the 1.12.4 milestone Aug 27, 2019
R/data.table.R Outdated
@@ -1265,6 +1265,8 @@ replace_order = function(isub, verbose, env) {
}

jval = eval(jsub, SDenv, parent.frame())
.Call(Csetattrib, jval, '.data.table.locked', NULL) # in case jval inherits .SD's lock, #1341 #2245. Use .Call not setattr() to avoid bumping jval's MAYBE_REFERENCED.
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh thanks. i was just scratching my head about what's going on here, would've taken me quite some time to figure it out 👍

src/assign.c Outdated Show resolved Hide resolved
@codecov
Copy link

codecov bot commented Aug 27, 2019

Codecov Report

Merging #3791 into master will decrease coverage by <.01%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #3791      +/-   ##
==========================================
- Coverage   99.41%   99.41%   -0.01%     
==========================================
  Files          71       71              
  Lines       13224    13222       -2     
==========================================
- Hits        13147    13145       -2     
  Misses         77       77
Impacted Files Coverage Δ
src/assign.c 100% <100%> (ø) ⬆️
R/data.table.R 100% <100%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 0f39178...f6eda8c. Read the comment docs.

R/data.table.R Outdated
# #2245 jval can be data.table even if is.null(irows); unlock then as well
if (is.data.table(jval)) {
setattr(jval, '.data.table.locked', NULL) # fix for #1341
if (!truelength(jval)) alloc.col(jval)
Copy link
Member

@mattdowle mattdowle Aug 27, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This commit (b13fdb4) also removed this alloc.col() which seems redundant. But it must have been covered since we have 100% R coverage, and the R coverage detects uncovered branches on the same line. So to find how it was covered I added it back with a stop() in commit b30e0cf. One test 2074.05 hit that stop. Which was a coverage test added fairly recently thanks to Michael. That coverage test does trigger the alloc.col but there isn't any need for the alloc.col in that test. So let's remove it for now since I don't see why the alloc.col is needed. Returning a data.table should already be over allocated which is why the coverage test needed to manually construct an invalid data.table to return.

@mattdowle mattdowle merged commit d5eb590 into master Aug 27, 2019
@mattdowle mattdowle deleted the j_lock_sd branch August 27, 2019 23:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

table retain's SD's locked attribute outside [
2 participants