Conversation
added windows support
vandry
left a comment
There was a problem hiding this comment.
It looks like the mmap documentation says you can use the form with access= as a keyword argument for all operating systems. I tested; it works. So you don't need an if statement at all. See https://docs.python.org/2/library/mmap.html
| self.raw = mmap.mmap(fd, fullsize, mmap.MAP_SHARED, mmap.PROT_READ) | ||
|
|
||
| if (os.name == "posix"): | ||
| #Linux-Version: |
There was a problem hiding this comment.
There is nothing Linux specific about this. It'll work on, say, Solaris or BSD as well.
Actually, you want probably just do without this comment altogether. It's clear what the "if" is doing.
There was a problem hiding this comment.
That's right. You can throw the comments away
| self.headerlen = headerlen | ||
| self.raw = mmap.mmap(fd, fullsize, mmap.MAP_SHARED, mmap.PROT_READ) | ||
|
|
||
| if (os.name == "posix"): |
There was a problem hiding this comment.
Style nit: don't use parentheses here.
| self.raw = mmap.mmap(fd, fullsize, mmap.MAP_SHARED, mmap.PROT_READ) | ||
| else: | ||
| #Windows-Version: | ||
| self.raw = mmap.mmap(fd, fullsize, access=mmap.ACCESS_READ)#mmap.MAP_SHARED, mmap.PROT_READ |
There was a problem hiding this comment.
Please get rid of the commented text at the end of the line.
|
I've just tested it under windows. The parameter access=ACCESS_READ is important to not throw an error. If you sucessfully tested it under posix- system, then it's fine. Then it will be just one line intead of three. |
added windows support