Skip to content

Commit

Permalink
Don't error on tohil namespace creation failure
Browse files Browse the repository at this point in the history
There's a report from FlightAware hitting this error, but it's elusive,
happens only in the rivet apache module and not very often.

But the error can be caused simply by doing a

```tcl
    namespace eval ::tohil {}
    package require tohil
```

That ought to not be an error.  In fact, from high-level Tcl itself there's no
explicit way to cause a namespace-already-exists error because `namespace eval` creates the namespace
if it doesn't exist and is ok with it if it does.

The concern here is that there is some underlying problem with the
multiple tcl interpreter / python subinterpreter stuff.  But in any case
the above shouldn't be a traceback.
  • Loading branch information
lehenbauer committed Jul 24, 2021
1 parent ac88da0 commit edec0e5
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions generic/tohil.c
Original file line number Diff line number Diff line change
Expand Up @@ -4139,8 +4139,9 @@ Tohil_Init(Tcl_Interp *interp)
if (Tcl_PkgProvide(interp, "tohil", PACKAGE_VERSION) != TCL_OK)
return TCL_ERROR;

if (Tcl_CreateNamespace(interp, "::tohil", NULL, NULL) == NULL)
return TCL_ERROR;
//if (Tcl_CreateNamespace(interp, "::tohil", NULL, NULL) == NULL)
// return TCL_ERROR;
Tcl_CreateNamespace(interp, "::tohil", NULL, NULL);

// if i haven't been told python is up, tcl is the parent,
// and we need to initialize the python interpreter and
Expand Down

0 comments on commit edec0e5

Please sign in to comment.