--profile-imports crashes with relative imports in plugin

Bug #1572314 reported by Ryan P. Kelly
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Bazaar
Expired
Undecided
Unassigned

Bug Description

Using --profile-imports in conjunction with relative imports in a plugin (anywhere, really) will cause a crash because timed_import doesn't pass down level into __import__.

Revision history for this message
Ryan P. Kelly (rpkelly22-m) wrote :
Revision history for this message
Richard Wilbur (richard-wilbur) wrote :

What's the output of `bzr version` on your system? Do you have specific plugins that cause this? I see from your branch changes how this could be a problem (although I'm not seeing it on bzr 2.7.0 under python 2.7.9) so I'm interested in what conditions bring this to light. I tried using the grep plugin:
bzr --profile-imports grep -i --recursive 'epoch' *
Is that a different use case than what you mention as "relative imports in a plugin"?

Changed in bzr:
status: New → Incomplete
Revision history for this message
Ryan P. Kelly (rpkelly22-m) wrote :

~$ bzr version
Bazaar (bzr) 2.7.0
  Python interpreter: /home/ryan/test/virtualenv/bin/python 2.7.3
  Python standard library: /home/ryan/test/virtualenv/lib/python2.7
  Platform: Linux-3.2.0-55-generic-x86_64-with-Ubuntu-12.04-precise
  bzrlib: /home/ryan/test/virtualenv/local/lib/python2.7/site-packages/bzrlib
  Bazaar configuration: /home/ryan/.bazaar
  Bazaar log file: /home/ryan/.bzr.log

Copyright 2005-2012 Canonical Ltd.
http://bazaar.canonical.com/

bzr comes with ABSOLUTELY NO WARRANTY. bzr is free software, and
you may use, modify and redistribute it under the terms of the GNU
General Public License version 2 or later.

Bazaar is part of the GNU Project to produce a free operating system.

What I meant was in a custom plugin. Nowhere in bzr itself are relative imports used. But if you try to import code that uses relative imports (or use relative imports in your plugin directly) you will get a crash.

Revision history for this message
Richard Wilbur (richard-wilbur) wrote :

Thanks for the information. Looks like your proposed fix is a relatively benign fix for a cause of crashes.

Please propose your branch be merged to the baseline.

By the way, do you have some code I could try in order to confirm this bug? If you wouldn't mind attaching a file to this bug I'd be happy to download and try it.

Revision history for this message
Launchpad Janitor (janitor) wrote :

[Expired for Bazaar because there has been no activity for 60 days.]

Changed in bzr:
status: Incomplete → Expired
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.