cpython: 2fe64ce5da05 (original) (raw)
Mercurial > cpython
changeset 84055:2fe64ce5da05 3.3
#18151, part 1: Backport idlelilb portion of Andrew Svetlov's 3.4 patch changing IOError to OSError (#16715). [#18151]
Terry Jan Reedy tjreedy@udel.edu | |
---|---|
date | Sat, 08 Jun 2013 00:22:45 -0400 |
parents | a0d8ae880ae6 |
children | 0be613638523 a2e093e98d45 |
files | Lib/idlelib/EditorWindow.py Lib/idlelib/GrepDialog.py Lib/idlelib/IOBinding.py Lib/idlelib/OutputWindow.py Lib/idlelib/PyShell.py Lib/idlelib/configHandler.py Lib/idlelib/rpc.py Lib/idlelib/textView.py |
diffstat | 8 files changed, 18 insertions(+), 22 deletions(-)[+] [-] Lib/idlelib/EditorWindow.py 2 Lib/idlelib/GrepDialog.py 2 Lib/idlelib/IOBinding.py 4 Lib/idlelib/OutputWindow.py 2 Lib/idlelib/PyShell.py 8 Lib/idlelib/configHandler.py 18 Lib/idlelib/rpc.py 2 Lib/idlelib/textView.py 2 |
line wrap: on
line diff
--- a/Lib/idlelib/EditorWindow.py +++ b/Lib/idlelib/EditorWindow.py @@ -901,7 +901,7 @@ class EditorWindow(object): with open(self.recent_files_path, 'w', encoding='utf_8', errors='replace') as rf_file: rf_file.writelines(rf_list)
except IOError as err:[](#l1.7)
except OSError as err:[](#l1.8) if not getattr(self.root, "recentfilelist_error_displayed", False):[](#l1.9) self.root.recentfilelist_error_displayed = True[](#l1.10) tkMessageBox.showerror(title='IDLE Error',[](#l1.11)
--- a/Lib/idlelib/GrepDialog.py +++ b/Lib/idlelib/GrepDialog.py @@ -82,7 +82,7 @@ class GrepDialog(SearchDialogBase): for fn in list: try: f = open(fn, errors='replace')
except IOError as msg:[](#l2.7)
except OSError as msg:[](#l2.8) print(msg)[](#l2.9) continue[](#l2.10) lineno = 0[](#l2.11)
--- a/Lib/idlelib/IOBinding.py +++ b/Lib/idlelib/IOBinding.py @@ -213,7 +213,7 @@ class IOBinding: f.seek(0) bytes = f.read() f.close()
except IOError as msg:[](#l3.7)
except OSError as msg:[](#l3.8) tkMessageBox.showerror("I/O Error", str(msg), master=self.text)[](#l3.9) return False[](#l3.10) chars, converted = self._decode(two_lines, bytes)[](#l3.11)
@@ -378,7 +378,7 @@ class IOBinding: f.flush() f.close() return True
except IOError as msg:[](#l3.16)
except OSError as msg:[](#l3.17) tkMessageBox.showerror("I/O Error", str(msg),[](#l3.18) master=self.text)[](#l3.19) return False[](#l3.20)
--- a/Lib/idlelib/OutputWindow.py +++ b/Lib/idlelib/OutputWindow.py @@ -106,7 +106,7 @@ class OutputWindow(EditorWindow): f = open(filename, "r") f.close() break
except IOError:[](#l4.7)
except OSError:[](#l4.8) continue[](#l4.9) else:[](#l4.10) return None[](#l4.11)
--- a/Lib/idlelib/PyShell.py +++ b/Lib/idlelib/PyShell.py @@ -59,7 +59,7 @@ else: try: file.write(warnings.formatwarning(message, category, filename, lineno, line=line))
except IOError:[](#l5.7)
warnings.showwarning = idle_showwarning def idle_formatwarning(message, category, filename, lineno, line=None): @@ -213,7 +213,7 @@ class PyShellEditorWindow(EditorWindow): try: with open(self.breakpointPath, "r") as fp: lines = fp.readlines()except OSError:[](#l5.8) pass ## file (probably __stderr__) is invalid, warning dropped.[](#l5.9)
except IOError:[](#l5.16)
except OSError:[](#l5.17) lines = [][](#l5.18) try:[](#l5.19) with open(self.breakpointPath, "w") as new_file:[](#l5.20)
@@ -224,7 +224,7 @@ class PyShellEditorWindow(EditorWindow): breaks = self.breakpoints if breaks: new_file.write(filename + '=' + str(breaks) + '\n')
except IOError as err:[](#l5.25)
except OSError as err:[](#l5.26) if not getattr(self.root, "breakpoint_error_displayed", False):[](#l5.27) self.root.breakpoint_error_displayed = True[](#l5.28) tkMessageBox.showerror(title='IDLE Error',[](#l5.29)
@@ -532,7 +532,7 @@ class ModifiedInterpreter(InteractiveInt return try: response = clt.pollresponse(self.active_seq, wait=0.05)
except (EOFError, IOError, KeyboardInterrupt):[](#l5.34)
except (EOFError, OSError, KeyboardInterrupt):[](#l5.35) # lost connection or subprocess terminated itself, restart[](#l5.36) # [the KBI is from rpc.SocketIO.handle_EOF()][](#l5.37) if self.tkconsole.closing:[](#l5.38)
--- a/Lib/idlelib/configHandler.py +++ b/Lib/idlelib/configHandler.py @@ -142,7 +142,7 @@ class IdleUserConfParser(IdleConfParser) fname = self.file try: cfgFile = open(fname, 'w')
except IOError:[](#l6.7)
except OSError:[](#l6.8) os.unlink(fname)[](#l6.9) cfgFile = open(fname, 'w')[](#l6.10) with cfgFile:[](#l6.11)
@@ -207,7 +207,7 @@ class IdleConf: userDir+',\n but the path does not exist.\n') try: sys.stderr.write(warn)
except IOError:[](#l6.16)
except OSError:[](#l6.17) pass[](#l6.18) userDir = '~'[](#l6.19) if userDir == "~": # still no path to home
@@ -217,7 +217,7 @@ class IdleConf: if not os.path.exists(userDir): try: os.mkdir(userDir)
except (OSError, IOError):[](#l6.25)
except OSError:[](#l6.26) warn = ('\n Warning: unable to create user config directory\n'+[](#l6.27) userDir+'\n Check path and permissions.\n Exiting!\n\n')[](#l6.28) sys.stderr.write(warn)[](#l6.29)
@@ -251,7 +251,7 @@ class IdleConf: raw=raw))) try: sys.stderr.write(warning)
except IOError:[](#l6.34)
except OSError:[](#l6.35) pass[](#l6.36) try:[](#l6.37) if self.defaultCfg[configType].has_option(section,option):[](#l6.38)
@@ -268,13 +268,11 @@ class IdleConf: (option, section, default)) try: sys.stderr.write(warning)
except IOError:[](#l6.43)
except OSError:[](#l6.44) pass[](#l6.45) return default[](#l6.46)
- def SetOption(self, configType, section, option, value): """In user's config file, set section's option to value. - """ self.userCfg[configType].SetOption(section, option, value) @@ -380,7 +378,7 @@ class IdleConf: (element, themeName, theme[element])) try: sys.stderr.write(warning)
except IOError:[](#l6.58)
except OSError:[](#l6.59) pass[](#l6.60) colour=cfgParser.Get(themeName,element,default=theme[element])[](#l6.61) theme[element]=colour[](#l6.62)
@@ -637,13 +635,11 @@ class IdleConf: (event, keySetName, keyBindings[event])) try: sys.stderr.write(warning)
except IOError:[](#l6.67)
except OSError:[](#l6.68) pass[](#l6.69) return keyBindings[](#l6.70)
- def GetExtraHelpSourceList(self,configSet): """Fetch list of extra help sources from a given configSet. - Valid configSets are 'user' or 'default'. Return a list of tuples of the form (menu_item , path_to_help_file , option), or return the empty list. 'option' is the sequence number of the help resource. 'option'
--- a/Lib/idlelib/rpc.py +++ b/Lib/idlelib/rpc.py @@ -339,7 +339,7 @@ class SocketIO(object): r, w, x = select.select([], [self.sock], []) n = self.sock.send(s[:BUFSIZE]) except (AttributeError, TypeError):
raise IOError("socket no longer exists")[](#l7.7)
raise OSError("socket no longer exists")[](#l7.8) except socket.error:[](#l7.9) raise[](#l7.10) else:[](#l7.11)
--- a/Lib/idlelib/textView.py +++ b/Lib/idlelib/textView.py @@ -66,7 +66,7 @@ def view_file(parent, title, filename, e try: with open(filename, 'r', encoding=encoding) as file: contents = file.read()