@@ -48,12 +48,22 @@ typedef std::set<ImportMapEntry> ImportMap;
4848static const CommentConfig def_comment = {nullptr , " #" , nullptr };
4949static const std::string Indent = " " ;
5050
51+ inline Namer::Config PythonNamerConfig (const Namer::Config& input,
52+ const IDLOptions& opts,
53+ const std::string& path) {
54+ auto cfg = WithFlagOptions (input, opts, path);
55+ if (opts.python_fields_snake_case ) {
56+ cfg.fields = Case::kSnake ;
57+ }
58+ return cfg;
59+ }
60+
5161class PythonStubGenerator {
5262 public:
5363 PythonStubGenerator (const Parser& parser, const std::string& path,
5464 const Version& version)
5565 : parser_{parser},
56- namer_{WithFlagOptions (kStubConfig , parser.opts , path),
66+ namer_{PythonNamerConfig (kStubConfig , parser.opts , path),
5767 Keywords (version)},
5868 version_ (version) {}
5969
@@ -698,7 +708,7 @@ class PythonGenerator : public BaseGenerator {
698708 : BaseGenerator(parser, path, file_name, " " /* not used */ ,
699709 " " /* not used */ , " py" ),
700710 float_const_gen_ (" float('nan')" , " float('inf')" , " float('-inf')" ),
701- namer_(WithFlagOptions (kConfig , parser.opts, path), Keywords(version)) {
711+ namer_(PythonNamerConfig (kConfig , parser.opts, path), Keywords(version)) {
702712 }
703713
704714 // Most field accessors need to retrieve and test the field offset first,
0 commit comments