• Home
  • Raw
  • Download

Lines Matching +full:single +full:- +full:version

6 --------------
13 .. index:: single: ModuleType (in module types)
34 single: __name__ (module attribute)
35 single: __doc__ (module attribute)
36 single: __file__ (module attribute)
37 single: __package__ (module attribute)
38 single: __loader__ (module attribute)
54 Similar to :c:func:`PyModule_NewObject`, but the name is a UTF-8 encoded
60 .. index:: single: __dict__ (module attribute)
75 single: __name__ (module attribute)
76 single: SystemError (built-in exception)
87 ``'utf-8'``.
105 single: __file__ (module attribute)
106 single: SystemError (built-in exception)
119 encoded to 'utf-8'.
126 .. _initializing-modules:
132 which export an initialization function), or compiled-in modules
134 See :ref:`building` or :ref:`extending-with-embedding` for details.
138 or request "multi-phase initialization" by returning the definition struct itself.
161 Module state may be kept in a per-module memory area that can be
163 This makes modules safe for use in multiple sub-interpreters.
169 Setting ``m_size`` to ``-1`` means that the module does not support
170 sub-interpreters, because it has global state.
172 Setting it to a non-negative value means that the module can be
173 re-initialized and specifies the additional amount of memory it requires
174 for its state. Non-negative ``m_size`` is required for multi-phase
181 A pointer to a table of module-level functions, described by
186 An array of slot definitions for multi-phase initialization, terminated by
188 When using single-phase initialization, *m_slots* must be ``NULL``.
192 Prior to version 3.5, this member was always set to ``NULL``,
248 Single-phase initialization
252 directly. This is referred to as "single-phase initialization", and uses one
265 API version *module_api_version*. If that version does not match the version
276 .. _multi-phase-initialization:
278 Multi-phase initialization
281 An alternate way to specify extensions is to request "multi-phase initialization".
288 Unlike modules created using single-phase initialization, these modules are not
289 singletons: if the *sys.modules* entry is removed and the module is re-imported,
291 collection -- as with Python modules.
298 All modules created using multi-phase initialization are expected to support
299 :ref:`sub-interpreters <sub-interpreter-support>`. Making sure multiple modules
302 To request multi-phase initialization, the initialization function
303 (PyInit_modulename) returns a :c:type:`PyModuleDef` instance with non-empty
358 names through symlinks, all while sharing a single module definition.
362 setting and getting import-related attributes.
364 ``PyModuleDef`` has non-``NULL`` ``m_traverse``, ``m_clear``,
365 ``m_free``; non-zero ``m_size``; or slots other than ``Py_mod_create``.
379 See :PEP:`489` for more details on multi-phase initialization.
381 Low-level module creation functions
384 The following functions are called under the hood when using multi-phase
400 ModuleSpec *spec*, assuming the API version *module_api_version*.
401 If that version does not match the version of the running interpreter,
442 The module initialization function (if using single phase initialization) or
443 a function called from a module execution slot (if using multi-phase
452 On success, return ``0``. On error, raise an exception and return ``-1``.
464 return -1;
513 return -1;
517 return -1;
533 return -1;
547 used from the module's initialization function. Return ``-1`` on error, ``0`` on
555 ``NULL``-terminated. Return ``-1`` on error, ``0`` on success.
563 Return ``-1`` on error, ``0`` on success.
576 Return ``-1`` on error, ``0`` on success.
584 Single-phase initialization creates singleton modules that can be looked up
588 These functions will not work on modules created using multi-phase initialization,
589 since multiple such modules can be created from a single definition.
603 Only effective on modules created using single-phase initialization.
615 Return 0 on success or -1 on failure.
622 Return 0 on success or -1 on failure.