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

Python API: Method DownloadCallbacks.add_new_download can return None #1929

Conversation

jrohel
Copy link
Contributor

@jrohel jrohel commented Dec 5, 2024

It's a backwards compatibility API.

Originally, return value support was not implemented in SWIG bindings for the add_new_download method and the method only accepted None as a return value.

Later, support was implemented for returning an integer, which is then passed in subsequent callbacks (progress, end, ...) as the user_cb_data argument. By expecting an integer instead of None, existing programs returning None are broken.

This PR adds the ability for Python programs to return None (it has the same meaning as returning the integer 0 in this case).

It's a backwards compatibility API.

Originally, return value support was not implemented in SWIG bindings
for the `add_new_download` method and the method only accepted `None`
as a return value.

Later, support was implemented for returning an integer, which is
then passed in subsequent callbacks (`progress`, `end`, ...)
as the `user_cb_data` argument. By expecting an integer instead of
`None`, existing programs returning None are broken.

This PR adds the ability for Python programs to return None (it has
the same meaning as returning the integer 0 in this case).
@ppisar
Copy link
Contributor

ppisar commented Dec 5, 2024

That could work.

@evan-goode evan-goode self-assigned this Dec 5, 2024
Copy link
Member

@evan-goode evan-goode left a comment

Choose a reason for hiding this comment

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

@evan-goode
Copy link
Member

This fixes a backwards-incompatibility introduced in #1849.

@evan-goode evan-goode added this pull request to the merge queue Dec 5, 2024
Merged via the queue into rpm-software-management:main with commit c05791a Dec 5, 2024
15 of 17 checks passed
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