Buffer class makes unexpected RPC calls
See original GitHub issueThe Buffer class makes unexpected RPC calls.
This is due to the __len__
method being called during boolean tests.
For example, the following code will print 2
.
class Example:
def __len__(self) -> int:
print(2)
return 0
example = Example()
if example:
pass
This is very surprising behaviour, and there is absoutely no way to fix it without breaking backwards compatibility.
But it should be documentated, because this will actually break your code if you are using Buffer
class from another thread.
It took me a quite a bit of effort to figure out that an or
statement was causing crashes in my plugin.
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
Question - Photon RPC Buffer Execution Delay - Unity Forum
I've noticed that if a move is made and one client isn't responding - the RPC call doesn't get received. So far I...
Read more >Remote Procedure Calls
When B returns, the return value is passed to A and A continues execution. This mechanism is called the Remote Procedure Call (RPC)....
Read more >Veeam Agent backup job fails with "Failed to call RPC function ...
A Veeam Agent backup job managed by the backup server fails with the following error:Processing Error: Failed to call RPC function ...
Read more >Overview | Protocol Buffers - Google Developers
Compact data storage; Fast parsing; Availability in many programming languages; Optimized functionality through automatically-generated classes ...
Read more >Error Handling in gRPC - Baeldung
gRPC is a platform to do inter-process Remote Procedure Calls (RPC). ... Java encapsulates this error model with the class io.grpc.Status.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
It could also implement
__bool__
itself (returningTrue
always), couldn’t it? https://docs.python.org/3.8/reference/datamodel.html?highlight=__del__#object.__bool__PR welcome. We monkey-patch various things, this is more or less idiomatic in python land.