[issue18659] test_precision in test_format.py is not executed and has unused variable

2013-10-13 Thread Roundup Robot

Roundup Robot added the comment:

New changeset e7eed20f2da7 by Mark Dickinson in branch 'default':
Issue #18659: fix test_format test that wasn't being executed.  Thanks Vajrasky 
Kok for the patch.
http://hg.python.org/cpython/rev/e7eed20f2da7

--

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



[issue18659] test_precision in test_format.py is not executed and has unused variable

2013-10-13 Thread Mark Dickinson

Mark Dickinson added the comment:

Let's try again.  I'll close once the buildbots have run.

--

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



[issue18659] test_precision in test_format.py is not executed and has unused variable

2013-10-13 Thread Mark Dickinson

Mark Dickinson added the comment:

... and the buildbots with sizeof(int) == sizeof(size_t) == 4 still fail, of 
course.

http://hg.python.org/cpython/rev/d115dc671f52 fixes that by removing the check 
for the exact error message.  It should be enough to check for ValueError 
anyway.

--

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



[issue18659] test_precision in test_format.py is not executed and has unused variable

2013-10-13 Thread Mark Dickinson

Mark Dickinson added the comment:

Buildbots are happy now.  Closing.  Thank you!

--
resolution:  - fixed
status: open - closed

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



[issue18659] test_precision in test_format.py is not executed and has unused variable

2013-08-06 Thread Antoine Pitrou

Changes by Antoine Pitrou pit...@free.fr:


--
nosy: +eric.smith

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



[issue18659] test_precision in test_format.py is not executed and has unused variable

2013-08-05 Thread Vajrasky Kok

New submission from Vajrasky Kok:

There is test_precision in Lib/test_format.py which is not being unit tested.

Also, there is a unused variable inside test_precision.

Attached the patch to fix these problems.

--
components: Tests
files: test_precision.patch
keywords: patch
messages: 194459
nosy: vajrasky
priority: normal
severity: normal
status: open
title: test_precision in test_format.py is not executed and has unused variable
versions: Python 3.4
Added file: http://bugs.python.org/file31162/test_precision.patch

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



[issue18659] test_precision in test_format.py is not executed and has unused variable

2013-08-05 Thread Mark Dickinson

Mark Dickinson added the comment:

Patch looks good to me.

--
nosy: +mark.dickinson

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



[issue18659] test_precision in test_format.py is not executed and has unused variable

2013-08-05 Thread Roundup Robot

Roundup Robot added the comment:

New changeset cfd875bcbe41 by Mark Dickinson in branch 'default':
Issue #18659: fix test_format test that wasn't being executed.  Thanks Vajrasky 
Kok for the patch.
http://hg.python.org/cpython/rev/cfd875bcbe41

--
nosy: +python-dev

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



[issue18659] test_precision in test_format.py is not executed and has unused variable

2013-08-05 Thread Mark Dickinson

Mark Dickinson added the comment:

Fixed.  Thanks!

--
assignee:  - mark.dickinson
resolution:  - fixed
stage:  - committed/rejected
status: open - closed
type:  - behavior

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



[issue18659] test_precision in test_format.py is not executed and has unused variable

2013-08-05 Thread Mark Dickinson

Mark Dickinson added the comment:

Okay, that caused some buildbots to fail.  I'm going to back out the change 
until I have time to figure out what's going on.

--
resolution: fixed - 
status: closed - open

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



[issue18659] test_precision in test_format.py is not executed and has unused variable

2013-08-05 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 9bee1fd64ee6 by Mark Dickinson in branch 'default':
Issue #18659: Backed out changeset cfd875bcbe41 after buildbot failures.
http://hg.python.org/cpython/rev/9bee1fd64ee6

--

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



[issue18659] test_precision in test_format.py is not executed and has unused variable

2013-08-05 Thread Mark Dickinson

Mark Dickinson added the comment:

Sample buildbot output here:

http://buildbot.python.org/all/builders/x86%20RHEL%206%203.x/builds/2485/steps/test/logs/stdio

Relevant snippet:

test_precision (test.test_format.FormatTest) ... FAIL

==
FAIL: test_precision (test.test_format.FormatTest)
--
Traceback (most recent call last):
  File 
/home/buildbot/buildarea/3.x.coghlan-redhat/build/Lib/test/test_format.py, 
line 338, in test_precision
self.assertEqual(str(cm.exception), precision too big)
AssertionError: 'Too many decimal digits in format string' != 'precision too 
big'
- Too many decimal digits in format string
+ precision too big


--
Ran 5 tests in 0.011s

--

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



[issue18659] test_precision in test_format.py is not executed and has unused variable

2013-08-05 Thread Vajrasky Kok

Vajrasky Kok added the comment:

Let me help you to debug this issue.

ethan@amiau:~/Documents/code/python/cpython$ cat /tmp/a.py
import sys

INT_MAX = sys.maxsize
f = 1.2
format(f, .%sf % (INT_MAX + 1))
ethan@amiau:~/Documents/code/python/cpython$ ./python /tmp/a.py
Traceback (most recent call last):
  File /tmp/a.py, line 5, in module
format(f, .%sf % (INT_MAX + 1))
ValueError: Too many decimal digits in format string
ethan@amiau:~/Documents/code/python/cpython$ cat /tmp/b.py
import sys

INT_MAX = 2147483647
f = 1.2
format(f, .%sf % (INT_MAX + 1))
ethan@amiau:~/Documents/code/python/cpython$ ./python /tmp/b.py
Traceback (most recent call last):
  File /tmp/b.py, line 5, in module
format(f, .%sf % (INT_MAX + 1))
ValueError: precision too big

My question is whether we should have different exception message for these two 
cases?

--

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



[issue18659] test_precision in test_format.py is not executed and has unused variable

2013-08-05 Thread Vajrasky Kok

Vajrasky Kok added the comment:

For now, instead of hardcoding INT_MAX to 2147483647 in test, maybe we can use 
module:

 import IN
 IN.INT_MAX
2147483647

--

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



[issue18659] test_precision in test_format.py is not executed and has unused variable

2013-08-05 Thread Serhiy Storchaka

Changes by Serhiy Storchaka storch...@gmail.com:


--
nosy: +haypo, serhiy.storchaka

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



[issue18659] test_precision in test_format.py is not executed and has unused variable

2013-08-05 Thread STINNER Victor

STINNER Victor added the comment:

The IN module must not be used, it is hardcoded and never regenerated.

--

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



[issue18659] test_precision in test_format.py is not executed and has unused variable

2013-08-05 Thread STINNER Victor

STINNER Victor added the comment:

I added the test in the following commit:

changeset:   84266:ef5175d08e7e
branch:  3.3
parent:  84263:7ecca1a98220
user:Victor Stinner victor.stin...@gmail.com
date:Sun Jun 23 14:54:30 2013 +0200
files:   Lib/test/test_format.py Misc/NEWS Python/formatter_unicode.c
description:
Issue #18137: Detect integer overflow on precision in float.__format__() and
complex.__format__().

--

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



[issue18659] test_precision in test_format.py is not executed and has unused variable

2013-08-05 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

We have _testcapi.INT_MAX.

I guess different exceptions raised on 64-bit platform. First parser checks 
that a number can be represented as Py_ssize_t (i.e. = PY_SSIZE_T_MAX). Here 
Too many decimal digits in format string can be raised. Then precision passed 
to internal function which accepts int and checked to be = INT_MAX before cast 
to int. Here precision too big can be raised.

--

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



[issue18659] test_precision in test_format.py is not executed and has unused variable

2013-08-05 Thread Vajrasky Kok

Vajrasky Kok added the comment:

For the passers-by who want to help:

The precision too big exception is raised in Python/formatter_unicode.c line 
1168 and 1002.

The Too many decimal digits... exception is raised in 
Python/formatter_unicode.c line 71.

So the question is whether it is beneficial to differentiate the exception 
message. If not, we can change the exception message or test whether the digit 
passes INT_MAX first before checking with sys.max_size. If yes, we need to add 
test case for sys.max_size and use _testcapi.INT_MAX for current unit test case.

--

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



[issue18659] test_precision in test_format.py is not executed and has unused variable

2013-08-05 Thread Vajrasky Kok

Vajrasky Kok added the comment:

Okay, I guess the fix for this ticket should be kept simple.

If we want to merge the exception message or touch the code base or do 
something smarter than fixing the test, maybe we should create a separate 
ticket.

So I used Serhiy Storchaka's suggestion to use _testcapi.INT_MAX for the second 
patch.

--
Added file: http://bugs.python.org/file31164/test_precision_v2.patch

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



[issue18659] test_precision in test_format.py is not executed and has unused variable

2013-08-05 Thread STINNER Victor

STINNER Victor added the comment:

I realized that the new tests checking that precision larger with
INT_MAX fail should be marked as specific to CPython. The import of
_testcapi should be moved to a CPython specific test.

--

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



[issue18659] test_precision in test_format.py is not executed and has unused variable

2013-08-05 Thread Vajrasky Kok

Vajrasky Kok added the comment:

Attached the third patch. The importing _testcapi part was moved inside the 
test. Added cpython support only decorator for this test.

--
Added file: http://bugs.python.org/file31169/test_precision_v3.patch

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