[issue5080] PyArg_Parse* should raise TypeError for float parsed with integer format

2010-01-01 Thread Mark Dickinson

Mark Dickinson dicki...@gmail.com added the comment:

Applied to trunk in r77218.  The DeprecationWarning for the 'L' format 
needs to be merged to py3k.

--
versions: +Python 3.2

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue5080
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue5080] PyArg_Parse* should raise TypeError for float parsed with integer format

2010-01-01 Thread Mark Dickinson

Mark Dickinson dicki...@gmail.com added the comment:

Merged relevant bits to py3k in r77220.

--
resolution:  - fixed
stage: needs patch - committed/rejected
status: open - closed

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue5080
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue5080] PyArg_Parse* should raise TypeError for float parsed with integer format

2009-12-21 Thread Mark Dickinson

Mark Dickinson dicki...@gmail.com added the comment:

Here's a patch that makes the DeprecationWarning a TypeError, and adds a 
new DeprecationWarning for the 'L' format.

--
keywords: +patch
Added file: http://bugs.python.org/file15649/issue5080.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue5080
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue5080] PyArg_Parse* should raise TypeError for float parsed with integer format

2009-12-20 Thread Mark Dickinson

Mark Dickinson dicki...@gmail.com added the comment:

Hmm.  That's unfortunate:  for argument type in 'bBHiIlkKn', an attempt to 
pass a float results in a DeprecationWarning.  For type 'L', there's no 
DeprecationWarning, and the float is silently truncated.  So for type 'L' 
I guess we still have to go through a round of DeprecationWarning.

I'm not sure what 'h' does;  there don't appear to be any tests for it, 
currently.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue5080
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue5080] PyArg_Parse* should raise TypeError for float parsed with integer format

2009-12-20 Thread Mark Dickinson

Mark Dickinson dicki...@gmail.com added the comment:

'h' also produces a DeprecationWarning;  I just added the missing tests 
for it in r76930 (trunk) and r76931 (py3k).

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue5080
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue5080] PyArg_Parse* should raise TypeError for float parsed with integer format

2009-11-20 Thread Antoine Pitrou

Antoine Pitrou pit...@free.fr added the comment:

I think this should be signalled on the mailing-list, by the way. I
expect everyone to agree of course :)

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue5080
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue5080] PyArg_Parse* should raise TypeError for float parsed with integer format

2009-11-20 Thread Mark Dickinson

Mark Dickinson dicki...@gmail.com added the comment:

Yes, checking with python-dev sounds sensible.  I'll wait until there's
a working patch, though.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue5080
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue5080] PyArg_Parse* should raise TypeError for float parsed with integer format

2009-11-19 Thread Antoine Pitrou

Antoine Pitrou pit...@free.fr added the comment:

+1 for a TypeError too.

--
nosy: +pitrou
priority:  - normal
stage:  - needs patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue5080
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue5080] PyArg_Parse* should raise TypeError for float parsed with integer format

2009-11-19 Thread Ezio Melotti

Changes by Ezio Melotti ezio.melo...@gmail.com:


--
nosy: +ezio.melotti

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue5080
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue5080] PyArg_Parse* should raise TypeError for float parsed with integer format

2009-11-18 Thread Mark Dickinson

Changes by Mark Dickinson dicki...@gmail.com:


--
assignee:  - mark.dickinson

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue5080
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue5080] PyArg_Parse* should raise TypeError for float parsed with integer format

2009-09-20 Thread Marcin Wider

Changes by Marcin Wider mwi...@gmail.com:


--
nosy: +marcin.wider

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue5080
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue5080] PyArg_Parse* should raise TypeError for float parsed with integer format

2009-09-07 Thread STINNER Victor

STINNER Victor victor.stin...@haypocalc.com added the comment:

+10. It would fix the os.urandom(1.2) bug. On Linux, os.urandom() displays
the following warnings and then go into an unlimited loop...

/usr/lib/python2.5/os.py:734: DeprecationWarning: integer argument expected,
got float
  bytes += read(_urandomfd, n - len(bytes))

read(1.2 - 1) ~ read(0.2) ~ read(0)...

Tolerate float as integers introduces subtle bugs like byte/unicode bugs...

--
nosy: +haypo

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue5080
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue5080] PyArg_Parse* should raise TypeError for float parsed with integer format

2009-09-04 Thread Georg Brandl

Georg Brandl ge...@python.org added the comment:

+1.

--
nosy: +georg.brandl

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue5080
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue5080] PyArg_Parse* should raise TypeError for float parsed with integer format

2009-01-27 Thread Mark Dickinson

New submission from Mark Dickinson dicki...@gmail.com:

Since Python 2.3, PyArg_ParseTuple and friends give a DeprecationWarning
for floating-point arguments where integers are expected.  From
http://www.python.org/download/releases/2.3/NEWS.txt:

- The PyArg_Parse functions now issue a DeprecationWarning if a float
  argument is provided when an integer is specified (this affects the 'b',
  'B', 'h', 'H', 'i', and 'l' codes).  Future versions of Python will
  raise a TypeError.

Can we turn that DeprecationWarning into a TypeError for 2.7?  (It's
already a TypeError in 3.x.) I'd like to see things like 'range(-0.3)'
and 'itertools.combinations(range(3), 5.1)' raise TypeError.

N.B. The relevant format codes in 2.7 include 'I' and 'n' in addition to
the six codes listed above.

--
messages: 80649
nosy: marketdickinson
severity: normal
status: open
title: PyArg_Parse* should raise TypeError for float parsed with integer format
type: behavior
versions: Python 2.7

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue5080
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com