diff options
| author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2020-01-07 15:20:49 (GMT) |
|---|---|---|
| committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2020-01-07 15:20:49 (GMT) |
| commit | 14b5289e4aa4945dd080d1d3d2dad7f54537eec8 (patch) | |
| tree | 8f683aa0cbf8062ba81931b49f3731abbccd0a8f /generic/tclResult.c | |
| parent | bb09dba8c07eb42beccc0249f53dc2ca25bb01ed (diff) | |
| parent | 49a7184962b241204447d10cb9546f514237c344 (diff) | |
| download | tcl-14b5289e4aa4945dd080d1d3d2dad7f54537eec8.zip tcl-14b5289e4aa4945dd080d1d3d2dad7f54537eec8.tar.gz tcl-14b5289e4aa4945dd080d1d3d2dad7f54537eec8.tar.bz2 | |
Merge 8.7
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 d5a7fb8..3d39bc5 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)); |
