Issue41373
Created on 2020-07-23 03:47 by terry.reedy, last changed 2020-07-26 07:22 by serhiy.storchaka. This issue is now closed.
| Pull Requests | |||
|---|---|---|---|
| URL | Status | Linked | Edit |
| PR 21597 | merged | serhiy.storchaka, 2020-07-23 06:02 | |
| PR 21610 | merged | miss-islington, 2020-07-25 03:21 | |
| PR 21611 | merged | miss-islington, 2020-07-25 03:22 | |
| Messages (8) | |||
|---|---|---|---|
| msg374119 - (view) | Author: Terry J. Reedy (terry.reedy) * | Date: 2020-07-23 03:47 | |
#41300 fixed one bug in the patch for #41158. A user reported another on on idle-dev list. Create a file in Windows Explorer. Leave as .txt or rename to .py. Right click and Edit with IDLE 3.8 (.4/.5 or 3.9.0b4 or 5). Edit works, Save (or Run) does not. Open the same file from Command Prompt, change it, and trying to save produces Exception in Tkinter callback Traceback (most recent call last): File "C:\Programs\Python38\lib\tkinter\__init__.py", line 1883, in __call__ return self.func(*args) File "C:\Programs\Python38\lib\idlelib\multicall.py", line 176, in handler r = l[i](event) File "C:\Programs\Python38\lib\idlelib\iomenu.py", line 200, in save if self.writefile(self.filename): File "C:\Programs\Python38\lib\idlelib\iomenu.py", line 232, in writefile text = self.fixnewlines() File "C:\Programs\Python38\lib\idlelib\iomenu.py", line 252, in fixnewlines text = text.replace("\n", self.eol_convention) TypeError: replace() argument 2 must be str, not None The replacement line is guarded with if self.eol_convention != "\n": Either the condition should be include 'and self.eol_convention is not None' or the setting of the attribute should be changed. I will look into how it was set before the #41158 patch. |
|||
| msg374121 - (view) | Author: Serhiy Storchaka (serhiy.storchaka) * | Date: 2020-07-23 06:00 | |
I missed that the file's attribute newlines can be None if no line separators were read. It can also be a tuple if mixed newlines are used. I think that eol_convention should be set to the default value os.linesep in these cases. I am currently not able to test this since IDLE does not work on my computer after upgrading to Ubuntu 20.04. |
|||
| msg374127 - (view) | Author: Terry J. Reedy (terry.reedy) * | Date: 2020-07-23 08:16 | |
So loading an externally created blank file (on any system) results in None. File=>New must set eol_convention, I presume to the same default. Before I got the traceback, I though it might be an issue with the Windows utf-8 BOM being added. 3.9.0rc1 is due August 10. It should have fix and new tests. |
|||
| msg374164 - (view) | Author: Raymond Hettinger (rhettinger) * | Date: 2020-07-24 08:37 | |
Bumping-up the priority. Today, I and a (virtual) room full of engineers simultaneously hit this problem and we all lost work. See issue41378 |
|||
| msg374165 - (view) | Author: Terry J. Reedy (terry.reedy) * | Date: 2020-07-24 09:08 | |
Raymond, I tested patch today and expect to apply it (without unittests yet) tomorrow, so will be in 3.9.0rc1 abd 3.8.6. In the meanwhile, either create new files within IDLE (File=>NEW) or add "isinstance(self.eol_convention, str) and " after 'if' on line 251 of idlelib/iomenu.py, just before the line in the traceback. The added check will be put elsewhere by the patch, but it should work on 251. |
|||
| msg374227 - (view) | Author: Terry J. Reedy (terry.reedy) * | Date: 2020-07-25 03:21 | |
New changeset 0dd463c8a4269137ebed7cc29605c555030df94f by Serhiy Storchaka in branch 'master': bpo-41373: IDLE: Fix saving files loaded with no newlines or mixed newlines (GH-21597) https://github.com/python/cpython/commit/0dd463c8a4269137ebed7cc29605c555030df94f |
|||
| msg374228 - (view) | Author: miss-islington (miss-islington) | Date: 2020-07-25 03:38 | |
New changeset 1c562ced2123f4d5a250fe9072ac93504cc41967 by Miss Islington (bot) in branch '3.8': bpo-41373: IDLE: Fix saving files loaded with no newlines or mixed newlines (GH-21597) https://github.com/python/cpython/commit/1c562ced2123f4d5a250fe9072ac93504cc41967 |
|||
| msg374229 - (view) | Author: miss-islington (miss-islington) | Date: 2020-07-25 03:39 | |
New changeset 15fdbb7145ee99abd98b4968307d4b89dd71a988 by Miss Islington (bot) in branch '3.9': bpo-41373: IDLE: Fix saving files loaded with no newlines or mixed newlines (GH-21597) https://github.com/python/cpython/commit/15fdbb7145ee99abd98b4968307d4b89dd71a988 |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2020-09-02 14:40:10 | terry.reedy | link | issue41691 superseder |
| 2020-08-13 17:09:48 | terry.reedy | link | issue41537 superseder |
| 2020-08-10 01:25:54 | terry.reedy | link | issue41512 superseder |
| 2020-07-26 07:22:38 | serhiy.storchaka | set | status: open -> closed resolution: fixed stage: patch review -> resolved |
| 2020-07-25 03:39:34 | miss-islington | set | messages: + msg374229 |
| 2020-07-25 03:38:52 | miss-islington | set | messages: + msg374228 |
| 2020-07-25 03:22:02 | miss-islington | set | pull_requests: + pull_request20753 |
| 2020-07-25 03:21:54 | miss-islington | set | nosy:
+ miss-islington pull_requests:
+ pull_request20752 |
| 2020-07-25 03:21:39 | terry.reedy | set | messages: + msg374227 |
| 2020-07-24 11:18:36 | eamanu | set | nosy:
+ eamanu |
| 2020-07-24 09:08:04 | terry.reedy | set | messages: + msg374165 |
| 2020-07-24 08:37:40 | rhettinger | set | priority: normal -> high nosy: + rhettinger messages: + msg374164 |
| 2020-07-24 05:50:02 | serhiy.storchaka | link | issue41378 superseder |
| 2020-07-23 08:16:21 | terry.reedy | set | messages:
+ msg374127 stage: patch review -> test needed |
| 2020-07-23 06:02:37 | serhiy.storchaka | set | keywords:
+ patch stage: test needed -> patch review pull_requests: + pull_request20736 |
| 2020-07-23 06:00:15 | serhiy.storchaka | set | nosy:
+ serhiy.storchaka messages: + msg374121 |
| 2020-07-23 03:47:16 | terry.reedy | create | |