[issue12021] mmap.read requires an argument

2011-05-07 Thread John O'Connor

Changes by John O'Connor :


--
nosy: +jcon

___
Python tracker 

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



[issue10154] locale.normalize strips "-" from UTF-8, which fails on Mac

2011-05-07 Thread Ronald Oussoren

Ronald Oussoren  added the comment:

The attached patch implements the change that Marc-Andre proposed.

I intend to apply this patch to all active branches later today (after some 
more testing)

--
keywords: +patch
Added file: http://bugs.python.org/file21916/issue10154.patch

___
Python tracker 

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



[issue12003] documentation: alternate version of xrange seems to fail.

2011-05-07 Thread Terry J. Reedy

Terry J. Reedy  added the comment:

I verified bug on winxp with 2.7
xrangef [5, 4, 3, 2, 1, 0]
py26 []
py27 [5, 4, 3, 2, 1, 0, -1, -2]
v1 [5, 4, 3, 2, 1, 0]
v2 [5, 4, 3, 2, 1, 0]
v3 [5, 4, 3, 2, 1, 0]
---
xrangef [5, 3, 1, -1, -3]
py26 []
py27 [5, 3, 1, -1, -3, -5]
v1 [5, 3, 1, -1, -3]
v2 [5, 3, 1, -1, -3]
v3 [5, 3, 1, -1, -3]

The problem is that -1 should instead be +1 for negative steps. The 2.6 version 
completely failed for negative steps because the comparison needs to be 
reversed. The doc example could add "for positive steps. For negative steps, 
use '+1' instead of '-1'". Or change expression to
islice(count(start, step), (stop-start+step-1+2*(step<0))//step)
(the addition is  +2*(step<0)).
Or change -1 to +(-1 if step>0 else 1). I tested both.

--
nosy: +terry.reedy

___
Python tracker 

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



[issue10466] locale.py resetlocale throws exception on Windows (getdefaultlocale returns value not usable in setlocale)

2011-05-07 Thread Jan Killian

Changes by Jan Killian :


--
nosy: +iki

___
Python tracker 

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



[issue11916] A few errnos from OSX

2011-05-07 Thread Ronald Oussoren

Ronald Oussoren  added the comment:

This shell-fragment lists which names in /usr/include/sys/errno don't exist in 
errnomodule.h:

$ grep '#define[  ]*E' /usr/include/sys/errno.h  | 
awk '{ print $2 }' | grep -v '^ELAST$' | 
while read name; do 
grep -q $name Modules/errnomodule.c || echo $name; 
done | sort

The following names in your list are already part in errnomodule.h:

* ECANCELED
* ENOTSUP

The patch looks fine otherwise. I'm currently rebuilding python3.3 and will 
commit the patch if everything works properly.

--

___
Python tracker 

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



[issue11916] A few errnos from OSX

2011-05-07 Thread Ronald Oussoren

Ronald Oussoren  added the comment:

And the patch works properly, with the patch applied (except for the two names 
I mentioned earlier):


$ DYLD_FRAMEWORK_PATH=$PWD ./python.exe
Python 3.3a0 (default:5fa92a47016c+, May  7 2011, 09:36:44) 
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import errno
>>> errno.EAUTH
80
>>> errno.ECANCELED
89
>>> errno.ENOTSUP
45
>>> errno.EPROGMISMATCH
75
>>>

--

___
Python tracker 

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



[issue12016] Wrong behavior for '\xff\n'.decode('gb2312', 'ignore')

2011-05-07 Thread Terry J. Reedy

Terry J. Reedy  added the comment:

u'' in 2.7.1 also, on winxp

--
nosy: +terry.reedy

___
Python tracker 

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



[issue12017] Decoding a highly-nested object with json (_speedups enabled) causes segfault

2011-05-07 Thread Terry J. Reedy

Changes by Terry J. Reedy :


--
versions:  -Python 2.6

___
Python tracker 

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



[issue12000] SSL certificate verification failed if no dNSName entry in subjectAltName

2011-05-07 Thread Nicolas Bareil

Nicolas Bareil  added the comment:

Hello Mads

> Until now Python failed to the safe side by not matching on 
> subjectAltName iPAddress but also not falling back to commonName
> if they were specified. AFAICS, with this change it is possible to 
> create strange certificates that Python would accept when an IP 
> address matched commonName but other implementations would reject 
> because of iPAddress mismatch.

Good point! But I think we already have this issue with a certificate 
like this one:

cert = { 'subject': ((('commonName', '192.168.1.1'),),)}
ok(cert, '192.168.1.1')

Do you think this test should fail?

--

___
Python tracker 

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



[issue11916] A few errnos from OSX

2011-05-07 Thread Roundup Robot

Roundup Robot  added the comment:

New changeset 2f978b4c02ad by Ronald Oussoren in branch 'default':
Closes Issue 11916: Add a number of MacOSX specific definitions to the errno 
module.
http://hg.python.org/cpython/rev/2f978b4c02ad

--
nosy: +python-dev
resolution:  -> fixed
stage: patch review -> committed/rejected
status: open -> closed

___
Python tracker 

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



[issue10910] pyport.h FreeBSD/Mac OS X "fix" causes errors in C++ compilation

2011-05-07 Thread Ronald Oussoren

Changes by Ronald Oussoren :


Removed file: http://bugs.python.org/file21728/unnamed

___
Python tracker 

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



[issue11994] [2.7/gcc-4.4.3] Segfault under valgrind in string.split()

2011-05-07 Thread Stefan Krah

Stefan Krah  added the comment:

Terry J. Reedy  wrote:
> "Also, the segfault only occurs when python is
> compiled with optimizations and run under valgrind."
>
> This says to me that the segfault is not a Python issue.
> What change do you expect in the Python source code?
> If none, this issue should be closed.

I think that the passage you quoted is not a strong argument for closing
the issue. I've been using Valgrind for several years, and I've never
encountered a situation where Valgrind was wrong. This includes situations
where a bug only occurs with optimizations turned on.

If anything, the fact that it so far only occurs with gcc-4.3 might
be a reason. Even so, recently an issue was kept open until someone
(I think Victor) proved that it was a compiler bug.


I'm not sure what to make of your question and its conclusion. Debugging
Valgrind issues or compiler bugs takes a lot of time, so the requirement
to pinpoint the exact problem in order to keep an issue open seems too
strict.

--

___
Python tracker 

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



[issue10154] locale.normalize strips "-" from UTF-8, which fails on Mac

2011-05-07 Thread STINNER Victor

Changes by STINNER Victor :


--
nosy: +haypo

___
Python tracker 

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



[issue10910] pyport.h FreeBSD/Mac OS X "fix" causes errors in C++ compilation

2011-05-07 Thread Ronald Oussoren

Ronald Oussoren  added the comment:

The problem is that pyport tries to replace the ctypes definion of the 
isascii(ch) and related functions by a replacement that works better with UTF-8 
on FreeBSD and OSX. That replacement is incompatible with the localfwd.h header.

The attached patch is a very crude hack that should fix the issue for this. 
This assumes that Python itself won't be compiled with C++ though, and might 
cause problems in C++ programs that use locale.h instead of localfwd.h.

As such I won't apply the patch just yet, the patch needs review from someone 
that's more experienced w.r.t. C++.

--
keywords: +needs review, patch
stage:  -> patch review
Added file: http://bugs.python.org/file21917/issue10910.txt

___
Python tracker 

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



[issue5154] OSX broken poll testing doesn't work

2011-05-07 Thread Ronald Oussoren

Changes by Ronald Oussoren :


--
resolution:  -> wont fix
status: open -> closed

___
Python tracker 

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



[issue11607] Apllication crashes when saving file

2011-05-07 Thread Ronald Oussoren

Ronald Oussoren  added the comment:

There is not enough information in the description to even know which program 
crashes, let alone to reproduce the problem.

I'm therefore closing this issues. Feel free to reopen the issue when you can 
supply more information (see the questions in the two other responses in this 
issue).

--
resolution:  -> invalid
stage:  -> committed/rejected
status: open -> closed

___
Python tracker 

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



[issue11999] sporadic failure in test_mailbox

2011-05-07 Thread STINNER Victor

STINNER Victor  added the comment:

I don't understand anything, but thanks for fixing it :-) (Or at least trying 
to fix it, buildbots will tell us.)

--
status: pending -> open

___
Python tracker 

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



[issue11277] Crash with mmap and sparse files on Mac OS X

2011-05-07 Thread STINNER Victor

STINNER Victor  added the comment:

> @haypo, @pitrou: Are there any objections to removing test_big_buffer()
from Lib/test/test_zlib.py?

I now agree Antoine: the test is useless. It can be removed today.

About mmap: add a new test for this issue (mmap on Mac OS X and F_FULLSYNC)  is 
a good idea. I suppose that we will need to backport the F_FULLSYNC fix too.

--

___
Python tracker 

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



[issue11995] test_pydoc loads all Python modules

2011-05-07 Thread STINNER Victor

STINNER Victor  added the comment:

> Isn’t the root problem that pydoc uses import rather than imp or PEP 302 
> things?  We could change that.

It's possible to get the documentation of some module without loading them: 
pydoc already supports get_source() method of a module loader.

But my concern is more about C modules: you have to load them to get their 
documentation, but you can never a unload C modules (you have to exit Python).

--

___
Python tracker 

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



[issue12016] Wrong behavior for '\xff\n'.decode('gb2312', 'ignore')

2011-05-07 Thread STINNER Victor

STINNER Victor  added the comment:

So the correct result for b'\xff\n'.decode('gb2312', 'replace') is u'?\n'?

--
versions: +Python 3.1, Python 3.2, Python 3.3

___
Python tracker 

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



[issue9971] Optimize BufferedReader.readinto

2011-05-07 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

Oops... It hadn't jumped at me earlier, but the patch is actually problematic 
performance-wise. The reason is that it doesn't buffer data at all, so small 
readintos become slower (they have to go through raw I/O every time):

$ ./python -m timeit -s "f=open('LICENSE', 'rb'); b = bytearray(4)" \
  "f.seek(0)" "while f.readinto(b): pass"
-> without patch: 2.53 msec per loop
-> with patch: 3.37 msec per loop

$ ./python -m timeit -s "f=open('LICENSE', 'rb'); b = bytearray(128)" \
  "f.seek(0)" "while f.readinto(b): pass"
-> without patch: 90.3 usec per loop
-> with patch: 103 usec per loop

The patch does make large reads faster, as expected:

$ ./python -m timeit -s "f=open('LICENSE', 'rb'); b = bytearray(4096)" \
  "f.seek(0)" "while f.readinto(b): pass"
-> without patch: 13.2 usec per loop
-> with patch: 6.71 usec per loop

(that's a good reminder for the future: when optimizing something, always try 
to measure the "improvement" :-))

One solution would be to refactor _bufferedreader_read_generic() to take an 
existing buffer, and use that.

--
stage: needs patch -> patch review

___
Python tracker 

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



[issue11962] Buildbot reliability

2011-05-07 Thread Stefan Krah

Stefan Krah  added the comment:

I think the FreeBSD bot changes are working out fine. The Ubuntu-PPC
issues were unrelated, so I'm closing this.

--
keywords: +buildbot
resolution:  -> fixed
stage:  -> committed/rejected
status: open -> closed

___
Python tracker 

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



[issue12016] Wrong behavior for '\xff\n'.decode('gb2312', 'ignore')

2011-05-07 Thread zy

zy  added the comment:

> So the correct result for b'\xff\n'.decode('gb2312', 'replace') is u'?\n'?

I think it should be so. This behavior does not leave out possible information, 
has no side-effect on later decodings, and should the '\n'  indeed be 
redundant, an output of u'?\n' would unlikely cause confusions.

Though, I have no knowledge on this subject code-wise. If a change of the 
behavior will have an impact on performance, maybe the change should not come 
in.

--

___
Python tracker 

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



[issue12016] Wrong behavior for '\xff\n'.decode('gb2312', 'ignore')

2011-05-07 Thread STINNER Victor

STINNER Victor  added the comment:

_codecs_cn implements different multibyte encodings: gb2312, gbkext, gbcommon, 
gb18030ext, gbk, gb18030.

And there are other Asian multibyte encodings: big5 family, ISO 2202 family, 
JIS family, korean encodings (KSX1001, EUC_KR, CP949, ...), Big5, CP950, ...

All of them ignore the all bytes if one byte of a multibyte sequence is invalid 
(lile 0xFF 0x0A: replaced by ? instead of ?\n using replace error handler).

I don't think that you can/should patch only one encoding: we should use the 
same rule for all encodings.

By the way, do you have any document explaining which result is the good one (? 
or ?\n)? For UTF-8, we have well defined standards explaining exactly what to 
do with invalid byte sequences => see issue #8271. It is easy to fix the 
decoders, but I would like to be sure that your proposed change is the right 
way to decode these encodings.

