[Python-Dev] fileobj.read(float): warning or error? (original) (raw)
Benjamin Peterson musiccomposition at gmail.com
Mon Jul 21 21:23:21 CEST 2008
- Previous message: [Python-Dev] fileobj.read(float): warning or error?
- Next message: [Python-Dev] fileobj.read(float): warning or error?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Mon, Jul 21, 2008 at 2:17 PM, Victor Stinner < victor.stinner at haypocalc.com> wrote:
Hi,
Since Python 2.4 (maybe 2.2 or older), fileobj.read(4.2) displays an error and works as fileobj.read(4). >>> i=open('/etc/issue') >>> i.read(4.2) main:1: DeprecationWarning: integer argument expected, got float
This warning is actually given by the argument parser when "i" gets a Python non-integer.
It should raises an error instead of a warning, it has no sense to read a partial byte :-) But that should breaks some applications?
This doesn't come into effect until 3.0.
Well, the real problem is os.urandom(4.2) which goes to an unlimited loop: while len(bytes) < n: bytes += read(urandomfd, n - len(bytes)) because read(0.2) works as read(0) :-/ Victor
Python-Dev mailing list Python-Dev at python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/musiccomposition%40gmail.com
-- Cheers, Benjamin Peterson "There's no place like 127.0.0.1." -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://mail.python.org/pipermail/python-dev/attachments/20080721/de60ff54/attachment.htm>
- Previous message: [Python-Dev] fileobj.read(float): warning or error?
- Next message: [Python-Dev] fileobj.read(float): warning or error?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]