[issue12562] calling mmap twice fails on Windows

2011-08-01 Thread Piotr Zolnierczuk

Piotr Zolnierczuk piotr.zolnierc...@gmail.com added the comment:

OK. I will work around it.
 
I was using 'mapping object of a specified size that is backed by the system 
paging file instead of by a file in the file system' - map-handle == 
INVALID_HANDLE_VALUE (-1), i.e. shared memory for inter-process communication 
(not my choice)

A use case was when all process were stopped and one wanted to start fresh 
using the same tag but with a bigger size. 

BTW, here's the result of the following script in Python 2.5
 import mmap
 map1 = mmap.mmap(fileno=-1, tagname='MyData', length=4096)
 map1[0] = 'a'
 map1[4095]='b'
 print len(map1), map1[0], map1[4095]
4096 a b
 map2 = mmap.mmap(fileno=-1, tagname='MyData', length=8192)
 print len(map2), map2[0], map2[4095]
8192 a b

which would indicate that it does 'resize' and preserves the data.



which means t

--
status: pending - open

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue12562
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue12562] calling mmap twice fails on Windows

2011-08-01 Thread Piotr Zolnierczuk

Piotr Zolnierczuk piotr.zolnierc...@gmail.com added the comment:

Just looked into my partner C++ code and he's using it very much like in 
Python 2.5:

m_obj-map_handle = CreateFileMapping (INVALID_HANDLE_VALUE,
NULL,   PAGE_READWRITE, 
 0,
pageSize,   
 tagName);

m_obj-data = (char *) MapViewOfFile (m_obj-map_handle,
  FILE_MAP_ALL_ACCESS,  
  0,
  0,
  0);

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue12562
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue2733] mmap resize fails on anonymous memory

2011-07-27 Thread Piotr Zolnierczuk

Piotr Zolnierczuk piotr.zolnierc...@gmail.com added the comment:

I wonder if this is related to the problem I reported about two weeks ago
http://bugs.python.org/issue12562?

--
nosy: +zolnie

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue2733
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue12562] calling mmap twice fails on Windows

2011-07-14 Thread Piotr Zolnierczuk

New submission from Piotr Zolnierczuk piotr.zolnierc...@gmail.com:

Hi,
I am trying to migrate from Python 2.5 to Python 2.7 I found though the mmap 
behaves differently on Windows XP between the two versions. It boils down to 
the following code:
import mmap
map1 = mmap.mmap(fileno=0, tagname='MyData', length=4096)
map2 = mmap.mmap(fileno=0, tagname='MyData', length=8192)

It runs fine (so I can resize shared memory) on XP with 2.5.4, but when 
running on 2.7.2 I get the following error

Traceback (most recent call last):
  File D:\Workspace\memmap_test.py, line 3, in module
map2 = mmap.mmap(fileno=0, tagname='MyData', length=8192)
WindowsError: [Error 5] Access is denied

--
messages: 140349
nosy: zolnie
priority: normal
severity: normal
status: open
title: calling mmap twice fails on Windows
versions: Python 2.7

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue12562
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue12562] calling mmap twice fails on Windows

2011-07-14 Thread Piotr Zolnierczuk

Changes by Piotr Zolnierczuk piotr.zolnierc...@gmail.com:


--
components: +Windows
type:  - behavior

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue12562
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com