[issue15880] os.path.split() and long UNC names

2012-09-15 Thread Ezio Melotti

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


--
keywords: +easy
nosy: +ezio.melotti
stage:  - test needed
type: crash - behavior
versions: +Python 3.2, Python 3.3

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



[issue15887] urlencode should accept iterables of pairs

2012-09-15 Thread Ezio Melotti

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


--
nosy: +ezio.melotti

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



[issue15888] ipaddress doctest examples have some errors

2012-09-15 Thread Ezio Melotti

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


--
nosy: +ezio.melotti
stage: needs patch - patch review

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



[issue15920] make howto/regex.rst doctests pass

2012-09-15 Thread Ezio Melotti

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


--
assignee: docs@python - ezio.melotti
nosy: +ezio.melotti
type:  - enhancement

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



[issue14570] Document json sort_keys parameter properly

2012-09-15 Thread Chris Rebert

Chris Rebert added the comment:

Any reactions? The patch is pretty straightforward...

--

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



[issue14570] Document json sort_keys parameter properly

2012-09-15 Thread Ezio Melotti

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


--
nosy: +petri.lehtinen
stage: needs patch - patch review

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



[issue15945] memoryview + bytes fails

2012-09-15 Thread Jean-Paul Calderone

New submission from Jean-Paul Calderone:

Python 3.3.0rc2+ (default:9def2209a839, Sep 10 2012, 08:44:51) 
[GCC 4.6.3] on linux
Type help, copyright, credits or license for more information.
 memoryview(b'foo') + b'bar'
Traceback (most recent call last):
  File stdin, line 1, in module
TypeError: unsupported operand type(s) for +: 'memoryview' and 'bytes'
 b'bar' + memoryview(b'foo')
b'barfoo'


--
messages: 170511
nosy: exarkun
priority: normal
severity: normal
status: open
title: memoryview + bytes fails
type: behavior
versions: Python 3.3

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



[issue15945] memoryview + bytes fails

2012-09-15 Thread Stefan Krah

Stefan Krah added the comment:

What is the expected outcome? memoryviews can't be resized, so
this scenario isn't possible:

 bytearray([1,2,3]) + b'123'
bytearray(b'\x01\x02\x03123')

--
nosy: +skrah

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



[issue15945] memoryview + bytes fails

2012-09-15 Thread Antoine Pitrou

Antoine Pitrou added the comment:

Just prepend the empty bytestring if you want to make sure the result is a 
bytes object:

 b'' + memoryview(b'foo') + b'bar'
b'foobar'

I think the following limitation may be more annoying, though:

 b''.join([memoryview(b'foo'), b'bar'])
Traceback (most recent call last):
  File stdin, line 1, in module
TypeError: sequence item 0: expected bytes, memoryview found

--
nosy: +pitrou

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



[issue15946] Windows 8 x64 - IO-Error

2012-09-15 Thread Christian Mikula

New submission from Christian Mikula:

OS Windows 8 Enterprise x64 clean installed.
Python Version 2.6.6 and 2.7.3 both x64 installed.

Problem is to delete one Directory and immediately after create one new with 
the same Name!

!!! Code !!!

import sys, platform, os, shutil

TEST_PATH = /test

print platform:\t, platform.platform()
print sys.platform:\t, sys.platform
print sys.version:\t, sys.version
print directory test:\t'%s' % TEST_PATH
print

if os.path.exists(TEST_PATH):
shutil.rmtree(TEST_PATH)
if not os.path.exists(TEST_PATH):
os.makedirs(TEST_PATH)

print success

!!! End of code !!!

The error is only present if the Directory was deleted previously.

Error:
Traceback (most recent call last):
  File dir_test.py, line 23, in module
os.makedirs(BUILD_PATH)
  File C:\Program Files\Python27\lib\os.py, line 157, in makedirs
mkdir(name, mode)
WindowsError: [Error 5] Zugriff verweigert: '/test'

--
components: IO, Windows
files: dir_test.png
messages: 170514
nosy: cmikula
priority: normal
severity: normal
status: open
title: Windows 8 x64 - IO-Error
versions: Python 2.6, Python 2.7
Added file: http://bugs.python.org/file27193/dir_test.png

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



[issue15946] Windows 8 x64 - IO-Error

2012-09-15 Thread Christian Mikula

Changes by Christian Mikula christian.mik...@live.at:


--
type:  - crash

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



[issue15946] Windows 8 x64 - IO-Error

2012-09-15 Thread R. David Murray

R. David Murray added the comment:

I believe this is a Windows...feature?  We have lots of trouble with this 
ourselves in the test suite, if I understand correctly.

--
nosy: +brian.curtin, r.david.murray, tim.golden

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



[issue15897] zipimport.c doesn't check return value of fseek()

2012-09-15 Thread Felipe Cruz

Felipe Cruz added the comment:

I've updated the patch changing fseek_error goto block error return from 
PyErr_SetFromErrno to PyErr_Format(ZipImportError, can't read Zip file: %R, 
archive); (returning NULL after).

--
Added file: http://bugs.python.org/file27194/issue15897_v1.patch

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



[issue15946] Windows 8 x64 - IO-Error

2012-09-15 Thread Christian Mikula

Christian Mikula added the comment:

I also think that it is a windows feature! who should report this problem with 
microsoft?

--

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



[issue15947] Assigning new values to instance of pointer types does not check validity

2012-09-15 Thread Facundo Batista

New submission from Facundo Batista:

In the doc it says:


Assigning a new value to instances of the pointer types c_char_p, c_wchar_p, 
and c_void_p changes the memory location they point to, not the contents of the 
memory block [...].

 s = Hello, World
 c_s = c_wchar_p(s)
 print(c_s)
c_wchar_p('Hello, World')
 c_s.value = Hi, there
 print(c_s)
c_wchar_p('Hi, there')
 print(s) # first object is unchanged
Hello, World



However, c_s it's not getting Hi, there as the memory location it points 
to, otherwise next access will surely segfault.

OTOH, if it *does* change the memory location, but the value is cached locally, 
which is the point of letting it change the memory location? Shouldn't it raise 
AttributeError or something?

Thanks!

--
components: ctypes
messages: 170518
nosy: facundobatista
priority: normal
severity: normal
status: open
title: Assigning new values to instance of pointer types does not check validity
type: behavior
versions: Python 3.2

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



[issue15897] zipimport.c doesn't check return value of fseek()

2012-09-15 Thread Christian Heimes

Christian Heimes added the comment:

You can further compress the changes when you get rid of `rc` and check the 
return value inline, for example:

  if (fseek(...) == -1) {
errorhandler;
  }

--

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



[issue15526] test_startfile crash on Windows 7 AMD64

2012-09-15 Thread Jeremy Kloth

Jeremy Kloth added the comment:

This test is still intermittently failing on the AMD64 Windows7 SP1 buildbot: 

http://buildbot.python.org/all/builders/AMD64%20Windows7%20SP1%203.x/builds/630

Any chance the patch could be committed?

--

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



[issue15948] Unchecked return value of I/O functions

2012-09-15 Thread Christian Heimes

New submission from Christian Heimes:

Python's C code contains more than 30 lines that don't check the return value 
of I/O functions like fseek(). A missing check can hide issues like a failing 
NFS connection.

I've created an (incomplete) list of missing checks with find and grep.

$ find -name '*.c' | sort | xargs egrep '^(\t|\ 
)*(fopen|fdopen|fread|fseek|fwite|open|read|write|readdir|readlink|lseek|dup|dup2|opendir|fdopendir|closedir|dirfd|readdir|seekdir|scandir|telldir|fcntl|ioctl)\
 *\('

./Modules/_ctypes/libffi/src/dlmalloc.c:  read(fd, buf, sizeof(buf)) == 
sizeof(buf)) {
./Modules/_cursesmodule.c:fseek(fp, 0, 0);
./Modules/_cursesmodule.c:fseek(fp, 0, 0);
./Modules/faulthandler.c:write(thread.fd, thread.header, 
thread.header_len);
./Modules/getpath.c:fseek(env_file, 0, SEEK_SET);
./Modules/mmapmodule.c:lseek(fileno, 0, SEEK_SET);
./Modules/ossaudiodev.c: ioctl(fd, SNDCTL_DSP_cmd, arg)
./Modules/posixmodule.c:ioctl(slave_fd, I_PUSH, ptem); /* push ptem */
./Modules/posixmodule.c:ioctl(slave_fd, I_PUSH, ldterm); /* push ldterm */
./Modules/posixmodule.c:ioctl(slave_fd, I_PUSH, ttcompat); /* push 
ttcompat */
./Modules/_posixsubprocess.c:fcntl(fd_dir_fd, F_SETFD, old | 
FD_CLOEXEC);
./Modules/_posixsubprocess.c:fcntl(p2cread, F_SETFD, old  
~FD_CLOEXEC);
./Modules/_posixsubprocess.c:fcntl(c2pwrite, F_SETFD, old  
~FD_CLOEXEC);
./Modules/_posixsubprocess.c:fcntl(errwrite, F_SETFD, old  
~FD_CLOEXEC);
./Modules/signalmodule.c:write(wakeup_fd, byte, 1);
./Modules/socketmodule.c:ioctl(s-sock_fd, FIONBIO, (caddr_t)block, 
sizeof(block));
./Modules/socketmodule.c:ioctl(s-sock_fd, FIONBIO, (unsigned int *)block);
./Modules/socketmodule.c:fcntl(s-sock_fd, F_SETFL, delay_flag);
./Modules/zipimport.c:fseek(fp, -22, SEEK_END);
./Modules/zipimport.c:fseek(fp, header_offset, 0);  /* Start of file 
header */
./Modules/zipimport.c:fseek(fp, header_offset + 8, 0);
./Modules/zipimport.c:fseek(fp, header_offset + 42, 0);
./Modules/zipimport.c:fseek(fp, file_offset, 0);
./Modules/zipimport.c:fseek(fp, file_offset + 26, 0);
./Modules/zlib/gzlib.c:open(path,
./PC/getpathp.c:fseek(env_file, 0, SEEK_SET);
./Python/traceback.c:lseek(fd, 0, 0); /* Reset position */
./Python/traceback.c:write(fd, buffer, len);
./Python/traceback.c:write(fd, buffer, len);
./Python/traceback.c:write(fd, c, 1);
./Python/traceback.c:write(fd, \, 1);
./Python/traceback.c:write(fd, \, 1);
./Python/traceback.c:write(fd, \n, 1);
./Python/traceback.c:write(fd, \n, 1);

The missing checks for zipimport.c are already handles by ticket #15897.

--
keywords: easy
messages: 170521
nosy: christian.heimes
priority: normal
severity: normal
status: open
title: Unchecked return value of I/O functions
type: behavior
versions: Python 2.7, Python 3.2, Python 3.3

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



[issue14570] Document json sort_keys parameter properly

2012-09-15 Thread Chris Jerdonek

Chris Jerdonek added the comment:

I would recommend making the added and modified lines not exceed 79 characters 
in both files.  Also, for the .rst file, you can use slashes to break lines as 
shown in the following example:

http://hg.python.org/cpython/file/09011896374d/Doc/library/argparse.rst#l133

--
nosy: +cjerdonek

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



[issue14570] Document json sort_keys parameter properly

2012-09-15 Thread Chris Jerdonek

Chris Jerdonek added the comment:

Also, while not strictly necessary, it is more customary and convenient to 
provide a single patch file for all files.

--

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



[issue15946] Windows 8 x64 - IO-Error

2012-09-15 Thread Brian Curtin

Brian Curtin added the comment:

I'm not sure Microsoft is going to change anything about this - it has done 
this for a long time, if not forever. We recently had #15496 receive changes, 
and #7443 is in the same area and has more details and some patches, so I'd 
suggest taking up the discussion over there.

--
resolution:  - duplicate
stage:  - committed/rejected
status: open - closed
superseder:  - test.support.unlink issue on Windows platform
type: crash - behavior

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



[issue15949] docs.python.org not getting updated

2012-09-15 Thread Chris Jerdonek

New submission from Chris Jerdonek:

docs.python.org doesn't seem to be getting updated anymore.  For example, this 
revision from Tuesday, Sept 11 is not reflected:

http://hg.python.org/cpython/rev/c8d60d0c736b

--
assignee: docs@python
components: Documentation
messages: 170525
nosy: cjerdonek, docs@python
priority: normal
severity: normal
status: open
title: docs.python.org not getting updated

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



[issue15897] zipimport.c doesn't check return value of fseek()

2012-09-15 Thread Felipe Cruz

Felipe Cruz added the comment:

v4 - inline fseek return code check - as Christian suggested

--
Added file: http://bugs.python.org/file27195/issue15897_v4.patch

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



[issue15933] flaky test in test_datetime

2012-09-15 Thread Chris Jerdonek

Chris Jerdonek added the comment:

I also notice that there is an unnecessary call to time.sleep(0.1) whenever the 
loop exhausts. This adds .1 seconds to the test run for every call to 
test_today() on, for example, platforms that never get the same value twice 
(according to the code comment).

For example, on my system (Mac OS X 10.7.4) this test method is called 8 times 
when running--

./python.exe -m test -v test_datetime

and in 6 of these calls the loop regularly exhausts.  This adds 0.6 seconds to 
each test run, and this doesn't include the first two loop iterations, which 
would account for a total of 1.8 seconds added on every test run.

--
nosy: +cjerdonek

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



[issue14616] subprocess docs should mention pipes.quote/shlex.quote

2012-09-15 Thread Chris Rebert

Changes by Chris Rebert pyb...@rebertia.com:


Added file: http://bugs.python.org/file27196/subprocess.rst-2.7.patch

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



[issue14616] subprocess docs should mention pipes.quote/shlex.quote

2012-09-15 Thread Chris Rebert

Chris Rebert added the comment:

Updated patches to mention pipes.quote().

--
Added file: http://bugs.python.org/file27197/subprocess.rst-3.3.patch

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



[issue1521051] Allow passing DocTestRunner and DocTestCase in doctest

2012-09-15 Thread Chris Jerdonek

Chris Jerdonek added the comment:

I think this would be useful as well.  For example, it would let one more 
easily get finer-grained test result data (e.g. to the level of doctest 
examples rather than just the TestCase level).  Without this, I needed to 
monkey patch.

The previously attached patch enhances DocTestSuite.  I think DocFileSuite 
should receive the same treatment (the case I was more interested in myself -- 
cf. http://bugs.python.org/issue15629#msg170447 ).

--
nosy: +cjerdonek
title: Extra configurability for doctest TestCases - Allow passing 
DocTestRunner and DocTestCase in doctest
versions: +Python 3.4 -Python 3.2

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



[issue15887] urlencode should accept iterables of pairs

2012-09-15 Thread Thomas Lee

Thomas Lee added the comment:

Working on a patch for this. Should be ready for review shortly.

--
nosy: +thomaslee

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



[issue15933] flaky test in test_datetime

2012-09-15 Thread Chris Jerdonek

Chris Jerdonek added the comment:

Here are the 6 cases where it always exhausts on my system:

test_today (test.datetimetester.TestSubclassDateTime_Pure)
test_today (test.datetimetester.TestDateTimeTZ_Pure)
test_today (test.datetimetester.TestDateTime_Pure)
test_today (test.datetimetester.TestSubclassDateTime_Fast)
test_today (test.datetimetester.TestDateTimeTZ_Fast)
test_today (test.datetimetester.TestDateTime_Fast)

--

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



[issue15419] distutils: build should use a version-specific build directory

2012-09-15 Thread Arfrever Frehtes Taifersar Arahesis

Arfrever Frehtes Taifersar Arahesis added the comment:

Changing of name of subdirectory would break e.g. shell scripts, which set 
PYTHONPATH=build/lib when calling Python scripts, so this change rather should 
not be made in micro releases.

--

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



[issue15933] flaky test in test_datetime

2012-09-15 Thread Chris Jerdonek

Chris Jerdonek added the comment:

I think we can avoid unnecessary sleeps if we only loop again if the final 
assert fails (i.e. by including the or condition with the time delta 
allowance inside the loop and not just outside).

--

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



[issue15526] test_startfile crash on Windows 7 AMD64

2012-09-15 Thread Roundup Robot

Roundup Robot added the comment:

New changeset bc5c5b79b7e1 by Antoine Pitrou in branch '3.2':
Issue #15526: try to fix test_startfile's inability to clean up after itself in 
time.
http://hg.python.org/cpython/rev/bc5c5b79b7e1

New changeset 1704deb7e6d7 by Antoine Pitrou in branch 'default':
Issue #15526: try to fix test_startfile's inability to clean up after itself in 
time.
http://hg.python.org/cpython/rev/1704deb7e6d7

--
nosy: +python-dev

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



[issue15526] test_startfile crash on Windows 7 AMD64

2012-09-15 Thread Antoine Pitrou

Antoine Pitrou added the comment:

Ok, hopefully there'll no more be failures now.

--
resolution:  - fixed
stage:  - committed/rejected
versions: +Python 3.2

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



[issue15887] urlencode should accept iterables of pairs

2012-09-15 Thread Thomas Lee

Thomas Lee added the comment:

Patch attached. Terry, you'll notice I wrap the main part of the urlencode 
function in a big try/except block to catch TypeErrors  ValueErrors.

I'm a bit concerned that doing this may misreport the true underlying error in 
the event we screw up values/types in a way that doesn't relate to the 'query' 
argument, but I think the code seems to do a pretty good job of ensuring that 
won't happen -- so that fear may be unfounded.

You'll see I reworked the documentation quite a bit. The wording was a bit odd 
in places, and I called out a few things that may not be obvious at a glance. 
Hopefully it seems like an improvement. :)

--
keywords: +patch
Added file: http://bugs.python.org/file27198/issue-15887-01.patch

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



[issue15933] flaky test in test_datetime

2012-09-15 Thread Ezio Melotti

Ezio Melotti added the comment:

The comment before the check states 4 possible reasons for this failure:
  1. It recently became midnight, between the today() and the time() calls.
  2. The platform time() has such fine resolution that we'll never get the same 
value twice.
  3. The platform time() has poor resolution, and we just happened to call 
today() right before a resolution quantum boundary.
  4. The system clock got fiddled between calls.

The test should be able to address 1 and 4 (unless the clock fiddler is really 
fast).  2 seems common (I couldn't get the same value twice here), but the 
timedelta is less than half second, so the test still passes.
So the failure is caused by either 3 (the platform time() has a resolution of 
more than half second), or by a really slow buildbot, so that half second 
passes between the two calls, or possibly by a combination of the two.

The attached patch does 3 things:
  1) it uses assertLess instead of assertTrue to get a better error message;
  2) it imports time() directly instead of using time.time(), in order to 
reduce the delay between the call to .today() and the one to time();
  3) it removes the sleep altogether, since it's useless for cases 1, 2, and 4, 
and probably doesn't help for case 3 either;

This wouldn't probably fix the sporadic failure, but will give us more 
information on the next failure and make the tests faster.
Checking the time() resolution on the x86 OpenIndiana 3.2 might also be 
useful.

FTR I tried to reproduce the failure using on my machine:
  ./python -m test -m TestSubclassDateTime_Fast -F test_datetime
but I didn't manage to.

--
keywords: +patch
nosy: +ezio.melotti
Added file: http://bugs.python.org/file27199/issue15933.diff

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



[issue15933] flaky test in test_datetime

2012-09-15 Thread Chris Jerdonek

Chris Jerdonek added the comment:

if today == todayagain:
-break
+return  # test passed

Might it make more sense to do the passing time-delta check inside the loop (at 
the above location), and then raise an exception at the end if the loop 
exhausts?  I think this might be clearer (in addition to preventing unnecessary 
looping).

--

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



[issue15933] flaky test in test_datetime

2012-09-15 Thread Ezio Melotti

Ezio Melotti added the comment:

That won't always work for case 1 (when theclass is e.g. 'date') and for case 4 
(even if it's unlikely).
Technically 2 loops should be enough, but without the sleep I don't think it 
matters much if it does 1 or 3 loops.

--

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



[issue15948] Unchecked return value of I/O functions

2012-09-15 Thread Felipe Cruz

Felipe Cruz added the comment:

I can submit patches.. 

Is there any problem to send 1 patch per module?

--
nosy: +felipecruz

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



[issue15948] Unchecked return value of I/O functions

2012-09-15 Thread Ezio Melotti

Ezio Melotti added the comment:

I think that's OK.

--
nosy: +ezio.melotti
stage:  - needs patch

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



[issue12075] python3.2 memory leak when reloading class with attributes

2012-09-15 Thread Ezio Melotti

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


--
nosy: +benjamin.peterson

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



[issue1052827] filelist.findall should not fail on dangling symlinks

2012-09-15 Thread Ezio Melotti

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


--
keywords: +easy
versions: +Python 3.3, Python 3.4 -Python 3.1

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



[issue15606] re.VERBOSE whitespace behavior not completely documented

2012-09-15 Thread Ezio Melotti

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


--
stage:  - patch review

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



[issue12321] documentation of ElementTree.find

2012-09-15 Thread Ezio Melotti

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


--
keywords: +easy

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



[issue11664] Add patch method to unittest.TestCase

2012-09-15 Thread Julian Berman

Julian Berman added the comment:

It's kind of unfortunate that `mock.patch` is called `mock.patch`. I was 
thinking about this a bit more yesterday, and `mock.patch.object` is the one 
that I think would be most appropriate to put on `TestCase`, and the best name 
for it is probably `patch`, but doing that would be deathly confusing, so I 
don't think that's a real choice we can make.

--

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



[issue15744] missing tests for {RawIO,BufferedIO,TextIO}.writelines

2012-09-15 Thread Felipe Cruz

Felipe Cruz added the comment:

Add tests for {RawIO,BufferedIO,TextIO}.writelines()

--
keywords: +patch
nosy: +felipecruz
Added file: http://bugs.python.org/file27200/issue15744_v1.patch

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



[issue15933] flaky test in test_datetime

2012-09-15 Thread Chris Jerdonek

Chris Jerdonek added the comment:

 That won't always work for case 1 (when theclass is e.g. 'date') and for case 
 4 (even if it's unlikely).

Can you explain what you mean by this?  It seems the timedelta allowance would 
be equally valid and serve the same purpose no matter what case or whether 
dealing with dates or datetimes (e.g. different date objects because of (1) 
would also fail the ` timedelta(seconds=0.5)` check).  For example--

 from datetime import date, timedelta
 d1 = date(2012, 1, 1)
 d2 = date(2012, 1, 2)
 abs(d2 - d1)  timedelta(seconds=0.5)
False

Basically, the check is to confirm that today and todayagain are within 0.1 
seconds of each other -- no matter which case.

--

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



[issue11454] email.message import time

2012-09-15 Thread Ezio Melotti

Ezio Melotti added the comment:

I tried to remove a few unused regex and inline some of the others (the re 
module has its own caching anyway and they don't seem to be documented), but it 
didn't get so much faster (see attached patch).  

I then put the second list of email imports of the previous message in a file 
and run it with cprofile and these are the results:

=== Without patch ===

$ time ./python -m issue11454_imp2
[69308 refs]

real0m0.337s
user0m0.312s
sys 0m0.020s

$ ./python -m cProfile -s time issue11454_imp2.py
 15130 function calls (14543 primitive calls) in 0.191 seconds

   Ordered by: internal time

   ncalls  tottime  percall  cumtime  percall filename:lineno(function)
   260.0290.0010.0290.001 {built-in method loads}
 12480.0150.0000.0180.000 sre_parse.py:184(__next)
30.0100.0030.0150.005 
sre_compile.py:301(_optimize_unicode)
48/170.0090.0000.0370.002 sre_parse.py:418(_parse)
 30/10.0080.0000.1910.191 {built-in method exec}
   820.0070.0000.0240.000 {built-in method __build_class__}
   250.0060.0000.0240.001 
sre_compile.py:207(_optimize_charset)
80.0050.0010.0050.001 {built-in method load_dynamic}
 11220.0050.0000.0220.000 sre_parse.py:209(get)
  1770.0050.0000.0050.000 {built-in method stat}
  1070.0050.0000.0120.000 frozen 
importlib._bootstrap:1350(find_loader)
2944/29190.0040.0000.0040.000 {built-in method len}
69/150.0030.0000.0280.002 sre_compile.py:32(_compile)
90.0030.0000.0030.000 sre_compile.py:258(_mk_bitmap)
   940.0020.0000.0030.000 frozen 
importlib._bootstrap:74(_path_join)


=== With patch ===

$ time ./python -m issue11454_imp2
[69117 refs]

real0m0.319s
user0m0.304s
sys 0m0.012s

$ ./python -m cProfile -s time issue11454_imp2.py
 11281 function calls (10762 primitive calls) in 0.162 seconds

   Ordered by: internal time

   ncalls  tottime  percall  cumtime  percall filename:lineno(function)
   210.0220.0010.0220.001 {built-in method loads}
30.0110.0040.0150.005 
sre_compile.py:301(_optimize_unicode)
  7080.0080.0000.0100.000 sre_parse.py:184(__next)
 30/10.0080.0000.2380.238 {built-in method exec}
   820.0070.0000.0230.000 {built-in method __build_class__}
  1870.0050.0000.0050.000 {built-in method stat}
80.0050.0010.0050.001 {built-in method load_dynamic}
  1070.0050.0000.0120.000 frozen 
importlib._bootstrap:1350(find_loader)
 29/80.0050.0000.0200.002 sre_parse.py:418(_parse)
   110.0040.0000.0200.002 
sre_compile.py:207(_optimize_charset)
  6430.0030.0000.0120.000 sre_parse.py:209(get)
50.0030.0010.0030.001 {built-in method dumps}
   940.0020.0000.0030.000 frozen 
importlib._bootstrap:74(_path_join)
  2570.0020.0000.0020.000 quoprimime.py:56(genexpr)
   260.0020.0000.1160.004 frozen 
importlib._bootstrap:938(get_code)
1689/16760.0020.0000.0020.000 {built-in method len}
   310.0020.0000.0030.000 frozen 
importlib._bootstrap:1034(get_data)
  2560.0020.0000.0020.000 {method 'setdefault' of 'dict' 
objects}
  1190.0020.0000.0030.000 frozen 
importlib._bootstrap:86(_path_split)
   350.0020.0000.0190.001 frozen 
importlib._bootstrap:1468(_find_module)
   340.0020.0000.0150.000 frozen 
importlib._bootstrap:1278(_get_loader)
 39/60.0020.0000.0230.004 sre_compile.py:32(_compile)
 26/30.0010.0000.2350.078 frozen 
importlib._bootstrap:853(_load_module)


The time spent in sre_compile.py:301(_optimize_unicode) most likely comes from 
email.utils._has_surrogates (there's a further speedup when it's commented 
away):
_has_surrogates = 
re.compile('([^\ud800-\udbff]|\A)[\udc00-\udfff]([^\udc00-\udfff]|\Z)').search

This is used in a number of places, so it can't be inlined.  I wanted to 
optimize it but I'm not sure what it's supposed to do.  It matches lone low 
surrogates, but not lone high ones, and matches some invalid sequences, but not 
others:
 _has_surrogates('\ud800')  # lone high
 _has_surrogates('\udc00')  # lone low
_sre.SRE_Match object at 0x9ae00e8
 _has_surrogates('\ud800\udc00')  # valid pair (high+low)
 _has_surrogates('\ud800\ud800\udc00')  # invalid sequence (lone high, valid 
 high+low)
 _has_surrogates('\udc00\ud800\ud800\udc00')  # invalid sequence (lone low, 
 lone high, valid high+low)
_sre.SRE_Match object at 0x9ae0028

FWIW this was 

[issue11454] email.message import time

2012-09-15 Thread R. David Murray

R. David Murray added the comment:

It detects whether a string contains any characters have been surrogate escaped 
by the surrogate escape handler.  I disliked using it, but I didn't know of any 
better way to do that detection.  It's on my long list of things to come back 
to eventually and try to improve :)

