[Twisted-Python] different import paths lead to insecureJelly

Glyph glyph at twistedmatrix.com
Fri Jan 3 02:06:38 MST 2014


On Jan 2, 2014, at 3:37 AM, exarkun at twistedmatrix.com wrote:

> Always refer to modules in the same way.  Never use relative imports.

Explicit relative imports preserve the benefit of being able to re-name your packages without editing every file inside them, but will still give you errors rather than silent pathological if you end up with an implicit Python path entry in the wrong place.

(Here is an termcast that illustrates the distinction: <http://asciinema.org/a/7016>.)

Also, any absolute import in python 2 can accidentally become implicitly relative given a sufficiently unfortunate set of circumstances.  Consider using 'from __future__ import absolute_import' everywhere to make your imports less ambiguous.

-glyph

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://twistedmatrix.com/pipermail/twisted-python/attachments/20140103/6bdeb019/attachment.html>


More information about the Twisted-Python mailing list