Skip to content

Conversation

@StanFromIreland
Copy link
Member

@StanFromIreland StanFromIreland commented Jul 13, 2025

@StanFromIreland StanFromIreland changed the title gh-62040: Raise ValueError on invalid *errors* parameter in several codecs gh-62040: Raise ValueError on invalid *errors* argument in several codecs Jul 13, 2025
@efimov-mikhail
Copy link
Member

I can see that there's only some changes from last patch:
https://bugs.python.org/file30902/issue17840.patch

For example, I'd like to remove also assert self.errors == 'strict', use _check_strict method in all files, test new changes.

@StanFromIreland
Copy link
Member Author

Ah I forgot about the patch and my grep was too strict, I'll fix all the self.errors cases.

@StanFromIreland StanFromIreland marked this pull request as draft July 14, 2025 13:16
@StanFromIreland StanFromIreland marked this pull request as ready for review July 24, 2025 08:22

### Codec Helpers

def _assert_strict(errors):
Copy link
Member

Choose a reason for hiding this comment

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

Maybe _check_strict from the original patch would be better?

Copy link
Member Author

Choose a reason for hiding this comment

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

I prefer assert_strict since it is closer to what was there before, and it is more obvious, to me at least, that it will fail if errors != 'strict', whereas check_strict, seems like something that will enable more verbose errors or the like.

Copy link
Member

Choose a reason for hiding this comment

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

IMO, it's not fully correct to name method assert_something and don't make any assert checks or raising an AssertionError.

Copy link
Member Author

Choose a reason for hiding this comment

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

@malemburg which do you prefer? _check_strict or _assert_strict

@StanFromIreland
Copy link
Member Author

Friendly ping @malemburg

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants