[issue12607] subprocess(stdout=..., stderr=sys.stdout) breaks stderr for child

2011-07-25 Thread Ross Lagerwall

Ross Lagerwall rosslagerw...@gmail.com added the comment:

Attached is a patch which tests all combinations and includes a testcase.

--
nosy: +pitrou
Added file: http://bugs.python.org/file22747/i12607_v2.patch

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



[issue12634] Random Remarks in class documentation

2011-07-25 Thread Ashutosh Swain

New submission from Ashutosh Swain ats.e...@gmail.com:

URL: http://docs.python.org/tutorial/classes.html
section: 9.4 Random Remarks 

The first sentense is bit confusing:
Data attributes override method attributes with the same name

Is it possible to change the sentense something like this:
Data attributes set through instance override method attributes with the same 
name

--
assignee: docs@python
components: Documentation
messages: 141073
nosy: ats.engg, docs@python
priority: normal
severity: normal
status: open
title: Random Remarks in class documentation
type: feature request
versions: Python 2.7

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



[issue12634] Random Remarks in class documentation

2011-07-25 Thread Raymond Hettinger

Raymond Hettinger raymond.hettin...@gmail.com added the comment:

The proposed rewrite doesn't make any sense to me.  Also set through is an 
reads awkwardly.

--
assignee: docs@python - rhettinger
nosy: +rhettinger

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



[issue12633] sys.modules gets special treatment

2011-07-25 Thread Nick Coghlan

Nick Coghlan ncogh...@gmail.com added the comment:

+1 for making this limitation explicit. See the caveat on locals() [1] for an 
example of how to note this kind of restriction.

[1] http://docs.python.org/dev/library/functions.html#locals

--

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



[issue12635] use as for block scope support

2011-07-25 Thread HaiYun Yan

New submission from HaiYun Yan lyricco...@gmail.com:

use as for block scope support
just like mozilla javascript let extension
https://developer.mozilla.org/en/new_in_javascript_1.7#Block_scope_with_let_%28Merge_into_let_Statement%29

usage:

as_clause(as_declare): as NAME
as_stmt: NAME as test
as_expr: ( expr as NAME ) expr

var declare by as_clause is alive in suite only
eg:
NAME f binding savedwith open(...) as fNAME f bind to HEAPObj:
   ...
NAME f binding restored

the same rule to except E as e: 

spec:
from socket import AF_INET as IPv4
IPv4 bind to socket.AF_INET slot
IPv4 = None
assert socket.AF_INET == None

var in as_stmt is alive in current indentation
eg:
for i in range(10):
   NAME t binding saved
   t as f()+1 NAME t bind to f()+1
   ...
   NAME t binding restored

var in as_expr is alive in sub expr only
eg:
t = None
x = (2+3 as t) t**2
assert t == None ane  x == 25

Suggestion:
new opcode
ENTER_BLOCK #depth #varslots

--
components: Interpreter Core
messages: 141076
nosy: lyricconch
priority: normal
severity: normal
status: open
title: use as for block scope support
type: feature request

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



[issue12635] use as for block scope support

2011-07-25 Thread Ezio Melotti

Ezio Melotti ezio.melo...@gmail.com added the comment:

You should propose this to the python-ideas mailing list first.
It might be worth checking the archives of the ML as well -- I think I saw 
already something similar a while ago.

--
nosy: +ezio.melotti
resolution:  - rejected
stage:  - committed/rejected
status: open - closed

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



[issue12634] Random Remarks in class documentation

2011-07-25 Thread Ezio Melotti

Ezio Melotti ezio.melo...@gmail.com added the comment:

Indeed that paragraph is not really clear.  I had to read it till the end 
(verbs for methods and nouns for data attributes) to figure out what it was 
talking about.  Even then it's still not clear what it's trying to say.
I *think* it means that if you have a class Foo with a method bar, and you do 
Foo.bar = 'data', the method will be overridden (so you won't be able to do 
Foo.bar for the 'data' and Foo.bar() for the method), but the opposite is also 
true.
Moreover I find both the suggestions for avoiding conflicts (capitalizing 
method names and/or using an underscore) wrong (both against PEP8).  Also it 
never happened to me to have an attribute with the same name of a method, and I 
think in general it's not a common case (becase, as the paragraph says, methods 
are verbs and attributes nouns).

The whole thing could be rewritten to just say that an attribute name always 
refers to a single object, either to a method or to some data.

--
nosy: +eric.araujo, ezio.melotti, terry.reedy
versions: +Python 3.2, Python 3.3

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



[issue9998] ctypes find_library should search LD_LIBRARY_PATH on linux

2011-07-25 Thread Yaroslav Bulatov

Changes by Yaroslav Bulatov yarosla...@gmail.com:


--
nosy: +yaroslavvb

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



[issue9998] ctypes find_library should search LD_LIBRARY_PATH on linux

2011-07-25 Thread Yaroslav Bulatov

Yaroslav Bulatov yarosla...@gmail.com added the comment:

This causes problem for Freetype Python bindings on Linux

--

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



[issue12607] subprocess(stdout=..., stderr=sys.stdout) breaks stderr for child

2011-07-25 Thread STINNER Victor

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

save_fds should be moved outside the try block:

+try:
+# save a copy of the standard file descriptors
+saved_fds = [os.dup(fd) for fd in range(3)]
+...
+finally:
+for std, saved in enumerate(saved_fds):
+os.dup2(saved, std)
+os.close(saved)


temp_fds = [fd for fd, fname in temps] should also be moved outside its try 
block.

Why not using .communicate() to write into stdin and read stdout/stderr?

--

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



[issue12636] IDLE ignores -*- coding -*- with -r option

2011-07-25 Thread ledave123

New submission from ledave123 ledave...@yahoo.fr:

I'm on Windows with cp1252 as the default encoding.
When I use -*- coding: c1252 -*- I get no problems.
When I use -*- coding: utf-8 -*- IDLE -r still opens the file with cp1252 
encoding.
Python.exe opens the file with utf-8 correctly.

I think the problem is in Python32\Lib\idlelib\PyShell.py line 585:
In class ModifiedInterpreter:

def execfile(self, filename, source=None):
Execute an existing file
if source is None:
source = open(filename, r).read() # this is the bug IMHO

--
components: IDLE
messages: 141081
nosy: ledave123
priority: normal
severity: normal
status: open
title: IDLE ignores -*- coding -*- with -r option
type: behavior
versions: Python 3.2

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



[issue12632] Windows GPF with Code Page 65001

2011-07-25 Thread STINNER Victor

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

You can use PYTHONIOENCODING=utf-8. Code page 65001 is not exactly like 
Python UTF-8 codec: see issue #6058.

Using issue #12281, it may be possible to implement a cp65001 codec.

See also issue #1602 for the Windows console.

Why do you use cp65001?

--

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



[issue12625] sporadic test_unittest failure

2011-07-25 Thread STINNER Victor

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

 getpid() is called after each kill(getpid(), signum),
 to force the signal delivery

Please write a function (in test.support?) with a comment explaining why you 
are doing that.

You may also only do this workaround on specific platforms. For example, only 
on FreeBSD and OpenIndiana (the test would be in the function).

--

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



[issue10883] urllib: socket is not closed explicitly

2011-07-25 Thread STINNER Victor

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

Thanks for your patch. ResourceWarning are really useful!

--

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



[issue12637] logging lastResort handler not ignoring messages less than WARNING

2011-07-25 Thread Xavier de Gaye

New submission from Xavier de Gaye xdeg...@gmail.com:

The 'Advanced Logging Tutorial' states about the lastResort handler:
The handler’s level is set to WARNING, so all events at this and
greater severities will be output.

Python 3.2 does not follow this behavior:

Python 3.2 (r32:88445, Jun 18 2011, 20:30:18)
[GCC 4.3.2] on linux2
Type help, copyright, credits or license for more information.
 import logging
 root = logging.getLogger()
 root.setLevel('DEBUG')
 root.warning('warning msg')
warning msg
 root.debug('debug msg')
debug msg
 

This is fixed with the attached patch:

Type help, copyright, credits or license for more information.
 import logging
 root = logging.getLogger()
 root.setLevel('DEBUG')
 root.warning('warning msg')
warning msg
 root.debug('debug msg')


--
components: Library (Lib)
files: logging_lastResort.patch
keywords: patch
messages: 141085
nosy: xdegaye
priority: normal
severity: normal
status: open
title: logging lastResort handler not ignoring messages less than WARNING
type: behavior
versions: Python 3.2
Added file: http://bugs.python.org/file22748/logging_lastResort.patch

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



[issue12463] Calling SocketServer.shutdown() when server_forever() was not called will hang

2011-07-25 Thread Petri Lehtinen

Petri Lehtinen pe...@digip.org added the comment:

Attached a patch with a test and the proposed fix.

--
keywords: +needs review, patch
stage:  - patch review
versions:  -Python 2.6, Python 3.1, Python 3.4
Added file: http://bugs.python.org/file22749/issue12463.patch

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



[issue12632] Windows GPF with Code Page 65001

2011-07-25 Thread Bruce Ferris

Bruce Ferris bferri...@bferris.co.uk added the comment:

I use code page 65001 because 1) it displays the UTF-8 characters in my text 
files with echo filename on the command line, and 2) that's Microsoft's 
official (whatever that means) code page for UTF-8, and 3) it works in 
cmd.exe.

Setting aside why I use it, it IS used by some, and Python shouldn't GPF for 
ANY reason if it can be easily fixed.  Right?

Essentially, 65001 makes Microsoft's console output behave properly (at least 
with the limited characters in Lucinda Console) so I would think Python should 
consider not blowing up when it's set.  

To be honest, I just happened to have it set to 65001 to get the output from 
another program to look right and just happened to run Python to do some quick 
unrelated calculations.

Imagine my surprise when Python blew, especially when all I did was to run it.  
It's not like I asked it to do any UTF-8 or anthing!

Anyway, as far as I understand...  Any GPF is a potential back door.  So, it 
needs closing.

--

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



[issue12326] Linux 3: code should avoid using sys.platform == 'linux2'

2011-07-25 Thread Éric Araujo

Éric Araujo mer...@netwok.org added the comment:

FTR, for Debian and derivatives, doko chose to use 'linux2' when building on 
linux3.

--
title: Linux 3: tests should avoid using sys.platform == 'linux2' - Linux 3: 
code should avoid using sys.platform == 'linux2'
versions:  -Python 3.4

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



[issue12634] Random Remarks in class documentation

2011-07-25 Thread Éric Araujo

Éric Araujo mer...@netwok.org added the comment:

I have the same reading as Ezio, and the same opinion that it’s unclear and 
unhelpful.  +1 to saying that there is only one namespace for data attributes 
and methods.

--

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



[issue12632] Windows GPF with Code Page 65001

2011-07-25 Thread R. David Murray

R. David Murray rdmur...@bitdance.com added the comment:

In this case it is not a potential security hole, since in fact the GPF comes 
from Python explicitly calling Abort because of a situation it can't handle, as 
indicated by the error message from Python.  (If it were a true segfault-like 
error, there would be no message from Python itself.)

--
nosy: +r.david.murray

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



[issue12632] Windows GPF with Code Page 65001

2011-07-25 Thread STINNER Victor

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

 Python shouldn't GPF for ANY reason if it can be easily fixed

Code page 65001 issue cannot be easily fixed. Did you read the history of 
the issue #6058? It took one year and a half to decide that cp65001 cannot be 
set as an alias to UTF-8.

As I wrote, it will be possible to really implement a real cp65001 codec for 
Python using issue #12281.

--

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



[issue10639] reindent.py converts newlines to platform default

2011-07-25 Thread Jason R. Coombs

Jason R. Coombs jar...@jaraco.com added the comment:

I looked into the possibility of retaining newline characters even for files 
with mixed newlines, but I've decided that's too intrusive an approach. The 
current implementation specifically takes measures to strip whitespaces from 
the ends of lines, so it seems outside the scope of this bug to alter that 
behavior.