Change the multibyte encodings can also concern the security. Read for example 
the following section "Check byte strings before decoding them to character 
strings" of my book:
http://www.haypocalc.com/tmp/unicode-2011-03-25/html/issues.html#check-byte-strings-before-decoding-them-to-character-strings
(https://github.com/haypo/unicode_book/wiki)

--

___
Python tracker 

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



[issue12012] _ssl module doesn't compile with OpenSSL 1.0.0d: SSLv2_method is missing

2011-05-07 Thread STINNER Victor

STINNER Victor  added the comment:

> Please avoid "negative" constants. Calling it HAS_SSLv2 would be fine.

I reused the term from ssl.h (#ifdef OPENSSL_NO_SSL2), but yes we can use a 
different name.

> Also, there should be some doc update mentioning that PROTOCOL_SSLv2
> is not always present.

Ok, I will do that.

--

___
Python tracker 

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



[issue9971] Optimize BufferedReader.readinto

2011-05-07 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

A solution could be to use overlapped I/O on the named pipe handles.
The first poll() would call ReadFile() with a tiny value (1?) and store an 
object wrapping the OVERLAPPED structure. Subsequent poll() or recv() would 
re-use that structure until the overlapped read succeeds.
The hEvent in the OVERLAPPED structure should be usable in WFMO fine.

--

___
Python tracker 

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



[issue11888] Add C99's log2() function to the math library

2011-05-07 Thread STINNER Victor

STINNER Victor  added the comment:

> Thanks, Victor.  I suspect we're going to need to be a bit more
> careful, though:  when the extra tests were added for math.log, it
> turned out that it had all sorts of strange special-case behaviour on
> various platforms.
> 
> So I suspect that even on platforms that have log2 natively, it'll be
> necessary to factor out special cases and deal with those first, only
> passing positive finite floats onto the system log2.  Take a look at
> m_log and the comment directly above it to see how that works.

Oh, I see:

/*  
Various platforms (Solaris, OpenBSD) do nonstandard things for
log(0),  
log(-ve), log(NaN).  Here are wrappers for log and log10 that deal
with 
special values directly, passing positive non-special values through
to 
the system
log/log10.   
 */  

> I'd also like to check in the non-system version first, just to give
> it a thorough test on the buildbots, before adding in the version that
> uses the system log2 when available.

Yes, we can use log2() only for the "x > 0.0" case. My secret plan was
to check system log2() using the buildbots. But if we know that system
log() only works correctly with strictly positive numbers, it's faster
to directly only use system log2() for x > 0.0.

Updated patch (version 3) implements that.

--

___
Python tracker 

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



[issue11888] Add C99's log2() function to the math library

2011-05-07 Thread STINNER Victor

STINNER Victor  added the comment:

(Oh, I hit the wrong keyboard shortcut and sent my email too fast)

You can commit issue11888.patch first if you would like to test it.

In this case, here is a patch to use system log2(), patch to apply *after* 
issue11888.patch. It only uses log2() if x > 0.0.

--
Added file: http://bugs.python.org/file21918/issue11888-part2.patch

___
Python tracker 

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



[issue11888] Add C99's log2() function to the math library

2011-05-07 Thread STINNER Victor

Changes by STINNER Victor :


Removed file: http://bugs.python.org/file21897/issue11888-2.patch

___
Python tracker 

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



[issue11888] Add C99's log2() function to the math library

2011-05-07 Thread STINNER Victor

STINNER Victor  added the comment:

By the way, issue11888.patch is just fine: you can commit it. I like your frexp 
"trick" to improve the accuracy.

--

___
Python tracker 

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



[issue11277] Crash with mmap and sparse files on Mac OS X

2011-05-07 Thread Roundup Robot

Roundup Robot  added the comment:

New changeset 201dcfc56e86 by Nadeem Vawda in branch '2.7':
Issue #11277: Remove useless test from test_zlib.
http://hg.python.org/cpython/rev/201dcfc56e86

--

___
Python tracker 

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



[issue11873] test_regexp() of test_compileall fails occassionally

2011-05-07 Thread STINNER Victor

STINNER Victor  added the comment:

> You are right that I got the regex wrong (I'm bad at regexes), but
> in fact it is fine the way it is.  Since there's no r, the regex
> is actually "ba[^/]$", which is exactly what I meant.

What about Windows? tempfile.mkdtemp(prefix='bar') can generate 
...\tmpxxbaxx\... Or compileall does first normalize the path?

--

___
Python tracker 

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



[issue10419] distutils command build_scripts fails with UnicodeDecodeError

2011-05-07 Thread STINNER Victor

Changes by STINNER Victor :


--
nosy: +benjamin.peterson, georg.brandl
priority: normal -> release blocker

___
Python tracker 

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



[issue11994] [2.7/gcc-4.4.3] Segfault under valgrind in string.split()

2011-05-07 Thread Stefan Krah

Stefan Krah  added the comment:

The segfault also occurs with a self-compiled gcc-4.4.6, but not
with gcc-4.5.3.

--

___
Python tracker 

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



[issue12027] Optimize import this (patch to make it 10x faster)

2011-05-07 Thread STINNER Victor

New submission from STINNER Victor :

Patch to optimize this: make it 10 times faster.

Try attached benchmark script. On a debug build I got the following results:
 * original: 299.8 ms
 * patched: 23.2 ms

I expected a factor of 10 because it uses a C implementation of rot13 instead 
of an hand made Python implementation.

--
components: Library (Lib)
files: python27_this_rot13.patch
keywords: patch
messages: 135432
nosy: haypo
priority: normal
severity: normal
status: open
title: Optimize import this (patch to make it 10x faster)
versions: Python 2.7
Added file: http://bugs.python.org/file21919/python27_this_rot13.patch

___
Python tracker 

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



[issue12027] Optimize import this (patch to make it 10x faster)

2011-05-07 Thread STINNER Victor

Changes by STINNER Victor :


Added file: http://bugs.python.org/file21920/bench.py

___
Python tracker 

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



[issue12027] Optimize import this (patch to make it 10x faster)

2011-05-07 Thread STINNER Victor

Changes by STINNER Victor :


--
nosy: +lemburg, pitrou

___
Python tracker 

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



[issue12027] Optimize import this (patch to make it 10x faster)

2011-05-07 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

Barry, 2.6?

--
nosy: +barry, benjamin.peterson
priority: normal -> release blocker

___
Python tracker 

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



[issue11668] _multiprocessing.Connection.poll with timeout uses polling under Windows

2011-05-07 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

A solution could be to use overlapped I/O on the named pipe handles.
The first poll() would call ReadFile() with a tiny value (1?) and store an 
object wrapping the OVERLAPPED structure. Subsequent poll() or recv() would 
re-use that structure until the overlapped read succeeds.
The hEvent in the OVERLAPPED structure should be usable in WFMO fine.

--

___
Python tracker 

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



[issue9971] Optimize BufferedReader.readinto

2011-05-07 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

Uh, sorry for the last message (about overlapped I/O), wrong issue.

--

___
Python tracker 

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



[issue9971] Optimize BufferedReader.readinto

2011-05-07 Thread Antoine Pitrou

Changes by Antoine Pitrou :


--
Removed message: http://bugs.python.org/msg135425

___
Python tracker 

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



[issue9971] Optimize BufferedReader.readinto

2011-05-07 Thread Antoine Pitrou

Changes by Antoine Pitrou :


--
Removed message: http://bugs.python.org/msg135435

___
Python tracker 

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



[issue8407] expose signalfd(2) and pthread_sigmask in the signal module

2011-05-07 Thread STINNER Victor

STINNER Victor  added the comment:

> I mistakenly removed your pending_signals-2 patch
> I'm really sorry about this, could you re-post it?

No problem, anyway I worked on a new version in the train.

> So, if anything, you shouldn't check for a pending signal [in sigwait]

Right, fixed in the new patch.

--

pending_signals-3.patch:
 - don't check for pending signals in sigwait()
 - pthread_kill() doc: it is not a good idea to say that pthread_kill() with 
signum=0 can be used to check if a thread identifier is valid => such test does 
crash (SIGSEGV) on my Linux box. I changed the doc to say that it can be used 
to check if a thread is still running (which is different).
 - add a dedicated test for sigpending()
 - doc: explain how to get a thread identifier for pthread_kill()
 - don't compile pthread_kill() without threads: you cannot get a valid thread 
identifier without the _thread module

I think that the patch is ready to be commited. Anyone for a last review? 
(antoine, neologix?)

--
Added file: http://bugs.python.org/file21921/pending_signals-3.patch

___
Python tracker 

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



[issue8407] expose signalfd(2) and pthread_sigmask in the signal module

2011-05-07 Thread STINNER Victor

STINNER Victor  added the comment:

Note: we might expose pth_raise() which is similar to pthread_kill(), but... 
pth support was deprecated by the PEP 11 and pth support will be removed from 
Python 3.3 source code.

--

___
Python tracker 

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



[issue8407] expose signalfd(2) and pthread_sigmask in the signal module

2011-05-07 Thread STINNER Victor

STINNER Victor  added the comment:

About signalfd(): this patch doesn't provide any information or tool to decode 
data written to the file descriptor. We should expose the signalfd_siginfo 
structure or you cannot handle more than one signal (how do you know which 
signal numbers were raised?). Example with ctypes:

class signalfd_siginfo(Structure):
_fields_ = (
('ssi_signo', c_uint32),# Signal number
('ssi_errno', c_int32), # Error number (unused)
('ssi_code', c_int32),  # Signal code
('ssi_pid', c_uint32),  # PID of sender
('ssi_uid', c_uint32),  # Real UID of sender
('ssi_fd', c_int32),# File descriptor (SIGIO)
('ssi_tid', c_uint32),  # Kernel timer ID (POSIX timers)
('ssi_band', c_uint32), # Band event (SIGIO)
('ssi_overrun', c_uint32),  # POSIX timer overrun count
('ssi_trapno', c_uint32),   # Trap number that caused signal
('ssi_status', c_int32),# Exit status or signal (SIGCHLD)
('ssi_int', c_int32),   # Integer sent by sigqueue(2)
('ssi_ptr', c_uint64),  # Pointer sent by sigqueue(2)
('ssi_utime', c_uint64),# User CPU time consumed (SIGCHLD)
('ssi_stime', c_uint64),# System CPU time consumed (SIGCHLD)
('ssi_addr', c_uint64), # Address that generated signal
# (for hardware-generated signals)
('_padding', c_char * 46),  # Pad size to 128 bytes (allow for
# additional fields in the future)
)

--

___
Python tracker 

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



[issue8407] expose signalfd(2) and pthread_sigmask in the signal module

2011-05-07 Thread STINNER Victor

STINNER Victor  added the comment:

wakeup_signum.patch: simple patch to write the signal number (as a single byte) 
instead of just b'\x00' into the wake up file descriptor. It gives the ability 
to watch more than one signal and be able to know which one was raised. 
Included tests demonstrate the feature. The doc explains how to decode data 
written to the file descriptor.

--
Added file: http://bugs.python.org/file21922/wakeup_signum.patch

___
Python tracker 

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



[issue8407] expose signalfd(2) and pthread_sigmask in the signal module

2011-05-07 Thread STINNER Victor

Changes by STINNER Victor :


Removed file: http://bugs.python.org/file21883/pending_signals.patch

___
Python tracker 

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



[issue8407] expose signalfd(2) and pthread_sigmask in the signal module

2011-05-07 Thread STINNER Victor

STINNER Victor  added the comment:

pending_signals-3.patch: doc nit, the link to Thread.ident doesn't work. The 
doc should be replaced by something like:
  
   *thread_id* can be read from the :attr:`~threading.Thread.ident` attribute   
   of a :class:`threading.Thread` object.  For example, 
   ``threading.current_thread().ident`` gives the identifier of the current 
   thread.

... but ident or Thread are not link, I don't know why.

--

___
Python tracker 

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



[issue12028] threading._get_ident(): remove it in the doc and make it public

2011-05-07 Thread STINNER Victor

New submission from STINNER Victor :

I don't know why threading._get_ident() (which is _thread.get_ident()) is 
private: this function is safe.

This function becomes useful with pthread_kill() which will be added by #8407.

--
assignee: docs@python
components: Documentation, Library (Lib)
messages: 135441
nosy: docs@python, haypo
priority: normal
severity: normal
status: open
title: threading._get_ident(): remove it in the doc and make it public
versions: Python 3.3

___
Python tracker 

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



[issue8407] expose signalfd(2) and pthread_sigmask in the signal module

2011-05-07 Thread STINNER Victor

STINNER Victor  added the comment:

The threading has a function to get directly the identifier of the current 
thread: threading._get_ident() instead of threading.current_thread().ident. I 
think that threading._get_ident() is more reliable to 
threading.current_thread().ident because Thread.ident can be None in some 
cases. I created the issue #12028 to decide what to do with this function.

--

___
Python tracker 

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



[issue12028] threading._get_ident(): remove it in the doc and make it public

2011-05-07 Thread STINNER Victor

STINNER Victor  added the comment:

I think that threading._get_ident() is more reliable than 
threading.current_thread().ident because Thread.ident can be None in some cases.

--

___
Python tracker 

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



[issue11994] [2.7/gcc-4.4.3] Segfault under valgrind in string.split()

2011-05-07 Thread STINNER Victor

STINNER Victor  added the comment:

GCC does have bugs: see a recent example with a development version of GCC 4.6 
=> #9880 (the bug was fixed before the final release of GCC 4.6).

If you would like to go futher, you should open a bug report in GCC bug tracker 
(not in the Python bug tracker).

--
resolution:  -> fixed
status: open -> closed

___
Python tracker 

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



[issue11277] Crash with mmap and sparse files on Mac OS X

2011-05-07 Thread Roundup Robot

Roundup Robot  added the comment:

New changeset d5d4f2967879 by Nadeem Vawda in branch '3.1':
Issue #11277: Add tests for mmap crash when using large sparse files on OS X.
http://hg.python.org/cpython/rev/d5d4f2967879

New changeset e447a68742e7 by Nadeem Vawda in branch '3.2':
Merge: #11277: Add tests for mmap crash when using large sparse files on OS X.
http://hg.python.org/cpython/rev/e447a68742e7

New changeset bc13badf10a1 by Nadeem Vawda in branch 'default':
Merge: #11277: Add tests for mmap crash when using large sparse files on OS X.
http://hg.python.org/cpython/rev/bc13badf10a1

--

___
Python tracker 

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



[issue11277] Crash with mmap and sparse files on Mac OS X

2011-05-07 Thread Roundup Robot

Roundup Robot  added the comment:

New changeset 8d27d2b22394 by Nadeem Vawda in branch '2.7':
Issue #11277: Add tests for mmap crash when using large sparse files on OS X.
http://hg.python.org/cpython/rev/8d27d2b22394

--

___
Python tracker 

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



[issue12016] Wrong behavior for '\xff\n'.decode('gb2312', 'ignore')

2011-05-07 Thread zy

zy  added the comment:

I do not have documents on this subject. Though, I found that GNU iconv(1) 
behaves the same as my proposed behavior. My reading of the source code 
suggests that iconv(1) treat all encodings equally, which I think should also 
be true for python.

As of security concerns, I do not think the change in decoding function itself 
would introduce any security vulnerabilities. If a security issue arises 
because of the proposed change, there must be improper code out side of python, 
which is out of python's control. That said, the proposed change is unlikely to 
introduce new security vulnerability, as all it does in effect is retaining a 
few ascii characters in the string to the output as opposed to removing.  In 
the issue of wordpress, if we suppose that wordpress was written in python, and 
that the attacker was using gb2312 encoded strings instead of gbk, then my 
proposed change would by chance fix the issue, as the backslash would be 
retained when we decode the string.

--

___
Python tracker 

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



[issue11277] Crash with mmap and sparse files on Mac OS X

2011-05-07 Thread Steffen Daode Nurpmeso

Steffen Daode Nurpmeso  added the comment:

@Nadeem: note that the committed versions of the tests would not
show up the Mac OS X mmap() bug AFAIK, because there is an
intermediate .close() of the file to be mmapped.  The OS X bug is
that the VMS/VFS interaction fails to provide a valid memory
region for <>
- i.e. there is no true sparse file support as on Linux, which
simply uses references to a single COW zero page.
(I've not tried it out for real yet, but i'm foolish like a prowd
cock, so i've looked at the changeset :)

--

___
Python tracker 

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



[issue12027] Optimize import this (patch to make it 10x faster)

2011-05-07 Thread Marc-Andre Lemburg

Marc-Andre Lemburg  added the comment:

STINNER Victor wrote:
> 
> New submission from STINNER Victor :
> 
> Patch to optimize this: make it 10 times faster.
> 
> Try attached benchmark script. On a debug build I got the following results:
>  * original: 299.8 ms
>  * patched: 23.2 ms
> 
> I expected a factor of 10 because it uses a C implementation of rot13 instead 
> of an hand made Python implementation.

It's a bit late for an April 1st patch, but +1 for the fun of it :-)

--

___
Python tracker 

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



[issue11277] Crash with mmap and sparse files on Mac OS X

2011-05-07 Thread Steffen Daode Nurpmeso

Steffen Daode Nurpmeso  added the comment:

(Of course this may also be intentional, say.
But then i would vote against it :), because it's better the
tests bring out errors than end-user apps.)

--

___
Python tracker 

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



[issue12023] non causal behavior

2011-05-07 Thread R. David Murray

R. David Murray  added the comment:

In 3.x, yes (the nonlocal keyword).  Not in 2.7, though.

--
nosy: +r.david.murray

___
Python tracker 

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



[issue11277] Crash with mmap and sparse files on Mac OS X

2011-05-07 Thread Roundup Robot

Roundup Robot  added the comment:

New changeset 9b9f0de19684 by Nadeem Vawda in branch '2.7':
Issue #11277: Fix tests - crash will not trigger if the file is closed and 
reopened.
http://hg.python.org/cpython/rev/9b9f0de19684

New changeset b112c72f8c01 by Nadeem Vawda in branch '3.1':
Issue #11277: Fix tests - crash will not trigger if the file is closed and 
reopened.
http://hg.python.org/cpython/rev/b112c72f8c01

New changeset a9da17fcb564 by Nadeem Vawda in branch '3.2':
Merge: #11277: Fix tests - crash will not trigger if the file is closed and 
reopened.
http://hg.python.org/cpython/rev/a9da17fcb564

New changeset b3a94906c4a0 by Nadeem Vawda in branch 'default':
Merge: #11277: Fix tests - crash will not trigger if the file is closed and 
reopened.
http://hg.python.org/cpython/rev/b3a94906c4a0

--

___
Python tracker 

___
___
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-05-07 Thread Charles-François Natali

Charles-François Natali  added the comment:

> I'll attach 11877.4.diff

A couple comments:

static PyObject *
posix_fsync(PyObject *self, PyObject *args, PyObject *kwargs)
{
PyObject *retval = NULL;
auto PyObject *fdobj;
auto int full_fsync = 1;

Why are you using the "auto" storage class specifier? I know that "explicit is 
better than implicit", but I really can't see a good reason for using it here 
(and anywhere, see http://c-faq.com/decl/auto.html).

# ifdef __APPLE__
res = fcntl(fd, F_FULLFSYNC);
# endif
# ifdef __NetBSD__
res = fsync_range(fd, FFILESYNC|FDISKSYNC, 0, 0);
# endif

Since __APPLE__ and __NetBSD__ are exclusive, you could use something like
# if defined(__APPLE__)
res = fcntl(fd, F_FULLFSYNC);
# elif defined(__NetBSD__)
res = fsync_range(fd, FFILESYNC|FDISKSYNC, 0, 0);
# endif

Do you really need to use goto for such a simple code?

--

___
Python tracker 

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



[issue11999] sporadic failure in test_mailbox on FreeBSD

2011-05-07 Thread Steffen Daode Nurpmeso

Steffen Daode Nurpmeso  added the comment:

That's really a good one.
(In my eyes.)

--
title: sporadic failure in test_mailbox -> sporadic failure in test_mailbox on 
FreeBSD

___
Python tracker 

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



[issue11277] Crash with mmap and sparse files on Mac OS X

2011-05-07 Thread Nadeem Vawda

Nadeem Vawda  added the comment:

sdaoden> @Nadeem: note that the committed versions of the tests would not
sdaoden> show up the Mac OS X mmap() bug AFAIK, because there is an
sdaoden> intermediate .close() of the file to be mmapped.

Thanks for catching that. Should be fixed now.

haypo> I now agree Antoine: the test is useless. It can be removed today.
haypo>
haypo> About mmap: add a new test for this issue (mmap on Mac OS X and
haypo> F_FULLSYNC)  is a good idea.

Done and done.

haypo> I suppose that we will need to backport the F_FULLSYNC fix too.

It has already been backported, as changeset 618c3e971e80.

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

___
Python tracker 

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



[issue12027] Optimize import this (patch to make it 10x faster)

2011-05-07 Thread Barry A. Warsaw

Barry A. Warsaw  added the comment:

That's a good one, but um, no not for 2.6, unless you can argue that a delay in 
obtaining the received wisdom of The Timbot is a serious security hole in 
Python.

Bag of ham.

--

___
Python tracker 

___
___
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-05-07 Thread Steffen Daode Nurpmeso

Steffen Daode Nurpmeso  added the comment:

On Sat,  7 May 2011 14:20:51 +0200, Charles-François Natali wrote:
> I really can't see a good reason for using it here (and
> anywhere, see http://c-faq.com/decl/auto.html).

You're right.

> Why are you using the "auto" storage class specifier? I know
> that "explicit is better than implicit"

Yup.  I'm doing what is happening for real in (x86) assembler.
Thus "auto" means (at a glance!) that this one will need space on
the stack.
(Conversely i'm not using "register" because who knows if that is
really true?  ;))

> Do you really need to use goto for such a simple code?

Yup.  Ok, this is more complicated.  The reason is that my funs
have exactly one entry point and exactly one place where they're
left.  This is because we here do manual instrumentalisation as in

ret
fun(args)
{
locals
s_NYD_ENTER;

assertions

...

jleave:
s_NYD_LEAVE;
return;

[maybe only, if large: possibly "predict-false" code blocks]

[possible error jumps here
goto jleave;]
}

We're prowd of that.  N(ot)Y(et)D(ead) is actually pretty cool,
i've used debuggers exactly 5 times in the past about ten years!
I don't even know exactly *how to use debuggers*.  8---} (NYD can
do backtracing, or, with NDEBUG and optional, profiling.)
A really good optimizing compiler will produce the very same code!
And i love nasm, but it's pretty non-portable.
But C is also nice.

But of course i can change this (in C) to simply use return, this
is easy here, no resources to be freed.

Thanks for looking at this, by the way.  :)

--

___
Python tracker 

___
___
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-05-07 Thread Steffen Daode Nurpmeso

Steffen Daode Nurpmeso  added the comment:

On Sat,  7 May 2011 14:20:51 +0200, Charles-François Natali wrote:
> # ifdef __APPLE__
> res = fcntl(fd, F_FULLFSYNC);
> # endif
> # ifdef __NetBSD__
> res = fsync_range(fd, FFILESYNC|FDISKSYNC, 0, 0);
> # endif
> 
> Since __APPLE__ and __NetBSD__ are exclusive, you could use something like
> # if defined(__APPLE__)
> res = fcntl(fd, F_FULLFSYNC);
> # elif defined(__NetBSD__)
> res = fsync_range(fd, FFILESYNC|FDISKSYNC, 0, 0);
> # endif

Yes, you're right, i'll update the patch accordingly.

--
Steffen, sdaoden(*)(gmail.com)

--

___
Python tracker 

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



[issue11999] sporadic failure in test_mailbox

2011-05-07 Thread Steffen Daode Nurpmeso

Steffen Daode Nurpmeso  added the comment:

This tracker - sorry!
(I surely will try to write and offer a patch for the tracker,
but first i need to understand that mailbox.py jungle for
#11935, next week.)

--
title: sporadic failure in test_mailbox on FreeBSD -> sporadic failure in 
test_mailbox

___
Python tracker 

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



[issue11969] Can't launch multiproccessing.Process on methods

2011-05-07 Thread Jesse Noller

Jesse Noller  added the comment:

Do things like this in the REPL are known not to work. Things are not protected 
in the if __name__ block so we can import the script properly to run it.

--

___
Python tracker 

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



[issue9205] Parent process hanging in multiprocessing if children terminate unexpectedly

2011-05-07 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

Here is an updated patch. Much of it consists of changes in the Windows 
Connection implementation, where I had to use overlapped I/O in order to use 
WaitForMultipleObjects on named pipes.

test_concurrent_futures sometimes blocks (under Windows), I'll try to debug.

--
nosy: +brian.curtin
versions:  -Python 2.7, Python 3.2
Added file: http://bugs.python.org/file21923/sentinels2.patch

___
Python tracker 

___
___
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-05-07 Thread Steffen Daode Nurpmeso

Steffen Daode Nurpmeso  added the comment:

11877.5.diff incorporates all changes suggested by
Charles-François except for the 'auto' keyword, which is extremely
important and which would need to be invented if it would not
yet exist.

I'm dropping the old stuff.  And i think this is the final version
of the patch.  I've changed the default argument to 'True' as
i really think it's better to be on the safe side here.  (The
french are better off doing some gracy and dangerous sports to
discover edges of life!)  I'm still of the opinion that this
should be completely hidden, but since it's completely transparent
wether a Python function gets yet another named argument or not...

So, thanks to Ronald, i detected that also NetBSD introduced
a FDISKSYNC flag in 2005 and that you really need fsync_range()
there (at least by definition)!  How could they do that?  But i'm
also happy to see that all other systems try hard to achieve
security transparently and by default and unless i missed
something once again.

--
Added file: http://bugs.python.org/file21924/11877.5.diff

___
Python tracker 

___diff --git a/Doc/library/os.rst b/Doc/library/os.rst
--- a/Doc/library/os.rst
+++ b/Doc/library/os.rst
@@ -798,7 +798,7 @@
Availability: Unix.
 
 
-.. function:: fsync(fd)
+.. function:: fsync(fd, full_fsync=True)
 
Force write of file with filedescriptor *fd* to disk.  On Unix, this calls 
the
native :c:func:`fsync` function; on Windows, the MS :c:func:`_commit` 
function.
@@ -807,6 +807,12 @@
``f.flush()``, and then do ``os.fsync(f.fileno())``, to ensure that all 
internal
buffers associated with *f* are written to disk.
 
+   The POSIX standart only 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.  On operating systems where it is
+   necessary and possible the optional *full_fsync* argument can be used to
+   initiate additional steps to synchronize the physical backing store.
+
Availability: Unix, and Windows.
 
 
diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c
--- a/Modules/posixmodule.c
+++ b/Modules/posixmodule.c
@@ -2121,13 +2121,46 @@
 
 #ifdef HAVE_FSYNC
 PyDoc_STRVAR(posix_fsync__doc__,
-"fsync(fildes)\n\n\
-force write of file with filedescriptor to disk.");
-
-static PyObject *
-posix_fsync(PyObject *self, PyObject *fdobj)
-{
-return posix_fildes(fdobj, fsync);
+"fsync(fildes, full_fsync=True)\n\n"
+"force write of file buffers with fildes to disk;\n"
+"full_fsync forces flush of disk caches in case fsync() alone is not enough.");
+
+static PyObject *
+posix_fsync(PyObject *self, PyObject *args, PyObject *kwargs)
+{
+auto PyObject *fdobj;
+auto int full_fsync = 1;
+static char *keywords[] = {"fd", "full_fsync", NULL };
+
+if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O|i", keywords,
+ &fdobj, &full_fsync))
+return NULL;
+
+/* See issue 11877 discussion */
+# if ((defined __APPLE__ && defined F_FULLFSYNC) || \
+  (defined __NetBSD__ && defined FDISKSYNC))
+if (full_fsync != 0) {
+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__
+res = fcntl(fd, F_FULLFSYNC);
+#  elif defined __NetBSD__
+res = fsync_range(fd, FFILESYNC|FDISKSYNC, 0, 0);
+#  endif
+Py_END_ALLOW_THREADS
+
+if (res < 0)
+return posix_error();
+Py_INCREF(Py_None);
+return Py_None;
+} else
+# endif
+return posix_fildes(fdobj, fsync);
 }
 #endif /* HAVE_FSYNC */
 
@@ -9472,7 +9505,8 @@
 {"fchdir",  posix_fchdir, METH_O, posix_fchdir__doc__},
 #endif
 #ifdef HAVE_FSYNC
-{"fsync",   posix_fsync, METH_O, posix_fsync__doc__},
+{"fsync",   (PyCFunction)posix_fsync, METH_VARARGS|METH_KEYWORDS,
+posix_fsync__doc__},
 #endif
 #ifdef HAVE_SYNC
 {"sync",posix_sync, METH_NOARGS, posix_sync__doc__},
___
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-05-07 Thread Steffen Daode Nurpmeso

Changes by Steffen Daode Nurpmeso :


Removed file: http://bugs.python.org/file21749/11877.3.diff

___
Python tracker 

___
___
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-05-07 Thread Steffen Daode Nurpmeso

Changes by Steffen Daode Nurpmeso :


Removed file: http://bugs.python.org/file21771/11877.4.diff

___
Python tracker 

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



[issue11072] Add MLSD command support to ftplib

2011-05-07 Thread Roundup Robot

Roundup Robot  added the comment:

New changeset 153bd8fc22c7 by Giampaolo Rodola' in branch 'default':
#11072- applying http://bugs.python.org/review/11072/show suggestions
http://hg.python.org/cpython/rev/153bd8fc22c7

--

___
Python tracker 

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



[issue12013] file /usr/local/lib/python3.1/lib-dynload/_socket.so: symbol inet_aton: referenced symbol not found

2011-05-07 Thread Éric Araujo

Éric Araujo  added the comment:

$ python3.1 -m test.regrtest

If your distribution removes tests from the binary package, this won’t work.

--

___
Python tracker 

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



[issue11963] Remove human verification from test suite (test_parser and test_subprocess)

2011-05-07 Thread Éric Araujo

Éric Araujo  added the comment:

Please feel free to improve titles; we’re a team, there’s no ego in bug title 
phrasing :)  I did so on at least one bug of yours; hope you didn’t consider it 
rude.

Are you asking about the docstring of the test module or the reST doc of 
test.support?  A brief mention of test.script_helper (and possibly the other 
undocumented test helpers) could be added in either or both IMO, but just to 
let people know about about the file and go read it or pydoc it; we don’t want 
to spend too much time documenting private modules with no compat constraints.

--
title: Use real assert* for test_trigger_memory_error (test_parser) -> Remove 
human verification from test suite (test_parser and test_subprocess)

___
Python tracker 

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



[issue10713] re module doesn't describe string boundaries for \b

2011-05-07 Thread Éric Araujo

Éric Araujo  added the comment:

Thanks for the report.  Would you be interested in experimenting and/or reading 
the code to find the anwser and propose a doc patch?

--
keywords: +easy
nosy: +eric.araujo
stage:  -> needs patch
versions: +Python 2.7, Python 3.1, Python 3.2, Python 3.3

___
Python tracker 

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



[issue10713] re module doesn't describe string boundaries for \b

2011-05-07 Thread Ezio Melotti

Changes by Ezio Melotti :


--
nosy: +ezio.melotti

___
Python tracker 

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



[issue10666] OS X installer variants have confusing readline differences

2011-05-07 Thread Éric Araujo

Éric Araujo  added the comment:

FTR, readline.read_init_file() works with libedit too (provided that the config 
file uses libedit-style format), so you can remove the branch from your code.

--
nosy: +eric.araujo

___
Python tracker 

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



[issue10663] configure shouldn't set a default OPT

2011-05-07 Thread Éric Araujo

Éric Araujo  added the comment:

Sounds reasonable.

--

___
Python tracker 

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



[issue10581] Review and document string format accepted in numeric data type constructors

2011-05-07 Thread Éric Araujo

Éric Araujo  added the comment:

> I may be in minority, but I find it convenient to use int(), float()
> etc. for data validation.
A number of libraries agree: argparse, HTML form handling libs, etc.

