Commit Graph

193 Commits

Author SHA1 Message Date
Zackery Spytz 9308dea3e1 Fix typos in mmap() error messages (GH-6173) 2018-03-21 14:02:37 +08:00
Zackery Spytz d6e1404661 bpo-33021: Fix GCC 7 warning (-Wmaybe-uninitialized) in mmapmodule.c (#6117) 2018-03-14 21:08:01 +01:00
Nir Soffer 4484f9dca9 bpo-33021: Release the GIL during fstat() calls (GH-6019)
fstat may block for long time if the file descriptor is on a
non-responsive NFS server, hanging all threads. Most fstat() calls are
handled by _Py_fstat(), releasing the GIL internally, but but
_Py_fstat_noraise() does not release the GIL, and most calls release the
GIL explicitly around it.

This patch fixes last 2 calls to _Py_fstat_no_raise(), avoiding hangs
when calling:
- mmap.mmap()
- os.urandom()
- random.seed()
2018-03-12 00:39:22 +01:00
Serhiy Storchaka e2f92de6a9
Add the const qualifier to "char *" variables that refer to literal strings. (#4370) 2017-11-11 13:06:26 +02:00
Justus Schwabedal 5a8a84b34f Added :const:`mmap.ACCESS_DEFAULT` constant. (#4093) 2017-11-07 12:51:43 -08:00
Serhiy Storchaka b879fe82e7 Expand the PySlice_GetIndicesEx macro. (#1023) 2017-04-08 09:53:51 +03:00
Serhiy Storchaka 762bf40438 bpo-29852: Argument Clinic Py_ssize_t converter now supports None (#716)
if pass `accept={int, NoneType}`.
2017-03-30 09:15:31 +03:00
Oren Milman 004251059b bpo-29730: replace some calls to PyNumber_Check and improve some error messages (#650) 2017-03-13 00:37:05 +02:00
Serhiy Storchaka 228b12edcc Issue #28999: Use Py_RETURN_NONE, Py_RETURN_TRUE and Py_RETURN_FALSE wherever
possible.  Patch is writen with Coccinelle.
2017-01-23 09:47:21 +02:00
Benjamin Peterson e4c222c040 merge 3.5 2016-10-05 23:32:15 -07:00
Benjamin Peterson 8f1cdc65ee ensure read size is initialized 2016-10-05 23:32:09 -07:00
Benjamin Peterson 43441c77b5 merge 3.5 2016-10-05 23:29:16 -07:00
Benjamin Peterson 3776836f67 do not leak buffer if mmap is not writable 2016-10-05 23:29:07 -07:00
Benjamin Peterson 87845bcb4d merge 3.5 2016-10-05 22:54:19 -07:00
Benjamin Peterson cd04db03de mmap: do all internal arithmetic with Py_ssize_t while being very careful about overflow 2016-10-05 21:45:48 -07:00
Steve Dower 940f33a50f Issue #23524: Finish removing _PyVerify_fd from sources 2016-09-08 11:21:54 -07:00
Benjamin Peterson af580dff4a replace PY_LONG_LONG with long long 2016-09-06 10:46:49 -07:00
Berker Peksag 6282e656e9 Issue #26335: Make mmap.write() return the number of bytes written like
other write methods.

Patch by Jakub Stasiak.
2016-03-02 19:30:18 +02:00
Serhiy Storchaka 5c4064e8bd Issue #25421: __sizeof__ methods of builtin types now use dynamic basic size.
This allows sys.getsize() to work correctly with their subclasses with
__slots__ defined.
2015-12-19 20:05:25 +02:00
Benjamin Peterson 60e3f367a4 Merge 3.4 (#24217) 2015-08-02 12:16:45 -07:00
Benjamin Peterson f6b5cad3c3 include fcntl.h on all *nix platforms (closes #24217)
Patch by Jeffrey Armstrong.
2015-08-02 12:15:30 -07:00
Steve Dower 8fc8980c96 Issue #23524: Replace _PyVerify_fd function with calls to _set_thread_local_invalid_parameter_handler. 2015-04-12 00:26:27 -04:00
Victor Stinner e134a7fe36 Issue #23752: _Py_fstat() is now responsible to raise the Python exception
Add _Py_fstat_noraise() function when a Python exception is not welcome.
2015-03-30 10:09:31 +02:00
Victor Stinner f329878e74 Issue #23753: Python doesn't support anymore platforms without stat() or
fstat(), these functions are always required.

Remove HAVE_STAT and HAVE_FSTAT defines, and stop supporting DONT_HAVE_STAT and
DONT_HAVE_FSTAT.
2015-03-24 10:27:50 +01:00
Serhiy Storchaka 8490f5acfe Issue #23001: Few functions in modules mmap, ossaudiodev, socket, ssl, and
codecs, that accepted only read-only bytes-like object now accept writable
bytes-like object too.
2015-03-20 09:00:36 +02:00
Victor Stinner e371b3d21a Fix compiler warning in mmapmodule.c (compare signed/unsigned integers) 2015-03-18 15:04:34 +01:00
Victor Stinner a555cfcb73 Issue #23694: Enhance _Py_open(), it now raises exceptions
* _Py_open() now raises exceptions on error. If open() fails, it raises an
  OSError with the filename.
* _Py_open() now releases the GIL while calling open()
* Add _Py_open_noraise() when _Py_open() cannot be used because the GIL is not
  held
2015-03-18 00:22:14 +01:00
Steve Dower f2f373f593 Issue #23152: Implement _Py_fstat() to support files larger than 2 GB on Windows.
fstat() may fail with EOVERFLOW on files larger than 2 GB because the file size type is an signed 32-bit integer.
2015-02-21 08:44:05 -08:00
Serhiy Storchaka 76b47655ff Issue #15696: Add a __sizeof__ implementation for mmap objects on Windows. 2014-08-19 17:11:20 +03:00
Christian Heimes af01f66817 Issue #16136: Remove VMS support and VMS-related code 2013-12-21 16:19:10 +01:00
Victor Stinner daf455554b Issue #18571: Implementation of the PEP 446: file descriptors and file handles
are now created non-inheritable; add functions os.get/set_inheritable(),
os.get/set_handle_inheritable() and socket.socket.get/set_inheritable().
2013-08-28 00:53:59 +02:00
Antoine Pitrou c53204b947 Issue #4885: Add weakref support to mmap objects. Patch by Valerie Lambert. 2013-08-05 23:17:30 +02:00
Richard Oudkerk 6d40134eba Merge 2013-02-13 12:32:32 +00:00
Richard Oudkerk 0d09ba8e0b Issue #16743: Fix mmap overflow check on 32 bit Windows 2013-02-13 12:18:03 +00:00
Jesus Cea 67bd81b867 MERGE: #15676: mmap: add empty file check prior to offset check <- Previous patch was incomplete (fix 2) 2012-09-10 22:58:35 +02:00
Jesus Cea e8db356cf1 #15676: mmap: add empty file check prior to offset check <- Previous patch was incomplete (fix 2) 2012-09-10 22:58:07 +02:00
Jesus Cea 4886d5b338 #15676: mmap: add empty file check prior to offset check <- Previous patch was incomplete 2012-09-10 22:50:21 +02:00
Jesus Cea 1f2799bef4 #15676: mmap: add empty file check prior to offset check <- Previous patch was incomplete 2012-09-10 22:49:50 +02:00
Jesus Cea 1b3f3b0316 Closes #15676: mmap: add empty file check prior to offset check 2012-09-10 01:23:05 +02:00
Jesus Cea 941bfcc537 Closes #15676: mmap: add empty file check prior to offset check 2012-09-10 00:27:55 +02:00
Stefan Krah 2318699f59 Whitespace. 2012-03-06 15:37:36 +01:00
Martin v. Löwis bd928fef42 Rename _Py_identifier to _Py_IDENTIFIER. 2011-10-14 10:20:37 +02:00
Antoine Pitrou 6b4883dec0 PEP 3151 / issue #12555: reworking the OS and IO exception hierarchy. 2011-10-12 02:54:14 +02:00
Martin v. Löwis afe55bba33 Add API for static strings, primarily good for identifiers.
Thanks to Konrad Schöbel and Jasper Schulz for helping with the mass-editing.
2011-10-09 10:38:36 +02:00
Ross Lagerwall 1db37f3248 Merge with 3.2 (Issue #12404). 2011-06-25 10:11:44 +02:00
Ross Lagerwall dbfb9b89db Issue 12404: Remove C89 incompatible code from mmap module.
Patch by Akira Kitada.
2011-06-25 10:02:37 +02:00
Charles-François Natali 4dd453c6aa Issue #12021: Make mmap's read() method argument optional. Patch by Petri
Lehtinen.
2011-06-08 19:18:14 +02:00
Brett Cannon 5fac8af22c Checking if an unsigned long is < 0 is pointless.
Found by LLVM/clang 2.9.
2011-06-06 20:22:56 -07:00
Victor Stinner 8108e96bc8 (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-02 01:11:33 +02:00
Victor Stinner a6cd0cf0f5 Issue #11277: 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-02 01:05:37 +02:00