[issue14391] misc TYPO in argparse.Action docstring

2012-03-22 Thread Toshihiro Kamishima

New submission from Toshihiro Kamishima :

Keywords to specify as string type are incorrect.
'string' should be 'str'

--
components: Library (Lib)
files: argparse.py.patch
keywords: patch
messages: 156635
nosy: shima__shima
priority: normal
severity: normal
status: open
title: misc TYPO in argparse.Action docstring
type: enhancement
versions: Python 2.7
Added file: http://bugs.python.org/file25000/argparse.py.patch

___
Python tracker 

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



[issue14386] Expose dictproxy as a public type

2012-03-22 Thread Jim Jewett

Jim Jewett  added the comment:

> The problem is to reject sequence in dictproxy constructor.

Why?  Just because you can't delegate in quite the same way?  A sequence *does* 
meet the (immutable) Mapping interface; it just won't happen to have any 
non-integer keys.

Or are you worried about IndexError vs KeyError?  Personally, I would just 
document it as returning LookupError, but if you're really worried, you could 
always catch the IndexError and raise a KeyError from it.

> The "PyMapping_Check(dict) && !PyMapping_Check(dict)" 

I'm not seeing how anything could sanely pass that ... was there a typo when 
pasting?

--
nosy: +Jim.Jewett

___
Python tracker 

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



[issue1752252] tkFileDialog closes Python when used

2012-03-22 Thread Terry J. Reedy

Terry J. Reedy  added the comment:

Without a specific claimed failing program and contemporary verification, it is 
hard to know whether one has reproduced or not. With 3.3 I did

import tkinter.filedialog as tkf
import tkinter as tk
fd=tkf.FileDialog(tk.Tk())
fd.go()

and got a file dialog window as well as a root window which sat there until I 
closed the fd window at least 10 seconds later. The root window did not close 
properly, but I suspect the above in missing anything. In any case, several 
crash causes have been fixed since 2007, so I agree to close.

The file dialog window was not the native window displayed for file selection 
in IDLE, and was pretty ugly. So I do not imagine that this is used much. It 
probably could be updated, but that is another issue for another time.

--
resolution:  -> out of date
status: open -> closed

___
Python tracker 

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



[issue14380] MIMEText should default to utf8 charset if input text contains non-ASCII

2012-03-22 Thread Roundup Robot

Roundup Robot  added the comment:

New changeset 9ceac471bd8c by R David Murray in branch 'default':
#14380: Make actual default match docs, fix __init__ order.
http://hg.python.org/cpython/rev/9ceac471bd8c

--

___
Python tracker 

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



[issue14380] MIMEText should default to utf8 charset if input text contains non-ASCII

2012-03-22 Thread R. David Murray

R. David Murray  added the comment:

See also issue 7304.  It was niggling at the back of my brain, and I finally 
managed to dig it up.  Fixing that is much more complex than fixing this 
(because set_charset is a *very* strange method), so I committed this patch in 
case we don't manage to fix 7304 before 3.3 is ready, but with a comment about 
removing it when 7304 is fixed.

Thanks, Jeff.

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

___
Python tracker 

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



[issue14380] MIMEText should default to utf8 charset if input text contains non-ASCII

2012-03-22 Thread Roundup Robot

Roundup Robot  added the comment:

New changeset bfd1ba2bbaf8 by R David Murray in branch 'default':
#14380: Have MIMEText defaults to utf-8 when passed non-ASCII unicode
http://hg.python.org/cpython/rev/bfd1ba2bbaf8

--
nosy: +python-dev

___
Python tracker 

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



[issue7304] email.message.Message.set_payload and as_string given charset 'us-ascii' plus 8bit data produces invalid message

2012-03-22 Thread R. David Murray

R. David Murray  added the comment:

In Python2 the fix would be to use charset unknown-8bit instead of us-ascii.

In Python3 this actually puts unicode in the message body.  There we should 
default to utf-8, but this requires a more extensive change than the Python2 
change, and probably should not be backported.

Once this is fixed in Python3 the utf-8 default check can be removed from 
MIMEText (issue 14380).

--
versions: +Python 3.3 -Python 3.1

___
Python tracker 

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



[issue7304] email.message.Message.set_payload and as_string given charset 'us-ascii' plus 8bit data produces invalid message

2012-03-22 Thread R. David Murray

Changes by R. David Murray :


--
assignee:  -> r.david.murray

___
Python tracker 

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



[issue12553] email should default to 8bit CTE unless policy.must_be_7bit is set

2012-03-22 Thread R. David Murray

Changes by R. David Murray :


--
assignee:  -> r.david.murray

___
Python tracker 

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



[issue14387] Include\accu.h incompatible with Windows.h

2012-03-22 Thread Roundup Robot

Roundup Robot  added the comment:

New changeset aff7ff2aae8c by Kristján Valur Jónsson in branch '3.2':
Issue #14387 : undefine 'small' so that it doesn't clash with Windows headers.
http://hg.python.org/cpython/rev/aff7ff2aae8c

New changeset 780aaa7b4b62 by Kristján Valur Jónsson in branch 'default':
Merge with 3.2 (Issue #14387)
http://hg.python.org/cpython/rev/780aaa7b4b62

--

___
Python tracker 

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



[issue1752252] tkFileDialog closes Python when used

2012-03-22 Thread Andrew Svetlov

Andrew Svetlov  added the comment:

Ping.
Is there can be reproduced?
I like to see the issue as out of date.

--
nosy: +asvetlov, georg.brandl, loewis, terry.reedy
versions: +Python 3.3 -Python 2.6, Python 3.0

___
Python tracker 

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



[issue1524639] Fix Tkinter Tcl-commands memory-leaks

2012-03-22 Thread Andrew Svetlov

Changes by Andrew Svetlov :


--
assignee:  -> asvetlov
nosy: +asvetlov

___
Python tracker 

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



[issue14387] Include\accu.h incompatible with Windows.h

2012-03-22 Thread Kristján Valur Jónsson

Kristján Valur Jónsson  added the comment:

Sure, that's simpler.  I'll submit a fix.

--

___
Python tracker 

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



[issue14387] Include\accu.h incompatible with Windows.h

2012-03-22 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

> Now unicodedata.c does not compile with VS2010, because somewhere, "small" is 
> defined.
> Do you mind if I change the _PyAccu.small member to 'smalls'?

How about the #undef suggested somewhere?

--

___
Python tracker 

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



[issue14387] Include\accu.h incompatible with Windows.h

2012-03-22 Thread Kristján Valur Jónsson

Kristján Valur Jónsson  added the comment:

Now unicodedata.c does not compile with VS2010, because somewhere, "small" is 
defined.
Do you mind if I change the _PyAccu.small member to 'smalls'?

--
nosy: +krisvale

___
Python tracker 

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



[issue14381] Intern certain integral floats for memory savings and performance

2012-03-22 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

Ok. In the current state it doesn't look detrimental, although I'm not 
convinced it's that useful either.
That said, the implementation needs a bit of work, I don't think it's ok for 
float_is_positive_zero() to use the Py_LONG_LONG casting thing.

--

___
Python tracker 

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



[issue3015] tkinter with wantobjects=False has been broken for some time

2012-03-22 Thread Andrew Svetlov

Changes by Andrew Svetlov :


--
nosy: +asvetlov

___
Python tracker 

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



[issue6270] Menu deletecommand fails if command is already deleted

2012-03-22 Thread Andrew Svetlov

Changes by Andrew Svetlov :


--
nosy: +asvetlov

___
Python tracker 

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



[issue1222721] tk + setlocale problems...

2012-03-22 Thread Terry J. Reedy

Terry J. Reedy  added the comment:

Thanks for retesting.
Closing until there is a clear problem with current releases.

--
resolution:  -> out of date
status: open -> closed
versions:  -Python 2.4

___
Python tracker 

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



[issue3367] Uninitialized value read in parsetok.c

2012-03-22 Thread Kristján Valur Jónsson

Kristján Valur Jónsson  added the comment:

Victor, could you check out the last patch here for sysmodule?  I gather that 
you are familiar with it.

--
nosy: +haypo

___
Python tracker 

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



[issue3035] Removing apparently unwanted functions from Tkinter

2012-03-22 Thread R. David Murray

R. David Murray  added the comment:

You are theoretically right about not posting trivial patches, but as you can 
see, sometimes even a trivial patch elicits unexpected insights.  So I like to 
always post my patches, even the seemingly trivial ones.  Then if I don't get 
any responses, I figure it is OK to to ahead on the trivial ones :)

Of course, I don't do this 100% of the time.  This is especially true if there 
has been prior discussion, or sometimes discussion on IRC (although in the 
latter case I still may post the patch and always post summary of the IRC 
discussion).

As for the deprecation process. PendingDeprecationWarning was introduced 
for...I forget which feature it was.  Something that was going to be around for 
several releases, anyway.  And I think that feature wound up not getting 
removed until Python3, but I don't remember for sure.

Then for a short time we did start using it as you say, giving a three release 
deprecation cycle (pending, deprecated, gone), but that was before deprecation 
warnings were made silent.  PendingDeprecations were silent, you see, so using 
them one release early was a hack around the fact that DeprecationWarnings were 
*not* silent.

On the other hand I think we've gotten more strict about "needless" 
deprecations.  If there's no harm in leaving something in, we leave it in.  
It's too bad Guido's comment wasn't noticed at the Python3 boundary; that is 
the perfect time to remove such cruft.  So doing a PendingDeprecationWarning to 
remind ourselves that this is something we want to remove in Python4 is also a 
reasonable approach.  Really, I think this is an area where our procedures and 
criteria are still a bit in flux...

--

___
Python tracker 

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



[issue14390] Tkinter single-threaded deadlock

2012-03-22 Thread John Bollinger

New submission from John Bollinger :

This is the same as issue 452973, created as a new issue pursuant to the 
instruction given when 452973 was closed as "out of date".

In a nutshell, in a program using combining Tkinter with Tcl callbacks written 
in C, it is possible for even a single-threaded program to deadlock.

The case I ran into had these particulars:

The main program is in Python, but it relies on a custom extension written in 
C.  Through that extension, C callbacks are registered for various Tcl GUI 
events, and most of these invoke Python functions via Python's C API.  Many of 
those Python functions invoke Tkinter methods.  For example, many of the 
callbacks are bound to menu item activations, and these typically [try to] 
contruct a Tkinter dialog the first time they are called.  What happens in 
practice is that the program starts fine, but the GUI freezes as soon as any 
menu item is activated that has one of the affected callbacks bound to it.

Gdb and I are confident that the problem is as described in issue 452973: the 
program's single thread acquires TKinter's internal Tcl lock when the mouse 
event processing begins, and does not release it before control re-enters 
Python (there is no public API by which it can be made to do so).  When the 
Python function invokes Tkinter methods, tkinter attempts to acquire the lock 
again, at which point it deadlocks because it holds the lock already.

I encountered this issue on CentOS 6 (thus Python 2.6.6), but it appears that 
the problem is still present in the Python 3 trunk.  I have flagged this issue 
only for version 2.6, however, because I cannot currently confirm that it 
affects later versions (see below regarding testing).

I developed a patch against 2.6.6.  It fixes the problem by allowing the Tcl 
lock to be acquired multiple times by any one thread (and requiring it to be 
released the same number of times before another thread can acquire it).  That 
is perhaps technically inferior to creating public functions around 
_tkinter.c's ENTER_PYTHON and LEAVE_PYTHON macros, but it doesn't touch the 
public API.  Even if new public functions were provided, the reentrant locking 
might still be a good fallback.  The patch applies cleanly to the trunk, so 
probably also to every version between that and 2.6.6.

I would be happy to contribute the patch, but I am a bit at a loss as to how to 
write an automated test for it because (1) such a test must depend on an 
extension module, and (2) test failure means causing a deadlock.

Any advice as to whether such a patch would be considered, or as to how best to 
test it would be welcome.

--
components: Tkinter
messages: 156619
nosy: jcbollinger
priority: normal
severity: normal
status: open
title: Tkinter single-threaded deadlock
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



[issue14382] test_unittest crashes loading 'unittest.test.testmock' when run from installed Python

2012-03-22 Thread Ned Deily

Changes by Ned Deily :


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

___
Python tracker 

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



[issue14382] test_unittest crashes loading 'unittest.test.testmock' when run from installed Python

2012-03-22 Thread Roundup Robot

Roundup Robot  added the comment:

New changeset 1ec74eeda4e8 by Ned Deily in branch 'default':
Issue #14382: Ensure new unittest.test.testmock is installed.
http://hg.python.org/cpython/rev/1ec74eeda4e8

--
nosy: +python-dev

___
Python tracker 

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



[issue1252236] Simplying Tkinter's event loop

2012-03-22 Thread Andrew Svetlov

Changes by Andrew Svetlov :


--
nosy: +asvetlov

___
Python tracker 

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



[issue10538] PyArg_ParseTuple("s*") does not always incref object

2012-03-22 Thread STINNER Victor

STINNER Victor  added the comment:

Thanks :-)

--

___
Python tracker 

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



[issue1447222] tkinter Dialog fails when more than four buttons are used

2012-03-22 Thread Andrew Svetlov

Changes by Andrew Svetlov :


--
nosy: +asvetlov

___
Python tracker 

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



[issue5527] multiprocessing won't work with Tkinter (under Linux)

2012-03-22 Thread Andrew Svetlov

Changes by Andrew Svetlov :


--
nosy: +asvetlov

___
Python tracker 

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



[issue11077] Tkinter is not thread safe

2012-03-22 Thread Andrew Svetlov

Changes by Andrew Svetlov :


--
nosy: +asvetlov

___
Python tracker 

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



[issue14387] Include\accu.h incompatible with Windows.h

2012-03-22 Thread Jeff Robbins

Jeff Robbins  added the comment:

Stefan asked

'Did you include Python.h before or after Windows.h? Extensions
are supposed to include Python.h before anything else. '

I downloaded http://code.google.com/p/apsw/ to test it out on the latest sqlite 
release.  I followed the build instructions on its website and discovered this 
problem.  

While the code isn't mine, inspecting apsw.c, the main source file, I can see 
that the sqlite "amalgamation" is included BEFORE Python.h.  It is this 
"amalgamation" that, in turn, includes Windows.h.

Should I contact the extension's author(s)/maintainer(s) and tell them about 
this ordering requirement?

--

___
Python tracker 

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



[issue3035] Removing apparently unwanted functions from Tkinter

2012-03-22 Thread Andrew Svetlov

Andrew Svetlov  added the comment:

David Murray,
I used to think what deprecation process in Python have to go trough 
PendingDeprectaionWarning to DeprecationWarning and removing in next next 
release at end. Is it right?
Also I thought what that trivial patch does not need to be published in 
tracker. Will do next time.

Terry J. Reedy, the message what you asked was made by GvR in 1995.
That functions can be used to point position in text widget (single-line Entry 
doesn't support it).

Now I think we need to deprecate that functions, but also add keyword-only 
parameters in widgets methods which can accept that ones.
Documentation need to be updated as well.

I'll make a patch for that.

Thank you for mentoring.

--

___
Python tracker 

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



[issue10538] PyArg_ParseTuple("s*") does not always incref object

2012-03-22 Thread Roundup Robot

Roundup Robot  added the comment:

New changeset 8efe88c0f14e by krisvale in branch '2.7':
Issue #10538 - Update Misc/NEWS
http://hg.python.org/cpython/rev/8efe88c0f14e

--

___
Python tracker 

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



[issue1676] Fork/exec issues with Tk 8.5/Python 2.5.1 on OS X

2012-03-22 Thread Ned Deily

Ned Deily  added the comment:

Yes, whatever the initial problem, it doesn't seem to be an issue anymore.

--
nosy: +ned.deily
resolution:  -> out of date
stage: test needed -> 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



[issue14387] Include\accu.h incompatible with Windows.h

2012-03-22 Thread Stefan Krah

Stefan Krah  added the comment:

To prevent further confusion. :)

db154e62ac03 -> OK
5fe7d19ec49a -> failure

5fe7d19ec49a with #undef patch -> OK


So I don't know if it is better to revert to db154e62ac03 or
to use the #undef patch.


Jeff, you originally said:

'An extension which includes both Windows.h and Python.h won't compile   due to 
the Windows.h definition of "small".'


Did you include Python.h before or after Windows.h? Extensions
are supposed to include Python.h before anything else.

--

___
Python tracker 

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



[issue14380] MIMEText should default to utf8 charset if input text contains non-ASCII

2012-03-22 Thread R. David Murray

R. David Murray  added the comment:

That looks good.

--
stage: test needed -> commit review

___
Python tracker 

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



[issue14387] Include\accu.h incompatible with Windows.h

2012-03-22 Thread Stefan Krah

Stefan Krah  added the comment:

Jeff Robbins  wrote:
> I am sorry if I've caused any confusion.  I am building a Python extension
> (APSW), and it includes the sqlite "amalgamation" and also includes Python.h.

The Python build itself failed here, too, specifically in unicodeobject.c.

But I now see that apart from Windows.h there's also windows.h. Case
insensitivity is a difficult concept for a Unix user...

--

___
Python tracker 

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



[issue14380] MIMEText should default to utf8 charset if input text contains non-ASCII

2012-03-22 Thread Jeff Knupp

Jeff Knupp  added the comment:

Understood. Please take a look at the updated patch. Also, removed the 
unrelated diffs that somehow were hanging around in my hg mq.

--
Added file: http://bugs.python.org/file24999/mimeutf8.patch

___
Python tracker 

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



[issue14387] Include\accu.h incompatible with Windows.h

2012-03-22 Thread Jeff Robbins

Jeff Robbins  added the comment:

re  Stefan Krah's posting:

I am sorry if I've caused any confusion.  I am building a Python extension 
(APSW), and it includes the sqlite "amalgamation" and also includes Python.h.

Sqlite includes Windows.h.  Which then causes the problem when Python.h is 
included.

--

___
Python tracker 

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



[issue14387] Include\accu.h incompatible with Windows.h

2012-03-22 Thread Stefan Krah

Stefan Krah  added the comment:

Jeff's #undef suggestion works here (see patch). But I have a question:

Where is Windows.h pulled in anyway? A grep only shows signalmodule.c:

$ find . -name "\.hg" -prune -o -type f -print0 | xargs -0 grep -n 'Windows\.h'
./Modules/signalmodule.c:9:#include 
./Doc/using/windows.rst:341:   `A Python for Windows Tutorial 
`_

--
keywords: +patch
Added file: http://bugs.python.org/file24998/issue14387.diff

___
Python tracker 

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



[issue14384] Add "default" kw argument to operator.itemgetter and operator.attrgetter

2012-03-22 Thread Raymond Hettinger

Changes by Raymond Hettinger :


--
assignee:  -> rhettinger

___
Python tracker 

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



[issue1222721] tk + setlocale problems...

2012-03-22 Thread Andrew Svetlov

Andrew Svetlov  added the comment:

I have no problems with executing demo.
I used Russian locale with LC_NUMERIC, utf-8 and cp1251 (Russian Windows 
encoding).

Looks like the problem cannot be reproduced.

--
nosy: +asvetlov

___
Python tracker 

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



[issue14380] MIMEText should default to utf8 charset if input text contains non-ASCII

2012-03-22 Thread R. David Murray

R. David Murray  added the comment:

