[issue1561] py3k: test_mailbox fails on Windows

2007-12-06 Thread Amaury Forgeot d'Arc

New submission from Amaury Forgeot d'Arc:

test_mailbox keeps failing on Windows, due to line-ending issues.
Difficult things began when the files started to open in text mode.

Trying to list problems:
- mailbox.py works with differences of tell() results, and uses this to
as an argument to read(). This is wrong for two reasons: tell() returns
an offset in the file, and mixes this with the codec status.
- _PartialFile (a narrowed view of a file) does not work, for the same
kinds of reasons.

--
components: Windows
messages: 58238
nosy: amaury.forgeotdarc
severity: normal
status: open
title: py3k: test_mailbox fails on Windows
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



[issue1336] subprocess.Popen hangs when child writes to stderr

2007-12-06 Thread Thomas Herve

Thomas Herve added the comment:

FWIW, we encountered roughly the same problem in Twisted. However, we
fixed it by disabling gc *before* fork, because the gc can occur just
after the fork. See http://twistedmatrix.com/trac/ticket/2483 for the
bug report, and http://twistedmatrix.com/trac/changeset/21686 for the
solution.

--
nosy: +therve

__
Tracker <[EMAIL PROTECTED]>

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



[issue1561] py3k: test_mailbox fails on Windows

2007-12-06 Thread Christian Heimes

Changes by Christian Heimes:


--
nosy: +tiran
priority:  -> normal

__
Tracker <[EMAIL PROTECTED]>

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



[issue1285940] socket intial recv() latency

2007-12-06 Thread Armin Rigo

Changes by Armin Rigo:


--
resolution:  -> invalid
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



[issue1469] SSL tests leak memory

2007-12-06 Thread Christian Heimes

Christian Heimes added the comment:

I can reproduce the problem when I run the ssl tests with -unetwork.

I've used PYTHONDUMREFS and combinerefs.py to find the leaking objects.
I'm seeing lots of

0x9fd3e4c [1] SSLSocket
0x9fd2928 [1] ssl.SSLContext 
0x9fd5b74 [1] dict {'certfile': None, '_sslobj': , 'do_handshake_on_con
nect': True, 'ssl_version': 1, '_base': None, 'cert_reqs': 2,
'ca_certs': '/home/heimes/dev/python/py3k/Lib
/test/https_svn_python_org_root.pem', 'keyfile': None,
'suppress_ragged_eofs': True}

in the output.

I guess the problem is connected to::

_ssl.sslwrap(self, server_side,
keyfile, certfile,
cert_reqs, ssl_version, ca_certs)

in Lib/ssl.py. I'm digging in

--
assignee: janssen -> tiran
nosy: +gvanrossum
priority: normal -> high

__
Tracker <[EMAIL PROTECTED]>

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



[issue1562] Decimal can't be subclassed useful

2007-12-06 Thread poelzi

New submission from poelzi:

The Decimal class doesn't use lookups through self to construct results 
in functions like __add__ to generate the resulting object. This makes 
subclassing Decimal more or less senseless since all methods have to be 
wrapped instead of overriding the __new__ and __init__ methods, which 
could be enough for immutable type.
Currently I'm implementing a Money class which is more or less a 
Decimal with addition currency information. Because resulting Types 
generated with something like return Decimal(something) instead of 
self.__new__(...)

--
components: Library (Lib)
messages: 58241
nosy: poelzi
severity: normal
status: open
title: Decimal can't be subclassed useful
versions: Python 2.5

__
Tracker <[EMAIL PROTECTED]>

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



[issue1469] SSL tests leak memory

2007-12-06 Thread Christian Heimes

Christian Heimes added the comment:

I may have found the error. The PySSL_Type doesn't support GC but it
should in order to clean up self->Socket. 

I've started to fix it but I don't have time to work on the problem 'til
tonight. The patch causes a seg fault. I may have overlooked or
misunderstood something.

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread -1210324800 (LWP 31486)]
0x08127d03 in gc_list_remove (node=0x86d1cac) at Modules/gcmodule.c:158
158 node->gc.gc_prev->gc.gc_next = node->gc.gc_next;

Added file: http://bugs.python.org/file8884/ssl_gc.patch

__
Tracker <[EMAIL PROTECTED]>

__Index: Tools/scripts/combinerefs.py
===
--- Tools/scripts/combinerefs.py	(Revision 59376)
+++ Tools/scripts/combinerefs.py	(Arbeitskopie)
@@ -86,7 +86,8 @@
 break
 
 def combine(fname):
-f = file(fname)
+f = open(fname)
+
 fi = iter(f)
 
 for line in read(fi, re.compile(r'^Remaining objects:$'), False):
