[New-bugs-announce] [issue10089] Add support for arbitrary -X options

Antoine Pitrou report at bugs.python.org
Wed Oct 13 21:01:40 CEST 2010

New submission from Antoine Pitrou <pitrou at free.fr>:

It can be useful to enable or disable global Python features based on command-line flags. The -X is supposed to allow implementation-specific options but it is currently disabled for CPython. This patch allows to use -X for arbitrary options in CPython. These options are not validated but minimally parsed and fed into a dictionary, sys.xoptions. An example is better than a thousand words:

$ ./python -c "import sys; print(sys.xoptions)"
$ ./python -Xa,b=c,d -Xe,f=g=h -c "import sys; print(sys.xoptions)"
{'a': True, 'b': 'c', 'e': True, 'd': True, 'f': 'g=h'}

This could be useful for various debug enablers, such as Victor's SIGSEGV handler, warnings about unclosed files, etc.

components: Interpreter Core
files: xopts.patch
keywords: patch
messages: 118563
nosy: haypo, loewis, ncoghlan, pitrou
priority: normal
severity: normal
stage: patch review
status: open
title: Add support for arbitrary -X options
type: feature request
versions: Python 3.2
Added file: http://bugs.python.org/file19221/xopts.patch

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list