示例#1
0
        public IronPythonInterpreter(PythonInterpreterFactoryWithDatabase factory) {
#if DEBUG
            _id = Interlocked.Increment(ref _interpreterCount);
            Debug.WriteLine(String.Format("IronPython Interpreter Created {0}", _id));
            Debug.WriteLine(new StackTrace(true).ToString());
#endif

            AppDomain.CurrentDomain.AssemblyResolve += AssemblyResolver.Instance.CurrentDomain_AssemblyResolve;

            InitializeRemoteDomain();

            try {
                LoadAssemblies();
            } catch {
                // IronPython not installed in the GAC...
            }

            var mod = Remote.ImportBuiltinModule("__builtin__");
            var newMod = new IronPythonBuiltinModule(this, mod, "__builtin__");
            _modules[newMod.Name] = newMod;

            _factory = factory;
            _typeDb = _factory.GetCurrentDatabase().CloneWithNewBuiltins(newMod);
            _factory.NewDatabaseAvailable += OnNewDatabaseAvailable;

            LoadModules();
        }
示例#2
0
        public IronPythonInterpreter(IPythonInterpreterFactory factory)
        {
#if DEBUG
            _id = Interlocked.Increment(ref _interpreterCount);
            Debug.WriteLine(String.Format("IronPython Interpreter {0} created from {1}", _id, factory.GetType().FullName));
            Debug.WriteLine(new StackTrace(true).ToString());
#endif

            AppDomain.CurrentDomain.AssemblyResolve += AssemblyResolver.Instance.CurrentDomain_AssemblyResolve;

            InitializeRemoteDomain();

            try {
                LoadAssemblies();
            } catch {
                // IronPython not installed in the GAC...
            }

            var mod    = Remote.ImportBuiltinModule("__builtin__");
            var newMod = new IronPythonBuiltinModule(this, mod, "__builtin__");
            _modules[newMod.Name] = newMod;

            _factory = factory;
            if (_factory is PythonInterpreterFactoryWithDatabase withDb)
            {
                _typeDb = withDb.GetCurrentDatabase().CloneWithNewBuiltins(newMod);
                withDb.NewDatabaseAvailable += OnNewDatabaseAvailable;
            }

            LoadModules();
        }
示例#3
0
        public IronPythonInterpreter(IPythonInterpreterFactory factory)
        {
#if DEBUG
            _id = Interlocked.Increment(ref _interpreterCount);
            Debug.WriteLine(String.Format("IronPython Interpreter {0} created from {1}", _id, factory.GetType().FullName));
            try {
                Debug.WriteLine(new StackTrace(true).ToString());
            } catch (System.Security.SecurityException) {
            }
#endif

            _factory = factory;

            AppDomain.CurrentDomain.AssemblyResolve += AssemblyResolver.Instance.CurrentDomain_AssemblyResolve;

            InitializeRemoteDomain();

            try {
                LoadAssemblies();
            } catch {
                // IronPython not installed in the GAC...
            }

            var mod    = Remote.ImportBuiltinModule("__builtin__");
            var newMod = new IronPythonBuiltinModule(this, mod, "__builtin__");
            _modules[newMod.Name] = _builtinModule = newMod;

            LoadModules();
        }