-
-
Notifications
You must be signed in to change notification settings - Fork 2k
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
fix PYTHONASYNCIODEBUG and AIOHTTP_NO_EXTENSIONS usage #551
Conversation
PYTHONASYNCIODEBUG environment variable enables asyncio debug mode if it's any **non-empty** string (see <https://docs.python.org/3/using/cmdline.html#envvar-PYTHONASYNCIODEBUG>). In code it's actually implemented in the following way, which corresponds to documented behaviour: self._debug = (not sys.flags.ignore_environment and bool(os.environ.get('PYTHONASYNCIODEBUG'))) Not documented `AIOHTTP_NO_EXTENSIONS` environment variable used in the same way, so it's behaviour is the same.
- PYTHONASYNCIODEBUG=0 AIOHTTP_NO_EXTENSIONS=0 | ||
- PYTHONASYNCIODEBUG=1 AIOHTTP_NO_EXTENSIONS=1 | ||
- PYTHONASYNCIODEBUG=0 AIOHTTP_NO_EXTENSIONS=1 | ||
- PYTHONASYNCIODEBUG=nonemptystring AIOHTTP_NO_EXTENSIONS= |
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 believe one character should be enough
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.
Actually I prefer to explicitly state meaning of the environment variable to prevent confusions such as fixed in this PR.
Setting PYTHONASYNCIODEBUG
to yes
, Y
, 1
, True
, T
etc, most probably will make reader to think that to negate meaning of the variable he should use no
, N
, 0
, False
, F
, etc value.
Maybe use shorter value, e.g. set
instead of nonemptystring
?
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.
It affects aiohttp contributors only.
Believe me I'll never again forget the rule but I don't want to see nonemptystring
every time when I open .travis.yml
.
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 don't think this affects only aiohttp
contributors. Since this is Open Source project it's common to use any part of it in other projects. For example I used this .travis.yml
as reference in aiohttp_cors
, and most probably will use again in other asyncio
-based project.
What about single character + comment?
1e16a4c
to
e28ca41
Compare
fix PYTHONASYNCIODEBUG and AIOHTTP_NO_EXTENSIONS usage
Thanks! |
PYTHONASYNCIODEBUG
environment variable enablesasyncio
debug mode if it's any non-empty string (docs).In code it's actually implemented in the following way, which corresponds to the documented behaviour:
Not documented
AIOHTTP_NO_EXTENSIONS
environment variable used in the same way, so it's behaviour is the same.BTW, maybe
AIOHTTP_NO_EXTENSIONS
should be documented?