[issue1971] ctypes exposing the pep 3118 buffer interface

2008-01-30 Thread Thomas Heller

New submission from Thomas Heller:

The attached patch against py3k makes ctypes expose the pep 3118 buffer
interface.
The code is also available in the py3k-ctypes-pep3118 branch.

--
components: Extension Modules
files: ctypes-pep3118.patch
keywords: patch
messages: 61844
nosy: theller
priority: urgent
severity: normal
status: open
title: ctypes exposing the pep 3118 buffer interface
type: rfe
versions: Python 3.0
Added file: http://bugs.python.org/file9324/ctypes-pep3118.patch

__
Tracker <[EMAIL PROTECTED]>

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



[issue1953] Compact int and float freelists

2008-01-30 Thread Christian Heimes

Christian Heimes added the comment:

I've moved the methods back to the sys module and added API docs for the
C and Python code.

--
title: gc.compact_freelists -> Compact int and float freelists
Added file: http://bugs.python.org/file9325/trunk_compact_freelist2.patch

__
Tracker <[EMAIL PROTECTED]>

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



[issue1968] Unused number magic methods leaked into Py2.6

2008-01-30 Thread Christian Heimes

Changes by Christian Heimes:


--
priority:  -> high
type:  -> behavior

__
Tracker <[EMAIL PROTECTED]>

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



[issue1966] infinite loop in httplib

2008-01-30 Thread Christian Heimes

Christian Heimes added the comment:

I'm not sure if the patch can get into 2.3 and 2.4. It's up to Martin to
decide.

--
assignee:  -> loewis
keywords: +easy, patch
nosy: +loewis, tiran
priority:  -> high

__
Tracker <[EMAIL PROTECTED]>

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



[issue1970] Speedup unicode whitespace and linebreak detection

2008-01-30 Thread Christian Heimes

Christian Heimes added the comment:

Sounds interesting and good!

--
keywords: +patch
nosy: +tiran
priority:  -> normal
type:  -> rfe

__
Tracker <[EMAIL PROTECTED]>

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



[issue1969] split and rsplit in bytearray are inconsistent

2008-01-30 Thread Christian Heimes

Christian Heimes added the comment:

Fixed in r60437 with unit test.

Thanks for the report!

--
nosy: +tiran
resolution:  -> fixed
status: open -> closed

__
Tracker <[EMAIL PROTECTED]>

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



[issue1967] Backport dictviews to 2.6

2008-01-30 Thread Christian Heimes

Changes by Christian Heimes:


--
priority:  -> normal
type:  -> rfe

__
Tracker <[EMAIL PROTECTED]>

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



[issue1391] Adds the .compact() method to bsddb db.DB objects

2008-01-30 Thread Christian Heimes

Changes by Christian Heimes:


--
priority:  -> normal

__
Tracker <[EMAIL PROTECTED]>

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



[issue1965] Move trunc() to math module

2008-01-30 Thread Christian Heimes

Changes by Christian Heimes:


--
priority:  -> high

__
Tracker <[EMAIL PROTECTED]>

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



[issue1970] Speedup unicode whitespace and linebreak detection

2008-01-30 Thread Marc-Andre Lemburg

Marc-Andre Lemburg added the comment:

This should also be backported to Py2.6.

--
versions: +Python 2.6

__
Tracker <[EMAIL PROTECTED]>

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



[issue1970] Speedup unicode whitespace and linebreak detection

2008-01-30 Thread Christian Heimes

Changes by Christian Heimes:


Removed file: http://bugs.python.org/file9326/trunk_unispace.patch

__
Tracker <[EMAIL PROTECTED]>

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



[issue1970] Speedup unicode whitespace and linebreak detection

2008-01-30 Thread Christian Heimes

Christian Heimes added the comment:

Sorry, this patch doesn't contain my current work.

Added file: http://bugs.python.org/file9327/trunk_unispace.patch

__
Tracker <[EMAIL PROTECTED]>

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



[issue1970] Speedup unicode whitespace and linebreak detection

2008-01-30 Thread Christian Heimes

Christian Heimes added the comment:

I agree! The new patch applies cleanly to the trunk. I've fixed some
white spaces and renamed the tables to _Py_ascii_

Added file: http://bugs.python.org/file9326/trunk_unispace.patch

__
Tracker <[EMAIL PROTECTED]>

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



[issue1970] Speedup unicode whitespace and linebreak detection

2008-01-30 Thread Marc-Andre Lemburg

Marc-Andre Lemburg added the comment:

Nice patch !

--
nosy: +lemburg

__
Tracker <[EMAIL PROTECTED]>

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



[issue1964] Slight adjustment to sphinx print-media stylesheet

2008-01-30 Thread Christian Heimes

Changes by Christian Heimes:


--
assignee:  -> georg.brandl
keywords: +patch
nosy: +georg.brandl
priority:  -> normal
type:  -> rfe

