GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | ||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | ||||||||||||||||||||||
GeezerVison is showing github.com — gh-102542 Refactor the mime audio module by JosephSBoyle · Pull Request #102540 · python/cpython Conversation
|
| _subtype = _what(_audiodata) | ||
| if _subtype is None: | ||
| raise TypeError('Could not find audio MIME subtype') | ||
| _subtype = _subtype or _infer_subtype(_audiodata) |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
This changes the behavior if _subtype is '' (or any other non-None null value). Someone other than me needs to agree with this.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
That's correct. Falsey values other than None such as: 0, False, '' and empty collections will all fall back to the second or operand: _infer_subtype(_audiodata).
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
I personally prefer more explicit tests than just "falseiness" when a more explicit type is indicated. In this case _subtype=None defaults to None to mean that this argument wasn't given.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
@warsaw This PR mostly replaces the section you committed April '22. I believe that replacement logic is correct. Joseph, have you checked the coverage of the mime audio test? |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
None of the tests execute this path as far as I could tell from putting a breakpoint in and running the tests. I convinced myself that the logic in |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
e3f62eb to
09cd7f1
Compare
|
Force pushed to correct a mistake in the commit message. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
That implies that we should perhaps first work on improving test coverage, before undertaking a risky refactoring of this module. ("Risky" only in the sense that all refactorings are risky if test coverage is low :) |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
ac8e652 to
5b26332
Compare
You're right as usual;) Turns out adding the tests was easier than I first thought. Apologies for rebasing rather than merging, I'm still working on using that workflow @AlexWaygood |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Update: I was incorrect about this path not being tested - there are in fact tests for this, see: As such I've deleted the redundant ones. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
@terryjreedy could you have a re-review when you get a chance please. I think the minimum set of changes for this PR would be simply removing the unused |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
I have nothing to add, which was that I will not approve the change as this is outside my expertise.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Hia @AlexWaygood. Who I should request a review from on this? I have the feeling it may have slipped through people's todos! Cheers |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
I've provided some additional thoughts on #102542 |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Closing as we've decided to leave the |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.