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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

python error UnboundLocalError in jit/frontend.py #32139

Closed
arvrmd opened this issue Jan 13, 2020 · 1 comment
Closed

python error UnboundLocalError in jit/frontend.py #32139

arvrmd opened this issue Jan 13, 2020 · 1 comment
Assignees
Labels
oncall: jit Add this issue/PR to JIT oncall triage queue triaged This issue has been looked at a team member, and triaged and prioritized into an appropriate module

Comments

@arvrmd
Copy link

arvrmd commented Jan 13, 2020

馃悰 Bug

One of the error cases in the function build_param_list uses ctx_range without defining it, in the following context:

    if not PY2 and py_args.kw_defaults:
        raise NotSupportedError(ctx_range, _vararg_kwarg_err)

To Reproduce

Steps to reproduce the behavior:

I was using torch.jit.script() on a large module, and since it's the error reporting that's failing I don't have a line reference. By inspection, however, I believe the unsupported feature was the asterisk in the following function definition:

    @torch.jit.export
    def initState(self, *, n_tokens: int, device_name: str) -> None:

Expected behavior

Relevant error message should be reported.

cc @suo

@facebook-github-bot facebook-github-bot added the oncall: jit Add this issue/PR to JIT oncall triage queue label Jan 13, 2020
@suo
Copy link
Member

suo commented Jan 13, 2020

cc @driazati can you take a look?

driazati pushed a commit that referenced this issue Jan 14, 2020
This was not tested before, fixes #32139 (which was actually a false positive, functions with kwargs but without defaults on those kwargs are supported). This PR adds testing for both cases and cleans up the error reporting.
@suo suo added the triaged This issue has been looked at a team member, and triaged and prioritized into an appropriate module label Jan 14, 2020
wuhuikx pushed a commit to wuhuikx/pytorch that referenced this issue Jan 30, 2020
Summary:
This was not tested before, fixes pytorch#32139 (which was actually a false positive, functions with kwargs but without defaults on those kwargs are supported). This PR adds testing for both cases and cleans up the error reporting.
](https://our.intern.facebook.com/intern/diff/19385828/)
Pull Request resolved: pytorch#32146

Pulled By: driazati

Differential Revision: D19385828

fbshipit-source-id: 5eab74df6d02f8e1d7ec054cafb44f909f9d637e
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
oncall: jit Add this issue/PR to JIT oncall triage queue triaged This issue has been looked at a team member, and triaged and prioritized into an appropriate module
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants