Skip to content

Commit 133a332

Browse files
authored
fix: default proto package name is the module name, not "" (#309)
* fix: default proto package name is the module name, not "" * fix tests * lint
1 parent 1a086da commit 133a332

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

packages/proto-plus/proto/_package_info.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,11 @@ def compile(name, attrs):
3333
# Pull a reference to the module where this class is being
3434
# declared.
3535
module = sys.modules.get(attrs.get("__module__"))
36+
module_name = module.__name__ if hasattr(module, __name__) else ""
3637
proto_module = getattr(module, "__protobuf__", object())
3738

3839
# A package should be present; get the marshal from there.
39-
package = getattr(proto_module, "package", "")
40+
package = getattr(proto_module, "package", module_name)
4041
marshal = Marshal(name=getattr(proto_module, "marshal", package))
4142

4243
# Done; return the data.

0 commit comments

Comments
 (0)