nebius/SWE-bench-extra huggingface dataset:
Repository: PostHog/posthog-python

Issue:
Library does not properly handle feature flags with no % rollout
See sentry issue https://sentry.io/organizations/posthog/issues/2220836956/?project=1899813. If a feature flag is enabled for everyone without a % rollout, the client crashes. Notice that this is different from a 100% rollout which works fine.


```
unsupported operand type(s) for /: 'NoneType' and 'int'
```

posthoganalytics/client.py#L276
```python
response = _hash(key, distinct_id) <= (feature_flag['rollout_percentage'] / 100)
```

Comments:

Patch:
diff --git a/posthog/client.py b/posthog/client.py
index 0588082..22157cf 100644
--- a/posthog/client.py
+++ b/posthog/client.py
@@ -330,8 +330,8 @@ class Client(object):
             except IndexError:
                 return default
 
-            if feature_flag.get("is_simple_flag") and feature_flag.get("rollout_percentage"):
-                response = _hash(key, distinct_id) <= (feature_flag["rollout_percentage"] / 100)
+            if feature_flag.get("is_simple_flag"):
+                response = _hash(key, distinct_id) <= ((feature_flag.get("rollout_percentage", 100) or 100) / 100)
             else:
                 try:
                     request_data = {


Test patch:
diff --git a/posthog/test/test_client.py b/posthog/test/test_client.py
index e4971db..9c867a0 100644
--- a/posthog/test/test_client.py
+++ b/posthog/test/test_client.py
@@ -325,14 +325,28 @@ class TestClient(unittest.TestCase):
         self.assertTrue(client.feature_enabled("beta-feature", "distinct_id"))
 
     @mock.patch("posthog.client.decide")
-    def test_feature_enabled_request(self, patch_get):
-        patch_get.return_value = {"featureFlags": ["beta-feature"]}
+    def test_feature_enabled_request(self, patch_decide):
+        patch_decide.return_value = {"featureFlags": ["beta-feature"]}
         client = Client(TEST_API_KEY)
         client.feature_flags = [
             {"id": 1, "name": "Beta Feature", "key": "beta-feature", "is_simple_flag": False, "rollout_percentage": 100}
         ]
         self.assertTrue(client.feature_enabled("beta-feature", "distinct_id"))
 
+    @mock.patch("posthog.client.get")
+    def test_feature_enabled_simple_without_rollout_percentage(self, patch_get):
+        client = Client(TEST_API_KEY)
+        client.feature_flags = [{"id": 1, "name": "Beta Feature", "key": "beta-feature", "is_simple_flag": True}]
+        self.assertTrue(client.feature_enabled("beta-feature", "distinct_id"))
+
+    @mock.patch("posthog.client.get")
+    def test_feature_enabled_simple_with_none_rollout_percentage(self, patch_get):
+        client = Client(TEST_API_KEY)
+        client.feature_flags = [
+            {"id": 1, "name": "Beta Feature", "key": "beta-feature", "is_simple_flag": True, "rollout_percantage": None}
+        ]
+        self.assertTrue(client.feature_enabled("beta-feature", "distinct_id"))
+
     @mock.patch("posthog.client.Poller")
     @mock.patch("posthog.client.get")
     def test_feature_enabled_doesnt_exist(self, patch_get, patch_poll):
Repository: PyCQA/flake8

Issue:
Config file .flake8 not exist when running github actions
### how did you install flake8?

```console
jobs:
  flake8_py3:
    runs-on: ubuntu-latest
    steps:
      - name: Setup Python
        uses: actions/setup-python@v1
        with:
          python-version: 3.9.x
          architecture: x64
      - name: Checkout PyTorch
        uses: actions/checkout@master
      - name: Install flake8
        run: pip install flake8==4.0.1
      - name: Run flake8
        uses: suo/flake8-github-action@v1
        with:
          checkName: 'flake8_py3'   # NOTE: this needs to be the same as the job name
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
```


### unmodified output of `flake8 --bug-report`

```json
platform: git hub
```


### describe the problem

# Description of the issue
I have been using flake8 to run during the github  actions. Configuration code is described above in how install flake8.

It was great until the new release 5.0.x was released on the 30th of July. 
Starting from this release flake8 always fails because is trying to get the configuration from the runner server, which of course does not exist. 


#### what  happen
```
There was a critical error during execution of Flake8:
The specified config file does not exist: /home/runner/work/<my_repository>/.flake8
Error: The process 'flake8' failed with exit code 1


Comments:

Patch:
diff --git a/src/flake8/options/config.py b/src/flake8/options/config.py
index 36fe976..daf8529 100644
--- a/src/flake8/options/config.py
+++ b/src/flake8/options/config.py
@@ -29,9 +29,9 @@ def _find_config_file(path: str) -> Optional[str]:
         home_stat = None
 
     dir_stat = _stat_key(path)
-    cfg = configparser.RawConfigParser()
     while True:
         for candidate in ("setup.cfg", "tox.ini", ".flake8"):
+            cfg = configparser.RawConfigParser()
             cfg_path = os.path.join(path, candidate)
             try:
                 cfg.read(cfg_path, encoding="UTF-8")


Test patch:
diff --git a/tests/unit/test_options_config.py b/tests/unit/test_options_config.py
index bdc2208..4ad6acd 100644
--- a/tests/unit/test_options_config.py
+++ b/tests/unit/test_options_config.py
@@ -21,7 +21,9 @@ def test_config_file_without_section_is_not_considered(tmp_path):
 
 
 def test_config_file_with_parse_error_is_not_considered(tmp_path, caplog):
-    tmp_path.joinpath("setup.cfg").write_text("[error")
+    # the syntax error here is deliberately to trigger a partial parse
+    # https://github.com/python/cpython/issues/95546
+    tmp_path.joinpath("setup.cfg").write_text("[flake8]\nx = 1\n...")
 
     assert config._find_config_file(str(tmp_path)) is None
Repository: PyCQA/flake8-bugbear

Issue:
B902 requires first parameter named self for __init__ of metaclass
I have a metaclass defined like this:

    class StorageMeta(type):
        def __init__(cls, name, bases, d):

Naturally B902 flagged the first parameter of `__init__`, but I'm not sure if it's intended in the case of metaclasses. I can imagine arguments for and against this behavior.

Comments:

Patch:
diff --git a/README.rst b/README.rst
index 9f3cf5f..81382f4 100644
--- a/README.rst
+++ b/README.rst
@@ -107,9 +107,10 @@ Users coming from Python 2 may expect the old behavior which might lead
 to bugs.  Use native ``async def`` coroutines or mark intentional
 ``return x`` usage with ``# noqa`` on the same line.
 
-**B902**: Invalid first argument used for method. Use ``self`` for
-instance methods, and `cls` for class methods (which includes `__new__`
-and `__init_subclass__`).
+**B902**: Invalid first argument used for method. Use ``self`` for instance
+methods, and `cls` for class methods (which includes `__new__` and
+`__init_subclass__`) or instance methods of metaclasses. Note that this lint
+can only detect metaclasses if they directly inherit from ``type``.
 
 **B950**: Line too long. This is a pragmatic equivalent of ``pycodestyle``'s
 E501: it considers "max-line-length" but only triggers when the value has been
diff --git a/bugbear.py b/bugbear.py
index d9dc7e7..42a9077 100644
--- a/bugbear.py
+++ b/bugbear.py
@@ -319,6 +319,10 @@ class BugBearVisitor(ast.NodeVisitor):
         ):
             expected_first_args = B902.cls
             kind = 'class'
+        elif any(getattr(x, 'id', None) == 'type'
+                 for x in self.node_stack[-2].bases):
+            expected_first_args = B902.cls
+            kind = 'metaclass instance'
         else:
             expected_first_args = B902.self
             kind = 'instance'


Test patch:
diff --git a/tests/b902.py b/tests/b902.py
index 91e6bc1..7f8ffc1 100644
--- a/tests/b902.py
+++ b/tests/b902.py
@@ -47,3 +47,13 @@ class Warnings:
 
     def invalid_keyword_only(*, self):
         ...
+
+
+class Meta(type):
+    def __init__(cls, name, bases, d):
+        ...
+
+
+class OtherMeta(type):
+    def __init__(self, name, bases, d):
+        ...
diff --git a/tests/test_bugbear.py b/tests/test_bugbear.py
index f7c89d9..c94a60e 100644
--- a/tests/test_bugbear.py
+++ b/tests/test_bugbear.py
@@ -146,6 +146,7 @@ class BugbearTestCase(unittest.TestCase):
                 B902(39, 22, vars=("*args", 'instance', 'self')),
                 B902(45, 30, vars=("**kwargs", 'instance', 'self')),
                 B902(48, 32, vars=("*, self", 'instance', 'self')),
+                B902(58, 17, vars=("'self'", 'metaclass instance', 'cls')),
             )
         )
Repository: PyCQA/flake8-bugbear

Issue:
crash on tuple expansion in try/except block
Running flake8 against the following file produces no report as an exception is raised in bugbear
```python
# dummy.py
grey_list = (ValueError,)
black_list = (TypeError,)

try:
    int("1e3")
except (*grey_list, *black_list):
    print("error caught")
```

crashes with
```
Traceback (most recent call last):
...
  File "/Users/clm/.pyenv/versions/3.8.6/envs/yt_dev/lib/python3.8/site-packages/bugbear.py", line 126, in _to_name_str
    assert isinstance(node, ast.Attribute)
AssertionError
```

For information
```
$ flake8 --version
3.8.4 (flake8-bugbear: 20.11.1, mccabe: 0.6.1, pycodestyle: 2.6.0, pyflakes: 2.2.0) CPython 3.8.6 on Darwin
```

Comments:

Patch:
diff --git a/bugbear.py b/bugbear.py
index 873fc10..974e5cb 100644
--- a/bugbear.py
+++ b/bugbear.py
@@ -124,8 +124,10 @@ def _to_name_str(node):
     # "pkg.mod.error", handling any depth of attribute accesses.
     if isinstance(node, ast.Name):
         return node.id
-    assert isinstance(node, ast.Attribute)
-    return _to_name_str(node.value) + "." + node.attr
+    try:
+        return _to_name_str(node.value) + "." + node.attr
+    except AttributeError:
+        return _to_name_str(node.value)
 
 
 def _typesafe_issubclass(cls, class_or_tuple):


Test patch:
diff --git a/tests/test_bugbear.py b/tests/test_bugbear.py
index ccce9da..c755fb9 100644
--- a/tests/test_bugbear.py
+++ b/tests/test_bugbear.py
@@ -340,6 +340,20 @@ class TestFuzz(unittest.TestCase):
                     if f.endswith(".py"):
                         BugBearChecker(filename=str(Path(dirname) / f))
 
+    def test_does_not_crash_on_tuple_expansion_in_except_statement(self):
+        # akin to test_does_not_crash_on_any_valid_code
+        # but targets a rare case that's not covered by hypothesmith.from_grammar
+        # see https://github.com/PyCQA/flake8-bugbear/issues/153
+        syntax_tree = ast.parse(
+            "grey_list = (ValueError,)\n"
+            "black_list = (TypeError,)\n"
+            "try:\n"
+            "    int('1e3')\n"
+            "except (*grey_list, *black_list):\n"
+            "     print('error caught')"
+        )
+        BugBearVisitor(filename="<string>", lines=[]).visit(syntax_tree)
+
 
 if __name__ == "__main__":
     unittest.main()
Repository: PyCQA/flake8-bugbear

Issue:
B008: Whitelist operator.{attrgetter,itemgetter,methodcaller} default args
Calling those functions in default args is perfectly fine and *not* calling them would most likely be a bug.

Comments:

Patch:
diff --git a/bugbear.py b/bugbear.py
index b881b8b..40708b9 100644
--- a/bugbear.py
+++ b/bugbear.py
@@ -694,6 +694,13 @@ B008.immutable_calls = {
     "frozenset",
     "types.MappingProxyType",
     "MappingProxyType",
+    "re.compile",
+    "operator.attrgetter",
+    "operator.itemgetter",
+    "operator.methodcaller",
+    "attrgetter",
+    "itemgetter",
+    "methodcaller",
 }
 B009 = Error(
     message=(


Test patch:
diff --git a/tests/b006_b008.py b/tests/b006_b008.py
index e60e968..40bf797 100644
--- a/tests/b006_b008.py
+++ b/tests/b006_b008.py
@@ -1,7 +1,10 @@
 import collections
 import logging
+import operator
+import re
 import time
 import types
+from operator import attrgetter, itemgetter, methodcaller
 from types import MappingProxyType
 
 
@@ -98,3 +101,21 @@ def float_int_is_wrong(value=float(3)):
 
 def float_str_not_inf_or_nan_is_wrong(value=float("3.14")):
     pass
+
+
+def re_compile_ok(value=re.compile("foo")):
+    pass
+
+
+def operators_ok(
+    v=operator.attrgetter("foo"),
+    v2=operator.itemgetter("foo"),
+    v3=operator.methodcaller("foo"),
+):
+    pass
+
+
+def operators_ok_unqualified(
+    v=attrgetter("foo"), v2=itemgetter("foo"), v3=methodcaller("foo")
+):
+    pass
diff --git a/tests/test_bugbear.py b/tests/test_bugbear.py
index c6e31bb..428d313 100644
--- a/tests/test_bugbear.py
+++ b/tests/test_bugbear.py
@@ -99,15 +99,15 @@ class BugbearTestCase(unittest.TestCase):
         self.assertEqual(
             errors,
             self.errors(
-                B006(26, 24),
-                B006(30, 29),
-                B006(34, 19),
-                B006(38, 19),
-                B006(42, 31),
-                B008(51, 38),
-                B006(67, 32),
-                B008(95, 29),
-                B008(99, 44),
+                B006(29, 24),
+                B006(33, 29),
+                B006(37, 19),
+                B006(41, 19),
+                B006(45, 31),
+                B008(54, 38),
+                B006(70, 32),
+                B008(98, 29),
+                B008(102, 44),
             ),
         )
Repository: PyCQA/flake8-bugbear

Issue:
B018 wrongly detects inline variable or attribute docstrings
Having an inline attribute doc string or a module variable docstring, it is wrongly marked as B018 (sample from sphinx doc):

```
module_level_variable2 = 98765
"""int: Module level variable documented inline.

The docstring may span multiple lines. The type may optionally be specified
on the first line, separated by a colon.
"""

```

Comments:

Patch:
diff --git a/bugbear.py b/bugbear.py
index 77b4dc6..9249550 100644
--- a/bugbear.py
+++ b/bugbear.py
@@ -639,7 +639,6 @@ class BugBearVisitor(ast.NodeVisitor):
             if isinstance(
                 subnode.value,
                 (
-                    ast.Str,
                     ast.Num,
                     ast.Bytes,
                     ast.NameConstant,


Test patch:
diff --git a/tests/b018_classes.py b/tests/b018_classes.py
index 12195c0..551b14e 100644
--- a/tests/b018_classes.py
+++ b/tests/b018_classes.py
@@ -1,6 +1,6 @@
 """
 Should emit:
-B018 - on lines 15-26, 30, 32
+B018 - on lines 16-26, 30, 33
 """
 
 
@@ -30,3 +30,4 @@ class Foo3:
     123
     a = 2
     "str"
+    1
diff --git a/tests/b018_functions.py b/tests/b018_functions.py
index 9764274..f8c3f77 100644
--- a/tests/b018_functions.py
+++ b/tests/b018_functions.py
@@ -1,6 +1,6 @@
 """
 Should emit:
-B018 - on lines 14-25, 29, 31
+B018 - on lines 15-25, 29, 32
 """
 
 
@@ -29,3 +29,4 @@ def foo3():
     123
     a = 2
     "str"
+    3
diff --git a/tests/test_bugbear.py b/tests/test_bugbear.py
index c05b828..319a508 100644
--- a/tests/test_bugbear.py
+++ b/tests/test_bugbear.py
@@ -234,9 +234,9 @@ class BugbearTestCase(unittest.TestCase):
         bbc = BugBearChecker(filename=str(filename))
         errors = list(bbc.run())
 
-        expected = [B018(line, 4) for line in range(14, 26)]
+        expected = [B018(line, 4) for line in range(15, 26)]
         expected.append(B018(29, 4))
-        expected.append(B018(31, 4))
+        expected.append(B018(32, 4))
         self.assertEqual(errors, self.errors(*expected))
 
     def test_b018_classes(self):
@@ -244,9 +244,9 @@ class BugbearTestCase(unittest.TestCase):
         bbc = BugBearChecker(filename=str(filename))
         errors = list(bbc.run())
 
-        expected = [B018(line, 4) for line in range(15, 27)]
+        expected = [B018(line, 4) for line in range(16, 27)]
         expected.append(B018(30, 4))
-        expected.append(B018(32, 4))
+        expected.append(B018(33, 4))
         self.assertEqual(errors, self.errors(*expected))
 
     def test_b901(self):
Repository: PyCQA/isort

Issue:
Line break and tab indentation makes wrong fix
`isort` causes odd fixing with import line which contains line berak and tab indentation.

before `isort` (Notice that this code uses Tab indentation, not spaces.)

```py
from sys \
	import version
print(version)
```

after `isort`
```py
from sys import importversion

print(version)
```

expected
```py
from sys import version

print(version)
```

### Versions
- macOS Big Sur 11.2.3
- Python 3.9.4
- isort 5.7.0

Comments:

Patch:
diff --git a/isort/parse.py b/isort/parse.py
index 714e39ab..2a15c90f 100644
--- a/isort/parse.py
+++ b/isort/parse.py
@@ -293,6 +293,7 @@ def file_contents(contents: str, config: Config = DEFAULT_CONFIG) -> ParsedConte
             else:
                 while line.strip().endswith("\\"):
                     line, new_comment = parse_comments(in_lines[index])
+                    line = line.lstrip()
                     index += 1
                     if new_comment:
                         comments.append(new_comment)


Test patch:
diff --git a/tests/unit/test_isort.py b/tests/unit/test_isort.py
index 7a02884b..8f0368d7 100644
--- a/tests/unit/test_isort.py
+++ b/tests/unit/test_isort.py
@@ -4095,6 +4095,14 @@ def test_isort_keeps_comments_issue_691() -> None:
     assert isort.code(test_input) == expected_output
 
 
+def test_isort_multiline_with_tab_issue_1714() -> None:
+    test_input = "from sys \\ \n" "\timport version\n" "print(version)\n"
+
+    expected_output = "from sys import version\n" "\n" "print(version)\n"
+
+    assert isort.code(test_input) == expected_output
+
+
 def test_isort_ensures_blank_line_between_import_and_comment() -> None:
     config = {
         "ensure_newline_before_comments": True,
Repository: PyCQA/pyflakes

Issue:
Class-level `TypeVar` resulting in "undefined name" error
Minimal sample:
```
from typing import TypeVar


class IdClass:
    Y = TypeVar('Y')

    def id(self, x: Y) -> Y:
        return x
```
Result:
```
# pyflakes t.py 
t.py:7: undefined name 'Y'
```

MyPy supports such typing annotations and does not complain about this file.
Probably this issue is related to similar ones #427 and #126 

Comments:

Patch:
diff --git a/pyflakes/checker.py b/pyflakes/checker.py
index 0e636c1..83f92aa 100644
--- a/pyflakes/checker.py
+++ b/pyflakes/checker.py
@@ -1480,7 +1480,7 @@ class Checker(object):
 
             self.pushScope()
 
-            self.handleChildren(node, omit='decorator_list')
+            self.handleChildren(node, omit=['decorator_list', 'returns'])
 
             def checkUnusedAssignments():
                 """


Test patch:
diff --git a/pyflakes/test/test_type_annotations.py b/pyflakes/test/test_type_annotations.py
index 03f70bb..9c34dcf 100644
--- a/pyflakes/test/test_type_annotations.py
+++ b/pyflakes/test/test_type_annotations.py
@@ -342,3 +342,23 @@ class TestTypeAnnotations(TestCase):
         x = 1
         # type: F
         """)
+
+    @skipIf(version_info < (3,), 'new in Python 3')
+    def test_return_annotation_is_class_scope_variable(self):
+        self.flakes("""
+        from typing import TypeVar
+        class Test:
+            Y = TypeVar('Y')
+
+            def t(self, x: Y) -> Y:
+                return x
+        """)
+
+    @skipIf(version_info < (3,), 'new in Python 3')
+    def test_return_annotation_is_function_body_variable(self):
+        self.flakes("""
+        class Test:
+            def t(self) -> Y:
+                Y = 2
+                return Y
+        """, m.UndefinedName)
Repository: PyCQA/pyflakes

Issue:
@overload of async functions
Since #435, pyflakes git tip copes with synchronous @overload'ed functions, but not with async ones:

```python
from typing import overload

@overload
def f(x: int) -> int:
    ...

@overload
def f(x: float) -> float:
    ...

def f(x):
    return x

@overload
async def g(x: int) -> int:
    ...

@overload
async def g(x: float) -> float:
    ...

async def g(x):
    return x
```
```bash
$ python -m pyflakes .

18:1 redefinition of unused 'g' from line 14
22:1 redefinition of unused 'g' from line 18
```

Comments:

Patch:
diff --git a/pyflakes/checker.py b/pyflakes/checker.py
index 44c6b25..eca2002 100644
--- a/pyflakes/checker.py
+++ b/pyflakes/checker.py
@@ -72,9 +72,11 @@ else:
 if PY35_PLUS:
     FOR_TYPES = (ast.For, ast.AsyncFor)
     LOOP_TYPES = (ast.While, ast.For, ast.AsyncFor)
+    FUNCTION_TYPES = (ast.FunctionDef, ast.AsyncFunctionDef)
 else:
     FOR_TYPES = (ast.For,)
     LOOP_TYPES = (ast.While, ast.For)
+    FUNCTION_TYPES = (ast.FunctionDef,)
 
 # https://github.com/python/typed_ast/blob/1.4.0/ast27/Parser/tokenizer.c#L102-L104
 TYPE_COMMENT_RE = re.compile(r'^#\s*type:\s*')
@@ -642,7 +644,7 @@ def is_typing_overload(value, scope_stack):
         )
 
     return (
-        isinstance(value.source, ast.FunctionDef) and
+        isinstance(value.source, FUNCTION_TYPES) and
         any(
             is_typing_overload_decorator(dec)
             for dec in value.source.decorator_list


Test patch:
diff --git a/pyflakes/test/test_type_annotations.py b/pyflakes/test/test_type_annotations.py
index 676a4a5..045c57a 100644
--- a/pyflakes/test/test_type_annotations.py
+++ b/pyflakes/test/test_type_annotations.py
@@ -56,6 +56,24 @@ class TestTypeAnnotations(TestCase):
             return s
         """)
 
+    @skipIf(version_info < (3, 5), 'new in Python 3.5')
+    def test_typingOverloadAsync(self):
+        """Allow intentional redefinitions via @typing.overload (async)"""
+        self.flakes("""
+        from typing import overload
+
+        @overload
+        async def f(s):  # type: (None) -> None
+            pass
+
+        @overload
+        async def f(s):  # type: (int) -> int
+            pass
+
+        async def f(s):
+            return s
+        """)
+
     def test_overload_with_multiple_decorators(self):
         self.flakes("""
             from typing import overload
Repository: PyCQA/pyflakes

Issue:
F401 (imported but unused) false positive on Foo when using def x(a: Foo, /, *, b: Bar)
```python
from datetime import datetime as Foo, time as Bar


def x(a: Foo, /, *, b: Bar):
    pass
```

Running this on the file results in:

```
› flake8 --version  
3.7.9 (mccabe: 0.6.1, pycodestyle: 2.5.0, pyflakes: 2.1.1) CPython 3.8.1 on Linux
› pyflakes --version
2.1.1 Python 3.8.1 on Linux
› flake8 example.py 
example.py:1:1: F401 'datetime.datetime as Foo' imported but unused
› pyflakes example.py
example.py:1: 'datetime.datetime as Foo' imported but unused
```

Comments:

Patch:
diff --git a/pyflakes/checker.py b/pyflakes/checker.py
index c8ccf56..d157008 100644
--- a/pyflakes/checker.py
+++ b/pyflakes/checker.py
@@ -1799,6 +1799,10 @@ class Checker(object):
             addArgs(node.args.args)
             defaults = node.args.defaults
         else:
+            if PY38_PLUS:
+                for arg in node.args.posonlyargs:
+                    args.append(arg.arg)
+                    annotations.append(arg.annotation)
             for arg in node.args.args + node.args.kwonlyargs:
                 args.append(arg.arg)
                 annotations.append(arg.annotation)


Test patch:
diff --git a/pyflakes/test/test_type_annotations.py b/pyflakes/test/test_type_annotations.py
index 289535d..1fa4f5e 100644
--- a/pyflakes/test/test_type_annotations.py
+++ b/pyflakes/test/test_type_annotations.py
@@ -418,3 +418,11 @@ class TestTypeAnnotations(TestCase):
                 Y = 2
                 return Y
         """, m.UndefinedName)
+
+    @skipIf(version_info < (3, 8), 'new in Python 3.8')
+    def test_positional_only_argument_annotations(self):
+        self.flakes("""
+        from x import C
+
+        def f(c: C, /): ...
+        """)