A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2008-September/082442.html below:

[Python-Dev] switching on -3 from within a program?

[Python-Dev] switching on -3 from within a program? [Python-Dev] switching on -3 from within a program?Christian Heimes lists at cheimes.de
Tue Sep 16 18:07:33 CEST 2008
Anthon van der Neut wrote:
> import sys
> sys.py3kwarning = True
> x = { 'abc': 1 }; x.has_key('abc')
> 
> which does not give a warning (starting python2.6 with the -3 option of
> course does).
 > Is there anyway to switch this on from within a program with a Python
 > statement?

That doesn't work because "sys.py3kwarning = True" doesn't change the 
global C variable Py_Py3kWarningFlag. IIRC there is no API to change the 
flag from Python code.


> If not, would I need to make a small C-extension module (to be imported
> as the first module) that sets Py_Py3WarningFlag or something else at
> the C level, or would that better be done by mod_wsgi's C code.

I suggest that you introduce a new config option that sets 
Py_Py3kWarningFlag to 1.

Christian

More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4