> I may be too strict, but I don't think anyone would want to see
> columns with a mix of Bengali and Devanagari numerals. [...]
> On the other hand there is certain convenience in promiscuous
> parsers, but this is not an expectation that I have from int() and
> friends. [...] There are pros and cons in any approach.
Indeed, tough question.  On one hand, I tend to agree that mixing Hindi/Arab 
numerals with Bengali does not make sense; on the other hand, rejecting it 
means that the int code does know about Unicode, which you argued against.

>[MAL]
>> The codecs, Unicode methods and other Unicode support features
>> happily work with all kinds of languages, mixed or not, without any
>> such specification.
> In my view int() and friends are only marginally related to Unicode
> and Unicode methods design is not directly relevant to their behavior.
I think I agree.  It’s perfectly fine that Unicode support features don’t care 
about the type of the characters but just encode and decode; however, int has a 
validation step.  It rejects numerals that don’t make sense with the given base 
for example, so rejecting nonsensical sequences of Unicode numerals makes sense 
IMO.

What do the other languages that are able to convert from Unicode numerals to 
integer objects?

--
nosy: +eric.araujo

___
Python tracker 

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



[issue9923] mailcap module may not work on non-POSIX platforms if MAILCAPS env variable is set

2011-05-07 Thread Éric Araujo

Changes by Éric Araujo :


--
dependencies: +No unit test for mailcap module

___
Python tracker 

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



[issue9923] mailcap module may not work on non-POSIX platforms if MAILCAPS env variable is set

2011-05-07 Thread Éric Araujo

Éric Araujo  added the comment:

BTW, is there a real use case that lead you to open this report, or is it just 
theoretical?  I’m not even sure mailcap is used on non-UNIX (and even there, I 
think it’s not used by recent tools).

--
nosy: +eric.araujo

___
Python tracker 

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



[issue12017] Decoding a highly-nested object with json (_speedups enabled) causes segfault

2011-05-07 Thread Roundup Robot

Roundup Robot  added the comment:

New changeset 6fa20e360e5e by Ezio Melotti in branch '2.7':
#12017: Fix segfault in json.loads() while decoding highly-nested objects using 
the C accelerations.
http://hg.python.org/cpython/rev/6fa20e360e5e

New changeset 61164d09337e by Ezio Melotti in branch '3.1':
#12017: Fix segfault in json.loads() while decoding highly-nested objects using 
the C accelerations.
http://hg.python.org/cpython/rev/61164d09337e

New changeset db97968379dd by Ezio Melotti in branch '3.2':
#12017: merge with 3.1.
http://hg.python.org/cpython/rev/db97968379dd

New changeset 389620c9e609 by Ezio Melotti in branch 'default':
#12017: merge with 3.2.
http://hg.python.org/cpython/rev/389620c9e609

