Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions labscript_utils/excepthook/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ class l:
logger = None

child_processes = []
_original_showwarning = warnings.showwarning


def install_thread_excepthook():
Expand Down Expand Up @@ -83,12 +84,11 @@ def tkhandler(exceptclass, exception, exec_info, reraise=True):
def logwarning(message, category, filename, lineno, file=None, line=None):
logmessage = warnings.formatwarning(message, category, filename, lineno, line)
l.logger.warn(logmessage)
warnings._showwarning(message, category, filename, lineno, file, line)
_original_showwarning(message, category, filename, lineno, file, line)


def set_logger(logger):
l.logger = logger
warnings._showwarning = warnings.showwarning
warnings.showwarning = logwarning

# Check for tkinter availability. Tkinter is frustratingly not available
Expand Down
6 changes: 3 additions & 3 deletions labscript_utils/ls_zprocess.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,8 @@ def get_config():
config['allow_insecure'] = labconfig.getboolean('security', 'allow_insecure')
except (labconfig.NoOptionError, labconfig.NoSectionError):
config['allow_insecure'] = False
if config['shared_secret'] is None and not config['allow_insecure']:
raise ValueError(_ERR_NO_SHARED_SECRET.replace('/', os.sep))
if config['shared_secret'] is None and not config['allow_insecure']:
raise ValueError(_ERR_NO_SHARED_SECRET.replace('/', os.sep))
try:
config['logging_maxBytes'] = labconfig.getint('logging', 'maxBytes')
except (labconfig.NoOptionError, labconfig.NoSectionError):
Expand Down Expand Up @@ -257,7 +257,7 @@ def socket(self, socket_type, socket_class=None, **kwargs):
# be a SecureSocket. If caller has explicitly requested a different socket type
# (e.g since pyzmq 25, ThreadAuthenticator sets up an internal socket by calling
# `Context.socket(..., socket_class=zmq.Socket)), then don't.`
if socket_class is None or issubclass(socket_class, SecureContext):
if socket_class is None or issubclass(socket_class, SecureSocket):
config = get_config()
kwargs['allow_insecure'] = config['allow_insecure']
return SecureContext.socket(self, socket_type=socket_type, **kwargs)
Expand Down
4 changes: 4 additions & 0 deletions labscript_utils/properties.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,10 @@ def _default(o):
# Workaround for https://bugs.python.org/issue24313
if isinstance(o, np.integer):
return int(o)
if isinstance(o, np.floating):
return float(o)
if isinstance(o, np.bool_):
return bool(o)
raise TypeError


Expand Down
2 changes: 1 addition & 1 deletion labscript_utils/zlock.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def main():
'-m',
'zprocess.zlock',
'--port',
config['zlock_port'],
str(config['zlock_port']),
'-l',
LOG_PATH,
]
Expand Down