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

Extend PyWin_SetAPIError #2188

Merged
merged 2 commits into from
Mar 18, 2024
Merged

Extend PyWin_SetAPIError #2188

merged 2 commits into from
Mar 18, 2024

Conversation

CristiFati
Copy link
Contributor

Split this out of #2183.

This change by itself is much more significant than the other one, so it should be stand alone (rather than a prerequisite).

So far, anything is unchanged functionally (all the places that call it).
If this behavior (returning None on non error, instead of raising PyWinExc_ApiError(0, "No error message is available")) becomes the default, the (new) default argument value should be changed. But (although I don't know what the module backward compatibility / deprecation policy is), I'd just deprecate it for now:

  • Keep it as it is for the next release (maybe also the one after)

  • Let users know by changing the error message to something like: (Deprecated) No error message is available

@mhammond
Copy link
Owner

TBH I'm not sure the right thing to do is have PyWin_SetAPIError not set an error - wouldn't it be clearer and cleaner, if slightly more verbose, to just have each call site check the code and explicitly return None there?

The question about how to change those call-sites without breaking b/w compat is a good one though and one I need to think through a little more. I do like the idea of a deprecation warnning for a few releases - in which case some helper might still make sense - I just don't think it should be inside PyWin_SetAPIError

@CristiFati CristiFati force-pushed the cfati_dev06 branch 2 times, most recently from 7145515 to e325b62 Compare March 17, 2024 17:32
@CristiFati
Copy link
Contributor Author

Sorry for the late reply, currently on vacation with sporadic access / time.

Moved the functionality in a different (wrapper) function.

Copy link
Owner

@mhammond mhammond left a comment

Choose a reason for hiding this comment

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

Thanks, this is great. Please take your time for the more difficult questions though because I'll struggle to find time too :)

@mhammond mhammond merged commit 7cac4eb into mhammond:main Mar 18, 2024
27 checks passed
@CristiFati CristiFati deleted the cfati_dev06 branch March 28, 2024 15:35
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.

2 participants