Skip to content

Commit 364fd7d

Browse files
authored
a few more allowlist entries moved to don't fix (#13236)
1 parent 22e0699 commit 364fd7d

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

stdlib/@tests/stubtest_allowlists/common.txt

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,11 @@ ctypes.CDLL._FuncPtr # None at class level but initialized in __init__ to this
1717
ctypes.memmove # CFunctionType
1818
ctypes.memset # CFunctionType
1919
fractions.Fraction.__new__ # overload is too complicated for stubtest to resolve
20-
functools.cached_property.__set__ # Stub is a white lie; see comments in the stub
21-
hmac.new # Stub is a white lie; see comments in the stub
22-
http.HTTPStatus.description # set in __new__
23-
http.HTTPStatus.phrase # set in __new__
2420
http.client.HTTPConnection.response_class # the actual type at runtime is abc.ABCMeta
2521
importlib.abc.Loader.exec_module # See Lib/importlib/_abc.py. Might be defined for backwards compatibility
2622
importlib.abc.MetaPathFinder.find_spec # Not defined on the actual class, but expected to exist.
2723
importlib.abc.PathEntryFinder.find_spec # Not defined on the actual class, but expected to exist.
2824
numbers.Number.__hash__ # typeshed marks this as abstract but code just sets this as None
29-
optparse.Values.__getattr__ # Some attributes are set in __init__ using setattr
3025
select.poll # Depends on configuration
3126
selectors.DevpollSelector # Depends on configuration
3227
shutil.rmtree # stubtest doesn't like that we have this as an instance of a callback protocol instead of a function
@@ -38,7 +33,6 @@ tarfile.TarFile.errors # errors is initialized for some reason as None even tho
3833
tkinter.simpledialog.[A-Z_]+
3934
tkinter.simpledialog.TclVersion
4035
tkinter.simpledialog.TkVersion
41-
tkinter.Misc.after # we intentionally don't allow everything that "works" at runtime
4236
tkinter.Text.count # stubtest somehow thinks that index1 parameter has a default value, but it doesn't in any of the overloads
4337
unittest.mock.patch # It's a complicated overload and I haven't been able to figure out why stubtest doesn't like it
4438
weakref.WeakKeyDictionary.update
@@ -362,7 +356,11 @@ email.policy.EmailPolicy.message_factory # "type" at runtime, but protocol in s
362356
enum.auto.__or__ # enum.auto is magic, see comments
363357
enum.auto.__and__ # enum.auto is magic, see comments
364358
enum.auto.__xor__ # enum.auto is magic, see comments
359+
functools.cached_property.__set__ # doesn't exist, but cached_property is settable by another mechanism
365360
_?hashlib.scrypt # Raises TypeError if salt, n, r or p are None
361+
hmac.new # Raises TypeError if optional argument digestmod is not provided
362+
http.HTTPStatus.description # set in __new__; work-around for enum wierdness
363+
http.HTTPStatus.phrase # set in __new__; work-around for enum wierdness
366364
imaplib.IMAP4_SSL.ssl # Depends on the existence and flags of SSL
367365

368366
# runtime is *args, **kwargs due to a wrapper; we have more accurate signatures in the stubs
@@ -438,6 +436,7 @@ multiprocessing.synchronize.Condition.release
438436
multiprocessing.synchronize.SemLock.acquire
439437
multiprocessing.synchronize.SemLock.release
440438

439+
optparse.Values.__getattr__ # Some attributes are set in __init__ using setattr
441440
os._wrap_close.read # Methods that come from __getattr__() at runtime
442441
os._wrap_close.readable # Methods that come from __getattr__() at runtime
443442
os._wrap_close.readline # Methods that come from __getattr__() at runtime
@@ -459,6 +458,8 @@ threading.Condition.release # Condition functions are exported in __init__
459458
# Marking it as a function will make it impossible for users to use the Lock type as an annotation.
460459
threading.RLock
461460

461+
tkinter.Misc.after # we intentionally don't allow everything that "works" at runtime
462+
462463
# Methods that come from __getattr__() at runtime
463464
tkinter.Tk.adderrorinfo
464465
tkinter.Tk.call

stdlib/optparse.pyi

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,8 @@ class Values:
182182
def ensure_value(self, attr: str, value): ...
183183
def read_file(self, filename: str, mode: str = "careful") -> None: ...
184184
def read_module(self, modname: str, mode: str = "careful") -> None: ...
185+
# __getattr__ doesn't exist, but anything passed as a default to __init__
186+
# is set on the instance.
185187
def __getattr__(self, name: str): ...
186188
def __setattr__(self, name: str, value, /) -> None: ...
187189
def __eq__(self, other: object) -> bool: ...

0 commit comments

Comments
 (0)