Comments (5)
Thank you for the reproducer @jnsnow ! I don't have python 3.8 locally, but I've opened #9753 to reproduce in the continuous integration.
from pylint.
I don't have access to laptop right now, but can somebody bisect if this is due to #9714?
from pylint.
Seeing the same in QEMU's tests: under Python 3.9 through 3.12 inclusive, there's no issue. Python 3.8 with 3.1.1, 3.2.0, 3.2.1, 3.2.2, 3.2.3 all work correctly. This only seems to surface directly under pylint 3.2.4 and python 3.8. Python 3.7 and earlier untested.
Bisecting confirms commit c41c35a
here's a somewhat minimized reproducer: I tried testing it one function at a time, but could only trigger it in the caller to qemu_img_json()
.
import json
import subprocess
from typing import Any
def qemu_tool(
*args: str,
check: bool = True,
combine_stdio: bool = True
) -> 'subprocess.CompletedProcess[str]':
subp = subprocess.run(
args,
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT if combine_stdio else subprocess.PIPE,
universal_newlines=True,
check=False
)
if check and subp.returncode or (subp.returncode < 0):
raise subprocess.CalledProcessError(
subp.returncode, args,
output=subp.stdout,
stderr=subp.stderr,
)
return subp
def qemu_img(
*args: str,
check: bool = True,
combine_stdio: bool = True
) -> 'subprocess.CompletedProcess[str]':
full_args = ['qemu-img'] + list(args)
return qemu_tool(*full_args, check=check, combine_stdio=combine_stdio)
def qemu_img_json(*args: str) -> Any:
try:
res = qemu_img(*args, combine_stdio=False)
except subprocess.CalledProcessError as exc:
if exc.returncode < 0:
raise
try:
return json.loads(exc.stdout)
except json.JSONDecodeError:
pass
raise
return json.loads(res.stdout)
def qemu_img_info(*args: str) -> Any:
ret = qemu_img_json('info', "--output", "json", *args)
print("hello?") # repro.py:50:4: W0101: Unreachable code (unreachable)
return ret
... If I had to guess, it's because _SpecialForm
is being checked in 3.8, but I believe that typing.Any also inherits _SpecialForm
, so I think that might be what's going on here.
from pylint.
Yup. Here's a much shorter reproducer:
from typing import Any
def repro() -> Any:
return 5
def main():
x = repro() + 5
print(x)
from pylint.
Big thankyou to everyone for getting this resolved so quickly.
from pylint.
Related Issues (20)
- Crash ``Building error when trying to create ast representation of module 'aws_cp.app'``
- pylint cannot find third-party packages in virtual environment HOT 3
- False Positive W0143-comparison-with-callable when using derived property descriptors
- Documentation about `class-const` needs to be updated.
- PEP 695: Type Parameter Syntax HOT 1
- pylint not finding the tox.ini config HOT 12
- [not-an-iterable] FP for attribute used in comprehension but guarded in if test HOT 2
- PyTest FixtureRequest
- Feature Request: Have multiple types for a naming-style HOT 2
- Support disabling possibly-used-before-assignment in-line for specific variables HOT 2
- `@overload` causes `missing-param-doc` despite parameter being documented HOT 1
- False positive unnecessary-negation for float comparison HOT 2
- Import error with Python 3.11 HOT 7
- Pylint is not smart enough when analyzes functions returning coroutine. HOT 5
- Incorrect complaint about the `_fields` attribute of instances of `typing.NamedTuple` HOT 2
- Unreachable code if exception is caught in decorator HOT 3
- no-value-for-parameter false positive with sqlalchemy.ext.hybrid.hybrid_method
- How to satisfy `unexpected-keyword-arg` in derived class override method that creates an instance via a super() method HOT 3
- `multiple-statements` no longer detected in a `finally:` block HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pylint.