This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author pitrou
Recipients Thomas.Smith, dmalcolm, doko, ezio.melotti, liang, neologix, pitrou, tim.peters, vstinner
Date 2010-04-20.14:00:08
SpamBayes Score 4.7450804e-08
Marked as misclassified No
Message-id <1271772137.3523.9.camel@localhost>
In-reply-to <1271771220.8.0.392283554955.issue7332@psf.upfronthosting.co.za>
Content
> The problem is highlighted with recursive imports:
> a module which imports another module, which imports another module,
> etc. PyMarshal_ReadLastObjectFromFile is not the only function to use
> stack-allocated buffers, there are also load_source_module,
> load_package, import_module_level, which use char buf[MAXPATHLEN+1]:
> with a MAXPATHLEN to 1024, you lose 2 or 3K every time you do a
> recursive import.

Let's assume we lose ten times 1024 bytes, that's still only 10KB. The
stack is 8MB. We are argueing about less than 1% of the total stack
size.

I just went through all of the functions highlighted in one of these
stack traces (*). The only big consumers of stack space seem to be the
stack buffer in PyMarshal_ReadLastObjectFromFile, and the various file
path buffers using MAXPATHLEN.

(*) https://bugs.launchpad.net/ubuntu/+source/python2.6/+bug/432546

And that report shows only a single thread, so I have to assume that the
8MB figure applies there.

Nevertheless, we can remove the stack buffer since it's probably
useless. It just seems unlikely to me to be the root cause of the stack
overflow.
History
Date User Action Args
2010-04-20 14:00:11pitrousetrecipients: + pitrou, tim.peters, doko, vstinner, ezio.melotti, dmalcolm, liang, Thomas.Smith, neologix
2010-04-20 14:00:08pitroulinkissue7332 messages
2010-04-20 14:00:08pitroucreate