Commit Graph

123 Commits

Author SHA1 Message Date
Ross Lagerwall ffa8e2fb56 Issue 12404: Remove C89 incompatible code from mmap module.
Patch by Akira Kitada.
2011-06-25 09:55:10 +02:00
Victor Stinner 112d48ac17 (Merge 3.1) Issue #11277: mmap.mmap() calls fcntl(fd, F_FULLFSYNC) on Mac OS X
to get around a mmap bug with sparse files. Patch written by Steffen Daode
Nurpmeso.
2011-05-03 14:36:36 +02:00
Antoine Pitrou d6f3a3e3a8 Issue #11391: Writing to a mmap object created with
`mmap.PROT_READ|mmap.PROT_EXEC` would segfault instead of raising a
TypeError.  Patch by Charles-François Natali.
2011-03-06 02:03:34 +01:00
Antoine Pitrou f4d2b3dc10 Merged revisions 88486 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k

........
  r88486 | antoine.pitrou | 2011-02-22 00:41:12 +0100 (mar., 22 févr. 2011) | 5 lines

  Issue #4681: Allow mmap() to work on file sizes and offsets larger than
  4GB, even on 32-bit builds.  Initial patch by Ross Lagerwall, adapted for
  32-bit Windows.
........
2011-02-21 23:59:20 +00:00
Antoine Pitrou 8a0eede21d Merged revisions 88131 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k

........
  r88131 | antoine.pitrou | 2011-01-20 22:07:24 +0100 (jeu., 20 janv. 2011) | 6 lines

  Issue #10955: Fix a potential crash when trying to mmap() a file past its
  length.  Initial patch by Ross Lagerwall.

  This fixes a regression introduced by r88022.
........
2011-01-20 21:20:18 +00:00
Antoine Pitrou 533aa25b48 Merged revisions 88036 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k

........
  r88036 | antoine.pitrou | 2011-01-15 18:25:58 +0100 (sam., 15 janv. 2011) | 3 lines

  Fix mmap and test_mmap under Windows too (followup to r88022)
........
2011-01-15 17:40:00 +00:00
Antoine Pitrou 9989d857eb Merged revisions 88022 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k

........
  r88022 | antoine.pitrou | 2011-01-15 17:17:07 +0100 (sam., 15 janv. 2011) | 7 lines

  Issue #10916: mmap should not segfault when a file is mapped using 0 as
  length and a non-zero offset, and an attempt to read past the end of file
  is made (IndexError is raised instead).  Patch by Ross Lagerwall.

  Requested by Georg.
........
2011-01-15 16:18:57 +00:00
R. David Murray 2a4b3fce9d Merged revisions 85678 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k

........
  r85678 | r.david.murray | 2010-10-17 21:14:06 -0400 (Sun, 17 Oct 2010) | 5 lines

  #678250: Make mmap flush a noop on ACCESS_READ and ACCESS_COPY.

  Patch by Sébastien Sablé.  This solves a test_mmap failure on AIX.
........
2010-12-11 02:13:04 +00:00
Brian Curtin ba6c08e670 Merged revisions 83407 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k

........
  r83407 | brian.curtin | 2010-08-01 10:26:26 -0500 (Sun, 01 Aug 2010) | 3 lines

  Fix #8105. Add validation to mmap.mmap so invalid file descriptors
  don't cause a crash on Windows.
........
2010-08-01 15:47:53 +00:00
Antoine Pitrou c83ea137d7 Untabify C files. Will watch buildbots. 2010-05-09 14:46:46 +00:00
Hirokazu Yamamoto 8839fd7372 Issue #6344: Fixed a crash of mmap.read() when passed a negative argument.
Reviewed by Amaury Forgeot d'Arc.
2009-06-29 13:25:16 +00:00
Hirokazu Yamamoto 983a46543c Issue #6271: mmap tried to close invalid file handle (-1) when annonymous.
(On Unix) Patch by STINNER Victor.
2009-06-14 03:53:55 +00:00
Jack Diederich 2ecd3c36b5 bounds check arguments to mmap.move(). All of them. Really.
fixes crasher on OS X 10.5
2009-04-01 20:26:13 +00:00
Hirokazu Yamamoto 1d7d5325be Issue #5387: Fixed mmap.move crash by integer overflow. (take2) 2009-03-31 20:14:04 +00:00
Jesse Noller 40a6164afa Apply patch for netbsd multiprocessing support 2009-03-31 18:12:35 +00:00
Hirokazu Yamamoto 9d2ee5ded2 Issue #5387: Fixed mmap.move crash by integer overflow. 2009-03-31 13:13:05 +00:00
Hirokazu Yamamoto 264fc12fbf Issue #5385: Fixed mmap crash after resize failure on windows.
Now uses NULL instead of INVALID_HANDLE_VALUE as invalid map handle
because CreateFileMapping returns NULL when error occurs.
2009-03-05 14:21:12 +00:00
Hirokazu Yamamoto b0e10c760c Issue #1733986: Fixed mmap crash in accessing elements of second map object
with same tagname but larger size than first map. (Windows)
2009-02-28 12:13:07 +00:00
Hirokazu Yamamoto f2dc885780 Issue #5386: mmap.write_byte didn't check map size, so it could cause buffer
overrun.
2009-02-28 10:31:54 +00:00
Hirokazu Yamamoto 17a837e4db Issue #5282: Fixed mmap resize on 32bit windows and unix. When offset > 0,
The file was resized to wrong size.
2009-02-17 13:17:26 +00:00
Hirokazu Yamamoto f6bbd0e71d Issue #5292: Fixed mmap crash on its boundary access m[len(m)]. 2009-02-17 10:12:10 +00:00
Thomas Heller 6626099520 Fix strange character in the docstring. 2008-08-19 17:47:13 +00:00
Neal Norwitz e7d8be80ba Security patches from Apple: prevent int overflow when allocating memory 2008-07-31 17:17:14 +00:00
Gregory P. Smith dd96db63f6 This reverts r63675 based on the discussion in this thread:
http://mail.python.org/pipermail/python-dev/2008-June/079988.html

Python 2.6 should stick with PyString_* in its codebase.  The PyBytes_* names
in the spirit of 3.0 are available via a #define only.  See the email thread.
2008-06-09 04:58:54 +00:00
Christian Heimes 593daf545b Renamed PyString to PyBytes 2008-05-26 12:51:38 +00:00
Facundo Batista e139688d34 Issue 2112. mmap does not raises EnvironmentError no more, but
a subclass of it. Thanks John Lenton.
2008-02-17 18:59:29 +00:00
Christian Heimes 7adfad850a Bug #2111: mmap segfaults when trying to write a block opened with PROT_READ
Thanks to Thomas Herve for the fix.
2008-02-15 08:20:11 +00:00
Neal Norwitz e1027f9034 Use int for the sign rather than a char. char can be signed or unsigned.
It's system dependent.  This might fix the problem with test_rfind failing.
2008-01-27 07:37:38 +00:00
Neal Norwitz 448654f1f8 Mostly reformat. Also set an error and return NULL if neither MS_WINDOWS
nor UNIX is defined.  This may have caused problems on cygwin.
2008-01-27 07:36:03 +00:00
Neal Norwitz 739a3c40e6 Cleanup the code a bit. test_rfind is failing on PPC and PPC64 buildbots,
this might fix the problem.
2008-01-26 20:24:36 +00:00
Christian Heimes 501dbbfb70 Use Py_TYPE() instead of ->ob_type 2008-01-23 14:00:25 +00:00
Georg Brandl d02fc48f67 Fix for #1087741 patch. 2008-01-22 19:56:03 +00:00
Georg Brandl 845c403c08 #1087741: make mmap.mmap the type of mmap objects, not a
factory function. Allow it to be subclassed.
2008-01-21 14:16:46 +00:00
Georg Brandl ef92802f73 Switch mmap from old Py_FindMethod to new PyObject_GenericGetAttr attribute access.
Fixes #1087735.
2008-01-20 14:50:05 +00:00
Andrew M. Kuchling 5c60bfcfbf Patch #976880: add mmap .rfind() method, and 'end' paramter to .find().
Contributed by John Lenton.
2008-01-19 18:18:41 +00:00
Andrew M. Kuchling 7c22ccc3dd Check for fd of -1 to save fsync() and fstat() call 2008-01-10 13:37:12 +00:00
Christian Heimes e93237dfcc #1629: Renamed Py_Size, Py_Type and Py_Refcnt to Py_SIZE, Py_TYPE and Py_REFCNT. Macros for b/w compatibility are available. 2007-12-19 02:37:44 +00:00
Neal Norwitz 9c4382f2a3 Fix some compiler warnings for signed comparisons on Unix and Windows. 2007-10-31 06:33:20 +00:00
Travis E. Oliphant 8feafab346 Add phuang patch from Issue 708374 which adds offset parameter to mmap module. 2007-10-23 02:40:56 +00:00
Thomas Wouters 3ccec68a05 Improve extended slicing support in builtin types and classes. Specifically:
- Specialcase extended slices that amount to a shallow copy the same way as
   is done for simple slices, in the tuple, string and unicode case.

 - Specialcase step-1 extended slices to optimize the common case for all
   involved types.

 - For lists, allow extended slice assignment of differing lengths as long
   as the step is 1. (Previously, 'l[:2:1] = []' failed even though
   'l[:2] = []' and 'l[:2:None] = []' do not.)

 - Implement extended slicing for buffer, array, structseq, mmap and
   UserString.UserString.

 - Implement slice-object support (but not non-step-1 slice assignment) for
   UserString.MutableString.

 - Add tests for all new functionality.
2007-08-28 15:28:19 +00:00
Martin v. Löwis 6819210b9e PEP 3123: Provide forward compatibility with Python 3.0, while keeping
backwards compatibility. Add Py_Refcnt, Py_Type, Py_Size, and
PyVarObject_HEAD_INIT.
2007-07-21 06:55:02 +00:00
Neal Norwitz 670f875a7c Alexander Belopolsky pointed out that pos is a size_t 2006-08-22 13:56:56 +00:00
Neal Norwitz 076d1e0c0b Fix a couple of ssize-t issues reported by Alexander Belopolsky on python-dev 2006-08-21 18:20:10 +00:00
Neal Norwitz 5ed4997e1f Get rid of compiler warning 2006-08-13 18:41:15 +00:00
Neal Norwitz e9ac0bb169 Check return result of PyModule_GetDict().
Fix a bunch of refleaks in the init of the module.  This would only be found
when running python -v.
2006-08-13 18:11:27 +00:00
Neal Norwitz 8a87f5d37e Patch #1538606, Patch to fix __index__() clipping.
I modified this patch some by fixing style, some error checking, and adding
XXX comments.  This patch requires review and some changes are to be expected.
I'm checking in now to get the greatest possible review and establish a
baseline for moving forward.  I don't want this to hold up release if possible.
2006-08-12 17:03:09 +00:00
Martin v. Löwis 0e8bd7e1cc Patch #1495999: Part two of Windows CE changes.
- update header checks, using autoconf
- provide dummies for getenv, environ, and GetVersion
- adjust MSC_VER check in socketmodule.c
2006-06-10 12:23:46 +00:00
Georg Brandl 96a8c3954c Make use of METH_O and METH_NOARGS where possible.
Use Py_UnpackTuple instead of PyArg_ParseTuple where possible.
2006-05-29 21:04:52 +00:00
Georg Brandl 2cfaa34dfa Correct some value converting strangenesses. 2006-05-29 19:39:45 +00:00
Guido van Rossum 38fff8c4e4 Checking in the code for PEP 357.
This was mostly written by Travis Oliphant.
I've inspected it all; Neal Norwitz and MvL have also looked at it
(in an earlier incarnation).
2006-03-07 18:50:55 +00:00