spyder-ide / spyder

Official repository for Spyder - The Scientific Python Development Environment
https://www.spyder-ide.org
MIT License
8.33k stars 1.61k forks source link

Weird linking between file information after using "Save as..." #17140

Open oscargus opened 2 years ago

oscargus commented 2 years ago

Issue Report Checklist

Problem Description

I stumbled upon a weird issue while refactoring some files. I think it comes down to what happens with the additional information that Spyder stores internally for each file, but I have not dug into it.

Here is the output:

image

See below how it was obtained. (I originally noted that _file.py had error markers from file.py, so the first three steps is enough to obtain one of the problems. But while creating an MWE, I also found that file2.py does not have error markers, which it should. So first time there is a link and second time there is no checking.)

It is not really a major issue, but maybe something to have in mind when working on those parts.

What steps reproduce the problem?

  1. Create a valid Python file save it, say file.py
  2. Save it under a different name, say _file.py
  3. Open the old file, file.py, and introduce some error in it.
  4. Save it under a different name, , say file2.py
  5. Open file.py.

What is the expected output? What do you see instead?

_file.py should not have an error marker. file2.py should have an error marker.

Paste Traceback/Error Below (if applicable)


PASTE TRACEBACK HERE

Versions

Dependencies

# Mandatory:
atomicwrites >=1.2.0          :  1.4.0 (OK)
chardet >=2.0.0               :  4.0.0 (OK)
cloudpickle >=0.5.0           :  2.0.0 (OK)
cookiecutter >=1.6.0          :  1.7.3 (OK)
diff_match_patch >=20181111   :  20200713 (OK)
intervaltree >=3.0.2          :  3.1.0 (OK)
IPython >=7.6.0               :  7.30.1 (OK)
jedi >=0.17.2;<0.19.0         :  0.18.1 (OK)
jellyfish >=0.7               :  0.8.9 (OK)
jsonschema >=3.2.0            :  4.3.3 (OK)
keyring >=17.0.0              :  23.4.0 (OK)
nbconvert >=4.0               :  6.3.0 (OK)
numpydoc >=0.6.0              :  1.1.0 (OK)
paramiko >=2.4.0              :  2.9.1 (OK)
parso >=0.7.0;<0.9.0          :  0.8.3 (OK)
pexpect >=4.4.0               :  4.8.0 (OK)
pickleshare >=0.4             :  0.7.5 (OK)
psutil >=5.3                  :  5.9.0 (OK)
pygments >=2.0                :  2.11.1 (OK)
pylint >=2.5.0                :  2.12.2 (OK)
pyls_spyder >=0.4.0           :  0.4.0 (OK)
pylsp >=1.3.2;<1.4.0          :  1.3.3 (OK)
pylsp_black >=1.0.0           :  1.0.1 (OK)
qdarkstyle =3.0.2             :  3.0.2 (OK)
qstylizer >=0.1.10            :  0.2.1 (OK)
qtawesome >=1.0.2             :  1.1.1 (OK)
qtconsole >=5.2.1;<5.3.0      :  5.2.2 (OK)
qtpy >=1.5.0                  :  2.0.0 (OK)
rtree >=0.9.7                 :  0.9.7 (OK)
setuptools >=49.6.0           :  60.2.0 (OK)
sphinx >=0.6.6                :  4.3.2 (OK)
spyder_kernels >=2.2.0;<2.3.0 :  2.2.0 (OK)
textdistance >=4.2.0          :  4.2.2 (OK)
three_merge >=0.1.1           :  0.1.1 (OK)
watchdog >=0.10.3             :  2.1.6 (OK)
zmq >=17                      :  22.3.0 (OK)

# Optional:
cython >=0.21                 :  None (NOK)
matplotlib >=2.0.0            :  None (NOK)
numpy >=1.7                   :  1.22.0 (OK)
pandas >=1.1.1                :  None (NOK)
scipy >=0.17.0                :  1.7.3 (OK)
sympy >=0.7.3                 :  1.10.dev (OK)
steff456 commented 2 years ago

Hi @oscargus,

I followed your instructions, but I was unable to reproduce this issue in macOS. Do you have any other case that I can try it on?

oscargus commented 2 years ago

Thanks for looking into it.

I just tried it again and it still behaves like that. I also tried it on my office Linux machine right now (5.0.5) and happens there as well. I can try on my home Linux machine later on tonight.

Maybe you can try with a simpler example (only two files involved).

  1. Create a new file, write some valid code and save it, say "new.py".
  2. Use "Save as..." for that file and save under a new name, say "new2.py"
  3. Open the first file, "new.py", (keeping the second open), edit it to get an error.
  4. Watch the error show up on the sidebar of both files. (No need to split screens etc even, I did that just to get a good screen shot.)

(I might try to capture a video if it doesn't work out.)

oscargus commented 2 years ago

I can just confirm that the same thing happens on my home Linux computer (Spyder 5.2.1, Python 3.10).

I'll see if I can record a video of it.