[Python-Dev] Add a developer mode to Python: -X dev command line option

Yury Selivanov yselivanov.ml at gmail.com
Thu Nov 16 09:47:31 EST 2017


On Thu, Nov 16, 2017 at 7:56 AM, Victor Stinner
<victor.stinner at gmail.com> wrote:
> 2017-11-16 13:43 GMT+01:00 Antoine Pitrou <antoine at python.org>:
>>> About asyncio debug mode, if it's too expensive to be used to develop
>>> an application, maybe there is an issue with additional checks? Should
>>> we remove some of them to be able to use asyncio debug mode in more
>>> cases?
>>
>> Well, I'm sure some people like them, otherwise they wouldn't have been
>> added to the codebase in the first place :-)  For example, knowing where
>> a Future was created can make debug logs much more informative.
>
> The most expensive part of asyncio debug mode is the code to extracts
> the current stack when a coroutine or a handle is created.

Probably the most expensive part of asyncio debug mode is all
coroutines wrapped with CoroWrapper.  This makes every "await" and
coroutine instantiation much slower (think 2-3x).

> Would it make sense to modify asyncio debug mode to skip the traceback
> by default, but add a second debug level which extracts the traceback?

Let's keep it simple.  I'm big -1 on adding different "debug levels",
they are always confusing.

Overall I don't see an issue with enabling asyncio debug mode when
python is executed with "-X dev".  If the purpose of the flag is to
make Python super verbose and it will not be recommended to use it in
production -- then why not.


Yury


More information about the Python-Dev mailing list