[issue1562] Decimal can't be subclassed useful

2007-12-07 Thread Christian Heimes

Christian Heimes added the comment:

Can you create a patch that replaces Decimal with self.__class__ and the
string "Decimal" with "%s ..." % self.__class__.__name__? 

Thanks :)

--
assignee:  -> facundobatista
nosy: +facundobatista, tiran
priority:  -> normal
type:  -> behavior
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



[issue1564547] Py_signal_pipe

2007-12-07 Thread Gustavo J. A. M. Carneiro

Gustavo J. A. M. Carneiro added the comment:

"My understanding is that there are some things that the current patch
does not address."

Well, I don't know what those things are, so it's hard for me to address
them. :-)

_
Tracker <[EMAIL PROTECTED]>

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



[issue1567] Patch for new API method _PyImport_ImportModuleNoLock(char *name)

2007-12-07 Thread Christian Heimes

Changes by Christian Heimes:


--
assignee:  -> tiran
components: +IDLE, Interpreter Core
type:  -> behavior

__
Tracker <[EMAIL PROTECTED]>

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



[issue1567] Patch for new API method _PyImport_ImportModuleNoLock(char *name)

2007-12-07 Thread Christian Heimes

New submission from Christian Heimes:

The patch adds a new API method _PyImport_ImportModuleNoLock(const char
*name). It works mostly like PyImport_ImportModule except it does not
block. It tries to fetch the module from sys.modules first and falls
back to PyImport_ImportModule UNLESS the import lock is held by another
thread.

It fixes several issues related to dead locks when a thread uses a
function that imports a module but another thread holds the lock. It
doesn't require static caching of modules.

The patch is against py3k but I can backport it to 2.6.

--
files: import_nolock.diff
messages: 58272
nosy: gvanrossum, tiran
priority: normal
severity: normal
status: open
title: Patch for new API method _PyImport_ImportModuleNoLock(char *name)
versions: Python 2.6, Python 3.0
Added file: http://bugs.python.org/file/import_nolock.diff

__
Tracker <[EMAIL PROTECTED]>

__Index: Python/errors.c
===
--- Python/errors.c	(Revision 59405)
+++ Python/errors.c	(Arbeitskopie)
@@ -711,7 +711,7 @@
 {
 	PyObject *mod, *dict, *func = NULL;
 
-	mod = PyImport_ImportModule("warnings");
+	mod = _PyImport_ImportModuleNoLock("warnings");
 	if (mod != NULL) {
 		dict = PyModule_GetDict(mod);
 		func = PyDict_GetItemString(dict, "warn_explicit");
Index: Python/mactoolboxglue.c
===
--- Python/mactoolboxglue.c	(Revision 59405)
+++ Python/mactoolboxglue.c	(Arbeitskopie)
@@ -36,7 +36,7 @@
 	PyObject *m;
 	PyObject *rv;
 
-	m = PyImport_ImportModule("MacOS");
+	m = _PyImport_ImportModuleNoLock("MacOS");
 	if (!m) {
 		if (Py_VerboseFlag)
 			PyErr_Print();
Index: Python/ast.c
===
--- Python/ast.c	(Revision 59405)
+++ Python/ast.c	(Arbeitskopie)
@@ -56,7 +56,7 @@
identifier; if so, normalize to NFKC. */
 for (; *u; u++) {
 	if (*u >= 128) {
-	PyObject *m = PyImport_ImportModule("unicodedata");
+	PyObject *m = _PyImport_ImportModuleNoLock("unicodedata");
 	PyObject *id2;
 	if (!m)
 		return NULL;
Index: Python/import.c
===
--- Python/import.c	(Revision 59405)
+++ Python/import.c	(Arbeitskopie)
@@ -1895,6 +1895,53 @@
 	return result;
 }
 
+/* Import a module without blocking
+ *
+ * It tries to fetch the module from sys.modules. If the module was never
+ * loaded before it loads it with PyImport_ImportModule(), When the import
+ * lock is held by another thread it fails with an import error instead of
+ * blocking.
+ *
+ * Returns the module object with incremented ref count.
+ */
+PyObject *
+_PyImport_ImportModuleNoLock(const char *name)
+{
+	PyObject *result;
+	PyObject *modules;
+	long me;
+
+	/* Try to get the module from sys.modules[name] */
+	modules = PySys_GetObject("modules");
+	if (modules == NULL)
+		return NULL;
+
+	result = PyDict_GetItemString(modules, name);
+	if (result != NULL) {
+		Py_INCREF(result);
+		return result;
+	}
+	else {
+		PyErr_Clear();
+	}
+
+	/* check the import lock
+	   me might be -1 but I ignore the error here, the lock function
+	   takes care of the problem */
+	me = PyThread_get_thread_ident();
+	if (import_lock_thread == -1 || import_lock_thread == me) {
+		/* no thread or me is holding the lock */
+		return PyImport_ImportModule(name);
+	}
+	else {
+		PyErr_Format(PyExc_ImportError,
+			 "Failed to import %.200s because the import lock"
+			 "is held by another thread.",
+			 name);
+		return NULL;
+	}
+}
+
 /* Forward declarations for helper routines */
 static PyObject *get_parent(PyObject *globals, char *buf,
 			Py_ssize_t *p_buflen, int level);
Index: Python/bltinmodule.c
===
--- Python/bltinmodule.c	(Revision 59405)
+++ Python/bltinmodule.c	(Arbeitskopie)
@@ -261,7 +261,7 @@
 builtin_filter(PyObject *self, PyObject *args)
 {
 	PyObject *itertools, *ifilter, *result;
-	itertools = PyImport_ImportModule("itertools");
+	itertools = _PyImport_ImportModuleNoLock("itertools");
 	if (itertools == NULL)
 		return NULL;
 	ifilter = PyObject_GetAttrString(itertools, "ifilter");
@@ -776,7 +776,7 @@
 builtin_map(PyObject *self, PyObject *args)
 {
 	PyObject *itertools, *imap, *result;
-	itertools = PyImport_ImportModule("itertools");
+	itertools = _PyImport_ImportModuleNoLock("itertools");
 	if (itertools == NULL)
 		return NULL;
 	imap = PyObject_GetAttrString(itertools, "imap");
Index: Include/py_curses.h
===
--- Include/py_curses.h	(Revision 59405)
+++ Include/py_curses.h	(Arbeitskopie)
@@ -90,7 +90,7 @@
 
 #define import_curses() \
 { \
-  PyObject *module = PyImport_ImportModule("_curses"); \
+  PyObject *module = _PyImport_ImportModuleNoLock("_curses"); \
   if (

[issue1566] sock_type doesn't have GC although it can contain a PyObject*

2007-12-07 Thread Christian Heimes

New submission from Christian Heimes:

The socket object is defined in socketmodule.h as

typedef struct {
PyObject_HEAD
SOCKET_T sock_fd;   /* Socket file descriptor */
int sock_family;/* Address family, e.g., AF_INET */
int sock_type;  /* Socket type, e.g., SOCK_STREAM */
int sock_proto; /* Protocol type, usually 0 */
PyObject *(*errorhandler)(void); /* Error handler; checks
errno, returns NULL and
sets a Python exception */
double sock_timeout; /* Operation timeout in seconds;
0.0 means non-blocking */
} PySocketSockObject;

The PyTypeObject sock_type doesn't have support for cyclic GC. Shouldn't
types that can contain a PyObject* use GC?

--
components: Extension Modules
messages: 58270
nosy: tiran
priority: normal
severity: normal
status: open
title: sock_type doesn't have GC although it can contain a PyObject*
type: behavior
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



[issue1565] round(x,y) doesn't behave as expected, round error

2007-12-07 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc added the comment:

Please see
http://www.python.org/doc/faq/general/#why-are-floating-point-calculations-so-inaccurate

--
nosy: +amaury.forgeotdarc
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



[issue1568] PATCH: Armin's attribute lookup caching for 3.0

2007-12-07 Thread Christian Heimes

Changes by Christian Heimes:


--
keywords: +patch, py3k
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



[issue1566] sock_type doesn't have GC although it can contain a PyObject*

2007-12-07 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc added the comment:

But there is not PyObject* in this struct. errorhandler is a pointer to
a C function returning a PyObject*; it cannot create a reference cycle.

--
nosy: +amaury.forgeotdarc

__
Tracker <[EMAIL PROTECTED]>

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



[issue1565] round(x,y) doesn't behave as expected, round error

2007-12-07 Thread Shlomo Anglister

Shlomo Anglister added the comment:

>>> def my_round(n,i):
... t = n * (10**i)
... s = round(t)
... r = s / (10**i)
... return r
... 
>>> print my_round(s,2)
1.41

__
Tracker <[EMAIL PROTECTED]>

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



[issue1568] PATCH: Armin's attribute lookup caching for 3.0

2007-12-07 Thread Neil Toronto

New submission from Neil Toronto:

This is a half-port of the patches in #1685986 and #1700288 to Python
3.0. Speedups are about the same as in those patches applied to their
respective Python versions for minibenchmarks (included in the patch as
fastattr_test_py3k.py): 5%-30% or more depending on how deep the class
hierarchy is. Pybench takes 4% less time on my system, and pystone takes
6% less time.

(Pybench would do better, but SpecialClassAttribute runs long and spends
half its time setting class attributes.)

The main difference between this and the previous patches is that 3.0's
simplifications allow a smaller footprint and make it easier to analyze
its correctness. Specifically, the fact that every object in the MRO
must be a type allows us to assume that every attribute lookup is
cacheable, and allows integration into the update_subclasses mechanism
when attributes are set. The lack of compiled extension modules means
there is no flag to check to see whether a type object supports caching.

--
components: Interpreter Core
files: python30-attrcache.diff
messages: 58274
nosy: ntoronto
severity: normal
status: open
title: PATCH: Armin's attribute lookup caching for 3.0
type: rfe
versions: Python 3.0
Added file: http://bugs.python.org/file8889/python30-attrcache.diff

__
Tracker <[EMAIL PROTECTED]>

__Index: Python/pythonrun.c
===
--- Python/pythonrun.c	(revision 59400)
+++ Python/pythonrun.c	(working copy)
@@ -501,6 +501,9 @@
 
 	/* Cleanup Unicode implementation */
 	_PyUnicode_Fini();
+	
+	/* Report counts of attribute cache hits/misses (if enabled) */
+	PyType_Fini();
 
 	/* reset file system default encoding */
 	if (!Py_HasFileSystemDefaultEncoding) {
Index: Include/object.h
===
--- Include/object.h	(revision 59400)
+++ Include/object.h	(working copy)
@@ -373,6 +373,9 @@
 	PyObject *tp_subclasses;
 	PyObject *tp_weaklist;
 	destructor tp_del;
+	/* Unique cache ID per type, assigned when bases change (see
+	   mro_internal) */
+	PY_LONG_LONG tp_cache_id;
 
 #ifdef COUNT_ALLOCS
 	/* these must be last and never explicitly initialized */
Index: Include/pythonrun.h
===
--- Include/pythonrun.h	(revision 59400)
+++ Include/pythonrun.h	(working copy)
@@ -141,6 +141,7 @@
 PyAPI_FUNC(void) PyBytes_Fini(void);
 PyAPI_FUNC(void) PyFloat_Fini(void);
 PyAPI_FUNC(void) PyOS_FiniInterrupts(void);
+PyAPI_FUNC(void) PyType_Fini(void);
 
 /* Stuff with no proper home (yet) */
 PyAPI_FUNC(char *) PyOS_Readline(FILE *, FILE *, char *);
Index: fastattr_test_py3k.py
===
--- fastattr_test_py3k.py	(revision 0)
+++ fastattr_test_py3k.py	(revision 0)
@@ -0,0 +1,265 @@
+#!/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

[issue1566] sock_type doesn't have GC although it can contain a PyObject*

2007-12-07 Thread Christian Heimes

Christian Heimes added the comment:

uhm ... yeah, you are right.

I saw PyObject* and didn't though about the rest.

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



[issue1569] Add VS CRT redist to the MSI installer

2007-12-07 Thread Christian Heimes

New submission from Christian Heimes:

The 3.0a2 installer requires the user to install the VS CRT library
manually. 3.0a3 and 2.6a1 should automate the installation of vsredist
somehow.

--
components: Installation, Windows
keywords: py3k
messages: 58278
nosy: jorend, loewis, tiran
priority: high
severity: normal
status: open
title: Add VS CRT redist to the MSI installer
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



[issue1266570] PEP 349: allow str() to return unicode

2007-12-07 Thread Alexandre Vassalotti

Alexandre Vassalotti added the comment:

The PEP has been deferred and the patch is out of date.  So, is this
change still wanted?

--
nosy: +alexandre.vassalotti
resolution:  -> out of date

_
Tracker <[EMAIL PROTECTED]>

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



[issue1530] doctest should return error if not all tests passed

2007-12-07 Thread Alexandre Vassalotti

Alexandre Vassalotti added the comment:

Committed in r59411. Thanks!

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



[issue1570] Backport sys.maxsize to Python 2.6

2007-12-07 Thread Christian Heimes

Christian Heimes added the comment:

Good idea! I've created a GHOP task and waiting for approval. I'll
shepherd the task.

__
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-07 Thread Mark Dickinson

Mark Dickinson added the comment:

It's not clear to me that this would be the right behaviour.  Unless I'm 
missing something, Decimal behaves in just the same way as types like 
int, float and str in this respect:

>>> class myint(int): pass
... 
>>> a = myint(2)
>>> b = myint(3)
>>> a+b
5
>>> type(_)


Tim Peters had something to say on this subject at:

http://mail.python.org/pipermail/python-list/2005-January/300791.html

--
nosy: +marketdickinson

__
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-07 Thread Guido van Rossum

Changes by Guido van Rossum:


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

__
Tracker <[EMAIL PROTECTED]>

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



[issue1570] Backport sys.maxsize to Python 2.6

2007-12-07 Thread Guido van Rossum

Guido van Rossum added the comment:

Maybe suggest this as a GHOP task?

--
nosy: +gvanrossum
priority: high -> normal

__
Tracker <[EMAIL PROTECTED]>

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



[issue1565] round(x,y) doesn't behave as expected, round error

2007-12-07 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc added the comment:

Your function is not better:

>>> print my_round(s,2)
1.41
>>> my_round(s,2)
1.4099

print uses str(), and restricts itself to 12 significant digits.
the direct call uses repr(), and display the most precise number.

The problem is not in the computation, but is inherent to the 'float'
type which cannot represent 1.41 exactly. Please carefully read the faq
entry above.

__
Tracker <[EMAIL PROTECTED]>

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



[issue1565] round(x,y) doesn't behave as expected, round error

2007-12-07 Thread Shlomo Anglister

New submission from Shlomo Anglister:

#Round is unexpectedly wrong
>>> z = complex(1,1)
>>> s=abs(z)
>>> round(s,2)
1.4099

--
components: Interpreter Core
messages: 58266
nosy: shlomoa
severity: normal
status: open
title: round(x,y) doesn't behave as expected, round error
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-07 Thread Guido van Rossum

Guido van Rossum added the comment:

Don't worry, I did back it out before releasing 3.0a2.

I believe I hacked your code a bit before checking it in (or after you
checked it in, can't remember).

Did you see my bug report with a TypeError?

__
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-07 Thread Guido van Rossum

Changes by Guido van Rossum:


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

__
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-07 Thread Bill Janssen

Bill Janssen added the comment:

I'm still not sure what the problem is.  This code was working fine when I
committed it, no leaks, so something else must have changed under the
covers.  I don't believe that adding GC to the C code is the answer; it
should be automatically GC'd.  So I'd back that patch out.

I intend to wolf-fence the tests in the test module until I find a single
test that causes the leaks.  Sorry I haven't had time to look at this
earlier, but we're in the middle of a big presentation afternoon here at
work.

On Dec 6, 2007 11:45 AM, Christian Heimes <[EMAIL PROTECTED]> wrote:

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

Added file: http://bugs.python.org/file8892/unnamed

__
Tracker <[EMAIL PROTECTED]>

__I'm still not sure what the problem is.  This code was working fine 
when I committed it, no leaks, so something else must have changed under the 
covers.  I don't believe that adding GC to the C code is the answer; 
it should be automatically GC'd.  So I'd back that patch out.
I intend to wolf-fence the tests in the test module until I find a 
single test that causes the leaks.  Sorry I haven't had time to look 
at this earlier, but we're in the middle of a big presentation afternoon 
here at work.
On Dec 6, 2007 11:45 AM, Christian Heimes 
[EMAIL PROTECTED]> 
wrote:
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 patchrequires some redesign of the ssl 
interface. It's definitely too late now.
Christian__Tracker [EMAIL PROTECTED]>
http://bugs.python.org/issue1469>__

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



[issue1568] PATCH: Armin's attribute lookup caching for 3.0

2007-12-07 Thread Neil Toronto

Neil Toronto added the comment:

This patch adds the ability to invalidate all of a subclasses' cache
entries upon setattr rather than updating just one cache entry. It's not
clear which of these is the Right Thing To Do, so I've made it an #ifdef
for now. It defaults to updating.

Added file: http://bugs.python.org/file8891/python30-attrcache-1.diff

__
Tracker <[EMAIL PROTECTED]>

__Index: Python/pythonrun.c
===
--- Python/pythonrun.c	(revision 59400)
+++ Python/pythonrun.c	(working copy)
@@ -501,6 +501,9 @@
 
 	/* Cleanup Unicode implementation */
 	_PyUnicode_Fini();
+	
+	/* Report counts of attribute cache hits/misses (if enabled) */
+	PyType_Fini();
 
 	/* reset file system default encoding */
 	if (!Py_HasFileSystemDefaultEncoding) {
Index: Include/object.h
===
--- Include/object.h	(revision 59400)
+++ Include/object.h	(working copy)
@@ -373,6 +373,9 @@
 	PyObject *tp_subclasses;
 	PyObject *tp_weaklist;
 	destructor tp_del;
+	/* Unique cache ID per type, assigned when bases change (see
+	   mro_internal) */
+	PY_LONG_LONG tp_cache_id;
 
 #ifdef COUNT_ALLOCS
 	/* these must be last and never explicitly initialized */
Index: Include/pythonrun.h
===
--- Include/pythonrun.h	(revision 59400)
+++ Include/pythonrun.h	(working copy)
@@ -141,6 +141,7 @@
 PyAPI_FUNC(void) PyBytes_Fini(void);
 PyAPI_FUNC(void) PyFloat_Fini(void);
 PyAPI_FUNC(void) PyOS_FiniInterrupts(void);
+PyAPI_FUNC(void) PyType_Fini(void);
 
 /* Stuff with no proper home (yet) */
 PyAPI_FUNC(char *) PyOS_Readline(FILE *, FILE *, char *);
Index: fastattr_test_py3k.py
===
--- fastattr_test_py3k.py	(revision 0)
+++ fastattr_test_py3k.py	(revision 0)
@@ -0,0 +1,265 @@
+#!/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.__cla

[issue1530] doctest should return error if not all tests passed

2007-12-07 Thread Alexandre Vassalotti

Alexandre Vassalotti added the comment:

Looks good to me. Here's slightly modified patch ready to be committed.

--
keywords: +patch
nosy: +alexandre.vassalotti
priority:  -> low
Added file: http://bugs.python.org/file8893/doctest.patch

__
Tracker <[EMAIL PROTECTED]>

__Index: Lib/doctest.py
===
--- Lib/doctest.py	(revision 59409)
+++ Lib/doctest.py	(working copy)
@@ -2657,12 +2657,15 @@
 sys.path.insert(0, dirname)
 m = __import__(filename[:-3])
 del sys.path[0]
-testmod(m)
+failures, _ = testmod(m)
 else:
-testfile(filename, module_relative=False)
+failures, _ = testfile(filename, module_relative=False)
+if failures:
+return 1
 else:
 r = unittest.TextTestRunner()
 r.run(DocTestSuite())
+return 0
 
 if __name__ == "__main__":
-_test()
+sys.exit(_test())
___
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue1569] Add VS CRT redist to the MSI installer

2007-12-07 Thread Martin v. Löwis

Martin v. Löwis added the comment:

I tried running vcredist from within the python MSI. That aborts with
error message that it can't run another installer while one is already
running.

__
Tracker <[EMAIL PROTECTED]>

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



[issue1110] Problems with the msi installer - python-3.0a1.msi

2007-12-07 Thread Vlastimil Brom

Vlastimil Brom added the comment:

I just installed python-3.0a2 and it works fine for me (Win XPh SP2 
Czech; python3 directory C:\Python30). Sofar I haven't found any 
problems other than those mentioned in the release notes.
Thank you very much for fixing this!

__
Tracker <[EMAIL PROTECTED]>

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



[issue914148] xml.sax segfault on error

2007-12-07 Thread Facundo Batista

Facundo Batista added the comment:

There's no crash in 2.5.1 neither in the trunk.

As 2.3 or 2.4 won't be fixed, do you think that this bug can be closed?

Thanks!

--
nosy: +facundobatista


Tracker <[EMAIL PROTECTED]>


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



[issue1570] Backport sys.maxsize to Python 2.6

2007-12-07 Thread Christian Heimes

New submission from Christian Heimes:

Reminder for me and myself

--
assignee: tiran
components: Interpreter Core
messages: 58279
nosy: tiran
priority: high
severity: normal
status: open
title: Backport sys.maxsize to Python 2.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



[issue1568] PATCH: Armin's attribute lookup caching for 3.0

2007-12-07 Thread Raymond Hettinger

Raymond Hettinger added the comment:

Recommend holding-off on applying this one until I've reviewed and
applied the Py2.6 version.

--
assignee:  -> rhettinger
nosy: +rhettinger

__
Tracker <[EMAIL PROTECTED]>

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