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

Fix reference counts in nrnexec. #3269

Closed
wants to merge 1 commit into from
Closed

Conversation

1uc
Copy link
Collaborator

@1uc 1uc commented Dec 4, 2024

The function nrnexec is wrapped and then registered via PyMethodDef. Therefore is must satisfy the requirements: https://docs.python.org/3.12/c-api/structures.html#c.PyCFunction

Meaning it must return a new reference. Hence, it must the Py_RETURN_{TRUE,FALSE} macros.

The function `nrnexec` is wrapped and then registered via
`PyMethodDef`. Therefore is must satisfy the requirements:
https://docs.python.org/3.12/c-api/structures.html#c.PyCFunction

Meaning it must return a new reference. Hence, it must the
`Py_RETURN_{TRUE,FALSE}` macros.
Copy link

sonarqubecloud bot commented Dec 4, 2024

@JCGoran
Copy link
Collaborator

JCGoran commented Dec 4, 2024

Could we use https://docs.python.org/3/c-api/bool.html#c.PyBool_FromLong instead? It's part of the stable ABI, and returns a new reference.
For context, I'd prefer to use functionality from the stable ABI (only if possible, and if the performance penalty is minimal) for any new changes, as it makes it easier to (eventually, maybe) support the stable ABI with NEURON.

Copy link

codecov bot commented Dec 4, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 67.07%. Comparing base (d177f5b) to head (64e5eaf).
Report is 1 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #3269   +/-   ##
=======================================
  Coverage   67.07%   67.07%           
=======================================
  Files         571      571           
  Lines      111110   111111    +1     
=======================================
+ Hits        74528    74529    +1     
  Misses      36582    36582           

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

@1uc 1uc closed this Dec 4, 2024
Copy link

✔️ 64e5eaf -> Azure artifacts URL

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.

3 participants