Handle mutable default arguments cleanly
When generating code, ensure that default list/dict arguments are initialised in local scope if unspecified or `None`.
This commit is contained in:
		
				
					committed by
					
						 Bouke Versteegh
						Bouke Versteegh
					
				
			
			
				
	
			
			
			
						parent
						
							42e197f985
						
					
				
				
					commit
					0ba0692dec
				
			| @@ -80,6 +80,10 @@ class {{ service.py_name }}Stub(betterproto.ServiceStub): | ||||
| {{ method.comment }} | ||||
|  | ||||
|         {% endif %} | ||||
|         {%- for py_name, zero in method.mutable_default_args %} | ||||
|         {{ py_name }} = {{ py_name }} or {{ zero }} | ||||
|         {% endfor %} | ||||
|  | ||||
|         {% if not method.client_streaming %} | ||||
|         request = {{ method.input }}() | ||||
|         {% for field in method.input_message.properties %} | ||||
|   | ||||
		Reference in New Issue
	
	Block a user