__
Tracker <[EMAIL PROTECTED]>

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



[issue1685] linecache .updatecache fails on utf8 encoded files

2008-01-30 Thread Christian Heimes

Changes by Christian Heimes:


--
keywords: +easy, patch
priority:  -> high
type:  -> behavior

__
Tracker <[EMAIL PROTECTED]>

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



[issue1970] Speedup unicode whitespace and linebreak detection

2008-01-30 Thread Marc-Andre Lemburg

Marc-Andre Lemburg added the comment:

Please make those stables static... 

In general, everything that's not needed outside an object file should
be made static to avoid naming conflicts. For static symbols, there's no
need to prefix them with any "Py" indicator.

__
Tracker <[EMAIL PROTECTED]>

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



[issue1973] bytes.fromhex('') raises SystemError

2008-01-30 Thread Christian Heimes

Christian Heimes added the comment:

Thanks! :)

Fixed in r60439

--
keywords: +patch
nosy: +tiran
priority:  -> normal
resolution:  -> fixed
status: open -> closed
type:  -> crash

__
Tracker <[EMAIL PROTECTED]>

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



[issue1973] bytes.fromhex('') raises SystemError

2008-01-30 Thread Antoine Pitrou

Antoine Pitrou added the comment:

Here is a patch. Unittest should be covered by removing the test_bytes
workaround mentioned in #1972 :)

Added file: http://bugs.python.org/file9329/fromhex.patch

__
Tracker <[EMAIL PROTECTED]>

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



[issue1970] Speedup unicode whitespace and linebreak detection

2008-01-30 Thread Marc-Andre Lemburg

Marc-Andre Lemburg added the comment:

Ok, thanks.

__
Tracker <[EMAIL PROTECTED]>

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



[issue1970] Speedup unicode whitespace and linebreak detection

2008-01-30 Thread Christian Heimes

Christian Heimes added the comment:

> Please make those stables static... 
> 
> In general, everything that's not needed outside an object file should
> be made static to avoid naming conflicts. For static symbols, there's no
> need to prefix them with any "Py" indicator.

The ascii whitespace table is required for Py_UNICODE_ISSPACE. I can
make the linebreak table static but I can't make the whitespace table
static.

__
Tracker <[EMAIL PROTECTED]>

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



[issue1972] improve bytes and bytearray tests

2008-01-30 Thread Antoine Pitrou

New submission from Antoine Pitrou:

Currently some tests in test_bytes.py only test bytearray, others only
test bytes. Here is a patch to try to make test coverage more extensive.
You'll notice there is a small hack in test_fromhex, that's because
bytes.fromhex is buggy, I'll open a separate bug entry for that.

--
components: Tests
files: bytestest.patch
messages: 61854
nosy: pitrou
severity: normal
status: open
title: improve bytes and bytearray tests
versions: Python 3.0
Added file: http://bugs.python.org/file9328/bytestest.patch

__
Tracker <[EMAIL PROTECTED]>

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



[issue1973] bytes.fromhex('') raises SystemError

2008-01-30 Thread Antoine Pitrou

New submission from Antoine Pitrou:

>>> bytearray.fromhex('')
bytearray(b'')
>>> bytes.fromhex('')
Traceback (most recent call last):
  File "", line 1, in 
SystemError: Objects/stringobject.c:3131: bad argument to internal function

--
components: Interpreter Core
messages: 61855
nosy: pitrou
severity: normal
status: open
title: bytes.fromhex('') raises SystemError
versions: Python 3.0

__
Tracker <[EMAIL PROTECTED]>

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



[issue1972] improve bytes and bytearray tests

2008-01-30 Thread Christian Heimes

Christian Heimes added the comment:

Good idea but could you please use typ2test instead of a decorator? It
involves too much magic.

--
keywords: +patch
nosy: +tiran
priority:  -> normal
resolution:  -> accepted
type:  -> rfe

__
Tracker <[EMAIL PROTECTED]>

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



[issue1970] Speedup unicode whitespace and linebreak detection

2008-01-30 Thread Christian Heimes

Christian Heimes added the comment:

I've applied the patch to the trunk in r60440. It will be merged into
3.0 soonish. Thanks for your work Keep it going! :)

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

__
Tracker <[EMAIL PROTECTED]>

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



[issue1972] improve bytes and bytearray tests

2008-01-30 Thread Antoine Pitrou

Changes by Antoine Pitrou:


Added file: http://bugs.python.org/file9331/bytestest.patch

__
Tracker <[EMAIL PROTECTED]>

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



[issue1972] improve bytes and bytearray tests

2008-01-30 Thread Antoine Pitrou

Antoine Pitrou added the comment:

Ok, here is a patch using type2test instead :)

Added file: http://bugs.python.org/file9330/bytestest.patch

__
Tracker <[EMAIL PROTECTED]>

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



[issue1943] improved allocation of PyUnicode objects

2008-01-30 Thread Marc-Andre Lemburg

Marc-Andre Lemburg added the comment:

Yes, definitely.

Some comments on style in your first patch:

 * please use unicode->length instead of the macro LENGTH you added
 * indents in unicodeobject.c are 4 spaces
 * line length should stay below 80

__
Tracker <[EMAIL PROTECTED]>

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



[issue1972] improve bytes and bytearray tests

2008-01-30 Thread Antoine Pitrou

Antoine Pitrou added the comment:

Hmm, that "import functools" at top of the file certainly can be removed...

__
Tracker <[EMAIL PROTECTED]>

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



[issue1972] improve bytes and bytearray tests

2008-01-30 Thread Christian Heimes

Christian Heimes added the comment:

Thanks again! Applied in r60442

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

__
Tracker <[EMAIL PROTECTED]>

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



[issue1974] email.MIMEText.MIMEText.as_string incorrectly folding long subject header

2008-01-30 Thread Chris Withers

New submission from Chris Withers:

Somewhere in email.MIMEText.MIMEText.as_string (I'm not sure where) long
subject headers are folded using a newline followed by a tab:

>>> from email.MIMEText import MIMEText
>>> m = MIMEText('foo')
>>> m['Subject']='AA '*40
>>> m.as_string()
'Content-Type: text/plain; charset="us-ascii"\nMIME-Version:
1.0\nContent-Transfer-Encoding: 7bit\nSubject: AA AA AA AA AA AA AA AA
AA AA AA AA AA AA AA AA AA AA AA AA AA AA AA\n\tAA AA AA AA AA AA AA AA
AA AA AA AA AA AA AA AA AA \n\nfoo'

While RFC 822 section 3.1.1 doesn't forbid this type of folding, the
current behaviour mis-renders in both Thunderbird and Outlook.

Messages generated by Thunderbird and Outlook represent the above
subject as follows:

'Content-Type: text/plain; charset="us-ascii"\nMIME-Version:
1.0\nContent-Transfer-Encoding: 7bit\nSubject: AA AA AA AA AA AA AA AA
AA AA AA AA AA AA AA AA AA AA AA AA AA AA AA\n AA AA AA AA AA AA AA AA
AA AA AA AA AA AA AA AA AA \n\nfoo'

Could the email library be adjusted to do the same? Years of wondering
why mails re-sent by mailman, mails from any number of python web
systems and recent complaints from customers of mine of mis-rendered
emails could be solved by doing so.

--
components: Library (Lib)
messages: 61866
nosy: cjw296
severity: normal
status: open
title: email.MIMEText.MIMEText.as_string incorrectly folding long subject header
versions: Python 2.4

__
Tracker <[EMAIL PROTECTED]>

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



[issue1943] improved allocation of PyUnicode objects

2008-01-30 Thread Antoine Pitrou

Antoine Pitrou added the comment:

After some more tests I must qualify what I said. The freelist patch is
an improvement in some situations. In others it does not really have any
impact. On the other hand, the PyVarObject version handles memory-bound
cases dramatically better, see below.

With a small string:
./python -m timeit -s "s=open('INTBENCH', 'r').read()" "s.split()"
-> Unpatched py3k: 26.4 usec per loop
-> Freelist patch: 21.5 usec per loop
-> PyVarObject patch: 20.2 usec per loop

With a medium-sized string:
./python -m timeit -s "s=open('LICENSE', 'r').read()" "s.split()"
-> Unpatched py3k: 458 usec per loop
-> Freelist patch: 408 usec per loop
-> PyVarObject patch: 316 usec per loop

With a long string:
./python -m timeit -s "s=open('Misc/HISTORY', 'r').read()" "s.split()"
-> Unpatched py3k: 31.3 msec per loop
-> Freelist patch: 32.7 msec per loop
-> PyVarObject patch: 17.8 msec per loop

(the numbers are better than in my previous posts because the
split-accelerating patch has been integrated)

Also, given those results, it is also clear that neither pybench nor
stringbench really stress memory efficiency of strings, only processing
algorithms.

That said, the freelist patch is attached.

Added file: http://bugs.python.org/file9332/freelists.patch

__
Tracker <[EMAIL PROTECTED]>

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



[issue1745035] DoS smtpd vulnerability

2008-01-30 Thread Jesús Cea Avión

Changes by Jesús Cea Avión:


--
nosy: +jcea

_
Tracker <[EMAIL PROTECTED]>

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



[issue756914] SSL support for poplib

2008-01-30 Thread Raghuram Devarakonda

Raghuram Devarakonda added the comment:

no activity. Please do reopen if the offer still stands.

--
nosy: +draghuram
resolution:  -> out of date
status: open -> closed


Tracker <[EMAIL PROTECTED]>


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



[issue600362] relocate cgi.parse_qs() into urlparse

2008-01-30 Thread Raghuram Devarakonda

Raghuram Devarakonda added the comment:

I know that Senthil has been working on consolidating url related
functionalities so I am adding him to the list.

--
nosy: +draghuram, orsenthil
versions: +Python 2.6, Python 3.0


Tracker <[EMAIL PROTECTED]>


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



[issue1975] signals in thread problem

2008-01-30 Thread Andriy Pylypenko

New submission from Andriy Pylypenko:

Hello,

This issue is actually a follow up of issue 960406. The patch applied
there brought in a problem at least under FreeBSD. The problem is
extremely annoying so I made an effort to uncover the source of it.

Here is an example code that shows the problem:

some_time = 600 # seconds

class MyThread(Thread):
def run(self):
while (True):
time.sleep(some_time)

t = MyThread()
t.start()
while(True):
select.select(None, None, None, some_time)

Start this script, then try to interrupt it by hitting Control-C. If you
run this code under Linux you won't see any problem. But under FreeBSD
the script won't stop until the timeout in main thread occurs or some
activity takes place on descriptors passed to the select().

My investigation showed that the source of the problem is in that how
signals are processed. FreeBSD processes signals in opposite order than
Linux. For example suppose we have a program that starts one user thread
and allows both main and user threads to receive signals. Under Linux
the signal handler always fires up in context of the main thread, but
under FreeBSD the signal handler runs in context of the user thread. 
POSIX doesn't state which behavior is correct so both behaviors should
be assumed to be correct and Python should be aware of them both. Before
the patch from 960406 the Python made effort to deny signal handling in
user threads but the patch dropped this code and all threads are allowed
to handle signals.

Let's return to the script. When running the script under Linux the
select() call is the one that gets interrupted by the signal and this
allows the script to shutdown quickly. But under FreeBSD the sleep()
call is interrupted by the signal leaving the main thread to wait on
select() until timeout.

The description of issue 960406 states:

"This is a patch which will correct the issues some people have with
python's handling of signal handling in threads. It allows any thread to
initially catch the signal mark it as triggered, allowing the main
thread to later process it."

And yes it behaves exactly as described but this behavior is
inconsistent between different OSes.

To make things predictable I've restored the code that ensures that
signal handler will run in context of main thread only:

long
PyThread_start_new_thread(void (*func)(void *), void *arg)
{
...
+   sigset_t set, oset;
...
+   sigfillset(&set);
+   SET_THREAD_SIGMASK(SIG_BLOCK, &set, &oset);
pthread_create(...)
+   SET_THREAD_SIGMASK(SIG_SETMASK, &oset, NULL);
...

and this works perfectly for me under FreeBSD and Linux at least for my
needs. It doesn't bring any visible changes to readline behavior either.
I'm using the 2.5.1 version of Python. In attach you can find this patch
against the trunk.

I'm not Python guru but let me try to display my vision of the situation.

As I understand, my change does nothing for applications written in pure
Python and running under Linux (without user modules written in C and
using special thread and signal handling). Signals under Linux have
absolutely no chance to be caught from within user threads as Python
doesn't provide any way to alter the signal mask and with the default
signal mask the signals always arrive to the main thread. So explicit
prohibition to handle signals from within user thread doesn't change
anything. On the other hand this change ensures that under FreeBSD
things go exactly like under Linux.

Of course this change can possibly break some C-written module that
relies on signal handling in context of user thread (as the signal mask
of the user thread must be modified explicitly now). But anyway this is
how things are meant to work in order to be portable. So I'm considering
this possibility as highly unlikely.

I suppose the Mac OS X is affected also as it's based on FreeBSD.

--
components: Interpreter Core
files: pthread_sig.diff
messages: 61870
nosy: bamby
severity: normal
status: open
title: signals in thread problem
type: behavior
versions: Python 2.4, Python 2.5
Added file: http://bugs.python.org/file9333/pthread_sig.diff

__
Tracker <[EMAIL PROTECTED]>

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



[issue1976] pybsddb leak in using cursors

2008-01-30 Thread Jesús Cea Avión

New submission from Jesús Cea Avión:

Iterating a cursor over a database seems to leak memory. See
http://sourceforge.net/mailarchive/forum.php?thread_name=4797B7D0.8060701%40gmail.com&forum_name=pybsddb-users

--
components: Extension Modules
messages: 61871
nosy: jcea
severity: normal
status: open
title: pybsddb leak in using cursors

__
Tracker <[EMAIL PROTECTED]>

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



[issue1976] pybsddb leak in using cursors

2008-01-30 Thread Jesús Cea Avión

Changes by Jesús Cea Avión:


--
severity: normal -> major
type:  -> resource usage

__
Tracker <[EMAIL PROTECTED]>

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



[issue799104] CPPFLAGS should not be aded to ldshard command

2008-01-30 Thread Raghuram Devarakonda

Raghuram Devarakonda added the comment:

For the record, the latest Lib/distutils/sysconfig.py still seems to
have this behaviour (please correct me if I am wrong). I am closing this
as there is no activity for quite some time.

--
nosy: +draghuram
resolution:  -> wont fix
status: open -> closed
type:  -> behavior
versions: +Python 2.6


Tracker <[EMAIL PROTECTED]>


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



[issue1966] infinite loop in httplib

2008-01-30 Thread Jesús Cea Avión

Changes by Jesús Cea Avión:


--
nosy: +jcea

__
Tracker <[EMAIL PROTECTED]>

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



[issue1977] Python reinitialization test

2008-01-30 Thread Christian Heimes

New submission from Christian Heimes:

The patch adds a new test and a new executable. The executable calls
Py_Initialze() and Py_Finalize() multiple times in a row. The test also
shows that Python looses about 35 references in each round.

$ ./test_reinit
round 1
[7751 refs]
round 2
[7797 refs]
round 3
[7834 refs]
round 4
[7871 refs]
round 5
[7908 refs]
round 6
[7945 refs]
round 7
[7982 refs]
round 8
[8019 refs]
round 9
[8056 refs]
round 10
[8093 refs]

--
components: Build, Interpreter Core
files: test_reinit.patch
keywords: patch
messages: 61873
nosy: tiran
priority: normal
severity: normal
status: open
title: Python reinitialization test
type: rfe
versions: Python 2.6, Python 3.0
Added file: http://bugs.python.org/file9334/test_reinit.patch

__
Tracker <[EMAIL PROTECTED]>

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



[issue1966] infinite loop in httplib

2008-01-30 Thread Mike Klaas

Mike Klaas added the comment:

I wouldn't advocate that it go in to 2.3/2.4.  The only security issue is 
a possible DoS, but I think that is unlikely.  There is already an "attack 
vector" for python code using (timeout-less) httplib by simply returning 
the response very slowly (1byte/sec).

__
Tracker <[EMAIL PROTECTED]>

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



[issue1966] infinite loop in httplib

2008-01-30 Thread Martin v. Löwis

Changes by Martin v. Löwis:


--
versions:  -Python 2.3, Python 2.4

__
Tracker <[EMAIL PROTECTED]>

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



[issue1977] Python reinitialization test

2008-01-30 Thread Martin v. Löwis

Martin v. Löwis added the comment:

I'm not sure what the purpose of this test is. When would it pass, when
would it fail? I don't think it is a bug if a
Py_Initialize()/Py_Finalize() cycle loses references.

--
nosy: +loewis

__
Tracker <[EMAIL PROTECTED]>

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



[issue1977] Python reinitialization test

2008-01-30 Thread Christian Heimes

Christian Heimes added the comment:

Martin v. Löwis wrote:
> Martin v. Löwis added the comment:
> 
> I'm not sure what the purpose of this test is. When would it pass, when
> would it fail? I don't think it is a bug if a
> Py_Initialize()/Py_Finalize() cycle loses references.

Today my attempts to fix some reference leaks related to sys.flags and
sys.float_info caused the test to fail. A single init/final cycle worked
but the second cycle broke.

The test also shows an issue in Python 3.0. The double linked reference
list is broken:

$ ./test_reinit
round 1
[24676 refs]
round 2
[25588 refs]
round 3
* ob
object  : 
type: str
refcount: 0
address : 0x82248e8
* op->_ob_prev->_ob_next
object  : 
type: str
refcount: 0
address : 0x82248e8
* op->_ob_next->_ob_prev
object  : bytearray(b'')
type: bytearray
refcount: 1
address : 0x839ab98
Fatal Python error: UNREF invalid object
Aborted (core dumped)

__
Tracker <[EMAIL PROTECTED]>

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



[issue1771] Remove cmp parameter to list.sort() and builtin.sorted()

2008-01-30 Thread Raymond Hettinger

Raymond Hettinger added the comment:

Checked-in rev 60453.

__
Tracker <[EMAIL PROTECTED]>

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



[issue1771] Remove cmp parameter to list.sort() and builtin.sorted()

2008-01-30 Thread Raymond Hettinger

Changes by Raymond Hettinger:


--
status: open -> closed

__
Tracker <[EMAIL PROTECTED]>

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



[issue1234] semaphore errors on AIX 5.2

2008-01-30 Thread Marc-Andre Lemburg

Marc-Andre Lemburg added the comment:

Christian, could you apply this patch ? It needs a working autoconf 2.61
installation which I currently don't have.

The patch itself, does the trick, so should go in.

Thanks.

--
assignee: lemburg -> tiran

__
Tracker <[EMAIL PROTECTED]>

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



[issue1234] semaphore errors on AIX 5.2

2008-01-30 Thread Christian Heimes

Christian Heimes added the comment:

Fixed in r60464 (trunk) and r60465 (25)

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

__
Tracker <[EMAIL PROTECTED]>

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



[issue1978] Python(2.5.1) will be crashed when i use _ssl module in multi-threads environment in linux.

2008-01-30 Thread [EMAIL PROTECTED]

New submission from [EMAIL PROTECTED]:

Python-2.5.1 will be crashed when i use _ssl module in multi-threads 
environment in linux. the sample code looks as below(A https server is 
running on host which ip is "192.168.5.151" and many certificates and 
keys in PEM format are in the directory "./cert". These certificates 
and keys are ok because i can use them in a web browser like IE/
Firefox.):


--
#! /home/duxg/Download/soft/Python-2.5.1/python
#
#   filename: test.py
#
'''This script simulates the behaviors of a https client.'''

import threading
import httplib

class HTTPSClient(threading.Thread):
def __init__(self, server_ip, url, cert_file, key_file):
threading.Thread.__init__(self)
# get run parameters 
self.server_ip = server_ip
self.url = url 
self.cert_file = cert_file
self.key_file = key_file

def get(self):
# make headers
headers = {'User-Agent': 'https_test/[EMAIL PROTECTED]', 
   'Connection': 'close'
  }
# use httplib
conn = httplib.HTTPSConnection('%s' % self.server_ip, \
   key_file = self.key_file, \
   cert_file = self.cert_file)
# http get
conn.request('GET', self.url, headers = headers)
resp = conn.getresponse()
# check response
if resp.status != 200:
print 'get(%s) failed/status=%d.' % (self.url, resp.status)
return False
return True

def run(self):
while True:
self.get()

def main():
worker_number = 100

threading.stack_size(512 * 1024)
worker = []
for i in range(worker_number):
# create worker thread
worker.append(HTTPSClient('192.168.5.151', '/test.html', \
  './cert/testu%d.cert' % i, \
  './cert/testu%d.key' % i))
for w in worker:
# go
w.start()
for w in worker:
# wait
w.join()

main()

--

  This code will be produced a lot of exceptions and finally it will 
cause Python crashed.


--
Exception in thread Thread-19:
Traceback (most recent call last):
  File "/home/duxg/Download/soft/Python-2.5.1/Lib/threading.py", line 
460, in __bootstrap
self.run()
  File "./test.py", line 39, in run
self.get()
  File "./test.py", line 29, in get
conn.request('GET', self.url, headers = headers)
  File "/home/duxg/Download/soft/Python-2.5.1/Lib/httplib.py", line 
862, in request
self._send_request(method, url, body, headers)
  File "/home/duxg/Download/soft/Python-2.5.1/Lib/httplib.py", line 
885, in _send_request
self.endheaders()
  File "/home/duxg/Download/soft/Python-2.5.1/Lib/httplib.py", line 
856, in endheaders
self._send_output()
  File "/home/duxg/Download/soft/Python-2.5.1/Lib/httplib.py", line 
728, in _send_output
self.send(msg)
  File "/home/duxg/Download/soft/Python-2.5.1/Lib/httplib.py", line 
695, in send
self.connect()
  File "/home/duxg/Download/soft/Python-2.5.1/Lib/httplib.py", line 
1131, in connect
ssl = socket.ssl(sock, self.key_file, self.cert_file)
  File "/home/duxg/Download/soft/Python-2.5.1/Lib/socket.py", line 74, 
in ssl
return _realssl(sock, keyfile, certfile)
sslerror: SSL_CTX_use_certificate_chain_file error

...

*** glibc detected *** /home/duxg/Download/soft/Python-2.5.1/python: 
double free or corruption (!prev): 0x0a2b71a0 ***
=== Backtrace: =
/lib/libc.so.6[0x887f41]
/lib/libc.so.6(cfree+0x90)[0x88b580]
/lib/libcrypto.so.6(CRYPTO_free+0x3a)[0x14f46a]
/lib/libcrypto.so.6(ERR_clear_error+0x73)[0x1a4d13]
/lib/libssl.so.6(SSL_CTX_use_certificate_chain_file+0x227)[0x358e47]
/home/duxg/Download/soft/Python-2.5.1/build/lib.linux-i686-2.5/
_ssl.so[0xb9eb9e]
/home/duxg/Download/soft/Python-2.5.1/
python(PyEval_EvalFrameEx+0x5d2c)[0x80c539c]
/home/duxg/Download/soft/Python-2.5.1/
python(PyEval_EvalCodeEx+0x775)[0x80c65d5]
/home/duxg/Download/soft/Python-2.5.1/
python(PyEval_EvalFrameEx+0x5419)[0x80c4a89]
/home/duxg/Download/soft/Python-2.5.1/
python(PyEval_EvalFrameEx+0x6155)[0x80c57c5]
/home/duxg/Download/soft/Python-2.5.1/
python(PyEval_EvalFrameEx+0x6155)[0x80c57c5]
/home/duxg/Download/soft/Python-2.5.1/
python(PyEval_EvalFrameEx+0x6155)[0x80c57c5]
/home/duxg/Download/soft/Python-2.5.1/
python(PyEval_EvalFrameEx+0x6155)[0x80c57c5]
/home/duxg/Download/soft/Python-2.5.1/
python(PyEval_EvalFrameEx+0x6155)[0x80c57c5]
/home/duxg/Download/soft/Python-2.5.1/
python(PyEval_EvalCodeEx+0x775)[0x80c65d5]
/home/duxg/Download/soft/Python-2.5.1/
python(PyEval_EvalFrameEx+0x5419)[0x80c4a89]
/home/duxg/Download/soft/Python-2.5.1/
python(PyEval_EvalFrameEx+0x6155)[0x80c57c5]
/home/dux

[issue1978] Python(2.5.1) will be crashed when i use _ssl module in multi-threads environment in linux.

2008-01-30 Thread Christian Heimes

Changes by Christian Heimes:


--
assignee:  -> janssen
components: +Extension Modules -None
keywords: +patch
nosy: +janssen
priority:  -> high

__
Tracker <[EMAIL PROTECTED]>

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



[issue1967] Backport dictviews to 2.6

2008-01-30 Thread Thomas Wouters

Changes by Thomas Wouters:


Removed file: http://bugs.python.org/file9320/dictviews_backport.diff

__
Tracker <[EMAIL PROTECTED]>

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



[issue1967] Backport dictviews to 2.6

2008-01-30 Thread Thomas Wouters

Thomas Wouters added the comment:

After talking to Guido, got rid of the future import magic in favour of
just providing 'viewkeys', 'viewitems' and 'viewvalues' methods of
dicts. This makes efficient 2.6-and-3.0 dict-using code possibly by
making 2to3 translate the view-methods directly to keys/values/items in
3.0, and not wrapping everything in list().

Added file: http://bugs.python.org/file9336/dictviews_backport.diff

__
Tracker <[EMAIL PROTECTED]>

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



[issue1905] PythonLauncher not working correctly on OS X 10.5/Leopad

2008-01-30 Thread Mark Dickinson

Mark Dickinson added the comment:

I can reproduce this in the trunk, on OS X 10.5.1/Intel:  after a

./configure --enable-framework && make && sudo make altinstall

ctrl-clicking on a simple python file on the Desktop and selecting OpenWith -> 
PythonLauncher fails to run the 
script and gives essentially the same messages in the console:

1/30/08 7:59:31 PM Python Launcher[23508] doscript: Could not activate Terminal
1/30/08 7:59:31 PM Python Launcher[23508] doscript: AESend(activate): error -600
1/30/08 7:59:31 PM Python Launcher[23508] Exit status: -600

Assigning this to Ronald Oussoren since he was the last person to touch 
PythonLauncher, so probably has a much 
better idea than me of what's going on.

I'm a complete newbie when it comes to AppleEvents and the like, but I'm 
suspicious of the lines

#define ACTIVATE_CMD 'misc'
#define ACTIVATE_SUITE 'actv'

in Mac/PythonLauncher/doscript.m;  perhaps I'm looking in the wrong place, but 
I can't find documentation for 
'actv' anywhere.

--
assignee:  -> ronaldoussoren
nosy: +marketdickinson, ronaldoussoren
versions: +Python 2.6

__
Tracker <[EMAIL PROTECTED]>

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



[issue1978] Python(2.5.1) will be crashed when i use _ssl module in multi-threads environment in linux.

2008-01-30 Thread Bill Janssen

Bill Janssen added the comment:

Thanks for the patch.

I'm of two minds about this.  It may well be an appropriate patch for
2.5.2 -- I seem to recall having to do something much like this in the
new SSL module -- but it patches the old SSL code which we are replacing
for 2.6.  And I'd recommend downloading and using the new SSL code from
PyPI with pre-2.6 Pythons instead of using the supplied support.  I'd
think, at the very least, this patch should include additions to the
test suite for socket_ssl before it's included.

--
nosy: +tiran
priority: high -> low

__
Tracker <[EMAIL PROTECTED]>

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



[issue1979] Make Decimal comparisons with NaN less arbitrary

2008-01-30 Thread Mark Dickinson

New submission from Mark Dickinson:

For Python 3.0 the decimal module got rich comparisons.  Those comparisons have 
somewhat unconventional 
behavior with respect to NaNs, as seen below:  <, <= and == comparisons 
involving NaNs always return False, 
while >, >= and != comparisons always return True.

The Decimal specification has nothing helpful to say about comparisons 
involving NaNs.  But reading IEEE-
754r (on which the Decimal specification is closely based), there are two 
possible options:

 (1) have comparisons involving NaNs (except for !=) raise InvalidOperation in 
the context, and hence give a 
Python exception (assuming that InvalidOperation isn't trapped.)

 (2) have comparisons involving NaNs always return False (except for !=, which 
always returns True).

I think either of these is better than the current behavior.  (2) seems like 
the better option, for a couple 
of reasons:  first, it's the way that Python floats currently work, and second, 
there might be issues with 
list membership testing if equality comparisons involving NaNs raised an 
exception or returned a NaN.

Since Mike Cowlishaw is intimately involved with both the Decimal specification 
and the IEEE-754r process, I 
thought it might be useful to have his opinion on this;  his main 
recommendation was to have the Decimal 
type do the same as the float type.

The attached patch makes <, <=, >, >= and == comparisons involving NaNs always 
return False, and != 
comparisons always return True.  It also renames __cmp__ to _cmp and adds a few 
tests for the new behavior.

Here's how NaN comparisons currently work:

Python 3.0a2+ (py3k:60470M, Jan 30 2008, 23:11:40) 
[GCC 4.0.1 (Apple Inc. build 5465)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from decimal import *
>>> n = Decimal("nan")
>>> i = Decimal("inf")
>>> n < n
False
>>> n > n
True
>>> i < n
False
>>> i > n
True

See also issue #1514428.

--
assignee: facundobatista
components: Library (Lib)
files: richcmp.patch
keywords: patch
messages: 61884
nosy: facundobatista, marketdickinson
severity: minor
status: open
title: Make Decimal comparisons with NaN less arbitrary
type: behavior
versions: Python 3.0
Added file: http://bugs.python.org/file9337/richcmp.patch

__
Tracker <[EMAIL PROTECTED]>

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



[issue1979] Make Decimal comparisons with NaN less arbitrary

2008-01-30 Thread Raymond Hettinger

Raymond Hettinger added the comment:

ISTM, you're now moving far beyond the spec into territory that isn't 
covered by tests or standards.  Is this necessary?

--
nosy: +rhettinger

__
Tracker <[EMAIL PROTECTED]>

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



[issue1545463] New-style classes fail to cleanup attributes

2008-01-30 Thread Alexander Belopolsky

Alexander Belopolsky added the comment:

The problem still exists in 2.5.1.

The explanations given so far are not correct. With x.py as before (see 
attached):

>>> import sys, gc, x
creating X('new')
creating X('old')
>>> del x,sys.modules['x']
deleting X('old')
>>> gc.collect()
deleting X('new')
6

which shows that the cycles in x module are resolvable by GC.

The problem is not that there are uncollectable objects but that GC is 
ran on exit before x becomes dead.

>>> import sys, gc, x
creating X('new')
creating X('old')
>>> gc.set_debug(1)
>>> sys.exit()
gc: collecting generation 2...
gc: objects in each generation: 463 2034 0
gc: done.
deleting X('old')


Looking at the comments in Py_Finalize, it looks like GvR intended to 
run GC after destroying the modules, but it led to problems:
(from svn blame Python/pythonrun.c)
 32278 gvanrossum 
  9025  guido   /* Destroy all modules */
  8403  guido   PyImport_Cleanup();
  9025  guido 
 32278 gvanrossum   /* Collect final garbage.  This disposes of 
cycles created by
 34776tim_one* new-style class definitions, for example.
 34776tim_one* XXX This is disabled because it caused too 
many problems.  If
 34776tim_one* XXX a __del__ or weakref callback triggers 
here, Python code has
 34776tim_one* XXX a hard time running, because even the sys 
module has been
 34776tim_one* XXX cleared out (sys.stdout is gone, 
sys.excepthook is gone, etc).
 34776tim_one* XXX One symptom is a sequence of information-
free messages
 34776tim_one* XXX coming from threads (if a __del__ or 
callback is invoked,
 34776tim_one* XXX other threads can execute too, and any 
exception they encounter
 34776tim_one* XXX triggers a comedy of errors as subsystem 
after subsystem
 34776tim_one* XXX fails to find what it *expects* to find 
in sys to help report
 34776tim_one* XXX the exception and consequent unexpected 
failures).  I've also
 34776tim_one* XXX seen segfaults then, after adding print 
statements to the
 34776tim_one* XXX Python code getting called.
 34776tim_one*/
 34776tim_one #if 0
 32278 gvanrossum   PyGC_Collect();
 34776tim_one #endif

Commenting out PyGC_Collect() seems like a too radical solution because  
no module referenced cycles get collected, not even those without 
__del__.

I have not tried it yet, but it looks like a possible solution is to 
call PyGC_Collect() at the end of _PyModule_Clear.

--
type:  -> resource usage
versions: +Python 2.5 -Python 2.4
Added file: http://bugs.python.org/file9338/x.py

_
Tracker <[EMAIL PROTECTED]>

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



[issue1014230] optparse: parser.remove_option("-h") inconsistency

2008-01-30 Thread Ralf Schmitt

Ralf Schmitt added the comment:

this test program work with python 2.4 and 2.5:

import optparse
p1=optparse.OptionParser()
p2=optparse.OptionParser()
p1.remove_option('-h')
p2.remove_option('-h')

This issue should be closed.

--
nosy: +schmir

_
Tracker <[EMAIL PROTECTED]>

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