Skip to content

Commit fca017d

Browse files
committed
Update allowlists
1 parent 52d320f commit fca017d

4 files changed

Lines changed: 20 additions & 4 deletions

File tree

stdlib/@tests/stubtest_allowlists/common.txt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,8 @@ _?ast.stmt.__init__
210210

211211
_ast.ImportFrom.level # None on the class, but never None on instances
212212

213+
argparse.Namespace.__setattr__ # should allow setting any attribute
214+
213215
ast.ImportFrom.level # None on the class, but never None on instances
214216
ast.NodeVisitor.visit_\w+ # Methods are discovered dynamically, see #3796
215217
_?asyncio.Future.__init__ # Usually initialized from c object
@@ -272,7 +274,9 @@ _?ctypes.Array._length_ # _length_ is abstract, https://github.com/python/types
272274
_?ctypes.Array.raw # exists but stubtest can't see it; only available if _CT == c_char
273275
ctypes.CDLL._FuncPtr # None at class level but initialized in __init__ to this value
274276
_?ctypes.Structure.__getattr__ # doesn't exist, but makes things easy if we pretend it does
277+
_?ctypes.Structure.__setattr__ # doesn't exist, but makes things easy if we pretend it does
275278
_?ctypes.Union.__getattr__ # doesn't exist, but makes things easy if we pretend it does
279+
_?ctypes.Union.__setattr__ # doesn't exist, but makes things easy if we pretend it does
276280

277281
# Iterable classes that don't define __iter__ at runtime (usually iterable via __getitem__)
278282
# These would ideally be special-cased by type checkers; see https://github.com/python/mypy/issues/2220
@@ -323,6 +327,8 @@ inspect.Signature.__init__
323327
inspect.Parameter.empty # set as private marker _empty
324328
inspect.Signature.empty # set as private marker _empty
325329

330+
logging.LogRecord.__setattr__ # doesn't exist, but makes things easy if we pretend it does
331+
326332
# Iterable classes that don't define __iter__ at runtime (usually iterable via __getitem__)
327333
# These would ideally be special-cased by type checkers; see https://github.com/python/mypy/issues/2220
328334
mmap.mmap.__iter__
@@ -380,7 +386,9 @@ multiprocessing.synchronize.SemLock.acquire
380386
multiprocessing.synchronize.SemLock.release
381387

382388
numbers.Number.__hash__ # typeshed marks this as abstract but code just sets this as None
389+
383390
optparse.Values.__getattr__ # Some attributes are set in __init__ using setattr
391+
optparse.Values.__setattr__ # doesn't exist, but makes things easy if we pretend it does
384392

385393
os._wrap_close.read # Methods that come from __getattr__() at runtime
386394
os._wrap_close.readable # Methods that come from __getattr__() at runtime

stdlib/@tests/stubtest_allowlists/py312.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@ zoneinfo.ZoneInfo.from_file # Pos-only parameters had different "names" in diff
1313
typing_extensions.TypeAliasType.__parameters__
1414
typing_extensions.TypeAliasType.__value__
1515

16+
# Types that require `__setattr__` and `__delattr__` for typing purposes:
17+
argparse.Namespace.__setattr__
18+
argparse.Namespace.__delattr__
19+
1620

1721
# ====================================
1822
# Pre-existing errors from Python 3.11

stdlib/@tests/stubtest_allowlists/py313.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@ zoneinfo.ZoneInfo.from_file # Pos-only parameters had different "names" in diff
1818
typing_extensions.TypeAliasType.__parameters__
1919
typing_extensions.TypeAliasType.__value__
2020

21+
# Types that require `__setattr__` and `__delattr__` for typing purposes:
22+
argparse.Namespace.__setattr__
23+
argparse.Namespace.__delattr__
24+
2125

2226
# =======
2327
# >= 3.11

stdlib/@tests/stubtest_allowlists/py314.txt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,10 @@ functools.partialmethod.__new__
5555

5656
zoneinfo.ZoneInfo.from_file # Pos-only parameters had different "names" in different Python versions
5757

58+
# Types that require `__setattr__` and `__delattr__` for typing purposes:
59+
argparse.Namespace.__setattr__
60+
argparse.Namespace.__delattr__
61+
5862

5963
# =======
6064
# >= 3.11
@@ -101,10 +105,6 @@ typing(_extensions)?\.IO\.writelines
101105
# Allowlist entries that cannot or should not be fixed; >= 3.14
102106
# =============================================================
103107

104-
# Internal annotations machinery
105-
.*\.__annotate_func__
106-
.*\.__annotations_cache__
107-
108108
# Undocumented private attributes
109109
.*\.ForwardRef\.__arg__
110110
.*\.ForwardRef\.__ast_node__

0 commit comments

Comments
 (0)