Skip to content

Fix leaks in get_endian_character.#3257

Merged
1uc merged 1 commit into
masterfrom
1uc/fix-leak-get_endian
Dec 2, 2024
Merged

Fix leaks in get_endian_character.#3257
1uc merged 1 commit into
masterfrom
1uc/fix-leak-get_endian

Conversation

@1uc

@1uc 1uc commented Nov 27, 2024

Copy link
Copy Markdown
Collaborator

The facts are:

  • PyImport_ImportModule returns a new reference 1.
  • PyObject_GetAttrString returns a new referece 2.
  • Py2NRNString::as_ascii doesn't steal.

Therefore, in both cases, we create a new reference without ever calling DECREF.

The facts are:
  * `PyImport_ImportModule` returns a new reference [1].
  * `PyObject_GetAttrString` returns a new referece [2].
  * `Py2NRNString::as_ascii` doesn't steal.

Therefore, in both cases, we create a new reference without ever calling
DECREF.

[1]: https://docs.python.org/3.12/c-api/import.html#c.PyImport_ImportModule
@sonarqubecloud

Copy link
Copy Markdown

@1uc 1uc marked this pull request as ready for review November 27, 2024 17:20
@codecov

codecov Bot commented Nov 27, 2024

Copy link
Copy Markdown

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 67.09%. Comparing base (5f0675b) to head (9d0a6ce).
Report is 6 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #3257   +/-   ##
=======================================
  Coverage   67.09%   67.09%           
=======================================
  Files         570      570           
  Lines      111082   111082           
=======================================
  Hits        74525    74525           
  Misses      36557    36557           

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

@azure-pipelines

Copy link
Copy Markdown

✔️ 9d0a6ce -> Azure artifacts URL

@JCGoran JCGoran left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM

@1uc 1uc merged commit bf55c2e into master Dec 2, 2024
@1uc 1uc deleted the 1uc/fix-leak-get_endian branch December 2, 2024 12:01
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