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
Add environment variable $PYTHONWARNINGS #51550
Comments
It would be very useful to have an environment variable $PYTHONWARNINGS, Use case: a test suite running many subprocesses, testing that those |
I attached a patch against trunk r76237 which seems to cover this, sans The patch allows multiple warnings to be passed to the environment Let me know what you think. |
test_warnings is probably the best place since test_cmd_line ignores |
Added a patch which includes tests in test_warnings. There are tests for |
fixed a tab/space issue |
Updated patch, tests weren't working. |
Looks good to me. Updated patch with a couple whitespace changes |
Patch looks good to me too. Do any of you have commit privileges? If so, please commit this. If not assign the issue to me and I'll do it. |
applied in r79878 - r79881, thanks! |
I committed a somewhat different version of this patch to py3k to handle the warn options now calling for wchars, but this needs more work. Some of the buildbots are unhappy Seems like the py3k version either needs to fully decode the env values to a unicode obj via the file system encoding (which I doubt is initialized at this point)/surrogateescape, or use something along the lines of char2wchar in python.c |
Here's a patch for py3k using the same char2wchar as the argv decoder for posix, and better windows handling. Plus an additional nonascii value test. Patch is against r79980 for clarity |
The tests don't look good to me. You should use p.communicate() rather than p.stdout.read(). Also, check the error return code and raise an error if it's non-zero. |
The changes in main.c in r79881 don't look right: strtok() is used on the string returned by getenv(), which must not Also (and this admittedly cosmetic), perhaps use a static buffer like |
The pending patch for py3k fixes the modification of the env value (trunk already has a fix for that). That patch is also doing the conversion to wchar_t via the char2wchar function now, with that reusing a single buffer seems out of the question |
py3k should be taken care of as of r80066+r80075 |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: