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
1a949369
Commit
1a949369
authored
Feb 28, 2016
by
Kevin Modzelewski
Browse files
Options
Browse Files
Download
Plain Diff
Merge commit 'c1f25c' into refcounting
parents
3294712f
c1f25c37
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
64 additions
and
1 deletion
+64
-1
.gitmodules
.gitmodules
+1
-1
src/runtime/builtin_modules/builtins.cpp
src/runtime/builtin_modules/builtins.cpp
+8
-0
test/extra/simplejson_test.py
test/extra/simplejson_test.py
+26
-0
test/tests/reload_test.py
test/tests/reload_test.py
+29
-0
No files found.
.gitmodules
View file @
1a949369
...
...
@@ -20,7 +20,7 @@
ignore = untracked
[submodule "build_deps/libunwind"]
path = build_deps/libunwind
url =
git://git.sv.gnu.org
/libunwind.git
url =
https://github.com/pathscale
/libunwind.git
ignore = all
[submodule "build_deps/libpypa"]
path = build_deps/libpypa
...
...
src/runtime/builtin_modules/builtins.cpp
View file @
1a949369
...
...
@@ -1353,6 +1353,13 @@ static PyObject* builtin_print(PyObject* self, PyObject* args, PyObject* kwds) n
Py_RETURN_NONE
;
}
static
PyObject
*
builtin_reload
(
PyObject
*
self
,
PyObject
*
v
)
noexcept
{
if
(
PyErr_WarnPy3k
(
"In 3.x, reload() is renamed to imp.reload()"
,
1
)
<
0
)
return
NULL
;
return
PyImport_ReloadModule
(
v
);
}
Box
*
getreversed
(
Box
*
o
)
{
static
BoxedString
*
reversed_str
=
getStaticString
(
"__reversed__"
);
...
...
@@ -2162,6 +2169,7 @@ void setupBuiltins() {
static
PyMethodDef
builtin_methods
[]
=
{
{
"print"
,
(
PyCFunction
)
builtin_print
,
METH_VARARGS
|
METH_KEYWORDS
,
print_doc
},
{
"reload"
,
builtin_reload
,
METH_O
,
reload_doc
},
};
for
(
auto
&
md
:
builtin_methods
)
{
builtins_module
->
giveAttr
(
md
.
ml_name
,
...
...
test/extra/simplejson_test.py
0 → 100644
View file @
1a949369
import
os
,
sys
,
subprocess
,
shutil
sys
.
path
.
append
(
os
.
path
.
dirname
(
__file__
)
+
"/../lib"
)
from
test_helper
import
create_virtenv
,
run_test
ENV_NAME
=
"simplejson_test_env_"
+
os
.
path
.
basename
(
sys
.
executable
)
SRC_DIR
=
os
.
path
.
abspath
(
os
.
path
.
join
(
ENV_NAME
,
"src"
))
PYTHON_EXE
=
os
.
path
.
abspath
(
os
.
path
.
join
(
ENV_NAME
,
"bin"
,
"python"
))
def
install_and_test_simplejson
():
shutil
.
rmtree
(
SRC_DIR
,
ignore_errors
=
True
)
os
.
makedirs
(
SRC_DIR
)
url
=
"https://pypi.python.org/packages/source/s/simplejson/simplejson-2.6.2.tar.gz"
subprocess
.
check_call
([
"wget"
,
url
],
cwd
=
SRC_DIR
)
subprocess
.
check_call
([
"tar"
,
"-zxf"
,
"simplejson-2.6.2.tar.gz"
],
cwd
=
SRC_DIR
)
SIMPLEJSON_DIR
=
os
.
path
.
abspath
(
os
.
path
.
join
(
SRC_DIR
,
"simplejson-2.6.2"
))
subprocess
.
check_call
([
PYTHON_EXE
,
"setup.py"
,
"build"
],
cwd
=
SIMPLEJSON_DIR
)
subprocess
.
check_call
([
PYTHON_EXE
,
"setup.py"
,
"install"
],
cwd
=
SIMPLEJSON_DIR
)
expected
=
[{
'ran'
:
170
}]
run_test
([
PYTHON_EXE
,
"setup.py"
,
"test"
],
cwd
=
SIMPLEJSON_DIR
,
expected
=
expected
)
create_virtenv
(
ENV_NAME
,
None
,
force_create
=
True
)
install_and_test_simplejson
()
test/tests/reload_test.py
0 → 100644
View file @
1a949369
import
os
,
sys
def
delete_file
(
name
):
try
:
import
os
os
.
remove
(
name
)
except
:
pass
def
generate_file
(
ret
):
with
open
(
"reload_test_target.py"
,
"w"
)
as
f
:
f
.
write
(
"# skip-if: True
\
n
"
)
f
.
write
(
"# warning this file is generated by %s
\
n
"
%
(
__file__
))
f
.
write
(
"def foo(): return %s
\
n
"
%
(
ret
))
# delete the pyc because cpython uses a timestamp for detecting if the pyc needs an update and we modify the file too fast
delete_file
(
"reload_test_target.pyc"
)
os
.
chdir
(
os
.
path
.
dirname
(
os
.
path
.
realpath
(
__file__
)))
generate_file
(
1
)
import
reload_test_target
print
reload_test_target
.
foo
()
generate_file
(
42
)
reload
(
reload_test_target
)
print
reload_test_target
.
foo
()
delete_file
(
"reload_test_target.py"
)
delete_file
(
"reload_test_target.pyc"
)
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