@@ -209,7 +209,7 @@ Standard names are defined for the following types:
209209
210210.. class :: ModuleType(name, doc=None)
211211
212- The type of :term: `modules <module> `. Constructor takes the name of the
212+ The type of :term: `modules <module> `. The constructor takes the name of the
213213 module to be created and optionally its :term: `docstring `.
214214
215215 .. note ::
@@ -224,12 +224,23 @@ Standard names are defined for the following types:
224224
225225 The :term: `loader ` which loaded the module. Defaults to ``None ``.
226226
227+ This attribute is to match :attr: `importlib.machinery.ModuleSpec.loader `
228+ as stored in the attr:`__spec__ ` object.
229+
230+ .. note ::
231+ A future version of Python may stop setting this attribute by default.
232+ To guard against this potential change, preferrably read from the
233+ :attr: `__spec__ ` attribute instead or use
234+ ``getattr(module, "__loader__", None) `` if you explicitly need to use
235+ this attribute.
236+
227237 .. versionchanged :: 3.4
228238 Defaults to ``None ``. Previously the attribute was optional.
229239
230240 .. attribute :: __name__
231241
232- The name of the module.
242+ The name of the module. Expected to match
243+ :attr: `importlib.machinery.ModuleSpec.name `.
233244
234245 .. attribute :: __package__
235246
@@ -238,9 +249,26 @@ Standard names are defined for the following types:
238249 to ``'' ``, else it should be set to the name of the package (which can be
239250 :attr: `__name__ ` if the module is a package itself). Defaults to ``None ``.
240251
252+ This attribute is to match :attr: `importlib.machinery.ModuleSpec.parent `
253+ as stored in the attr:`__spec__ ` object.
254+
255+ .. note ::
256+ A future version of Python may stop setting this attribute by default.
257+ To guard against this potential change, preferrably read from the
258+ :attr: `__spec__ ` attribute instead or use
259+ ``getattr(module, "__package__", None) `` if you explicitly need to use
260+ this attribute.
261+
241262 .. versionchanged :: 3.4
242263 Defaults to ``None ``. Previously the attribute was optional.
243264
265+ .. attribute :: __spec__
266+
267+ A record of the the module's import-system-related state. Expected to be
268+ an instance of :class: `importlib.machinery.ModuleSpec `.
269+
270+ .. versionadded :: 3.4
271+
244272
245273.. class :: GenericAlias(t_origin, t_args)
246274
0 commit comments