This patch fixes a possible overflow in the Sleep system call on
Win32/64 in the time_sleep() function in the time module. For very
large values of the give time to sleep the number of milliseconds can
overflow and give unexpected sleep intervals. THis patch raises an
OverflowError if the value overflows.
Closes SourceForge patch #100514.
This patch fixes the posix module for large file support mainly on
Win64, although some general cleanup is done as well.
The changes are:
- abstract stat->STAT, fstat->FSTAT, and struct stat->STRUCT_STAT
This is because stat() etc. are not the correct functions to use on
Win64 (nor maybe on other platforms?, if not then it is now trivial to
select the appropriate one). On Win64 the appropriate system functions
are _stati64(), etc.
- add _pystat_fromstructstat(), it builds the return tuple for the
fstat system call. This functionality was being duplicated. As well
the construction of the tuple was modified to ensure no overflow of
the time_t elements (sizeof(time_t) > sizeof(long) on Win64).
- add overflow protection for the return values of posix_spawnv and
posix_spawnve
- use the proper 64-bit capable lseek() on Win64
- use intptr_t instead of long where appropriate from Win32/64 blocks
(sizeof(void*) > sizeof(long) on Win64)
This closes SourceForge patch #100513.
Mark Hammond provided (a long time ago) a better Win32 specific
time_clock implementation in timemodule.c. The library for this
implementation does not exist on Win64 (yet, at least). This patch
makes Win64 fall back on the system's clock() function for
time_clock().
This closes SourceForge patch #100512.
64-bit readiness (the config values are needed for patches that I will
be submitting later today. The changes are as follows:
- add SIZEOF_OFF_T #define's to PC/config.h (it was already in configure.in)
- add SIZEOF_TIME_T #define to PC/config.h and configure
Needed for some buffer overflow checking because sizeof(time_t) is
different on Win64.
- add SIZEOF_FPOS_T #define
Needed for the Win64 large file support implementation.
- add SIZEOF_HKEY in PC/config.h only
Needed for proper Win32 vs. Win64 handling in PC/winreg.c
- #define HAVE_LARGEFILE_SUPPORT for Win64
- typedef long intptr_t; for all Windows except Win64 (which defines it
itself)
This is a new ANSI (I think) type that is useful (and used by me) for
proper handling in msvcrtmodule.c and posixmodule.c
- indent the nested #ifdef's and #defines in PC/config.h
This is *so* much more readable. There cannot be a compiler
compatibilty issue here can there? Perl uses indented #defines and it
compiles with everything.
errors in some of the hash algorithms. For exmaple, in float_hash and
complex_hash a certain part of the value is not included in the hash
calculation. See Tim's, Guido's, and my discussion of this on
python-dev in May under the title "fix float_hash and complex_hash for
64-bit *nix"
(2) The hash algorithms that use pointers (e.g. func_hash, code_hash)
are universally not correct on Win64 (they assume that sizeof(long) ==
sizeof(void*))
As well, this patch significantly cleans up the hash code. It adds the
two function _Py_HashDouble and _PyHash_VoidPtr that the various
hashing routine are changed to use.
These help maintain the hash function invariant: (a==b) =>
(hash(a)==hash(b))) I have added Lib/test/test_hash.py and
Lib/test/output/test_hash to test this for some cases.
get_starttag_text(): New method.
Return the text of the most recently parsed start tag, from
the '<' to the '>' or '/'. Not really useful for structure
processing, but requested for Web-related use. May also be
useful for being able to re-generate the input from the parse
events, but there's no equivalent for end tags.
attrfind: Be a little more forgiving of unquoted attribute values.
(those semantics are weird...)
- got rid of $Id$'s (for the moment, at least). in other
words, there should be no more "empty" checkins.
- internal: some minor cleanups.
(test_sre still complains about split, but that's caused by
the group reset bug, not split itself)
- added more mark slots
(should be dynamically allocated, but 100 is better than 32.
and checking for the upper limit is better than overwriting
the memory ;-)
- internal: renamed the cursor helper class
- internal: removed some bloat from sre_compile
threads use --without-threads. No extra tests of thread/compiler
combinations have been added.
--with(out)-thread and --with(out)-threads are completely
interchangeable.
--with-threads still supports the =DIRECTORY option for specifying
where to find thread libraries.
accidentally wiped out by Ping's patch (which shouldn't have affected
this file at all, had Ping done a cvs update).
This checkin restores Gordon's version, with Fredrik's change merged
back in.
tests in sre_patch back to previous version
- fixed return value from findall
- renamed a bunch of functions inside _sre (way too
many leading underscores...)
</F>