Skip to content

String defaults aren't handled well in native_functions.yaml #43944

@bhosmer

Description

@bhosmer

A signature containing a string-typed argument with a literal default will get emitted to C++ without escaping the double quotes, i.e.

- func: myop(Tensor self, str s="HEY") -> Tensor

will emit

m.def("myop(Tensor self, str s="HEY") -> Tensor")

with the ensuing hilarity. Escaping the schema strings is easy, not sure what other issues might need to be dealt with around the initializers themselves. OTOH if we want to explicitly disallow string defaults[1], we should error at codegen time.

[1] though e.g. they're the obvious route to avoiding python facades in #42190

Metadata

Metadata

Assignees

Labels

module: codegenIssues related to the codegen for Aten and AutogradtriagedThis issue has been looked at a team member, and triaged and prioritized into an appropriate module

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions