-
Task
-
Resolution: Done
-
Normal
-
None
-
None
-
None
-
1
-
False
-
-
False
-
Not Selected
-
rhos-ops-platform-services-pidone
-
-
-
Sprint 9
-
1
The current implementation in amqpdriver.py uses an explicit conditional to handle a rare edge case where os.getpgrp() may return 0 (for example when running under the crun container runtime):
proc_id = self.pg if self.pg != 0 else os.getpid()
This patch simplifies the expression by using the more idiomatic Python fallback pattern:
proc_id = self.pg or os.getpid()
Using or preserves the same behavior, correctly handling any falsy values (0, None, etc.), while making the code shorter and more readable.
This change does not alter behavior — it’s purely a readability improvement on top of the previous fix for the crun runtime case.
Rationale
Keeps the same behavior for pg=0 and pg=None
More Pythonic and concise
Improves code readability and maintainability
Impact
None on functionality.
The change only affects readability and expression style.
References
Gerrit change: https://review.opendev.org/c/openstack/oslo.messaging/+/965938