Skip to content

Commit

Permalink
Clean up common stubtest allowlist (#12770)
Browse files Browse the repository at this point in the history
* Move all platform and installation differences into a separate
  section.
* Split sections for missing items into "should be fixed" and "should
  not be fixed".
* Add "TODO" markers to appropriate sections.
  • Loading branch information
srittau authored Oct 10, 2024
1 parent 4f94a0e commit 17d2e5a
Showing 1 changed file with 45 additions and 34 deletions.
79 changes: 45 additions & 34 deletions stdlib/@tests/stubtest_allowlists/common.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# ==========
# Allowlist entries that should be fixed
# TODO: Allowlist entries that should be fixed
# ==========

# Please keep sorted alphabetically
Expand Down Expand Up @@ -133,11 +133,8 @@ xml.etree.ElementTree.XMLParser.__init__ # Defined in C so has general signatur
xml.etree.cElementTree.XMLParser.__init__ # Defined in C so has general signature
xml.parsers.expat.expat_CAPI

# Modules that exist at runtime, but shouldn't be added to typeshed
idlelib

# ==========
# Modules that exist at runtime, but are missing from stubs
# TODO: Modules that exist at runtime, but are missing from stubs
# ==========
ctypes.macholib
ctypes.macholib.dyld
Expand Down Expand Up @@ -192,7 +189,7 @@ turtledemo\..+
xml.sax.expatreader

# ==========
# Module members that exist at runtime, but are missing from stubs
# TODO: Module members that exist at runtime, but are missing from stubs
# ==========
_json.encode_basestring
_thread.RLock
Expand Down Expand Up @@ -244,6 +241,23 @@ tkinter.Misc.config
tkinter.font.Font.counter
turtle.TNavigator.speed

_ctypes.PyObj_FromPtr
_ctypes.Py_DECREF
_ctypes.Py_INCREF
_ctypes.buffer_info
_ctypes.call_cdeclfunction
_ctypes.call_function

# ==========
# Modules that exist at runtime, but are deliberately missing from stubs
# ==========

idlelib

# ==========
# Module members that exist at runtime, but are deliberately missing from stubs
# ==========

# Undocumented implementation details of a deprecated class
importlib.machinery.WindowsRegistryFinder.DEBUG_BUILD
importlib.machinery.WindowsRegistryFinder.REGISTRY_KEY
Expand Down Expand Up @@ -273,15 +287,33 @@ turtle.ScrolledCanvas.onResize
wave.Wave_read.initfp
wave.Wave_write.initfp

_ctypes.PyObj_FromPtr
_ctypes.Py_DECREF
_ctypes.Py_INCREF
_ctypes.buffer_info
_ctypes.call_cdeclfunction
_ctypes.call_function
# ==========
# Platform and installation differences
# ==========

# Platform differences that cannot be captured by the type system
os.O_[A-Z_]+
socket.AF_DECnet

# sys attributes that are not always defined
sys.gettotalrefcount # Available on python debug builds
sys.last_traceback
sys.last_type
sys.last_value
sys.ps1
sys.ps2
sys.tracebacklimit

# LC_MESSAGES is sometimes present in __all__, sometimes not,
# so stubtest will sometimes complain about exported names being different at runtime to the exported names in the stub
(locale.__all__)?

# Loadable SQLite extensions are disabled on GitHub runners
(sqlite3(.dbapi2)?.Connection.enable_load_extension)?
(sqlite3(.dbapi2)?.Connection.load_extension)?

# ==========
# Allowlist entries that cannot or should not be fixed
# Other allowlist entries that cannot or should not be fixed
# ==========

# Runtime AST node runtime constructor behaviour is too loose.
Expand Down Expand Up @@ -511,15 +543,6 @@ types.MethodType.__defaults__ # read-only but not actually a property; stubtest
types.ModuleType.__dict__ # read-only but not actually a property; stubtest thinks it's a mutable attribute.
types.ModuleType.__getattr__ # this doesn't exist at runtime

# sys attributes that are not always defined
sys.gettotalrefcount # Available on python debug builds
sys.last_traceback
sys.last_type
sys.last_value
sys.ps1
sys.ps2
sys.tracebacklimit

sys.implementation # Actually SimpleNamespace but then you wouldn't have convenient attributes

# A factory function that returns 'most efficient lock'.
Expand Down Expand Up @@ -580,14 +603,6 @@ xml.dom
xml.etree
xml.sax

# Platform differences that cannot be captured by the type system
os.O_[A-Z_]+
socket.AF_DECnet

# Loadable SQLite extensions are disabled on GitHub runners
(sqlite3(.dbapi2)?.Connection.enable_load_extension)?
(sqlite3(.dbapi2)?.Connection.load_extension)?

# Missing aliases to existing methods that not many people seem to use.
# Complicated multiple inheritance, confuses type checkers.
tkinter.Grid.bbox
Expand Down Expand Up @@ -656,10 +671,6 @@ xml.etree.ElementTree.Element.__iter__
xml.etree.cElementTree.Element.__iter__
typing(_extensions)?\.IO\.__iter__ # See https://github.com/python/typeshed/commit/97bc450acd60c1bcdafef3ce8fbe3b95a9c0cac3

# LC_MESSAGES is sometimes present in __all__, sometimes not,
# so stubtest will sometimes complain about exported names being different at runtime to the exported names in the stub
(locale.__all__)?

# Added or modified in a patch release, backported to all security branches,
# but have yet to find their way to all GitHub Actions images
(tarfile.tar_filter)?
Expand Down

0 comments on commit 17d2e5a

Please sign in to comment.