[issue11561] "coverage" of Python regrtest cannot see initial import of libs

2011-03-21 Thread Sandro Tosi

Changes by Sandro Tosi :


--
nosy: +sandro.tosi

___
Python tracker 

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



[issue11561] "coverage" of Python regrtest cannot see initial import of libs

2011-03-21 Thread Brett Cannon

Changes by Brett Cannon :


--
assignee:  -> brett.cannon
components: +Demos and Tools
stage:  -> patch review
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



[issue11393] Integrate faulthandler module into Python 3.3

2011-03-21 Thread Andreas Stührk

Changes by Andreas Stührk :


--
nosy: +Trundle

___
Python tracker 

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



[issue11393] Integrate faulthandler module into Python 3.3

2011-03-21 Thread STINNER Victor

STINNER Victor  added the comment:

> It would be nice if it were enabled by default for fatal errors
> (and asserts perhaps?).

That would mean that the module should be a builtin module, or that it is 
always loaded in memory.

I am maybe ok to enable it by default for debug builds, but not for release 
builds. At least, not in a first time.

--

___
Python tracker 

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



[issue11393] Integrate faulthandler module into Python 3.3

2011-03-21 Thread STINNER Victor

STINNER Victor  added the comment:

I renamed some functions to conform to the PEP 8 (and have more readable 
function names). I prefer to do it today instead having to keep ugly names for 
years :-)

Functions are now:

 * enable(file=sys.stderr, all_threads=False)
 * disable()
 * is_enabled()

 * dump_backtrace(file=sys.stderr, all_threads=False)
 * dump_backtrace_later(delay, repeat=False, file=sys.stderr, all_threads=False)
 * cancel_dump_backtrace_later()

 * register(signum, file=sys.stderr, all_threads=False)
 * unregister(signum)

 * sigbus()
 * sigfpe()
 * sigill()
 * sigsegv()

Refer to the README file for the details.

--

___
Python tracker 

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



[issue11591] "python -S" should be robust against e.g. "from site import addsitedir"

2011-03-21 Thread Brett Cannon

Changes by Brett Cannon :


--
assignee: eric.araujo -> brett.cannon

___
Python tracker 

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



[issue11623] Distutils is reporting OSX 10.6 w/ XCode 4 as "universal"

2011-03-21 Thread Ned Deily

Ned Deily  added the comment:

The release of Xcode 4 for Mac OS X 10.6 has complicated things for Python 
builds.  We need to sort out what the problems are and possible solutions for 
them.  I suggest this issue be reassigned to Ronald and me.

In the meantime, the workaround is to continue to use Xcode 3 (which is still 
fully supported) on OS X 10.6.  If you feel you absolutely need to have Xcode 4 
installed *and* you still need to build C extension modules for the currently 
available Pythons for OS X (i.e. the python.org installers or even the 
Apple-supplied Pythons in 10.60), there are unofficial suggestions out on the 
web on how one can have Xcode 3 and 4 installed side-by-side, for example:
   http://hints.macworld.com/article.php?story=20110318050811544
(Note, I have not tried this and am not recommending it.)

--
components: +Macintosh
nosy: +ned.deily, ronaldoussoren

___
Python tracker 

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



[issue10050] urllib.request still has old 2.x urllib primitives

2011-03-21 Thread Senthil Kumaran

Senthil Kumaran  added the comment:

No, it is not waiting for you, in fact it is waiting for me to commit
the portion which you have already contributed  with some additional
code (DeprecationWarning). 

But this bug does not end up here as there are other primitives which
may need cleanup and have  DeprecationWarnings. Those needs to be
addressed as well, either as part of this issue or as separate issues.

--

___
Python tracker 

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



[issue10050] urllib.request still has old 2.x urllib primitives

2011-03-21 Thread Jeff McNeil

Jeff McNeil  added the comment:

Just wanted to check so this doesn't sit with people waiting on me.  Is there 
anything else I need/should do to this patch? Little unclear on how to handle 
the deprecation process.

--

___
Python tracker 

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



[issue11393] Integrate faulthandler module into Python 3.3

2011-03-21 Thread STINNER Victor

STINNER Victor  added the comment:

> Ok, good idea, I will do that. I think that I will write it in the
> function comment, something like: "This function is signal safe".

Done in 6685691dfcbd3644feffcb197491bce3168ff5de (git SHA-1)

While checking the usage of signal safe functions, I found a bug: 
dumpbacktrace_later() signal handler called Py_CLEAR() which is far from being 
signal safe. I tried to replace it be a pending call, but Py_AddPendingCall() 
doesn't look to be signal safe. So I just removed the call. 
cancel_dumpbacktrace_later() is already documented as being required to clear 
the reference to the file.

> >   - within tests.py, ...
> Ok, I will try to find better names.

Done in db99e17dea187bec4248aca9fc81f673d88dec93. I documented methods and 
renamed some of them.

--

___
Python tracker 

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



[issue11627] segfault raising an arbitrary object as an exception

2011-03-21 Thread Andreas Stührk

Changes by Andreas Stührk :


Added file: http://bugs.python.org/file21329/issue11627_2.patch

___
Python tracker 

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



[issue11627] segfault raising an arbitrary object as an exception

2011-03-21 Thread Andreas Stührk

Andreas Stührk  added the comment:

> Antoine Pitrou  added the comment:
> You could try something more explicit, such as
> "calling %s() should have returned an instance of BaseException, not %s"
> % (type, Py_TYPE(value))

Thanks, updated the patch.

> By the way, you have a tab character in your patch. Please only use
> spaces for indentation.

I am terribly sorry for that. I always realise after the first changed
line that my editor is in the wrong C mode.

--

___
Python tracker 

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



[issue11628] cmp_to_key generated class should use __slots__

2011-03-21 Thread Chris Colbert

Chris Colbert  added the comment:

Man, you guys are quick! Cheers!

--

___
Python tracker 

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



[issue11628] cmp_to_key generated class should use __slots__

2011-03-21 Thread Raymond Hettinger

Changes by Raymond Hettinger :


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



[issue11628] cmp_to_key generated class should use __slots__

2011-03-21 Thread Roundup Robot

Roundup Robot  added the comment:

New changeset 97799a54728e by Raymond Hettinger in branch '3.2':
Issue #11628: cmp_to_key should use __slots__.
http://hg.python.org/cpython/rev/97799a54728e

New changeset 2e5e5d515c09 by Raymond Hettinger in branch 'default':
Issue #11628: cmp_to_key should use __slots__.
http://hg.python.org/cpython/rev/2e5e5d515c09

--
nosy: +python-dev

___
Python tracker 

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



[issue11628] cmp_to_key generated class should use __slots__

2011-03-21 Thread Éric Araujo

Éric Araujo  added the comment:

Right, I edited the versions field to match the versions that contain 
cmp_to_key, but if this behavior change is just for performance, it’s not a 
candidate for backport.

Chris: I’d go with the simpler implementation.

--
versions:  -Python 2.7, Python 3.2

___
Python tracker 

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



[issue11628] cmp_to_key generated class should use __slots__

2011-03-21 Thread Raymond Hettinger

Raymond Hettinger  added the comment:

I think this is a good idea.
Am not sure whether it should be backported though.

--
assignee:  -> rhettinger

___
Python tracker 

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



[issue3080] Full unicode import system

2011-03-21 Thread Roundup Robot

Roundup Robot  added the comment:

New changeset 15f9eca5e956 by Victor Stinner in branch 'default':
Issue #3080: On DJGPP, case_bytes() returns -1 to signal an error if the file
http://hg.python.org/cpython/rev/15f9eca5e956

--

___
Python tracker 

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



[issue7330] PyUnicode_FromFormat: implement width and precision for %s, %S, %R, %V, %U, %A

2011-03-21 Thread Roundup Robot

Roundup Robot  added the comment:

New changeset d3ae3fe3eb97 by Victor Stinner in branch 'default':
Issue #7330, #10833: Replace %100s by %.100s and %200s by %.200s
http://hg.python.org/cpython/rev/d3ae3fe3eb97

--
nosy: +python-dev

___
Python tracker 

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



[issue11591] "python -S" should be robust against e.g. "from site import addsitedir"

2011-03-21 Thread Carl Meyer

Carl Meyer  added the comment:

> Did you have to manually click “Create Patch” to make roundup generate it?  

Yes - the first time too.

> Did you try first to click on the button of the existing repo before adding a 
> new repo entry?

That would probably have worked fine. The "Remote hg repo" field was just empty 
when I made my latest comment, so I filled it in again. Wasn't sure if it would 
duplicate, or be smart enough to tell they were the same repo, or what. I guess 
it duplicated :/

--

___
Python tracker 

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



[issue11623] Distutils is reporting OSX 10.6 w/ XCode 4 as "universal"

2011-03-21 Thread Éric Araujo

Éric Araujo  added the comment:

Thanks for the report.  Can you try to reproduce the bug with a distutils setup 
script to confirm the bug and get an error log?  You may have to apply the 
patch from #11599 to get a complete error message.  (Also, superuser rights are 
not required for build, so let’s remove that too.)

I only know the basics about C compilation, and I only know that Mac OS is a 
strange and peculiar system, but let’s try to work on this bug :)  The 
distutils.unixccompiler module already has code to work around things in 
various Mac OS versions, so if there is an easy way to detect “when it’s no 
longer possible to compile for PPC”, there is hope.

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

___
Python tracker 

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



[issue11628] cmp_to_key generated class should use __slots__

2011-03-21 Thread Éric Araujo

Changes by Éric Araujo :


--
nosy: +eric.araujo
versions:  -Python 3.1, Python 3.4

___
Python tracker 

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



[issue11591] "python -S" should be robust against e.g. "from site import addsitedir"

2011-03-21 Thread Éric Araujo

Éric Araujo  added the comment:

Looks great, thank you.  I think I’ll also add a docstring to main before 
committing, now that the function is publicly documented.

Did you have to manually click “Create Patch” to make roundup generate it?  Did 
you try first to click on the button of the existing repo before adding a new 
repo entry?  (Still learning how to use it, thanks for experimenting along :)

Brett: Thanks for the review.  If you don’t comment negatively on the doc 
change, I will commit this.

(Side concern: the module does not define __all__, even though only 4 functions 
and 4 constants are officially documented.  I’d like to define __all__, but the 
recentish huge thread on public/private APIs scared me.)

--

___
Python tracker 

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



[issue11626] Py_LIMITED_API on windows: unresolved symbol __imp___PyArg_ParseTuple_SizeT

2011-03-21 Thread Martin v . Löwis

Martin v. Löwis  added the comment:

It seems this function was forgotten. I'd add this for 3.2.1, which of course 
means that your extension wouldn't run on a 3.2.0 installation. Would you 
consider this acceptable?

Would you prefer to see a compiler error indicating that you are using a 
function not available in 3.2.0 (with an option of opting into 3.2.1+)?

--

___
Python tracker 

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



[issue11627] segfault raising an arbitrary object as an exception

2011-03-21 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

Le lundi 21 mars 2011 à 22:57 +, Andreas Stührk a écrit :
> Andreas Stührk  added the comment:
> 
> Attached is a patch. I'm not too happy about the error message though,
> I think it's more confusing than helpful.

You could try something more explicit, such as
"calling %s() should have returned an instance of BaseException, not %s"
% (type, Py_TYPE(value))

By the way, you have a tab character in your patch. Please only use
spaces for indentation.

--

___
Python tracker 

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



[issue11595] Miscellaneous bugs in cfg_to_args() utility function

2011-03-21 Thread Éric Araujo

Éric Araujo  added the comment:

I don’t really follow what you’re saying, sorry.  Anyway, it looks like a 
feature request separate from this bug, let’s keep things distinct :)

You can write to the ML, add a todo entry or another bug about your other thing.

--

___
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

2011-03-21 Thread Martin v . Löwis

Martin v. Löwis  added the comment:

> I realize that this is
> a subtle point, but in fact, the atomic functions make no memory
> barrier guarantees either (I think).

No need to guess:

http://msdn.microsoft.com/en-us/library/ms683560(v=vs.85).aspx

"This function generates a full memory barrier (or fence) to ensure that
memory operations are completed in order."

--

___
Python tracker 

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



[issue11627] segfault raising an arbitrary object as an exception

2011-03-21 Thread Andreas Stührk

Andreas Stührk  added the comment:

Attached is a patch. I'm not too happy about the error message though, I think 
it's more confusing than helpful.

--
keywords: +patch
Added file: http://bugs.python.org/file21328/issue11627.patch

___
Python tracker 

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



[issue11624] distutils should support a custom list of exported symbols for Windows dlls.

2011-03-21 Thread Éric Araujo

Éric Araujo  added the comment:

Would you like to work on a patch?

--

___
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

2011-03-21 Thread Martin v . Löwis

Martin v. Löwis  added the comment:

> I would still favour committing the semaphore-based version first
> (especially in 3.2), and then discussing performance improvements if
> desired.

For 3.2, I would prefer a solution that makes least changes to the
current code. This is better than fundamentally replacing the
synchronization mechanism which locks are based on.

For 3.3, I predict that any Semaphore-based version will be shortly
replaced by something "fast". Benchmarks seem to indicate that you can
get much faster than semaphores.

--

___
Python tracker 

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



[issue11621] build error: bootstrap issue with gettext

2011-03-21 Thread Éric Araujo

Éric Araujo  added the comment:

Thank you for catching and fixing this.

--

___
Python tracker 

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



[issue9523] Improve dbm modules

2011-03-21 Thread Éric Araujo

Éric Araujo  added the comment:

Yes, I mean exactly that.

--

___
Python tracker 

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



[issue11628] cmp_to_key generated class should use __slots__

2011-03-21 Thread Daniel Stutzbach

Changes by Daniel Stutzbach :


--
nosy: +stutzbach

___
Python tracker 

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



[issue11622] Documentation

2011-03-21 Thread Éric Araujo

Éric Araujo  added the comment:

Welcome to Python!  We hope you’ll have a great time using it.

The language reference is useful to understand subtleties or implement a Python 
interpreter, not for common use.  The library reference is, well, a reference 
manual to use when you already know the modules.  Another resource with more 
examples is http://www.doughellmann.com/PyMOTW/articles/.  SilentGhost gave you 
the link to the official tutorial; more links are given on 
http://wiki.python.org/moin/FrontPage.  If you still have questions, the 
python-list mailing list or #python IRC channel are full of nice people with 
answers.

I hope those links get you started in the right direction.  Since this report 
does not contain a specific error in the Python doc, I am closing it.

