@@ -223,7 +223,7 @@ Standard names are defined for the following types:
223223
224224.. class :: ModuleType(name, doc=None)
225225
226- The type of :term: `modules <module> `. Constructor takes the name of the
226+ The type of :term: `modules <module> `. The constructor takes the name of the
227227 module to be created and optionally its :term: `docstring `.
228228
229229 .. note ::
@@ -238,12 +238,23 @@ Standard names are defined for the following types:
238238
239239 The :term: `loader ` which loaded the module. Defaults to ``None ``.
240240
241+ This attribute is to match :attr: `importlib.machinery.ModuleSpec.loader `
242+ as stored in the attr:`__spec__ ` object.
243+
244+ .. note ::
245+ A future version of Python may stop setting this attribute by default.
246+ To guard against this potential change, preferrably read from the
247+ :attr: `__spec__ ` attribute instead or use
248+ ``getattr(module, "__loader__", None) `` if you explicitly need to use
249+ this attribute.
250+
241251 .. versionchanged :: 3.4
242252 Defaults to ``None ``. Previously the attribute was optional.
243253
244254 .. attribute :: __name__
245255
246- The name of the module.
256+ The name of the module. Expected to match
257+ :attr: `importlib.machinery.ModuleSpec.name `.
247258
248259 .. attribute :: __package__
249260
@@ -252,9 +263,26 @@ Standard names are defined for the following types:
252263 to ``'' ``, else it should be set to the name of the package (which can be
253264 :attr: `__name__ ` if the module is a package itself). Defaults to ``None ``.
254265
266+ This attribute is to match :attr: `importlib.machinery.ModuleSpec.parent `
267+ as stored in the attr:`__spec__ ` object.
268+
269+ .. note ::
270+ A future version of Python may stop setting this attribute by default.
271+ To guard against this potential change, preferrably read from the
272+ :attr: `__spec__ ` attribute instead or use
273+ ``getattr(module, "__package__", None) `` if you explicitly need to use
274+ this attribute.
275+
255276 .. versionchanged :: 3.4
256277 Defaults to ``None ``. Previously the attribute was optional.
257278
279+ .. attribute :: __spec__
280+
281+ A record of the the module's import-system-related state. Expected to be
282+ an instance of :class: `importlib.machinery.ModuleSpec `.
283+
284+ .. versionadded :: 3.4
285+
258286
259287.. data :: EllipsisType
260288
0 commit comments