-
-
Notifications
You must be signed in to change notification settings - Fork 8.2k
The unix version crashes #38
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I see you're using Ubuntu; which version do you have, so I can replicate? |
OS is gcc --version gives |
just as a side note. It seems the stack trace made github markdown go crazy and link this post with others. I tried to edit by putting a code fence block around the stack trace, but the links are still there. |
Yes, this is a bug. It doesn't crash for me, but prints the wrong number (10 times). If you want to try and fix it, enable debug output in runtime.c, at line 20. Then run the example again. |
I can confirm that the above program listing will segfault on ubuntu 12.04 using GCC. Using that setup, with the runtime.c debug output, I get:
|
And interestingly enough, changing the generator function in the original code to
results in a successful test, returning 0 through 9 as expected. |
Generator objects now allocate the object and the state in one malloc. This improvement fixes Issue #38.
Also, using the list comprehension, as:
will work just fine and dandy. For some reason, it just doesn't like the naked variable sitting there without something happening to it. Update: go figure while I'm digging around that you fix it. :-) |
It was a pretty nasty bug: I allocated enough memory for the state of the generator (to hold local variables and the stack), but I initialised the stack pointer to the last element, when it should be initialised to the position just after the last element of the state. This is because the stack is pre-decrement Sorry if I spoiled your fun! |
atmel-samd: Support auto-reset based on USB write activity.
closes files on deinit
Update from adafruit main
Cleanup fballoc stack on NLR.
Replaced the Color implementation to storing a single 16bit value.
The following code results in segmentation fault:
gen = (i for i in range(10))
for i in gen: print(i)
Compiling with debugging symbols (-g) and running though gdb gives this:
Current directory is /home/alex/micropython/unix/
GNU gdb (GDB) 7.5.91.20130417-cvs-ubuntu
Copyright (C) 2013 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later http://gnu.org/licenses/gpl.html
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
For bug reporting instructions, please see:
http://www.gnu.org/software/gdb/bugs/...
Reading symbols from /home/alex/micropython/unix/py...done.
(gdb) run
Starting program: /home/alex/micropython/unix/py
The text was updated successfully, but these errors were encountered: