[issue14779] test_buffer fails on OS X universal 64-/32-bit builds

2012-05-11 Thread Stefan Krah

Stefan Krah  added the comment:

The sysconfig docs say: "configuration variables relevant for the
current platform"

If get_config_var('SIZEOF_VOID_P') is meaningless for universal builds,
then IMO it should return None. None would then mean either "not found"
or "irrelevant".

--

___
Python tracker 

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



[issue14743] on terminating, Pdb debugs itself

2012-05-11 Thread Xavier de Gaye

Xavier de Gaye  added the comment:

The previous patch only fixed the problem when the debugger is started
from its main function. Uploaded new patch
pdb_botframe_default_3.patch that fixes pdb.main and the pdb.run*
function.

This patch also corrects pdb.runcall(): in the following session, the
3.1 debugger starts the debugging session at the second line of foo()
and not at the --Call-- event. A test case for this problem is also
included in the patch.


===   main.py   =
import pdb, sys
print(sys.version)

def foo():
pass

pdb.runcall(foo)
=
$ python3.1 main.py
3.1.2 (r312:79147, Apr  4 2010, 17:46:48) 
[GCC 4.3.2]
> /path_to/main.py(5)foo()
-> pass
(Pdb) quit
=

--
Added file: http://bugs.python.org/file25535/pdb_botframe_default_3.patch

___
Python tracker 

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



[issue14781] strptime fails for year 0

2012-05-11 Thread Matthias Meyer

New submission from Matthias Meyer :

Hi folks,

What I did:
import time
time.strptime('-10-03T15:35:05Z','%Y-%m-%dT%H:%M:%SZ')

What I expected:
time.struct_time(tm_year=0, tm_mon=10, tm_mday=3, tm_hour=15, tm_min=35, 
tm_sec=5, tm_wday=2, tm_yday=276, tm_isdst=-1)

What I got:
Traceback (most recent call last):
  File "", line 1, in 
  File "/usr/lib/python2.7/_strptime.py", line 454, in _strptime_time
return _strptime(data_string, format)[0]
  File "/usr/lib/python2.7/_strptime.py", line 440, in _strptime
datetime_date(year, 1, 1).toordinal() + 1
ValueError: year is out of range


Environment:
Ubuntu 12.04 x64
python --version: 2.7.3


If you need more information, please let me know...

--
components: Library (Lib)
messages: 160404
nosy: Matthias.Meyer
priority: normal
severity: normal
status: open
title: strptime fails for year 0
type: crash
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



[issue14779] test_buffer fails on OS X universal 64-/32-bit builds

2012-05-11 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

Well, no need to ever use SIZEOF_VOID_P. sys.maxsize should always tell you 
whether the build is 32-bit or 64-bit.

--
nosy: +mark.dickinson, pitrou

___
Python tracker 

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



[issue14781] strptime fails for year 0

2012-05-11 Thread Hynek Schlawack

Hynek Schlawack  added the comment:

Hello Matthias,

%Y for strptime is defined as:

"Year with century as a decimal number [0001,] (strptime), […]"

