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

elementNROWS() is generally incorrect for vector extensions #40

Open
lawremi opened this issue Jun 4, 2019 · 0 comments
Open

elementNROWS() is generally incorrect for vector extensions #40

lawremi opened this issue Jun 4, 2019 · 0 comments

Comments

@lawremi
Copy link
Collaborator

lawremi commented Jun 4, 2019

The elementNROWS,ANY() calls the C-level sapply_NROWS(), relying on an error condition to fallback to the safe vapply(., NROWS, ...) path. Unfortunately, sapply_NROWS() will succeed (with a generally incorrect result) for any "object" that is implemented by a vector, including lists (very common). We could dispatch to NROWS() in that case, but it the simplest fix would be to fail whenever IS_OBJECT() is TRUE.

Like

	if (!IS_VECTOR(x) || IS_OBJECT(x))
 		error("get_NROW() defined only on a vector (or NULL)");
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

No branches or pull requests

1 participant