Conversation
Agent-Logs-Url: https://github.com/igraph/rigraph/sessions/531e0c03-86ac-4e9d-a0e9-2279180d6b8c Co-authored-by: krlmlr <1741643+krlmlr@users.noreply.github.com>
Rf_findVar() and Rf_findVarInFrame()
|
@copilot: The changes should be effective for R 4.6 only, keep the old code for R 4.5 or older. |
Agent-Logs-Url: https://github.com/igraph/rigraph/sessions/cc777226-37d7-4f3b-bbc7-a53e707c28fb Co-authored-by: krlmlr <1741643+krlmlr@users.noreply.github.com>
Done in 9615eab. All uses of |
|
@copilot: |
…isteredNamespace for R >= 4.6 Agent-Logs-Url: https://github.com/igraph/rigraph/sessions/c8d0b1d1-3677-4fd5-a580-d4748a401fe8 Co-authored-by: krlmlr <1741643+krlmlr@users.noreply.github.com>
Done in 926bf8a. Changes for R ≥ 4.6:
The forward declaration uses |
Rf_findVar() and Rf_findVarInFrame()Rf_findVar(), Rf_findVarInFrame(), and R_UnboundValue
|
@copilot: Review r-devel/r-svn@3aa2470 for the signature, it's |
Agent-Logs-Url: https://github.com/igraph/rigraph/sessions/eadca524-2523-4195-a712-126f5fa6dd91 Co-authored-by: krlmlr <1741643+krlmlr@users.noreply.github.com>
Fixed in e084487. Updated the forward declaration to |
Rf_findVar(), Rf_findVarInFrame(), and R_UnboundValueRf_findVar(), Rf_findVarInFrame(), and R_UnboundValue
…and `R_UnboundValue` (#2604) Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: krlmlr <1741643+krlmlr@users.noreply.github.com> Co-authored-by: Kirill Müller <krlmlr@users.noreply.github.com>
R 4.6 flags
Rf_findVar,Rf_findVarInFrame, andR_UnboundValueas non-API entry points. This replaces all occurrences insrc/rinterface_extra.cwith public API equivalents, gated onR_VERSION >= R_Version(4, 6, 0)so that older R versions continue to use the original calls.Changes
Rf_findVar(sym, env)→R_getVarEx(sym, env, TRUE, R_NilValue)(R ≥ 4.6) where the result is checked againstR_NilValue(i.e. the variable may legitimately be absent). UsingR_NilValueas the default sentinel avoids any reference to the non-APIR_UnboundValue. Applies toRx_igraph_get_pointer()andRx_igraph_graph_version(). Falls back toRf_findVar+R_UnboundValuecomparison on R < 4.6.Rf_findVar(sym, env)→R_getVar(sym, env, TRUE)(R ≥ 4.6) where the variable must always exist (ALTREP length/dataptr callbacks,Rx_igraph_get_graph_id()).R_getVarmirrorsget()— signals a clear error if the binding is missing. Falls back toRf_findVaron R < 4.6.Rf_findFun(identity, R_BaseNamespace)+R_UnboundValuecheck inRx_igraph_safe_eval_in_env()is replaced (R ≥ 4.6) withR_getVar(identity, R_BaseNamespace, TRUE), which errors automatically ifbase::identityis not found — eliminating theR_UnboundValuecomparison.eval(call("getNamespace", "igraph"))→R_getRegisteredNamespace("igraph")(R ≥ 4.6) inRx_igraph_progress_handler(),Rx_igraph_status_handler(), andR_igraph_finalizer(). The C-levelR_getRegisteredNamespace(const char *name)(new in R 4.6) returns the already-loaded igraph namespace directly. A forward declarationSEXP R_getRegisteredNamespace(const char *name)is included under#if R_VERSION >= R_Version(4, 6, 0).PROTECT/UNPROTECTcounts are managed with apxcounter since the number of protections differs between versions. Falls back to theeval-based approach on R < 4.6.Rf_findVarInFrame(base_ns, Rf_install("emptyenv"))inRx_igraph_add_env()is eliminated entirely: the 4-line sequence that looked up and calledemptyenv()through the base namespace is replaced with theR_EmptyEnvconstant directly passed toR_NewEnv(). No version guard is needed sinceR_EmptyEnvhas been in R for many versions.Removed the now-unused
R_xlen_t ivariable fromRx_igraph_add_env().