Index: Modules/_ssl.c
===
--- Modules/_ssl.c	(Revision 59376)
+++ Modules/_ssl.c	(Arbeitskopie)
@@ -1050,16 +1050,32 @@
 	return NULL;
 }
 
-static void PySSL_dealloc(PySSLObject *self)
+/* GC support. */
+static int
+PySSL_traverse(PySSLObject *self, visitproc visit, void *arg)
 {
+	Py_VISIT(self->Socket);
+	return 0;
+}
+
+static int
+PySSL_clear(PySSLObject *self)
+{
+	Py_CLEAR(self->Socket);
+	return 0;
+}
+
+static void
+PySSL_dealloc(PySSLObject *self)
+{
+	PySSL_clear(self);
 	if (self->peer_cert)	/* Possible not to have one? */
 		X509_free (self->peer_cert);
 	if (self->ssl)
 		SSL_free(self->ssl);
 	if (self->ctx)
 		SSL_CTX_free(self->ctx);
-	Py_XDECREF(self->Socket);
-	PyObject_Del(self);
+	Py_Type(self)->tp_free((PyObject *)self);
 }
 
 /* If the socket has a timeout, do a select()/poll() on the socket.
@@ -1372,7 +1388,7 @@
 	/* methods */
 	(destructor)PySSL_dealloc,	/*tp_dealloc*/
 	0,/*tp_print*/
-	(getattrfunc)PySSL_getattr,	/*tp_getattr*/
+	0,/*tp_getattr*/
 	0,/*tp_setattr*/
 	0,/*tp_compare*/
 	0,/*tp_repr*/
@@ -1380,6 +1396,32 @@
 	0,/*tp_as_sequence*/
 	0,/*tp_as_mapping*/
 	0,/*tp_hash*/
+	0,/* tp_call */
+	0,/* tp_str */
+	PyObject_GenericGetAttr,	/* tp_getattro */
+	0,/* tp_setattro */
+	0,/* tp_as_buffer */
+	Py_TPFLAGS_DEFAULT | 
+		Py_TPFLAGS_HAVE_GC,	/* tp_flags */
+	0,/* tp_doc */
+	(traverseproc)PySSL_traverse,	/* tp_traverse */
+	(inquiry)PySSL_clear,		/* tp_clear */
+	0,/* tp_richcompare */
+	0,/* tp_weaklistoffset */
+	0,/* tp_iter */
+	0,/* tp_iternext */
+	PySSLMethods,			/* tp_methods */
+	0,/* tp_members */
+	0,/* tp_getset */
+	0,/* tp_base */
+	0,/* tp_dict */
+	0,/* tp_descr_get */
+	0,/* tp_descr_set */
+	0,/* tp_dictoffset */
+	0,/* tp_init */
+	PyType_GenericAlloc,		/* tp_alloc */
+	PyType_GenericNew,		/* tp_new */
+	PyObject_GC_Del,		/* tp_free */
 };
 
 #ifdef HAVE_OPENSSL_RAND
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1469] SSL tests leak memory

2007-12-06 Thread Christian Heimes

Christian Heimes added the comment:

I found the problem! I've to use PyObject_GC_New instead of PyObject_New

__
Tracker <[EMAIL PROTECTED]>

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



[issue1469] SSL tests leak memory

2007-12-06 Thread Guido van Rossum

Guido van Rossum added the comment:

I get a segfault when I run it like this:

$ ./python.exe Lib/test/regrtest.py -uall test_ssl
test_ssl
Segmentation fault
$ 

(Without -uall it passes.)

__
Tracker <[EMAIL PROTECTED]>

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



[issue1469] SSL tests leak memory

2007-12-06 Thread Christian Heimes

Changes by Christian Heimes:


Removed file: http://bugs.python.org/file8884/ssl_gc.patch

__
Tracker <[EMAIL PROTECTED]>

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



[issue1469] SSL tests leak memory

2007-12-06 Thread Christian Heimes

Christian Heimes added the comment:

New patch

The new patch doesn't cause a seg fault but it doesn't help. It
*increases* the number of reference leaks.

test_ssl leaked [1610, 1610] references, sum=3220

Added file: http://bugs.python.org/file8885/ssl_gc.patch

__
Tracker <[EMAIL PROTECTED]>

__Index: Tools/scripts/combinerefs.py
===
--- Tools/scripts/combinerefs.py	(Revision 59376)
+++ Tools/scripts/combinerefs.py	(Arbeitskopie)
@@ -86,7 +86,8 @@
 break
 
 def combine(fname):
-f = file(fname)
+f = open(fname)
+
 fi = iter(f)
 
 for line in read(fi, re.compile(r'^Remaining objects:$'), False):
Index: Modules/_ssl.c
===
--- Modules/_ssl.c	(Revision 59376)
+++ Modules/_ssl.c	(Arbeitskopie)
@@ -266,7 +266,7 @@
 	int ret;
 	int verification_mode;
 
-	self = PyObject_New(PySSLObject, &PySSL_Type); /* Create new object */
+	self = PyObject_GC_New(PySSLObject, &PySSL_Type); /* Create new object */
 	if (self == NULL)
 		return NULL;
 	self->peer_cert = NULL;
@@ -385,6 +385,7 @@
 
 	self->Socket = Sock;
 	Py_INCREF(self->Socket);
+	_PyObject_GC_TRACK(self);
 	return self;
  fail:
 	if (errstr)
@@ -1050,16 +1051,33 @@
 	return NULL;
 }
 
-static void PySSL_dealloc(PySSLObject *self)
+/* GC support. */
+static int
+PySSL_traverse(PySSLObject *self, visitproc visit, void *arg)
 {
+	Py_VISIT(self->Socket);
+	return 0;
+}
+
+static int
+PySSL_clear(PySSLObject *self)
+{
+	Py_CLEAR(self->Socket);
+	return 0;
+}
+
+static void
+PySSL_dealloc(PySSLObject *self)
+{
+	PyObject_GC_UnTrack(self);
 	if (self->peer_cert)	/* Possible not to have one? */
-		X509_free (self->peer_cert);
+		X509_free(self->peer_cert);
 	if (self->ssl)
 		SSL_free(self->ssl);
 	if (self->ctx)
 		SSL_CTX_free(self->ctx);
-	Py_XDECREF(self->Socket);
-	PyObject_Del(self);
+	PySSL_clear(self);
+	Py_Type(self)->tp_free((PyObject *)self);
 }
 
 /* If the socket has a timeout, do a select()/poll() on the socket.
@@ -1359,20 +1377,15 @@
 	{NULL, NULL}
 };
 
-static PyObject *PySSL_getattr(PySSLObject *self, char *name)
-{
-	return Py_FindMethod(PySSLMethods, (PyObject *)self, name);
-}
-
 static PyTypeObject PySSL_Type = {
 	PyVarObject_HEAD_INIT(NULL, 0)
-	"ssl.SSLContext",		/*tp_name*/
+	"_ssl.SSLContext",		/*tp_name*/
 	sizeof(PySSLObject),		/*tp_basicsize*/
 	0,/*tp_itemsize*/
 	/* methods */
 	(destructor)PySSL_dealloc,	/*tp_dealloc*/
 	0,/*tp_print*/
-	(getattrfunc)PySSL_getattr,	/*tp_getattr*/
+	0,/*tp_getattr*/
 	0,/*tp_setattr*/
 	0,/*tp_compare*/
 	0,/*tp_repr*/
@@ -1380,6 +1393,32 @@
 	0,/*tp_as_sequence*/
 	0,/*tp_as_mapping*/
 	0,/*tp_hash*/
+	0,/* tp_call */
+	0,/* tp_str */
+	PyObject_GenericGetAttr,	/* tp_getattro */
+	0,/* tp_setattro */
+	0,/* tp_as_buffer */
+	Py_TPFLAGS_DEFAULT | 
+		Py_TPFLAGS_HAVE_GC,	/* tp_flags */
+	0,/* tp_doc */
+	(traverseproc)PySSL_traverse,	/* tp_traverse */
+	(inquiry)PySSL_clear,		/* tp_clear */
+	0,/* tp_richcompare */
+	0,/* tp_weaklistoffset */
+	0,/* tp_iter */
+	0,/* tp_iternext */
+	PySSLMethods,			/* tp_methods */
+	0,/* tp_members */
+	0,/* tp_getset */
+	0,/* tp_base */
+	0,/* tp_dict */
+	0,/* tp_descr_get */
+	0,/* tp_descr_set */
+	0,/* tp_dictoffset */
+	0,/* tp_init */
+	PyType_GenericAlloc,		/* tp_alloc */
+	PyType_GenericNew,		/* tp_new */
+	PyObject_GC_Del,		/* tp_free */
 };
 
 #ifdef HAVE_OPENSSL_RAND
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1469] SSL tests leak memory

2007-12-06 Thread Christian Heimes

Changes by Christian Heimes:


Removed file: http://bugs.python.org/file8885/ssl_gc.patch

__
Tracker <[EMAIL PROTECTED]>

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



[issue1469] SSL tests leak memory

2007-12-06 Thread Christian Heimes

Christian Heimes added the comment:

The new patch works and fixes the ref leak. I had to move the call
self._real_close() from __del__ to PySSL_dealloc(). I don't know if you
are going to like it. :]

Added file: http://bugs.python.org/file8886/ssl_gc.patch

__
Tracker <[EMAIL PROTECTED]>

__Index: Tools/scripts/combinerefs.py
===
--- Tools/scripts/combinerefs.py	(Revision 59376)
+++ Tools/scripts/combinerefs.py	(Arbeitskopie)
@@ -86,7 +86,8 @@
 break
 
 def combine(fname):
-f = file(fname)
+f = open(fname)
+
 fi = iter(f)
 
 for line in read(fi, re.compile(r'^Remaining objects:$'), False):
Index: Lib/ssl.py
===
--- Lib/ssl.py	(Revision 59376)
+++ Lib/ssl.py	(Arbeitskopie)
@@ -148,6 +148,10 @@
 self.do_handshake_on_connect = do_handshake_on_connect
 self.suppress_ragged_eofs = suppress_ragged_eofs
 
+# See Modules/_ssl.c:PySSL_dealloc()
+# def __del__(self):
+#self._real_close()
+
 def dup(self):
 raise NotImplemented("Can't dup() %s instances" %
  self.__class__.__name__)
@@ -300,6 +304,7 @@
 socket.shutdown(self, how)
 
 def _real_close(self):
+# real close is called by Modules/_ssl.c:PySSL_dealloc()
 self._sslobj = None
 # self._closed = True
 if self._base:
@@ -348,10 +353,6 @@
   self.do_handshake_on_connect),
 addr)
 
-
-def __del__(self):
-self._real_close()
-
 def wrap_socket(sock, keyfile=None, certfile=None,
 server_side=False, cert_reqs=CERT_NONE,
 ssl_version=PROTOCOL_SSLv23, ca_certs=None,
Index: Modules/_ssl.c
===
--- Modules/_ssl.c	(Revision 59376)
+++ Modules/_ssl.c	(Arbeitskopie)
@@ -266,7 +266,7 @@
 	int ret;
 	int verification_mode;
 
-	self = PyObject_New(PySSLObject, &PySSL_Type); /* Create new object */
+	self = PyObject_GC_New(PySSLObject, &PySSL_Type); /* Create new object */
 	if (self == NULL)
 		return NULL;
 	self->peer_cert = NULL;
@@ -385,6 +385,7 @@
 
 	self->Socket = Sock;
 	Py_INCREF(self->Socket);
+	_PyObject_GC_TRACK(self);
 	return self;
  fail:
 	if (errstr)
@@ -1050,16 +1051,41 @@
 	return NULL;
 }
 
-static void PySSL_dealloc(PySSLObject *self)
+/* GC support. */
+static int
+PySSL_traverse(PySSLObject *self, visitproc visit, void *arg)
 {
+	Py_VISIT(self->Socket);
+	return 0;
+}
+
+static int
+PySSL_clear(PySSLObject *self)
+{
+	Py_CLEAR(self->Socket);
+	return 0;
+}
+
+static void
+PySSL_dealloc(PySSLObject *self)
+{
+	PyObject *o;
+	PyObject *exc_type, *exc_value, *exc_tb;
+
+	PyErr_Fetch(&exc_type, &exc_value, &exc_tb);
+	o = PyObject_CallMethod((PyObject*)self, "_real_close", NULL);
+	Py_XDECREF(o);
+	PyErr_Restore(exc_type, exc_value, exc_tb);
+	
+	PyObject_GC_UnTrack(self);
 	if (self->peer_cert)	/* Possible not to have one? */
-		X509_free (self->peer_cert);
+		X509_free(self->peer_cert);
 	if (self->ssl)
 		SSL_free(self->ssl);
 	if (self->ctx)
 		SSL_CTX_free(self->ctx);
-	Py_XDECREF(self->Socket);
-	PyObject_Del(self);
+	Py_CLEAR(self->Socket);
+	Py_Type(self)->tp_free((PyObject *)self);
 }
 
 /* If the socket has a timeout, do a select()/poll() on the socket.
@@ -1359,20 +1385,15 @@
 	{NULL, NULL}
 };
 
-static PyObject *PySSL_getattr(PySSLObject *self, char *name)
-{
-	return Py_FindMethod(PySSLMethods, (PyObject *)self, name);
-}
-
 static PyTypeObject PySSL_Type = {
 	PyVarObject_HEAD_INIT(NULL, 0)
-	"ssl.SSLContext",		/*tp_name*/
+	"_ssl.SSLContext",		/*tp_name*/
 	sizeof(PySSLObject),		/*tp_basicsize*/
 	0,/*tp_itemsize*/
 	/* methods */
 	(destructor)PySSL_dealloc,	/*tp_dealloc*/
 	0,/*tp_print*/
-	(getattrfunc)PySSL_getattr,	/*tp_getattr*/
+	0,/*tp_getattr*/
 	0,/*tp_setattr*/
 	0,/*tp_compare*/
 	0,/*tp_repr*/
@@ -1380,6 +1401,32 @@
 	0,/*tp_as_sequence*/
 	0,/*tp_as_mapping*/
 	0,/*tp_hash*/
+	0,/* tp_call */
+	0,/* tp_str */
+	PyObject_GenericGetAttr,	/* tp_getattro */
+	0,/* tp_setattro */
+	0,/* tp_as_buffer */
+	Py_TPFLAGS_DEFAULT | 
+		Py_TPFLAGS_HAVE_GC,	/* tp_flags */
+	0,/* tp_doc */
+	(traverseproc)PySSL_traverse,	/* tp_traverse */
+	(inquiry)PySSL_clear,		/* tp_clear */
+	0,/* tp_richcompare */
+	0,/* tp_weaklistoffset */
+	0,/* tp_iter */
+	0,/* tp_iternext */
+	PySSLMethods,			/* tp_methods */
+	0,/* tp_members */
+	0,/* tp_getset */
+	0,/* tp_base */
+	0,/* tp_dict */
+	0,/* tp_descr_get */
+	0,/* tp_descr_set */
+	0,/* tp_dictoffset */
+	0,/* tp_init */
+	PyType_GenericAlloc,		/* tp_alloc */
+	PyType_GenericNew,		/* tp_new */
+	PyObject_GC_Del,		/* tp_free */
 };
 
 #ifdef HAVE_OPENSSL_RAND
___

[issue1469] SSL tests leak memory

2007-12-06 Thread Guido van Rossum

Guido van Rossum added the comment:

I will look at this in an hour or so, after I bring Orlijn to school
and drive to work.

__
Tracker <[EMAIL PROTECTED]>

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



[issue1525919] email package quoted printable behaviour changed

2007-12-06 Thread Roger Demetrescu

Roger Demetrescu added the comment:

I am not sure if it is related, but anyway...

MIMEText behaviour has changed from python 2.4 to 2.5.


# Python 2.4

>>> from email.MIMEText import MIMEText
>>> m = MIMEText(None, 'html', 'iso-8859-1')
>>> m.set_payload('abc ' * 50)
>>> print m
>From nobody Thu Dec  6 12:52:40 2007
Content-Type: text/html; charset="iso-8859-1"
MIME-Version: 1.0
Content-Transfer-Encoding: quoted-printable

abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc=
 abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc ab=
c abc abc abc abc abc abc abc abc abc abc abc abc=20








# Python 2.5

>>> from email.MIMEText import MIMEText
>>> m = MIMEText(None, 'html', 'iso-8859-1')
>>> m.set_payload('abc ' * 50)
>>> print m
>From nobody Thu Dec  6 14:46:07 2007
Content-Type: text/html; charset="iso-8859-1"
MIME-Version: 1.0
Content-Transfer-Encoding: quoted-printable

abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc
abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc
abc abc abc abc abc abc abc abc abc abc abc abc abc abc





However, if we initialize MIMEText with the text, we get the correct output:

# python 2.5

>>> from email.MIMEText import MIMEText
>>> m = MIMEText('abc ' * 50, 'html', 'iso-8859-1')
>>> print m
>From nobody Thu Dec  6 13:01:17 2007
Content-Type: text/html; charset="iso-8859-1"
MIME-Version: 1.0
Content-Transfer-Encoding: quoted-printable

abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc=
 abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc ab=
c abc abc abc abc abc abc abc abc abc abc abc abc=20



If I want to set payload after MIMEText is already created, I need to
use this workaround::

#python 2.5
from email.MIMEText import MIMEText
m = MIMEText(None, 'html', 'iso-8859-1')
m.set_payload(m._charset.body_encode('abc' * 50))


PS: The issue's versions field is filled with "Python 2.4". Shouldn't it
be "Python 2.5" ?

--
nosy: +rdemetrescu

_
Tracker <[EMAIL PROTECTED]>

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



[issue1469] SSL tests leak memory

2007-12-06 Thread Christian Heimes

Christian Heimes added the comment:

Guido van Rossum wrote:
> I will look at this in an hour or so, after I bring Orlijn to school
> and drive to work.

I found two problems with the _real_close() call in PySSL_dealloc. I'm
digging into it now.

o = PyObject_CallMethod((PyObject*)self->Socket, "_real_close", "");

Christian

__
Tracker <[EMAIL PROTECTED]>

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



[issue1469] SSL tests leak memory

2007-12-06 Thread Guido van Rossum

Guido van Rossum added the comment:

Oops, I just committed revision 59394.
Please advise.

--
priority: high -> immediate

__
Tracker <[EMAIL PROTECTED]>

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



[issue1563] asyncore and asynchat incompatible with Py3k str and bytes

2007-12-06 Thread Daniel Arbuckle

New submission from Daniel Arbuckle:

[EMAIL PROTECTED] is working up a patch for this.

--
components: Library (Lib)
messages: 58251
nosy: djarb
severity: normal
status: open
title: asyncore and asynchat incompatible with Py3k str and bytes
type: behavior
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



