[MERGE][0.90][0.91][Bug 137044] ftp password handling broken

Aaron Bentley aaron.bentley at utoronto.ca
Wed Sep 5 17:57:26 BST 2007


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Vincent Ladeuil wrote:
>>>>>> "aaron" == Aaron Bentley <aaron.bentley at utoronto.ca> writes:
>     aaron> "from package import module" is compatible with
>     aaron> lazy_import.  "from packages.module import class" is
>     aaron> not.
> 
> No. Look at bzrlib/branch.py for example.

No.  bzrlib/branch.py would work incorrectly if it tried to use the
classes directly before any instances of those classes had been created.

Try this:

>>> from bzrlib.lazy_import import lazy_import
>>> lazy_import(globals(), """
... from bzrlib.branch import Branch"""
... )
>>> help(Branch)

You'll get a nice traceback ending with:

bzrlib.errors.IllegalUseOfScopeReplacer: ScopeReplacer object 'Branch'
was used incorrectly: Object already cleaned up, did you assign it to
another variable?: _factory

> And I thought we weren't interested in lazy import in the test
> framework anyway (as it it quite pointless).

I've noticed that even when I'm only running a few tests, "bzr selftest"
takes a long time to start running tests.  I'm interested in fixing
that, and it seems likely that lazy_import would help.

Aaron
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFG3t/20F+nu1YWqI0RAsUqAKCCk5y5CJnA5LBTXh57y1RLnm3ihACeNQjM
YHVIzXUQJW2xo3G6IEJxW5A=
=B8XV
-----END PGP SIGNATURE-----



More information about the bazaar mailing list