[Python-checkins] r83040 - peps/trunk/pep-3151.txt

antoine.pitrou python-checkins at python.org
Wed Jul 21 20:49:25 CEST 2010


Author: antoine.pitrou
Date: Wed Jul 21 20:49:25 2010
New Revision: 83040

Log:
Add items to survey.



Modified:
   peps/trunk/pep-3151.txt

Modified: peps/trunk/pep-3151.txt
==============================================================================
--- peps/trunk/pep-3151.txt	(original)
+++ peps/trunk/pep-3151.txt	Wed Jul 21 20:49:25 2010
@@ -49,6 +49,7 @@
             +-- socket.error
         +-- OSError
             +-- WindowsError
+        +-- mmap.error
     +-- select.error
 
 While some of these distinctions can be explained by implementation
@@ -199,6 +200,7 @@
 changes are listed hereafter:
 
 * alias both socket.error and select.error to IOError
+* alias mmap.error to OSError
 * alias IOError to OSError
 * alias WindowsError to OSError
 
@@ -517,6 +519,9 @@
 `FILE *` parameter (which, in the source tree, is always either stdout or
 stderr).
 
+Unicode encoding and decoding using the ``mbcs`` encoding can raise
+WindowsError for some error conditions.
+
 Standard library
 ----------------
 
@@ -616,16 +621,54 @@
       File "<stdin>", line 1, in <module>
     IOError: telling position disabled by next() call
 
-Raises BlockingIOError (inherited from IOError) when a call on a non-blocking
+Raises BlockingIOError (inheriting from IOError) when a call on a non-blocking
 object would block.
 
+mmap
+''''
+
+Undex Unix, raises its own ``mmap.error`` (inheriting from EnvironmentError)
+throughout::
+
+    >>> mmap.mmap(123, 10)
+    Traceback (most recent call last):
+      File "<stdin>", line 1, in <module>
+    mmap.error: [Errno 9] Bad file descriptor
+    >>> mmap.mmap(os.open("/tmp", os.O_RDONLY), 10)
+    Traceback (most recent call last):
+      File "<stdin>", line 1, in <module>
+    mmap.error: [Errno 13] Permission denied
+
+Under Windows, however, it mostly raises WindowsError (the source code
+also shows a few occurrences of ``mmap.error``)::
+
+    >>> fd = os.open("LICENSE", os.O_RDONLY)
+    >>> m = mmap.mmap(fd, 16384)
+    Traceback (most recent call last):
+      File "<stdin>", line 1, in <module>
+    WindowsError: [Error 5] Accès refusé
+    >>> sys.last_value.errno
+    13
+    >>> errno.errorcode[13]
+    'EACCES'
+
+    >>> m = mmap.mmap(-1, 4096)
+    >>> m.resize(16384)
+    Traceback (most recent call last):
+      File "<stdin>", line 1, in <module>
+    WindowsError: [Error 87] Paramètre incorrect
+    >>> sys.last_value.errno
+    22
+    >>> errno.errorcode[22]
+    'EINVAL'
+
 multiprocessing
 '''''''''''''''
 
 Not examined.
 
-os / posix module
-'''''''''''''''''
+os / posix
+''''''''''
 
 The ``os`` (or ``posix``) module raises OSError throughout, except under
 Windows where WindosError can be raised instead.
@@ -676,6 +719,12 @@
 
 socket.error inherits from IOError.
 
+sys
+'''
+
+``sys.getwindowsversion()`` raises WindowsError with a bogus error number
+if the ``GetVersionEx()`` call fails.
+
 time
 ''''
 


More information about the Python-checkins mailing list