Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

gh-83004: Clean up refleaks in _decimal initialisation #99043

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

Closed
wants to merge 5 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix whitespace
  • Loading branch information
hauntsaninja committed Nov 3, 2022
commit a7576b372c9f9b26eb3ec10abf9c45c472e94435
8 changes: 4 additions & 4 deletions 8 Modules/_decimal/_decimal.c
Original file line number Diff line number Diff line change
Expand Up @@ -5920,7 +5920,7 @@ PyInit__decimal(void)
/* Add types to the module */
CHECK_INT(PyModule_AddObjectRef(m, "Decimal", (PyObject *)&PyDec_Type));
CHECK_INT(PyModule_AddObjectRef(m, "Context",
(PyObject *)&PyDecContext_Type));
(PyObject *)&PyDecContext_Type));
CHECK_INT(PyModule_AddObjectRef(m, "DecimalTuple", (PyObject *)DecimalTuple));


Expand Down Expand Up @@ -6006,7 +6006,7 @@ PyInit__decimal(void)
ASSIGN_PTR(default_context_template,
PyObject_CallObject((PyObject *)&PyDecContext_Type, NULL));
CHECK_INT(PyModule_AddObjectRef(m, "DefaultContext",
default_context_template));
default_context_template));

#ifndef WITH_DECIMAL_CONTEXTVAR
ASSIGN_PTR(tls_context_key, PyUnicode_FromString("___DECIMAL_CTX__"));
Expand All @@ -6022,14 +6022,14 @@ PyInit__decimal(void)
PyObject_CallObject((PyObject *)&PyDecContext_Type, NULL));
init_basic_context(basic_context_template);
CHECK_INT(PyModule_AddObjectRef(m, "BasicContext",
basic_context_template));
basic_context_template));

/* Init extended context template */
ASSIGN_PTR(extended_context_template,
PyObject_CallObject((PyObject *)&PyDecContext_Type, NULL));
init_extended_context(extended_context_template);
CHECK_INT(PyModule_AddObjectRef(m, "ExtendedContext",
extended_context_template));
extended_context_template));


/* Init mpd_ssize_t constants */
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Can't add a comment there because Github, but CHECK_INT(PyModule_AddObject(m, ssize_cm->name, obj)); for obj on L6038 does not leak obj on failure because its reference count is 1 going into PyModule_AddObject and we Py_CLEAR it on goto error inside CHECK_INT.

Copy link
Contributor

Choose a reason for hiding this comment

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

Could you update the PR to add a comment about that?

Copy link
Member

Choose a reason for hiding this comment

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

Ping on this; there's also a merge conflict.

Expand Down
Morty Proxy This is a proxified and sanitized view of the page, visit original site.