Fix a few wording nits
This commit is contained in:
parent
17e9fd3ada
commit
e7c92e36ed
19
pep-0395.txt
19
pep-0395.txt
|
@ -162,8 +162,9 @@ Two simple changes are proposed to fix this problem:
|
|||
``os.path.splitext(os.path.basename(__file__))[0]`` as well as under
|
||||
``__main__``.
|
||||
|
||||
With the main module also stored under its "real" name, imports will pick it
|
||||
up from the ``sys.modules`` cache rather than reimporting it under a new name.
|
||||
With the main module also stored under its "real" name, attempts to import it
|
||||
will pick it up from the ``sys.modules`` cache rather than reimporting it
|
||||
under the new name.
|
||||
|
||||
|
||||
Fixing direct execution inside packages
|
||||
|
@ -187,7 +188,7 @@ that doesn't contain an ``__init__`` file. Once that directory is found, it
|
|||
will be set to ``sys.path[0]``, ``sys.argv[0]`` will be set to ``-m`` and
|
||||
``runpy._run_module_as_main`` will be invoked with the appropriate module
|
||||
name (as calculated based on the original filename and the directories
|
||||
traversed while looking for a directory without an ``__init__`` file.
|
||||
traversed while looking for a directory without an ``__init__`` file).
|
||||
|
||||
|
||||
Fixing pickling without breaking introspection
|
||||
|
@ -200,10 +201,10 @@ When setting the ``__module__`` attribute on a function or class, the
|
|||
interpreter will be updated to use ``__source_name__`` if defined, falling
|
||||
back to ``__name__`` otherwise.
|
||||
|
||||
``__source_name__`` will automatically be set to the main module's "real" name
|
||||
(as described above under the fix to prevent duplicate imports of the main
|
||||
module) by the interpreter. This will fix both pickling and introspection for
|
||||
the main module.
|
||||
In the main module, ``__source_name__`` will automatically be set to the main
|
||||
module's "real" name (as described above under the fix to prevent duplicate
|
||||
imports of the main module) by the interpreter. This will fix both pickling
|
||||
and introspection for the main module.
|
||||
|
||||
It is also proposed that the pickling mechanism for classes and functions be
|
||||
updated to use an optional ``__pickle_module__`` attribute when deciding how
|
||||
|
@ -226,8 +227,8 @@ Fixing multiprocessing on Windows
|
|||
|
||||
With ``__source_name__`` now available to tell ``multiprocessing`` the real
|
||||
name of the main module, it should be able to simply include it in the
|
||||
serialised information passed to the child process, eliminating the dubious
|
||||
reverse engineering of the ``__file__`` attribute.
|
||||
serialised information passed to the child process, eliminating the
|
||||
need for dubious reverse engineering of the ``__file__`` attribute.
|
||||
|
||||
|
||||
Reference Implementation
|
||||
|
|
Loading…
Reference in New Issue