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
31e9f7cb
Commit
31e9f7cb
authored
Apr 19, 2014
by
Eric Snow
Browse files
Options
Browse Files
Download
Plain Diff
Merge from 3.4.
parents
386b2b18
658af313
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
22 additions
and
1 deletion
+22
-1
Lib/pkgutil.py
Lib/pkgutil.py
+2
-0
Lib/test/test_pkgutil.py
Lib/test/test_pkgutil.py
+18
-1
Misc/NEWS
Misc/NEWS
+2
-0
No files found.
Lib/pkgutil.py
View file @
31e9f7cb
...
@@ -461,6 +461,8 @@ def get_loader(module_or_name):
...
@@ -461,6 +461,8 @@ def get_loader(module_or_name):
loader
=
getattr
(
module
,
'__loader__'
,
None
)
loader
=
getattr
(
module
,
'__loader__'
,
None
)
if
loader
is
not
None
:
if
loader
is
not
None
:
return
loader
return
loader
if
getattr
(
module
,
'__spec__'
,
None
)
is
None
:
return
None
fullname
=
module
.
__name__
fullname
=
module
.
__name__
else
:
else
:
fullname
=
module_or_name
fullname
=
module_or_name
...
...
Lib/test/test_pkgutil.py
View file @
31e9f7cb
from
test.support
import
run_unittest
,
unload
,
check_warnings
from
test.support
import
run_unittest
,
unload
,
check_warnings
,
CleanImport
import
unittest
import
unittest
import
sys
import
sys
import
importlib
import
importlib
...
@@ -345,6 +345,23 @@ class ImportlibMigrationTests(unittest.TestCase):
...
@@ -345,6 +345,23 @@ class ImportlibMigrationTests(unittest.TestCase):
finally
:
finally
:
__loader__
=
this_loader
__loader__
=
this_loader
def
test_get_loader_handles_missing_spec_attribute
(
self
):
name
=
'spam'
mod
=
type
(
sys
)(
name
)
del
mod
.
__spec__
with
CleanImport
(
name
):
sys
.
modules
[
name
]
=
mod
loader
=
pkgutil
.
get_loader
(
name
)
self
.
assertIsNone
(
loader
)
def
test_get_loader_handles_spec_attribute_none
(
self
):
name
=
'spam'
mod
=
type
(
sys
)(
name
)
mod
.
__spec__
=
None
with
CleanImport
(
name
):
sys
.
modules
[
name
]
=
mod
loader
=
pkgutil
.
get_loader
(
name
)
self
.
assertIsNone
(
loader
)
def
test_find_loader_avoids_emulation
(
self
):
def
test_find_loader_avoids_emulation
(
self
):
with
check_warnings
()
as
w
:
with
check_warnings
()
as
w
:
...
...
Misc/NEWS
View file @
31e9f7cb
...
@@ -129,6 +129,8 @@ Library
...
@@ -129,6 +129,8 @@ Library
:func:`tempfile.NamedTemporaryFile`, close the file descriptor if
:func:`tempfile.NamedTemporaryFile`, close the file descriptor if
:func:`io.open` fails
:func:`io.open` fails
- Issue #21200: Return None from pkgutil.get_loader() when __spec__ is missing.
- Issue #21013: Enhance ssl.create_default_context() when used for server side
- Issue #21013: Enhance ssl.create_default_context() when used for server side
sockets to provide better security by default.
sockets to provide better security by default.
...
...
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