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
fa3ed96f
Commit
fa3ed96f
authored
Apr 16, 2015
by
Kevin Modzelewski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
exec of tuple
parent
919e8d25
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
22 additions
and
3 deletions
+22
-3
src/codegen/irgen/hooks.cpp
src/codegen/irgen/hooks.cpp
+13
-1
test/integration/virtualenv_test.py
test/integration/virtualenv_test.py
+3
-2
test/tests/exec_in_test.py
test/tests/exec_in_test.py
+6
-0
No files found.
src/codegen/irgen/hooks.cpp
View file @
fa3ed96f
...
...
@@ -401,6 +401,18 @@ Box* eval(Box* boxedCode) {
}
Box
*
exec
(
Box
*
boxedCode
,
Box
*
globals
,
Box
*
locals
)
{
if
(
isSubclass
(
boxedCode
->
cls
,
tuple_cls
))
{
RELEASE_ASSERT
(
!
globals
,
""
);
RELEASE_ASSERT
(
!
locals
,
""
);
BoxedTuple
*
t
=
static_cast
<
BoxedTuple
*>
(
boxedCode
);
RELEASE_ASSERT
(
t
->
size
()
>=
2
&&
t
->
size
()
<=
3
,
"%ld"
,
t
->
size
());
boxedCode
=
t
->
elts
[
0
];
globals
=
t
->
elts
[
1
];
if
(
t
->
size
()
>=
3
)
locals
=
t
->
elts
[
2
];
}
if
(
globals
==
None
)
globals
=
NULL
;
...
...
@@ -444,7 +456,7 @@ Box* exec(Box* boxedCode, Box* globals, Box* locals) {
}
// TODO same issues as in `eval`
RELEASE_ASSERT
(
boxedCode
->
cls
==
str_cls
,
"
"
);
RELEASE_ASSERT
(
boxedCode
->
cls
==
str_cls
,
"
%s"
,
boxedCode
->
cls
->
tp_name
);
const
char
*
code
=
static_cast
<
BoxedString
*>
(
boxedCode
)
->
s
.
data
();
AST_Module
*
parsedModule
=
parse_string
(
code
);
AST_Suite
*
parsedSuite
=
new
AST_Suite
(
std
::
move
(
parsedModule
->
interned_strings
));
...
...
test/integration/virtualenv_test.py
View file @
fa3ed96f
...
...
@@ -16,10 +16,11 @@ print "Running", args
subprocess
.
check_call
(
args
)
sh_script
=
"""
set -ex
set -e
. test_env/bin/activate
set -ux
python -c 'import __future__'
python -c 'import sys; print sys.executable'
. test_env/bin/activate
pip install bcrypt==1.1.0
python -c 'import bcrypt; assert bcrypt.__version__ == "1.1.0"; assert bcrypt.hashpw("password1", "$2a$12$0123456789012345678901").endswith("I1hdtg4K"); print "bcrypt seems to work"'
"""
.
strip
()
...
...
test/tests/exec_in_test.py
View file @
fa3ed96f
...
...
@@ -125,3 +125,9 @@ def show(obj, msg):
print
msg
return
obj
exec
show
(
"print 'in exec'"
,
"body"
)
in
show
(
None
,
"globals"
),
show
(
None
,
"locals"
)
g
=
{}
l
=
{}
exec
(
"a=1; print a"
,
g
,
l
)
print
g
.
keys
(),
l
.
keys
()
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