Skip to content

Commit

Permalink
fix: default proto package name is the module name, not "" (#309)
Browse files Browse the repository at this point in the history
* fix: default proto package name is the module name, not ""

* fix tests

* lint
  • Loading branch information
parthea authored May 2, 2022
1 parent 079fc6a commit 3148a1c
Showing 1 changed file with 2 additions and 1 deletion.
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

0 comments on commit 3148a1c

Please sign in to comment.