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
c02424de
Commit
c02424de
authored
May 18, 2015
by
Kevin Modzelewski
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #537 from kmod/exec_in_other_module
Fix `exec s in other_module`
parents
7009ec5d
e9843cfa
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
39 additions
and
11 deletions
+39
-11
src/codegen/ast_interpreter.cpp
src/codegen/ast_interpreter.cpp
+3
-3
src/codegen/irgen/irgenerator.cpp
src/codegen/irgen/irgenerator.cpp
+2
-1
src/jit.cpp
src/jit.cpp
+16
-6
test/integration/virtualenv_test.py
test/integration/virtualenv_test.py
+1
-1
test/tests/exec_in_test.py
test/tests/exec_in_test.py
+17
-0
No files found.
src/codegen/ast_interpreter.cpp
View file @
c02424de
...
...
@@ -441,9 +441,9 @@ Value ASTInterpreter::visit_jump(AST_Jump* node) {
if
(
backedge
)
threading
::
allowGLReadPreemption
();
if
(
ENABLE_OSR
&&
backedge
&&
(
globals
->
cls
==
module_cls
)
)
{
bool
can_osr
=
!
FORCE_INTERPRETER
&&
(
globals
->
cls
==
module_cls
);
if
(
can_osr
&&
edgecount
++
==
OSR_THRESHOLD_INTERPRETER
)
{
if
(
ENABLE_OSR
&&
backedge
&&
edgecount
++
==
OSR_THRESHOLD_INTERPRETER
)
{
bool
can_osr
=
!
FORCE_INTERPRETER
&&
source_info
->
scoping
->
areGlobalsFromModule
(
);
if
(
can_osr
)
{
static
StatCounter
ast_osrs
(
"num_ast_osrs"
);
ast_osrs
.
log
();
...
...
src/codegen/irgen/irgenerator.cpp
View file @
c02424de
...
...
@@ -310,7 +310,8 @@ public:
explicit
IREmitterImpl
(
IRGenState
*
irstate
,
llvm
::
BasicBlock
*&
curblock
,
IRGenerator
*
irgenerator
)
:
irstate
(
irstate
),
builder
(
new
IRBuilder
(
g
.
context
)),
curblock
(
curblock
),
irgenerator
(
irgenerator
)
{
ASSERT
(
irstate
->
getSourceInfo
()
->
scoping
->
areGlobalsFromModule
(),
"jit doesn't support custom globals yet"
);
RELEASE_ASSERT
(
irstate
->
getSourceInfo
()
->
scoping
->
areGlobalsFromModule
(),
"jit doesn't support custom globals yet"
);
builder
->
setEmitter
(
this
);
builder
->
SetInsertPoint
(
curblock
);
...
...
src/jit.cpp
View file @
c02424de
...
...
@@ -60,12 +60,7 @@ static bool unbuffered = false;
static
const
char
*
argv0
;
static
int
pipefds
[
2
];
static
void
handle_sigsegv
(
int
signum
)
{
assert
(
signum
==
SIGSEGV
);
// TODO: this should set a flag saying a KeyboardInterrupt is pending.
// For now, just call abort(), so that we get a traceback at least.
fprintf
(
stderr
,
"child encountered segfault! signalling parent watcher to backtrace.
\n
"
);
static
void
signal_parent_watcher
()
{
char
buf
[
1
];
int
r
=
write
(
pipefds
[
1
],
buf
,
1
);
RELEASE_ASSERT
(
r
==
1
,
""
);
...
...
@@ -75,6 +70,20 @@ static void handle_sigsegv(int signum) {
}
}
static
void
handle_sigsegv
(
int
signum
)
{
assert
(
signum
==
SIGSEGV
);
fprintf
(
stderr
,
"child encountered segfault! signalling parent watcher to backtrace.
\n
"
);
signal_parent_watcher
();
}
static
void
handle_sigabrt
(
int
signum
)
{
assert
(
signum
==
SIGABRT
);
fprintf
(
stderr
,
"child aborted! signalling parent watcher to backtrace.
\n
"
);
signal_parent_watcher
();
}
static
int
gdb_child_pid
;
static
void
propagate_sig
(
int
signum
)
{
// fprintf(stderr, "parent received signal %d, passing to child and then ignoring\n", signum);
...
...
@@ -136,6 +145,7 @@ static void enableGdbSegfaultWatcher() {
close
(
pipefds
[
0
]);
signal
(
SIGSEGV
,
&
handle_sigsegv
);
signal
(
SIGABRT
,
&
handle_sigabrt
);
}
int
handleArg
(
char
code
)
{
...
...
test/integration/virtualenv_test.py
View file @
c02424de
...
...
@@ -29,7 +29,7 @@ python -c 'from PIL import Image; print "Pillow imports"'
"""
.
strip
()
# print sh_script
subprocess
.
check_call
([
"sh"
,
"-c"
,
sh_script
])
subprocess
.
check_call
([
"sh"
,
"-c"
,
sh_script
]
,
stdout
=
sys
.
stderr
)
print
print
"PASSED"
test/tests/exec_in_test.py
View file @
c02424de
...
...
@@ -161,3 +161,20 @@ s = "from sys import *"
g
=
dict
()
exec
s
in
g
print
"version"
in
g
# Test to make sure that 'exec s in other_module' is handled correctly:
import
import_target
assert
import_target
.
z
==
2
z
=
3
exec
"print z"
in
import_target
.
__dict__
,
{}
exec
"print z"
in
globals
(),
{}
# Try it with osr as well:
s
=
"""
print z
for i in xrange(20000):
pass
print z
"""
exec
s
in
import_target
.
__dict__
,
{}
exec
s
in
globals
(),
{}
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