diff options
Diffstat (limited to 'generic/tclStubLib.c')
-rw-r--r-- | generic/tclStubLib.c | 30 |
1 files changed, 12 insertions, 18 deletions
diff --git a/generic/tclStubLib.c b/generic/tclStubLib.c index bd80ec1..9a2e063 100644 --- a/generic/tclStubLib.c +++ b/generic/tclStubLib.c @@ -35,28 +35,21 @@ const TclIntPlatStubs *tclIntPlatStubsPtr = NULL; static const TclStubs * HasStubSupport( Tcl_Interp *interp, + const char *tclversion, int magic) { + /* TODO: Whatever additional checks using tclversion + * and/or magic should be done here. */ + Interp *iPtr = (Interp *) interp; - if (!iPtr->stubTable) { - /* No stub table at all? Nothing we can do. */ - return NULL; - } - if (iPtr->stubTable->magic != magic) { - /* - * The iPtr->stubTable entry from Tcl_Interp and the - * Tcl_NewStringObj() and Tcl_SetObjResult() entries - * in the stub table cannot change in Tcl 9 compared - * to Tcl 8.x. Otherwise the lines below won't work. - * TODO: add a test case for that. - */ - iPtr->stubTable->tcl_SetObjResult(interp, - iPtr->stubTable->tcl_NewStringObj( - "This extension is compiled for Tcl 9.x", -1)); - return NULL; + if (iPtr->stubTable && iPtr->stubTable->magic == magic) { + return iPtr->stubTable; } - return iPtr->stubTable; + iPtr->legacyResult + = "interpreter uses an incompatible stubs mechanism"; + iPtr->legacyFreeProc = 0; /* TCL_STATIC */ + return NULL; } /* @@ -91,6 +84,7 @@ TclInitStubs( Tcl_Interp *interp, const char *version, int exact, + const char *tclversion, int magic) { const char *actualVersion = NULL; @@ -102,7 +96,7 @@ TclInitStubs( * times. [Bug 615304] */ - tclStubsPtr = HasStubSupport(interp, magic); + tclStubsPtr = HasStubSupport(interp, tclversion, magic); if (!tclStubsPtr) { return NULL; } |