Commit d5a4dd72 authored by Kevin Modzelewski's avatar Kevin Modzelewski

Merge pull request #912 from kmod/mmap

Enable the "mmap" module
parents 9df41bb5 05c7f27d
......@@ -125,6 +125,7 @@ add_custom_command(OUTPUT
${CMAKE_BINARY_DIR}/lib_pyston/grp.pyston.so
${CMAKE_BINARY_DIR}/lib_pyston/termios.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
DEPENDS
pyston
......@@ -150,5 +151,6 @@ add_custom_command(OUTPUT
Modules/grpmodule.c
Modules/termios.c
Modules/_cursesmodule.c
Modules/mmapmodule.c
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
add_custom_target(sharedmods DEPENDS ${CMAKE_BINARY_DIR}/lib_pyston/_multiprocessing.pyston.so)
This diff is collapsed.
......@@ -1956,7 +1956,8 @@ product_next(productobject *lz)
Py_DECREF(old_result);
}
/* 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
next pool when the previous one rolls-over */
......
......@@ -88,6 +88,12 @@ def termios_ext():
"Modules/termios.c",
]))
@unique
def mmap_ext():
return Extension("mmap", sources = map(relpath, [
"Modules/mmapmodule.c",
]))
@unique
def pyexpat_ext():
define_macros = [('HAVE_EXPAT_CONFIG_H', '1'),]
......@@ -136,7 +142,9 @@ ext_modules = [future_builtins_ext(),
ctypes_test_ext(),
grp_ext(),
curses_ext(),
termios_ext()]
termios_ext(),
mmap_ext(),
]
builtin_headers = map(relpath, glob.glob("Include/*.h"))
......
......@@ -1652,9 +1652,9 @@ Box* _strSlice(BoxedString* self, i64 start, i64 stop, i64 step, i64 length) {
assert(step != 0);
if (step > 0) {
assert(0 <= start);
assert(stop <= s.size());
assert(stop <= (i64)s.size());
} else {
assert(start < s.size());
assert(start < (i64)s.size());
assert(-1 <= stop);
}
assert(length >= 0);
......
../../from_cpython/Lib/test/test_mmap.py
\ No newline at end of file
......@@ -14,3 +14,5 @@ for i in xrange(10):
print
print list(itertools.dropwhile(lambda x: x == 0, reversed((1, 2, 3))))
print list(itertools.product(range(4), range(4)))
......@@ -181,3 +181,10 @@ def irgen_error():
fail = "test {0} {1} {2}".format(1, 2, 3)
print fail
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)])
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment