mirror of
https://github.com/google/flatbuffers.git
synced 2026-06-01 19:58:15 +00:00
[Python] Avoid include own type (#8625)
This prevents the include of the type defined in the pyi, otherwise this leads to error message like this: error: Name XYZ already defined (possibly by an import) [no-redef]
This commit is contained in:
@@ -59,5 +59,21 @@ const python::Import &python::Imports::Import(const std::string &module,
|
||||
imports.push_back(std::move(import));
|
||||
return imports.back();
|
||||
}
|
||||
|
||||
const python::Import &python::Imports::Export(const std::string &module) {
|
||||
python::Import import;
|
||||
import.module = module;
|
||||
exports.push_back(std::move(import));
|
||||
return exports.back();
|
||||
}
|
||||
|
||||
const python::Import &python::Imports::Export(const std::string &module,
|
||||
const std::string &name) {
|
||||
python::Import import;
|
||||
import.module = module;
|
||||
import.name = name;
|
||||
exports.push_back(std::move(import));
|
||||
return exports.back();
|
||||
}
|
||||
} // namespace python
|
||||
} // namespace flatbuffers
|
||||
|
||||
@@ -85,7 +85,12 @@ struct Imports {
|
||||
const python::Import &Import(const std::string &module,
|
||||
const std::string &name);
|
||||
|
||||
const python::Import &Export(const std::string &module);
|
||||
const python::Import &Export(const std::string &module,
|
||||
const std::string &name);
|
||||
|
||||
std::vector<python::Import> imports;
|
||||
std::vector<python::Import> exports;
|
||||
};
|
||||
} // namespace python
|
||||
} // namespace flatbuffers
|
||||
|
||||
Reference in New Issue
Block a user