DALI icon indicating copy to clipboard operation
DALI copied to clipboard

Remove redundant wrapper from autograph.do_not_convert

Open mzient opened this issue 1 year ago • 2 comments

Category:

Bug fix (non-breaking change which fixes an issue)

Description:

Autograph's do_not_convert changes the functions signature and __code__. This isn't necessary. The with statement is redundant; it goes down the same road as is_autograph_artifact, and do_not_convert can mark the function as such. See api.h:

    if ag_ctx.control_status_ctx().status == ag_ctx.Status.DISABLED:
        logging.log(2, "Allowlisted: %s: AutoGraph is disabled in context", f)
        return _call_unconverted(f, args, kwargs, options, False)

    if is_autograph_artifact(f):
        logging.log(2, "Permanently allowed: %s: AutoGraph artifact", f)
        return _call_unconverted(f, args, kwargs, options)

Thus, simply marking the original function as autograph artifact (or possibly coming up with a different, specific marker) is indeed enough.

Additional information:

Affected modules and functionalities:

Autograph

Key points relevant for the review:

Tests:

See #5268

  • [ ] Existing tests apply
  • [ ] New tests added
    • [ ] Python tests
    • [ ] GTests
    • [ ] Benchmark
    • [ ] Other
  • [ ] N/A

Checklist

Documentation

  • [ ] Existing documentation applies
  • [ ] Documentation updated
    • [ ] Docstring
    • [ ] Doxygen
    • [ ] RST
    • [ ] Jupyter
    • [ ] Other
  • [ ] N/A

DALI team only

Requirements

  • [ ] Implements new requirements
  • [ ] Affects existing requirements
  • [ ] N/A

REQ IDs: N/A

JIRA TASK: N/A

mzient avatar Jan 08 '24 08:01 mzient

CI MESSAGE: [11954919]: BUILD STARTED

dali-automaton avatar Jan 08 '24 09:01 dali-automaton

CI MESSAGE: [11954919]: BUILD FAILED

dali-automaton avatar Jan 08 '24 13:01 dali-automaton

We added the do_not_convert decorator in another PR.

klecki avatar Mar 05 '24 17:03 klecki