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
Message
Author
Korbiwe
Newbie
Posts: 4
Joined: Mon Jul 17, 2017 7:55 am
Github: Korbiwe
Contact:

Bug: Sets in dictionaries not using RevertableSet

#1 Post by Korbiwe »

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' }) }
Attachments
bug_report.png

Human Bolt Diary
Regular
Posts: 111
Joined: Fri Oct 11, 2013 12:46 am
Contact:

Re: Bug: Sets in dictionaries not using RevertableSet

#2 Post by Human Bolt Diary »

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:
https://github.com/renpy/renpy/pull/1037

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