This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author schmir
Recipients schmir
Date 2008-05-08.10:19:46
SpamBayes Score 0.0035420132
Marked as misclassified No
Message-id <1210242000.56.0.446699742835.issue2790@psf.upfronthosting.co.za>
In-reply-to
Content
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)
History
Date User Action Args
2008-05-08 10:20:03schmirsetspambayes_score: 0.00354201 -> 0.0035420132
recipients: + schmir
2008-05-08 10:20:00schmirsetspambayes_score: 0.00354201 -> 0.00354201
messageid: <1210242000.56.0.446699742835.issue2790@psf.upfronthosting.co.za>
2008-05-08 10:19:58schmirlinkissue2790 messages
2008-05-08 10:19:56schmircreate