Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use PyBool_FromLong instead of macros #3305

Merged
merged 3 commits into from
Jan 21, 2025
Merged

Conversation

JCGoran
Copy link
Collaborator

@JCGoran JCGoran commented Jan 10, 2025

  • use PyBool_FromLong (part of stable ABI/limited API) instead of macros
  • simplify some logic to use less branching

As an impl detail, the function is defined in cpython as:

PyObject *PyBool_FromLong(long ok)
{
    return ok ? Py_True : Py_False;
}

Advantages:
- better readability
- part of limited API/stable ABI
Copy link

✔️ 97d2bb7 -> Azure artifacts URL

Copy link

codecov bot commented Jan 10, 2025

Codecov Report

Attention: Patch coverage is 26.66667% with 11 lines in your changes missing coverage. Please review.

Project coverage is 67.07%. Comparing base (9500741) to head (97d2bb7).
Report is 5 commits behind head on master.

Files with missing lines Patch % Lines
src/nrnpython/nrnpy_nrn.cpp 22.22% 7 Missing ⚠️
src/nrnpython/nrnpy_hoc.cpp 33.33% 4 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##           master    #3305   +/-   ##
=======================================
  Coverage   67.07%   67.07%           
=======================================
  Files         571      571           
  Lines      111055   111038   -17     
=======================================
- Hits        74488    74484    -4     
+ Misses      36567    36554   -13     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@JCGoran JCGoran marked this pull request as ready for review January 10, 2025 10:30
@JCGoran JCGoran requested a review from nrnhines January 10, 2025 12:00
@JCGoran JCGoran merged commit 9137717 into master Jan 21, 2025
38 checks passed
@JCGoran JCGoran deleted the jelic/python_refactor1 branch January 21, 2025 10:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants