New submission from Gregory P. Smith <g...@krypto.org>:

Python/import.c in 2.7 and 3.2 consume a lot of stack space when importing 
modules.  In stack constrained environments (think: 64k stack) this can cause a 
crash when you have a large chain of imports.

The bulk of this likely comes from places where a char buf[MAXPATHLEN+1] or 
similar is declared on the stack in the call chain.  MAXPATHLEN is commonly 
defined to be in the 256..1024 range depending on the OS.

Changing the code to not put the large buffer on the stack but to malloc and 
free it instead is a pretty straightforward re-factor.

import is being significantly reworked in 3.3 so I won't consider this issue 
there until after that settles as it may no longer apply.

----------
assignee: gregory.p.smith
messages: 155981
nosy: brett.cannon, gregory.p.smith, ncoghlan, twouters
priority: normal
severity: normal
status: open
title: Python/import.c uses a lot of stack space due to MAXPATHLEN
versions: Python 2.7, Python 3.2

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue14331>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to