Update pydoc.py from 3.14.3 (#7104)

This commit is contained in:
Shahar Naveh authored and GitHub committed 2026-02-13 18:07:25 +09:00
1 parent 6d516fe7e4
commit 3e64c42b23
10 files changed
+3925 -517

No files matched your search

+699 -485
View File
File diff suppressed because it is too large. Load diff
+320
View File
@@ -0,0 +1,320 @@
# Autogenerated by Sphinx on Tue Feb 3 17:32:13 2026
# as part of the release process.
module_docs = {
'__future__': '__future__#module-__future__',
'__main__': '__main__#module-__main__',
'_thread': '_thread#module-_thread',
'_tkinter': 'tkinter#module-_tkinter',
'abc': 'abc#module-abc',
'aifc': 'aifc#module-aifc',
'annotationlib': 'annotationlib#module-annotationlib',
'argparse': 'argparse#module-argparse',
'array': 'array#module-array',
'ast': 'ast#module-ast',
'asynchat': 'asynchat#module-asynchat',
'asyncio': 'asyncio#module-asyncio',
'asyncore': 'asyncore#module-asyncore',
'atexit': 'atexit#module-atexit',
'audioop': 'audioop#module-audioop',
'base64': 'base64#module-base64',
'bdb': 'bdb#module-bdb',
'binascii': 'binascii#module-binascii',
'bisect': 'bisect#module-bisect',
'builtins': 'builtins#module-builtins',
'bz2': 'bz2#module-bz2',
'cProfile': 'profile#module-cProfile',
'calendar': 'calendar#module-calendar',
'cgi': 'cgi#module-cgi',
'cgitb': 'cgitb#module-cgitb',
'chunk': 'chunk#module-chunk',
'cmath': 'cmath#module-cmath',
'cmd': 'cmd#module-cmd',
'code': 'code#module-code',
'codecs': 'codecs#module-codecs',
'codeop': 'codeop#module-codeop',
'collections': 'collections#module-collections',
'collections.abc': 'collections.abc#module-collections.abc',
'colorsys': 'colorsys#module-colorsys',
'compileall': 'compileall#module-compileall',
'compression': 'compression#module-compression',
'compression.zstd': 'compression.zstd#module-compression.zstd',
'concurrent.futures': 'concurrent.futures#module-concurrent.futures',
'concurrent.interpreters': 'concurrent.interpreters#module-concurrent.interpreters',
'configparser': 'configparser#module-configparser',
'contextlib': 'contextlib#module-contextlib',
'contextvars': 'contextvars#module-contextvars',
'copy': 'copy#module-copy',
'copyreg': 'copyreg#module-copyreg',
'crypt': 'crypt#module-crypt',
'csv': 'csv#module-csv',
'ctypes': 'ctypes#module-ctypes',
'curses': 'curses#module-curses',
'curses.ascii': 'curses.ascii#module-curses.ascii',
'curses.panel': 'curses.panel#module-curses.panel',
'curses.textpad': 'curses#module-curses.textpad',
'dataclasses': 'dataclasses#module-dataclasses',
'datetime': 'datetime#module-datetime',
'dbm': 'dbm#module-dbm',
'dbm.dumb': 'dbm#module-dbm.dumb',
'dbm.gnu': 'dbm#module-dbm.gnu',
'dbm.ndbm': 'dbm#module-dbm.ndbm',
'dbm.sqlite3': 'dbm#module-dbm.sqlite3',
'decimal': 'decimal#module-decimal',
'difflib': 'difflib#module-difflib',
'dis': 'dis#module-dis',
'distutils': 'distutils#module-distutils',
'doctest': 'doctest#module-doctest',
'email': 'email#module-email',
'email.charset': 'email.charset#module-email.charset',
'email.contentmanager': 'email.contentmanager#module-email.contentmanager',
'email.encoders': 'email.encoders#module-email.encoders',
'email.errors': 'email.errors#module-email.errors',
'email.generator': 'email.generator#module-email.generator',
'email.header': 'email.header#module-email.header',
'email.headerregistry': 'email.headerregistry#module-email.headerregistry',
'email.iterators': 'email.iterators#module-email.iterators',
'email.message': 'email.message#module-email.message',
'email.mime': 'email.mime#module-email.mime',
'email.mime.application': 'email.mime#module-email.mime.application',
'email.mime.audio': 'email.mime#module-email.mime.audio',
'email.mime.base': 'email.mime#module-email.mime.base',
'email.mime.image': 'email.mime#module-email.mime.image',
'email.mime.message': 'email.mime#module-email.mime.message',
'email.mime.multipart': 'email.mime#module-email.mime.multipart',
'email.mime.nonmultipart': 'email.mime#module-email.mime.nonmultipart',
'email.mime.text': 'email.mime#module-email.mime.text',
'email.parser': 'email.parser#module-email.parser',
'email.policy': 'email.policy#module-email.policy',
'email.utils': 'email.utils#module-email.utils',
'encodings': 'codecs#module-encodings',
'encodings.idna': 'codecs#module-encodings.idna',
'encodings.mbcs': 'codecs#module-encodings.mbcs',
'encodings.utf_8_sig': 'codecs#module-encodings.utf_8_sig',
'ensurepip': 'ensurepip#module-ensurepip',
'enum': 'enum#module-enum',
'errno': 'errno#module-errno',
'faulthandler': 'faulthandler#module-faulthandler',
'fcntl': 'fcntl#module-fcntl',
'filecmp': 'filecmp#module-filecmp',
'fileinput': 'fileinput#module-fileinput',
'fnmatch': 'fnmatch#module-fnmatch',
'fractions': 'fractions#module-fractions',
'ftplib': 'ftplib#module-ftplib',
'functools': 'functools#module-functools',
'gc': 'gc#module-gc',
'getopt': 'getopt#module-getopt',
'getpass': 'getpass#module-getpass',
'gettext': 'gettext#module-gettext',
'glob': 'glob#module-glob',
'graphlib': 'graphlib#module-graphlib',
'grp': 'grp#module-grp',
'gzip': 'gzip#module-gzip',
'hashlib': 'hashlib#module-hashlib',
'heapq': 'heapq#module-heapq',
'hmac': 'hmac#module-hmac',
'html': 'html#module-html',
'html.entities': 'html.entities#module-html.entities',
'html.parser': 'html.parser#module-html.parser',
'http': 'http#module-http',
'http.client': 'http.client#module-http.client',
'http.cookiejar': 'http.cookiejar#module-http.cookiejar',
'http.cookies': 'http.cookies#module-http.cookies',
'http.server': 'http.server#module-http.server',
'idlelib': 'idle#module-idlelib',
'imaplib': 'imaplib#module-imaplib',
'imghdr': 'imghdr#module-imghdr',
'imp': 'imp#module-imp',
'importlib': 'importlib#module-importlib',
'importlib.abc': 'importlib#module-importlib.abc',
'importlib.machinery': 'importlib#module-importlib.machinery',
'importlib.metadata': 'importlib.metadata#module-importlib.metadata',
'importlib.resources': 'importlib.resources#module-importlib.resources',
'importlib.resources.abc': 'importlib.resources.abc#module-importlib.resources.abc',
'importlib.util': 'importlib#module-importlib.util',
'inspect': 'inspect#module-inspect',
'io': 'io#module-io',
'ipaddress': 'ipaddress#module-ipaddress',
'itertools': 'itertools#module-itertools',
'json': 'json#module-json',
'json.tool': 'json#module-json.tool',
'keyword': 'keyword#module-keyword',
'linecache': 'linecache#module-linecache',
'locale': 'locale#module-locale',
'logging': 'logging#module-logging',
'logging.config': 'logging.config#module-logging.config',
'logging.handlers': 'logging.handlers#module-logging.handlers',
'lzma': 'lzma#module-lzma',
'mailbox': 'mailbox#module-mailbox',
'mailcap': 'mailcap#module-mailcap',
'marshal': 'marshal#module-marshal',
'math': 'math#module-math',
'mimetypes': 'mimetypes#module-mimetypes',
'mmap': 'mmap#module-mmap',
'modulefinder': 'modulefinder#module-modulefinder',
'msilib': 'msilib#module-msilib',
'msvcrt': 'msvcrt#module-msvcrt',
'multiprocessing': 'multiprocessing#module-multiprocessing',
'multiprocessing.connection': 'multiprocessing#module-multiprocessing.connection',
'multiprocessing.dummy': 'multiprocessing#module-multiprocessing.dummy',
'multiprocessing.managers': 'multiprocessing#module-multiprocessing.managers',
'multiprocessing.pool': 'multiprocessing#module-multiprocessing.pool',
'multiprocessing.shared_memory': 'multiprocessing.shared_memory#module-multiprocessing.shared_memory',
'multiprocessing.sharedctypes': 'multiprocessing#module-multiprocessing.sharedctypes',
'netrc': 'netrc#module-netrc',
'nis': 'nis#module-nis',
'nntplib': 'nntplib#module-nntplib',
'numbers': 'numbers#module-numbers',
'operator': 'operator#module-operator',
'optparse': 'optparse#module-optparse',
'os': 'os#module-os',
'os.path': 'os.path#module-os.path',
'ossaudiodev': 'ossaudiodev#module-ossaudiodev',
'pathlib': 'pathlib#module-pathlib',
'pathlib.types': 'pathlib#module-pathlib.types',
'pdb': 'pdb#module-pdb',
'pickle': 'pickle#module-pickle',
'pickletools': 'pickletools#module-pickletools',
'pipes': 'pipes#module-pipes',
'pkgutil': 'pkgutil#module-pkgutil',
'platform': 'platform#module-platform',
'plistlib': 'plistlib#module-plistlib',
'poplib': 'poplib#module-poplib',
'posix': 'posix#module-posix',
'pprint': 'pprint#module-pprint',
'profile': 'profile#module-profile',
'pstats': 'profile#module-pstats',
'pty': 'pty#module-pty',
'pwd': 'pwd#module-pwd',
'py_compile': 'py_compile#module-py_compile',
'pyclbr': 'pyclbr#module-pyclbr',
'pydoc': 'pydoc#module-pydoc',
'queue': 'queue#module-queue',
'quopri': 'quopri#module-quopri',
'random': 'random#module-random',
're': 're#module-re',
'readline': 'readline#module-readline',
'reprlib': 'reprlib#module-reprlib',
'resource': 'resource#module-resource',
'rlcompleter': 'rlcompleter#module-rlcompleter',
'runpy': 'runpy#module-runpy',
'sched': 'sched#module-sched',
'secrets': 'secrets#module-secrets',
'select': 'select#module-select',
'selectors': 'selectors#module-selectors',
'shelve': 'shelve#module-shelve',
'shlex': 'shlex#module-shlex',
'shutil': 'shutil#module-shutil',
'signal': 'signal#module-signal',
'site': 'site#module-site',
'sitecustomize': 'site#module-sitecustomize',
'smtpd': 'smtpd#module-smtpd',
'smtplib': 'smtplib#module-smtplib',
'sndhdr': 'sndhdr#module-sndhdr',
'socket': 'socket#module-socket',
'socketserver': 'socketserver#module-socketserver',
'spwd': 'spwd#module-spwd',
'sqlite3': 'sqlite3#module-sqlite3',
'ssl': 'ssl#module-ssl',
'stat': 'stat#module-stat',
'statistics': 'statistics#module-statistics',
'string': 'string#module-string',
'string.templatelib': 'string.templatelib#module-string.templatelib',
'stringprep': 'stringprep#module-stringprep',
'struct': 'struct#module-struct',
'subprocess': 'subprocess#module-subprocess',
'sunau': 'sunau#module-sunau',
'symtable': 'symtable#module-symtable',
'sys': 'sys#module-sys',
'sys.monitoring': 'sys.monitoring#module-sys.monitoring',
'sysconfig': 'sysconfig#module-sysconfig',
'syslog': 'syslog#module-syslog',
'tabnanny': 'tabnanny#module-tabnanny',
'tarfile': 'tarfile#module-tarfile',
'telnetlib': 'telnetlib#module-telnetlib',
'tempfile': 'tempfile#module-tempfile',
'termios': 'termios#module-termios',
'test': 'test#module-test',
'test.regrtest': 'test#module-test.regrtest',
'test.support': 'test#module-test.support',
'test.support.bytecode_helper': 'test#module-test.support.bytecode_helper',
'test.support.import_helper': 'test#module-test.support.import_helper',
'test.support.os_helper': 'test#module-test.support.os_helper',
'test.support.script_helper': 'test#module-test.support.script_helper',
'test.support.socket_helper': 'test#module-test.support.socket_helper',
'test.support.threading_helper': 'test#module-test.support.threading_helper',
'test.support.warnings_helper': 'test#module-test.support.warnings_helper',
'textwrap': 'textwrap#module-textwrap',
'threading': 'threading#module-threading',
'time': 'time#module-time',
'timeit': 'timeit#module-timeit',
'tkinter': 'tkinter#module-tkinter',
'tkinter.colorchooser': 'tkinter.colorchooser#module-tkinter.colorchooser',
'tkinter.commondialog': 'dialog#module-tkinter.commondialog',
'tkinter.dnd': 'tkinter.dnd#module-tkinter.dnd',
'tkinter.filedialog': 'dialog#module-tkinter.filedialog',
'tkinter.font': 'tkinter.font#module-tkinter.font',
'tkinter.messagebox': 'tkinter.messagebox#module-tkinter.messagebox',
'tkinter.scrolledtext': 'tkinter.scrolledtext#module-tkinter.scrolledtext',
'tkinter.simpledialog': 'dialog#module-tkinter.simpledialog',
'tkinter.ttk': 'tkinter.ttk#module-tkinter.ttk',
'token': 'token#module-token',
'tokenize': 'tokenize#module-tokenize',
'tomllib': 'tomllib#module-tomllib',
'trace': 'trace#module-trace',
'traceback': 'traceback#module-traceback',
'tracemalloc': 'tracemalloc#module-tracemalloc',
'tty': 'tty#module-tty',
'turtle': 'turtle#module-turtle',
'turtledemo': 'turtle#module-turtledemo',
'types': 'types#module-types',
'typing': 'typing#module-typing',
'unicodedata': 'unicodedata#module-unicodedata',
'unittest': 'unittest#module-unittest',
'unittest.mock': 'unittest.mock#module-unittest.mock',
'urllib': 'urllib#module-urllib',
'urllib.error': 'urllib.error#module-urllib.error',
'urllib.parse': 'urllib.parse#module-urllib.parse',
'urllib.request': 'urllib.request#module-urllib.request',
'urllib.response': 'urllib.request#module-urllib.response',
'urllib.robotparser': 'urllib.robotparser#module-urllib.robotparser',
'usercustomize': 'site#module-usercustomize',
'uu': 'uu#module-uu',
'uuid': 'uuid#module-uuid',
'venv': 'venv#module-venv',
'warnings': 'warnings#module-warnings',
'wave': 'wave#module-wave',
'weakref': 'weakref#module-weakref',
'webbrowser': 'webbrowser#module-webbrowser',
'winreg': 'winreg#module-winreg',
'winsound': 'winsound#module-winsound',
'wsgiref': 'wsgiref#module-wsgiref',
'wsgiref.handlers': 'wsgiref#module-wsgiref.handlers',
'wsgiref.headers': 'wsgiref#module-wsgiref.headers',
'wsgiref.simple_server': 'wsgiref#module-wsgiref.simple_server',
'wsgiref.types': 'wsgiref#module-wsgiref.types',
'wsgiref.util': 'wsgiref#module-wsgiref.util',
'wsgiref.validate': 'wsgiref#module-wsgiref.validate',
'xdrlib': 'xdrlib#module-xdrlib',
'xml': 'xml#module-xml',
'xml.dom': 'xml.dom#module-xml.dom',
'xml.dom.minidom': 'xml.dom.minidom#module-xml.dom.minidom',
'xml.dom.pulldom': 'xml.dom.pulldom#module-xml.dom.pulldom',
'xml.etree.ElementInclude': 'xml.etree.elementtree#module-xml.etree.ElementInclude',
'xml.etree.ElementTree': 'xml.etree.elementtree#module-xml.etree.ElementTree',
'xml.parsers.expat': 'pyexpat#module-xml.parsers.expat',
'xml.parsers.expat.errors': 'pyexpat#module-xml.parsers.expat.errors',
'xml.parsers.expat.model': 'pyexpat#module-xml.parsers.expat.model',
'xml.sax': 'xml.sax#module-xml.sax',
'xml.sax.handler': 'xml.sax.handler#module-xml.sax.handler',
'xml.sax.saxutils': 'xml.sax.utils#module-xml.sax.saxutils',
'xml.sax.xmlreader': 'xml.sax.reader#module-xml.sax.xmlreader',
'xmlrpc': 'xmlrpc#module-xmlrpc',
'xmlrpc.client': 'xmlrpc.client#module-xmlrpc.client',
'xmlrpc.server': 'xmlrpc.server#module-xmlrpc.server',
'zipapp': 'zipapp#module-zipapp',
'zipfile': 'zipfile#module-zipfile',
'zipimport': 'zipimport#module-zipimport',
'zlib': 'zlib#module-zlib',
'zoneinfo': 'zoneinfo#module-zoneinfo',
}
+191 -22
View File
@@ -1,4 +1,4 @@
# Autogenerated by Sphinx on Fri Dec 5 18:49:09 2025
# Autogenerated by Sphinx on Tue Feb 3 17:32:13 2026
# as part of the release process.
topics = {
@@ -2000,7 +2000,7 @@ ensures that the type of the target "e" is consistently
... except* BlockingIOError as e:
... print(repr(e))
...
ExceptionGroup('', (BlockingIOError()))
ExceptionGroup('', (BlockingIOError(),))
"break", "continue" and "return" cannot appear in an "except*" clause.
@@ -5796,7 +5796,9 @@ The available presentation types for "float" and "Decimal" values are:
| | With no precision given, uses a precision of "6" digits |
| | after the decimal point for "float", and shows all |
| | coefficient digits for "Decimal". If "p=0", the decimal |
| | point is omitted unless the "#" option is used. |
| | point is omitted unless the "#" option is used. For |
| | "float", the exponent always contains at least two digits, |
| | and is zero if the value is zero. |
+-----------+------------------------------------------------------------+
| "'E'" | Scientific notation. Same as "'e'" except it uses an upper |
| | case ‘E’ as the separator character. |
@@ -9830,7 +9832,12 @@ str.casefold()
it is intended to remove all case distinctions in a string. For
example, the German lowercase letter "'ß'" is equivalent to ""ss"".
Since it is already lowercase, "lower()" would do nothing to "'ß'";
"casefold()" converts it to ""ss"".
"casefold()" converts it to ""ss"". For example:
>>> 'straße'.lower()
'straße'
>>> 'straße'.casefold()
'strasse'
The casefolding algorithm is described in section 3.13 ‘Default
Case Folding’ of the Unicode Standard.
@@ -10019,7 +10026,18 @@ str.format_map(mapping, /)
str.index(sub[, start[, end]])
Like "find()", but raise "ValueError" when the substring is not
found.
found. For example:
>>> 'spam, spam, spam'.index('spam')
0
>>> 'spam, spam, spam'.index('eggs')
Traceback (most recent call last):
File "<python-input-0>", line 1, in <module>
'spam, spam, spam'.index('eggs')
~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^
ValueError: substring not found
See also "rindex()".
str.isalnum()
@@ -10118,7 +10136,19 @@ str.isnumeric()
that have the Unicode numeric value property, e.g. U+2155, VULGAR
FRACTION ONE FIFTH. Formally, numeric characters are those with
the property value Numeric_Type=Digit, Numeric_Type=Decimal or
Numeric_Type=Numeric.
Numeric_Type=Numeric. For example:
>>> '0123456789'.isnumeric()
True
>>> '٠١٢٣٤٥٦٧٨٩'.isnumeric() # Arabic-indic digit zero to nine
True
>>> '⅕'.isnumeric() # Vulgar fraction one fifth
True
>>> '²'.isdecimal(), '²'.isdigit(), '²'.isnumeric()
(False, True, True)
See also "isdecimal()" and "isdigit()". Numeric characters are a
superset of decimal numbers.
str.isprintable()
@@ -10136,6 +10166,13 @@ str.isprintable()
plus the ASCII space 0x20. Nonprintable characters are those in
group Separator or Other (Z or C), except the ASCII space.
For example:
>>> ''.isprintable(), ' '.isprintable()
(True, True)
>>> '\t'.isprintable(), '\n'.isprintable()
(False, False)
str.isspace()
Return "True" if there are only whitespace characters in the string
@@ -10201,10 +10238,24 @@ str.ljust(width, fillchar=' ', /)
space). The original string is returned if *width* is less than or
equal to "len(s)".
For example:
>>> 'Python'.ljust(10)
'Python '
>>> 'Python'.ljust(10, '.')
'Python....'
>>> 'Monty Python'.ljust(10, '.')
'Monty Python'
See also "rjust()".
str.lower()
Return a copy of the string with all the cased characters [4]
converted to lowercase.
converted to lowercase. For example:
>>> 'Lower Method Example'.lower()
'lower method example'
The lowercasing algorithm used is described in section 3.13
‘Default Case Folding’ of the Unicode Standard.
@@ -10268,6 +10319,8 @@ str.removeprefix(prefix, /)
Added in version 3.9.
See also "removesuffix()" and "startswith()".
str.removesuffix(suffix, /)
If the string ends with the *suffix* string and that *suffix* is
@@ -10281,12 +10334,19 @@ str.removesuffix(suffix, /)
Added in version 3.9.
See also "removeprefix()" and "endswith()".
str.replace(old, new, /, count=-1)
Return a copy of the string with all occurrences of substring *old*
replaced by *new*. If *count* is given, only the first *count*
occurrences are replaced. If *count* is not specified or "-1", then
all occurrences are replaced.
all occurrences are replaced. For example:
>>> 'spam, spam, spam'.replace('spam', 'eggs')
'eggs, eggs, eggs'
>>> 'spam, spam, spam'.replace('spam', 'eggs', 1)
'eggs, spam, spam'
Changed in version 3.13: *count* is now supported as a keyword
argument.
@@ -10296,12 +10356,30 @@ str.rfind(sub[, start[, end]])
Return the highest index in the string where substring *sub* is
found, such that *sub* is contained within "s[start:end]".
Optional arguments *start* and *end* are interpreted as in slice
notation. Return "-1" on failure.
notation. Return "-1" on failure. For example:
>>> 'spam, spam, spam'.rfind('sp')
12
>>> 'spam, spam, spam'.rfind('sp', 0, 10)
6
See also "find()" and "rindex()".
str.rindex(sub[, start[, end]])
Like "rfind()" but raises "ValueError" when the substring *sub* is
not found.
not found. For example:
>>> 'spam, spam, spam'.rindex('spam')
12
>>> 'spam, spam, spam'.rindex('eggs')
Traceback (most recent call last):
File "<stdin-0>", line 1, in <module>
'spam, spam, spam'.rindex('eggs')
~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^
ValueError: substring not found
See also "index()" and "find()".
str.rjust(width, fillchar=' ', /)
@@ -10318,6 +10396,17 @@ str.rpartition(sep, /)
found, return a 3-tuple containing two empty strings, followed by
the string itself.
For example:
>>> 'Monty Python'.rpartition(' ')
('Monty', ' ', 'Python')
>>> "Monty Python's Flying Circus".rpartition(' ')
("Monty Python's Flying", ' ', 'Circus')
>>> 'Monty Python'.rpartition('-')
('', '', 'Monty Python')
See also "partition()".
str.rsplit(sep=None, maxsplit=-1)
Return a list of the words in the string, using *sep* as the
@@ -11088,7 +11177,7 @@ Whitespace is significant in these situations:
* In "fstring_replacement_field", if "f_debug_specifier" is present,
all whitespace after the opening brace until the
"f_debug_specifier", as well as whitespace immediatelly following
"f_debug_specifier", as well as whitespace immediately following
"f_debug_specifier", is retained as part of the expression.
**CPython implementation detail:** The expression is not handled in
@@ -11211,8 +11300,11 @@ Any object can be tested for truth value, for use in an "if" or
By default, an object is considered true unless its class defines
either a "__bool__()" method that returns "False" or a "__len__()"
method that returns zero, when called with the object. [1] Here are
most of the built-in objects considered false:
method that returns zero, when called with the object. [1] If one of
the methods raises an exception when called, the exception is
propagated and the object does not have a truth value (for example,
"NotImplemented"). Here are most of the built-in objects considered
false:
* constants defined to be false: "None" and "False"
@@ -11393,7 +11485,7 @@ ensures that the type of the target "e" is consistently
... except* BlockingIOError as e:
... print(repr(e))
...
ExceptionGroup('', (BlockingIOError()))
ExceptionGroup('', (BlockingIOError(),))
"break", "continue" and "return" cannot appear in an "except*" clause.
@@ -11777,6 +11869,10 @@ Special read-only attributes
+----------------------------------------------------+----------------------------------------------------+
| Attribute | Meaning |
|====================================================|====================================================|
| function.__builtins__ | A reference to the "dictionary" that holds the |
| | function’s builtins namespace. Added in version |
| | 3.10. |
+----------------------------------------------------+----------------------------------------------------+
| function.__globals__ | A reference to the "dictionary" that holds the |
| | function’s global variables – the global namespace |
| | of the module in which the function was defined. |
@@ -12871,10 +12967,6 @@ class dict(iterable, /, **kwargs)
the keyword argument replaces the value from the positional
argument.
Providing keyword arguments as in the first example only works for
keys that are valid Python identifiers. Otherwise, any valid keys
can be used.
Dictionaries compare equal if and only if they have the same "(key,
value)" pairs (regardless of ordering). Order comparisons (‘<’,
‘<=’, ‘>=’, ‘>’) raise "TypeError". To illustrate dictionary
@@ -13387,10 +13479,17 @@ Notes:
note that "-0" is still "0".
4. The slice of *s* from *i* to *j* is defined as the sequence of
items with index *k* such that "i <= k < j". If *i* or *j* is
greater than "len(s)", use "len(s)". If *i* is omitted or "None",
use "0". If *j* is omitted or "None", use "len(s)". If *i* is
greater than or equal to *j*, the slice is empty.
items with index *k* such that "i <= k < j".
* If *i* is omitted or "None", use "0".
* If *j* is omitted or "None", use "len(s)".
* If *i* or *j* is less than "-len(s)", use "0".
* If *i* or *j* is greater than "len(s)", use "len(s)".
* If *i* is greater than or equal to *j*, the slice is empty.
5. The slice of *s* from *i* to *j* with step *k* is defined as the
sequence of items with index "x = i + n*k" such that "0 <= n <
@@ -13655,6 +13754,76 @@ class list(iterable=(), /)
empty for the duration, and raises "ValueError" if it can detect
that the list has been mutated during a sort.
Thread safety: Reading a single element from a "list" is *atomic*:
lst[i] # list.__getitem__
The following methods traverse the list and use *atomic* reads of each
item to perform their function. That means that they may return
results affected by concurrent modifications:
item in lst
lst.index(item)
lst.count(item)
All of the above methods/operations are also lock-free. They do not
block concurrent modifications. Other operations that hold a lock will
not block these from observing intermediate states.All other
operations from here on block using the per-object lock.Writing a
single item via "lst[i] = x" is safe to call from multiple threads and
will not corrupt the list.The following operations return new objects
and appear *atomic* to other threads:
lst1 + lst2 # concatenates two lists into a new list
x * lst # repeats lst x times into a new list
lst.copy() # returns a shallow copy of the list
Methods that only operate on a single elements with no shifting
required are *atomic*:
lst.append(x) # append to the end of the list, no shifting required
lst.pop() # pop element from the end of the list, no shifting required
The "clear()" method is also *atomic*. Other threads cannot observe
elements being removed.The "sort()" method is not *atomic*. Other
threads cannot observe intermediate states during sorting, but the
list appears empty for the duration of the sort.The following
operations may allow lock-free operations to observe intermediate
states since they modify multiple elements in place:
lst.insert(idx, item) # shifts elements
lst.pop(idx) # idx not at the end of the list, shifts elements
lst *= x # copies elements in place
The "remove()" method may allow concurrent modifications since element
comparison may execute arbitrary Python code (via
"__eq__()")."extend()" is safe to call from multiple threads.
However, its guarantees depend on the iterable passed to it. If it is
a "list", a "tuple", a "set", a "frozenset", a "dict" or a dictionary
view object (but not their subclasses), the "extend" operation is safe
from concurrent modifications to the iterable. Otherwise, an iterator
is created which can be concurrently modified by another thread. The
same applies to inplace concatenation of a list with other iterables
when using "lst += iterable".Similarly, assigning to a list slice with
"lst[i:j] = iterable" is safe to call from multiple threads, but
"iterable" is only locked when it is also a "list" (but not its
subclasses).Operations that involve multiple accesses, as well as
iteration, are never atomic. For example:
# NOT atomic: read-modify-write
lst[i] = lst[i] + 1
# NOT atomic: check-then-act
if lst:
item = lst.pop()
# NOT thread-safe: iteration while modifying
for item in lst:
process(item) # another thread may modify lst
Consider external synchronization when sharing "list" instances across
threads. See Python support for free threading for more information.
Tuples
======
-9
View File
@@ -88,8 +88,6 @@ class DocXMLRPCHTTPGETServer(unittest.TestCase):
self.thread.join()
self.serv.server_close()
# TODO: RUSTPYTHON
@unittest.expectedFailure
def test_valid_get_response(self):
self.client.request("GET", "/")
response = self.client.getresponse()
@@ -119,7 +117,6 @@ class DocXMLRPCHTTPGETServer(unittest.TestCase):
response.read()
@unittest.expectedFailure # TODO: RUSTPYTHON; http.client.RemoteDisconnected: Remote end closed connection without response
def test_lambda(self):
"""Test that lambda functionality stays the same. The output produced
currently is, I suspect invalid because of the unencoded brackets in the
@@ -134,8 +131,6 @@ class DocXMLRPCHTTPGETServer(unittest.TestCase):
b'&lt;lambda&gt;</strong></a>(x, y)</dt></dl>'),
response.read())
# TODO: RUSTPYTHON
@unittest.expectedFailure
@make_request_and_skipIf(sys.flags.optimize >= 2,
"Docstrings are omitted with -O2 and above")
def test_autolinking(self):
@@ -160,7 +155,6 @@ class DocXMLRPCHTTPGETServer(unittest.TestCase):
b'auto-linked,&nbsp;too:<br>\n<a href="http://google.com">'
b'http://google.com</a>.</tt></dd></dl>'), response)
@unittest.expectedFailure # TODO: RUSTPYTHON; http.client.RemoteDisconnected: Remote end closed connection without response
@make_request_and_skipIf(sys.flags.optimize >= 2,
"Docstrings are omitted with -O2 and above")
def test_system_methods(self):
@@ -190,7 +184,6 @@ class DocXMLRPCHTTPGETServer(unittest.TestCase):
b'<br>\nThis&nbsp;server&nbsp;does&nbsp;NOT&nbsp;support&nbsp;system'
b'.methodSignature.</tt></dd></dl>'), response)
@unittest.expectedFailure # TODO: RUSTPYTHON; http.client.RemoteDisconnected: Remote end closed connection without response
def test_autolink_dotted_methods(self):
"""Test that selfdot values are made strong automatically in the
documentation."""
@@ -200,7 +193,6 @@ class DocXMLRPCHTTPGETServer(unittest.TestCase):
self.assertIn(b"""Try&nbsp;self.<strong>add</strong>,&nbsp;too.""",
response.read())
@unittest.expectedFailure # TODO: RUSTPYTHON; http.client.RemoteDisconnected: Remote end closed connection without response
def test_annotations(self):
""" Test that annotations works as expected """
self.client.request("GET", "/")
@@ -214,7 +206,6 @@ class DocXMLRPCHTTPGETServer(unittest.TestCase):
b'method_annotation</strong></a>(x: bytes)</dt></dl>'),
response.read())
@unittest.expectedFailure # TODO: RUSTPYTHON; TypeError: HTMLDoc.heading() missing 2 required positional arguments: "fgcol" and "bgcol"
def test_server_title_escape(self):
# bpo-38243: Ensure that the server title and documentation
# are escaped for HTML.
-1
View File
@@ -5042,7 +5042,6 @@ class TestStdLib(unittest.TestCase):
MAGENTA = 2
YELLOW = 3
@unittest.expectedFailure # TODO: RUSTPYTHON; | is a read-only view of the internal mapping.
def test_pydoc(self):
# indirectly test __objclass__
if StrEnum.__doc__ is None:
+6
View File
@@ -0,0 +1,6 @@
import os
from test import support
def load_tests(*args):
return support.load_package_tests(os.path.dirname(__file__), *args)
+8
View File
@@ -0,0 +1,8 @@
def func():
pass
func.__module__ = None
class A:
def method(self):
pass
method.__module__ = None
+51
View File
@@ -0,0 +1,51 @@
"""This is a test module for test_pydoc"""
from __future__ import print_function
import types
import typing
__author__ = "Benjamin Peterson"
__credits__ = "Nobody"
__version__ = "1.2.3.4"
__xyz__ = "X, Y and Z"
class A:
"""Hello and goodbye"""
def __init__():
"""Wow, I have no function!"""
pass
class B(object):
NO_MEANING: str = "eggs"
pass
class C(object):
def say_no(self):
return "no"
def get_answer(self):
""" Return say_no() """
return self.say_no()
def is_it_true(self):
""" Return self.get_answer() """
return self.get_answer()
def __class_getitem__(self, item):
return types.GenericAlias(self, item)
def doc_func():
"""
This function solves all of the world's problems:
hunger
lack of Python
war
"""
def nodoc_func():
pass
list_alias1 = typing.List[int]
list_alias2 = list[int]
c_alias = C[int]
type_union1 = typing.Union[int, str]
type_union2 = int | str
+191
View File
@@ -0,0 +1,191 @@
"""Something just to look at via pydoc."""
import types
def global_func(x, y):
"""Module global function"""
def global_func2(x, y):
"""Module global function 2"""
class A:
"A class."
def A_method(self):
"Method defined in A."
def AB_method(self):
"Method defined in A and B."
def AC_method(self):
"Method defined in A and C."
def AD_method(self):
"Method defined in A and D."
def ABC_method(self):
"Method defined in A, B and C."
def ABD_method(self):
"Method defined in A, B and D."
def ACD_method(self):
"Method defined in A, C and D."
def ABCD_method(self):
"Method defined in A, B, C and D."
def A_classmethod(cls, x):
"A class method defined in A."
A_classmethod = classmethod(A_classmethod)
def A_staticmethod(x, y):
"A static method defined in A."
A_staticmethod = staticmethod(A_staticmethod)
def _getx(self):
"A property getter function."
def _setx(self, value):
"A property setter function."
def _delx(self):
"A property deleter function."
A_property = property(fdel=_delx, fget=_getx, fset=_setx,
doc="A sample property defined in A.")
A_int_alias = int
class B(A):
"A class, derived from A."
def AB_method(self):
"Method defined in A and B."
def ABC_method(self):
"Method defined in A, B and C."
def ABD_method(self):
"Method defined in A, B and D."
def ABCD_method(self):
"Method defined in A, B, C and D."
def B_method(self):
"Method defined in B."
def BC_method(self):
"Method defined in B and C."
def BD_method(self):
"Method defined in B and D."
def BCD_method(self):
"Method defined in B, C and D."
@classmethod
def B_classmethod(cls, x):
"A class method defined in B."
global_func = global_func # same name
global_func_alias = global_func
global_func2_alias = global_func2
B_classmethod_alias = B_classmethod
A_classmethod_ref = A.A_classmethod
A_staticmethod = A.A_staticmethod # same name
A_staticmethod_alias = A.A_staticmethod
A_method_ref = A().A_method
A_method_alias = A.A_method
B_method_alias = B_method
count = list.count # same name
list_count = list.count
__repr__ = object.__repr__ # same name
object_repr = object.__repr__
get = {}.get # same name
dict_get = {}.get
from math import sin
B.B_classmethod_ref = B.B_classmethod
class C(A):
"A class, derived from A."
def AC_method(self):
"Method defined in A and C."
def ABC_method(self):
"Method defined in A, B and C."
def ACD_method(self):
"Method defined in A, C and D."
def ABCD_method(self):
"Method defined in A, B, C and D."
def BC_method(self):
"Method defined in B and C."
def BCD_method(self):
"Method defined in B, C and D."
def C_method(self):
"Method defined in C."
def CD_method(self):
"Method defined in C and D."
class D(B, C):
"""A class, derived from B and C.
"""
def AD_method(self):
"Method defined in A and D."
def ABD_method(self):
"Method defined in A, B and D."
def ACD_method(self):
"Method defined in A, C and D."
def ABCD_method(self):
"Method defined in A, B, C and D."
def BD_method(self):
"Method defined in B and D."
def BCD_method(self):
"Method defined in B, C and D."
def CD_method(self):
"Method defined in C and D."
def D_method(self):
"Method defined in D."
class FunkyProperties(object):
"""From SF bug 472347, by Roeland Rengelink.
Property getters etc may not be vanilla functions or methods,
and this used to make GUI pydoc blow up.
"""
def __init__(self):
self.desc = {'x':0}
class get_desc:
def __init__(self, attr):
self.attr = attr
def __call__(self, inst):
print('Get called', self, inst)
return inst.desc[self.attr]
class set_desc:
def __init__(self, attr):
self.attr = attr
def __call__(self, inst, val):
print('Set called', self, inst, val)
inst.desc[self.attr] = val
class del_desc:
def __init__(self, attr):
self.attr = attr
def __call__(self, inst):
print('Del called', self, inst)
del inst.desc[self.attr]
x = property(get_desc('x'), set_desc('x'), del_desc('x'), 'prop x')
submodule = types.ModuleType(__name__ + '.submodule',
"""A submodule, which should appear in its parent's summary""")
global_func_alias = global_func
A_classmethod = A.A_classmethod # same name
A_classmethod2 = A.A_classmethod
A_classmethod3 = B.A_classmethod
A_staticmethod = A.A_staticmethod # same name
A_staticmethod_alias = A.A_staticmethod
A_staticmethod_ref = A().A_staticmethod
A_staticmethod_ref2 = B().A_staticmethod
A_method = A().A_method # same name
A_method2 = A().A_method
A_method3 = B().A_method
B_method = B.B_method # same name
B_method2 = B.B_method
count = list.count # same name
list_count = list.count
__repr__ = object.__repr__ # same name
object_repr = object.__repr__
get = {}.get # same name
dict_get = {}.get
from math import sin # noqa: F401
+2459
View File
File diff suppressed because it is too large. Load diff