[New-bugs-announce] [issue2790] sys.flags is missing bytes_warning

Ralf Schmitt report at bugs.python.org
Thu May 8 12:20:00 CEST 2008


New submission from Ralf Schmitt <schmir at gmail.com>:

sys.flags is missing bytes_warning:

Python 2.6a2+ (trunk, May  8 2008, 12:09:50) 
[GCC 4.2.3 (Debian 4.2.3-3)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> sys.flags
sys.flags(debug=0, py3k_warning=0, division_warning=0, division_new=0,
inspect=0, interactive=0, optimize=0, dont_write_bytecode=0,
no_user_site=0, no_site=0, ignore_environment=0, tabcheck=0, verbose=0,
unicode=0)

This is only used from warnings.py currently:

~/pydev/trunk/ ack bytes_warning                                       
                                 
Lib/warnings.py
311:    bytes_warning = sys.flags.bytes_warning
312:    if bytes_warning > 1:
314:    elif bytes_warning:

Python/sysmodule.c
1172:	{"bytes_warning", "-b"},

(I only see an attribute error in frozen programs).

The attached patch fixes it by not using the sizeof operator to compute
the size of the array.

This gives:
>>> sys.flags
sys.flags(debug=0, py3k_warning=0, division_warning=0, division_new=0,
inspect=0, interactive=0, optimize=0, dont_write_bytecode=0,
no_user_site=0, no_site=0, ignore_environment=0, tabcheck=0, verbose=0,
unicode=0, bytes_warning=0)

----------
files: bytes_warning.patch
keywords: patch
messages: 66411
nosy: schmir
severity: normal
status: open
title: sys.flags is missing bytes_warning
type: behavior
versions: Python 2.6
Added file: http://bugs.python.org/file10220/bytes_warning.patch

__________________________________
Tracker <report at bugs.python.org>
<http://bugs.python.org/issue2790>
__________________________________


More information about the New-bugs-announce mailing list