This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Py30a5 float.is_integer() raises ValueError
Type: behavior Stage:
Components: Versions: Python 3.0
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: mark.dickinson Nosy List: holdenweb, mark, mark.dickinson
Priority: normal Keywords:

Created on 2008-05-09 11:28 by mark, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Messages (8)
msg66465 - (view) Author: Mark Summerfield (mark) * Date: 2008-05-09 11:28
The new method float.is_integer() introduced in Py30a5 behaves unexpectedly:

>>> x = 5.0
>>> x.as_integer_ratio()
(5, 1)
>>> x.is_integer()
Traceback (most recent call last):
  File "<pyshell#20>", line 1, in <module>
    x.is_integer()
ValueError: (11, 'Resource temporarily unavailable')

I was expecting True.
msg66468 - (view) Author: Mark Dickinson (mark.dickinson) * (Python committer) Date: 2008-05-09 13:47
Is this on Windows?  I can't reproduce it on OS X 10.5.2:

Python 3.0a5+ (py3k:62937M, May  9 2008, 09:32:27) 
[GCC 4.0.1 (Apple Inc. build 5465)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> x = 5.0
>>> x.is_integer()
True
msg66469 - (view) Author: Mark Dickinson (mark.dickinson) * (Python committer) Date: 2008-05-09 13:55
This should be fixed in r62938.  Mark, can you confirm?
msg66470 - (view) Author: Mark Dickinson (mark.dickinson) * (Python committer) Date: 2008-05-09 13:56
That should be r62939, not r62938.  Sorry.
msg66473 - (view) Author: Mark Summerfield (mark) * Date: 2008-05-09 14:33
On 2008-05-09, Mark Dickinson wrote:
> Mark Dickinson <dickinsm@gmail.com> added the comment:
>
> Is this on Windows?  I can't reproduce it on OS X 10.5.2:
>
> Python 3.0a5+ (py3k:62937M, May  9 2008, 09:32:27)
> [GCC 4.0.1 (Apple Inc. build 5465)] on darwin
> Type "help", "copyright", "credits" or "license" for more information.
>
> >>> x = 5.0
> >>> x.is_integer()
>
> True

I'm on Linux:

'3.0a5 (r30a5:62856, May  9 2008, 11:23:06) \n[GCC 4.1.2 20070925 (Red Hat 
4.1.2-33)]'
>>> (5.).as_integer_ratio()
(5, 1)
>>> (5.).is_integer()
Traceback (most recent call last):
  File "<pyshell#99>", line 1, in <module>
    (5.).is_integer()
ValueError: (11, 'Resource temporarily unavailable')

(I can't test on Windows because Py30a5 isn't available for it yet.)
msg66476 - (view) Author: Mark Summerfield (mark) * Date: 2008-05-09 14:53
OK, I've just built against your fix and it works fine now!

Python 3.0a5+ (py3k:60668:62940, May  9 2008, 15:48:15)
[GCC 4.1.2 20070925 (Red Hat 4.1.2-33)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> (5.).as_integer_ratio()
(5, 1)
>>> (5.).is_integer()
True
msg66481 - (view) Author: Mark Dickinson (mark.dickinson) * (Python committer) Date: 2008-05-09 16:19
Thanks, Mark.

I've also backported the fix to the trunk in r62943.
msg147068 - (view) Author: Steve Holden (holdenweb) * (Python committer) Date: 2011-11-05 04:40
ValueError: (11, 'Resource temporarily unavailable') looks to me like a Cygwin error relating to Windows' DLLs and the difficulty of mapping them to unique memory locations. I very much doubt it's a real issue with Python, so closing the issue appears to be the correct decision in the absence of further contradictory information from the OP.
History
Date User Action Args
2022-04-11 14:56:34adminsetgithub: 47050
2011-11-05 04:40:45holdenwebsetnosy: + holdenweb
messages: + msg147068
2008-05-09 16:19:20mark.dickinsonsetstatus: open -> closed
resolution: fixed
messages: + msg66481
2008-05-09 14:53:15marksetmessages: + msg66476
2008-05-09 14:33:42marksetmessages: + msg66473
2008-05-09 14:02:11mark.dickinsonsetpriority: normal
assignee: mark.dickinson
2008-05-09 13:56:02mark.dickinsonsetmessages: + msg66470
2008-05-09 13:55:11mark.dickinsonsetmessages: + msg66469
2008-05-09 13:47:08mark.dickinsonsetnosy: + mark.dickinson
messages: + msg66468
2008-05-09 11:28:49markcreate