Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 78e42e4f2099667fe3f21ebaf3052d7c3a14e862ab066c5a1cb46870e8fb0846
Ticket: 154f0982f2f701a1c3f964c0a3d54737361a3630
Tcl_NewObjectInstance() silently ignores existing namespace argument
User & Date: dkf on 2024-05-23 12:47:48
Changes

  1. icomment:
    There are two ways we could vary things from how they are now:
    
    1. Make `AllocObject()` return `NULL` in this case and not reset the result (so the underlying error in `Tcl_CreateNamespace()` can shine through, or we can generate our own error; we've definitely got a valid `interp` at that point. `TclNewObjectInstanceCommon()` can then pass the failure out (that function already has failure semantics in place so we don't need to check its callers).
    2. Make `AllocObject()` call `Tcl_Panic()` if it can't allocate the named namespace. I'm not keen on this option as I suspect it would make the panic definitely reachable from Tcl scripts.
    
    There are other users of `AllocObject()` but they all pass `NULL` for `nsNamePtr`; they won't go down this code path. This is a *total* audit of callers of `AllocObject()` as that was, is, and always will be internal to `tclOO.c`; the other callers are in the function that sets up the base of the object hierarchy.
    
  2. login: "dkf"
  3. mimetype: "text/x-markdown"