Skip to content

Commit

Permalink
Fix _ThermoAnalysis._set_globals_and_seq_args for improper checks o…
Browse files Browse the repository at this point in the history
…n `misprime_lib` and

`mishyb_lib` leading to incorrect initialization of `mp_lib` and `mh_lib`
  • Loading branch information
grinner committed Feb 15, 2024
1 parent 5b3d006 commit 7eb5e3d
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 16 deletions.
5 changes: 5 additions & 0 deletions CHANGES
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Changelog

## Version 2.0.3 (February 15, 2024)

- 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`. See issue #133

## Version 2.0.2 (February 9, 2024)

- Support for python 3.12 (build, test, docs)
Expand Down
4 changes: 2 additions & 2 deletions primer3/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@
from typing import List

# Per PEP-440 https://peps.python.org/pep-0440/#public-version-identifiers
__version__ = '2.0.2'
__version__ = '2.0.3'
__author__ = 'Ben Pruitt, Nick Conway'
__copyright__ = (
'Copyright 2014-2023, Ben Pruitt & Nick Conway; 2014-2018 Wyss Institute'
'Copyright 2014-2024, Ben Pruitt & Nick Conway; 2014-2018 Wyss Institute'
)
__license__ = 'GPLv2'
DESCRIPTION = 'Python bindings for Primer3'
Expand Down
35 changes: 21 additions & 14 deletions primer3/thermoanalysis.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -1213,22 +1213,29 @@ cdef class _ThermoAnalysis:
err_msg = ''
try:
global_settings_data = <p3_global_settings*> self.global_settings_data
if misprime_lib != None:
mp_lib = pdh_create_seq_lib(misprime_lib)
if mp_lib == NULL:
err_msg = f'Issue creating misprime_lib {misprime_lib}'
raise ValueError(
f'Issue creating misprime_lib {misprime_lib}'
)

global_settings_data[0].p_args.repeat_lib = mp_lib
if misprime_lib is None:
misprime_lib = {}

mp_lib = pdh_create_seq_lib(misprime_lib)
if mp_lib == NULL:
err_msg = f'Issue creating misprime_lib {misprime_lib}'
raise ValueError(
f'Issue creating misprime_lib {misprime_lib}'
)

global_settings_data[0].p_args.repeat_lib = mp_lib

if mishyb_lib is None:
mishyb_lib = {}

mh_lib = pdh_create_seq_lib(mishyb_lib)
if mh_lib == NULL:
err_msg = f'Issue creating mishyb_lib: {mishyb_lib}'
raise ValueError(err_msg)

global_settings_data[0].o_args.repeat_lib = mh_lib

if mishyb_lib != None:
mh_lib = pdh_create_seq_lib(mishyb_lib)
if mh_lib == NULL:
err_msg = f'Issue creating mishyb_lib: {mishyb_lib}'
raise ValueError(err_msg)
global_settings_data[0].o_args.repeat_lib = mh_lib
except (OSError, TypeError) as exc:
p3_destroy_global_settings(
<p3_global_settings*> self.global_settings_data
Expand Down

0 comments on commit 7eb5e3d

Please sign in to comment.