Skip to content

Fix/issue 164 objects#167

Merged
benpruitt merged 3 commits intolibnano:masterfrom
uguraka:fix/issue-164-objects
Jan 6, 2026
Merged

Fix/issue 164 objects#167
benpruitt merged 3 commits intolibnano:masterfrom
uguraka:fix/issue-164-objects

Conversation

@uguraka
Copy link
Contributor

@uguraka uguraka commented Jan 2, 2026

This PR addresses Issue #164 by enabling objects with sequence representation in analysis functions.

Changes made:

  1. Updated _bytes() in primer3/thermoanalysis.pyx to accept any object that implements __str__, not just str or bytes.
  2. Updated calc_tm() in primer3/thermoanalysis.pyx to explicitly convert non-bytes objects to string before validation to prevent TypeError.
  3. Updated type hints in primer3/bindings.py to reflect that objects are now accepted.
  4. Added test cases in tests/test_issue_164.py covering both (calc_tm) and (calc_end_stability) paths.

Verification:

  • Added tests/test_issue_164.py passes successfully.
  • Existing logic for str and bytes remains unchanged.

@benpruitt benpruitt self-requested a review January 2, 2026 17:04
Copy link
Contributor

@benpruitt benpruitt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm; thanks for pulling this together. A couple of minor requests:

  1. Can you add a module docstring to your tests module, conformant w/ the module docstring used in other test modules (https://github.com/libnano/primer3-py/tree/master/tests)?
  2. Rename the test module with a more directly descriptive name (e.g., test_str_rep_ifc_compat.py

Once we have this PR buttoned up, I'll spin a minor version release (we've got a couple of changes sitting on master that have yet to be incorporated into a release, all minor).

@uguraka
Copy link
Contributor Author

uguraka commented Jan 6, 2026

Hello, I have renamed the test module and added the docstring.

@benpruitt benpruitt merged commit ad3758b into libnano:master Jan 6, 2026
18 checks passed
@benpruitt benpruitt mentioned this pull request Jan 6, 2026
@benpruitt
Copy link
Contributor

@uguraka thanks for your work on this feature -- we cut v2.3.0 today, which includes this merged PR, and it is now live on PyPI.

@uguraka
Copy link
Contributor Author

uguraka commented Jan 7, 2026

Happy to have contributed! Thank you for the review and for getting this released so quickly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants