Bug: Sets in dictionaries not using RevertableSet

In this forum we discuss the future of Ren'Py, both bug fixes and longer-term development. Pre-releases are announced and discussed here.
Post Reply
Posts: 1
Joined: Mon Jul 17, 2017 7:55 am
Github: Korbiwe

Bug: Sets in dictionaries not using RevertableSet

#1 Post by Korbiwe » Mon Jul 17, 2017 8:14 am

So, I have a dictionary inside an init python block inside a class with keys being strings and values being sets of strings:

Code: Select all

self.trait_table = { 'positive' : { 'curiosity', 'responsiveness', 'mindfulness', 'responsibility' }, 
                            'negative' : { 'mean', 'passive', 'inattentiveness', 'deceitfulness' },
                            'poetic' : { 'idealism', 'inventiveness', 'carefulness' },
                            'prosaic' : { 'pragmatism', 'skepticism', 'cynism' } }
And when trying to use & operator with something converted to RevertableSet with set() I get an error, that says that operand & accepting types set and RevertableSet doesn't exist (screenshot attached).

When manually changing dictionary to use the RevertableSet (code below) everything works just fine. This is not necessarily a bug, could be just an undersight, but it took some time for me to figure out the whole RevertabtableSet thing.

Code: Select all

self.trait_table = { 'positive' : set({ 'curiosity', 'responsiveness', 'mindfulness', 'responsibility' }), 
                            'negative' : set({ 'mean', 'passive', 'inattentiveness', 'deceitfulness' }),
                            'poetic' : set({ 'idealism', 'inventiveness', 'carefulness' }),
                            'prosaic' : set({ 'pragmatism', 'skepticism', 'cynism' }) }

Human Bolt Diary
Posts: 48
Joined: Fri Oct 11, 2013 12:46 am

Re: Bug: Sets in dictionaries not using RevertableSet

#2 Post by Human Bolt Diary » Wed Jul 19, 2017 7:58 pm

I recommend you file this issue in the Ren'Py bug tracker: https://github.com/renpy/renpy/issues

This PR related to Sets would, I'm fairly certain, fix your issue:

You could probably extract the part of those changes that adds the visit_Set function if you really need it.

Post Reply

Who is online

Users browsing this forum: No registered users