Displaying 1 result from an estimated 1 matches for "r_environmentislocked".
2014 Oct 17
1
Making parent.env<- an error for package namespaces and package imports
...SE;
+}
+
SEXP attribute_hidden do_parentenvgets(SEXP call, SEXP op, SEXP args, SEXP rho)
{
SEXP env, parent;
@@ -371,6 +389,10 @@
error(_("argument is not an environment"));
if( env == R_EmptyEnv )
error(_("can not set parent of the empty environment"));
+ if (R_EnvironmentIsLocked(env) && R_IsNamespaceEnv(env))
+ error(_("can not set the parent environment of a namespace"));
+ if (R_EnvironmentIsLocked(env) && R_IsImportsEnv(env))
+ error(_("can not set the parent environment of package imports"));
parent = CADR(args);...