--
nosy: +python-dev

___
Python tracker 

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



[issue9859] Add tests to verify API match of modules with 2 implementations

2011-05-07 Thread Éric Araujo

Changes by Éric Araujo :


--
nosy: +belopolsky, brett.cannon, eric.araujo, pitrou

___
Python tracker 

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



[issue10964] Mac installer need not add things to /usr/local

2011-05-07 Thread Éric Araujo

Changes by Éric Araujo :


--
nosy: +eric.araujo

___
Python tracker 

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



[issue12017] Decoding a highly-nested object with json (_speedups enabled) causes segfault

2011-05-07 Thread Ezio Melotti

Ezio Melotti  added the comment:

Fixed, thanks Ivan for the report and Alex for suggesting Py_EnterRecursiveCall!

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

___
Python tracker 

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



[issue9516] sysconfig: $MACOSX_DEPLOYMENT_TARGET mismatch: now "10.3" but "10.5" during configure

2011-05-07 Thread Éric Araujo

Éric Araujo  added the comment:

> I haven't changed the CompileError handling though, that would change
> a test failure into a test error.
Ah, thanks for correcting my mistake.

--

___
Python tracker 

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



[issue12002] ftplib.FTP.abort fails with TypeError on Python 3.x

2011-05-07 Thread Giampaolo Rodola'

Giampaolo Rodola'  added the comment:

This is a nasty one and mainly it's the reason why there are no tests for 
abort() method.
In FTP, ABOR command is supposed to be sent as OOB (out-of-band) "urgent" data 
and the dummy FTP server we're using for the funcional tests must handle this 
appopriately.

In practical terms this means that when the client calls 
self.sock.sendall(line, MSG_OOB) the server is supposed to call 
socket.recv(1024, MSG_OOB).
Since our server uses asyncore this becomes quite twisted to handle.
This can be avoided by setting SO_OOBINLINE which tells the server to handle 
the urgent data inline meaning that both plain and urgent data can be received 
with a normal sock.recv(1024) call.

The patch in attachment does this and also fixes FTP_TLS.abort() which is not 
able to accept the extra MSG_OOB flag argument.

There's a side note: on certain platforms SO_OOBINLINE has no effect, resulting 
in asyncore's handle_expt method being called, see:
http://code.google.com/p/pyftpdlib/source/browse/trunk/pyftpdlib/ftpserver.py#2064
I haven't handled this case in my patch because I'm not sure what platforms are 
broken.
I'd say we can commit this patch as-is, wait for the buildbots to turn red and 
then disable the test for those platforms afterwards.

--
keywords: +patch
Added file: http://bugs.python.org/file21925/ftplib.patch

___
Python tracker 

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



[issue12027] Optimize import this (patch to make it 10x faster)

2011-05-07 Thread Benjamin Peterson

Benjamin Peterson  added the comment:

I suggest rejecting. See 8ae88db7843c

--

___
Python tracker 

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



[issue12027] Optimize import this (patch to make it 10x faster)

2011-05-07 Thread Benjamin Peterson

Changes by Benjamin Peterson :


--
nosy: +rhettinger

___
Python tracker 

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



[issue12027] Optimize import this (patch to make it 10x faster)

2011-05-07 Thread Georg Brandl

Georg Brandl  added the comment:

(And subsequently cc10b010f40b.  I agree with Benjamin.)

--
nosy: +georg.brandl

___
Python tracker 

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



[issue12022] improve special method lookup error message

2011-05-07 Thread Benjamin Peterson

Changes by Benjamin Peterson :


--
resolution: invalid -> 
status: closed -> open
title: 'transaction' module-as-context-manager thwarted by Python 2.7.1 -> 
improve special method lookup error message

___
Python tracker 

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



[issue10169] socket.sendto raises incorrect exception when passed incorrect types

2011-05-07 Thread Roundup Robot

Roundup Robot  added the comment:

New changeset 7c3a20b5943a by Ezio Melotti in branch '2.7':
#10169: Fix argument parsing in socket.sendto() to avoid error masking.
http://hg.python.org/cpython/rev/7c3a20b5943a

--
nosy: +python-dev

___
Python tracker 

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



[issue5421] Irritating error message by socket's sendto method

2011-05-07 Thread Roundup Robot

Roundup Robot  added the comment:

New changeset 9222c9d747c1 by Ezio Melotti in branch '3.1':
#5421: add tests.
http://hg.python.org/cpython/rev/9222c9d747c1

New changeset 4b3352b49483 by Ezio Melotti in branch '3.2':
#5421: merge with 3.1.
http://hg.python.org/cpython/rev/4b3352b49483

New changeset 20273f2195ba by Ezio Melotti in branch 'default':
#5421: merge with 3.2.
http://hg.python.org/cpython/rev/20273f2195ba

--

___
Python tracker 

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



[issue11882] test_imaplib failed on x86 ubuntu

2011-05-07 Thread Kasun Herath

Kasun Herath  added the comment:

david, I'm not much familiar with c. Still trying to figure out how to do it

--
status: pending -> open

___
Python tracker 

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



[issue11743] Rewrite PipeConnection and Connection in pure Python

2011-05-07 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

Updated patch, fixing a sporadic failure in test_spawn_close.

--
Added file: http://bugs.python.org/file21926/mpconn2.patch

___
Python tracker 

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



[issue10169] socket.sendto raises incorrect exception when passed incorrect types

2011-05-07 Thread Ezio Melotti

Ezio Melotti  added the comment:

This turned out to be a duplicate of #5421 already fixed in 3.x, so I 
backported the patch and added the tests to 3.x too.

--
resolution:  -> fixed
stage: commit review -> committed/rejected
status: open -> closed
versions:  -Python 3.1, Python 3.2

___
Python tracker 

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



[issue5421] Irritating error message by socket's sendto method

2011-05-07 Thread Ezio Melotti

Ezio Melotti  added the comment:

I backported the patch to 2.7 in 7c3a20b5943a, and added tests to the 3.x 
branches.

--
nosy: +ezio.melotti

___
Python tracker 

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



[issue11910] test_heapq C tests are not skipped when _heapq is missing

2011-05-07 Thread Ezio Melotti

Ezio Melotti  added the comment:

Attempting to fix import_fresh_module might be better.

--
assignee:  -> ezio.melotti

___
Python tracker 

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



[issue12022] AttributeError should report the same details when raised by lookup_special() as when raised in the REPL

2011-05-07 Thread Daniel Holth

Daniel Holth  added the comment:

Python should explain AttributeError in the same way when it's raised by the 
interpreter. The with: statement below should raise the second AttributeError, 
not the first.

import transaction
with transaction: pass
>>> AttributeError: __exit__

import sys
sys.__exit__
>>> AttributeError: 'module' object has no attribute '__exit__'

--
title: improve special method lookup error message -> AttributeError should 
report the same details when raised by lookup_special() as when raised in the 
REPL

___
Python tracker 

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



  1   2   >