[Distutils] [issue38] bdist_egg extension stub loaders are broken

Philip Jenvey setuptools at bugs.python.org
Fri Aug 29 00:16:58 CEST 2008

New submission from Philip Jenvey <pjenvey at underboss.org>:

There's two different stub loader generators in the code base: 
build_ext.write_stub and bdist_egg.write_stub

bdist_egg's stub loader always assumes the presence of a __loader__ value, which 
causes a NameError in some cases. build_ext's version of the stub loader does 
the right thing and only messes with __loader__ if it exists -- the following 
patch applys that check to bdist_egg's stub loader

This fix is particularly important for packages with optional C extensions 
deployed to Google App Engine (like simplejson, Genshi). Compiled extensions 
won't be imported by GAE (as they're not supported), so instead the stub loader 
is imported. Without a __loader__ present this results in:

File "/base/data/home/apps/sluggo-exp/2.1/lib/python2.5/site-
line 5, in __bootstrap__
     del __bootstrap__, __loader__
 NameError: global name '__loader__' is not defined

instead of an ImportError, which these packages expect to be raised when they 
need to fallback to the alternative to the compiled extension

This should really make it in for the next release; prioritized as critical

files: bdist_egg-stub-loader_r65963.diff
messages: 149
nosy: pjenvey
priority: critical
status: unread
title: bdist_egg extension stub loaders are broken
Added file: http://bugs.python.org/setuptools/file20/bdist_egg-stub-loader_r65963.diff

Setuptools tracker <setuptools at bugs.python.org>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: bdist_egg-stub-loader_r65963.diff
URL: <http://mail.python.org/pipermail/distutils-sig/attachments/20080828/a0701ab9/attachment.txt>

More information about the Distutils-SIG mailing list