GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — fcntl: various improvements by hauntsaninja · Pull Request #3680 · python/typeshed

Conversation

@hauntsaninja

@hauntsaninja hauntsaninja commented Jan 28, 2020

Copy link
Copy Markdown
Collaborator
  • use overload for fcntl.ioctl
  • use overload for fcntl.fcntl
  • mark positional-only args

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@hauntsaninja

hauntsaninja commented Jan 28, 2020

Copy link
Copy Markdown
Collaborator Author

Little less sure about this one...

  • The comment about depending on the type of cmd, not arg seems incorrect (introduced in bf50135). I checked the docs and examples, CPython implementation and CPython tests, but
    I might be missing something.
  • This isn't a module I really know how to use, so my testing was mainly limited to the examples in the documentation.
  • If there's a good way to type buffers and mutable buffers, let me know, and I can remove the other TODO as well.
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

JelleZijlstra
JelleZijlstra reviewed Jan 29, 2020
View reviewed changes
Comment thread stdlib/3/fcntl.pyi
__request: int,
__arg: bytearray,
__mutate_flag: Literal[True] = ...) -> int: ...
@overload

@JelleZijlstra JelleZijlstra Jan 29, 2020

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this overload can be omitted (note that bytearray is treated as a subtype of bytes to the typechecker).

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
JelleZijlstra
JelleZijlstra reviewed Jan 29, 2020
View reviewed changes

@JelleZijlstra JelleZijlstra left a comment

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For the buffer protocol, see python/typing#593.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
hauntsaninja added 4 commits February 4, 2020 16:04
hauntsaninja
fcntl: mark positional-only args
64894c4
hauntsaninja
fcntl: use overload for fcntl.fcntl
c6dbfbe
The comment about depending on the type of arg seems incorrect
python@bf50135

I checked the docs and examples, CPython implementation and CPython tests, but
I might be missing something
hauntsaninja
fcntl: use overload for fcntl.ioctl
10400fa
Based off of docs and examples
hauntsaninja
fcntl: type buffers better
4d89247
Follows the approach in python#2610
@hauntsaninja
hauntsaninja force-pushed the fcntl branch from c8808ac to 4d89247 Compare February 5, 2020 00:04
@JelleZijlstra
JelleZijlstra merged commit 1b7eadc into python:master Feb 22, 2020
@hauntsaninja
hauntsaninja deleted the fcntl branch February 22, 2020 05:32
Rahix added a commit to Rahix/tbot that referenced this pull request Mar 11, 2020
@Rahix
subprocess: Fix a mypy error
efbe31c
A recent change in Python's typeshed [1] leads to mypy complaining that
there is no overload for ioctl() with the signature `int, int, bytes`.
By adding an explicit `mutate_flag=False`, another overload is selected
and mypy stays quiet.

[1]: python/typeshed#3680

Signed-off-by: Harald Seiler <[email protected]>
@julian-klode julian-klode mentioned this pull request Mar 24, 2020
fcntl.ioctl() regression: mutate_flag now mandatory for read-only buffer #3881
Closed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@JelleZijlstra JelleZijlstra JelleZijlstra left review comments

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@hauntsaninja @JelleZijlstra
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.