[issue1469] SSL tests leak memory

2007-12-06 Thread Guido van Rossum

Guido van Rossum added the comment:

I just reverted it. I put a bit of debugging in the call to
_real_close(), and even with Christian's corrections it fails miserably.
I prefer leaking.

__
Tracker <[EMAIL PROTECTED]>

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



[issue1469] SSL tests leak memory

2007-12-06 Thread Guido van Rossum

Guido van Rossum added the comment:

I'm giving up on this for now.  There are other weird bugs in the code,
e.g. this simple piece of code fails:

>>> x = urllib.urlopen("https://mail.google.com";).read()
Traceback (most recent call last):
  File "", line 1, in 
  File "/usr/local/google/home/guido/python/py3kd/Lib/io.py", line 463,
in read
return self.readall()
  File "/usr/local/google/home/guido/python/py3kd/Lib/io.py", line 473,
in readall
data = self.read(DEFAULT_BUFFER_SIZE)
  File "/usr/local/google/home/guido/python/py3kd/Lib/io.py", line 466,
in read
del b[n:]
TypeError: slice indices must be integers or None or have an __index__
method
[64813 refs]
>>>

The debugger tells me that 'n' contains a bytes object instead of an
int.  This appears due to the confused signature of _sslobj.read()
(which can behave as either read() or readinto()).  Its docstring is
wrong too.  We'll deal with this after 3.0a2 is released.

--
assignee: tiran -> janssen
priority: immediate -> normal

__
Tracker <[EMAIL PROTECTED]>

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



[issue1561] py3k: test_mailbox fails on Windows

2007-12-06 Thread Paul Moore

Paul Moore added the comment:

I believe that mailbox.py is expected to work with files opened in
binary mode. A long time ago I opened a bug on th email package
(http://bugs.python.org/issue586899) which turned out to be because
mailbox.py required binary mode files. The conclusion was that it
wouldn't be fixed (mainly because I couldn't work out a reasonable patch).

I could look again, but I doubt I'll be any better able to work out what
to do now...

--
nosy: +pmoore

__
Tracker <[EMAIL PROTECTED]>

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



[issue1469] SSL tests leak memory

2007-12-06 Thread Christian Heimes

Christian Heimes added the comment:

Guido van Rossum wrote:
> I just reverted it. I put a bit of debugging in the call to
> _real_close(), and even with Christian's corrections it fails miserably.
> I prefer leaking.

I agree! I've not enough time to work on the patch. A working patch
requires some redesign of the ssl interface. It's definitely too late now.

Christian

__
Tracker <[EMAIL PROTECTED]>

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



[issue1563] asyncore and asynchat incompatible with Py3k str and bytes

2007-12-06 Thread Christian Heimes

Changes by Christian Heimes:


--
keywords: +py3k
priority:  -> normal

__
Tracker <[EMAIL PROTECTED]>

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



[issue1564] The set implementation should special-case PyUnicode instead of PyString

2007-12-06 Thread Guido van Rossum

Changes by Guido van Rossum:


--
keywords: py3k
nosy: gvanrossum
severity: normal
status: open
title: The set implementation should special-case PyUnicode instead of PyString
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



[issue1564] The set implementation should special-case PyUnicode instead of PyString

2007-12-06 Thread Raymond Hettinger

New submission from Raymond Hettinger:

Much of the code in setobject.c exactly parallels that in dictobject.c.
 Ideally, we should keep that parallelism by scanning all of the changes
to dictobject.c and applying substantially similar changes to
setobject.c (just the changes that touch the hash tables, not the API
changes).

--
nosy: +rhettinger

__
Tracker <[EMAIL PROTECTED]>

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



[issue1564] The set implementation should special-case PyUnicode instead of PyString

2007-12-06 Thread Guido van Rossum

Guido van Rossum added the comment:

Would it make any sense at all to refactor the code so that code reuse
is automatic?

__
Tracker <[EMAIL PROTECTED]>

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



[issue1561] py3k: test_mailbox fails on Windows

2007-12-06 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc added the comment:

> mailbox.py is expected to work with files opened in binary mode
Not everywhere, unfortunately. Some files are still opened in text mode.
And this makes a huge difference with py3k: one accepts bytes, the other
requires strings.

__
Tracker <[EMAIL PROTECTED]>

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



[issue1564] The set implementation should special-case PyUnicode instead of PyString

2007-12-06 Thread Raymond Hettinger

Raymond Hettinger added the comment:

Not really, the implementations are different enough that it would be
*really* hard to keep common code.  The two parallel each other in a way
that is visually easy to translate but hard to do through real
refactoring.  For the most part, both code bases have historically been
very stable, so double maintenance hasn't been much of an issue.  My
last post was meant to suggest the cleanest way to do the Py3.0
string-->unicode switch modeling the set changes after those in dicts.  

