robhagemans / pcbasic

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

Crash on "just" line number as input #114

Closed KedalionDaimon closed 4 years ago

KedalionDaimon commented 4 years ago

Bug report

Problem

When you input JUST a line number, e.g.:

10

Steps

  1. Input the following program: 10

    • it will crash immediately.

Program

Crash log

PC-BASIC crash log

FATAL ERROR version 2.0.2 [] 2020-01-19 08:56:22 python 3.8.2 [64bit ELF] platform Linux-5.4.0-31-generic-x86_64-with-glibc2.29 interface VideoSDL2, AudioSDL2 statement

contextlib.py:131, exit implementation.py:415, _handle_exceptions implementation.py:424, _handle_error program.py:98, get_line_number TypeError: '<=' not supported between instances of 'int' and 'NoneType'

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/archon/.local/share/pcbasic-2.0/crash-20200529-8d15mu8m.log Thank you!

Press a key to close this window. Traceback (most recent call last): File "/usr/lib/python3/dist-packages/pcbasic/basic/implementation.py", line 410, in _handle_exceptions yield File "/usr/lib/python3/dist-packages/pcbasic/basic/implementation.py", line 329, in interact self._prompt = not self._store_line(line) File "/usr/lib/python3/dist-packages/pcbasic/basic/implementation.py", line 362, in _store_line self.program.store_line(self.interpreter.direct_line) File "/usr/lib/python3/dist-packages/pcbasic/basic/program.py", line 180, in store_line raise error.BASICError(error.UNDEFINED_LINE_NUMBER) pcbasic.basic.base.error.BASICError

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/usr/lib/python3/dist-packages/pcbasic/guard.py", line 66, in protect yield File "/usr/lib/python3/dist-packages/pcbasic/main.py", line 114, in run_session session.interact() File "/usr/lib/python3/dist-packages/pcbasic/basic/api.py", line 124, in interact self._impl.interact() File "/usr/lib/python3/dist-packages/pcbasic/basic/implementation.py", line 329, in interact self._prompt = not self._store_line(line) File "/usr/lib/python3.8/contextlib.py", line 131, in exit self.gen.throw(type, value, traceback) File "/usr/lib/python3/dist-packages/pcbasic/basic/implementation.py", line 415, in _handle_exceptions self._handle_error(e) File "/usr/lib/python3/dist-packages/pcbasic/basic/implementation.py", line 424, in _handle_error self.screen.write(e.get_message(self.program.get_line_number(e.pos))) File "/usr/lib/python3/dist-packages/pcbasic/basic/program.py", line 98, in get_line_number if linum_pos <= pos and linum > pre: TypeError: '<=' not supported between instances of 'int' and 'NoneType'

==== 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 |10 | 2 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 | 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'0000' (ENDS) b'' b'' ==== Program ======================================================================================= ==== Options ======================================================================================= []

Notes

PC-BASIC version: 2.0.2 Operating system version: Ubuntu Focal Fossa

robhagemans commented 4 years ago

Hi, thanks for reporting. Looks like this is caused by a change in behaviour in Python 3.8 so until it's fixed you can try running in 3.7

On Fri, 29 May 2020, 19:45 Nino Ivanov, notifications@github.com wrote:

Bug report

Problem

When you input JUST a line number, e.g.:

10

  • then pcbasic crashes with a sort of bluescreen. This was, however, a popular way of deleting lines: you input "empty" numbers, and thus delete whatever was there before.

Steps

  1. Input the following program: 10

    • it will crash immediately.

Program

Crash log PC-BASIC crash log

FATAL ERROR version 2.0.2 [] 2020-01-19 08:56:22 python 3.8.2 [64bit ELF] platform Linux-5.4.0-31-generic-x86_64-with-glibc2.29 interface VideoSDL2, AudioSDL2 statement

contextlib.py:131, exit implementation.py:415, _handle_exceptions implementation.py:424, _handle_error program.py:98, get_line_number TypeError: '<=' not supported between instances of 'int' and 'NoneType'

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/archon/.local/share/pcbasic-2.0/crash-20200529-8d15mu8m.log Thank you!

Press a key to close this window. Traceback (most recent call last): File "/usr/lib/python3/dist-packages/pcbasic/basic/implementation.py", line 410, in _handle_exceptions yield File "/usr/lib/python3/dist-packages/pcbasic/basic/implementation.py", line 329, in interact self._prompt = not self._store_line(line) File "/usr/lib/python3/dist-packages/pcbasic/basic/implementation.py", line 362, in _store_line self.program.store_line(self.interpreter.direct_line) File "/usr/lib/python3/dist-packages/pcbasic/basic/program.py", line 180, in store_line raise error.BASICError(error.UNDEFINED_LINE_NUMBER) pcbasic.basic.base.error.BASICError

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/usr/lib/python3/dist-packages/pcbasic/guard.py", line 66, in protect yield File "/usr/lib/python3/dist-packages/pcbasic/main.py", line 114, in run_session session.interact() File "/usr/lib/python3/dist-packages/pcbasic/basic/api.py", line 124, in interact self._impl.interact() File "/usr/lib/python3/dist-packages/pcbasic/basic/implementation.py", line 329, in interact self._prompt = not self._store_line(line) File "/usr/lib/python3.8/contextlib.py", line 131, in exit self.gen.throw(type, value, traceback) File "/usr/lib/python3/dist-packages/pcbasic/basic/implementation.py", line 415, in _handle_exceptions self._handle_error(e) File "/usr/lib/python3/dist-packages/pcbasic/basic/implementation.py", line 424, in _handle_error self.screen.write(e.get_message(self.program.get_line_number(e.pos))) File "/usr/lib/python3/dist-packages/pcbasic/basic/program.py", line 98, in get_line_number if linum_pos <= pos and linum > pre: TypeError: '<=' not supported between instances of 'int' and 'NoneType'

==== 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 |10 | 2 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 | 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'0000' (ENDS) b'' b'' ==== Program

==== Options

[]

Notes

PC-BASIC version: 2.0.2 Operating system version: Ubuntu Focal Fossa

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/robhagemans/pcbasic/issues/114, or unsubscribe https://github.com/notifications/unsubscribe-auth/AB25RES4H5BMJBFOU6EOWE3RT77DFANCNFSM4NOIQLNA .

robhagemans commented 4 years ago

Issue no longer occurs on python 3.8 in develop branch

KedalionDaimon commented 4 years ago

Hey Rob,

Sorry, it still persists in Python 3.9 on Ubuntu 20.04, and moreover, the deb is not installable as it complains about some missing python-serial and python-parallel dependencies.

Just write this:

10

Really sorry about the hassle.

Kind regards,

Nino

KedalionDaimon commented 4 years ago

WITHDRAWING MY REPORT!

Dear Rob

I needed to re-install pcbasic. And I confirm:

Kind regards,

Nino

2020-10-25 12:25 GMT+01:00, Kedalion Daimon kedalion.daimon@gmail.com:

Hey Rob,

Sorry, it still persists in Python 3.9 on Ubuntu 20.04, and moreover, the deb is not installable as it complains about some missing python-serial and python-parallel dependencies.

Just write this:

10

  • and press Enter, and it will crash.

Really sorry about the hassle.

Kind regards,

Nino