Re: [Python-Dev] XXX - in funcobject.c

2008-02-06 Thread Kristján Valur Jónsson


> -Original Message-
> From: Amaury Forgeot d'Arc [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, February 06, 2008 00:02
> To: Guido van Rossum
> Cc: Kristján Valur Jónsson; python-dev@python.org
> Subject: Re: [Python-Dev] XXX - in funcobject.c
>
> Yet Another Kind Of Tuple... However this seems the correct thing to
> do.
>
> In addition, if we agree to restrict arguments names to str (and
> disallow subclasses), there are easy optimizations in
> PyEval_EvalCodeEx, somewhere around the "XXX slow" comment (!)

Super.  I think I'll do this myself and see if the crashes go away (even though 
I know that doesn't constitute a proof).
Also, allow me to suggest that we preallocate stack space for, say, 10 kwargs, 
to avoid the malloc for the common cases.


Kristján
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] Initial attempt to PyCon sprint tutorial slides are up

2008-02-06 Thread Facundo Batista
2008/2/4, Brett Cannon <[EMAIL PROTECTED]>:

> The 1 MB PDF can be found at
> http://www.cs.ubc.ca/~drifty/pycon/sprint_tutorial.pdf . If you find
> any bad info or some info that is really lacking, let me know. But

Brett, please tell me when you have a kind of finished version of
this... I want to send it to the Python Argentina mail list.

Thank you!

-- 
.Facundo

Blog: http://www.taniquetil.com.ar/plog/
PyAr: http://www.python.org/ar/
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


[Python-Dev] Limit free list of method and builtin function objects (was: [Python-checkins] r60614 - in python/trunk: Misc/NEWS Objects/classobject.c Objects/methodobject.c)

2008-02-06 Thread M.-A. Lemburg
Hi Christian,

could you explain how you came up with the 256 entry limit ?
It appears to be rather low and somehow arbitrary.

I understand that some limit is required, but since these
objects get created a lot (e.g. for bound methods), setting the
limit too low will significantly slow down the interpreter.

BTW: What does pybench have to say to this patch ?

To get an idea of how many objects are typically part of the
free list, I'd suggest running an application such as Zope for
a while and then check the maximum numfree value.

Thanks,
-- 
Marc-Andre Lemburg
eGenix.com

