Skip to content

Tools/Scripts/crlf.py needs updating for python 3+ #56241

Closed

Description

@stephenferg
BPO 12032
Nosy @merwok

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/merwok'
closed_at = <Date 2011-08-12.17:57:45.623>
created_at = <Date 2011-05-08.16:55:28.965>
labels = ['type-bug']
title = 'Tools/Scripts/crlf.py needs updating for python 3+'
updated_at = <Date 2011-08-12.17:57:45.622>
user = 'https://bugs.python.org/stephenferg'

bugs.python.org fields:

activity = <Date 2011-08-12.17:57:45.622>
actor = 'eric.araujo'
assignee = 'eric.araujo'
closed = True
closed_date = <Date 2011-08-12.17:57:45.623>
closer = 'eric.araujo'
components = ['Demos and Tools']
creation = <Date 2011-05-08.16:55:28.965>
creator = 'stephen_ferg'
dependencies = []
files = []
hgrepos = []
issue_num = 12032
keywords = []
message_count = 4.0
messages = ['135531', '135555', '141790', '141978']
nosy_count = 3.0
nosy_names = ['eric.araujo', 'python-dev', 'stephen_ferg']
pr_nums = []
priority = 'normal'
resolution = 'fixed'
stage = 'resolved'
status = 'closed'
superseder = None
type = 'behavior'
url = 'https://bugs.python.org/issue12032'
versions = ['Python 3.2']

Activity

  1. stephenferg commented on May 8, 2011

    stephenfergmannequin
    MannequinAuthor

    I think this is a consequence of the new Unicode support in Python 3+

    Here is code copied from C:\Python32\Tools\Scripts\crlf.py (on windows)
    ==================================================================

        for filename in os.listdir("."):
            if os.path.isdir(filename):
                print(filename, "Directory!")
                continue
            data = open(filename, "rb").read()
            if '\0' in data:
                print(filename, "Binary!")
                continue
            newdata = data.replace("\r\n", "\n")
            if newdata != data:
                print(filename)

    ===================================================================

    When run, it produces this (run under the PyCharm debugger)

    ===================================================================

    C:\Python32\python.exe C:/pydev/zob/zobtest.py
    Traceback (most recent call last):
      File "C:/pydev/zob/zobtest.py", line 134, in <module>
        x() 
      File "C:/pydev/zob/zobtest.py", line 126, in x
        if '\0' in data:
    TypeError: Type str doesn't support the buffer API

    Process finished with exit code 1
    ===================================================================

    Removing the test for "\0" produces this:
    ===================================================================

    C:\Python32\python.exe C:/pydev/zob/zobtest.py
    Traceback (most recent call last):
      File "C:/pydev/zob/zobtest.py", line 131, in <module>
        x()  
      File "C:/pydev/zob/zobtest.py", line 126, in x
        newdata = data.replace("\r\n", "\n")
    TypeError: expected an object with the buffer interface

    Process finished with exit code 1
    ===================================================================

  2. added
    type-crashA hard crash of the interpreter, possibly with a core dump
    on May 8, 2011
  3. python-dev commented on May 8, 2011

    python-devmannequin
    Mannequin

    New changeset f94d74c85dcb by Victor Stinner in branch 'default':
    Close bpo-12032: Fix scripts/crlf.py for Python 3
    http://hg.python.org/cpython/rev/f94d74c85dcb

  4. changed the title [-]Tools/Scripts/crlv.py needs updating for python 3+[/-] [+]Tools/Scripts/crlf.py needs updating for python 3+[/+] on Aug 5, 2011
  5. added
    type-bugAn unexpected behavior, bug, or error
    and removed
    type-crashA hard crash of the interpreter, possibly with a core dump
    on Aug 5, 2011
  6. merwok commented on Aug 8, 2011

    @merwok
    Member

    This needs porting to 3.2.

  7. reopened this on Aug 8, 2011
  8. python-dev commented on Aug 12, 2011

    python-devmannequin
    Mannequin

    New changeset 47ffb957921d by Éric Araujo in branch '3.2':
    Update crlf and lfcr scripts for 3.x bytes semantics (bpo-12032).
    http://hg.python.org/cpython/rev/47ffb957921d

  9. self-assigned this
    on Aug 12, 2011
  10. transferred this issue fromon Apr 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

type-bugAn unexpected behavior, bug, or error

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions