[PATCH] D67753: [gn build] Fix Python DeprecationWarning

Marco Antognini via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 25 03:49:33 PDT 2019


mantognini added a comment.

In D67753#1681049 <https://reviews.llvm.org/D67753#1681049>, @thakis wrote:

> That's mysterious indeed. Looks like the default warnings come from here: https://github.com/python/cpython/blob/88e6447451fb5525e83e802c66c3e51b4a45bf86/Python/initconfig.c#L2064 You don't happen to run python in dev mode, do you? In dev mode, the warnings default to "default"; else they apparently don't.


I //think// I found out why //I// get those warnings: the Python binary we use for our test was built with `--with-pydebug`. I've tested this by downloading Python source and building it with and without that `./configure` option and it seems to change the behaviour of Python runtime. Using GDB, I inspected `config_init_warnoptions`. The options are set apparently in the same way. Turns out, the difference are in init_filters <https://github.com/python/cpython/blob/3.7/Python/_warnings.c#L1258-L1290>, which turns all warnings on when built using `--with-pydebug` but only the ones mentioned in the documentation when built without this option, and in get_filter <https://github.com/python/cpython/blob/3.7/Python/_warnings.c#L236>, which uses `get_default_action` under `--with-pydebug`.

Strictly speaking, this means that the warnings we see downstream are not triggered by default with Python 3.7. I still think it's worth fixing these, though.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D67753/new/

https://reviews.llvm.org/D67753





More information about the llvm-commits mailing list