コード例 #1
0
 private void EnsureInterpreter()
 {
     if (_interpreter == null)
     {
         lock (this) {
             if (_interpreter == null)
             {
                 var fact = new IronPythonInterpreterFactory(_config.Architecture);
                 fact.BeginRefreshIsCurrent();
                 _interpreter = fact;
             }
         }
     }
 }
コード例 #2
0
 private void DiscoverInterpreterFactories()
 {
     if (_config == null && IronPythonResolver.GetPythonInstallDir() != null)
     {
         _config = IronPythonInterpreterFactory.GetConfiguration(ProcessorArchitecture.X86);
         if (Environment.Is64BitOperatingSystem)
         {
             _configX64 = IronPythonInterpreterFactory.GetConfiguration(ProcessorArchitecture.Amd64);
         }
         var evt = InterpreterFactoriesChanged;
         if (evt != null)
         {
             evt(this, EventArgs.Empty);
         }
     }
 }
コード例 #3
0
        public void InvalidIronPythonDatabase() {
            using (var db = MockCompletionDB.Create(PythonLanguageVersion.V27,
                // __bad_builtin__ is missing str
                Tuple.Create("__bad_builtin__", "__builtin__")
            )) {
                var ptd = db.Database;

                Assert.IsNotNull(ptd.GetModule("__builtin__"));

                var factory = new IronPythonInterpreterFactory();
                // Explicitly create an IronPythonInterpreter from factory that
                // will use the database in db.Factory.
                using (var analyzer = PythonAnalyzer.CreateSynchronously(factory, factory.MakeInterpreter(db.Factory))) {
                    // String type should have been loaded anyway
                    Assert.IsNotNull(analyzer.ClassInfos[BuiltinTypeId.Str]);
                }
            }
        }
コード例 #4
0
 private void EnsureInterpreter() {
     if (_interpreter == null) {
         lock (this) {
             if (_interpreter == null) {
                 var fact = new IronPythonInterpreterFactory(_config.Architecture);
                 fact.BeginRefreshIsCurrent();
                 _interpreter = fact;
             }
         }
     }
 }