Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: default proto package name is the module name, not "" #309

Merged
merged 5 commits into from
May 2, 2022
Merged
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 2 additions & 1 deletion proto/_package_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,11 @@ def compile(name, attrs):
# Pull a reference to the module where this class is being
# declared.
module = sys.modules.get(attrs.get("__module__"))
module_name = module.__name__ if hasattr(module, __name__) else ""
proto_module = getattr(module, "__protobuf__", object())

# A package should be present; get the marshal from there.
package = getattr(proto_module, "package", "")
package = getattr(proto_module, "package", module_name)
marshal = Marshal(name=getattr(proto_module, "marshal", package))

# Done; return the data.
Expand Down