If you want to suggest the policy of adding short examples to all our docs, 
please bring it up to the python-dev mailing list.

--
assignee: docs@python -> 
nosy: +eric.araujo
resolution:  -> works for me
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



[issue11618] Locks broken wrt timeouts on Windows

2011-03-21 Thread sbt

sbt  added the comment:

krisvale wrote

There is no barrier in use on the read part.  I realize that this is a subtle 
point, but in fact, the atomic functions make no memory barrier guarantees 
either (I think).  And even if they did, you are not using a memory barrier 
when you read the 'timeouts' to perform the subtraction.  On a multiprocessor 
machine the two values can easily fall on two cache lines and become visible to 
the other cpu in a random fashion.  In other words:  One cpu decreases the 
"owner" and "timeouts" at about the same time.  A different thread, on a 
different cpu may see the decrease in "owner" but not the decrease in 
"timeouts" until at some random later point.


>From the webpage you linked to:

Sometimes the read or write that acquires or releases a resource is done using 
one of the InterlockedXxx functions. On Windows this simplifies things, because 
on Windows, the InterlockedXxx functions are all full-memory barriers—they 
effectively have a CPU memory barrier both before and after them, which means 
that they are a full read-acquire or write-release barrier all by themselves.


Interlocked functions would be pretty useless for implementing mutexes if they 
did not also act as some kind of barrier: preventing two threads from 
manipulating an object at the same time is not much use if they don't also get 
up-to-date views of that object while they own the lock.

Given that mutex->timeout is only modified by interlocked functions, an 
unprotected read of mutex->timeout will get a value which is at least as fresh 
as the one available the last time we crossed a barrier by calling 
InterlockedXXX() or WaitForSingleObject().

Note that if the read of mutex->timeouts in this line

if ((timeouts = mutex->timeouts) != 0)

gives the "wrong" answer it will be an underestimate because we own the lock 
and the only other threads which might interfere will be incrementing the 
counter.  The worst that can happen is that the fast path remains blocked: 
consistency is not affected.

--

___
Python tracker 

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



[issue11627] segfault raising an arbitrary object as an exception

2011-03-21 Thread Andreas Stührk

Andreas Stührk  added the comment:

On Mon, Mar 21, 2011 at 10:27 PM, Santoso Wijaya  wrote:
>
> Santoso Wijaya  added the comment:
>
> Also, why is the print() in __new__ executed twice?

Because `PyErr_NormalizeException()` is called twice: First time when
the exceptions is raised, and then a second time when the exception is
caught. Because the previous call didn't instantiate an instance of a
exception, the second call will (try to) create a new exception
instance.

--

___
Python tracker 

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



[issue11627] segfault raising an arbitrary object as an exception

2011-03-21 Thread Santoso Wijaya

Santoso Wijaya  added the comment:

Also, why is the print() in __new__ executed twice?

--

___
Python tracker 

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



[issue11627] segfault raising an arbitrary object as an exception

2011-03-21 Thread Santoso Wijaya

Santoso Wijaya  added the comment:

Oddly, this works:

C:\Users\santa>C:\python32\python.exe
Python 3.2 (r32:88445, Feb 20 2011, 21:30:00) [MSC v.1500 64 bit (AMD64)] on win
32
Type "help", "copyright", "credits" or "license" for more information.
>>> class Foo(Exception):
... def __new__(*args):
... obj = object()
... print('Returning {}'.format(repr(obj)))
... return obj
...
>>> try:
... raise Foo
... except Exception as e:
... print('Got it: {}'.format(repr(e)))
...
Returning 
Returning 
Got it: 
>>> ^Z


But this does not:

C:\Users\santa>C:\python32\python.exe
Python 3.2 (r32:88445, Feb 20 2011, 21:30:00) [MSC v.1500 64 bit (AMD64)] on win
32
Type "help", "copyright", "credits" or "license" for more information.
>>> class Foo(Exception):
... def __new__(*args):
... obj = object()
... print('Returning', repr(obj))
... return obj
...
>>> try:
... raise Foo
... except Exception as e:
... print('Got it:', repr(e))
...
Returning 
Returning 

crash!

--
nosy: +santa4nt

___
Python tracker 

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



[issue5309] setup.py doesn't parallelize extension module compilation

2011-03-21 Thread Éric Araujo

Changes by Éric Araujo :


--
keywords: +gsoc

___
Python tracker 

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



[issue11628] cmp_to_key generated class should use __slots__

2011-03-21 Thread Chris Colbert

New submission from Chris Colbert :

The cmp_to_key func acts as a class factory for generating key objects that 
behave according to a user defined cmp function. 

Many patterns/libs that make use of key functions (for example blist and the 
SortedCollection recipe) store the the results of the key function internally 
to provide faster subsequent operations. For large datasets, the number of key 
objects can become large, and it makes sense to keep their memory footprint as 
small as possible. 

>From this stance, I propose to add "__slots__ = ('obj',)" to the class 
>definition of "K" in cmp_to_key to prevent the creation of the un-needed 
>instance dict and save the memory. 

I find it hard to conjure up a case where a user would need to weakref or add 
attributes to the return value of a key func. But should that need arise, that 
functionality could be provided as optional kwargs to cmp_to_key, or just have 
the user subclass the return value of cmp_to_key. Alternatively, the addition 
of __slots__ could be specified as a kwarg to cmp_to_key. 

I'd be happy to make a patch for any of these (or alternative) options.

--
components: Library (Lib)
messages: 131691
nosy: Chris.Colbert, ncoghlan, rhettinger
priority: normal
severity: normal
status: open
title: cmp_to_key generated class should use __slots__
type: behavior
versions: Python 2.7, Python 3.1, Python 3.2, Python 3.3, Python 3.4

___
Python tracker 

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



[issue11627] segfault raising an arbitrary object as an exception

2011-03-21 Thread Michael Foord

Michael Foord  added the comment:

This:

raise type('',(Exception,),{'__new__':lambda *a:object()}) 

Segfaults 3.2 but not 3.1.

--

___
Python tracker 

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



[issue11627] segfault raising an arbitrary object as an exception

2011-03-21 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

Have you tried 3.1?

--
nosy: +pitrou

___
Python tracker 

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



[issue11627] segfault raising an arbitrary object as an exception

2011-03-21 Thread Andreas Stührk

Changes by Andreas Stührk :


--
nosy: +Trundle

___
Python tracker 

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



[issue11627] segfault raising an arbitrary object as an exception

2011-03-21 Thread Michael Foord

Michael Foord  added the comment:

Personally I don't think this should be valid at all (it should ideally be an 
error at the raise point). It is the kind of thing that causes difficulties for 
the other implementations trying to match CPython behaviour (this code works in 
Python 2.7 - you can catch the object()).

--

___
Python tracker 

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



[issue11627] segfault raising an arbitrary object as an exception

2011-03-21 Thread Michael Foord

New submission from Michael Foord :

Python 3.2 (r32:88452, Feb 20 2011, 10:19:59) 
[GCC 4.0.1 (Apple Inc. build 5493)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> class Foo(Exception):
...  def __new__(*args):
...   return object()
... 
>>> try:
...  raise Foo
... except Exception as e:
...  print ('got it', e)
... 
Bus error

--
messages: 131687
nosy: michael.foord
priority: normal
severity: normal
status: open
title: segfault raising an arbitrary object as an exception
type: crash
versions: 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



[issue11618] Locks broken wrt timeouts on Windows

2011-03-21 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

> Antoine:  I notice that even the fast path contains a ResetEvent()
> call.  I think this is a kernel call and so just as expensive as
> directly using a semaphore :)

Yes, in my timings it doesn't show significant improvements compared to
the semaphore approach (although again it's on a VM, so I'm not sure how
much this reflects a native Windows system).

--

___
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

2011-03-21 Thread Kristján Valur Jónsson

Kristján Valur Jónsson  added the comment:

Antoine:  I notice that even the fast path contains a ResetEvent() call.  I 
think this is a kernel call and so just as expensive as directly using a 
semaphore :).  Otherwise, the logic looks robust, although ResetEvent() and 
Event objects always give me an uneasy feeling.

--

___
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

2011-03-21 Thread Kristján Valur Jónsson

Kristján Valur Jónsson  added the comment:

There is no barrier in use on the read part.  I realize that this is a subtle 
point, but in fact, the atomic functions make no memory barrier guarantees 
either (I think).  And even if they did, you are not using a memory barrier 
when you read the 'timeouts' to perform the subtraction.  On a multiprocessor 
machine the two values can easily fall on two cache lines and become visible to 
the other cpu in a random fashion.  In other words:  One cpu decreases the 
"owner" and "timeouts" at about the same time.  A different thread, on a 
different cpu may see the decrease in "owner" but not the decrease in 
"timeouts" until at some random later point.

Lockless algorithms are notoriously hard and it is precisely because of subtle 
pitfalls like these.  I could even be wrong about the above, but that would not 
be blindingly obvious either.  I'm sure you've read something similar but this 
is where I remember seeing some of this stuff mentioned:  
http://msdn.microsoft.com/en-us/library/ee418650(v=vs.85).aspx

--

___
Python tracker 

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



[issue11626] Py_LIMITED_API on windows: unresolved symbol __imp___PyArg_ParseTuple_SizeT

2011-03-21 Thread Amaury Forgeot d'Arc

Changes by Amaury Forgeot d'Arc :


--
assignee:  -> loewis
nosy: +loewis

___
Python tracker 

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



[issue2292] Missing *-unpacking generalizations

2011-03-21 Thread Ezio Melotti

Changes by Ezio Melotti :


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



[issue11626] Py_LIMITED_API on windows: unresolved symbol __imp___PyArg_ParseTuple_SizeT

2011-03-21 Thread Rainer Schaaf

New submission from Rainer Schaaf :

When building a c extension on windows the linker fails like this:

link.exe /DLL /nologo /INCREMENTAL:NO 
/LIBPATH:../../../libs/plop/Release_MD_PLOPDS_VS6 
/LIBPATH:C:\Programme\python32\libs /LIBPATH:C:\Programme\python32\PCbuild 
kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib 
shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib libplop.lib 
/EXPORT:PyInit_plop_py build\temp.win32-3.2\Release\plop_py.obj 
/OUT:build\lib.win32-3.2\plop_py.pyd 
/IMPLIB:build\temp.win32-3.2\Release\plop_py.lib 
/MANIFESTFILE:build\temp.win32-3.2\Release\plop_py.pyd.manifest
   Creating library build\temp.win32-3.2\Release\plop_py.lib and object 
build\temp.win32-3.2\Release\plop_py.exp

plop_py.obj : error LNK2019: unresolved external symbol 
__imp___PyArg_ParseTuple_SizeT referenced in function __wrap_PLOP_new

build\lib.win32-3.2\plop_py.pyd : fatal error LNK1120: 1 unresolved externals


I use distutils to build the extension. The same code works fine on 
Linux/Unix/MacOSX. When I unset the Py_LIMITED_API it works fine on Windows too.

--
components: Extension Modules
messages: 131683
nosy: rjs
priority: normal
severity: normal
status: open
title: Py_LIMITED_API on windows: unresolved symbol 
__imp___PyArg_ParseTuple_SizeT
versions: Python 3.2

___
Python tracker 

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



[issue11623] Distutils is reporting OSX 10.6 w/ XCode 4 as "universal"

2011-03-21 Thread Santoso Wijaya

Changes by Santoso Wijaya :


--
nosy: +santa4nt

___
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

2011-03-21 Thread sbt

sbt  added the comment:

sbt wrote:
-
I see your point.  Still, I think we still may have a flaw:  The statement that 
(owned-timeouts) is never an under-estimate isn't true on modern architectures, 
I think.  The order of the atomic decrement operations in the code means 
nothing and cannot be depended on to guarantee such a claim:  The thread doing 
the reading may see the individual updates in any order, and so the estimate 
may be an over- or an underestimate.
-

The interlocked functions act as read (and write) memory barriers, so 
mutex->timeout is never any staler than the value of owned obtained from the 
preceeding interlocked function call.  As you say my claim that (owned-timeout) 
is never an underestimate is dubious.  But the only time I use this quantity is 
in this bit:

else if (owned - mutex->timeouts != -1) /* harmless race */
return WAIT_TIMEOUT ;

If this test gives a false negative we just fall through to the slow path (no 
problem).  If we get a false positive it is because one of the two following 
races happened:

1) Another thread just got the lock: letting the non-blocking acquire fail is 
clearly the right thing to do.

2) Another thread just timed out: this means that a third thread must have held 
the lock up until very recently, so allowing a non-blocking acquire to fail is 
entirely reasonable (even if WaitForSingleObject() might now succeed).

--

___
Python tracker 

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



[issue11591] "python -S" should be robust against e.g. "from site import addsitedir"

2011-03-21 Thread Carl Meyer

Changes by Carl Meyer :


Added file: http://bugs.python.org/file21327/ebe5760afa08.diff

___
Python tracker 

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



[issue11591] "python -S" should be robust against e.g. "from site import addsitedir"

2011-03-21 Thread Carl Meyer

Carl Meyer  added the comment:

Added documentation to Doc/library/site.rst and Misc/NEWS.

--
hgrepos: +5

___
Python tracker 

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



[issue11613] test_subprocess fails under Windows

2011-03-21 Thread Reid Kleckner

Reid Kleckner  added the comment:

The bot is green again as of ab2363f89058.  Thanks for the heads up.

--
status: open -> closed

___
Python tracker 

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



[issue11625] Typo in collections.abc docs

2011-03-21 Thread Raymond Hettinger

Raymond Hettinger  added the comment:

Thanks for noticing this.

--
nosy: +rhettinger
priority: normal -> high

___
Python tracker 

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



[issue11625] Typo in collections.abc docs

2011-03-21 Thread Doug Latornell

Changes by Doug Latornell :


--
keywords: +patch
Added file: http://bugs.python.org/file21326/collections.abc-docs.patch

___
Python tracker 

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



[issue11625] Typo in collections.abc docs

2011-03-21 Thread Doug Latornell

New submission from Doug Latornell :

There is a minor type in note (1) regarding use of Set and MutableSet mixins. 
The method to be overridden when a special constructor signature is required 
should be _from_iterator, not from_iterator.

--

___
Python tracker 

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



[issue11625] Typo in collections.abc docs

2011-03-21 Thread Doug Latornell

Changes by Doug Latornell :


--
assignee: docs@python
components: Documentation
nosy: dlatornell, docs@python
priority: normal
severity: normal
status: open
title: Typo in collections.abc docs

___
Python tracker 

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



[issue11624] distutils should support a custom list of exported symbols for Windows dlls.

2011-03-21 Thread dholth

New submission from dholth :

I would like to be able to use distutils to compile a shared library with a 
different set of exported symbols than the default.

In Windows, distutils only exports certain symbols needed for the Python module 
initialization API when it compiles a shared module. It does this by passing a 
file to the C compiler that lists those symbols. In Linux all symbols are 
exported/visible by default because that's just how the linker has 
traditionally worked.

I would like to be able to override or augment this list of symbols. Probably 
by just providing my own 'symbols to export' file.

distutils is definitely the poor man's compiler frontend but this feature would 
make it easier for me to support Windows (Python's secret shame.)

--
assignee: tarek
components: Distutils2
messages: 131677
nosy: alexis, dholth, eric.araujo, tarek
priority: normal
severity: normal
status: open
title: distutils should support a custom list of exported symbols for Windows 
dlls.
type: feature request
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



[issue11618] Locks broken wrt timeouts on Windows

2011-03-21 Thread Kristján Valur Jónsson

Kristján Valur Jónsson  added the comment:

Antoine:  I agree, the semaphore is the quick and robust solution.

sbt: I see your point.  Still, I think we still may have a flaw:  The statement 
that (owned-timeouts) is never an under-estimate isn't true on modern 
architectures, I think.  The order of the atomic decrement operations in the 
code means nothing and cannot be depended on to guarantee such a claim:  The 
thread doing the reading may see the individual updates in any order, and so 
the estimate may be an over- or an underestimate.

It would fix this and simplify things a lot to take the special case for 
timeout==0 out of the code.

--

___
Python tracker 

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



[issue10833] Replace %.100s by %s in PyErr_Format(): the arbitrary limit of 500 bytes is outdated

2011-03-21 Thread Roundup Robot

Roundup Robot  added the comment:

New changeset 513bab5cfb18 by Victor Stinner in branch 'default':
Issue #10833: Remove the buffer allocated on the stack, it isn't used anymore
http://hg.python.org/cpython/rev/513bab5cfb18

New changeset 4c2135930882 by Victor Stinner in branch 'default':
Issue #10833: Use PyErr_Format() and PyUnicode_FromFormat() instead of
http://hg.python.org/cpython/rev/4c2135930882

--

___
Python tracker 

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



[issue11393] Integrate faulthandler module into Python 3.3

2011-03-21 Thread STINNER Victor

STINNER Victor  added the comment:

Le lundi 21 mars 2011 à 15:59 +, Dave Malcolm a écrit :
> Various thoughts/nitpicking:
>   - is it possible to indicate with a coding convention (e.g.
> comments) which parts of the code are intended to be called from a
> signal handler?  It seems worth making this explicit.  Or perhaps put
> it all in one file?

Ok, good idea, I will do that. I think that I will write it in the
function comment, something like: "This function is signal safe".

The following functions are signal safe:

faulthandler_fatal_error()
faulthandler_dump_backtrace()
faulthandler_dump_backtrace_threads()
faulthandler_user()

(.. and all helper functions, used by faulthandler_dump_backtrace():
reverse_string(), dump_decimal(), dump_hexadecimal(), dump_ascii(),
dump_frame().)

>   - within tests.py, check_enabled and check_disabled seem to me to be
> misnamed; it's not at all clear what they do.
>   I'd suggest renaming "get_output" to "run_code", perhaps (adding
> a docstring specifying the returned value)
>   "check_enabled" seems to mean "assertCodeLeadsToOutput" or
> somesuch.

Ok, I will try to find better names.

> Within backtrace.py:
>   - do all platforms supported by Python have a concept of numeric
> filedescriptors? I was wondering if FILE* might be a better
> abstraction here (with flushing), then read
> http://bugs.python.org/issue8863#msg124385 which gives the reason:
> fprintf etc are not signal-safe

Yes, I think that all platforms support numeric file descriptors. On
Windows, numeric file descriptors are not the native type for file, but
Windows provides a POSIX API.

And yes, FILE* API cannot be used because it uses buffers, and buffers
are not signal safe (at least, fwrite() is not signal safe).

I tested my module on Linux, FreeBSD and Windows. I don't have other
OS :-)

>   - all of the calls to "write" ignore the return code, leading to
> warnings from GCC.  I don't think there's any good way to handle
> errors from these calls, though.

Except exiting the signal handler, I don't see anything useful to do on
write() error. I think that it is safe to ignore write() errors, and I
prefer to keep the code simple.

I don't know how to make these warnings quiet.

> Might be nice to also have SIGABRT (as per a c-level assertion
> failure), exposed 

I think that it would do that while integrating faulthandler into Python
to check the interaction with Py_FatalError().

> NB: on Fedora/RHEL we also have a whole-system crash detection system
> (called "abrt": https://fedorahosted.org/abrt/ ), and in theory, that
> means that for me, crash reports get run using the gdb pretty-print
> hooks.
>
> I'm wondering to what extent this would interract with whole-system
> crash-detection tools: would it e.g. mask a SIGSEGV, so that the crash
> is not seen by that system?

faulthandler is compatible with gdb and abrt. For gdb, you get the
SIGSEGV signal before faulthandler: the "signal SIGSEGV" gdb command
will call faulthandler signal handler. For abrt, faulthandler does print
the backtrace, and then abrt is called. Execution order:

crash => gdb => faulthandler => abrt

(I think that gdb and abrt are exclusive)

I didn't try abrt, but I tried Ubuntu Apport which is smiliar (Apport
uses /proc/sys/kernel/core_pattern with a pipe).

You may test faulthandler on Fedora to tell me if it interacts correctly
with abrt :-)
https://github.com/haypo/faulthandler/wiki/

--

___
Python tracker 

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



[issue11623] Distutils is reporting OSX 10.6 w/ XCode 4 as "universal"

2011-03-21 Thread Johannes Lindenbaum

New submission from Johannes Lindenbaum :

This bug is a crosspost from /setuptools.
(http://bugs.python.org/setuptools/issue122)

Summary:
OSX 10.6.x with Xcode 4 installed. Xcode 4 removes the PPC assembler from GCC. 
I attempted to install Fabric-1.0.0 which depended on pycrypto, during the 
pycrypto build there was a failure regarding "Broken Pipe".

I downloaded the package separately and attempted to do the install there. Same 
error.

I was pointed in the right direction that the broken pipe error was coming from 
the '-arch ppc' flag during build.


Expected Result
10.6.x should not report itself as "universal" when it's no longer possible to 
compile for PPC.


Actual Result
Attempted PPC compilation fails.


More detail:
http://superuser.com/questions/259278/python-2-6-1-pycrypto-2-3-pypi-package-broken-pipe-during-build/260106#260106

Let me know if you require more information.

Kind Regards,
Johannes

--
assignee: tarek
components: Distutils
messages: 131673
nosy: eric.araujo, jlindenbaum, tarek
priority: normal
severity: normal
status: open
title: Distutils is reporting OSX 10.6 w/ XCode 4 as "universal"
type: behavior
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



[issue11618] Locks broken wrt timeouts on Windows

2011-03-21 Thread sbt

sbt  added the comment:

> Btw, the locktimeout.patch appears to have a race condition.  
> LeaveNonRecursiveMutex may SetEvent when there is no thread waiting 
> (because a timeout just occurred, but the thread on which it happened 
> is still somewhere around line #62 ).  This will cause the next 
> WaitForSingleObject() to succeed, when it shouldn't.

I believe the lock is still in a consistent state.  If this race happens and 
SetEvent() is called then we will must have mutex->owned > -1 because the timed 
out waiter is still counted by mutex->owned.  This prevents the tests involving 
interlocked functions from giving true.  Thus WaitForSingleObject() is the ONLY 
way for a waiter to get the lock.

In other words, as soon as a timeout happens the fast "interlocked path" gets 
blocked.  It is only unblocked again after a call to WaitForSingleObject() 
succeeds: then the thread which now owns the lock fixes mutex->owned using 
mutex->timeouts and the interlocked path is operational again (unless another 
timeout happens).

I can certainly understand the desire to follow the KISS principle.

--

___
Python tracker 

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



[issue11393] Integrate faulthandler module into Python 3.3

2011-03-21 Thread Dave Malcolm

Dave Malcolm  added the comment:

Various thoughts/nitpicking:
  - is it possible to indicate with a coding convention (e.g. comments) which 
parts of the code are intended to be called from a signal handler?  It seems 
worth making this explicit.  Or perhaps put it all in one file?
  - within tests.py, check_enabled and check_disabled seem to me to be 
misnamed; it's not at all clear what they do.
  I'd suggest renaming "get_output" to "run_code", perhaps (adding a 
docstring specifying the returned value)
  "check_enabled" seems to mean "assertCodeLeadsToOutput" or somesuch.

Within backtrace.py:
  - do all platforms supported by Python have a concept of numeric 
filedescriptors? I was wondering if FILE* might be a better abstraction here 
(with flushing), then read http://bugs.python.org/issue8863#msg124385 which 
gives the reason: fprintf etc are not signal-safe
  - all of the calls to "write" ignore the return code, leading to warnings 
from GCC.  I don't think there's any good way to handle errors from these 
calls, though.

Might be nice to also have SIGABRT (as per a c-level assertion failure), 
exposed 

NB: on Fedora/RHEL we also have a whole-system crash detection system (called 
"abrt": https://fedorahosted.org/abrt/ ), and in theory, that means that for 
me, crash reports get run using the gdb pretty-print hooks.

I'm wondering to what extent this would interract with whole-system 
crash-detection tools: would it e.g. mask a SIGSEGV, so that the crash is not 
seen by that system?

--

___
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

2011-03-21 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

Just for the record, here is the critical section-based version.

I would still favour committing the semaphore-based version first (especially 
in 3.2), and then discussing performance improvements if desired.

--
Added file: http://bugs.python.org/file21325/critlocknt.patch

___
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

2011-03-21 Thread Kristján Valur Jónsson

Kristján Valur Jónsson  added the comment:

Btw, the locktimeout.patch appears to have a race condition.  
LeaveNonRecursiveMutex may SetEvent when there is no thread waiting (because a 
timeout just occurred, but the thread on which it happened is still somewhere 
around line #62 ).  This will cause the next WaitForSingleObject() to succeed, 
when it shouldn't.

It is this race between the timeout occurring, and the ability of us being able 
to register that in the lock's bookkeeping, that is the source of all the race 
problems with the timeout.  This is what prompted me to submit the condition 
variable version.

--

___
Python tracker 

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



[issue7330] PyUnicode_FromFormat: implement width and precision for %s, %S, %R, %V, %U, %A

2011-03-21 Thread Ray.Allen

Ray.Allen  added the comment:

Ooops! I found my last submitted patch is a wrong one.


Here is the updated patch add doc entries about the changes. The test cases 
which assert error messages generated by PyUnicode_FromFormat() with "%.200s" 
formatters equality would failed due to this patch. Hope you don't miss any of 
them.

--
Added file: http://bugs.python.org/file21324/issue_7330.diff

___
Python tracker 

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



[issue5863] bz2.BZ2File should accept other file-like objects. (issue4274045)

2011-03-21 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

> >From the discussion on python-dev, it seems that I will need to submit a
> Contributor Agreement to the PSF. Can I ask that you not commit this
> patch until the CA has been submitted? I will need to clear it with my
> employer, and it might complicate things if the code in question has
> already been committed.

Ok, I was planning to do another review anyway.

--

___
Python tracker 

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



[issue5863] bz2.BZ2File should accept other file-like objects. (issue4274045)

2011-03-21 Thread Nadeem Vawda

Nadeem Vawda  added the comment:

>From the discussion on python-dev, it seems that I will need to submit a
Contributor Agreement to the PSF. Can I ask that you not commit this
patch until the CA has been submitted? I will need to clear it with my
employer, and it might complicate things if the code in question has
already been committed.

--

___
Python tracker 

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



[issue7330] PyUnicode_FromFormat: implement width and precision for %s, %S, %R, %V, %U, %A

2011-03-21 Thread Ray.Allen

Changes by Ray.Allen :


Removed file: http://bugs.python.org/file21032/issue7330_3.diff

___
Python tracker 

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



[issue11621] build error: bootstrap issue with gettext

2011-03-21 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

Should be fixed.

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



[issue3080] Full unicode import system

2011-03-21 Thread Andrew Svetlov

Andrew Svetlov  added the comment:

Understood. Sorry.
I thought Python support only Windows and posix (Linux, BSD, MacOSX etc) 
systems now, all other OSes are not maintained.

Anyway please don't care about that.

--

___
Python tracker 

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



[issue11621] build error: bootstrap issue with gettext

2011-03-21 Thread Roundup Robot

Roundup Robot  added the comment:

New changeset 160823d258b5 by Antoine Pitrou in branch 'default':
Issue #11621: fix bootstrap issue with getopt/gettext (following d3e46930ffe9)
http://hg.python.org/cpython/rev/160823d258b5

--
nosy: +python-dev

___
Python tracker 

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



[issue11621] build error: bootstrap issue with gettext

2011-03-21 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

Actually, it's not specific to the DMG build.

--
nosy: +pitrou, r.david.murray
priority: normal -> release blocker
title: DMG build error -> build error: bootstrap issue with gettext

___
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

2011-03-21 Thread sbt

sbt  added the comment:

Benchmarks (on an old laptop running XP without a VM) doing

D:\Repos\cpython\PCbuild>python -m timeit -s "from threading import Lock; l = 
Lock()" "l.acquire(); l.release()"
100 loops, best of 3: 0.934 usec per loop

default:0.934
locktimeout.patch:  0.965
semlocknt.patch:2.76
locktimeout2.patch: 2.03

--

___
Python tracker 

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



[issue11595] Miscellaneous bugs in cfg_to_args() utility function

2011-03-21 Thread Erik Bray

Erik Bray  added the comment:

I've got an additional patch to this function that also adds support for the 
package_data option, for extension modules (at least as they are currently 
specified in setup.cfg), and adds support for running setup_hook.

The only problem is that it's starting to copy more and more from 
distutils2.config.Config.  The difference being that it's still simpler, and 
doesn't depend on much else from distutils2.  The reason being that I'm using 
this in my own packages so that I can distutils2-like setup.cfgs, but still 
install with normal distutils and/or Distribute without depending on distutils2 
in its entirety.

I'm wondering if there might be a better way to proceed, or if this sort of 
compatibility support is even useful to anyone else.

--

___
Python tracker 

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



[issue11622] Documentation

2011-03-21 Thread SilentGhost

SilentGhost  added the comment:

Did you try http://docs.python.org/tutorial/ ?

--
nosy: +SilentGhost
versions:  -Python 2.7, Python 3.4

___
Python tracker 

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



[issue11622] Documentation

2011-03-21 Thread Roberto De Renzi

New submission from Roberto De Renzi :

I don't know if a suggestion is allowed here. I am an absolute beginner trying 
to substitute my matlab+fortran with python. I just passed the stage of 
tutorials and I have to struggle looking for the right syntax to implement my 
simple-minded programs. The learning curve is much steeper than for matlab, 
certainly due to the greater power of the language. The thing I need is a good 
reference manual. 

I find the Language Reference extremely poor in examples. The Library Reference 
is marginally better. Would you please consider sponsoring (as a developer-user 
community) a style that forces to include very short examples?  Thanks Roberto

--
assignee: docs@python
components: Documentation
messages: 131658
nosy: docs@python, roberto.derenzi
priority: normal
severity: normal
status: open
title: Documentation
type: feature request
versions: Python 2.7, Python 3.4

___
Python tracker 

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



[issue1602] windows console doesn't print or input Unicode

2011-03-21 Thread STINNER Victor

STINNER Victor  added the comment:

I did some tests with WriteConsoleW():
 - with raster fonts, U+00E9 is displayed as é, U+0141 as L and U+042D as ? => 
good (work as expected)
 - with TrueType font (Lucida), U+00E9 is displayed as é, U+0141 as Ł and 
U+042D as Э => perfect! (all characters are rendered correctly)

Now I agree that WriteConsoleW() is the best solution to fix this issue.

My test code (added to Python/sysmodule.c):
-
static PyObject *
sys_write_stdout(PyObject *self, PyObject *args)
{
PyObject *textobj;
wchar_t *text;
DWORD written, total;
Py_ssize_t len, chunk;
HANDLE console;
BOOL ok;

if (!PyArg_ParseTuple(args, "U:write_stdout", &textobj))
return NULL;

console = GetStdHandle(STD_OUTPUT_HANDLE);
if (console == INVALID_HANDLE_VALUE) {
PyErr_SetFromWindowsErr(GetLastError());
return NULL;
}

text = PyUnicode_AS_UNICODE(textobj);
len = PyUnicode_GET_SIZE(textobj);
total = 0;
while (len != 0) {
if (len > 1)
/* WriteConsoleW() is limited to 64 KB (32,768 UTF-16 units), but
   this limit depends on the heap usage. Use a safe limit of 10,000
   UTF-16 units.
   http://tahoe-lafs.org/trac/tahoe-lafs/ticket/1232 */
chunk = 1;
else
chunk = len;
ok = WriteConsoleW(console, text, chunk, &written, NULL);
if (!ok) 
break;
text += written;
len -= written;
total += written;
}
return PyLong_FromUnsignedLong(total);
}
-


The question is now how to integrate WriteConsoleW() into Python without 
breaking the API, for example:
 - Should sys.stdout be a TextIOWrapper or not?
 - Should sys.stdout.fileno() returns 1 or raise an error?
 - What about sys.stdout.buffer: should sys.stdout.buffer.write() calls 
WriteConsoleA() or sys.stdout should not have a buffer attribute? I think that 
many modules and programs now rely on sys.stdout.buffer to write directly bytes 
into stdout. There is at least python -m base64.
 - Should we use ReadConsoleW() for stdin?

--

___
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

2011-03-21 Thread Kristján Valur Jónsson

Kristján Valur Jónsson  added the comment:

Emulating condition variables on windows became easy once Semaphores were 
provided by the OS because they provide a way around the lost wakeup problem.  
The current implementation in cpython was submitted by me :)  The source 
material is provided for reference only.

--

___
Python tracker 

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



[issue11621] DMG build error

2011-03-21 Thread Antoine Pitrou

Changes by Antoine Pitrou :


--
nosy:  -pitrou

___
Python tracker 

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



[issue11621] DMG build error

2011-03-21 Thread Antoine Pitrou

New submission from Antoine Pitrou :

Looks like a bootstrap issue, could be related to the latest getopt changes:


Could not find platform dependent libraries 
Consider setting $PYTHONHOME to [:]
Traceback (most recent call last):
  File "/Users/db3l/buildarea.dmg/3.x.dmg/build/setup.py", line 13, in 
from distutils.core import Extension, setup
  File "/Users/db3l/buildarea.dmg/3.x.dmg/build/Lib/distutils/core.py", line 
18, in 
from distutils.dist import Distribution
  File "/Users/db3l/buildarea.dmg/3.x.dmg/build/Lib/distutils/dist.py", line 
17, in 
from distutils.fancy_getopt import FancyGetopt, translate_longopt
  File "/Users/db3l/buildarea.dmg/3.x.dmg/build/Lib/distutils/fancy_getopt.py", 
line 14, in 
import getopt
  File "/Users/db3l/buildarea.dmg/3.x.dmg/build/Lib/getopt.py", line 37, in 

from gettext import gettext as _
  File "/Users/db3l/buildarea.dmg/3.x.dmg/build/Lib/gettext.py", line 49, in 

import locale, copy, io, os, re, struct, sys
  File "/Users/db3l/buildarea.dmg/3.x.dmg/build/Lib/struct.py", line 12, in 

from _struct import *
ImportError: No module named '_struct'
make: *** [sharedmods] Error 1

--
components: Build
messages: 131655
nosy: db3l, eric.araujo, pitrou
priority: normal
severity: normal
stage: needs patch
status: open
title: DMG build error
type: behavior
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



[issue11046] setup.py/configure

2011-03-21 Thread Steffen Daode Nurpmeso

Steffen Daode Nurpmeso  added the comment:

(P.S.: sorry all of you, have had no contact to roundup
and thus [k=v] Subject: interpretation until 30 minutes ago.)

--
resolution: later -> fixed

___
Python tracker 

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



[issue11046] setup.py/configure

2011-03-21 Thread Steffen Daode Nurpmeso

Steffen Daode Nurpmeso  added the comment:

On Sat, Mar 19, 2011 at 11:09:27PM +, Ronald Oussoren wrote:
> AFAIK that means it is not necessary to keep this issue open.

Yeah, all-automatic is even better than yet another command line
option, i think - great!
(Let's get completely rid of it.)

--
title: setup.py/configure [darwin] -> setup.py/configure

___
Python tracker 

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



[issue11594] 2to3 does not preserve line endings

2011-03-21 Thread Benjamin Peterson

Benjamin Peterson  added the comment:

I can fix it. I just need to find time. :)

--

___
Python tracker 

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



[issue11046] setup.py/configure [darwin]

2011-03-21 Thread Steffen Daode Nurpmeso

Changes by Steffen Daode Nurpmeso :


--
status: pending -> closed

___
Python tracker 

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



[issue9523] Improve dbm modules

2011-03-21 Thread Ray.Allen

Ray.Allen  added the comment:

> I think the patch will not be suitable for 3.1 and 3.2

Yes, it changes some api(e.g keys()), which may introduces compatibility issues.

> so there should be a doc patch to mention the limitations of the dbm API 
> (keys() > returning a list and all that).

Do you mean a doc patch for 3.2 which mentions the missing or imperfect methods 
of collections.MutableSequence()? e.g keys() not returns a KeysView but a list 
instead, update() is missing

--

___
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

2011-03-21 Thread sbt

sbt  added the comment:

> If we are rolling our own instead of using Semaphores (as has been 
> suggested for performance reasons) then using a Condition variable is 
> IMHO safer than a custom solution because the correctness of that 
> approach is so easily provable.

Assuming that you trust the implementation of condition variables, then I 
agree.  Unfortunately implementing condition variables correctly on Windows is 
notoriously difficult.  The patch contains the lines

+   Generic emulations of the pthread_cond_* API using
+   Win32 functions can be found on the Web.
+   The following read can be edificating (or not):
+   http://www.cse.wustl.edu/~schmidt/win32-cv-1.html

Apparently all the examples from that web page are faulty one way or another.

http://newsgroups.derkeiler.com/Archive/Comp/comp.programming.threads/2008-07/msg00025.html
 

contains the following quote:

> Perhaps this list should provide links to a "reliable" windows
> condition variable implementation instead of continuously bad 
> mouthing the ~schmidt/win32-cv-1.html page and thereby raising 
> it's page rank.  It would greatly help out all us newbies out here.

pthreads-w32 used to use a solution depending on that paper but changed to 
something else.  The following is a long but relevant read:

ftp://sourceware.org/pub/pthreads-win32/sources/pthreads-w32-2-8-0-release/README.CV

Of course implementing condition variables is a whole lot easier if you don't 
need to broadcast and you only need weak guarantees on the behaviour.  So 
python's implementation may be quite sufficient.  (It does appear that a thread 
which calls COND_SIGNAL() may consume that signal with a later call of 
COND_WAIT().  A "proper" implementation should never allow that because it can 
cause deadlocks in code depending on normal pthread sematics.)

--

___
Python tracker 

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



[issue11082] ValueError: Content-Length should be specified

2011-03-21 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



[issue7330] PyUnicode_FromFormat: implement width and precision for %s, %S, %R, %V, %U, %A

2011-03-21 Thread STINNER Victor

STINNER Victor  added the comment:

Ray Allen: Your patch doesn't touch the documentation. At least, you should 
mention (using .. versionchanged:: 3.3) that PyUnicode_FromFormat() does now 
support width and precision. It is important to specify the unit of the sizes: 
number of bytes or number of characters? Because many developer may refer to 
printf() which counts in bytes (especially for %s). PyUnicode_FromFormat() is 
more close to wprintf(), but I don't know if wprintf() uses bytes or characters 
for width and precision with the %s and %ls formats.

I plan to fix #10833 by replacing %.100s by %s is most (or all) error messages, 
and then commit your patch.

--

___
Python tracker 

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



[issue9309] Add environment variable complementing command line option -no-user-cfg

2011-03-21 Thread Éric Araujo

Éric Araujo  added the comment:

This is discussed on https://github.com/pypa/virtualenv/issues/88

I noticed that the original Sage bug report requested that no-user-cfg be 
supported in the global distutils config file; this is more acceptable than 
adding an environment variable.  I’m not sure it would solve your problem 
though, which looks more educational than technical (i.e. people may forget to 
use an option on the command line or in the config file, so adding support for 
an option in the config file may not help).  Do you think it would be a useful 
feature anyway?

Anyway, don’t forget that distutils is closed to feature requests, and this 
would only land in distutils2 (included in Python 3.3 and released on PyPI for 
older versions), so I suspect a fix here would take years to be of benefit to 
your community.  I’m sorry about this situation, and I do hope a fix in 
virtualenv (which has a faster release cycle and don’t require you to change 
code in the distributed projects) will solve your problem in a near future.

--

___
Python tracker 

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



[issue11572] bring Lib/copy.py to 100% coverage

2011-03-21 Thread Éric Araujo

Éric Araujo  added the comment:

The suggestion about assertIsInstance was a mistake, I misread issubclass in 
the original code.

--

___
Python tracker 

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



[issue9302] distutils API Reference: setup() and Extension parameters' description not correct.

2011-03-21 Thread Ray.Allen

Ray.Allen  added the comment:

I searched the distutils docs for such a parameter description table and find 
tow more on the distutils.core.setup() function descriptions. Reflected in my 
updated patch.

--
title: distutils.core.Extension: list parameters documented as strings -> 
distutils API Reference: setup() and Extension parameters' description not 
correct.
Added file: http://bugs.python.org/file21323/issue_9302.diff

___
Python tracker 

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



[issue11594] 2to3 does not preserve line endings

2011-03-21 Thread Alexander Belchenko

Alexander Belchenko  added the comment:

Éric, thank you for the proposal, but I'm not familiar enough with the codebase 
to work on it. 

The short scan over the tests reveals that there is at least one test which 
tries to test CRLF behavior, in the file test_refactor.py, but I don't 
understand what it doing?

def test_crlf_newlines(self):
old_sep = os.linesep
os.linesep = "\r\n"
try:
fn = os.path.join(TEST_DATA_DIR, "crlf.py")
fixes = refactor.get_fixers_from_package("lib2to3.fixes")
self.check_file_refactoring(fn, fixes)
finally:
os.linesep = old_sep

So, in theory I can modify that test to check what if the file has LF-only 
line-endings originally, but os.linesep is CRLF, but then I don't know what the 
content I should create and how to run fixer over that.

--

___
Python tracker 

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



[issue11572] bring Lib/copy.py to 100% coverage

2011-03-21 Thread Brandon Craig Rhodes

Brandon Craig Rhodes  added the comment:

Nick Coghlan  writes:

> Regarding "__reduce__", other readers will have the same question Éric
> did, so that point should definitely go in a comment after the
> "__reduce_ex__" check.

I just sat down to review this issue, and, looking at test_copy3.patch,
isn't there already a comment next to each __reduce_ex__ check that
reminds the reader that object.__reduce_ex__ will itself call
__reduce__?  Does the comment just need to be more elaborate or
something?

Finally, Éric wants me to replace this:

> self.assertTrue(issubclass(copy.Error, Exception))

with self.assertIsInstance().  But surely the question is not whether
copy.Error is an *instance* of Exception?  They are both instances of
*type*, right?  What I would need is something like assertIsSubclass or
assertInheritsFrom, neither of which exists.

So I think that test_copy3.patch already includes all of the valid
improvements on the table; if I'm missing one, just point it out and
I'll fix it!

--

___
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

2011-03-21 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

> I'm just providing this as a fast alternative to the Semaphore, which
> as far as I know, will cause a kernel call every time.

A Semaphore might be "slow", but I'm not sure other primitives are
faster. For the record, I tried another implementation using a critical
section, and it's not significantly faster under a VM (even though MSDN
claims critical sections are fast).

Have you timed your solution?

--

___
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

2011-03-21 Thread Kristján Valur Jónsson

Kristján Valur Jónsson  added the comment:

I'm just providing this as a fast alternative to the Semaphore, which as far as 
I know, will cause a kernel call every time.

Complicated is relative.  In terms of the condition variable api, I wouldn't 
say that it is.  But given the fact that we have to emulate condition variables 
on older windows, then yes, it is complex.

If we are rolling our own instead of using Semaphores (as has been suggested 
for performance reasons) then using a Condition variable is IMHO safer than a 
custom solution because the correctness of that approach is so easily provable.

--

___
Python tracker 

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



  1   2   >