Skip to content

fcntl.ioctl() regression: mutate_flag now mandatory for read-only buffer #3881

Closed

Description

@julian-klode

#3680 now mandates the presence of a boolean mutate_flag in case of an read-only bytes buffer for the argument, which seems wrong, it should be optional (it does not do anything).

This breaks code like this:

buf = fcntl.ioctl(fileno, termios.TIOCGWINSZ, 8 * b' ')

which now pointlessly needs to be written as

buf = fcntl.ioctl(fileno, termios.TIOCGWINSZ, 8 * b' ', False)

or reworked to use a bytearray.

Activity

  1. changed the title [-]fcntl.ioctl() regression[/-] [+]fcntl.ioctl() regression: mutate_flag now mandatory for read-only buffer[/+] on Mar 24, 2020
  2. julian-klode commented on Mar 24, 2020

    @julian-klode
    ContributorAuthor

    This also breaks compatibility with Python 2 code, as it does not accept the mutate_flag argument.

    TypeError                                 Traceback (most recent call last)
    <ipython-input-6-73e86fea1fbd> in <module>()
    ----> 1 fcntl.ioctl(2, termios.TIOCGWINSZ, 8 * b' ', True)
    
    TypeError: ioctl requires a file or file descriptor, an integer and optionally an integer or buffer argument
    
  3. added a commit that references this issue on Mar 24, 2020
    23dc493
  4. julian-klode commented on Mar 24, 2020

    @julian-klode
    ContributorAuthor

    Fix in #3882

  5. added a commit that references this issue on Mar 24, 2020
    009b269
  6. added a commit that references this issue on Jul 9, 2021
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

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions