pytorch
4c9eae33 - Use standard mechanism for stdlib names (#81520)

Comment changes are shownComment changes are hidden
Commit
2 years ago
Use standard mechanism for stdlib names (#81520) I noticed that in #81261 all of the stdlib module names were explicitly listed, however as of Python 3.10 the stdlib now has a mechanism for this. https://github.com/python/cpython/issues/87121 I figured it was better to use `sys.stdlib_module_names` going forward for 3.10+ instead of having to maintain this file for every new Python release. For docs see: https://docs.python.org/3/library/sys.html#sys.stdlib_module_names I did a symmetric difference to determine what the effective change would be. I verified that everything listed in this file ins included in sys.stdlib_module_names. However, there are files in sys.stdlib_module_names that are not included in the previous hard coded definition. Namely these are: ``` frozenset({'__future__', '_abc', '_aix_support', '_asyncio', '_bisect', '_blake2', '_bootsubprocess', '_bz2', '_codecs', '_codecs_cn', '_codecs_hk', '_codecs_iso2022', '_codecs_jp', '_codecs_kr', '_codecs_tw', '_collections', '_collections_abc', '_compat_pickle', '_compression', '_contextvars', '_crypt', '_csv', '_ctypes', '_curses', '_curses_panel', '_datetime', '_dbm', '_decimal', '_elementtree', '_frozen_importlib', '_frozen_importlib_external', '_functools', '_gdbm', '_hashlib', '_heapq', '_imp', '_io', '_json', '_locale', '_lsprof', '_lzma', '_markupbase', '_md5', '_msi', '_multibytecodec', '_multiprocessing', '_opcode', '_operator', '_osx_support', '_overlapped', '_pickle', '_posixshmem', '_posixsubprocess', '_py_abc', '_pydecimal', '_pyio', '_queue', '_random', '_scproxy', '_sha1', '_sha256', '_sha3', '_sha512', '_signal', '_sitebuiltins', '_socket', '_sqlite3', '_sre', '_ssl', '_stat', '_statistics', '_string', '_strptime', '_struct', '_symtable', '_threading_local', '_tkinter', '_tracemalloc', '_uuid', '_warnings', '_weakref', '_weakrefset', '_winapi', '_zoneinfo', 'antigravity', 'genericpath', 'idlelib', 'nt', 'nturl2path', 'opcode', 'pydoc_data', 'pyexpat', 'this'}) ``` I'm not sure if excluding these matters. I wouldn't think it would, but if it does and it is better to explicitly update this file each time, then feel free to close this. Pull Request resolved: https://github.com/pytorch/pytorch/pull/81520 Approved by: https://github.com/malfet
Author
Committer
Parents
  • torch/package
    • File
      _stdlib.py
Loading