Internal API for developers

TclTk.Impl.new_listFunction
TclTk.Impl.new_list() -> lstptr

Return a pointer to a Tcl object storing an empty list.

TclTk.Impl.new_list(f, [interp,] args...) -> lstptr

Return a pointer to a Tcl object storing a list built by calling f(interp, list, arg) for each arg in args.... Typically, f is TclTk.Impl.unsafe_append_element or TclTk.Impl.unsafe_append_list.

Optional argument interp is a Tcl interpreter that can be used to retrieve the error message in case of failure.

Warning

The returned object is not managed and has a zero reference count. The caller is responsible of taking care of that.

source
TclTk.Impl.Tcl_DecrRefCountFunction
TclTk.Impl.Tcl_DecrRefCount(objptr) -> refcnt

Decrement the reference count of the Tcl object given its pointer and return its new reference count. If refcnt < 1 holds, the Tcl object has been released and objptr shall no longer be used.

This method emulates the Tcl_DecrRefCount macro defined in <tcl.h>.

Warning

Unsafe function: object pointer must not be null and must remain valid during the call to this function.

See also

TclTk.Impl.Tcl_IncrRefCount and TclTk.Impl.Tcl_GetRefCount.

source
TclTk.Impl.unsafe_append_elementFunction
TclTk.Impl.unsafe_append_element([interp,] list, item) -> nothing

Private method to append item as a single element to the Tcl object list.

Optional argument interp is a pointer to a Tcl interpreter. If interp is specified and non-null, it is used to retrieve the error message in case of failure.

The following conditions are asserted: list must be writable (i.e., a non-null pointer to a non-shared Tcl object) and item must be readable (i.e., a non-null pointer to a Tcl object).

Warning

Unsafe method: list, item, and interp (the latter if non-null) must remain valid during the call to this method (e.g., preserved from being garbage collected).

Warning

The method may throw and the caller is responsible of managing the reference count of item to have it automatically deleted in case of errors if it is fresh object created by new_object(val).

See also

TclTk.Impl.unsafe_append_list and TclTk.Impl.new_list.

source