mirror of
https://github.com/kennethreitz-archive/bpython-gist.git
synced 2026-06-05 23:50:18 +00:00
Bug fix re: PYTHONSTARTUP
I've never used this feature but Thorsten Kampe reported problems with it. Unfortunately the way I was parsing the file was line-by-line which was causing bpython to blow up when it encountered a double line-break, which was pretty stupid on my part. It now takes the whole file at once.
This commit is contained in:
+9
-8
@@ -789,14 +789,14 @@ class Repl( object ):
|
||||
entered for using up/down to go back and forth (which has to be separate
|
||||
to the evaluation history, which will be truncated when undoing."""
|
||||
|
||||
# This was a feature request to have the PYTHONSTARTUP
|
||||
# file executed on startup - I personally don't use this
|
||||
# feature so please notify me of any breakage.
|
||||
# This was a feature request to have the PYTHONSTARTUP
|
||||
# file executed on startup - I personally don't use this
|
||||
# feature so please notify me of any breakage.
|
||||
filename = os.environ.get('PYTHONSTARTUP')
|
||||
if filename and os.path.isfile(filename):
|
||||
for line in open(filename, 'r'):
|
||||
self.push( line )
|
||||
self.push( '\n' )
|
||||
f = open(filename, 'r')
|
||||
self.interp.runsource(f.read())
|
||||
f.close()
|
||||
|
||||
# The regular help() function uses PAGER to display the help, which
|
||||
# screws with bpython.
|
||||
@@ -826,8 +826,9 @@ class Repl( object ):
|
||||
self.h_i = 0
|
||||
self.history.append( inp )
|
||||
self.s_hist[-1] += self.f_string
|
||||
self.stdout_hist += inp + '\n'#.rstrip('\n')
|
||||
self.rl_hist.append( inp ) # Keep two copies so you can go up and down in the hist
|
||||
self.stdout_hist += inp + '\n'
|
||||
# Keep two copies so you can go up and down in the hist:
|
||||
self.rl_hist.append( inp )
|
||||
more = self.push( inp )
|
||||
|
||||
def size( self ):
|
||||
|
||||
Reference in New Issue
Block a user