[issue14705] Add 'bool' format character to PyArg_ParseTuple*

2012-05-02 Thread Larry Hastings

New submission from Larry Hastings :

Currently functions that parse their arguments with the PyArg_ParseTuple family 
which want to take a boolean-ish parameter face two choices:
  * take an "int", then test whether or not the int is 0, or
  * take an "object", then call PyObject_IsTrue themselves.

The former is foolish; though it works with ints and bools, it doesn't work 
with any other type (float, str, list, etc) which strictly speaking are valid 
for boolean fields.  And this is common enough that the latter should not be 
necessary.

I propose to add support for a new format character to the PyArg_ParseTuple 
family: 'b', which specifies 'boolean'.  Its
implementation would be much the same as that of 'd' except:
  * the output type would be "int" instead of "double",
  * it would check for a -1 instead of calling PyErr_Occured, and
  * it would call PyObject_IsTrue instead of PyFloat_AsDouble.


If we cared, I could also add 'B', which would only accept
either Py_True or Py_False.  But I see no reason why we'd ever want
to strictly enforce the type... do you?  (I can see MvL's argument now:
"We've lived this long without it.  YAGNI.")


If there's interest I'll knock out a patch.  I expect it to be less than ten 
lines not counting documentation and test.  (Less than twenty if
folks actually want 'B'.)

--
assignee: larry
components: Interpreter Core
messages: 159781
nosy: larry
priority: normal
severity: normal
status: open
title: Add 'bool' format character to PyArg_ParseTuple*
type: enhancement
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



[issue13210] Support Visual Studio 2010

2012-05-02 Thread Kristján Valur Jónsson

Kristján Valur Jónsson  added the comment:

Posted some comments.
Also, I see you didn't remove the old SxS functionality, no longer used by 
VS2010 (see my sxs.patch)

--

___
Python tracker 

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



[issue14705] Add 'bool' format character to PyArg_ParseTuple*

2012-05-02 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

Yes, I too have encountered this in the process of working on issue 14626. For 
this purpose it is appropriate to use a special converter (with 'O&'). I 
suppose it must be a strict сonverter; there is no point in specifying 
followlinks=[1, 2, 3]. If it is somewhere need a nonstrict ones -- use 'O' and 
then check the how to in this particular case.

Would be good to have a special letter for this format, but note that 'b' and 
'B' are already used. It is better first to use the сonverter, and expand the 
format only when the enough number of uses.

--
nosy: +storchaka

___
Python tracker 

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



[issue14706] Inconsistent os.access os.X_OK on Solaris and AIX when running as root

2012-05-02 Thread Adi Roiban

New submission from Adi Roiban :

The return value of os.access(FILE, os.X_OK) is not consistent across operating 
system when executed as "root"

I have tested with Python 2.5 on Linux and Solaris, but there is a bug in 
python-nose reporting the same behavior with Python 2.6 on Solaris and AIX.
http://code.google.com/p/python-nose/issues/detail?id=423

---

On Solaris:

$ ls -al 
-rw-rw-r--   1 buildslave other   1079 May  1 16:25 nose_runner.py

$ ./bin/python 
Python 2.5.6 (r256:88840, Nov  1 2011, 12:19:05) 
[GCC 3.4.3 (csl-sol210-3_4-branch+sol_rpath)] on sunos5
Type "help", "copyright", "credits" or "license" for more information.
>>> import os
>>> os.access('nose_runner.py', os.X_OK)
False

$ sudo ./bin/python 
Python 2.5.6 (r256:88840, Nov  1 2011, 12:19:05) 
[GCC 3.4.3 (csl-sol210-3_4-branch+sol_rpath)] on sunos5
Type "help", "copyright", "credits" or "license" for more information.
>>> import os
>>> os.access('nose_runner.py', os.X_OK)
True

--

On Linux:

$ ls -al 
-rw-rw-r-- 1 adi adi  1079 2012-05-02 11:25 nose_runner.py

$ ./bin/python 
Python 2.5.5 (r255:77872, Sep 14 2010, 16:22:46) 
[GCC 4.4.5] on linux2
>>> import os
>>> os.access('nose_runner.py', os.X_OK)
False

$ sudo ./bin/python 
Python 2.5.5 (r255:77872, Sep 14 2010, 16:22:46) 
[GCC 4.4.5] on linux2
>>> import os
>>> os.access('nose_runner.py', os.X_OK)
False

--
messages: 159784
nosy: adiroiban
priority: normal
severity: normal
status: open
title: Inconsistent os.access os.X_OK on Solaris and AIX when running as root
type: behavior

___
Python tracker 

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



[issue14705] Add 'bool' format character to PyArg_ParseTuple*

2012-05-02 Thread Larry Hastings

Larry Hastings  added the comment:

> For this purpose it is appropriate to use a special converter
> (with 'O&').

The converter works--but, then, a similar converter would also work
for double, and float, and long long and many others.  If long long
is special enough to merit explicit support in PyArg_ParseTuple,
then bool definitely is, as I strongly suspect bool is used much more
frequently.


> I suppose it must be a strict сonverter; there is no point
> in specifying followlinks=[1, 2, 3].

I don't see a need for that either, but--where would you draw the line?  What 
is the principle that says "ints are okay, floats are... okay, lists are not"?

Python has a long-established concept of the "truthiness" of an expression.  I 
*strongly* suggest we stick with that unless we have a *very* good reason why 
not.


> note that 'b' and 'B' are already used.

I'm a moron!  I must have looked right at it and it didn't register.

't' (truth) and 'f' (false) are also taken.  As is 'c' (conditional).
The only thing I can come up with that's remotely related and
isn't already taken is 'p' for predicate.


> It is better first to use the сonverter, and expand the format
> only when the enough number of uses.

I suspect there are already loads of places in the standard library
that should be using this rather than abusing 'i'.

--

___
Python tracker 

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



[issue14656] Add a macro for unreachable code

2012-05-02 Thread STINNER Victor

STINNER Victor  added the comment:

I think you misuse __builtin_unreachable(): the code *is* reachable,
it is just very unlikely.

I really prefer to return something looking valid and continue the
execution of the program, instead of calling the evil Py_FatalError()
in release mode which stops immediatly the program in an insane
manner. For example, -1 is a valid result for findchar(), so the
program execution will continue, even if the kind is invalid.

--

___
Python tracker 

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



[issue14706] Inconsistent os.access os.X_OK on Solaris and AIX when running as root

2012-05-02 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

This is not a Python bug. os.access() is just a wrapper around the POSIX 
access() function:
http://pubs.opengroup.org/onlinepubs/9699919799/functions/faccessat.html

“If any access permissions are checked, each shall be checked individually, as 
described in XBD File Access Permissions, except that where that description 
refers to execute permission for a process with appropriate privileges, an 
implementation may indicate success for X_OK even if execute permission is not 
granted to any user.”

So this seems to be a well-known portability problem accross Unix 
implementations. If you want to test the executable bits, just use os.stat().

--
nosy: +pitrou
resolution:  -> invalid
status: open -> closed

___
Python tracker 

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



[issue14656] Add a macro for unreachable code

2012-05-02 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

> I really prefer to return something looking valid and continue the
> execution of the program

How would that be better? Should Python become more like PHP?

--
nosy: +pitrou

___
Python tracker 

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



[issue14656] Add a macro for unreachable code

2012-05-02 Thread STINNER Victor

STINNER Victor  added the comment:

Oh, I read again the patch. There are two different cases:

 * The code is really unreachable. Ex: the loop of lookdict() does never stop, 
return is used in the loop. Py_UNREACHABLE can be used in this case *to avoid a 
compiler warning*. __builtin_unreachable() helps if you have GCC, but if you 
don't have GCC, using return with a dummy value would be better than a 
Py_FatalError(). I don't think that calling Py_FatalError() does make the 
warning quiet.

 * The code is reachable, but if it is reached, it's a bug. Ex: switch/case on 
the Unicode kinde of a string. I like the current solution: assert(0) + return 
a almost valid value, but Antoine and Benjamin don't like the "almost valid 
value" (and so prefer a fatal error?). We may issue a warning instead of a 
fatal error (e.g. write a message into stderr with fprintf ?) in release mode.

--

Using return, it gives something like:

+#ifdef NDEBUG
+#ifdef __GNUC__
+#define Py_UNREACHABLE(value) __builtin_unreachable()
+#else
+#define Py_UNREACHABLE(value) return (value);
+#endif
+#else
+#define Py_UNREACHABLE(value) do { assert(0); return (value); } while (0)
+#endif

It cannot be used if the function has no result value (void), but quite all 
Python functions have a result.

--

___
Python tracker 

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



[issue14706] Inconsistent os.access os.X_OK on Solaris and AIX when running as root

2012-05-02 Thread Adi Roiban

Adi Roiban  added the comment:

Many thanks for your comment!

Cheers,
Adi

--

___
Python tracker 

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



[issue14082] shutil doesn't copy extended attributes

2012-05-02 Thread Charles-François Natali

Charles-François Natali  added the comment:

I really like the idea of adding extended attributes copy to shutil.cop2().
However, I'm not convinced that exposing the raw copyxattr() is
necessary (I can't really come up with a use case for this).

So I'd suggest make copyxattr() private, and wait until someone asks
for the functionality.

--

___
Python tracker 

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



[issue14082] shutil doesn't copy extended attributes

2012-05-02 Thread Hynek Schlawack

Hynek Schlawack  added the comment:

> I really like the idea of adding extended attributes copy to shutil.cop2().
> However, I'm not convinced that exposing the raw copyxattr() is
> necessary (I can't really come up with a use case for this).
> 
> So I'd suggest make copyxattr() private, and wait until someone asks
> for the functionality.

I agree. If someone needs it, (s)he will be able to advice on useful
semantics re replacement. For copy2() it’s a non-issue.

--

___
Python tracker 

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



[issue14517] Recompilation of sources with Distutils

2012-05-02 Thread Christophe Benoit

Christophe Benoit  added the comment:

2012/4/22 Éric Araujo 

>
> Éric Araujo  added the comment:
>
> Is it #5372?
>
> --
>
> ___
> Python tracker 
> 
> ___
>

Yes, I think so. The problem is :
For modules with a lot of .c, recompiling everything can take a very long
time...
In fact, it becomes very cumbersome for me and my co-workers...
Is there a way to make the previous check on timestamps optional?

--

___
Python tracker 

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



[issue14656] Add a macro for unreachable code

2012-05-02 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

> I like the current
> solution: assert(0) + return a almost valid value, but Antoine and
> Benjamin don't like the "almost valid value" (and so prefer a fatal
> error?). We may issue a warning instead of a fatal error (e.g. write a 
> message into stderr with fprintf ?) in release mode.

If there's a bug, either an exception should be raised, or a fatal error.
We should discourage warnings on stderr (the PHP approach).

--

___
Python tracker 

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



[issue14662] shutil.move doesn't handle ENOTSUP raised by chflags on OS X

2012-05-02 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

The test fails here (Linux), since there's no os.chflags:

==
ERROR: test_copystat_handles_harmless_chflags_errors 
(test.test_shutil.TestShutil)
--
Traceback (most recent call last):
  File "/home/antoine/cpython/default/Lib/test/test_shutil.py", line 302, in 
test_copystat_handles_harmless_chflags_errors
old_chflags = os.chflags
AttributeError: 'module' object has no attribute 'chflags'

--

___
Python tracker 

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



[issue14662] shutil.move doesn't handle ENOTSUP raised by chflags on OS X

2012-05-02 Thread Hynek Schlawack

Hynek Schlawack  added the comment:

Fixed for 2.7

--
Added file: http://bugs.python.org/file25434/expand-chflags-catch-2.7-v2.diff

___
Python tracker 

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



[issue13032] h2py.py can fail with UnicodeDecodeError

2012-05-02 Thread Mike Gilbert

Changes by Mike Gilbert :


--
nosy: +floppymaster

___
Python tracker 

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



[issue14656] Add a macro for unreachable code

2012-05-02 Thread Georg Brandl

Georg Brandl  added the comment:

> If there's a bug, either an exception should be raised, or a fatal error.
> We should discourage warnings on stderr (the PHP approach).

Agreed.

That said, I'm with Martin in that don't see how the patch in this issue helps.

--
nosy: +georg.brandl

___
Python tracker 

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



[issue9400] multiprocessing.pool.AsyncResult.get() messes up exceptions

2012-05-02 Thread Roundup Robot

Roundup Robot  added the comment:

New changeset 26bbff4562a7 by Richard Oudkerk in branch '2.7':
Issue #9400: Partial backport of fix for #9244
http://hg.python.org/cpython/rev/26bbff4562a7

--
nosy: +python-dev

___
Python tracker 

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



[issue14656] Add a macro for unreachable code

2012-05-02 Thread Martin v . Löwis

Martin v. Löwis  added the comment:

> Py_UNREACHABLE can be used in this case *to avoid a compiler warning*.

What is the specific warning that you want to avoid, and what specific compiler 
version produces it currently on what specific code? 

It's not "control reaches end of non-void function without return", is it? 
(since if the compiler correctly determines that the code is unreachable, it 
shouldn't complain that control reaches the end of the function, as it doesn't 
reach the end of the function).

--

___
Python tracker 

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



[issue14662] shutil.move doesn't handle ENOTSUP raised by chflags on OS X

2012-05-02 Thread Hynek Schlawack

Hynek Schlawack  added the comment:

Fixed for 3.2.

--
Added file: http://bugs.python.org/file25435/expand-chflags-catch-3.2-v2.diff

___
Python tracker 

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



[issue9244] multiprocessing.pool: Worker crashes if result can't be encoded

2012-05-02 Thread Roundup Robot

Roundup Robot  added the comment:

New changeset 26bbff4562a7 by Richard Oudkerk in branch '2.7':
Issue #9400: Partial backport of fix for #9244
http://hg.python.org/cpython/rev/26bbff4562a7

--
nosy: +python-dev

___
Python tracker 

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



[issue14656] Add a macro for unreachable code

2012-05-02 Thread Benjamin Peterson

Benjamin Peterson  added the comment:

It does not avoid any warning because we have the "assert(0); return X" 
pattern. I was just attempting to provide a standard way of marking unreachable 
code.

--

___
Python tracker 

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



[issue14662] shutil.move doesn't handle ENOTSUP raised by chflags on OS X

2012-05-02 Thread Hynek Schlawack

Hynek Schlawack  added the comment:

And finally tip.

--
Added file: http://bugs.python.org/file25436/expand-chflags-catch-tip-v2.diff

___
Python tracker 

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



[issue9400] multiprocessing.pool.AsyncResult.get() messes up exceptions

2012-05-02 Thread Richard Oudkerk

Richard Oudkerk  added the comment:

I have backported the fix for issue #9244 to 2.7.  This should fix the hang and 
produce a traceback containing a representation of the original error.

--

___
Python tracker 

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



[issue14656] Add a macro for unreachable code

2012-05-02 Thread Martin v . Löwis

Martin v. Löwis  added the comment:

> I was just attempting to provide a standard way of marking unreachable code.

I'm -1 for the proposed patch (and probably -0 on the general idea). I think 
the patch has the potential *introducing* new warnings, as compilers might warn 
that a return is lacking in these functions. 

I'm -0 on the general idea, as I think the status quo is just fine.

As for Victor's second use case (run-time checking that supposedly-unreachable 
code is indeed not reached, in release mode), I'm -0 also: we check that in 
debug mode; this looks sufficient to me.

--

___
Python tracker 

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



[issue14366] Supporting lzma compression in zip files

2012-05-02 Thread Martin v . Löwis

Martin v. Löwis  added the comment:

I'm not sure where the test run time actually comes from. It's certainly 
desirable to reduce the test run time, as long as all test purposes are 
preserved. It's not necessary to do redundant tests, e.g. if some test isn't 
about compression, there is no point in running it with all compressors (again, 
I'm not sure whether this actually happens).

--

___
Python tracker 

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



[issue14707] extend() puzzled me.

2012-05-02 Thread Daniel543

New submission from Daniel543 :

Python 2.7.3 (default, Apr 20 2012, 22:44:07) 
[GCC 4.6.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> a = ['1']
>>> b = []
>>> c = a
>>> b.append(a)
>>> a
['1']
>>> b
[['1']]
>>> c
['1']
>>> a = ['2']
>>> c.extend(a)
>>> b
[['1', '2']]
>>> c
['1', '2']
>>> a
['2']
>>> 

Is this wrong? I think the "b" should not change.

--
components: None
messages: 159807
nosy: Daniel543
priority: normal
severity: normal
status: open
title: extend() puzzled me.
type: behavior
versions: Python 2.7

___
Python tracker 

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



[issue14707] extend() puzzled me.

2012-05-02 Thread Martin v . Löwis

Martin v. Löwis  added the comment:

This is correct behavior, because:

>>> b[0] is c
True

(read up on the meaning of the "is" operator, if this is not a convincing proof 
to you).

--
nosy: +loewis
resolution:  -> invalid
status: open -> closed

___
Python tracker 

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



[issue14707] extend() puzzled me.

2012-05-02 Thread Ezio Melotti

Ezio Melotti  added the comment:

>>> a = ['1']
>>> b = []
>>> c = a
# now c and a refer to the same object
>>> b.append(a)
# this object is appended to b
>>> a
['1']
>>> b
[['1']]
>>> c
['1']
# a and c refer to the same object you have in b
# so all these ['1'] are actually the same object
>>> a = ['2']
# now a refers to another object
>>> c.extend(a)
# and here you are extending the object referred by c
# and the same object that you have in b
>>> b
[['1', '2']]
>>> c
['1', '2']
# so this is correct
>>> a
['2']
>>>

You can use id() to verify the identity of the objects, and read 
http://python.net/crew/mwh/hacks/objectthink.html for more information.

--
nosy: +ezio.melotti
stage:  -> committed/rejected

___
Python tracker 

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



[issue14366] Supporting lzma compression in zip files

2012-05-02 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

> Note that the supporting of bzip2 increases the time of testing
> test_zipfile in 1.5x, and lzma -- 2x (total 3x). May be not all tests
> are needed?

I think it's ok. Some of our tests run quite longer than that; and better to be 
exhaustive than fast (even though exhaustive *and* fast is better, of course).

--
nosy: +pitrou

___
Python tracker 

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



[issue13903] New shared-keys dictionary implementation

2012-05-02 Thread Benjamin Peterson

Changes by Benjamin Peterson :


--
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



[issue9530] integer undefined behaviors

2012-05-02 Thread Chris Rebert

Changes by Chris Rebert :


--
nosy: +cvrebert

___
Python tracker 

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



[issue14698] test_posix failures - getpwduid()/initgroups()/getgroups()

2012-05-02 Thread Roundup Robot

Roundup Robot  added the comment:

New changeset 45f0272f5296 by Charles-François Natali in branch '2.7':
Issue #14698: Make test_posix more robust when the current UID doesn't have an
http://hg.python.org/cpython/rev/45f0272f5296

New changeset 93424b084d08 by Charles-François Natali in branch '3.2':
Issue #14698: Make test_posix more robust when the current UID doesn't have an
http://hg.python.org/cpython/rev/93424b084d08

New changeset 982c30064bc9 by Charles-François Natali in branch 'default':
Issue #14698: Make test_posix more robust when the current UID doesn't have an
http://hg.python.org/cpython/rev/982c30064bc9

--
nosy: +python-dev

___
Python tracker 

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



[issue9530] integer undefined behaviors

2012-05-02 Thread Mark Dickinson

Mark Dickinson  added the comment:

> Alternatively, I can re-run the Python test suite on a Python compiled
> using our tool.  Let me know if this would be helpful.

Definitely helpful if you have the time!  Yes, please.  Though I do intend to 
try out the tool for myself at some point.

--

___
Python tracker 

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



[issue13183] pdb skips frames after hitting a breakpoint and running step

2012-05-02 Thread Charles-François Natali

Charles-François Natali  added the comment:

All 3.2 and 2.7 buildbots are still broken:
http://python.org/dev/buildbot/all/builders/x86 OpenIndiana 3.2/builds/1080

"""
==
FAIL: test_issue13183 (test.test_pdb.PdbTestCase)
--
Traceback (most recent call last):
  File 
"/export/home/buildbot/32bits/3.2.cea-indiana-x86/build/Lib/test/test_pdb.py", 
line 662, in test_issue13183
'Fail to step into the caller after a return')
AssertionError: 'main.py(5)foo()->None' not found in '-> bar()' : Fail to step 
into the caller after a return

--
Ran 2 tests in 0.558s
"""

--
nosy: +neologix
status: closed -> open

___
Python tracker 

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



[issue13032] h2py.py can fail with UnicodeDecodeError

2012-05-02 Thread Arfrever Frehtes Taifersar Arahesis

Arfrever Frehtes Taifersar Arahesis  added the comment:

UTF-8 is default encoding in Python 3, so statements with UTF-8 characters 
could be accepted.

Any strings are very rare in these statements. On my system, only generated 
TYPES.py contains 2 strings:
# Included from bits/select.h
__FD_ZERO_STOS = "stosq"
__FD_ZERO_STOS = "stosl"

/usr/include/bits/select.h contains:
# if __WORDSIZE == 64
#  define __FD_ZERO_STOS "stosq"
# else
#  define __FD_ZERO_STOS "stosl"
# endif

--

___
Python tracker 

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



[issue14204] Support for the NPN extension to TLS/SSL

2012-05-02 Thread Colin Marc

Colin Marc  added the comment:

Just noticed this is missing from "What's new in Python 3.3": 
http://docs.python.org/dev/whatsnew/3.3.html. 

Should I submit a patch for that?

--

___
Python tracker 

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



[issue14204] Support for the NPN extension to TLS/SSL

2012-05-02 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

> Just noticed this is missing from "What's new in Python 3.3": 
> http://docs.python.org/dev/whatsnew/3.3.html. 

> Should I submit a patch for that?

No need for that, the What's New document usually gets filled later in the 
release cycle.

--

___
Python tracker 

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



[issue14204] Support for the NPN extension to TLS/SSL

2012-05-02 Thread Colin Marc

Colin Marc  added the comment:

Ah ok, just curious. Thanks!

--

___
Python tracker 

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



[issue8077] cgi handling of POSTed files is broken

2012-05-02 Thread Pierre Quentel

Changes by Pierre Quentel :


--
nosy: +quentel

___
Python tracker 

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



[issue13183] pdb skips frames after hitting a breakpoint and running step

2012-05-02 Thread Xavier de Gaye

Xavier de Gaye  added the comment:

The test has been changed in the default branch by changeset
1b174a117e19.  This change replaces the assertIn by a less restrictive
assertTrue. These changes should also probably be made in 3.2 and 2.7
and hopefully this will fix the problem in 3.2 and 2.7.

The changeset 1b174a117e19 in the default branch is:

diff --git a/Lib/test/test_pdb.py b/Lib/test/test_pdb.py
--- a/Lib/test/test_pdb.py
+++ b/Lib/test/test_pdb.py
@@ -604,6 +604,7 @@
 filename = 'main.py'
 with open(filename, 'w') as f:
 f.write(textwrap.dedent(script))
+self.addCleanup(support.unlink, filename)
 cmd = [sys.executable, '-m', 'pdb', filename]
 stdout = stderr = None
 with subprocess.Popen(cmd, stdout=subprocess.PIPE,
@@ -660,9 +661,11 @@
 """
 with open('bar.py', 'w') as f:
 f.write(textwrap.dedent(bar))
+self.addCleanup(support.unlink, 'bar.py')
 stdout, stderr = self.run_pdb(script, commands)
-self.assertIn('main.py(5)foo()->None', stdout.split('\n')[-3],
- 'Fail to step into the caller after a return')
+self.assertTrue(
+any('main.py(5)foo()->None' in l for l in stdout.splitlines()),
+'Fail to step into the caller after a return')

--

___
Python tracker 

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



[issue11618] Locks broken wrt timeouts on Windows

2012-05-02 Thread Kristján Valur Jónsson

Kristján Valur Jónsson  added the comment:

Again, to clarify because this seems to have been put to sleep by Martin's  
unfortunate dismissal.  A recap of the patch:

1) Extract the Contition Variable functions on windows out of ceval_gil.h and 
into thread_nt_cv.h, so that they can be used in more places.
2) Implement the "Lock" primitive in Python using CritialSection and condition 
variables, rather than windows Mutexes.  This gives a large performance boost 
on uncontended locks.
3) Provide an alternate implementation of the Condition Variable for a build 
target of Vista/Server 2008, using the native contidion variable objects 
available for that platform.

I think Martin got distraught by 3) and though that was the only thing this 
patch is about.  The important part is 1) and 2) whereas 3) is provided as a 
bonus (and to make sure that 1) is future-safe)

So, can we get this reviewed please?

--

___
Python tracker 

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



[issue14632] Race condition in WatchedFileHandler leads to unhandled exception

2012-05-02 Thread Vinay Sajip

Vinay Sajip  added the comment:

Re. the error on open(), I have no idea why it's failing. That's just open, and 
it appears to be trying to open a file in a directory for which one would 
expect you to have write access.

Re. the error on unlink(), could that be an older version of the code that 
you're running? There was a cleanup() function, but I have removed it (and 
re-tested) before closing the issue.

The 3.x buildbots appear not to be showing this failure.

--

___
Python tracker 

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



[issue14632] Race condition in WatchedFileHandler leads to unhandled exception

2012-05-02 Thread Brian Curtin

Brian Curtin  added the comment:

I'm seeing this with the current tip 8635825b9734.

I wouldn't trust the build slaves with a race condition test since they're 
incredibly slow machines, but this issue isn't about the race. That path really 
should be accessible so I'm not sure why it's failing. It's also failing for 
Richard (sbt) as noted while working on the VS2010 port.

--

___
Python tracker 

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



[issue14687] Optimize str%tuple for the PEP 393

2012-05-02 Thread STINNER Victor

STINNER Victor  added the comment:

pyunicode_format_writer.patch: a new completly different approach. It's an 
optimistic patch: start with a short ASCII buffer, and grows slowly the buffer, 
and convert to UCS2 and maybe to UCS4 if needed. The UTF-8 decoder is based on 
the same idea.

The patch adds a "unicode writer", the optimistic writer. It overallocates the 
buffer by 50% to limit the number of calls to PyUnicode_Resize(). It may be 
reused by other functions.

My dummy benchmark script:

$ cat ~/bench.sh 
./python -m timeit \
-s 'fmt="%s:"; arg="abc"' \
'fmt % arg'
./python -m timeit \
-s 'N=200; L=3; fmt="%s"*N; args=("a"*L,)*N' \
'fmt % args'
./python -m timeit \
-s 's="x=%s, y=%u, z=%x"; args=(123, 456, 789)' \
's%args'
./python -m timeit \
-s 's="The %(k1)s is %(k2)s the %(k3)s."; 
args={"k1":"x","k2":"y","k3":"z",}' \
's%args'


Results.

Python 3.2:

1000 loops, best of 3: 0.0916 usec per loop
10 loops, best of 3: 4.04 usec per loop
100 loops, best of 3: 0.492 usec per loop
100 loops, best of 3: 0.305 usec per loop

Python 3.3:

1000 loops, best of 3: 0.169 usec per loop
10 loops, best of 3: 8.02 usec per loop
100 loops, best of 3: 0.648 usec per loop
100 loops, best of 3: 0.658 usec per loop

Python 3.3 optimist (compared to 3.3):

1000 loops, best of 3: 0.123 usec per loop (-27%)
10 loops, best of 3: 5.73 usec per loop (-29%)
100 loops, best of 3: 0.466 usec per loop (-28%)
100 loops, best of 3: 0.454 usec per loop (-31%)

Overhead of the PEP 393 (Python 3.2 => 3.3) without -> with the patch:

 * 85% -> 35%
 * 99% -> 41%
 * 31% -> -5% (Python 3.3 is *faster* on this specific case! maybe thanks to 
f4837725c50f)
 * 115% -> 49%

--

"%(name)s" syntax is still *much* slower than Python 3.2, I don't understand 
why.

Parameters of the Unicode writer (overallocation factor and initial size) may 
be adjusted (later?) for better performances.

--
Added file: http://bugs.python.org/file25437/pyunicode_format_writer.patch

___
Python tracker 

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



[issue14687] Optimize str%tuple for the PEP 393

2012-05-02 Thread STINNER Victor

Changes by STINNER Victor :


Removed file: http://bugs.python.org/file25388/pyunicode_format.patch

___
Python tracker 

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



[issue9925] Idle doesn't launch

2012-05-02 Thread Roger Serwy

Roger Serwy  added the comment:

Closing this issue as a duplicate of #4625.

--
resolution:  -> duplicate
status: pending -> closed

___
Python tracker 

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



[issue14687] Optimize str%tuple for the PEP 393

2012-05-02 Thread Roundup Robot

Roundup Robot  added the comment:

New changeset 90b4c2d7c90d by Victor Stinner in branch 'default':
Issue #14687: Optimize str%tuple for the "%(name)s" syntax
http://hg.python.org/cpython/rev/90b4c2d7c90d

--

___
Python tracker 

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



[issue14632] Race condition in WatchedFileHandler leads to unhandled exception

2012-05-02 Thread Vinay Sajip

Vinay Sajip  added the comment:

The only thing I can think of is that the file is kept open by something else 
(the other thread).

--

___
Python tracker 

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



[issue12776] argparse: type conversion function should be called only once

2012-05-02 Thread Mike Meyer

Mike Meyer  added the comment:

I've just verified that this patch also fixes 13824 and 11839.
The attached patchfile adds a test to verify that using a non-existent default 
file fails if you don't specify the argument, and succeeds if you do.

Could someone please apply it?

--
nosy: +Mike.Meyer
Added file: http://bugs.python.org/file25438/fopatch

___
Python tracker 

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



[issue12776] argparse: type conversion function should be called only once

2012-05-02 Thread Mike Meyer

Mike Meyer  added the comment:

Sorry - got ahead of myself. It doesn't fix 13824. A deeper reading reveals 
that the problem wasn't quite what I thought it on first glance.

--

___
Python tracker 

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



[issue11839] argparse: unexpected behavior of default for FileType('w')

2012-05-02 Thread Mike Meyer

Mike Meyer  added the comment:

Steven - 12776 indeed fixes this issue. I applied the patch from it to a build 
of todays checkout, verified that my simple test script worked, then wrote some 
test cases for test_argparse.

I've uploaded the patch for that test to both issues. I can't close this as a 
duplicate, though.

--
nosy: +Mike.Meyer
Added file: http://bugs.python.org/file25439/fopatch

___
Python tracker 

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



[issue14632] Race condition in WatchedFileHandler leads to unhandled exception

2012-05-02 Thread Vinay Sajip

Vinay Sajip  added the comment:

The changeset you mentioned doesn't have a cleanup function in test_race (an 
older version used to) - so I'm not sure where that error is coming from.

It's going to be hard for me to reproduce this - I was finding it pretty hard 
to throw up the original race condition which led to the test being added. If 
you are getting the error repeatably, it would be really handy if you could 
tweak the test to generate some more diagnostic information - e.g. if the file 
already exists when the open fails (=> it's held open by something else).

Are you running indexing or anti-virus software on the machine where you get 
the failures? That can hold a file open when you're not expecting it.

--

___
Python tracker 

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



[issue14632] Race condition in WatchedFileHandler leads to unhandled exception

2012-05-02 Thread Brian Curtin

Brian Curtin  added the comment:

I have exemptions set in AV for my dev folders for exactly that reason :)
I'll try and poke around and get more info.

--

___
Python tracker 

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



[issue14687] Optimize str%tuple for the PEP 393

2012-05-02 Thread STINNER Victor

STINNER Victor  added the comment:

> Parameters of the Unicode writer (overallocation factor
> and initial size) may be adjusted (later?) for better performances.

I tried to compute the initial size from the args object. It is hard because we 
don't know how arguments are used. For example, an argument may not be a number 
formatted  as decimal, but the width of an argument. Another example: "%.3s" 
may be used to only read the 3 first characters of a very long string.

So I consider that it is *simpler and safer* to not guess anything from args, 
but only choose correctly the overallocation factor. I tried the following 
factors: 1 (no overallocation), 1.25, 1.5 and 2.0. It looks like 1.25 (pos*5/4) 
is the best compromise and offers the best performances.

--

___
Python tracker 

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



[issue14618] remove modules_reloading from the interpreter state

2012-05-02 Thread Eric Snow

Eric Snow  added the comment:

from issue13959:

New changeset eb68502731dd by Brett Cannon in branch 'default':
Issues #13959, 14647: Re-implement imp.reload() in Lib/imp.py.
http://hg.python.org/cpython/rev/eb68502731dd

--
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



[issue14708] distutils's checking for MSVC compiler

2012-05-02 Thread jamesf

New submission from jamesf <54740...@qq.com>:

I am using python 2.7.2 installed via the pre-built installer package, and my 
SDK version is v7.1.

1) The MSSdk environment variable is not set by lastest SDK's SetEnv.cmd 
anymore, but distutils still check for it.

2) I have also install MSVC 2010 Express Edition, and its vcvarsall.bat
can't be found.

Off-side question:
a) Can i use different version of MSVC from which python is built for extension 
development ?
b) Can i use mingw compiler to develop extension for the pre-built windows 
binary python ?

--
messages: 159833
nosy: jwfang
priority: normal
severity: normal
status: open
title: distutils's checking for MSVC compiler
type: behavior
versions: Python 2.7

___
Python tracker 

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



[issue14708] distutils's checking for MSVC compiler

2012-05-02 Thread Antoine Pitrou

Changes by Antoine Pitrou :


--
nosy: +loewis

___
Python tracker 

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



[issue14708] distutils's checking for MSVC compiler

2012-05-02 Thread Martin v . Löwis

Martin v. Löwis  added the comment:

> 1) The MSSdk environment variable is not set by lastest SDK's 
> SetEnv.cmd anymore, but distutils still check for it.

This is intentional. Older SDKs still set the variable, so there
is nothing wrong with checking it.

> 2) I have also install MSVC 2010 Express Edition, and its 
> vcvarsall.bat can't be found.

MSVC 2010 is not supported for building Python 2.7 extension modules.

> a) Can i use different version of MSVC from which python is built for 
> extension development ?

No. Because of the way the MSVCRT works, this can cause crashes.

> b) Can i use mingw compiler to develop extension for the pre-built 
> windows binary python ?

Yes, in principle. In practice, it may fail because of gcc limitations.

--

___
Python tracker 

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