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
d5a4dd72
Commit
d5a4dd72
authored
Sep 11, 2015
by
Kevin Modzelewski
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #912 from kmod/mmap
Enable the "mmap" module
parents
9df41bb5
05c7f27d
Changes
8
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
755 additions
and
4 deletions
+755
-4
from_cpython/CMakeLists.txt
from_cpython/CMakeLists.txt
+2
-0
from_cpython/Lib/test/test_mmap.py
from_cpython/Lib/test/test_mmap.py
+730
-0
from_cpython/Modules/itertoolsmodule.c
from_cpython/Modules/itertoolsmodule.c
+2
-1
from_cpython/setup.py
from_cpython/setup.py
+9
-1
src/runtime/str.cpp
src/runtime/str.cpp
+2
-2
test/cpython/test_mmap.py
test/cpython/test_mmap.py
+1
-0
test/tests/itertools_test.py
test/tests/itertools_test.py
+2
-0
test/tests/str_functions.py
test/tests/str_functions.py
+7
-0
No files found.
from_cpython/CMakeLists.txt
View file @
d5a4dd72
...
@@ -125,6 +125,7 @@ add_custom_command(OUTPUT
...
@@ -125,6 +125,7 @@ add_custom_command(OUTPUT
${
CMAKE_BINARY_DIR
}
/lib_pyston/grp.pyston.so
${
CMAKE_BINARY_DIR
}
/lib_pyston/grp.pyston.so
${
CMAKE_BINARY_DIR
}
/lib_pyston/termios.pyston.so
${
CMAKE_BINARY_DIR
}
/lib_pyston/termios.pyston.so
${
CMAKE_BINARY_DIR
}
/lib_pyston/_curses.pyston.so
${
CMAKE_BINARY_DIR
}
/lib_pyston/_curses.pyston.so
${
CMAKE_BINARY_DIR
}
/lib_pyston/mmap.pyston.so
COMMAND
${
CMAKE_BINARY_DIR
}
/pyston setup.py build --build-lib
${
CMAKE_BINARY_DIR
}
/lib_pyston
COMMAND
${
CMAKE_BINARY_DIR
}
/pyston setup.py build --build-lib
${
CMAKE_BINARY_DIR
}
/lib_pyston
DEPENDS
DEPENDS
pyston
pyston
...
@@ -150,5 +151,6 @@ add_custom_command(OUTPUT
...
@@ -150,5 +151,6 @@ add_custom_command(OUTPUT
Modules/grpmodule.c
Modules/grpmodule.c
Modules/termios.c
Modules/termios.c
Modules/_cursesmodule.c
Modules/_cursesmodule.c
Modules/mmapmodule.c
WORKING_DIRECTORY
${
CMAKE_CURRENT_SOURCE_DIR
}
)
WORKING_DIRECTORY
${
CMAKE_CURRENT_SOURCE_DIR
}
)
add_custom_target
(
sharedmods DEPENDS
${
CMAKE_BINARY_DIR
}
/lib_pyston/_multiprocessing.pyston.so
)
add_custom_target
(
sharedmods DEPENDS
${
CMAKE_BINARY_DIR
}
/lib_pyston/_multiprocessing.pyston.so
)
from_cpython/Lib/test/test_mmap.py
0 → 100644
View file @
d5a4dd72
This diff is collapsed.
Click to expand it.
from_cpython/Modules/itertoolsmodule.c
View file @
d5a4dd72
...
@@ -1956,7 +1956,8 @@ product_next(productobject *lz)
...
@@ -1956,7 +1956,8 @@ product_next(productobject *lz)
Py_DECREF
(
old_result
);
Py_DECREF
(
old_result
);
}
}
/* Now, we've got the only copy so we can update it in-place */
/* Now, we've got the only copy so we can update it in-place */
assert
(
npools
==
0
||
2
/*Pyston change, was: Py_REFCNT(result)*/
==
1
);
// Pyston change: safe to comment this out since we will always create a new tuple:
// assert (npools==0 || Py_REFCNT(result) == 1);
/* Update the pool indices right-to-left. Only advance to the
/* Update the pool indices right-to-left. Only advance to the
next pool when the previous one rolls-over */
next pool when the previous one rolls-over */
...
...
from_cpython/setup.py
View file @
d5a4dd72
...
@@ -88,6 +88,12 @@ def termios_ext():
...
@@ -88,6 +88,12 @@ def termios_ext():
"Modules/termios.c"
,
"Modules/termios.c"
,
]))
]))
@
unique
def
mmap_ext
():
return
Extension
(
"mmap"
,
sources
=
map
(
relpath
,
[
"Modules/mmapmodule.c"
,
]))
@
unique
@
unique
def
pyexpat_ext
():
def
pyexpat_ext
():
define_macros
=
[(
'HAVE_EXPAT_CONFIG_H'
,
'1'
),]
define_macros
=
[(
'HAVE_EXPAT_CONFIG_H'
,
'1'
),]
...
@@ -136,7 +142,9 @@ ext_modules = [future_builtins_ext(),
...
@@ -136,7 +142,9 @@ ext_modules = [future_builtins_ext(),
ctypes_test_ext
(),
ctypes_test_ext
(),
grp_ext
(),
grp_ext
(),
curses_ext
(),
curses_ext
(),
termios_ext
()]
termios_ext
(),
mmap_ext
(),
]
builtin_headers
=
map
(
relpath
,
glob
.
glob
(
"Include/*.h"
))
builtin_headers
=
map
(
relpath
,
glob
.
glob
(
"Include/*.h"
))
...
...
src/runtime/str.cpp
View file @
d5a4dd72
...
@@ -1652,9 +1652,9 @@ Box* _strSlice(BoxedString* self, i64 start, i64 stop, i64 step, i64 length) {
...
@@ -1652,9 +1652,9 @@ Box* _strSlice(BoxedString* self, i64 start, i64 stop, i64 step, i64 length) {
assert
(
step
!=
0
);
assert
(
step
!=
0
);
if
(
step
>
0
)
{
if
(
step
>
0
)
{
assert
(
0
<=
start
);
assert
(
0
<=
start
);
assert
(
stop
<=
s
.
size
());
assert
(
stop
<=
(
i64
)
s
.
size
());
}
else
{
}
else
{
assert
(
start
<
s
.
size
());
assert
(
start
<
(
i64
)
s
.
size
());
assert
(
-
1
<=
stop
);
assert
(
-
1
<=
stop
);
}
}
assert
(
length
>=
0
);
assert
(
length
>=
0
);
...
...
test/cpython/test_mmap.py
0 → 120000
View file @
d5a4dd72
..
/
..
/
from_cpython
/
Lib
/
test
/
test_mmap
.
py
\ No newline at end of file
test/tests/itertools_test.py
View file @
d5a4dd72
...
@@ -14,3 +14,5 @@ for i in xrange(10):
...
@@ -14,3 +14,5 @@ for i in xrange(10):
print
print
print
list
(
itertools
.
dropwhile
(
lambda
x
:
x
==
0
,
reversed
((
1
,
2
,
3
))))
print
list
(
itertools
.
dropwhile
(
lambda
x
:
x
==
0
,
reversed
((
1
,
2
,
3
))))
print
list
(
itertools
.
product
(
range
(
4
),
range
(
4
)))
test/tests/str_functions.py
View file @
d5a4dd72
...
@@ -181,3 +181,10 @@ def irgen_error():
...
@@ -181,3 +181,10 @@ def irgen_error():
fail
=
"test {0} {1} {2}"
.
format
(
1
,
2
,
3
)
fail
=
"test {0} {1} {2}"
.
format
(
1
,
2
,
3
)
print
fail
print
fail
irgen_error
()
irgen_error
()
s
=
"hello"
for
i
in
xrange
(
-
8
,
8
):
for
j
in
xrange
(
-
8
,
8
):
print
i
,
j
,
repr
(
s
[
i
:
j
])
for
k
in
(
-
2
,
1
,
1
,
2
):
print
i
,
j
,
k
,
repr
(
s
[
i
:
j
:
k
]),
repr
(
s
[
slice
(
i
,
j
,
k
)])
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