[Patches] [ python-Patches-1067760 ] fix for 1067728: Better handling of float arguments to seek
SourceForge.net
noreply at sourceforge.net
Sun Nov 12 19:26:20 CET 2006
Patches item #1067760, was opened at 2004-11-17 02:28
Message generated for change (Comment added) made by loewis
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1067760&group_id=5470
Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: None
Group: None
>Status: Closed
>Resolution: Rejected
Priority: 5
Private: No
Submitted By: Robert Church (churchr)
Assigned to: Nobody/Anonymous (nobody)
Summary: fix for 1067728: Better handling of float arguments to seek
Initial Comment:
Instead of converting all float arguments to ints, this
first attempts to
convert the argument to a PyLong, and then the old
conversion code takes over.
The upshot is that the limit of floating point
arguments to seek() is raised from (2 ** 32) - 1 to
somewhere above (2 ** 62).
Perhaps a better way to handle this would be to not
accept floating point arguments to seek().
----------------------------------------------------------------------
>Comment By: Martin v. Löwis (loewis)
Date: 2006-11-12 19:26
Message:
Logged In: YES
user_id=21627
After discussion on python-dev, I committed r52738, which
raises a deprecation warning when a float is passed as seek
argument; the meaning of doing so remains unchanged. The
original patch is thus rejected.
----------------------------------------------------------------------
Comment By: Martin v. Löwis (loewis)
Date: 2006-11-12 11:56
Message:
Logged In: YES
user_id=21627
I'm attaching a different fix, which uses the index API to
obtain the offset.
As a consequence, passing a float becomes an outright error.
----------------------------------------------------------------------
Comment By: Oren Tirosh (orenti)
Date: 2005-03-29 21:07
Message:
Logged In: YES
user_id=562624
The actual usable range of a float is 2**53, not 2**62.
Above this the resolution drops below 1 byte. It's enough
for some 9000 terabytes.
----------------------------------------------------------------------
Comment By: Titus Brown (titus)
Date: 2004-12-29 09:00
Message:
Logged In: YES
user_id=23486
Updated patch to check return value of PyErr_Warn in case 'python -W
error' is specified. No other objections raised on python-dev...
revised patch still at
http://issola.caltech.edu/~t/transfer/patch-1067760-seekwarn.diff
----------------------------------------------------------------------
Comment By: Titus Brown (titus)
Date: 2004-12-23 09:29
Message:
Logged In: YES
user_id=23486
Bob Ippolito pointed out that nowadays float-->int conversion of
arguments is deprecated; a DeprecationWarning wasn't being raised
because conversion was done manually in seek. Patch to fix this
at
http://issola.caltech.edu/~t/transfer/patch-1067760-seekwarn.diff
Linux RH 9.0 works, regression tests run w/o problem.
The patch is against the current HEAD but can probably be backported w/
o a problem.
----------------------------------------------------------------------
Comment By: Titus Brown (titus)
Date: 2004-12-19 10:38
Message:
Logged In: YES
user_id=23486
Sorry, I should add: patch works against head on Linux RH 9.0 (and
should work everywhere). Behavior tested with a script.
----------------------------------------------------------------------
Comment By: Titus Brown (titus)
Date: 2004-12-19 10:37
Message:
Logged In: YES
user_id=23486
The patch works against HEAD; updated for line numbers (there's a very
similar set of line elsewhere in the file):
http://issola.caltech.edu/~t/transfer/patch-1067760-seek.diff
rhettinger thought the current behavior was reasonable (see bug
1067728). I'm not qualified to comment ;) but it seems odd that floats
would have drastically different limits than longs. This looks like a
reasonable compromise IMO.
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1067760&group_id=5470
More information about the Patches
mailing list