Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
191e3138
Commit
191e3138
authored
Oct 17, 2017
by
Barry Warsaw
Committed by
GitHub
Oct 17, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bpo-31799: Make module.__spec__ more discoverable (#4010)
bpo-31799: Make module.__spec__ more discoverable
parent
6cfa927c
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
3 deletions
+12
-3
Doc/library/importlib.rst
Doc/library/importlib.rst
+9
-1
Doc/reference/import.rst
Doc/reference/import.rst
+3
-2
No files found.
Doc/library/importlib.rst
View file @
191e3138
...
...
@@ -1048,7 +1048,15 @@ find and load modules.
.. class:: ModuleSpec(name, loader, *, origin=None, loader_state=None, is_package=None)
A specification for a module'
s
import
-
system
-
related
state
.
A specification for a module'
s
import
-
system
-
related
state
.
This
is
typically
exposed
as
the
module
's ``__spec__`` attribute. In the
descriptions below, the names in parentheses give the corresponding
attribute available directly on the module object.
E.g. ``module.__spec__.origin == module.__file__``. Note however that
while the *values* are usually equivalent, they can differ since there is
no synchronization between the two objects. Thus it is possible to update
the module'
s
``
__path__
``
at
runtime
,
and
this
will
not
be
automatically
reflected
in
``
__spec__
.
submodule_search_locations
``.
..
versionadded
::
3.4
...
...
Doc/reference/import.rst
View file @
191e3138
...
...
@@ -519,8 +519,9 @@ and the loader that executes it. Most importantly, it allows the
import machinery to perform the boilerplate operations of loading,
whereas without a module spec the loader had that responsibility.
See :class:`~importlib.machinery.ModuleSpec` for more specifics on what
information a module'
s
spec
may
hold
.
The module'
s
spec
is
exposed
as
the
``
__spec__
``
attribute
on
a
module
object
.
See
:
class
:`~
importlib
.
machinery
.
ModuleSpec
`
for
details
on
the
contents
of
the
module
spec
.
..
versionadded
::
3.4
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment