[issue5565] Strange behavior when I logout() with IMAP4_SSL

2009-03-26 Thread Philipp Tölke

New submission from Philipp Tölke :

While researching some strange logs from out firewall and narrowing it
down to a biff-like imap-client written in python we found the following:

To reproduce:

Start a network-sniffer like wireshark on the loopback-interface
In one shell start some network-listener:
$ nc -l -p 12345

In python, connect to it and send some data:
>>> s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
>>> s.connect(("127.0.0.1", 12345))
>>> s.send("Hallo\n");
6

The other shell now looks like:
$ nc -l -p 12345
Hallo

Type in anything and press  to send. Then quit the nc with C-c.

Then:
>>> s.close()

What I see here is the following:
The two messages are exchanged and nc sends his FIN-Package when
quitting. Python ACKnowledges this package (though intrestingly enough,
with a ack-number one to far (8 instead of 7 in my example)). At the
Moment of the s.close(), it sends another package, containing the same
ACK-Number, the same SEQ-Number(!) and this time the RST-Flag as well.

If I understand correctly, it sends RST, because not everything from the
connection was read by python. Why does it resend the ACK? Why is the
ACK-Number one to high? Why does it reuse the SEQ-Number?

And now to imaplib.IMAP4_SSL. The behavior here seems to me even more
strange:

If I invoke .logout(), the server sends his "BYE" message and after that
a FIN, which python ACKnowledges. At the moment, that the
IMAP4_SSL-object gets out of scope, a RST/ACK-Package is send, that
again re-ACKs the FIN and has the same sequence-number, that the ACK
package had!

Why does .logout() not send a FIN? Why does it not read the complete
Buffer, so that the Socket could close with FIN? And, why does it wait
until getting out of scope with sending this RST? (I assume, that is
when the Object is garbage-collected)

Thank you!

--
components: Library (Lib)
messages: 84175
nosy: toelke
severity: normal
status: open
title: Strange behavior when I logout() with IMAP4_SSL
versions: Python 2.5

___
Python tracker 

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



[issue5560] help() no longer reports module docstrings

2009-03-26 Thread Senthil

Changes by Senthil :


Removed file: http://bugs.python.org/file13418/unnamed

___
Python tracker 

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



[issue5560] help() no longer reports module docstrings

2009-03-26 Thread Senthil

Senthil  added the comment:

This is issue is FIXED in the trunk code. Please ignore my previous
comment. 

The problem area is in between line 350-352 in the Python 3.0:pydoc.py
module.

348 docloc = os.environ.get("PYTHONDOCS",
349 "http://docs.python.org/library";)
350 docdir = '/usr/share/doc/python%s/html/library' %
sys.version[:3]
351 if not os.environ.has_key("PYTHONDOCS") and
os.path.isdir(docdir):
352 docloc = docdir

Setting the PYTHONDOCS environment variable still wont work becaues in
Python3k, os.environ does not have has_key attribute, will throw an
exception which is caught somewhere and the module location is returned
instead of its help file,which pydoc uses to display help.

I see that its fixed in trunk where in the lines 350-352 is removed and
pydoc.help() is gathered from local help files if PYTHONDOCS is set or
from the docs.python.org/library location.

This works properly with Python3.1 and this issue can be Closed as Fixed
in 3.1.

--

___
Python tracker 

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



[issue4709] Mingw-w64 and python on windows x64

2009-03-26 Thread Cournapeau David

Cournapeau David  added the comment:

Is there any change to see this integrated soon ? The patch is only a
couple of lines long,

thanks

--

___
Python tracker 

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




[issue5566] Minor error in document of PyLong_AsSsize_t

2009-03-26 Thread Haoyu Bai

New submission from Haoyu Bai :

In 2.6 and 2.7 development document, PyLong_AsSsize_t is said "New in
version 2.5". It is not correct because I checked Python 2.5.4 and
there's only _PyLong_AsSsize_t(). You can check it here:
http://docs.python.org/dev/c-api/long.html#PyLong_AsSsize_t

In 3.0 and 3.1 development document, PyLong_AsSsize_t is appeared twice,
there must be one duplicated. Check it here:
http://docs.python.org/dev/py3k/c-api/long.html#PyLong_AsSsize_t

Thanks!

--
assignee: georg.brandl
components: Documentation
messages: 84178
nosy: bhy, georg.brandl
severity: normal
status: open
title: Minor error in document of PyLong_AsSsize_t
versions: Python 2.7, Python 3.0, Python 3.1

___
Python tracker 

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



[issue5560] help() no longer reports module docstrings

2009-03-26 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc  added the comment:

The code you show was never part of the python project;
But I found that it can come from a customized version for some Linux
distributions:
http://patches.ubuntu.com/by-release/extracted/ubuntu/p/python3.0/3.0~b3+20080915-0ubuntu1/deb-locations.dpatch

This patch is wrong, as you noticed, and should be corrected by their
authors.

--
nosy: +amaury.forgeotdarc
resolution:  -> invalid
status: open -> closed

___
Python tracker 

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



[issue1497532] C API to retain GIL during Python Callback

2009-03-26 Thread Martin Gfeller Martin Gfeller

Martin Gfeller  Martin Gfeller  added 
the comment:

Lukas, I'm afraid to admit you're right :-;. 

Assuming that the Python code called under the "not release the GIL" 
regime would not do anything that could be potentially blocking is 
probably dangerous and could result in an unstable interpreter. 

So I withdraw my feature request and thank you for your efforts and 
interest. 

Best regards, Martin

--
status: open -> closed

___
Python tracker 

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



[issue1497532] C API to retain GIL during Python Callback

2009-03-26 Thread Benjamin Peterson

Changes by Benjamin Peterson :


--
resolution:  -> rejected

___
Python tracker 

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



[issue5567] Operators in operator module don't work with keyword arguments

2009-03-26 Thread Marek Kubica

New submission from Marek Kubica :

When calling operators from the ``operator``-module, they refuse to
accept keyword arguments:

operator.add(a=1, b=2)
TypeError: add() takes no keyword arguments

Operators with keyword arguments are important when one wants to create
partial functions with non-positional arguments.

Take for example ``operator.mod`` where the order of the arguments matters:

This works:
map(lambda x: x % 2, range(5))

This does not work, since ``operator.mod`` does not support keyword
arguments:
map(functools.partial(operator.mod, b=2), range(5))

So there are two solutions: define one's own add(), mod(), contains()
etc. but then the ``operator`` module is rather useless or make them
accept keyword arguments. With ``partial`` in the Stdlib this solution
would be a whole lot nicer.

--
components: Library (Lib)
messages: 84181
nosy: leonidas
severity: normal
status: open
title: Operators in operator module don't work with keyword arguments
type: feature request

___
Python tracker 

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



[issue5528] Unable to launch IDLE on Windows

2009-03-26 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc  added the comment:

Do you happen to have a TCL_LIBRARY environment variable?
If yes, I suggest to remove it.

--
nosy: +amaury.forgeotdarc

___
Python tracker 

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



[issue5126] Space character returns false from isprintable() method

2009-03-26 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc  added the comment:

The patch seems good.

--
nosy: +amaury.forgeotdarc
resolution:  -> accepted
stage: test needed -> commit review

