Path: csiph.com!usenet.pasdenom.info!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.029 X-Spam-Evidence: '*H*': 0.94; '*S*': 0.00; 'fault': 0.07; 'sys': 0.09; 'thx': 0.09; 'python': 0.11; 'subject:python': 0.12; 'print': 0.15; '2.7.2': 0.16; 'funny,': 0.16; 'ubuntu,': 0.16; 'wien,': 0.16; 'def': 0.20; 'header:User-Agent:1': 0.23; 'import': 0.24; '(or': 0.24; '>>>': 0.24; 'hi,': 0.33; 'skip:s 20': 0.34; 'why': 0.36; 'charset:us-ascii': 0.36; 'michael': 0.38; 'to:addr:python- list': 0.39; 'to:addr:python.org': 0.40; 'steps': 0.61; 'content- disposition:inline': 0.62; 'skip:+ 10': 0.63; 'materials': 0.70; '152': 0.84; 'random,': 0.84; 'voice:': 0.84 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=univie.ac.at; s=rev2; h=Content-Type:MIME-Version:Message-ID:Subject:To:From:Date; bh=XEmYHxjih91GQHVUQP0/0Ng7FotFmtzidcRwKeZuIq8=; b=UeynYjBrLK55/Ilv/8S1rwGWIeWcC/JMUfYxxPvh9imh4lXc+O4i/9JJjZZF5/5z3omKXI5CQs2bsRUkh3WcrnxSGzIuQdeHKICNI+Gh1svfn07YCeeowdEFiEVMgODL7tNbuKTkq/pl0PtEjcH/mfqm23Zvn4mlOhKavmNl96s=; Date: Wed, 28 Mar 2012 00:27:57 +0200 From: Michael Poeltl To: python-list@python.org Subject: python segfault MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) X-Univie-Virus-Scan: scanned by ClamAV on justin.univie.ac.at X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 66 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1332887286 news.xs4all.nl 6866 [2001:888:2000:d::a6]:36603 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:22255 hi, can anybody tell why this 'little stupid *thing* of code' let's python-3.2.2, 2.6.X or python 2.7.2 segfault? >> def get_steps2(pos=0, steps=0): ... if steps == 0: ... pos = random.randint(-1,1) ... if pos == 0: ... return steps ... steps += 2 ... pos += random.randint(-1,1) ... return get_steps2(pos,steps) ... >>> import random, sys >>> sys.setrecursionlimit(100000) >>> for i in range(200): ... print ( get_steps2() ) ... 4 0 8 0 0 0 2 2 166 2 0 0 16 4 2 16 0 0 10 70 152 50 58 0 6 0 0 0 2 8 0 Segmentation fault ?> funny, isn't it? I was able to reproduce this segfault on various machines (32bit 64bit), ubuntu, slackware, debian python.X segfaults on all of them thx Michael -- Michael Poeltl Computational Materials Physics voice: +43-1-4277-51409 Univ. Wien, Sensengasse 8/12 fax: +43-1-4277-9514 (or 9513) A-1090 Wien, AUSTRIA cmp.mpi.univie.ac.at ------------------------------------------------------------------------------- ubuntu-11.10 | vim-7.3 | python-3.2.2 | mutt-1.5.21 | elinks-0.12 -------------------------------------------------------------------------------