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
f2d0e053
Commit
f2d0e053
authored
Aug 10, 2013
by
Ezio Melotti
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
#18681: Fix a NameError in imp.reload() (noticed by Weizhao Li).
parent
d7d1b9cd
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
12 additions
and
1 deletion
+12
-1
Lib/imp.py
Lib/imp.py
+1
-1
Lib/test/test_imp.py
Lib/test/test_imp.py
+9
-0
Misc/NEWS
Misc/NEWS
+2
-0
No files found.
Lib/imp.py
View file @
f2d0e053
...
...
@@ -267,7 +267,7 @@ def reload(module):
parent_name
=
name
.
rpartition
(
'.'
)[
0
]
if
parent_name
and
parent_name
not
in
sys
.
modules
:
msg
=
"parent {!r} not in sys.modules"
raise
ImportError
(
msg
.
format
(
parentname
),
name
=
parent_name
)
raise
ImportError
(
msg
.
format
(
parent
_
name
),
name
=
parent_name
)
return
module
.
__loader__
.
load_module
(
name
)
finally
:
try
:
...
...
Lib/test/test_imp.py
View file @
f2d0e053
...
...
@@ -275,6 +275,15 @@ class ReloadTests(unittest.TestCase):
import
marshal
imp
.
reload
(
marshal
)
def
test_with_deleted_parent
(
self
):
# see #18681
from
html
import
parser
del
sys
.
modules
[
'html'
]
def
cleanup
():
del
sys
.
modules
[
'html.parser'
]
self
.
addCleanup
(
cleanup
)
with
self
.
assertRaisesRegex
(
ImportError
,
'html'
):
imp
.
reload
(
parser
)
class
PEP3147Tests
(
unittest
.
TestCase
):
"""Tests of PEP 3147."""
...
...
Misc/NEWS
View file @
f2d0e053
...
...
@@ -64,6 +64,8 @@ Core and Builtins
Library
-------
- Issue #18681: Fix a NameError in imp.reload() (noticed by Weizhao Li).
- Issue #8112: xlmrpc.server'
s
DocXMLRPCServer
server
no
longer
raises
an
error
if
methods
have
annotations
;
it
now
correctly
displays
the
annotations
.
...
...
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