1. 08 May, 2000 9 commits
    • Jeremy Hylton's avatar
      if the GzipFile constructor fails, the __del__ method is still · e298c301
      Jeremy Hylton authored
      called.  catch the resulting AttributeError and exit cleanly.
      e298c301
    • Guido van Rossum's avatar
      Trent Mick: · c554505c
      Guido van Rossum authored
      Fix overflow bug in ldexp(x, exp). The 'exp' argument maps to a C int for the
      math library call [double ldexp(double, int)], however the 'd'
      PyArg_ParseTuple formatter was used to yield a double, which was subsequently
      cast to an int. This could overflow.
      
      [GvR: mysteriously, on Solaris 2.7, ldexp(1, 2147483647) returns Inf
      while ldexp(1, 2147483646) raises OverflowError; this seems a bug in
      the math library (it also takes a real long time to compute the
      Inf outcome).  Does this point to a bug in the CHECK() macro?  It
      should have discovered that the result was outside the HUGE_VAL range.]
      c554505c
    • Guido van Rossum's avatar
      Trent Mick: · 23ef82ff
      Guido van Rossum authored
      The following modules are specifically excluded in the Win64 build:
      audioop, binascii, imageop, rgbimg. They are advertised as heavily 32-bit
      dependent.  [They should probably be fixed!  --GvR]
      23ef82ff
    • Guido van Rossum's avatar
      Trent Mick: · c66ae966
      Guido van Rossum authored
      Changes to PC\config.[hc] for Win64. MSVC defines _WINxx to differentiate the
      various windows platforms. Python's MS_WINxx are keyed off of these. Note
      that _WIN32 (and hence MS_WIN32 in Python) are defined on Win32 *and* on
      Win64. This is for compatibility reasons. The idea is that the common case is
      that code specific to Win32 will also work on Win64 rather than being
      specific to Win32 (i.e. there is more the same than different in WIn32 and
      Win64).
      
      The following modules are specifically excluded in the Win64 build:
      audioop, binascii, imageop, rgbimg. They are advertised as heavily 32-bit
      dependent.  [They should probably be fixed!  --GvR]
      
      The patch to config.h looks big but it really is not. These are the effective
      changes:
      - MS_WINxx are keyed off _WINxx
      - SIZEOF_VOID_P is set to 8 for Win64
      - COMPILER string is changed appropriately for Win64
      c66ae966
    • Guido van Rossum's avatar
      Trent Mick: · c682140d
      Guido van Rossum authored
      Fix the string methods that implement slice-like semantics with
      optional args (count, find, endswith, etc.) to properly handle
      indeces outside [INT_MIN, INT_MAX]. Previously the "i" formatter
      for PyArg_ParseTuple was used to get the indices. These could overflow.
      
      This patch changes the string methods to use the "O&" formatter with
      the slice_index() function from ceval.c which is used to do the same
      job for Python code slices (e.g. 'abcabcabc'[0:1000000000L]). slice_index()
      is renamed _PyEval_SliceIndex() and is now exported. As well, the return
      values for success/fail were changed to make slice_index directly
      usable as required by the "O&" formatter.
      
      [GvR: shouldn't a similar patch be applied to unicodeobject.c?]
      c682140d
    • Guido van Rossum's avatar
      Trent Mick: · 20c6add7
      Guido van Rossum authored
      Change static slice_index() to extern _PyEval_SliceIndex() (with
      different return value interpretation: 0 for failure, 1 for success).
      20c6add7
    • Guido van Rossum's avatar
      Trent Mick: · 7c36ada1
      Guido van Rossum authored
      Add declaration of PyEval_SliceIndex().
      7c36ada1
    • Guido van Rossum's avatar
      Trent Mick: · 80dc16ba
      Guido van Rossum authored
      Changes the 'b', 'h', and 'i' formatters in PyArg_ParseTuple to raise an
      Overflow exception if they overflow (previously they just silently
      overflowed).
      
      Changes by Guido: always accept values [0..255] (in addition to
      [CHAR_MIN..CHAR_MAX]) for 'b' format; changed some spaces into tabs in
      other code.
      80dc16ba
    • Guido van Rossum's avatar
      07bd90e9
  2. 07 May, 2000 10 commits
  3. 06 May, 2000 6 commits
  4. 05 May, 2000 10 commits
  5. 04 May, 2000 5 commits
    • Guido van Rossum's avatar
      Fast NonRecursiveMutex support by Yakov Markovitch, markovitch@iso.ru, · 706262bd
      Guido van Rossum authored
      who wrote:
      
      Here's the new version of thread_nt.h.  More particular, there is a
      new version of thread lock that uses kernel object (e.g. semaphore)
      only in case of contention; in other case it simply uses interlocked
      functions, which are faster by the order of magnitude.  It doesn't
      make much difference without threads present, but as soon as thread
      machinery initialised and (mostly) the interpreter global lock is on,
      difference becomes tremendous.  I've included a small script, which
      initialises threads and launches pystone.  With original thread_nt.h,
      Pystone results with initialised threads are twofold worse then w/o
      threads.  With the new version, only 10% worse.  I have used this
      patch for about 6 months (with threaded and non-threaded
      applications).  It works remarkably well (though I'd desperately
      prefer Python was free-threaded; I hope, it will soon).
      706262bd
    • Guido van Rossum's avatar
      When the UTF-8 conversion to Unicode fails, return an 8-bit string · 69529ad0
      Guido van Rossum authored
      instead.  This seems more robust than returning an Unicode string with
      some unconverted charcters in it.
      
      This still doesn't support getting truly binary data out of Tcl, since
      we look for the trailing null byte; but the old (pre-Unicode) code did
      this too, so apparently there's no need.  (Plus, I really don't feel
      like finding out how Tcl deals with this in each version.)
      69529ad0
    • Guido van Rossum's avatar
      Mark Hammond should get his act into gear (his words :-). Zero length · 03e29f1a
      Guido van Rossum authored
      strings _are_ valid!
      03e29f1a
    • Jack Jansen's avatar
      301f3f6b
    • Guido van Rossum's avatar
      Two changes to improve (I hope) Unicode support. · 990f5c6c
      Guido van Rossum authored
      1. In Tcl 8.2 and later, use Tcl_NewUnicodeObj() when passing a Python
      Unicode object rather than going through UTF-8.  (This function
      doesn't exist in Tcl 8.1, so there the original UTF-8 code is still
      used; in Tcl 8.0 there is no support for Unicode.)  This assumes that
      Tcl_UniChar is the same thing as Py_UNICODE; a run-time error is
      issued if this is not the case.
      
      2. In Tcl 8.1 and later (i.e., whenever Tcl supports Unicode), when a
      string returned from Tcl contains bytes with the top bit set, we
      assume it is encoded in UTF-8, and decode it into a Unicode string
      object.
      
      Notes:
      
      - Passing Unicode strings to Tcl 8.0 does not do the right thing; this
      isn't worth fixing.
      
      - When passing an 8-bit string to Tcl 8.1 or later that has bytes with
      the top bit set, Tcl tries to interpret it as UTF-8; it seems to fall
      back on Latin-1 for non-UTF-8 bytes.  I'm not sure what to do about
      this besides telling the user to disambiguate such strings by
      converting them to Unicode (forcing the user to be explicit about the
      encoding).
      
      - Obviously it won't be possible to get binary data out of Tk this
      way.  Do we need that ability?  How to do it?
      990f5c6c