Pretty close.  I'd do the check for us_ascii first, and only do the encode 
test/switch to utf-8 if that's the charset.  The reason is that that if a 
charset has been specified, we don't waste time doing an unnecessary encoding 
(and the ascii codec is very fast, which you can't say about all the codecs).

Now, what would be *really* nice is to also try latin-1 before falling back to 
utf-8, but I wouldn't want to make that the default behavior for performance 
reasons.  I'm planning to add support for that at some point, but I haven't 
decided exactly how (policy setting? New optional setting in the alias 
structure?)

There seem to be unrelated changes to torture_test in your patch?

--

___
Python tracker 

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



[issue14307] Make subclassing SocketServer simpler for non-blocking frameworks

2012-03-22 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

> What's wrong with making functionality overridable, Antoine?  By all
> means, let's keep the select() but allow subclasses to elect not to use 
> it.

It's making the implementation more complex for no obvious point.
Using select() is not a bug in itself.
Furthermore, you can simply reimplement serve_forever() in your subclass, if 
you really want it.

--

___
Python tracker 

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



[issue14380] MIMEText should default to utf8 charset if input text contains non-ASCII

2012-03-22 Thread Jeff Knupp

Changes by Jeff Knupp :


--
keywords: +patch
Added file: http://bugs.python.org/file24997/mailutf8.patch

___
Python tracker 

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



[issue14380] MIMEText should default to utf8 charset if input text contains non-ASCII

2012-03-22 Thread Jeff Knupp

Jeff Knupp  added the comment:

Patch to default character set to utf8 if non-ascii characters are found in the 
input string. Please let me know if this is what you had in mind.

--
nosy: +Jeff.Knupp

___
Python tracker 

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



[issue14367] try/except block in ismethoddescriptor() in inspect.py, so that pydoc works with pygame in Python 3.2

2012-03-22 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

Well, the exception shouldn't be silenced. As David said, I think it would be 
better to silence the exception in pydoc.
Besides, it would be nice to come with a standalone test case, because it's not 
clear exactly why pygame triggers this.

--
nosy: +pitrou

___
Python tracker 

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



[issue14367] try/except block in ismethoddescriptor() in inspect.py, so that pydoc works with pygame in Python 3.2

2012-03-22 Thread Michael Foord

Michael Foord  added the comment:

The code is *already* triggering execution through the use of hasattr. It could 
be switched to use getattr_static instead, but the try...except in the patch 
looks reasonable whether or not that change is made.

--

___
Python tracker 

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



[issue14361] No link to issue tracker on Python home page

2012-03-22 Thread Daniel Swanson

Daniel Swanson  added the comment:

I agree that the link to the bug tracker should be more obvious (yesterday it 
took me almost an hour to find it)

--
nosy: +weirdink13

___
Python tracker 

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



[issue1676] Fork/exec issues with Tk 8.5/Python 2.5.1 on OS X

2012-03-22 Thread Andrew Svetlov

Andrew Svetlov  added the comment:

Let's close this issue as very old and obsolete.

--
nosy: +asvetlov

___
Python tracker 

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



[issue14387] Include\accu.h incompatible with Windows.h

2012-03-22 Thread Jeff Robbins

Jeff Robbins  added the comment:

The easiest fix would be to rename the "small" field in accu.h (and of course 
in any file that references that field.)  I have no idea who uses this file.

Perhaps the 2nd easiest fix would be to put this after the #include of Windows.h

#ifdef small
#undef small
#endif

As long as any extension also including Windows.h included Windows.h BEFORE 
Python.h, this should fix the problem for an extension builder.

A further thought is to put

#define WIN32_LEAN_AND_MEAN

right before the #include Windows.h

This doesn't fix the extension problem in that every #include of Windows.h 
would need to do this (SQLITE doesn't right now) but if all Python needs from 
Windows.h is in the "WIN32_LEAN_AND_MEAN" subset, it seems like a good thing in 
general, no?

--

___
Python tracker 

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



[issue10538] PyArg_ParseTuple("s*") does not always incref object

2012-03-22 Thread STINNER Victor

STINNER Victor  added the comment:

You should mention your change in Misc/NEWS.

--

___
Python tracker 

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



[issue14371] Add support for bzip2 compression to the zipfile module

2012-03-22 Thread Antoine Pitrou

Changes by Antoine Pitrou :


--
nosy: +nadeem.vawda
stage:  -> patch review

___
Python tracker 

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



[issue14387] Include\accu.h incompatible with Windows.h

2012-03-22 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

> Hmm, I still get the error in 13cefcbcc7da:

Can you try to find a fix? I don't have anything to test here.

--
assignee: pitrou -> 

___
Python tracker 

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



[issue14384] Add "default" kw argument to operator.itemgetter and operator.attrgetter

2012-03-22 Thread R. David Murray

R. David Murray  added the comment:

Great.  I'm going to close the issue, but it's only "for now": if you get a 
good response and a design agreement on python-ideas please reopen the issue.  
Of course, we'd need a patch, too; and I believe there would need to be close 
to zero impact on performance, since as I understand it a large part of the 
point of attrgetter and friends is speed.

--
nosy: +rhettinger
resolution:  -> later
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



[issue14371] Add support for bzip2 compression to the zipfile module

2012-03-22 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

All errors are fixed. All tests are passed. Unfortunately, the patch was more 
than expected. This is necessary for correct and effective work with large 
bzip2 buffers (for other codecs can also be a profit).

--
Added file: http://bugs.python.org/file24996/bzip2_in_zip_2.patch

___
Python tracker 

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



[issue14384] Add "default" kw argument to operator.itemgetter and operator.attrgetter

2012-03-22 Thread Miki Tebeka

Miki Tebeka  added the comment:

python-ideas post at 
https://groups.google.com/d/msg/python-ideas/lc_hkpKNvAg/ledftgY0mFUJ

--

___
Python tracker 

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



[issue10538] PyArg_ParseTuple("s*") does not always incref object

2012-03-22 Thread Kristján Valur Jónsson

Changes by Kristján Valur Jónsson :


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



[issue10538] PyArg_ParseTuple("s*") does not always incref object

2012-03-22 Thread Roundup Robot

Roundup Robot  added the comment:

New changeset 17c671529f7e by Kristján Valur Jónsson in branch '2.7':
Issue #10538. Put a reference to the source object in the Py_buffer when
http://hg.python.org/cpython/rev/17c671529f7e

--
nosy: +python-dev

___
Python tracker 

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



[issue14387] Include\accu.h incompatible with Windows.h

2012-03-22 Thread Georg Brandl

Georg Brandl  added the comment:

We can of course also rename "small".

--

___
Python tracker 

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



[issue14387] Include\accu.h incompatible with Windows.h

2012-03-22 Thread Stefan Krah

Stefan Krah  added the comment:

Hmm, I still get the error in 13cefcbcc7da:

c:\Users\stefan\pydev\cpython\Include\accu.h(21) : error C2059: syntax error : 
'type'   
c:\Users\stefan\pydev\cpython\Include\accu.h(22) : error C2059: syntax error : 
'}'  
c:\Users\stefan\pydev\cpython\Include\accu.h(24) : error C2143: syntax error : 
missing ')' before '*
'   

c:\Users\stefan\pydev\cpython\Include\accu.h(24) : error C2143: syntax error : 
missing '{' before '*
'   

c:\Users\stefan\pydev\cpython\Include\accu.h(24) : error C2059: syntax error : 
')'  
c:\Users\stefan\pydev\cpython\Include\accu.h(25) : error C2143: syntax error : 
missing ')' before '*
'   

c:\Users\stefan\pydev\cpython\Include\accu.h(25) : error C2143: syntax error : 
missing '{' before '*
'   

c:\Users\stefan\pydev\cpython\Include\accu.h(25) : error C2371: 'PyObject' : 
redefinit




[...]

c:\users\stefan\pydev\cpython\objects\stringlib/unicode_format.h(128) : error 
C2143: syntax error : 
missing ')' before '*'  

c:\users\stefan\pydev\cpython\objects\stringlib/unicode_format.h(128) : error 
C2143: syntax error : 
missing '{' before '*'  

c:\users\stefan\pydev\cpython\objects\stringlib/unicode_format.h(128) : error 
C2371: 'PyObject' : re
definition; different basic types

--
nosy: +skrah

___
Python tracker 

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



[issue14387] Include\accu.h incompatible with Windows.h

2012-03-22 Thread Georg Brandl

Georg Brandl  added the comment:

Sounds reasonable to me.

--

___
Python tracker 

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



[issue10538] PyArg_ParseTuple("s*") does not always incref object

2012-03-22 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

Looks good to me.

--

___
Python tracker 

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



[issue10340] asyncore doesn't properly handle EINVAL on OSX

2012-03-22 Thread R. David Murray

R. David Murray  added the comment:

This appears to be causing buildbot failures:

http://www.python.org/dev/buildbot/all/builders/x86%20debian%20parallel%203.x/builds/4077

http://www.python.org/dev/buildbot/all/builders/AMD64%20Gentoo%20Wide%203.x/builds/3520

--
keywords: +buildbot
status: closed -> open

___
Python tracker 

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



[issue14389] Mishandling of large numbers

2012-03-22 Thread R. David Murray

R. David Murray  added the comment:

You might want to take a look at the Decimal module.

--
nosy: +r.david.murray

___
Python tracker 

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



[issue14307] Make subclassing SocketServer simpler for non-blocking frameworks

2012-03-22 Thread Kristján Valur Jónsson

Kristján Valur Jónsson  added the comment:

What's wrong with making functionality overridable, Antoine?  By all means, 
let's keep the select() but allow subclasses to elect not to use it.

As for the wakeup fd, there isn't such a thing.  Why object on the basis of a 
hypothetical feature which might be added later?  And should it be added later, 
it would require changes to SocketServer anyway.  Why not arrange it so that 
such functionality can be added in an extensible manner?

--

___
Python tracker 

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



[issue14228] It is impossible to catch sigint on startup in python code

2012-03-22 Thread telmich

telmich  added the comment:

Oh yes, you are right. Sorry for the confusion.

When modifying caller.py to only print(), everything works.

But then I've a different problem: If I want to exit(1),
in case I get a SIGINT, I'd like to try to import sys. But trying to import 
sys, will probably fail again, because the user is still pressing ctrl-c:


[17:05] brief:python-traceback-test% ./caller.py 
Indirect child being called
Indirect child being called
Indirect child being called
Indirect child being called
Indirect child being called
Indirect child being called
Indirect child being called
Indirect child being called
Indirect child being called
Indirect child being called
^Ccaught signint in child
[17:05] brief:python-traceback-test% ./caller.py
Indirect child being called
Indirect child being called
Indirect child being called
Indirect child being called
Indirect child being called
Indirect child being called
Indirect child being called
^Ccaught signint in child
Fatal Python error: Py_Initialize: can't initialize sys standard streams
Traceback (most recent call last):
  File "/usr/lib/python3.2/io.py", line 60, in 
[17:05] brief:python-traceback-test% import _io
  File "/usr/lib/python3.2/os.py", line 22, in 
"""
KeyboardInterrupt
./shellpart.sh: line 7: 23123 Aborted ./__testpython


I'll change my production code to run with -S and restoring SIGINT and report 
back.

In any case, I'd appreciate, if cpython would be changed to something more 
sane/less verbose by default.

--

___
Python tracker 

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



[issue14389] Mishandling of large numbers

2012-03-22 Thread R. David Murray

Changes by R. David Murray :


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

___
Python tracker 

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



[issue10538] PyArg_ParseTuple("s*") does not always incref object

2012-03-22 Thread Kristján Valur Jónsson

Kristján Valur Jónsson  added the comment:

Adding a patch here.

--
keywords: +patch
Added file: http://bugs.python.org/file24995/#10538.patch

___
Python tracker 

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



[issue14367] try/except block in ismethoddescriptor() in inspect.py, so that pydoc works with pygame in Python 3.2

2012-03-22 Thread R. David Murray

R. David Murray  added the comment:

Michael, I thought you might be interested in this one since it looks like it 
might involve inspect executing code unexpectedly, and I know you worked on 
ways of not doing that...

--
nosy: +michael.foord

___
Python tracker 

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



[issue14228] It is impossible to catch sigint on startup in python code

2012-03-22 Thread poq

poq  added the comment:

> It seems not even using -S fixes the problem

That's because you try to use re and os in your except block, and the 
KeyboardInterrupt is raised before they are imported.

--
nosy: +poq

___
Python tracker 

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



[issue14389] Mishandling of large numbers

2012-03-22 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

See 
http://docs.python.org/dev/faq/design.html#why-are-floating-point-calculations-so-inaccurate

--
nosy: +pitrou

___
Python tracker 

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



[issue14381] Intern certain integral floats for memory savings and performance

2012-03-22 Thread Kristján Valur Jónsson

Kristján Valur Jónsson  added the comment:

PyFloat_FromString() is very restrictive.  In our case, for example, the floats 
in question don't come from text files.

I'm adding a new file with changes suggested by Antoine.  only 0.0 and 1.0 are 
interned.  It turns out that the "int" test is expensive, and special casing it 
to check for '0.0' and '1.0' with direct float comparison makes the performance 
hit go away.  Here are the figures:


D:\pydev\hg\cpython2>pcbuild10\python.exe Tools\pybench\pybench.py -s interned8 
-c normal
---
PYBENCH 2.1
---
* using CPython 3.3.0a1+ (default, Mar 22 2012, 15:39:50) [MSC v.1600 32 bit 
(Intel)]
* disabled garbage collection
* system check interval set to maximum: 2147483647
* using timer: time.clock

---
Benchmark: interned8
---

Rounds: 10
Warp:   10
Timer:  time.clock

Machine Details:
   Platform ID:Windows-7-6.1.7601-SP1
   Processor:  Intel64 Family 6 Model 26 Stepping 5, GenuineIntel

Python:
   Implementation: CPython
   Executable: D:\pydev\hg\cpython2\pcbuild10\python.exe
   Version:3.3.0a1+
   Compiler:   MSC v.1600 32 bit (Intel)
   Bits:   32bit
   Build:  Mar 22 2012 15:39:50 (#default)
   Unicode:UCS4


---
Comparing with: normal
---

Rounds: 10
Warp:   10
Timer:  time.clock

Machine Details:
   Platform ID:Windows-7-6.1.7601-SP1
   Processor:  Intel64 Family 6 Model 26 Stepping 5, GenuineIntel

Python:
   Implementation: CPython
   Executable: D:\pydev\hg\cpython2\pcbuild10\python.exe
   Version:3.3.0a1+
   Compiler:   MSC v.1600 32 bit (Intel)
   Bits:   32bit
   Build:  Mar 22 2012 13:53:45 (#default)
   Unicode:UCS4


Test minimum run-timeaverage  run-time
 thisother   diffthisother   diff
---
  BuiltinFunctionCalls:59ms59ms   -0.7%60ms60ms   -0.3%
   BuiltinMethodLookup:40ms40ms   -0.2%40ms40ms   -0.2%
 CompareFloats:47ms46ms   +2.3%47ms46ms   +2.3%
 CompareFloatsIntegers:   125ms   126ms   -0.8%   129ms   131ms   -2.0%
   CompareIntegers:76ms76ms   -0.2%76ms76ms   -0.3%
CompareInternedStrings:60ms60ms   -0.0%61ms61ms   +0.2%
  CompareLongs:44ms44ms   -0.4%44ms44ms   -0.4%
CompareStrings:59ms58ms   +2.1%59ms58ms   +1.8%
ComplexPythonFunctionCalls:59ms60ms   -1.7%60ms61ms   -2.5%
 ConcatStrings:49ms55ms  -10.7%49ms55ms  -10.6%
   CreateInstances:67ms66ms   +1.1%68ms68ms   -0.1%
CreateNewInstances:50ms50ms   +1.3%51ms50ms   +0.4%
   CreateStringsWithConcat:70ms71ms   -1.3%70ms72ms   -1.7%
  DictCreation:45ms46ms   -1.7%46ms46ms   -1.5%
 DictWithFloatKeys:81ms84ms   -2.8%81ms84ms   -2.7%
   DictWithIntegerKeys:52ms55ms   -5.4%52ms55ms   -5.1%
DictWithStringKeys:47ms51ms   -6.6%48ms51ms   -6.6%
  ForLoops:42ms42ms   +0.2%42ms42ms   +0.2%
IfThenElse:63ms59ms   +5.5%63ms59ms   +5.6%
   ListSlicing:39ms39ms   +0.0%39ms39ms   -0.4%
NestedForLoops:67ms67ms   -0.2%68ms68ms   +0.0%
  NestedListComprehensions:63ms62ms   +1.2%64ms63ms   +1.2%
  NormalClassAttribute:   102ms   100ms   +1.3%   102ms   101ms   +1.4%
   NormalInstanceAttribute:62ms62ms   +0.2%63ms63ms   +0.2%
   PythonFunctionCalls:60ms60ms   +0.8%61ms60ms   +1.3%
 PythonMethodCalls:74ms74ms   -0.0%74ms74ms   -0.3%
 Recursion:   103ms   102ms   +1.4%   104ms   102ms   +1.3%
  SecondImport:   109ms   109ms   -0.4%   110ms   110ms   -0.6%
   SecondPackageImport:   111ms   112ms   -0.6%   113ms   113ms   +0.2%
 SecondSubmoduleImport:   154ms   153ms   +0.7%   155ms   155ms   -0.2%
   SimpleComplexArithmetic:56ms54ms   +3.7%57ms56ms   +1.9%
SimpleDic

[issue14367] try/except block in ismethoddescriptor() in inspect.py, so that pydoc works with pygame in Python 3.2

2012-03-22 Thread Dave Burton

Dave Burton  added the comment:

Well, the exception is NotImplementedError.  It's raised explicitly in 
pygame\__init__.py

I uncommented my commented-out print statement in inspect.py, and added a 
traceback print, and ran pydoc like this:

c:\python32\python.exe c:\python32\Lib\pydoc.py -p 7464

The I viewed http://localhost:7464/pygame.html in a web browser, and the pydoc 
server printed:



Server ready at http://localhost:7464/
Server commands: [b]rowser, [q]uit
server> c:\python32\Lib\inspect.py:105: RuntimeWarning: use scrap: No module 
named scrap
(ImportError: No module named scrap)
  result = (hasattr(object, "__get__")
dbg: ismethoddescriptor() failed, 
exception=NotImplementedError('scrap module not available\n(ImportError: No 
module named scrap)',)
Traceback (most recent call last):
  File "c:\python32\Lib\inspect.py", line 105, in ismethoddescriptor
result = (hasattr(object, "__get__")
  File "c:\python32\lib\site-packages\pygame\__init__.py", line 74, in 
__getattr__
raise NotImplementedError(MissingPygameModule)
NotImplementedError: scrap module not available
(ImportError: No module named scrap)


c:\python32\Lib\inspect.py:105: RuntimeWarning: use sndarray: no module named 
numpy or Numeric found
(ImportError: no module named numpy or Numeric found)
  result = (hasattr(object, "__get__")
dbg: ismethoddescriptor() failed, 
exception=NotImplementedError('sndarray module not available\n(ImportError: no 
module named numpy or Numeric found)',)
Traceback (most recent call last):
...(etc.)


Here's the modified ismethoddescriptor() in inspect.py:


def ismethoddescriptor(object):
"""Return true if the object is a method descriptor.

But not if ismethod() or isclass() or isfunction() are true.

This is new in Python 2.2, and, for example, is true of int.__add__.
An object passing this test has a __get__ attribute but not a __set__
attribute, but beyond that the set of attributes varies.  __name__ is
usually sensible, and __doc__ often is.

Methods implemented via descriptors that also pass one of the other
tests return false from the ismethoddescriptor() test, simply because
the other tests promise more -- you can, e.g., count on having the
__func__ attribute (etc) when an object passes ismethod()."""
import traceback
try:
result = (hasattr(object, "__get__")
 and not hasattr(object, "__set__") # else it's a data 
descriptor
 and not ismethod(object)   # mutual exclusion
 and not isfunction(object)
 and not isclass(object))
except Exception as whichone:
print('dbg: ismethoddescriptor('+repr(object)+') failed, 
exception='+repr(whichone))
traceback.print_exc(file=sys.stdout)
print("-"*60 + '\n')
result = False
return result

--

___
Python tracker 

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



[issue14389] Mishandling of large numbers

2012-03-22 Thread Practicing Zazen

New submission from Practicing Zazen :

Please let me know if this is accepted behavior or not.

>>> 9*999
8991
>>> 9*999+0.1
8990.0
>>> 9*999+1
8992

--
messages: 156576
nosy: Practicing.Zazen
priority: normal
severity: normal
status: open
title: Mishandling of large numbers

___
Python tracker 

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



[issue14228] It is impossible to catch sigint on startup in python code

2012-03-22 Thread telmich

telmich  added the comment:

I think setting up SIGINT after importing site is a good solution: It will kill 
the program as expected and as soon as the user takes over control, she can 
decide what todo.

In which stage/part is the python interpreter when
I guess/hope that the race condition between initsigs(); would have been moved 
downwards?

I'm asking, because if 'import site' is done, the maximum output seen that 
could occur is

KeyboardInterrupt


if there is no code around there. Which looks way more sane that what I see 
currently.

--

___
Python tracker 

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



[issue10340] asyncore doesn't properly handle EINVAL on OSX

2012-03-22 Thread Giampaolo Rodola'

Changes by Giampaolo Rodola' :


--
assignee:  -> giampaolo.rodola
priority: high -> normal
resolution:  -> fixed
stage: patch review -> committed/rejected
status: open -> closed

___
Python tracker 

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



[issue14228] It is impossible to catch sigint on startup in python code

2012-03-22 Thread telmich

telmich  added the comment:

It seems not even using -S fixes the problem:

[16:25] brief:python-traceback-test% head -n 2 caller.py 
#!/usr/bin/python3 -S

[16:25] brief:python-traceback-test% ./caller.py 
Indirect child being called
Indirect child being called
Indirect child being called
^Ccaught signint in parent
Traceback (most recent call last):
  File "/usr/lib/python3.2/functools.py", line 176, in wrapper
result = cache[key]
KeyError: (, '[ \\f\\t]*(\\r?\\n[ 
\\f\\t]*)*(#[^\\r\\n]*)?((([0-9]+[jJ]|(([0-9]+\\.[0-9]*|\\.[0-9]+)([eE][-+]?[0-9]+)?|[0-9]+[eE][-+]?[0-9]+)[jJ])|(([0-9]+\\.[0-9]*|\\.[0-9]+)([eE][-+]?[0-9]+)?|[0-9]+[eE][-+]?[0-9]+)|(0[xX][0-9a-fA-F]+|0[bB][01]+|0[oO][0-7]+|(?:0+|[1-9][0-9]*)))|((\\*\\*=?|>>=?|<<=?|!=|//=?|->|[+\\-*/%&|^=<>]=?|~)|[][(){}]|(\\r?\\n|\\.\\.\\.|[:;.,@]))|([bB]?[rR]?\'[^\\n\']*(?:.[^\\n\']*)*\'|[bB]?[rR]?"[^\\n"]*(?:.[^\\n"]*)*")|\\w+)',
 32)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "./__testpython", line 4, in 
import site
  File "/usr/lib/python3.2/site.py", line 58, in 
import traceback
  File "/usr/lib/python3.2/traceback.py", line 3, in 
import linecache
  File "/usr/lib/python3.2/linecache.py", line 10, in 
import tokenize
  File "/usr/lib/python3.2/tokenize.py", line 118, in 
_compile, (Token, PseudoToken, Single3, Double3))
  File "/usr/lib/python3.2/tokenize.py", line 115, in _compile
return re.compile(expr, re.UNICODE)
  File "/usr/lib/python3.2/re.py", line 206, in compile
[16:25] brief:python-traceback-test% return _compile(pattern, flags)
  File "/usr/lib/python3.2/re.py", line 255, in _compile
return _compile_typed(type(pattern), pattern, flags)
  File "/usr/lib/python3.2/functools.py", line 180, in wrapper
result = user_function(*args, **kwds)
  File "/usr/lib/python3.2/re.py", line 267, in _compile_typed
return sre_compile.compile(pattern, flags)
  File "/usr/lib/python3.2/sre_compile.py", line 495, in compile
code = _code(p, flags)
  File "/usr/lib/python3.2/sre_compile.py", line 477, in _code
_compile_info(code, p, flags)
  File "/usr/lib/python3.2/sre_compile.py", line 366, in _compile_info
lo, hi = pattern.getwidth()
  File "/usr/lib/python3.2/sre_parse.py", line 163, in getwidth
i, j = av[1].getwidth()
  File "/usr/lib/python3.2/sre_parse.py", line 153, in getwidth
l, h = av.getwidth()
  File "/usr/lib/python3.2/sre_parse.py", line 163, in getwidth
i, j = av[1].getwidth()
  File "/usr/lib/python3.2/sre_parse.py", line 153, in getwidth
l, h = av.getwidth()
  File "/usr/lib/python3.2/sre_parse.py", line 163, in getwidth
i, j = av[1].getwidth()
  File "/usr/lib/python3.2/sre_parse.py", line 153, in getwidth
l, h = av.getwidth()
  File "/usr/lib/python3.2/sre_parse.py", line 163, in getwidth
i, j = av[1].getwidth()
  File "/usr/lib/python3.2/sre_parse.py", line 153, in getwidth
l, h = av.getwidth()
  File "/usr/lib/python3.2/sre_parse.py", line 147, in getwidth
REPEATCODES = (MIN_REPEAT, MAX_REPEAT)
KeyboardInterrupt

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "./__testpython", line 26, in 
if re.match("__", os.path.basename(sys.argv[0])):
NameError: name 're' is not defined

--
Added file: http://bugs.python.org/file24993/caller.py

___
Python tracker 

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



[issue10340] asyncore doesn't properly handle EINVAL on OSX

2012-03-22 Thread Roundup Robot

Roundup Robot  added the comment:

New changeset 13cefcbcc7da by Giampaolo Rodola' in branch 'default':
fix #10340: properly handle EINVAL on OSX and also avoid to call 
handle_connect() in case of a disconnetected socket which is not meant to 
connect.
http://hg.python.org/cpython/rev/13cefcbcc7da

--

___
Python tracker 

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



[issue10340] asyncore doesn't properly handle EINVAL on OSX

2012-03-22 Thread Roundup Robot

Roundup Robot  added the comment:

New changeset 8c1fd9276b25 by Giampaolo Rodola' in branch '3.2':
issue 10340 - forgot to update Misc/NEWS
http://hg.python.org/cpython/rev/8c1fd9276b25

--

___
Python tracker 

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



[issue14381] Intern certain integral floats for memory savings and performance

2012-03-22 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

Try moving your changes from PyFloat_FromDouble to PyFloat_FromString. Look at 
memory and perfomance.

--

___
Python tracker 

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



[issue10340] asyncore doesn't properly handle EINVAL on OSX

2012-03-22 Thread Roundup Robot

Roundup Robot  added the comment:

New changeset e2cddb3f4526 by Giampaolo Rodola' in branch '3.2':
fix #10340: properly handle EINVAL on OSX and also avoid to call 
handle_connect() in case of a disconnetected socket which is not meant to 
connect.
http://hg.python.org/cpython/rev/e2cddb3f4526

New changeset 6ffdca50a5ef by Giampaolo Rodola' in branch 'default':
merge 79422b3684f1 in 3.3 branch (issue 10340)
http://hg.python.org/cpython/rev/6ffdca50a5ef

--

___
Python tracker 

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



[issue14381] Intern certain integral floats for memory savings and performance

2012-03-22 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

> Right, I'll do some test with the hardcoded values you mentioned.
> Btw, I don't think -0.0 is worth it, that value is a typical
> arithmetic result and not something you typically get from input data.

I was suggesting -0.0 in the hope that it might make the patch a bit
simpler, but I was probably wrong: you still have to test the float's
sign to distinguish between the two values.

> Also, while interning in python is certainly possible, perhaps it
> would make sense to implement such in c.

I think it makes sense in the float implementation if it doesn't
significantly decrease performance. I suggest you post the benchmark
numbers (see http://hg.python.org/benchmarks/ ).

Adding a separate builtin/stdlib function would be overkill IMO.

--

___
Python tracker 

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



[issue14381] Intern certain integral floats for memory savings and performance

2012-03-22 Thread Kristján Valur Jónsson

Kristján Valur Jónsson  added the comment:

The -10..11 range was determined empirically.  As you see from the values,  
only -10 shows up as significant... In fact, just storing 0 to 5 would capture 
the bulk of the savings.
 
Right, I'll do some test with the hardcoded values you mentioned.
Btw, I don't think -0.0 is worth it, that value is a typical arithmetic result 
and not something you typically get from input data.

Also, while interning in python is certainly possible, perhaps it would make 
sense to implement such in c.  Perhaps in the math module, or perhaps  even the 
'intern' builtin can be extended for this purpose?  It could be documented to 
intern any immutable object that it sees fit to intern, leaving the details to 
the implementation.

--

___
Python tracker 

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



[issue10340] asyncore doesn't properly handle EINVAL on OSX

2012-03-22 Thread Roundup Robot

Roundup Robot  added the comment:

New changeset 8c19c9914c22 by Giampaolo Rodola' in branch '2.7':
fix #10340: properly handle EINVAL on OSX and also avoid to call 
handle_connect() in case of a disconnetected socket which is not meant to 
connect.
http://hg.python.org/cpython/rev/8c19c9914c22

--
nosy: +python-dev

___
Python tracker 

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



[issue14381] Intern certain integral floats for memory savings and performance

2012-03-22 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

> Integers don't fall out of arithmetic that often, true.  But integral
> floats are incredibly common in tabular data.  In a game such as Eve
> Online,  configuration data contains a lot of 0.0, 1.0, -1.0 and so
> on.  This patch saved us many megabytes on the server.

Can't you do your own interning when reading configuration data? You can even 
do it in pure Python.

If CPython starts interning some integral floats, I think only {-1.0, -0.0, 
0.0, 1.0} should apply. The rest is too application-specific.

--
nosy: +pitrou

___
Python tracker 

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



[issue14382] test_unittest crashes loading 'unittest.test.testmock' when run from installed Python

2012-03-22 Thread Michael Foord

Michael Foord  added the comment:

Thanks vinay (and ned). I thought that was the cause of the problem - but glad 
you diagnosed and fixed it before I had to look into it. Patch looks good to 
apply.

--

___
Python tracker 

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



[issue14381] Intern certain integral floats for memory savings and performance

2012-03-22 Thread Kristján Valur Jónsson

Kristján Valur Jónsson  added the comment:

Yes, there is a measurable performance decrease in pybench arithmetic tests.

Integers don't fall out of arithmetic that often, true.  But integral floats 
are incredibly common in tabular data.  In a game such as Eve Online,  
configuration data contains a lot of 0.0, 1.0, -1.0 and so on.  This patch 
saved us many megabytes on the server.  I can check again...

>>> [sys.getrefcount(float(i)) for i in range(-10, 11)]
[777, 4, 38, 9, 215, 691, 627, 185, 98, 603, 73180, 62111, 8326, 6225, 6357, 
11737, 2906, 1393, 3142, 1145, 5601]
>>> sum([sys.getrefcount(float(i)) for i in range(-10, 11)])
185340
>>> 
This is on an idle server.  A server with lots of stuff going on will have this:
[16715, 184, 1477, 34, 1505, 27102, 3878, 1344, 6248, 974, 595889, 313062, 
124072, 120054, 65585, 138667, 13265, 2499, 15677, 3175, 24821]
>>> sum([sys.getrefcount(float(i)) for i in range(-10, 11)])
1465155

About half of the interned floats are 0.0
On a 64 bit machine with each float taking 24 bytes, this is 35mb net.

An alternative could be to add a function for manual intering of floating point 
data, which one can use e.g. when reading tabular data.

--

___
Python tracker 

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



[issue13325] no address in the representation of asyncore dispatcher after connection established

2012-03-22 Thread Giampaolo Rodola'

Giampaolo Rodola'  added the comment:

Closing as duplicate of issue 13694.

--
resolution:  -> duplicate
status: open -> closed
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



[issue14388] configparser.py traceback

2012-03-22 Thread R. David Murray

R. David Murray  added the comment:

Looking at the traceback and your code, configparser is calling 'get', 
expecting to call its own get method (that takes a 'raw' keyword), but instead 
is calling the get on your subclass, which doesn't take a 'raw' keyword.  

Since this appears to be example code, probably what you should do to fix this 
is remove those get methods.  Your 'default' is spelled 'fallback' in Python3.2 
configparser and does the same thing your code does.

--
nosy: +lukasz.langa, r.david.murray
resolution:  -> invalid
status: open -> closed
type: crash -> behavior

___
Python tracker 

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



[issue14387] Include\accu.h incompatible with Windows.h

2012-03-22 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

Fixed according to Amaury's suggestion.
Georg, Benjamin, I think this should probably go into the final releases.

--

___
Python tracker 

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




[issue14387] Include\accu.h incompatible with Windows.h

2012-03-22 Thread Roundup Robot

Roundup Robot  added the comment:

New changeset f34ac2e9d5cf by Antoine Pitrou in branch '3.2':
Issue #14387: Do not include accu.h from Python.h.
http://hg.python.org/cpython/rev/f34ac2e9d5cf

New changeset 5fe7d19ec49a by Antoine Pitrou in branch 'default':
Issue #14387: Do not include accu.h from Python.h.
http://hg.python.org/cpython/rev/5fe7d19ec49a

--
nosy: +python-dev

___
Python tracker 

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



[issue14388] configparser.py traceback

2012-03-22 Thread Sol Jerome

New submission from Sol Jerome :

This seems like it could be user error, but the traceback doesn't provide 
useful information on where the problem could be. The relevant class is at the 
following URL.

https://github.com/Bcfg2/bcfg2/blob/master/src/lib/Server/Plugin.py#L1180


Traceback (most recent call last):
  File "/root/bcfg2/Bcfg2/Server/FileMonitor.py", line 64, in handle_one_event
self.handles[event.requestID].HandleEvent(event)
  File "/root/bcfg2/Bcfg2/Server/Plugins/Packages/PackagesSources.py", line 52, 
in HandleEvent
self.pkg_obj.Reload()
  File "/root/bcfg2/Bcfg2/Server/Plugins/Packages/__init__.py", line 193, in 
Reload
self._load_config()
  File "/root/bcfg2/Bcfg2/Server/Plugins/Packages/__init__.py", line 203, in 
_load_config
self._load_sources(force_update)
  File "/root/bcfg2/Bcfg2/Server/Plugins/Packages/__init__.py", line 221, in 
_load_sources
if not self.disableMetaData:
  File "/root/bcfg2/Bcfg2/Server/Plugins/Packages/__init__.py", line 65, in 
disableMetaData
return not self.config.getboolean("global", "resolver")
  File "/root/bcfg2/Bcfg2/Server/Plugin.py", line 1216, in getboolean
section, option)
  File "/usr/lib64/python3.2/configparser.py", line 819, in getboolean
raw=raw, vars=vars)
  File "/usr/lib64/python3.2/configparser.py", line 793, in _get
return conv(self.get(section, option, **kwargs))
TypeError: get() got an unexpected keyword argument 'raw'


Please let me know if more information is required.

--
components: Library (Lib)
messages: 156559
nosy: solj
priority: normal
severity: normal
status: open
title: configparser.py traceback
type: crash
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



[issue14078] Add 'sourceline' property to xml.etree Elements

2012-03-22 Thread Eli Bendersky

Eli Bendersky  added the comment:

Hi Leon,
Thanks for the patch.

I suggest to start by raising this to the python-ideas mailing list, to see if 
anyone has objections / different idea about doing this.

Next, keep in mind that starting with 3.3, the default ElementTree 
implementation comes from the C accelerator Modules/_elementtree.c, and 
compatibility between the Python and C implementations becomes important. 
Therefore, each such change has to be added to both implementations. Is your 
patch done in a common section, or just the Python implementation?

--

___
Python tracker 

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



[issue14382] test_unittest crashes loading 'unittest.test.testmock' when run from installed Python

2012-03-22 Thread Vinay Sajip

Vinay Sajip  added the comment:

This should be fixable using the attached patch.

--
keywords: +patch
nosy: +vinay.sajip
stage: needs patch -> patch review
type:  -> behavior
Added file: http://bugs.python.org/file24992/Makefile.pre.in.diff

___
Python tracker 

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



[issue14378] __future__ imports fail when compiling from python ast

2012-03-22 Thread Benjamin Peterson

Benjamin Peterson  added the comment:

1b467efb9b27

--

___
Python tracker 

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



[issue14378] __future__ imports fail when compiling from python ast

2012-03-22 Thread Roundup Robot

Roundup Robot  added the comment:

New changeset 1729ec440bb6 by Benjamin Peterson in branch '2.7':
check by equality for __future__ not identity (closes #14378)
http://hg.python.org/cpython/rev/1729ec440bb6

--
status: open -> closed

___
Python tracker 

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



[issue14378] __future__ imports fail when compiling from python ast

2012-03-22 Thread R. David Murray

R. David Murray  added the comment:

After this commit the buildbots are dying randomly with segfaults.

--
nosy: +r.david.murray
priority: normal -> release blocker
status: closed -> open

___
Python tracker 

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



[issue14387] Include\accu.h incompatible with Windows.h

2012-03-22 Thread Antoine Pitrou

Changes by Antoine Pitrou :


--
nosy: +benjamin.peterson, georg.brandl
priority: normal -> release blocker
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



[issue14367] try/except block in ismethoddescriptor() in inspect.py, so that pydoc works with pygame in Python 3.2

2012-03-22 Thread R. David Murray

R. David Murray  added the comment:

Thanks for the report and patch.  However, in general we prefer not to mask 
exceptions (doing that can hide bugs in programs).  It would probably be 
reasonable to fix this in pydoc, however.

Alternatively there might be a specific exception or set of exceptions that 
should indeed result in a False value.  What exception is being raised?  Can 
you provide a test case extracted from what pygame is doing that triggers the 
problem?

--
nosy: +r.david.murray
stage:  -> test needed

___
Python tracker 

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



[issue14385] Support other types than dict for __builtins__

2012-03-22 Thread STINNER Victor

STINNER Victor  added the comment:

> Note: this protection is not enough to secure Python,
> but it is an important part of a Python sandbox.

Oh, and by the way, I workaround the lack of read-only mapping in pysandbox by 
removing dict methods: dict.__init__(), dict.clear(), dict.update(), etc. This 
is a problem because these methods are useful in Python.

--

___
Python tracker 

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



  1   2   >