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

PEP 3137 patch (repr, names, parser) #45588

Closed
tiran opened this issue Oct 8, 2007 · 8 comments
Closed

PEP 3137 patch (repr, names, parser) #45588

tiran opened this issue Oct 8, 2007 · 8 comments
Assignees
Labels
interpreter-core (Objects, Python, Grammar, and Parser dirs)

Comments

@tiran
Copy link
Member

tiran commented Oct 8, 2007

BPO 1247
Nosy @gvanrossum, @gpshead, @tiran, @avassalotti
Files
  • pep3137.patch
  • change_bytes_repr_for_buffer.patch
  • change_string_repr_prefix.patch
  • tmp_test_bytes_fix.patch
  • py3k-pep3137_harmless.patch
  • 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/gvanrossum'
    closed_at = <Date 2007-10-31.23:30:20.716>
    created_at = <Date 2007-10-08.16:39:20.536>
    labels = ['interpreter-core']
    title = 'PEP 3137 patch (repr, names, parser)'
    updated_at = <Date 2007-10-31.23:30:20.680>
    user = 'https://github.com/tiran'

    bugs.python.org fields:

    activity = <Date 2007-10-31.23:30:20.680>
    actor = 'gvanrossum'
    assignee = 'gvanrossum'
    closed = True
    closed_date = <Date 2007-10-31.23:30:20.716>
    closer = 'gvanrossum'
    components = ['Interpreter Core']
    creation = <Date 2007-10-08.16:39:20.536>
    creator = 'christian.heimes'
    dependencies = []
    files = ['8491', '8492', '8493', '8494', '8624']
    hgrepos = []
    issue_num = 1247
    keywords = ['patch']
    message_count = 8.0
    messages = ['56280', '56282', '56287', '56289', '56294', '56806', '56843', '57006']
    nosy_count = 4.0
    nosy_names = ['gvanrossum', 'gregory.p.smith', 'christian.heimes', 'alexandre.vassalotti']
    pr_nums = []
    priority = 'high'
    resolution = 'accepted'
    stage = None
    status = 'closed'
    superseder = None
    type = None
    url = 'https://bugs.python.org/issue1247'
    versions = ['Python 3.0']

    @tiran
    Copy link
    Member Author

    tiran commented Oct 8, 2007

    The patches changes:

    • change PyString's repr() to return "b'...'"
    • change PyBytes's repr() to return "buffer(b'...')"
    • change parser so that b"..." returns PyString, not PyBytes
    • rename bytes -> buffer, str8 -> bytes

    The patch breaks some unit test because some of the infrastructure like
    the new buffer() isn't in place yet. I'm not happy with bytes_repr() but
    the for loop with *p++ was the easiest way to implement it. Every other
    implementation I could think of was either too complicated or wouldn't
    work (like memcpy).

    @tiran tiran added the interpreter-core (Objects, Python, Grammar, and Parser dirs) label Oct 8, 2007
    @avassalotti
    Copy link
    Member

    I am not sure how the parser work, so I can't comment if your change to
    it is correct. It would probably a better idea to keep it for later,
    when the semantic differences between str8 and bytes objects will be
    resolved.

    I think changing b'' to buffer(b''), in the tests, is not a good idea.
    These tests will need to be changed again when bytes() will be changed
    to str8().

    Your changes to PyString and PyBytes look good to me. As I said on the
    mailing list, I think the for-loops in bytes_repr() should be changed to:

    while (*quote_prefix)
        *p++ = *quote_prefix++;
    

    I attached updated patches with the above change. I also replaced
    bytes() for buffer() in PyBytes's docstrings.

    @gvanrossum
    Copy link
    Member

    GHave you two agreed yet as to which patch(es) I should look at?

    @tiran
    Copy link
    Member Author

    tiran commented Oct 9, 2007

    Guido van Rossum wrote:

    Guido van Rossum added the comment:

    GHave you two agreed yet as to which patch(es) I should look at?

    Please commit Alexandres patch. His patch for bytesobject.c is based on
    my patch. It's more complete and a bit better than mine, too. I'm going
    to create a new patch for the other tasks later.

    @gvanrossum
    Copy link
    Member

    I don't think I can check these in yet; right now they are inconsistent.
    But I will check them in when they are ready.

    @gvanrossum gvanrossum self-assigned this Oct 9, 2007
    @gvanrossum
    Copy link
    Member

    Setting to 'high' everything related to PEP-3137.

    @tiran
    Copy link
    Member Author

    tiran commented Oct 27, 2007

    Here is the patch that contains only the harmless parts of the previous
    patches. It changes a bunch of doc strings, changes the name of the
    types and their repr() and str(). It also adds __builtin__.buffer but it
    leaves __builtin__.bytes, __builtin__.str8 and b'' as they are.

    @gvanrossum
    Copy link
    Member

    I've submitted the 'harmless' patch (and much, much more) in r58741.
    I'm closing this now, the rest probably has been implemented one way or
    another as well. If you see something I missed, please open a new issue
    with a patch for just that issue.

    @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)
    Projects
    None yet
    Development

    No branches or pull requests

    3 participants