Skip to content
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

Questions about these lines of code #45

Closed
LiuYinCarl opened this issue Apr 29, 2022 · 0 comments
Closed

Questions about these lines of code #45

LiuYinCarl opened this issue Apr 29, 2022 · 0 comments

Comments

@LiuYinCarl
Copy link

In function make_frame, I dont't understand these lines of code's effect.

    def make_frame(self, code, callargs={}, f_globals=None, f_locals=None):
        log.info("make_frame: code=%r, callargs=%s" % (code, repper(callargs)))
        # if f_globals is not None:
        #     f_globals = f_globals
        #     if f_locals is None:
        #         f_locals = f_globals
        # Can the above lines be modified like this
        if f_globals is not None and f_locals is None:
                f_locals = f_globals

        elif self.frames:
            f_globals = self.frame.f_globals
            f_locals = {}
        else:
            f_globals = f_locals = {
                '__builtins__': __builtins__,
                '__name__': '__main__',
                '__doc__': None,
                '__package__': None,
            }
        f_locals.update(callargs)
        frame = Frame(code, f_globals, f_locals, self.frame)
        return frame
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant