Skip to content
Tcl Source Code History Of Ticket 07000bd237c021d5
Login

History Of Ticket 07000bd237c021d5

Artifacts Associated With Ticket 07000bd237c021d5

  1. Ticket change [3f2cb31e6c] (rid 247998) by apnadkarni on 2025-11-10 16:57:22:

    1. assignee initialized to: "nobody"
    2. closer initialized to: "nobody"
    3. cmimetype initialized to: "text/x-markdown"
    4. comment initialized to:
      The documentation for `Tcl_{Set,Get,Take}BigNum` needs to clarified with respect to handling of `mp_int` memory. At least,
      
      - Tcl_SetBignumObj should clarify that the passed `mp_int` is cleared by Tcl and will not hold it original value
      
      - Tcl_{Get,Take}BignumFromObj - `mp_clear` needs to be called on the returned `mp_int` values to free memory.
      
    5. is_private initialized to: "0"
    6. login: "apnadkarni"
    7. priority initialized to: "5 Medium"
    8. private_contact initialized to: "9546e9877f1a8899e25a89082561ee694e7fb402"
    9. resolution initialized to: "None"
    10. severity initialized to: "Minor"
    11. status initialized to: "Open"
    12. submitter initialized to: "apnadkarni"
    13. subsystem initialized to: "56. LibTomMath"
    14. title initialized to:
      Bignum documentation needs to be clarified w.r.t mp_int handling
      
    15. type initialized to: "Bug"
  2. Ticket change [0bdfdcd1f0] (rid 250326) by cdubois on 2026-01-12 03:39:06:

    1. icomment:
      Thanks for flagging this. Making the ownership/lifetime contract for mp_int explicit is important to prevent leaks and accidental misuse.
      
      I agree the docs should be strict here. I will cross-check the current implementation (including Tcl_TakeBignumFromObj behaviour for shared vs unshared objects) and then propose a documentation patch.
      
      Proposed doc clarifications (subject to confirming the implementation):
      
      - Tcl_SetBignumObj: clarify whether the function clears/consumes the supplied mp_int (i.e., callers must treat it as cleared and not rely on its prior value after the call).
      
      - Tcl_GetBignumFromObj / Tcl_TakeBignumFromObj: clarify whether the caller must call mp_clear on the mp_int they receive/populate to release internal allocations, and what postconditions apply to the source object in the Take case.
      
      I can also add a minimal code snippet illustrating the correct cleanup pattern.
      
    2. login: "cdubois"
    3. mimetype: "text/plain"
  3. Ticket change [47dcfd7e07] (rid 250375) by apnadkarni on 2026-01-14 14:56:51:

    1. icomment:
      @cdubois, Great, a documentation patch would be greatly appreciated. It is really quite confusing as it stands.
      
    2. login: "apnadkarni"
    3. mimetype: "text/plain"