@@ -745,16 +745,19 @@ def push(self, s, insert_into_history=True):
745
745
s = s .rstrip ('\n ' )
746
746
self .buffer .append (s )
747
747
748
- if insert_into_history and self .config .hist_length :
749
- histfilename = os .path .expanduser (self .config .hist_file )
750
- self .rl_history .entries = []
751
- if os .path .exists (histfilename ):
752
- self .rl_history .load (histfilename , getpreferredencoding ())
753
- self .rl_history .append (s )
754
- try :
755
- self .rl_history .save (histfilename , getpreferredencoding (), self .config .hist_length )
756
- except EnvironmentError as (errno , strerr ):
757
- self .interact .notify ("Write error for file: %s. %s " % (histfilename , strerr ))
748
+ if insert_into_history :
749
+ if self .config .hist_length :
750
+ histfilename = os .path .expanduser (self .config .hist_file )
751
+ self .rl_history .entries = []
752
+ if os .path .exists (histfilename ):
753
+ self .rl_history .load (histfilename , getpreferredencoding ())
754
+ self .rl_history .append (s )
755
+ try :
756
+ self .rl_history .save (histfilename , getpreferredencoding (), self .config .hist_length )
757
+ except EnvironmentError as (errno , strerr ):
758
+ self .interact .notify ("Write error for file: %s. %s " % (histfilename , strerr ))
759
+ else :
760
+ self .rl_history .append (s )
758
761
759
762
more = self .interp .runsource ('\n ' .join (self .buffer ))
760
763
0 commit comments