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
c4464052
Commit
c4464052
authored
Nov 21, 2014
by
Serhiy Storchaka
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue #19720: Suppressed context for some exceptions in importlib.
parent
b6e2556d
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
6 additions
and
5 deletions
+6
-5
Lib/importlib/__init__.py
Lib/importlib/__init__.py
+3
-2
Lib/importlib/_bootstrap.py
Lib/importlib/_bootstrap.py
+1
-1
Lib/importlib/util.py
Lib/importlib/util.py
+2
-2
No files found.
Lib/importlib/__init__.py
View file @
c4464052
...
...
@@ -73,7 +73,7 @@ def find_loader(name, path=None):
except
KeyError
:
pass
except
AttributeError
:
raise
ValueError
(
'{}.__loader__ is not set'
.
format
(
name
))
raise
ValueError
(
'{}.__loader__ is not set'
.
format
(
name
))
from
None
spec
=
_bootstrap
.
_find_spec
(
name
,
path
)
# We won't worry about malformed specs (missing attributes).
...
...
@@ -138,7 +138,8 @@ def reload(module):
parent
=
sys
.
modules
[
parent_name
]
except
KeyError
:
msg
=
"parent {!r} not in sys.modules"
raise
ImportError
(
msg
.
format
(
parent_name
),
name
=
parent_name
)
raise
ImportError
(
msg
.
format
(
parent_name
),
name
=
parent_name
)
from
None
else
:
pkgpath
=
parent
.
__path__
else
:
...
...
Lib/importlib/_bootstrap.py
View file @
c4464052
...
...
@@ -2172,7 +2172,7 @@ def _find_and_load_unlocked(name, import_):
path
=
parent_module
.
__path__
except
AttributeError
:
msg
=
(
_ERR_MSG
+
'; {!r} is not a package'
).
format
(
name
,
parent
)
raise
ImportError
(
msg
,
name
=
name
)
raise
ImportError
(
msg
,
name
=
name
)
from
None
spec
=
_find_spec
(
name
,
path
)
if
spec
is
None
:
raise
ImportError
(
_ERR_MSG
.
format
(
name
),
name
=
name
)
...
...
Lib/importlib/util.py
View file @
c4464052
...
...
@@ -56,7 +56,7 @@ def _find_spec_from_path(name, path=None):
try
:
spec
=
module
.
__spec__
except
AttributeError
:
raise
ValueError
(
'{}.__spec__ is not set'
.
format
(
name
))
raise
ValueError
(
'{}.__spec__ is not set'
.
format
(
name
))
from
None
else
:
if
spec
is
None
:
raise
ValueError
(
'{}.__spec__ is None'
.
format
(
name
))
...
...
@@ -96,7 +96,7 @@ def find_spec(name, package=None):
try
:
spec
=
module
.
__spec__
except
AttributeError
:
raise
ValueError
(
'{}.__spec__ is not set'
.
format
(
name
))
raise
ValueError
(
'{}.__spec__ is not set'
.
format
(
name
))
from
None
else
:
if
spec
is
None
:
raise
ValueError
(
'{}.__spec__ is None'
.
format
(
name
))
...
...
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