Commit Graph

74 Commits

Author SHA1 Message Date
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
Martin v. Löwis
02cbf4ae4b More unconsting. 2006-02-27 17:20:04 +00:00
Martin v. Löwis
5bb8a15593 Fix typo. 2006-02-18 12:49:49 +00:00
Martin v. Löwis
151860752f Fix size computation on Win64. 2006-02-18 12:38:35 +00:00
Thomas Wouters
2c98a7bbc6 Fix typo. 2006-02-17 09:59:00 +00:00
Martin v. Löwis
cfe7e0912c Remove size restrictions. 2006-02-17 06:59:14 +00:00
Tim Peters
f28829577d mmap_flush_method(): Squash compiler warning about
mixing signed and unsigned types in comparison.
2006-02-17 01:07:39 +00:00
Tim Peters
8f9cc29e74 Remove space between function name and left paren
in function calls.
2006-02-17 00:00:20 +00:00
Tim Peters
23721ee96c Removed pointless parens around return expressions;
deleted some curlies around one-line blocks.
2006-02-16 23:50:16 +00:00
Tim Peters
ec0a5f0add Trimmed trailing whitespace. 2006-02-16 23:47:20 +00:00
Tim Peters
e564e7f939 new_mmap_object(), Windows flavor.
On a box where sizeof(size_t) == 4, C doesn't define
what happens when a size_t value is shifted right by
32 bits, and this caused test_mmap to fail on Windows
in a debug build.  So use different code to break
the size apart depending on how large size_t actually
is.

This looks like an illusion, since lots of code in this
module still appears to assume sizes can't be more
than 32 bits (e.g., the internal _GetMapSize() still
returns an int), but at least test_mmap passes again.
2006-02-16 23:46:01 +00:00
Thomas Wouters
dde176593d More Py_ssize_t format characters. 2006-02-16 21:10:52 +00:00
Martin v. Löwis
ad0a4629be Use Py_ssize_t for counts and sizes. 2006-02-16 14:30:23 +00:00
Neal Norwitz
3eaf2b5044 Update comment and make accurate. 2006-02-16 08:08:54 +00:00
Martin v. Löwis
18e165558b Merge ssize_t branch. 2006-02-15 17:27:45 +00:00
Neal Norwitz
0e6bc8c260 Patch #1407135, bug #1424041, make mmap.mmap(-1, length) work the same
on both Unix (SVR4 and BSD) and Windows.  Restores behaviour of passing -1
for anonymous memory on Unix.  Use MAP_ANONYMOUS instead of _ANON since
the latter is deprecated according to Linux (gentoo) man pages.

Should we continue to allow mmap.mmap(0, length) to work on Windows?
0 is a valid fd.

Will backport bugfix portions.
2006-02-05 05:45:43 +00:00
Neal Norwitz
d1cfc8ade1 Whitespace normalization 2006-02-05 03:36:57 +00:00
Neal Norwitz
1ac754fa10 Check return result from Py_InitModule*(). This API can fail.
Probably should be backported.
2006-01-19 06:09:39 +00:00
Neal Norwitz
3b4fff8079 Fix SF bug #1402308, segfault when using mmap(-1, ...)
This didn't crash on Linux, but valgrind complained.
I'm not sure if this test is valid on Windows.

Will backport.
2006-01-11 08:54:45 +00:00
Neal Norwitz
8856fb750b SF Patch #1365916, mmap fails on AMD64
Fix some 64-bit issues due to mismatch format characters w/actual data types
2005-12-18 03:34:22 +00:00
Jeremy Hylton
af68c874a6 Add const to several API functions that take char *.
In C++, it's an error to pass a string literal to a char* function
without a const_cast().  Rather than require every C++ extension
module to put a cast around string literals, fix the API to state the
const-ness.

I focused on parts of the API where people usually pass literals:
PyArg_ParseTuple() and friends, Py_BuildValue(), PyMethodDef, the type
slots, etc.  Predictably, there were a large set of functions that
needed to be fixed as a result of these changes.  The most pervasive
change was to make the keyword args list passed to
PyArg_ParseTupleAndKewords() to be a const char *kwlist[].

One cast was required as a result of the changes:  A type object
mallocs the memory for its tp_doc slot and later frees it.
PyTypeObject says that tp_doc is const char *; but if the type was
created by type_new(), we know it is safe to cast to char *.
2005-12-10 18:50:16 +00:00
Neal Norwitz
6eac2005bf Cleanup the previous checkin.
Close the fd in the close method and invalidated it.  Don't try
to close a second time when deallocating.
2005-11-02 05:36:37 +00:00
Neal Norwitz
7b631793ab Bug #1344508, Fix UNIX mmap leaking file descriptors. Will backport. 2005-11-02 05:26:07 +00:00
Armin Rigo
335ffe88bb C89 compliance. 2005-09-20 19:04:02 +00:00
Georg Brandl
38387b8b91 bug [ 728515 ] mmap's resize method resizes the file in win32 but not unix 2005-08-24 07:17:40 +00:00