| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Relative imports use resolve_name to get the absolute target name,
which first seeks the current module's absolute package name from the globals:
If __package__ (and __spec__.parent) are missing then
import uses __name__, truncating the last segment if
the module is a submodule rather than a package __init__.py
(which it guesses from whether __path__ is defined).
The __name__ attempt should fail if there is no parent package (top level modules),
if __name__ is '__main__' (-m entry points), or both (scripts).
That is, if both __name__ has no subcomponents and the module does not seem
to be a package __init__ module then import should fail..
(cherry picked from commit 92420b3e679959a7d0ce875875601a4cee45231e)
Co-authored-by: Ben Lewis <benjimin@users.noreply.github.com>
(cherry picked from commit 0a6693a469cfb1dd5c8048d8cb4231a7b5883251)
Co-authored-by: Brett Cannon <54418+brettcannon@users.noreply.github.com>
|
| |
|
| |
This reverts commit e34b5f4d6483187969d5149c801d056b72ef2ddb.
|
| |
|
| |
(cherry picked from commit 8f4ef3b019ce380022018587571b0f970e668de3)
|
| |
|
|
|
|
|
| |
(#6869)
(cherry picked from commit 8709b236fc997077d24b4802320db287640f82e2)
Co-authored-by: Barry Warsaw <barry@python.org>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
Historically, -m added the empty string as sys.path
zero, meaning it resolved imports against the current
working directory, the same way -c and the interactive
prompt do.
This changes the sys.path initialisation to add the
*starting* working directory as sys.path[0] instead,
such that changes to the working directory while the
program is running will have no effect on imports
when using the -m switch.
(cherry picked from commit d5d9e02dd3c6df06a8dd9ce75ee9b52976420a8b)
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Python now supports checking bytecode cache up-to-dateness with a hash of the
source contents rather than volatile source metadata. See the PEP for details.
While a fairly straightforward idea, quite a lot of code had to be modified due
to the pervasiveness of pyc implementation details in the codebase. Changes in
this commit include:
- The core changes to importlib to understand how to read, validate, and
regenerate hash-based pycs.
- Support for generating hash-based pycs in py_compile and compileall.
- Modifications to our siphash implementation to support passing a custom
key. We then expose it to importlib through _imp.
- Updates to all places in the interpreter, standard library, and tests that
manually generate or parse pyc files to grok the new format.
- Support in the interpreter command line code for long options like
--check-hash-based-pycs.
- Tests and documentation for all of the above.
|
| |
|
|
| |
attribute. (#3620)
|
| |
|
| |
binding a submodule to a name.
|
| |
|
|
|
|
|
|
|
| |
(#2639)
instead of failing with SystemError.
Relative import from non-package now fails with ImportError rather than
SystemError.
|
| |
|
|
| |
(#2580)
|
| |
|
|
|
|
| |
(#1920)
We get `ERROR_BAD_NETPATH` (53) on AppVeyor which is translated to
ENOENT (2).
|
| |
|
| |
a submodule to a name are now supported.
|
| |
|
| |
Patch by Anish Shah.
|
| | |
|
| |
|
| |
Windows uses backslashes for separators.
|
| |
|
|
| |
bpo-29546: Improve from-import error message with location
|
| | |
|
| | |
|
| | |
|
| |
|
|
| |
files cannot be written.
|
| |
|
|
|
|
| |
ImportError if __name__ is not defined on a package.
Thanks to Armin Rigo for the bug report and diagnosing the cause.
|
| |
|
|
| |
Patch by Christie Wilson.
|
| | |
|
| |
|
|
| |
Patch by Isaac Schwabacher.
|
| |
|
|
|
|
| |
The concept of .pyo files no longer exists. Now .pyc files have an
optional `opt-` tag which specifies if any extra optimizations beyond
the peepholer were applied.
|
| | |
|
| |
|