summaryrefslogtreecommitdiffstats
path: root/Modules/mmapmodule.c
Commit message (Collapse)AuthorAgeFilesLines
* bpo-46848: Move _PyBytes_Find() to internal C API (GH-31642)Victor Stinner2022-03-021-0/+1
| | | | | | Move _PyBytes_Find() and _PyBytes_ReverseFind() functions to the internal C API. bytesobject.c now includes pycore_bytesobject.h.
* bpo-46848: Use stringlib/fastsearch in mmap (GH-31625)Dennis Sweeney2022-03-021-19/+13
| | | Speed up mmap.find(). Add _PyBytes_Find() and _PyBytes_ReverseFind().
* bpo-46541: Remove usage of _Py_IDENTIFIER from mmap module (GH-31375)Dong-hee Na2022-02-161-4/+1
|
* bpo-46541: Replace core use of _Py_IDENTIFIER() with statically initialized ↵Eric Snow2022-02-081-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | global objects. (gh-30928) We're no longer using _Py_IDENTIFIER() (or _Py_static_string()) in any core CPython code. It is still used in a number of non-builtin stdlib modules. The replacement is: PyUnicodeObject (not pointer) fields under _PyRuntimeState, statically initialized as part of _PyRuntime. A new _Py_GET_GLOBAL_IDENTIFIER() macro facilitates lookup of the fields (along with _Py_GET_GLOBAL_STRING() for non-identifier strings). https://bugs.python.org/issue46541#msg411799 explains the rationale for this change. The core of the change is in: * (new) Include/internal/pycore_global_strings.h - the declarations for the global strings, along with the macros * Include/internal/pycore_runtime_init.h - added the static initializers for the global strings * Include/internal/pycore_global_objects.h - where the struct in pycore_global_strings.h is hooked into _PyRuntimeState * Tools/scripts/generate_global_objects.py - added generation of the global string declarations and static initializers I've also added a --check flag to generate_global_objects.py (along with make check-global-objects) to check for unused global strings. That check is added to the PR CI config. The remainder of this change updates the core code to use _Py_GET_GLOBAL_IDENTIFIER() instead of _Py_IDENTIFIER() and the related _Py*Id functions (likewise for _Py_GET_GLOBAL_STRING() instead of _Py_static_string()). This includes adding a few functions where there wasn't already an alternative to _Py*Id(), replacing the _Py_Identifier * parameter with PyObject *. The following are not changed (yet): * stop using _Py_IDENTIFIER() in the stdlib modules * (maybe) get rid of _Py_IDENTIFIER(), etc. entirely -- this may not be doable as at least one package on PyPI using this (private) API * (maybe) intern the strings during runtime init https://bugs.python.org/issue46541
* bpo-46303: Move fileutils.h private functions to internal C API (GH-30484)Victor Stinner2022-01-111-0/+5
| | | | | | | | | | Move almost all private functions of Include/cpython/fileutils.h to the internal C API Include/internal/pycore_fileutils.h. Only keep _Py_fopen_obj() in Include/cpython/fileutils.h, since it's used by _testcapi which must not use the internal C API. Move EncodeLocaleEx() and DecodeLocaleEx() functions from _testcapi to _testinternalcapi, since the C API moved to the internal C API.
* bpo-46176: mmap module adding MAP_STACK constant. (GH-30252)David CARLIER2021-12-291-0/+5
|
* bpo-40915: Avoid compiler warnings by fixing mmapmodule conversion from ↵neonene2021-12-181-1/+2
| | | | LARGE_INTEGER to Py_ssize_t (GH-30175)
* bpo-45621: Small changes to mmap (GH-29247)Tim Golden2021-10-291-16/+5
| | | | * Small tidy-ups / comments * Use randomized names when testing tagged mmaps to avoid any risk of parallel tests treading on each others' toes
* bpo-40915: Fix mmap resize bugs on Windows (GH-29213)Tim Golden2021-10-261-34/+95
| | | | | | | | | | | (original patch by eryksun) Correctly hand various failure modes when resizing an mmap on Windows: * Resizing a pagefile-backed mmap now creates a new mmap and copies data * Attempting to resize when another mapping is held on the same file raises an OSError * Attempting to resize a nametagged mmap raises an OSError if another mapping is held with the same nametag
* bpo-43908: Make heap types converted during 3.10 alpha immutable (GH-26351)Erlend Egeberg Aasland2021-06-171-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Make functools types immutable * Multibyte codec types are now immutable * pyexpat.xmlparser is now immutable * array.arrayiterator is now immutable * _thread types are now immutable * _csv types are now immutable * _queue.SimpleQueue is now immutable * mmap.mmap is now immutable * unicodedata.UCD is now immutable * sqlite3 types are now immutable * _lsprof.Profiler is now immutable * _overlapped.Overlapped is now immutable * _operator types are now immutable * winapi__overlapped.Overlapped is now immutable * _lzma types are now immutable * _bz2 types are now immutable * _dbm.dbm and _gdbm.gdbm are now immutable
* bpo-42972: Fully support GC for mmap heap types (GH-26373)Erlend Egeberg Aasland2021-05-271-3/+10
|
* bpo-30555: Fix WindowsConsoleIO fails in the presence of fd redirection ↵Segev Finer2021-04-231-6/+3
| | | | | | | | (GH-1927) This works by not caching the handle and instead getting the handle from the file descriptor each time, so that if the actual handle changes by fd redirection closing/opening the console handle beneath our feet, we will keep working correctly.
* bpo-42232: mmap module add Darwin specific madvise options. (GH-23076)David CARLIER2020-11-211-0/+8
|
* bpo-40077: Convert mmap.mmap static type to a heap type (GH-23108)Erlend Egeberg Aasland2020-11-031-68/+90
|
* bpo-1635741: Port mmap module to multiphase initialization (GH-19459)Dong-hee Na2020-06-051-74/+80
|
* bpo-40611: Adds MAP_POPULATE to the mmap module (GH-20061)Ethan Steinberg2020-05-261-0/+3
| | | | MAP_POPULATE constant has now been added to the list of exported mmap module flags.
* bpo-39481: remove generic classes from ipaddress/mmap (GH-20045)Batuhan Taskaya2020-05-121-2/+0
| | | These were added by mistake (see https://bugs.python.org/issue39481#msg366288).
* bpo-40268: Remove unused structmember.h includes (GH-19530)Victor Stinner2020-04-151-1/+1
| | | | | | If only offsetof() is needed: include stddef.h instead. When structmember.h is used, add a comment explaining that PyMemberDef is used.
* bpo-39481: PEP 585 for enumerate, AsyncGeneratorType, mmap (GH-19421)Ethan Smith2020-04-101-0/+2
|
* bpo-38465: Convert the type of exports counters to Py_ssize_t. (GH-16746)Hai Shi2019-10-211-1/+1
|
* bpo-34953: Implement `mmap.mmap.__repr__` (GH-9891)Taine Zhao2019-10-171-12/+57
|
* Fix a possbile refleak in setint() of mmapmodule.c (GH-16136)Hai Shi2019-09-161-1/+2
|
* bpo-37337: Add _PyObject_CallMethodNoArgs() (GH-14267)Jeroen Demeyer2019-07-081-1/+1
|
* bpo-37316: mmap.mmap() passes the wrong variable to PySys_Audit() (GH-14152)Zackery Spytz2019-06-211-1/+1
| | | Also, add a missing call to va_end() in PySys_Audit().
* bpo-36974: tp_print -> tp_vectorcall_offset and tp_reserved -> tp_as_async ↵Jeroen Demeyer2019-05-311-2/+2
| | | | | | | | | (GH-13464) Automatically replace tp_print -> tp_vectorcall_offset tp_compare -> tp_as_async tp_reserved -> tp_as_async
* bpo-32941: Add madvise() for mmap objects (GH-6172)Zackery Spytz2019-05-271-0/+118
| | | | Allow mmap objects to access the madvise() system call.
* bpo-36842: Implement PEP 578 (GH-12613)Steve Dower2019-05-231-0/+10
| | | Adds sys.audit, sys.addaudithook, io.open_code, and associated C APIs.
* bpo-36648: fix mmap issue for VxWorks (GH-12394)Lihua Zhao2019-05-211-0/+7
| | | | | The mmap module set MAP_SHARED flag when map anonymous memory, however VxWorks only support MAP_PRIVATE when map anonymous memory, this commit clear MAP_SHARED and set MAP_PRIVATE.
* bpo-36946: Fix possible signed integer overflow when handling slices. (GH-13375)Zackery Spytz2019-05-171-2/+4
| | | | | | | The final addition (cur += step) may overflow, so use size_t for "cur". "cur" is always positive (even for negative steps), so it is safe to use size_t here. Co-Authored-By: Martin Panter <vadmium+py@gmail.com>
* bpo-36139: Fix mmap_object_dealloc(): hold the GIL to call PyMem_Free() ↵Davide Rizzo2019-03-061-2/+4
| | | | (GH-12199)
* closes bpo-36139: release GIL around munmap(). (GH-12073)Davide Rizzo2019-03-061-14/+25
|
* bpo-33029: Fix signatures of getter and setter functions. (GH-10746)Serhiy Storchaka2018-11-271-1/+1
| | | Fix also return type for few other functions (clear, releasebuffer).
* Fix misleading mentions of tp_size in comments (GH-9093)Peter Eisentraut2018-09-101-1/+1
| | | | Many type object initializations labeled a field "tp_size" in the comment, but the name of that field is tp_basicsize.
* bpo-2122: Make mmap.flush() behave same on all platforms (GH-8692)Berker Peksag2018-08-221-4/+7
| | | | | Previously, its behavior was platform-dependent and there was no error checking under Windows.
* bpo-33767: Fix improper use of SystemError by mmap.mmap objects (GH-7381)Zackery Spytz2018-06-051-20/+2
| | | | Raise TypeError instead of SystemError for unsupported operations.
* Fix typos in mmap() error messages (GH-6173)Zackery Spytz2018-03-211-2/+2
|
* bpo-33021: Fix GCC 7 warning (-Wmaybe-uninitialized) in mmapmodule.c (#6117)Zackery Spytz2018-03-141-1/+1
|
* bpo-33021: Release the GIL during fstat() calls (GH-6019)Nir Soffer2018-03-111-2/+9
| | | | | | | | | | | | | | 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()
* Add the const qualifier to "char *" variables that refer to literal strings. ↵Serhiy Storchaka2017-11-111-1/+1
| | | | (#4370)
* Added :const:`mmap.ACCESS_DEFAULT` constant. (#4093)Justus Schwabedal2017-11-071-0/+1
|
* Expand the PySlice_GetIndicesEx macro. (#1023)Serhiy Storchaka2017-04-081-5/+4
|
* bpo-29852: Argument Clinic Py_ssize_t converter now supports None (#716)Serhiy Storchaka2017-03-301-24/+1
| | | if pass `accept={int, NoneType}`.
* bpo-29730: replace some calls to PyNumber_Check and improve some error ↵Oren Milman2017-03-121-3/+4
| | | | messages (#650)
* Issue #28999: Use Py_RETURN_NONE, Py_RETURN_TRUE and Py_RETURN_FALSE whereverSerhiy Storchaka2017-01-231-12/+6
| | | | possible. Patch is writen with Coccinelle.
* merge 3.5Benjamin Peterson2016-10-061-1/+1
|\
| * ensure read size is initializedBenjamin Peterson2016-10-061-1/+1
| |
* | merge 3.5Benjamin Peterson2016-10-061-1/+3
|\ \ | |/
| * do not leak buffer if mmap is not writableBenjamin Peterson2016-10-061-1/+3
| |
* | merge 3.5Benjamin Peterson2016-10-061-112/+79
|\ \ | |/
| * mmap: do all internal arithmetic with Py_ssize_t while being very careful ↵Benjamin Peterson2016-10-061-109/+78
| | | | | | | | about overflow