Skip to content

Support for newline and encoding in tempfile module #45374

Closed

Description

@hupp
mannequin
BPO 1033
Nosy @gvanrossum
Files
  • tempfile-newline-encoding.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 = None
    closed_at = <Date 2007-08-28.03:30:24.434>
    created_at = <Date 2007-08-27.00:10:44.421>
    labels = ['type-feature', 'library']
    title = 'Support for newline and encoding in tempfile module'
    updated_at = <Date 2007-08-28.03:30:24.379>
    user = 'https://bugs.python.org/hupp'

    bugs.python.org fields:

    activity = <Date 2007-08-28.03:30:24.379>
    actor = 'gvanrossum'
    assignee = 'none'
    closed = True
    closed_date = <Date 2007-08-28.03:30:24.434>
    closer = 'gvanrossum'
    components = ['Library (Lib)']
    creation = <Date 2007-08-27.00:10:44.421>
    creator = 'hupp'
    dependencies = []
    files = ['8331']
    hgrepos = []
    issue_num = 1033
    keywords = []
    message_count = 3.0
    messages = ['55328', '55329', '55349']
    nosy_count = 2.0
    nosy_names = ['gvanrossum', 'hupp']
    pr_nums = []
    priority = 'normal'
    resolution = 'accepted'
    stage = None
    status = 'closed'
    superseder = None
    type = 'enhancement'
    url = 'https://bugs.python.org/issue1033'
    versions = ['Python 3.0']

    Activity

    1. hupp commented on Aug 27, 2007

      huppmannequin
      MannequinAuthor

      It would be useful for tempfile.TemporaryFile and friends to pass
      newline and encoding arguments to the underlying io.open call. For
      example, several tests in test_csv use TemporaryFile and need to handle
      unicode file output or preserve exact newlines. This is simpler with
      direct support in TemporaryFile.

      The attached patch makes the following changes:

      1. tempfile.TemporaryFile, NamedTemporaryFile, and SpooledTemporaryFile
        now pass newline and encoding to the underlying io.open call.
      2. test_tempfile is updated
      3. test_csv is updated to use the new arguments.
    2. added
      stdlibStandard Library Python modules in the Lib/ directory
      type-featureA feature request or enhancement
      on Aug 27, 2007
    3. hupp commented on Aug 27, 2007

      huppmannequin
      MannequinAuthor

      One change I forgot to mention that may need discussion. I've changed
      the 'bufsize' arguments in tempfile to 'buffering', since that is
      consistent with the same change in os.fdopen.

    4. gvanrossum commented on Aug 28, 2007

      @gvanrossum
      Member

      Thanks!

      Committed revision 57594.

      General note: please run Tools/scripts/reindent.py over your files after
      editing so I won't have to.

    5. 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

    No one assigned

      Labels

      stdlibStandard Library Python modules in the Lib/ directorytype-featureA feature request or enhancement

      Projects

      No projects

        Milestone

        No milestone

        Relationships

        None yet

        Development

        No branches or pull requests

        Issue actions