Comments (8)
This may have to do with the inability to pickle memoryview
objects, see https://bugs.python.org/issue27098
from pcbasic.
- Does not happen if we simply define a variable
i
. - Does not happen if we allow the program to finish and then exit.
- Does happen if we include a
STOP
statement and exit after the break. - Also happens if we interrupt PC-BASIC with
Alt+F4
while the program is running.
from pcbasic.
Another suspect is the ByteStream
class which is derived from _pyio.BytesIO
from pcbasic.
10 i=1: goto 10
does not have the issue. FOR
loops only?
from pcbasic.
interpreter.py
lines 385, 386:
counter_view = self._scalars.view(varname)
self.for_stack.append((varname, counter_view, stop, step, step.sign(), forpos, nextpos,))
This stores a view in a structure that is to be pickled - may be the cause?
from pcbasic.
The memoryview
is the issue. Apparently I'm storing most variables simply as bytearray
s, but in a FOR
-loop I'm keeping a copy of the Value
object, which contains a memoryview
. Adding __setstate__
and __getstate__
to Value
to convert the memoryview
to bytearray
and back avoids the crash, but cuts the connection between the loop variable and the view of it which is being incremented.
from pcbasic.
As far as I can see, the loop record contains the Value
objects counter_view
, stop
and step
. Not sure why the Scalars
object itself pickles without problems in the absence of a FOR
-loop.
from pcbasic.
Fixed by 35e5640
from pcbasic.
Related Issues (20)
- DEF FN clobbers variables in argument list HOT 2
- `CONT` should be allowed after `END` HOT 1
- once-working 2.0.4 release now fails to launch on macOS 12.x HOT 4
- dependency libSDL2 not built for Apple Silicon HOT 10
- `pkg_resources` issues with `.deb` package on Ubuntu 22.04 HOT 10
- `PCOPY` has no effect HOT 4
- Crash in `DRAW` statement on type mismatch in linked variable HOT 3
- USAGE.txt missing HOT 4
- Crash attempting to save a program as binary with text-encoding HOT 2
- Bug fix for when reading raw exernal text files with sequencial input mode "I" HOT 2
- Crash on fixed-point `PRINT USING` of small floats HOT 3
- SAVE" BUG HOT 1
- PC-BASIC2.0.6 wont start - VCRUNTIME140.dll not found HOT 5
- crash report after a program break followed by listing a single line HOT 2
- Bug in PCBASIC 2.0.7 for Linux won't open due by DBUS error HOT 7
- Crash when running `AUTO .` HOT 1
- MOD operator returns wrong results for negative argument HOT 3
- Greek codepages, didn't work for me. HOT 2
- chdir ".." nothing changes. HOT 1
- LLIST command does not produce output until program is closed HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pcbasic.