diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2020-01-06 10:40:14 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2020-01-06 10:40:14 (GMT) |
commit | ea707391882e00872e4a2eef8ba41d304abd421f (patch) | |
tree | a89c9b623b0611e0ff2fc91fe48d06f7f4722ad1 /generic/tclResult.c | |
parent | 82d75fed0306193fe1798696b2a0104ca1e49329 (diff) | |
parent | d7728fcc6900b15ef7dda907d3cf9a15c9363bd5 (diff) | |
download | tcl-ea707391882e00872e4a2eef8ba41d304abd421f.zip tcl-ea707391882e00872e4a2eef8ba41d304abd421f.tar.gz tcl-ea707391882e00872e4a2eef8ba41d304abd421f.tar.bz2 |
Merge 8.6
Diffstat (limited to 'generic/tclResult.c')
-rw-r--r-- | generic/tclResult.c | 32 |
1 files changed, 13 insertions, 19 deletions
diff --git a/generic/tclResult.c b/generic/tclResult.c index 3c856d3..ac1f6dd 100644 --- a/generic/tclResult.c +++ b/generic/tclResult.c @@ -1690,22 +1690,14 @@ Tcl_SetReturnOptions( * * Tcl_TransferResult -- * - * Copy the result (and error information) from one interp to another. + * Transfer the result (and error information) from one interp to another. * Used when one interp has caused another interp to evaluate a script * and then wants to transfer the results back to itself. * - * This routine copies the string reps of the result and error - * information. It does not simply increment the refcounts of the result - * and error information objects themselves. It is not legal to exchange - * objects between interps, because an object may be kept alive by one - * interp, but have an internal rep that is only valid while some other - * interp is alive. - * * Results: - * The target interp's result is set to a copy of the source interp's - * result. The source's errorInfo field may be transferred to the - * target's errorInfo field, and the source's errorCode field may be - * transferred to the target's errorCode field. + * The result of targetInterp is set to the result read from sourceInterp. + * The return options dictionary of sourceInterp is transferred to + * targetInterp as appropriate for the return code value code. * * Side effects: * None. @@ -1715,14 +1707,16 @@ Tcl_SetReturnOptions( void Tcl_TransferResult( - Tcl_Interp *sourceInterp, /* Interp whose result and error information + Tcl_Interp *sourceInterp, /* Interp whose result and return options * should be moved to the target interp. * After moving result, this interp's result * is reset. */ - int result, /* TCL_OK if just the result should be copied, - * TCL_ERROR if both the result and error - * information should be copied. */ - Tcl_Interp *targetInterp) /* Interp where result and error information + int code, /* The return code value active in + * sourceInterp. Controls how the return options + * dictionary is retrieved from sourceInterp, + * same as in Tcl_GetReturnOptions, to then be + * transferred to targetInterp. */ + Tcl_Interp *targetInterp) /* Interp where result and return options * should be stored. If source and target are * the same, nothing is done. */ { @@ -1733,7 +1727,7 @@ Tcl_TransferResult( return; } - if (result == TCL_OK && siPtr->returnOpts == NULL) { + if (code == TCL_OK && siPtr->returnOpts == NULL) { /* * Special optimization for the common case of normal command return * code and no explicit return options. @@ -1745,7 +1739,7 @@ Tcl_TransferResult( } } else { Tcl_SetReturnOptions(targetInterp, - Tcl_GetReturnOptions(sourceInterp, result)); + Tcl_GetReturnOptions(sourceInterp, code)); tiPtr->flags &= ~(ERR_ALREADY_LOGGED); } Tcl_SetObjResult(targetInterp, Tcl_GetObjResult(sourceInterp)); |