[issue16490] inspect.getargspec() and inspect.getcallargs() don't work for builtins

2012-12-04 Thread David Villa Alises

David Villa Alises added the comment:

What about something like gobject.introspection?
https://live.gnome.org/GObjectIntrospection/

--

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



[issue13876] Sporadic failure in test_socket: testRecvmsgEOF

2012-12-04 Thread STINNER Victor

Changes by STINNER Victor victor.stin...@gmail.com:


--
title: Sporadic failure in test_socket - Sporadic failure in test_socket: 
testRecvmsgEOF

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



[issue16604] Sporadic .test_threaded_import failure: test_parallel_meta_path on Windows 7

2012-12-04 Thread STINNER Victor

New submission from STINNER Victor:

http://buildbot.python.org/all/builders/x86%20Windows7%203.x/builds/5975/steps/test/logs/stdio

==
FAIL: test_parallel_meta_path (test.test_threaded_import.ThreadedImportTests)
--
Traceback (most recent call last):
  File 
D:\cygwin\home\db3l\buildarea\3.x.bolen-windows7\build\lib\test\test_threaded_import.py,
 line 133, in test_parallel_meta_path
self.assertEqual(finder.x, finder.numcalls)
AssertionError: 93 != 94

--
components: Tests
messages: 176880
nosy: brett.cannon, haypo, pitrou
priority: normal
severity: normal
status: open
title: Sporadic .test_threaded_import failure: test_parallel_meta_path on 
Windows 7
versions: Python 3.4

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



[issue16603] Sporadic test_socket failures: testFDPassCMSG_SPACE on Mac OS X

2012-12-04 Thread STINNER Victor

New submission from STINNER Victor:

http://buildbot.python.org/all/builders/AMD64%20Mountain%20Lion%20%5BSB%5D%203.x/builds/523/steps/test/logs/stdio

==
ERROR: testFDPassCMSG_SPACE (test.test_socket.RecvmsgIntoSCMRightsStreamTest)
--
Traceback (most recent call last):
  File 
/Volumes/bay2/buildslave/cpython/3.x.snakebite-mountainlion-amd64/build/Lib/test/test_socket.py,
 line 2502, in testFDPassCMSG_SPACE
socket.CMSG_SPACE(4 * SIZEOF_INT)))
  File 
/Volumes/bay2/buildslave/cpython/3.x.snakebite-mountainlion-amd64/build/Lib/test/test_socket.py,
 line 1786, in doRecvmsg
result = sock.recvmsg_into([buf], *args)
socket.timeout: timed out

==
ERROR: testFDPassCMSG_SPACE (test.test_socket.RecvmsgIntoSCMRightsStreamTest)
--
Traceback (most recent call last):
  File 
/Volumes/bay2/buildslave/cpython/3.x.snakebite-mountainlion-amd64/build/Lib/test/test_socket.py,
 line 232, in _tearDown
raise exc
  File 
/Volumes/bay2/buildslave/cpython/3.x.snakebite-mountainlion-amd64/build/Lib/test/test_socket.py,
 line 244, in clientRun
test_func()
  File 
/Volumes/bay2/buildslave/cpython/3.x.snakebite-mountainlion-amd64/build/Lib/test/test_socket.py,
 line 2506, in _testFDPassCMSG_SPACE
self.createAndSendFDs(4)
  File 
/Volumes/bay2/buildslave/cpython/3.x.snakebite-mountainlion-amd64/build/Lib/test/test_socket.py,
 line 2445, in createAndSendFDs
array.array(i, self.newFDs(n)))]),
  File 
/Volumes/bay2/buildslave/cpython/3.x.snakebite-mountainlion-amd64/build/Lib/test/test_socket.py,
 line 1687, in sendmsgToServer
*(args + self.sendmsg_to_server_defaults[len(args):]))
BrokenPipeError: [Errno 32] Broken pipe

--

See also issue #13876. I copied the nosy list of this issue.

--
components: Tests
messages: 176879
nosy: giampaolo.rodola, haypo, nadeem.vawda, neologix, pitrou, rosslagerwall
priority: normal
severity: normal
status: open
title: Sporadic test_socket failures: testFDPassCMSG_SPACE on Mac OS X
versions: Python 3.4

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



[issue15745] Numerous utime ns tests fail on FreeBSD w/ ZFS (update: and NetBSD w/ FFS, Solaris w/ UFS)

2012-12-04 Thread STINNER Victor

STINNER Victor added the comment:

I didn't read the whole issue, but the following code makes sense.

+try:
+import posix
+except ImportError:
+# Windows has nanosecond utime resolution.
+UTIME_EPSILON = 2e-9
+else:
+import sysconfig
+if 'HAVE_UTIMENSAT' in posix._have_functions:
+UTIME_EPSILON = 2e-9
+elif 'HAVE_UTIMES' in sysconfig.get_config_vars():
+UTIME_EPSILON = 2e-6
+else:
+UTIME_EPSILON = 1.0

Windows doesn't really have nanosecond resolution: the common Windows unit is 
100 ns. See GetFileInformationByHandle() documentation: its 
BY_HANDLE_FILE_INFORMATION  structure has FILETIME fields, and FILETIME uses 
the 100 ns unit.

We might expose this unit (UTIME_EPSILON, in the os module maybe?) as we done 
for time function with time.get_clock_info().

--
nosy: +haypo

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



[issue16605] test_posix.test_fs_holes() fails on FreeBSD 9.0

2012-12-04 Thread STINNER Victor

New submission from STINNER Victor:

http://buildbot.python.org/all/builders/AMD64%20FreeBSD%209.0%20dtrace%203.x/builds/761/steps/test/logs/stdio



==
FAIL: test_fs_holes (test.test_posix.PosixTester)
--
Traceback (most recent call last):
  File 
/usr/home/buildbot/python/3.x.koobs-freebsd/build/Lib/test/test_posix.py, 
line 1003, in test_fs_holes
self.assertLessEqual(size, os.lseek(fno, i, os.SEEK_HOLE))
AssertionError: 5 not less than or equal to 0


--

See also the issue #10142 which added this feature. I copied the nosy list of 
this issue.

--
components: Tests
messages: 176882
nosy: aklauer, amaury.forgeotdarc, benjamin.peterson, georg.brandl, haypo, 
jcea, loewis, pitrou, python-dev, rhettinger, skrah, terry.reedy
priority: normal
severity: normal
status: open
title: test_posix.test_fs_holes() fails on FreeBSD 9.0
versions: Python 3.4

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



[issue15955] gzip, bz2, lzma: add option to limit output size

2012-12-04 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

 # Using zlib's interface
 while not d.eof:
 compressed = d.unconsumed_tail or f.read(8192)
 if not compressed:
 raise ValueError('End-of-stream marker not found')
 output = d.decompress(compressed, 8192)
 # process output

This is not usable with bzip2. Bzip2 uses large block size and unconsumed_tail 
can be non empty but decompress() will return b''. With zlib you possible can 
see the same effect on some input when read by one byte.

 A related, but orthogonal proposal: We might want to make unconsumed_tail
 a memoryview (provided the input data is know to be immutable), to avoid
 creating an unnecessary copy of the data.

It looks interesting. However the data should be copied anyway if the input 
data is not a bytes object.

--

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



[issue16275] test_ctypes fails on Solaris 10 SPARC 2.7 (nitrogen/s10) (Sun C compiler)

2012-12-04 Thread STINNER Victor

Changes by STINNER Victor victor.stin...@gmail.com:


--
nosy: +haypo

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



[issue15747] Various chflags tests failing on FreeBSD/ZFS

2012-12-04 Thread koobs

koobs added the comment:

I think this needs a backport to 2.7, my FreeBSD buildbots are failing on that 
branch since moving buildbots home directory onto a ZFS fs:

==
ERROR: test_chflags (test.test_posix.PosixTester)
--
Traceback (most recent call last):
  File 
/usr/home/buildbot/python/2.7.koobs-freebsd/build/Lib/test/test_posix.py, 
line 350, in test_chflags
self._test_chflags_regular_file(posix.chflags, test_support.TESTFN)
  File 
/usr/home/buildbot/python/2.7.koobs-freebsd/build/Lib/test/test_posix.py, 
line 337, in _test_chflags_regular_file
chflags_func(target_file, st.st_flags | stat.UF_IMMUTABLE)
OSError: [Errno 45] Operation not supported: '@test_38161_tmp'

==
ERROR: test_lchflags_regular_file (test.test_posix.PosixTester)
--
Traceback (most recent call last):
  File 
/usr/home/buildbot/python/2.7.koobs-freebsd/build/Lib/test/test_posix.py, 
line 354, in test_lchflags_regular_file
self._test_chflags_regular_file(posix.lchflags, test_support.TESTFN)
  File 
/usr/home/buildbot/python/2.7.koobs-freebsd/build/Lib/test/test_posix.py, 
line 337, in _test_chflags_regular_file
chflags_func(target_file, st.st_flags | stat.UF_IMMUTABLE)
OSError: [Errno 45] Operation not supported: '@test_38161_tmp'

--
Ran 38 tests in 0.455s

I won't link the buildbot log url here since it will not be valid forever.

--
nosy: +koobs

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



[issue15747] Various chflags tests failing on FreeBSD/ZFS

2012-12-04 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 4beb1630544f by Victor Stinner in branch '2.7':
Issue #15747: skip chflags UF_IMMUTABLE tests if EOPNOTSUPP is raised.
http://hg.python.org/cpython/rev/4beb1630544f

--

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



[issue16604] Sporadic .test_threaded_import failure: test_parallel_meta_path on Windows 7

2012-12-04 Thread Antoine Pitrou

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


--
resolution:  - duplicate
status: open - closed
superseder:  - test_circular_imports() of test_threaded_import fails on 
FreeBSD 9.0

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



[issue12268] file readline, readlines readall methods can lose data on EINTR

2012-12-04 Thread Antoine Pitrou

Antoine Pitrou added the comment:

Is there anything left to do here?

--

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



[issue16604] Sporadic .test_threaded_import failure: test_parallel_meta_path on Windows 7

2012-12-04 Thread STINNER Victor

STINNER Victor added the comment:

 status: open - closed
 superseder: test_circular_imports() of test_threaded_import fails on FreeBSD 
 9.0
 resolution: duplicate

Oh strange, I failed to find this issue (even if I'm the author of its first 
message!). I forgot maybe to search test_parallel_meta_path. Thanks Antoine 
:-)

--

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



[issue15599] test_circular_imports() of test_threaded_import fails on FreeBSD 9.0

2012-12-04 Thread koobs

Changes by koobs koobs.free...@gmail.com:


--
nosy: +koobs

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



[issue15747] Various chflags tests failing on FreeBSD/ZFS

2012-12-04 Thread koobs

koobs added the comment:

Confirming successful 2.7 build post Victors commit on both buildbots (standard 
 clang)

--

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



[issue16605] test_posix.test_fs_holes() fails on FreeBSD 9.0

2012-12-04 Thread koobs

Changes by koobs koobs.free...@gmail.com:


--
nosy: +koobs

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



[issue14803] Add feature to allow code execution prior to __main__ invocation

2012-12-04 Thread Kristján Valur Jónsson

Kristján Valur Jónsson added the comment:

offtopic:  
Noticed something pretty annoying:
If a package uses relative imports, e.g.
from . import sibling_module,
then it is impossible to run that package as a script, even with the __main__ 
trick.

--

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



[issue10040] GZipFile failure on large files

2012-12-04 Thread Serhiy Storchaka

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


--
status: open - pending

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



[issue16504] IDLE - fatal error when opening a file with certain tokenizing errors

2012-12-04 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

LGTM.

--
nosy: +kbk
stage:  - commit review

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



[issue6584] gzip module has no custom exception

2012-12-04 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

read32() should raise BadGzipFile when less than 4 bytes read. Also you should 
introduce read8() function which raises BadGzipFile when less than 1 byte read.

See also issue4844 and issue14315 for zipfile.

--
stage: commit review - needs patch

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



[issue16602] weakref can return an object with 0 refcount

2012-12-04 Thread Antoine Pitrou

Antoine Pitrou added the comment:

The easy fix would probably be to return Py_None when the weakref'ed object has 
a zero refcount.

--

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



[issue16444] Use support.TESTFN_UNDECODABLE on UNIX

2012-12-04 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Ping.

--
stage:  - patch review
type:  - enhancement

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



[issue8865] select.poll is not thread safe

2012-12-04 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

As I see, Christian's contributor agreement already confirmed. Let's go ahead.

--

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



[issue8865] select.poll is not thread safe

2012-12-04 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Christian, it would be nice if you write the tests.

--

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



[issue15955] gzip, bz2, lzma: add option to limit output size

2012-12-04 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Actually it should be:

# Using zlib's interface
while not d.eof:
output = d.decompress(d.unconsumed_tail, 8192)
while not output and not d.eof:
compressed = f.read(8192)
if not compressed:
raise ValueError('End-of-stream marker not found')
output = d.decompress(d.unconsumed_tail + compressed, 8192)
# process output

Note that you should use d.unconsumed_tail + compressed as input, and therefore 
do an unnecessary copy of the data.

Without explicit unconsumed_tail you can write input data in the internal 
mutable buffer, it will be more effective for large buffer (handreds of KB) and 
small input chunks (several KB).

--

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



[issue12457] type() returns incorrect type for nested classes

2012-12-04 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Should it be closed?

--

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



[issue16596] Skip stack unwinding when next, until and return pdb commands executed in generator context

2012-12-04 Thread Andrew Svetlov

Andrew Svetlov added the comment:

Rename skip_yield to skipyield

--
Added file: http://bugs.python.org/file28205/issue16596_v2.diff

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



[issue2193] Cookie Colon Name Bug

2012-12-04 Thread Eyal Lewisohn

Eyal Lewisohn added the comment:

just wanted to note that I agree with BM's comment and that I had to change 
LegalChars myself to include the slash '/' in order for my application to work 
properly.

--
nosy: +Eyal.Lewisohn

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



[issue16599] unittest: Access test result from tearDown

2012-12-04 Thread Antoine Pitrou

Antoine Pitrou added the comment:

Another solution would be to add a new method named addSuccessCleanup.

--
nosy: +michael.foord, pitrou

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



[issue16599] unittest: Access test result from tearDown

2012-12-04 Thread anatoly techtonik

anatoly techtonik added the comment:

Or call tearDown() with some parameter that it's able to retrieve.

--

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



[issue12457] type() returns incorrect type for nested classes

2012-12-04 Thread Antoine Pitrou

Antoine Pitrou added the comment:

The naming confusion was fixed in 3.3:
http://docs.python.org/dev/whatsnew/3.3.html#pep-3155-qualified-name-for-classes-and-functions

As for pickle, it indeed depends on protocol version 4 as proposed in PEP 3154.

--
nosy: +pitrou
stage: needs patch - 
status: open - closed

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



[issue12457] type() returns incorrect type for nested classes

2012-12-04 Thread Daniel Urban

Daniel Urban added the comment:

I don't know what is the protocol for duplicates when the superseder is still 
open. If they should be closed, then I think yes, this should be closed.

--

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



[issue16599] unittest: Access test result from tearDown

2012-12-04 Thread Michael Foord

Michael Foord added the comment:

Changing the signature of tearDown would be backwards incompatible. 
addSuccessCleanup is an interesting idea - cleanup functions that are only 
executed if the test passes. (What to do if a cleanup function raises an 
exception though? And when do these get executed - before or after standard 
cleanups.) 

In general cleanup functions are an improvement on tearDown.

--
assignee:  - michael.foord

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



[issue16541] tk_setPalette doesn't accept keyword parameters

2012-12-04 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Yes, doing list(kw.items()) is safe now. Here is a patch.

--
keywords: +patch
stage: needs patch - patch review
Added file: http://bugs.python.org/file28206/tkinter_tk_setPalette.patch

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



[issue16599] unittest: Access test result from tearDown

2012-12-04 Thread anatoly techtonik

anatoly techtonik added the comment:

addSuccessCleanup is not the best name as it assumes that some cleanup is being 
added, which is confusing.

Additional consideration that the need to leave the test results is a user run 
time preference, which may only be actual when debugging or working on the 
particular test.

--

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



[issue16606] hashlib memory leak

2012-12-04 Thread Thorsten Simons

New submission from Thorsten Simons:

hashlib seems to leak memory when used on a Linux box (whereas the same works 
fine when run under Windows 7) (tested w/ Python 3.2.1 and 3.2.3)

snip file mem.py
import hashlib

#file = 'B:\\video\\TEST\\01_file_10G'
file = '/video/TEST/01_file_10G'

myhash = hashlib.sha256()

with open(file, rb) as f:
for buffer in f:
myhash.update(buffer)

print('hash =', myhash.hexdigest())
snip

On Windows, 'python3 mem.py' occupies roundabout 7 MB memory,
on Linux (OpenSuse 12.2), it quickly acquires all available memory, then all 
swap, than get's killed.

--
components: Library (Lib)
messages: 176907
nosy: Thorsten.Simons
priority: normal
severity: normal
status: open
title: hashlib memory leak
type: resource usage
versions: Python 3.2

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



[issue16599] unittest: Access test result from tearDown

2012-12-04 Thread Michael Foord

Michael Foord added the comment:

Well, addSuccessCleanup *would* be an api for adding a cleanup - one that is 
only called on success. So the cleanup is skipped on failure or error, which 
was the original use case.

Additional consideration that the need to leave the test results is a user run 
time preference, which may only be actual when debugging or working on the 
particular test.

I can't parse that sentence, can you rephrase please. (Did you mean another 
word other than leave, and I don't understand may only be actual.)

--

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



[issue16599] unittest: Access test result from tearDown

2012-12-04 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Why do you need it? You can add a test result depended code at the end of the 
test method. For example set a special flag

def setUp(self):
self.success = False

def tearDown(self):
if not self.success:
...

def test_xxx(self):
...
self.success = True

I don't think any special support in stdlib needed.

--
nosy: +serhiy.storchaka

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



[issue16445] SEGFAULT when deleting Exception.message

2012-12-04 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Victor, I will be glad to review any related patches, but please split the 
patch on several patches, from most undoubted to more sophisticated patterns.

--

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



[issue16606] hashlib memory leak

2012-12-04 Thread Thorsten Simons

Thorsten Simons added the comment:

forgot to say that this is about huge files (tested w/ a 10GB file)

--

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



[issue16606] hashlib memory leak

2012-12-04 Thread Antoine Pitrou

Antoine Pitrou added the comment:

What happens if you replace iteration with something like:

with open(file, rb) as f:
while True:
data = f.read(16384)
if not data:
break
myhash.update(data)

--
nosy: +pitrou

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



[issue16606] hashlib memory leak

2012-12-04 Thread Thorsten Simons

Thorsten Simons added the comment:

Antoine,

this was of great help - no memory leaking anymore...
So, I asume that somewhere in the iteration the read file is buffered?
Does that make sense or - was it the developers intention?

Thank you,
Regards, Thorsten

--
resolution:  - works for me

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



[issue16602] weakref can return an object with 0 refcount

2012-12-04 Thread Eugene Toder

Eugene Toder added the comment:

Agreed. That's what I've put in my code as a work around.

--

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



[issue14803] Add feature to allow code execution prior to __main__ invocation

2012-12-04 Thread Nick Coghlan

Nick Coghlan added the comment:

Why post that complaint here? If there's a case where__main__.__package__
isn't being set correctly by -m, file a separate bug.

--

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



[issue16606] hashlib memory leak

2012-12-04 Thread Antoine Pitrou

Antoine Pitrou added the comment:

Well, it's not immediately obvious what the exact problem could be. Are you 
reading a regular text file? Or is it a binary file where maybe the '\n' 
character appears very rarely?

If it can be reproduced with a smaller file, perhaps you can attach it 
somewhere.

--

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



[issue16507] Patch selectmodule.c to support WSAPoll on Windows

2012-12-04 Thread Richard Oudkerk

Richard Oudkerk added the comment:

Here is a version which loads WSAPoll at runtime.  Still no tests or docs.

--
Added file: http://bugs.python.org/file28207/runtime_wsapoll.patch

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



[issue16606] hashlib memory leak

2012-12-04 Thread Lukas Lueg

Lukas Lueg added the comment:

Thorsten, the problem is that you are using line-based syntax. The code 'for 
buffer in f:' will read one line per iteration and put it to 'buffer'; for a 
file opened in binary mode, the iterator will always seek to the next b'\n'. 
Depending on the content of the file, python may have to read tons of data 
before the next b'\n' appears.

--
nosy: +ebfe

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



[issue16599] unittest: Access test result from tearDown

2012-12-04 Thread anatoly techtonik

anatoly techtonik added the comment:

On Tue, Dec 4, 2012 at 3:43 PM, Michael Foord rep...@bugs.python.orgwrote:


 Well, addSuccessCleanup *would* be an api for adding a cleanup - one that
 is only called on success. So the cleanup is skipped on failure or error,
 which was the original use case.


I thought it will be a callback method.

 Additional consideration that the need to leave the test results is a
 user run time preference, which may only be actual when debugging or
 working on the particular test.

 I can't parse that sentence, can you rephrase please. (Did you mean
 another word other than leave, and I don't understand may only be
 actual.)


Most of the time users need to clean up mess. It mostly during debug
session you need to leave it. So the workaround should be easy and obvious
to enable and disable. Serhiy's method is good. I was too busy with other
stuff to think about it. Thanks.

--

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



[issue16606] hashlib memory leak

2012-12-04 Thread Thorsten Simons

Thorsten Simons added the comment:

OK, learned something again - should have known this :-(

Thank you!

Thorsten

--

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



[issue15031] Split .pyc parsing from module loading

2012-12-04 Thread Brett Cannon

Brett Cannon added the comment:

So we have IronPython who has their own format, Jython who has their own format 
*and* .pyc files (which would screw with __cached__ so I assume they won't try 
to use both at the same time), PyPy which use .pyc files, and CPython which 
uses .pyc files. My motivation for exposing this publicly is quickly dwindling, 
although factoring it out for private use is fine.

--

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



[issue16605] test_posix.test_fs_holes() fails on FreeBSD 9.0

2012-12-04 Thread Jesús Cea Avión

Jesús Cea Avión added the comment:

This is likely a FreeBSD 9 kernel bug.

Using this code under python 3, on a ZFS filesystem:


import os
f = open(test, wb)
f.write(bhello)
f.flush()
print(os.lseek(f.fileno(), 3, os.SEEK_HOLE))


Under Solaris, the reply is 5, pointing to the end of the file.

Under current FreeBSD 9, it replies 3. In fact, it replies back current file 
offset.

This is wrong according to lseek man:


[...]
   o  If whence is SEEK_HOLE, the **offset of the start of  the**
  **next  hole greater than or equal to the supplied offset**
  **is returned**. The definition of a hole is provided  near
  the end of the DESCRIPTION.
[...]
 A hole is defined as a contiguous  range  of  bytes  in  a
 file,  all  having the value of zero, but not all zeros in a
 file are guaranteed to be represented as holes returned with
 SEEK_HOLE. Filesystems are allowed to expose ranges of zeros
 with SEEK_HOLE, but not required to.  Applications  can  use
 SEEK_HOLE  to  optimise  their behavior for ranges of zeros,
 but must not depend on it to find all such ranges in a file.
 **The  existence  of  a  hole  at the end of every data region**
 **allows for easy programming and implies that a virtual  hole**
 **exists  at  the  end  of  the  file.** Applications should use
 fpathconf(_PC_MIN_HOLE_SIZE) or  pathconf(_PC_MIN_HOLE_SIZE)
 to  determine if a filesystem supports SEEK_HOLE. See fpath-
 conf(2).

 **For filesystems that do not supply information about  holes,
 the file will be represented as one entire data region.**


So FreeBSD has two bugs:

1. It is giving an error if the filesystem doesn't support holes. The correct 
behavious SHOULD report a hole at the end of the file.

2. In a file without holes, on a filesystem supporting holes (ZFS), FreeBSD 9 
is returning current file offset for SEEK_HOLE, instead of reporting offset = 
filesize. Consistent with the virtual hole at the end of the file.

koobs, can you report to FreeBSD guys?.

In the meantime we could apply a SkipIf to this test, to skio FreeBSD 9 (for 
now).

Ideas?

--

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



[issue16605] test_posix.test_fs_holes() fails on FreeBSD 9.0

2012-12-04 Thread koobs

koobs added the comment:

I'll take care of upstream and report back with PR numbers. Happy with the 
skipIf until resolved. Thanks for your time and patience jcea, much appreciated.

--

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



[issue16605] test_posix.test_fs_holes() fails on FreeBSD 9.0

2012-12-04 Thread Jesús Cea Avión

Jesús Cea Avión added the comment:

koobs, do you want the SkipIf now?. Maybe having a red buildbot can contribute 
push FreeBSD kernel guys :)

--
versions: +Python 3.3

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



[issue16605] test_posix.test_fs_holes() fails on FreeBSD 9.0

2012-12-04 Thread Jesús Cea Avión

Changes by Jesús Cea Avión j...@jcea.es:


--
assignee:  - jcea

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



[issue16605] test_posix.test_fs_holes() fails on FreeBSD 9.0

2012-12-04 Thread koobs

koobs added the comment:

Give me till the end of the weekend, will ping you for the skipIf then if I 
haven't made progress. Thank you again.

--

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



[issue12268] file readline, readlines readall methods can lose data on EINTR

2012-12-04 Thread Gregory P. Smith

Gregory P. Smith added the comment:

Yes. See my comment from June. The write paths need to be taken care of.

--

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



[issue16606] hashlib memory leak

2012-12-04 Thread Eric Snow

Changes by Eric Snow ericsnowcurren...@gmail.com:


--
status: open - closed

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



[issue16602] weakref can return an object with 0 refcount

2012-12-04 Thread Daniel Urban

Changes by Daniel Urban urban.dani...@gmail.com:


--
nosy: +daniel.urban

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



[issue16607] Bad examples in documentation

2012-12-04 Thread myreallycoolname

New submission from myreallycoolname:

The doumentation examples imn the tutorial in python3.2 are at lest in part 
invalid. I was having trouble understanding the documentation so I pulled out 
my pthony interperator and pluged in one of tyhe examples.
Just as I thought self was not defined.
You can't learn python if the docs are bad.
Please review the examples under classes to make sure they are all correct.

--
assignee: docs@python
components: Documentation
messages: 176927
nosy: docs@python, myreallycoolname
priority: normal
severity: normal
status: open
title: Bad examples in documentation
versions: Python 3.2

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



[issue16608] subclass str fails

2012-12-04 Thread David W. Lambert

New submission from David W. Lambert:

http://forums.devshed.com/newreply.php?do=newreplynoquote=1p=2838814

 class c(tuple):
...  def __init__(s,a,b):
...   tuple.__init__(s,a)
...   self.b = b
...
 c(tuple(),666)
Traceback (most recent call last):
  File stdin, line 1, in module
TypeError: tuple() takes at most 1 argument (2 given)


--
components: Interpreter Core
messages: 176928
nosy: LambertDW
priority: normal
severity: normal
status: open
title: subclass str fails
type: behavior
versions: Python 2.7, Python 3.2

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



[issue16607] Bad examples in documentation

2012-12-04 Thread Daniel Urban

Daniel Urban added the comment:

Could you please point to a specific example which is incorrect? Thank you.

--
nosy: +daniel.urban

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



[issue16609] random.random() / float() loses precision when passed to str()

2012-12-04 Thread Cal Leeming

New submission from Cal Leeming:

Hello,

Today I came up against a strange problem where collisions were being 
encountered after less than 1mil iterations when attempting to use 
random.random().

After much digging, the problem was because I was casting my float to a string, 
and this was automatically rounding it.

Some explanation is given [1], but it still leaves me with questions.

 import random
 random.random()
0.33885573194811902
 x = random.random()
 x
0.88022393777095409
 print x
0.880223937771
 str(x)
'0.880223937771'
 print str(x)
0.880223937771
 repr(x)
'0.88022393777095409'
 str(repr(x))
'0.88022393777095409'

After painstakingly searching through documentation (including the lengthy one 
about floating points arithmetic), I was unable to find any explanation behind 
why the float is automatically rounded if str() is called on it.

Although I doubt this behavior would ever be changed, it would be nice to 
update the documentation to reflect this. I'm thinking a note underneath 
random.random() explaining that you have to use repr() and not str() in order 
to maintain floating point precision.

Thoughts?

Cal

[1] 
http://stackoverflow.com/questions/3481289/converting-a-python-float-to-a-string-without-losing-precision

--
components: Interpreter Core
messages: 176930
nosy: sleepycal
priority: normal
severity: normal
status: open
title: random.random() / float() loses precision when passed to str()
versions: Python 2.7

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



[issue13120] Default nosigint option to pdb.Pdb() prevents use in non-main thread

2012-12-04 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 708586792eec by Andrew Svetlov in branch '3.2':
Issue #13120: Allow to call pdb.set_trace() from thread.
http://hg.python.org/cpython/rev/708586792eec

New changeset 678dba60c12d by Andrew Svetlov in branch '3.3':
Merge issue #13120: Allow to call pdb.set_trace() from thread.
http://hg.python.org/cpython/rev/678dba60c12d

New changeset 4006c4ca0c1f by Andrew Svetlov in branch 'default':
Merge issue #13120: Allow to call pdb.set_trace() from thread.
http://hg.python.org/cpython/rev/4006c4ca0c1f

--
nosy: +python-dev

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



[issue13120] Default nosigint option to pdb.Pdb() prevents use in non-main thread

2012-12-04 Thread Andrew Svetlov

Andrew Svetlov added the comment:

Fixed. Thanks.

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

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



[issue16609] random.random() / float() loses precision when passed to str()

2012-12-04 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

http://docs.python.org/2/tutorial/floatingpoint.html

--
nosy: +serhiy.storchaka
resolution:  - invalid
status: open - pending

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



[issue16609] random.random() / float() loses precision when passed to str()

2012-12-04 Thread Cal Leeming

Cal Leeming added the comment:

As stated before, I have already read this document.

This ticket is specifically about making users aware of this behaviour in the 
form of a documentation update on the random.random() docs.

The link you provided does not exactly make this very clear.

--
resolution: invalid - 
status: pending - open

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



[issue12268] file readline, readlines readall methods can lose data on EINTR

2012-12-04 Thread Antoine Pitrou

Antoine Pitrou added the comment:

Well, this issue is about readline, readlines  readall. It would be easier 
to follow if you opened a separate issue.

--

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



[issue16608] immutable subclass constructor call error does not show subclass name

2012-12-04 Thread R. David Murray

R. David Murray added the comment:

Is your error report the fact that the name 'tuple' appears in the error 
message instead of 'c'?  That does seem sub-optimal.  It may not be easy to 
improve, though.

--
nosy: +r.david.murray
priority: normal - low
title: subclass str fails - immutable subclass constructor call error does not 
show subclass name
versions: +Python 3.3, Python 3.4

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



[issue16608] immutable subclass constructor call error does not show subclass name

2012-12-04 Thread David W. Lambert

David W. Lambert added the comment:

The apparent problem was that the constructing str with __init__ failed.  I now 
recall that immutables take initial values in the __new__ method.  Sorry!  
Otherwise, it was quite thoughtful for you to search for a problem.  Dave.

--

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



[issue16610] Silent StopIteration exc when raised from generator inside of another generator

2012-12-04 Thread Stepan Wagner

New submission from Stepan Wagner:

def emptygen():
# Or other more meaningful generator
raise StopIteration
yield

def wrap(gen):
next(gen)
print(This should be printed or StopIteration raised.)
while True:
try:
yield next(gen)
except StopIteration as exc:
return

items = wrap(emptygen())
for item in items:
print(item)

print(End.)

--
components: Interpreter Core
messages: 176939
nosy: Stepan.Wagner
priority: normal
severity: normal
status: open
title: Silent StopIteration exc when raised from generator inside of another 
generator
type: behavior
versions: Python 2.6, Python 3.1

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



[issue16607] Bad examples in documentation

2012-12-04 Thread Georg Brandl

Georg Brandl added the comment:

I had a look and can't see an example in the Classes doc where self might not 
be defined.  Please reopen with a concrete pointer if you think otherwise.

--
nosy: +georg.brandl
resolution:  - invalid
status: open - closed

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



[issue16609] random.random() / float() loses precision when passed to str()

2012-12-04 Thread Mark Dickinson

Mark Dickinson added the comment:

The `random` module docs are not the right place to add notes about general 
floating-point arithmetic behaviour.

--
nosy: +mark.dickinson

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



[issue16609] random.random() / float() loses precision when passed to str()

2012-12-04 Thread Cal Leeming

Cal Leeming added the comment:

Normally I would concur, but casting random.random() to a string is commonly 
used, and people aren't going to read the entire floating point arithmetic page 
to figure this out. And even if they do, that page still doesn't make it 
entirely obvious at first read.

Hopefully if anyone else is caught out by this, then they will see this thread 
at least :X

--

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



[issue16609] random.random() / float() loses precision when passed to str()

2012-12-04 Thread R. David Murray

R. David Murray added the comment:

In fact it has been changed.  In Python3 you get:

 x = 0.88022393777095409
 x
0.8802239377709541
 str(x)
'0.8802239377709541'

Even in 2.7 you would get the above repr, not the one you showed.  This is 
because 2.7 and 3.3 use the shortest repr described in the floating point 
document, but 2.7 still uses the old rounding as the default str representation 
(for backward compatibility reasons).

While you could still make an argument for updating the 2.7 docs, I'm not sure 
it is worth it.  If you (or anyone) want to propose a patch, I would suggest 
that instead of adding a note to the random docs, that a glossary entry be 
added for 'floating point' which mentions it as a 2.7 limitation, and a link to 
that glossary entry from the random docs.

--
assignee:  - docs@python
components: +Documentation -Interpreter Core
nosy: +docs@python, r.david.murray
priority: normal - low
type:  - behavior

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



[issue16609] random.random() / float() loses precision when passed to str()

2012-12-04 Thread Cal Leeming

Cal Leeming added the comment:

Many thanks for your lengthy response David.

Sorry, my initial bug report stated it was Python 2.7. The tests I performed 
were actually on Python 2.6.6.

I will take a look at how to contribute documentation updates, and once I've 
familiarized myself with it I'll submit a patch for review.

Thanks again

--

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



[issue16609] random.random() / float() loses precision when passed to str()

2012-12-04 Thread Mark Dickinson

Mark Dickinson added the comment:

It is notable that this behaviour isn't described anywhere that I can find in 
the library manual or the reference manual.  As David says, it applies only to 
2.7;  in 3.2 and later, `str` and `repr` are identical.

 a glossary entry be added for 'floating point' which mentions it as a
 2.7 limitation

That could work.  I *really* don't think it should be linked to from the random 
docs, though;  this has absolutely nothing to do with the random module, except 
that the random module happens to contain functions that can produce floats.  
Many other modules do that, too.

Another option would be to add the information somewhere in

http://docs.python.org/2/library/stdtypes.html#numeric-types-int-float-long-complex

--

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



[issue16608] immutable subclass constructor call error does not show subclass name

2012-12-04 Thread R. David Murray

R. David Murray added the comment:

