potential return stack corruption ?

Discuss how to use the Ren'Py engine to create visual novels and story-based games. New releases are announced in this section.
Forum rules
This is the right place for Ren'Py help. Please ask one question per thread, use a descriptive subject like 'NotFound error in option.rpy' , and include all the relevant information - especially any relevant code and traceback messages. Use the code tag to format scripts.
Post Reply
Message
Author
booom414
Newbie
Posts: 11
Joined: Mon Sep 04, 2017 5:56 pm
Contact:

potential return stack corruption ?

#1 Post by booom414 »

Hello my code

Code: Select all

init:

    python:    <---- line 18
        global arr
        global entries

    $ arr=dict()
    $ entries=[]
gives a exception that i can ignore and the game works fine

Code: Select all

I'm sorry, but an uncaught exception occurred.

While running game code:
  File "game/script.rpy", line 18, in script
    python:
Exception: Potential return stack corruption: dynamic=1 return=0

-- Full Traceback ------------------------------------------------------------

Full traceback:
  File "game/script.rpy", line 18, in script
    python:
  File "C:\Users\USER\Downloads\renpysdk\renpy\execution.py", line 349, in check_stacks
    raise e
Exception: Potential return stack corruption: dynamic=1 return=0

Windows-8-6.2.9200
Ren'Py 6.99.12.3.2123
but can't compile any releases with it so is there a way to fix it or to suppress the exception?

User avatar
xela
Lemma-Class Veteran
Posts: 2481
Joined: Sun Sep 18, 2011 10:13 am
Contact:

Re: potential return stack corruption ?

#2 Post by xela »

Code: Select all

init:
    $ arr = dict()
    $ entries = []
This is already global. Declaring it as such when you are already on global scope is a no-no. Get rid of that and it should work fine. Assuming that it's what causing the issue, it should disappear after it is removed.
Like what we're doing? Support us at:
Image

booom414
Newbie
Posts: 11
Joined: Mon Sep 04, 2017 5:56 pm
Contact:

Re: potential return stack corruption ?

#3 Post by booom414 »

Code: Select all

init:


    $ arr = dict()   <---- line 20
    $ entries = []

    python:
        global this
        this=This()
        global wtevent
        global screens
        screens=ScreenCollection()
        global choose
        choose=None
        global time
        time=Time()
        global music
        music=Music()
done it but still have the same problem now only not at the python: but at dict

Code: Select all

I'm sorry, but an uncaught exception occurred.

While running game code:
  File "game/script.rpy", line 20, in script
    
Exception: Potential return stack corruption: dynamic=1 return=0

-- Full Traceback ------------------------------------------------------------

Full traceback:
  File "game/script.rpy", line 20, in script
    
  File "C:\Users\USER\Downloads\renpysdk\renpy\execution.py", line 349, in check_stacks
    raise e
Exception: Potential return stack corruption: dynamic=1 return=0

Windows-8-6.2.9200
Ren'Py 6.99.12.3.2123

also can i ask what a potential stack corruption is / causes it? because it doesn't seem dire?

User avatar
xela
Lemma-Class Veteran
Posts: 2481
Joined: Sun Sep 18, 2011 10:13 am
Contact:

Re: potential return stack corruption ?

#4 Post by xela »

A number of thing can cause it, this error is thrown when there is a weird difference between length of dynamic and return stacks of your context.

You misunderstood what I was suggestion you to do. STOP declaring variables global while working on global namespace. Declare global only within functions and methods, nowhere else!
Like what we're doing? Support us at:
Image

booom414
Newbie
Posts: 11
Joined: Mon Sep 04, 2017 5:56 pm
Contact:

Re: potential return stack corruption ?

#5 Post by booom414 »

ah sorry XD

i'll do that just a force of habit sorry for the misunderstanding!

thank you for the help <3

edit1 :

still once i removed all global refrences it still gives the same error

Code: Select all

init:


    $ arr = dict() <----- line 20
    $ entries = []

    python:
        
        this=This()

        screens=ScreenCollection()

        choose=None

        time=Time()

        music=Music()


User avatar
xela
Lemma-Class Veteran
Posts: 2481
Joined: Sun Sep 18, 2011 10:13 am
Contact:

Re: potential return stack corruption ?

#6 Post by xela »

Looks ok. This should not cause crashes.
Like what we're doing? Support us at:
Image

booom414
Newbie
Posts: 11
Joined: Mon Sep 04, 2017 5:56 pm
Contact:

Re: potential return stack corruption ?

#7 Post by booom414 »

found the problem if i use

Code: Select all

init:
	python:
		stufff
	
	
	
	
	more stuff
	
it gives that error

but if i do it

Code: Select all

init python:
	stuff
	
	
	
	more stuff
it works fine so i prob had a indent problem or something down the line

User avatar
PyTom
Ren'Py Creator
Posts: 16096
Joined: Mon Feb 02, 2004 10:58 am
Completed: Moonlight Walks
Projects: Ren'Py
IRC Nick: renpytom
Github: renpytom
itch: renpytom
Location: Kings Park, NY
Contact:

Re: potential return stack corruption ?

#8 Post by PyTom »

I'm unable to repeat this in my development version of Ren'Py. Can I suggest trying out 6.99.12.4, to see if the problem is fixed there? If it's not, please zip up your game and send it to me so I can figure out what's wrong.
Supporting creators since 2004
(When was the last time you backed up your game?)
"Do good work." - Virgil Ivan "Gus" Grissom
Software > Drama • https://www.patreon.com/renpytom

booom414
Newbie
Posts: 11
Joined: Mon Sep 04, 2017 5:56 pm
Contact:

Re: potential return stack corruption ?

#9 Post by booom414 »

It's fixes tom

I had more code behind it so prob that was the cause

Fixed it by doing multiple init python: blocks and cleaning the code up a little

Post Reply

Who is online

Users browsing this forum: No registered users