Title: Wave stdlib parameter regression in mypy 0.950 · Issue #8322 · python/typeshed · GitHub
Open Graph Title: Wave stdlib parameter regression in mypy 0.950 · Issue #8322 · python/typeshed
X Title: Wave stdlib parameter regression in mypy 0.950 · Issue #8322 · python/typeshed
Description: Bug Report When working with the wave module of the standard library, valid code from mypy <0.950 works but errors with error: Argument 1 to "setparams" of "Wave_write" has incompatible type "waveparams"; expected "_wave_params" on 0.950...
Open Graph Description: Bug Report When working with the wave module of the standard library, valid code from mypy <0.950 works but errors with error: Argument 1 to "setparams" of "Wave_write" has incompatible type "wavep...
X Description: Bug Report When working with the wave module of the standard library, valid code from mypy <0.950 works but errors with error: Argument 1 to "setparams" of "Wave_write" has i...
Opengraph URL: https://github.com/python/typeshed/issues/8322
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Wave stdlib parameter regression in mypy 0.950","articleBody":"\r\n**Bug Report**\r\n\r\nWhen working with the `wave` module of the standard library, valid code from mypy \u003c0.950 works but errors with \r\n```error: Argument 1 to \"setparams\" of \"Wave_write\" has incompatible type \"waveparams\"; expected \"_wave_params\"``` \r\non 0.950+\r\n**To Reproduce**\r\n\r\nUsing Example code \r\n```python\r\n# bug_report.py\r\nimport wave\r\nimport collections\r\n\r\nwaveparams = collections.namedtuple(\r\n \"waveparams\",\r\n \"nchannels, sampwidth, framerate, nframes, comptype, compname\",\r\n)\r\n\r\nwith wave.open(\"test.wav\", \"wb\") as wav_file:\r\n params = waveparams(\r\n nchannels=1,\r\n sampwidth=2,\r\n framerate=16_000,\r\n nframes=0,\r\n comptype=\"NONE\",\r\n compname=\"NONE\",\r\n )\r\n wav_file.setparams(params)\r\n```\r\nrunning `mypy` an older version (say 0.931) it says no issues. but using a fully up to date version throws and error of\r\n`error: Argument 1 to \"setparams\" of \"Wave_write\" has incompatible type \"waveparams\"; expected \"_wave_params\"`\r\n\r\nI am not sure why they would be 'incompatible' here. My team was making a namedtuple to make up for the fact that wav_file.setparameters just took a raw untyped tuple as input. \r\n\r\n**Expected Behavior**\r\n\r\nThe named tuple here does match the required fields ofr setparams of `Wave_write` object from the stdlib so it should pass.\r\n\r\n**Actual Behavior**\r\n\r\nOn newer versions of mypy this errors\r\n\r\n**Your Environment**\r\n\r\n- Python version used: 3.8\r\n- Operating system and version: Linux\r\n","author":{"url":"https://github.com/f4hy","@type":"Person","name":"f4hy"},"datePublished":"2022-07-18T05:13:45Z","url":"https://github.com/python/typeshed/issues/8322"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react-reconciler,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@d5750093facf |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:ad29d827-d92d-62f6-d5a7-0898ab140aba |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 8ABE:1A67FD:4A9706:66B1E7:6AECCCA0 |
| html-safe-nonce | 1858c02ff6bb082b76585f78e6245f2011417a6522b657297633bf88795ae291 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4QUJFOjFBNjdGRDo0QTk3MDY6NjZCMUU3OjZBRUNDQ0EwIiwidmlzaXRvcl9pZCI6IjEwMTQyNTMzMjA0MDM3MzM2NjQiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 9aaae52749d9659d106ee1caa5bb64b5146e66181c0956dfd6ce65196f9df46a |
| hovercard-subject-tag | issue:1307423334 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/python/typeshed/8322/issue_layout |
| twitter:image | https://opengraph.githubassets.com/be5ba1796e4119be20fa9e389bb11ba0bf49d44f8223bad6e98e85a80c3bdc92/python/typeshed/issues/8322 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/be5ba1796e4119be20fa9e389bb11ba0bf49d44f8223bad6e98e85a80c3bdc92/python/typeshed/issues/8322 |
| og:image:alt | Bug Report When working with the wave module of the standard library, valid code from mypy <0.950 works but errors with error: Argument 1 to "setparams" of "Wave_write" has incompatible type "wavep... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | f4hy |
| hostname | github.com |
| expected-hostname | github.com |
| None | dc0b519c5798dc1150b88dc4c06a8b9634d0069218dc04e469970e76aad74016 |
| turbo-cache-control | no-preview |
| go-import | github.com/python/typeshed git https://github.com/python/typeshed.git |
| octolytics-dimension-user_id | 1525981 |
| octolytics-dimension-user_login | python |
| octolytics-dimension-repository_id | 31696383 |
| octolytics-dimension-repository_nwo | python/typeshed |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 31696383 |
| octolytics-dimension-repository_network_root_nwo | python/typeshed |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | db139f0bf57b59bf9a8c4abb0849924d6c6ca559 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width