I have no idea what you are referring to by 'constructing str' :(

I thought at first it was your incorrect tuple call in the init that was the 
issue, but that didn't look right, and after reproducing it and playing with it 
for a bit I figured out it was the __new__ failure, and I realized the reason I 
was confused was that the error message said 'tuple' instead of 'c'.  So I 
definitely think that message could use improvement if it is practical.

--

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



[issue16609] float loses precision when passed to str()

2012-12-04 Thread Mark Dickinson

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


--
title: random.random() / float() loses precision when passed to str() - float 
loses precision when passed to str()

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



[issue16610] Silent StopIteration exc when raised from generator inside of another generator

2012-12-04 Thread R. David Murray

R. David Murray added the comment:

I don't see the bug here.

Your for loop calls wrap.  Wrap calls emptygen.  Emptygen raises a 
StopIteration exception.  That exception is of course propagated upward (it 
isn't caught by wrap), and the loop stops.

--
nosy: +r.david.murray
resolution:  - invalid
stage:  - committed/rejected
status: open - closed

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



[issue16609] float loses precision when passed to str()

2012-12-04 Thread R. David Murray

R. David Murray added the comment:

That's why I suggested a glossary entry.  The relevant function description 
*does* contain the phrase floating point, so a glossary link there would be 
reasonably natural.

--

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



[issue16608] immutable subclass constructor call error does not show subclass name

2012-12-04 Thread David W. Lambert

David W. Lambert added the comment:

Sorry again.  You probably didn't follow the link I posted to see the
problem origination.   Which was Cannot subclass str.  I generalized
this to tuple.

On Tue, 2012-12-04 at 20:08 +, R. David Murray wrote:
 R. David Murray added the comment:
 
 I have no idea what you are referring to by 'constructing str' :(
 
 I thought at first it was your incorrect tuple call in the init that was the 
 issue, but that didn't look right, and after reproducing it and playing with 
 it for a bit I figured out it was the __new__ failure, and I realized the 
 reason I was confused was that the error message said 'tuple' instead of 'c'. 
  So I definitely think that message could use improvement if it is practical.
 
 --
 
 ___
 Python tracker rep...@bugs.python.org
 http://bugs.python.org/issue16608
 ___

--

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



[issue16608] immutable subclass constructor call error does not show subclass name

2012-12-04 Thread R. David Murray

R. David Murray added the comment:

I followed the link, but it took me to a login/signup form, so it wasn't very 
informative.

--

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



[issue16610] Silent StopIteration exc when raised from generator inside of another generator

2012-12-04 Thread Stepan Wagner

Stepan Wagner added the comment:

OK, thanks for explanation.

The behaviour is still strange, because when I delete try...except clause
from wrap, the StopIteration exc from emptygen terminates the program with
traceback.

On Tue, Dec 4, 2012 at 9:14 PM, R. David Murray rep...@bugs.python.orgwrote:


 R. David Murray added the comment:

 I don't see the bug here.

 Your for loop calls wrap.  Wrap calls emptygen.  Emptygen raises a
 StopIteration exception.  That exception is of course propagated upward (it
 isn't caught by wrap), and the loop stops.

 --
 nosy: +r.david.murray
 resolution:  - invalid
 stage:  - committed/rejected
 status: open - closed

 ___
 Python tracker rep...@bugs.python.org
 http://bugs.python.org/issue16610
 ___


--

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



[issue16609] float loses precision when passed to str()

2012-12-04 Thread Antoine Pitrou

Antoine Pitrou added the comment:

I agree with Mark here. This isn't specific to random.random() and it's already 
covered elsewhere in the documentation.

Furthermore, I don't know why you're using str() on random.random(). There are 
better ways to get random strings, such as random.getrandbits() or os.urandom().

Recommend closing.

--
nosy: +pitrou
resolution:  - invalid
status: open - pending

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



[issue16609] float loses precision when passed to str()

2012-12-04 Thread Cal Leeming

Cal Leeming added the comment:

Actually, you do have a good point, this should have been using 
random.getrandbits really.

--
status: pending - open

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



[issue16123] IDLE - deprecate running without a subprocess

2012-12-04 Thread Campbell Barton

Campbell Barton added the comment:

Hi, I just found a use for this feature, with `use_subprocess` being optional 
its possible to load idle into a running python session.

--
import idlelib
import idlelib.PyShell
idlelib.PyShell.main()
--

This allows you to load idle inside an application that embeds python, is there 
some other way to do this without this option?

--
nosy: +ideasman42

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



[issue16609] float loses precision when passed to str()

2012-12-04 Thread Cal Leeming

Changes by Cal Leeming cal.leem...@simplicitymedialtd.co.uk:


--
status: open - pending

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



[issue16444] Use support.TESTFN_UNDECODABLE on UNIX

2012-12-04 Thread Roundup Robot

Roundup Robot added the comment:

New changeset ed0ff4b3d1c4 by Victor Stinner in branch 'default':
Issue #16444: test more bytes in support.TESTFN_UNDECODABLE to support more 
Windows code pages
http://hg.python.org/cpython/rev/ed0ff4b3d1c4

--

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



[issue16610] Silent StopIteration exc when raised from generator inside of another generator

2012-12-04 Thread R. David Murray

R. David Murray added the comment:

The only way I was able to replicate that result was by removing the entire 
try/except block, including the yield.  In that case, wrap is no longer a 
generator, so the exception is raised before you enter the for loop.

--

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



[issue16611] multiple problems with Cookie.py

2012-12-04 Thread John Dennis

New submission from John Dennis:

There are multiple problems with Cookie.py. Some of the issues are covered in 
http://bugs.python.org/issue3073 which is still open (after 4.5 years).

In all honesty the API and the implementation are not great perhaps the best 
thing would be to remove it from the core libraries, however you can't remove a 
core library. There is cookielib.py is which is pretty good however 
cookielib.py is tightly coupled to urllib2 and if you're not using urllib2 you 
can't use cookielib.py so you're stuck using Cookie.py which means the best 
thing is to get the bugs in Cookie.py fixed.

Of the problems illustrated in the attached unittest (test_cookie.py) the 
absolute must fix issues are the inability to parse an Expires attribute and 
the impossibility of testing the HttpOnly  Secure flags for a truth value 
after parsing. Those are critical because it makes using Cookie.py impossible. 
The other errors would be nice to get fixed, but not as critical. Next in 
importance would be respecting the truth value when setting the HttpOnly  
Secure flags. Failing to detect an improperly formatted cookie when parsing is 
the least important because hopefully you won't have improperly formatted 
cookies (unfortunately a weak assumption)

Note: the HttpOnly and Secure issues are symmetrical, they both suffer the same 
problems because they're both boolean flags whose True value is asserted by the 
flag's presence and it's False value by it's absence.
 
Cookie parsing problems:

* Cannot read a properly formatted Expires attribute (see also issue 3073)

* Impossible to determine state of HttpOnly boolean flag after parsing

* Impossible to determine state of Secure boolean flag after parsing

* Fails to raise any errors when parsing invalid cookie strings

Cookie creation/initialization problems:

* Setting HttpOnly flag to a value which evaluates to False results in the flag 
being set to True (there is no check whatsoever on the value).

* Setting Secure flag to a value which evaluates to False results in the flag 
being set to True (there is no check whatsoever on the value).

Attached is a unittest illustrating the problems (more details are in the 
unittest).

python test_cookie.py
FF.FF...F
--
Ran 13 tests in 0.003s

FAILED (failures=9)

--
components: Library (Lib)
files: test_cookie.py
messages: 176957
nosy: jdennis
priority: normal
severity: normal
status: open
title: multiple problems with Cookie.py
versions: Python 2.7
Added file: http://bugs.python.org/file28208/test_cookie.py

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



[issue16444] Use support.TESTFN_UNDECODABLE on UNIX

2012-12-04 Thread STINNER Victor

STINNER Victor added the comment:

Ooook, all remaining issues about undecodable bytes should now be fixed (until 
someone opens a new one? :-))

--
resolution:  - fixed
status: open - closed

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



[issue16610] Silent StopIteration exc when raised from generator inside of another generator

2012-12-04 Thread Stepan Wagner

Stepan Wagner added the comment:

Thank you, I wasn't paying attention enough. It works as you describe.

On Tue, Dec 4, 2012 at 9:46 PM, R. David Murray rep...@bugs.python.orgwrote:


 R. David Murray added the comment:

 The only way I was able to replicate that result was by removing the
 entire try/except block, including the yield.  In that case, wrap is no
 longer a generator, so the exception is raised before you enter the for
 loop.

 --

 ___
 Python tracker rep...@bugs.python.org
 http://bugs.python.org/issue16610
 ___


--

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



[issue16607] Bad examples in documentation

2012-12-04 Thread myreallycoolname

myreallycoolname added the comment:

Sorry about that. You will unfortunatly have to wait as I'm not on a computer 
that has python installed currently.

 - Original Message -
 From: Daniel Urban
 Sent: 12/04/12 02:00 PM
 To: do...@mail.com
 Subject: [issue16607] Bad examples in documentation
 
 Daniel Urban added the comment:
 
 Could you please point to a specific example which is incorrect? Thank you.
 
 --
 nosy: +daniel.urban
 
 ___
 Python tracker rep...@bugs.python.org
 http://bugs.python.org/issue16607
 ___


--

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



[issue16607] Bad examples in documentation

2012-12-04 Thread myreallycoolname

myreallycoolname added the comment:

I'm no expert so I'm not sure which it is but try these:

 class Complex:
... def __init__(self, realpart, imagpart):
... self.r = realpart
... self.i = imagpart
...

class Bag:
def __init__(self):
self.data = []
def add(self, x):
self.data.append(x)
def addtwice(self, x):
self.add(x)
self.add(x)

If that's not it wait and I'll submit a new and better bug report or add to the 
existing one.

 - Original Message -
 From: myreallycoolname
 Sent: 12/04/12 04:12 PM
 To: do...@mail.com
 Subject: [issue16607] Bad examples in documentation
 
 myreallycoolname added the comment:
 
 Sorry about that. You will unfortunatly have to wait as I'm not on a computer 
 that has python installed currently.
 
  - Original Message -
  From: Daniel Urban
  Sent: 12/04/12 02:00 PM
  To: do...@mail.com
  Subject: [issue16607] Bad examples in documentation
  
  Daniel Urban added the comment:
  
  Could you please point to a specific example which is incorrect? Thank you.
  
  --
  nosy: +daniel.urban
  
  ___
  Python tracker rep...@bugs.python.org
  http://bugs.python.org/issue16607
  ___
 
 
 --
 
 ___
 Python tracker rep...@bugs.python.org
 http://bugs.python.org/issue16607
 ___


--

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



[issue16607] Bad examples in documentation

2012-12-04 Thread Daniel Urban

Daniel Urban added the comment:

Both work fine.

--

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



[issue16612] Integrate Argument Clinic specialized preprocessor into CPython trunk

2012-12-04 Thread Larry Hastings

New submission from Larry Hastings:

This bug tracker entry is to track adding Argument Clinic to CPython trunk.

Please see 
http://mail.python.org/pipermail/python-dev/2012-December/122920.html for more 
information.

--
assignee: larry
components: Interpreter Core
messages: 176965
nosy: larry
priority: normal
severity: normal
stage: needs patch
status: open
title: Integrate Argument Clinic specialized preprocessor into CPython trunk
type: enhancement
versions: Python 3.4

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



[issue16612] Integrate Argument Clinic specialized preprocessor into CPython trunk

2012-12-04 Thread Glenn Linderman

Changes by Glenn Linderman v+pyt...@g.nevcal.com:


--
nosy: +v+python

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



[issue16612] Integrate Argument Clinic specialized preprocessor into CPython trunk

2012-12-04 Thread Dave Malcolm

Changes by Dave Malcolm dmalc...@redhat.com:


--
nosy: +dmalcolm

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



[issue16612] Integrate Argument Clinic specialized preprocessor into CPython trunk

2012-12-04 Thread Alex Gaynor

Changes by Alex Gaynor alex.gay...@gmail.com:


--
nosy: +alex

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



[issue16612] Integrate Argument Clinic specialized preprocessor into CPython trunk

2012-12-04 Thread Barry A. Warsaw

Changes by Barry A. Warsaw ba...@python.org:


--
nosy: +barry

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



  1   2   >