Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
P
Pyston
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
Boxiang Sun
Pyston
Commits
f5d262cc
Commit
f5d262cc
authored
Feb 17, 2015
by
Kevin Modzelewski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make find_module support packages
parent
14dd8e7d
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
9 additions
and
2 deletions
+9
-2
from_cpython/Include/pyconfig.h
from_cpython/Include/pyconfig.h
+1
-0
src/runtime/import.cpp
src/runtime/import.cpp
+7
-2
test/tests/imp_test.py
test/tests/imp_test.py
+1
-0
No files found.
from_cpython/Include/pyconfig.h
View file @
f5d262cc
...
...
@@ -48,6 +48,7 @@
#define HAVE_POLL 1
#define HAVE_SELECT 1
#define HAVE_ALARM 1
#define HAVE_SYMLINK 1
#define PY_FORMAT_LONG_LONG "ll"
#define PY_FORMAT_SIZE_T "z"
...
...
src/runtime/import.cpp
View file @
f5d262cc
...
...
@@ -269,8 +269,13 @@ Box* impFindModule(Box* _name) {
Box
*
path
=
boxString
(
sr
.
path
);
Box
*
mode
=
boxStrConstant
(
"r"
);
Box
*
f
=
runtimeCall
(
file_cls
,
ArgPassSpec
(
2
),
path
,
mode
,
NULL
,
NULL
,
NULL
);
return
new
BoxedTuple
(
{
f
,
path
,
new
BoxedTuple
({
boxStrConstant
(
".py"
),
mode
,
boxInt
(
SearchResult
::
PY_SOURCE
)
})
});
return
new
BoxedTuple
({
f
,
path
,
new
BoxedTuple
({
boxStrConstant
(
".py"
),
mode
,
boxInt
(
sr
.
type
)
})
});
}
if
(
sr
.
type
==
SearchResult
::
PKG_DIRECTORY
)
{
Box
*
path
=
boxString
(
sr
.
path
);
Box
*
mode
=
boxStrConstant
(
""
);
return
new
BoxedTuple
({
None
,
path
,
new
BoxedTuple
({
mode
,
mode
,
boxInt
(
sr
.
type
)
})
});
}
Py_FatalError
(
"unimplemented"
);
...
...
test/tests/imp_test.py
View file @
f5d262cc
import
imp
print
len
(
imp
.
find_module
(
"os"
))
print
imp
.
find_module
(
"encodings"
)[
0
]
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