picop.cymodule#
Module / import helpers.
- picop.cymodule.mod_add_cstr(module, name, value)#
Add string constant
nameviaPyModule_AddStringConstant.Notes
nameandvaluemust bebytes, notstr. Returns0on success; errors raise — do not use the status as a bool. Alias ofmod_add_string(prefer*_cstrnaming).
- picop.cymodule.mod_add_int(module, name, value)#
Add integer constant
nameviaPyModule_AddIntConstant.Notes
namemust bebytes. Returns0on success; errors raise — do not use the status as a bool.
- picop.cymodule.mod_add_object_ref(module, name, value)#
Add
valueasnamewithout stealing the reference (PyModule_AddObjectRef).Notes
namemust bebytes. Returns0on success; errors raise — do not use the status as a bool.
- picop.cymodule.mod_check(p)#
Return True if
pis a module or subtype (PyModule_Check).
- picop.cymodule.mod_check_exact(p)#
Return True if
type(p) is types.ModuleType(PyModule_CheckExact).
- picop.cymodule.mod_eq(a, b)#
Return True if
a is b(module-object identity; CPythonobject.__eq__).
- picop.cymodule.mod_get_filename(module)#
Return
module.__file__viaPyModule_GetFilenameObject.
- picop.cymodule.mod_get_name(module)#
Return
module.__name__viaPyModule_GetNameObject.
- picop.cymodule.mod_import(name)#
Import module
nameviaPyImport_ImportModule.Notes
namemust bebytes, notstr.
- picop.cymodule.mod_import_object(name)#
Import module
nameviaPyImport_Import.Notes
Slower than the plain-Python equivalent
__import__(name)(Tier A 1.94x); module plumbing for embedding code.
- picop.cymodule.mod_magic_number()#
Return the
.pycmagic number viaPyImport_GetMagicNumber.- Return type:
- picop.cymodule.mod_new(name)#
Return a new module named
nameviaPyModule_New.Notes
namemust bebytes, notstr.
- picop.cymodule.mod_new_object(name)#
Return a new module named
nameviaPyModule_NewObject.