internlm/SWE-Fixer-Train-110K huggingface dataset:
Repository: spyder-ide/spyder

Issue:
Error when trying to load third-party plugins
## Description

**What steps will reproduce the problem?**

1. Start sypder.
2. 
3. 

**What is the expected output? What do you see instead?**
It shows right away after starting Spyder.

**Please provide any additional information below**
A message box show this:
    module = _import_module_from_path(module_name, plugin_path)
    module = spec.loader.load_module(module_name)
AttributeError: 'NoneType' object has no attribute 'load_module'
![image](https://user-images.githubusercontent.com/9072983/28740752-f2f86f42-7432-11e7-84e5-539b3cf0e641.png)

Spyder functions fine, no problem after close the message box.
## Version and main components

* Spyder Version: 3.2.0 
* Python Version: 3.5.3
* Qt Versions: 5.6.2, PyQt5 5.6 on Darwin

## Dependencies
```
pyflakes >=0.6.0 :  1.5.0 (OK)
pycodestyle >=2.3:  2.3.1 (OK)
pygments >=2.0   :  2.2.0 (OK)
pandas >=0.13.1  :  0.19.2 (OK)
numpy >=1.7      :  1.12.1 (OK)
sphinx >=0.6.6   :  1.5.4 (OK)
rope >=0.9.4     :  0.10.5 (OK)
jedi >=0.9.0     :  0.10.2 (OK)
psutil >=0.3     :  5.2.1 (OK)
nbconvert >=4.0  :  5.1.1 (OK)
sympy >=0.7.3    :  None (NOK)
cython >=0.21    :  None (NOK)
qtconsole >=4.2.0:  4.3.0 (OK)
IPython >=4.0    :  6.1.0 (OK)
pylint >=0.25    :  1.6.4 (OK)

```



Discussion:
Do you have any additional Spyder module installed, like `spyder-terminal`?
If that's the case, please uninstall them. This error is only caused because of third-party plugins.

Resolving patch:
diff --git a/spyder/otherplugins.py b/spyder/otherplugins.py
--- a/spyder/otherplugins.py
+++ b/spyder/otherplugins.py
@@ -54,10 +54,16 @@ def _get_spyderplugins(plugin_path, is_io, modnames, modlist):
         # Is this a Spyder plugin?
         if not name.startswith(PLUGIN_PREFIX):
             continue
+
         # Ensure right type of plugin
         if is_io != name.startswith(IO_PREFIX):
             continue
 
+        # Skip names that end in certain suffixes
+        forbidden_suffixes = ['dist-info', 'egg.info', 'egg-link']
+        if any([name.endswith(s) for s in forbidden_suffixes]):
+            continue
+
         # Import the plugin
         _import_plugin(name, plugin_path, modnames, modlist)
 


Test patch:
Repository: spyder-ide/spyder

Issue:
Error when pressing Ctrl+C in the terminal where Spyder was started 
## Description

**What steps will reproduce the problem?**

1. 
2. 
3. 

**What is the expected output? What do you see instead?**


**Please provide any additional information below**

  File "/home/salalaika/application/Anaconda3/lib/python3.6/site-packages/spyder/widgets/status.py", line 108, in update_label
    def update_label(self):
KeyboardInterrupt


## Version and main components

* Spyder Version: 3.2.3 
* Python Version: 3.6.1
* Qt Versions: 5.6.2, PyQt5 5.6 on Linux

## Dependencies
```
pyflakes >=0.6.0 :  1.5.0 (OK)
pycodestyle >=2.3:  2.3.1 (OK)
pygments >=2.0   :  2.2.0 (OK)
pandas >=0.13.1  :  0.20.1 (OK)
numpy >=1.7      :  1.12.1 (OK)
sphinx >=0.6.6   :  1.5.6 (OK)
rope >=0.9.4     :  0.9.4-1 (OK)
jedi >=0.9.0     :  0.10.2 (OK)
psutil >=0.3     :  5.2.2 (OK)
nbconvert >=4.0  :  5.1.1 (OK)
sympy >=0.7.3    :  1.0 (OK)
cython >=0.21    :  0.25.2 (OK)
qtconsole >=4.2.0:  4.3.0 (OK)
IPython >=4.0    :  5.3.0 (OK)
pylint >=0.25    :  1.6.4 (OK)

```



Discussion:

Resolving patch:
diff --git a/spyder/app/mainwindow.py b/spyder/app/mainwindow.py
--- a/spyder/app/mainwindow.py
+++ b/spyder/app/mainwindow.py
@@ -288,6 +288,11 @@ def signal_handler(signum, frame=None):
                 pass
         else:
             signal.signal(signal.SIGTERM, signal_handler)
+            if not DEV:
+                # Make spyder quit when presing ctrl+C in the console
+                # In DEV Ctrl+C doesn't quit, because it helps to
+                # capture the traceback when spyder freezes
+                signal.signal(signal.SIGINT, signal_handler)
 
         # Use a custom Qt stylesheet
         if sys.platform == 'darwin':


Test patch:
Repository: spyder-ide/spyder

Issue:
AttributeError: 'super' object has no attribute '_handle_error' in IPython console
## Description

**What steps will reproduce the problem?**

1. 
2. 
3. 

**What is the expected output? What do you see instead?**


**Please provide any additional information below**

  File "D:\Anaconda 4.3.0\lib\site-packages\qtconsole\base_frontend_mixin.py", line 163, in _dispatch
    handler(msg)
  File "D:\Anaconda 4.3.0\lib\site-packages\spyder\widgets\ipythonconsole\shell.py", line 417, in _handle_error
    super(ShellWidget, self)._handle_error(msg)
AttributeError: 'super' object has no attribute '_handle_error'


## Version and main components

* Spyder Version: 3.2.2 
* Python Version: 3.6.0
* Qt Versions: 5.6.2, PyQt5 5.6 on Windows

## Dependencies
```
pyflakes >=0.6.0 :  1.5.0 (OK)
pycodestyle >=2.3:  2.3.1 (OK)
pygments >=2.0   :  2.1.3 (OK)
pandas >=0.13.1  :  0.20.3 (OK)
numpy >=1.7      :  1.13.1 (OK)
sphinx >=0.6.6   :  1.5.1 (OK)
rope >=0.9.4     :  0.9.4-1 (OK)
jedi >=0.9.0     :  0.9.0 (OK)
nbconvert >=4.0  :  4.2.0 (OK)
sympy >=0.7.3    :  1.0 (OK)
cython >=0.21    :  0.25.2 (OK)
qtconsole >=4.2.0:  4.2.1 (OK)
IPython >=4.0    :  5.1.0 (OK)
pylint >=0.25    :  1.6.4 (OK)

```



Discussion:
Thanks for reporting. We'll try to fix this error in our 3.2.3 version.

Could you update qtconsole in the meantime, to see it it fixes this error? You can do that by running this command in a system terminal (i.e. `cmd.exe`):

    conda update qtconsole

Resolving patch:
diff --git a/spyder/widgets/ipythonconsole/shell.py b/spyder/widgets/ipythonconsole/shell.py
--- a/spyder/widgets/ipythonconsole/shell.py
+++ b/spyder/widgets/ipythonconsole/shell.py
@@ -410,11 +410,7 @@ def _handle_error(self, msg):
         """
         Reimplemented to reset the prompt if the error comes after the reply
         """
-        # In pyqt4, if super does not has _handle_error, disregard the error
-        if PYQT4:
-            if not hasattr(super(ShellWidget, self), '_handle_error'):
-                return
-        super(ShellWidget, self)._handle_error(msg)
+        self._process_execute_error(msg)
         self._show_interpreter_prompt()
 
     def _context_menu_make(self, pos):


Test patch:
Repository: spyder-ide/spyder

Issue:
Renaming file containing folders yields IndexError.
## Description

**What steps will reproduce the problem?**

1. Opening some files in Spyder under Windows 7.
2. Trying to rename the folder in which the files are located.
3. Windows will possibly remark that the files are currently open (and it is possible to try again to rename the folder).
4. Restart the python kernel (optionally, only if renaming the folder was not possible).
5. Retry to rename the file containing folder (windows will now rename the folder).
6. Spyder will remark that the files have been removed or deleted outside of the editor and will allow to close the files.
7. Close all files that were opened in Spyder (and were located in the renamed folder).

**What is the expected output? What do you see instead?**

Spyder should close the file without promting an IndexError.

**Please provide any additional information below**

  File "C:\Users\TheUser\AppData\Local\Continuum\Anaconda3\lib\site-packages\spyder\widgets\editor.py", line 1660, in current_changed
    self.current_file_changed.emit(self.data[index].filename,
IndexError: list index out of range


## Version and main components

* Spyder Version: 3.2.0 
* Python Version: 3.6.1
* Qt Versions: 5.6.2, PyQt5 5.6 on Windows

## Dependencies
```
pyflakes >=0.6.0 :  1.5.0 (OK)
pycodestyle >=2.3:  2.3.1 (OK)
pygments >=2.0   :  2.2.0 (OK)
pandas >=0.13.1  :  0.20.1 (OK)
numpy >=1.7      :  1.12.1 (OK)
sphinx >=0.6.6   :  1.5.6 (OK)
rope >=0.9.4     :  0.9.4-1 (OK)
jedi >=0.9.0     :  0.10.2 (OK)
nbconvert >=4.0  :  5.1.1 (OK)
sympy >=0.7.3    :  1.0 (OK)
cython >=0.21    :  0.25.2 (OK)
qtconsole >=4.2.0:  4.3.0 (OK)
IPython >=4.0    :  5.3.0 (OK)
pylint >=0.25    :  1.6.4 (OK)

```



Discussion:
Thanks for the detailed description of the problem. We'll fix this problem in 3.2.3

@dalthviz, please take a look at this one.

Resolving patch:
diff --git a/spyder/widgets/editor.py b/spyder/widgets/editor.py
--- a/spyder/widgets/editor.py
+++ b/spyder/widgets/editor.py
@@ -1703,8 +1703,13 @@ def current_changed(self, index):
 
         self.update_plugin_title.emit()
         if editor is not None:
-            self.current_file_changed.emit(self.data[index].filename,
+            # Needed in order to handle the close of files open in a directory
+            # that has been renamed. See issue 5157
+            try:
+                self.current_file_changed.emit(self.data[index].filename,
                                            editor.get_position('cursor'))
+            except IndexError:
+                pass
 
     def _get_previous_file_index(self):
         if len(self.stack_history) > 1:


Test patch:
Repository: spyder-ide/spyder

Issue:
pdb.pm() raises an Error
## Description

**What steps will reproduce the problem?**

1. create an error
2. Try to debug using pdb.pm()

**Please provide any additional information below**

Traceback (most recent call last):

  File "<ipython-input-3-619d77b83f20>", line 1, in <module>
    pdb.pm()

  File "/usr/local/Cellar/python3/3.6.2/Frameworks/Python.framework/Versions/3.6/lib/python3.6/pdb.py", line 1604, in pm
    post_mortem(sys.last_traceback)

  File "/usr/local/Cellar/python3/3.6.2/Frameworks/Python.framework/Versions/3.6/lib/python3.6/pdb.py", line 1601, in post_mortem
    p.interaction(None, t)

  File "/Users/quentinpeter/pyscripts/spyder/spyder/utils/site/sitecustomize.py", line 440, in interaction
    if "sitecustomize.py" not in frame.f_code.co_filename:

AttributeError: 'NoneType' object has no attribute 'f_code'


## Version and main components

* Spyder Version: 4.0.0.dev0 474e59379
* Python Version: 3.6.2
* Qt Versions: 5.9.1, PyQt5 5.9 on Darwin

## Dependencies
```
pyflakes >=0.6.0 :  1.6.0 (OK)
pycodestyle >=2.3:  2.3.1 (OK)
pygments >=2.0   :  2.2.0 (OK)
pandas >=0.13.1  :  0.20.3 (OK)
numpy >=1.7      :  1.13.1 (OK)
sphinx >=0.6.6   :  1.6.3 (OK)
rope >=0.9.4     :  0.10.5 (OK)
jedi >=0.9.0     :  0.10.2 (OK)
psutil >=0.3     :  5.2.2 (OK)
nbconvert >=4.0  :  5.2.1 (OK)
sympy >=0.7.3    :  1.1.1 (OK)
cython >=0.21    :  0.26 (OK)
qtconsole >=4.2.0:  4.3.0 (OK)
IPython >=4.0    :  6.1.0 (OK)
pylint >=0.25    :  1.7.2 (OK)

```



Discussion:
@dalthviz, please take a look at this one.

Resolving patch:
diff --git a/spyder/utils/site/sitecustomize.py b/spyder/utils/site/sitecustomize.py
--- a/spyder/utils/site/sitecustomize.py
+++ b/spyder/utils/site/sitecustomize.py
@@ -437,15 +437,15 @@ def user_return(self, frame, return_value):
 
 @monkeypatch_method(pdb.Pdb, 'Pdb')
 def interaction(self, frame, traceback):
-    if "sitecustomize.py" not in frame.f_code.co_filename:
+    if frame is not None and "sitecustomize.py" in frame.f_code.co_filename:
+        self.run('exit')
+    else:
         self.setup(frame, traceback)
         if self.send_initial_notification:
             self.notify_spyder(frame)
         self.print_stack_entry(self.stack[self.curindex])
         self._cmdloop()
         self.forget()
-    else:
-        self.run('exit')
 
 
 @monkeypatch_method(pdb.Pdb, 'Pdb')


Test patch:
Repository: spyder-ide/spyder

Issue:
Error when Selecting Fig from Variable Explorer
## Description

**What steps will reproduce the problem?**

1. 
2. 
3. 

**What is the expected output? What do you see instead?**


**Please provide any additional information below**

  File "c:\python36-32\lib\site-packages\spyder\widgets\variableexplorer\collectionseditor.py", line 519, in createEditor
    readonly=readonly)
  File "c:\python36-32\lib\site-packages\spyder\widgets\variableexplorer\collectionseditor.py", line 1308, in setup
    self.data_copy = copy.deepcopy(data)
  File "c:\python36-32\lib\copy.py", line 180, in deepcopy
    y = _reconstruct(x, memo, *rv)
  File "c:\python36-32\lib\copy.py", line 280, in _reconstruct
    state = deepcopy(state, memo)
  File "c:\python36-32\lib\copy.py", line 150, in deepcopy
    y = copier(x, memo)
  File "c:\python36-32\lib\copy.py", line 240, in _deepcopy_dict
    y[deepcopy(key, memo)] = deepcopy(value, memo)
  File "c:\python36-32\lib\copy.py", line 161, in deepcopy
    y = copier(memo)
  File "c:\python36-32\lib\site-packages\matplotlib\transforms.py", line 125, in __copy__
    "Consider using frozen() instead.")
NotImplementedError: TransformNode instances can not be copied. Consider using frozen() instead.


## Version and main components

* Spyder Version: 3.2.3 
* Python Version: 3.6.2
* Qt Versions: 5.9.1, PyQt5 5.9 on Windows

## Dependencies
```
pyflakes


Discussion:
What do you mean by selecting Fig? Please be more specific.
Hi,
Sorry - this was an automated error code generated by Spyder, and I presed OK before reading it properly. 
The error occured when creating a plot using Matplotlib within Spyder. The code was as follows:
```
import matplotlib.pyplot as plt
fig = plt.figure(figsize=(20, 10))
```
A variable appeared in Variable Explorer called fig. I double clicked on it to examine, and this caused an error. 
I've added a screen shot to this note. 
![spyder and matplotlib error](https://user-images.githubusercontent.com/29338325/30364636-59a4c104-9865-11e7-96d0-ac35e8eedd5b.png)
Let me know if there is anything else I can provide
Thanks

Thanks for the reproducible example. @dalthviz, please take a look at this one.

Resolving patch:
diff --git a/spyder/widgets/variableexplorer/collectionseditor.py b/spyder/widgets/variableexplorer/collectionseditor.py
--- a/spyder/widgets/variableexplorer/collectionseditor.py
+++ b/spyder/widgets/variableexplorer/collectionseditor.py
@@ -1305,7 +1305,10 @@ def setup(self, data, title='', readonly=False, width=650, remote=False,
         else:
             # unknown object
             import copy
-            self.data_copy = copy.deepcopy(data)
+            try:
+                self.data_copy = copy.deepcopy(data)
+            except NotImplementedError:
+                self.data_copy = copy.copy(data)
             datalen = len(get_object_attrs(data))
         self.widget = CollectionsEditorWidget(self, self.data_copy, title=title,
                                               readonly=readonly, remote=remote)


Test patch:
Repository: spyder-ide/spyder

Issue:
Profiler incorrectly detects recursion
## Description

**What steps will reproduce the problem?**

1. Profile a code where a function in a module calls a similarly named function in another module
2. Look at the greyed out line

[test.zip](https://github.com/spyder-ide/spyder/files/1308171/test.zip)
![recursion](https://user-images.githubusercontent.com/6740194/30510574-c3684736-9abe-11e7-8e27-1427259029f3.png)







## Version and main components

* Spyder Version: 4.0.0.dev0 474e59379
* Python Version: 3.6.2
* Qt Versions: 5.9.1, PyQt5 5.9 on Darwin

## Dependencies
```
pyflakes >=0.6.0 :  1.6.0 (OK)
pycodestyle >=2.3:  2.3.1 (OK)
pygments >=2.0   :  2.2.0 (OK)
pandas >=0.13.1  :  0.20.3 (OK)
numpy >=1.7      :  1.13.1 (OK)
sphinx >=0.6.6   :  1.6.3 (OK)
rope >=0.9.4     :  0.10.5 (OK)
jedi >=0.9.0     :  0.10.2 (OK)
psutil >=0.3     :  5.2.2 (OK)
nbconvert >=4.0  :  5.2.1 (OK)
sympy >=0.7.3    :  1.1.1 (OK)
cython >=0.21    :  0.26 (OK)
qtconsole >=4.2.0:  4.3.0 (OK)
IPython >=4.0    :  6.1.0 (OK)
pylint >=0.25    :  1.7.2 (OK)

```



Discussion:
I don't know if the Python profiler module can deal with this case or not.

Resolving patch:
diff --git a/spyder_profiler/widgets/profilergui.py b/spyder_profiler/widgets/profilergui.py
--- a/spyder_profiler/widgets/profilergui.py
+++ b/spyder_profiler/widgets/profilergui.py
@@ -657,8 +657,8 @@ def is_recursive(self, child_item):
         while ancestor:
             if (child_item.data(0, Qt.DisplayRole
                                 ) == ancestor.data(0, Qt.DisplayRole) and
-                child_item.data(4, Qt.DisplayRole
-                                ) == ancestor.data(4, Qt.DisplayRole)):
+                child_item.data(7, Qt.DisplayRole
+                                ) == ancestor.data(7, Qt.DisplayRole)):
                 return True
             else:
                 ancestor = ancestor.parent()


Test patch:
Repository: spyder-ide/spyder

Issue:
Enter in IPython console inserts new line when big Dataframes are in namespace
@Khris777 said in https://github.com/spyder-ide/spyder/issues/2696#issuecomment-330441511

@ccordoba12 

Try this example, it reproduces the problem for me:

	import pandas as pd
	import numpy as np
	nrow = 1000000
	ncol = 50
	test = np.ones((nrow,ncol),dtype=object)
	df = pd.DataFrame(test)

Then enter commands like these into the console:

	df.head()
	df[df[1] == 1]
	df[(df[1] == 1)&(df[4] == 1)]

You should pretty soon encounter a case when pressing enter will bring up another line and seemingly not executing the command.

The behaviour is erratic though, sometimes a command works, then it won't.

Adding the commands into a file and pressing F9 for that line always works, and sometimes after doing so entering a command manually will work again as well.

EDIT: It seems like `dtype=object` is a significant factor here. Using the same array with `dtype=int` makes it work well and to encounter some problematic behaviour (still way less than with dtype object) I need to set `nrow = 10000000`. But since I'm working with arrays/dataframes that have mostly strings in them (internally dtype object), the example case is fitting.


Discussion:

Resolving patch:
diff --git a/spyder/utils/ipython/start_kernel.py b/spyder/utils/ipython/start_kernel.py
--- a/spyder/utils/ipython/start_kernel.py
+++ b/spyder/utils/ipython/start_kernel.py
@@ -64,6 +64,8 @@ def kernel_config():
     # Until we implement Issue 1052
     spy_cfg.InteractiveShell.xmode = 'Plain'
 
+    spy_cfg.IPCompleter.use_jedi = False
+
     # Run lines of code at startup
     run_lines_o = CONF.get('ipython_console', 'startup/run_lines')
     if run_lines_o:
diff --git a/spyder/widgets/ipythonconsole/shell.py b/spyder/widgets/ipythonconsole/shell.py
--- a/spyder/widgets/ipythonconsole/shell.py
+++ b/spyder/widgets/ipythonconsole/shell.py
@@ -15,7 +15,6 @@
 from qtpy.QtCore import Signal
 from qtpy.QtWidgets import QMessageBox
 from spyder.config.main import CONF
-from qtpy import PYQT4
 from spyder.config.base import _
 from spyder.config.gui import config_shortcut
 from spyder.py3compat import PY2, to_text_string


Test patch:
Repository: spyder-ide/spyder

Issue:
Error when trying to edit elements of a float numpy array in variable explorer
## Error when trying to edit elements of a float numpy array in variable explorer

**What steps will reproduce the problem?**

1. Doubleclick a float numpy array in variable explorer 
2. Try to edit the fractional part of any element

**What is the expected output? What do you see instead?**
The value of the chosen element is expected to be changed, but it is not.

**Please provide any additional information below**



## Version and main components

* Spyder Version: 3.2.1 
* Python Version: 3.6.1
* Qt Versions: 5.6.2, PyQt5 5.6 on Windows

## Dependencies
```
pyflakes >=0.6.0 :  1.5.0 (OK)
pycodestyle >=2.3:  2.3.1 (OK)
pygments >=2.0   :  2.2.0 (OK)
pandas >=0.13.1  :  0.20.1 (OK)
numpy >=1.7      :  1.12.1 (OK)
sphinx >=0.6.6   :  1.5.6 (OK)
rope >=0.9.4     :  0.9.4-1 (OK)
jedi >=0.9.0     :  0.10.2 (OK)
nbconvert >=4.0  :  5.1.1 (OK)
sympy >=0.7.3    :  1.0 (OK)
cython >=0.21    :  0.25.2 (OK)
qtconsole >=4.2.0:  4.3.0 (OK)
IPython >=4.0    :  6.1.0 (OK)
pylint >=0.25    :  1.6.4 (OK)

```



Discussion:
Thanks for reporting. What command are you using to create the Numpy array you can't modify?
I'm using numpy.array() for example.

Resolving patch:
diff --git a/spyder/widgets/variableexplorer/arrayeditor.py b/spyder/widgets/variableexplorer/arrayeditor.py
--- a/spyder/widgets/variableexplorer/arrayeditor.py
+++ b/spyder/widgets/variableexplorer/arrayeditor.py
@@ -18,7 +18,7 @@
 
 # Third party imports
 from qtpy.compat import from_qvariant, to_qvariant
-from qtpy.QtCore import (QAbstractTableModel, QItemSelection,
+from qtpy.QtCore import (QAbstractTableModel, QItemSelection, QLocale,
                          QItemSelectionRange, QModelIndex, Qt, Slot)
 from qtpy.QtGui import QColor, QCursor, QDoubleValidator, QKeySequence
 from qtpy.QtWidgets import (QAbstractItemDelegate, QApplication, QCheckBox,
@@ -373,7 +373,9 @@ def createEditor(self, parent, option, index):
             editor.setFont(get_font(font_size_delta=DEFAULT_SMALL_DELTA))
             editor.setAlignment(Qt.AlignCenter)
             if is_number(self.dtype):
-                editor.setValidator(QDoubleValidator(editor))
+                validator = QDoubleValidator(editor)
+                validator.setLocale(QLocale('C'))
+                editor.setValidator(validator)
             editor.returnPressed.connect(self.commitAndCloseEditor)
             return editor
 


Test patch:
Repository: spyder-ide/spyder

Issue:
Go to line doesn't correspond to the correct file
Lines to jump to and filenames are saved in different dictionaries. After reloading spyder they don't correspond to their initial ones. 


Discussion:
Let's merge first the focus PR and then you'll work on this one :-)
@dalthviz, please work on this one. This refers to lines and filenames saved when Spyder is closed and reopened again.

Resolving patch:
diff --git a/spyder/plugins/editor.py b/spyder/plugins/editor.py
--- a/spyder/plugins/editor.py
+++ b/spyder/plugins/editor.py
@@ -2799,13 +2799,12 @@ def reorder_filenames(self, filenames):
                     index_first_file = filenames.index(cfname)
                     filenames.pop(index_first_file)
                     filenames.insert(0, cfname)
+                    clines_first_file = clines[index_first_file]
+                    clines.pop(index_first_file)
+                    clines.insert(0, clines_first_file)
                 else:
                     cfname = filenames[0]
                     index_first_file = 0
-            if index_first_file != 0:
-                clines_0 = clines[0]
-                clines.pop(index_first_file)
-                clines.insert(0, clines_0)
             reordered_splitsettings.append((is_vertical, cfname, clines))
         layout['splitsettings'] = reordered_splitsettings
         self.set_option('layout_settings', layout)


Test patch:
diff --git a/spyder/plugins/tests/test_editor.py b/spyder/plugins/tests/test_editor.py
--- a/spyder/plugins/tests/test_editor.py
+++ b/spyder/plugins/tests/test_editor.py
@@ -56,7 +56,7 @@ def test_basic_initialization(setup_editor):
         (['/file1.py', '/file2.py', '/file3.py', '/file4.py'],
          ['/file2.py', '/file1.py', '/file3.py', '/file4.py'],
          [(False, '/file2.py', [2, 4, 8, 12])],
-         [(False, '/file2.py', [2, 2, 8, 12])]),
+         [(False, '/file2.py', [4, 2, 8, 12])]),
         (['/file1.py', '/file2.py', '/file3.py', '/file4.py'],
          ['/file1.py', '/file2.py', '/file3.py', '/file4.py'],
          None,