[ python-Bugs-964876 ] mapping a 0 length file

SourceForge.net noreply at sourceforge.net
Sat Jun 5 14:01:40 EDT 2004


Bugs item #964876, was opened at 2004-06-02 10:28
Message generated for change (Comment added) made by pmoore
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=964876&group_id=5470

Category: Python Library
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Manlio Perillo (manlioperillo)
Assigned to: Nobody/Anonymous (nobody)
Summary: mapping a 0 length file

Initial Comment:
>>> sys.version
'2.3.3 (#51, Dec 18 2003, 20:22:39) [MSC v.1200 32 bit
(Intel)]'
>>> sys.platform
'win32'
>>> sys.getwindowsversion()
(5, 1, 2600, 2, '')

Hi.
If I mmap a 0 length file on winnt, I obtain an exception:

>>> import mmap, os

>>> file = os.open(file_name, os.O_RDWR | os.O_BINARY)
>>> buf = mmap.mmap(file, 0, access = map.ACCESS_WRITE)

Traceback (most recent call last):
  File "<pyshell#15>", line 1, in -toplevel-
    buf = mmap.mmap(file, 0, access = mmap.ACCESS_WRITE)
WindowsError: [Errno 1006] Il volume corrispondente al
file è stato alterato dall'esterno. Il file aperto non
è più valido


This is a windows problem, but I think it should be at
least documented.



Thanks and regards   Manlio Perillo

----------------------------------------------------------------------

Comment By: Paul Moore (pmoore)
Date: 2004-06-05 19:01

Message:
Logged In: YES 
user_id=113328

Suggested documentation patch:

Index: lib/libmmap.tex
===================================================================
RCS file: /cvsroot/python/python/dist/src/Doc/lib/libmmap.tex,v
retrieving revision 1.8
diff -u -r1.8 libmmap.tex
--- lib/libmmap.tex	3 Dec 2001 18:27:22 -0000	1.8
+++ lib/libmmap.tex	5 Jun 2004 18:00:08 -0000
@@ -44,7 +44,9 @@
   specified by the file handle \var{fileno}, and returns a mmap
   object.  If \var{length} is \code{0}, the maximum length
of the map
   will be the current size of the file when
\function{mmap()} is
-  called.
+  called.  If \var{length} is \code{0} and the file is 0
bytes long,
+  Windows will return an error.  It is not possible to map
a 0-byte
+  file under Windows.
   
   \var{tagname}, if specified and not \code{None}, is a
string giving
   a tag name for the mapping.  Windows allows you to have many


----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=964876&group_id=5470



More information about the Python-bugs-list mailing list