--

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



[issue15893] Py_FrozenMain() resource leak and missing malloc checks

2012-09-15 Thread Thomas Lee

Thomas Lee added the comment:

Patch against hg tip attached.

--
keywords: +patch
nosy: +thomaslee
Added file: http://bugs.python.org/file27202/issue-15893-01.patch

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



[issue15949] docs.python.org not getting updated

2012-09-15 Thread Ezio Melotti

Ezio Melotti added the comment:

http://docs.python.org/dev/py3k/reference/datamodel.html says Last updated on 
Sep 11, 2012.

--
nosy: +ezio.melotti, georg.brandl
type:  - behavior

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



[issue11454] email.message import time

2012-09-15 Thread Ezio Melotti

Ezio Melotti added the comment:

Given that high surrogates are U+D800..U+DBFF, and low ones are U+DC00..U+DFFF, 
'([^\ud800-\udbff]|\A)[\udc00-\udfff]([^\udc00-\udfff]|\Z)' means a low 
surrogates, preceded by either an high one or line beginning, and followed by 
another low one or line end.

PEP 838 says With this PEP, non-decodable bytes = 128 will be represented as 
lone surrogate codes U+DC80..U+DCFF.

If I change the regex to _has_surrogates = 
re.compile('[\udc80-\udcff]').search, the tests still pass but there's no 
improvement on startup time (note: the previous regex was matching all the 
surrogates in this range too, however I'm not sure how well this is tested).

If I change the implementation with
_pep383_surrogates = set(map(chr, range(0xDC80, 0xDCFF+1)))
def _has_surrogates(s):
return any(c in _pep383_surrogates for c in s)

the tests still pass and the startup is ~15ms faster here:

$ time ./python -m issue11454_imp2
[68837 refs]

real0m0.305s
user0m0.288s
sys 0m0.012s

However using this function instead of the regex is ~10x slower at runtime.  
Using the shorter regex is about ~7x faster, but there are no improvements on 
the startup time.
Assuming the shorter regex is correct, it can still be called inside a function 
or used with functools.partial.  This will result in a improved startup time 
and a ~2x improvement on runtime (so it's a win-win).
See attached patch for benchmarks.

This is a sample result:
 17.01 usec/pass  - re.compile(current_regex).search
  2.20 usec/pass  - re.compile(short_regex).search
148.18 usec/pass  - return any(c in surrogates for c in s)
106.35 usec/pass  - for c in s: if c in surrogates: return True
  8.40 usec/pass  - return re.search(short_regex, s)
  8.20 usec/pass  - functools.partial(re.search, short_regex)

--
Added file: http://bugs.python.org/file27203/issue11454_surr1.py

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