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

call correct which= in sys.call() #6255

Merged
merged 2 commits into from
Jul 15, 2024
Merged

call correct which= in sys.call() #6255

merged 2 commits into from
Jul 15, 2024

Conversation

MichaelChirico
Copy link
Member

@MichaelChirico MichaelChirico commented Jul 13, 2024

sys.call(1) actually pulls from the top of the stack (i.e., equivalent to sys.calls()[[1]]), but we need to pull from the bottom, hence sys.nframe().

Before:

DT=data.table(a=1, b=2)
setnames(DT, c(NA, 'b'), c('c', 'd'))
# Error in stopf("NA (or out of bounds) in 'old' at positions %s", brackify(which(is.na(old)))) : 
#   NA (or out of bounds) in 'old' at positions [1]

foo = function() {
  setnames(DT, c(NA, 'b'), c('c', 'd'))
}
foo()
# Error in setnames(DT, c(NA, "b"), c("c", "d")) : 
#   NA (or out of bounds) in 'old' at positions [1]

After:

DT=data.table(a=1, b=2)
setnames(DT, c(NA, 'b'), c('c', 'd'))
# Error in setnames(DT, c(NA, "b"), c("c", "d")) : 
#   NA (or out of bounds) in 'old' at positions [1]

foo = function() {
  setnames(DT, c(NA, 'b'), c('c', 'd'))
}
foo()
# Error in setnames(DT, c(NA, "b"), c("c", "d")) : 
#   NA (or out of bounds) in 'old' at positions [1]

Copy link

Comparison Plot

Generated via commit 6caf66a

Download link for the artifact containing the test results: ↓ atime-results.zip

Time taken to finish the standard R installation steps: 11 minutes and 32 seconds

Time taken to run atime::atime_pkg on the tests: 3 minutes and 37 seconds

Copy link
Member

@TysonStanley TysonStanley left a comment

Choose a reason for hiding this comment

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

Makes sense that the usage of raise_condition() would consistently be 2 from the bottom of the stack (but in theory could be anywhere from the top)

@MichaelChirico MichaelChirico merged commit dc39c97 into master Jul 15, 2024
3 of 4 checks passed
@MichaelChirico MichaelChirico deleted the stopf-nframe branch July 15, 2024 17:49
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.

2 participants