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
8d886046
Commit
8d886046
authored
May 18, 2012
by
Petri Lehtinen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
#14798: pyclbr now raises ImportError instead of KeyError for missing packages
parent
1033b310
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
12 additions
and
0 deletions
+12
-0
Lib/pyclbr.py
Lib/pyclbr.py
+2
-0
Lib/test/test_pyclbr.py
Lib/test/test_pyclbr.py
+5
-0
Misc/ACKS
Misc/ACKS
+1
-0
Misc/NEWS
Misc/NEWS
+4
-0
No files found.
Lib/pyclbr.py
View file @
8d886046
...
...
@@ -128,6 +128,8 @@ def _readmodule(module, path, inpackage=None):
parent
=
_readmodule
(
package
,
path
,
inpackage
)
if
inpackage
is
not
None
:
package
=
"%s.%s"
%
(
inpackage
,
package
)
if
not
'__path__'
in
parent
:
raise
ImportError
(
'No package named {}'
.
format
(
package
))
return
_readmodule
(
submodule
,
parent
[
'__path__'
],
package
)
# Search the path for the module
...
...
Lib/test/test_pyclbr.py
View file @
8d886046
...
...
@@ -167,6 +167,11 @@ class PyclbrTest(TestCase):
cm
(
'email.parser'
)
cm
(
'test.test_pyclbr'
)
def
test_issue_14798
(
self
):
# test ImportError is raised when the first part of a dotted name is
# not a package
self
.
assertRaises
(
ImportError
,
pyclbr
.
readmodule_ex
,
'asyncore.foo'
)
def
test_main
():
run_unittest
(
PyclbrTest
)
...
...
Misc/ACKS
View file @
8d886046
...
...
@@ -332,6 +332,7 @@ Lars Marius Garshol
Dan Gass
Andrew Gaul
Stephen M. Gava
Xavier de Gaye
Harry Henry Gebel
Marius Gedminas
Thomas Gellekum
...
...
Misc/NEWS
View file @
8d886046
...
...
@@ -63,6 +63,10 @@ Core and Builtins
Library
-------
- Issue #14798: Fix the functions in pyclbr to raise an ImportError
when the first part of a dotted name is not a package. Patch by
Xavier de Gaye.
- Issue #14829: Fix bisect and range() indexing with large indices
(>= 2 ** 32) under 64-bit Windows.
...
...
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