so it works as specified. And actually that's correct as there was no year zero 
(http://en.wikipedia.org/wiki/0_(year)). :)

--
nosy: +hynek
resolution:  -> invalid

___
Python tracker 

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



[issue14781] strptime fails for year 0

2012-05-11 Thread Matthias Meyer

Matthias Meyer  added the comment:

but ISO 8601 specifies year 0 to be identical with 1 BC. Shouldn't it default 
to that, then?

--

___
Python tracker 

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



[issue12029] Catching virtual subclasses in except clauses

2012-05-11 Thread Éric Araujo

Changes by Éric Araujo :


--
title: ABC registration of Exceptions -> Catching virtual subclasses in except 
clauses
versions: +Python 3.3 -Python 3.2

___
Python tracker 

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



[issue14772] Return destination values in some shutil functions

2012-05-11 Thread Éric Araujo

Éric Araujo  added the comment:

In distutils, both copy_file and copy_tree return the destination path(s), 
which is needed by many commands.  In packaging there is code to compute and 
return those paths, as shutil functions return None; I’d love to remove that 
code.

The bug I was thinking about is actually about copy(_)file parameters, not 
return value: #13336.

--

___
Python tracker 

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



[issue14588] PEP 3115 compliant dynamic class creation

2012-05-11 Thread Éric Araujo

Éric Araujo  added the comment:

Implementing in pure Python seems to have a lot of pros and no con to me.

--

___
Python tracker 

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



[issue14781] Default to year 1 in strptime if year 0 has been specified

2012-05-11 Thread Hynek Schlawack

Hynek Schlawack  added the comment:

Well, that's what C's strptime does. But that would be a feature request (if it 
works as documented, it's no bug). :)

I've transformed this issue accordingly. But as a feature request, it won't go 
into 2.7 unless I'm missing something.

--
nosy: +belopolsky, benjamin.peterson, lemburg
priority: normal -> low
resolution: invalid -> 
stage:  -> needs patch
title: strptime fails for year 0 -> Default to year 1 in strptime if year 0 has 
been specified
type: crash -> enhancement
versions: +Python 3.2, Python 3.3 -Python 2.7

___
Python tracker 

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



[issue14781] Default to year 1 in strptime if year 0 has been specified

2012-05-11 Thread Hynek Schlawack

Hynek Schlawack  added the comment:

I have to correct myself:

It's _not_ what C's strptime does. C's strptime returns via "struct tm" which 
saves only "years since 1900" in the "tm_year" field.

--

___
Python tracker 

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



[issue14782] Tabcompletion of classes with static methods and __call__ has extra bracket

2012-05-11 Thread w.pettersson

New submission from w.pettersson :

With tab completion enabled via rlcompleter and readline, tab-completion will 
assume anything that is callable (by callable(val)) is going to be called. For 
example, the below code defines a class "CCC" that is callable and has a static 
function. However, typing 
>>> CC
and then pressing tab results in the following.
>>> CCC(
Note the extra parentheses. It would be nice if these weren't added if the 
object also has some other reasonable choices.

However, I don't know what would be "reasonable" here. Somehow we'd have to 
detect whether a callable class has static methods, possibly via dir() or 
directly checking class.__dict__ but at this point I am not comfortable enough 
with python to suggest decent solutions.


>>> class CCC:  
>>>  
...   def __call__(self):
... print "call"
...   @staticmethod
...   def f(a):
... print "Static",a
... 
>>>CC
>>>CCC(

--
components: Library (Lib)
messages: 160412
nosy: wpettersson
priority: normal
severity: normal
status: open
title: Tabcompletion of classes with static methods and __call__ has extra 
bracket
type: behavior

___
Python tracker 

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



[issue14779] test_buffer fails on OS X universal 64-/32-bit builds

2012-05-11 Thread Stefan Krah

Stefan Krah  added the comment:

The tests for arrays with suboffsets literally need sizeof(void *).

I don't think C guarantees SIZEOF_VOID_P == SIZEOF_SIZE_T. If HAVE_SSIZE_T
is defined in pyport.h, AFAICS no such check is made.

Of course these concerns may be entirely theoretical. :)

--

___
Python tracker 

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



[issue14776] Add SystemTap static markers

2012-05-11 Thread Mark Wielaard

Changes by Mark Wielaard :


--
nosy: +mjw

___
Python tracker 

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



[issue14776] Add SystemTap static markers

2012-05-11 Thread Mark Wielaard

Mark Wielaard  added the comment:

Just a comment that newer [eu]-readelf -n will provide a nicer view of the sdt 
ELF notes. You might want to suggest that in the documentation.

e.g. $ eu-readelf -n /usr/lib64/libpython2.7.so

Note section [ 1] '.note.gnu.build-id' of 36 bytes at offset 0x190:
  Owner  Data size  Type
  GNU   20  GNU_BUILD_ID
Build ID: a28f8db1b224530b0d38ad7b82a249cf7c3f18d6

Note section [27] '.note.stapsdt' of 184 bytes at offset 0x1ae884:
  Owner  Data size  Type
  stapsdt   70  Version: 3
PC: 0xe0d3a, Base: 0x14b150, Semaphore: 0x3ae882
Provider: python, Name: function__return, Args: '8@%rbx 8@%r13 -4@%eax'
  stapsdt   69  Version: 3
PC: 0xe0f37, Base: 0x14b150, Semaphore: 0x3ae880
Provider: python, Name: function__entry, Args: '8@%rbx 8@%r13 -4@%eax'

--

___
Python tracker 

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



[issue14764] importlib.test.benchmark broken

2012-05-11 Thread Roundup Robot

Roundup Robot  added the comment:

New changeset e1d0535372d0 by Brett Cannon in branch 'default':
Issue #14764: Update importlib.test.benchmark to work in a world where
http://hg.python.org/cpython/rev/e1d0535372d0

--
nosy: +python-dev

___
Python tracker 

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



[issue14764] importlib.test.benchmark broken

2012-05-11 Thread Brett Cannon

Changes by Brett Cannon :


--
assignee:  -> brett.cannon
resolution:  -> fixed
stage:  -> committed/rejected
status: open -> closed

___
Python tracker 

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



[issue14783] Update int() docstring from manual

2012-05-11 Thread Terry J. Reedy

New submission from Terry J. Reedy :

int.__doc__ starts "int(x[, base]) -> integer". That is not exactly correct as 
x is not required and base is only allowed if x is a string. The 3.3 manual 
fixes both problems with "int([number | string[, base]])"

I actually think the rest of the docstring might be replaced with the more 
accurate and informative manual entry. It might be condensed, but I am not sure 
what might be omitted.

--
keywords: easy
messages: 160416
nosy: terry.reedy
priority: low
severity: normal
status: open
title: Update int() docstring from manual
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



[issue14728] trace function not set, causing some Pdb commands to fail

2012-05-11 Thread Terry J. Reedy

Terry J. Reedy  added the comment:

Since this pdb issue is a continuation of #13183 and repeals a part of that 
issue's patch, I nosy'ed the contributors to that issue.

--
nosy: +georg.brandl, loewis, neologix, orsenthil, terry.reedy
stage:  -> patch review

___
Python tracker 

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



[issue12029] Catching virtual subclasses in except clauses

2012-05-11 Thread Guido van Rossum

Guido van Rossum  added the comment:

I agree it's a bug and should be fixed.  It's too confusing that there would be 
two slightly different interpretations of isinstance/issubclass where the 
isinstance() and issubclass() would be using the extended interpretation but 
the except clause would use the narrow interpretation.

The exception matching done by the except clause ought to be explainable in 
terms of issubclass/isinstance.

--
nosy: +gvanrossum

___
Python tracker 

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



[issue14782] Tab-completion of callables displays opening paren

2012-05-11 Thread Éric Araujo

Changes by Éric Araujo :


--
title: Tab-completion of classes displays opening paren -> Tab-completion of 
callables displays opening paren

___
Python tracker 

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



[issue14777] Tkinter clipboard_get() decodes characters incorrectly

2012-05-11 Thread Terry J. Reedy

Terry J. Reedy  added the comment:

3.3, Win 7, Idle
>>> root.clipboard_get()
'abc€'
after cut from here

--
nosy: +terry.reedy

___
Python tracker 

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



[issue14782] Tab-completion of classes displays opening paren

2012-05-11 Thread Éric Araujo

Éric Araujo  added the comment:

This annoys me too, for all callable objects actually (e.g. I type 
"help(someprefix" then Tab then I have to delete the "(" before typing ")" and 
Enter), but I think it was a deliberate change.  I may have the original bug 
report open in a browser tab at home, I’ll check.

--
nosy: +eric.araujo
title: Tabcompletion of classes with static methods and __call__ has extra 
bracket -> Tab-completion of classes displays opening paren

___
Python tracker 

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



[issue14781] Default to year 1 in strptime if year 0 has been specified

2012-05-11 Thread Terry J. Reedy

Changes by Terry J. Reedy :


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



[issue14780] SSL should use OpenSSL-defined default certificate store if ca_certs parameter is omitted

2012-05-11 Thread James Oakley

James Oakley  added the comment:

load_verify_locations() is not available in Python 2.x. It was added in 3.x. 
Also, there is no way to load a directory-based certificate store at all in 
Python 2.x, which is why the bug was opened.

--

___
Python tracker 

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



[issue14780] SSL should use OpenSSL-defined default certificate store if ca_certs parameter is omitted

2012-05-11 Thread Éric Araujo

Éric Araujo  added the comment:

Sorry, by our policy this change is a new feature and cannot go into stable 
versions.

--
nosy: +eric.araujo
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



[issue12029] Catching virtual subclasses in except clauses

2012-05-11 Thread Éric Araujo

Changes by Éric Araujo :


--
stage:  -> needs patch
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



[issue14732] PEP 3121 Refactoring applied to _csv module

2012-05-11 Thread Éric Araujo

Éric Araujo  added the comment:

Skip: I used the nosy field autocomplete which is based on the experts file in 
the devguide; I can mark you "retired" in that file so that your name does not 
show up in autocomplete (but humans will still know that you might be contacted 
when all else fails, unless you prefer your name to be fully removed).

--
nosy: +eric.araujo

___
Python tracker 

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



[issue12029] Catching virtual subclasses in except clauses

2012-05-11 Thread Antoine Pitrou

Changes by Antoine Pitrou :


--
nosy: +benjamin.peterson
type: behavior -> enhancement
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



[issue13959] Re-implement parts of imp in pure Python

2012-05-11 Thread Roundup Robot

Roundup Robot  added the comment:

New changeset b81ddaf0db47 by Brett Cannon in branch 'default':
Issue #13959: Deprecate imp.get_suffixes() for new attributes on
http://hg.python.org/cpython/rev/b81ddaf0db47

--

___
Python tracker 

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



[issue14732] PEP 3121 Refactoring applied to _csv module

2012-05-11 Thread Skip Montanaro

Skip Montanaro  added the comment:

> Skip: I used the nosy field autocomplete which is based on the experts file 
> in the devguide; I can mark you "retired" in that file so that your name does 
> not show up in autocomplete (but humans will still know that you might be 
> contacted when all else fails, unless you prefer your name to be fully 
> removed).

Thanks.  That would be great.  I don't mind the occasional question,
but don't want people thinking I am going to jump in feet first any
time I'm made nosy on a ticket.

S

--

___
Python tracker 

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



[issue12029] Catching virtual subclasses in except clauses

2012-05-11 Thread Benjamin Peterson

Benjamin Peterson  added the comment:

I think being able to catch exception with ABCs is esssentially useless. The 
originally stated "usecase" can be simply solved by putting classes into a 
tuple and putting that in the except clause.

In general, the whole abc machinary causes lots of code which expects instance 
and subclass checks to be side-effect free to be able to execute arbitrary 
code, which creates messes.

--

___
Python tracker 

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



[issue12029] Catching virtual subclasses in except clauses

2012-05-11 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

Perhaps ABCMeta could raise a UserWarning when creating an Exception subclass?

--
nosy: +pitrou

___
Python tracker 

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



[issue12029] Catching virtual subclasses in except clauses

2012-05-11 Thread andrew cooke

andrew cooke  added the comment:

perhaps it could just work in a simple, consistent way?

in my original report i wondered whether there was a significant performance 
hit.  but so far the objections against fixing this seem to be (1) a lawyer 
could be convinced the current behaviour is consistent with the docs (2) python 
3 should remain compatible with python 2 (3) abcmeta is the sucksorz.

those don't seem like great arguments against making it just work right, to me.

--

___
Python tracker 

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



[issue12029] Catching virtual subclasses in except clauses

2012-05-11 Thread andrew cooke

Changes by andrew cooke :


--
nosy:  -acooke

___
Python tracker 

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



[issue14780] SSL should use OpenSSL-defined default certificate store if ca_certs parameter is omitted

2012-05-11 Thread James Oakley

James Oakley  added the comment:

Fair enough. What about a patch to handle a directory store passed through the 
ca_certs parameter? As it stands now, it's impossible to load the 
distribution-supplied cert store on openSUSE.

--

___
Python tracker 

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



[issue12029] Catching virtual subclasses in except clauses

2012-05-11 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

> perhaps it could just work in a simple, consistent way?

That would be best obviously. But as Benjamin explained it's quite delicate to 
make it work while avoiding pitfalls where code involved in exception checking 
may itself fail with arbitrary errors - say, enter an infinite recursion. It's 
also why I think it would be a bad idea to fix it in 3.2 (the bugfix branch). 
In 3.3 we can take riskier decisions.

--

___
Python tracker 

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



[issue14780] SSL should use OpenSSL-defined default certificate store if ca_certs parameter is omitted

2012-05-11 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

> What about a patch to handle a directory store passed through the
> ca_certs parameter? As it stands now, it's impossible to load the
> distribution-supplied cert store on openSUSE.

I'm afraid it would still be a new feature, unsuitable for a bugfix release. 
Other distros simply have both a directory-based cert store and a cert bundle. 
In Mageia I see both /etc/pki/tls/rootcerts/ (a directory-based cert store) and 
/etc/pki/tls/certs/ca-bundle.crt (a single file cert bundle). (yes, I hope 
they're synchronized :))

Generally, the only reason we would add a new feature in a bugfix release is if 
it's necessary to fix a security issue (such as the hash randomization 
feature). Here it's not necessary: you could simply ship a cert bundle in 
addition to the cert store. I suppose its generation is easily automated with a 
script.

(and, yes, the ssl module has long lacked important features; its history is a 
bit bumpy)

Again, for 3.3, a patch allowing urllib.request to call 
load_default_verify_locations() could be a good idea.

--

___
Python tracker 

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



[issue12029] Catching virtual subclasses in except clauses

2012-05-11 Thread Benjamin Peterson

Benjamin Peterson  added the comment:

Basically, someone needs to produce a patch and we can go from there.

--

___
Python tracker 

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



[issue13959] Re-implement parts of imp in pure Python

2012-05-11 Thread Eric Snow

Eric Snow  added the comment:

Question on this one:


@@ -126,7 +131,7 @@ def load_compiled(name, pathname, file=N
 # XXX deprecate
 def load_package(name, path):
 if os.path.isdir(path):
-extensions = _bootstrap._SOURCE_SUFFIXES + 
[_bootstrap._BYTECODE_SUFFIX]
+extensions = machinery.SOURCE_SUFFIXES[:] + 
[machinery.BYTECODE_SUFFIXES]
 for extension in extensions:
 path = os.path.join(path, '__init__'+extension)
 if os.path.exists(path):


Should that be the following?

  extensions = machinery.SOURCE_SUFFIXES[:] + machinery.BYTECODE_SUFFIXES[:]

Also, why the "[:]"?

Finally, in a couple spots you use the first element of the list (like the old 
case of "machinery.SOURCE_SUFFIXES[0]" in source_from_cache() and the new one 
in find_module()).  Will this be a problem where the source file has one of the 
other suffixes?  I'm not sure it's a big enough deal for the moment to worry 
about, but thought I'd ask.  :)

--

___
Python tracker 

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



[issue14783] Update int() docstring from manual

2012-05-11 Thread Tshepang Lekhonkhobe

Changes by Tshepang Lekhonkhobe :


--
assignee:  -> docs@python
components: +Documentation
nosy: +docs@python, tshepang

___
Python tracker 

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



[issue13959] Re-implement parts of imp in pure Python

2012-05-11 Thread Brett Cannon

Brett Cannon  added the comment:

Yes.

And the [:] copies the list so I don't accidentally mutate in-place (did that 
once already, so now I'm just being paranoid; I doubt I need it hardly anywhere 
I don't do +=).

As for using SOURCE_SUFFIXES[0], I'm done following the ported code. I really 
don't care if .pyw isn't supported in that case. But in general people 
shouldn't assume just .py (or .py at all).

--

___
Python tracker 

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



[issue12029] Catching virtual subclasses in except clauses

2012-05-11 Thread George-Cristian Bîrzan

George-Cristian Bîrzan  added the comment:

I posted on python dev that this would slow exception checking considerably so 
that is a concern. As for possible bugs, this has been working in the 2 branch 
for a while now, so I don't think that is the biggest issue. 
As for possible use cases, writing a wrapper around backend, each with its own 
exceptions and still being able to catch a 'base' exception in your code while 
still having the ability to catch specific exceptions, without doing awkward 
stuff like looking at __cause__ (let alone that you have to reraise that in 2 
for code that has to run on both branches). Yes, you could patch the 
exceptions' bases but that is what Abc was created to avoid. 

Sorry for the mistakes and weird phrasing, posting this off my phone.

--
nosy: +gcbirzan

___
Python tracker 

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



[issue12029] Catching virtual subclasses in except clauses

2012-05-11 Thread George-Cristian Bîrzan

George-Cristian Bîrzan  added the comment:

I have a patch, with tests, but no Internet on my computer so going out, will 
post it when I get back/my Internet comes back

--

___
Python tracker 

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



[issue14780] SSL should use OpenSSL-defined default certificate store if ca_certs parameter is omitted

2012-05-11 Thread James Oakley

James Oakley  added the comment:

Something like this perhaps?

--- a/Lib/urllib/request.py Fri May 11 13:11:02 2012 -0400
+++ b/Lib/urllib/request.py Fri May 11 11:03:02 2012 -0700
@@ -135,16 +135,19 @@
 
 _opener = None
 def urlopen(url, data=None, timeout=socket._GLOBAL_DEFAULT_TIMEOUT,
-*, cafile=None, capath=None):
+*, cafile=None, capath=None, cadefault=True):
 global _opener
 if cafile or capath:
 if not _have_ssl:
 raise ValueError('SSL support not available')
 context = ssl.SSLContext(ssl.PROTOCOL_SSLv23)
 context.options |= ssl.OP_NO_SSLv2
-if cafile or capath:
+if cafile or capath or cadefault:
 context.verify_mode = ssl.CERT_REQUIRED
-context.load_verify_locations(cafile, capath)
+if cafile or capath:
+context.load_verify_locations(cafile, capath)
+else:
+context.load_default_verify_locations()
 check_hostname = True
 else:
 check_hostname = False

--

___
Python tracker 

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



[issue14777] Tkinter clipboard_get() decodes characters incorrectly

2012-05-11 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

This issue can be reproduced by pure Tcl/Tk:

$ wish
% clipboard get
abc?
% clipboard get -type STRING
abc?
% clipboard get -type UTF8_STRING
abc€

Use `root.clipboard_get(type='UTF8_STRING')` in Python.

I don't know whether it should just be documented (UTF8_STRING is not even 
mentioned in the clipboard_get docstring), or do we need to change the default 
behavior.

--

___
Python tracker 

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



[issue13959] Re-implement parts of imp in pure Python

2012-05-11 Thread Roundup Robot

Roundup Robot  added the comment:

New changeset 626d5c6fbd95 by Brett Cannon in branch 'default':
Issue #13959: Have
http://hg.python.org/cpython/rev/626d5c6fbd95

--

___
Python tracker 

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



[issue14777] Tkinter clipboard_get() decodes characters incorrectly

2012-05-11 Thread Thomas Kluyver

Thomas Kluyver  added the comment:

On this computer, I see this from Tcl:

$ wish
% clipboard get
abc\u20ac

But here Python's following suit:

>>> root.clipboard_get()
'abc\\u20ac'

Which is odd, because as far as I know, my two computers run the same OS 
(Ubuntu 12.04) in the same configuration. I briefly thought the presence of 
xsel might be affecting it, but uninstalling it doesn't seem to make any 
difference.

--

___
Python tracker 

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



[issue14777] Tkinter clipboard_get() decodes characters incorrectly

2012-05-11 Thread Ned Deily

Ned Deily  added the comment:

As is often the case with Tcl/Tk issues, there are platform differences.  On OS 
X, with the two native Tcl/Tk implementations (Aqua Cocoa and Aqua Carbon), the 
examples work appear to work as is *and* type "UTF8_STRING" does not exist.  
The less commonly used X11 Tcl/Tk on OS X does support and require 
"UTF8_STRING" for the example given.  So any doc change needs to be carefully 
worded.

--
nosy: +ned.deily

___
Python tracker 

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



[issue14624] Faster utf-16 decoder

2012-05-11 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

The patch updated to stylistic conformity of the UTF-8 decoder. The decoding of 
the UCS2 non-surrogate characters a little speed up (+15%).

--
Added file: http://bugs.python.org/file25536/decode_utf16_3.patch

___
Python tracker 

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



[issue14625] Faster utf-32 decoder

2012-05-11 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

The patches updated to stylistic conformity of the UTF-8 decoder. Patch B is 
significantly accelerated for aligned input data (i. e. almost always), 
especially for natural order. The UTF-32 decoder can now be faster than ASCII 
decoder! May be it is time to change the title to "Amazingly faster UTF-32 
decoding"? ;)

  Py3.2 Py3.3 patchA
   patchB

utf-32le  'A'*1   162 (+462%)   100 (+810%)   391 
(+133%)   910
utf-32le  'A'*+'\x80' 162 (+411%)   99 (+736%)377 
(+120%)   828
utf-32le  'A'*+'\u0100'   162 (+277%)   95 (+543%)324 
(+89%)611
utf-32le  'A'*+'\u8000'   162 (+278%)   95 (+545%)324 
(+89%)613
utf-32le  'A'*+'\U0001'   162 (+280%)   95 (+547%)322 
(+91%)615
utf-32le  '\x80'*1162 (+436%)   94 (+823%)389 
(+123%)   868
utf-32le'\x80'+'A'*   162 (+441%)   94 (+832%)388 
(+126%)   876
utf-32le  '\x80'*+'\u0100'162 (+273%)   90 (+571%)320 
(+89%)604
utf-32le  '\x80'*+'\u8000'162 (+271%)   90 (+568%)319 
(+88%)601
utf-32le  '\x80'*+'\U0001'162 (+268%)   90 (+562%)318 
(+87%)596
utf-32le  '\u0100'*1  161 (+445%)   83 (+958%)405 
(+117%)   878
utf-32le'\u0100'+'A'* 162 (+440%)   83 (+954%)403 
(+117%)   875
utf-32le'\u0100'+'\x80'*  162 (+444%)   83 (+963%)403 
(+119%)   882
utf-32le  '\u0100'*+'\u8000'  162 (+441%)   83 (+955%)404 
(+117%)   876
utf-32le  '\u0100'*+'\U0001'  162 (+259%)   79 (+637%)325 
(+79%)582
utf-32le  '\u8000'*1  162 (+441%)   83 (+955%)404 
(+117%)   876
utf-32le'\u8000'+'A'* 162 (+441%)   83 (+955%)404 
(+117%)   876
utf-32le'\u8000'+'\x80'*  161 (+448%)   83 (+964%)403 
(+119%)   883
utf-32le'\u8000'+'\u0100'*161 (+443%)   83 (+954%)402 
(+118%)   875
utf-32le  '\u8000'*+'\U0001'  162 (+262%)   79 (+643%)325 
(+81%)587
utf-32le  '\U0001'*1  149 (+483%)   83 (+947%)390 
(+123%)   869
utf-32le'\U0001'+'A'* 162 (+444%)   83 (+963%)389 
(+127%)   882
utf-32le'\U0001'+'\x80'*  162 (+430%)   83 (+935%)389 
(+121%)   859
utf-32le'\U0001'+'\u0100'*162 (+429%)   83 (+933%)389 
(+120%)   857
utf-32le'\U0001'+'\u8000'*162 (+431%)   83 (+937%)388 
(+122%)   861

utf-32be  'A'*1   162 (+199%)   100 (+384%)   393 
(+23%)484
utf-32be  'A'*+'\x80' 162 (+186%)   99 (+368%)376 
(+23%)463
utf-32be  'A'*+'\u0100'   162 (+138%)   95 (+306%)323 
(+20%)386
utf-32be  'A'*+'\u8000'   162 (+139%)   95 (+307%)323 
(+20%)387
utf-32be  'A'*+'\U0001'   162 (+138%)   95 (+305%)322 
(+20%)385
utf-32be  '\x80'*1161 (+196%)   94 (+407%)389 
(+23%)477
utf-32be'\x80'+'A'*   161 (+197%)   94 (+409%)387 
(+24%)478
utf-32be  '\x80'*+'\u0100'161 (+137%)   90 (+324%)321 
(+19%)382
utf-32be  '\x80'*+'\u8000'162 (+135%)   89 (+328%)320 
(+19%)381
utf-32be  '\x80'*+'\U0001'162 (+134%)   89 (+326%)318 
(+19%)379
utf-32be  '\u0100'*1  161 (+196%)   83 (+473%)404 
(+18%)476
utf-32be'\u0100'+'A'* 161 (+196%)   83 (+475%)402 
(+19%)477
utf-32be'\u0100'+'\x80'*  162 (+196%)   83 (+477%)403 
(+19%)479
utf-32be  '\u0100'*+'\u8000'  161 (+196%)   83 (+473%)404 
(+18%)476
utf-32be  '\u0100'*+'\U0001'  162 (+131%)   79 (+373%)325 
(+15%)374
utf-32be  '\u8000'*1  161 (+195%)   83 (+472%)404 
(+18%)475
utf-32be'\u8000'+'A'* 161 (+197%)   83 (+476%)402 
(+19%)478
utf-32be'\u8000'+'\x80'*  161 (+197%)   83 (+476%)403 
(+19%)478
utf-32be'\u8000'+'\u0100'*162 (+194%)   83 (+473%)403 
(+18%)476
utf-32be  '\u8000'*+'\U0001'  161 (+133%)   79 (+375%)325 
(+15%)375
utf-32be  '\U0001'*1  148 (+222%)   83 (+473%)391 
(+22%)476
utf-32be'\U0001'+'A'* 161 (+198%)   83 (+477%)389 
(+23%)479
utf-32be'\U0001'+'\x80'*  162 (+194%)   83 (+473%)389 
(+22%)476
utf-32be'\U0001'+'\u0100'*162 (+194%)   83 (+475%)389 
(+23%)477
utf-32be'\U0001'+'\u8000'*161 (+196%)   83 (+475%)389 
(+23%)477

--
Added file: http://bugs.python.org/file25537/decode_utf32_a_2.patch

___

[issue14625] Faster utf-32 decoder

2012-05-11 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


Added file: http://bugs.python.org/file25538/decode_utf32_b_2.patch

___
Python tracker 

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



[issue14777] Tkinter clipboard_get() decodes characters incorrectly

2012-05-11 Thread Thomas Kluyver

Thomas Kluyver  added the comment:

OK, after a quick bit of reading, I see why I'm confused: the clipboard 
actually works by requesting the text from the source program, so where you 
copy it from makes a difference. In my case, copying from firefox gives 
'abc\\u20ac', and copying from Geany gives u'abc\xe2\x82\xac'.

However, I still think there's something that can be improved in Python. As 
Serhiy points out, specifying type='UTF8_STRING' makes it work properly from 
both programs. The Tcl documentation recommends this as the best option for 
"modern X11 systems"[1].

>From what Ned says, we can't make UTF8_STRING the default everywhere, but is 
>there a way to detect if we're inside X11, and use UTF8_STRING by default 
>there?

[1] http://www.tcl.tk/man/tcl/TkCmd/clipboard.htm

--

___
Python tracker 

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



[issue14419] Faster ascii decoding

2012-05-11 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

Since the patch commited as part of new UTF-8 decoder, this issue can be closed 
(issue14738).

--

___
Python tracker 

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



[issue14784] Re-importing _warnings changes warnings.filters

2012-05-11 Thread Brett Cannon

New submission from Brett Cannon :

If you run test.test_warnings it reports that warnings.filters changed. If you 
comment out the import of c_warnings in that module, the warning goes away 
(this happens with running on tests).

It looks like _PyWarnings_Init() itself doesn't trigger a reprocessing of the 
sys.warnoptions as an import of warnings.py does, and thus the change in 
warnings.filter.

--
components: Library (Lib)
messages: 160446
nosy: brett.cannon
priority: low
severity: normal
stage: test needed
status: open
title: Re-importing _warnings changes warnings.filters
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



[issue14738] Amazingly faster UTF-8 decoding

2012-05-11 Thread Serhiy Storchaka

Serhiy Storchaka  added the comment:

Thanks Martin for review, which has allowed me to make a quality patch, and for 
promotion of further research. Thanks Antoine for review, benchmarks, commit, 
and for the original optimization, which served as the basis for my patch.

--

___
Python tracker 

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



[issue14624] Faster utf-16 decoder

2012-05-11 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
components: +Unicode
nosy: +ezio.melotti

___
Python tracker 

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



[issue14625] Faster utf-32 decoder

2012-05-11 Thread Serhiy Storchaka

Changes by Serhiy Storchaka :


--
components: +Unicode
nosy: +ezio.melotti

___
Python tracker 

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



[issue12029] Catching virtual subclasses in except clauses

2012-05-11 Thread Yury Selivanov

Changes by Yury Selivanov :


--
nosy: +Yury.Selivanov

___
Python tracker 

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



[issue14776] Add SystemTap static markers

2012-05-11 Thread Dave Malcolm

Dave Malcolm  added the comment:

Thanks Eric, Antoine and Mark.

I'm attaching two new patches: a replacement patch for cpython, and a new patch 
for the devguide

I've moved the docs to the dev guide, starting a new "Debugging and 
Instrumentation" section there.

Changes to the cpython patch:
  * fixed a bug in configure.in that was enabling systemtap support even 
without --with-systemtap (if the devel toolchain was present)
  * I added an initial check to test_systemtap to skip the tests unless Python 
was configured --with-systemtap
  * pysystemtap.h is not meant to be public, so I've moved the source 
pysystemtap.d and generated header pysystemtap.h from Include/ to Python/.  I 
also simplified pysystemtap.d (removed the #pragma lines, since I believe 
they're DTrace-specific).
  * I've introduced a Python/ceval_systemtap.h private header as suggested by 
Antoine, moving things in there to simplify the changes to Python/ceval.c

Changes to the devguide docs:
  * removed the ".. impl-detail" as this only seems to work (and be 
appropriate) in the cpython Doc build, not in devguide.
  * added "eu-readelf -n" example from Mark

The docs refer to the low-level way of doing things (using the markers 
directly), but don't yet spell out the higher-level way (creating a tapset).  
I've left this out of the patches for now to keep the patches simpler.

--
Added file: 
http://bugs.python.org/file25539/cpython-systemtap-2012-05-11-001.patch

___
Python tracker 

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



[issue14776] Add SystemTap static markers

2012-05-11 Thread Dave Malcolm

Changes by Dave Malcolm :


Added file: 
http://bugs.python.org/file25540/devguide-systemtap-2012-05-11-001.patch

___
Python tracker 

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



[issue4111] Add Systemtap/DTrace probes

2012-05-11 Thread Dave Malcolm

Dave Malcolm  added the comment:

Issue #13405 covers DTrace; I've taken the liberty of also opening issue #14776 
to cover SystemTap.  I hope that once one of these is in the tree it will be 
easier to get the other one in.

--

___
Python tracker 

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



[issue14777] Tkinter clipboard_get() decodes characters incorrectly

2012-05-11 Thread Terry J. Reedy

Terry J. Reedy  added the comment:

There are definitely platform differences. As I noted, the original example 
works fine on Windows. However

>>> root.clipboard_get(type='STRING')
'abc€'
>>> root.clipboard_get(type='UTF8_STRING')
Traceback (most recent call last):
  File "", line 1, in 
root.clipboard_get(type='UTF8_STRING')
  File "C:\Programs\Python33\lib\tkinter\__init__.py", line 549, in 
clipboard_get
return self.tk.call(('clipboard', 'get') + self._options(kw))
_tkinter.TclError: CLIPBOARD selection doesn't exist or form "UTF8_STRING" not 
defined

Of course, on Windows I suspect that the unicode string is not copied to 
clipboard as utf8 bytes, so if clipboard contents are tagged, there would not 
be such a thing. Perhaps clipboards work differently on diffferent OSes.

>>> help(root.clipboard_get)
...
The type keyword specifies the form in which the data is
to be returned and should be an atom name such as STRING
or FILE_NAME.  Type defaults to STRING.

(Actually, FILE_NAME give the same exception as UTF8_STRING.)

--

___
Python tracker 

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



[issue14777] Tkinter clipboard_get() decodes characters incorrectly

2012-05-11 Thread Ned Deily

Ned Deily  added the comment:

Most likely the best way to determine the windowing system is to use the "tk 
windowingsystem" command (http://www.tcl.tk/man/tcl8.5/TkCmd/tk.htm#M10), so 
something like this:

root = tkinter.Tk()
root.call(('tk', 'windowingsystem'))

As documented, the call returns 'x11' for X11-based systems, 'win32' for 
Windows, and 'aqua' for the native OS X implementations.

--

___
Python tracker 

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



[issue14777] Tkinter clipboard_get() decodes characters incorrectly

2012-05-11 Thread Thomas Kluyver

Thomas Kluyver  added the comment:

Thanks, Ned.

Does it seem like a good idea to test the windowing system like that, and 
default to UTF8_STRING if it's x11? So far, I've not found any case on X where 
STRING works but UTF8_STRING doesn't. If it seems reasonable, I'm happy to have 
a go at making a patch.

--

___
Python tracker 

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



[issue14757] INCA: Inline Caching meets Quickening in Python 3.3

2012-05-11 Thread stefan brunthaler

stefan brunthaler  added the comment:

This is the updated patch file that fixes the performance issues measurable 
using the official perf.py py3k test suite.

--
Added file: http://bugs.python.org/file25541/20120511-inca.patch

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



[issue14757] INCA: Inline Caching meets Quickening in Python 3.3

2012-05-11 Thread stefan brunthaler

Changes by stefan brunthaler :


Added file: http://bugs.python.org/file25542/20120511-inca-perf.txt

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



[issue14757] INCA: Inline Caching meets Quickening in Python 3.3

2012-05-11 Thread stefan brunthaler

Changes by stefan brunthaler :


Added file: http://bugs.python.org/file25543/20120510-vanilla-perf.txt

___
Python tracker 

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



[issue14187] add "annotation" entry to Glossary

2012-05-11 Thread Chris Rebert

Chris Rebert  added the comment:

Here's an actual patch.

--
keywords: +patch
Added file: http://bugs.python.org/file25544/func_annotation.patch

___
Python tracker 

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



[issue14419] Faster ascii decoding

2012-05-11 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

Okay, thank you!

--
dependencies: +Amazingly faster UTF-8 decoding
resolution:  -> duplicate
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



[issue14419] Faster ascii decoding

2012-05-11 Thread Antoine Pitrou

Changes by Antoine Pitrou :


--
dependencies:  -Amazingly faster UTF-8 decoding
superseder:  -> Amazingly faster UTF-8 decoding

___
Python tracker 

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



[issue14777] Tkinter clipboard_get() decodes characters incorrectly

2012-05-11 Thread Ned Deily

Ned Deily  added the comment:

A patch would be great.  I don't have a strong opinion about the issue one way 
or another.  I suppose it would simplify things for Python 3 users if the 
clipboard results were returned properly in the default case when no 'type' 
argument is passed to clipboard_get().  For Python 2, changing things seems a 
little more questionable but, as long as it was already returning a unicode 
object in that case, it sounds like a bug fix rather than a feature.  Martin, 
Andrew: any opinions on this?

--
nosy: +asvetlov, loewis

___
Python tracker 

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



[issue14757] INCA: Inline Caching meets Quickening in Python 3.3

2012-05-11 Thread stefan brunthaler

stefan brunthaler  added the comment:

So I took a close look to what the performance problem was. Many of the 
benchmarks used by the perf.py py3k benchmarks use function calls for which 
there are no optimized derivatives available. In this case the function trying 
to do the quickening (aptly called "quickening_call_function") did not have a 
proper target instruction. Therefore, it was "stuck" with the additional 
quickening code in "quickening_call_function." This causes some overhead, or at 
least ate away some of the benefits of quickening. The new patch takes care of 
quickening to another function, if no better target is available, the only 
optimization being to have one instruction for calling a C function or a Python 
function/method (instruction labels being INCA_C_CALL, and INCA_PYTHON_CALL 
respectively. The new interpreter dispatch loop therefore has 208 instructions.)

Furthermore, I have also added a baseline evaluation of running perf.py on my 
system, where I measure the vanilla Python 3.3 version against itself. I see 
quite some noise there, with some benchmarks showing up to 10pct outliers. On 
average, my interpretation is that around five percent variance needs to be 
accounted for.

The new patch shows an overall improvement. For the slower ones, I guess that's 
within the error margin demonstrated by the baseline evaluation run. The 
remaining speedups are acceptable, even though I could tune the code generator 
to have more optimized derivatives in place. I took a closer look at the float 
benchmark, because my experience with the computer language benchmarks game the 
INCA optimization performs quite well there.

These are the dynamic instruction frequencies for the two most frequently 
executed functions:

maximize:
-
   Freq.  |pos | instruction | arg
   100:   0: LOAD_FAST 0
   100:   3: LOAD_ATTR 0
   100:   6: LOAD_FAST 1
   100:   9: LOAD_ATTR 0
   100:  12: INCA_CMP_FLOAT4
   100:  15: POP_JUMP_IF_FALSE 27
   1996400:  18: LOAD_FAST 0
   1996400:  21: LOAD_ATTR 0
   1996400:  24: JUMP_FORWARD  6
  3500:  27: LOAD_FAST 1
  3500:  30: LOAD_ATTR 0
   100:  33: LOAD_FAST 0
   100:  36: STORE_ATTR0
   100:  39: LOAD_FAST 0
   100:  42: LOAD_ATTR 1
   100:  45: LOAD_FAST 1
   100:  48: LOAD_ATTR 1
   100:  51: INCA_CMP_FLOAT4
   100:  54: POP_JUMP_IF_FALSE 66
   100:  57: LOAD_FAST 0
   100:  60: LOAD_ATTR 1
   100:  63: JUMP_FORWARD  6
   100:  72: LOAD_FAST 0
   100:  75: STORE_ATTR1
   100:  78: LOAD_FAST 0
   100:  81: LOAD_ATTR 2
   100:  84: LOAD_FAST 1
   100:  87: LOAD_ATTR 2
   100:  90: INCA_CMP_FLOAT4
   100:  93: POP_JUMP_IF_FALSE 105
   1993800:  96: LOAD_FAST 0
   1993800:  99: LOAD_ATTR 2
   1993800: 102: JUMP_FORWARD  6
  6100: 105: LOAD_FAST 1
  6100: 108: LOAD_ATTR 2
   100: 111: LOAD_FAST 0
   100: 114: STORE_ATTR2
   100: 117: LOAD_CONST0
   100: 120: RETURN_VALUE  0

normalize:
--
   Freq.  |pos | instruction | arg
   200:   0: LOAD_GLOBAL   0
   200:   3: LOAD_FAST 0
   200:   6: LOAD_ATTR 1
   200:   9: LOAD_CONST1
   200:  12: INCA_FLOAT_POWER  1
   200:  13: LOAD_FAST 0
   200:  16: LOAD_ATTR 2
   200:  19: LOAD_CONST1
   200:  22: INCA_FLOAT_POWER  1
   200:  23: INCA_FLOAT_ADD1
   200:  24: LOAD_FAST 0
   200:  27: LOAD_ATTR 3
   200:  30: LOAD_CONST1
   200:  33: INCA_FLOAT_POWER  1
   200:  34: INCA_FLOAT_ADD   

[issue14187] add "function annotation" entry to Glossary

2012-05-11 Thread Éric Araujo

Éric Araujo  added the comment:

Thanks, LGTM.

--
title: add "annotation" entry to Glossary -> add "function annotation" entry to 
Glossary

___
Python tracker 

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



[issue14785] Add sys._debugmallocstats()

2012-05-11 Thread Dave Malcolm

New submission from Dave Malcolm :

I'm attaching a patch which generalizes the at-exit PYTHONMALLOCSTATS memory 
usage report, so that it's available in a regular build and can be triggered 
from Python, by calling:
   sys._debugmallocstats()

This can be useful when debugging memory usage issues: a script can call the 
debug hook before and after certain activities, and the before/after amounts 
can be compared.

The patch moves this arena-accouting code when a new arena is allocated:
 ++ntimes_arena_allocated;
 if (narenas_currently_allocated > narenas_highwater)
 narenas_highwater = narenas_currently_allocated;
from out of the #ifdef PYMALLOC_DEBUG guard and into all PYMALLOC 
configurations, so that this data is available within the dump.  Given how much 
activity happens when a new arena is allocated, I believe this doesn't impact 
performance.

It changes _PyObject_DebugMallocStats() to take an arbitrary FILE*, rather than 
assuming stderr (which was handy for my original use-case of debugging a web 
server).  This function is already marked with PyAPI_FUNC() but not documented 
(albeit only present in a debug build).

Tested with --with-pymalloc, --without-pymalloc, and --with-pydebug

FWIW, Red Hat has been using a version of this patch in RHEL 5 as of RHEL 5.6 
(http://rhn.redhat.com/errata/RHSA-2011-0027.html), and also in Fedora since 
September 2011 with python-2.7.2-15 and python3-3.2.2-6 (for the forthcoming 
Fedora 17).

--
files: add-debug-malloc-stats.patch
keywords: needs review, patch
messages: 160459
nosy: dmalcolm
priority: normal
severity: normal
stage: patch review
status: open
title: Add sys._debugmallocstats()
type: enhancement
versions: Python 3.3
Added file: http://bugs.python.org/file25545/add-debug-malloc-stats.patch

___
Python tracker 

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



[issue14187] add "function annotation" entry to Glossary

2012-05-11 Thread Raymond Hettinger

Raymond Hettinger  added the comment:

The third paragraph should be dropped.

--

___
Python tracker 

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



[issue12029] Catching virtual subclasses in except clauses

2012-05-11 Thread James Henstridge

James Henstridge  added the comment:

Benjamin: if you are after a use case for this feature, see  
https://code.djangoproject.com/ticket/15901

In Django, there are multiple database backends, each of which currently catch 
the adapter's DatabaseError and reraise it as Django's DatabaseError so that 
Django code can handle database errors in a standard way without having to care 
about which backend they came from.  Unfortunately, this loses some information 
from the exception.

My idea for solving that bug was to make Django's DatabaseError an ABC.  By 
registering the various adapter's DatabaseErrors with the ABC, it would not be 
necessary to catch and reraise them in the backends while still preserving the 
ability to catch the generic errors in the core.  This works fine in Python 
2.x, but it was pointed out that it would cause compatibility problems when 
porting to Python 3.2.

--
type: enhancement -> behavior

___
Python tracker 

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



[issue12029] Catching virtual subclasses in except clauses

2012-05-11 Thread James Henstridge

Changes by James Henstridge :


--
type: behavior -> enhancement

___
Python tracker 

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