Re: [Python-Dev] Two spaces or one?
> I normally use monospaced fonts for Python, but in my > Think Pascal days I wrote most of my Pascal in Geneva. I had to read that sentence twice to understand that you didn't actually go to Switzerland to write Pascal (although this would have been very appropriate). 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
[Python-Dev] Bus error in transformer.py
Hi! I'm still working on bug: http://python.org/sf/1720241 First thing I've found is that `compile` works OK, but `compiler.parse` not. And I feel that It's bug in python, or python port, because I'm getting Bus error on some stage when I'm tracing execution and trying to backtrace. Also `parser.expr` passes ok, and error raises in Transformer class. I've attached part of the debugger session, and script I use. Any hints how to debug it further? -- Paul. (Pdb) bt /usr/local/lib/python2.5/threading.py(460)__bootstrap() -> self.run() /usr/local/lib/python2.5/threading.py(440)run() -> self.__target(*self.__args, **self.__kwargs) /tmp/test1.py(9)test() -> print Transformer().compile_node(b) /usr/local/lib/python2.5/compiler/transformer.py(160)compile_node() -> return self.eval_input(node[1:]) /usr/local/lib/python2.5/compiler/transformer.py(195)eval_input() -> return Expression(self.com_node(nodelist[0])) /usr/local/lib/python2.5/compiler/transformer.py(792)com_node() -> return self._dispatch[node[0]](node[1:]) /usr/local/lib/python2.5/compiler/transformer.py(567)testlist() -> return self.com_binary(Tuple, nodelist) /usr/local/lib/python2.5/compiler/transformer.py(1065)com_binary() -> return self.lookup_node(n)(n[1:]) /usr/local/lib/python2.5/compiler/transformer.py(583)test() -> then = self.com_node(nodelist[0]) /usr/local/lib/python2.5/compiler/transformer.py(792)com_node() -> return self._dispatch[node[0]](node[1:]) /usr/local/lib/python2.5/compiler/transformer.py(597)or_test() -> return self.com_binary(Or, nodelist) /usr/local/lib/python2.5/compiler/transformer.py(1065)com_binary() -> return self.lookup_node(n)(n[1:]) /usr/local/lib/python2.5/compiler/transformer.py(602)and_test() -> return self.com_binary(And, nodelist) /usr/local/lib/python2.5/compiler/transformer.py(1065)com_binary() -> return self.lookup_node(n)(n[1:]) /usr/local/lib/python2.5/compiler/transformer.py(606)not_test() -> result = self.com_node(nodelist[-1]) /usr/local/lib/python2.5/compiler/transformer.py(792)com_node() -> return self._dispatch[node[0]](node[1:]) /usr/local/lib/python2.5/compiler/transformer.py(613)comparison() -> node = self.com_node(nodelist[0]) /usr/local/lib/python2.5/compiler/transformer.py(792)com_node() -> return self._dispatch[node[0]](node[1:]) /usr/local/lib/python2.5/compiler/transformer.py(646)expr() -> return self.com_binary(Bitor, nodelist) /usr/local/lib/python2.5/compiler/transformer.py(1065)com_binary() -> return self.lookup_node(n)(n[1:]) /usr/local/lib/python2.5/compiler/transformer.py(650)xor_expr() -> return self.com_binary(Bitxor, nodelist) /usr/local/lib/python2.5/compiler/transformer.py(1065)com_binary() -> return self.lookup_node(n)(n[1:]) /usr/local/lib/python2.5/compiler/transformer.py(654)and_expr() -> return self.com_binary(Bitand, nodelist) /usr/local/lib/python2.5/compiler/transformer.py(1065)com_binary() -> return self.lookup_node(n)(n[1:]) /usr/local/lib/python2.5/compiler/transformer.py(658)shift_expr() -> node = self.com_node(nodelist[0]) /usr/local/lib/python2.5/compiler/transformer.py(792)com_node() -> return self._dispatch[node[0]](node[1:]) /usr/local/lib/python2.5/compiler/transformer.py(670)arith_expr() -> node = self.com_node(nodelist[0]) /usr/local/lib/python2.5/compiler/transformer.py(792)com_node() -> return self._dispatch[node[0]](node[1:]) /usr/local/lib/python2.5/compiler/transformer.py(682)term() -> node = self.com_node(nodelist[0]) /usr/local/lib/python2.5/compiler/transformer.py(792)com_node() -> return self._dispatch[node[0]](node[1:]) /usr/local/lib/python2.5/compiler/transformer.py(702)factor() -> node = self.lookup_node(nodelist[-1])(nodelist[-1][1:]) /usr/local/lib/python2.5/compiler/transformer.py(714)power() -> node = self.com_node(nodelist[0]) /usr/local/lib/python2.5/compiler/transformer.py(792)com_node() -> return self._dispatch[node[0]](node[1:]) /usr/local/lib/python2.5/compiler/transformer.py(726)atom() -> return self._atom_dispatch[nodelist[0][0]](nodelist) /usr/local/lib/python2.5/compiler/transformer.py(731)atom_lpar() -> return self.com_node(nodelist[1]) /usr/local/lib/python2.5/compiler/transformer.py(792)com_node() -> return self._dispatch[node[0]](node[1:]) /usr/local/lib/python2.5/compiler/transformer.py(577)testlist_gexp() -> return self.testlist(nodelist) /usr/local/lib/python2.5/compiler/transformer.py(567)testlist() -> return self.com_binary(Tuple, nodelist) /usr/local/lib/python2.5/compiler/transformer.py(1065)com_binary() -> return self.lookup_node(n)(n[1:]) /usr/local/lib/python2.5/compiler/transformer.py(583)test() -> then = self.com_node(nodelist[0]) /usr/local/lib/python2.5/compiler/transformer.py(792)com_node() -> return self._dispatch[node[0]](node[1:]) /usr/local/lib/python2.5/compiler/transformer.py(597)or_test() -> return self.com_binary(Or, nodelist) /usr/local/lib/python2.5/compiler/transformer.py(1065)com_binary() -> return self.lookup_node
Re: [Python-Dev] Bus error in transformer.py
Paul> And I feel that It's bug in python, or python port, because I'm Paul> getting Bus error on some stage when I'm tracing execution and Paul> trying to backtrace. Have you run it under control of a C-level debugger (gdb, dbx, etc) to see where the bus error occurs? Skip ___ 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] Bus error in transformer.py
> Any hints how to debug it further? You should run it under gdb, or attach to the interpreter from gdb. Could it be that you get a stack overflow? To my knowledge, stack space is very scarce on FreeBSD if you use threads. 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] Bus error in transformer.py
Martin v. Löwis wrote: > You should run it under gdb, or attach to the interpreter > from gdb. > I've run it with gdb before (when posted a bug), and sometimes I got a huge traceback with 1+ lines and sometimes less than 100 full of question marks so I've decided it's not of a great interest. Today I've got quite good backtrace :) > Could it be that you get a stack overflow? To my knowledge, > stack space is very scarce on FreeBSD if you use threads. > Well, yes it is! I've tested stack overflow before without using threads, and it throws an exception as expected. But this: def test(): test() from threading import Thread t = Thread(target = test) t.start() t.join() Produces "Segmentation fault" on python2.4 and "Bus error" on python2.5. Following line: threading.stack_size(1<<19) Fixes this problem for python2.5. Thanks a lot. I think I'll set up it in sitecustomize.py. I don't know but maybe you should consider change platform defaults. -- Paul. ___ 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] Bus error in transformer.py
> Thanks a lot. I think I'll set up it in sitecustomize.py. > I don't know but maybe you should consider change platform defaults. Such a patch should be contributed by a FreeBSD expert. Different versions of FreeBSD behave differently, with too many conditions to consider. It's a mess. The simplest thing to do would be to stop supporting threading on FreeBSD. 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] Bus error in transformer.py
On Sat, Jul 28, 2007, Paul Colomiets wrote: > > [...] Because I can't resist: shouldn't that be a "truck error" if you're using transformer.py? For those who don't get it: http://en.wikipedia.org/wiki/Transformers_%28fiction%29 -- Aahz ([EMAIL PROTECTED]) <*> http://www.pythoncraft.com/ This is Python. We don't care much about theory, except where it intersects with useful practice. ___ 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] Summary of Tracker Issues
ACTIVITY SUMMARY (07/22/07 - 07/29/07) Tracker at http://bugs.python.org/ To view or respond to any of the issues listed below, click on the issue number. Do NOT respond to this message. 1276 open ( +3) / 11101 closed ( +2) / 12377 total ( +5) Average duration of open issues: 688 days. Median duration of open issues: 554 days. Open Issues Breakdown open 1274 ( +2) pending 2 ( +1) Issues Created Or Reopened (5) __ struni: Fix test_macostools 07/22/07 CLOSED http://bugs.python.org/issue1758570 created jyasskin Documentation of descriptors needs more detail 07/23/07 http://bugs.python.org/issue1758696 created lpd unicode(None,charset) raise TypeError07/23/07 http://bugs.python.org/issue1758804 created guillaumb pyexpat unit tests - str/uni branch 07/23/07 CLOSED http://bugs.python.org/issue1759016 created jcgregorio clean up Solaris port and allow C99 extension modules07/23/07 http://bugs.python.org/issue1759169 created zooko Issues Now Closed (3) _ splice() function for itertools2 days http://bugs.python.org/issue1757395 rhettinger struni: Fix test_macostools1 days http://bugs.python.org/issue1758570 gvanrossum pyexpat unit tests - str/uni branch0 days http://bugs.python.org/issue1759016 gvanrossum ___ 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] uuid creation not thread-safe?
On Jul 20, 1:52 pm, "Guido van Rossum" <[EMAIL PROTECTED]> wrote: > I discovered what appears to be a thread-unsafety inuuid.py. This is > in the trunk as well as in 3.x; I'm using the trunk here for easy > reference. There's some code around like 395: > > import ctypes, ctypes.util > _buffer = ctypes.create_string_buffer(16) > > This creates a *global* buffer which is used as the output parameter > to later calls to _uuid_generate_random() and _uuid_generate_time(). > For example, around line 481, in uuid1(): > > _uuid_generate_time(_buffer) > returnUUID(bytes=_buffer.raw) > > Clearly if two threads do this simultaneously they are overwriting > _buffer in unpredictable order. There are a few other occurrences of > this too. > > I find it somewhat disturbing that what seems a fairly innocent > function that doesn't *appear* to have global state is nevertheless > not thread-safe. Would it be wise to fix this, e.g. by allocating a > fresh output buffer inside uuid1() and other callers? > I didn't find any reply to this, which is odd, so forgive me if it's old news. I agree with you that it's not thread safe and that a local buffer in the stack should fix it. Just for reference, the thread-safe uuid extension we've been using since python 2.1, which I don't recall where we borrow it from, uses a local buffer in the stack. It looks like this: -begin uuid.c-- static char uuid__doc__ [] = "DCE compatible Universally Unique Identifier module"; #include "Python.h" #include static char uuidgen__doc__ [] = "Create a new DCE compatible UUID value"; static PyObject * uuidgen(void) { uuid_t out; char buf[48]; uuid_generate(out); uuid_unparse(out, buf); return PyString_FromString(buf); } static PyMethodDef uuid_methods[] = { {"uuidgen", uuidgen, 0, uuidgen__doc__}, {NULL, NULL}/* Sentinel */ }; DL_EXPORT(void) inituuid(void) { Py_InitModule4("uuid", uuid_methods, uuid__doc__, (PyObject *)NULL, PYTHON_API_VERSION); } -end uuid.c-- It also seems that using uuid_generate()/uuid_unparse() should be faster than using uuid_generate_random() and then creating a python object to call its __str__ method. If so, it would be nice if the uuid.py module also provided equivalent fast versions that returned strings instead of objects. -- Luis P Caamano Atlanta, GA, USA ___ 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