Skip to content

Commit

Permalink
Merge branch 'bugfix/codegen-docstrings' into 'main'
Browse files Browse the repository at this point in the history
Fix codegen issue with docstrings

See merge request omniverse/warp!726
  • Loading branch information
shi-eric committed Sep 17, 2024
2 parents ee92dcd + 0585e35 commit e6a4eda
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
- Fix array in-place op (`+=`, `-=`) adjoints to compute gradients correctly in the backwards pass.
- `wp.sim.Model.edge_indices` now includes boundary edges
- Allow shadowing builtin functions ([GH-308](https://github.com/NVIDIA/warp/issues/308))
- Fix a bug in which Python docstrings would be created as local function variables in generated code.

## [1.3.3] - 2024-09-04

Expand Down
3 changes: 3 additions & 0 deletions warp/codegen.py
Original file line number Diff line number Diff line change
Expand Up @@ -1493,6 +1493,9 @@ def end_while(adj):

def emit_FunctionDef(adj, node):
for f in node.body:
# Skip variable creation for standalone constants, including docstrings
if isinstance(f, ast.Expr) and isinstance(f.value, ast.Constant):
continue
adj.eval(f)

if adj.return_var is not None and len(adj.return_var) == 1:
Expand Down

0 comments on commit e6a4eda

Please sign in to comment.