Home Download Buy Blog Forum Support

ST3 on_api_ready issue

ST3 on_api_ready issue

Postby jburnett on Mon Feb 04, 2013 10:51 pm

In 3010, on_api_ready() is iterating over sys.modules.values() directly (sublime_plugin.py:133). If a plugin does something like an import inside its plugin_loaded function, ST will bail with a RuntimeError ("dictionary changed size during iteration"). It might be better to capture modules.values() into a list before iterating to guard against that?
jburnett
 
Posts: 89
Joined: Wed Jul 27, 2011 9:23 pm

Re: ST3 on_api_ready issue

Postby wbond on Tue Feb 05, 2013 2:51 pm

I am curious about how you are using on_api_read in your plugin. I was looking for something like that when I started porting PC because I needed to check the version of PC to determine what import code to run.

Would it solve your problem if sublime.version(), sublime.arch() and sublime.platform() were available always? I don't know if that is possible, but it would certainly make some of my import code a little cleaner.
wbond
 
Posts: 528
Joined: Mon Feb 28, 2011 5:33 am

Re: ST3 on_api_ready issue

Postby atomi on Tue Feb 05, 2013 10:16 pm

here's what i'm doing:

Code: Select all
try:
    import py3modules
else ImportError:
    import py2.6modules

def _import_modules():
    blah = sublime.blah # we have sublime
    # run all my imports here that need sublime avaialble

if not sublime.version():
    _import_modules()
def plugin_loaded():
    sublime.set_timeout_async(_import_modules)
atomi
 
Posts: 342
Joined: Thu Jan 20, 2011 5:06 pm
Location: Los Angeles CA US

Re: ST3 on_api_ready issue

Postby jps on Wed Feb 06, 2013 3:35 am

jburnett: Will fix for the next build

wbond: I'll modify the next build so that sublime.version() and friends can be called at any time
jps
Site Admin
 
Posts: 3067
Joined: Wed Mar 19, 2008 12:33 pm


Return to General Discussion

Who is online

Users browsing this forum: Google Adsense [Bot] and 26 guests