Repository: renpy/renpy

Issue #3693: Wildcard imports are broken
Created: 2022-06-22T23:44:07Z
from x import * worked fine in r6 and early r7, but now it doesn't import anything (but also doesn't tell anything about it).
Should probably be restored for compatibility, especially since Python still allows to use * for imports.

Duplicate issue #4077: `from store import *` overriding `__name__` and `__package__` in PY2
Created: 2022-11-06T19:40:44Z
I've tried upgrading my game from RenPy 7.3.5 to 7.5.3 and ran into an issue with pickling classes in Names Stores (modules).
Here's a minimal reproducible example. The project was created in 7.3.5 (doesn't seem to matter, though).
﻿init python in named_store_test:

    from store import *

    foo_inst = None

    class Foo:
        def __init__(self, foobar):
            self.foobar = foobar

    def init_foo():
        named_store_test.foo_inst = Foo("bar")

label start:
    $ named_store_test.init_foo()
    "Test start. Foo initialized."
    "Save here."
    "Test read: [named_store_test.foo_inst.foobar]"
    "Test end"
    return
When saving at Save here, in RenPy 7.3.5 the state is saved without any issue. You can load the save, the object will be there with the data intact.
When saving at the same point (or anywhere after Foo is initialized) in RenPy 7.5.3, the pickle crashes with:
Full traceback:
  File "renpy/common/_layout/screen_load_save.rpym", line 35, in script
    $ ui.interact()
  File "renpy/ast.py", line 1131, in execute
    renpy.python.py_exec_bytecode(self.code.bytecode, self.hide, store=self.store)
  File "renpy/python.py", line 1061, in py_exec_bytecode
    exec(bytecode, globals, locals)
  File "renpy/common/_layout/screen_load_save.rpym", line 35, in <module>
    $ ui.interact()
  File "renpy/ui.py", line 299, in interact
    rv = renpy.game.interface.interact(roll_forward=roll_forward, **kwargs)
  File "renpy/display/core.py", line 3377, in interact
    repeat, rv = self.interact_core(preloads=preloads, trans_pause=trans_pause, pause=pause, pause_start=pause_start, pause_modal=pause_modal, **kwargs) # type: ignore
  File "renpy/display/core.py", line 4258, in interact_core
    rv = root_widget.event(ev, x, y, 0)
  File "renpy/display/layout.py", line 1175, in event
    rv = i.event(ev, x - xo, y - yo, cst)
  File "renpy/display/transition.py", line 53, in event
    return self.new_widget.event(ev, x, y, st) # E1101
  File "renpy/display/layout.py", line 1175, in event
    rv = i.event(ev, x - xo, y - yo, cst)
  File "renpy/display/layout.py", line 1175, in event
    rv = i.event(ev, x - xo, y - yo, cst)
  File "renpy/display/screen.py", line 743, in event
    rv = self.child.event(ev, x, y, st)
  File "renpy/display/layout.py", line 1175, in event
    rv = i.event(ev, x - xo, y - yo, cst)
  File "renpy/display/layout.py", line 1399, in event
    rv = super(Window, self).event(ev, x, y, st)
  File "renpy/display/layout.py", line 279, in event
    rv = d.event(ev, x - xo, y - yo, st)
  File "renpy/display/layout.py", line 1175, in event
    rv = i.event(ev, x - xo, y - yo, cst)
  File "renpy/display/layout.py", line 1175, in event
    rv = i.event(ev, x - xo, y - yo, cst)
  File "renpy/display/behavior.py", line 1073, in event
    return handle_click(self.clicked)
  File "renpy/display/behavior.py", line 1008, in handle_click
    rv = run(action)
  File "renpy/display/behavior.py", line 322, in run
    new_rv = run(i, *args, **kwargs)
  File "renpy/display/behavior.py", line 329, in run
    return action(*args, **kwargs)
  File "renpy/common/00action_file.rpy", line 383, in __call__
    renpy.save(fn, extra_info=save_name)
  File "renpy/loadsave.py", line 403, in save
    reraise(t, e, tb)
  File "renpy/loadsave.py", line 389, in save
    dump((roots, renpy.game.log), logf)
  File "renpy/compat/pickle.py", line 53, in dump
    pickle.dump(o, f,PROTOCOL)
  File "/home/tom/ab/renpy-build/tmp/install.linux-x86_64/lib/python2.7/pickle.py", line 1376, in dump
  File "/home/tom/ab/renpy-build/tmp/install.linux-x86_64/lib/python2.7/pickle.py", line 224, in dump
  File "/home/tom/ab/renpy-build/tmp/install.linux-x86_64/lib/python2.7/pickle.py", line 286, in save
  File "/home/tom/ab/renpy-build/tmp/install.linux-x86_64/lib/python2.7/pickle.py", line 554, in save_tuple
  File "/home/tom/ab/renpy-build/tmp/install.linux-x86_64/lib/python2.7/pickle.py", line 286, in save
  File "/home/tom/ab/renpy-build/tmp/install.linux-x86_64/lib/python2.7/pickle.py", line 655, in save_dict
  File "/home/tom/ab/renpy-build/tmp/install.linux-x86_64/lib/python2.7/pickle.py", line 687, in _batch_setitems
  File "/home/tom/ab/renpy-build/tmp/install.linux-x86_64/lib/python2.7/pickle.py", line 331, in save
  File "/home/tom/ab/renpy-build/tmp/install.linux-x86_64/lib/python2.7/pickle.py", line 396, in save_reduce
  File "/home/tom/ab/renpy-build/tmp/install.linux-x86_64/lib/python2.7/pickle.py", line 286, in save
  File "/home/tom/ab/renpy-build/tmp/install.linux-x86_64/lib/python2.7/pickle.py", line 754, in save_global
PicklingError: Can't pickle <class 'store.Foo'>: it's not found as store.Foo

Closing comment (2022-11-07T12:13:53Z): I think it's similar to #3693. Maybe you could just ignore all __dunder__ members.