-
Notifications
You must be signed in to change notification settings - Fork 991
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
print to stderr #15704
print to stderr #15704
Conversation
@@ -362,6 +366,7 @@ def _load_python_file(conan_file_path): | |||
else: | |||
if folder.startswith(current_dir): | |||
module = sys.modules.pop(added) | |||
module.print = new_print |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like this - but makes me wonder if there are any risks since print
is a built-in? thinking of unusual scenarios like a frozen interpreter embedded in an executable - but it looks good otherwise!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had a look, and in theory it seems ok, this kind of overwrite of module globals seems allowed, it is not changing the built-in print, just making the module print()
pointing to another function, and this is done per-module, not globally.
Should this be using |
If we were forced to use the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Jenkins will be pleased by this change.
Changelog: Fix: Make all recipe and plugins python file
print()
tostderr
, so json outputs tostdout
are not broken.Docs: omit
Close #15671