Skip to content

Commit 0081e83

Browse files
committed
fix: move global _zmq_context declaration before first use in terminate_zmq
1 parent fb27fa9 commit 0081e83

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

concore_base.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ def init_zmq_port(mod, port_name, port_type, address, socket_type_str):
101101

102102
def terminate_zmq(mod):
103103
"""Clean up all ZMQ sockets, then terminate the shared context once."""
104+
global _zmq_context # declared first — used both in the early-return guard and reset below
104105
if mod._cleanup_in_progress:
105106
return # Already cleaning up, prevent reentrant calls
106107

@@ -121,7 +122,6 @@ def terminate_zmq(mod):
121122

122123
# terminate the single shared context exactly once, then reset so it
123124
# can be safely recreated if init_zmq_port is called again later.
124-
global _zmq_context
125125
if _zmq_context is not None and not _zmq_context.closed:
126126
try:
127127
_zmq_context.term()

0 commit comments

Comments
 (0)