Skip to content

Commit 7eb5e3d

Browse files
committed
Fix _ThermoAnalysis._set_globals_and_seq_args for improper checks on misprime_lib and
`mishyb_lib` leading to incorrect initialization of `mp_lib` and `mh_lib`
1 parent 5b3d006 commit 7eb5e3d

File tree

3 files changed

+28
-16
lines changed

3 files changed

+28
-16
lines changed

CHANGES

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# Changelog
22

3+
## Version 2.0.3 (February 15, 2024)
4+
5+
- Fix `_ThermoAnalysis._set_globals_and_seq_args` for improper checks on `misprime_lib` and
6+
`mishyb_lib` leading to incorrect initialization of `mp_lib` and `mh_lib`. See issue #133
7+
38
## Version 2.0.2 (February 9, 2024)
49

510
- Support for python 3.12 (build, test, docs)

primer3/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,10 @@
2626
from typing import List
2727

2828
# Per PEP-440 https://peps.python.org/pep-0440/#public-version-identifiers
29-
__version__ = '2.0.2'
29+
__version__ = '2.0.3'
3030
__author__ = 'Ben Pruitt, Nick Conway'
3131
__copyright__ = (
32-
'Copyright 2014-2023, Ben Pruitt & Nick Conway; 2014-2018 Wyss Institute'
32+
'Copyright 2014-2024, Ben Pruitt & Nick Conway; 2014-2018 Wyss Institute'
3333
)
3434
__license__ = 'GPLv2'
3535
DESCRIPTION = 'Python bindings for Primer3'

primer3/thermoanalysis.pyx

Lines changed: 21 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1213,22 +1213,29 @@ cdef class _ThermoAnalysis:
12131213
err_msg = ''
12141214
try:
12151215
global_settings_data = <p3_global_settings*> self.global_settings_data
1216-
if misprime_lib != None:
1217-
mp_lib = pdh_create_seq_lib(misprime_lib)
1218-
if mp_lib == NULL:
1219-
err_msg = f'Issue creating misprime_lib {misprime_lib}'
1220-
raise ValueError(
1221-
f'Issue creating misprime_lib {misprime_lib}'
1222-
)
12231216

1224-
global_settings_data[0].p_args.repeat_lib = mp_lib
1217+
if misprime_lib is None:
1218+
misprime_lib = {}
1219+
1220+
mp_lib = pdh_create_seq_lib(misprime_lib)
1221+
if mp_lib == NULL:
1222+
err_msg = f'Issue creating misprime_lib {misprime_lib}'
1223+
raise ValueError(
1224+
f'Issue creating misprime_lib {misprime_lib}'
1225+
)
1226+
1227+
global_settings_data[0].p_args.repeat_lib = mp_lib
1228+
1229+
if mishyb_lib is None:
1230+
mishyb_lib = {}
1231+
1232+
mh_lib = pdh_create_seq_lib(mishyb_lib)
1233+
if mh_lib == NULL:
1234+
err_msg = f'Issue creating mishyb_lib: {mishyb_lib}'
1235+
raise ValueError(err_msg)
1236+
1237+
global_settings_data[0].o_args.repeat_lib = mh_lib
12251238

1226-
if mishyb_lib != None:
1227-
mh_lib = pdh_create_seq_lib(mishyb_lib)
1228-
if mh_lib == NULL:
1229-
err_msg = f'Issue creating mishyb_lib: {mishyb_lib}'
1230-
raise ValueError(err_msg)
1231-
global_settings_data[0].o_args.repeat_lib = mh_lib
12321239
except (OSError, TypeError) as exc:
12331240
p3_destroy_global_settings(
12341241
<p3_global_settings*> self.global_settings_data

0 commit comments

Comments
 (0)