___
Python tracker 

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



[issue5516] equality not symmetric for subclasses of datetime.date and datetime.datetime

2009-03-26 Thread Jack Diederich

Jack Diederich  added the comment:

+1

Patch and tests work for me.  Uploaded a patch that is identical except
the file paths are fixed.

Was the old behavior stable across compilers anyway?  It memcmpared two
different structs and IIRC only the first item of each struct is
guaranteed to be at the start of the memory location.  No?

With this patch only same-struct objects are memcmpared.

--
nosy: +jackdied
Added file: http://bugs.python.org/file13419/issue5516_trunk.diff

___
Python tracker 

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



[issue5006] Duplicate UTF-16 BOM if a file is open in append mode

2009-03-26 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

As for the C version of the patch:
- I'm not sure why you make self->ok handling more complicated than it was
- encodefunc should not be forced to NULL, otherwise it will yield a big
decrease in write() performance

--

___
Python tracker 

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



[issue5567] Operators in operator module don't work with keyword arguments

2009-03-26 Thread Antoine Pitrou

Changes by Antoine Pitrou :


--
nosy: +rhettinger

___
Python tracker 

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



[issue1080387] Making IDLE Themes and Keys Config more Robust

2009-03-26 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc  added the comment:

This issue seems identical to issue2665: IDLE prints a lot of warnings,
and this can block the program after some amount of text, probably on
the first flush() because stderr is not connected to anything when
pythonw.exe is used.

issue2665 was fixed by not blocking the program, now IDLE can start.
The original problem remain, though.

--
nosy: +amaury.forgeotdarc

___
Python tracker 

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



[issue5126] Space character returns false from isprintable() method

2009-03-26 Thread Benjamin Peterson

Benjamin Peterson  added the comment:

Fixed in r70610.

--
nosy: +benjamin.peterson
resolution: accepted -> fixed
status: open -> closed

___
Python tracker 

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



[issue5006] Duplicate UTF-16 BOM if a file is open in append mode

2009-03-26 Thread STINNER Victor

STINNER Victor  added the comment:

> - I'm not sure why you make self->ok handling more complicated than it was

tell() requires self->ok=1. I choosed to reset self->ok to zero on error, but 
it's maybe useless.

> - encodefunc should not be forced to NULL, otherwise it will yield a big
> decrease in write() performance

self>encodefunc value have to be changed because .setstate() changes 
the encoding function: UTF-16 => UTF-16-LE or UTF-16-BE.

I don't know how to get the new value of self>encodefunc. I will try to write 
another patch.

--

___
Python tracker 

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



[issue5567] Operators in operator module don't work with keyword arguments

2009-03-26 Thread Raymond Hettinger

Raymond Hettinger  added the comment:

Sounds like what you're really looking for is a version of partial()
that lets you bind positional arguments in any position.  Something
like:  partial(operator.mod, (1,2)) that pre-binds 2 to argument
position 1.  

Changing the language to match the existing partial() function instead
of changing partial() to fit the language seems like "the tail wagging
the dog".

FWIW, I don't think partial actually buys you anything useful.  It's
implementation isn't as flexible as a lambda, nor is it any faster.  I
think it mainly serves those who have an aversion to lambda, perhaps
because of its name.

Also, I don't think it's a good idea to assign arbitrary keywords to the
operator functions unless those keywords have some meaning that makes
programs more readable.  The names "a" and "b" are only mildly useful a
position placeholders.  Names like "divisor" and "dividend" are more
descriptive, but that is overkill.

Overall, am -1 on the proposal.

--
assignee:  -> rhettinger

___
Python tracker 

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



[issue5568] self.writer.closed() extraneous parens in BufferedRWPair of io module

2009-03-26 Thread Jim Olson

New submission from Jim Olson :

import io


# Corrected a typo in Python261/Lib/io.py at line 1167
# return self.writer.closed() ==> return self.writer.closed
# in
#@property
#def closed(self):
#return self.writer.closed

#also: shouldn't ascii strings still work in Python 2.6.1 for
#StringIO and TextIO? As shown below, writes only work with unicode strings.
#Python 3 changes default encoding to utf-8 but 2.6.1 is still ascii:
#>>> import sys
#>>> sys.getdefaultencoding()
#'ascii'

# Sorry if I am wrong about this.  

ba = buffer('circle')
s = io.StringIO(ba)
print s.getvalue()
#ascii string doesn't work in Python 2.6.1 -- print s.write('square')
print s.write(u'square')
print s.read()
print s.getvalue(), '\n\n'

f = io.FileIO('ioex.txt', 'a+')
r = io.BufferedReader(f)
w = io.BufferedWriter(f)
p = io.BufferedRWPair(r, w)
t = io.TextIOWrapper(p, line_buffering=True)
print t.read(3)
print t.read()
print f.write('julius ceaser\n')
lines = ['william', 'shakespeare', '\n']
f.writelines(' '.join(lines))
#ascii string doesn't work in Python 2.6.1 -- print t.write('marc
anthony\n')
print t.write(u'marc anthony\n')

--
files: ioex.py
messages: 84190
nosy: jimo555
severity: normal
status: open
title: self.writer.closed() extraneous parens in BufferedRWPair of io module
type: behavior
versions: Python 2.6
Added file: http://bugs.python.org/file13420/ioex.py

___
Python tracker 

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



[issue5528] Unable to launch IDLE on Windows

2009-03-26 Thread Chris

Chris  added the comment:

Amaury,
   That worked, the variable was for IBMTools, so I am a little concerned that 
some other program may have issues.  If I do have problems, I will just add the 
variable back.
   Thanks for getting back to me.
- Chris

- Original Message 
From: Amaury Forgeot d'Arc 
To: chrisa...@yahoo.com
Sent: Thursday, March 26, 2009 11:21:08 AM
Subject: [issue5528] Unable to launch IDLE on Windows

Amaury Forgeot d'Arc  added the comment:

Do you happen to have a TCL_LIBRARY environment variable?
If yes, I suggest to remove it.

--
nosy: +amaury.forgeotdarc

___
Python tracker 

___

--

___
Python tracker 

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



[issue5567] Operators in operator module don't work with keyword arguments

2009-03-26 Thread Marek Kubica

Marek Kubica  added the comment:

Well, some Schemes have an CURRYR variant which creates partial
functions with positional arguments from the right but the current
solution with partial accepting keywords is way more flexible since I
can pre-set any arguments I like in such a function in any order. Doing
so by using keyword arguments looks cleaner than by using the position
of the argument.

Compare ``partial(operator.mod, (2, 2))`` with ``partial(operator.mod,
divisor=2)`` and at least to me, it is clearer what is happening in the
second case. Even ``partial(operator.mod, b=2)`` looks simpler, albeit
the name ``b`` is not particularly descriptive.

The names ``a`` and ``b`` as used in many operators are indeed not very
useful but renaming them wouldn't be a problem since nobody currently
depends on ``a`` or ``b`` in their code; just in the order. That said,
``a`` and ``b`` are not so bad actually, because I couldn't think of
better names for ``a`` and ``b`` in ``operator.contains(a, b)``.

The nice thing now is, that partial can indeed replace many lambdas so
not allowing partial to use operator seems just a random restriction.

--

___
Python tracker 

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



[issue5006] Duplicate UTF-16 BOM if a file is open in append mode

2009-03-26 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

Le jeudi 26 mars 2009 à 17:26 +, STINNER Victor a écrit :
> STINNER Victor  added the comment:
> 
> > - I'm not sure why you make self->ok handling more complicated than it was
> 
> tell() requires self->ok=1. I choosed to reset self->ok to zero on error, but 
> it's maybe useless.

You are calling tell() on the underlying binary buffer, not on the
TextIOWrapper object. So self->ok should have no impact. Am I missing
something?

> self>encodefunc value have to be changed because .setstate() changes 
> the encoding function: UTF-16 => UTF-16-LE or UTF-16-BE.

I know, but then the logic should probably be changed and use an
additional struct member to signal that the start of file has been
skipped.

--

___
Python tracker 

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



[issue5568] self.writer.closed() extraneous parens in BufferedRWPair of io module

2009-03-26 Thread Jim Olson

Changes by Jim Olson :


--
components: +Library (Lib)

___
Python tracker 

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



[issue5006] Duplicate UTF-16 BOM if a file is open in append mode

2009-03-26 Thread STINNER Victor

STINNER Victor  added the comment:

Faster patch!
 - add fast encoder for UTF-32, UTF-32-LE and UTF-32-BE (copy/paste of 
utf16 functions)
 - move utf-8 before utf-16-* because utf8 more popular than utf16 :-p
 - don't set self->encodefunc=NULL (loose all the encoder 
optimisation), but only fix self->encodefunc for two special cases: 
utf16=>utf16le or utf16be and utf32=>utf32le or utf32be
 - remove self->ok: it was may be usefull for an older version of my 
patch, but it's not more needed

--
Added file: http://bugs.python.org/file13421/append_bom-2.patch

___
Python tracker 

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



[issue5006] Duplicate UTF-16 BOM if a file is open in append mode

2009-03-26 Thread STINNER Victor

Changes by STINNER Victor :


Removed file: http://bugs.python.org/file13377/append_bom.patch

___
Python tracker 

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



[issue5006] Duplicate UTF-16 BOM if a file is open in append mode

2009-03-26 Thread STINNER Victor

STINNER Victor  added the comment:

Hum, it's a detail, but is it a good idea to keep the reference the int(0)? Or 
would it be better to release it at exit?

--

___
Python tracker 

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



[issue5569] Issue in transparency in top level tk window(python) on MAC

2009-03-26 Thread Yogendra Mohan

New submission from Yogendra Mohan :

Hello All,

   OS - MAC 10.5.1
   Python 2.5.1
   Tk - 8.5.6

I am using the wm_attributes for transparency of top level window. But 
unable to do the same.  
The Tk wm attributes command takes option arguments
self.top=Toplevel(master=self.parent)
self.top.wm_attributes(alpha=0.0)
Let me know can I do on MAC system or Not? If not then please let me 
know what all changes are required into tkinter.

Thanks in advance.
Yogendra Mohan

--
components: Tkinter
messages: 84196
nosy: YMohan
severity: normal
status: open
title: Issue in transparency in top level tk window(python) on MAC
type: crash
versions: Python 2.5

___
Python tracker 

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



[issue5570] Bus error when calling .poll() on a closed Connection from multiprocessing.Pipe()

2009-03-26 Thread Allister MacLeod

New submission from Allister MacLeod :

Python 2.6.1 (r261:67515, Mar 26 2009, 14:44:39) 
[GCC 4.2.4 (Ubuntu 4.2.4-1ubuntu3)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from multiprocessing import Pipe
>>> a, b = Pipe()
>>> a.close()
>>> a.poll()
Bus error

amacl...@cthulhu:~$ uname -a
Linux cthulhu 2.6.24-23-generic #1 SMP Mon Jan 26 01:04:16 UTC 2009
x86_64 GNU/Linux


I'm running Ubuntu 8.04 LTS, and just installed Python 2.6.1, compiling
from source.

--
components: Library (Lib)
messages: 84197
nosy: amacleod
severity: normal
status: open
title: Bus error when calling .poll() on a closed Connection from 
multiprocessing.Pipe()
versions: Python 2.6

___
Python tracker 

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



[issue5571] new "TestCase.skip" method causes all tests to skip under trial (Twisted's test runner)

2009-03-26 Thread Glyph Lefkowitz

New submission from Glyph Lefkowitz :

c.f. this Twisted ticket: http://twistedmatrix.com/trac/ticket/3703

Twisted's test tool has an extended TestCase which uses the 'skip'
attribute, on both tests and methods, to determine whether to skip them.
 You can see the implementation here:

http://twistedmatrix.com/trac/browser/trunk/twisted/trial/unittest.py?rev=26043#L655

The addition of the new 'skip' method in unittest.py therefore causes
trial, twisted's test tool, to unconditionally skip all tests.

I've set the priority to release blocker because I'd like it to be
determined whether this is really python's fault, or twisted's fault for
subclassing TestCase.

If the new 'skip' method of TestCase is renamed to something else, say
skipTest, this won't be a problem.

While I understand that this is technically a compatible change (the
addition of an attribute) I'd appreciate it if this changed on Python's
side of things, because leaving it up to Twisted means we need to go
through a deprecation cycle on a long-standing, stable public interface
that a lot of test code is using.

--
assignee: benjamin.peterson
components: Library (Lib)
messages: 84198
nosy: benjamin.peterson, glyph
priority: release blocker
severity: normal
status: open
title: new "TestCase.skip" method causes all tests to skip under trial 
(Twisted's test runner)
type: behavior
versions: Python 2.7, Python 3.1

___
Python tracker 

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



[issue5572] distutils ignores the LIBS configure env var

2009-03-26 Thread Collin Winter

New submission from Collin Winter :

If you pass LIBS to ./configure (as in "LIBS=-lgcov ./configure"),
distutils ignores this when building extension modules, which breaks
when using certain gcc options which require certain libraries (I'm
thinking of -fprofile-generate). The attached patch remedies this.

--
assignee: tarek
components: Distutils
files: distutils_libs.patch
keywords: needs review, patch, patch
messages: 84199
nosy: collinwinter, jyasskin, tarek
severity: normal
stage: patch review
status: open
title: distutils ignores the LIBS configure env var
type: behavior
versions: Python 2.7
Added file: http://bugs.python.org/file13422/distutils_libs.patch

___
Python tracker 

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



[issue5570] Bus error when calling .poll() on a closed Connection from multiprocessing.Pipe()

2009-03-26 Thread Vaibhav Mallya

Vaibhav Mallya  added the comment:

Python 2.6.1 (r261:67515, Mar 22 2009, 05:39:39) 
[GCC 4.2.4 (Ubuntu 4.2.4-1ubuntu4)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from multiprocessing import Pipe
>>> a, b = Pipe()
>>> a.close()
>>> a.poll()
Segmentation fault

Seems like this should raise an exception.

uname -a:
Linux mememy 2.6.24-23-generic #1 SMP Thu Feb 5 15:00:25 UTC 2009 i686
GNU/Linux

Compiled Python 2.6.1 from source.

--
components: +Extension Modules -Library (Lib)
nosy: +mallyvai

___
Python tracker 

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



[issue5570] Bus error when calling .poll() on a closed Connection from multiprocessing.Pipe()

2009-03-26 Thread Benjamin Peterson

Changes by Benjamin Peterson :


--
assignee:  -> jnoller
nosy: +jnoller
priority:  -> high

___
Python tracker 

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



[issue5387] mmap.move crashes by integer overflow

2009-03-26 Thread Jack Diederich

Jack Diederich  added the comment:

Here is a more verbose patch.  It checks to see if the first two
arguments stand-alone as well.  It also updates NEWS and ACKs and adds
some assertRaises for various bounds checks.

--
nosy: +jackdied
Added file: http://bugs.python.org/file13423/issue_5387.patch

___
Python tracker 

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



[issue5570] Bus error when calling .poll() on a closed Connection from multiprocessing.Pipe()

2009-03-26 Thread Jesse Noller

Jesse Noller  added the comment:

See also:

http://svn.python.org/view?view=rev&revision=68768
http://bugs.python.org/issue3311

This was checked into trunk, I don't know if it was merged to 2.6.1

--

___
Python tracker 

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



[issue5188] telnetlib process_rawq buffer handling is confused

2009-03-26 Thread Jack Diederich

Jack Diederich  added the comment:

I assigned this to me.  I'll be sprinting on telnetlib.

--
assignee:  -> jackdied
nosy: +jackdied

___
Python tracker 

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



[issue5573] multiprocessing Pipe poll() and recv() semantics.

2009-03-26 Thread Vaibhav Mallya

New submission from Vaibhav Mallya :

Python 2.6.1 (r261:67515, Mar 22 2009, 05:39:39) 
[GCC 4.2.4 (Ubuntu 4.2.4-1ubuntu4)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from multiprocessing import Pipe
>>> parent, child = Pipe()
>>> parent.send(1)
>>> parent.close()
>>> print child.recv()
1
>>> print child.poll()
True
>>> print child.recv()
Traceback (most recent call last):
  File "", line 1, in 
EOFError

We have to use both poll() and recv() to determine whether or not the
connection was actually closed.

Better behavior might be returning True on poll() only if the next
recv() on that end of the pipe will work without an error. There may not
be a way to guarantee this, but it would be useful if the documentation
was clarified either way.


uname -a:
Linux mememy 2.6.24-23-generic #1 SMP Thu Feb 5 15:00:25 UTC 2009 i686
GNU/Linux

Compiled Python 2.6.1 from source.

--
assignee: georg.brandl
components: Documentation, Library (Lib)
messages: 84204
nosy: georg.brandl, mallyvai
severity: normal
status: open
title: multiprocessing Pipe poll() and recv() semantics.
type: behavior
versions: Python 2.6

___
Python tracker 

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



[issue5570] Bus error when calling .poll() on a closed Connection from multiprocessing.Pipe()

2009-03-26 Thread Jesse Noller

Jesse Noller  added the comment:

OS/X, Python Trunk:

>>> from multiprocessing import Pipe
>>> a, b = Pipe()
>>> a.close()
>>> a.poll()
Traceback (most recent call last):
  File "", line 1, in 
IOError: handle out of range in select()
>>> 

2.6.1 Does not have the fix (I can segfault it here too). Ben, are we 
planning a 2.6.2?

--
nosy: +benjamin.peterson

___
Python tracker 

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



[issue5573] multiprocessing Pipe poll() and recv() semantics.

2009-03-26 Thread Vaibhav Mallya

Changes by Vaibhav Mallya :


--
nosy: +jnoller

___
Python tracker 

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



[issue5573] multiprocessing Pipe poll() and recv() semantics.

2009-03-26 Thread Jesse Noller

Changes by Jesse Noller :


--
assignee: georg.brandl -> jnoller

___
Python tracker 

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



[issue5570] Bus error when calling .poll() on a closed Connection from multiprocessing.Pipe()

2009-03-26 Thread Benjamin Peterson

Benjamin Peterson  added the comment:

2009/3/26 Jesse Noller :
> 2.6.1 Does not have the fix (I can segfault it here too). Ben, are we
> planning a 2.6.2?

Yes, I think around 3.1's release, but you'll have to ask Barry for sure.

--

___
Python tracker 

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



[issue5148] gzip.open breaks with 'U' flag

2009-03-26 Thread Jack Diederich

Jack Diederich  added the comment:

Unfortunately universal newlines are more complicated than replace() can
handle.  See io.py, you may be able to use one of those classes to the
the universal new line handling on the cheap (or at least easy).

--
nosy: +jackdied

___
Python tracker 

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



[issue4242] Classify language vs. impl-detail tests, step 1

2009-03-26 Thread Benjamin Peterson

Benjamin Peterson  added the comment:

Ok, I applied part of Armin's patch in r70615 modified to work with
unittest's new test skipping ability. I think I will apply the
test_descr part later.

--

___
Python tracker 

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



[issue4709] Mingw-w64 and python on windows x64

2009-03-26 Thread Martin v. Löwis

Martin v. Löwis  added the comment:

Can you please provide some setup instructions for mingw-w64? What URLs 
should I install in what order, so that I can compile Python?

--

___
Python tracker 

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



[issue5571] new "TestCase.skip" method causes all tests to skip under trial (Twisted's test runner)

2009-03-26 Thread Benjamin Peterson

Benjamin Peterson  added the comment:

Renamed to skipTest in r60616.

--
resolution:  -> fixed
status: open -> closed

___
Python tracker 

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



[issue4242] Classify language vs. impl-detail tests, step 1

2009-03-26 Thread Benjamin Peterson

Benjamin Peterson  added the comment:

Second patch applied in r70617.

--
resolution:  -> accepted
status: open -> closed

___
Python tracker 

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



[issue5574] multiprocessing queues.py doesn't include JoinableQueue in its __all__ list

2009-03-26 Thread Vaibhav Mallya

New submission from Vaibhav Mallya :

Should __all__ = ['Queue', 'SimpleQueue'] in queues.py have
JoinableQueue as part of the list as well? 

Also, multiprocessing's __init__.py does not appear to have SimpleQueue
as part of its __all__ - is this expected?

SimpleQueue does not appear in the multiprocessing docs; is it meant to
be avoided by user code then?

--
assignee: georg.brandl
components: Documentation, Library (Lib)
messages: 84212
nosy: georg.brandl, jnoller, mallyvai
severity: normal
status: open
title: multiprocessing queues.py doesn't include JoinableQueue in its __all__ 
list
type: feature request
versions: Python 2.6, Python 2.7, Python 3.0

___
Python tracker 

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



[issue5574] multiprocessing queues.py doesn't include JoinableQueue in its __all__ list

2009-03-26 Thread Jesse Noller

Changes by Jesse Noller :


--
assignee: georg.brandl -> jnoller
nosy:  -georg.brandl

___
Python tracker 

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



[issue5572] distutils ignores the LIBS configure env var

2009-03-26 Thread Roumen Petrov

Roumen Petrov  added the comment:

issue 5060 address this

--
nosy: +rpetrov

___
Python tracker 

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



[issue5572] distutils ignores the LIBS configure env var

2009-03-26 Thread Collin Winter

Collin Winter  added the comment:

The patch attached to issue 5060 seems very tightly focused on a problem
with gcc FDO. This is a more general patch that solves the problem of
distutils ignoring LIBS.

--

___
Python tracker 

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



[issue5572] distutils ignores the LIBS configure env var

2009-03-26 Thread Roumen Petrov

Roumen Petrov  added the comment:

The LIBS contain all module dependent libraries, libpython is linked
with LIBS, modules are linked with libpython.
May be I miss something but I could not found why distutils has to use
LIBS to link a module.

--

___
Python tracker 

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



[issue5468] urlencode does not handle "bytes", and could easily handle alternate encodings

2009-03-26 Thread Jeremy Hylton

Jeremy Hylton  added the comment:

I'm not sure I understand the part of the code that deals with binary
strings.  I agree the current behavior is odd.  RFC 2396 says that
non-ascii characters must be encoded as utf-8 and then percent escaped.
 In the test case you started with, you encoded b'\xa0\x24'.  It doesn't
seem like this should be allowed, since it is not valid utf-8.

--
nosy: +jhylton

___
Python tracker 

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



[issue4773] HTTPMessage not documented and has inconsistent API across 2.6/3.0

2009-03-26 Thread Jeremy Hylton

Jeremy Hylton  added the comment:

No deep thought was given to the HTTPMessage API.  Here's the extent of
the discussion that I can find.  I've changed the names, but you can
find the full discussion at http://bugs.python.org/issue2848

A: mimetools.Message is compatible with email.message.Message, right?
B: I don't know how compatible it is.
C: The APIs are bit different, but it should be possible to migrate from 
the old to the new.

--
nosy: +jhylton

___
Python tracker 

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



[issue2123] ctypes pointer not always keeping target alive

2009-03-26 Thread Thomas Heller

Thomas Heller  added the comment:

I accept this as a bug; however I don't have time now to work on it.

--

___
Python tracker 

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



[issue4773] HTTPMessage not documented and has inconsistent API across 2.6/3.0

2009-03-26 Thread Jeremy Hylton

Jeremy Hylton  added the comment:

A plausible solution is to pick some core set of functionality that we
think people need and document that API.  We can modify one or both of
the current implementations to include that functionality.  What do we need?

--

___
Python tracker 

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



[issue5575] Add env vars for controlling building sqlite, hashlib and ssl

2009-03-26 Thread Collin Winter

New submission from Collin Winter :

This patch adds SSL_ROOT, SQLITE_INC and SQLITE_LIB environment
variables used to inject additional libraries/headers for building the
sqlite, hashlib and ssl modules. We've found this very useful for
building these modules against their dependencies statically for
deployment purposes. This may well not be useful for most CPython users,
but I figured it would be nice to have a record here.

--
components: Build
files: setup_env_vars.patch
keywords: needs review, patch, patch
messages: 84220
nosy: collinwinter
severity: normal
stage: patch review
status: open
title: Add env vars for controlling building sqlite, hashlib and ssl
versions: Python 2.7
Added file: http://bugs.python.org/file13424/setup_env_vars.patch

___
Python tracker 

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



[issue5131] pprint doesn't know how to print a set or a defaultdict

2009-03-26 Thread Jack Diederich

Jack Diederich  added the comment:

sets and frozensets have already been updated to format like lists. 
This patch formats defaultdicts like dicts.

--
keywords: +patch
nosy: +jackdied
Added file: http://bugs.python.org/file13425/issue_5131.patch

___
Python tracker 

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



[issue5028] tokenize.generate_tokens doesn't always return logical line

2009-03-26 Thread Jack Diederich

Jack Diederich  added the comment:

+1 for a docbug.  The last item is always the physical line and not the
logical line.  Some other examples:

if True and \
   False: pass

if (True and
False): pass

--
nosy: +jackdied

___
Python tracker 

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



[issue4773] HTTPMessage not documented and has inconsistent API across 2.6/3.0

2009-03-26 Thread Barry A. Warsaw

Barry A. Warsaw  added the comment:

I propose that you only document the getitem header access API.  I.e.
the thing that info() gives you can be used to access the message
headers via message['content-type'].  That's an API common to both
rfc822.Messages (the ultimate base class of mimetools.Message) and
email.message.Message.

--
nosy: +barry

___
Python tracker 

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



[issue4889] difflib

2009-03-26 Thread Jack Diederich

Jack Diederich  added the comment:

closing, Garbriel's explanation is sufficient.

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

___
Python tracker 

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



[issue5418] urllib.response.addinfourl does not support __exit__

2009-03-26 Thread Jeremy Hylton

Changes by Jeremy Hylton :


--
assignee:  -> jhylton
nosy: +jhylton
resolution:  -> accepted

___
Python tracker 

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



[issue5418] urllib.response.addinfourl does not support __exit__

2009-03-26 Thread Jeremy Hylton

Jeremy Hylton  added the comment:

Makes sense to me.
Committed revision 70625.

--
resolution: accepted -> fixed
status: open -> closed

___
Python tracker 

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



[issue3266] Python-2.5.2/Modules/mmapmodule.c:915: error: `O_RDWR' undeclared

2009-03-26 Thread Jack Diederich

Jack Diederich  added the comment:

survey of other modules that use O_RDRW
The following include sys/type.h and fcntl.h unconditionally:
  bsdmodule.c, dbmmoudle.c, _fileio.c

posixmodule.c includes them after doing an #ifdef check

mmapmodule.c currently (2.7 trunk) includes sys/types.h with an ifdef
check, but fcntl.h not at all.

--
nosy: +jackdied

___
Python tracker 

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



[issue5314] http client error

2009-03-26 Thread Jeremy Hylton

Jeremy Hylton  added the comment:

I'm not sure what to do here.  I guess changing to utf-8 is safe insofar
as the current code only accepts ascii, so the only code that breaks
will be code that depends on the encode() call raising an exception.  It
seems like the client out to specify the encoding, though.  We could fix
that via documentation.

--
nosy: +jhylton

___
Python tracker 

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



[issue5188] telnetlib process_rawq buffer handling is confused

2009-03-26 Thread STINNER Victor

Changes by STINNER Victor :


--
nosy:  -haypo

___
Python tracker 

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



[issue5468] urlencode does not handle "bytes", and could easily handle alternate encodings

2009-03-26 Thread Dan Mahn

Dan Mahn  added the comment:

Hello.  Thanks for the feedback.

With regards to RFC 2396, I see this:

http://www.ietf.org/rfc/rfc2396.txt


There is a second translation for some resources: the sequence of
octets defined by a component of the URI is subsequently used to
represent a sequence of characters. A 'charset' defines this mapping.
There are many charsets in use in Internet protocols. For example,
UTF-8 [UTF-8] defines a mapping from sequences of octets to sequences
of characters in the repertoire of ISO 10646.


To me, that text does not indicate that URLs are always encoded in 
UTF-8.  It indicates that URL information may be encoded in character 
sets ('charset') other than ASCII, and when it is, the values must be 
sent as escaped values.  Here, I note the specific words "many charsets 
in use" and "For example", before the reference to UTF-8.

I have also done a few tests, and have found that in practice, browsers 
do not always encode URLs as UTF-8.  This actually seems to differ as to 
what part of the URL is being encoded.  For instance, my Firefox will 
encode the path portion of a URL as UTF-8, but encode the query string 
as Latin-1.

I think that the general idea is ... URL data must be encoded into 
ASCII, but as to what the data is that is being encoded ... That may be 
of some "charset" which may be application-defined.  And in the most 
general sense, I would argue that the data could simply be binary data. 
  (Actually, Latin-1 pretty much uses all the codes from 0 to 255, so 
it's very much like plain binary data anyway.)

I hope that clarifies what I am reading in RFC 2396.

In addition, quote_plus() already handles all the cases I placed into 
urlencode().  I suppose the actual test cases may be debatable, but I 
did specifically choose tests with data which would be recognized as 
something other then UTF-8.

Jeremy Hylton wrote:
> Jeremy Hylton  added the comment:
> 
> I'm not sure I understand the part of the code that deals with binary
> strings.  I agree the current behavior is odd.  RFC 2396 says that
> non-ascii characters must be encoded as utf-8 and then percent escaped.
>  In the test case you started with, you encoded b'\xa0\x24'.  It doesn't
> seem like this should be allowed, since it is not valid utf-8.
> 
> --
> nosy: +jhylton
> 
> ___
> Python tracker 
> 
> ___

--
title: urlencode does not handle "bytes", and could easily handle alternate 
encodings -> urlencode does not handle "bytes", and could easily handle 
alternate encodings

___
Python tracker 

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



[issue5391] mmap: read_byte/write_byte and object type

2009-03-26 Thread STINNER Victor

STINNER Victor  added the comment:

martin> However, your list of alternatives is incomplete: we 
martin> *could* also change the "c" code to accept and produce 
martin> int - then mmapmodule would not need to change at all.

That's extactly the idea that I proposed in issue #5499 ;-) I prefer 
to have strict getarg('c') and getarg('C') than fixing each module.

--

___
Python tracker 

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



[issue5545] multiprocessing: switch to autoconf detection of platform values

2009-03-26 Thread Roumen Petrov

Roumen Petrov  added the comment:

AC_CHECK_FUNC* check for function .
AC_CHECK_DECL check for declaration .

The check for functions sem_xxx() is incorrect in proposed patch. It has
to check for function.

I didn't review next part of the patch.

--

___
Python tracker 

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



[issue5377] Strange behavior when performing int on a Decimal made from -sys.maxint-1

2009-03-26 Thread STINNER Victor

STINNER Victor  added the comment:

> The general machinery for implementing the built-in int function
> should check any result of type long to see if it fits in an int,
> and convert if so.

Attached patch try to convert long to int, and so it fix the intial 
problem: 
  assert isinstance(int(Decimal(-sys.maxint-1), int).

I used benchmark tools dedicated to test integers:

Unpatched:
  pidigit.py: 4612.0 ms
  bench_int.py: 2743.5 ms

Patched:
  pidigit.py: 4623.8 ms (0.26% slower)
  bench_int.py: 2754.5 ms (0.40% slower)

So for intensive integer operations, the overhead is low. Using a more 
generic benchmark tool (pybench?), you might not be able to see the 
difference ;-)

I'm +0 for this patch because it fixes a very rare case: 
   1 case on (sys.maxint + 1) × 2
   0.0002% with maxint=2^31

--
keywords: +patch
Added file: http://bugs.python.org/file13426/force_int.patch

___
Python tracker 

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



[issue4985] Idle hangs when given a nonexistent filename.

2009-03-26 Thread Guilherme Polo

Guilherme Polo  added the comment:

I tried it here but it didn't hang. But I did notice the editor window
was created and then disappeared, differently from what happens in
python-trunk.

I don't believe creating new files is a good solution, idle on
python-trunk doesn't need to do this to work normally.

--
nosy: +gpolo
versions: +Python 3.1

___
Python tracker 

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



[issue5377] Strange behavior when performing int on a Decimal made from -sys.maxint-1

2009-03-26 Thread STINNER Victor

STINNER Victor  added the comment:

I added the two benchmark tools to my own public SVN:

http://haypo.hachoir.org/trac/browser/misc/bench_int.py
(improved version of the script attached to issue #4294)

http://haypo.hachoir.org/trac/browser/misc/pidigits.py
(improved version of the script attached to issue #5512)

If you know a better place to these benchmarks, feel free to reupload 
them somewhere else.

--

___
Python tracker 

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



[issue4294] Macros for PyLong: sign, number of digits, fits in an int

2009-03-26 Thread STINNER Victor

STINNER Victor  added the comment:

> I think PyLong_SIGN and PyLong_EQUALS_ZERO should go in
> Include/longobject.h, not Include/longintrepr.h

Yeah, it's better for 3rd party modules.

> PyLong_NDIGITS should stay in longintrepr.h, though,
> since it's dependent on the representation.

I don't understand why. PyLong_SIGN() and PyLong_EQUALS_ZERO() do also 
depend on the PyLong implementation. Eg. if we choose to store zero in 
a PyLong of 1 digit (digits={0}), PyLong_SIGN() have also to be 
changed. I think that PyLong_SIGN() can also be moved to longobject.h 
(not done in my patch v3).

> Perhaps rename PyLong_EQUALS_ZERO to PyLong_IS_ZERO?

Done.

> Almost all your uses of PyLong_SIGN take the form 
> PyLong_SIGN(X) < 0. Maybe it would be better to have a
> PyLong_IS_NEGATIVE macro instead?

Not "almost all", just "all" :-) So I also changed the macro name.

--
Added file: http://bugs.python.org/file13427/pylong_macros-3.patch

___
Python tracker 

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



[issue4294] Macros for PyLong: sign, number of digits, fits in an int

2009-03-26 Thread STINNER Victor

Changes by STINNER Victor :


Removed file: http://bugs.python.org/file11975/pylong_macros.patch

___
Python tracker 

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



[issue4294] Macros for PyLong: sign, number of digits, fits in an int

2009-03-26 Thread STINNER Victor

Changes by STINNER Victor :


Removed file: http://bugs.python.org/file13369/pylong_macros-2.patch

___
Python tracker 

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



[issue4294] Macros for PyLong: sign, number of digits, fits in an int

2009-03-26 Thread STINNER Victor

Changes by STINNER Victor :


Removed file: http://bugs.python.org/file11977/pylong_optimize.patch

___
Python tracker 

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



[issue4294] Macros for PyLong: sign, number of digits, fits in an int

2009-03-26 Thread STINNER Victor

Changes by STINNER Victor :


Removed file: http://bugs.python.org/file11980/pylong_shift.patch

___
Python tracker 

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



[issue4294] Macros for PyLong: sign, number of digits, fits in an int

2009-03-26 Thread STINNER Victor

Changes by STINNER Victor :


Removed file: http://bugs.python.org/file11981/bench_int.py

___
Python tracker 

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



[issue4294] Macros for PyLong: sign, number of digits, fits in an int

2009-03-26 Thread STINNER Victor

STINNER Victor  added the comment:

I removed my "optimization" patches: there were useless (no or low 
speedup). I also removed bench_int.py: I moved it to my own public 
SVN:
http://haypo.hachoir.org/trac/browser/misc/bench_int.py

--

___
Python tracker 

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



[issue5576] Don't use PyLong_SHIFT with _PyLong_AsScaledDouble()

2009-03-26 Thread STINNER Victor

New submission from STINNER Victor :

_PyLong_AsScaledDouble() writes the exponent in a int which have to be 
multiplied by PyLong_SHIFT to give the power of 2. I proposed to 
multiply the exponent by PyLong_SHIFT in _PyLong_AsScaledDouble() to 
directly get the power of 2. It avoids complex code to test integer 
overflow in code using _PyLong_AsScaledDouble() (the test is only done 
once, in _PyLong_AsScaledDouble).

I also propose to change exponent type from "int*" to "unsigned int*". 
Previous maximum exponent was INT_MAX//PyLong_SHIFT (eg. 143165576 for 
PyLong using base 2^15). The new maximum is now 
UINT_MAX//PyLong_SHIFT, the double ;-)

And since issue #4258 is commited (Use 30-bit digits instead of 15-bit 
digits for Python integers), PyLong_SHIFT value may be different 
depending on the compiler option. Using my patch, the long implement 
will be a little bit more hidden.

The function _PyLong_AsScaledDouble() should be private because the 
name starts with "_". But I see it in Include/longobject.h. In Python, 
it's used in longobject.c and mathmodule.c.

--
components: Interpreter Core
files: pylong_asscaleddouble-2.patch
keywords: patch
messages: 84236
nosy: haypo
severity: normal
status: open
title: Don't use PyLong_SHIFT with _PyLong_AsScaledDouble()
versions: Python 2.7, Python 3.1
Added file: http://bugs.python.org/file13428/pylong_asscaleddouble-2.patch

___
Python tracker 

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



[issue5576] Don't use PyLong_SHIFT with _PyLong_AsScaledDouble()

2009-03-26 Thread STINNER Victor

Changes by STINNER Victor :


--
nosy: +marketdickinson

___
Python tracker 

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



[issue4294] Macros for PyLong: sign, number of digits, fits in an int

2009-03-26 Thread STINNER Victor

STINNER Victor  added the comment:

I created a decicated issue for my last unrelated patch:
#5576: Don't use PyLong_SHIFT with _PyLong_AsScaledDouble()

--

___
Python tracker 

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



[issue4294] Macros for PyLong: sign, number of digits, fits in an int

2009-03-26 Thread STINNER Victor

Changes by STINNER Victor :


Removed file: http://bugs.python.org/file11979/pylong_asscaleddouble.patch

___
Python tracker 

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



[issue5016] FileIO.seekable() can return False

2009-03-26 Thread STINNER Victor

Changes by STINNER Victor :


Removed file: http://bugs.python.org/file12848/fileio_seekable.patch

___
Python tracker 

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



[issue5016] FileIO.seekable() can return False

2009-03-26 Thread STINNER Victor

STINNER Victor  added the comment:

> Needs backport to trunk and 2.6, if someone is interested.

I'm interrested by a backport at least in trunk. I updated the patch 
to trunk:
 - test directly _file._FileIO() instead of using open() because in 
Python trunk, a file has no seekable() method :-/
 - use contextlib.closing() because _FileIO doesn't implement context 
API (not __exit__() method)

--
Added file: http://bugs.python.org/file13429/fileio_seekable-trunk.patch

___
Python tracker 

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



[issue5545] multiprocessing: switch to autoconf detection of platform values

2009-03-26 Thread Christian Heimes

Christian Heimes  added the comment:

Dear Roumen, please do my a favor and stop throwing in random ideas and
accusations. I appreciate any help but your replies don't help at all.
They are just causing frustration on either side.

I know about AC_CHECK_DECL and AC_CHECK_FUNC. As I already said I can't
use AC_CHECK_FUNC because I can't easily include the necessary header file. 
AC_CHECK_DECL emits almost the same code as my check for sem_open and
sem_timedwait. However I'm planing to add more sanity checks for exotic
platforms in the future.
My check for sem_open does exactly what it suppose to do (and exactly
what AC_CHECK_DECL does, by the way). Why do you think it's not right?

--

___
Python tracker 

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



[issue5545] multiprocessing: switch to autoconf detection of platform values

2009-03-26 Thread Christian Heimes

Christian Heimes  added the comment:

Jesse, have fun with
svn+ssh://python...@svn.python.org/python/branches/multiprocessing-autoconf
during the sprint.

--
stage: needs patch -> patch review

___
Python tracker 

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



[issue5016] FileIO.seekable() can return False

2009-03-26 Thread Antoine Pitrou

Antoine Pitrou  added the comment:

You can use io.open() instead of open()...

--

___
Python tracker 

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



[issue5035] Compilation --without-threads fails

2009-03-26 Thread STINNER Victor

STINNER Victor  added the comment:

Python trunk is still broken --without-threads. The multiprocessing 
issue (#3807) is now closed, so can someone review (or apply?) my 
patches?

--

___
Python tracker 

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



[issue4773] HTTPMessage not documented and has inconsistent API across 2.6/3.0

2009-03-26 Thread Brad Miller

Brad Miller  added the comment:

On Thu, Mar 26, 2009 at 4:29 PM, Barry A. Warsaw wrote:

>
> Barry A. Warsaw  added the comment:
>
> I propose that you only document the getitem header access API.  I.e.
> the thing that info() gives you can be used to access the message
> headers via message['content-type'].  That's an API common to both
> rfc822.Messages (the ultimate base class of mimetools.Message) and
> email.message.Message.
>

As I've found myself in the awkward position of having to explain the new
3.0 api to my students I've thought about this and have some
ideas/questions.
I'm also willing to help with the documentation or any enhancements.

Traceback (most recent call last):
  File "", line 1, in 
TypeError: 'addinfourl' object is unsubscriptable

I wish I new what an addinfourl object was.

'Fri, 27 Mar 2009 00:41:34 GMT'

'Fri, 27 Mar 2009 00:41:34 GMT'

['Date', 'Server', 'Last-Modified', 'ETag', 'Accept-Ranges',
'Content-Length', 'Connection', 'Content-Type']

Using x.headers over x.info()  makes the most sense to me, but I don't know
that I can give any good rationale.  Which would we want to document?

'text/html; charset=ISO-8859-1'

I guess technically this is correct since the charset is part of the
Content-Type header in HTTP but it does make life difficult for what I think
will be a pretty common use case in this new urllib:  read from the url (as
bytes) and then decode them into a string using the appropriate character
set.

As you follow this road, you have the confusing option of these three calls:

'iso-8859-1'
>>> x.headers.get_charsets()
['iso-8859-1']

I think it should be a bug that get_charset() does not return anything in
this case.  It is not at all clear why get_content_charset() and
get_charset() should have different behavior.

Brad

>
> --
> nosy: +barry
>
> ___
> Python tracker 
> 
> ___
>

--
Added file: http://bugs.python.org/file13430/unnamed

___
Python tracker 

___On Thu, Mar 26, 2009 at 4:29 PM, Barry A. 
Warsaw rep...@bugs.python.org> 
wrote:

Barry A. Warsaw ba...@python.org> 
added the comment:

I propose that you only document the getitem header access API.  I.e.
the thing that info() gives you can be used to access the message
headers via message['content-type'].  That's an API common to 
both
rfc822.Messages (the ultimate base class of mimetools.Message) and
email.message.Message.As I've found 
myself in the awkward position of having to explain the new 3.0 api to my 
students I've thought about this and have some ideas/questions.
I'm also willing to help with the documentation or any 
enhancements.>>> x = 
urllib.request.urlopen('http://knuth.luther.edu/python/test.html";>http://knuth.luther.edu/python/test.html')
>>> x['Date']Traceback (most recent call 
last):  File "", line 1, in 
TypeError: 'addinfourl' object is 
unsubscriptable
I wish I new what an addinfourl object 
was.>>> http://x.info";>x.info()['Date']'Fri, 27 Mar 
2009 00:41:34 GMT'
>>> x.headers['Date']'Fri, 27 
Mar 2009 00:41:34 GMT'>>> 
x.headers.keys()['Date', 'Server', 
'Last-Modified', 'ETag', 'Accept-Ranges', 
'Content-Length', 'Connection', 'Content-Type']
Using x.headers over http://x.info";>x.info() 
 makes the most sense to me, but I don't know that I can give any good 
rationale.  Which would we want to document?
>>> 
x.headers['Content-Type']'text/html; 
charset=ISO-8859-1'I guess technically this is 
correct since the charset is part of the Content-Type header in HTTP but it 
does make life difficult for what I think will be a pretty common use case in 
this new urllib:  read from the url (as bytes) and then decode them into a 
string using the appropriate character set.
As you follow this road, you have the confusing 
option of these three calls:>>> 
x.headers.get_charset()>>> 
x.headers.get_content_charset()
'iso-8859-1'>>> 
x.headers.get_charsets()['iso-8859-1']I
 think it should be a bug that get_charset() does not return anything in this 
case.  It is not at all clear why get_content_charset() and get_charset() 
should have different behavior.
Brad 

--
nosy: +barry

___
Python tracker rep...@bugs.python.org>
http://bugs.python.org/issue4773>
___
-- Brad 
MillerAssistant Professor, Computer ScienceLuther College

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



[issue5035] Compilation --without-threads fails

2009-03-26 Thread STINNER Victor

Changes by STINNER Victor :


Removed file: http://bugs.python.org/file12839/_sqlite_nothread.patch

___
Python tracker 

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



[issue5035] Compilation --without-threads fails

2009-03-26 Thread STINNER Victor

STINNER Victor  added the comment:

Updated and completed patch for _sqlite module (python trunk).

--
Added file: http://bugs.python.org/file13431/_sqlite_nothread-2.patch

___
Python tracker 

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



[issue5035] Compilation --without-threads fails

2009-03-26 Thread STINNER Victor

STINNER Victor  added the comment:

New patch _tkinter_nothread.patch: fix gcc warnings in _tkinter.

--
Added file: http://bugs.python.org/file13432/_tkinter_nothread.patch

___
Python tracker 

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



[issue5016] FileIO.seekable() can return False

2009-03-26 Thread STINNER Victor

STINNER Victor  added the comment:

> You can use io.open() instead of open()...

Alright, it's much easier with io.open() :-)

--
Added file: http://bugs.python.org/file13433/fileio_seekable-trunk-2.patch

___
Python tracker 

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



[issue5016] FileIO.seekable() can return False

2009-03-26 Thread STINNER Victor

Changes by STINNER Victor :


Removed file: http://bugs.python.org/file13429/fileio_seekable-trunk.patch

___
Python tracker 

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



[issue4629] getopt should not accept no_argument that ends with '='

2009-03-26 Thread STINNER Victor

STINNER Victor  added the comment:

Updated patch with a regression test.

--
Added file: http://bugs.python.org/file13434/getopt-2.patch

___
Python tracker 

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



[issue5110] Printing Unicode chars from the interpreter in a non-UTF8 terminal raises an error (Py3)

2009-03-26 Thread STINNER Victor

STINNER Victor  added the comment:

martin> IIUC, this patch breaks PEP3138, 
martin> so it clearly must be rejected.

After reading the PEP3138, it's clear that this issue is not bug, and 
that we can not accept any patch fixing the issue without breaking the 
PEP.

Windows user who want to get the Python2 behaviour can use my display 
hook proposed in Message80823.

We can not fix this issue, so I choose to close it. If anyone wants to 
change the PEP, start a discussion on python-dev first.

--
resolution:  -> invalid
status: open -> closed

___
Python tracker 

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



[issue5145] struct.calcsize('cd') returns 16 instead of 9

2009-03-26 Thread STINNER Victor

STINNER Victor  added the comment:

Sorry, but I don't see this issue as a bug because it's related to 
memory alignment as explained in the documentation. 

I choose to close this issue. If you think that the documentation 
should be improved, please suggest an updated doc.
http://docs.python.org/library/struct.html#struct.calcsize

--
resolution:  -> invalid
status: open -> closed

___
Python tracker 

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



[issue5214] Add KOI8-RU as a known encoding

2009-03-26 Thread STINNER Victor

STINNER Victor  added the comment:

> @lemburg: I can't comment on the status of the standard.
> I would assume that like most 8 bit encodings that these 
> are falling away and being replaced by Unicode.

Can I close this issue? Or do we have enough KOI8-RU users to include 
this charset in Python?

I think that iconv is enough for people who need to convert their old 
files to UTF-8 (or anything else).

--

___
Python tracker 

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



[issue5528] Unable to launch IDLE on Windows

2009-03-26 Thread Amaury Forgeot d'Arc

Changes by Amaury Forgeot d'Arc :


--
resolution:  -> invalid
status: open -> closed

___
Python tracker 

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



[issue1551113] random.choice(setinstance) fails

2009-03-26 Thread Rob Renaud

Rob Renaud  added the comment:

I found this via google search when disappointed that random.choice
raised an exception rather than returned a random item in the set.

It's quite easy to implement random.choice for sets/dicts in O(1)
expected time from the C implementation as long as the set/dict
implementation guarantees minimal constant density.  Simply generate
random indices in the set object until one with an object is found . 
This has will work in expected O(1/density) probes.

I suppose making random.choice work for sets/dicts isn't worth a C
implementation (as happy as it would have made me a few hours ago...)?

--
nosy: +rrenaud

___
Python tracker 

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



[issue4709] Mingw-w64 and python on windows x64

2009-03-26 Thread Cournapeau David

Cournapeau David  added the comment:

I think compiling python itself with it would be quite difficult - I
have never attempted it. My 'scenario' is building extensions against
the official python for amd64 on windows.

The quickest way to test the patch would be as follows:
 - take a native toolchain (by native, I mean runs on and target 64 bits
windows subsystem - I have not tested cross compilation, or even using
32 bits toolchain on WoW). The one from equations.com is recent and runs
well:

http://www.equation.com/servlet/equation.cmd?call=fortran

 - builds a hello-world like python extension from the command line:

http://projects.scipy.org/numpy/wiki/MicrosoftToolchainSupport (I am
sorry, the wiki page is bit messy, I will clean it up).

Since we use our own distutils extensions in numpy, I don't know how
much is needed for support at the stdlib distutils level. If that's
something which sounds interesting to python itself, I am willing to add
support in python proper for mingw-w64.

--

___
Python tracker 

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



  1   2   >