You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This error occurs because sealClass() includes the following line:
if (missing(where)) where <- findClass(Class, unique = "sealing the class", where = where)
Because findClass() always returns a list (even if 'unique' contains a character string indicating that a unique location for the class is expected), this statement assigns a list of length 1, containing a single environment, to the variable 'where'.
This results in an error being thrown in the subsequent call to assignClassDef(), which expects the 'where' argument to contain an environment, rather than a list of environments:
assignClassDef(Class, classDef, where)
For this reason, the abovementioned line in sealClass() should instead read:
if (missing(where)) where <- findClass(Class, unique = "sealing the class", where = where)[[1]]
A patch for this bug is attached. Thanks very much for your assistance in this matter.
Created attachment 2383 [details]
A patch for sealClass() generated as described in https://www.r-project.org/bugs.html.
Function sealClass() cannot be used without specifying the 'where' argument. This issue exists in R versions 2.15.1 through 3.5.0.
Here is an example of the bug in question:
[1] FALSE
Error in list2env(list(), NULL, ) :
names(x) must be a character vector of the same length as x
[1] FALSE
[1] TRUE
This error occurs because sealClass() includes the following line:
if (missing(where)) where <- findClass(Class, unique = "sealing the class", where = where)
Because findClass() always returns a list (even if 'unique' contains a character string indicating that a unique location for the class is expected), this statement assigns a list of length 1, containing a single environment, to the variable 'where'.
This results in an error being thrown in the subsequent call to assignClassDef(), which expects the 'where' argument to contain an environment, rather than a list of environments:
assignClassDef(Class, classDef, where)
For this reason, the abovementioned line in sealClass() should instead read:
if (missing(where)) where <- findClass(Class, unique = "sealing the class", where = where)[[1]]
A patch for this bug is attached. Thanks very much for your assistance in this matter.
METADATA
The text was updated successfully, but these errors were encountered: