robhagemans / pcbasic

PC-BASIC - A free, cross-platform emulator for the GW-BASIC family of interpreters
http://www.pc-basic.org
Other
399 stars 48 forks source link

pcbasic AUTO crashes if line already exists #97

Closed sjweierman closed 5 years ago

sjweierman commented 5 years ago

Bug report

Problem Attempting to skip overwriting a line while using AUTO causes a crash.

I was expecting the behaviour as documented in GW-BASIC User's Guide:

"If AUTO generates a line number that is already being used, an asterisk appears after the number to warn that any input will replace the existing line. However, pressing return immediately after the asterisk saves the line and generates the next line number."

Steps

  1. create any simple program: ie. 10 CLS
  2. AUTO
  3. Press enter after 10* to attempt to skip overwriting line 10

Program

Crash log PC-BASIC crash log

FATAL ERROR version 2.0.2 [66c62e30f] v2.0.2 2019-02-10 09:09:51.819136 python 3.6.7 [64bit ELF] platform Linux-4.18.0-16-generic-x86_64-with-Ubuntu-18.10-cosmic interface VideoSDL2, AudioSDL2 statement :AUTO

main.py:114, run_session api.py:124, interact implementation.py:324, interact implementation.py:378, _auto_step TypeError: an integer is required

This is a bug in PC-BASIC. Sorry about that. To help improve PC-BASIC, please file a bug report at https://github.com/robhagemans/pcbasic/issues Please include the messages above and as much information as you can about what you were doing and how this happened. Please attach the log file /home/sjw/.local/share/pcbasic-2.0/crash-20190324-bfrpt6og.log Thank you!

Press a key to close this window. Traceback (most recent call last): File "/usr/local/lib/python3.6/dist-packages/pcbasic/guard.py", line 66, in protect yield File "/usr/local/lib/python3.6/dist-packages/pcbasic/main.py", line 114, in run_session session.interact() File "/usr/local/lib/python3.6/dist-packages/pcbasic/basic/api.py", line 124, in interact self._impl.interact() File "/usr/local/lib/python3.6/dist-packages/pcbasic/basic/implementation.py", line 324, in interact self._auto_step() File "/usr/local/lib/python3.6/dist-packages/pcbasic/basic/implementation.py", line 378, in _auto_step line[len(numstr)] = b' ' TypeError: an integer is required

==== Screen Pages ================================================================================== +--------------------------------------------------------------------------------+ 0 |PC-BASIC 2.0.2 | 14 1 |(C) Copyright 2013--2019 Rob Hagemans. | 38 2 |60300 Bytes free | 16 3 |Ok? | 3 4 |auto | 4 5 |10 cls | 6 6 |20 | 3 7 |Ok? | 3 8 |auto | 4 9 |10* | 3 10 | | 0 11 | | 0 12 | | 0 13 | | 0 14 | | 0 15 | | 0 16 | | 0 17 | | 0 18 | | 0 19 | | 0 20 | | 0 21 | | 0 22 | | 0 23 | | 0 24 | 1LIST 2RUN 3LOAD" 4SAVE" 5CONT 6,"LPT1 7TRON 8TROFF 9KEY 0SCREEN| 80 +--------------------------------------------------------------------------------+ +--------------------------------------------------------------------------------+ 0 | | 0 1 | | 0 2 | | 0 3 | | 0 4 | | 0 5 | | 0 6 | | 0 7 | | 0 8 | | 0 9 | | 0 10 | | 0 11 | | 0 12 | | 0 13 | | 0 14 | | 0 15 | | 0 16 | | 0 17 | | 0 18 | | 0 19 | | 0 20 | | 0 21 | | 0 22 | | 0 23 | | 0 24 | | 0 +--------------------------------------------------------------------------------+ +--------------------------------------------------------------------------------+ 0 | | 0 1 | | 0 2 | | 0 3 | | 0 4 | | 0 5 | | 0 6 | | 0 7 | | 0 8 | | 0 9 | | 0 10 | | 0 11 | | 0 12 | | 0 13 | | 0 14 | | 0 15 | | 0 16 | | 0 17 | | 0 18 | | 0 19 | | 0 20 | | 0 21 | | 0 22 | | 0 23 | | 0 24 | | 0 +--------------------------------------------------------------------------------+ +--------------------------------------------------------------------------------+ 0 | | 0 1 | | 0 2 | | 0 3 | | 0 4 | | 0 5 | | 0 6 | | 0 7 | | 0 8 | | 0 9 | | 0 10 | | 0 11 | | 0 12 | | 0 13 | | 0 14 | | 0 15 | | 0 16 | | 0 17 | | 0 18 | | 0 19 | | 0 20 | | 0 21 | | 0 22 | | 0 23 | | 0 24 | | 0 +--------------------------------------------------------------------------------+ ==== Scalars =======================================================================================

==== Arrays ========================================================================================

==== Strings =======================================================================================

==== Program Buffer ================================================================================ b'00' b'7412' (+006) b'0a00' [00010] b'c0000000' b'00' b'0000' (ENDS) b'' b'' ==== Program ======================================================================================= 10 CLS ==== Options ======================================================================================= []

Notes

PC-BASIC version:
Operating system version:

Pop!_OS 18.10

robhagemans commented 5 years ago

Hi, thanks for the bug report!

This Python-3 specific issue has already been resolved on the develop branch and the fix will be included in the next release version.