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

Python 3 pdb: shows internal code, breakpoints don't work #50376

Closed
ericp mannequin opened this issue May 27, 2009 · 7 comments
Closed

Python 3 pdb: shows internal code, breakpoints don't work #50376

ericp mannequin opened this issue May 27, 2009 · 7 comments
Assignees
Labels
interpreter-core (Objects, Python, Grammar, and Parser dirs) type-bug An unexpected behavior, bug, or error

Comments

@ericp
Copy link
Mannequin

ericp mannequin commented May 27, 2009

BPO 6126
Nosy @birkenfeld, @pitrou, @agronholm
Files
  • pdb-fix.diff
  • 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/birkenfeld'
    closed_at = <Date 2009-08-13.08:17:21.997>
    created_at = <Date 2009-05-27.19:15:05.953>
    labels = ['interpreter-core', 'type-bug']
    title = "Python 3 pdb: shows internal code, breakpoints don't work"
    updated_at = <Date 2009-08-13.08:17:21.996>
    user = 'https://bugs.python.org/ericp'

    bugs.python.org fields:

    activity = <Date 2009-08-13.08:17:21.996>
    actor = 'georg.brandl'
    assignee = 'georg.brandl'
    closed = True
    closed_date = <Date 2009-08-13.08:17:21.997>
    closer = 'georg.brandl'
    components = ['Interpreter Core']
    creation = <Date 2009-05-27.19:15:05.953>
    creator = 'ericp'
    dependencies = []
    files = ['14679']
    hgrepos = []
    issue_num = 6126
    keywords = ['patch']
    message_count = 7.0
    messages = ['88431', '88756', '91433', '91434', '91468', '91469', '91515']
    nosy_count = 4.0
    nosy_names = ['georg.brandl', 'pitrou', 'ericp', 'alex.gronholm']
    pr_nums = []
    priority = 'normal'
    resolution = 'fixed'
    stage = None
    status = 'closed'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue6126'
    versions = ['Python 3.0']

    @ericp
    Copy link
    Mannequin Author

    ericp mannequin commented May 27, 2009

    I have a simple test file, test01.py, with this output:
    $ cat test01.py
    #!/usr/bin/env python

    print("Line 1")
    print("Line 2")
    print("Line 3")
    $
    $ # Now try debugging it.
    $ python3.0 -mpdb test01.py
    --Return--
    > /home/ericp/opt/Python-3.0.1/lib/python3.0/io.py(762)closed()->False
    -> return self.raw.closed
    (Pdb) b test01.py:4
    Breakpoint 1 at /home/ericp/lab/Python-3.0.1/test01.py:5
    (Pdb) r
    --Return--
    > /home/ericp/opt/Python-3.0.1/lib/python3.0/io.py(1471)closed()->False
    -> return self.buffer.closed
    (Pdb) c
    line 1
    line 2
    line 3
    The program finished and will be restarted

    Two main problems:

    1. I shouldn't see the code for io.py

    2. The program doesn't stop at the breakpoint, because that
      stack frame is exposed to bdb as (file:"<string>", line:4),
      not (file:"/home/.../test01.py", line:4).

    @ericp ericp mannequin added interpreter-core (Objects, Python, Grammar, and Parser dirs) type-bug An unexpected behavior, bug, or error labels May 27, 2009
    @ericp
    Copy link
    Mannequin Author

    ericp mannequin commented Jun 2, 2009

    Similar problem with 3.1rc1:

    C:\...>c:\Python31rc1\python.exe -m pdb hello01.py
    --Return--

    c:\python31rc1\lib\encodings\cp437.py(19)encode()->b'Hello'
    -> return codecs.charmap_encode(input,self.errors,encoding_map)[0]
    (Pdb) b 2
    *** Blank or comment
    (Pdb) b hello01.py:2
    Breakpoint 1 at c:\...\hello01.py:2

    (Pdb) b
    Num Type Disp Enb Where
    1 breakpoint keep yes at c:\...\hello01.py:2
    (Pdb) c
    Hello
    here
    bye
    The program finished and will be restarted
    --Return--

    c:\python31rc1\lib\encodings\cp437.py(19)encode()->b'Hello'
    -> return codecs.charmap_encode(input,self.errors,encoding_map)[0]
    (Pdb)

    @agronholm
    Copy link
    Mannequin

    agronholm mannequin commented Aug 9, 2009

    Why has this not been resolved yet? Not having a working debugger is a
    severe hindrance to the acceptance of Py3k.

    @birkenfeld
    Copy link
    Member

    Attached patch confirmedly fixes this. Will commit as soon as svn is
    back up.

    @birkenfeld birkenfeld self-assigned this Aug 9, 2009
    @pitrou
    Copy link
    Member

    pitrou commented Aug 11, 2009

    Reading this patch, is it normal that the file is opened in text mode
    without an encoding specified? What if the source file uses a different
    encoding than the default system one?

    @birkenfeld
    Copy link
    Member

    That's a good question :)

    A quick test shows that exec() does honor coding cookies in code given
    as a bytestring, so simply changing to open(..., "rb") should be fine.

    @birkenfeld
    Copy link
    Member

    Fixed in r74366, and merged back to 3.1 branch in r74367.

    @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
    interpreter-core (Objects, Python, Grammar, and Parser dirs) type-bug An unexpected behavior, bug, or error
    Projects
    None yet
    Development

    No branches or pull requests

    2 participants