Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: d6ec06cb6b7350acd351c5c564467120effefa1c
Ticket: 1899164fffffffffffffffffffffffffffffffff
Cached bytecode not typed; expr vs. script
User & Date: dgp on 2008-02-21 21:55:45
Changes

  1. assignee changed to: "andreas_kupries"
  2. cmimetype changed to: "text/plain"
  3. comment changed to:
    
    The implementation of Tcl_ExprObj()
    tries to detect when the Tcl_Obj
    passed in is a PRECOMPILED "bytecode"
    value, and then validate interps and
    forgive any epoch expiration before
    executing the bytecode.
    
    This is incorrect, because a PRECOMPILED
    value has been compiled as a script to
    produce the bytecode, and that bytecode
    is not a valid set of instructions to
    interpret the same string as an expression.
    ([eval {0}] and [expr {0}] are different!)
    
    Worse still, the cleanup stages at the
    end of Tcl_ExprObj() will free the bytecode,
    and since PRECOMPILED values suppress the
    original string rep., the original bytecode
    will be lost with no way to recover it.
    
    Attached is a patch to make Tcl_ExprObj()
    do the only sensible thing -- raise an
    error.
    
    No one has noticed this, probably because
    it appears difficult and unnatural to
    pass a PRECOMPILED value to Tcl_ExprObj(),
    possibly even requiring internals intrusion
    to accomplish it.
    
    If there's a way to create a test case for
    this with reasonable effort in either the
    Tcl or the tbcload test suite, I'd appreciate
    that contribution.  Otherwise, just review
    and commit this fix please.
    
    
  4. foundin changed to: "obsolete: 8.5.1"
  5. is_private changed to: "0"
  6. priority changed to: "5 Medium"
  7. resolution changed to: "None"
  8. status changed to: "Open"
  9. submitter changed to: "dgp"
  10. subsystem changed to: "47. Bytecode Compiler"
  11. title changed to: "Tcl_ExprObj and PRECOMPILED scripts"
  12. type changed to: "Bug"