Professional Python Services directly from the Source  (#1, Feb 06 2008)
>>> Python/Zope Consulting and Support ...http://www.egenix.com/
>>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/
>>> mxODBC, mxDateTime, mxTextTools ...http://python.egenix.com/


 Try mxODBC.Zope.DA for Windows,Linux,Solaris,MacOSX for free ! 


   eGenix.com Software, Skills and Services GmbH  Pastor-Loeh-Str.48
D-40764 Langenfeld, Germany. CEO Dipl.-Math. Marc-Andre Lemburg
   Registered at Amtsgericht Duesseldorf: HRB 46611


On 2008-02-06 13:44, christian.heimes wrote:
> Author: christian.heimes
> Date: Wed Feb  6 13:44:34 2008
> New Revision: 60614
> 
> Modified:
>python/trunk/Misc/NEWS
>python/trunk/Objects/classobject.c
>python/trunk/Objects/methodobject.c
> Log:
> Limit free list of method and builtin function objects to 256 entries each.
> 
> Modified: python/trunk/Misc/NEWS
> ==
> --- python/trunk/Misc/NEWS(original)
> +++ python/trunk/Misc/NEWSWed Feb  6 13:44:34 2008
> @@ -12,6 +12,9 @@
>  Core and builtins
>  -
>  
> +- Limit free list of method and builtin function objects to 256 entries
> +  each.
> +
>  - Patch #1953: Added ``sys._compact_freelists()`` and the C API functions
>``PyInt_CompactFreeList`` and ``PyFloat_CompactFreeList``
>to compact the internal free lists of pre-allocted ints and floats.
> 
> Modified: python/trunk/Objects/classobject.c
> ==
> --- python/trunk/Objects/classobject.c(original)
> +++ python/trunk/Objects/classobject.cWed Feb  6 13:44:34 2008
> @@ -4,10 +4,16 @@
>  #include "Python.h"
>  #include "structmember.h"
>  
> +/* Free list for method objects to safe malloc/free overhead
> + * The im_self element is used to chain the elements.
> + */
> +static PyMethodObject *free_list;
> +static int numfree = 0;
> +#define MAXFREELIST 256
> +
>  #define TP_DESCR_GET(t) \
>  (PyType_HasFeature(t, Py_TPFLAGS_HAVE_CLASS) ? (t)->tp_descr_get : NULL)
>  
> -
>  /* Forward */
>  static PyObject *class_lookup(PyClassObject *, PyObject *,
> PyClassObject **);
> @@ -2193,8 +2199,6 @@
> In case (b), im_self is NULL
>  */
>  
> -static PyMethodObject *free_list;
> -
>  PyObject *
>  PyMethod_New(PyObject *func, PyObject *self, PyObject *klass)
>  {
> @@ -2207,6 +2211,7 @@
>   if (im != NULL) {
>   free_list = (PyMethodObject *)(im->im_self);
>   PyObject_INIT(im, &PyMethod_Type);
> + numfree--;
>   }
>   else {
>   im = PyObject_GC_New(PyMethodObject, &PyMethod_Type);
> @@ -2332,8 +2337,14 @@
>   Py_DECREF(im->im_func);
>   Py_XDECREF(im->im_self);
>   Py_XDECREF(im->im_class);
> - im->im_self = (PyObject *)free_list;
> - free_list = im;
> + if (numfree < MAXFREELIST) {
> + im->im_self = (PyObject *)free_list;
> + free_list = im;
> + numfree++;
> + }
> + else {
> + PyObject_GC_Del(im);
> + }
>  }
>  
>  static int
> @@ -2620,5 +2631,7 @@
>   PyMethodObject *im = free_list;
>   free_list = (PyMethodObject *)(im->im_self);
>   PyObject_GC_Del(im);
> + numfree--;
>   }
> + assert(numfree == 0);
>  }
> 
> Modified: python/trunk/Objects/methodobject.c
> ==
> --- python/trunk/Objects/methodobject.c   (original)
> +++ python/trunk/Objects/methodobject.c   Wed Feb  6 13:44:34 2008
> @@ -4,7 +4,12 @@
>  #include "Python.h"
>  #include "structmember.h"
>  
> +/* Free list for method objects to safe malloc/free overhead
> + * The m_self element is used to chain the objects.
> + */
>  static PyCFunctionObject *free_list = NULL;
> +static int numfree = 0;
> +#define MAXFREELIST 256
>  
>  PyObject *
>  PyCFunction_NewEx(PyMethodDef *ml, PyObject *self, PyObject *module)
> @@ -14,6 +19,7 @@
>   if (op != NULL) {
>   free_list = (PyCFunctionObject *)(op->m_self);
>   PyObject_INIT(op, &PyCFunction_Type);
> + numfree--;
>   }
>   else {
>   op 

Re: [Python-Dev] XXX - in funcobject.c

2008-02-06 Thread Guido van Rossum
On Feb 6, 2008 1:49 AM, Kristján Valur Jónsson <[EMAIL PROTECTED]> wrote:
>
>
> > -Original Message-
> > From: Amaury Forgeot d'Arc [mailto:[EMAIL PROTECTED]
> > Sent: Wednesday, February 06, 2008 00:02
> > To: Guido van Rossum
> > Cc: Kristján Valur Jónsson; python-dev@python.org
> > Subject: Re: [Python-Dev] XXX - in funcobject.c
> >
> > Yet Another Kind Of Tuple... However this seems the correct thing to
> > do.
> >
> > In addition, if we agree to restrict arguments names to str (and
> > disallow subclasses), there are easy optimizations in
> > PyEval_EvalCodeEx, somewhere around the "XXX slow" comment (!)
>
> Super.  I think I'll do this myself and see if the crashes go away (even 
> though I know that doesn't constitute a proof).
> Also, allow me to suggest that we preallocate stack space for, say, 10 
> kwargs, to avoid the malloc for the common cases.

Great idea! If you come up with a useful patch, can you attach it to
the appropriate bug issue? (issues 2015 and 2016 on bugs.python.org)

-- 
--Guido van Rossum (home page: http://www.python.org/~guido/)
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


[Python-Dev] bugs.pythong.org bug?

2008-02-06 Thread Joseph Armbruster
All,

I attempted to search for all issues created by me today so I could catch up
since i've been out of the loop for a bit.  I performed the following steps:

- went to bugs.python.org
- clicked search (on the lhs of the page)
- typed in josepharmbruster as creator
- clicked search

I will create an issue if deemed necessary.

Joseph Armbruster


*exceptions.KeyError*:

Debugging information follows

   1. While evaluating the standard:'request/batch' expression on line 23
   Current variables:
*templates*
   *repeat* *false*0 *context* *
   utils* *db* *nothing*None *i18n*<
   roundup.cgi.TranslationService.TranslationService instance at
   0x2ab2b759e200> *true*1 *default*<
   roundup.cgi.PageTemplates.TALES.Default instance at 0x2ab2b6353b90> *
   request*, 'classname':
   'issue', 'special_char': '@', 'dispname': None, 'group': [('+',
   'priority')], '_client': , 'template': 'index', 'input': , 'columns': ['title', 'id', 'activity', 'status'], 'sort':
   [('+', 'activity')], 'env': {'HTTP_AUTHORIZATION': None, 'SERVER_PORT':
   '8080', 'SERVER_NAME': 'localhost', 'HTTP_ACCEPT_LANGUAGE': 'en-us,en;q=
   0.5', 'SCRIPT_NAME': '', 'REQUEST_METHOD': 'GET', 'HTTP_HOST':
   'localhost:8080', 'PATH_INFO': 'issue', 'CONTENT_TYPE': 'text/plain',
   'QUERY_STRING':
   
'%40search_text=&title=&%40columns=title&id=&%40columns=id&creation=&creator=josepharmbruster&activity=&%40columns=activity&%40sort=activity&actor=&nosy=&type=&components=&versions=&severity=&dependencies=&assignee=&keywords=&priority=&%40group=priority&status=1&%40columns=status&resolution=&%40pagesize=50&%40startwith=0&%40action=search',
   'TRACKER_NAME': 'tracker'}, 'form': FieldStorage(None, None,
   [MiniFieldStorage('@columns', 'title'), MiniFieldStorage('@columns', 'id'),
   MiniFieldStorage('creator', 'josepharmbruster'),
   MiniFieldStorage('@columns', 'activity'), MiniFieldStorage('@sort',
   'activity'), MiniFieldStorage('@group', 'priority'),
   MiniFieldStorage('status', '1'), MiniFieldStorage('@columns', 'status'),
   MiniFieldStorage('@pagesize', '50'), MiniFieldStorage('@startwith', '0'),
   MiniFieldStorage('@action', 'search'), MiniFieldStorage('@filter',
   'creator'), MiniFieldStorage('@filter', 'status')]), 'nodeid': None, 'base':
   'http://bugs.python.org/', 'user': ,
   'search_text': None, 'pagesize': 50, 'filterspec': {'status': ['1'],
   'creator': []}, 'filter': ['creator', 'status'], 'client': <
   roundup.cgi.client.Client instance at 0x2ab2b759e128>}> *tracker*<
   roundup.instance.Tracker instance at 0x2ab2b64bccf8> *template* *config*<
   roundup.configuration.CoreConfig instance at 0x2ab2b64bcd40>
*options*{'ok_message':
   [], 'error_message': []} *loop*<
   roundup.cgi.PageTemplates.TALES.SafeMapping instance at
   0x2ab2b75ad9e0> *status_notresolved*'-1,1,3' *columns_showall*
   'id,activity,title,creator,assignee,status' *kw_create*0
*attrs*{'tal:define':
   'batch request/batch', 'tal:condition': 'context/is_view_ok'} *columns
   *'id,activity,title,creator,status'
   2. A problem occurred in your template "issue.index.html".

 Full traceback:

Traceback (most recent call last):
  File 
"/home/roundup/roundup-production//lib/python2.4/site-packages/roundup/cgi/client.py",
line 770, in renderContext
result = pt.render(self, None, None, **args)
  File 
"/home/roundup/roundup-production//lib/python2.4/site-packages/roundup/cgi/templating.py",
line 323, in render
getEngine().getContext(c), output, tal=1, strictinsert=0)()
  File 
"/home/roundup/roundup-production//lib/python2.4/site-packages/roundup/cgi/TAL/TALInterpreter.py",
line 192, in __call__
self.interpret(self.program)
  File 
"/home/roundup/roundup-production//lib/python2.4/site-packages/roundup/cgi/TAL/TALInterpreter.py",
line 236, in interpret
handlers[opcode](self, args)
  File 
"/home/roundup/roundup-production//lib/python2.4/site-packages/roundup/cgi/TAL/TALInterpreter.py",
line 666, in do_useMacro
self.interpret(macro)
  File 
"/home/roundup/roundup-production//lib/python2.4/site-packages/roundup/cgi/TAL/TALInterpreter.py",
line 236, in interpret
handlers[opcode](self, args)
  File 
"/home/roundup/roundup-production//lib/python2.4/site-packages/roundup/cgi/TAL/TALInterpreter.py",
line 411, in do_optTag_tal
self.do_optTag(stuff)
  File 
"/home/roundup/roundup-production//lib/python2.4/site-packages/roundup/cgi/TAL/TALInterpreter.py",
line 396, in do_optTag
return self.no_tag(start, program)
  File 
"/home/roundup/roundup-production//lib/python2.4/site-packages/roundup/cgi/TAL/TALInterpreter.py",
line 391, in no_tag
self.interpret(program)
  File 
"/home/roundup/roundup-production//lib/python2.4/site-packages/roundup/cgi/TAL/TALInterpreter.py",
line 236, in interpret
handlers[opcode](self, args)
  File 
"/home/roundup/roundup-production//lib/python2.4/site-packages/roundup/cgi/TAL/TALInterpreter.py",
line 689, in do_defineSlot
self.interpret(slot)
  File 
"/home/roundup/roundup-production//lib/python2.4/

Re: [Python-Dev] bugs.pythong.org bug?

2008-02-06 Thread Martin v. Löwis
> I attempted to search for all issues created by me today so I could 
> catch up since i've been out of the loop for a bit.  I performed the 
> following steps:
> 
> - went to bugs.python.org 
> - clicked search (on the lhs of the page)
> - typed in josepharmbruster as creator

You need to ask for joearmbruster, then it works fine. In general,
take the string after "Hello, " on the navigation bar.

Regards,
Martin
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] bugs.pythong.org bug?

2008-02-06 Thread Raghuram Devarakonda
On Feb 6, 2008 2:54 PM, Joseph Armbruster <[EMAIL PROTECTED]> wrote:

> - went to bugs.python.org
>  - clicked search (on the lhs of the page)
> - typed in josepharmbruster as creator
> - clicked search
>
> I will create an issue if deemed necessary.
>
> Joseph Armbruster
>
> exceptions.KeyError:

There seems to be a bug open for this problem:

http://psf.upfronthosting.co.za/roundup/meta/issue179

For tracker issues, the right place to ask is tracker-discuss list.

Thanks,
Raghu
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


[Python-Dev] Buildbot failures

2008-02-06 Thread Raymond Hettinger
Some of bsddb tests are failing.  In Py3.0 I switched the bsddb modules from 
UserDict.DictMixin to collections.MutableMapping.  But, the failures are also 
happened in the Py2.6 branch so something else must be the cause.  The 
db.InvalidArgError suggests that one of the defined constants is broken.

There is also a recurring failure in SocketServer.py  returning "ValueError: 
list.remove(x): x not in list" during attempts to remove a PID from the list of 
active_children.  Any ideas about what is causing this?

The freelists optimization has been causing periodic failure in test_sys., 
"test_compact_freelists self.assert_(r[0][2] > 100, r[0][2])".

Also, test_docxmlrpc hasn't been happy. One of the tests isn't getting the 
exact response string it expected.   Any ideas what is causing this?


Raymond
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com