Navigation Menu

Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sys.flags is missing bytes_warning #47039

Closed
schmir mannequin opened this issue May 8, 2008 · 9 comments
Closed

sys.flags is missing bytes_warning #47039

schmir mannequin opened this issue May 8, 2008 · 9 comments
Assignees
Labels
type-bug An unexpected behavior, bug, or error

Comments

@schmir
Copy link
Mannequin

schmir mannequin commented May 8, 2008

BPO 2790
Nosy @brettcannon, @tiran
Files
  • bytes_warning.patch: compute size with sizeof operator
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = 'https://github.com/tiran'
    closed_at = <Date 2008-05-08.20:25:10.839>
    created_at = <Date 2008-05-08.10:19:58.676>
    labels = ['type-bug']
    title = 'sys.flags is missing bytes_warning'
    updated_at = <Date 2008-05-08.20:44:02.359>
    user = 'https://bugs.python.org/schmir'

    bugs.python.org fields:

    activity = <Date 2008-05-08.20:44:02.359>
    actor = 'schmir'
    assignee = 'christian.heimes'
    closed = True
    closed_date = <Date 2008-05-08.20:25:10.839>
    closer = 'brett.cannon'
    components = []
    creation = <Date 2008-05-08.10:19:58.676>
    creator = 'schmir'
    dependencies = []
    files = ['10220']
    hgrepos = []
    issue_num = 2790
    keywords = ['patch']
    message_count = 9.0
    messages = ['66411', '66412', '66431', '66435', '66438', '66440', '66444', '66445', '66447']
    nosy_count = 3.0
    nosy_names = ['brett.cannon', 'christian.heimes', 'schmir']
    pr_nums = []
    priority = 'high'
    resolution = 'fixed'
    stage = None
    status = 'closed'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue2790'
    versions = ['Python 2.6']

    @schmir
    Copy link
    Mannequin Author

    schmir mannequin commented May 8, 2008

    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)

    @schmir schmir mannequin added the type-bug An unexpected behavior, bug, or error label May 8, 2008
    @schmir
    Copy link
    Mannequin Author

    schmir mannequin commented May 8, 2008

    brett, I added you to the nosy list, as you seem to have committed this
    in r62303 (http://hgpy.de/py/trunk/rev/ac1ae32a476c)

    @tiran tiran self-assigned this May 8, 2008
    @brettcannon
    Copy link
    Member

    Ralf, can you do a make clean and then try again? I had this happen to
    me with an old checkout until I did that and then everything worked fine.

    @schmir
    Copy link
    Mannequin Author

    schmir mannequin commented May 8, 2008

    sure, I even removed the whole source tree:
    ~/pydev/trunk/ ./python                                          
    ralf@rat64 ok
    Python 2.6a3+ (trunk, May  8 2008, 21:52:39) 
    [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)

    You can count the entries manually if you don't believe. The given count
    is off by one.

    @brettcannon
    Copy link
    Member

    Fixed in r62896.

    @schmir
    Copy link
    Mannequin Author

    schmir mannequin commented May 8, 2008

    why not use sizeof? you'll probably run into this again..

    @schmir
    Copy link
    Mannequin Author

    schmir mannequin commented May 8, 2008

    btw, I guess that sentinel entry in that array could also be removed?

    @brettcannon
    Copy link
    Member

    I didn't use sizeof because I didn't think of it; the solution to just
    change the numbers was right in front of me and I am swamped with other
    work so I went with what I knew would work.

    As for removing the array, perhaps, but I don't have time to try that out.

    @schmir
    Copy link
    Mannequin Author

    schmir mannequin commented May 8, 2008

    ok brett, I see in IRC you're doing lot's of commits currently. sorry
    for bothering you. I'll maybe try myself, it's a minor issue anyway...

    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    type-bug An unexpected behavior, bug, or error
    Projects
    None yet
    Development

    No branches or pull requests

    2 participants