Allows the manipulation of Python modules through the Python/C API. Like
PYTHON_FILE, it is unlikely that most casual users of the ePolyglot library
will have much direct use for this class.
class interface PYTHON_MODULE
creation
make_from_borrowed_reference (new_python_object_pointer: POINTER)
-- uses the given object pointer and increases the reference
-- count of the given python object. Used in cases where the
-- Python C api does not automatically increase the reference
-- count. Terminology ("borrowed reference" vs "new reference")
-- is taken from the Python C Api documentation
require
new_python_object_pointer.is_not_null
make_from_new_reference (new_python_object_pointer: POINTER)
-- uses the given object pointer without increasing reference
-- count of the python object. Used because several Python C
-- api calls generate a new object with a reference count of
-- 1, and we don't want to increase that or we get too many
-- false references
require
new_python_object_pointer.is_not_null
make_from_python_object (object: PYTHON_OBJECT)
-- uses the existing python_object_pointer of python_object
require
object /= Void
from_name (new_name: STRING)
-- creates a new object with the given name
from_import (new_name: STRING)
-- creates a new module by importing from the given name
feature(s) from PYTHON_MODULE
from_name (new_name: STRING)
-- creates a new object with the given name
from_import (new_name: STRING)
-- creates a new module by importing from the given name
get_dictionary: PYTHON_DICTIONARY
-- gets the dictionary object implementing the module's namespace
name: STRING
-- equivalent of python's __name__ value for the module
filename: STRING
-- filename from which the module was loaded
invariant
reference_count >= 0;
valid_reference: not is_none implies is_module;
end of PYTHON_MODULE |