FWIW, the reason that I put effort in to keeping the code as parallel as
possible was that it would save us mental clock cycles -- understanding
one implementation gives you most of the other for free.

__
Tracker <[EMAIL PROTECTED]>

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



[issue1564] The set implementation should special-case PyUnicode instead of PyString

2007-12-06 Thread Raymond Hettinger

Raymond Hettinger added the comment:

P.S. There is a way to factor-out some common code but it would entail
introducing a bunch of macros that hide the differences between the two.
 I don't think it would be worth it.

__
Tracker <[EMAIL PROTECTED]>

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



[issue1700288] Armin's method cache optimization updated for Python 2.6

2007-12-06 Thread Neil Toronto

Neil Toronto added the comment:

Attribute access that happens only once or very infrequently probably
shouldn't go through the cache machinery - it'll only slow things down.
(Updating slots for example.) Maybe _PyType_Lookup should remain the
same, with _PyType_CachingLookup added for attribute access via
type/instance getattr.

_
Tracker <[EMAIL PROTECTED]>

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



[issue1700288] Armin's method cache optimization updated for Python 2.6

2007-12-06 Thread Neil Toronto

Neil Toronto added the comment:

I've attached the microbenchmarks I was using for my own version of
attribute caching. For list, tuple, dict, and a deep hierarchy, it tests
accessing type attributes (cls.__class__), class attributes
(cls.__init__), class attributes via instance (inst.__class__), and
instance attributes (inst.__init__), using LOAD_ATTR and hasattr. It
also tests hasattr with missing attributes.

--
nosy: +ntoronto
Added file: http://bugs.python.org/file8887/fastattr_test.py

_
Tracker <[EMAIL PROTECTED]>

_#!/usr/bin/python

import timeit, random, time, sys

MULTIPLIER = 1


class A(object):
	def __init__(self, *args):
		pass

class B(A): pass

class C(B): pass

class D(C): pass

class E(D): pass

class F(E): pass

class G(F): pass

class H(G):
	def __init__(self):
		pass

class I(H): pass


def test_init(tmp):
	tmp.__init__; tmp.__init__; tmp.__init__; tmp.__init__; tmp.__init__
	tmp.__init__; tmp.__init__; tmp.__init__; tmp.__init__; tmp.__init__
	tmp.__init__; tmp.__init__; tmp.__init__; tmp.__init__; tmp.__init__
	tmp.__init__; tmp.__init__; tmp.__init__; tmp.__init__; tmp.__init__
	tmp.__init__; tmp.__init__; tmp.__init__; tmp.__init__; tmp.__init__
	tmp.__init__; tmp.__init__; tmp.__init__; tmp.__init__; tmp.__init__
	tmp.__init__; tmp.__init__; tmp.__init__; tmp.__init__; tmp.__init__
	tmp.__init__; tmp.__init__; tmp.__init__; tmp.__init__; tmp.__init__
	tmp.__init__; tmp.__init__; tmp.__init__; tmp.__init__; tmp.__init__
	tmp.__init__; tmp.__init__; tmp.__init__; tmp.__init__; tmp.__init__
	tmp.__init__; tmp.__init__; tmp.__init__; tmp.__init__; tmp.__init__
	tmp.__init__; tmp.__init__; tmp.__init__; tmp.__init__; tmp.__init__
	tmp.__init__; tmp.__init__; tmp.__init__; tmp.__init__; tmp.__init__
	tmp.__init__; tmp.__init__; tmp.__init__; tmp.__init__; tmp.__init__
	tmp.__init__; tmp.__init__; tmp.__init__; tmp.__init__; tmp.__init__
	tmp.__init__; tmp.__init__; tmp.__init__; tmp.__init__; tmp.__init__
	tmp.__init__; tmp.__init__; tmp.__init__; tmp.__init__; tmp.__init__
	tmp.__init__; tmp.__init__; tmp.__init__; tmp.__init__; tmp.__init__
	tmp.__init__; tmp.__init__; tmp.__init__; tmp.__init__; tmp.__init__
	tmp.__init__; tmp.__init__; tmp.__init__; tmp.__init__; tmp.__init__


def test_class(tmp):
	tmp.__class__; tmp.__class__; tmp.__class__; tmp.__class__; tmp.__class__
	tmp.__class__; tmp.__class__; tmp.__class__; tmp.__class__; tmp.__class__
	tmp.__class__; tmp.__class__; tmp.__class__; tmp.__class__; tmp.__class__
	tmp.__class__; tmp.__class__; tmp.__class__; tmp.__class__; tmp.__class__
	tmp.__class__; tmp.__class__; tmp.__class__; tmp.__class__; tmp.__class__
	tmp.__class__; tmp.__class__; tmp.__class__; tmp.__class__; tmp.__class__
	tmp.__class__; tmp.__class__; tmp.__class__; tmp.__class__; tmp.__class__
	tmp.__class__; tmp.__class__; tmp.__class__; tmp.__class__; tmp.__class__
	tmp.__class__; tmp.__class__; tmp.__class__; tmp.__class__; tmp.__class__
	tmp.__class__; tmp.__class__; tmp.__class__; tmp.__class__; tmp.__class__
	tmp.__class__; tmp.__class__; tmp.__class__; tmp.__class__; tmp.__class__
	tmp.__class__; tmp.__class__; tmp.__class__; tmp.__class__; tmp.__class__
	tmp.__class__; tmp.__class__; tmp.__class__; tmp.__class__; tmp.__class__
	tmp.__class__; tmp.__class__; tmp.__class__; tmp.__class__; tmp.__class__
	tmp.__class__; tmp.__class__; tmp.__class__; tmp.__class__; tmp.__class__
	tmp.__class__; tmp.__class__; tmp.__class__; tmp.__class__; tmp.__class__
	tmp.__class__; tmp.__class__; tmp.__class__; tmp.__class__; tmp.__class__
	tmp.__class__; tmp.__class__; tmp.__class__; tmp.__class__; tmp.__class__
	tmp.__class__; tmp.__class__; tmp.__class__; tmp.__class__; tmp.__class__
	tmp.__class__; tmp.__class__; tmp.__class__; tmp.__class__; tmp.__class__


def test_has_init(tmp):
	hasattr(tmp, '__init__'); hasattr(tmp, '__init__')
	hasattr(tmp, '__init__'); hasattr(tmp, '__init__')
	hasattr(tmp, '__init__'); hasattr(tmp, '__init__')
	hasattr(tmp, '__init__'); hasattr(tmp, '__init__')
	hasattr(tmp, '__init__'); hasattr(tmp, '__init__')
	hasattr(tmp, '__init__'); hasattr(tmp, '__init__')
	hasattr(tmp, '__init__'); hasattr(tmp, '__init__')
	hasattr(tmp, '__init__'); hasattr(tmp, '__init__')
	hasattr(tmp, '__init__'); hasattr(tmp, '__init__')
	hasattr(tmp, '__init__'); hasattr(tmp, '__init__')
	hasattr(tmp, '__init__'); hasattr(tmp, '__init__')
	hasattr(tmp, '__init__'); hasattr(tmp, '__init__')
	hasattr(tmp, '__init__'); hasattr(tmp, '__init__')
	hasattr(tmp, '__init__'); hasattr(tmp, '__init__')
	hasattr(tmp, '__init__'); hasattr(tmp, '__init__')
	hasattr(tmp, '__init__'); hasattr(tmp, '__init__')
	hasattr(tmp, '__init__'); hasattr(tmp, '__init__')
	hasattr(tmp, '__init__'); hasattr(tmp, '__init__')
	hasattr(tmp, '__init__'); hasattr(tmp, '__init__')
	hasattr(tmp, '__init__'); hasattr(tmp, '__init__')
	hasattr(tmp, '__init__'); hasattr(tmp, '__init__')

[issue1432] Strange behavior of urlparse.urljoin

2007-12-06 Thread Fantix King

Fantix King added the comment:

This issue also causes similar behavior on some libraries like mechanize
which depend on urljoin

--
nosy: +fantix

__
Tracker <[EMAIL PROTECTED]>

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



[issue1564547] Py_signal_pipe

2007-12-06 Thread Sean Reifschneider

Sean Reifschneider added the comment:

The thread at:

http://bugzilla.gnome.org/show_bug.cgi?id=481569

requests "attention" so I'm formally rejecting it.  :-)

My reading of the python-dev thread on this is that the current patch
does not reasonably fix the problem.  However, I'd like mwh and
anthonybaxters input on this.  What would we need to be able to accept
this patch?  My understanding is that there are some things that the
current patch does not address.  Should I bring it up on python-dev?

The current opinion in the python-dev thread seems to be that the
current solution would go into trunk rather than into a maint branch for
an existing release, so it's not going to be a quick fix in any case.

--
nosy: +anthonybaxter, jafo, mwh
resolution:  -> rejected
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



[issue1491] BaseHTTPServer incorrectly implements response code 100

2007-12-06 Thread samwyse

samwyse added the comment:

Refactoring sounds like a good idea.  Someone would need to check how
other web servers log this, if at all.  You're probably right about the
HTTP/0.9 as well.

The main reason to send a 100 response is because the client sent an
"Expect: 100-continue" header, and won't send data until either it
receives the header or a timeout expires.  The server is expected to
validate the received headers before sending the response, although it
is allowed to send it in any event.

__
Tracker <[EMAIL PROTECTED]>

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