So I've taken another stab at a more robust implementation that does newline 
detection but raises an error if the file contains mixed newlines.

Furthermore, it adds an option (--newline) to specify which newline character 
to use, bypassing the mixed-newline error and allowing the user to override 
newline detection.

Here's a demo run:

PS C:\cpython-issue10639 python .\Tools\scripts\reindent.py .\foo.py
.\foo.py: mixed newlines detected; cannot continue without --newline
PS C:\cpython-issue10639 python .\Tools\scripts\reindent.py --newline CRLF 
.\foo.py
PS C:\cpython-issue10639 python .\Tools\scripts\reindent.py --newline LF 
.\foo.py
PS C:\cpython-issue10639 python .\Tools\scripts\reindent.py .\foo.py

I've published this change as 
https://bitbucket.org/jaraco/cpython-issue10639/changeset/900df5732f93.

Please review. If this changeset is acceptable, I will push the revisions to 
the master repo. Please advise if I may also backport to Python 3.2 and 2.7.

--
hgrepos: +45

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



[issue9998] ctypes find_library should search LD_LIBRARY_PATH on linux

2011-07-25 Thread Jonathan Niehof

Jonathan Niehof jnie...@lanl.gov added the comment:

Yaroslav: does the patch cause problems, or the original issue? If the former, 
could you be specific so I can try and fix it?

--

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



[issue12638] urllib.URLopener prematurely deletes files on cleanup

2011-07-25 Thread Carl

New submission from Carl c...@carlbook.com:

urllib.URLopener (or urllib.request.URLopener for Python 3) and user defined 
classes that inherit from these prematurely delete files upon cleanup.  Any 
temporary files downloaded using the .retrieve() method are deleted when an 
instance of a URLopener is garbage collected.

I feel this is a violation since the filename is returned to the caller and 
then silently deleted.  It is possible to simply override the .cleanup() 
method, but I feel this is not a good solution.

--
components: None
files: bug2.py
messages: 141094
nosy: carlbook
priority: normal
severity: normal
status: open
title: urllib.URLopener prematurely deletes files on cleanup
type: behavior
versions: Python 2.6, Python 2.7, Python 3.2
Added file: http://bugs.python.org/file22750/bug2.py

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



Re: [issue12638] urllib.URLopener prematurely deletes files on cleanup

2011-07-25 Thread Senthil Kumaran
urlretrieve is a helper function from urllib  module. The way to use
it is:

 import urllib.request
 urllib.request('http://bugs.python.org')
('/tmp/tmpe873xe', http.client.HTTPMessage object at 0xb72c2f6c)
 import os
 os.stat('/tmp/tmpe873xe')
posix.stat_result(st_mode=33152, st_ino=4462517, st_dev=2054,
st_nlink=1, st_uid=1000, st_gid=1000, st_size=33128,
st_atime=1311608669, st_mtime=1311608670, st_ctime=1311608670)

Works properly for me 3.3 and 2.7. Is there any service that is
running on your machine that deleting the tmp files as soon as they
are created?

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



[issue12638] urllib.URLopener prematurely deletes files on cleanup

2011-07-25 Thread Senthil Kumaran

Senthil Kumaran sent...@uthcode.com added the comment:

urlretrieve is a helper function from urllib  module. The way to use
it is:

('/tmp/tmpe873xe', http.client.HTTPMessage object at 0xb72c2f6c)
 import os
 os.stat('/tmp/tmpe873xe')

Works!

--

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



[issue12638] urllib.URLopener prematurely deletes files on cleanup

2011-07-25 Thread Senthil Kumaran

Senthil Kumaran sent...@uthcode.com added the comment:

Tracker stripped off the code. Here is it.

import urllib.request
urllib.request.urlretrieve('http://bugs.python.org')
('/tmp/tmpe873xe', http.client.HTTPMessage object at 0xb72c2f6c)
import os
os.stat('/tmp/tmpe873xe')
posix.stat_result(st_mode=33152, st_ino=4462517, st_dev=2054, st_nlink=1, 
st_uid=1000, st_gid=1000, st_size=33128, st_atime=1311608669, 
st_mtime=1311608670, st_ctime=1311608670)

--

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



[issue12639] msilib Directory.start_component() fails if keyfile is not None

2011-07-25 Thread John Keeping

New submission from John Keeping john.keep...@lineone.net:

If msilib.Directory.start_component() is called with the keyfile argument not 
None then it attempts to call self.cab.gen_id(self.absolute, keyfile) but the 
msilib.CAB.gen_id() method takes only two arguments (not three).

--
components: Windows
files: msilib.gen_id.patch
keywords: patch
messages: 141098
nosy: john.keeping
priority: normal
severity: normal
status: open
title: msilib Directory.start_component() fails if keyfile is not None
versions: Python 2.6, Python 2.7, Python 3.1, Python 3.2, Python 3.3, Python 3.4
Added file: http://bugs.python.org/file22751/msilib.gen_id.patch

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



[issue11784] multiprocessing.Process.join: timeout argument doesn't specify time unit.

2011-07-25 Thread Roundup Robot

Roundup Robot devn...@psf.upfronthosting.co.za added the comment:

New changeset 8d67fd820627 by Charles-François Natali in branch 'default':
Issue #11784: Improve multiprocessing.Process.join() documentation. Patch by
http://hg.python.org/cpython/rev/8d67fd820627

--
nosy: +python-dev

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



[issue11784] multiprocessing.Process.join: timeout argument doesn't specify time unit.

2011-07-25 Thread Charles-François Natali

Charles-François Natali neolo...@free.fr added the comment:

Committed to default.
Patrick, thanks for the patch!

--
nosy: +neologix
resolution:  - fixed
stage: patch review - committed/rejected
status: open - closed
versions:  -Python 2.7

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



[issue12625] sporadic test_unittest failure

2011-07-25 Thread Charles-François Natali

Charles-François Natali neolo...@free.fr added the comment:

 Please write a function (in test.support?) with a comment explaining why you
 are doing that.
 You may also only do this workaround on specific platforms. For example,
 only on FreeBSD and OpenIndiana (the test would be in the function).

There's already a comment right before the first call to getpid(). I
thought about making it a function, but since it's such a kludge, it
dropped the idea. I don't mind making it a function, though.
As for calling this only on specific platforms, well, I don't know
exactly which platforms are affected, so I stayed on the safe side
(for example, is FreeBSD4 affected?).

But I'd like first to make sure this works. IIRC, you have access to a
FreeBSD6 box. Could you test it there and see if it works?

I promise, I'll soon setup a clone to be able to test my patches on
the buildbot. I just have to select Server-side clone on
http://hg.python.org/cpython/# ?

--

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



[issue12638] urllib.URLopener prematurely deletes files on cleanup

2011-07-25 Thread Carl

Carl c...@carlbook.com added the comment:

@orsenthil, that is the correct behavior if you do not want to override any of 
URLopener's handlers for error codes.  In my case, I wanted to override 
FancyURLopener (a child class of URLopener) to override HTTP 401 behavior.  
Using urlretrieve is not correct in this case.

Also included python 3.2 code, I didn't test 3.1.

--
Added file: http://bugs.python.org/file22752/bug3.py

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



[issue12634] Random Remarks in class documentation

2011-07-25 Thread Terry J. Reedy

Terry J. Reedy tjre...@udel.edu added the comment:

That sentence is wrong to imply that there is anything special about data 
versus method attributes with respect to overriding -- or that attributes are 
special when it comes to names in a single namespace. What I think the 
paragraph should say, if not just deleted, is something like.

Instance attributes hide class attributes. Instance data names are often 
intended to override class data names. But instance data names masking methods 
names is likely a mistake. This can be avoided by using verbs for method names 
and nouns for data names.

--

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



[issue12463] Calling SocketServer.shutdown() when server_forever() was not called will hang

2011-07-25 Thread Марк Коренберг

Марк Коренберг socketp...@gmail.com added the comment:

Yes, this is what I want. Thanks.

--

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



[issue12463] Calling SocketServer.shutdown() when server_forever() was not called will hang

2011-07-25 Thread Charles-François Natali

Charles-François Natali neolo...@free.fr added the comment:

Seems reasonable to me.
What bothers me is this comment in shutdown's docstring:

Stops the serve_forever loop.

Blocks until the loop has finished. This must be called while
serve_forever() is running in another thread, or it will
deadlock.


I'm adding Giampaolo to the nosy list, to get his input on this.

--
nosy: +giampaolo.rodola, neologix

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



[issue6477] Pickling of NoneType raises PicklingError

2011-07-25 Thread Jason R. Coombs

Jason R. Coombs jar...@jaraco.com added the comment:

I've encountered a use-case where the need to pickle NoneType is more relevant 
(and difficult to work around).

We have a strongly-type Limited Python language, LimPy, which is based on 
Python (https://bitbucket.org/yougov/limpy). This parser takes, as part of its 
initialization arguments, a type specification (indicating which types are 
allowed and not allowed). In some cases, the return value may be `None`, in 
which case the specification says the type must be `NoneType`.

We're attempting to run this parser in a separate process, using the 
multiprocessing module, which requires that the arguments passed to and from 
the parser be pickleable. Unfortunately, because `NoneType` is in the type 
specification, it cannot be passed to the parser.

Here's an example of one such type specification (from the test suite):

class SomeFunctionNamespace:
@signature([IListType], [], None, ListOfInt)
def listcount(self, l):
return range(len(l))

@signature([IListType], [], None, int)
def listlen(self, l):
return len(l)

# ...

@signature([IIntType], [IStringType], IStringType, NoneType)
def givespec(self, *args):
for a in args:
print a


Note that we can pickle `str` and `int` just fine. Only type(None) fails.

It would be possible to re-write the entire LimPy system (and its child 
projects) to use a different object where currently NoneType is used, though 
NoneType is precisely the right thing to be used here except that it can't be 
pickled.

Since type(None) is a fundamental Python type, it strikes me as a bug that it's 
not pickleable, though I concede that it's also reasonable to interpret this 
issue as a feature request (as it's never been pickleable).

Nick makes some good comments that pickling of NoneType should be done right, 
but other than that, there haven't been any reasons why in principle NoneType 
should not be pickleable.

NoneType is more akin to `str` and `int` which are pickleable than it is to a 
function or type(NotImplemented), and this is evident by the way that LimPy 
uses it (before there was any consideration for pickleability).

Therefore, I propose we reconsider that NoneType should be made pickleable.

--
nosy: +jaraco

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



[issue6419] Broken test_kqueue.py on OpenBSD

2011-07-25 Thread Charles-François Natali

Charles-François Natali neolo...@free.fr added the comment:

Stephan, did you apply the patch?

I think the failures you were experiencing on amd64 could be due to issue 
#12181: OpenBSD's struct kevent definition differs from FreeBSD/NetBSD, which 
can trigger a segfault on sparc64 (which doesn't allow unaligned access).

By the way, Henry, would you be interested in writting a patch for issue #12181?

--
nosy: +neologix

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



[issue12632] Windows GPF with Code Page 65001

2011-07-25 Thread Bruce Ferris

Bruce Ferris bferri...@bferris.co.uk added the comment:

I disagree with the it's not really a GPF since it calls Abort.

Consider the following cmd.exe session...

  Microsoft Windows [Version 6.0.6002]
  Copyright (c) 2006 Microsoft Corporation.  All rights reserved.

  D:\chcp 65001
  Active code page: 65001

  D:\python t.txt
  Fatal Python error: Py_Initialize: can't initialize sys standard streams
  LookupError: unknown encoding: cp65001

  This application has requested the Runtime to terminate it in an unusual way.
  Please contact the application's support team for more information.

  D:\type t.txt

  D:\dir t.txt
  Volume in drive D is DATA
  Volume Serial Number is 2E61-626C

  Directory of D:\

  25/07/2011  06:10 PM 0 t.txt
 1 File(s)  0 bytes
 0 Dir(s)  16,768,655,360 bytes free

  D:\

This means that, even if it was intentional, from a programatic point of 
view. the Python process in this case leaves no other indication other than 
transient bytes in the transient cmd.exe console buffer.  No way of redirecting 
the output and examining it.

I strongly disagree with the statement (If it were a true segfault-like error, 
there would be no message from Python itself.)

The no message from Python itself case is shown above.

My application handles code page 65001 just fine, no problems.  If it attempts 
to use Windows WriteConsole function and it fails, it tries using WriteFile 
instead.  So, when my application fails and output is redirected, it produces 
output.

But, Python 3.1 doesn't.  See the following Microsoft MSDN link, it states the 
WriteConsole point explicitly...

  http://msdn.microsoft.com/en-us/library/ms687401%28v=VS.85%29.aspx

So, if Python doesn't like Code Page 65001, for whatever reason, it can simply 
save it on startup, and change it to whatever makes it happy.  Then, upon 
Python exit (including Abort), change it back to 65001 before calling Abort.

I'm sorry, but the following is easy in my book...

  1) At Startup...  Call GetConsoleOutputCP and save that somewhere.

If code page is 65001, change it to something that
doesn't cause problems by calling SetConsoleOutputCP

  2) On Write... If WriteConsole fails, try calling WriteFile instead.

  3) At Abort or Exit... Call SetConsoleOutputCP to set it back
 to whatever it was on Startup.

