Skip to content

Commit

Permalink
add sanity check for is(,class2)
Browse files Browse the repository at this point in the history
git-svn-id: https://svn.r-project.org/R/trunk@81549 00db46b3-68df-0310-9c12-caf00c1e9a41
  • Loading branch information
ripley committed Jan 22, 2022
1 parent b048065 commit e0fa9f3
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
5 changes: 3 additions & 2 deletions doc/NEWS.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -173,8 +173,9 @@
three numeric vectors is a surprisingly common error.
\item \code{mean()}, \code{rank()}, \code{which},
\code{barplot()}, \code{contour()} and \code{polygon()} have more
robust sanity checks on some of their arguments.
\code{barplot()}, \code{contour()}, \code{polygon()}
and \code{methods::is()}
have more robust sanity checks on some of their arguments.
}
}
Expand Down
3 changes: 2 additions & 1 deletion src/library/methods/R/is.R
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# File src/library/methods/R/is.R
# Part of the R package, https://www.R-project.org
#
# Copyright (C) 1995-2021 The R Core Team
# Copyright (C) 1995-2022 The R Core Team
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
Expand All @@ -28,6 +28,7 @@ is <- function(object, class2)
class1 <- class1[[1L]]
if(missing(class2))
return(extends(class1))
stopifnot(length(class2) == 1L)
class1Def <- getClassDef(class1)
class2Def <- NULL
if(!is.character(class2)) {
Expand Down

0 comments on commit e0fa9f3

Please sign in to comment.