[issue4561] Optimize new io library

2008-12-16 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc amaur...@gmail.com added the comment:

The previous implementation only returns bytes and does not translate
newlines. For this particular case, indeed, the plain old FILE* based
object is faster.

--
nosy: +amaury.forgeotdarc

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



[issue3439] create a numbits() method for int and long types

2008-12-16 Thread Raymond Hettinger

Raymond Hettinger rhettin...@users.sourceforge.net added the comment:

In the whatsnew docs, add two lines showing the binary representation of
37.  That will provide clarification as to why the answer is six:

   n = 37
+  bin(37)
+ '0b100101'
   n.bit_length()
  6

Also, the main entry in the docs should be built-out just a bit.  I like
that the current entry provides a precise mathematical spec that is
easily validated, but it should also mention the more intuitive notion
of the number of bits in a number's binary representation excluding
leading zeros (for example the decimal number 37, which is 0b100101 in
binary, has six binary digits).

Possibly, the BitLengthTables can be dropped in favor of the old
shift-one, add-one code (to be inserted right after the shift-eight,
add-eight code).  The two tables consume a lot of memory and the
relevant entry is not likely to be in cache when needed (cache misses
are very slow).  It is simpler and possibly faster to skip the table
lookup unless the table is made much smaller.  Plus, it makes the code a
bit more maintainable and self-evidently correct (not requiring as
extensive test coverage to validate the whole table).

My own crack at optimization looks like this:

static const char BitLengthTable[32] =
{0, 1, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4,
 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5};
while (n = 32) { r += 5;   n = 5; }
r += (long)(BitLengthTable[n]);

If you don't adopt mine, at least consider making a table of chars
instead of longs (this will give a 4:1 or 8:1 table compression,
reducing the memory footprint and increasing the likelihood of a cache hit).

I would feel better about the test code if it also directly validated
the definitions in docs and thoroughly exercised the tables:

for x in range(-65000, 65000):
k = x.numbits
if x  0:
 assert 2 ** (k-1) = x  2**k
 assert k == 1 + math.floor(math.log(x) / math.log(2))
elif x == 0:
 assert k == 0
else:
 assert k == (-x).numbits()



Other than that, I'm basically happy with the patch.

--
assignee: rhettinger - marketdickinson

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



[issue4674] test_normalization failures on some buildbot

2008-12-16 Thread Antoine Pitrou

New submission from Antoine Pitrou pit...@free.fr:

test_normalization intermittently fails on some buildbots with the
following message:

Traceback (most recent call last):
  File ./Lib/test/regrtest.py, line 596, in runtest_inner
the_package = __import__(abstest, globals(), locals(), [])
  File
/home/pybot/buildarea/3.0.klose-debian-ia64/build/Lib/test/test_normalization.py,
line 13, in module
l = f.readline()
  File /home/pybot/buildarea/3.0.klose-debian-ia64/build/Lib/io.py,
line 1810, in readline
while self._read_chunk():
  File /home/pybot/buildarea/3.0.klose-debian-ia64/build/Lib/io.py,
line 1559, in _read_chunk
self._set_decoded_chars(self._decoder.decode(input_chunk, eof))
  File /home/pybot/buildarea/3.0.klose-debian-ia64/build/Lib/io.py,
line 1292, in decode
output = self.decoder.decode(input, final=final)
  File
/home/pybot/buildarea/3.0.klose-debian-ia64/build/Lib/encodings/ascii.py,
line 26, in decode
return codecs.ascii_decode(input, self.errors)[0]
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe1 in position
1129: ordinal not in range(128)

--
components: Tests
messages: 77899
nosy: pitrou
priority: high
severity: normal
status: open
title: test_normalization failures on some buildbot
type: crash
versions: Python 3.0

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



[issue3439] create a numbits() method for int and long types

2008-12-16 Thread Antoine Pitrou

Antoine Pitrou pit...@free.fr added the comment:

Le mardi 16 décembre 2008 à 13:56 +, STINNER Victor a écrit :
 (16).numbits() is 4, not 5.

Well, I do hope (16).numbits() returns 5...

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



[issue4674] test_normalization failures on some buildbot

2008-12-16 Thread Antoine Pitrou

Antoine Pitrou pit...@free.fr added the comment:

Should be fixed (r67814, r67815).

--
resolution:  - fixed
status: open - closed

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



[issue4561] Optimize new io library

2008-12-16 Thread Antoine Pitrou

Antoine Pitrou pit...@free.fr added the comment:

 I know that as hard as it might be for 
 everyone to believe, there are a lot of people who crank lots of non-
 Unicode data with Python.

But cranking data implies you'll do something useful with it, and
therefore spend CPU time doing those useful things (likely much more CPU
time than you spent read()ing the data in the first place).

In any case, you can try to open your file in unbuffered mode:
open(foobar, rb, buffering=0)

it will bypass the Python buffering layer and will go directly to the
raw C unbuffered object.

 (e.g., okay, they work with bytes instead of 
 strings, but is the bytes type really all that different from the old 
 Python 2 str type?)

No. It's a bit more limited, doesn't support autoconversion to/from
unicode, but that's all.

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



[issue4561] Optimize new io library

2008-12-16 Thread David M. Beazley

David M. Beazley beaz...@users.sourceforge.net added the comment:

I wish I shared your optimism about this, but I don't.  Here's a short 
explanation why.

The problem of I/O and the associated interface between hardware, the 
operating system kernel, and user applications is one of the most 
fundamental and carefully studied problems in all of computer systems.  
The C library and its associated I/O functionality provide the user-
space implementation of this interface.  However, if you peel the covers 
off of the C library, you're going to find a lot of really hairy stuff 
in there.  Examples might include:

1. Low-level optimization related to the system hardware (processor 
architecture, caching, I/O bus, etc.).  

2. Hand-written finely tuned assembly code. 

3. Low-level platform-specific system calls such as ioctl().

4. System calls related to shared memory regions, kernel buffers, etc. 
(i.e., optimizations that try to eliminate buffer copies). 

5. Undocumented vendor-specific proprietary system calls (i.e., 
unknown magic).

So, you'll have to forgive me for being skeptical, but I just don't 
think any programmer is going to sit down and bang out a new 
implementation of buffered I/O that is going to match the performance of 
what's provided by the C library.

Again, I would love to be proven wrong.

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



[issue4561] Optimize new io library

2008-12-16 Thread Antoine Pitrou

Antoine Pitrou pit...@free.fr added the comment:

I seem to recall one of the design principles of the new IO stack was to
avoid relying on the C stdlib's buffered API, which has too many
platform-dependant behaviours.

In any case, binary reading has acceptable performance in py3k (although
3x-4x slower than in 2.x), it's text I/O which is truely horrendous.

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



[issue4653] Patch to fix typos for Py3K

2008-12-16 Thread Mark Dickinson

Mark Dickinson dicki...@gmail.com added the comment:

It looks to me as though all these are valid, and the patch should be 
applied to py3k and the 3.0 maintenance branch.

Minor nit: the sizeof(theInfo) line exceeds 79 characters, in violation 
of PEP 7.

Is there any core developer who's in a position to test this patch on 
Windows?

--
nosy: +marketdickinson
stage:  - commit review
versions: +Python 3.1

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



[issue4501] asyncore's urgent data management and connection closed events are broken when using poll()

2008-12-16 Thread Giampaolo Rodola'

Giampaolo Rodola' billiej...@users.sourceforge.net added the comment:

IMHO it would be good if this could go in the latest 2.4 and 2.5
upcoming releases while we still have the chance.

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



[issue4561] Optimize new io library

2008-12-16 Thread Antoine Pitrou

Antoine Pitrou pit...@free.fr added the comment:

 I don't agree that that was a worthy design goal.

I don't necessarily agree either, but it's probably too late now.
The py3k buffered IO object has additional methods (e.g. peek(),
read1()) which can be used by upper layers (text IO) and so can't be
replaced with the old 2.x file object.

In any case, Amaury has started rewriting the IO lib in C (*) and
getting good binary IO performance shouldn't be too difficult.

(*) http://svn.python.org/view/sandbox/trunk/io-c/

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



[issue4561] Optimize new io library

2008-12-16 Thread David M. Beazley

David M. Beazley beaz...@users.sourceforge.net added the comment:

Good luck with that.  Most people who get bright ideas such as gee, 
maybe I'll write my own version of X where X is some part of the 
standard C library pertaining to I/O, end up fighting a losing battle.   
Of course, I'd love to be proven wrong, but I don't think I will in this 
case. 

As for cranking data, that does not necessarily imply heavy-duty CPU 
processing.  Someone might be reading large datafiles simply to perform 
some kind of data extraction, filtering, minor translation, or other 
operation that is easily carried out in Python, but where the programs 
are still I/O bound.   For example, the kinds of processing one might 
otherwise do using awk, sed, perl, etc.

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



[issue3439] create a numbits() method for int and long types

2008-12-16 Thread Fredrik Johansson

Fredrik Johansson fredrik.johans...@gmail.com added the comment:

When did the name change back to numbits? Anyway, I think this reference
implementation is better:

def numbits(x):
x = abs(x)
n = 0
while x:
n += 1
x //= 2
return n

(//= 2 could be changed to = 1)

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



[issue4561] Optimize new io library

2008-12-16 Thread David M. Beazley

David M. Beazley beaz...@users.sourceforge.net added the comment:

I agree with Raymond.   For binary reads, I'll go farther and say that 
even a 10% slowdown in performance would be surprising if not 
unacceptable to some people.  I know that as hard as it might be for 
everyone to believe, there are a lot of people who crank lots of non-
Unicode data with Python.   In fact, Python 2.X is pretty good at it. 

It's fine that text mode now uses Unicode, but if I don't want that, I 
would certainly expect the binary file modes to run at virtually the 
same speed as Python 2 (e.g., okay, they work with bytes instead of 
strings, but is the bytes type really all that different from the old 
Python 2 str type?).

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



[issue3439] create a numbits() method for int and long types

2008-12-16 Thread STINNER Victor

STINNER Victor victor.stin...@haypocalc.com added the comment:

Please don't promote this ugly code len(bin(x).lstrip('-0b')). It's 
not the best way to compute the number of bits... I prefer fredrikj's 
proposition (with // 2, few people understand  1).

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



[issue1673409] datetime module missing some important methods

2008-12-16 Thread Marc-Andre Lemburg

Changes by Marc-Andre Lemburg m...@egenix.com:


--
nosy:  -lemburg

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



[issue3439] create a numbits() method for int and long types

2008-12-16 Thread Raymond Hettinger

Raymond Hettinger rhettin...@users.sourceforge.net added the comment:

Oops, forgot one part of the doc definition in the proposed additional
tests:

for x in range(-65000, 65000):
k = x.numbits()
assert k == len(bin(x).lstrip('-0b'))
if x  0:
assert 2 ** (k-1) = x  2**k
assert k == 1 + math.floor(math.log(x) / math.log(2))
elif x == 0:
assert k == 0
else:
assert k == (-x).numbits()

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



[issue3439] create a numbits() method for int and long types

2008-12-16 Thread Raymond Hettinger

Raymond Hettinger rhettin...@users.sourceforge.net added the comment:

One other thought on the docs.  I would like to continue the style of
supplying pure python equivalents to help precisely explain what a
function does (see the itertools docs for an example, also a few
builtins are explained that way and namedtuples too):

+  Equivalent to::
+
+  def numbits(x):
+  'Number of binary bits necessary to represent the integer n'
+  return len(bin(x).lstrip('-0b'))

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



[issue3439] create a numbits() method for int and long types

2008-12-16 Thread STINNER Victor

STINNER Victor victor.stin...@haypocalc.com added the comment:

Ooops, you're right! (15).numbits() - 4 and (16).numbits() - 5. I'm 
tired.

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



[issue3439] create a numbits() method for int and long types

2008-12-16 Thread Skip Montanaro

Skip Montanaro s...@pobox.com added the comment:

Regarding the last few posts:

 * Raymond's implementation, while ugly, provides a completely orthogonal
   way to test compute numbits, useful in unit tests if nothing else.

 * Using x  1 in a reference implementation is perfectly reasonable.
   If the person using the reference implementation to produce a real
   C-based implementation doesn't understand the equivalence of x // 2
   and x  1, heaven help us.

Skip

--
nosy: +skip.montanaro

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



[issue4561] Optimize new io library

2008-12-16 Thread Antoine Pitrou

Antoine Pitrou pit...@free.fr added the comment:

[...]

Although I agree all this is important, I'd challenge the assumption it
has its place in the buffered IO library rather than in lower-level
layers (i.e. kernel  userspace unbuffered IO).

In any case, it will be difficult to undo the current design decisions
(however misguided they may or may not be) of the py3k IO library and
we'll have to make the best out of them!

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



[issue4561] Optimize new io library

2008-12-16 Thread Christian Heimes

Christian Heimes li...@cheimes.de added the comment:

David:
Amaury's work is going to be a part of the standard library as soon as
his work is done. I'm confident that we can reach the old speed of the
2.x file type by carefully moving code to C modules.

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



[issue3439] create a numbits() method for int and long types

2008-12-16 Thread STINNER Victor

STINNER Victor victor.stin...@haypocalc.com added the comment:

x.numbits() is:
  math.ceil(math.log(abs(x)) / math.log(2)) if x != 0
  0 otherwise

and not 1 + math.floor(math.log(x) / math.log(2))

(16).numbits() is 4, not 5.

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



[issue4675] urllib's splitpasswd does not accept newline chars in passwords

2008-12-16 Thread Mihai Ibanescu

New submission from Mihai Ibanescu mihai.ibane...@gmail.com:

According to http://www.ietf.org/rfc/rfc2617.txt section 2, in basic
HTTP authentication the password can be any character (including newline).

urllib does the following:

_passwdprog = re.compile('^([^:]*):(.*)$')

That should be changed to:

_passwdprog = re.compile('^([^:]*):(.*)$', re.S)

otherwise newlines will not be caught by the second part of the regex,
and bad things are produced.

For a password with regular chars in it:

 python -c import urllib; print urllib.splitpasswd('user:ab')
('user', 'ab')

For a password with a newline:
 python -c import urllib; print urllib.splitpasswd('user:a\nb')
('user:a\nb', None)

The expected result should have been ('user', 'a\nb')

--
components: Library (Lib)
messages: 77919
nosy: mibanescu
severity: normal
status: open
title: urllib's splitpasswd does not accept newline chars in passwords
type: behavior
versions: Python 2.6, Python 3.0

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



[issue3439] create a numbits() method for int and long types

2008-12-16 Thread Mark Dickinson

Mark Dickinson dicki...@gmail.com added the comment:

Thanks for all the comments.  Here's an updated patch, with quite a few 
changes:

code:
 - drop lookup tables in favour of while(x) {x = 1; count += 1;}
 - add example to docstring, and use PyDoc_STRVAR macro for docstrings

docs:
 - add bin(37) to whatsnew example
 - move main documentation out of the bit operations table into its own
   subsection, so that it can be indexed properly.
 - expand main documentation with examples, informal definition,
   equivalent Python code
 - I dropped the 1 + math.floor(...) definition from the docs, judging
   that 1 informal, 1 formal and 1 Python definition should be enough.

tests:
 - as proposed by Raymond, directly check equivalence with formal
   definition, equivalent Python code, and two other possible definitions.

(FWIW I prefer 'x1' over 'x//2' in the Python code, because it's more 
immediately related to the intended sense:  the operation should be 
thought of as a bit shift rather than a division.)

Added file: http://bugs.python.org/file12362/bit_length8.patch

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



[issue3439] create a numbits() method for int and long types

2008-12-16 Thread Mark Dickinson

Changes by Mark Dickinson dicki...@gmail.com:


--
components: +Interpreter Core -Library (Lib)

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



[issue4676] python3 closes + home keys

2008-12-16 Thread Somelauw

New submission from Somelauw somel...@yahoo.com:

I'm using python 3.0 final which was released on December the 3th.
I also have python 2.5 installed.

2 bugs in python3 IDLE which might be related (but don't have to)

1.
The Python3 IDLE sometimes suddenly closes.
It always happens when I'm using it for a while, then press the shift +
home or end key and then it just disappears and my unsaved work is lost.
It really completely exits without an error and I also don't see it on
the background.

I'm unable to reproduce the error. But it usually happens when I have
hold down shift and press the home key.

2.
When I have some code then scroll down the code, then hold down shift
and press up a few times, then press home the selected code completely
switches.
Instead some code above the cursor suddenly gets selected.

The reason I think both are related is because both involve shift + home
key.

Both of the bugs have never happened in the IDLE 1.2.1 which was part of
python 2.5.2
I think

--
components: IDLE
messages: 77921
nosy: Somelauw
severity: normal
status: open
title: python3 closes + home keys
versions: Python 3.0

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



[issue3439] create a numbits() method for int and long types

2008-12-16 Thread Raymond Hettinger

Raymond Hettinger rhettin...@users.sourceforge.net added the comment:

Of course, the name should have been bit_length() instead of numbits().

For the code equivalent, I'm aiming for something less process oriented
and more focused on what it does.  bit_length IS the number of bits in a
binary representation without the sign or leading zeroes -- that
definition IS a correct mental picture and does not require special
cases for zero or for negatives.  

The purpose of the code equivalent is not efficiency or beauty; it to
help communicate was a function does.  If you want it to be more
beautiful, it can be broken into multiple lines.

I don't think you gain ANY explanatory power with code that says:
bit_length is the number of right-shifts (or floor divisions by two) of
the absolute value of a number until that number becomes zero.  Tell
that description to a high school student and prepare for a blank stare.

FWIW, I think having a mental picture that was too process oriented was
behind last night's mistake of thinking the (16).bit_length() was 5
instead of 4.  I theorize that error wouldn't have occurred if the
mental picture was of len('1') instead of power-of-two mental model
where people (including some of the commenter here) tend to get the edge
cases wrong.

It would be better to have no code equivalent at all than to present the
repeated //2 method as a definition.  That is a process, but not a
useful mental picture to help explain what bit_length is all about. 
Think about it, bit_length() is about the length in bits of a binary
representation -- any code provided needs to translate directly to that
definition.

def bit_length(x):
'''Length of a binary representation without the sign or leading zeroes:

 (-37).numbits()
6
'''

s = bin(x)  # binary representation:  bin(-37) -- '-0b100101'
s = s.lstrip('-0b') # remove leading zeros and sign
return len(s)

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



[issue3439] create a numbits() method for int and long types

2008-12-16 Thread Mark Dickinson

Mark Dickinson dicki...@gmail.com added the comment:

Okay;  I don't have strong feelings about the form the Python code takes;  
I'll let you guys argue it out and then fix things accordingly

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



[issue3439] create a numbits() method for int and long types

2008-12-16 Thread Raymond Hettinger

Raymond Hettinger rhettin...@users.sourceforge.net added the comment:

IMO, the choices are something like my version or none at all.  The
repeated floor division by two of abs(x) has ZERO explanatory power and
may even detract from a beginner's ability to understand what the method
does.  Show that code to most finance people and they will avoid the
method entirely.

Anyone who disagrees needs to show both code fragments to some junior
programmers and see which best leads to understanding the method and
being able to correctly predict the edge cases bordering powers of two,
the zero case, and how negatives are handled.  

No fair trying this experiment on assembly language programmers ;-)

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



[issue3439] create a numbits() method for int and long types

2008-12-16 Thread Antoine Pitrou

Antoine Pitrou pit...@free.fr added the comment:

 Show that code to most finance people and they will avoid the
 method entirely.

Why would finance people be interested in bit_length()?

I think this discussion begins to feel like bikeshedding. Documentation
can always be improved afterwards.

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



[issue3439] create a numbits() method for int and long types

2008-12-16 Thread Raymond Hettinger

Raymond Hettinger rhettin...@users.sourceforge.net added the comment:

Antoine, it's not bike-shedding at all.  Communicative docs are
important to users other than assembly language programmers.  BTW, I am
a finance person (a CPA).

Yes, you're correct, I can fix-up the docs after the patch is posted.

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



[issue4580] slicing of memoryviews when itemsize != 1 is wrong

2008-12-16 Thread Antoine Pitrou

Antoine Pitrou pit...@free.fr added the comment:

Any news?

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



[issue3439] create a numbits() method for int and long types

2008-12-16 Thread Mark Dickinson

Mark Dickinson dicki...@gmail.com added the comment:

Updated patch.

Added file: http://bugs.python.org/file12363/bit_length9.patch

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



[issue3439] create a numbits() method for int and long types

2008-12-16 Thread Mark Dickinson

Changes by Mark Dickinson dicki...@gmail.com:


Removed file: http://bugs.python.org/file12348/bit_length7.patch

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



[issue3439] create a numbits() method for int and long types

2008-12-16 Thread Mark Dickinson

Changes by Mark Dickinson dicki...@gmail.com:


Removed file: http://bugs.python.org/file12349/bit_length7_opt2.patch

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



[issue3439] create a numbits() method for int and long types

2008-12-16 Thread Mark Dickinson

Changes by Mark Dickinson dicki...@gmail.com:


Removed file: http://bugs.python.org/file12362/bit_length8.patch

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



[issue3439] create a numbits() method for int and long types

2008-12-16 Thread Mark Dickinson

Mark Dickinson dicki...@gmail.com added the comment:

Bah.  Fix test_int so that it actually works.

Added file: http://bugs.python.org/file12364/bit_length10.patch

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



[issue3439] create a numbits() method for int and long types

2008-12-16 Thread Mark Dickinson

Changes by Mark Dickinson dicki...@gmail.com:


Removed file: http://bugs.python.org/file12363/bit_length9.patch

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



[issue3439] create a numbits() method for int and long types

2008-12-16 Thread Martin v. Löwis

Changes by Martin v. Löwis mar...@v.loewis.de:


--
nosy:  -loewis

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



[issue3439] create a numbits() method for int and long types

2008-12-16 Thread Mark Dickinson

Mark Dickinson dicki...@gmail.com added the comment:

...and use proper unittest methods instead of asserts...

Added file: http://bugs.python.org/file12365/bit_length11.patch

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



[issue4486] Exception traceback is incorrect for strange exception handling

2008-12-16 Thread Antoine Pitrou

Antoine Pitrou pit...@free.fr added the comment:

Here is a patch. Should it go in?

--
keywords: +needs review, patch
stage:  - patch review
type:  - behavior
Added file: http://bugs.python.org/file12366/issue4486.patch

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



[issue3439] create a numbits() method for int and long types

2008-12-16 Thread Raymond Hettinger

Raymond Hettinger rhettin...@users.sourceforge.net added the comment:

Looks good.  Marking as accepted.

Before applying, consider adding back the part of the docs with the '1 +
floor(...' definition.  I think it provides a useful alternative way to
look at what the method does.  Also, it gives a useful mathematical
expression that can be used in reasoning about invariants.  More
importantly, we should provide it because it is so easy to make a
mistake when rolling your own version of the formula (i.e. using ceil
instead of floor or having an off by one error).

--
resolution:  - accepted

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



[issue4426] UTF7 decoding is far too strict

2008-12-16 Thread Antoine Pitrou

Antoine Pitrou pit...@free.fr added the comment:

I'm not in a position to comment on the encoding algorithm itself but I
have a couple of comments:

* I get the following compilation warning:
Objects/unicodeobject.c: In function ‘PyUnicode_DecodeUTF7Stateful’:
Objects/unicodeobject.c:1531: attention : ‘shiftOutStart’ may be used
uninitialized in this function

* shouldn't there be an additional test for the '/' behaviour (unless it
is already there and I have overlooked it)?

* your patch fails on another test:
Traceback (most recent call last):
  File Lib/test/test_unicode.py, line 538, in test_codecs_utf7
self.assertRaises(UnicodeDecodeError, '+\xc1'.decode, 'utf-7')
AssertionError: UnicodeDecodeError not raised

--
keywords: +needs review, patch
priority:  - critical
stage:  - patch review

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



[issue4583] segfault when mutating memoryview to array.array when array is resized

2008-12-16 Thread Antoine Pitrou

Antoine Pitrou pit...@free.fr added the comment:

Nothing new in this patch except that it fixes the bogus indentation of
the previous patch.

Added file: http://bugs.python.org/file12367/arraybuf2.patch

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



[issue4583] segfault when mutating memoryview to array.array when array is resized

2008-12-16 Thread Antoine Pitrou

Changes by Antoine Pitrou pit...@free.fr:


--
nosy: +teoliphant

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



[issue3439] create a numbits() method for int and long types

2008-12-16 Thread Mark Dickinson

Mark Dickinson dicki...@gmail.com added the comment:

 Before applying, consider adding back the part of the docs with the '1 +
 floor(...' definition.

My only (minor) objection to this definition is that a straight Python
translation of it doesn't work, thanks to roundoff error and
the limited precision of floating-point:

 from math import floor, log
 n = 2**101
 n.bit_length()
102
 1 + floor(log(n)/log(2))
101.0
 n = 2**80-1
 n.bit_length()
80
 1 + floor(log(n)/log(2))
81.0

But as you say, it provides another perspective;  I'm fine with
putting it back in.

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



[issue477863] New gc work

2008-12-16 Thread Antoine Pitrou

Antoine Pitrou pit...@free.fr added the comment:

Although this dates back to 2001, I think this might still be useful.

--
components: +Interpreter Core -None
nosy: +pitrou
versions: +Python 2.7, Python 3.1

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



[issue3439] create a numbits() method for int and long types

2008-12-16 Thread Raymond Hettinger

Raymond Hettinger rhettin...@users.sourceforge.net added the comment:

Also, consider writing it in the two argument form:

   1 + floor(log(n, 2))

and using the word approximately or somesuch.

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



[issue4677] a list comprehensions tests for pybench

2008-12-16 Thread Antoine Pitrou

New submission from Antoine Pitrou pit...@free.fr:

This patch adds some measurements of list comprehensions performance to
the standard pybench suite. Marc-André, is it ok for you?

--
components: Demos and Tools
files: pybench-listcomps.patch
keywords: patch
messages: 77938
nosy: lemburg, pitrou
priority: normal
severity: normal
stage: patch review
status: open
title: a list comprehensions tests for pybench
type: performance
versions: Python 2.7, Python 3.1
Added file: http://bugs.python.org/file12368/pybench-listcomps.patch

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



[issue2183] optimize list comprehensions

2008-12-16 Thread Antoine Pitrou

Antoine Pitrou pit...@free.fr added the comment:

Here is a new patch against trunk and fixing the documentation for
LIST_APPEND.

--
nosy: +pitrou
stage:  - patch review
versions: +Python 2.7, Python 3.1 -Python 2.6
Added file: http://bugs.python.org/file12369/list-comp-opt3.patch

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



[issue4678] Unicode: multiple chars for high code points

2008-12-16 Thread Eric Eisner

New submission from Eric Eisner e...@mit.edu:

I discovered this when trying to splice a string containing unicode
codepoints higher than U+


all examples on 32-bit Ubuntu Linux

python 2.5.2 (for comparison):
sys.maxunicode # 1114111
len(unichr(66674)) # 1
len(u'\U00010472') # 1
len(u'Ѳ')  # 2
unichr(66674)[0]   # u'\U00010472'


python 3.0: (same behavior on ubuntu's rc1 package and my build(r67781)
from svn)
sys.maxunicode# 65535
len(chr(66674))   # 2
len('\U00010472') # 2
len('Ѳ')  # 2
chr(66674)[0] # '\ud801'

I expect the nth element of a string to be the nth codepoint, regardless
of unicode settings. I don't know why the maxunicode is configured
differently (both compiled by ubuntu), but is this the expected behavior?

If this is actually the expected behavior, how can I configure a build
of python to use the larger maxunicode value?

--
components: Unicode
messages: 77940
nosy: ede
severity: normal
status: open
title: Unicode: multiple chars for high code points
versions: Python 3.0

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



[issue4678] Unicode: multiple chars for high code points

2008-12-16 Thread Marc-Andre Lemburg

Marc-Andre Lemburg m...@egenix.com added the comment:

On 2008-12-17 00:25, Eric Eisner wrote:
 New submission from Eric Eisner e...@mit.edu:
 
 I discovered this when trying to splice a string containing unicode
 codepoints higher than U+
 
 
 all examples on 32-bit Ubuntu Linux
 
 python 2.5.2 (for comparison):
 sys.maxunicode # 1114111
 len(unichr(66674)) # 1
 len(u'\U00010472') # 1
 len(u'Ѳ')  # 2
 unichr(66674)[0]   # u'\U00010472'
 
 
 python 3.0: (same behavior on ubuntu's rc1 package and my build(r67781)
 from svn)
 sys.maxunicode# 65535
 len(chr(66674))   # 2
 len('\U00010472') # 2
 len('Ѳ')  # 2
 chr(66674)[0] # '\ud801'
 
 I expect the nth element of a string to be the nth codepoint, regardless
 of unicode settings. I don't know why the maxunicode is configured
 differently (both compiled by ubuntu), but is this the expected behavior?
 
 If this is actually the expected behavior, how can I configure a build
 of python to use the larger maxunicode value?

You are seeing the different behavior because you've probably
built Python 3.0 from source and used the Ubuntu default Python
install for comparison:

The default Python 3.0 build will create a UCS2 unless you specify
the --enable-unicode=ucs4 configure option.

The Ubuntu Python build (like many other Linux distros) uses this
option per default.

--
nosy: +lemburg

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



[issue4679] Fork + shelve causes shelve corruption and backtrace

2008-12-16 Thread Alex Roper

New submission from Alex Roper al...@ugcs.caltech.edu:

Hi,

I wrote a simple script (attached) to do some preprocessing of MediaWiki
XML dumps. When it has a 8 MB chunk ready to dump to disk, it forks, and
the child writes it out and (will) compress it, then exit. The main
thread continues as before. Note that the child thread never touches (or
executes code that has in scope) the shelve handle.

The attached script, as written, will work fine on dumps (I tested it on
enwikisource-20081112-pages-articles.xml available from
http://download.wikimedia.org/enwikisource/20081112/). If you uncomment
the fork on line 40 (and the exit() on line 46 of course) and run it, it
will die after writing out about 450 megabytes with the backtrace below.

This appears to happen deterministically at the same place 3 of the 3
times I ran it. Apologies for the size and complexity of the test, I
don't have time to reduce it further at the moment, and it looks like it
may be fairly involved. I can try to work out a reduced case later and
resubmit if no one wants to touch this as is;)

# I ran the script with:
bzcat enwikisource-20081112-pages-articles.xml.bz2 | ./convert.py
wikisource 8388608
# (after making a dir called wikisource)

Let me know if I can be of any assistance, and apologies if this is
somewhere documented and I missed it.

Using Python 2.6.1 as released from python.org.

Alex

al...@autumn:~/projects/wikipedia$ cat
enwikisource-20081112-pages-articles.xml | ./convert.py wikisource 8388608
Alexandria version 1, Copyright (C) 2008 Alex Roper
Alexandria comes with ABSOLUTELY NO WARRANTY.
This is free software, and you are welcome to copy modify, and
redistribute it
under certain conditions; see the file COPYING for details.
..Traceback
(most recent call last):
  File ./convert.py, line 100, in module
sax.parse(sys.stdin, Parser(sys.argv[1], MIN_CHUNK_SIZE))
  File /usr/lib/python2.6/xml/sax/__init__.py, line 33, in parse
parser.parse(source)
  File /usr/lib/python2.6/xml/sax/expatreader.py, line 107, in parse
xmlreader.IncrementalParser.parse(self, source)
  File /usr/lib/python2.6/xml/sax/xmlreader.py, line 123, in parse
self.feed(buffer)
  File /usr/lib/python2.6/xml/sax/expatreader.py, line 207, in feed
self._parser.Parse(data, isFinal)
  File /usr/lib/python2.6/xml/sax/expatreader.py, line 304, in end_element
self._cont_handler.endElement(name)
  File ./convert.py, line 61, in endElement
s.pagehandler(s.title, s.text)
  File ./convert.py, line 68, in pagehandler
s.index[title.encode(UTF8)] = (s.chunks, len(s.pages))
  File /usr/lib/python2.6/shelve.py, line 133, in __setitem__
self.dict[key] = f.getvalue()
  File /usr/lib/python2.6/bsddb/__init__.py, line 276, in __setitem__
_DeadlockWrap(wrapF)  # self.db[key] = value
  File /usr/lib/python2.6/bsddb/dbutils.py, line 68, in DeadlockWrap
return function(*_args, **_kwargs)
  File /usr/lib/python2.6/bsddb/__init__.py, line 275, in wrapF
self.db[key] = value
bsddb.db.DBRunRecoveryError: (-30975, 'DB_RUNRECOVERY: Fatal error, run
database recovery -- PANIC: Invalid argument')
Exception bsddb.db.DBRunRecoveryError: DBRunRecoveryError(-30975,
'DB_RUNRECOVERY: Fatal error, run database recovery -- PANIC: fatal
region error detected; run recovery') in bound method Parser.__del__ of
__main__.Parser instance at 0x7f3492966d40 ignored
Exception bsddb.db.DBRunRecoveryError: DBRunRecoveryError(-30975,
'DB_RUNRECOVERY: Fatal error, run database recovery -- PANIC: fatal
region error detected; run recovery') in  ignored
Exception bsddb.db.DBRunRecoveryError: DBRunRecoveryError(-30975,
'DB_RUNRECOVERY: Fatal error, run database recovery -- PANIC: fatal
region error detected; run recovery') in  ignored

--
components: Extension Modules
files: convert.py
messages: 77942
nosy: calmofthestorm
severity: normal
status: open
title: Fork + shelve causes shelve corruption and backtrace
type: behavior
versions: Python 2.6
Added file: http://bugs.python.org/file12370/convert.py

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



[issue2183] optimize list comprehensions

2008-12-16 Thread Raymond Hettinger

Raymond Hettinger rhettin...@users.sourceforge.net added the comment:

This looks like a major improvement, not just for speed, but for getting
rid of the _[1] arguments setup, retrieval, and deletion.

I presume it has been tested with nested and conditional variants? 

 def f(): return [x for t in s for x in t if x]

--
nosy: +rhettinger

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



[issue4678] Unicode: multiple chars for high code points

2008-12-16 Thread Martin v. Löwis

Martin v. Löwis mar...@v.loewis.de added the comment:

As Mark-Andre say, this is not a bug. Finding out the exact name of the
configure option is left as an exercise.

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

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



[issue4678] Unicode: multiple chars for high code points

2008-12-16 Thread Marc-Andre Lemburg

Marc-Andre Lemburg m...@egenix.com added the comment:

On 2008-12-17 00:53, Martin v. Löwis wrote:
 Martin v. Löwis mar...@v.loewis.de added the comment:
 
 As Marc-Andre say, this is not a bug. Finding out the exact name of the
 configure option is left as an exercise.

Ah, so that changed as well... for Python 3.0 it's called
--with-wide-unicode.

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



[issue2183] optimize list comprehensions

2008-12-16 Thread Antoine Pitrou

Antoine Pitrou pit...@free.fr added the comment:

 I presume it has been tested with nested and conditional variants? 

The whole test suite runs fine. test_iter and test_grammar seem to cover
all possible cases.

As for performance, the new benches in #4677 show a moderate improvement
(~ 10%).

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



[issue2183] optimize list comprehensions

2008-12-16 Thread Raymond Hettinger

Raymond Hettinger rhettin...@users.sourceforge.net added the comment:

This is a nice cleanup.
Marking as accepted.
Go ahead and apply.

--
assignee: nnorwitz - pitrou
resolution:  - accepted

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



[issue4675] urllib's splitpasswd does not accept newline chars in passwords

2008-12-16 Thread Mihai Ibanescu

Changes by Mihai Ibanescu mihai.ibane...@gmail.com:


--
keywords: +patch
Added file: http://bugs.python.org/file12371/splitpasswd.patch

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



[issue4653] Patch to fix typos for Py3K

2008-12-16 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc amaur...@gmail.com added the comment:

It's difficult to really test such errors.

Moreover, on the top of the bdist_wininst files, a comment says loudly:  
IF CHANGES TO THIS FILE ARE CHECKED INTO PYTHON CVS, THE RECOMPILED 
BINARIES MUST BE CHECKED IN AS WELL!

--
nosy: +amaury.forgeotdarc, loewis

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



[issue2183] optimize list comprehensions

2008-12-16 Thread Jeffrey Yasskin

Changes by Jeffrey Yasskin jyass...@gmail.com:


--
nosy: +jyasskin

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



[issue2183] optimize list comprehensions

2008-12-16 Thread Antoine Pitrou

Antoine Pitrou pit...@free.fr added the comment:

I've fixed the Python compiler package and committed it all in r67818.
Will port to py3k.

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



[issue2183] optimize list comprehensions

2008-12-16 Thread Antoine Pitrou

Antoine Pitrou pit...@free.fr added the comment:

I have started porting to py3k and I've applied the same optimizations
to set and dict comprehensions. I just have a question: I have created
an opcode MAP_ADD which is very similar to STORE_MAP, except that it
takes as argument the stack offset to the dict object. Should I merge
the two opcodes together? (STORE_MAP would be replaced with MAP_ADD(0),
as it takes its dict from the top of the stack).

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



[issue2183] optimize list comprehensions

2008-12-16 Thread Antoine Pitrou

Antoine Pitrou pit...@free.fr added the comment:

FWIW, here's the py3k patch.

--
versions:  -Python 2.7
Added file: http://bugs.python.org/file12372/py3k-comps.patch

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



[issue2183] optimize list comprehensions

2008-12-16 Thread Raymond Hettinger

Raymond Hettinger rhettin...@users.sourceforge.net added the comment:

Will take a look in the morning and get back to you on the MAP_ADD question.

--
assignee: pitrou - rhettinger

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue2183
___
___
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

2008-12-16 Thread Guilherme Polo

Guilherme Polo ggp...@gmail.com added the comment:

Something like the proposed patch is still needed. But allow me to point
out my views towards your current patch:

* Changes in Misc.after, Misc._bind: good

* Changes in Misc.unbind can be simplified a bit:

cbs = self._bind_names(self._bind(('bind', self._w), sequence,
func=None, add=None))

could be only:

cbs = self._bind_names(self.bind(sequence))

and the comment in the end should go.

* Changes in Misc.unbind_all and Misc.unbind_class can be simplified in
the same as as Misc.unbind (just change self.bind by self.bind_all and
self.bind_class)

* Changes in Variable: would you care to elaborate more on these ? Do
you need a new _tclCommands there and also use the _tclCommands from its
master ?

* Changes in Misc._options are somewhat fine. 
 - The comment about Python 2.3, 2.4, 2.5 being bugged because a Tcl_Obj
is returned is misleading, so you should change it.
 - What are you gaining by sorting the cnf keys ?

* Changes in Misc._configure uhm.. it is hard to like that one =) Since
we are after commands created, why can't we just check the _tclCommands
before and after calling tcl here ? So we just remove the difference
(maybe move it to a set?) and don't do all those checks in case of
error, and then reraise the error.

* Changes in Wm.wm_protocol: I almost like it, except that there are two
checks for a callable arg now.


Hopefully you are still around.

--
nosy: +gpolo
versions: +Python 2.6, Python 2.7, Python 3.0, Python 3.1

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



[issue1731706] tkinter memory leak problem

2008-12-16 Thread Guilherme Polo

Guilherme Polo ggp...@gmail.com added the comment:

Sample attached for demonstrating the leak by missing a call to
Tkapp_CallDeallocArgs.

--
nosy: +gpolo
Added file: http://bugs.python.org/file12373/test_tkleak1.py

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



[issue4680] Queue class should include high-water mark

2008-12-16 Thread Roy Smith

New submission from Roy Smith r...@panix.com:

It would be nice if Queue.Queue included a way to access the high-water 
mark, i.e. the largest value which qsize() has ever reached.  This is 
often useful when assessing application performance.

I am assuming this is cheap, i.e. O(1), to provide.

--
components: Library (Lib)
messages: 77955
nosy: roysmith
severity: normal
status: open
title: Queue class should include high-water mark
type: feature request
versions: Python 2.5.3

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



[issue4074] Building a list of tuples has non-linear performance

2008-12-16 Thread Collin Winter

Changes by Collin Winter coll...@gmail.com:


--
nosy: +collinwinter

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



[issue4680] Queue class should include high-water mark

2008-12-16 Thread David W. Lambert

Changes by David W. Lambert lamber...@corning.com:


--
nosy: +LambertDW

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



[issue4653] Patch to fix typos for Py3K

2008-12-16 Thread Johnny Lee

Changes by Johnny Lee typo...@gmail.com:


Removed file: http://bugs.python.org/file12335/py30diff.txt

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



[issue4653] Patch to fix typos for Py3K

2008-12-16 Thread Johnny Lee

Johnny Lee typo...@gmail.com added the comment:

attached modified diff patch so line length =79 chars

Added file: http://bugs.python.org/file12374/py30dif2.txt

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



[issue4680] Queue class should include high-water mark

2008-12-16 Thread Martin v. Löwis

Changes by Martin v. Löwis mar...@v.loewis.de:


--
versions: +Python 2.7 -Python 2.5.3

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