private static void configureDebugEnvironment(@NotNull Project project,
                                                @NotNull EnvironmentController environmentController,
                                                @Nullable RunProfile runProfile,
                                                boolean addCythonExtensionsToPythonPath) {
    if (PyDebuggerOptionsProvider.getInstance(project).isSupportGeventDebugging()) {
      environmentController.putFixedValue(GEVENT_SUPPORT, "True");
    }

    PyDebuggerSettings debuggerSettings = PyDebuggerSettings.getInstance();
    if (debuggerSettings.isSteppingFiltersEnabled()) {
      environmentController.putFixedValue(PYDEVD_FILTERS, debuggerSettings.getSteppingFiltersForProject(project));
    }
    if (debuggerSettings.isLibrariesFilterEnabled()) {
      environmentController.putFixedValue(PYDEVD_FILTER_LIBRARIES, "True");
    }
    if (debuggerSettings.getValuesPolicy() != ValuesPolicy.SYNC) {
      environmentController.putFixedValue(PyDebugValue.POLICY_ENV_VARS.get(debuggerSettings.getValuesPolicy()), "True");
    }

    PydevConsoleRunnerFactory.putIPythonEnvFlag(project, environmentController);

    if (addCythonExtensionsToPythonPath) {
      environmentController.appendTargetPathToPathsValue(PYTHONPATH_ENV_NAME, CYTHON_EXTENSIONS_DIR);
    }

    PyDebugAsyncioCustomizer.Companion.getInstance().enableAsyncioMode(environmentController);

    AbstractPythonRunConfiguration<?> runConfiguration = runProfile instanceof AbstractPythonRunConfiguration<?> ?
                                                               (AbstractPythonRunConfiguration<?>)runProfile : null;
    Module module = runConfiguration != null ? runConfiguration.getModule() : null;

    if (module != null) {
      addProjectRootsToEnv(module, environmentController);
    }

    if (runConfiguration != null) {
      final Sdk sdk = runConfiguration.getSdk();
      if (sdk != null) {
        final PythonSdkFlavor<?> flavor = PythonSdkFlavor.getFlavor(sdk);
        if (flavor != null) {
          final LanguageLevel langLevel = flavor.getLanguageLevel(sdk);
          // PY-28457 Disable Cython extensions in Python 3.4 and Python 3.5 because of crash in generated C code
          if (langLevel == LanguageLevel.PYTHON34 || langLevel == LanguageLevel.PYTHON35) {
            environmentController.putFixedValue(PYDEVD_USE_CYTHON, "NO");
          }
        }
      }

      addSdkRootsToEnv(environmentController, runConfiguration);
      environmentController.appendTargetPathToPathsValue(PYTHONPATH_ENV_NAME, runConfiguration.getWorkingDirectorySafe());
    }

    applyRegistryFlags(environmentController);
  }
private static void configureDebugEnvironment(@NotNull Project project,
                                                @NotNull EnvironmentController environmentController,
                                                @Nullable RunProfile runProfile,
                                                boolean addCythonExtensionsToPythonPath)