This is the title of the just finished thesis by Antonio Cuni. He is one of the PyPy developers and the author of the exciting .NET backend named GenCLI.
The thesis is for people (hopefully the entire Python community ) who want to understand better the PyPy as a whole and its backend.
You can find [...]
mmap porting is finished.
Here’s the latest changelog:
correctly raise error if used in concatenation and repeatition
responds to getitem, setitem
correctly raise error if called delitem
support slicing objects
add a big test ported from test_mmap.py
The only remaining issue is the lack of support of the Buffer object protocol because is not directly exposed in Python. You can’t pass a [...]
… I’m quite puzzled about a couple of things.
First, I don’t understand when PySequence_GetItem it’s been called. I explain myself:
in mmapmodule.c you can find the following function to implement getitem behavior:
[code lang="c"]
static PyObject *
mmap_item(mmap_object *self, Py_ssize_t i)
{
CHECK_VALID(NULL);
if (i < 0 || (size_t)i >= self->size) {
[...]
Changelog:
mmap.size() is done
mmap.tell() too
mmap.flush() is done
I had some problems with memmove() syscall from ctypes so I implemented
mmap.move() with memcpy()
mmap.resize() works where supported (not supported on OSX and FreeBSD)
I discovered an ugly alignment problem caling msync() syscall but it has been fixed. The problem was in Linux only…
mmap methods are completed, now I have to make [...]
Parallels is damn cool and with 2.0Gb of RAM is even cooler. Why it takes 20 minutes to be up and running for the SoC with Ubuntu Dapper and after two hours of installation/configuration/reboot I’ve not completed the setup of the XP box yet?
I’m installing some SDK now…
posted with TextMate
Today changelog:
mmap.find() is here
mmap.seek() is here
mmap.write() is here
many fixes to make it work under windows as well
big refactoring of tests
mmap.write_byte() is here
I do want mutable strings in Python!:-)
Here’s the today changelog:
mmap frees resources correctly
close() is done and working
read_byte() is done and working
readline() is done and working
find() needs more work.
The bus error is gone but I’m not really comfortable with the reason why I don’t have that error anymore. Let’s explain a bit:
mmap() is a 6 argument function, all of them required.
Thomas Heller discovered under FreeBSD 6.0 with ktrace that it’s called with 8 parameters, not 6. The two argument in addition are all [...]
I don’t really know why the following example works well under Linux but crashes badly and with no mercy under MacOSX and FreeBSD:
[code lang="python"]
from ctypes import *
import ctypes.util
_libc = cdll.LoadLibrary(ctypes.util.find_library("c"))
f = open("foo", "w+")
f.write("foo\0")
f.flush()
_libc.mmap.restype = c_void_p
m = _libc.mmap(0, 4, 3, 1, f.fileno(), 0)
print m
if m != c_void_p(-1).value:
c = cast(m, POINTER(c_char))
print [c[i] for i in range(4)]
f.close()
[/code]
Anytime I [...]
I’m dealing with a nasty platform problem now. The following sample of code works well under linux and its POSIX implementation of mmap but under BSD/MacOSX it throws an ugly Bus Error:
[code lang="python"]
import cmmap
f = open("foo", "w+")
f.write("c")
f.flush()
m = cmmap.mmap(f.fileno(), 1)
f.close()
[/code]
gdb says:
Program received signal EXC_BAD_ACCESS, Could not access memory.
Reason: 10 at address: 0×00045000
Bus error
And this is [...]