I don't care if your app (Python) can display UTF-8 on Microsoft's cmd.exe 
console or if it can't. 

All I'm trying to do is point out a bit of misbehaviour that CAN be easily 
changed and will make your product more resilient.

I don't know the details of how Python deals with character encoding and, quite 
honestly, I shouldn't need to since it's not my product.  however, I DO know 
how I handle a similiar scenario in my own app.

Microsoft made it complicated, not me.  But, I can easily get around the 
problem using the above scenario.  If Python can't do it just as easily, then 
it tells me more about Python's implementation and the people behind Python 
then it tells me about Microsoft and the people behind Windows.

Don't get me wrong, I love Python as a tool for solving certain classes of 
problems and, please, keep up the good work.  It's appreciated.

--

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



[issue12463] Calling SocketServer.shutdown() when server_forever() was not called will hang

2011-07-25 Thread Petri Lehtinen

Petri Lehtinen pe...@digip.org added the comment:

OK, so this is intentional. But why? Why does it *have to* block on every call? 
It would be more reasonable to make in not block if serve_forever() is not 
running and for example add a function to check whether serve_forever() is 
running or not.

If for some reason it has to fail when serve_forever() is not running, a 
deadlock is still not good. An exception would be better.

--

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



[issue12614] Allow to explicitly set the method of urllib.request.Request

2011-07-25 Thread Miki Tebeka

Changes by Miki Tebeka miki.teb...@gmail.com:


--
hgrepos: +46
Added file: http://bugs.python.org/file22753/request-method.diff

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



[issue12463] Calling SocketServer.shutdown() when server_forever() was not called will hang

2011-07-25 Thread Giampaolo Rodola'

Giampaolo Rodola' g.rod...@gmail.com added the comment:

IMHO, both methods should raise an exception (RuntimeError maybe) in case the 
server is already started or stopped, at least in Python 3.3, while previous 
python versions should silently pass.

It also makes sense to add a running property returning a bool, as suggested 
by Petri.

--

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



[issue12632] Windows GPF with Code Page 65001

2011-07-25 Thread R. David Murray

R. David Murray rdmur...@bitdance.com added the comment:

If you read what I wrote, I did not say that it wasn't a GPF.  I said that an 
Abort is different from writing into or reading from memory incorrectly (which 
is what leads to security holes).

We don't have many Windows developers active enough to have gotten commit 
privileges, but perhaps one of them will be have time enough to take a look at 
your suggestion.

--

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



[issue12464] tempfile.TemporaryDirectory.cleanup follows symbolic links

2011-07-25 Thread Petri Lehtinen

Petri Lehtinen pe...@digip.org added the comment:

Attached a patch that fixes the issue and adds a test case for it.

--
keywords: +needs review, patch
stage:  - patch review
Added file: http://bugs.python.org/file22754/issue12464.patch

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



[issue12637] logging lastResort handler not ignoring messages less than WARNING

2011-07-25 Thread Roundup Robot

Roundup Robot devn...@psf.upfronthosting.co.za added the comment:

New changeset d11a1a373f58 by Vinay Sajip in branch '3.2':
Fixes #12637: Last resort messages now correctly handled. Thanks to Xavier de 
Gaye for the patch.
http://hg.python.org/cpython/rev/d11a1a373f58

New changeset de13ce98ca3b by Vinay Sajip in branch 'default':
Fixes #12637: Merged fix from 3.2 and added test.
http://hg.python.org/cpython/rev/de13ce98ca3b

--
nosy: +python-dev

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



[issue12464] tempfile.TemporaryDirectory.cleanup follows symbolic links

2011-07-25 Thread Petri Lehtinen

Petri Lehtinen pe...@digip.org added the comment:

Adding potential reviewers to nosy list.

--
nosy: +georg.brandl, ncoghlan

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



[issue12637] logging lastResort handler not ignoring messages less than WARNING

2011-07-25 Thread Vinay Sajip

Changes by Vinay Sajip vinay_sa...@yahoo.co.uk:


--
assignee:  - vinay.sajip
nosy: +vinay.sajip
resolution:  - fixed
status: open - closed
versions: +Python 3.3

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



[issue9998] ctypes find_library should search LD_LIBRARY_PATH on linux

2011-07-25 Thread Yaroslav Bulatov

Yaroslav Bulatov yarosla...@gmail.com added the comment:

Sorry for confusion, I meant the original problem causes problems. I haven't 
tested the patch because my target machines don't have gcc

--

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



[issue12439] BaseHTTPServer's send_reponse adds extra \r\n when using HTTPMessage in input

2011-07-25 Thread Petri Lehtinen

Changes by Petri Lehtinen pe...@digip.org:


--
status: open - closed

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



[issue12611] 2to3 crashes when converting doctest using reduce()

2011-07-25 Thread Aaron Meurer

Changes by Aaron Meurer asmeu...@gmail.com:


--
nosy: +Aaron.Meurer

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



[issue12463] Calling SocketServer.shutdown() when server_forever() was not called will hang

2011-07-25 Thread Giampaolo Rodola'

Giampaolo Rodola' g.rod...@gmail.com added the comment:

Patch in attachment (tests still missing).

--
Added file: http://bugs.python.org/file22755/socketserver.patch

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



[issue6419] Broken test_kqueue.py on OpenBSD

2011-07-25 Thread Stefan Krah

Stefan Krah stefan-use...@bytereef.org added the comment:

No, I didn't commit it. Currently I don't have an amd64 OpenBSD install to do 
further testing.

The problem could be #12181, it could also be qemu, which sometimes has
issues with OpenBSD.

--

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



[issue12380] bytearray methods center, ljust, rjust don't accept a bytearray as the fill character

2011-07-25 Thread Petri Lehtinen

Petri Lehtinen pe...@digip.org added the comment:

 The solution could be global, to allow bytearray fit the 'c' format of
 PyArg_ParseTuple. Then one would also be able to pass a bytearray into
 other stringlib methods requiring the 'c' format.

Another possibility would be the change the 'c' format so that it accepts any 
object that supports the buffer protocol and whose buffer length is 1.

Attaching two patches: The first allows bytes and bytearray, the second allows 
any object that supports the buffer protocol.

--
keywords: +patch
Added file: http://bugs.python.org/file22756/c_format_bytearray.patch

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



[issue12380] bytearray methods center, ljust, rjust don't accept a bytearray as the fill character

2011-07-25 Thread Petri Lehtinen

Changes by Petri Lehtinen pe...@digip.org:


Added file: http://bugs.python.org/file22757/c_format_buffer.patch

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



[issue12380] bytearray methods center, ljust, rjust don't accept a bytearray as the fill character

2011-07-25 Thread Petri Lehtinen

Changes by Petri Lehtinen pe...@digip.org:


--
keywords: +needs review
stage: needs patch - patch review

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



[issue12547] whatsnew/3.3: error in example about nntplib

2011-07-25 Thread July Tikhonov

July Tikhonov july.t...@gmail.com added the comment:

The very same example (with the same error) can be found in
Doc/library/nntplib.rst

--
resolution: fixed - 
status: closed - open
Added file: http://bugs.python.org/file22758/library.nntplib.rst.diff

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



[issue12560] libpython.so not built on OpenBSD

2011-07-25 Thread Stefan Krah

Stefan Krah stefan-use...@bytereef.org added the comment:

For the record: The other failures I mentioned were almost certainly
OpenBSD 4.5 / autoconf specific, so I didn't bother. Cairo has a
workaround, but I think that goes too far.

http://cairo.sourcearchive.com/documentation/1.9.4/cairo-atomic-private_8h-source.html

/* The autoconf on OpenBSD 4.5 produces the malformed constant name
 * SIZEOF_VOID__ rather than SIZEOF_VOID_P.  Work around that here. */
#if !defined(SIZEOF_VOID_P)  defined(SIZEOF_VOID__)
# define SIZEOF_VOID_P SIZEOF_VOID__
#endif

--

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



[issue11877] Change os.fsync() to support physical backing store syncs

2011-07-25 Thread Steffen Daode Nurpmeso

Steffen Daode Nurpmeso sdao...@googlemail.com added the comment:

 Are you willing to update your patch accordingly?

I'm a vain rooster!  I've used fullfsync() in 11877-standalone.1.diff!
Sorry for that, haypo.  :-/

11877.fullsync-1.diff uses fullsync() and will instead always be
provided when fsync() is available, to which it will fall back if
no special operating system functionality is available.

I really think this is the cleanest solution, because like this
a user can state i want the strongest guarantees available on
data integrity, and Python does just that.

--Steffen
Ciao, sdaoden(*)(gmail.com)
ASCII ribbon campaign   ( ) More nuclear fission plants
  against HTML e-mailXcan serve more coloured
and proprietary attachments / \ and sounding animations

--
Added file: http://bugs.python.org/file22759/11877.fullsync-1.diff

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11877
___diff --git a/Doc/library/os.rst b/Doc/library/os.rst
--- a/Doc/library/os.rst
+++ b/Doc/library/os.rst
@@ -706,6 +706,31 @@
Availability: Unix, and Windows starting in 2.2.3.
 
 
+.. function:: fullsync(fd)
+
+   The POSIX standart requires that :c:func:`fsync` must transfer the buffered
+   data to the storage device, not that the data is actually written by the
+   device itself.  It explicitely leaves it up to operating system implementors
+   whether users are given stronger guarantees on data integrity or not.  Some
+   systems also offer special functions which overtake the part of making such
+   stronger guarantees, i.e., Mac OS X and NetBSD.  :func:`fullsync` is
+   identical to :func:`fsync` unless there is such special functionality
+   available, in which case that will be used.
+   To strive for best-possible data integrity, the following can be done::
+
+  # Force writeout of local buffer modifications
+  f.flush()
+  # Then synchronize the changes to physical backing store
+  if hasattr(os, 'fsync'):
+ os.fullsync(f.fileno())
+
+   ..note::
+  Calling this function may take a long time, since it may block
+  until the disk reports that the transfer has been completed.
+
+   Availability: See :func:`fsync`.
+
+
 .. function:: ftruncate(fd, length)
 
Truncate the file corresponding to file descriptor *fd*, so that it is at 
most
diff --git a/Lib/test/test_os.py b/Lib/test/test_os.py
--- a/Lib/test/test_os.py
+++ b/Lib/test/test_os.py
@@ -554,7 +554,7 @@
 
 class TestInvalidFD(unittest.TestCase):
 singles = [fchdir, fdopen, dup, fdatasync, fstat,
-   fstatvfs, fsync, tcgetpgrp, ttyname]
+   fstatvfs, fsync, fullsync, tcgetpgrp, ttyname]
 #singles.append(close)
 #We omit close because it doesn'r raise an exception on some platforms
 def get_single(f):
diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c
--- a/Modules/posixmodule.c
+++ b/Modules/posixmodule.c
@@ -1855,6 +1855,42 @@
 {
 return posix_fildes(fdobj, fsync);
 }
+
+PyDoc_STRVAR(fullsync__doc__,
+fullsync(fd)\n\n
+force write of file buffers to disk, and the flush of disk caches\n
+of the file given by file descriptor fd.);
+
+static PyObject *
+fullsync(PyObject *self, PyObject *fdobj)
+{
+/* See issue 11877 discussion */
+int res, fd = PyObject_AsFileDescriptor(fdobj);
+if (fd  0)
+return NULL;
+if (!_PyVerify_fd(fd))
+return posix_error();
+
+Py_BEGIN_ALLOW_THREADS
+# if defined __APPLE__
+/* F_FULLFSYNC is not supported for all types of FDs/FSYSs;
+ * be on the safe side and test for inappropriate ioctl errors.
+ * Because plain fsync() may succeed even then, let it decide about error 
*/
+res = fcntl(fd, F_FULLFSYNC);
+if (res  0  errno == ENOTTY)
+res = fsync(fd);
+# elif defined __NetBSD__
+res = fsync_range(fd, FFILESYNC | FDISKSYNC, 0, 0);
+# else
+res = fsync(fd);
+# endif
+Py_END_ALLOW_THREADS
+
+if (res  0)
+return posix_error();
+Py_INCREF(Py_None);
+return Py_None;
+}
 #endif /* HAVE_FSYNC */
 
 #ifdef HAVE_FDATASYNC
@@ -8953,6 +8989,7 @@
 #endif
 #ifdef HAVE_FSYNC
 {fsync,   posix_fsync, METH_O, posix_fsync__doc__},
+{fullsync,fullsync, METH_O, fullsync__doc__},
 #endif
 #ifdef HAVE_FDATASYNC
 {fdatasync,   posix_fdatasync,  METH_O, posix_fdatasync__doc__},
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue12464] tempfile.TemporaryDirectory.cleanup follows symbolic links

2011-07-25 Thread Charles-François Natali

Charles-François Natali neolo...@free.fr added the comment:

I'm not sure I see what the problem is:
- if the idea behind this is the risk of symlink attack (like issue #4489), 
it's not the case here, because the directory is created with 0600 permission
- furthermore, the attached patch has a TOCTTOU race, between the the call to 
os.path.islink() and the call to rmtree()

So I'd like to know the problem we're trying to solve here.

--
nosy: +neologix

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



[issue12633] sys.modules doc entry should reflect restrictions

2011-07-25 Thread Eric Snow

Eric Snow ericsnowcurren...@gmail.com added the comment:

Would an implementation detail note be inappropriate here?  I only ask because 
it looks like the imp module's use of interp-modules is implementation 
specific.

Here's a patch for Doc/library/sys.rst that adds the note.

--
assignee:  - docs@python
components: +Documentation
keywords: +patch
nosy: +docs@python
title: sys.modules gets special treatment - sys.modules doc entry should 
reflect restrictions
Added file: http://bugs.python.org/file22760/sys_modules_doc.diff

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



[issue11871] test_default_timeout() of test_threading.BarrierTests failure: BrokenBarrierError

2011-07-25 Thread Charles-François Natali

Charles-François Natali neolo...@free.fr added the comment:

The attached patch bumps the barrier's default timeout to 300ms: it should be 
more than enough (unless you got a really crappy scheduler, or a really heavily 
loaded machine), especially since this problem doesn't seem to occur often 
(AFAICT).

--
keywords: +needs review, patch
stage:  - patch review
Added file: http://bugs.python.org/file22761/test_barrier_timeout.diff

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



[issue1641] asyncore delayed calls feature

2011-07-25 Thread Giampaolo Rodola'

Giampaolo Rodola' g.rod...@gmail.com added the comment:

This patch is now available as a recipe for python 2.x:
http://code.activestate.com/recipes/577808-asyncore-scheduler/

--
versions: +Python 3.3 -Python 3.2

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



[issue12463] Calling SocketServer.shutdown() when server_forever() was not called will hang

2011-07-25 Thread Giampaolo Rodola'

Giampaolo Rodola' g.rod...@gmail.com added the comment:

New patch including tests.

--
Added file: http://bugs.python.org/file22762/socketserver.patch

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



[issue12613] itertools fixer fails

2011-07-25 Thread Aaron Meurer

Changes by Aaron Meurer asmeu...@gmail.com:


--
nosy: +Aaron.Meurer

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



[issue12616] zip fixer fails on zip()[:-1]

2011-07-25 Thread Aaron Meurer

Changes by Aaron Meurer asmeu...@gmail.com:


--
nosy: +Aaron.Meurer

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



[issue12463] Calling SocketServer.shutdown() when server_forever() was not called will hang

2011-07-25 Thread Antoine Pitrou

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

Can you explain the issue a bit more?
If thread A calls shutdown(), and thread B calls serve_forever() a bit later, 
thread A should IMO wait for serve_forever() to finish.

--
nosy: +pitrou

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



[issue12380] bytearray methods center, ljust, rjust don't accept a bytearray as the fill character

2011-07-25 Thread Antoine Pitrou

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

c_format_bytearray.patch looks ok to me. The other proposal is too broad, and 
may lead to confusing behaviour.
In any case, some tests are needed.

--

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



[issue12464] tempfile.TemporaryDirectory.cleanup follows symbolic links

2011-07-25 Thread Antoine Pitrou

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

Without even mentioning the possibility attacks, I think it's wrong for the 
cleanup routine to follow symbolic links. It should instead simply remove the 
links, and not mess with anything outside of the temporary directory.

Note that shutil.rmtree() does the right thing by calling lstat(). 
TemporaryDirectory interestingly uses a stripped down version of rmtree which 
doesn't retain that subtlety.

--
nosy: +pitrou

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



[issue6419] Broken test_kqueue.py on OpenBSD

2011-07-25 Thread Antoine Pitrou

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


--
components: +Library (Lib)
nosy: +haypo
stage:  - patch review
type:  - behavior
versions: +Python 3.3 -Python 2.6, Python 3.1

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



[issue12231] regrtest: add -k and -K options to filter tests by function/file names

2011-07-25 Thread Antoine Pitrou

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

This patch doesn't work if run_unittest() is called with an already constructed 
test suite or test case (the patch in #12626 does).

--
nosy: +pitrou

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



[issue12640] test_ctypes seg fault (test_callback_register_double); armv7; gcc 4.5.1

2011-07-25 Thread python272

New submission from python272 letters.rando...@gmail.com:

[meego]$/opt/org.python.python-2.7.2/bin/python -m test.regrtest ...
...
test_callback_register_double 
(ctypes.test.test_callbacks.SampleCallbacksTestCase) ... Segmentation fault

this is after a native (not cross-compile) configure; make; make install on 
armv7:
== CPython 2.7.2 (default, Jul 25 2011, 11:06:06) [GCC 4.5.1 20100731 (MeeGo 
4.5.1-1) [release 4.5-2010.09-1]]
==   Linux-2.6.37-24.5.CE-adaptation-n900-armv7l-with-glibc2.4 little-endian
==   /tmp/test_python_6700
Testing with flags: sys.flags(debug=0, py3k_warning=0, division_warning=0, 
division_new=0, inspect=0, interactive=0, optimize=0, dont_write_bytecode=0, 
no_user_site=0, no_site=0, ignore_environment=0, tabcheck=0, verbose=0, 
unicode=0, bytes_warning=0)

that is the only regrtest seg fault, but there are several worrisome(?) 
failures in test_ctypes:
...
==
FAIL: test_longlongresult (ctypes.test.test_functions.FunctionTestCase)
--
Traceback (most recent call last):
  File 
/opt/org.python.python-2.7.2/lib/python2.7/ctypes/test/test_functions.py, 
line 167, in test_longlongresult
self.assertEqual(result, 21)
AssertionError: 10L != 21
...
Ran 335 tests in 3.949s

FAILED (failures=17, errors=1, skipped=1)
test test_ctypes failed -- multiple errors occurred
1 test failed:
test_ctypes


a few other test modules have failures, they appear to be less severe:
test_cmath 
test_float 
#http://bugs.python.org/issue12331
test_lib2to3 
test_math 
test_pyexpat 
test_strtod


=
note: the arm systems i have access to (meego armv7  android sl4a/py4a) both 
natively use python  2.6.7; forgive my ignorance if 2.7 series is not expected 
to be mature on arm. please also forgive if i should have just disabled ctypes 
in setup.py as many of the online (cross-compile) instructions suggest:
disabled_module_list.append('_ctypes')
===

test_ctypes for a native build of 2.6.7 does not seg fault, but does have the 
same test failures:

...
Ran 327 tests in 3.025s

FAILED (failures=17)
test test_ctypes failed -- multiple errors occurred
1 test failed:
test_ctypes

--
components: Tests
messages: 141131
nosy: python272
priority: normal
severity: normal
status: open
title: test_ctypes seg fault (test_callback_register_double); armv7; gcc 4.5.1
type: crash
versions: Python 2.7

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



[issue11049] add tests for test.support

2011-07-25 Thread Brett Cannon

Brett Cannon br...@python.org added the comment:

On Fri, Jul 22, 2011 at 22:47, Eli Bendersky rep...@bugs.python.org wrote:


 Eli Bendersky eli...@gmail.com added the comment:

 Brett, what do you mean by listed as an essential test in regrtest. The
 regrtest.STDTESTS list?


Yes

--
Added file: http://bugs.python.org/file22763/unnamed

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11049
___brbrdiv class=gmail_quoteOn Fri, Jul 22, 2011 at 22:47, Eli Bendersky 
span dir=ltrlt;a 
href=mailto:rep...@bugs.python.org;rep...@bugs.python.org/agt;/span 
wrote:brblockquote class=gmail_quote style=margin:0 0 0 
.8ex;border-left:1px #ccc solid;padding-left:1ex;

div class=imbr
Eli Bendersky lt;a href=mailto:eli...@gmail.com;eli...@gmail.com/agt; 
added the comment:br
br
/divBrett, what do you mean by quot;listed as an essential test in 
regrtestquot;. The regrtest.STDTESTS list?br/blockquotedivbrYes 
br/div/div
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue12615] add array.zeroes

2011-07-25 Thread Nick Coghlan

Nick Coghlan ncogh...@gmail.com added the comment:

Compare however the behaviour of bytes() and bytearray() which support direct 
zero initialisation of a region of memory by passing an integer to their 
constructor.

--
nosy: +ncoghlan

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



[issue12615] add array.zeroes

2011-07-25 Thread Santoso Wijaya

Changes by Santoso Wijaya santoso.wij...@gmail.com:


--
nosy: +santa4nt

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



[issue12464] tempfile.TemporaryDirectory.cleanup follows symbolic links

2011-07-25 Thread Nick Coghlan

Nick Coghlan ncogh...@gmail.com added the comment:

I agree with Antoine - it's a simple bug introduced by the attempt to allow 
temporary directories to be correctly cleaned up during interpreter shutdown.

The race condition due to the usage of LBYL is shared with the full 
shutil.rmtree implementation, so the patch looks reasonable to me.

--

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



[issue12607] subprocess(stdout=..., stderr=sys.stdout) breaks stderr for child

2011-07-25 Thread Ross Lagerwall

Ross Lagerwall rosslagerw...@gmail.com added the comment:

communicate() requires setting stdin, stdout and stderr to subprocess.PIPE 
which defeats the purpose of the test: setting them to 0, 1 and 2 (in various 
orders) so that they need to be swapped...

--

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